From a7445dbcdda4b11de354e5f4e6a24b9ffe29c7dd Mon Sep 17 00:00:00 2001 From: Alberto Date: Fri, 4 Jun 2021 12:05:52 +0200 Subject: [PATCH 01/11] - Add package locales support - Add related_posts table name config - add it translation - add froala package requirement --- README.md | 10 ++ composer.json | 3 +- config/nova-blog.php | 15 ++- ...3_23_120630_create_related_posts_table.php | 6 +- resources/lang/en.json | 42 +++++++ resources/lang/it.json | 42 +++++++ resources/views/navigation.blade.php | 6 +- src/Models/Post.php | 2 +- src/Models/RelatedPost.php | 8 +- src/Nova/Category.php | 14 ++- src/Nova/Post.php | 107 ++++++++++-------- src/ToolServiceProvider.php | 4 + 12 files changed, 200 insertions(+), 59 deletions(-) create mode 100644 resources/lang/en.json create mode 100644 resources/lang/it.json diff --git a/README.md b/README.md index 1adac7c..b8289c2 100755 --- a/README.md +++ b/README.md @@ -229,6 +229,16 @@ Example response for querying page with slug `test-post-3` (`nova_get_post_by_sl } ``` +## Localization + +The translation file(s) can be published by using the following command: + +```bash +php artisan vendor:publish --provider="OptimistDigital\NovaBlog\ToolServiceProvider" --tag="translations" +``` + +You can add your translations to `resources/lang/vendor/nova-blog/` by creating a new translations file with the locale name (ie `et.json`) and copying the JSON from the existing `en.json`. + ## Credits - [Marika Must](https://github.com/MarikaMustV) diff --git a/composer.json b/composer.json index 6e77390..328e995 100755 --- a/composer.json +++ b/composer.json @@ -32,7 +32,8 @@ "optimistdigital/nova-locale-field": "^2.0", "whitecube/nova-flexible-content": "^0.2.4", "optimistdigital/nova-multiselect-field": ">=1.8.1", - "digital-creative/conditional-container": "^1.3" + "digital-creative/conditional-container": "^1.3", + "froala/nova-froala-field": "^3.4" }, "autoload": { "psr-4": { diff --git a/config/nova-blog.php b/config/nova-blog.php index 4b2b912..27c509a 100755 --- a/config/nova-blog.php +++ b/config/nova-blog.php @@ -13,6 +13,17 @@ 'blog_posts_table' => 'nova_blog_posts', + /* + |-------------------------------------------------------------------------- + | Related posts table name + |-------------------------------------------------------------------------- + | + | Set a custom table for Nova Blog to store its posts data. + | + */ + + 'blog_related_posts_table' => 'nova_blog_related_posts', + /* |-------------------------------------------------------------------------- | Categories table name @@ -80,8 +91,6 @@ 'hide_related_posts_column_from_index' => false, - 'hide_locale_column_from_index' => false, - - 'navigation_title' => 'Blog', + 'hide_locale_column_from_index' => false ]; diff --git a/database/migrations/2020_03_23_120630_create_related_posts_table.php b/database/migrations/2020_03_23_120630_create_related_posts_table.php index 9dc60ed..be69a3d 100644 --- a/database/migrations/2020_03_23_120630_create_related_posts_table.php +++ b/database/migrations/2020_03_23_120630_create_related_posts_table.php @@ -14,8 +14,9 @@ class CreateRelatedPostsTable extends Migration public function up() { $postsTable = config('nova-blog.blog_posts_table', 'nova_blog_posts'); + $relatedPostsTable = config('nova-blog.blog_related_posts_table', 'nova_blog_related_posts'); - Schema::create('nova_blog_related_posts', function (Blueprint $table) use ($postsTable) { + Schema::create($relatedPostsTable, function (Blueprint $table) use ($postsTable) { $table->bigIncrements('id'); $table->timestamps(); $table->bigInteger('post_id')->unsigned()->nullable(); @@ -32,6 +33,7 @@ public function up() */ public function down() { - Schema::dropIfExists('related_posts'); + $relatedPostsTable = config('nova-blog.blog_related_posts_table', 'nova_blog_related_posts'); + Schema::dropIfExists($relatedPostsTable); } } diff --git a/resources/lang/en.json b/resources/lang/en.json new file mode 100644 index 0000000..4c6a596 --- /dev/null +++ b/resources/lang/en.json @@ -0,0 +1,42 @@ +{ + "novaBlog.navigationItemTitle": "Blog", + "novaBlog.navigationPostsTitle": "Posts", + "novaBlog.navigationCategoriesTitle": "Categories", + "novaBlog.posts": "Posts", + "novaBlog.post": "Post", + "novaBlog.categories": "Categories", + "novaBlog.category": "Category", + "novaBlog.postContent": "Post content", + "novaBlog.textSection": "Text section", + "novaBlog.textContent": "Text content", + "novaBlog.imageSection": "Image section", + "novaBlog.image": "Image", + "novaBlog.imageCaption": "Image caption", + "novaBlog.imageAlt": "Alt (image alternate text)", + "novaBlog.embedMediaSection": "Other embed media section", + "novaBlog.embedMediaCode": "Embed media code (twitter, iframe, etc.)", + "novaBlog.embedMediaCaption": "Media caption", + "novaBlog.textSectionFroala": "Text section in Froala", + "novaBlog.addLayoutButton": "Add section", + "novaBlog.title": "Title", + "novaBlog.isPinned": "Is pinned", + "novaBlog.includeInBloglist": "Include in bloglist", + "novaBlog.slug": "Slug", + "novaBlog.slugOriginal": "Use existing", + "novaBlog.slugNewFromTitle": "Generate new from title", + "novaBlog.slugCreateCustom": "Create custom", + "novaBlog.customSlug": "Custom slug", + "novaBlog.publishedAt": "Published at", + "novaBlog.postIntroduction": "Post introduction", + "novaBlog.featuredImage": "Featured image", + "novaBlog.relatedPosts" : "Related posts", + "novaBlog.locale" : "Locale", + "novaBlog.draft" : "Draft", + "novaBlog.status" : "Status", + "novaBlog.unpublish" : "Unpublish", + "novaBlog.seo": "SEO", + "novaBlog.pageData": "Page data", + "novaBlog.seoTitle": "SEO title", + "novaBlog.seoDescription": "SEO description", + "novaBlog.seoImage": "SEO image" +} diff --git a/resources/lang/it.json b/resources/lang/it.json new file mode 100644 index 0000000..e7b2ae1 --- /dev/null +++ b/resources/lang/it.json @@ -0,0 +1,42 @@ +{ + "novaBlog.navigationItemTitle": "Blog", + "novaBlog.navigationPostsTitle": "Post", + "novaBlog.navigationCategoriesTitle": "Categorie", + "novaBlog.posts": "Post", + "novaBlog.post": "Post", + "novaBlog.categories": "Categorie", + "novaBlog.category": "Categoria", + "novaBlog.postContent": "Contenuto post", + "novaBlog.textSection": "Sezione testo", + "novaBlog.textContent": "Contenuto testo", + "novaBlog.imageSection": "Sezione immagine", + "novaBlog.image": "Immagine", + "novaBlog.imageCaption": "Didascalia immagine", + "novaBlog.imageAlt": "Alt (testo alternativo immagine)", + "novaBlog.embedMediaSection": "Sezione embed media", + "novaBlog.embedMediaCode": "Codice di embed media (twitter, iframe, etc.)", + "novaBlog.embedMediaCaption": "Didascalia media", + "novaBlog.textSectionFroala": "Sezione testo con Froala", + "novaBlog.addLayoutButton": "Aggiungi sezione", + "novaBlog.title": "Titolo", + "novaBlog.isPinned": "In evidenza", + "novaBlog.includeInBloglist": "Includi nella bloglist", + "novaBlog.slug": "Slug", + "novaBlog.slugOriginal": "Usa esistente", + "novaBlog.slugNewFromTitle": "Genera dal titolo", + "novaBlog.slugCreateCustom": "Crea personalizzato", + "novaBlog.customSlug": "Slug personalizzato", + "novaBlog.publishedAt": "Data pubblicazione", + "novaBlog.postIntroduction": "Introduzione post", + "novaBlog.featuredImage": "Immagine fornita", + "novaBlog.relatedPosts" : "Post collegati", + "novaBlog.locale" : "Lingua", + "novaBlog.draft" : "Bozza", + "novaBlog.status" : "Stato", + "novaBlog.unpublish" : "Non pubblicato", + "novaBlog.seo": "SEO", + "novaBlog.pageData": "Dati pagina", + "novaBlog.seoTitle": "SEO title", + "novaBlog.seoDescription": "SEO description", + "novaBlog.seoImage": "SEO image" +} diff --git a/resources/views/navigation.blade.php b/resources/views/navigation.blade.php index f4fdc2e..0353dcc 100755 --- a/resources/views/navigation.blade.php +++ b/resources/views/navigation.blade.php @@ -4,7 +4,7 @@ d="M16,15H9V13H16V15M19,11H9V9H19V11M19,7H9V5H19V7M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3M21,1A2,2 0 0,1 23,3V17C23,18.11 22.11,19 21,19H7A2,2 0 0,1 5,17V3C5,1.89 5.89,1 7,1H21M7,3V17H21V3H7Z"/> - {{config('nova-blog.navigation_title', 'Blog')}} + @lang("novaBlog.navigationItemTitle") @@ -19,7 +19,7 @@ }" class="text-white ml-8 no-underline dim" > - Posts + @lang("novaBlog.navigationPostsTitle")
  • @@ -32,7 +32,7 @@ class="text-white ml-8 no-underline dim" }" class="text-white ml-8 no-underline dim" > - Categories + @lang("novaBlog.navigationCategoriesTitle")
  • diff --git a/src/Models/Post.php b/src/Models/Post.php index 89d954e..48d340d 100755 --- a/src/Models/Post.php +++ b/src/Models/Post.php @@ -41,7 +41,7 @@ public function category() public function relatedPosts() { - return $this->belongsToMany(Post::class, 'nova_blog_related_posts', 'post_id', 'related_post_id'); + return $this->belongsToMany(Post::class, config('nova-blog.blog_related_posts_table', 'nova_blog_related_posts'), 'post_id', 'related_post_id'); } protected static function boot() diff --git a/src/Models/RelatedPost.php b/src/Models/RelatedPost.php index dcd9305..3efc613 100644 --- a/src/Models/RelatedPost.php +++ b/src/Models/RelatedPost.php @@ -9,5 +9,11 @@ class RelatedPost extends Model protected $fillable = [ 'post_id', 'related_post_id' ]; - protected $table = 'nova_blog_related_posts'; + + public function __construct(array $attributes = []) + { + parent::__construct($attributes); + $this->setTable(config('nova-blog.blog_related_posts_table', 'nova_blog_related_posts')); + } + } diff --git a/src/Nova/Category.php b/src/Nova/Category.php index b2ca62b..4e087f9 100644 --- a/src/Nova/Category.php +++ b/src/Nova/Category.php @@ -44,8 +44,8 @@ public function fields(Request $request) { return [ ID::make()->sortable(), - Text::make('Title', 'title'), - Slug::make('Slug', 'slug')->rules('required', 'alpha_dash_or_slash'), + Text::make(__('novaBlog.title'), 'title'), + Slug::make(__('novaBlog.slug'), 'slug')->rules('required', 'alpha_dash_or_slash'), ]; } @@ -92,4 +92,14 @@ public function actions(Request $request) { return []; } + + public static function label() + { + return __('novaBlog.categories'); + } + + public static function singularLabel() + { + return __('novaBlog.category'); + } } diff --git a/src/Nova/Post.php b/src/Nova/Post.php index 2c646f2..ea82a52 100755 --- a/src/Nova/Post.php +++ b/src/Nova/Post.php @@ -9,7 +9,6 @@ use Laravel\Nova\Fields\Text; use Laravel\Nova\Fields\Image; use Laravel\Nova\Fields\Boolean; -use Laravel\Nova\Fields\Heading; use Laravel\Nova\Fields\DateTime; use Laravel\Nova\Fields\Markdown; use Laravel\Nova\Fields\Textarea; @@ -53,42 +52,49 @@ public function fields(Request $request) }); $relatedPosts = RelatedPost::where('post_id', $this->id)->pluck('related_post_id'); - $showCategoryColumnInIndex = config('nova-blog.hide_category_selector') === true ? null : BelongsTo::make('Category', 'category', 'OptimistDigital\NovaBlog\Nova\Category')->nullable(); - $hideCategoryColumnInIndex = config('nova-blog.hide_category_selector') === true ? null : BelongsTo::make('Category', 'category', 'OptimistDigital\NovaBlog\Nova\Category')->nullable()->hideFromIndex(); + $showCategoryColumnInIndex = config('nova-blog.hide_category_selector') === true ? null : BelongsTo::make(__('novaBlog.category'), 'category', 'OptimistDigital\NovaBlog\Nova\Category')->nullable(); + $hideCategoryColumnInIndex = config('nova-blog.hide_category_selector') === true ? null : BelongsTo::make(__('novaBlog.category'), 'category', 'OptimistDigital\NovaBlog\Nova\Category')->nullable()->hideFromIndex(); - $postContent = Flexible::make('Post content', 'post_content')->hideFromIndex() - ->addLayout('Text section', 'text', [ - config('nova-blog.use_trix') === true ? Trix::make('Text content', 'text_content') : Markdown::make('Text content', 'text_content'), + $postContent = Flexible::make(__('novaBlog.postContent'), 'post_content')->hideFromIndex() + ->addLayout(__('novaBlog.textSection'), 'text', [ + config('nova-blog.use_trix') === true ? Trix::make(__('novaBlog.textContent'), 'text_content') : Markdown::make(__('novaBlog.textContent'), 'text_content'), ]) - ->addLayout('Image section', 'image', [ - Image::make('Image', 'image')->deletable(false)->creationRules('required'), - Text::make('Image caption', 'caption'), - Text::make('Alt (image alternate text)', 'alt') + ->addLayout(__('novaBlog.imageSection'), 'image', [ + Image::make(__('novaBlog.image'), 'image')->deletable(false)->creationRules('required'), + Text::make(__('novaBlog.imageCaption'), 'caption'), + Text::make(__('novaBlog.imageAlt'), 'alt') ]) - ->addLayout('Other embed media section', 'other_media', [ - Textarea::make('Embed media code (twitter, iframe, etc.)', 'media_code'), - Text::make('Media caption', 'caption') - ]); + ->addLayout(__('novaBlog.embedMediaSection'), 'other_media', [ + Textarea::make(__('novaBlog.embedMediaCode'), 'media_code'), + Text::make(__('novaBlog.embedMediaCaption'), 'caption') + ])->button(__('novaBlog.addLayoutButton')); if (config('nova-blog.include_froala_texteditor_option')) { - $postContent->addLayout('Text section in Froala', 'text_froala', [ - Froala::make('Text section in Froala', 'text_content_froala'), + $postContent->addLayout(__('novaBlog.textSectionFroala'), 'text_froala', [ + Froala::make(__('novaBlog.textSectionFroala'), 'text_content_froala'), ]); } $fields = [ ID::make()->sortable(), - config('nova-blog.use_trix') === true ? Trix::make('Title', 'title')->rules('required')->alwaysShow() : Title::make('Title', 'title')->rules('required')->alwaysShow(), - config('nova-blog.hide_pinned_post_option') === true ? null : Boolean::make('Is pinned', 'is_pinned'), - config('nova-blog.include_include_in_bloglist') === true ? Boolean::make('Include in bloglist', 'include_in_bloglist') : null, - Slug::make('Slug', 'slug')->rules('required', 'alpha_dash_or_slash')->hideWhenUpdating()->hideFromIndex()->hideFromDetail(), - Select::make('Slug', 'slug_generation')->options(['original' => 'Use existing', 'new_from_title' => 'Generate new from title', 'custom' => 'Create custom'])->hideWhenCreating()->hideFromDetail()->hideFromIndex()->rules('required')->resolveUsing(function () { + config('nova-blog.use_trix') === true ? Trix::make(__('novaBlog.title'), 'title')->rules('required')->alwaysShow() : Title::make(__('novaBlog.title'), 'title')->rules('required')->alwaysShow(), + config('nova-blog.hide_pinned_post_option') === true ? null : Boolean::make(__('novaBlog.isPinned'), 'is_pinned'), + config('nova-blog.include_include_in_bloglist') === true ? Boolean::make(__('novaBlog.includeInBloglist'), 'include_in_bloglist') : null, + Slug::make(__('novaBlog.slug'), 'slug')->rules('required', 'alpha_dash_or_slash')->hideWhenUpdating()->hideFromIndex()->hideFromDetail(), + Select::make(__('novaBlog.slug'), 'slug_generation') + ->options( + [ + 'original' => __('novaBlog.slugOriginal'), + 'new_from_title' => __('novaBlog.slugNewFromTitle'), + 'custom' => __('novaBlog.slugCreateCustom') + ] + )->hideWhenCreating()->hideFromDetail()->hideFromIndex()->rules('required')->resolveUsing(function () { return $this->slug_generation ?? 'original'; }), ConditionalContainer::make([ - Slug::make('Custom slug', 'slug')->rules('required'), + Slug::make(__('novaBlog.customSlug'), 'slug')->rules('required'), ])->if('slug_generation = custom'), - Text::make('Slug', function () { + Text::make(__('novaBlog.slug'), function () { $previewToken = $this->childDraft ? $this->childDraft->preview_token : $this->preview_token; $previewPart = $previewToken ? '?preview=' . $previewToken : ''; $pagePath = $this->resource->slug; @@ -103,22 +109,22 @@ public function fields(Request $request) $buttonText "; })->asHtml()->exceptOnForms(), - DateTime::make('Published at', 'published_at')->rules('required'), - Textarea::make('Post introduction', 'post_introduction'), - config('nova-blog.include_featured_image') === true ? Image::make('Featured image', 'featured_image') : null, + DateTime::make(__('novaBlog.publishedAt'), 'published_at')->rules('required'), + Textarea::make(__('novaBlog.postIntroduction'), 'post_introduction'), + config('nova-blog.include_featured_image') === true ? Image::make(__('novaBlog.featuredImage'), 'featured_image') : null, (config('nova-blog.hide_category_column_from_index') === true) ? $hideCategoryColumnInIndex : $showCategoryColumnInIndex, $postContent, config('nova-blog.include_related_posts_feature') === true && config('nova-blog.hide_related_posts_column_from_index') === false ? Multiselect - ::make('Related posts', 'related_posts') + ::make(__('novaBlog.relatedPosts'), 'related_posts') ->options($relatedPostOptions) ->withMeta(['value' => $relatedPosts]) : null, config('nova-blog.include_related_posts_feature') === true && config('nova-blog.hide_related_posts_column_from_index') === true ? Multiselect - ::make('Related posts', 'related_posts') + ::make(__('novaBlog.relatedPosts'), 'related_posts') ->options($relatedPostOptions) ->withMeta(['value' => $relatedPosts]) ->hideFromIndex() @@ -126,44 +132,44 @@ public function fields(Request $request) ]; if (NovaBlog::hasNovaLang()) { - config('nova-blog.hide_locale_column_from_index') === true ? $fields[] = \OptimistDigital\NovaLang\NovaLangField::make('Locale', 'locale', 'locale_parent_id')->onlyOnForms()->hideFromIndex() : - $fields[] = \OptimistDigital\NovaLang\NovaLangField::make('Locale', 'locale', 'locale_parent_id')->onlyOnForms(); + config('nova-blog.hide_locale_column_from_index') === true ? $fields[] = \OptimistDigital\NovaLang\NovaLangField::make(__('novaBlog.locale'), 'locale', 'locale_parent_id')->onlyOnForms()->hideFromIndex() : + $fields[] = \OptimistDigital\NovaLang\NovaLangField::make(__('novaBlog.locale'), 'locale', 'locale_parent_id')->onlyOnForms(); } else { - config('nova-blog.hide_locale_column_from_index') === true ? $fields[] = LocaleField::make('Locale', 'locale', 'locale_parent_id') + config('nova-blog.hide_locale_column_from_index') === true ? $fields[] = LocaleField::make(__('novaBlog.locale'), 'locale', 'locale_parent_id') ->locales($locales) ->onlyOnForms()->hideFromIndex() : - $fields[] = LocaleField::make('Locale', 'locale', 'locale_parent_id') + $fields[] = LocaleField::make(__('novaBlog.locale'), 'locale', 'locale_parent_id') ->locales($locales) ->onlyOnForms(); } if (count($locales) > 1) { - config('nova-blog.hide_locale_column_from_index') === true ? $fields[] = LocaleField::make('Locale', 'locale', 'locale_parent_id') + config('nova-blog.hide_locale_column_from_index') === true ? $fields[] = LocaleField::make(__('novaBlog.locale'), 'locale', 'locale_parent_id') ->locales($locales) ->exceptOnForms() ->hideFromIndex() : - $fields[] = LocaleField::make('Locale', 'locale', 'locale_parent_id') + $fields[] = LocaleField::make(__('novaBlog.locale'), 'locale', 'locale_parent_id') ->locales($locales) ->exceptOnForms() ->maxLocalesOnIndex(3); } else if ($hasManyDifferentLocales) { - config('nova-blog.hide_locale_column_from_index') === true ? $fields[] = Text::make('Locale', 'locale')->exceptOnForms()->hideFromIndex() : - $fields[] = Text::make('Locale', 'locale')->exceptOnForms(); + config('nova-blog.hide_locale_column_from_index') === true ? $fields[] = Text::make(__('novaBlog.locale'), 'locale')->exceptOnForms()->hideFromIndex() : + $fields[] = Text::make(__('novaBlog.locale'), 'locale')->exceptOnForms(); } if (NovaBlog::hasNovaDrafts()) { - $fields[] = \OptimistDigital\NovaDrafts\DraftButton::make('Draft'); - $fields[] = \OptimistDigital\NovaDrafts\PublishedField::make('State', 'published'); - $fields[] = \OptimistDigital\NovaDrafts\UnpublishButton::make('Unpublish'); + $fields[] = \OptimistDigital\NovaDrafts\DraftButton::make(__('novaBlog.draft'),'draft'); + $fields[] = \OptimistDigital\NovaDrafts\PublishedField::make(__('novaBlog.status'), 'published'); + $fields[] = \OptimistDigital\NovaDrafts\UnpublishButton::make(__('novaBlog.unpublish'),'Unpublish'); } - $fields[] = new Panel('SEO', $this->getSeoFields()); + $fields[] = new Panel(__('novaBlog.seo'), $this->getSeoFields()); if (count($templateFieldsAndPanels['fields']) > 0) { $fields[] = new Panel( - 'Page data', + __('novaBlog.pageData'), array_merge( - [Heading::make('Page data')->hideFromDetail()], + [Heading::make(__('novaBlog.pageData'))->hideFromDetail()], $templateFieldsAndPanels['fields'] ) ); @@ -180,10 +186,9 @@ public function fields(Request $request) protected function getSeoFields() { return [ - Heading::make('SEO'), - Text::make('SEO Title', 'seo_title')->hideFromIndex(), - Text::make('SEO Description', 'seo_description')->hideFromIndex(), - Image::make('SEO Image', 'seo_image')->hideFromIndex(), + Text::make(__('novaBlog.seoTitle'), 'seo_title')->hideFromIndex(), + Text::make(__('novaBlog.seoDescription'), 'seo_description')->hideFromIndex(), + Image::make(__('novaBlog.seoImage'), 'seo_image')->hideFromIndex(), ]; } @@ -203,4 +208,14 @@ public static function indexQuery(NovaRequest $request, $query) }); return $query; } + + public static function label() + { + return __('novaBlog.posts'); + } + + public static function singularLabel() + { + return __('novaBlog.post'); + } } diff --git a/src/ToolServiceProvider.php b/src/ToolServiceProvider.php index f69089a..34d13f6 100755 --- a/src/ToolServiceProvider.php +++ b/src/ToolServiceProvider.php @@ -7,9 +7,11 @@ use Laravel\Nova\Nova; use OptimistDigital\NovaBlog\Nova\Category; use OptimistDigital\NovaBlog\Nova\Post; +use OptimistDigital\NovaTranslationsLoader\LoadsNovaTranslations; class ToolServiceProvider extends ServiceProvider { + use LoadsNovaTranslations; /** * Bootstrap any application services. * @@ -21,6 +23,8 @@ public function boot() $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); + $this->loadTranslations(__DIR__ . '/../resources/lang', 'nova-blog', true); + $this->publishes([ __DIR__ . '/../database/migrations' => database_path('migrations'), ], 'migrations'); From 34fd71b999b845a2b75f0972d71a29a47357d47b Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 26 Oct 2021 15:01:00 +0200 Subject: [PATCH 02/11] fix table name --- .../2020_04_13_093941_add_locale_parent_id_column_to_posts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2020_04_13_093941_add_locale_parent_id_column_to_posts.php b/database/migrations/2020_04_13_093941_add_locale_parent_id_column_to_posts.php index 3bdc2ee..8c32577 100644 --- a/database/migrations/2020_04_13_093941_add_locale_parent_id_column_to_posts.php +++ b/database/migrations/2020_04_13_093941_add_locale_parent_id_column_to_posts.php @@ -19,7 +19,7 @@ public function up() Schema::table($postsTable, function (Blueprint $table) { $table->unsignedBigInteger('locale_parent_id')->nullable(); - $table->foreign('locale_parent_id')->references('id')->on($table); + $table->foreign('locale_parent_id')->references('id')->on($postsTable); }); } From 5937a9924fdc4a343fb9f7f03c8dd60b1d62b283 Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 26 Oct 2021 15:03:26 +0200 Subject: [PATCH 03/11] fix --- .../2020_04_13_093941_add_locale_parent_id_column_to_posts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2020_04_13_093941_add_locale_parent_id_column_to_posts.php b/database/migrations/2020_04_13_093941_add_locale_parent_id_column_to_posts.php index 8c32577..a2a799d 100644 --- a/database/migrations/2020_04_13_093941_add_locale_parent_id_column_to_posts.php +++ b/database/migrations/2020_04_13_093941_add_locale_parent_id_column_to_posts.php @@ -16,7 +16,7 @@ public function up() { $postsTable = config('nova-blog.blog_posts_table', 'nova_blog_posts'); - Schema::table($postsTable, function (Blueprint $table) { + Schema::table($postsTable, function (Blueprint $table) use ($postsTable) { $table->unsignedBigInteger('locale_parent_id')->nullable(); $table->foreign('locale_parent_id')->references('id')->on($postsTable); From 7581b0e52a368a6ead3a8a2edd9aa6518b20d7b3 Mon Sep 17 00:00:00 2001 From: Alberto Peripolli Date: Tue, 4 Jan 2022 10:55:19 +0100 Subject: [PATCH 04/11] - add custom model config --- config/nova-blog.php | 34 ++++++++++++++++++++++++++++++++++ src/Nova/Category.php | 35 +++++++++++++++-------------------- src/Nova/Post.php | 19 +++++++++++++++++-- src/NovaBlog.php | 15 +++++++++++++++ 4 files changed, 81 insertions(+), 22 deletions(-) diff --git a/config/nova-blog.php b/config/nova-blog.php index 27c509a..e0b500b 100755 --- a/config/nova-blog.php +++ b/config/nova-blog.php @@ -73,6 +73,40 @@ 'locales' => ['en' => 'English'], + /* + |-------------------------------------------------------------------------- + | Overwrite the category model with a custom implementation + |-------------------------------------------------------------------------- + | + | Add a custom implementation of the Category model. + | + */ + + 'category_model' => \OptimistDigital\NovaBlog\Models\Category::class, + + /* + |-------------------------------------------------------------------------- + | Overwrite the post model with a custom implementation + |-------------------------------------------------------------------------- + | + | Add a custom implementation of the Post model. + | + */ + + 'post_model' => \OptimistDigital\NovaBlog\Models\Post::class, + + /* + |-------------------------------------------------------------------------- + | Overwrite the related post model with a custom implementation + |-------------------------------------------------------------------------- + | + | Add a custom implementation of the RelatedPost model. + | + */ + + 'related_post_model' => \OptimistDigital\NovaBlog\Models\RelatedPost::class, + + 'hide_pinned_post_option' => false, 'hide_category_selector' => false, diff --git a/src/Nova/Category.php b/src/Nova/Category.php index 4e087f9..ccd6a92 100644 --- a/src/Nova/Category.php +++ b/src/Nova/Category.php @@ -6,33 +6,28 @@ use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\Text; use OptimistDigital\NovaBlog\Nova\Fields\Slug; +use OptimistDigital\NovaBlog\NovaBlog; class Category extends TemplateResource { public static $displayInNavigation = false; - /** - * The model the resource corresponds to. - * - * @var string - */ - public static $model = 'OptimistDigital\NovaBlog\Models\Category'; - - /** - * The single value that should be used to represent the resource when being displayed. - * - * @var string - */ + public static $model = null; public static $title = 'title'; + public static $search = ['id','title','slug']; - /** - * The columns that should be searched. - * - * @var array - */ - public static $search = [ - 'id', - ]; + public function __construct($resource) + { + self::$model = NovaBlog::getCategoryModel(); + parent::__construct($resource); + } + + public static function newModel() + { + $model = empty(self::$model) ? NovaBlog::getCategoryModel() : self::$model; + + return new $model; + } /** * Get the fields displayed by the resource. diff --git a/src/Nova/Post.php b/src/Nova/Post.php index ea82a52..9b04611 100755 --- a/src/Nova/Post.php +++ b/src/Nova/Post.php @@ -29,12 +29,27 @@ class Post extends TemplateResource { use HasConditionalContainer; - public static $title = 'name'; - public static $model = 'OptimistDigital\NovaBlog\Models\Post'; + + public static $title = 'title'; + public static $model = null; public static $displayInNavigation = false; + public static $search = ['title', 'slug']; protected $type = 'post'; + public function __construct($resource) + { + self::$model = NovaBlog::getPostModel(); + parent::__construct($resource); + } + + public static function newModel() + { + $model = empty(self::$model) ? NovaBlog::getPostModel() : self::$model; + + return new $model; + } + public function fields(Request $request) { // Get base data diff --git a/src/NovaBlog.php b/src/NovaBlog.php index b117b7b..ae58562 100755 --- a/src/NovaBlog.php +++ b/src/NovaBlog.php @@ -46,6 +46,21 @@ public static function hasNovaDrafts() return class_exists('\OptimistDigital\NovaDrafts\DraftButton') || class_exists('\OptimistDigital\NovaDrafts\PublishedField'); } + public static function getCategoryModel(): string + { + return config('nova-blog.category_model', \OptimistDigital\NovaBlog\Models\Category::class); + } + + public static function getPostModel(): string + { + return config('nova-blog.post_model', \OptimistDigital\NovaBlog\Models\Post::class); + } + + public static function getRelatedPostModel(): string + { + return config('nova-blog.related_post_model', \OptimistDigital\NovaBlog\Models\RelatedPost::class); + } + public static function getPageUrl(Post $post) { $getPostUrl = config('nova-blog.page_url'); From 68c32503059557aeefafe5c30724f621500ab391 Mon Sep 17 00:00:00 2001 From: Alberto Peripolli Date: Tue, 4 Jan 2022 11:46:35 +0100 Subject: [PATCH 05/11] - change into translatable fields on categories --- composer.json | 4 +- ...9_08_14_121846_create_categories_table.php | 2 +- ...2019_09_12_161000_add_slug_to_category.php | 2 +- ...8_03_000000_add_sort_order_to_category.php | 2 +- ...000000_add_multilanguage_to_categories.php | 37 +++++++++++++++++++ src/Models/Category.php | 5 +++ src/Nova/Category.php | 4 +- 7 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 database/migrations/2022_01_03_000000_add_multilanguage_to_categories.php diff --git a/composer.json b/composer.json index e3d3585..44b0a91 100755 --- a/composer.json +++ b/composer.json @@ -32,8 +32,10 @@ "optimistdigital/nova-locale-field": "^2.0", "whitecube/nova-flexible-content": "^0.2.4", "optimistdigital/nova-multiselect-field": ">=1.8.1", + "optimistdigital/nova-translatable": ">=1.11", "digital-creative/conditional-container": "^1.3", - "froala/nova-froala-field": "^3.4" + "froala/nova-froala-field": "^3.4", + "spatie/laravel-translatable": "^5.1", "optimistdigital/nova-sortable": "^2.3.4" }, "autoload": { diff --git a/database/migrations/2019_08_14_121846_create_categories_table.php b/database/migrations/2019_08_14_121846_create_categories_table.php index 22e0bf7..f8dfcf7 100644 --- a/database/migrations/2019_08_14_121846_create_categories_table.php +++ b/database/migrations/2019_08_14_121846_create_categories_table.php @@ -17,8 +17,8 @@ public function up() Schema::create($table, function (Blueprint $table) { $table->bigIncrements('id'); - $table->timestamps(); $table->string('title'); + $table->timestamps(); }); } diff --git a/database/migrations/2019_09_12_161000_add_slug_to_category.php b/database/migrations/2019_09_12_161000_add_slug_to_category.php index d328f0e..6fbceb7 100644 --- a/database/migrations/2019_09_12_161000_add_slug_to_category.php +++ b/database/migrations/2019_09_12_161000_add_slug_to_category.php @@ -15,7 +15,7 @@ public function up() { $categoriesTable = config('nova-blog.blog_categories_table', 'nova_blog_categories'); Schema::table($categoriesTable, function (Blueprint $table) { - $table->string('slug')->default(''); + $table->string('slug')->default('')->after('title'); }); } diff --git a/database/migrations/2021_08_03_000000_add_sort_order_to_category.php b/database/migrations/2021_08_03_000000_add_sort_order_to_category.php index c3ed11c..bb8a295 100644 --- a/database/migrations/2021_08_03_000000_add_sort_order_to_category.php +++ b/database/migrations/2021_08_03_000000_add_sort_order_to_category.php @@ -16,7 +16,7 @@ public function up() { $categoriesTable = config('nova-blog.blog_categories_table', 'nova_blog_categories'); Schema::table($categoriesTable, function (Blueprint $table) { - $table->integer('sort_order'); + $table->integer('sort_order')->after('slug'); }); DB::statement("UPDATE $categoriesTable SET sort_order = id"); diff --git a/database/migrations/2022_01_03_000000_add_multilanguage_to_categories.php b/database/migrations/2022_01_03_000000_add_multilanguage_to_categories.php new file mode 100644 index 0000000..15dbb48 --- /dev/null +++ b/database/migrations/2022_01_03_000000_add_multilanguage_to_categories.php @@ -0,0 +1,37 @@ +json('title')->change(); + $table->json('slug')->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + } +} diff --git a/src/Models/Category.php b/src/Models/Category.php index bffafa3..01e4e7a 100644 --- a/src/Models/Category.php +++ b/src/Models/Category.php @@ -5,15 +5,20 @@ use Spatie\EloquentSortable\Sortable; use Spatie\EloquentSortable\SortableTrait; use Illuminate\Database\Eloquent\Model; +use Spatie\Translatable\HasTranslations; class Category extends Model implements Sortable { use SortableTrait; + use HasTranslations; public $sortable = [ 'order_column_name' => 'sort_order', 'sort_when_creating' => true, ]; + + public $translatable = ['title','slug']; + public function __construct(array $attributes = []) { parent::__construct($attributes); diff --git a/src/Nova/Category.php b/src/Nova/Category.php index 248898a..25ca185 100644 --- a/src/Nova/Category.php +++ b/src/Nova/Category.php @@ -41,8 +41,8 @@ public function fields(Request $request) { return [ ID::make()->sortable(), - Text::make(__('novaBlog.title'), 'title'), - Slug::make(__('novaBlog.slug'), 'slug')->rules('required', 'alpha_dash_or_slash'), + Text::make(__('novaBlog.title'), 'title')->translatable(), + Slug::make(__('novaBlog.slug'), 'slug')->rules('required', 'alpha_dash_or_slash')->translatable(), ]; } From 8f213e9535bceed8d3492a3352dd27f8899cd14d Mon Sep 17 00:00:00 2001 From: Alberto Peripolli Date: Tue, 4 Jan 2022 12:01:58 +0100 Subject: [PATCH 06/11] fix migration --- .../2022_01_03_000000_add_multilanguage_to_categories.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/database/migrations/2022_01_03_000000_add_multilanguage_to_categories.php b/database/migrations/2022_01_03_000000_add_multilanguage_to_categories.php index 15dbb48..a6e6588 100644 --- a/database/migrations/2022_01_03_000000_add_multilanguage_to_categories.php +++ b/database/migrations/2022_01_03_000000_add_multilanguage_to_categories.php @@ -16,13 +16,13 @@ public function up() { $categoriesTable = config('nova-blog.blog_categories_table', 'nova_blog_categories'); $locales = \OptimistDigital\NovaBlog\NovaBlog::getLocales(); - $mainLocale = reset($locales); + $mainLocale = key($locales); DB::statement("UPDATE ".$categoriesTable." SET title = CONCAT('{\"".$mainLocale."\":\"',title,'\"}'), slug = CONCAT('{\"".$mainLocale."\":\"',slug,'\"}') "); Schema::table($categoriesTable, function (Blueprint $table) { - $table->json('title')->change(); - $table->json('slug')->change(); + $table->json('title')->default(NULL)->change(); + $table->json('slug')->default(NULL)->change(); }); } From 2c564518affb0214a36c03ef4ae235215ab9e33e Mon Sep 17 00:00:00 2001 From: Alberto Peripolli Date: Wed, 5 Jan 2022 10:06:52 +0100 Subject: [PATCH 07/11] - update mix script - update slug component to accept translatable fields - refactor POST to use flexible Layout and Preset - add custom preset config - add button flexible layout --- composer.json | 1 + config/nova-blog.php | 11 + dist/js/nova-blog-dist.js | 2 +- package-lock.json | 18182 +++++++++++----- package.json | 13 +- resources/lang/en.json | 3 + resources/lang/it.json | 3 + resources/slug-field/components/SlugField.vue | 26 +- src/Nova/Flexible/Layouts/ButtonLayout.php | 43 + .../Flexible/Layouts/EmbedMediaLayout.php | 38 + src/Nova/Flexible/Layouts/ImageLayout.php | 39 + src/Nova/Flexible/Layouts/TextLayout.php | 36 + src/Nova/Flexible/Presets/ContentPreset.php | 24 + src/Nova/Post.php | 13 +- src/NovaBlog.php | 5 + webpack.mix.js | 2 +- 16 files changed, 12686 insertions(+), 5755 deletions(-) create mode 100644 src/Nova/Flexible/Layouts/ButtonLayout.php create mode 100644 src/Nova/Flexible/Layouts/EmbedMediaLayout.php create mode 100644 src/Nova/Flexible/Layouts/ImageLayout.php create mode 100644 src/Nova/Flexible/Layouts/TextLayout.php create mode 100644 src/Nova/Flexible/Presets/ContentPreset.php diff --git a/composer.json b/composer.json index 44b0a91..3a8a1c9 100755 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "digital-creative/conditional-container": "^1.3", "froala/nova-froala-field": "^3.4", "spatie/laravel-translatable": "^5.1", + "inspheric/nova-url-field": "^1.4", "optimistdigital/nova-sortable": "^2.3.4" }, "autoload": { diff --git a/config/nova-blog.php b/config/nova-blog.php index e0b500b..a041ab5 100755 --- a/config/nova-blog.php +++ b/config/nova-blog.php @@ -95,6 +95,17 @@ 'post_model' => \OptimistDigital\NovaBlog\Models\Post::class, + /* + |-------------------------------------------------------------------------- + | Overwrite the content preset with a custom implementation + |-------------------------------------------------------------------------- + | + | Add a custom implementation of the Content preset. + | + */ + + 'content_preset' => \OptimistDigital\NovaBlog\Nova\Flexible\Presets\ContentPreset::class, + /* |-------------------------------------------------------------------------- | Overwrite the related post model with a custom implementation diff --git a/dist/js/nova-blog-dist.js b/dist/js/nova-blog-dist.js index 9651c09..bff1a7e 100644 --- a/dist/js/nova-blog-dist.js +++ b/dist/js/nova-blog-dist.js @@ -1,2 +1,2 @@ /*! For license information please see nova-blog-dist.js.LICENSE.txt */ -!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=2)}([function(t,e,n){var r;r=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.i=function(t){return t},n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=49)}([function(t,e,n){"use strict";var r=n(48),o=n(159),i=Object.prototype.toString;function u(t){return"[object Array]"===i.call(t)}function a(t){return null!==t&&"object"==typeof t}function c(t){return"[object Function]"===i.call(t)}function s(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),u(t))for(var n=0,r=t.length;n=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(t){c.headers[t]={}})),r.forEach(["post","put","patch"],(function(t){c.headers[t]=r.merge(i)})),t.exports=c}).call(e,n(77))},function(t,e,n){"use strict";e.__esModule=!0;var r,o=n(116),i=(r=o)&&r.__esModule?r:{default:r};e.default=function(t,e,n){return e in t?(0,i.default)(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var r=n(9),o=n(1).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=!0},function(t,e,n){"use strict";var r=n(14);function o(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=r(e),this.reject=r(n)}t.exports.f=function(t){return new o(t)}},function(t,e,n){var r=n(11).f,o=n(17),i=n(2)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},function(t,e,n){var r=n(62)("keys"),o=n(67);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},function(t,e,n){var r=n(56),o=n(27);t.exports=function(t){return r(o(t))}},function(t,e,n){var r=n(12).Symbol;t.exports=r},function(t,e,n){var r=n(173),o=n(192);t.exports=function(t,e){var n=o(t,e);return r(n)?n:void 0}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e){t.exports=function(t){return t}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mapProps=void 0;var r,o=n(237),i=(r=o)&&r.__esModule?r:{default:r},u={showHelpText:{type:Boolean,default:!1},shownViaNewRelationModal:{type:Boolean,default:!1},resourceId:{type:[Number,String]},resourceName:{type:String},field:{type:Object,required:!0},viaResource:{type:String,required:!1},viaResourceId:{type:[String,Number],required:!1},viaRelationship:{type:String,required:!1},shouldOverrideMeta:{type:Boolean,default:!1}};e.mapProps=function(t){return i.default.pick(u,t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=["1/2","1/3","2/3","1/4","3/4","1/5","2/5","3/5","4/5","1/6","5/6"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(157);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i(r).default}}),Object.defineProperty(e,"Form",{enumerable:!0,get:function(){return i(r).default}});var o=n(68);function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"Errors",{enumerable:!0,get:function(){return i(o).default}})},function(t,e,n){"use strict";(function(e){var r=n(0),o=n(104),i=n(107),u=n(113),a=n(111),c=n(47),s="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||n(106);t.exports=function(t){return new Promise((function(f,l){var p=t.data,h=t.headers;r.isFormData(p)&&delete h["Content-Type"];var v=new XMLHttpRequest,d="onreadystatechange",g=!1;if("test"===e.env.NODE_ENV||"undefined"==typeof window||!window.XDomainRequest||"withCredentials"in v||a(t.url)||(v=new window.XDomainRequest,d="onload",g=!0,v.onprogress=function(){},v.ontimeout=function(){}),t.auth){var y=t.auth.username||"",_=t.auth.password||"";h.Authorization="Basic "+s(y+":"+_)}if(v.open(t.method.toUpperCase(),i(t.url,t.params,t.paramsSerializer),!0),v.timeout=t.timeout,v[d]=function(){if(v&&(4===v.readyState||g)&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))){var e="getAllResponseHeaders"in v?u(v.getAllResponseHeaders()):null,n={data:t.responseType&&"text"!==t.responseType?v.response:v.responseText,status:1223===v.status?204:v.status,statusText:1223===v.status?"No Content":v.statusText,headers:e,config:t,request:v};o(f,l,n),v=null}},v.onerror=function(){l(c("Network Error",t,null,v)),v=null},v.ontimeout=function(){l(c("timeout of "+t.timeout+"ms exceeded",t,"ECONNABORTED",v)),v=null},r.isStandardBrowserEnv()){var m=n(109),b=(t.withCredentials||a(t.url))&&t.xsrfCookieName?m.read(t.xsrfCookieName):void 0;b&&(h[t.xsrfHeaderName]=b)}if("setRequestHeader"in v&&r.forEach(h,(function(t,e){void 0===p&&"content-type"===e.toLowerCase()?delete h[e]:v.setRequestHeader(e,t)})),t.withCredentials&&(v.withCredentials=!0),t.responseType)try{v.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&v.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&v.upload&&v.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then((function(t){v&&(v.abort(),l(t),v=null)})),void 0===p&&(p=null),v.send(p)}))}}).call(e,n(77))},function(t,e,n){"use strict";function r(t){this.message=t}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,t.exports=r},function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},function(t,e,n){"use strict";var r=n(103);t.exports=function(t,e,n,o,i){var u=new Error(t);return r(u,e,n,o,i)}},function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;rn;)e.push(arguments[n++]);return y[++g]=function(){a("function"==typeof t?t:Function(t),e)},r(g),g},h=function(t){delete y[t]},"process"==n(15)(l)?r=function(t){l.nextTick(u(_,t,1))}:d&&d.now?r=function(t){d.now(u(_,t,1))}:v?(i=(o=new v).port2,o.port1.onmessage=m,r=u(i.postMessage,i,1)):f.addEventListener&&"function"==typeof postMessage&&!f.importScripts?(r=function(t){f.postMessage(t+"","*")},f.addEventListener("message",m,!1)):r="onreadystatechange"in s("script")?function(t){c.appendChild(s("script")).onreadystatechange=function(){c.removeChild(this),_.call(t)}}:function(t){setTimeout(u(_,t,1),0)}),t.exports={set:p,clear:h}},function(t,e,n){var r=n(34),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,e,n){var r=n(27);t.exports=function(t){return Object(r(t))}},function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};o(this,t),this.record(e)}return r(t,[{key:"all",value:function(){return this.errors}},{key:"has",value:function(t){var e=this.errors.hasOwnProperty(t);return e||(e=Object.keys(this.errors).filter((function(e){return e.startsWith(t+".")||e.startsWith(t+"[")})).length>0),e}},{key:"first",value:function(t){return this.get(t)[0]}},{key:"get",value:function(t){return this.errors[t]||[]}},{key:"any",value:function(){return Object.keys(this.errors).length>0}},{key:"record",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.errors=t}},{key:"clear",value:function(t){if(t){var e=Object.assign({},this.errors);Object.keys(e).filter((function(e){return e===t||e.startsWith(t+".")||e.startsWith(t+"[")})).forEach((function(t){return delete e[t]})),this.errors=e}else this.errors={}}}]),t}();e.default=i},function(t,e,n){var r=n(180),o=n(232),i=n(13),u=n(233),a=n(72),c=n(234),s=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=i(t),f=!n&&o(t),l=!n&&!f&&u(t),p=!n&&!f&&!l&&c(t),h=n||f||l||p,v=h?r(t.length,String):[],d=v.length;for(var g in t)!e&&!s.call(t,g)||h&&("length"==g||l&&("offset"==g||"parent"==g)||p&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||a(g,d))||v.push(g);return v}},function(t,e,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(e,n(78))},function(t,e){var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");t.exports=function(t){return n.test(t)}},function(t,e){var n=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991}},function(t,e,n){var r=n(181);t.exports=function(t){return null==t?"":r(t)}},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var c,s=[],f=!1,l=-1;function p(){f&&c&&(f=!1,c.length?s=c.concat(s):l=-1,s.length&&h())}function h(){if(!f){var t=a(p);f=!0;for(var e=s.length;e;){for(c=s,s=[];++l1)for(var n=1;n1&&void 0!==arguments[1]?arguments[1]:null;return this.viaManyToMany?this.detachResources(t):Nova.request({url:"/nova-api/"+this.resourceName,method:"delete",params:(0,i.default)({},this.queryString,{resources:u(t)})}).then(n||function(){e.deleteModalOpen=!1,e.getResources()})},deleteSelectedResources:function(){this.deleteResources(this.selectedResources)},deleteAllMatchingResources:function(){var t=this;return this.viaManyToMany?this.detachAllMatchingResources():Nova.request({url:this.deleteAllMatchingResourcesEndpoint,method:"delete",params:(0,i.default)({},this.queryString,{resources:"all"})}).then((function(){t.deleteModalOpen=!1,t.getResources()}))},detachResources:function(t){var e=this;return Nova.request({url:"/nova-api/"+this.resourceName+"/detach",method:"delete",params:(0,i.default)({},this.queryString,{resources:u(t)})}).then((function(){e.deleteModalOpen=!1,e.getResources()}))},detachAllMatchingResources:function(){var t=this;return Nova.request({url:"/nova-api/"+this.resourceName+"/detach",method:"delete",params:(0,i.default)({},this.queryString,{resources:"all"})}).then((function(){t.deleteModalOpen=!1,t.getResources()}))},forceDeleteResources:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Nova.request({url:"/nova-api/"+this.resourceName+"/force",method:"delete",params:(0,i.default)({},this.queryString,{resources:u(t)})}).then(n||function(){e.deleteModalOpen=!1,e.getResources()})},forceDeleteSelectedResources:function(){this.forceDeleteResources(this.selectedResources)},forceDeleteAllMatchingResources:function(){var t=this;return Nova.request({url:this.forceDeleteSelectedResourcesEndpoint,method:"delete",params:(0,i.default)({},this.queryString,{resources:"all"})}).then((function(){t.deleteModalOpen=!1,t.getResources()}))},restoreResources:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Nova.request({url:"/nova-api/"+this.resourceName+"/restore",method:"put",params:(0,i.default)({},this.queryString,{resources:u(t)})}).then(n||function(){e.restoreModalOpen=!1,e.getResources()})},restoreSelectedResources:function(){this.restoreResources(this.selectedResources)},restoreAllMatchingResources:function(){var t=this;return Nova.request({url:this.restoreAllMatchingResourcesEndpoint,method:"put",params:(0,i.default)({},this.queryString,{resources:"all"})}).then((function(){t.restoreModalOpen=!1,t.getResources()}))}},computed:{deleteAllMatchingResourcesEndpoint:function(){return this.lens?"/nova-api/"+this.resourceName+"/lens/"+this.lens:"/nova-api/"+this.resourceName},forceDeleteSelectedResourcesEndpoint:function(){return this.lens?"/nova-api/"+this.resourceName+"/lens/"+this.lens+"/force":"/nova-api/"+this.resourceName+"/force"},restoreAllMatchingResourcesEndpoint:function(){return this.lens?"/nova-api/"+this.resourceName+"/lens/"+this.lens+"/restore":"/nova-api/"+this.resourceName+"/restore"},queryString:function(){return{search:this.currentSearch,filters:this.encodedFilters,trashed:this.currentTrashed,viaResource:this.viaResource,viaResourceId:this.viaResourceId,viaRelationship:this.viaRelationship}}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o,i,u=s(n(52)),a=s(n(26)),c=s(n(51));function s(t){return t&&t.__esModule?t:{default:t}}s(n(229)),s(n(231)),e.default={methods:{clearSelectedFilters:(i=(0,c.default)(u.default.mark((function t(e){var n;return u.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=5;break}return t.next=3,this.$store.dispatch(this.resourceName+"/resetFilterState",{resourceName:this.resourceName,lens:e});case 3:t.next=7;break;case 5:return t.next=7,this.$store.dispatch(this.resourceName+"/resetFilterState",{resourceName:this.resourceName});case 7:this.updateQueryString((n={},(0,a.default)(n,this.pageParameter,1),(0,a.default)(n,this.filterParameter,""),n));case 8:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)}),filterChanged:function(){var t;this.updateQueryString((t={},(0,a.default)(t,this.pageParameter,1),(0,a.default)(t,this.filterParameter,this.$store.getters[this.resourceName+"/currentEncodedFilters"]),t))},initializeFilters:(o=(0,c.default)(u.default.mark((function t(e){return u.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.$store.commit(this.resourceName+"/clearFilters"),t.next=3,this.$store.dispatch(this.resourceName+"/fetchFilters",{resourceName:this.resourceName,viaResource:this.viaResource,viaResourceId:this.viaResourceId,viaRelationship:this.viaRelationship,lens:e});case 3:return t.next=5,this.initializeState(e);case 5:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)}),initializeState:(r=(0,c.default)(u.default.mark((function t(e){return u.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.initialEncodedFilters){t.next=5;break}return t.next=3,this.$store.dispatch(this.resourceName+"/initializeCurrentFilterValuesFromQueryString",this.initialEncodedFilters);case 3:t.next=7;break;case 5:return t.next=7,this.$store.dispatch(this.resourceName+"/resetFilterState",{resourceName:this.resourceName,lens:e});case 7:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},computed:{filterParameter:function(){return this.resourceName+"_filter"}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(41);e.default={props:(0,r.mapProps)(["shownViaNewRelationModal","field","viaResource","viaResourceId","viaRelationship","resourceName","showHelpText"]),data:function(){return{value:""}},mounted:function(){var t=this;this.setInitialValue(),this.field.fill=this.fill,Nova.$on(this.field.attribute+"-value",(function(e){t.value=e}))},destroyed:function(){Nova.$off(this.field.attribute+"-value")},methods:{setInitialValue:function(){this.value=void 0!==this.field.value&&null!==this.field.value?this.field.value:""},fill:function(t){t.append(this.field.attribute,String(this.value))},handleChange:function(t){this.value=t.target.value,this.field&&Nova.$emit(this.field.attribute+"-change",this.value)}},computed:{isReadonly:function(){return this.field.readonly||_.get(this.field,"extraAttributes.readonly")}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(43);e.default={props:{errors:{default:function(){return new r.Errors}}},data:function(){return{errorClass:"border-danger"}},computed:{errorClasses:function(){return this.hasError?[this.errorClass]:[]},fieldAttribute:function(){return this.field.attribute},validationKey:function(){return this.field.validationKey},hasError:function(){return this.errors.has(this.validationKey)},firstError:function(){if(this.hasError)return this.errors.first(this.validationKey)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=a(n(52)),i=a(n(51)),u=a(n(42));function a(t){return t&&t.__esModule?t:{default:t}}e.default={props:{loadCards:{type:Boolean,default:!0}},data:function(){return{cards:[]}},created:function(){this.fetchCards()},watch:{cardsEndpoint:function(){this.fetchCards()}},methods:{fetchCards:(r=(0,i.default)(o.default.mark((function t(){var e,n;return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.loadCards){t.next=6;break}return t.next=3,Nova.request().get(this.cardsEndpoint,{params:this.extraCardParams});case 3:e=t.sent,n=e.data,this.cards=n;case 6:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},computed:{shouldShowCards:function(){return this.cards.length>0},smallCards:function(){return _.filter(this.cards,(function(t){return-1!==u.default.indexOf(t.width)}))},largeCards:function(){return _.filter(this.cards,(function(t){return"full"==t.width}))},extraCardParams:function(){return null}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={methods:{toAppTimezone:function(t){return t?moment.tz(t,this.userTimezone).clone().tz(Nova.config.timezone).format("YYYY-MM-DD HH:mm:ss"):t},fromAppTimezone:function(t){return t?moment.tz(t,Nova.config.timezone).clone().tz(this.userTimezone).format("YYYY-MM-DD HH:mm:ss"):t},localizeDateTimeField:function(t){if(!t.value)return t.value;var e=moment.tz(t.value,Nova.config.timezone).clone().tz(this.userTimezone);return t.format?e.format(t.format):this.usesTwelveHourTime?e.format("YYYY-MM-DD h:mm:ss A"):e.format("YYYY-MM-DD HH:mm:ss")},localizeDateField:function(t){if(!t.value)return t.value;var e=moment.tz(t.value,Nova.config.timezone).clone().tz(this.userTimezone);return t.format?e.format(t.format):e.format("YYYY-MM-DD")}},computed:{userTimezone:function(){return Nova.config.userTimezone?Nova.config.userTimezone:moment.tz.guess()},usesTwelveHourTime:function(){return _.endsWith((new Date).toLocaleString(),"AM")||_.endsWith((new Date).toLocaleString(),"PM")}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=n(228),i=(r=o)&&r.__esModule?r:{default:r};e.default={methods:{updateQueryString:function(t){this.$router.push({query:(0,i.default)(t,this.$route.query)})}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={computed:{resourceInformation:function(){var t=this;return _.find(Nova.config.resources,(function(e){return e.uriKey==t.resourceName}))},viaResourceInformation:function(){var t=this;if(this.viaResource)return _.find(Nova.config.resources,(function(e){return e.uriKey==t.viaResource}))},authorizedToCreate:function(){return this.resourceInformation.authorizedToCreate}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=n(26),i=(r=o)&&r.__esModule?r:{default:r};e.default={methods:{selectPreviousPage:function(){this.updateQueryString((0,i.default)({},this.pageParameter,this.currentPage-1))},selectNextPage:function(){this.updateQueryString((0,i.default)({},this.pageParameter,this.currentPage+1))}},computed:{currentPage:function(){return parseInt(this.$route.query[this.pageParameter]||1)}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=n(26),i=(r=o)&&r.__esModule?r:{default:r};e.default={data:function(){return{perPage:25}},methods:{initializePerPageFromQueryString:function(){this.perPage=this.currentPerPage},perPageChanged:function(){this.updateQueryString((0,i.default)({},this.perPageParameter,this.perPage))}},computed:{currentPerPage:function(){return this.$route.query[this.perPageParameter]||25}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=n(227),i=(r=o)&&r.__esModule?r:{default:r};e.default={data:function(){return{search:"",selectedResource:"",availableResources:[]}},methods:{selectResource:function(t){this.selectedResource=t,this.field&&Nova.$emit(this.field.attribute+"-change",this.selectedResource.value)},handleSearchCleared:function(){this.availableResources=[]},clearSelection:function(){this.selectedResource="",this.availableResources=[],this.field&&Nova.$emit(this.field.attribute+"-change",null)},performSearch:function(t){var e=this;this.search=t;var n=t.trim();""!=n&&this.debouncer((function(){e.getAvailableResources(n)}),500)},debouncer:(0,i.default)((function(t){return t()}),500)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={beforeRouteLeave:function(t,e,n){this.canLeave||window.confirm(this.__("Do you really want to leave? You have unsaved changes."))?n():n(!1)},data:function(){return{canLeave:!0}},methods:{updateFormStatus:function(){this.canLeave=!1}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={data:function(){return{withTrashed:!1}},methods:{toggleWithTrashed:function(){this.withTrashed=!this.withTrashed},enableWithTrashed:function(){this.withTrashed=!0},disableWithTrashed:function(){this.withTrashed=!1}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return(0,i.default)(t)};var r,o=n(242),i=(r=o)&&r.__esModule?r:{default:r}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=n(50),i=(r=o)&&r.__esModule?r:{default:r};e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return i.default.all([t,new i.default((function(t){setTimeout((function(){return t()}),e)}))]).then((function(t){return t[0]}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){return t>1||0==t?r.Inflector.pluralize(e):r.Inflector.singularize(e)};var r=n(49)},function(t,e,n){"use strict";var r={uncountableWords:["equipment","information","rice","money","species","series","fish","sheep","moose","deer","news"],pluralRules:[[new RegExp("(m)an$","gi"),"$1en"],[new RegExp("(pe)rson$","gi"),"$1ople"],[new RegExp("(child)$","gi"),"$1ren"],[new RegExp("^(ox)$","gi"),"$1en"],[new RegExp("(ax|test)is$","gi"),"$1es"],[new RegExp("(octop|vir)us$","gi"),"$1i"],[new RegExp("(alias|status)$","gi"),"$1es"],[new RegExp("(bu)s$","gi"),"$1ses"],[new RegExp("(buffal|tomat|potat)o$","gi"),"$1oes"],[new RegExp("([ti])um$","gi"),"$1a"],[new RegExp("sis$","gi"),"ses"],[new RegExp("(?:([^f])fe|([lr])f)$","gi"),"$1$2ves"],[new RegExp("(hive)$","gi"),"$1s"],[new RegExp("([^aeiouy]|qu)y$","gi"),"$1ies"],[new RegExp("(x|ch|ss|sh)$","gi"),"$1es"],[new RegExp("(matr|vert|ind)ix|ex$","gi"),"$1ices"],[new RegExp("([m|l])ouse$","gi"),"$1ice"],[new RegExp("(quiz)$","gi"),"$1zes"],[new RegExp("s$","gi"),"s"],[new RegExp("$","gi"),"s"]],singularRules:[[new RegExp("(m)en$","gi"),"$1an"],[new RegExp("(pe)ople$","gi"),"$1rson"],[new RegExp("(child)ren$","gi"),"$1"],[new RegExp("([ti])a$","gi"),"$1um"],[new RegExp("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$","gi"),"$1$2sis"],[new RegExp("(hive)s$","gi"),"$1"],[new RegExp("(tive)s$","gi"),"$1"],[new RegExp("(curve)s$","gi"),"$1"],[new RegExp("([lr])ves$","gi"),"$1f"],[new RegExp("([^fo])ves$","gi"),"$1fe"],[new RegExp("([^aeiouy]|qu)ies$","gi"),"$1y"],[new RegExp("(s)eries$","gi"),"$1eries"],[new RegExp("(m)ovies$","gi"),"$1ovie"],[new RegExp("(x|ch|ss|sh)es$","gi"),"$1"],[new RegExp("([m|l])ice$","gi"),"$1ouse"],[new RegExp("(bus)es$","gi"),"$1"],[new RegExp("(o)es$","gi"),"$1"],[new RegExp("(shoe)s$","gi"),"$1"],[new RegExp("(cris|ax|test)es$","gi"),"$1is"],[new RegExp("(octop|vir)i$","gi"),"$1us"],[new RegExp("(alias|status)es$","gi"),"$1"],[new RegExp("^(ox)en","gi"),"$1"],[new RegExp("(vert|ind)ices$","gi"),"$1ex"],[new RegExp("(matr)ices$","gi"),"$1ix"],[new RegExp("(quiz)zes$","gi"),"$1"],[new RegExp("s$","gi"),""]],nonTitlecasedWords:["and","or","nor","a","an","the","so","but","to","of","at","by","from","into","on","onto","off","out","in","over","with","for"],idSuffix:new RegExp("(_ids|_id)$","g"),underbar:new RegExp("_","g"),spaceOrUnderbar:new RegExp("[ _]","g"),uppercase:new RegExp("([A-Z])","g"),underbarPrefix:new RegExp("^_"),applyRules:function(t,e,n,r){if(r)t=r;else if(!(n.indexOf(t.toLowerCase())>-1))for(var o=0;o>8-u%1*8)){if((n=o.charCodeAt(u+=3/4))>255)throw new r;e=e<<8|n}return i}},function(t,e,n){"use strict";var r=n(0);function o(t){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var i;if(n)i=n(e);else if(r.isURLSearchParams(e))i=e.toString();else{var u=[];r.forEach(e,(function(t,e){null!=t&&(r.isArray(t)?e+="[]":t=[t],r.forEach(t,(function(t){r.isDate(t)?t=t.toISOString():r.isObject(t)&&(t=JSON.stringify(t)),u.push(o(e)+"="+o(t))})))})),i=u.join("&")}return i&&(t+=(-1===t.indexOf("?")?"?":"&")+i),t}},function(t,e,n){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},function(t,e,n){"use strict";var r=n(0);t.exports=r.isStandardBrowserEnv()?{write:function(t,e,n,o,i,u){var a=[];a.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(i)&&a.push("domain="+i),!0===u&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(t,e,n){"use strict";t.exports=function(t){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)}},function(t,e,n){"use strict";var r=n(0);t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function o(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{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 t=o(window.location.href),function(e){var n=r.isString(e)?o(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},function(t,e,n){"use strict";var r=n(0);t.exports=function(t,e){r.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))}},function(t,e,n){"use strict";var r=n(0),o=["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"];t.exports=function(t){var e,n,i,u={};return t?(r.forEach(t.split("\n"),(function(t){if(i=t.indexOf(":"),e=r.trim(t.substr(0,i)).toLowerCase(),n=r.trim(t.substr(i+1)),e){if(u[e]&&o.indexOf(e)>=0)return;u[e]="set-cookie"===e?(u[e]?u[e]:[]).concat([n]):u[e]?u[e]+", "+n:n}})),u):u}},function(t,e,n){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},function(t,e,n){t.exports={default:n(118),__esModule:!0}},function(t,e,n){t.exports={default:n(119),__esModule:!0}},function(t,e,n){"use strict";e.__esModule=!0;var r,o=n(115),i=(r=o)&&r.__esModule?r:{default:r};e.default=i.default||function(t){for(var e=1;ef;)if((a=c[f++])!=a)return!0}else for(;s>f;f++)if((t||f in c)&&c[f]===n)return t||f||0;return!t&&-1}}},function(t,e,n){var r=n(16),o=n(128),i=n(127),u=n(4),a=n(65),c=n(147),s={},f={};(e=t.exports=function(t,e,n,l,p){var h,v,d,g,y=p?function(){return t}:c(t),_=r(n,l,e?2:1),m=0;if("function"!=typeof y)throw TypeError(t+" is not iterable!");if(i(y)){for(h=a(t.length);h>m;m++)if((g=e?_(u(v=t[m])[0],v[1]):_(t[m]))===s||g===f)return g}else for(d=y.call(t);!(v=d.next()).done;)if((g=o(d,_,v.value,e))===s||g===f)return g}).BREAK=s,e.RETURN=f},function(t,e,n){t.exports=!n(5)&&!n(29)((function(){return 7!=Object.defineProperty(n(28)("div"),"a",{get:function(){return 7}}).a}))},function(t,e){t.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){var r=n(10),o=n(2)("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},function(t,e,n){var r=n(4);t.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&r(i.call(t)),e}}},function(t,e,n){"use strict";var r=n(134),o=n(61),i=n(32),u={};n(7)(u,n(2)("iterator"),(function(){return this})),t.exports=function(t,e,n){t.prototype=r(u,{next:o(1,n)}),i(t,e+" Iterator")}},function(t,e,n){var r=n(2)("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var i=[7],u=i[r]();u.next=function(){return{done:n=!0}},i[r]=function(){return u},t(i)}catch(t){}return n}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){var r=n(1),o=n(64).set,i=r.MutationObserver||r.WebKitMutationObserver,u=r.process,a=r.Promise,c="process"==n(15)(u);t.exports=function(){var t,e,n,s=function(){var r,o;for(c&&(r=u.domain)&&r.exit();t;){o=t.fn,t=t.next;try{o()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(c)n=function(){u.nextTick(s)};else if(!i||r.navigator&&r.navigator.standalone)if(a&&a.resolve){var f=a.resolve(void 0);n=function(){f.then(s)}}else n=function(){o.call(r,s)};else{var l=!0,p=document.createTextNode("");new i(s).observe(p,{characterData:!0}),n=function(){p.data=l=!l}}return function(r){var o={fn:r,next:void 0};e&&(e.next=o),t||(t=o,n()),e=o}}},function(t,e,n){"use strict";var r=n(58),o=n(136),i=n(139),u=n(66),a=n(56),c=Object.assign;t.exports=!c||n(29)((function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=c({},t)[n]||Object.keys(c({},e)).join("")!=r}))?function(t,e){for(var n=u(t),c=arguments.length,s=1,f=o.f,l=i.f;c>s;)for(var p,h=a(arguments[s++]),v=f?r(h).concat(f(h)):r(h),d=v.length,g=0;d>g;)l.call(h,p=v[g++])&&(n[p]=h[p]);return n}:c},function(t,e,n){var r=n(4),o=n(135),i=n(54),u=n(33)("IE_PROTO"),a=function(){},c=function(){var t,e=n(28)("iframe"),r=i.length;for(e.style.display="none",n(55).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("