diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index e852afd67..6ffa65703 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,21 +1,20 @@ - - + + - + +## What was changed + - ## What was changed - +## Why? + - ## Why? - +## Checklist - ## Checklist - - - Issue # - - Tested +- Issue # +- Tested - [ ] Tested manually - [ ] Tests added - - [ ] Documentation +- [ ] Documentation diff --git a/composer.json b/composer.json index d8153de7c..b47c42d26 100644 --- a/composer.json +++ b/composer.json @@ -27,21 +27,21 @@ "illuminate/contracts": "^10|^11", "illuminate/support": "^10|^11", "illuminate/view": "^10|^11", - "lee-to/fast-attributes": "^0.1.0", + "lee-to/fast-attributes": "^0.1", "lee-to/laravel-package-command": "^0.9", - "nyholm/psr7": "^1", + "nyholm/psr7": "^1.8", "php": "^8.2", - "symfony/psr-http-message-bridge": "^7" + "symfony/psr-http-message-bridge": "^7.2" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^3.64", + "larastan/larastan": "^2.0", "moonshine/import-export": "^1.0", "orchestra/testbench": "^9.0", "pestphp/pest": "^3.0", "pestphp/pest-plugin-laravel": "^3.0", "rector/rector": "^1.0", - "symplify/monorepo-builder": "^11.2", - "larastan/larastan": "^2.0", - "friendsofphp/php-cs-fixer": "^3.64" + "symplify/monorepo-builder": "^11.2" }, "replace": { "moonshine/asset-manager": "self.version", @@ -102,6 +102,7 @@ "composer install", "vendor/bin/pest --bail" ], - "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes" + "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes", + "monorepo:merge": "vendor/bin/monorepo-builder merge" } } diff --git a/src/Laravel/composer.json b/src/Laravel/composer.json index db1c391bb..e495ed4c4 100644 --- a/src/Laravel/composer.json +++ b/src/Laravel/composer.json @@ -24,9 +24,9 @@ "ext-curl": "*", "ext-json": "*", "lee-to/laravel-package-command": "^0.9", - "lee-to/fast-attributes": "^0.1.0", - "symfony/psr-http-message-bridge": "^7", - "nyholm/psr7": "^1", + "lee-to/fast-attributes": "^0.1", + "symfony/psr-http-message-bridge": "^7.2", + "nyholm/psr7": "^1.8", "moonshine/contracts": "^3.0", "moonshine/asset-manager": "^3.0", "moonshine/color-manager": "^3.0", diff --git a/src/Laravel/src/Commands/InstallCommand.php b/src/Laravel/src/Commands/InstallCommand.php index be9f9c665..6bd569b01 100644 --- a/src/Laravel/src/Commands/InstallCommand.php +++ b/src/Laravel/src/Commands/InstallCommand.php @@ -72,7 +72,7 @@ public function handle(): int } if (! $this->testsMode) { - confirm('Can you quickly star our GitHub repository? 🙏🏻', true); + confirm('Can you quickly star our GitHub repository? 🙏🏻'); $this->components->bulletList([ 'Star or contribute to MoonShine: https://github.com/moonshine-software/moonshine', @@ -259,7 +259,7 @@ protected function initDirectories(): void ); } - $this->makeDir($this->getDirectory() . '/Resources'); + $this->makeDir($this->getDirectory('/Resources')); $this->components->task('Resources directory created'); } @@ -283,10 +283,14 @@ protected function initDashboard(): void $this->components->task('Dashboard created'); } - protected function initLayout(): void { - $compact = $this->confirmAction('Want to use a minimalist theme?', skipOption: 'default-layout', autoEnable: $this->testsMode, default: false); + $compact = $this->confirmAction( + 'Want to use a minimalist theme?', + skipOption: 'default-layout', + autoEnable: $this->testsMode, + default: false, + ); $this->call(MakeLayoutCommand::class, [ 'className' => 'MoonShineLayout', @@ -323,7 +327,10 @@ private function confirmAction( private function registerServiceProvider(): void { - if (method_exists(ServiceProvider::class, 'addProviderToBootstrapFile') && file_exists(base_path('bootstrap/app.php'))) { + if ( + method_exists(ServiceProvider::class, 'addProviderToBootstrapFile') + && file_exists(base_path('bootstrap/app.php')) + ) { // @phpstan-ignore-next-line ServiceProvider::addProviderToBootstrapFile(\App\Providers\MoonShineServiceProvider::class); diff --git a/src/Laravel/src/Commands/MakeApplyCommand.php b/src/Laravel/src/Commands/MakeApplyCommand.php index ba65fdc02..fa5b8d7cf 100644 --- a/src/Laravel/src/Commands/MakeApplyCommand.php +++ b/src/Laravel/src/Commands/MakeApplyCommand.php @@ -6,8 +6,7 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException; -use function Laravel\Prompts\outro; -use function Laravel\Prompts\text; +use function Laravel\Prompts\{outro, text}; use Symfony\Component\Console\Attribute\AsCommand; @@ -28,11 +27,10 @@ public function handle(): int required: true ); - $apply = $this->getDirectory() . "/Applies/$className.php"; + $appliesDir = $this->getDirectory('/Applies'); + $apply = "$appliesDir/$className.php"; - if (! is_dir($this->getDirectory() . '/Applies')) { - $this->makeDir($this->getDirectory() . '/Applies'); - } + $this->makeDir($appliesDir); $this->copyStub('Apply', $apply, [ '{namespace}' => moonshineConfig()->getNamespace('\Applies'), @@ -40,11 +38,7 @@ public function handle(): int ]); outro( - "$className was created: " . str_replace( - base_path(), - '', - $apply - ) + "$className was created: " . $this->getRelativePath($apply) ); return self::SUCCESS; diff --git a/src/Laravel/src/Commands/MakeComponentCommand.php b/src/Laravel/src/Commands/MakeComponentCommand.php index 5dc988764..b6a5bf0eb 100644 --- a/src/Laravel/src/Commands/MakeComponentCommand.php +++ b/src/Laravel/src/Commands/MakeComponentCommand.php @@ -6,8 +6,7 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException; -use function Laravel\Prompts\outro; -use function Laravel\Prompts\text; +use function Laravel\Prompts\{outro, text}; use Symfony\Component\Console\Attribute\AsCommand; @@ -41,42 +40,33 @@ public function handle(): int required: true ); - $component = $this->getDirectory() . "/Components/$className.php"; + $componentsDir = $this->getDirectory('/Components'); + $componentPath = "$componentsDir/$className.php"; - if (! is_dir($this->getDirectory() . '/Components')) { - $this->makeDir($this->getDirectory() . '/Components'); - } + $this->makeDir($componentsDir); $view = str_replace('.blade.php', '', $view); $viewPath = resource_path('views/' . str_replace('.', DIRECTORY_SEPARATOR, $view)); $viewPath .= '.blade.php'; - if (! is_dir(\dirname($viewPath))) { - $this->makeDir(\dirname($viewPath)); - } + $this->makeDir( + \dirname($viewPath) + ); $this->copyStub('view', $viewPath); - $this->copyStub('Component', $component, [ + $this->copyStub('Component', $componentPath, [ '{namespace}' => moonshineConfig()->getNamespace('\Components'), '{view}' => $view, 'DummyClass' => $className, ]); outro( - "$className was created: " . str_replace( - base_path(), - '', - $component - ) + "$className was created: " . $this->getRelativePath($componentPath) ); outro( - "View was created: " . str_replace( - base_path(), - '', - $viewPath - ) + "View was created: " . $this->getRelativePath($viewPath) ); return self::SUCCESS; diff --git a/src/Laravel/src/Commands/MakeControllerCommand.php b/src/Laravel/src/Commands/MakeControllerCommand.php index 08400eb2b..0723a11b8 100644 --- a/src/Laravel/src/Commands/MakeControllerCommand.php +++ b/src/Laravel/src/Commands/MakeControllerCommand.php @@ -6,15 +6,14 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException; -use function Laravel\Prompts\outro; -use function Laravel\Prompts\text; +use function Laravel\Prompts\{outro, text}; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand(name: 'moonshine:controller')] class MakeControllerCommand extends MoonShineCommand { - protected $signature = 'moonshine:controller {className?}'; + protected $signature = 'moonshine:controller {name?}'; protected $description = 'Create controller'; @@ -23,28 +22,23 @@ class MakeControllerCommand extends MoonShineCommand */ public function handle(): int { - $className = $this->argument('className') ?? text( + $name = $this->argument('name') ?? text( 'Class name', required: true ); - $controller = $this->getDirectory() . "/Controllers/$className.php"; + $controllersDir = $this->getDirectory('/Controllers'); + $controllerPath = "$controllersDir/$name.php"; - if (! is_dir($this->getDirectory() . '/Controllers')) { - $this->makeDir($this->getDirectory() . '/Controllers'); - } + $this->makeDir($controllersDir); - $this->copyStub('Controller', $controller, [ + $this->copyStub('Controller', $controllerPath, [ '{namespace}' => moonshineConfig()->getNamespace('\Controllers'), - 'DummyClass' => $className, + 'DummyClass' => $name, ]); outro( - "$className was created: " . str_replace( - base_path(), - '', - $controller - ) + "$name was created: " . $this->getRelativePath($controllerPath) ); return self::SUCCESS; diff --git a/src/Laravel/src/Commands/MakeFieldCommand.php b/src/Laravel/src/Commands/MakeFieldCommand.php index 6f61c9c6d..971f9a62d 100644 --- a/src/Laravel/src/Commands/MakeFieldCommand.php +++ b/src/Laravel/src/Commands/MakeFieldCommand.php @@ -7,9 +7,7 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException; use Illuminate\Support\Facades\File; -use function Laravel\Prompts\outro; -use function Laravel\Prompts\select; -use function Laravel\Prompts\text; +use function Laravel\Prompts\{outro, select, text}; use MoonShine\UI\Fields\Field; use Symfony\Component\Console\Attribute\AsCommand; @@ -61,13 +59,12 @@ public function handle(): int Field::class ); - $field = $this->getDirectory() . "/Fields/$className.php"; + $fieldsDir = $this->getDirectory('/Fields'); + $fieldPath = "$fieldsDir/$className.php"; - if (! is_dir($this->getDirectory() . '/Fields')) { - $this->makeDir($this->getDirectory() . '/Fields'); - } + $this->makeDir($fieldsDir); - $this->copyStub('Field', $field, [ + $this->copyStub('Field', $fieldPath, [ '{namespace}' => moonshineConfig()->getNamespace('\Fields'), '{view}' => $view, '{extend}' => $extends, @@ -79,26 +76,18 @@ public function handle(): int $viewPath = resource_path('views/' . str_replace('.', DIRECTORY_SEPARATOR, $view)); $viewPath .= '.blade.php'; - if (! is_dir(\dirname($viewPath))) { - $this->makeDir(\dirname($viewPath)); - } + $this->makeDir( + \dirname($viewPath) + ); $this->copyStub('view', $viewPath); outro( - "$className was created: " . str_replace( - base_path(), - '', - $field - ) + "$className was created: " . $this->getRelativePath($fieldPath) ); outro( - "View was created: " . str_replace( - base_path(), - '', - $viewPath - ) + "View was created: " . $this->getRelativePath($viewPath) ); return self::SUCCESS; diff --git a/src/Laravel/src/Commands/MakeHandlerCommand.php b/src/Laravel/src/Commands/MakeHandlerCommand.php index 83a52aa76..6c2e08031 100644 --- a/src/Laravel/src/Commands/MakeHandlerCommand.php +++ b/src/Laravel/src/Commands/MakeHandlerCommand.php @@ -27,23 +27,18 @@ public function handle(): int required: true ); - $path = $this->getDirectory() . "/Handlers/$className.php"; + $handlersDir = $this->getDirectory() . '/Handlers'; + $handlerPath = "$handlersDir/$className.php"; - if (! is_dir($this->getDirectory() . '/Handlers')) { - $this->makeDir($this->getDirectory() . '/Handlers'); - } + $this->makeDir($handlersDir); - $this->copyStub('Handler', $path, [ + $this->copyStub('Handler', $handlerPath, [ '{namespace}' => moonshineConfig()->getNamespace('\Handlers'), 'DummyHandler' => $className, ]); outro( - "$className was created: " . str_replace( - base_path(), - '', - $path - ) + "$className was created: " . $this->getRelativePath($handlerPath) ); return self::SUCCESS; diff --git a/src/Laravel/src/Commands/MakeLayoutCommand.php b/src/Laravel/src/Commands/MakeLayoutCommand.php index 592a26e05..5a0cbbbed 100644 --- a/src/Laravel/src/Commands/MakeLayoutCommand.php +++ b/src/Laravel/src/Commands/MakeLayoutCommand.php @@ -6,9 +6,7 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException; -use function Laravel\Prompts\confirm; -use function Laravel\Prompts\outro; -use function Laravel\Prompts\text; +use function Laravel\Prompts\{confirm, outro, text}; use Symfony\Component\Console\Attribute\AsCommand; @@ -36,18 +34,17 @@ public function handle(): int $dir = 'Layouts'; } - $layout = $this->getDirectory() . "/$dir/$className.php"; + $layoutsDir = $this->getDirectory() . "/$dir"; + $layoutPath = "$layoutsDir/$className.php"; - if (! is_dir($this->getDirectory() . "/$dir")) { - $this->makeDir($this->getDirectory() . "/$dir"); - } + $this->makeDir($layoutsDir); $compact = ! $this->option('full') && ($this->option('compact') || confirm('Want to use a minimalist theme?')); $extendClassName = $compact ? 'CompactLayout' : 'AppLayout'; $extends = "MoonShine\Laravel\Layouts\\$extendClassName"; - $this->copyStub('Layout', $layout, [ + $this->copyStub('Layout', $layoutPath, [ '{namespace}' => moonshineConfig()->getNamespace('\\' . str_replace('/', '\\', $dir)), '{extend}' => $extends, '{extendShort}' => class_basename($extends), @@ -55,11 +52,7 @@ public function handle(): int ]); outro( - "$className was created: " . str_replace( - base_path(), - '', - $layout - ) + "$className was created: " . $this->getRelativePath($layoutPath) ); if ($this->option('default') || confirm('Use the default template in the system?')) { diff --git a/src/Laravel/src/Commands/MakePageCommand.php b/src/Laravel/src/Commands/MakePageCommand.php index ea66c7537..ec208604c 100644 --- a/src/Laravel/src/Commands/MakePageCommand.php +++ b/src/Laravel/src/Commands/MakePageCommand.php @@ -6,9 +6,7 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException; -use function Laravel\Prompts\outro; -use function Laravel\Prompts\select; -use function Laravel\Prompts\text; +use function Laravel\Prompts\{outro, select, text}; use Symfony\Component\Console\Attribute\AsCommand; @@ -85,13 +83,12 @@ private function makePage( $dir = \is_null($dir) ? 'Pages' : $dir; $extends = $extends === null || $extends === '' || $extends === '0' ? 'Page' : $extends; - $page = $this->getDirectory() . "/$dir/$className.php"; + $pagesDir = $this->getDirectory("/$dir"); + $pagePath = "$pagesDir/$className.php"; - if (! is_dir($this->getDirectory() . "/$dir")) { - $this->makeDir($this->getDirectory() . "/$dir"); - } + $this->makeDir($pagesDir); - $this->copyStub($stub, $page, [ + $this->copyStub($stub, $pagePath, [ '{namespace}' => moonshineConfig()->getNamespace('\\' . str_replace('/', '\\', $dir)), 'DummyPage' => $className, 'DummyTitle' => $className, @@ -99,11 +96,7 @@ private function makePage( ]); outro( - "$className was created: " . str_replace( - base_path(), - '', - $page - ) + "$className was created: " . $this->getRelativePath($pagePath) ); if (! $this->option('without-register')) { diff --git a/src/Laravel/src/Commands/MakePolicyCommand.php b/src/Laravel/src/Commands/MakePolicyCommand.php index 3862adffe..190e915e8 100644 --- a/src/Laravel/src/Commands/MakePolicyCommand.php +++ b/src/Laravel/src/Commands/MakePolicyCommand.php @@ -6,8 +6,7 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException; -use function Laravel\Prompts\outro; -use function Laravel\Prompts\suggest; +use function Laravel\Prompts\{outro, suggest}; use MoonShine\Laravel\MoonShineAuth; use Symfony\Component\Console\Attribute\AsCommand; @@ -27,24 +26,29 @@ public function handle(): int { $modelPath = is_dir(app_path('Models')) ? app_path('Models') : app_path(); - $className = suggest( - 'Model', - collect((new Finder())->files()->depth(0)->in($modelPath)) + $className = $this->argument('className') ?? suggest( + label: 'Model', + options: collect((new Finder())->files()->depth(0)->in($modelPath)) ->map(static fn ($file) => $file->getBasename('.php')) ->values() - ->all() + ->all(), + required: true, ); + $className = str($className) + ->ucfirst() + ->remove('policy', false) + ->value(); + $model = $this->qualifyModel($className); - $className = class_basename($model) . "Policy"; + $className = class_basename($model) . 'Policy'; - $path = app_path("/Policies/$className.php"); + $policiesDir = app_path('/Policies'); + $policyPath = "$policiesDir/$className.php"; - if (! is_dir(app_path('/Policies'))) { - $this->makeDir(app_path('/Policies')); - } + $this->makeDir($policiesDir); - $this->copyStub('Policy', $path, [ + $this->copyStub('Policy', $policyPath, [ 'DummyClass' => $className, '{model-namespace}' => $model, '{model}' => class_basename($model), @@ -53,11 +57,7 @@ public function handle(): int ]); outro( - "$className was created: " . str_replace( - base_path(), - '', - $path - ) + "$className was created: " . $this->getRelativePath($policyPath) ); return self::SUCCESS; diff --git a/src/Laravel/src/Commands/MakeResourceCommand.php b/src/Laravel/src/Commands/MakeResourceCommand.php index ccb887908..23fb46096 100644 --- a/src/Laravel/src/Commands/MakeResourceCommand.php +++ b/src/Laravel/src/Commands/MakeResourceCommand.php @@ -22,31 +22,24 @@ class MakeResourceCommand extends MoonShineCommand */ public function handle(): int { - $name = str( - text( - 'Name', - 'ArticleResource', - $this->argument('name') ?? '', - required: true, - ) + $name = $this->argument('name') ?? text( + 'Resource name', + 'ArticleResource', + required: true, ); - $dir = $name->ucfirst() - ->remove('Resource', false) - ->value(); - - $name = $name->ucfirst() - ->replace(['resource', 'Resource'], '') + $name = str($name) + ->ucfirst() + ->remove('resource', false) ->value(); $model = $this->qualifyModel($this->option('model') ?? $name); $title = $this->option('title') ?? str($name)->singular()->plural()->value(); + $resourcesDir = $this->getDirectory('/Resources'); - $resource = $this->getDirectory() . "/Resources/{$name}Resource.php"; + $resource = "$resourcesDir/{$name}Resource.php"; - if (! is_dir($this->getDirectory() . "/Resources")) { - $this->makeDir($this->getDirectory() . "/Resources"); - } + $this->makeDir($resourcesDir); $stub = select('Resource type', [ 'ModelResourceDefault' => 'Default model resource', @@ -54,7 +47,7 @@ public function handle(): int 'Resource' => 'Empty resource', ], 'ModelResourceDefault'); - $replaceData = [ + $replace = [ '{namespace}' => moonshineConfig()->getNamespace('\Resources'), '{model-namespace}' => $model, '{model}' => class_basename($model), @@ -64,44 +57,36 @@ public function handle(): int if ($this->option('test') || $this->option('pest')) { $testStub = $this->option('pest') ? 'pest' : 'test'; - $testPath = base_path('tests/Feature/') . $name . 'ResourceTest.php'; + $testPath = base_path("tests/Feature/{$name}ResourceTest.php"); - $this->copyStub($testStub, $testPath, $replaceData); + $this->copyStub($testStub, $testPath, $replace); info('Test file was created'); } if ($stub === 'ModelResourceWithPages') { - $pageDir = "Pages/$dir"; - $this->call(MakePageCommand::class, [ 'className' => $name, '--crud' => true, '--without-register' => true, ]); - $pageNamespace = static fn (string $name): string => moonshineConfig()->getNamespace( - str_replace('/', '\\', "\\$pageDir\\$dir$name") - ); - - $replaceData = [ - '{indexPage}' => "{$dir}IndexPage", - '{formPage}' => "{$dir}FormPage", - '{detailPage}' => "{$dir}DetailPage", - '{index-page-namespace}' => $pageNamespace('IndexPage'), - '{form-page-namespace}' => $pageNamespace('FormPage'), - '{detail-page-namespace}' => $pageNamespace('DetailPage'), - ] + $replaceData; + $pageNamespace = moonshineConfig()->getNamespace("\Pages\\$name\\$name"); + + $replace += [ + '{indexPage}' => "{$name}IndexPage", + '{formPage}' => "{$name}FormPage", + '{detailPage}' => "{$name}DetailPage", + '{index-page-namespace}' => "{$pageNamespace}IndexPage", + '{form-page-namespace}' => "{$pageNamespace}FormPage", + '{detail-page-namespace}' => "{$pageNamespace}DetailPage", + ]; } - $this->copyStub($stub, $resource, $replaceData); + $this->copyStub($stub, $resource, $replace); info( - "{$name}Resource file was created: " . str_replace( - base_path(), - '', - $resource - ) + "{$name}Resource file was created: " . $this->getRelativePath($resource) ); self::addResourceOrPageToProviderFile( diff --git a/src/Laravel/src/Commands/MakeTypeCastCommand.php b/src/Laravel/src/Commands/MakeTypeCastCommand.php index 74e8d79cd..09b599f05 100644 --- a/src/Laravel/src/Commands/MakeTypeCastCommand.php +++ b/src/Laravel/src/Commands/MakeTypeCastCommand.php @@ -27,23 +27,18 @@ public function handle(): int required: true ); - $path = $this->getDirectory() . "/TypeCasts/$className.php"; + $typeCastsDir = $this->getDirectory('/TypeCasts'); + $typeCastPath = "$typeCastsDir/$className.php"; - if (! is_dir($this->getDirectory() . '/TypeCasts')) { - $this->makeDir($this->getDirectory() . '/TypeCasts'); - } + $this->makeDir($typeCastsDir); - $this->copyStub('TypeCast', $path, [ + $this->copyStub('TypeCast', $typeCastPath, [ '{namespace}' => moonshineConfig()->getNamespace('\TypeCasts'), 'DummyCast' => $className, ]); outro( - "$className was created: " . str_replace( - base_path(), - '', - $path - ) + "$className was created: " . $this->getRelativePath($typeCastPath) ); return self::SUCCESS; diff --git a/src/Laravel/src/Commands/MakeUserCommand.php b/src/Laravel/src/Commands/MakeUserCommand.php index e6ddab100..95df9efdd 100644 --- a/src/Laravel/src/Commands/MakeUserCommand.php +++ b/src/Laravel/src/Commands/MakeUserCommand.php @@ -26,7 +26,7 @@ public function handle(): int $password = $this->option('password') ?? password('Password'); if ($username && $name && $password) { - MoonShineAuth::getModel()->query()->create([ + MoonShineAuth::getModel()::query()->create([ moonshineConfig()->getUserField('username', 'email') => $username, moonshineConfig()->getUserField('name') => $name, moonshineConfig()->getUserField('password') => Hash::make($password), @@ -53,8 +53,7 @@ private function uniqueUsername(): string required: true ); - $exists = MoonShineAuth::getModel() - ->query() + $exists = MoonShineAuth::getModel()::query() ->where( moonshineConfig()->getUserField('username', 'email'), $username, diff --git a/src/Laravel/src/Commands/MoonShineCommand.php b/src/Laravel/src/Commands/MoonShineCommand.php index 899884af4..f4c90bdfc 100644 --- a/src/Laravel/src/Commands/MoonShineCommand.php +++ b/src/Laravel/src/Commands/MoonShineCommand.php @@ -13,9 +13,14 @@ abstract class MoonShineCommand extends Command { protected string $stubsDir = __DIR__ . '/../../stubs'; - protected function getDirectory(): string + protected function getDirectory(string $path = ''): string { - return moonshineConfig()->getDir(); + return moonshineConfig()->getDir($path); + } + + protected function getRelativePath(string $path): string + { + return str_replace(base_path(), '', $path); } public static function addResourceOrPageToProviderFile(string $class, bool $page = false, string $prefix = ''): void @@ -38,7 +43,7 @@ class: $prefix . $class, to: app_path('MoonShine/Layouts/MoonShineLayout.php'), isPage: $page, between: static fn (Stringable $content): Stringable => $content->betweenFirst("protected function menu(): array", '}'), - replace: static fn (Stringable $content, Closure $tab): Stringable => $content->replace("];", "{$tab()}MenuItem::make('{$title}', $class::class),\n{$tab(2)}];"), + replace: static fn (Stringable $content, Closure $tab): Stringable => $content->replace("];", "{$tab()}MenuItem::make('$title', $class::class),\n{$tab(2)}];"), use: MenuItem::class, ); } diff --git a/src/Laravel/src/Commands/PublishCommand.php b/src/Laravel/src/Commands/PublishCommand.php index af33abd26..53365cebc 100644 --- a/src/Laravel/src/Commands/PublishCommand.php +++ b/src/Laravel/src/Commands/PublishCommand.php @@ -151,9 +151,7 @@ private function publishForms(): void private function publishSystemForm(string $className, string $configKey): void { - if (! is_dir($this->getDirectory() . "/Forms")) { - $this->makeDir($this->getDirectory() . "/Forms"); - } + $this->makeDir($this->getDirectory('/Forms')); $this->copySystemClass($className, 'Forms'); @@ -192,9 +190,7 @@ private function publishPages(): void private function publishSystemPage(string $className, string $configKey): void { - if (! is_dir($this->getDirectory() . "/Pages")) { - $this->makeDir($this->getDirectory() . "/Pages"); - } + $this->makeDir($this->getDirectory('/Pages')); $copyInfo = $this->copySystemClass($className, 'Pages'); diff --git a/src/Laravel/src/Fields/Relationships/BelongsToMany.php b/src/Laravel/src/Fields/Relationships/BelongsToMany.php index 89ecad934..a1b3cd0e2 100644 --- a/src/Laravel/src/Fields/Relationships/BelongsToMany.php +++ b/src/Laravel/src/Fields/Relationships/BelongsToMany.php @@ -262,7 +262,9 @@ protected function resolveValue(): mixed return $this->getKeys(); } - return ($this->memoizeValues ?? $this->resolveValuesQuery()->get())->map(function ($value) { + $values = $this->memoizeValues ?? ($this->isAsyncSearch() ? $this->toValue() : $this->resolveValuesQuery()->get()); + + return $values->map(function ($value) { if (! $this->isValueWithModels()) { $data = $this->toValue(); diff --git a/src/Laravel/src/Fields/Relationships/ModelRelationField.php b/src/Laravel/src/Fields/Relationships/ModelRelationField.php index a1c9f54de..e21233d89 100644 --- a/src/Laravel/src/Fields/Relationships/ModelRelationField.php +++ b/src/Laravel/src/Fields/Relationships/ModelRelationField.php @@ -15,6 +15,7 @@ use Illuminate\Support\Stringable; use MoonShine\Contracts\Core\HasResourceContract; use MoonShine\Contracts\Core\TypeCasts\DataWrapperContract; +use MoonShine\Contracts\UI\HasFieldsContract; use MoonShine\Core\Traits\HasResource; use MoonShine\Laravel\Resources\ModelResource; use MoonShine\UI\Exceptions\FieldException; @@ -86,6 +87,11 @@ public function __construct( } else { $this->setResource($resource); } + + // required to create field entities and load assets + if ($this instanceof HasFieldsContract && ! $this->isMorph()) { + $this->getResource()?->getFormFields(); + } } /** diff --git a/src/Laravel/src/Fields/Relationships/RelationRepeater.php b/src/Laravel/src/Fields/Relationships/RelationRepeater.php index 302fec4f6..36dd97f4a 100644 --- a/src/Laravel/src/Fields/Relationships/RelationRepeater.php +++ b/src/Laravel/src/Fields/Relationships/RelationRepeater.php @@ -10,12 +10,15 @@ use Illuminate\Support\Collection; use MoonShine\Contracts\Core\DependencyInjection\FieldsContract; use MoonShine\Contracts\UI\ActionButtonContract; +use MoonShine\Contracts\UI\ComponentContract; use MoonShine\Contracts\UI\FieldContract; use MoonShine\Contracts\UI\HasFieldsContract; use MoonShine\Contracts\UI\TableBuilderContract; use MoonShine\Laravel\Collections\Fields; use MoonShine\Laravel\Resources\ModelResource; use MoonShine\UI\Components\ActionButton; +use MoonShine\UI\Components\Layout\Column; +use MoonShine\UI\Components\Layout\Div; use MoonShine\UI\Components\Table\TableBuilder; use MoonShine\UI\Contracts\DefaultValueTypes\CanBeArray; use MoonShine\UI\Contracts\DefaultValueTypes\CanBeObject; @@ -61,8 +64,6 @@ class RelationRepeater extends ModelRelationField implements protected array $buttons = []; - protected bool $deleteWhenEmpty = false; - protected ?Closure $modifyTable = null; protected ?Closure $modifyRemoveButton = null; @@ -206,24 +207,19 @@ protected function isBlankValue(): bool */ protected function resolveValue(): mixed { - $emptyRow = $this->getResource()?->getDataInstance(); - - // because the TableBuilder filters the values - if (blank($emptyRow)) { - $emptyRow = [null]; - } - $value = $this->isPreviewMode() ? $this->toFormattedValue() : $this->toValue(); - $values = is_iterable($value) - ? $value - : [$value ?? $emptyRow]; + $values = Collection::make( + is_iterable($value) + ? $value + : [] + ); - return collect($values)->when( + return $values->when( ! $this->isPreviewMode() && ! $this->isCreatable() && blank($values), - static fn ($values): Collection => $values->push($emptyRow) + static fn ($values): Collection => $values->push([null]) ); } @@ -245,7 +241,13 @@ protected function getComponent(): TableBuilder ->cast($this->getResource()?->getCaster()) ->when( $this->isVertical(), - fn (TableBuilderContract $table): TableBuilderContract => $table->vertical($this->verticalTitleSpan, $this->verticalValueSpan) + fn (TableBuilderContract $table): TableBuilderContract => $table->vertical( + title: fn (FieldContract $field, ComponentContract $default): Column => Column::make([ + Div::make([ + $field->getLabel(), + ]), + ])->columnSpan($this->verticalTitleSpan), + ) ) ->when( ! \is_null($this->modifyTable), @@ -362,18 +364,18 @@ private function saveRelation(array $items, mixed $model) static fn (Builder $q) => $q->whereNotIn( $relatedQualifiedKeyName, $ids - )->delete() - ); - - $model->{$relationName}()->when( - empty($ids) && $this->deleteWhenEmpty, + )->delete(), static fn (Builder $q) => $q->delete() ); - $items->each(static fn ($item) => $model->{$relationName}()->updateOrCreate( - [$relatedQualifiedKeyName => $item[$relatedKeyName] ?? null], - $item - )); + foreach ($items as $item) { + if (empty($item[$relatedKeyName])) { + unset($item[$relatedKeyName]); + $model->{$relationName}()->create($item); + } else { + $model->{$relationName}()->where($relatedKeyName, $item[$relatedKeyName])->update($item); + } + } return $model; } @@ -419,7 +421,7 @@ protected function viewData(): array fn (TableBuilderContract $table): TableBuilderContract => $table->creatable( limit: $this->getCreateLimit(), button: $this->getCreateButton() - ) + )->removeAfterClone() ) ->buttons($this->getButtons()) ->simple(), diff --git a/src/Laravel/src/Http/Requests/MoonShineFormRequest.php b/src/Laravel/src/Http/Requests/MoonShineFormRequest.php index e4afdb596..95cfaf1f2 100644 --- a/src/Laravel/src/Http/Requests/MoonShineFormRequest.php +++ b/src/Laravel/src/Http/Requests/MoonShineFormRequest.php @@ -36,7 +36,7 @@ public function messages(): array { if ($this->hasResource()) { return array_merge( - __('moonshine::validation'), + __('moonshine::validation') ?? [], $this->getResource()?->validationMessages() ?? [] ); } diff --git a/src/UI/dist/assets/app.js b/src/UI/dist/assets/app.js index 54da349f8..15cee3ca0 100644 --- a/src/UI/dist/assets/app.js +++ b/src/UI/dist/assets/app.js @@ -1,24 +1,24 @@ -(()=>{function Ta(e,t){return function(){return e.apply(t,arguments)}}const{toString:Qc}=Object.prototype,{getPrototypeOf:Lo}=Object,ci=(e=>t=>{const n=Qc.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ct=e=>(e=e.toLowerCase(),t=>ci(t)===e),ui=e=>t=>typeof t===e,{isArray:$n}=Array,ur=ui("undefined");function Zc(e){return e!==null&&!ur(e)&&e.constructor!==null&&!ur(e.constructor)&&ze(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Aa=ct("ArrayBuffer");function eu(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Aa(e.buffer),t}const tu=ui("string"),ze=ui("function"),Ca=ui("number"),fi=e=>e!==null&&typeof e=="object",nu=e=>e===!0||e===!1,Fr=e=>{if(ci(e)!=="object")return!1;const t=Lo(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ru=ct("Date"),iu=ct("File"),ou=ct("Blob"),su=ct("FileList"),au=e=>fi(e)&&ze(e.pipe),lu=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||ze(e.append)&&((t=ci(e))==="formdata"||t==="object"&&ze(e.toString)&&e.toString()==="[object FormData]"))},cu=ct("URLSearchParams"),[uu,fu,du,hu]=["ReadableStream","Request","Response","Headers"].map(ct),pu=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function pr(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),$n(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}const Zt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,xa=e=>!ur(e)&&e!==Zt;function Gi(){const{caseless:e}=xa(this)&&this||{},t={},n=(r,i)=>{const o=e&&Ia(t,i)||i;Fr(t[o])&&Fr(r)?t[o]=Gi(t[o],r):Fr(r)?t[o]=Gi({},r):$n(r)?t[o]=r.slice():t[o]=r};for(let r=0,i=arguments.length;r(pr(t,(i,o)=>{n&&ze(i)?e[o]=Ta(i,n):e[o]=i},{allOwnKeys:r}),e),gu=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),vu=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},yu=(e,t,n,r)=>{let i,o,a;const s={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)a=i[o],(!r||r(a,e,t))&&!s[a]&&(t[a]=e[a],s[a]=!0);e=n!==!1&&Lo(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},bu=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},_u=e=>{if(!e)return null;if($n(e))return e;let t=e.length;if(!Ca(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Eu=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Lo(Uint8Array)),wu=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=r.next())&&!i.done;){const o=i.value;t.call(e,o[0],o[1])}},Su=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ou=ct("HTMLFormElement"),Tu=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),bs=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Au=ct("RegExp"),Pa=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};pr(n,(i,o)=>{let a;(a=t(i,o,e))!==!1&&(r[o]=a||i)}),Object.defineProperties(e,r)},Cu=e=>{Pa(e,(t,n)=>{if(ze(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(ze(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Iu=(e,t)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return $n(e)?r(e):r(String(e).split(t)),n},xu=()=>{},Pu=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Ii="abcdefghijklmnopqrstuvwxyz",_s="0123456789",La={DIGIT:_s,ALPHA:Ii,ALPHA_DIGIT:Ii+Ii.toUpperCase()+_s},Lu=(e=16,t=La.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Du(e){return!!(e&&ze(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Ru=e=>{const t=new Array(10),n=(r,i)=>{if(fi(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[i]=r;const o=$n(r)?[]:{};return pr(r,(a,s)=>{const l=n(a,i+1);!ur(l)&&(o[s]=l)}),t[i]=void 0,o}}return r};return n(e,0)},Mu=ct("AsyncFunction"),Nu=e=>e&&(fi(e)||ze(e))&&ze(e.then)&&ze(e.catch),Da=((e,t)=>e?setImmediate:t?((n,r)=>(Zt.addEventListener("message",({source:i,data:o})=>{i===Zt&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Zt.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ze(Zt.postMessage)),$u=typeof queueMicrotask<"u"?queueMicrotask.bind(Zt):typeof process<"u"&&process.nextTick||Da,L={isArray:$n,isArrayBuffer:Aa,isBuffer:Zc,isFormData:lu,isArrayBufferView:eu,isString:tu,isNumber:Ca,isBoolean:nu,isObject:fi,isPlainObject:Fr,isReadableStream:uu,isRequest:fu,isResponse:du,isHeaders:hu,isUndefined:ur,isDate:ru,isFile:iu,isBlob:ou,isRegExp:Au,isFunction:ze,isStream:au,isURLSearchParams:cu,isTypedArray:Eu,isFileList:su,forEach:pr,merge:Gi,extend:mu,trim:pu,stripBOM:gu,inherits:vu,toFlatObject:yu,kindOf:ci,kindOfTest:ct,endsWith:bu,toArray:_u,forEachEntry:wu,matchAll:Su,isHTMLForm:Ou,hasOwnProperty:bs,hasOwnProp:bs,reduceDescriptors:Pa,freezeMethods:Cu,toObjectSet:Iu,toCamelCase:Tu,noop:xu,toFiniteNumber:Pu,findKey:Ia,global:Zt,isContextDefined:xa,ALPHABET:La,generateString:Lu,isSpecCompliantForm:Du,toJSONObject:Ru,isAsyncFn:Mu,isThenable:Nu,setImmediate:Da,asap:$u};function se(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}L.inherits(se,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:L.toJSONObject(this.config),code:this.code,status:this.status}}});const Ra=se.prototype,Ma={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ma[e]={value:e}});Object.defineProperties(se,Ma);Object.defineProperty(Ra,"isAxiosError",{value:!0});se.from=(e,t,n,r,i,o)=>{const a=Object.create(Ra);return L.toFlatObject(e,a,function(l){return l!==Error.prototype},s=>s!=="isAxiosError"),se.call(a,e.message,t,n,r,i),a.cause=e,a.name=e.name,o&&Object.assign(a,o),a};const ju=null;function Xi(e){return L.isPlainObject(e)||L.isArray(e)}function Na(e){return L.endsWith(e,"[]")?e.slice(0,-2):e}function Es(e,t,n){return e?e.concat(t).map(function(i,o){return i=Na(i),!n&&o?"["+i+"]":i}).join(n?".":""):t}function Fu(e){return L.isArray(e)&&!e.some(Xi)}const ku=L.toFlatObject(L,{},null,function(t){return/^is[A-Z]/.test(t)});function di(e,t,n){if(!L.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=L.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,b){return!L.isUndefined(b[v])});const r=n.metaTokens,i=n.visitor||u,o=n.dots,a=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&L.isSpecCompliantForm(t);if(!L.isFunction(i))throw new TypeError("visitor must be a function");function c(g){if(g===null)return"";if(L.isDate(g))return g.toISOString();if(!l&&L.isBlob(g))throw new se("Blob is not supported. Use a Buffer instead.");return L.isArrayBuffer(g)||L.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function u(g,v,b){let O=g;if(g&&!b&&typeof g=="object"){if(L.endsWith(v,"{}"))v=r?v:v.slice(0,-2),g=JSON.stringify(g);else if(L.isArray(g)&&Fu(g)||(L.isFileList(g)||L.endsWith(v,"[]"))&&(O=L.toArray(g)))return v=Na(v),O.forEach(function(I,_){!(L.isUndefined(I)||I===null)&&t.append(a===!0?Es([v],_,o):a===null?v:v+"[]",c(I))}),!1}return Xi(g)?!0:(t.append(Es(b,v,o),c(g)),!1)}const f=[],h=Object.assign(ku,{defaultVisitor:u,convertValue:c,isVisitable:Xi});function p(g,v){if(!L.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(g),L.forEach(g,function(O,w){(!(L.isUndefined(O)||O===null)&&i.call(t,O,L.isString(w)?w.trim():w,v,h))===!0&&p(O,v?v.concat(w):[w])}),f.pop()}}if(!L.isObject(e))throw new TypeError("data must be an object");return p(e),t}function ws(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Do(e,t){this._pairs=[],e&&di(e,this,t)}const $a=Do.prototype;$a.append=function(t,n){this._pairs.push([t,n])};$a.toString=function(t){const n=t?function(r){return t.call(this,r,ws)}:ws;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Bu(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ja(e,t,n){if(!t)return e;const r=n&&n.encode||Bu,i=n&&n.serialize;let o;if(i?o=i(t,n):o=L.isURLSearchParams(t)?t.toString():new Do(t,n).toString(r),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Ss{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){L.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Fa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Hu=typeof URLSearchParams<"u"?URLSearchParams:Do,Uu=typeof FormData<"u"?FormData:null,qu=typeof Blob<"u"?Blob:null,Vu={isBrowser:!0,classes:{URLSearchParams:Hu,FormData:Uu,Blob:qu},protocols:["http","https","file","blob","url","data"]},Ro=typeof window<"u"&&typeof document<"u",Ji=typeof navigator=="object"&&navigator||void 0,Wu=Ro&&(!Ji||["ReactNative","NativeScript","NS"].indexOf(Ji.product)<0),Ku=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Yu=Ro&&window.location.href||"http://localhost",zu=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ro,hasStandardBrowserEnv:Wu,hasStandardBrowserWebWorkerEnv:Ku,navigator:Ji,origin:Yu},Symbol.toStringTag,{value:"Module"})),Ue={...zu,...Vu};function Gu(e,t){return di(e,new Ue.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,o){return Ue.isNode&&L.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Xu(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Ju(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r=n.length;return a=!a&&L.isArray(i)?i.length:a,l?(L.hasOwnProp(i,a)?i[a]=[i[a],r]:i[a]=r,!s):((!i[a]||!L.isObject(i[a]))&&(i[a]=[]),t(n,r,i[a],o)&&L.isArray(i[a])&&(i[a]=Ju(i[a])),!s)}if(L.isFormData(e)&&L.isFunction(e.entries)){const n={};return L.forEachEntry(e,(r,i)=>{t(Xu(r),i,n,0)}),n}return null}function Qu(e,t,n){if(L.isString(e))try{return(t||JSON.parse)(e),L.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const mr={transitional:Fa,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=L.isObject(t);if(o&&L.isHTMLForm(t)&&(t=new FormData(t)),L.isFormData(t))return i?JSON.stringify(ka(t)):t;if(L.isArrayBuffer(t)||L.isBuffer(t)||L.isStream(t)||L.isFile(t)||L.isBlob(t)||L.isReadableStream(t))return t;if(L.isArrayBufferView(t))return t.buffer;if(L.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Gu(t,this.formSerializer).toString();if((s=L.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return di(s?{"files[]":t}:t,l&&new l,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),Qu(t)):t}],transformResponse:[function(t){const n=this.transitional||mr.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(L.isResponse(t)||L.isReadableStream(t))return t;if(t&&L.isString(t)&&(r&&!this.responseType||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(s){if(a)throw s.name==="SyntaxError"?se.from(s,se.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ue.classes.FormData,Blob:Ue.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};L.forEach(["delete","get","head","post","put","patch"],e=>{mr.headers[e]={}});const Zu=L.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ef=e=>{const t={};let n,r,i;return e&&e.split(` -`).forEach(function(a){i=a.indexOf(":"),n=a.substring(0,i).trim().toLowerCase(),r=a.substring(i+1).trim(),!(!n||t[n]&&Zu[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Os=Symbol("internals");function Vn(e){return e&&String(e).trim().toLowerCase()}function kr(e){return e===!1||e==null?e:L.isArray(e)?e.map(kr):String(e)}function tf(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const nf=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function xi(e,t,n,r,i){if(L.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!L.isString(t)){if(L.isString(r))return t.indexOf(r)!==-1;if(L.isRegExp(r))return r.test(t)}}function rf(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function of(e,t){const n=L.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,o,a){return this[r].call(this,t,i,o,a)},configurable:!0})})}let qe=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function o(s,l,c){const u=Vn(l);if(!u)throw new Error("header name must be a non-empty string");const f=L.findKey(i,u);(!f||i[f]===void 0||c===!0||c===void 0&&i[f]!==!1)&&(i[f||l]=kr(s))}const a=(s,l)=>L.forEach(s,(c,u)=>o(c,u,l));if(L.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(L.isString(t)&&(t=t.trim())&&!nf(t))a(ef(t),n);else if(L.isHeaders(t))for(const[s,l]of t.entries())o(l,s,r);else t!=null&&o(n,t,r);return this}get(t,n){if(t=Vn(t),t){const r=L.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return tf(i);if(L.isFunction(n))return n.call(this,i,r);if(L.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Vn(t),t){const r=L.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||xi(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function o(a){if(a=Vn(a),a){const s=L.findKey(r,a);s&&(!n||xi(r,r[s],s,n))&&(delete r[s],i=!0)}}return L.isArray(t)?t.forEach(o):o(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!t||xi(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){const n=this,r={};return L.forEach(this,(i,o)=>{const a=L.findKey(r,o);if(a){n[a]=kr(i),delete n[o];return}const s=t?rf(o):String(o).trim();s!==o&&delete n[o],n[s]=kr(i),r[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return L.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&L.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[Os]=this[Os]={accessors:{}}).accessors,i=this.prototype;function o(a){const s=Vn(a);r[s]||(of(i,a),r[s]=!0)}return L.isArray(t)?t.forEach(o):o(t),this}};qe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);L.reduceDescriptors(qe.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});L.freezeMethods(qe);function Pi(e,t){const n=this||mr,r=t||n,i=qe.from(r.headers);let o=r.data;return L.forEach(e,function(s){o=s.call(n,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function Ba(e){return!!(e&&e.__CANCEL__)}function jn(e,t,n){se.call(this,e??"canceled",se.ERR_CANCELED,t,n),this.name="CanceledError"}L.inherits(jn,se,{__CANCEL__:!0});function Ha(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new se("Request failed with status code "+n.status,[se.ERR_BAD_REQUEST,se.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function sf(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function af(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,o=0,a;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),u=r[o];a||(a=c),n[i]=l,r[i]=c;let f=o,h=0;for(;f!==i;)h+=n[f++],f=f%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),c-a{n=u,i=null,o&&(clearTimeout(o),o=null),e.apply(null,c)};return[(...c)=>{const u=Date.now(),f=u-n;f>=r?a(c,u):(i=c,o||(o=setTimeout(()=>{o=null,a(i)},r-f)))},()=>i&&a(i)]}const zr=(e,t,n=3)=>{let r=0;const i=af(50,250);return lf(o=>{const a=o.loaded,s=o.lengthComputable?o.total:void 0,l=a-r,c=i(l),u=a<=s;r=a;const f={loaded:a,total:s,progress:s?a/s:void 0,bytes:l,rate:c||void 0,estimated:c&&s&&u?(s-a)/c:void 0,event:o,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(f)},n)},Ts=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},As=e=>(...t)=>L.asap(()=>e(...t)),cf=Ue.hasStandardBrowserEnv?function(){const t=Ue.navigator&&/(msie|trident)/i.test(Ue.navigator.userAgent),n=document.createElement("a");let r;function i(o){let a=o;return t&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=i(window.location.href),function(a){const s=L.isString(a)?i(a):a;return s.protocol===r.protocol&&s.host===r.host}}():function(){return function(){return!0}}(),uf=Ue.hasStandardBrowserEnv?{write(e,t,n,r,i,o){const a=[e+"="+encodeURIComponent(t)];L.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),L.isString(r)&&a.push("path="+r),L.isString(i)&&a.push("domain="+i),o===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ff(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function df(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ua(e,t){return e&&!ff(t)?df(e,t):t}const Cs=e=>e instanceof qe?{...e}:e;function ln(e,t){t=t||{};const n={};function r(c,u,f){return L.isPlainObject(c)&&L.isPlainObject(u)?L.merge.call({caseless:f},c,u):L.isPlainObject(u)?L.merge({},u):L.isArray(u)?u.slice():u}function i(c,u,f){if(L.isUndefined(u)){if(!L.isUndefined(c))return r(void 0,c,f)}else return r(c,u,f)}function o(c,u){if(!L.isUndefined(u))return r(void 0,u)}function a(c,u){if(L.isUndefined(u)){if(!L.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function s(c,u,f){if(f in t)return r(c,u);if(f in e)return r(void 0,c)}const l={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(c,u)=>i(Cs(c),Cs(u),!0)};return L.forEach(Object.keys(Object.assign({},e,t)),function(u){const f=l[u]||i,h=f(e[u],t[u],u);L.isUndefined(h)&&f!==s||(n[u]=h)}),n}const qa=e=>{const t=ln({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:a,auth:s}=t;t.headers=a=qe.from(a),t.url=ja(Ua(t.baseURL,t.url),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let l;if(L.isFormData(n)){if(Ue.hasStandardBrowserEnv||Ue.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((l=a.getContentType())!==!1){const[c,...u]=l?l.split(";").map(f=>f.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...u].join("; "))}}if(Ue.hasStandardBrowserEnv&&(r&&L.isFunction(r)&&(r=r(t)),r||r!==!1&&cf(t.url))){const c=i&&o&&uf.read(o);c&&a.set(i,c)}return t},hf=typeof XMLHttpRequest<"u",pf=hf&&function(e){return new Promise(function(n,r){const i=qa(e);let o=i.data;const a=qe.from(i.headers).normalize();let{responseType:s,onUploadProgress:l,onDownloadProgress:c}=i,u,f,h,p,g;function v(){p&&p(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(i.method.toUpperCase(),i.url,!0),b.timeout=i.timeout;function O(){if(!b)return;const I=qe.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),U={data:!s||s==="text"||s==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:I,config:e,request:b};Ha(function(Y){n(Y),v()},function(Y){r(Y),v()},U),b=null}"onloadend"in b?b.onloadend=O:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(O)},b.onabort=function(){b&&(r(new se("Request aborted",se.ECONNABORTED,e,b)),b=null)},b.onerror=function(){r(new se("Network Error",se.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let _=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const U=i.transitional||Fa;i.timeoutErrorMessage&&(_=i.timeoutErrorMessage),r(new se(_,U.clarifyTimeoutError?se.ETIMEDOUT:se.ECONNABORTED,e,b)),b=null},o===void 0&&a.setContentType(null),"setRequestHeader"in b&&L.forEach(a.toJSON(),function(_,U){b.setRequestHeader(U,_)}),L.isUndefined(i.withCredentials)||(b.withCredentials=!!i.withCredentials),s&&s!=="json"&&(b.responseType=i.responseType),c&&([h,g]=zr(c,!0),b.addEventListener("progress",h)),l&&b.upload&&([f,p]=zr(l),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(u=I=>{b&&(r(!I||I.type?new jn(null,e,b):I),b.abort(),b=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const w=sf(i.url);if(w&&Ue.protocols.indexOf(w)===-1){r(new se("Unsupported protocol "+w+":",se.ERR_BAD_REQUEST,e));return}b.send(o||null)})},mf=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const o=function(c){if(!i){i=!0,s();const u=c instanceof Error?c:this.reason;r.abort(u instanceof se?u:new jn(u instanceof Error?u.message:u))}};let a=t&&setTimeout(()=>{a=null,o(new se(`timeout ${t} of ms exceeded`,se.ETIMEDOUT))},t);const s=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),e=null)};e.forEach(c=>c.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>L.asap(s),l}},gf=function*(e,t){let n=e.byteLength;if(!t||n{const i=vf(e,t);let o=0,a,s=l=>{a||(a=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await i.next();if(c){s(),l.close();return}let f=u.byteLength;if(n){let h=o+=f;n(h)}l.enqueue(new Uint8Array(u))}catch(c){throw s(c),c}},cancel(l){return s(l),i.return()}},{highWaterMark:2})},hi=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Va=hi&&typeof ReadableStream=="function",bf=hi&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Wa=(e,...t)=>{try{return!!e(...t)}catch{return!1}},_f=Va&&Wa(()=>{let e=!1;const t=new Request(Ue.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),xs=64*1024,Qi=Va&&Wa(()=>L.isReadableStream(new Response("").body)),Gr={stream:Qi&&(e=>e.body)};hi&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Gr[t]&&(Gr[t]=L.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new se(`Response type '${t}' is not supported`,se.ERR_NOT_SUPPORT,r)})})})(new Response);const Ef=async e=>{if(e==null)return 0;if(L.isBlob(e))return e.size;if(L.isSpecCompliantForm(e))return(await new Request(Ue.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(L.isArrayBufferView(e)||L.isArrayBuffer(e))return e.byteLength;if(L.isURLSearchParams(e)&&(e=e+""),L.isString(e))return(await bf(e)).byteLength},wf=async(e,t)=>{const n=L.toFiniteNumber(e.getContentLength());return n??Ef(t)},Sf=hi&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:o,timeout:a,onDownloadProgress:s,onUploadProgress:l,responseType:c,headers:u,withCredentials:f="same-origin",fetchOptions:h}=qa(e);c=c?(c+"").toLowerCase():"text";let p=mf([i,o&&o.toAbortSignal()],a),g;const v=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let b;try{if(l&&_f&&n!=="get"&&n!=="head"&&(b=await wf(u,r))!==0){let U=new Request(t,{method:"POST",body:r,duplex:"half"}),N;if(L.isFormData(r)&&(N=U.headers.get("content-type"))&&u.setContentType(N),U.body){const[Y,C]=Ts(b,zr(As(l)));r=Is(U.body,xs,Y,C)}}L.isString(f)||(f=f?"include":"omit");const O="credentials"in Request.prototype;g=new Request(t,{...h,signal:p,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:O?f:void 0});let w=await fetch(g);const I=Qi&&(c==="stream"||c==="response");if(Qi&&(s||I&&v)){const U={};["status","statusText","headers"].forEach(R=>{U[R]=w[R]});const N=L.toFiniteNumber(w.headers.get("content-length")),[Y,C]=s&&Ts(N,zr(As(s),!0))||[];w=new Response(Is(w.body,xs,Y,()=>{C&&C(),v&&v()}),U)}c=c||"text";let _=await Gr[L.findKey(Gr,c)||"text"](w,e);return!I&&v&&v(),await new Promise((U,N)=>{Ha(U,N,{data:_,headers:qe.from(w.headers),status:w.status,statusText:w.statusText,config:e,request:g})})}catch(O){throw v&&v(),O&&O.name==="TypeError"&&/fetch/i.test(O.message)?Object.assign(new se("Network Error",se.ERR_NETWORK,e,g),{cause:O.cause||O}):se.from(O,O&&O.code,e,g)}}),Zi={http:ju,xhr:pf,fetch:Sf};L.forEach(Zi,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ps=e=>`- ${e}`,Of=e=>L.isFunction(e)||e===null||e===!1,Ka={getAdapter:e=>{e=L.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let o=0;o`adapter ${s} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=t?o.length>1?`since : +(()=>{function Ta(e,t){return function(){return e.apply(t,arguments)}}const{toString:Qc}=Object.prototype,{getPrototypeOf:Do}=Object,ui=(e=>t=>{const n=Qc.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ct=e=>(e=e.toLowerCase(),t=>ui(t)===e),fi=e=>t=>typeof t===e,{isArray:$n}=Array,ur=fi("undefined");function Zc(e){return e!==null&&!ur(e)&&e.constructor!==null&&!ur(e.constructor)&&ze(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Aa=ct("ArrayBuffer");function eu(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Aa(e.buffer),t}const tu=fi("string"),ze=fi("function"),Ca=fi("number"),di=e=>e!==null&&typeof e=="object",nu=e=>e===!0||e===!1,Fr=e=>{if(ui(e)!=="object")return!1;const t=Do(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ru=ct("Date"),iu=ct("File"),ou=ct("Blob"),su=ct("FileList"),au=e=>di(e)&&ze(e.pipe),lu=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||ze(e.append)&&((t=ui(e))==="formdata"||t==="object"&&ze(e.toString)&&e.toString()==="[object FormData]"))},cu=ct("URLSearchParams"),[uu,fu,du,hu]=["ReadableStream","Request","Response","Headers"].map(ct),pu=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function pr(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),$n(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}const Zt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,xa=e=>!ur(e)&&e!==Zt;function Ji(){const{caseless:e}=xa(this)&&this||{},t={},n=(r,i)=>{const o=e&&Ia(t,i)||i;Fr(t[o])&&Fr(r)?t[o]=Ji(t[o],r):Fr(r)?t[o]=Ji({},r):$n(r)?t[o]=r.slice():t[o]=r};for(let r=0,i=arguments.length;r(pr(t,(i,o)=>{n&&ze(i)?e[o]=Ta(i,n):e[o]=i},{allOwnKeys:r}),e),gu=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),vu=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},yu=(e,t,n,r)=>{let i,o,a;const s={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)a=i[o],(!r||r(a,e,t))&&!s[a]&&(t[a]=e[a],s[a]=!0);e=n!==!1&&Do(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},bu=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},_u=e=>{if(!e)return null;if($n(e))return e;let t=e.length;if(!Ca(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Eu=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Do(Uint8Array)),wu=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=r.next())&&!i.done;){const o=i.value;t.call(e,o[0],o[1])}},Su=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ou=ct("HTMLFormElement"),Tu=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),bs=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Au=ct("RegExp"),Pa=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};pr(n,(i,o)=>{let a;(a=t(i,o,e))!==!1&&(r[o]=a||i)}),Object.defineProperties(e,r)},Cu=e=>{Pa(e,(t,n)=>{if(ze(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(ze(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Iu=(e,t)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return $n(e)?r(e):r(String(e).split(t)),n},xu=()=>{},Pu=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Pi="abcdefghijklmnopqrstuvwxyz",_s="0123456789",La={DIGIT:_s,ALPHA:Pi,ALPHA_DIGIT:Pi+Pi.toUpperCase()+_s},Lu=(e=16,t=La.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Du(e){return!!(e&&ze(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Ru=e=>{const t=new Array(10),n=(r,i)=>{if(di(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[i]=r;const o=$n(r)?[]:{};return pr(r,(a,s)=>{const l=n(a,i+1);!ur(l)&&(o[s]=l)}),t[i]=void 0,o}}return r};return n(e,0)},Mu=ct("AsyncFunction"),Nu=e=>e&&(di(e)||ze(e))&&ze(e.then)&&ze(e.catch),Da=((e,t)=>e?setImmediate:t?((n,r)=>(Zt.addEventListener("message",({source:i,data:o})=>{i===Zt&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Zt.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ze(Zt.postMessage)),$u=typeof queueMicrotask<"u"?queueMicrotask.bind(Zt):typeof process<"u"&&process.nextTick||Da,L={isArray:$n,isArrayBuffer:Aa,isBuffer:Zc,isFormData:lu,isArrayBufferView:eu,isString:tu,isNumber:Ca,isBoolean:nu,isObject:di,isPlainObject:Fr,isReadableStream:uu,isRequest:fu,isResponse:du,isHeaders:hu,isUndefined:ur,isDate:ru,isFile:iu,isBlob:ou,isRegExp:Au,isFunction:ze,isStream:au,isURLSearchParams:cu,isTypedArray:Eu,isFileList:su,forEach:pr,merge:Ji,extend:mu,trim:pu,stripBOM:gu,inherits:vu,toFlatObject:yu,kindOf:ui,kindOfTest:ct,endsWith:bu,toArray:_u,forEachEntry:wu,matchAll:Su,isHTMLForm:Ou,hasOwnProperty:bs,hasOwnProp:bs,reduceDescriptors:Pa,freezeMethods:Cu,toObjectSet:Iu,toCamelCase:Tu,noop:xu,toFiniteNumber:Pu,findKey:Ia,global:Zt,isContextDefined:xa,ALPHABET:La,generateString:Lu,isSpecCompliantForm:Du,toJSONObject:Ru,isAsyncFn:Mu,isThenable:Nu,setImmediate:Da,asap:$u};function se(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}L.inherits(se,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:L.toJSONObject(this.config),code:this.code,status:this.status}}});const Ra=se.prototype,Ma={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ma[e]={value:e}});Object.defineProperties(se,Ma);Object.defineProperty(Ra,"isAxiosError",{value:!0});se.from=(e,t,n,r,i,o)=>{const a=Object.create(Ra);return L.toFlatObject(e,a,function(l){return l!==Error.prototype},s=>s!=="isAxiosError"),se.call(a,e.message,t,n,r,i),a.cause=e,a.name=e.name,o&&Object.assign(a,o),a};const ju=null;function Qi(e){return L.isPlainObject(e)||L.isArray(e)}function Na(e){return L.endsWith(e,"[]")?e.slice(0,-2):e}function Es(e,t,n){return e?e.concat(t).map(function(i,o){return i=Na(i),!n&&o?"["+i+"]":i}).join(n?".":""):t}function Fu(e){return L.isArray(e)&&!e.some(Qi)}const ku=L.toFlatObject(L,{},null,function(t){return/^is[A-Z]/.test(t)});function hi(e,t,n){if(!L.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=L.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,b){return!L.isUndefined(b[v])});const r=n.metaTokens,i=n.visitor||u,o=n.dots,a=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&L.isSpecCompliantForm(t);if(!L.isFunction(i))throw new TypeError("visitor must be a function");function c(g){if(g===null)return"";if(L.isDate(g))return g.toISOString();if(!l&&L.isBlob(g))throw new se("Blob is not supported. Use a Buffer instead.");return L.isArrayBuffer(g)||L.isTypedArray(g)?l&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function u(g,v,b){let O=g;if(g&&!b&&typeof g=="object"){if(L.endsWith(v,"{}"))v=r?v:v.slice(0,-2),g=JSON.stringify(g);else if(L.isArray(g)&&Fu(g)||(L.isFileList(g)||L.endsWith(v,"[]"))&&(O=L.toArray(g)))return v=Na(v),O.forEach(function(I,_){!(L.isUndefined(I)||I===null)&&t.append(a===!0?Es([v],_,o):a===null?v:v+"[]",c(I))}),!1}return Qi(g)?!0:(t.append(Es(b,v,o),c(g)),!1)}const f=[],d=Object.assign(ku,{defaultVisitor:u,convertValue:c,isVisitable:Qi});function p(g,v){if(!L.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+v.join("."));f.push(g),L.forEach(g,function(O,w){(!(L.isUndefined(O)||O===null)&&i.call(t,O,L.isString(w)?w.trim():w,v,d))===!0&&p(O,v?v.concat(w):[w])}),f.pop()}}if(!L.isObject(e))throw new TypeError("data must be an object");return p(e),t}function ws(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Ro(e,t){this._pairs=[],e&&hi(e,this,t)}const $a=Ro.prototype;$a.append=function(t,n){this._pairs.push([t,n])};$a.toString=function(t){const n=t?function(r){return t.call(this,r,ws)}:ws;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Bu(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ja(e,t,n){if(!t)return e;const r=n&&n.encode||Bu;L.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(t,n):o=L.isURLSearchParams(t)?t.toString():new Ro(t,n).toString(r),o){const a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Ss{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){L.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Fa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Hu=typeof URLSearchParams<"u"?URLSearchParams:Ro,Uu=typeof FormData<"u"?FormData:null,qu=typeof Blob<"u"?Blob:null,Vu={isBrowser:!0,classes:{URLSearchParams:Hu,FormData:Uu,Blob:qu},protocols:["http","https","file","blob","url","data"]},Mo=typeof window<"u"&&typeof document<"u",Zi=typeof navigator=="object"&&navigator||void 0,Wu=Mo&&(!Zi||["ReactNative","NativeScript","NS"].indexOf(Zi.product)<0),Ku=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Yu=Mo&&window.location.href||"http://localhost",zu=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Mo,hasStandardBrowserEnv:Wu,hasStandardBrowserWebWorkerEnv:Ku,navigator:Zi,origin:Yu},Symbol.toStringTag,{value:"Module"})),Ne={...zu,...Vu};function Gu(e,t){return hi(e,new Ne.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,o){return Ne.isNode&&L.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Xu(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Ju(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r=n.length;return a=!a&&L.isArray(i)?i.length:a,l?(L.hasOwnProp(i,a)?i[a]=[i[a],r]:i[a]=r,!s):((!i[a]||!L.isObject(i[a]))&&(i[a]=[]),t(n,r,i[a],o)&&L.isArray(i[a])&&(i[a]=Ju(i[a])),!s)}if(L.isFormData(e)&&L.isFunction(e.entries)){const n={};return L.forEachEntry(e,(r,i)=>{t(Xu(r),i,n,0)}),n}return null}function Qu(e,t,n){if(L.isString(e))try{return(t||JSON.parse)(e),L.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(e)}const mr={transitional:Fa,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=L.isObject(t);if(o&&L.isHTMLForm(t)&&(t=new FormData(t)),L.isFormData(t))return i?JSON.stringify(ka(t)):t;if(L.isArrayBuffer(t)||L.isBuffer(t)||L.isStream(t)||L.isFile(t)||L.isBlob(t)||L.isReadableStream(t))return t;if(L.isArrayBufferView(t))return t.buffer;if(L.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Gu(t,this.formSerializer).toString();if((s=L.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return hi(s?{"files[]":t}:t,l&&new l,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),Qu(t)):t}],transformResponse:[function(t){const n=this.transitional||mr.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(L.isResponse(t)||L.isReadableStream(t))return t;if(t&&L.isString(t)&&(r&&!this.responseType||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(s){if(a)throw s.name==="SyntaxError"?se.from(s,se.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ne.classes.FormData,Blob:Ne.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};L.forEach(["delete","get","head","post","put","patch"],e=>{mr.headers[e]={}});const Zu=L.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ef=e=>{const t={};let n,r,i;return e&&e.split(` +`).forEach(function(a){i=a.indexOf(":"),n=a.substring(0,i).trim().toLowerCase(),r=a.substring(i+1).trim(),!(!n||t[n]&&Zu[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Os=Symbol("internals");function Vn(e){return e&&String(e).trim().toLowerCase()}function kr(e){return e===!1||e==null?e:L.isArray(e)?e.map(kr):String(e)}function tf(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const nf=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Li(e,t,n,r,i){if(L.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!L.isString(t)){if(L.isString(r))return t.indexOf(r)!==-1;if(L.isRegExp(r))return r.test(t)}}function rf(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function of(e,t){const n=L.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,o,a){return this[r].call(this,t,i,o,a)},configurable:!0})})}let qe=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function o(s,l,c){const u=Vn(l);if(!u)throw new Error("header name must be a non-empty string");const f=L.findKey(i,u);(!f||i[f]===void 0||c===!0||c===void 0&&i[f]!==!1)&&(i[f||l]=kr(s))}const a=(s,l)=>L.forEach(s,(c,u)=>o(c,u,l));if(L.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(L.isString(t)&&(t=t.trim())&&!nf(t))a(ef(t),n);else if(L.isHeaders(t))for(const[s,l]of t.entries())o(l,s,r);else t!=null&&o(n,t,r);return this}get(t,n){if(t=Vn(t),t){const r=L.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return tf(i);if(L.isFunction(n))return n.call(this,i,r);if(L.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Vn(t),t){const r=L.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Li(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function o(a){if(a=Vn(a),a){const s=L.findKey(r,a);s&&(!n||Li(r,r[s],s,n))&&(delete r[s],i=!0)}}return L.isArray(t)?t.forEach(o):o(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!t||Li(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){const n=this,r={};return L.forEach(this,(i,o)=>{const a=L.findKey(r,o);if(a){n[a]=kr(i),delete n[o];return}const s=t?rf(o):String(o).trim();s!==o&&delete n[o],n[s]=kr(i),r[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return L.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&L.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[Os]=this[Os]={accessors:{}}).accessors,i=this.prototype;function o(a){const s=Vn(a);r[s]||(of(i,a),r[s]=!0)}return L.isArray(t)?t.forEach(o):o(t),this}};qe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);L.reduceDescriptors(qe.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});L.freezeMethods(qe);function Di(e,t){const n=this||mr,r=t||n,i=qe.from(r.headers);let o=r.data;return L.forEach(e,function(s){o=s.call(n,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function Ba(e){return!!(e&&e.__CANCEL__)}function jn(e,t,n){se.call(this,e??"canceled",se.ERR_CANCELED,t,n),this.name="CanceledError"}L.inherits(jn,se,{__CANCEL__:!0});function Ha(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new se("Request failed with status code "+n.status,[se.ERR_BAD_REQUEST,se.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function sf(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function af(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,o=0,a;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),u=r[o];a||(a=c),n[i]=l,r[i]=c;let f=o,d=0;for(;f!==i;)d+=n[f++],f=f%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),c-a{n=u,i=null,o&&(clearTimeout(o),o=null),e.apply(null,c)};return[(...c)=>{const u=Date.now(),f=u-n;f>=r?a(c,u):(i=c,o||(o=setTimeout(()=>{o=null,a(i)},r-f)))},()=>i&&a(i)]}const Gr=(e,t,n=3)=>{let r=0;const i=af(50,250);return lf(o=>{const a=o.loaded,s=o.lengthComputable?o.total:void 0,l=a-r,c=i(l),u=a<=s;r=a;const f={loaded:a,total:s,progress:s?a/s:void 0,bytes:l,rate:c||void 0,estimated:c&&s&&u?(s-a)/c:void 0,event:o,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(f)},n)},Ts=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},As=e=>(...t)=>L.asap(()=>e(...t)),cf=Ne.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ne.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ne.origin),Ne.navigator&&/(msie|trident)/i.test(Ne.navigator.userAgent)):()=>!0,uf=Ne.hasStandardBrowserEnv?{write(e,t,n,r,i,o){const a=[e+"="+encodeURIComponent(t)];L.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),L.isString(r)&&a.push("path="+r),L.isString(i)&&a.push("domain="+i),o===!0&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ff(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function df(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ua(e,t){return e&&!ff(t)?df(e,t):t}const Cs=e=>e instanceof qe?{...e}:e;function ln(e,t){t=t||{};const n={};function r(c,u,f,d){return L.isPlainObject(c)&&L.isPlainObject(u)?L.merge.call({caseless:d},c,u):L.isPlainObject(u)?L.merge({},u):L.isArray(u)?u.slice():u}function i(c,u,f,d){if(L.isUndefined(u)){if(!L.isUndefined(c))return r(void 0,c,f,d)}else return r(c,u,f,d)}function o(c,u){if(!L.isUndefined(u))return r(void 0,u)}function a(c,u){if(L.isUndefined(u)){if(!L.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function s(c,u,f){if(f in t)return r(c,u);if(f in e)return r(void 0,c)}const l={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(c,u,f)=>i(Cs(c),Cs(u),f,!0)};return L.forEach(Object.keys(Object.assign({},e,t)),function(u){const f=l[u]||i,d=f(e[u],t[u],u);L.isUndefined(d)&&f!==s||(n[u]=d)}),n}const qa=e=>{const t=ln({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:a,auth:s}=t;t.headers=a=qe.from(a),t.url=ja(Ua(t.baseURL,t.url),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")));let l;if(L.isFormData(n)){if(Ne.hasStandardBrowserEnv||Ne.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((l=a.getContentType())!==!1){const[c,...u]=l?l.split(";").map(f=>f.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...u].join("; "))}}if(Ne.hasStandardBrowserEnv&&(r&&L.isFunction(r)&&(r=r(t)),r||r!==!1&&cf(t.url))){const c=i&&o&&uf.read(o);c&&a.set(i,c)}return t},hf=typeof XMLHttpRequest<"u",pf=hf&&function(e){return new Promise(function(n,r){const i=qa(e);let o=i.data;const a=qe.from(i.headers).normalize();let{responseType:s,onUploadProgress:l,onDownloadProgress:c}=i,u,f,d,p,g;function v(){p&&p(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(i.method.toUpperCase(),i.url,!0),b.timeout=i.timeout;function O(){if(!b)return;const I=qe.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),U={data:!s||s==="text"||s==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:I,config:e,request:b};Ha(function(Y){n(Y),v()},function(Y){r(Y),v()},U),b=null}"onloadend"in b?b.onloadend=O:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(O)},b.onabort=function(){b&&(r(new se("Request aborted",se.ECONNABORTED,e,b)),b=null)},b.onerror=function(){r(new se("Network Error",se.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let _=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const U=i.transitional||Fa;i.timeoutErrorMessage&&(_=i.timeoutErrorMessage),r(new se(_,U.clarifyTimeoutError?se.ETIMEDOUT:se.ECONNABORTED,e,b)),b=null},o===void 0&&a.setContentType(null),"setRequestHeader"in b&&L.forEach(a.toJSON(),function(_,U){b.setRequestHeader(U,_)}),L.isUndefined(i.withCredentials)||(b.withCredentials=!!i.withCredentials),s&&s!=="json"&&(b.responseType=i.responseType),c&&([d,g]=Gr(c,!0),b.addEventListener("progress",d)),l&&b.upload&&([f,p]=Gr(l),b.upload.addEventListener("progress",f),b.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(u=I=>{b&&(r(!I||I.type?new jn(null,e,b):I),b.abort(),b=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const w=sf(i.url);if(w&&Ne.protocols.indexOf(w)===-1){r(new se("Unsupported protocol "+w+":",se.ERR_BAD_REQUEST,e));return}b.send(o||null)})},mf=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const o=function(c){if(!i){i=!0,s();const u=c instanceof Error?c:this.reason;r.abort(u instanceof se?u:new jn(u instanceof Error?u.message:u))}};let a=t&&setTimeout(()=>{a=null,o(new se(`timeout ${t} of ms exceeded`,se.ETIMEDOUT))},t);const s=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),e=null)};e.forEach(c=>c.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>L.asap(s),l}},gf=function*(e,t){let n=e.byteLength;if(n{const i=vf(e,t);let o=0,a,s=l=>{a||(a=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await i.next();if(c){s(),l.close();return}let f=u.byteLength;if(n){let d=o+=f;n(d)}l.enqueue(new Uint8Array(u))}catch(c){throw s(c),c}},cancel(l){return s(l),i.return()}},{highWaterMark:2})},pi=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Va=pi&&typeof ReadableStream=="function",bf=pi&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Wa=(e,...t)=>{try{return!!e(...t)}catch{return!1}},_f=Va&&Wa(()=>{let e=!1;const t=new Request(Ne.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),xs=64*1024,eo=Va&&Wa(()=>L.isReadableStream(new Response("").body)),Xr={stream:eo&&(e=>e.body)};pi&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Xr[t]&&(Xr[t]=L.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new se(`Response type '${t}' is not supported`,se.ERR_NOT_SUPPORT,r)})})})(new Response);const Ef=async e=>{if(e==null)return 0;if(L.isBlob(e))return e.size;if(L.isSpecCompliantForm(e))return(await new Request(Ne.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(L.isArrayBufferView(e)||L.isArrayBuffer(e))return e.byteLength;if(L.isURLSearchParams(e)&&(e=e+""),L.isString(e))return(await bf(e)).byteLength},wf=async(e,t)=>{const n=L.toFiniteNumber(e.getContentLength());return n??Ef(t)},Sf=pi&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:o,timeout:a,onDownloadProgress:s,onUploadProgress:l,responseType:c,headers:u,withCredentials:f="same-origin",fetchOptions:d}=qa(e);c=c?(c+"").toLowerCase():"text";let p=mf([i,o&&o.toAbortSignal()],a),g;const v=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let b;try{if(l&&_f&&n!=="get"&&n!=="head"&&(b=await wf(u,r))!==0){let U=new Request(t,{method:"POST",body:r,duplex:"half"}),N;if(L.isFormData(r)&&(N=U.headers.get("content-type"))&&u.setContentType(N),U.body){const[Y,C]=Ts(b,Gr(As(l)));r=Is(U.body,xs,Y,C)}}L.isString(f)||(f=f?"include":"omit");const O="credentials"in Request.prototype;g=new Request(t,{...d,signal:p,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:O?f:void 0});let w=await fetch(g);const I=eo&&(c==="stream"||c==="response");if(eo&&(s||I&&v)){const U={};["status","statusText","headers"].forEach(D=>{U[D]=w[D]});const N=L.toFiniteNumber(w.headers.get("content-length")),[Y,C]=s&&Ts(N,Gr(As(s),!0))||[];w=new Response(Is(w.body,xs,Y,()=>{C&&C(),v&&v()}),U)}c=c||"text";let _=await Xr[L.findKey(Xr,c)||"text"](w,e);return!I&&v&&v(),await new Promise((U,N)=>{Ha(U,N,{data:_,headers:qe.from(w.headers),status:w.status,statusText:w.statusText,config:e,request:g})})}catch(O){throw v&&v(),O&&O.name==="TypeError"&&/fetch/i.test(O.message)?Object.assign(new se("Network Error",se.ERR_NETWORK,e,g),{cause:O.cause||O}):se.from(O,O&&O.code,e,g)}}),to={http:ju,xhr:pf,fetch:Sf};L.forEach(to,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ps=e=>`- ${e}`,Of=e=>L.isFunction(e)||e===null||e===!1,Ka={getAdapter:e=>{e=L.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let o=0;o`adapter ${s} `+(l===!1?"is not supported by the environment":"is not available in the build"));let a=t?o.length>1?`since : `+o.map(Ps).join(` -`):" "+Ps(o[0]):"as no adapter specified";throw new se("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:Zi};function Li(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new jn(null,e)}function Ls(e){return Li(e),e.headers=qe.from(e.headers),e.data=Pi.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ka.getAdapter(e.adapter||mr.adapter)(e).then(function(r){return Li(e),r.data=Pi.call(e,e.transformResponse,r),r.headers=qe.from(r.headers),r},function(r){return Ba(r)||(Li(e),r&&r.response&&(r.response.data=Pi.call(e,e.transformResponse,r.response),r.response.headers=qe.from(r.response.headers))),Promise.reject(r)})}const Ya="1.7.7",Mo={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Mo[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ds={};Mo.transitional=function(t,n,r){function i(o,a){return"[Axios v"+Ya+"] Transitional option '"+o+"'"+a+(r?". "+r:"")}return(o,a,s)=>{if(t===!1)throw new se(i(a," has been removed"+(n?" in "+n:"")),se.ERR_DEPRECATED);return n&&!Ds[a]&&(Ds[a]=!0,console.warn(i(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,a,s):!0}};function Tf(e,t,n){if(typeof e!="object")throw new se("options must be an object",se.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],a=t[o];if(a){const s=e[o],l=s===void 0||a(s,o,e);if(l!==!0)throw new se("option "+o+" must be "+l,se.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new se("Unknown option "+o,se.ERR_BAD_OPTION)}}const eo={assertOptions:Tf,validators:Mo},Dt=eo.validators;let tn=class{constructor(t){this.defaults=t,this.interceptors={request:new Ss,response:new Ss}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ln(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&eo.assertOptions(r,{silentJSONParsing:Dt.transitional(Dt.boolean),forcedJSONParsing:Dt.transitional(Dt.boolean),clarifyTimeoutError:Dt.transitional(Dt.boolean)},!1),i!=null&&(L.isFunction(i)?n.paramsSerializer={serialize:i}:eo.assertOptions(i,{encode:Dt.function,serialize:Dt.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=o&&L.merge(o.common,o[n.method]);o&&L.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=qe.concat(a,o);const s=[];let l=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(l=l&&v.synchronous,s.unshift(v.fulfilled,v.rejected))});const c=[];this.interceptors.response.forEach(function(v){c.push(v.fulfilled,v.rejected)});let u,f=0,h;if(!l){const g=[Ls.bind(this),void 0];for(g.unshift.apply(g,s),g.push.apply(g,c),h=g.length,u=Promise.resolve(n);f{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const a=new Promise(s=>{r.subscribe(s),o=s}).then(i);return a.cancel=function(){r.unsubscribe(o)},a},t(function(o,a,s){r.reason||(r.reason=new jn(o,a,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new za(function(i){t=i}),cancel:t}}};function Cf(e){return function(n){return e.apply(null,n)}}function If(e){return L.isObject(e)&&e.isAxiosError===!0}const to={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(to).forEach(([e,t])=>{to[t]=e});function Ga(e){const t=new tn(e),n=Ta(tn.prototype.request,t);return L.extend(n,tn.prototype,t,{allOwnKeys:!0}),L.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return Ga(ln(e,i))},n}const Te=Ga(mr);Te.Axios=tn;Te.CanceledError=jn;Te.CancelToken=Af;Te.isCancel=Ba;Te.VERSION=Ya;Te.toFormData=di;Te.AxiosError=se;Te.Cancel=Te.CanceledError;Te.all=function(t){return Promise.all(t)};Te.spread=Cf;Te.isAxiosError=If;Te.mergeConfig=ln;Te.AxiosHeaders=qe;Te.formToJSON=e=>ka(L.isHTMLForm(e)?new FormData(e):e);Te.getAdapter=Ka.getAdapter;Te.HttpStatusCode=to;Te.default=Te;const{Axios:Dg,AxiosError:Rg,CanceledError:Mg,isCancel:Ng,CancelToken:$g,VERSION:jg,all:Fg,Cancel:kg,isAxiosError:Bg,spread:Hg,toFormData:Ug,AxiosHeaders:qg,HttpStatusCode:Vg,formToJSON:Xa,getAdapter:Wg,mergeConfig:Kg}=Te;window.axios=Te;window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";CSS.supports("selector(:has(*))")||document.addEventListener("DOMContentLoaded",()=>{const e=document.querySelector(".layout-wrapper");e&&e.querySelector(":scope > .layout-menu")&&e.classList.add("layout-wrapper--sidebar"),e&&e.querySelector(":scope > .layout-menu-horizontal")&&e.classList.add("layout-wrapper--top-menu"),e&&e.querySelector(":scope > .layout-menu-mobile")&&e.classList.add("layout-wrapper--mobilebar")});var no=!1,ro=!1,nn=[],io=-1;function xf(e){Pf(e)}function Pf(e){nn.includes(e)||nn.push(e),Lf()}function Ja(e){let t=nn.indexOf(e);t!==-1&&t>io&&nn.splice(t,1)}function Lf(){!ro&&!no&&(no=!0,queueMicrotask(Df))}function Df(){no=!1,ro=!0;for(let e=0;ee.effect(t,{scheduler:n=>{oo?xf(n):n()}}),Qa=e.raw}function Rs(e){kn=e}function Nf(e){let t=()=>{};return[r=>{let i=kn(r);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),gr(i))},i},()=>{t()}]}function Zn(e,t,n={}){e.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}function Ft(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>Ft(i,t));return}let n=!1;if(t(e,()=>n=!0),n)return;let r=e.firstElementChild;for(;r;)Ft(r,t),r=r.nextElementSibling}function St(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var Ms=!1;function $f(){Ms&&St("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),Ms=!0,document.body||St("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `