diff --git a/app/Http/Controllers/Calendars/Bulks/EntityEventController.php b/app/Http/Controllers/Calendars/Bulks/EntityEventController.php index 399b2bb021..50eb3a9797 100644 --- a/app/Http/Controllers/Calendars/Bulks/EntityEventController.php +++ b/app/Http/Controllers/Calendars/Bulks/EntityEventController.php @@ -29,6 +29,9 @@ public function index(Request $request, Campaign $campaign, Calendar $calendar) 'campaign' => $campaign, 'calendar' => $calendar]), '_calendar-event', $models, $calendar); } + if (request()->ajax()) { + return response()->json(['success' => true]); + } $count = $this->campaign($campaign)->bulkProcess($request, EntityEvent::class); return redirect() diff --git a/app/Http/Controllers/Campaign/DefaultImageController.php b/app/Http/Controllers/Campaign/DefaultImageController.php index 4033c8fa8a..d4ce3a94f4 100644 --- a/app/Http/Controllers/Campaign/DefaultImageController.php +++ b/app/Http/Controllers/Campaign/DefaultImageController.php @@ -84,7 +84,10 @@ public function store(DefaultImageStore $request, Campaign $campaign) public function destroy(DefaultImageDestroy $request, Campaign $campaign) { $this->authorize('recover', $campaign); - $this->service->campaign($campaign)->type($request->post('entity_type'))->destroy(); + $this->service + ->campaign($campaign) + ->type($request->post('entity_type')) + ->destroy(); return redirect()->route('campaign.default-images', $campaign) ->with( diff --git a/app/Http/Controllers/Campaign/InviteController.php b/app/Http/Controllers/Campaign/InviteController.php index 6dbdf87a46..235892f6fd 100644 --- a/app/Http/Controllers/Campaign/InviteController.php +++ b/app/Http/Controllers/Campaign/InviteController.php @@ -69,12 +69,8 @@ public function store(StoreCampaignInvite $request, Campaign $campaign) $invitation = CampaignInvite::create($data); $link = route('campaigns.join', [$invitation->token]); - $copy = link_to('#', ' ' . __('campaigns.invites.actions.copy'), [ - 'data-clipboard' => $link, - 'data-toggle' => 'tooltip', - 'data-toast' => __('crud.alerts.copy_invite'), - 'title' => __('campaigns.invites.actions.copy') - ], null, false); + $copy = ' ' . __('campaigns.invites.actions.copy') . ''; + return redirect()->route('campaign_users.index', $campaign) ->with( diff --git a/app/Http/Controllers/Campaign/ModuleController.php b/app/Http/Controllers/Campaign/ModuleController.php index 1f8d4d4cf8..9a7d493508 100644 --- a/app/Http/Controllers/Campaign/ModuleController.php +++ b/app/Http/Controllers/Campaign/ModuleController.php @@ -58,6 +58,9 @@ public function update(UpdateModuleName $request, Campaign $campaign, EntityType return view('campaign.modules') ->with('errors', __('This feature is only available on premium and boosted campaigns')); } + if (request()->ajax()) { + return response()->json(['success' => true]); + } $this->moduleService ->campaign($campaign) diff --git a/app/Http/Controllers/Campaign/StyleController.php b/app/Http/Controllers/Campaign/StyleController.php index a26211c686..95f2d6cbd0 100644 --- a/app/Http/Controllers/Campaign/StyleController.php +++ b/app/Http/Controllers/Campaign/StyleController.php @@ -13,7 +13,7 @@ class StyleController extends Controller { - public const MAX_THEMES = 30; + public const int MAX_THEMES = 30; /** * Create a new controller instance. @@ -78,6 +78,9 @@ public function create(Campaign $campaign) public function store(StoreCampaignStyle $request, Campaign $campaign) { $this->authorize('update', $campaign); + if (request()->ajax()) { + return response()->json(['success' => true]); + } if ($campaign->styles()->count() >= self::MAX_THEMES) { return redirect()->route('campaign_styles.index', $campaign) diff --git a/app/Http/Controllers/Campaign/VisibilityController.php b/app/Http/Controllers/Campaign/VisibilityController.php index 0ec27636a6..db84989685 100644 --- a/app/Http/Controllers/Campaign/VisibilityController.php +++ b/app/Http/Controllers/Campaign/VisibilityController.php @@ -37,7 +37,7 @@ public function save(StoreCampaignVisibility $request, Campaign $campaign) ]); $success = __('campaigns/public.update.' . ($campaign->isPublic() ? 'public' : 'private'), [ - 'public-campaigns' => link_to('https://kanka.io/campaigns', __('footer.public-campaigns'), ['target' => '_blank']), + 'public-campaigns' => '' . __('footer.public-campaigns') . '', ]); if ($request->get('from') === 'overview') { diff --git a/app/Http/Controllers/ConversationParticipantController.php b/app/Http/Controllers/ConversationParticipantController.php index d847088745..d959d1ed61 100644 --- a/app/Http/Controllers/ConversationParticipantController.php +++ b/app/Http/Controllers/ConversationParticipantController.php @@ -21,13 +21,16 @@ public function index(Campaign $campaign, Conversation $conversation) public function store(StoreConversationParticipant $request, Campaign $campaign, Conversation $conversation) { $this->authorize('update', $conversation); + if (request()->ajax()) { + return response()->json(['success' => true]); + } $participant = new ConversationParticipant(); $participant = $participant->create($request->all()); return redirect() - ->to($conversation->getLink()) - ->with('success', trans('conversations.participants.create.success', [ + ->route('entities.show', [$campaign, $conversation->entity]) + ->with('success', __('conversations.participants.create.success', [ 'name' => $conversation->name, 'entity' => $participant->name() ])); diff --git a/app/Http/Controllers/CrudController.php b/app/Http/Controllers/CrudController.php index ee476c8144..a88c0f6882 100644 --- a/app/Http/Controllers/CrudController.php +++ b/app/Http/Controllers/CrudController.php @@ -108,7 +108,7 @@ public function crudIndex(Request $request) return redirect()->route('dashboard', $this->campaign)->with( 'error_raw', __('campaigns.settings.errors.module-disabled', [ - 'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$this->campaign, '#' . $this->module]), + 'fix' => '' . __('crud.fix-this-issue') . '', ]) ); } @@ -383,16 +383,13 @@ public function crudStore(Request $request, bool $redirectToCreated = false) $new->entity->crudSaved(); } + $link = '' . $new->name . ''; $success = __('general.success.created', [ - 'name' => $new->entity ? link_to_route( - 'entities.show', - $new->name, - [$this->campaign, $new->entity] - ) : link_to_route(/** Menu link **/ - $this->view . '.show', - $new->name, - [$this->campaign, $new->id] - ) + 'name' => $link ]); session()->flash('success_raw', $success); @@ -541,16 +538,13 @@ public function crudUpdate(Request $request, Model|MiscModel $model) } } + $link = '' . $model->name . ''; $success = __('general.success.updated', [ - 'name' => $model->entity ? link_to_route( - 'entities.show', - $model->name, - [$this->campaign, $model->entity] - ) : link_to_route(/** Menu link **/ - $this->view . '.show', - $model->name, - [$this->campaign, $model] - ) + 'name' => $link ]); if ($model->entity) { @@ -608,7 +602,7 @@ public function crudDestroy(Model|MiscModel $model) return redirect()->route($this->route . '.index', $this->campaign) ->with('success_raw', __('general.success.deleted-cancel', [ 'name' => $model->name, - 'cancel' => link_to_route('recovery', __('crud.cancel'), [$model->campaign]) + 'cancel' => '' . __('crud.cancel') . '' ])); } diff --git a/app/Http/Controllers/Entity/AbilityController.php b/app/Http/Controllers/Entity/AbilityController.php index 90db651fa8..528724e1e9 100644 --- a/app/Http/Controllers/Entity/AbilityController.php +++ b/app/Http/Controllers/Entity/AbilityController.php @@ -22,7 +22,7 @@ public function index(Campaign $campaign, Entity $entity) return redirect()->route('entities.show', [$campaign, $entity])->with( 'error_raw', __('campaigns.settings.errors.module-disabled', [ - 'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#abilities']), + 'fix' => '' . __('crud.fix-this-issue') . '', ]) ); } diff --git a/app/Http/Controllers/Entity/AssetController.php b/app/Http/Controllers/Entity/AssetController.php index 431889b2db..f0f44172dc 100644 --- a/app/Http/Controllers/Entity/AssetController.php +++ b/app/Http/Controllers/Entity/AssetController.php @@ -25,7 +25,7 @@ public function index(Campaign $campaign, Entity $entity) return redirect()->route('entities.show', [$campaign, $entity])->with( 'error_raw', __('campaigns.settings.errors.module-disabled', [ - 'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#assets']), + 'fix' => '' . __('crud.fix-this-issue') . '', ]) ); } diff --git a/app/Http/Controllers/Entity/AttributeController.php b/app/Http/Controllers/Entity/AttributeController.php index 28ead558c2..69eecc349c 100644 --- a/app/Http/Controllers/Entity/AttributeController.php +++ b/app/Http/Controllers/Entity/AttributeController.php @@ -34,7 +34,7 @@ public function index(Campaign $campaign, Entity $entity) return redirect()->route('entities.show', [$campaign, $entity])->with( 'error_raw', __('campaigns.settings.errors.module-disabled', [ - 'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#entity_attributes']), + 'fix' => '' . __('crud.fix-this-issue') . '' ]) ); } @@ -71,7 +71,7 @@ public function dashboard(Campaign $campaign, Entity $entity) return redirect()->route('dashboard', $campaign)->with( 'error_raw', __('campaigns.settings.errors.module-disabled', [ - 'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#entity_attributes']), + 'fix' => '' . __('crud.fix-this-issue') . '' ]) ); } @@ -106,7 +106,7 @@ public function edit(Campaign $campaign, Entity $entity) return redirect()->route('dashboard', $campaign)->with( 'error_raw', __('campaigns.settings.errors.module-disabled', [ - 'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#entity_attributes']), + 'fix' => '' . __('crud.fix-this-issue') . '' ]) ); } diff --git a/app/Http/Controllers/Entity/AttributeTemplateController.php b/app/Http/Controllers/Entity/AttributeTemplateController.php index 195230177e..4526748859 100644 --- a/app/Http/Controllers/Entity/AttributeTemplateController.php +++ b/app/Http/Controllers/Entity/AttributeTemplateController.php @@ -29,7 +29,7 @@ public function index(Campaign $campaign, Entity $entity) return redirect()->route('dashboard', $campaign)->with( 'error_raw', __('campaigns.settings.errors.module-disabled', [ - 'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#entity_attributes']), + 'fix' => '' . __('crud.fix-this-issue') . '' ]) ); } diff --git a/app/Http/Controllers/Entity/InventoryController.php b/app/Http/Controllers/Entity/InventoryController.php index 6c714f3759..5fd13d29bc 100644 --- a/app/Http/Controllers/Entity/InventoryController.php +++ b/app/Http/Controllers/Entity/InventoryController.php @@ -34,7 +34,7 @@ public function index(Campaign $campaign, Entity $entity) return redirect()->route('entities.show', [$campaign, $entity])->with( 'error_raw', __('campaigns.settings.errors.module-disabled', [ - 'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#inventories']), + 'fix' => '' . __('crud.fix-this-issue') . '' ]) ); } diff --git a/app/Http/Controllers/Entity/MoveController.php b/app/Http/Controllers/Entity/MoveController.php index 55f7b5cf8b..083e719f67 100644 --- a/app/Http/Controllers/Entity/MoveController.php +++ b/app/Http/Controllers/Entity/MoveController.php @@ -44,12 +44,14 @@ public function index(Campaign $campaign, Entity $entity) } /** - * @return \Illuminate\Http\RedirectResponse * @throws \Illuminate\Auth\Access\AuthorizationException */ public function move(MoveEntityRequest $request, Campaign $campaign, Entity $entity) { $this->authorize('view', $entity->child); + if (request()->ajax()) { + return response()->json(['success' => true]); + } $copied = $request->filled('copy'); try { diff --git a/app/Http/Controllers/Entity/ReminderController.php b/app/Http/Controllers/Entity/ReminderController.php index 7f6541f113..e63e53c6c6 100644 --- a/app/Http/Controllers/Entity/ReminderController.php +++ b/app/Http/Controllers/Entity/ReminderController.php @@ -46,7 +46,7 @@ public function index(Campaign $campaign, Entity $entity) return redirect()->route('entities.show', [$campaign, $entity])->with( 'error_raw', __('campaigns.settings.errors.module-disabled', [ - 'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$campaign, '#calendars']), + 'fix' => '' . __('crud.fix-this-issue') . '' ]) ); } diff --git a/app/Http/Controllers/Entity/TransformController.php b/app/Http/Controllers/Entity/TransformController.php index f9cef49104..003bcd0ddd 100644 --- a/app/Http/Controllers/Entity/TransformController.php +++ b/app/Http/Controllers/Entity/TransformController.php @@ -50,6 +50,9 @@ public function index(Campaign $campaign, Entity $entity) public function transform(TransformEntityRequest $request, Campaign $campaign, Entity $entity) { $this->authorize('move', $entity->child); + if (request()->ajax()) { + return response()->json(['success' => true]); + } try { $this->transformService diff --git a/app/Http/Controllers/EntityCreatorController.php b/app/Http/Controllers/EntityCreatorController.php index 885b6db82b..0530f91366 100644 --- a/app/Http/Controllers/EntityCreatorController.php +++ b/app/Http/Controllers/EntityCreatorController.php @@ -148,7 +148,7 @@ public function store(Request $request, Campaign $campaign, $type) } } $createdEntities[] = $new; - $links[] = link_to($new->entity->url(), $new->name); + $links[] = '' . $new->name . ''; } // If no entity was created, we throw the standard error diff --git a/app/Http/Controllers/Families/MemberController.php b/app/Http/Controllers/Families/MemberController.php index d462417d6e..6be5aae169 100644 --- a/app/Http/Controllers/Families/MemberController.php +++ b/app/Http/Controllers/Families/MemberController.php @@ -70,6 +70,9 @@ public function create(Campaign $campaign, Family $family) public function store(StoreCharacterFamily $request, Campaign $campaign, Family $family) { $this->authorize('update', $family); + if ($request->ajax()) { + return response()->json(['success' => true]); + } $newMembers = $family->members()->syncWithoutDetaching($request->members); diff --git a/app/Http/Controllers/Maps/Bulks/GroupController.php b/app/Http/Controllers/Maps/Bulks/GroupController.php index be7ed48f32..67e2eef6e5 100644 --- a/app/Http/Controllers/Maps/Bulks/GroupController.php +++ b/app/Http/Controllers/Maps/Bulks/GroupController.php @@ -29,6 +29,9 @@ public function index(Request $request, Campaign $campaign, Map $map) return $this->bulkBatch(route('maps.groups.bulk', [$campaign, 'map' => $map]), '_map-group', $models); } + if (request()->ajax()) { + return response()->json(['success' => true]); + } $count = $this->bulkProcess($request, MapGroup::class); return redirect() diff --git a/app/Http/Controllers/Maps/Bulks/LayerController.php b/app/Http/Controllers/Maps/Bulks/LayerController.php index 75335ea347..3b1bd98559 100644 --- a/app/Http/Controllers/Maps/Bulks/LayerController.php +++ b/app/Http/Controllers/Maps/Bulks/LayerController.php @@ -30,6 +30,9 @@ public function index(Request $request, Campaign $campaign, Map $map) return $this->campaign($campaign)->bulkBatch(route('maps.layers.bulk', [$campaign, 'map' => $map]), '_map-layer', $models); } + if (request()->ajax()) { + return response()->json(['success' => true]); + } $count = $this->bulkProcess($request, MapLayer::class); return redirect() diff --git a/app/Http/Controllers/Maps/Bulks/MarkerController.php b/app/Http/Controllers/Maps/Bulks/MarkerController.php index 42a715609e..8b8a34d37e 100644 --- a/app/Http/Controllers/Maps/Bulks/MarkerController.php +++ b/app/Http/Controllers/Maps/Bulks/MarkerController.php @@ -29,6 +29,9 @@ public function index(Request $request, Campaign $campaign, Map $map) 'campaign' => $campaign, 'map' => $map]), '_map-marker', $models, $map); } + if (request()->ajax()) { + return response()->json(['success' => true]); + } $count = $this->campaign($campaign)->bulkProcess($request, MapMarker::class); return redirect() diff --git a/app/Http/Controllers/Maps/Markers/DetailController.php b/app/Http/Controllers/Maps/Markers/DetailController.php index a7d60f9764..bd75c6a0ce 100644 --- a/app/Http/Controllers/Maps/Markers/DetailController.php +++ b/app/Http/Controllers/Maps/Markers/DetailController.php @@ -40,7 +40,7 @@ public function index(Campaign $campaign, Map $map, MapMarker $mapMarker) $name = $mapMarker->name; if ($mapMarker->entity) { $name = !empty($mapMarker->name) ? $mapMarker->name : $mapMarker->entity->name; - $name = link_to($mapMarker->entity->url(), $name, ['target' => '_blank']); + $name = '' . $name . ''; } if (request()->has('mobile')) { return response()->view('maps.markers.dialog_details', [ diff --git a/app/Http/Controllers/Organisation/MemberController.php b/app/Http/Controllers/Organisation/MemberController.php index 9854f49b2b..2de4862efa 100644 --- a/app/Http/Controllers/Organisation/MemberController.php +++ b/app/Http/Controllers/Organisation/MemberController.php @@ -43,7 +43,7 @@ public function index(Campaign $campaign, Organisation $organisation) ->select('organisation_member.*') ->with([ 'organisation', 'organisation.entity', - 'parent', 'parent.character', + 'parent', 'parent.character', 'parent.character.entity', 'character', 'character.entity', 'character.entity.image', 'character.location', 'character.location.entity']) ->has('character') @@ -79,6 +79,9 @@ public function create(Campaign $campaign, Organisation $organisation) public function store(StoreOrganisationMember $request, Campaign $campaign, Organisation $organisation) { $this->authorize('member', $organisation); + if ($request->ajax()) { + return response()->json(['success' => true]); + } $relation = OrganisationMember::create($request->all()); return redirect()->route('entities.show', [$campaign, $organisation->entity]) @@ -123,6 +126,9 @@ public function update( OrganisationMember $organisationMember ) { $this->authorize('member', $organisation); + if ($request->ajax()) { + return response()->json(['success' => true]); + } $organisationMember->update($request->all()); return redirect()->route('entities.show', [$campaign, $organisation->entity]) diff --git a/app/Http/Controllers/RelationController.php b/app/Http/Controllers/RelationController.php index a0ef6d49d8..1bf5abcfdf 100644 --- a/app/Http/Controllers/RelationController.php +++ b/app/Http/Controllers/RelationController.php @@ -85,10 +85,7 @@ public function store(StoreRelation $request, Campaign $campaign) $count = $this->relationService->getCount(); $success = trans_choice($this->langKey . '.create.success_bulk', $count, [ - 'entity' => link_to( - $new->owner->url(), - $new->owner->name - ), + 'entity' => '' . $new->owner->name . '', 'count' => $count, ]); session()->flash('success_raw', $success); diff --git a/app/Http/Controllers/Timelines/TimelineEraController.php b/app/Http/Controllers/Timelines/TimelineEraController.php index 77769f1950..baf6a54e59 100644 --- a/app/Http/Controllers/Timelines/TimelineEraController.php +++ b/app/Http/Controllers/Timelines/TimelineEraController.php @@ -171,6 +171,9 @@ public function bulk(Request $request, Campaign $campaign, Timeline $timeline) return $this->bulkBatch(route('timelines.eras.bulk', [$campaign, 'timeline' => $timeline]), '_timeline-era', $models); }*/ + if (request()->ajax()) { + return response()->json(['success' => true]); + } $count = $this->bulkProcess($request, TimelineEra::class); return redirect() diff --git a/app/Models/AttributeTemplate.php b/app/Models/AttributeTemplate.php index 9b65d07693..7738d3c31e 100644 --- a/app/Models/AttributeTemplate.php +++ b/app/Models/AttributeTemplate.php @@ -63,7 +63,7 @@ class AttributeTemplate extends MiscModel ]; /** @var bool Attribute templates don't have inventory, relations or abilities */ - public $hasRelations = false; + public bool $hasRelations = false; public function attributeTemplate(): BelongsTo { diff --git a/app/Models/Conversation.php b/app/Models/Conversation.php index 1778a993a5..fdfdc28b27 100644 --- a/app/Models/Conversation.php +++ b/app/Models/Conversation.php @@ -5,6 +5,8 @@ use App\Models\Concerns\Acl; use App\Models\Concerns\HasFilters; use App\Traits\CampaignTrait; +use Illuminate\Database\Eloquent\Collection; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -18,10 +20,13 @@ * @property int $target_id * @property bool $is_private * @property bool $is_closed + * + * @property ConversationParticipant[]|Collection $participants + * @property ConversationMessage[]|Collection $messages */ class Conversation extends MiscModel { - use Acl ; + use Acl; use CampaignTrait; use HasFactory; use HasFilters; @@ -37,8 +42,8 @@ class Conversation extends MiscModel 'is_closed' ]; - public const TARGET_USERS = 1; - public const TARGET_CHARACTERS = 2; + public const int TARGET_USERS = 1; + public const int TARGET_CHARACTERS = 2; /** * Entity type @@ -60,27 +65,20 @@ class Conversation extends MiscModel /** * Set to false if this entity type doesn't have relations - * @var bool */ - public $hasRelations = false; + public bool $hasRelations = false; /** * @var string[] Extra relations loaded for the API endpoint */ public array $apiWith = ['messages', 'participants']; - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function messages() + public function messages(): HasMany { return $this->hasMany('App\Models\ConversationMessage', 'conversation_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function participants() + public function participants(): HasMany { return $this->hasMany('App\Models\ConversationParticipant', 'conversation_id'); } @@ -89,7 +87,7 @@ public function participants() * Get a list of participants * @return array */ - public function participantsList($withNames = true, $users = false) + public function participantsList(bool $withNames = true, bool $users = false) { $participants = []; foreach ($this->participants as $participant) { diff --git a/app/Models/ConversationParticipant.php b/app/Models/ConversationParticipant.php index 1ff98c9418..edc0442cd0 100644 --- a/app/Models/ConversationParticipant.php +++ b/app/Models/ConversationParticipant.php @@ -4,6 +4,8 @@ use App\User; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * @property int $id @@ -19,10 +21,7 @@ class ConversationParticipant extends MiscModel { use HasFactory; - /** - * @var bool|Character|User - */ - protected $loadedEntity = false; + protected Character|User|null $loadedEntity; protected $fillable = [ 'conversation_id', @@ -38,70 +37,36 @@ class ConversationParticipant extends MiscModel /** * Who created this entry - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function creator() + public function creator(): BelongsTo { return $this->belongsTo('App\User', 'created_by'); } /** * Who created this entry - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function user() + public function user(): BelongsTo { return $this->belongsTo('App\User', 'user_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function character() + public function character(): BelongsTo { return $this->belongsTo('App\Models\Character', 'character_id'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function conversation() + public function conversation(): BelongsTo { return $this->belongsTo('App\Models\Conversation', 'conversation_id'); } - /** - * @return string - */ - public function author() - { - if (!empty($this->user_id)) { - return $this->user->name; - } elseif (!empty($this->character_id)) { - return link_to_route( - 'entities.show', - $this->character->name, - [$this->character->entity] - ); - } else { - return trans('conversations.messages.author_unknown'); - } - } - - /** - * @return array|\Illuminate\Contracts\Translation\Translator|mixed|null|string - */ - public function name() + public function name(): string { - return !empty($this->loadedEntity) ? - $this->loadedEntity->name : - trans('conversations.messages.author_unknown'); + return $this->entity()->name ?? __('conversations.messages.author_unknown'); } - /** - * @return int|null - */ - public function target() + public function target(): int|null { return (!empty($this->character_id) ? Conversation::TARGET_CHARACTERS : (!empty($this->user_id) ? Conversation::TARGET_USERS : null)); @@ -131,15 +96,13 @@ public function entity() */ protected function loadEntity() { - if ($this->loadedEntity === false) { - if (!empty($this->user_id)) { - $this->loadedEntity = $this->user; - } else { - $this->loadedEntity = $this->character; - } + if (isset($this->loadedEntity)) { + return $this->loadedEntity; } - - return $this->loadedEntity; + if (!empty($this->user_id)) { + return $this->loadedEntity = $this->user; + } + return $this->loadedEntity = $this->character; } /** diff --git a/app/Models/DiceRollResult.php b/app/Models/DiceRollResult.php index 071e0a4a09..e0e8207f69 100644 --- a/app/Models/DiceRollResult.php +++ b/app/Models/DiceRollResult.php @@ -46,7 +46,7 @@ class DiceRollResult extends Model protected string $entityType = 'dice_roll'; /** @var bool No relations for this entity "type" */ - protected $hasRelations = false; + protected bool $hasRelations = false; /** * diff --git a/app/Models/EntityLog.php b/app/Models/EntityLog.php index a418f48139..259423ca51 100644 --- a/app/Models/EntityLog.php +++ b/app/Models/EntityLog.php @@ -2,7 +2,6 @@ namespace App\Models; -use App\Facades\CampaignLocalization; use App\Http\Requests\HistoryRequest; use App\User; use Carbon\Carbon; @@ -228,15 +227,6 @@ public function userLink(): string return '' . $this->user->name . ''; } - public function entityLink(): string - { - if (!$this->entity) { - $campaign = CampaignLocalization::getCampaign(); - return link_to_route('recovery', __('history.unknown.entity'), [$campaign]); - } - return $this->entity->tooltipedLink($this->entity->name, false); - } - public function actions($action): array { if ($action == self::ACTION_CREATE || $action == self::ACTION_CREATE_POST) { diff --git a/app/Models/EntityMention.php b/app/Models/EntityMention.php index 12135ce678..5fe1b06a9a 100644 --- a/app/Models/EntityMention.php +++ b/app/Models/EntityMention.php @@ -140,29 +140,33 @@ public function isCampaign(): bool public function scopePrepareCount(Builder $query): Builder { return $query->where(function ($sub) { - // @phpstan-ignore-next-line return $sub ->where(function ($subEnt) { + // @phpstan-ignore-next-line return $subEnt ->entity() ->has('entity'); }) ->orWhere(function ($subPost) { + // @phpstan-ignore-next-line return $subPost ->post() ->has('post.entity'); }) ->orWhere(function ($subQuestElement) { + // @phpstan-ignore-next-line return $subQuestElement ->questElement() ->has('questElement.entity'); }) ->orWhere(function ($subTimelineElement) { + // @phpstan-ignore-next-line return $subTimelineElement ->timelineElement() ->has('timelineElement.entity'); }) ->orWhere(function ($subCam) { + // @phpstan-ignore-next-line return $subCam->campaign(); }); }); @@ -252,6 +256,7 @@ public function hasEntity(): bool /** * Get the entity link with ajax tooltip. * When coming from an entity first, call this method on the entity. It avoids some back and worth. + * Todo: move this out of the model */ public function mentionLink(): string { diff --git a/app/Models/ImageMention.php b/app/Models/ImageMention.php index dcf4d9c029..c5844ebd3c 100644 --- a/app/Models/ImageMention.php +++ b/app/Models/ImageMention.php @@ -67,14 +67,14 @@ public function scopePrepareCount(Builder $query): Builder return $query->where(function ($sub) { return $sub ->where(function ($subEnt) { + // @phpstan-ignore-next-line return $subEnt - // @phpstan-ignore-next-line ->entity() ->has('entity'); }) ->orWhere(function ($subPost) { + // @phpstan-ignore-next-line return $subPost - // @phpstan-ignore-next-line ->post() ->has('post.entity'); }); diff --git a/app/Models/Map.php b/app/Models/Map.php index 36be6c4ad5..f6068c7138 100644 --- a/app/Models/Map.php +++ b/app/Models/Map.php @@ -2,7 +2,6 @@ namespace App\Models; -use App\Facades\CampaignLocalization; use App\Models\Concerns\Acl; use App\Models\Concerns\HasFilters; use App\Models\Concerns\SortableTrait; @@ -647,30 +646,6 @@ public function explorable(): bool return !($this->isChunked() && ($this->chunkingError() || $this->chunkingRunning())); } - /** - * The explore link for a map, or the chunking process icon - */ - public function exploreLink(): string - { - if (!$this->explorable()) { - return ''; - } - if ($this->isChunked()) { - if ($this->chunkingError()) { - return ''; - } elseif ($this->chunkingRunning()) { - return ''; - } - } - $campaign = CampaignLocalization::getCampaign(); - return '' . - '' . - ''; - } - /** * Prepare groups for clustering */ diff --git a/app/Models/MapLayer.php b/app/Models/MapLayer.php index aeb44ecf2d..dd013702c7 100644 --- a/app/Models/MapLayer.php +++ b/app/Models/MapLayer.php @@ -4,6 +4,7 @@ use App\Facades\CampaignLocalization; use App\Facades\Img; +use App\Facades\Mentions; use App\Models\Concerns\Blameable; use App\Models\Concerns\Paginatable; use App\Models\Concerns\SortableTrait; @@ -134,4 +135,12 @@ public function tooltipedLink(string $displayName = null): string (!empty($displayName) ? $displayName : e($this->name)) . ''; } + + + /** + */ + public function getEntryForEditionAttribute() + { + return Mentions::parseForEdit($this); + } } diff --git a/app/Models/Plugin.php b/app/Models/Plugin.php index c22ce535ef..8573b355d3 100644 --- a/app/Models/Plugin.php +++ b/app/Models/Plugin.php @@ -34,7 +34,7 @@ class Plugin extends Model use SoftDeletes; use SortableTrait; - protected $cachedHasUpdate = null; + protected bool $cachedHasUpdate; public $sortable = [ 'name', @@ -59,7 +59,7 @@ public function type(): string */ public function hasUpdate(): bool { - if ($this->cachedHasUpdate !== null) { + if (isset($this->cachedHasUpdate)) { return $this->cachedHasUpdate; } diff --git a/app/Models/PluginVersion.php b/app/Models/PluginVersion.php index 9df5b101a5..a79132a80c 100644 --- a/app/Models/PluginVersion.php +++ b/app/Models/PluginVersion.php @@ -519,7 +519,7 @@ protected function abilities(Entity $entity): array 'charges' => $abi->ability->charges, 'used_charges' => $abi->charges, 'thumb' => '', - 'link' => link_to($abi->ability->getLink(), $abi->ability->name, ['class' => 'ability-link']), + 'link' => '' . $abi->ability->name . '', 'tags' => $tags, 'parent' => $parent, ]; diff --git a/app/Models/Scopes/AclScope.php b/app/Models/Scopes/AclScope.php index 87f104f92e..a87a1e3b45 100644 --- a/app/Models/Scopes/AclScope.php +++ b/app/Models/Scopes/AclScope.php @@ -51,6 +51,7 @@ protected function addWithInvisible(Builder $builder) return $builder; } + // @phpstan-ignore-next-link return $builder->withoutGlobalScope($this); }); } diff --git a/app/Renderers/CalendarRenderer.php b/app/Renderers/CalendarRenderer.php index b8cc2e5850..77f26a4d04 100644 --- a/app/Renderers/CalendarRenderer.php +++ b/app/Renderers/CalendarRenderer.php @@ -683,17 +683,12 @@ public function todayButton() $calendarYear = $this->calendar->currentDate('year'); $calendarMonth = $this->calendar->currentDate('month'); - $options = ['class' => 'btn2 btn-sm']; + $disabled = false; if ($this->year == $calendarYear && $this->month == $calendarMonth) { - $options['disabled'] = 'disabled'; + $disabled = true; } - return link_to_route( - 'entities.show', - trans('calendars.actions.today'), - [$this->campaign, 'entity' => $this->calendar->entity, 'month' => $calendarMonth, 'year' => $calendarYear], - $options - ); + return '' . __('calendars.actions.today') . ''; } /** diff --git a/app/Renderers/DatagridRenderer.php b/app/Renderers/DatagridRenderer.php index 88f1ce03fd..51919995a2 100644 --- a/app/Renderers/DatagridRenderer.php +++ b/app/Renderers/DatagridRenderer.php @@ -17,7 +17,6 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Arr; -use Collective\Html\FormFacade as Form; use Illuminate\Support\Str; class DatagridRenderer @@ -120,7 +119,7 @@ private function renderColumns() $html = ''; // Checkbox for delete if (auth()->check()) { - $html .= '' . Form::checkbox('all', 1, false, ['id' => 'datagrid-select-all']) . ''; + $html .= ''; } foreach ($this->columns as $column) { @@ -334,7 +333,7 @@ private function renderRow(Model $model): string // Bulk if (auth()->check()) { - $html .= '' . Form::checkbox('model[]', $model->id, false) . ''; + $html .= ''; } foreach ($this->columns as $column) { @@ -440,11 +439,7 @@ private function renderColumn(string|array $column, $model) /** @var Journal $model */ if ($model->entity->calendarDate && $model->entity->calendarDate->calendar && $model->entity->calendarDate->calendar->entity) { $reminder = $model->entity->calendarDate; - $content = link_to_route( - 'entities.show', - $reminder->readableDate(), - [$this->campaign, $reminder->calendar->entity, 'month' => $reminder->month, 'year' => $reminder->year] - ); + $content = '' . $reminder->readableDate() . ''; } } else { // Exception diff --git a/app/Renderers/Layouts/Campaign/Theme.php b/app/Renderers/Layouts/Campaign/Theme.php index 5f0af607d7..810081c50d 100644 --- a/app/Renderers/Layouts/Campaign/Theme.php +++ b/app/Renderers/Layouts/Campaign/Theme.php @@ -26,7 +26,7 @@ public function columns(): array 'label' => 'campaigns/styles.fields.name', 'render' => function ($model) { $campaign = CampaignLocalization::getCampaign(); - return link_to_route('campaign_styles.edit', $model->name, [$campaign, $model]); + return '' . $model->name . ''; }, ], 'length' => [ diff --git a/app/Services/Bragi/BragiService.php b/app/Services/Bragi/BragiService.php index e54f7edff2..059bf76c34 100644 --- a/app/Services/Bragi/BragiService.php +++ b/app/Services/Bragi/BragiService.php @@ -26,11 +26,7 @@ public function prepare(): array $data = [ 'header' => __('bragi.intro', [ 'name' => 'Bragi', - 'here' => link_to( - '//docs.kanka.io/en/latest/features/bragi.html', - __('bragi.here'), - ['target' => '_blank'] - ) + 'here' => '' . __('bragi.here') . '', ]), ]; if (!$this->user->hasTokens()) { diff --git a/app/Services/Campaign/DefaultImageService.php b/app/Services/Campaign/DefaultImageService.php index cf9fc82632..e41fd3a608 100644 --- a/app/Services/Campaign/DefaultImageService.php +++ b/app/Services/Campaign/DefaultImageService.php @@ -79,6 +79,9 @@ public function destroy(): bool $images = []; } + if (!isset($images[$this->type])) { + return false; + } /** @var Image|null $image */ $image = Image::find($images[$this->type]); if (empty($image)) { diff --git a/app/Services/Campaign/MemberService.php b/app/Services/Campaign/MemberService.php index 85a76f51c3..e8d735a1d0 100644 --- a/app/Services/Campaign/MemberService.php +++ b/app/Services/Campaign/MemberService.php @@ -61,8 +61,8 @@ public function update(CampaignUser $user, CampaignRole $campaignRole): bool 'campaigns.roles.users.errors.cant_kick_admins' ))->setOptions([ 'admin' => $role->campaignRole->name, - 'discord' => link_to(config('social.discord'), 'Discord'), - 'email' => link_to('mailto:' . config('app.email'), config('app.email')) + 'discord' => '' . config('app.email') . '', ]); } $role->delete(); @@ -147,8 +147,8 @@ public function delete(): bool 'campaigns.roles.users.errors.cant_kick_admins' ))->setOptions([ 'admin' => $this->userCampaignRole->campaignRole->name, - 'discord' => link_to(config('social.discord'), 'Discord'), - 'email' => link_to('mailto:' . config('app.email'), config('app.email')) + 'discord' => '' . config('app.email') . '', ]); } diff --git a/app/Services/LengthValidatorService.php b/app/Services/LengthValidatorService.php index c9c58b02db..cbfd437294 100644 --- a/app/Services/LengthValidatorService.php +++ b/app/Services/LengthValidatorService.php @@ -29,12 +29,12 @@ public function validateLength(Calendar $calendar, Request $request) if ($length >= $totalLength) { return [ 'overflow' => true, - 'message' => __('calendars.warnings.event_length', ['documentation' => link_to('https://docs.kanka.io/en/latest/entities/calendars.html#long-lasting-reminders', ' ' . __('footer.documentation'), ['target' => '_blank'], null, false)]), - ]; + 'message' => __('calendars.warnings.event_length', ['documentation' => ' ' . __('footer.documentation') . '', + ])]; } return [ 'overflow' => false, - 'message' => __('calendars.warnings.event_length', ['documentation' => link_to('https://docs.kanka.io/en/latest/entities/calendars.html#long-lasting-reminders', ' ' . __('footer.documentation'), ['target' => '_blank'], null, false)]), - ]; + 'message' => __('calendars.warnings.event_length', ['documentation' => ' ' . __('footer.documentation') . '', + ])]; } } diff --git a/app/Services/PaginationService.php b/app/Services/PaginationService.php index 236ec6a5ab..ae1811cc7f 100644 --- a/app/Services/PaginationService.php +++ b/app/Services/PaginationService.php @@ -36,7 +36,7 @@ public function disabled(): array { $disabled = []; - if (!auth()->user()->isSubscriber()) { + if (auth()->user()->isSubscriber()) { $disabled[self::MAX] = ['disabled' => true]; } diff --git a/app/Services/Plugins/ImporterService.php b/app/Services/Plugins/ImporterService.php index 6c0506a3ce..bf7fa9cedb 100644 --- a/app/Services/Plugins/ImporterService.php +++ b/app/Services/Plugins/ImporterService.php @@ -145,7 +145,7 @@ protected function importModel(PluginVersionEntity $pluginEntity) $model = $entity->child; if (!$this->skipUpdates) { - $this->updated[] = link_to($entity->url(), $entity->name); + $this->updated[] = '' . $entity->name . ''; } else { $this->skippedEntities[] = $pluginEntity->id; } @@ -172,7 +172,7 @@ protected function importModel(PluginVersionEntity $pluginEntity) $this->entityTypes[$pluginEntity->id] = $model->getEntityType(); $this->entityIds[$pluginEntity->id] = $model->entity->id; - $this->created[] = link_to($entity->url(), $model->name); + $this->created[] = '' . $entity->name . ''; } $this->models[$pluginEntity->id] = $model; } diff --git a/app/Traits/TreeControllerTrait.php b/app/Traits/TreeControllerTrait.php index 0bdb1b5651..2890a21efd 100644 --- a/app/Traits/TreeControllerTrait.php +++ b/app/Traits/TreeControllerTrait.php @@ -25,7 +25,7 @@ public function tree(Request $request, Campaign $campaign) return redirect()->route('dashboard', $this->campaign)->with( 'error_raw', __('campaigns.settings.errors.module-disabled', [ - 'fix' => link_to_route('campaign.modules', __('crud.fix-this-issue'), [$this->campaign, '#' . $this->module]), + 'fix' => '' . __('crud.fix-this-issue') . '', ]) ); } diff --git a/app/User.php b/app/User.php index 3c01ea10cc..be7173f49f 100644 --- a/app/User.php +++ b/app/User.php @@ -150,7 +150,7 @@ public function rolesList(Campaign $campaign): string $roleLinks = []; foreach ($roles as $role) { if (auth()->user()->isAdmin()) { - $roleLinks[] = link_to_route('campaign_roles.show', $role->name, [$campaign, $role->id]); + $roleLinks[] = '' . $role->name . ''; } else { $roleLinks[] = $role->name; } diff --git a/app/View/Components/Dialog.php b/app/View/Components/Dialog.php index 425d5c0943..5b0e70be67 100644 --- a/app/View/Components/Dialog.php +++ b/app/View/Components/Dialog.php @@ -8,33 +8,21 @@ class Dialog extends Component { - public string $id; - public ?string $title; - public ?string $footer; - public bool $full; - public bool $loading; - public bool $dismissible = true; - public array $form; - /** * Create a new component instance. */ public function __construct( - string $title = null, - string $id = null, - string $footer = null, - array $form = [], - bool $full = false, - bool $loading = false, - bool $dismissible = true, + public string|null $title = null, + public string|null $id = null, + public string|null $footer = null, + public array $form = [], + public bool $full = false, + public bool $loading = false, + public bool $dismissible = true, ) { - $this->id = $id ?? uniqid(); - $this->title = $title; - $this->full = $full; - $this->loading = $loading; - $this->footer = $footer; - $this->dismissible = $dismissible; - $this->form = $form; + if (empty($this->id)) { + $this->id = uniqid(); + } } /** diff --git a/app/View/Components/Form.php b/app/View/Components/Form.php new file mode 100644 index 0000000000..3d5bed2251 --- /dev/null +++ b/app/View/Components/Form.php @@ -0,0 +1,68 @@ +method = mb_strtoupper($method); + foreach ($config as $k => $v) { + if (!property_exists($this, $k)) { + continue; + } + $this->$k = $v; + } + } + + /** + * Get the view / contents that represent the component. + */ + public function render(): View|Closure|string + { + return view('components.form'); + } + + public function extra(): string|null + { + if (empty($this->extra)) { + return null; + } + $extra = []; + foreach ($this->extra as $k => $v) { + $extra[] = $k . '="' . $v . '"'; + } + return implode(' ', $extra); + } + + public function action(): string + { + if (!is_array($this->action)) { + return route($this->action); + } + $parameters = array_slice($this->action, 1); + + if (array_keys($this->action) === [0, 1]) { + $parameters = head($parameters); + } + + return route($this->action[0], $parameters); + } +} diff --git a/app/View/Components/Forms/Select.php b/app/View/Components/Forms/Select.php new file mode 100644 index 0000000000..53761067dd --- /dev/null +++ b/app/View/Components/Forms/Select.php @@ -0,0 +1,70 @@ +name); + if (null !== $old) { + $this->selected = $old; + } elseif (!empty($this->placeholder)) { + $this->selected = ''; + $this->options = ['' => $this->placeholder] + $this->options; + } + return view('components.forms.select'); + } + + public function fieldId(): string + { + return !empty($this->id) ? $this->id : uniqid($this->name); + } + + public function isSelected(mixed $value): bool + { + if (empty($this->selected)) { + return empty($value); + } + if (is_array($this->selected)) { + return in_array($value, $this->selected); + } + if (is_int($this->selected)) { + return $value == $this->selected; + } + // Always force values to lower to avoid thinking + return mb_strtolower($value) == mb_strtolower($this->selected); + } + + public function optionAttributes(string $key): array + { + return $this->optionAttributes[$key] ?? []; + } +} diff --git a/composer.json b/composer.json index 793a90705b..bd45c7c724 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,6 @@ "laravel/scout": "^10.5", "laravel/socialite": "^5.0", "laravel/ui": "^4.2.1", - "laravelcollective/html": "^6.0", "league/flysystem-aws-s3-v3": "^3.5", "league/html-to-markdown": "^5.1", "livewire/livewire": "^3.3", diff --git a/composer.lock b/composer.lock index 3d2e805496..81d9cf516d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "19ea6776af2a291354dd9a617a00221b", + "content-hash": "858021f7fc4560ff15c490c4c78d069d", "packages": [ { "name": "aws/aws-crt-php", @@ -3497,79 +3497,6 @@ }, "time": "2024-03-21T18:12:29+00:00" }, - { - "name": "laravelcollective/html", - "version": "v6.4.1", - "source": { - "type": "git", - "url": "https://github.com/LaravelCollective/html.git", - "reference": "64ddfdcaeeb8d332bd98bef442bef81e39c3910b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/LaravelCollective/html/zipball/64ddfdcaeeb8d332bd98bef442bef81e39c3910b", - "reference": "64ddfdcaeeb8d332bd98bef442bef81e39c3910b", - "shasum": "" - }, - "require": { - "illuminate/http": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/routing": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/session": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/view": "^6.0|^7.0|^8.0|^9.0|^10.0", - "php": ">=7.2.5" - }, - "require-dev": { - "illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0", - "mockery/mockery": "~1.0", - "phpunit/phpunit": "~8.5|^9.5.10" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.x-dev" - }, - "laravel": { - "providers": [ - "Collective\\Html\\HtmlServiceProvider" - ], - "aliases": { - "Form": "Collective\\Html\\FormFacade", - "Html": "Collective\\Html\\HtmlFacade" - } - } - }, - "autoload": { - "files": [ - "src/helpers.php" - ], - "psr-4": { - "Collective\\Html\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Adam Engebretson", - "email": "adam@laravelcollective.com" - }, - { - "name": "Taylor Otwell", - "email": "taylorotwell@gmail.com" - } - ], - "description": "HTML and Form Builders for the Laravel Framework", - "homepage": "https://laravelcollective.com", - "support": { - "issues": "https://github.com/LaravelCollective/html/issues", - "source": "https://github.com/LaravelCollective/html" - }, - "abandoned": "spatie/laravel-html", - "time": "2023-04-25T02:46:11+00:00" - }, { "name": "lcobucci/clock", "version": "3.2.0", diff --git a/config/app.php b/config/app.php index e3f8652883..955850b13a 100644 --- a/config/app.php +++ b/config/app.php @@ -208,7 +208,6 @@ /* * Package Service Providers... */ - Collective\Html\HtmlServiceProvider::class, Stevebauman\Purify\PurifyServiceProvider::class, Laravel\Socialite\SocialiteServiceProvider::class, Intervention\Image\ImageServiceProvider::class, diff --git a/lang/en/campaigns.php b/lang/en/campaigns.php index 08bd6140f3..38e1169e7f 100644 --- a/lang/en/campaigns.php +++ b/lang/en/campaigns.php @@ -396,7 +396,7 @@ ], 'sharing' => [ 'filters' => 'Public campaigns are visible on the :public-campaigns page. Filling out these fields makes it easier for others to discover it.', - 'language' => 'The language in which the campaign\'s content is written.', + 'language' => 'The main language in which the campaign\'s content is written.', 'system' => 'If playing a TTRPG, the system used to play in the campaign.', ], 'show' => [ diff --git a/lang/en/campaigns/styles.php b/lang/en/campaigns/styles.php index 9a9c83390d..c9104552f3 100644 --- a/lang/en/campaigns/styles.php +++ b/lang/en/campaigns/styles.php @@ -38,6 +38,9 @@ 'main' => 'You can create custom CSS styling for your premium campaign. These styles are loaded after any themes from the marketplace that are enabled for the campaign. You can learn more about styling your campaign :here.', ], 'pitch' => 'Create custom CSS styling to fully customise the look and feel of the campaign.', + 'placeholders' => [ + 'name' => 'Name of the style', + ], 'reorder' => [ 'save' => 'Save new order', 'success' => '{1} Reordered :count style.|[2,*] Reordered :count styles.', diff --git a/lang/en/maps.php b/lang/en/maps.php index 4750525d86..d40a35422f 100644 --- a/lang/en/maps.php +++ b/lang/en/maps.php @@ -49,7 +49,7 @@ 'chunked_zoom' => 'Automatically cluster markers together when they are close to each other.', 'distance_measure' => 'Giving the map a distance measurement will enable the measurement tool in the exploration mode.', 'distance_measure_2' => 'For 100 pixels to measure 1 kilometer, input a value of 0.0041.', - 'grid' => 'Define a grid size that will be displayed in the exploration mode.', + 'grid' => 'Define a grid size that will be displayed in the exploration mode. A value below 10 will result in a greyed out map.', 'has_clustering' => 'Automatically cluster markers together when they are close to each other.', 'initial_zoom' => 'The initial zoom level a map is loaded with. The default value is :default, while the highest allowed value is :max and the lowest allowed value is :min.', 'is_real' => 'Select this option if you want to use a real world map instead of the uploaded image. This option disable layers.', diff --git a/lang/en/profiles.php b/lang/en/profiles.php index 0f6cbb0d61..8b61c5e997 100644 --- a/lang/en/profiles.php +++ b/lang/en/profiles.php @@ -74,7 +74,7 @@ 'success' => 'Theme changed.', 'themes' => [ 'dark' => 'Dark', - 'default' => 'Default', + 'default' => 'Light', 'future' => 'Future', 'midnight' => 'Midnight Blue', ], diff --git a/phpstan.neon b/phpstan.neon index d7bc6d0783..9a90bc25fd 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -13,7 +13,6 @@ parameters: - ./*/*/FileToBeExcluded.php - ./app/Models/Concerns/*.php - ./app/Console/Commands/*.php - - ./app/Models/EntityMention.php - - ./app/Models/ImageMention.php + - ./app/Models/Scopes/AclScope.php treatPhpDocTypesAsCertain: false diff --git a/public/build/assets/abilities-883611b4.css b/public/build/assets/abilities-883611b4.css deleted file mode 100644 index eda4dffc5c..0000000000 --- a/public/build/assets/abilities-883611b4.css +++ /dev/null @@ -1 +0,0 @@ -.ability-parent .ability-name .name{color:#fff;text-shadow:rgba(0,0,0,.8) 0 1px 4px}.ability-parent.without .ability-name{background-image:none}.ability-parent.without .ability-name:hover{background-color:#000000b3}.ability-parent.active .ability-name{background-color:#0000001a}.ability-parent.active.without .ability-name{background-color:#000000b3}.ability .ability-image{transition:filter .5s ease-in-out}.ability .ability-image:hover{filter:saturate(3)}.ability a:hover{background-color:unset!important}.charges .charge{--tw-border-opacity: 1;border:1px solid hsl(var(--bc)/var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--b1)/var(--tw-bg-opacity))}.charges .used:before{content:"";display:block;height:10px;width:10px;margin-top:4px;margin-left:4px;--tw-bg-opacity: 1;background-color:hsl(var(--a)/var(--tw-bg-opacity))} diff --git a/public/build/assets/abilities-a6eb9228.js b/public/build/assets/abilities-a6eb9228.js deleted file mode 100644 index e5a1732771..0000000000 --- a/public/build/assets/abilities-a6eb9228.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as y,o as e,c as i,a as l,h as x,e as g,b as o,t as c,n as v,F as h,r as b,k as C,j as A,g as f,f as k,l as D}from"./_plugin-vue_export-helper-0796b9c6.js";import{m as M}from"./mitt-f7ef348c.js";import{v as L}from"./v-click-outside.umd-1708c20a.js";import"./_commonjsHelpers-725317a4.js";const T={props:["ability","permission","meta","trans"],directives:{clickOutside:L.directive},data(){return{details:!1,openedDropdown:!1}},computed:{hasAttribute:function(){return this.ability.attributes.length>0},canDelete:function(){return this.permission},isSelf:function(){return this.meta.user_id===this.ability.created_by},backgroundImage:function(){return this.ability.images.thumb?{backgroundImage:"url("+this.ability.images.thumb+")"}:{}}},methods:{click:function(t){this.details=!this.details},deleteAbility:function(t){this.emitter.emit("delete_ability",t)},updateAbility:function(t){window.openDialog("abilities-dialog",t.actions.edit)},showAbility:function(t){window.open(t.actions.view,"_blank")},setVisibility:function(t){let a={visibility_id:t,ability_id:this.ability.ability_id};axios.patch(this.ability.actions.update,a).then(s=>{this.ability.visibility_id=t,this.emitter.emit("edited_ability",ability)}).catch(()=>{}),this.openedDropdown=!1},useCharge:function(t,a){a>t.used_charges?t.used_charges+=1:t.used_charges-=1,axios.post(t.actions.use,{used:t.used_charges}).then(s=>{s.data.success||(t.used_charges-=1)}).catch(()=>{t.used_charges-=1})},translate(t){return this.trans[t]??"unknown"},dropdownClass(){return this.openedDropdown?"open dropdown":"dropdown"},openDropdown(){this.openedDropdown=!this.openedDropdown},onClickOutside(t){this.openedDropdown=!1}}},H=["data-tags"],j={class:"ability-box p-3 rounded bg-box shadow-xs"},S={class:"ability-header border-b flex items-center gap-2 pb-2 mb-2"},V=["title"],I=["title"],F=["title"],O=["title"],P=["title"],B={key:1,class:"flex gap-2 flex-wrap"},N={key:1,class:"grow"},z=["data-id","data-url"],E=["title"],J=l("i",{class:"fa-solid fa-pencil","aria-hidden":"true"},null,-1),q={class:"sr-only"},G={class:"ability-body entity-content"},K={class:"flex"},Q={class:"flex-1"},R={class:"help-block"},U=["innerHTML"],W=["innerHTML"],X={key:0,class:"flex-none text-right ml-2 mb-2"},Y=["href"],Z={key:0},$={class:"charges relative"},tt=["onClick"],et={key:0,class:"fa-solid fa-chevron-down"},it={key:2},st={class:"dl-horizontal"},nt=["innerHTML"],at={key:1},lt={key:0},ot={key:0,class:"fa-solid fa-check","aria-hidden":"true"},rt=["innerHTML"],dt={key:0,class:"fa-solid fa-chevron-up"};function ct(t,a,s,m,r,n){const _=C("click-outside");return e(),i("div",{class:"ability","data-tags":s.ability.class},[l("div",j,[l("div",S,[s.permission?x((e(),i("div",{key:0,class:g(n.dropdownClass())},[this.openedDropdown?(e(),i("div",B,[l("a",{role:"button",class:"btn2 btn-sm",onClick:a[1]||(a[1]=d=>n.setVisibility(1))},c(n.translate("all")),1),s.meta.is_admin?(e(),i("a",{key:0,role:"button",class:"btn2 btn-sm",onClick:a[2]||(a[2]=d=>n.setVisibility(2))},c(n.translate("admin")),1)):o("",!0),this.isSelf?(e(),i("a",{key:1,role:"button",class:"btn2 btn-sm",onClick:a[3]||(a[3]=d=>n.setVisibility(4))},c(n.translate("self")),1)):o("",!0),this.isSelf?(e(),i("a",{key:2,role:"button",class:"btn2 btn-sm",onClick:a[4]||(a[4]=d=>n.setVisibility(5))},c(n.translate("members")),1)):o("",!0),this.isSelf?(e(),i("a",{key:3,role:"button",class:"btn2 btn-sm",onClick:a[5]||(a[5]=d=>n.setVisibility(3))},c(n.translate("admin-self")),1)):o("",!0)])):(e(),i("a",{key:0,onClick:a[0]||(a[0]=d=>n.openDropdown()),role:"button"},[s.ability.visibility_id===2?(e(),i("i",{key:0,class:"fa-solid fa-lock",title:n.translate("admin")},null,8,V)):o("",!0),s.ability.visibility_id===3?(e(),i("i",{key:1,class:"fa-solid fa-user-lock",title:n.translate("admin-self")},null,8,I)):o("",!0),s.ability.visibility_id===5?(e(),i("i",{key:2,class:"fa-solid fa-users",title:n.translate("members")},null,8,F)):o("",!0),s.ability.visibility_id===4?(e(),i("i",{key:3,class:"fa-solid fa-user-secret",title:n.translate("self")},null,8,O)):o("",!0),s.ability.visibility_id===1?(e(),i("i",{key:4,class:"fa-solid fa-eye",title:n.translate("all")},null,8,P)):o("",!0)]))],2)),[[_,n.onClickOutside]]):o("",!0),this.openedDropdown?o("",!0):(e(),i("div",N,[l("a",{role:"button",onClick:a[6]||(a[6]=d=>n.showAbility(s.ability)),"data-toggle":"tooltip-ajax",class:"grow text-lg","data-id":s.ability.entity.id,"data-url":s.ability.entity.tooltip},c(s.ability.name),9,z)])),this.canDelete&&!this.openedDropdown?(e(),i("a",{key:2,role:"button",onClick:a[7]||(a[7]=d=>n.updateAbility(s.ability)),class:"btn2 btn-ghost btn-xs",title:n.translate("update")},[J,l("span",q,c(n.translate("update")),1)],8,E)):o("",!0)]),l("div",G,[l("div",K,[l("div",Q,[l("span",R,c(s.ability.type),1),l("div",{innerHTML:s.ability.entry},null,8,U),l("div",{innerHTML:s.ability.note,class:"help-block"},null,8,W)]),s.ability.images.has?(e(),i("div",X,[l("a",{class:"ability-image block w-32 h-32 cover-background",target:"_blank",href:s.ability.images.url,style:v(n.backgroundImage)},null,12,Y)])):o("",!0)]),s.ability.charges&&s.permission?(e(),i("div",Z,[l("div",$,[(e(!0),i(h,null,b(s.ability.charges,d=>(e(),i("div",{class:g(["charge inline-block mr-2 h-5 w-5 cursor-pointer bg-white shadow-xs",{used:s.ability.used_charges>=d}]),onClick:w=>n.useCharge(s.ability,d)},null,10,tt))),256))])])):o("",!0),n.hasAttribute?(e(),i("div",{key:1,class:"text-center cursor-pointer",onClick:a[8]||(a[8]=d=>n.click(s.ability))},[r.details?o("",!0):(e(),i("i",et))])):o("",!0),r.details&&n.hasAttribute?(e(),i("div",it,[l("dl",st,[(e(!0),i(h,null,b(s.ability.attributes,d=>(e(),i("div",null,[d.type=="section"?(e(),i("h4",{key:0,class:"font-bold text-center",innerHTML:d.name},null,8,nt)):(e(),i("div",at,[l("dt",null,c(d.name),1),d.type=="checkbox"?(e(),i("dd",lt,[d.value==1?(e(),i("i",ot)):o("",!0)])):(e(),i("dd",{key:1,innerHTML:d.value},null,8,rt))]))]))),256))])])):o("",!0),n.hasAttribute?(e(),i("div",{key:3,class:"text-center cursor-pointer",onClick:a[9]||(a[9]=d=>n.click(s.ability))},[r.details?(e(),i("i",dt)):o("",!0)])):o("",!0)])])],8,H)}const ut=y(T,[["render",ct]]),ht={props:["ability"],data(){return{active:!1}},computed:{backgroundImage:function(){return this.ability.has_image?{backgroundImage:"url("+this.ability.image+")"}:{}}},methods:{click:function(t){this.emitter.emit("click_parent",this.active?null:t)}},mounted(){this.emitter.on("click_parent",t=>{this.active=t&&t.id===this.ability.id})}},bt={class:"ability-name flex justify-center h-full w-full items-center cursor-pointer bg-white/70 hover:bg-black/10 transition-all duration-500"},_t={class:"name text-2xl"};function yt(t,a,s,m,r,n){return e(),i("div",{class:g(["ability-parent cover-background rounded overflow-hidden w-48 h-20",{active:r.active,without:!s.ability.has_image}]),style:v(n.backgroundImage),onClick:a[0]||(a[0]=_=>n.click(s.ability))},[l("div",bt,[l("div",_t,c(s.ability.name),1)])],6)}const mt=y(ht,[["render",yt]]),ft={props:[],data(){return{modal:!1,modalContent:""}},methods:{showModal:function(t){this.modal=!0,axios.get(t).then(a=>{this.modalContent=a.data})},modalStyle:function(){return this.modal?"block":"hidden"}},mounted(){this.emitter.on("add_ability",t=>{this.showModal(t)})}},kt={class:"modal-dialog",role:"document"},gt=["innerHTML"];function vt(t,a,s,m,r,n){return e(),i("div",{class:"modal fade in",style:v({display:this.modalStyle()}),tabindex:"-1",role:"dialog"},[l("div",kt,[l("div",{class:"modal-content",innerHTML:r.modalContent},null,8,gt)])],4)}const pt=y(ft,[["render",vt]]),wt={props:["id","api","permission","trans"],components:{Ability:ut,AbilityForm:pt,Parent:mt},data(){return{abilities:[],parents:[],meta:[],loading:!0,show_parent:!1,parent:null,waiting:!1,modal:!1,json_trans:[]}},methods:{getAbilities:function(){fetch(this.api).then(t=>t.json()).then(t=>{this.abilities=t.data.abilities,this.parents=t.data.parents,this.meta=t.data.meta,this.loading=!1,this.waiting=!1,this.parent&&(this.parent=this.parents[this.parent.id],this.showParent(this.parent))})},showParent:function(t){this.show_parent=!!t},addAbility:function(){this.emitter.emit("add_ability",this.meta.add_url)},deleteAbility:function(t){this.waiting=!0,axios.delete(t.actions.delete).then(()=>{this.getAbilities()}).catch(()=>{this.getAbilities()})},translate(t){return this.json_trans[t]??"unknown"}},mounted(){this.getAbilities(),this.emitter.on("click_parent",t=>{this.parent=t,this.showParent(t)}),this.emitter.on("delete_ability",t=>{this.deleteAbility(t)}),this.json_trans=JSON.parse(this.trans)},updated(){window.ajaxTooltip()}},xt={class:"viewport box-abilities relative flex flex-col gap-5"},Ct={key:0,class:"load more text-center"},At=l("i",{class:"fa-solid fa-spin fa-spinner"},null,-1),Dt=[At],Mt={class:"flex gap-5 flex-wrap"},Lt={key:1,class:"flex flex-col gap-5"},Tt={key:0,class:"parent-box p-3 rounded bg-box shadow-xs"},Ht={class:"parent-header mb-2"},jt=["href"],St=["innerHTML"],Vt={class:"flex flex-col gap-5"},It={key:2,class:"box-waiting absolute top-0 w-full h-full bg-black/20 text-center"},Ft=l("i",{class:"fa-solid fa-spin fa-spinner fa-4x mt-5"},null,-1),Ot=[Ft];function Pt(t,a,s,m,r,n){const _=f("parent"),d=f("ability"),w=f("AbilityForm");return e(),i("div",xt,[r.loading?(e(),i("div",Ct,Dt)):o("",!0),l("div",Mt,[(e(!0),i(h,null,b(r.parents,u=>(e(),k(_,{key:u.id,ability:u},null,8,["ability"]))),128))]),r.show_parent?(e(),i("div",Lt,[r.parent.entry?(e(),i("div",Tt,[l("div",Ht,[l("a",{class:"text-lg",href:r.parent.url},c(r.parent.name),9,jt)]),l("div",{class:"entity-content parent-body",innerHTML:r.parent.entry},null,8,St)])):o("",!0),(e(!0),i(h,null,b(r.parent.abilities,u=>(e(),k(d,{key:u.id,ability:u,permission:s.permission,meta:r.meta,trans:r.json_trans},null,8,["ability","permission","meta","trans"]))),128))])):o("",!0),l("div",Vt,[r.show_parent?o("",!0):(e(!0),i(h,{key:0},b(r.abilities,u=>(e(),k(d,{key:u.id,ability:u,permission:s.permission,meta:r.meta,trans:r.json_trans},null,8,["ability","permission","meta","trans"]))),128))]),A(w,{trans:r.json_trans},null,8,["trans"]),r.waiting?(e(),i("div",It,Ot)):o("",!0)])}const Bt=y(wt,[["render",Pt]]),Nt=M(),p=D({});p.config.globalProperties.emitter=Nt;p.component("abilities",Bt);p.mount("#abilities"); diff --git a/public/build/assets/abilities-d433f912.js b/public/build/assets/abilities-d433f912.js new file mode 100644 index 0000000000..9e4e4b743a --- /dev/null +++ b/public/build/assets/abilities-d433f912.js @@ -0,0 +1 @@ +import{_ as h,o as t,c as i,a as s,n as b,b as a,F as u,r as _,e as x,f,g as y,l as v}from"./_plugin-vue_export-helper-0796b9c6.js";import{m as k}from"./mitt-f7ef348c.js";const p={props:["ability","permission","meta","trans"],data(){return{details:!1}},computed:{hasAttribute:function(){return this.ability.attributes.length>0},canDelete:function(){return this.permission},backgroundImage:function(){return this.ability.images.thumb?{backgroundImage:"url("+this.ability.images.thumb+")"}:{}}},methods:{updateAbility:function(n){window.openDialog("abilities-dialog",n.actions.edit)},remainingNumber:function(){return this.ability.charges-this.ability.used_charges},remainingText:function(){return this.ability.i18n.left.replace(/:amount/,"")},useCharge:function(n,c){c>n.used_charges?n.used_charges+=1:n.used_charges-=1,axios.post(n.actions.use,{used:n.used_charges}).then(e=>{e.data.success||(n.used_charges-=1)}).catch(()=>{n.used_charges-=1})}}},T=["data-tags"],L={class:"ability-box p-4 rounded bg-box shadow-xs flex flex-col md:flex-row items-center md:items-start gap-2 md:gap-4"},H={key:0,class:""},M=["href"],w={class:"flex flex-col gap-4 w-full"},C={class:"flex gap-2 md:gap-4 items-center w-full"},A={class:"flex gap-2 items-center text-xl grow"},I=["href","innerHTML"],B=["title"],N=["title"],j=["title"],D=["title"],z=["title"],F=["innerHTML"],P={key:1,class:""},V=["title"],E=s("i",{class:"fa-solid fa-pencil text-xl","aria-hidden":"true"},null,-1),S=["innerHTML"],q={key:0,class:"visible md:hidden"},G=["innerHTML"],J=["innerHTML"],K={key:2,class:"flex gap-2 items-center"},O=["href","innerHTML"],Q=["innerHTML"],R={key:4,class:"flex gap-2 md:gap-4 ability-charges w-full items-end"},U={class:"flex gap-1 flex-wrap grow"},W=["onClick"],X=["innerHTML"],Y={class:"flex-none"},Z=["innerHTML"],$=["innerHTML"];function ee(n,c,e,g,d,o){return t(),i("div",{class:"ability","data-tags":e.ability.class},[s("div",L,[e.ability.images.has?(t(),i("div",H,[s("a",{class:"ability-image rounded-xl block w-40 h-40 cover-background",href:e.ability.images.url,style:b(o.backgroundImage)},null,12,M)])):a("",!0),s("div",w,[s("div",C,[s("div",A,[s("a",{href:e.ability.actions.view,class:"ability-name text-2xl",innerHTML:e.ability.name},null,8,I),e.ability.visibility_id===2?(t(),i("i",{key:0,class:"fa-solid fa-lock",title:e.ability.visibility},null,8,B)):a("",!0),e.ability.visibility_id===3?(t(),i("i",{key:1,class:"fa-solid fa-user-lock",title:e.ability.visibility},null,8,N)):a("",!0),e.ability.visibility_id===5?(t(),i("i",{key:2,class:"fa-solid fa-users",title:e.ability.visibility},null,8,j)):a("",!0),e.ability.visibility_id===4?(t(),i("i",{key:3,class:"fa-solid fa-user-secret",title:e.ability.visibility},null,8,D)):a("",!0),e.ability.visibility_id===1?(t(),i("i",{key:4,class:"fa-solid fa-eye",title:e.ability.visibility},null,8,z)):a("",!0)]),e.ability.type?(t(),i("div",{key:0,class:"hidden md:inline bg-base-200 p-2 rounded-xl flex-none",innerHTML:e.ability.type},null,8,F)):a("",!0),e.permission?(t(),i("div",P,[this.canDelete?(t(),i("a",{key:0,role:"button",onClick:c[0]||(c[0]=l=>o.updateAbility(e.ability)),class:"btn2 btn-ghost btn-sm",title:e.ability.i18n.edit},[E,s("span",{class:"sr-only",innerHTML:e.ability.i18n.edit},null,8,S)],8,V)):a("",!0)])):a("",!0)]),e.ability.type?(t(),i("div",q,[s("div",{class:"inline-block bg-base-200 p-2 rounded-xl",innerHTML:e.ability.type},null,8,G)])):a("",!0),e.ability.entry?(t(),i("p",{key:1,class:"text-sm",innerHTML:e.ability.entry},null,8,J)):a("",!0),e.ability.tags?(t(),i("div",K,[(t(!0),i(u,null,_(e.ability.tags,l=>(t(),i("a",{class:"rounded-lg bg-base-200 text-xs py-1 px-2 text-base-content",href:l.url,innerHTML:l.name},null,8,O))),256))])):a("",!0),e.ability.note?(t(),i("div",{key:3,class:"entity-content",innerHTML:e.ability.note},null,8,Q)):a("",!0),e.ability.charges&&e.permission?(t(),i("div",R,[s("div",U,[(t(!0),i(u,null,_(e.ability.charges,l=>(t(),i("div",{class:x(["charge cursor-pointer rounded-full p-2 hover:bg-accent hover:text-accent-content w-8 h-8 flex items-center justify-center",{"bg-base-200 charge-used":e.ability.used_charges>=l}]),onClick:r=>o.useCharge(e.ability,l)},[s("span",{innerHTML:l},null,8,X)],10,W))),256))]),s("div",Y,[s("span",{class:"text-2xl",innerHTML:o.remainingNumber()},null,8,Z),s("span",{innerHTML:o.remainingText()},null,8,$)])])):a("",!0)])])],8,T)}const te=h(p,[["render",ee]]),ie={components:{Ability:te},props:["group","permission","meta"],data(){return{collapsed:!1}},computed:{backgroundImage:function(){return this.group.has_image?{backgroundImage:"url("+this.group.image+")"}:{}}},methods:{click:function(n){this.collapsed=!this.collapsed}}},se={class:"ability-parent flex flex-col gap-5 w-full"},ne={class:"parent-head flex gap-2 md:gap-5 items-center"},ae={class:"flex flex-col gap-1 grow overflow-hidden"},le={key:0},oe=["href","innerHTML"],ce=["innerHTML"],re=["innerHTML"],de={class:"flex-none self-end"},ue={key:0,"aria-hidden":"true",class:"fa-thin fa-chevron-circle-up fa-2x"},_e={key:1,"aria-hidden":"true",class:"fa-thin fa-chevron-circle-down fa-2x"},he={key:0,class:"parent-abilities flex flex-col gap-5"};function me(n,c,e,g,d,o){const l=y("ability");return t(),i("div",se,[s("div",ne,[e.group.has_image?(t(),i("div",{key:0,class:"parent-image rounded-full w-12 h-12 md:w-16 md:h-16 cover-background flex-none",style:b(o.backgroundImage)},null,4)):a("",!0),s("div",ae,[e.group.url?(t(),i("div",le,[s("a",{href:e.group.url,innerHTML:e.group.name,class:"parent-name text-xl md:text-2xl"},null,8,oe)])):(t(),i("span",{key:1,class:"parent-name text-xl md:text-2xl",innerHTML:e.group.name},null,8,ce)),s("p",{class:"md:text-lg truncate",innerHTML:e.group.type},null,8,re)]),s("div",de,[s("span",{role:"button",onClick:c[0]||(c[0]=r=>o.click(e.group)),class:"cursor-pointer inline-block"},[this.collapsed?(t(),i("i",_e)):(t(),i("i",ue))])])]),this.collapsed?a("",!0):(t(),i("div",he,[(t(!0),i(u,null,_(e.group.abilities,r=>(t(),f(l,{key:r.id,ability:r,permission:e.permission,meta:e.meta},null,8,["ability","permission","meta"]))),128))]))])}const ge=h(ie,[["render",me]]),be={props:["id","api","permission"],components:{Parent:ge},data(){return{groups:[],meta:[],loading:!0,waiting:!1}},methods:{getAbilities:function(){fetch(this.api).then(n=>n.json()).then(n=>{this.groups=n.data.groups,this.meta=n.data.meta,this.loading=!1,this.waiting=!1})}},mounted(){this.getAbilities()},updated(){window.ajaxTooltip()}},fe={class:"viewport box-abilities relative flex flex-col gap-5"},ye={key:0,class:"load more text-center text-2xl"},xe=s("i",{class:"fa-solid fa-spin fa-spinner","aria-hidden":"true"},null,-1),ve=[xe],ke={class:"flex gap-5 flex-wrap"};function pe(n,c,e,g,d,o){const l=y("parent");return t(),i("div",fe,[d.loading?(t(),i("div",ye,ve)):a("",!0),s("div",ke,[(t(!0),i(u,null,_(d.groups,r=>(t(),f(l,{key:r.id,group:r,permission:e.permission,meta:d.meta},null,8,["group","permission","meta"]))),128))])])}const Te=h(be,[["render",pe]]),Le=k(),m=v({});m.config.globalProperties.emitter=Le;m.component("abilities",Te);m.mount("#abilities"); diff --git a/public/build/assets/app-cea6fbd9.js b/public/build/assets/app-cea6fbd9.js new file mode 100644 index 0000000000..abffefa03f --- /dev/null +++ b/public/build/assets/app-cea6fbd9.js @@ -0,0 +1 @@ +import{t as U,C as W}from"./tippy.esm-24ef6cb2.js";import{d as it}from"./mention-b4456db3.js";import{S as Ee}from"./sortable.esm-0d19b1d3.js";import"./dialog-f9278276.js";import{_ as L,c as l,a,t as u,o as r,n as E,w as X,b as h,F as v,r as w,d as b,e as g,f as S,g as T,h as ee,i as st,v as at,j as H,k as Me,l as ot}from"./_plugin-vue_export-helper-0796b9c6.js";import{m as rt}from"./mitt-f7ef348c.js";import{v as Ae}from"./v-click-outside.umd-1708c20a.js";import"./_commonjsHelpers-725317a4.js";$(document).ready(function(){window.initTags=function(){$.each($(".form-tags"),function(){$(this).hasClass("select2-hidden-accessible")||$(this).select2({tags:$(this).data("allow-new"),allowClear:$(this).data("allow-clear"),dropdownParent:$(this).data("dropdown-parent")||"",minimumInputLength:0,ajax:{quietMillis:500,delay:500,url:$(this).data("url"),dataType:"json",data:function(e){return{q:$.trim(e.term)}},processResults:function(e){return{results:e}},cache:!0},createTag:function(e){let t=$.trim(e.term);return t===""?null:{id:t,text:t,newTag:!0}},templateResult:function(e){let t=$(""+e.text+"");return e.colour&&(t=$(""+e.text+"")),t},templateSelection:function(e,t){if(e.newTag)return $(''+e.text+' ');let n=$(e.element);return e.colour?$(t).addClass(e.colour):n.data("colour")&&$(t).addClass(n.data("colour")),$(t).addClass("text-left"),e.text}})}),$.each($(".position-dropdown"),function(){$(this).hasClass("select2-hidden-accessible")||$(this).select2({tags:!0,allowClear:!0,dropdownParent:$(this).data("dropdown-parent")||"",placeholder:$(this).data("placeholder"),minimumInputLength:0,createTag:function(e){let t=$.trim(e.term);return t===""?null:{id:t,text:t,newTag:!0}}})})},window.initTags()});/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(t){var n=t.input.length-t.maximum,s="Si us plau, elimina "+n+" car";return s+=n==1?"àcter":"àcters"},inputTooShort:function(t){var n=t.minimum-t.input.length,s="Si us plau, introdueix "+n+" car";return s+=n==1?"àcter":"àcters"},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(t){var n="Només es pot seleccionar "+t.maximum+" element";return t.maximum!=1&&(n+="s"),n},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"},removeAllItems:function(){return"Treu tots els elements"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(t){return"Bitte "+(t.input.length-t.maximum)+" Zeichen weniger eingeben"},inputTooShort:function(t){return"Bitte "+(t.minimum-t.input.length)+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(t){var n="Sie können nur "+t.maximum+" Element";return t.maximum!=1&&(n+="e"),n+=" auswählen"},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"},removeAllItems:function(){return"Entferne alle Elemente"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(t){var n=t.input.length-t.maximum,s="Please delete "+n+" character";return n!=1&&(s+="s"),s},inputTooShort:function(t){return"Please enter "+(t.minimum-t.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(t){var n="You can only select "+t.maximum+" item";return t.maximum!=1&&(n+="s"),n},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(t){var n=t.input.length-t.maximum,s="Por favor, elimine "+n+" car";return s+=n==1?"ácter":"acteres"},inputTooShort:function(t){var n=t.minimum-t.input.length,s="Por favor, introduzca "+n+" car";return s+=n==1?"ácter":"acteres"},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(t){var n="Sólo puede seleccionar "+t.maximum+" elemento";return t.maximum!=1&&(n+="s"),n},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Eliminar todos los elementos"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Supprimez "+n+" caractère"+(n>1?"s":"")},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Saisissez au moins "+n+" caractère"+(n>1?"s":"")},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(t){return"Vous pouvez seulement sélectionner "+t.maximum+" élément"+(t.maximum>1?"s":"")},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"},removeAllItems:function(){return"Supprimer tous les éléments"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/hu",[],function(){return{errorLoading:function(){return"Az eredmények betöltése nem sikerült."},inputTooLong:function(t){return"Túl hosszú. "+(t.input.length-t.maximum)+" karakterrel több, mint kellene."},inputTooShort:function(t){return"Túl rövid. Még "+(t.minimum-t.input.length)+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(t){return"Csak "+t.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"},removeAllItems:function(){return"Távolítson el minden elemet"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(t){var n=t.input.length-t.maximum,s="Per favore cancella "+n+" caratter";return s+=n!==1?"i":"e"},inputTooShort:function(t){return"Per favore inserisci "+(t.minimum-t.input.length)+" o più caratteri"},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(t){var n="Puoi selezionare solo "+t.maximum+" element";return t.maximum!==1?n+="i":n+="o",n},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"},removeAllItems:function(){return"Rimuovi tutti gli oggetti"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(t){return"Gelieve "+(t.input.length-t.maximum)+" karakters te verwijderen"},inputTooShort:function(t){return"Gelieve "+(t.minimum-t.input.length)+" of meer karakters in te voeren"},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(t){var n=t.maximum==1?"kan":"kunnen",s="Er "+n+" maar "+t.maximum+" item";return t.maximum!=1&&(s+="s"),s+=" worden geselecteerd"},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"},removeAllItems:function(){return"Verwijder alle items"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/pl",[],function(){var t=["znak","znaki","znaków"],n=["element","elementy","elementów"],s=function(i,o){return i===1?o[0]:i>1&&i<=4?o[1]:i>=5?o[2]:void 0};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(i){var o=i.input.length-i.maximum;return"Usuń "+o+" "+s(o,t)},inputTooShort:function(i){var o=i.minimum-i.input.length;return"Podaj przynajmniej "+o+" "+s(o,t)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(i){return"Możesz zaznaczyć tylko "+i.maximum+" "+s(i.maximum,n)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"},removeAllItems:function(){return"Usuń wszystkie przedmioty"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(t){var n=t.input.length-t.maximum,s="Apague "+n+" caracter";return n!=1&&(s+="es"),s},inputTooShort:function(t){return"Digite "+(t.minimum-t.input.length)+" ou mais caracteres"},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(t){var n="Você só pode selecionar "+t.maximum+" ite";return t.maximum==1?n+="m":n+="ns",n},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Remover todos os itens"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/ru",[],function(){function t(n,s,i,o){return n%10<5&&n%10>0&&n%100<5||n%100>20?n%10>1?i:s:o}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(n){var s=n.input.length-n.maximum,i="Пожалуйста, введите на "+s+" символ";return i+=t(s,"","a","ов"),i+=" меньше"},inputTooShort:function(n){var s=n.minimum-n.input.length,i="Пожалуйста, введите ещё хотя бы "+s+" символ";return i+=t(s,"","a","ов")},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(n){var s="Вы можете выбрать не более "+n.maximum+" элемент";return s+=t(n.maximum,"","a","ов")},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"},removeAllItems:function(){return"Удалить все элементы"}}}),e.define,e.require})();/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sk",[],function(){var t={2:function(n){return n?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(n){var s=n.input.length-n.maximum;return s==1?"Prosím, zadajte o jeden znak menej":s>=2&&s<=4?"Prosím, zadajte o "+t[s](!0)+" znaky menej":"Prosím, zadajte o "+s+" znakov menej"},inputTooShort:function(n){var s=n.minimum-n.input.length;return s==1?"Prosím, zadajte ešte jeden znak":s<=4?"Prosím, zadajte ešte ďalšie "+t[s](!0)+" znaky":"Prosím, zadajte ešte ďalších "+s+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(n){return n.maximum==1?"Môžete zvoliť len jednu položku":n.maximum>=2&&n.maximum<=4?"Môžete zvoliť najviac "+t[n.maximum](!1)+" položky":"Môžete zvoliť najviac "+n.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"},removeAllItems:function(){return"Odstráňte všetky položky"}}}),e.define,e.require})();$(document).ready(function(){window.initForeignSelect=function(){$("select.select2").length!==0&&($.each($("select.select2"),function(e){if($(this).hasClass("select2-hidden-accessible"))return;if($(this).hasClass("campaign-genres")){$(this).select2({tags:!1,allowClear:!0,dropdownParent:"",width:"100%",maximumSelectionLength:3});return}let t=$(this).data("url"),n=$(this).data("allow-clear"),s=$(this).data("dropdown-parent");if(!t){$(this).select2({tags:!1,placeholder:$(this).data("placeholder"),allowClear:n??!1,language:$(this).data("language"),minimumInputLength:0,dropdownParent:s||"",width:"100%"});return}$(this).select2({tags:!1,placeholder:$(this).data("placeholder"),allowClear:n||!0,language:$(this).data("language"),minimumInputLength:0,dropdownParent:s||"",width:"100%",ajax:{delay:500,quietMillis:500,url:t,dataType:"json",data:function(i){return{q:$.trim(i.term)}},processResults:function(i){return{results:i}},error:function(i){return console.log("error",i),i.status===503&&window.showToast(i.responseJSON.message,"error"),{results:[]}},cache:!0},templateResult:function(i){let o="";return i.image?o=$(""+i.text+""):o=$(""+i.text+""),o},createTag:function(i){return null}})}),$("select.select2-local").select2({placeholder:$(this).data("placeholder"),language:$(this).data("language"),allowClear:!0}),$("select.select2-colour").select2({allowClear:!1,templateResult:pe,templateSelection:pe}))}});function pe(e){return e.id==="none"?e.text:$('
'+e.text+"
")}$(document).ready(function(){ge(),ve(),_e(),$(document).on("shown.bs.modal",()=>{_e(),ve(),ge()})});const ge=()=>{document.querySelectorAll("form[data-shortcut]").forEach(function(t){lt(t)})};function ve(){$(document).bind("keydown",function(e){let t=$(e.target),n=$("#entity-modal"),s=$(".quick-creator-button"),i=$('[data-keyboard="edit"]');if(e.key==="]"){if(F(t))return;$(".sidebar-toggle").click().blur()}else{if(e.key==="k")return F(t)?void 0:($("#entity-lookup").focus(),!1);if(e.key==="n"&&!(e.ctrlKey||e.metaKey)&&!e.altKey&&s.length>0){if(F(t)||(n.data("bs.modal")||{}).isShown)return;s[0].click()}else if(e.key==="e"&&!(e.ctrlKey||e.metaKey)&&i.length===1){if(F(t)||(n.data("bs.modal")||{}).isShown)return;i[0].click()}else e.key==="Escape"&&n.has(".qq-modal-selection").length===1&&n.modal("hide")}})}function F(e){return e.length===0?!1:e.is("input")||e.is("select")||e.is("textarea")||e.attr("contentEditable")==="true"||e.hasClass("CodeMirror")}function lt(e){e.dataset.shortcutInit||(e.dataset.shortcutInit=1,e.addEventListener("keydown",function(t){if((t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="s")return t.preventDefault(),e.dataset.unload&&(window.entityFormHasUnsavedChanges=!1),t.shiftKey?J("submit-update"):t.altKey&&J("submit-new"),e.requestSubmit(),!1;if((t.ctrlKey||t.metaKey)&&t.altKey&&t.key==="c")return e.dataset.unload&&(window.entityFormHasUnsavedChanges=!1),J("submit-copy"),e.submit(),!1}))}function J(e){let t=$("#form-submit-main");t&&(t.attr("name",e),$("#submit-mode").attr("name",e))}const _e=()=>{$('input[data-paste="fontawesome"]').on("paste",function(e){e.preventDefault();let t;if(e.clipboardData||e.originalEvent.clipboardData?t=(e.originalEvent||e).clipboardData.getData("text/plain"):window.clipboardData&&(t=window.clipboardData.getData("Text")),t.startsWith('i.json()).then(i=>{s.innerHTML="",i.forEach(o=>{let c=document.createElement("a");c.href=o.url,c.text=o.name,s.append(c)}),i.length>0&&t.show()})})}function Ie(){if(P=$(".form-submit-actions"),P.length===0)return;let e=$("#form-submit-main"),t=$("#submit-mode");if(t===void 0)throw new Error("No submit mode hidden input found");$.each(P,function(){$(this).data("loaded")!==1&&($(this).data("loaded",1),$(this).unbind("click").on("click",function(){return t.attr("name",$(this).data("action")),e.trigger("click"),!1}))})}function ut(){$.each($("form"),function(){$(this).on("submit",function(){window.entityFormHasUnsavedChanges=!1;let e=$(this).find(".btn-primary");return e.length>0&&($.each(e,function(){$(this).parent().hasClass("dropdown")||$(this).hasClass("quick-creator-subform")?$(this).prop("disabled",!0):$(this).prop("disabled",!0).addClass("loading")}),$(this).append('')),!0})})}function ft(){q=$("#entity-calendar-form-add"),y=$('select[name="calendar_id"]'),G=$('input[name="calendar_id"]'),$(".entity-calendar-modal-form"),j=$(".entity-calendar-subform"),A=$("#entity-calendar-form-cancel"),te=$(".entity-calendar-form"),k=$('input[name="calendar_year"]'),C=$('select[name="calendar_month"]'),x=$('select[name="calendar_day"]'),B=$(".entity-calendar-loading"),q.length===1&&(q.on("click",function(e){e.preventDefault(),q.hide(),te.show();let t=$(this).data("default-calendar");return t&&(G.val(t),A.show(),j.show(),R(t)),!1}),A.on("click",function(e){e.preventDefault(),y.val(null),G.val(null),A.hide(),ne()})),y.length===1&&y.on("change",function(){if(j.hide(),!$(this).val())return ne(),!1;k=$('input[name="calendar_year"]'),C=$('select[name="calendar_month"]'),x=$('select[name="calendar_day"]'),k.length===0&&$('input[name="year"]').length===1&&(k=$('input[name="year"]'),C=$('select[name="month"]'),x=$('input[name="day"]')),R(y.val())}),yt()}function Pe(){$("#entity-calendar-modal-add").length!==0&&(q=$("input[name=calendar-data-url]"),y=$('select[name="calendar_id"]'),k=$('input[name="year"]'),C=$('select[name="month"]'),x=$('input[name="day"]'),B=$(".entity-calendar-loading"),j=$(".entity-calendar-subform"),y.on("change",function(){if(j.hide(),!y.val()){ne();return}R(y.val())}),y.val()&&(A.show(),j.show(),R(y.val())),$('.entity-calendar-subform input[name="length"]').focusout(function(){if(!$(this).val())return;let e=$(this).data("url").replace("/0/","/"+y.val()+"/"),t={day:x.val(),month:C.val(),year:k.val(),length:$(this).val()};$.ajax(e,{data:t}).done(function(n){n.overflow==!0?$(".length-warning").show():$(".length-warning").hide()})}))}const R=e=>{B.show(),e=parseInt(e);let t=$('input[name="calendar-data-url"]').data("url").replace("/0/","/"+e+"/");fetch(t).then(n=>n.json()).then(n=>{let s=x.val();k.html(""),C.html(""),x.html("");let i=1,o=1;s||(s=n.current.day);let c=parseInt(n.current.month);$.each(n.months,function(d){let m=n.months[d],f=i===c?' selected="selected"':"";C.append('"),i===c&&(o=m.length),i++});for(let d=1;d"+d+"")}B.hide(),j.show(),k.val(n.current.year),$("select.reminder-periodicity option").remove(),$.each(n.recurring,function(d,m){$("select.reminder-periodicity").append('")}),$('input[name="length"]').val(1),n.length===1&&C.val(n[0].id)})};function ne(){te.hide(),q.show(),$('input[name="calendar_day"]').val(null),$('input[name="calendar_month"]').val(null),$('input[name="calendar_year"]').val(null),$('select[name="calendar_id"]').val(null)}function ht(){if(P=$('form[data-unload="1"]'),P.length===0)return;let e=$("#form-submit-main");$(document).on("change",":input",function(){$(this).data("skip-unsaved")||(window.entityFormHasUnsavedChanges=!0)}),e.length===1&&$(window).bind("beforeunload",function(t){if(window.entityFormHasUnsavedChanges)return"Unsaved data warning"})}function Qe(){$('form[data-maintenance="1"]').each(function(){$(this).data("with-maintenance")!==!0&&($(this).data("with-maintenance",!0),$(this).submit(function(e){if($(this).data("checked-maintenance")===!0)return!0;e.preventDefault();let t={url:$(this).attr("action"),method:$(this).attr("method"),data:$(this).serialize(),context:this};if($(this).find('input[type="file"]').not(".note-image-input").length>0){let n=new FormData(this);t={url:$(this).attr("action"),method:$(this).attr("method"),data:n,cache:!1,contentType:!1,processData:!1,context:this}}$.ajax(t).done(function(){$(this).data("checked-maintenance",!0).submit()}).fail(function(n){window.formErrorHandler(n,this)})}))})}function mt(){$(".permission-toggle").change(function(){let t="input[data-action="+$(this).data("action")+"]";$(this).prop("checked")?$(t).prop("checked",!0):$(t).prop("checked",!1)})}function Fe(){$(".btn-post-collapse").unbind("click").click(function(){return document.querySelectorAll(".element-toggle").forEach(t=>{t.classList.add("animate-collapsed"),document.querySelector(t.dataset.target).classList.add("hidden")}),!1}),$(".btn-post-expand").unbind("click").click(function(){return document.querySelectorAll(".element-toggle").forEach(t=>{t.classList.remove("animate-collapsed"),document.querySelector(t.dataset.target).classList.remove("hidden")}),!1})}function He(){$(".story-load-more").click(function(e){e.preventDefault();let t=$(this);return $(this).addClass("loading"),pt($(this).data("url")).then(n=>{t.parent().remove(),$(".entity-posts").append(n),He(),Fe(),$(document).trigger("shown.bs.modal")}).catch(()=>{t.removeClass("loading")}),!1})}async function pt(e){return await(await fetch(e)).text()}function gt(){$(".domain-trust").click(function(){let e="kanka_trusted_domains",t=document.cookie.match("(^|;) ?"+e+"=([^;]*)(;|$)");t=t?t[2]:"";let n=$(this).data("domain");t.includes(n)||(t&&(t+="|"),t+=n);let s=new Date;s.setTime(s.getTime()+30*24*60*60*1e3),document.cookie=e+"="+t+";expires="+s.toUTCString()+";sameSite=Strict"})}function vt(){$(".dynamic-row-add").on("click",function(e){e.preventDefault();let t=$(this).data("target"),n=$(this).data("template");return $("."+t).append('
'+$("#"+n).html()+"
"),ye(),$(document).trigger("shown.bs.modal"),!1}),ye()}function ye(){$.each($(".dynamic-row-delete"),function(){$(this).data("init")!==1&&$(this).data("init",1).on("click",function(e){e.preventDefault(),$(this).closest(".parent-delete-row").remove()}).on("keydown",function(e){e.key==="Enter"&&$(this).click()})})}function _t(){$('input[data-toggle="entity-privacy"]').change(function(){let e=$("#entity-is-private");$(this).prop("checked")?e.show():e.hide()})}function yt(){$('select[name="calendar_month"]').change(function(){let e=$(this).find(":selected").data("length");wt(e)})}function wt(e){let t=x.val();t>e&&(t=e),x.html("");for(let n=1;n<=e;n++){let s=n==t?' selected="selected"':"";x.append('")}}var ie;$(document).ready(function(){we(),$(document).on("shown.bs.modal shown.bs.popover",function(){we()}),ie=$(".post-perm-add"),ie.length!==0&&(bt(),ze())});function bt(){ie.on("click",function(e){e.preventDefault();let t=$(this).data("type"),n=$('select[name="'+t+'"]');if(!n||!n.val())return!1;let s=n.find(":selected")[0],i=$("#post-perm-"+t+"-template").clone().removeClass("hidden").removeAttr("id"),o=i.html().replace(/\$SELECTEDID\$/g,n.val()).replace(/\$SELECTEDNAME\$/g,s.text);return i.html(o).insertBefore($("#post-perm-target")),document.getElementById("post-new-"+t).close(),ze(),n.val("").trigger("change"),!1})}function ze(){$.each($(".post-delete-perm"),function(){$(this).unbind("click"),$(this).on("click",function(){$(this).closest(".grid").remove()})})}const we=()=>{$("form.post-visibility").on("submit",function(e){return e.preventDefault(),$.post({url:$(this).attr("action"),data:{visibility_id:$(this).find('[name="visibility_id"]').val()}}).done(function(t){document.getElementById("primary-dialog").close(),$("#visibility-icon-"+t.post_id).html(t.icon),window.showToast(t.toast)}),!1})};var be;$(document).ready(function(){be=$("#calendar-year-switcher"),be.length===1&&($("#calendar-year-switcher-field"),$("#add-calendar-event"),xt()),$(document).on("shown.bs.modal",function(){xe()}),$('select[name="recurring_periodicity"]').length===1&&xe(),kt()});function xt(){$(".calendar-event-block").each(function(){$(this).data("toggle")!=="dialog"&&$(this).data("url")&&$(this).click(function(){window.location=$(this).data("url")})})}function xe(){$('select[name="recurring_periodicity"]').change(function(){this.value?$(".field-recurring-until").show():$(".field-recurring-until").hide()}),$("#calendar-action-existing").click(function(e){e.preventDefault(),$("#calendar-event-first").hide(),$(".calendar-new-event-field").hide(),$("#calendar-event-subform").fadeToggle(),$("#calendar-event-submit").toggle()}),$("#calendar-action-new").click(function(e){e.preventDefault(),$("#calendar-event-first").hide(),$(".calendar-existing-event-field").hide(),$("#calendar-event-subform").fadeToggle(),$("#calendar-event-submit").toggle()}),$("#calendar-event-switch").click(function(e){e.preventDefault(),$("#calendar-event-subform").hide(),$("#calendar-event-first").fadeToggle(),$(".calendar-existing-event-field").show(),$(".calendar-new-event-field").show(),$("#calendar-event-submit").toggle()})}function kt(){$('[data-shortcut="previous"]').length!==0&&$(document).bind("keydown",function(e){(e.ctrlKey||e.metaKey)&&e.which===37?$('[data-shortcut="previous"]').addClass("loading")[0].click():(e.ctrlKey||e.metaKey)&&e.which===39&&$('[data-shortcut="next"]').addClass("loading")[0].click()})}const Be=document.querySelector("dialog#edit-warning"),se=300*1e3;let Ne,ae=!0;$(document).ready(function(){if(!Be)return;let e=document.querySelector('input[name="edit-warning"]');window.openDialog("edit-warning",e.dataset.url),$(document).on("shown.bs.modal",function(){$t()}),Ct()});function $t(){ae=!1,$("#entity-edit-warning-ignore").click(function(e){e.preventDefault(),ae=!0,$.ajax({url:$(this).data("url"),type:"POST",context:this}).done(function(){Be.close()})})}function Ct(){let e=$("#editing-keep-alive");e.length!==0&&(Ne=e.data("url"),setTimeout(oe,se))}function oe(){if(!ae){setTimeout(oe,se);return}$.ajax({url:Ne,type:"POST"}).done(function(){setTimeout(oe,se)})}var M;let re,ke,O;$(document).ready(function(){$(document).on("shown.bs.modal shown.bs.popover",function(){V()}),$(".quick-creator-subform").click(function(){$(document).on("shown.bs.modal",function(){fe()}),window.openDialog("primary-dialog",$(this).data("url"))})});function V(){re=$("#qq-modal-loading"),ke=$("#qq-modal-selection"),O=$("#qq-modal-form"),$('[data-toggle="entity-creator"]').unbind("click").click(function(e){return e.preventDefault(),$(this).data("type")==="inline"?($(".quick-creator-body").hide(),$(".quick-creator-footer").hide(),$(".quick-creator-loading").show()):Oe(),$.ajax({url:$(this).data("url"),context:this}).done(function(n){re.hide(),ke.hide(),O.show().html(n),fe(),he(),$(document).trigger("shown.bs.modal")}),!1})}function Re(){$("#qq-name-field").unbind("focusout").focusout(function(){$(this).val()&&($(this).parent().parent().find(".duplicate-entity-warning").hide(),$.ajax({url:$(this).data("live")+"?q="+$(this).val()+"&type="+$(this).data("type"),context:this}).done(function(e){if(e.length>0){let t=Object.keys(e).map(function(n){return''+e[n].name+""}).join(", ");$(this).parent().parent().find(".duplicate-entities").html(t),$(this).parent().parent().find(".duplicate-entity-warning").show()}else $(this).parent().parent().find(".duplicate-entity-warning").hide()}))})}function Oe(){$("#qq-modal-form").hide(),$("#qq-modal-selection").hide(),$("#qq-modal-loading").show()}function fe(){M=$(".quick-creator-submit"),M.length!==0&&(Re(),Ke(),he(),M.on("click",function(e){let t=$(this).data("action");return t&&$('#entity-creator-form [name="action"]').val(t),!0}),$("#entity-creator-form").submit(function(e){e.preventDefault(),M.prop("disabled",!0).find("span").hide().parent().find("i.fa-spin").show(),$("div.text-error").remove(),$.post({url:$(this).attr("action"),data:$(this).serialize(),context:this}).done(function(t){if(typeof t=="object"){if(t.redirect){window.location.replace(t.redirect);return}let s=new Option(t._name,t._id),i=$("#"+t._target);if(t._multi){let c=i.val();c.push(t._id),i.append(s).val(c)}else i.children().remove().end().append(s).val(t._id);i.trigger("change"),$("#qq-modal-form").html("").show(),$("#qq-modal-loading").hide(),$("#qq-modal-selection").show(),document.getElementById("primary-dialog").close(),le();return}let n=document.getElementById("qq-modal-form");n.innerHTML=t,V(),le()}).fail(function(t){if(t.responseJSON.errors){let n=t.responseJSON.errors;Object.keys(n).forEach(function(c){let d=$('#entity-creator-form [name="'+c+'"]');d.length>0&&d.addClass("input-error").parent().append('
'+n[c][0]+"
")});let i=Object.keys(n)[0],o=$('#entity-creator-form input[name="'+i+'"]');if(o[0]){o[0].scrollIntoView({behavior:"smooth"}),$(".tab-content .active").removeClass("active"),$(".nav-tabs li.active").removeClass("active");let c=$('[name="'+i+'"').closest(".tab-pane");c.addClass("active"),$('a[href="#'+c.attr("id")+'"]').closest("li").addClass("active")}}M.prop("disabled",!1).find("i.fa-spin").hide().parent().find("span").show(),$('#entity-creator-form [name="action"]').val("")})}))}function Ke(){$("#entity-creator-back").click(function(e){e.preventDefault(),Oe(),$.ajax({url:$(this).data("url"),context:this}).done(function(t){$(this).data("target"),O.html(t).show(),re.hide(),V()})})}function he(){$(".qq-mode-toggle").unbind("click").on("click",function(e){e.preventDefault(),!$(this).hasClass("active")&&($(".qq-mode-toggle").removeClass("active"),$(this).addClass("active"),$(".quick-creator-body").hide(),$(".quick-creator-footer").hide(),$(".quick-creator-loading").show(),$.ajax({url:$(this).data("url")}).done(function(t){O.html(t).show(),le(),$(document).trigger("shown.bs.modal")}))}),$(".qq-action-more").unbind("click").on("click",function(e){e.preventDefault(),$(this).hide(),$(".qq-more-fields").show()}),V()}function le(){he(),Re(),Ke(),fe()}var D,I,Lt=new IntersectionObserver(function(e){e[0].isIntersecting===!0&&de($(".datagrid-onload"))},{threshold:[0]});$(document).ready(function(){Ue(),ce(),K(),Tt(),$(document).on("shown.bs.modal",function(){ce(),me()})});function ce(){$("[data-bulk-action]").unbind("click").on("click",function(){St($(this).data("bulk-action"))}),$(".bulk-print").unbind("click").on("click",function(e){e.preventDefault();let t=$(this).closest("form");t.find(),t.submit()})}function Ue(){let e=$("#datagrid-select-all");e.length>0&&e.unbind("click").click(function(){$(this).prop("checked")?$.each($("input[name='model[]']"),function(){$(this).prop("checked",!0)}):$.each($("input[name='model[]']"),function(){$(this).prop("checked",!1)}),K()}),$.each($("input[name='model[]']"),function(){$(this).change(function(t){K(),t.preventDefault()})})}function St(e){let t=[];$.each($("input[name='model[]']"),function(){$(this).prop("checked")&&t.push($(this).val())}),e==="ajax"?$(document).on("shown.bs.modal",function(){$("#primary-dialog").find('input[name="models"]').val(t.toString())}):$("#datagrid-bulk-"+e+"-models").val(t.toString())}function K(){let e=!0;$.each($("input[name='model[]']"),function(){$(this).prop("checked")&&(e=!1)}),e?$(".datagrid-bulk-actions .btn2").prop("disabled",!0).addClass("btn-disabled"):$(".datagrid-bulk-actions .btn2").prop("disabled",!1).removeClass("btn-disabled").removeClass("disabled")}function Tt(){me(),Ve(),jt(),K()}function me(){$(".datagrid-bulk").unbind("click").click(function(e){e.preventDefault(),D=$(this).closest("form");let t=[];$.each($("input[name='model[]']"),function(){$(this).prop("checked")&&t.push($(this).val())}),$.ajax({url:D.attr("action")+"?action=edit",method:"POST",data:{model:t}}).done(function(n){let s=document.getElementById("primary-dialog");s.innerHTML=n,window.openDialog("primary-dialog"),$(document).trigger("shown.bs.modal")})}),$(".datagrid-submit").click(function(e){if(e.preventDefault(),D=$(this).closest("form"),D.find('input[name="action"]').val($(this).data("action")),$(this).data("action")==="delete")return window.openDialog("datagrid-bulk-delete"),!1;$(".datagrid-bulk-actions").hide(),$(".datagrid-spinner").show(),D.submit()}),$("#datagrid-action-confirm").click(function(){window.closeDialog("datagrid-bulk-delete"),D.submit()})}function Ve(){$.each($('table[data-render="datagrid2"]'),function(){I=$(this),$(this).find("thead a").click(function(e){e.preventDefault(),de($(this))}),$(this).closest("#datagrid-parent").find('nav[role="navigation"] a').click(function(e){e.preventDefault(),de($(this))})}),Ue(),ce(),me()}function jt(){$(".datagrid-onload").length!=0&&Lt.observe(document.querySelector(".datagrid-onload"))}function de(e){I.find("thead").hide(),I.find("tbody").hide(),I.find("tfoot").show();let t=e.attr("href"),n=e.data("url");t==="#"&&n&&(t=n);let s=e.data("target")??"#datagrid-parent";$.ajax(t).done(function(i){i.html&&$(s).html(i.html),i.deletes&&$("#datagrid-delete-forms").html(i.deletes),i.url&&window.history.pushState({},"",i.url),Ve(),$(document).trigger("shown.bs.modal")}).fail(function(i){console.error("datagrid2",i),I.find("tfoot").addClass("bg-danger")})}const We=()=>{document.querySelectorAll('[data-animate="collapse"]').forEach(n=>{n.addEventListener("click",Dt)}),document.querySelectorAll('[data-animate="reveal"]').forEach(n=>{n.addEventListener("change",qt)})};function Dt(e){let t=this.dataset.target;t||(t=this.hash),document.querySelectorAll(t).forEach(s=>{s.classList.toggle("hidden")}),this.classList.toggle("animate-collapsed")}function qt(e){let t=document.querySelector(this.dataset.target);this.value?t.classList.remove("hidden"):t.classList.add("hidden")}$(document).on("shown.bs.modal",function(){We()});We();$(document).ready(function(){Et(),Mt()});function Et(){let e=$("#bookmark-selector");if(e.length===0)return!1;e.change(function(t){t.preventDefault();let n=$(this).find(":selected");$(".bookmark-subform").addClass("hidden");let s=n.data("target");$(s).removeClass("hidden")})}function Mt(){let e=$("#entity-selector");if(e.length===0)return!1;e.val()!=""&&$("#filter-subform").show(),e.change(function(){e.val()==""?($("#filter-subform").hide(),console.log(e.val())):$("#filter-subform").show()})}$(document).ready(function(){At()});function At(){let e=$("#webhook-selector");if(e.length===0)return!1;e.change(function(t){t.preventDefault();let n=$(this).find(":selected");$(".webhook-subform").addClass("hidden");let s=n.data("target");$(s).removeClass("hidden")})}$(document).ready(function(){It()});function It(){let e=$("#post-layout-selector");e.length!==0&&e.change(function(t){t.preventDefault(),$(this).find(":selected").val()===""?($(".field-entry").show(),$(".field-location").show(),$(".field-display").show(),$("#post-layout-subform").hide()):($(".field-entry").hide(),$(".field-location").hide(),$(".field-display").hide(),$("#post-layout-subform").show())})}$(document).ready(function(){$(document).on("shown.bs.modal shown.bs.popover",function(){$e()}),$(".form-members").count!==0&&$e()});function $e(){$.each($(".form-members"),function(){let e=$(this);if(e.data("loaded")===1)return;e.data("loaded",1);let t=e.data("allow-clear");e.select2({tags:!0,allowClear:t||!0,minimumInputLength:0,ajax:{quietMillis:500,delay:500,url:e.data("url"),dataType:"json",data:function(n){return{q:$.trim(n.term)}},processResults:function(n){return{results:n}},cache:!0},createTag:function(){}})})}$(document).ready(function(){Pt(),Qt(),zt(),Bt(),Ft(),Nt(),Rt()});function Pt(){$("#campaign-modules").length!==0&&$('input[name="enabled"]').change(function(e){e.preventDefault();let t=$(this).closest(".box-module").find("h3");t.hasClass("loading")||(t.addClass("loading"),axios.post($(this).data("url")).then(n=>{let s=$(this);s.closest(".box-module").find("h3").removeClass("loading"),n.data.success&&(n.data.status?s.closest(".box-module").addClass("module-enabled"):s.closest(".box-module").removeClass("module-enabled"),window.showToast(n.data.toast))}))})}function Qt(){$(".btn-user-roles").popover({html:!0,sanitize:!1,trigger:"focus"})}function Ft(){document.querySelectorAll(".public-permission").forEach(t=>{t.addEventListener("click",Ht)})}function Ht(e){e.preventDefault(),this.classList.add("loading"),axios.post(this.dataset.url).then(t=>{this.classList.remove("loading"),t.data.success&&(t.data.status?$(this).addClass("enabled"):$(this).removeClass("enabled"),window.showToast(t.data.toast))})}function zt(){$.each($(".codemirror"),function(){let e=$(this).attr("id");CodeMirror.fromTextArea(document.getElementById(e),{extraKeys:{"Ctrl-Space":"autocomplete"},lineNumbers:!0,lineWrapping:!0,theme:"dracula"})})}function Bt(){let e=[].slice.call(document.querySelectorAll(".nested-sortable"));for(let t=0;t0;return!(i.classList.contains("fixed-position")&&c)}})}function Nt(){let e=$("form#campaign-style");e.length!==0&&e.on("submit",function(t){let n=$($(this).data("error"));return $('textarea[name="content"]').val().length<$(this).data("max-content")?(n.hide(),!0):(n.show(),$("form .submit-group .btn").prop("disabled",!1),!1)})}function Rt(){$('input[name="vanity"]').focusout(function(e){let t=$(this).val(),n=$("#vanity-error"),s=$("#vanity-success"),i=$("#vanity-loading");if(n.html("").hide(),s.hide(),!t)return;i.show();let o={};o.vanity=t,$.post({url:$(this).data("url"),method:"POST",context:this,data:o}).done(function(c){$(this).val(c.vanity),s.find("code").html(c.vanity),s.show(),n.hide(),i.hide()}).fail(function(c){let d="";c.responseJSON.errors.vanity.forEach(m=>d+=m+" "),n.html(d).show(),s.hide(),i.hide()})})}const Je=()=>{document.querySelectorAll("[data-clipboard]").forEach(t=>{t.addEventListener("click",Ot,!1)})};function Ot(e){e.preventDefault(),Kt(this.dataset.clipboard,this);let t=this.dataset.toast;return t&&window.showToast(t),!1}async function Kt(e,t){if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e);else{const n=document.createElement("textarea");n.value=e,n.style.position="absolute",n.style.left="-999999px",t.append(n),n.select();try{document.execCommand("copy")}catch(s){console.error(s)}finally{n.remove()}}}Je();$(document).on("shown.bs.modal",function(e){Je()});$(document).ready(function(){Ge()});function Ge(){$('.toast-container [data-toggle="dismiss"]').unbind("click").on("click",function(e){e.preventDefault();let t=$(this).closest(".toast-message");t.removeClass("opacity-100").addClass("opacity-0"),setTimeout(function(){t.remove()},150)})}window.showToast=function(e,t){t=t||"bg-success text-success-content",t==="error"&&(t="bg-error text-error-content");let n=$('
');n.html('
'+e+'this.options.collapseScreenSize?e("body").removeClass(i.collapsed).trigger(e.Event(o.expanded)):e("body").addClass(i.open).trigger(e.Event(o.expanded))},c.prototype.close=function(){var f=e(window).width();f>this.options.collapseScreenSize?e("body").addClass(i.collapsed).trigger(e.Event(o.collapsed)):e("body").removeClass(i.open+" "+i.collapsed).trigger(e.Event(o.collapsed))},c.prototype.expandOnHover=function(){e(s.mainSidebar).hover((function(){e("body").is(s.mini+s.collapsed)&&e(window).width()>this.options.collapseScreenSize&&this.expand()}).bind(this),(function(){e("body").is(s.expanded)&&this.collapse()}).bind(this))},c.prototype.expand=function(){setTimeout(function(){e("body").removeClass(i.collapsed).addClass(i.expanded)},this.options.expandTransitionDelay)},c.prototype.collapse=function(){setTimeout(function(){e("body").removeClass(i.expanded).addClass(i.collapsed)},this.options.expandTransitionDelay)};function d(f){return this.each(function(){var _=e(this),p=_.data(t);if(!p){var nt=e.extend({},n,_.data(),typeof f=="object"&&f);_.data(t,p=new c(nt))}f==="toggle"&&p.toggle()})}var m=window.$.fn.pushMenu;window.$.fn.pushMenu=d,window.$.fn.pushMenu.Constructor=c,window.$.fn.pushMenu.noConflict=function(){return window.$.fn.pushMenu=m,this},window.$(document).on("click",s.button,function(f){f.preventDefault(),d.call(window.$(this),"toggle")}),window.$(window).on("load",function(){d.call(window.$(s.button))})}(jQuery);const Ut=()=>{document.querySelectorAll(".banner-notification-dismiss").forEach(e=>{e.addEventListener("click",Vt,!1)}),document.querySelectorAll('[data-dismiss="tutorial"]').forEach(e=>{e.addEventListener("click",Wt,!1)})};function Vt(e){e.preventDefault();let t=this.dataset.dismiss;axios.post(this.dataset.url).then(()=>{if(!t)return;let n=document.querySelector(t);n&&n.classList.add("hidden")})}function Wt(e){e.preventDefault();let t=this.dataset.target;axios.post(this.dataset.url).then(()=>{if(!t)return;let n=document.querySelector(t);n&&n.classList.add("hidden")})}Ut();let Ze;$(document).ready(function(){Jt()});function Jt(){let e=$("#element-era-id");e.length!==0&&(Ze=e.val(),e.length===1&&e.on("change",function(){Gt(e.val())}))}function Gt(e){e=parseInt(e);let t=$('input[name="era-data-url"]').data("url").replace("/0/","/"+e+"/"),n=$('input[name="oldPosition"]').data("url");$.ajax(t).done(function(s){let i=$('select[name="position"]');i.html("");let o=1;$.each(s.positions,function(c){let d=s.positions[c],m=' selected="selected"';n&&!c&&Ze==e&&i.append('"),c&&i.append('"),o++})})}window.initSortable=function(){let e=document.querySelectorAll(".sortable-elements");e.length!==0&&e.forEach(t=>{let n={},s=t.dataset.handle;s&&(n.handle=s),Ee.create(t,n)})};window.initSortable();window.formErrorHandler=function(e,t){if($(".input-error").removeClass("input-error"),$(".text-error").remove(),$(t).find(".btn-primary").prop("disabled",!1).removeClass("loading"),e.status===503){window.showToast(e.responseJSON.message,"error");return}if(e.status===403){$("#entity-form-403-error").show();return}let n=e.responseJSON.errors,s=[],i=Object.keys(n),o=!0;if(i.forEach(function(f){let _=$('[name="'+f+'"]');_.length>0?_.addClass("input-error").parent().append('
'+n[f][0]+"
"):(o=!1,s.push(n[f][0])),window.showToast(n[f][0],"error")}),!o){let f=$("#entity-form-generic-error .error-logs");f.html(""),s.forEach(function(_){let p=_+"
";f.append(p)}),$("#entity-form-generic-error").show()}if($(t).find(".tab-content").length===0)return;let c=Object.keys(n)[0],d=document.getElementsByName(c);if(!d[0])return;$(".tab-content .active").removeClass("active"),$(".nav-tabs li.active").removeClass("active");let m=$('[name="'+c+'"').closest(".tab-pane");m.addClass("active"),$('a[href="#'+m.attr("id")+'"]').closest("li").addClass("active"),d[0].scrollIntoView({behavior:"smooth"})};const Zt={props:{text:String,title:String}},Yt={class:"mx-5"},Xt=["data-title"],en=a("svg",{class:"h-6 w-6 transition-all duration-150 hover:rotate-45","data-sidebar":"collapse",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 50 50"},[a("path",{d:"M 7.71875 6.28125 L 6.28125 7.71875 L 23.5625 25 L 6.28125 42.28125 L 7.71875 43.71875 L 25 26.4375 L 42.28125 43.71875 L 43.71875 42.28125 L 26.4375 25 L 43.71875 7.71875 L 42.28125 6.28125 L 25 23.5625 Z"})],-1),tn=a("svg",{class:"h-6 w-6 transition-all duration-150 hover:rotate-90","data-sidebar":"expand",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 50 50"},[a("path",{d:"M 0 9 L 0 11 L 50 11 L 50 9 Z M 0 24 L 0 26 L 50 26 L 50 24 Z M 0 39 L 0 41 L 50 41 L 50 39 Z"})],-1),nn={class:"sr-only"};function sn(e,t,n,s,i,o){return r(),l("div",Yt,[a("span",{role:"button",class:"sidebar-toggle text-center cursor-pointer fill-current hover:text-primary-focus","data-toggle":"tooltip","data-title":n.title,"data-placement":"right","data-html":"true",tabindex:"3"},[en,tn,a("span",nn,u(n.text),1)],8,Xt)])}const an=L(Zt,[["render",sn]]),on={props:["entity"],methods:{backgroundImage:function(e){return"url('"+e.image+"')"},preview:function(e){this.emitter.emit("preview",e)}}},rn=["data-id"],ln={class:"flex-none"},cn=["href","title"],dn={class:"flex-grow truncate pl-1"},un=["title","innerHTML"],fn=["innerHTML"];function hn(e,t,n,s,i,o){return r(),l("div",{class:"flex justify-center gap-1 cursor-pointer hover:bg-base-200 rounded w-full","data-id":n.entity.id,onClick:t[1]||(t[1]=c=>o.preview(n.entity))},[a("div",ln,[a("a",{href:n.entity.link,style:E({backgroundImage:o.backgroundImage(n.entity)}),onClick:t[0]||(t[0]=X(()=>{},["stop"])),title:n.entity.name,class:"rounded cover-background block h-16 w-16"},null,12,cn)]),a("div",dn,[a("div",{class:"font-extrabold entity-name truncate",title:n.entity.name,innerHTML:n.entity.name},null,8,un),a("div",{class:"entity-type text-xs",innerHTML:n.entity.type},null,8,fn)])],8,rn)}const Ye=L(on,[["render",hn]]),mn={props:["entity"],components:{LookupEntity:Ye},data(){return{focus_profile:!0,focus_pins:!1,focus_access:!1}},methods:{hasTitle(){return this.entity.title},tagClass(e){let t="inline-block rounded-xl px-3 py-1 bg-base-100 text-base-content text-xs";return e.colour&&(t+=" bg-"+e.colour,e.colour==="black"&&(t+=" text-white")),t},backgroundImage:function(){return"url('"+this.entity.image+"')"},tabClass:function(e){let t="p-1 px-1 mx-1 pt-2 select-none text-center truncate border-b-2 border-solid border-r-0 border-t-0 border-l-0";return e==="profile"&&this.focus_profile||e==="links"&&this.focus_pins||e==="access"&&this.focus_access?t+=" font-black border-slate-600":t+=" cursor-pointer border-base-100",t},switchTab:function(e){this.focus_profile=!1,this.focus_pins=!1,this.focus_access=!1,e==="profile"?this.focus_profile=!0:e==="links"?this.focus_pins=!0:e==="access"&&(this.focus_access=!0)},profileClass:function(e){return"entity-profile-"+e.slug}}},pn={class:"entity-header p-3 bg-entity-focus"},gn={class:"w-full flex items-center"},vn=["href","title","innerHTML"],_n={key:0,class:"fa-solid fa-skull mx-2","aria-hidden":"true"},yn=["href"],wn=a("i",{class:"fa-solid fa-external-link","aria-hidden":"true","aria-label":"Open in a new window"},null,-1),bn=[wn],xn=["innerHTML"],kn={key:1,class:"my-1 w-full flex flex-wrap gap-1"},$n=["href","data-tag-id","data-tag-slug","innerHTML"],Cn=["href","data-tag"],Ln=a("i",{class:"fa-duotone circle-location-arrow","aria-hidden":"true","aria-label":"Location"},null,-1),Sn=["href","title"],Tn={class:"entity-sections"},jn={class:"tabs flex my-2 justify-center items-center border-solid border-slate-600 border-b-2 border-r-0 border-t-0 border-l-0"},Dn={key:0,class:"tab-profile p-5 flex flex-col gap-5"},qn={key:0,class:"entity-pinned-attributes flex flex-col gap-3"},En=["data-attribute","data-target"],Mn={class:"inline-block uppercase font-extrabold mr-1"},An=["innerHTML"],In={key:1},Pn={class:"flex flex-col gap-3"},Qn={class:"uppercase font-extrabold truncate"},Fn={key:1,class:"tab-links p-3"},Hn={key:0,class:"text-center italic"};function zn(e,t,n,s,i,o){const c=T("LookupEntity");return r(),l(v,null,[a("div",pn,[a("div",gn,[a("a",{class:"text-2xl font-extrabold entity-name",href:n.entity.link,title:n.entity.name,innerHTML:n.entity.name},null,8,vn),n.entity.is_dead?(r(),l("i",_n)):h("",!0),a("a",{class:"ml-2 text-xs",target:"_blank",href:n.entity.link},bn,8,yn)]),o.hasTitle()?(r(),l("div",{key:0,class:"block w-full",innerHTML:n.entity.title},null,8,xn)):h("",!0),n.entity.tags.length>0?(r(),l("div",kn,[(r(!0),l(v,null,w(n.entity.tags,d=>(r(),l("a",{class:g(o.tagClass(d)),href:d.link,"data-tag-id":d.id,"data-tag-slug":d.slug,innerHTML:d.name},null,10,$n))),256))])):h("",!0),n.entity.location?(r(),l("a",{key:2,class:"block w-full cursor-pointer my-2",href:n.entity.location.link,"data-tag":n.entity.id},[Ln,b(" "+u(n.entity.location.name),1)],8,Cn)):h("",!0),n.entity.image?(r(),l("a",{key:3,href:n.entity.link,style:E({backgroundImage:o.backgroundImage()}),title:n.entity.name,class:"rounded cover-background block w-full aspect-square"},null,12,Sn)):h("",!0)]),a("div",Tn,[a("div",jn,[a("div",{class:g(o.tabClass("profile")),onClick:t[0]||(t[0]=d=>o.switchTab("profile"))},u(n.entity.texts.profile),3),a("div",{class:g(o.tabClass("links")),onClick:t[1]||(t[1]=d=>o.switchTab("links"))},u(n.entity.texts.connections),3),a("div",{class:g(o.tabClass("access")),onClick:t[2]||(t[2]=d=>o.switchTab("access"))},null,2)]),i.focus_profile?(r(),l("div",Dn,[n.entity.attributes.length>0?(r(),l("div",qn,[(r(!0),l(v,null,w(n.entity.attributes,d=>(r(),l("div",{class:"","data-attribute":d.name,"data-target":d.id},[a("span",Mn,u(d.name),1),a("span",{innerHTML:d.value},null,8,An)],8,En))),256))])):h("",!0),n.entity.attributes.length>0?(r(),l("hr",In)):h("",!0),a("div",Pn,[(r(!0),l(v,null,w(n.entity.profile,d=>(r(),l("div",{class:g(["",o.profileClass(d)])},[a("div",Qn,u(d.field),1),a("div",null,u(d.value),1)],2))),256))])])):h("",!0),i.focus_pins?(r(),l("div",Fn,[(r(!0),l(v,null,w(n.entity.connections,d=>(r(),S(c,{entity:d},null,8,["entity"]))),256)),n.entity.connections.length===0?(r(),l("p",Hn,u(n.entity.texts["no-connections"]),1)):h("",!0)])):h("",!0)])],64)}const Bn=L(mn,[["render",zn]]),Nn={directives:{clickOutside:Ae.directive},props:{api_lookup:String,api_recent:String,placeholder:String,keyboard_tooltip:String},components:{LookupEntity:Ye,EntityPreview:Bn},data(){return{has_drawer:!1,term:null,show_loading:!1,show_recent:!1,show_preview:!1,show_results:!1,show_bookmarks:!1,recent:[],bookmarks:[],indexes:[],results:[],cached:{},has_recent:!1,texts:{},timeout_id:null,preview_entity:null}},watch:{term(e,t){this.termChanged()}},methods:{termChanged(){this.term.trim().length<3||(this.timeout_id!==void 0&&clearTimeout(this.timeout_id),this.show_loading=!0,this.timeout_id=setTimeout(()=>this.lookup(),500))},lookup(){let e=this.term.trim(),t=e.toLowerCase().replace(/ /g,"-").replace(/ [^\w-]+/g,"");if(this.cached[t])return this.displayCached(t);fetch(this.api_lookup+"?"+new URLSearchParams({q:e,v2:!0})).then(n=>n.json()).then(n=>this.parseLookupResponse(n,t))},focus(){this.api_recent&&(this.show_preview=!1,this.has_drawer=!0,this.fetch())},escape(){this.timeout_id!==void 0&&clearTimeout(this.timeout_id),this.close()},fetch(){if(this.has_recent){this.show_recent=!0;return}this.show_loading=!0,fetch(this.api_recent).then(e=>e.json()).then(e=>{this.recent=e.recent,this.bookmarks=e.bookmarks,this.indexes=e.indexes,this.texts.recents=e.texts.recents,this.texts.results=e.texts.results,this.texts.hint=e.texts.hint,this.texts.bookmarks=e.texts.bookmarks,this.texts.index=e.texts.index,this.texts.keyboard=e.texts.keyboard,this.texts.empty_results=e.texts.empty_results,this.texts.fulltext=e.texts.fulltext,this.texts.fulltext_route=e.fulltext_route,this.show_loading=!1,this.show_recent=!0,this.has_recent=!0,this.bookmarks.length>0?this.show_bookmarks=!0:this.show_bookmarks=!1}).catch(e=>{this.show_loading=!1,this.show_recent=!0,this.has_recent=!1})},parseLookupResponse(e,t){this.results=e.entities,this.cached[t]=e.entities,this.showResults()},displayCached(e){this.results=this.cached[e],this.showResults()},showResults(){this.timeout_id=null,this.show_preview=!1,this.show_loading=!1,this.show_results=!0},loadPreview(e){this.show_loading=!0,fetch(e.preview).then(t=>t.json()).then(t=>this.parsePreviewResponse(t))},parsePreviewResponse(e){this.preview_entity=e,this.show_loading=!1,this.show_preview=!0,this.show_recent=!1},onClickOutside(e){this.close()},close(){this.show_recent=!1,this.show_loading=!1,this.show_preview=!1,this.$refs.searchField.blur()},showBookmarks(){this.show_bookmarks=!0},searchFullTextUrl(){return`${this.texts.fulltext_route}?term=${this.term}`},showIndexes(){this.show_bookmarks=!1},modeClass(e){return e&&this.show_bookmarks||!e&&!this.show_bookmarks?" underline":""}},mounted(){this.emitter.on("preview",e=>{this.loadPreview(e)})}},Rn={class:"flex grow mr-2"},On={class:"relative grow field flex items-center"},Kn=["placeholder"],Un={class:"absolute right-1 hidden md:inline"},Vn=["data-title"],Wn={key:0,class:"search-drawer absolute top-0 left-0 mt-12 h-sidebar w-sidebar bg-navbar bg-base-100 shadow-r overflow-y-auto"},Jn={key:0,class:"text-center"},Gn=a("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true","aria-label":"Loading"},null,-1),Zn=[Gn],Yn={key:1,class:"search-recent bg-lookup p-2 min-h-full shadow-r flex flex-col items-stretch"},Xn={key:0,class:"flex-none"},ei={class:"italic text-xs text-center"},ti={class:"grow flex flex-col gap-5 p-2"},ni={key:0,class:"search-results flex flex-col gap-2"},ii={class:"text-sm uppercase"},si={key:0,class:"text-neutral-content text-sm"},ai=["href"],oi={key:1,class:"recent-searches flex flex-col gap-2"},ri={class:"text-sm uppercase"},li={key:2,class:"flex gap-5 justify-center"},ci={key:3,class:"flex flex-col gap-4"},di=["href","title"],ui=["innerHTML"],fi={key:4,class:"flex flex-col gap-4"},hi=["href","title"],mi=["innerHTML"],pi={key:1,class:"flex-none text-xs text-center"},gi=a("hr",null,null,-1),vi=["innerHTML"],_i={key:2,class:"search-preview bg-lookup min-h-full shadow-r"};function yi(e,t,n,s,i,o){const c=T("LookupEntity"),d=T("EntityPreview"),m=Me("click-outside");return ee((r(),l("div",Rn,[a("div",On,[ee(a("input",{type:"text",class:"leading-4 w-20 md:w-full",maxlength:"25",ref:"searchField",id:"entity-lookup","onUpdate:modelValue":t[0]||(t[0]=f=>i.term=f),onClick:t[1]||(t[1]=f=>o.focus()),onFocus:t[2]||(t[2]=f=>o.focus()),onKeydown:t[3]||(t[3]=st(f=>o.escape(),["esc"])),placeholder:n.placeholder},null,40,Kn),[[at,i.term]]),a("span",Un,[a("span",{class:"flex-none keyboard-shortcut py-1",id:"lookup-kb-shortcut","data-toggle":"tooltip","data-title":n.keyboard_tooltip,"data-html":"true","data-placement":"bottom"}," K ",8,Vn)])]),i.show_recent||i.show_loading||i.show_preview?(r(),l("aside",Wn,[i.show_loading?(r(),l("div",Jn,Zn)):h("",!0),i.show_recent?(r(),l("div",Yn,[i.show_results?h("",!0):(r(),l("div",Xn,[a("p",ei,u(i.texts.hint),1)])),a("div",ti,[i.show_results?(r(),l("div",ni,[a("div",ii,u(i.texts.results),1),i.results.length===0?(r(),l("div",si,u(i.texts.empty_results),1)):(r(!0),l(v,{key:1},w(i.results,f=>(r(),S(c,{entity:f},null,8,["entity"]))),256)),a("a",{class:"grow text-sm uppercase hover:underline",href:o.searchFullTextUrl()},u(i.texts.fulltext),9,ai)])):h("",!0),i.recent.length>0?(r(),l("div",oi,[a("div",ri,u(i.texts.recents),1),(r(!0),l(v,null,w(i.recent,f=>(r(),S(c,{entity:f},null,8,["entity"]))),256))])):h("",!0),i.bookmarks.length>0?(r(),l("div",li,[i.bookmarks.length>0?(r(),l("button",{key:0,class:g(["grow text-sm uppercase hover:underline",this.modeClass(!0)]),onClick:t[4]||(t[4]=f=>o.showBookmarks())},u(i.texts.bookmarks),3)):h("",!0),a("button",{class:g(["grow text-sm uppercase hover:underline",this.modeClass(!1)]),onClick:t[5]||(t[5]=f=>o.showIndexes())},u(i.texts.index),3)])):h("",!0),i.show_bookmarks?(r(),l("div",ci,[(r(!0),l(v,null,w(i.bookmarks,f=>(r(),l("a",{href:f.url,onClick:t[6]||(t[6]=X(()=>{},["stop"])),title:f.text,class:"flex gap-2 items-center"},[a("i",{class:g(["w-4",f.icon]),"aria-hidden":"true"},null,2),a("span",{innerHTML:f.text},null,8,ui)],8,di))),256))])):(r(),l("div",fi,[(r(!0),l(v,null,w(i.indexes,f=>(r(),l("a",{href:f.url,onClick:t[7]||(t[7]=X(()=>{},["stop"])),title:f.name,class:"flex gap-2 items-center"},[a("i",{class:g(["w-4 text-center",f.icon]),"aria-hidden":"true"},null,2),a("span",{innerHTML:f.name},null,8,mi)],8,hi))),256))]))]),i.show_loading?h("",!0):(r(),l("div",pi,[gi,a("p",{class:"italic text-xs text-center",innerHTML:i.texts.keyboard},null,8,vi)]))])):h("",!0),i.show_preview?(r(),l("div",_i,[H(d,{entity:i.preview_entity},null,8,["entity"])])):h("",!0)])):h("",!0)])),[[m,o.onClickOutside]])}const wi=L(Nn,[["render",yi]]),bi={props:["campaign"],methods:{backgroundImage:function(e){return e.image?"url("+e.image+")":""},campaignClass:function(e){return"campaign flex items-end border border-solid rounded-lg cover-background relative h-24 overflow-hidden text-break shadow-xs hover:shadow-md border-0"+(e.is_boosted?" boosted":"")}}},xi=["href","title"],ki=["innerHTML"];function $i(e,t,n,s,i,o){return r(),l("a",{class:g(o.campaignClass(n.campaign)),href:n.campaign.url,style:E({backgroundImage:o.backgroundImage(n.campaign)}),title:n.campaign.name},[a("div",{class:"flex items-end justify-center name w-full text-xs p-2 pt-6 text-center",innerHTML:n.campaign.name},null,8,ki)],14,xi)}const Ci=L(bi,[["render",$i]]),Li={props:["notification"],data(){return{is_dismissed:!1,is_loading:!1}},methods:{backgroundClass:function(e){let t="notification bg-base-200 flex justify-center items-center p-2 rounded-md";return e.is_read?t:t+" unread"},iconClass:function(e){return"fa-solid fa-"+e.icon},dismiss:function(e){this.is_loading=!0,axios.post(e.dismiss).then(()=>{this.is_dismissed=!0,this.emitter.emit("read_notification",e)})}}},Si=["data-id"],Ti={class:"flex-none p-2"},ji=["innerHTML","href"],Di=["title"],qi=a("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),Ei=[qi],Mi={key:1,class:"flex-none p-2"},Ai=a("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1),Ii=[Ai],Pi=["data-id"],Qi={class:"flex-none p-2"},Fi=["innerHTML"],Hi=["title"],zi=a("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),Bi=[zi],Ni={key:1,class:"flex-none p-2"},Ri=a("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1),Oi=[Ri];function Ki(e,t,n,s,i,o){return n.notification.url&&!i.is_dismissed?(r(),l("div",{key:0,class:g(o.backgroundClass(n.notification)),"data-id":n.notification.id},[a("div",Ti,[a("i",{class:g(o.iconClass(n.notification)),"aria-hidden":"true"},null,2)]),a("a",{class:"flex-grow p-2 break-all",innerHTML:n.notification.text,href:n.notification.url},null,8,ji),this.is_loading?(r(),l("div",Mi,Ii)):(r(),l("div",{key:0,class:"flex-none p-2 cursor-pointer dismissable",onClick:t[0]||(t[0]=c=>o.dismiss(n.notification)),title:n.notification.dismiss_text},Ei,8,Di))],10,Si)):i.is_dismissed?h("",!0):(r(),l("div",{key:1,class:g(o.backgroundClass(n.notification)),"data-id":n.notification.id},[a("div",Qi,[a("i",{class:g(o.iconClass(n.notification)),"aria-hidden":"true"},null,2)]),a("div",{class:"flex-grow p-2",innerHTML:n.notification.text},null,8,Fi),this.is_loading?(r(),l("div",Ni,Oi)):(r(),l("div",{key:0,class:"flex-none p-2 cursor-pointer dismissable",onClick:t[1]||(t[1]=c=>o.dismiss(n.notification)),title:n.notification.dismiss_text},Bi,8,Hi))],10,Pi))}const Ui=L(Li,[["render",Ki]]),Vi={props:["release"],data(){return{is_dismissed:!1,is_loading:!1}},methods:{backgroundClass:function(e){return"release bg-base-200 flex justify-center items-center p-2 rounded-md"},dismiss:function(e){this.is_loading=!0,axios.post(e.dismiss).then(()=>{this.is_dismissed=!0,this.emitter.emit("read_release",e)})}}},Wi=["data-id"],Ji={class:"flex-grow p-2"},Gi=["innerHTML","href"],Zi=["innerHTML"],Yi=["title"],Xi=a("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),es=[Xi],ts={key:1,class:"flex-none p-2"},ns=a("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1),is=[ns];function ss(e,t,n,s,i,o){return i.is_dismissed?h("",!0):(r(),l("div",{key:0,class:g(o.backgroundClass(n.release)),"data-id":n.release.id},[a("div",Ji,[a("a",{innerHTML:n.release.title,class:"font-bold cursor-pointer block w-full",href:n.release.url,target:"_blank"},null,8,Gi),a("p",{innerHTML:n.release.text},null,8,Zi)]),this.is_loading?(r(),l("div",ts,is)):(r(),l("div",{key:0,class:"flex-none p-2 cursor-pointer dismissable",onClick:t[0]||(t[0]=c=>o.dismiss(n.release)),title:n.release.dismiss_text},es,8,Yi))],10,Wi))}const as=L(Vi,[["render",ss]]),os=a("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[a("g",{transform:"translate(-219.000000, -200.000000)",fill:"currentcolor"},[a("g",{id:"icons",transform:"translate(56.000000, 160.000000)"},[a("path",{d:"M181.9,54 L179.8,54 C178.63975,54 177.7,54.895 177.7,56 L177.7,58 C177.7,59.105 178.63975,60 179.8,60 L181.9,60 C183.06025,60 184,59.105 184,58 L184,56 C184,54.895 183.06025,54 181.9,54 M174.55,54 L172.45,54 C171.28975,54 170.35,54.895 170.35,56 L170.35,58 C170.35,59.105 171.28975,60 172.45,60 L174.55,60 C175.71025,60 176.65,59.105 176.65,58 L176.65,56 C176.65,54.895 175.71025,54 174.55,54 M167.2,54 L165.1,54 C163.93975,54 163,54.895 163,56 L163,58 C163,59.105 163.93975,60 165.1,60 L167.2,60 C168.36025,60 169.3,59.105 169.3,58 L169.3,56 C169.3,54.895 168.36025,54 167.2,54 M181.9,47 L179.8,47 C178.63975,47 177.7,47.895 177.7,49 L177.7,51 C177.7,52.105 178.63975,53 179.8,53 L181.9,53 C183.06025,53 184,52.105 184,51 L184,49 C184,47.895 183.06025,47 181.9,47 M174.55,47 L172.45,47 C171.28975,47 170.35,47.895 170.35,49 L170.35,51 C170.35,52.105 171.28975,53 172.45,53 L174.55,53 C175.71025,53 176.65,52.105 176.65,51 L176.65,49 C176.65,47.895 175.71025,47 174.55,47 M167.2,47 L165.1,47 C163.93975,47 163,47.895 163,49 L163,51 C163,52.105 163.93975,53 165.1,53 L167.2,53 C168.36025,53 169.3,52.105 169.3,51 L169.3,49 C169.3,47.895 168.36025,47 167.2,47 M181.9,40 L179.8,40 C178.63975,40 177.7,40.895 177.7,42 L177.7,44 C177.7,45.105 178.63975,46 179.8,46 L181.9,46 C183.06025,46 184,45.105 184,44 L184,42 C184,40.895 183.06025,40 181.9,40 M174.55,40 L172.45,40 C171.28975,40 170.35,40.895 170.35,42 L170.35,44 C170.35,45.105 171.28975,46 172.45,46 L174.55,46 C175.71025,46 176.65,45.105 176.65,44 L176.65,42 C176.65,40.895 175.71025,40 174.55,40 M169.3,42 L169.3,44 C169.3,45.105 168.36025,46 167.2,46 L165.1,46 C163.93975,46 163,45.105 163,44 L163,42 C163,40.895 163.93975,40 165.1,40 L167.2,40 C168.36025,40 169.3,40.895 169.3,42"})])])],-1),rs=[os],ls={__name:"GridSvg",props:{size:Number},setup(e){const t=e;function n(){return"w-"+t.size+" h-"+t.size}return(s,i)=>(r(),l("svg",{class:g(n()),viewBox:"0 -0.5 21 21",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true"},rs,2))}},cs={directives:{clickOutside:Ae.directive},props:{user_id:{type:String},api:{type:String},fetch:{type:String},initials:{type:String},avatar:{type:String},campaign_id:void 0,has_alerts:{type:Boolean}},components:{GridSvg:ls,Campaign:Ci,Notification:Ui,Release:as},data(){return{alert_delta:60*1e3,is_loading:!1,is_expanded:!1,has_data:!1,view_campaigns:!1,view_profile:!1,profile:{},campaigns:{},notifications:{},marketplace:{},releases:{},show_alerts:!1,is_loaded:!1}},methods:{openCampaigns:function(){this.view_campaigns=!0,this.view_profile=!1,this.loadData()},openProfile:function(){this.view_profile=!0,this.view_campaigns=!1,this.loadData()},loadData:function(){this.is_expanded=!0,!this.has_data&&(this.is_loading=!0,fetch(this.api).then(e=>e.json()).then(e=>{this.profile=e.profile,this.campaigns=e.campaigns,this.notifications=e.notifications,this.marketplace=e.marketplace,this.releases=e.releases,this.show_alerts=e.has_unread,this.has_data=!0,this.is_loading=!1,this.is_loaded=!0}))},blockClass:function(e){return e?"block p-4 flex-grow items-center focus:box-shadow":"block p-4 items-center bg-base-200 cursor-pointer flex-none focus:box-shadow"},logout:function(){document.getElementById("logout-form").submit()},onClickOutside(e){this.is_expanded=!1},readRelease:function(e){let t=this.releases.releases.findIndex(n=>n.id===e.id);this.releases.releases.slice(t,1),this.updateUnread()},readNotification:function(e){let t=this.notifications.messages.findIndex(n=>n.id==e.id);this.notifications.messages.slice(t,1),this.updateUnread()},updateUnread:function(){this.notifications.messages.length===0&&this.releases.releases.length===0&&(this.show_alerts=!1)},updateAlerts:function(){let e=localStorage.getItem("last_notification-"+this.user_id),n=new Date().getTime()-60*5e3;if(!e||et.json()).then(t=>{localStorage.setItem("notification-has-alerts-"+this.user_id,t.has_alerts),this.updateAlerts()})},queueFetch:function(){let e=this;setTimeout((function(){e.updateAlerts()}).bind(this),this.alert_delta)},showInitials:function(){return this.avatar.startsWith("/images/")},profilePictureUrl:function(){return"url("+this.avatar+")"}},mounted(){this.emitter.on("read_release",e=>{this.readRelease(e)}),this.emitter.on("read_notification",e=>{this.readNotification(e)}),this.show_alerts=this.has_alerts,this.queueFetch()}},ds={class:"nav-switcher flex items-center justify-center h-12"},us=a("span",{class:"sr-only"},"Campaigns",-1),fs={class:"indicator relative inline-flex w-max"},hs={key:0,class:"notification-badge left-auto top-auto w-fit inline-flex absolute content-center items-center z-10"},ms={key:1,class:"profile-box rounded-lg p-2 text-center font-bold"},ps={key:0,class:"navigation-drawer bg-base-100 h-full overflow-y-auto fixed top-0 right-0 rounded-l-2xl shadow-lg"},gs={key:0,class:"temporary p-8 text-center"},vs=a("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1),_s=[vs],ys={key:1,class:""},ws={class:"header flex"},bs={key:0,class:"full flex items-center gap-4"},xs={class:"flex-none"},ks={class:"flex-grow"},$s={class:"font-bold"},Cs=["title"],Ls={key:0,class:"full flex items-center gap-4"},Ss={key:0,class:"flex-none profile-box rounded-lg p-2 text-center uppercase font-bold"},Ts={class:"flex-grow"},js={class:"font-bold"},Ds=["title"],qs={key:0,class:"flex-none profile-box rounded-lg p-2 text-center uppercase font-bold"},Es={key:0,class:"profile p-5 flex flex-col gap-5"},Ms={key:0,class:"notifications"},As={class:"flex w-full py-2"},Is={class:"flex-grow uppercase font-bold"},Ps={class:"flex-grow text-right"},Qs=["href"],Fs={class:"flex flex-col gap-2"},Hs={key:0,class:"no-notifications help-block text-neutral-content italic"},zs={key:1,class:"releases"},Bs={class:"flex w-full py-2"},Ns={class:"flex-grow uppercase font-bold"},Rs={class:"flex flex-col gap-2"},Os={key:2,class:"marketplace"},Ks={class:"flex w-full py-2"},Us={class:"flex-grow uppercase font-bold"},Vs={class:"flex-grow text-right"},Ws=["href"],Js={class:"grid grid-cols-3 gap-2"},Gs=["href"],Zs=a("div",{class:"icon bg-base-200 rounded-full w-14 h-14 text-3xl aspect-square flex justify-center items-center"},[a("i",{class:"fa-solid fa-palette","aria-hidden":"true"})],-1),Ys={class:"text-muted text-xs"},Xs=["href"],ea=a("div",{class:"icon bg-base-200 rounded-full w-14 h-14 text-3xl aspect-square flex justify-center items-center"},[a("i",{class:"fa-solid fa-columns","aria-hidden":"true"})],-1),ta={class:"text-muted text-xs"},na=["href"],ia=a("div",{class:"icon bg-base-200 rounded-full w-14 h-14 text-3xl aspect-square flex justify-center items-center"},[a("i",{class:"fa-solid fa-dice-d20","aria-hidden":"true"})],-1),sa={class:"text-muted text-xs"},aa={key:3,class:"subscription"},oa={class:"uppercase font-bold py-2"},ra=["href"],la={class:"flex-none p-2"},ca=["src","alt"],da={class:"flex-grow p-2"},ua={class:"font-bold text-lg"},fa={key:0,class:"more"},ha=a("br",null,null,-1),ma={key:1,class:"more"},pa={class:"link flex gap-1 items-center"},ga=a("i",{class:"fa-duotone fa-credit-card","aria-hidden":"true"},null,-1),va=a("i",{class:"fa-brands fa-paypal","aria-hidden":"true"},null,-1),_a={key:4,class:"m-0 p-0 list-none flex flex-col gap-2"},ya=["href"],wa=a("i",{class:"fa-solid fa-cog mr-3","aria-hidden":"true"},null,-1),ba=["href"],xa=a("i",{class:"fa-solid fa-user mr-3","aria-hidden":"true"},null,-1),ka=["href"],$a=a("i",{class:"fa-solid fa-question-circle mr-3","aria-hidden":"true"},null,-1),Ca=a("i",{class:"fa-solid fa-sign-out mr-3","aria-hidden":"true"},null,-1),La={key:5,class:"m-0 p-0 list-none flex flex-col gap-2"},Sa=["href"],Ta=a("i",{class:"fa-solid fa-sign-out-alt mr-3","aria-hidden":"true"},null,-1),ja={key:1,class:"campaigns p-5"},Da={key:0,class:"campaigns flex flex-col gap-5"},qa={class:"flex flex-col gap-2"},Ea={class:"flex w-full"},Ma={class:"flex-grow uppercase font-bold"},Aa={key:0,class:"flex-grow text-right"},Ia=["href"],Pa={class:"grid grid-cols-2 md:grid-cols-3 gap-5"},Qa=["href"],Fa={class:"text-xs text-break uppercase"},Ha=a("i",{class:"fa-solid fa-plus","aria-hidden":"true",style:{display:"none"}},null,-1),za={key:0},Ba={class:"flex flex-col gap-2"},Na={key:0,class:"uppercase"},Ra={key:1,class:"grid grid-cols-2 md:grid-cols-3 gap-5 following"},Oa=["href"],Ka={class:"text-xs uppercase text-break"};function Ua(e,t,n,s,i,o){const c=T("GridSvg"),d=T("Notification"),m=T("Release"),f=T("Campaign"),_=Me("click-outside");return r(),l(v,null,[a("div",ds,[a("div",{class:"campaigns inline cursor-pointer text-center px-3 text-2xl hover:text-primary-focus",onClick:t[0]||(t[0]=p=>o.openCampaigns()),"aria-label":"Switch campaigns",tabindex:"0",role:"button"},[H(c,{size:7}),us]),a("div",{class:"profile inline cursor-pointer text-center uppercase pt-1",onClick:t[1]||(t[1]=p=>o.openProfile()),"aria-label":"Profile settings",tabindex:"0",role:"button"},[a("div",fs,[i.show_alerts?(r(),l("span",hs)):h("",!0),o.showInitials()?(r(),l("div",ms,u(n.initials),1)):(r(),l("div",{key:2,class:"w-9 h-9 rounded-lg cover-background",style:E({backgroundImage:o.profilePictureUrl()})},null,4))])])]),i.is_expanded?ee((r(),l("div",ps,[i.is_loading?(r(),l("div",gs,_s)):(r(),l("div",ys,[a("div",ws,[a("div",{class:g(o.blockClass(i.view_campaigns)),onClick:t[2]||(t[2]=p=>o.openCampaigns()),tabindex:"0",role:"button","aria-label":"Campaign list"},[i.view_campaigns?(r(),l("div",bs,[a("div",xs,[H(c,{size:6})]),a("div",ks,[a("div",$s,u(i.campaigns.texts.campaigns),1),a("div",null,u(i.campaigns.texts.count),1)])])):(r(),l("div",{key:1,class:"flex items-center justify-center h-full",title:i.campaigns.texts.campaigns},[H(c,{size:6})],8,Cs))],2),a("div",{class:g(o.blockClass(i.view_profile)),onClick:t[3]||(t[3]=p=>o.openProfile()),tabindex:"0",role:"button","aria-label":"Profile pane"},[i.view_profile?(r(),l("div",Ls,[o.showInitials()?(r(),l("div",Ss,u(n.initials),1)):(r(),l("div",{key:1,class:"flex-none w-9 h-9 rounded-lg cover-background",style:E({backgroundImage:o.profilePictureUrl()})},null,4)),a("div",Ts,[a("div",js,u(i.profile.name),1),a("div",null,u(i.profile.created),1)])])):(r(),l("div",{key:1,class:"",title:i.profile.your_profile},[o.showInitials()?(r(),l("div",qs,u(n.initials),1)):(r(),l("div",{key:1,class:"flex-none w-9 h-9 rounded-lg cover-background",style:E({backgroundImage:o.profilePictureUrl()})},null,4))],8,Ds))],2)]),i.view_profile?(r(),l("div",Es,[i.notifications.title?(r(),l("div",Ms,[a("div",As,[a("div",Is,u(i.notifications.title),1),a("div",Ps,[a("a",{href:i.notifications.all.url},u(i.notifications.all.text),9,Qs)])]),a("div",Fs,[(r(!0),l(v,null,w(i.notifications.messages,p=>(r(),S(d,{notification:p},null,8,["notification"]))),256))]),i.notifications.messages.length===0?(r(),l("div",Hs,u(i.notifications.none),1)):h("",!0)])):h("",!0),i.releases.title&&i.releases.releases.length>0?(r(),l("div",zs,[a("div",Bs,[a("div",Ns,u(i.releases.title),1)]),a("div",Rs,[(r(!0),l(v,null,w(i.releases.releases,p=>(r(),S(m,{release:p},null,8,["release"]))),256))])])):h("",!0),!i.profile.is_impersonating&&i.marketplace.title?(r(),l("div",Os,[a("div",Ks,[a("div",Us,u(i.marketplace.title),1),a("div",Vs,[a("a",{href:i.marketplace.explore.url,target:"_blank"},u(i.marketplace.explore.text),9,Ws)])]),a("div",Js,[a("a",{href:i.marketplace.themes.url,class:"border py-2 items-center justify-center rounded-md hover:shadow-md flex flex-col gap-1",target:"_blank"},[Zs,a("div",null,u(i.marketplace.themes.title),1),a("div",Ys,u(i.marketplace.themes.number),1)],8,Gs),a("a",{href:i.marketplace.sheets.url,class:"border py-2 items-center justify-center rounded-md hover:shadow-md flex flex-col gap-1",target:"_blank"},[ea,a("div",null,u(i.marketplace.sheets.title),1),a("div",ta,u(i.marketplace.sheets.number),1)],8,Xs),a("a",{href:i.marketplace.content.url,class:"border py-2 items-center justify-center rounded-md hover:shadow-md flex flex-col gap-1",target:"_blank"},[ia,a("div",null,u(i.marketplace.content.title),1),a("div",sa,u(i.marketplace.content.number),1)],8,na)])])):h("",!0),!i.profile.is_impersonating&&i.profile.subscription?(r(),l("div",aa,[a("div",oa,u(i.profile.subscription.title),1),a("a",{class:"border rounded-lg flex justify-center items-center hover:shadow-md",href:i.profile.urls.subscription},[a("div",la,[a("img",{class:"w-16 h-16",src:i.profile.subscription.image,alt:i.profile.subscription.tier},null,8,ca)]),a("div",da,[a("div",ua,u(i.profile.subscription.tier),1),i.profile.subscription.tier!=="Kobold"?(r(),l("div",fa,[b(u(i.profile.subscription.created),1),ha,b(" "+u(i.profile.subscription.boosters),1)])):(r(),l("div",ma,[b(u(i.profile.subscription.call_to_action)+" ",1),a("div",pa,[b(u(i.profile.subscription.call_to_action_2)+" ",1),ga,va])]))])],8,ra)])):h("",!0),i.profile.is_impersonating?(r(),l("ul",La,[a("li",null,[a("a",{href:i.profile.return.url,class:""},[Ta,b(" "+u(i.profile.return.name),1)],8,Sa)])])):(r(),l("ul",_a,[a("li",null,[a("a",{href:i.profile.urls.settings.url,class:"p-2 block"},[wa,b(" "+u(i.profile.urls.settings.name),1)],8,ya)]),a("li",null,[a("a",{href:i.profile.urls.profile.url,class:"p-2 block"},[xa,b(" "+u(i.profile.urls.profile.name),1)],8,ba)]),a("li",null,[a("a",{href:i.profile.urls.help.url,class:"p-2 block",target:"_blank"},[$a,b(" "+u(i.profile.urls.help.name),1)],8,ka)]),a("li",null,[a("a",{href:"#",onClick:t[4]||(t[4]=p=>o.logout()),class:"p-2 block"},[Ca,b(" "+u(i.profile.urls.logout.name),1)])])]))])):(r(),l("div",ja,[i.profile.is_impersonating?h("",!0):(r(),l("div",Da,[a("div",qa,[a("div",Ea,[a("div",Ma,u(i.campaigns.texts.campaigns),1),i.campaigns.member.length>0?(r(),l("div",Aa,[a("a",{href:i.campaigns.urls.reorder},u(i.campaigns.texts.reorder),9,Ia)])):h("",!0)]),a("div",Pa,[(r(!0),l(v,null,w(i.campaigns.member,p=>(r(),S(f,{campaign:p},null,8,["campaign"]))),256)),a("a",{href:i.campaigns.urls.new,class:"new-campaign flex items-center text-center border-dashed border rounded-lg h-24 p-2 overflow-hidden"},[a("span",Fa,[Ha,b(" "+u(i.campaigns.texts.new),1)])],8,Qa)])]),i.profile.is_impersonating?h("",!0):(r(),l("hr",za)),a("div",Ba,[i.profile.is_impersonating?h("",!0):(r(),l("p",Na,u(i.campaigns.texts.followed),1)),i.profile.is_impersonating?h("",!0):(r(),l("div",Ra,[(r(!0),l(v,null,w(i.campaigns.following,p=>(r(),S(f,{campaign:p},null,8,["campaign"]))),256)),a("a",{href:i.campaigns.urls.follow,class:"new-campaign flex items-center text-center border-dashed border rounded-lg h-24 p-2 overflow-hidden"},[a("span",Ka,u(i.campaigns.texts.follow),1)],8,Oa)]))])]))]))]))])),[[_,o.onClickOutside]]):h("",!0)],64)}const Va=L(cs,[["render",Ua]]),Wa=rt(),Q=ot({});Q.config.globalProperties.emitter=Wa;Q.component("nav-toggler",an);Q.component("nav-search",wi);Q.component("nav-switcher",Va);Q.mount("#header");const Z=Array(),Xe=()=>{document.querySelectorAll('[data-toggle="tooltip-ajax"]').forEach(t=>{t.dataset.loaded!=="1"&&(t.dataset.loaded="1",U(t,{theme:"kanka",placement:t.dataset.direction??"bottom",allowHTML:!0,interactive:!0,delay:500,appendTo:t.dataset.append??document.body,content:'