diff --git a/app/Http/Controllers/Campaign/SubmissionController.php b/app/Http/Controllers/Campaign/SubmissionController.php index 67e817b7a..0a401f6c4 100644 --- a/app/Http/Controllers/Campaign/SubmissionController.php +++ b/app/Http/Controllers/Campaign/SubmissionController.php @@ -35,6 +35,23 @@ public function index(Campaign $campaign) ->with('campaign', $campaign); } + public function show(Campaign $campaign, CampaignSubmission $campaignSubmission) + { + $this->authorize('submissions', $campaign); + + if (!$campaign->canHaveMoreMembers()) { + return view('cruds.forms.limit') + ->with('campaign', $campaign) + ->with('key', 'members') + ->with('name', 'campaign_roles'); + } + + return view('campaigns.submissions.show') + ->with('application', $campaignSubmission) + ->with('campaign', $campaign) + ; + } + public function edit(Campaign $campaign, CampaignSubmission $campaignSubmission) { $this->authorize('submissions', $campaign); @@ -74,7 +91,7 @@ public function update(PatchCampaignApplication $request, Campaign $campaign, Ca $note = $this->service ->campaign($campaign) ->submission($campaignSubmission) - ->process($request->only('role_id', 'rejection', 'action', 'message')); + ->process($request->only('role_id', 'rejection', 'action', 'reason')); return redirect()->route('campaign_submissions.index', $campaign) ->with('success', __('campaigns/submissions.update.' . $note)); diff --git a/app/Http/Requests/Campaigns/PatchCampaignApplication.php b/app/Http/Requests/Campaigns/PatchCampaignApplication.php index 5796f412a..b8bba6f98 100644 --- a/app/Http/Requests/Campaigns/PatchCampaignApplication.php +++ b/app/Http/Requests/Campaigns/PatchCampaignApplication.php @@ -25,8 +25,7 @@ public function rules() { $rules = [ 'role_id' => 'required_if:action,approve:rejection|exists:campaign_roles,id', - 'rejection' => 'nullable|string|max:191', - 'message' => 'nullable|string|max:191', + 'reason' => 'nullable|string|max:191', 'action' => 'required', ]; return $rules; diff --git a/app/Services/Campaign/SubmissionService.php b/app/Services/Campaign/SubmissionService.php index 4ef2c9e4b..5c5deae42 100644 --- a/app/Services/Campaign/SubmissionService.php +++ b/app/Services/Campaign/SubmissionService.php @@ -63,7 +63,7 @@ public function process(array $data): string $return = 'rejected'; // Notify the user - $rejection = $this->purify(Arr::get($data, 'rejection')); + $rejection = $this->purify(Arr::get($data, 'reason')); if ($rejection == '') { $key = 'campaign.application.rejected_no_message'; } else { @@ -78,7 +78,7 @@ public function process(array $data): string ]) ); } else { - $this->approve((int) Arr::get($data, 'role_id'), $this->purify(Arr::get($data, 'message'))); + $this->approve((int) Arr::get($data, 'role_id'), $this->purify(Arr::get($data, 'reason'))); } $this->submission->delete(); diff --git a/lang/en/campaigns/submissions.php b/lang/en/campaigns/submissions.php index 675088553..56b955cc7 100644 --- a/lang/en/campaigns/submissions.php +++ b/lang/en/campaigns/submissions.php @@ -3,9 +3,7 @@ return [ 'actions' => [ 'accept' => 'Accept', - 'applications' => 'Applications: :status', - 'change' => 'Change', - 'reject' => 'Reject', + 'reject' => 'Deny', ], 'apply' => [ 'apply' => 'Apply', @@ -18,31 +16,24 @@ ], 'title' => 'Join :name', ], - 'errors' => [ - 'not_open' => 'The campaign isn\'t open to new members. Edit the campaign\'s settings if you want to allow users applying to it.', - ], 'fields' => [ 'application' => 'Application', - 'approval' => 'Approval reason', - 'rejection' => 'Rejection reason', + 'reason' => 'Approval / Rejection reason', ], 'helpers' => [ - 'filter-helper' => 'This campaign is open to applications!', 'modal' => 'A campaign which is open to applications and public can have users apply to join the campaign.', + 'no_applications_title' => 'No applications found', 'no_applications' => 'There are currently no pending applications to join the campaign. Users can apply to join the campaign by visiting it\'s dashboard and clicking on the :button button.', - 'not_open' => 'The campaign isn\'t currently accepting applications.', - 'open_not_public' => 'The campaign is open to applications, but not public, meaning no one can apply to join it. This can be changed by editing the campaign\'s settings.', + 'reason' => 'If provided, the applicant will be notified with this reason.', + 'role' => 'If approving, the role the applicant gets added to.', ], 'placeholders' => [ 'note' => 'Write down your application to join the campaign', - ], - 'statuses' => [ - 'closed' => 'Closed', - 'open' => 'Open', + 'reason' => 'Your reason', ], 'toggle' => [ - 'closed' => 'Closed to applications', 'label' => 'Status', + 'closed' => 'Closed to applications', 'open' => 'Open to applications', 'success' => 'Campaign application status updated.', 'title' => 'Application status', @@ -53,4 +44,14 @@ 'reject' => 'Write an optional message to the user as to why you are rejecting their application.', 'rejected' => 'Application rejected', ], + 'open' => [ + 'title' => 'Open campaign', + 'open' => 'Campaign is open', + 'closed' => 'Campaign is closed', + ], + 'public' => [ + 'title' => 'Public campaign', + 'public' => 'Campaign is public', + 'private' => 'Campaign is private', + ], ]; diff --git a/public/build/assets/abilities-1bbcfe51.js b/public/build/assets/abilities-1bbcfe51.js new file mode 100644 index 000000000..6ee328c2f --- /dev/null +++ b/public/build/assets/abilities-1bbcfe51.js @@ -0,0 +1 @@ +import{d as f,r as h,b as i,c as s,a as t,n as _,e as n,F as y,f as m,h as T,i as v,o as L,x as M,q as H}from"./vue.esm-bundler-51152e6d.js";const w=["data-tags"],x={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"},$={key:0,class:""},C=["href"],A={class:"flex flex-col gap-4 w-full"},B={class:"flex gap-2 md:gap-4 items-center w-full"},I={class:"flex gap-2 items-center text-xl grow"},N=["href","innerHTML"],j=["title"],z=["title"],D=["title"],F=["title"],V=["title"],q=["innerHTML"],E={key:1,class:""},P=["title"],S=["innerHTML"],U={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"},W={class:"flex gap-1 flex-wrap grow"},X=["onClick"],Y=["innerHTML"],Z={class:"flex-none"},ee=["innerHTML"],ie=["innerHTML"],se=f({__name:"Ability",props:{ability:{},permission:{}},setup(g){h(!1);const a=g,r=()=>a.permission.value,c=()=>a.ability.images.thumb?{backgroundImage:"url("+a.ability.images.thumb+")"}:{},p=e=>{window.openDialog("abilities-dialog",e.actions.edit)},l=()=>a.ability.charges-a.ability.used_charges,b=()=>a.ability.i18n.left.replace(/:amount/,""),o=(e,d)=>{d>e.used_charges?e.used_charges+=1:e.used_charges-=1,axios.post(e.actions.use,{used:e.used_charges}).then(u=>{u.data.success||(e.used_charges-=1)}).catch(()=>{e.used_charges-=1})};return(e,d)=>(i(),s("div",{class:"ability","data-tags":e.ability.class},[t("div",x,[e.ability.images.has?(i(),s("div",$,[t("a",{class:"ability-image rounded-xl block w-40 h-40 cover-background",href:e.ability.images.url,style:_(c())},null,12,C)])):n("",!0),t("div",A,[t("div",B,[t("div",I,[t("a",{href:e.ability.actions.view,class:"ability-name text-2xl",innerHTML:e.ability.name},null,8,N),e.ability.visibility_id===2?(i(),s("i",{key:0,class:"fa-solid fa-lock",title:e.ability.visibility},null,8,j)):n("",!0),e.ability.visibility_id===3?(i(),s("i",{key:1,class:"fa-solid fa-user-lock",title:e.ability.visibility},null,8,z)):n("",!0),e.ability.visibility_id===5?(i(),s("i",{key:2,class:"fa-solid fa-users",title:e.ability.visibility},null,8,D)):n("",!0),e.ability.visibility_id===4?(i(),s("i",{key:3,class:"fa-solid fa-user-secret",title:e.ability.visibility},null,8,F)):n("",!0),e.ability.visibility_id===1?(i(),s("i",{key:4,class:"fa-solid fa-eye",title:e.ability.visibility},null,8,V)):n("",!0)]),e.ability.type?(i(),s("div",{key:0,class:"hidden md:inline bg-base-200 p-2 rounded-xl flex-none",innerHTML:e.ability.type},null,8,q)):n("",!0),e.permission?(i(),s("div",E,[r?(i(),s("a",{key:0,role:"button",onClick:d[0]||(d[0]=u=>p(e.ability)),class:"btn2 btn-ghost btn-sm",title:e.ability.i18n.edit},[d[1]||(d[1]=t("i",{class:"fa-solid fa-pencil text-xl","aria-hidden":"true"},null,-1)),t("span",{class:"sr-only",innerHTML:e.ability.i18n.edit},null,8,S)],8,P)):n("",!0)])):n("",!0)]),e.ability.type?(i(),s("div",U,[t("div",{class:"inline-block bg-base-200 p-2 rounded-xl",innerHTML:e.ability.type},null,8,G)])):n("",!0),e.ability.entry?(i(),s("div",{key:1,class:"entity-content",innerHTML:e.ability.entry},null,8,J)):n("",!0),e.ability.tags?(i(),s("div",K,[(i(!0),s(y,null,m(e.ability.tags,u=>(i(),s("a",{class:"rounded-lg bg-base-200 text-xs py-1 px-2 text-base-content",href:u.url,innerHTML:u.name},null,8,O))),256))])):n("",!0),e.ability.note?(i(),s("div",{key:3,class:"entity-content",innerHTML:e.ability.note},null,8,Q)):n("",!0),e.ability.charges&&e.permission?(i(),s("div",R,[t("div",W,[(i(!0),s(y,null,m(e.ability.charges,u=>(i(),s("div",{class:T(["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>=u}]),onClick:_e=>o(e.ability,u)},[t("span",{innerHTML:u},null,8,Y)],10,X))),256))]),t("div",Z,[t("span",{class:"text-2xl",innerHTML:l()},null,8,ee),t("span",{innerHTML:b()},null,8,ie)])])):n("",!0)])])],8,w))}}),te={class:"ability-parent flex flex-col gap-5 w-full"},ne={class:"parent-head flex gap-2 md:gap-5 items-center"},le={class:"flex flex-col gap-1 grow overflow-hidden"},ae={key:0},oe=["href","innerHTML"],re=["innerHTML"],de=["innerHTML"],ue={class:"flex-none self-end"},ce={key:0,"aria-hidden":"true",class:"fa-thin fa-chevron-circle-up fa-2x"},pe={key:1,"aria-hidden":"true",class:"fa-thin fa-chevron-circle-down fa-2x"},be={key:0,class:"parent-abilities flex flex-col gap-5"},he=f({__name:"Parent",props:{group:{},permission:{},meta:{}},setup(g){const a=g,r=h(!1),c=()=>a.group.has_image?{backgroundImage:"url("+a.group.image+")"}:{},p=l=>{r.value=!r.value};return(l,b)=>(i(),s("div",te,[t("div",ne,[l.group.has_image?(i(),s("div",{key:0,class:"parent-image rounded-full w-12 h-12 md:w-16 md:h-16 cover-background flex-none",style:_(c())},null,4)):n("",!0),t("div",le,[l.group.url?(i(),s("div",ae,[t("a",{href:l.group.url,innerHTML:l.group.name,class:"parent-name text-xl md:text-2xl"},null,8,oe)])):(i(),s("span",{key:1,class:"parent-name text-xl md:text-2xl",innerHTML:l.group.name},null,8,re)),t("p",{class:"md:text-lg truncate",innerHTML:l.group.type},null,8,de)]),t("div",ue,[t("span",{role:"button",onClick:b[0]||(b[0]=o=>p(l.group)),class:"cursor-pointer inline-block"},[r.value?(i(),s("i",pe)):(i(),s("i",ce))])])]),r.value?n("",!0):(i(),s("div",be,[(i(!0),s(y,null,m(l.group.abilities,o=>(i(),v(se,{key:o.id,ability:o,permission:l.permission,meta:l.meta},null,8,["ability","permission","meta"]))),128))]))]))}}),ge={class:"viewport box-abilities relative flex flex-col gap-5"},ye={key:0,class:"load more text-center text-2xl"},me={class:"flex gap-5 flex-wrap"},fe=f({__name:"Abilities",props:{id:{},api:{},permission:{}},setup(g){const a=g,r=h([]),c=h([]),p=h(!0),l=h(!0),b=()=>{axios.get(a.api).then(o=>{r.value=o.data.data.groups,c.value=o.data.data.meta,p.value=!1,l.value=!1})};return L(()=>{b()}),M(()=>{window.ajaxTooltip()}),(o,e)=>(i(),s("div",ge,[p.value?(i(),s("div",ye,e[0]||(e[0]=[t("i",{class:"fa-solid fa-spin fa-spinner","aria-hidden":"true"},null,-1)]))):n("",!0),t("div",me,[(i(!0),s(y,null,m(r.value,d=>(i(),v(he,{key:d.id,group:d,permission:o.permission,meta:c.value},null,8,["group","permission","meta"]))),128))])]))}}),k=H({});k.component("abilities",fe);k.mount("#abilities"); diff --git a/public/build/assets/abilities-f7438e43.js b/public/build/assets/abilities-f7438e43.js deleted file mode 100644 index 3d8a20685..000000000 --- a/public/build/assets/abilities-f7438e43.js +++ /dev/null @@ -1 +0,0 @@ -import{b as t,c as i,a as n,n as m,e as a,F as u,r as _,g as x,h as b,i as f,q as v}from"./vue.esm-bundler-35c332fe.js";import{_ as h}from"./_plugin-vue_export-helper-c27b6911.js";const k={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(s){window.openDialog("abilities-dialog",s.actions.edit)},remainingNumber:function(){return this.ability.charges-this.ability.used_charges},remainingText:function(){return this.ability.i18n.left.replace(/:amount/,"")},useCharge:function(s,l){l>s.used_charges?s.used_charges+=1:s.used_charges-=1,axios.post(s.actions.use,{used:s.used_charges}).then(e=>{e.data.success||(s.used_charges-=1)}).catch(()=>{s.used_charges-=1})}}},p=["data-tags"],T={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"},L={key:0,class:""},H=["href"],M={class:"flex flex-col gap-4 w-full"},w={class:"flex gap-2 md:gap-4 items-center w-full"},C={class:"flex gap-2 items-center text-xl grow"},A=["href","innerHTML"],I=["title"],B=["title"],N=["title"],j=["title"],D=["title"],z=["innerHTML"],F={key:1,class:""},V=["title"],q=["innerHTML"],E={key:0,class:"visible md:hidden"},P=["innerHTML"],S=["innerHTML"],G={key:2,class:"flex gap-2 items-center"},J=["href","innerHTML"],K=["innerHTML"],O={key:4,class:"flex gap-2 md:gap-4 ability-charges w-full items-end"},Q={class:"flex gap-1 flex-wrap grow"},R=["onClick"],U=["innerHTML"],W={class:"flex-none"},X=["innerHTML"],Y=["innerHTML"];function Z(s,l,e,g,d,r){return t(),i("div",{class:"ability","data-tags":e.ability.class},[n("div",T,[e.ability.images.has?(t(),i("div",L,[n("a",{class:"ability-image rounded-xl block w-40 h-40 cover-background",href:e.ability.images.url,style:m(r.backgroundImage)},null,12,H)])):a("",!0),n("div",M,[n("div",w,[n("div",C,[n("a",{href:e.ability.actions.view,class:"ability-name text-2xl",innerHTML:e.ability.name},null,8,A),e.ability.visibility_id===2?(t(),i("i",{key:0,class:"fa-solid fa-lock",title:e.ability.visibility},null,8,I)):a("",!0),e.ability.visibility_id===3?(t(),i("i",{key:1,class:"fa-solid fa-user-lock",title:e.ability.visibility},null,8,B)):a("",!0),e.ability.visibility_id===5?(t(),i("i",{key:2,class:"fa-solid fa-users",title:e.ability.visibility},null,8,N)):a("",!0),e.ability.visibility_id===4?(t(),i("i",{key:3,class:"fa-solid fa-user-secret",title:e.ability.visibility},null,8,j)):a("",!0),e.ability.visibility_id===1?(t(),i("i",{key:4,class:"fa-solid fa-eye",title:e.ability.visibility},null,8,D)):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,z)):a("",!0),e.permission?(t(),i("div",F,[this.canDelete?(t(),i("a",{key:0,role:"button",onClick:l[0]||(l[0]=o=>r.updateAbility(e.ability)),class:"btn2 btn-ghost btn-sm",title:e.ability.i18n.edit},[l[1]||(l[1]=n("i",{class:"fa-solid fa-pencil text-xl","aria-hidden":"true"},null,-1)),n("span",{class:"sr-only",innerHTML:e.ability.i18n.edit},null,8,q)],8,V)):a("",!0)])):a("",!0)]),e.ability.type?(t(),i("div",E,[n("div",{class:"inline-block bg-base-200 p-2 rounded-xl",innerHTML:e.ability.type},null,8,P)])):a("",!0),e.ability.entry?(t(),i("div",{key:1,class:"entity-content",innerHTML:e.ability.entry},null,8,S)):a("",!0),e.ability.tags?(t(),i("div",G,[(t(!0),i(u,null,_(e.ability.tags,o=>(t(),i("a",{class:"rounded-lg bg-base-200 text-xs py-1 px-2 text-base-content",href:o.url,innerHTML:o.name},null,8,J))),256))])):a("",!0),e.ability.note?(t(),i("div",{key:3,class:"entity-content",innerHTML:e.ability.note},null,8,K)):a("",!0),e.ability.charges&&e.permission?(t(),i("div",O,[n("div",Q,[(t(!0),i(u,null,_(e.ability.charges,o=>(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>=o}]),onClick:c=>r.useCharge(e.ability,o)},[n("span",{innerHTML:o},null,8,U)],10,R))),256))]),n("div",W,[n("span",{class:"text-2xl",innerHTML:r.remainingNumber()},null,8,X),n("span",{innerHTML:r.remainingText()},null,8,Y)])])):a("",!0)])])],8,p)}const $=h(k,[["render",Z]]),ee={components:{Ability:$},props:["group","permission","meta"],data(){return{collapsed:!1}},computed:{backgroundImage:function(){return this.group.has_image?{backgroundImage:"url("+this.group.image+")"}:{}}},methods:{click:function(s){this.collapsed=!this.collapsed}}},te={class:"ability-parent flex flex-col gap-5 w-full"},ie={class:"parent-head flex gap-2 md:gap-5 items-center"},ne={class:"flex flex-col gap-1 grow overflow-hidden"},se={key:0},ae=["href","innerHTML"],le=["innerHTML"],oe=["innerHTML"],re={class:"flex-none self-end"},ce={key:0,"aria-hidden":"true",class:"fa-thin fa-chevron-circle-up fa-2x"},de={key:1,"aria-hidden":"true",class:"fa-thin fa-chevron-circle-down fa-2x"},ue={key:0,class:"parent-abilities flex flex-col gap-5"};function _e(s,l,e,g,d,r){const o=b("ability");return t(),i("div",te,[n("div",ie,[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:m(r.backgroundImage)},null,4)):a("",!0),n("div",ne,[e.group.url?(t(),i("div",se,[n("a",{href:e.group.url,innerHTML:e.group.name,class:"parent-name text-xl md:text-2xl"},null,8,ae)])):(t(),i("span",{key:1,class:"parent-name text-xl md:text-2xl",innerHTML:e.group.name},null,8,le)),n("p",{class:"md:text-lg truncate",innerHTML:e.group.type},null,8,oe)]),n("div",re,[n("span",{role:"button",onClick:l[0]||(l[0]=c=>r.click(e.group)),class:"cursor-pointer inline-block"},[this.collapsed?(t(),i("i",de)):(t(),i("i",ce))])])]),this.collapsed?a("",!0):(t(),i("div",ue,[(t(!0),i(u,null,_(e.group.abilities,c=>(t(),f(o,{key:c.id,ability:c,permission:e.permission,meta:e.meta},null,8,["ability","permission","meta"]))),128))]))])}const he=h(ee,[["render",_e]]),ge={props:["id","api","permission"],components:{Parent:he},data(){return{groups:[],meta:[],loading:!0,waiting:!1}},methods:{getAbilities:function(){fetch(this.api).then(s=>s.json()).then(s=>{this.groups=s.data.groups,this.meta=s.data.meta,this.loading=!1,this.waiting=!1})}},mounted(){this.getAbilities()},updated(){window.ajaxTooltip()}},me={class:"viewport box-abilities relative flex flex-col gap-5"},be={key:0,class:"load more text-center text-2xl"},fe={class:"flex gap-5 flex-wrap"};function ye(s,l,e,g,d,r){const o=b("parent");return t(),i("div",me,[d.loading?(t(),i("div",be,l[0]||(l[0]=[n("i",{class:"fa-solid fa-spin fa-spinner","aria-hidden":"true"},null,-1)]))):a("",!0),n("div",fe,[(t(!0),i(u,null,_(d.groups,c=>(t(),f(o,{key:c.id,group:c,permission:e.permission,meta:d.meta},null,8,["group","permission","meta"]))),128))])])}const xe=h(ge,[["render",ye]]),y=v({});y.component("abilities",xe);y.mount("#abilities"); diff --git a/public/build/assets/api-fe8075db.js b/public/build/assets/api-953e743d.js similarity index 98% rename from public/build/assets/api-fe8075db.js rename to public/build/assets/api-953e743d.js index 776d4df0a..b441f22b0 100644 --- a/public/build/assets/api-fe8075db.js +++ b/public/build/assets/api-953e743d.js @@ -1 +1 @@ -import{c as r,a as t,e as u,F as c,r as m,f as k,w as y,j as h,v as b,k as g,b as i,t as a,q as v}from"./vue.esm-bundler-35c332fe.js";import{_ as x}from"./_plugin-vue_export-helper-c27b6911.js";const w={data(){return{clients:[],confirmClient:null,createForm:{errors:[],name:"",redirect:""},editForm:{errors:[],name:"",redirect:""}}},ready(){this.prepareComponent()},mounted(){this.prepareComponent()},methods:{prepareComponent(){this.getClients()},getClients(){axios.get("/oauth/clients").then(l=>{this.clients=l.data})},showCreateClientForm(){this.openModal("createModal"),this.$refs.createName.focus()},store(){this.persistClient("post","/oauth/clients",this.createForm,"createModal")},edit(l){this.editForm.id=l.id,this.editForm.name=l.name,this.editForm.redirect=l.redirect,this.openModal("editModal"),this.$refs.editName.focus()},update(){this.persistClient("put","/oauth/clients/"+this.editForm.id,this.editForm,"editModal")},persistClient(l,e,d,p){d.errors=[],axios[l](e,d).then(n=>{this.getClients(),d.name="",d.redirect="",d.errors=[],this.closeModal(p)}).catch(n=>{typeof n.response.data=="object"?d.errors=_.flatten(_.toArray(n.response.data.errors)):d.errors=["Something went wrong. Please try again."]})},destroy(l){axios.delete("/oauth/clients/"+l.id).then(e=>{this.getClients(),window.showToast("OAuth client deleted succesfully.")})},openModal(l){this.$refs[l].showModal(),this.$refs[l].addEventListener("click",function(e){let d=this.getBoundingClientRect();!(d.top<=e.clientY&&e.clientY<=d.top+d.height&&d.left<=e.clientX&&e.clientX<=d.left+d.width)&&e.target.tagName==="DIALOG"&&this.close()})},closeModal(l){this.$refs[l].close()},deleteConfirm(l){if(this.confirmClient&&l.id===this.confirmClient.id)return this.destroy(l);this.confirmClient=l}}},M={class:"card card-default"},T={class:"card-header"},F={class:"flex justify-between items-center"},A={class:"card-body"},N={key:0,class:"mb-0"},S={key:1,class:"table table-borderless mb-0"},I={style:{"vertical-align":"middle"}},j={style:{"vertical-align":"middle"}},D={style:{"vertical-align":"middle"}},L={style:{"vertical-align":"middle"}},R=["onClick"],U={class:"text-right",style:{"vertical-align":"middle"}},Y=["onClick"],z=["onClick"],V={class:"dialog rounded-2xl text-center",id:"modal-create-client",ref:"createModal","aria-modal":"true","aria-labelledby":"modal-create-client-label"},P={class:"text-justify"},O={key:0,class:"rounded p-4 bg-red-100 text-red-800 w-full"},q={class:"mb-5"},B={class:"mb-5"},K={class:"grid grid-cols-2 gap-2 w-full"},E={class:"dialog rounded-2xl text-center",id:"modal-edit-client",ref:"editModal","aria-modal":"true","aria-labelledby":"modal-edit-client-label"},X={class:"text-justify"},W={key:0,class:"alert alert-danger"},G={role:"form",autocomplete:"off"},$={class:"form-group grid grid-cols-2 gap-5"},H={class:"col-md-9"},J={class:"form-group grid grid-cols-2 gap-5"},Q={class:"col-md-9"},Z={class:"grid grid-cols-2 gap-2 w-full"};function ee(l,e,d,p,n,o){return i(),r("div",null,[t("div",M,[t("div",T,[t("div",F,[e[17]||(e[17]=t("span",{class:"text-lg"}," OAuth Clients ",-1)),t("a",{class:"btn2 btn-primary btn-outline btn-sm",tabindex:"-1",onClick:e[0]||(e[0]=(...s)=>o.showCreateClientForm&&o.showCreateClientForm(...s))}," Create New Client ")])]),t("div",A,[n.clients.length===0?(i(),r("p",N," You have not created any OAuth clients. ")):u("",!0),n.clients.length>0?(i(),r("table",S,[e[18]||(e[18]=t("thead",null,[t("tr",null,[t("th",null,"Client ID"),t("th",null,"Name"),t("th",null,"Secret"),t("th"),t("th")])],-1)),t("tbody",null,[(i(!0),r(c,null,m(n.clients,s=>(i(),r("tr",null,[t("td",I,a(s.id),1),t("td",j,a(s.name),1),t("td",D,[t("code",null,a(s.secret),1)]),t("td",L,[t("a",{class:"cursor-pointer",tabindex:"-1",onClick:f=>o.edit(s)}," Edit ",8,R)]),t("td",U,[!this.confirmClient||this.confirmClient.id!=s.id?(i(),r("a",{key:0,class:"btn2 btn-error btn-outline btn-xs",onClick:f=>o.deleteConfirm(s)}," Delete ",8,Y)):(i(),r("a",{key:1,class:"btn2 btn-error btn-xs",onClick:f=>o.deleteConfirm(s)}," Confirm delete ",8,z))])]))),256))])])):u("",!0)])]),t("dialog",V,[t("header",null,[e[20]||(e[20]=t("h4",{id:"modal-create-client-label"}," Create Client ",-1)),t("button",{type:"button",class:"rounded-full",onClick:e[1]||(e[1]=s=>o.closeModal("createModal")),title:"Close"},e[19]||(e[19]=[t("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),t("span",{class:"sr-only"},"Close",-1)]))]),t("article",P,[n.createForm.errors.length>0?(i(),r("div",O,[e[21]||(e[21]=t("p",{class:"mb-0"},[t("strong",null,"Whoops!"),k(" Something went wrong!")],-1)),e[22]||(e[22]=t("br",null,null,-1)),t("ul",null,[(i(!0),r(c,null,m(n.createForm.errors,s=>(i(),r("li",null,a(s),1))),256))])])):u("",!0),t("form",{role:"form",class:"w-full",onSubmit:e[6]||(e[6]=y((...s)=>o.store&&o.store(...s),["prevent"])),autocomplete:"off"},[t("div",q,[e[23]||(e[23]=t("label",{class:"font-extrabold required"},"Client name",-1)),h(t("input",{id:"create-client-name",type:"text",class:"rounded border w-full p-2",name:"name",placeholder:"Name the token","onUpdate:modelValue":e[2]||(e[2]=s=>n.createForm.name=s),onKeyup:e[3]||(e[3]=g((...s)=>o.store&&o.store(...s),["enter"])),ref:"createName"},null,544),[[b,n.createForm.name]]),e[24]||(e[24]=t("span",{class:"text-sm text-muted"}," Something your users will recognize and trust. ",-1))]),t("div",B,[e[25]||(e[25]=t("label",{class:"font-extrabold required"},"Redirect URL",-1)),h(t("input",{type:"text",class:"rounded border w-full p-2",name:"redirect",onKeyup:e[4]||(e[4]=g((...s)=>o.store&&o.store(...s),["enter"])),"onUpdate:modelValue":e[5]||(e[5]=s=>n.createForm.redirect=s)},null,544),[[b,n.createForm.redirect]]),e[26]||(e[26]=t("span",{class:"text-sm text-muted"}," Your application's authorization callback URL. ",-1))])],32),t("form",{role:"form",class:"w-full mb-5",onSubmit:e[7]||(e[7]=y((...s)=>o.store&&o.store(...s),["prevent"])),autocomplete:"off"},null,32),t("div",K,[t("button",{type:"button",class:"btn2 btn-ghost",onClick:e[8]||(e[8]=s=>o.closeModal("createModal"))},"Close"),t("button",{type:"button",class:"btn2 btn-primary",onClick:e[9]||(e[9]=(...s)=>o.store&&o.store(...s))}," Create ")])])],512),t("dialog",E,[t("header",null,[e[28]||(e[28]=t("h4",{id:"modal-edit-client-label"}," Create Client ",-1)),t("button",{type:"button",class:"rounded-full",onClick:e[10]||(e[10]=s=>o.closeModal("editModal")),title:"Close"},e[27]||(e[27]=[t("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),t("span",{class:"sr-only"},"Close",-1)]))]),t("article",X,[n.editForm.errors.length>0?(i(),r("div",W,[e[29]||(e[29]=t("p",{class:"mb-0"},[t("strong",null,"Whoops!"),k(" Something went wrong!")],-1)),e[30]||(e[30]=t("br",null,null,-1)),t("ul",null,[(i(!0),r(c,null,m(n.editForm.errors,s=>(i(),r("li",null,a(s),1))),256))])])):u("",!0),t("form",G,[t("div",$,[e[32]||(e[32]=t("label",{class:"col-md-3 col-form-label"},"Name",-1)),t("div",H,[h(t("input",{id:"edit-client-name",type:"text",class:"w-full",onKeyup:e[11]||(e[11]=g((...s)=>o.update&&o.update(...s),["enter"])),"onUpdate:modelValue":e[12]||(e[12]=s=>n.editForm.name=s),ref:"editName"},null,544),[[b,n.editForm.name]]),e[31]||(e[31]=t("span",{class:"form-text text-muted"}," Something your users will recognize and trust. ",-1))])]),t("div",J,[e[34]||(e[34]=t("label",{class:"col-md-3 col-form-label"},"Redirect URL",-1)),t("div",Q,[h(t("input",{type:"text",class:"w-full",name:"redirect",onKeyup:e[13]||(e[13]=g((...s)=>o.update&&o.update(...s),["enter"])),"onUpdate:modelValue":e[14]||(e[14]=s=>n.editForm.redirect=s)},null,544),[[b,n.editForm.redirect]]),e[33]||(e[33]=t("span",{class:"form-text text-muted"}," Your application's authorization callback URL. ",-1))])])]),t("div",Z,[t("button",{type:"button",class:"btn2 btn-ghost",onClick:e[15]||(e[15]=s=>o.closeModal("editModal"))},"Close"),t("button",{type:"button",class:"btn2 btn-primary",onClick:e[16]||(e[16]=(...s)=>o.update&&o.update(...s))}," Create ")])])],512)])}const te=x(w,[["render",ee]]);const se={data(){return{tokens:[]}},ready(){this.prepareComponent()},mounted(){this.prepareComponent()},methods:{prepareComponent(){this.getTokens()},getTokens(){axios.get("/oauth/tokens").then(l=>{this.tokens=l.data})},revoke(l){axios.delete("/oauth/tokens/"+l.id).then(e=>{this.getTokens()})}}},le={key:0},oe={class:"card card-default"},ne={class:"card-body"},re={class:"table table-borderless mb-0"},ie={style:{"vertical-align":"middle"}},de={style:{"vertical-align":"middle"}},ae={key:0},ue={style:{"vertical-align":"middle"}},ce=["onClick"];function me(l,e,d,p,n,o){return i(),r("div",null,[n.tokens.length>0?(i(),r("div",le,[t("div",oe,[e[1]||(e[1]=t("div",{class:"card-header text-lg"},"Authorized Applications",-1)),t("div",ne,[t("table",re,[e[0]||(e[0]=t("thead",null,[t("tr",null,[t("th",null,"Name"),t("th",null,"Scopes"),t("th")])],-1)),t("tbody",null,[(i(!0),r(c,null,m(n.tokens,s=>(i(),r("tr",null,[t("td",ie,a(s.client.name),1),t("td",de,[s.scopes.length>0?(i(),r("span",ae,a(s.scopes.join(", ")),1)):u("",!0)]),t("td",ue,[t("a",{class:"action-link text-error",onClick:f=>o.revoke(s)}," Revoke ",8,ce)])]))),256))])])])])])):u("",!0)])}const pe=x(se,[["render",me],["__scopeId","data-v-73922f67"]]),fe={data(){return{accessToken:null,tokens:[],scopes:[],confirmToken:null,form:{name:"",scopes:[],errors:[]}}},ready(){this.prepareComponent()},mounted(){this.prepareComponent()},methods:{prepareComponent(){this.getTokens(),this.getScopes()},getTokens(){axios.get("/oauth/personal-access-tokens").then(l=>{this.tokens=l.data})},getScopes(){axios.get("/oauth/scopes").then(l=>{this.scopes=l.data})},showCreateTokenForm(){this.openModal("createModal"),this.$refs.createName.focus()},store(){this.accessToken=null,this.form.errors=[],axios.post("/oauth/personal-access-tokens",this.form).then(l=>{this.form.name="",this.form.scopes=[],this.form.errors=[],this.tokens.push(l.data.token),this.showAccessToken(l.data.accessToken)}).catch(l=>{typeof l.response.data=="object"?this.form.errors=_.flatten(_.toArray(l.response.data.errors)):this.form.errors=["Something went wrong. Please try again."]})},toggleScope(l){this.scopeIsAssigned(l)?this.form.scopes=_.reject(this.form.scopes,e=>e==l):this.form.scopes.push(l)},scopeIsAssigned(l){return _.indexOf(this.form.scopes,l)>=0},showAccessToken(l){this.closeModal("createModal"),this.accessToken=l,this.openModal("accessModal")},revoke(l){axios.delete("/oauth/personal-access-tokens/"+l.id).then(e=>{this.getTokens(),window.showToast("API token deleted succesfully.")})},openModal(l){this.$refs[l].showModal(),this.$refs[l].addEventListener("click",function(e){let d=this.getBoundingClientRect();!(d.top<=e.clientY&&e.clientY<=d.top+d.height&&d.left<=e.clientX&&e.clientX<=d.left+d.width)&&e.target.tagName==="DIALOG"&&this.close()})},closeModal(l){this.$refs[l].close()},deleteConfirm(l){if(this.confirmToken&&l.id===this.confirmToken.id)return this.revoke(l);this.confirmToken=l}}},he={class:""},be={class:"flex flex-col gap-5"},ge={class:"flex justify-between items-center"},ke={key:0,class:""},Ce={key:1,class:"table table-borderless mb-0 w-full"},ye={style:{"vertical-align":"middle"}},xe={class:"text-right",style:{"vertical-align":"middle"}},ve=["onClick"],we=["onClick"],_e={class:"dialog rounded-2xl text-center",id:"modal-create-token",ref:"createModal","aria-modal":"true","aria-labelledby":"modal-create-token-label"},Me={class:"text-justify"},Te={key:0,class:"rounded p-4 bg-red-100 text-red-800 w-full"},Fe={key:0,class:"form-group grid grid-cols-2 gap-4"},Ae={class:"col-md-6"},Ne={class:"checkbox"},Se=["onClick","checked"],Ie={class:"grid grid-cols-2 gap-2 w-full"},je={class:"dialog rounded-2xl text-center",id:"modal-access-token",ref:"accessModal","aria-modal":"true","aria-labelledby":"modal-access-token-label"},De={class:"text-justify"},Le={class:"w-full",rows:"10"};function Re(l,e,d,p,n,o){return i(),r("div",he,[t("div",be,[t("div",ge,[e[8]||(e[8]=t("span",{class:"text-lg"}," Personal Access Tokens ",-1)),t("a",{class:"btn2 btn-primary btn-outline btn-sm",tabindex:"-1",onClick:e[0]||(e[0]=(...s)=>o.showCreateTokenForm&&o.showCreateTokenForm(...s))}," Create New Token ")]),n.tokens.length===0?(i(),r("p",ke," You have not created any personal access tokens. ")):u("",!0),n.tokens.length>0?(i(),r("table",Ce,[e[9]||(e[9]=t("thead",null,[t("tr",null,[t("th",null,"Name"),t("th")])],-1)),t("tbody",null,[(i(!0),r(c,null,m(n.tokens,s=>(i(),r("tr",null,[t("td",ye,a(s.name),1),t("td",xe,[!this.confirmToken||this.confirmToken.id!=s.id?(i(),r("a",{key:0,class:"btn2 btn-error btn-outline btn-xs",onClick:f=>o.deleteConfirm(s)}," Delete ",8,ve)):(i(),r("a",{key:1,class:"btn2 btn-error btn-xs",onClick:f=>o.deleteConfirm(s)}," Confirm delete ",8,we))])]))),256))])])):u("",!0)]),t("dialog",_e,[t("header",null,[e[11]||(e[11]=t("h4",{id:"modal-create-token-label"}," Create Token ",-1)),t("button",{type:"button",class:"rounded-full",onClick:e[1]||(e[1]=s=>o.closeModal("createModal")),title:"Close"},e[10]||(e[10]=[t("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),t("span",{class:"sr-only"},"Close",-1)]))]),t("article",Me,[n.form.errors.length>0?(i(),r("div",Te,[e[12]||(e[12]=t("p",{class:"mb-0"},[t("strong",null,"Whoops!"),k(" Something went wrong!")],-1)),e[13]||(e[13]=t("br",null,null,-1)),t("ul",null,[(i(!0),r(c,null,m(n.form.errors,s=>(i(),r("li",null,a(s),1))),256))])])):u("",!0),t("form",{role:"form",class:"w-full mb-5",onSubmit:e[3]||(e[3]=y((...s)=>o.store&&o.store(...s),["prevent"])),autocomplete:"off"},[e[15]||(e[15]=t("label",{class:"font-extrabold required"},"Token name",-1)),h(t("input",{id:"create-token-name",type:"text",class:"rounded border w-full p-2",name:"name",placeholder:"Name the token","onUpdate:modelValue":e[2]||(e[2]=s=>n.form.name=s),ref:"createName"},null,512),[[b,n.form.name]]),n.scopes.length>0?(i(),r("div",Fe,[e[14]||(e[14]=t("label",{class:"col-md-4 col-form-label"},"Scopes",-1)),t("div",Ae,[(i(!0),r(c,null,m(n.scopes,s=>(i(),r("div",null,[t("div",Ne,[t("label",null,[t("input",{type:"checkbox",onClick:f=>o.toggleScope(s.id),checked:o.scopeIsAssigned(s.id)},null,8,Se),k(" "+a(s.id),1)])])]))),256))])])):u("",!0)],32),t("div",Ie,[t("button",{type:"button",class:"btn2 btn-ghost",onClick:e[4]||(e[4]=s=>o.closeModal("createModal"))},"Close"),t("button",{type:"button",class:"btn2 btn-primary",onClick:e[5]||(e[5]=(...s)=>o.store&&o.store(...s))}," Create ")])])],512),t("dialog",je,[t("header",null,[e[17]||(e[17]=t("h4",{id:"modal-access-token-label"}," Personal Access Token ",-1)),t("button",{type:"button",class:"rounded-full",onClick:e[6]||(e[6]=s=>o.closeModal("accessModal")),title:"Close"},e[16]||(e[16]=[t("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),t("span",{class:"sr-only"},"Close",-1)]))]),t("article",De,[e[18]||(e[18]=t("p",{class:"mb-2"}," Here is your new personal access token. This is the only time it will be shown so don't lose it! You may now use this token to make API requests. ",-1)),t("textarea",Le,a(n.accessToken),1),t("button",{type:"button",class:"btn2 btn-ghost",onClick:e[7]||(e[7]=s=>o.closeModal("accessModal"))},"Close")])],512)])}const Ue=x(fe,[["render",Re]]),C=v({});C.component("passport-clients",te);C.component("passport-authorized-clients",pe);C.component("passport-personal-access-tokens",Ue);C.mount("#api"); +import{c as r,a as t,e as u,F as c,f as m,g as k,w as y,j as h,v as b,k as g,b as i,t as a,q as v}from"./vue.esm-bundler-51152e6d.js";import{_ as x}from"./_plugin-vue_export-helper-c27b6911.js";const w={data(){return{clients:[],confirmClient:null,createForm:{errors:[],name:"",redirect:""},editForm:{errors:[],name:"",redirect:""}}},ready(){this.prepareComponent()},mounted(){this.prepareComponent()},methods:{prepareComponent(){this.getClients()},getClients(){axios.get("/oauth/clients").then(l=>{this.clients=l.data})},showCreateClientForm(){this.openModal("createModal"),this.$refs.createName.focus()},store(){this.persistClient("post","/oauth/clients",this.createForm,"createModal")},edit(l){this.editForm.id=l.id,this.editForm.name=l.name,this.editForm.redirect=l.redirect,this.openModal("editModal"),this.$refs.editName.focus()},update(){this.persistClient("put","/oauth/clients/"+this.editForm.id,this.editForm,"editModal")},persistClient(l,e,d,p){d.errors=[],axios[l](e,d).then(n=>{this.getClients(),d.name="",d.redirect="",d.errors=[],this.closeModal(p)}).catch(n=>{typeof n.response.data=="object"?d.errors=_.flatten(_.toArray(n.response.data.errors)):d.errors=["Something went wrong. Please try again."]})},destroy(l){axios.delete("/oauth/clients/"+l.id).then(e=>{this.getClients(),window.showToast("OAuth client deleted succesfully.")})},openModal(l){this.$refs[l].showModal(),this.$refs[l].addEventListener("click",function(e){let d=this.getBoundingClientRect();!(d.top<=e.clientY&&e.clientY<=d.top+d.height&&d.left<=e.clientX&&e.clientX<=d.left+d.width)&&e.target.tagName==="DIALOG"&&this.close()})},closeModal(l){this.$refs[l].close()},deleteConfirm(l){if(this.confirmClient&&l.id===this.confirmClient.id)return this.destroy(l);this.confirmClient=l}}},M={class:"card card-default"},T={class:"card-header"},F={class:"flex justify-between items-center"},A={class:"card-body"},N={key:0,class:"mb-0"},S={key:1,class:"table table-borderless mb-0"},I={style:{"vertical-align":"middle"}},j={style:{"vertical-align":"middle"}},D={style:{"vertical-align":"middle"}},L={style:{"vertical-align":"middle"}},R=["onClick"],U={class:"text-right",style:{"vertical-align":"middle"}},Y=["onClick"],z=["onClick"],V={class:"dialog rounded-2xl text-center",id:"modal-create-client",ref:"createModal","aria-modal":"true","aria-labelledby":"modal-create-client-label"},P={class:"text-justify"},O={key:0,class:"rounded p-4 bg-red-100 text-red-800 w-full"},q={class:"mb-5"},B={class:"mb-5"},K={class:"grid grid-cols-2 gap-2 w-full"},E={class:"dialog rounded-2xl text-center",id:"modal-edit-client",ref:"editModal","aria-modal":"true","aria-labelledby":"modal-edit-client-label"},X={class:"text-justify"},W={key:0,class:"alert alert-danger"},G={role:"form",autocomplete:"off"},$={class:"form-group grid grid-cols-2 gap-5"},H={class:"col-md-9"},J={class:"form-group grid grid-cols-2 gap-5"},Q={class:"col-md-9"},Z={class:"grid grid-cols-2 gap-2 w-full"};function ee(l,e,d,p,n,o){return i(),r("div",null,[t("div",M,[t("div",T,[t("div",F,[e[17]||(e[17]=t("span",{class:"text-lg"}," OAuth Clients ",-1)),t("a",{class:"btn2 btn-primary btn-outline btn-sm",tabindex:"-1",onClick:e[0]||(e[0]=(...s)=>o.showCreateClientForm&&o.showCreateClientForm(...s))}," Create New Client ")])]),t("div",A,[n.clients.length===0?(i(),r("p",N," You have not created any OAuth clients. ")):u("",!0),n.clients.length>0?(i(),r("table",S,[e[18]||(e[18]=t("thead",null,[t("tr",null,[t("th",null,"Client ID"),t("th",null,"Name"),t("th",null,"Secret"),t("th"),t("th")])],-1)),t("tbody",null,[(i(!0),r(c,null,m(n.clients,s=>(i(),r("tr",null,[t("td",I,a(s.id),1),t("td",j,a(s.name),1),t("td",D,[t("code",null,a(s.secret),1)]),t("td",L,[t("a",{class:"cursor-pointer",tabindex:"-1",onClick:f=>o.edit(s)}," Edit ",8,R)]),t("td",U,[!this.confirmClient||this.confirmClient.id!=s.id?(i(),r("a",{key:0,class:"btn2 btn-error btn-outline btn-xs",onClick:f=>o.deleteConfirm(s)}," Delete ",8,Y)):(i(),r("a",{key:1,class:"btn2 btn-error btn-xs",onClick:f=>o.deleteConfirm(s)}," Confirm delete ",8,z))])]))),256))])])):u("",!0)])]),t("dialog",V,[t("header",null,[e[20]||(e[20]=t("h4",{id:"modal-create-client-label"}," Create Client ",-1)),t("button",{type:"button",class:"rounded-full",onClick:e[1]||(e[1]=s=>o.closeModal("createModal")),title:"Close"},e[19]||(e[19]=[t("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),t("span",{class:"sr-only"},"Close",-1)]))]),t("article",P,[n.createForm.errors.length>0?(i(),r("div",O,[e[21]||(e[21]=t("p",{class:"mb-0"},[t("strong",null,"Whoops!"),k(" Something went wrong!")],-1)),e[22]||(e[22]=t("br",null,null,-1)),t("ul",null,[(i(!0),r(c,null,m(n.createForm.errors,s=>(i(),r("li",null,a(s),1))),256))])])):u("",!0),t("form",{role:"form",class:"w-full",onSubmit:e[6]||(e[6]=y((...s)=>o.store&&o.store(...s),["prevent"])),autocomplete:"off"},[t("div",q,[e[23]||(e[23]=t("label",{class:"font-extrabold required"},"Client name",-1)),h(t("input",{id:"create-client-name",type:"text",class:"rounded border w-full p-2",name:"name",placeholder:"Name the token","onUpdate:modelValue":e[2]||(e[2]=s=>n.createForm.name=s),onKeyup:e[3]||(e[3]=g((...s)=>o.store&&o.store(...s),["enter"])),ref:"createName"},null,544),[[b,n.createForm.name]]),e[24]||(e[24]=t("span",{class:"text-sm text-muted"}," Something your users will recognize and trust. ",-1))]),t("div",B,[e[25]||(e[25]=t("label",{class:"font-extrabold required"},"Redirect URL",-1)),h(t("input",{type:"text",class:"rounded border w-full p-2",name:"redirect",onKeyup:e[4]||(e[4]=g((...s)=>o.store&&o.store(...s),["enter"])),"onUpdate:modelValue":e[5]||(e[5]=s=>n.createForm.redirect=s)},null,544),[[b,n.createForm.redirect]]),e[26]||(e[26]=t("span",{class:"text-sm text-muted"}," Your application's authorization callback URL. ",-1))])],32),t("form",{role:"form",class:"w-full mb-5",onSubmit:e[7]||(e[7]=y((...s)=>o.store&&o.store(...s),["prevent"])),autocomplete:"off"},null,32),t("div",K,[t("button",{type:"button",class:"btn2 btn-ghost",onClick:e[8]||(e[8]=s=>o.closeModal("createModal"))},"Close"),t("button",{type:"button",class:"btn2 btn-primary",onClick:e[9]||(e[9]=(...s)=>o.store&&o.store(...s))}," Create ")])])],512),t("dialog",E,[t("header",null,[e[28]||(e[28]=t("h4",{id:"modal-edit-client-label"}," Create Client ",-1)),t("button",{type:"button",class:"rounded-full",onClick:e[10]||(e[10]=s=>o.closeModal("editModal")),title:"Close"},e[27]||(e[27]=[t("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),t("span",{class:"sr-only"},"Close",-1)]))]),t("article",X,[n.editForm.errors.length>0?(i(),r("div",W,[e[29]||(e[29]=t("p",{class:"mb-0"},[t("strong",null,"Whoops!"),k(" Something went wrong!")],-1)),e[30]||(e[30]=t("br",null,null,-1)),t("ul",null,[(i(!0),r(c,null,m(n.editForm.errors,s=>(i(),r("li",null,a(s),1))),256))])])):u("",!0),t("form",G,[t("div",$,[e[32]||(e[32]=t("label",{class:"col-md-3 col-form-label"},"Name",-1)),t("div",H,[h(t("input",{id:"edit-client-name",type:"text",class:"w-full",onKeyup:e[11]||(e[11]=g((...s)=>o.update&&o.update(...s),["enter"])),"onUpdate:modelValue":e[12]||(e[12]=s=>n.editForm.name=s),ref:"editName"},null,544),[[b,n.editForm.name]]),e[31]||(e[31]=t("span",{class:"form-text text-muted"}," Something your users will recognize and trust. ",-1))])]),t("div",J,[e[34]||(e[34]=t("label",{class:"col-md-3 col-form-label"},"Redirect URL",-1)),t("div",Q,[h(t("input",{type:"text",class:"w-full",name:"redirect",onKeyup:e[13]||(e[13]=g((...s)=>o.update&&o.update(...s),["enter"])),"onUpdate:modelValue":e[14]||(e[14]=s=>n.editForm.redirect=s)},null,544),[[b,n.editForm.redirect]]),e[33]||(e[33]=t("span",{class:"form-text text-muted"}," Your application's authorization callback URL. ",-1))])])]),t("div",Z,[t("button",{type:"button",class:"btn2 btn-ghost",onClick:e[15]||(e[15]=s=>o.closeModal("editModal"))},"Close"),t("button",{type:"button",class:"btn2 btn-primary",onClick:e[16]||(e[16]=(...s)=>o.update&&o.update(...s))}," Create ")])])],512)])}const te=x(w,[["render",ee]]);const se={data(){return{tokens:[]}},ready(){this.prepareComponent()},mounted(){this.prepareComponent()},methods:{prepareComponent(){this.getTokens()},getTokens(){axios.get("/oauth/tokens").then(l=>{this.tokens=l.data})},revoke(l){axios.delete("/oauth/tokens/"+l.id).then(e=>{this.getTokens()})}}},le={key:0},oe={class:"card card-default"},ne={class:"card-body"},re={class:"table table-borderless mb-0"},ie={style:{"vertical-align":"middle"}},de={style:{"vertical-align":"middle"}},ae={key:0},ue={style:{"vertical-align":"middle"}},ce=["onClick"];function me(l,e,d,p,n,o){return i(),r("div",null,[n.tokens.length>0?(i(),r("div",le,[t("div",oe,[e[1]||(e[1]=t("div",{class:"card-header text-lg"},"Authorized Applications",-1)),t("div",ne,[t("table",re,[e[0]||(e[0]=t("thead",null,[t("tr",null,[t("th",null,"Name"),t("th",null,"Scopes"),t("th")])],-1)),t("tbody",null,[(i(!0),r(c,null,m(n.tokens,s=>(i(),r("tr",null,[t("td",ie,a(s.client.name),1),t("td",de,[s.scopes.length>0?(i(),r("span",ae,a(s.scopes.join(", ")),1)):u("",!0)]),t("td",ue,[t("a",{class:"action-link text-error",onClick:f=>o.revoke(s)}," Revoke ",8,ce)])]))),256))])])])])])):u("",!0)])}const pe=x(se,[["render",me],["__scopeId","data-v-73922f67"]]),fe={data(){return{accessToken:null,tokens:[],scopes:[],confirmToken:null,form:{name:"",scopes:[],errors:[]}}},ready(){this.prepareComponent()},mounted(){this.prepareComponent()},methods:{prepareComponent(){this.getTokens(),this.getScopes()},getTokens(){axios.get("/oauth/personal-access-tokens").then(l=>{this.tokens=l.data})},getScopes(){axios.get("/oauth/scopes").then(l=>{this.scopes=l.data})},showCreateTokenForm(){this.openModal("createModal"),this.$refs.createName.focus()},store(){this.accessToken=null,this.form.errors=[],axios.post("/oauth/personal-access-tokens",this.form).then(l=>{this.form.name="",this.form.scopes=[],this.form.errors=[],this.tokens.push(l.data.token),this.showAccessToken(l.data.accessToken)}).catch(l=>{typeof l.response.data=="object"?this.form.errors=_.flatten(_.toArray(l.response.data.errors)):this.form.errors=["Something went wrong. Please try again."]})},toggleScope(l){this.scopeIsAssigned(l)?this.form.scopes=_.reject(this.form.scopes,e=>e==l):this.form.scopes.push(l)},scopeIsAssigned(l){return _.indexOf(this.form.scopes,l)>=0},showAccessToken(l){this.closeModal("createModal"),this.accessToken=l,this.openModal("accessModal")},revoke(l){axios.delete("/oauth/personal-access-tokens/"+l.id).then(e=>{this.getTokens(),window.showToast("API token deleted succesfully.")})},openModal(l){this.$refs[l].showModal(),this.$refs[l].addEventListener("click",function(e){let d=this.getBoundingClientRect();!(d.top<=e.clientY&&e.clientY<=d.top+d.height&&d.left<=e.clientX&&e.clientX<=d.left+d.width)&&e.target.tagName==="DIALOG"&&this.close()})},closeModal(l){this.$refs[l].close()},deleteConfirm(l){if(this.confirmToken&&l.id===this.confirmToken.id)return this.revoke(l);this.confirmToken=l}}},he={class:""},be={class:"flex flex-col gap-5"},ge={class:"flex justify-between items-center"},ke={key:0,class:""},Ce={key:1,class:"table table-borderless mb-0 w-full"},ye={style:{"vertical-align":"middle"}},xe={class:"text-right",style:{"vertical-align":"middle"}},ve=["onClick"],we=["onClick"],_e={class:"dialog rounded-2xl text-center",id:"modal-create-token",ref:"createModal","aria-modal":"true","aria-labelledby":"modal-create-token-label"},Me={class:"text-justify"},Te={key:0,class:"rounded p-4 bg-red-100 text-red-800 w-full"},Fe={key:0,class:"form-group grid grid-cols-2 gap-4"},Ae={class:"col-md-6"},Ne={class:"checkbox"},Se=["onClick","checked"],Ie={class:"grid grid-cols-2 gap-2 w-full"},je={class:"dialog rounded-2xl text-center",id:"modal-access-token",ref:"accessModal","aria-modal":"true","aria-labelledby":"modal-access-token-label"},De={class:"text-justify"},Le={class:"w-full",rows:"10"};function Re(l,e,d,p,n,o){return i(),r("div",he,[t("div",be,[t("div",ge,[e[8]||(e[8]=t("span",{class:"text-lg"}," Personal Access Tokens ",-1)),t("a",{class:"btn2 btn-primary btn-outline btn-sm",tabindex:"-1",onClick:e[0]||(e[0]=(...s)=>o.showCreateTokenForm&&o.showCreateTokenForm(...s))}," Create New Token ")]),n.tokens.length===0?(i(),r("p",ke," You have not created any personal access tokens. ")):u("",!0),n.tokens.length>0?(i(),r("table",Ce,[e[9]||(e[9]=t("thead",null,[t("tr",null,[t("th",null,"Name"),t("th")])],-1)),t("tbody",null,[(i(!0),r(c,null,m(n.tokens,s=>(i(),r("tr",null,[t("td",ye,a(s.name),1),t("td",xe,[!this.confirmToken||this.confirmToken.id!=s.id?(i(),r("a",{key:0,class:"btn2 btn-error btn-outline btn-xs",onClick:f=>o.deleteConfirm(s)}," Delete ",8,ve)):(i(),r("a",{key:1,class:"btn2 btn-error btn-xs",onClick:f=>o.deleteConfirm(s)}," Confirm delete ",8,we))])]))),256))])])):u("",!0)]),t("dialog",_e,[t("header",null,[e[11]||(e[11]=t("h4",{id:"modal-create-token-label"}," Create Token ",-1)),t("button",{type:"button",class:"rounded-full",onClick:e[1]||(e[1]=s=>o.closeModal("createModal")),title:"Close"},e[10]||(e[10]=[t("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),t("span",{class:"sr-only"},"Close",-1)]))]),t("article",Me,[n.form.errors.length>0?(i(),r("div",Te,[e[12]||(e[12]=t("p",{class:"mb-0"},[t("strong",null,"Whoops!"),k(" Something went wrong!")],-1)),e[13]||(e[13]=t("br",null,null,-1)),t("ul",null,[(i(!0),r(c,null,m(n.form.errors,s=>(i(),r("li",null,a(s),1))),256))])])):u("",!0),t("form",{role:"form",class:"w-full mb-5",onSubmit:e[3]||(e[3]=y((...s)=>o.store&&o.store(...s),["prevent"])),autocomplete:"off"},[e[15]||(e[15]=t("label",{class:"font-extrabold required"},"Token name",-1)),h(t("input",{id:"create-token-name",type:"text",class:"rounded border w-full p-2",name:"name",placeholder:"Name the token","onUpdate:modelValue":e[2]||(e[2]=s=>n.form.name=s),ref:"createName"},null,512),[[b,n.form.name]]),n.scopes.length>0?(i(),r("div",Fe,[e[14]||(e[14]=t("label",{class:"col-md-4 col-form-label"},"Scopes",-1)),t("div",Ae,[(i(!0),r(c,null,m(n.scopes,s=>(i(),r("div",null,[t("div",Ne,[t("label",null,[t("input",{type:"checkbox",onClick:f=>o.toggleScope(s.id),checked:o.scopeIsAssigned(s.id)},null,8,Se),k(" "+a(s.id),1)])])]))),256))])])):u("",!0)],32),t("div",Ie,[t("button",{type:"button",class:"btn2 btn-ghost",onClick:e[4]||(e[4]=s=>o.closeModal("createModal"))},"Close"),t("button",{type:"button",class:"btn2 btn-primary",onClick:e[5]||(e[5]=(...s)=>o.store&&o.store(...s))}," Create ")])])],512),t("dialog",je,[t("header",null,[e[17]||(e[17]=t("h4",{id:"modal-access-token-label"}," Personal Access Token ",-1)),t("button",{type:"button",class:"rounded-full",onClick:e[6]||(e[6]=s=>o.closeModal("accessModal")),title:"Close"},e[16]||(e[16]=[t("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1),t("span",{class:"sr-only"},"Close",-1)]))]),t("article",De,[e[18]||(e[18]=t("p",{class:"mb-2"}," Here is your new personal access token. This is the only time it will be shown so don't lose it! You may now use this token to make API requests. ",-1)),t("textarea",Le,a(n.accessToken),1),t("button",{type:"button",class:"btn2 btn-ghost",onClick:e[7]||(e[7]=s=>o.closeModal("accessModal"))},"Close")])],512)])}const Ue=x(fe,[["render",Re]]),C=v({});C.component("passport-clients",te);C.component("passport-authorized-clients",pe);C.component("passport-personal-access-tokens",Ue);C.mount("#api"); diff --git a/public/build/assets/app-6ed73558.js b/public/build/assets/app-6ed73558.js deleted file mode 100644 index ba3348779..000000000 --- a/public/build/assets/app-6ed73558.js +++ /dev/null @@ -1,10 +0,0 @@ -import{t as ae,C as fe}from"./tippy.esm-24ef6cb2.js";import{S as ze}from"./sortable.esm-89cfb839.js";import"./dialog-4600fe8d.js";import{d as Z,o as Qe,c as m,a as l,t as v,b as u,n as Q,w as ye,e as y,F as q,r as I,f as N,g as _,h as U,i as K,j as ne,k as At,v as we,l as te,m as Ue,p as L,q as Ke,s as It,u as Dt}from"./vue.esm-bundler-35c332fe.js";import{_ as ce}from"./_plugin-vue_export-helper-c27b6911.js";import{v as We}from"./v-click-outside.umd-1708c20a.js";import"./_commonjsHelpers-725317a4.js";const Ve="kanka.default";window.triggerEvent=function(n){n=n||Ve;const e=new Event(n);document.dispatchEvent(e)};window.onEvent=function(n,e){e=e||Ve,document.addEventListener(e,n)};window.onReady=function(n){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(n,1):document.addEventListener("DOMContentLoaded",n)};window.initTags=function(){var n,e;(n=document.querySelectorAll(".form-tags"))==null||n.forEach(function(t){t.classList.contains("select2-hidden-accessible")||t.dataset.loaded!==1&&(t.dataset.loaded=1,$(t).select2({tags:t.dataset.allowNew,allowClear:t.dataset.allowClear,dropdownParent:t.dataset.dropdownParent||"",minimumInputLength:0,ajax:{quietMillis:500,delay:500,url:t.dataset.url,dataType:"json",data:function(i){var r;return{q:(r=i.term)==null?void 0:r.trim()}},processResults:function(i){return{results:i}},cache:!0},createTag:function(i){var s;const r=(s=i.term)==null?void 0:s.trim();return r===""?null:{id:r,text:r,newTag:!0}},templateResult:function(i){const r=document.createElement("span");return r.classList.add("block","grow","text-left"),r.innerHTML=i.text,i.colour&&(r.classList.add("flex","gap-2","items-center","text-left"),r.innerHTML=""+i.text+""),r},templateSelection:function(i,r){if(i.newTag){const a=document.createElement("span");a.classList.add("new-tag"),a.title=t.dataset.newTag,a.innerHTML=i.text+' '}let s=i.element,o=[];return i.colour?o=i.colour.trim().split(" "):s.dataset.colour&&(o=s.dataset.colour.trim().split(" ")),o.length>0&&o.forEach(a=>{a.trim().length!==0&&r[0].classList.add(a)}),r[0].classList.add("text-left"),i.text}}))}),(e=document.querySelectorAll(".position-dropdown"))==null||e.forEach(function(t){t.classList.contains("select2-hidden-accessible")||t.dataset.loaded!==1&&(t.dataset.loaded=1,$(t).select2({tags:!0,allowClear:!0,dropdownParent:t.dataset.dropdownParent||"",placeholder:t.dataset.placeholder,minimumInputLength:0,createTag:function(i){var s;const r=(s=i.term)==null?void 0:s.trim();return r===""?null:{id:r,text:r,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 n=jQuery.fn.select2.amd;n.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){return"Bitte "+(e.input.length-e.maximum)+" Zeichen weniger eingeben"},inputTooShort:function(e){return"Bitte "+(e.minimum-e.input.length)+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Element";return e.maximum!=1&&(t+="e"),t+=" auswählen"},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"},removeAllItems:function(){return"Entferne alle Elemente"}}}),n.define,n.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 n=jQuery.fn.select2.amd;n.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,i="Please delete "+t+" character";return t!=1&&(i+="s"),i},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),n.define,n.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 n=jQuery.fn.select2.amd;n.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var t=e.input.length-e.maximum,i="Por favor, elimine "+t+" car";return i+=t==1?"ácter":"acteres"},inputTooShort:function(e){var t=e.minimum-e.input.length,i="Por favor, introduzca "+t+" car";return i+=t==1?"ácter":"acteres"},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Eliminar todos los elementos"}}}),n.define,n.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 n=jQuery.fn.select2.amd;n.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Supprimez "+t+" caractère"+(t>1?"s":"")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Saisissez au moins "+t+" caractère"+(t>1?"s":"")},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1?"s":"")},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"},removeAllItems:function(){return"Supprimer tous les éléments"}}}),n.define,n.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 n=jQuery.fn.select2.amd;n.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,i="Per favore cancella "+t+" caratter";return i+=t!==1?"i":"e"},inputTooShort:function(e){return"Per favore inserisci "+(e.minimum-e.input.length)+" o più caratteri"},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"},removeAllItems:function(){return"Rimuovi tutti gli oggetti"}}}),n.define,n.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 n=jQuery.fn.select2.amd;n.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){return"Gelieve "+(e.input.length-e.maximum)+" karakters te verwijderen"},inputTooShort:function(e){return"Gelieve "+(e.minimum-e.input.length)+" of meer karakters in te voeren"},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",i="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(i+="s"),i+=" worden geselecteerd"},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"},removeAllItems:function(){return"Verwijder alle items"}}}),n.define,n.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 n=jQuery.fn.select2.amd;n.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],i=function(r,s){return r===1?s[0]:r>1&&r<=4?s[1]:r>=5?s[2]:void 0};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(r){var s=r.input.length-r.maximum;return"Usuń "+s+" "+i(s,e)},inputTooShort:function(r){var s=r.minimum-r.input.length;return"Podaj przynajmniej "+s+" "+i(s,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(r){return"Możesz zaznaczyć tylko "+r.maximum+" "+i(r.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"},removeAllItems:function(){return"Usuń wszystkie przedmioty"}}}),n.define,n.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 n=jQuery.fn.select2.amd;n.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,i="Apague "+t+" caracter";return t!=1&&(i+="es"),i},inputTooShort:function(e){return"Digite "+(e.minimum-e.input.length)+" ou mais caracteres"},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Remover todos os itens"}}}),n.define,n.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 n=jQuery.fn.select2.amd;n.define("select2/i18n/ru",[],function(){function e(t,i,r,s){return t%10<5&&t%10>0&&t%100<5||t%100>20?t%10>1?r:i:s}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var i=t.input.length-t.maximum,r="Пожалуйста, введите на "+i+" символ";return r+=e(i,"","a","ов"),r+=" меньше"},inputTooShort:function(t){var i=t.minimum-t.input.length,r="Пожалуйста, введите ещё хотя бы "+i+" символ";return r+=e(i,"","a","ов")},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var i="Вы можете выбрать не более "+t.maximum+" элемент";return i+=e(t.maximum,"","a","ов")},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"},removeAllItems:function(){return"Удалить все элементы"}}}),n.define,n.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 n=jQuery.fn.select2.amd;n.define("select2/i18n/sk",[],function(){var e={2:function(t){return t?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(t){var i=t.input.length-t.maximum;return i==1?"Prosím, zadajte o jeden znak menej":i>=2&&i<=4?"Prosím, zadajte o "+e[i](!0)+" znaky menej":"Prosím, zadajte o "+i+" znakov menej"},inputTooShort:function(t){var i=t.minimum-t.input.length;return i==1?"Prosím, zadajte ešte jeden znak":i<=4?"Prosím, zadajte ešte ďalšie "+e[i](!0)+" znaky":"Prosím, zadajte ešte ďalších "+i+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.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"}}}),n.define,n.require})();window.initForeignSelect=function(){const n=document.querySelectorAll("select.select2");n.length!==0&&(n.forEach(e=>{if(e.classList.contains("select2-hidden-accessible"))return;if(e.classList.contains("campaign-genres")){$(e).select2({tags:!1,allowClear:!0,dropdownParent:"",width:"100%",maximumSelectionLength:3});return}const t=e.dataset.url,i=e.dataset.allowClear,r=e.dataset.dropdownParent||"",s=e.dataset.placeholder;if(!t){$(e).select2({tags:!1,placeholder:s,allowClear:i??!1,language:e.dataset.language,minimumInputLength:0,dropdownParent:r,width:"100%"});return}$(e).select2({tags:!1,placeholder:s,allowClear:i||!0,language:e.dataset.language,minimumInputLength:0,dropdownParent:r,width:"100%",ajax:{delay:500,quietMillis:500,url:t,dataType:"json",data:function(o){var a;return{q:(a=o.term)==null?void 0:a.trim()}},processResults:function(o){return{results:o}},error:function(o){return o.status===503&&window.showToast(o.responseJSON.message,"error"),{results:[]}},cache:!0},templateResult:Ht,templateSelection:Pt,createTag:function(o){return null}})}),jt(),Nt())};const Ht=n=>{const e=document.createElement("span");return n.image?(e.classList.add("flex","gap-2","items-center","text-left"),e.innerHTML=""+n.text+""):e.innerHTML=n.text,e},Pt=n=>{if(!n.id)return n.text;const e=document.createElement("span");return e.innerHTML=n.text,e},jt=()=>{const n=document.querySelectorAll("select.select2-local");n.length!==0&&n.forEach(e=>{$(e).select2({placeholder:e.dataset.placeholder,language:e.dataset.language,allowClear:!0})})},Nt=()=>{const n=document.querySelectorAll("select.select2-colour");n.length!==0&&n.forEach(e=>{$(e).select2({placeholder:e.dataset.placeholder,language:e.dataset.language,allowClear:!1,templateResult:Re,templateSelection:Re})})},Re=n=>{if(n.id==="none")return n.text;const e=document.createElement("span");return e.innerHTML='
'+n.text,e};Array.prototype.find||(Array.prototype.find=function(n){if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof n!="function")throw new TypeError("predicate must be a function");for(var e=Object(this),t=e.length>>>0,i=arguments[1],r,s=0;s{r.key===t.keyCode&&(e.commandEvent=!0,e.callbacks()[r.value.toLowerCase()](t,i))})}input(e,t){e.inputEvent=!0,e.keyup.call(this,e,t)}click(e,t){let i=e.tribute;if(i.menu&&i.menu.contains(t.target)){let r=t.target;for(t.preventDefault(),t.stopPropagation();r.nodeName.toLowerCase()!=="li";)if(r=r.parentNode,!r||r===i.menu)throw new Error("cannot find the
  • container for the click");i.selectItemAtIndex(r.getAttribute("data-index"),t),i.hideMenu()}else i.current.element&&!i.current.externalTrigger&&(i.current.externalTrigger=!1,setTimeout(()=>i.hideMenu()))}keyup(e,t){if(e.inputEvent&&(e.inputEvent=!1),e.updateSelection(this),t.keyCode!==27){if(!e.tribute.allowSpaces&&e.tribute.hasTrailingSpace){e.tribute.hasTrailingSpace=!1,e.commandEvent=!0,e.callbacks().space(t,this);return}if(!e.tribute.isActive)if(e.tribute.autocompleteMode)e.callbacks().triggerChar(t,this,"");else{let i=e.getKeyCode(e,this,t);if(isNaN(i)||!i)return;let r=e.tribute.triggers().find(s=>s.charCodeAt(0)===i);typeof r<"u"&&e.callbacks().triggerChar(t,this,r)}e.tribute.current.mentionText.length{e.keyCode===i.key&&(t=!0)}),!t}return!1}getKeyCode(e,t,i){let r=e.tribute,s=r.range.getTriggerInfo(!1,r.hasTrailingSpace,!0,r.allowSpaces,r.autocompleteMode);return s?s.mentionTriggerChar.charCodeAt(0):!1}updateSelection(e){this.tribute.current.element=e;let t=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);t&&(this.tribute.current.selectedPath=t.mentionSelectedPath,this.tribute.current.mentionText=t.mentionText,this.tribute.current.selectedOffset=t.mentionSelectedOffset)}callbacks(){return{triggerChar:(e,t,i)=>{let r=this.tribute;r.current.trigger=i;let s=r.collection.find(o=>o.trigger===i);r.current.collection=s,r.current.mentionText.length>=r.current.collection.menuShowMinLength&&r.inputEvent&&r.showMenuFor(t,!0)},enter:(e,t)=>{this.tribute.isActive&&this.tribute.current.filteredItems&&(e.preventDefault(),e.stopPropagation(),setTimeout(()=>{this.tribute.selectItemAtIndex(this.tribute.menuSelected,e),this.tribute.hideMenu()},0))},escape:(e,t)=>{this.tribute.isActive&&(e.preventDefault(),e.stopPropagation(),this.tribute.isActive=!1,this.tribute.hideMenu())},tab:(e,t)=>{this.callbacks().enter(e,t)},space:(e,t)=>{this.tribute.isActive&&(this.tribute.spaceSelectsMatch?this.callbacks().enter(e,t):this.tribute.allowSpaces||(e.stopPropagation(),setTimeout(()=>{this.tribute.hideMenu(),this.tribute.isActive=!1},0)))},up:(e,t)=>{if(this.tribute.isActive&&this.tribute.current.filteredItems){e.preventDefault(),e.stopPropagation();let i=this.tribute.current.filteredItems.length,r=this.tribute.menuSelected;i>r&&r>0?(this.tribute.menuSelected--,this.setActiveLi()):r===0&&(this.tribute.menuSelected=i-1,this.setActiveLi(),this.tribute.menu.scrollTop=this.tribute.menu.scrollHeight)}},down:(e,t)=>{if(this.tribute.isActive&&this.tribute.current.filteredItems){e.preventDefault(),e.stopPropagation();let i=this.tribute.current.filteredItems.length-1,r=this.tribute.menuSelected;i>r?(this.tribute.menuSelected++,this.setActiveLi()):i===r&&(this.tribute.menuSelected=0,this.setActiveLi(),this.tribute.menu.scrollTop=0)}},delete:(e,t)=>{this.tribute.isActive&&this.tribute.current.mentionText.length<1?this.tribute.hideMenu():this.tribute.isActive&&this.tribute.showMenuFor(t)}}}setActiveLi(e){let t=this.tribute.menu.querySelectorAll("li"),i=t.length>>>0;e&&(this.tribute.menuSelected=parseInt(e));for(let r=0;ra.bottom){let c=o.bottom-a.bottom;this.tribute.menu.scrollTop+=c}else if(o.top{this.tribute.isActive&&this.tribute.showMenuFor(this.tribute.current.element,!1)},300,!1),this.windowResizeEvent=this.debounce(()=>{this.tribute.isActive&&this.tribute.range.positionMenuAtCaret(!0)},300,!1),this.tribute.range.getDocument().addEventListener("MSPointerDown",this.menuClickEvent,!1),this.tribute.range.getDocument().addEventListener("mousedown",this.menuClickEvent,!1),window.addEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.addEventListener("scroll",this.menuContainerScrollEvent,!1):window.addEventListener("scroll",this.menuContainerScrollEvent)}unbind(e){this.tribute.range.getDocument().removeEventListener("mousedown",this.menuClickEvent,!1),this.tribute.range.getDocument().removeEventListener("MSPointerDown",this.menuClickEvent,!1),window.removeEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.removeEventListener("scroll",this.menuContainerScrollEvent,!1):window.removeEventListener("scroll",this.menuContainerScrollEvent)}debounce(e,t,i){var r;return()=>{var s=this,o=arguments,a=()=>{r=null,i||e.apply(s,o)},c=i&&!r;clearTimeout(r),r=setTimeout(a,t),c&&e.apply(s,o)}}}class Bt{constructor(e){this.tribute=e,this.tribute.range=this}getDocument(){let e;return this.tribute.current.collection&&(e=this.tribute.current.collection.iframe),e?e.contentWindow.document:document}positionMenuAtCaret(e){let t=this.tribute.current,i,r=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(typeof r<"u"){if(!this.tribute.positionMenu){this.tribute.menu.style.cssText="display: block;";return}this.isContentEditable(t.element)?i=this.getContentEditableCaretPosition(r.mentionPosition):i=this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,r.mentionPosition),this.tribute.menu.style.cssText=`top: ${i.top}px; - left: ${i.left}px; - right: ${i.right}px; - bottom: ${i.bottom}px; - position: absolute; - display: block;`,i.left==="auto"&&(this.tribute.menu.style.left="auto"),i.top==="auto"&&(this.tribute.menu.style.top="auto"),e&&this.scrollIntoView(),window.setTimeout(()=>{let s={width:this.tribute.menu.offsetWidth,height:this.tribute.menu.offsetHeight},o=this.isMenuOffScreen(i,s),a=window.innerWidth>s.width&&(o.left||o.right),c=window.innerHeight>s.height&&(o.top||o.bottom);(a||c)&&(this.tribute.menu.style.cssText="display: none",this.positionMenuAtCaret(e))},0)}else this.tribute.menu.style.cssText="display: none"}get menuContainerIsBody(){return this.tribute.menuContainer===document.body||!this.tribute.menuContainer}selectElement(e,t,i){let r,s=e;if(t)for(var o=0;o=0&&(t=r.substring(0,s))}}else{let i=this.tribute.current.element;if(i){let r=i.selectionStart;i.value&&r>=0&&(t=i.value.substring(0,r))}}return t}getLastWordInText(e){e=e.replace(/\u00A0/g," ");let t=e.split(/\s+/),i=t.length-1;return t[i].trim()}getTriggerInfo(e,t,i,r,s){let o=this.tribute.current,a,c,f;if(!this.isContentEditable(o.element))a=this.tribute.current.element;else{let h=this.getContentEditableSelectedPath(o);h&&(a=h.selected,c=h.path,f=h.offset)}let d=this.getTextPrecedingCurrentSelection(),g=this.getLastWordInText(d);if(s)return{mentionPosition:d.length-g.length,mentionText:g,mentionSelectedElement:a,mentionSelectedPath:c,mentionSelectedOffset:f};if(d!=null){let h=-1,x;if(this.tribute.collection.forEach(b=>{let E=b.trigger,S=b.requireLeadingSpace?this.lastIndexWithLeadingSpace(d,E):d.lastIndexOf(E);S>h&&(h=S,x=E,i=b.requireLeadingSpace)}),h>=0&&(h===0||!i||/[\xA0\s]/g.test(d.substring(h-1,h)))){let b=d.substring(h+x.length,d.length);x=d.substring(h,h+x.length);let E=b.substring(0,1),S=b.length>0&&(E===" "||E===" ");t&&(b=b.trim());let C=r?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=C.test(b),!S&&(e||!C.test(b)))return{mentionPosition:h,mentionText:b,mentionSelectedElement:a,mentionSelectedPath:c,mentionSelectedOffset:f,mentionTriggerChar:x}}}}lastIndexWithLeadingSpace(e,t){let i=e.split("").reverse().join(""),r=-1;for(let s=0,o=e.length;s=0;d--)if(t[d]!==i[s-d]){f=!1;break}if(f&&(a||c)){r=e.length-1-s;break}}return r}isContentEditable(e){return e.nodeName!=="INPUT"&&e.nodeName!=="TEXTAREA"}isMenuOffScreen(e,t){let i=window.innerWidth,r=window.innerHeight,s=document.documentElement,o=(window.pageXOffset||s.scrollLeft)-(s.clientLeft||0),a=(window.pageYOffset||s.scrollTop)-(s.clientTop||0),c=typeof e.top=="number"?e.top:a+r-e.bottom-t.height,f=typeof e.right=="number"?e.right:e.left+t.width,d=typeof e.bottom=="number"?e.bottom:e.top+t.height,g=typeof e.left=="number"?e.left:o+i-e.right-t.width;return{top:cMath.ceil(o+i),bottom:d>Math.ceil(a+r),left:g{a[H]=c[H]}),s?(a.width=`${parseInt(c.width)-2}px`,e.scrollHeight>parseInt(c.height)&&(a.overflowY="scroll")):a.overflow="hidden",o.textContent=e.value.substring(0,t),e.nodeName==="INPUT"&&(o.textContent=o.textContent.replace(/\s/g," "));let f=this.getDocument().createElement("span");f.textContent=e.value.substring(t)||".",o.appendChild(f);let d=e.getBoundingClientRect(),g=document.documentElement,h=(window.pageXOffset||g.scrollLeft)-(g.clientLeft||0),x=(window.pageYOffset||g.scrollTop)-(g.clientTop||0),b=0,E=0;this.menuContainerIsBody&&(b=d.top,E=d.left);let S={top:b+x+f.offsetTop+parseInt(c.borderTopWidth)+parseInt(c.fontSize)-e.scrollTop,left:E+h+f.offsetLeft+parseInt(c.borderLeftWidth)},C=window.innerWidth,B=window.innerHeight,D=this.getMenuDimensions(),A=this.isMenuOffScreen(S,D);A.right&&(S.right=C-S.left,S.left="auto");let O=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(A.bottom){let H=this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect(),p=O-(B-H.top);S.bottom=p+(B-d.top-f.offsetTop),S.top="auto"}return A=this.isMenuOffScreen(S,D),A.left&&(S.left=C>D.width?h+C-D.width:h,delete S.right),A.top&&(S.top=B>D.height?x+B-D.height:x,delete S.bottom),this.getDocument().body.removeChild(o),S}getContentEditableCaretPosition(e){let t,i=this.getWindowSelection();t=this.getDocument().createRange(),t.setStart(i.anchorNode,e),t.setEnd(i.anchorNode,e),t.collapse(!1);let r=t.getBoundingClientRect(),s=document.documentElement,o=(window.pageXOffset||s.scrollLeft)-(s.clientLeft||0),a=(window.pageYOffset||s.scrollTop)-(s.clientTop||0),c=r.left,f=r.top,d={left:c+o,top:f+r.height+a},g=window.innerWidth,h=window.innerHeight,x=this.getMenuDimensions(),b=this.isMenuOffScreen(d,x);b.right&&(d.left="auto",d.right=g-r.left-o);let E=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(b.bottom){let S=this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect(),C=E-(h-S.top);d.top="auto",d.bottom=C+(h-r.top)}return b=this.isMenuOffScreen(d,x),b.left&&(d.left=g>x.width?o+g-x.width:o,delete d.right),b.top&&(d.top=h>x.height?a+h-x.height:a,delete d.bottom),this.menuContainerIsBody||(d.left=d.left?d.left-this.tribute.menuContainer.offsetLeft:d.left,d.top=d.top?d.top-this.tribute.menuContainer.offsetTop:d.top),d}scrollIntoView(e){let t=20,i,r=100,s=this.menu;if(typeof s>"u")return;for(;i===void 0||i.height===0;)if(i=s.getBoundingClientRect(),i.height===0&&(s=s.childNodes[0],s===void 0||!s.getBoundingClientRect))return;let o=i.top,a=o+i.height;if(o<0)window.scrollTo(0,window.pageYOffset+i.top-t);else if(a>window.innerHeight){let c=window.pageYOffset+i.top-t;c-window.pageYOffset>r&&(c=window.pageYOffset+r);let f=window.pageYOffset-(window.innerHeight-a);f>c&&(f=c),window.scrollTo(0,f)}}}class Ft{constructor(e){this.tribute=e,this.tribute.search=this}simpleFilter(e,t){return t.filter(i=>this.test(e,i))}test(e,t){return this.match(e,t)!==null}match(e,t,i){i=i||{},t.length;let r=i.pre||"",s=i.post||"",o=i.caseSensitive&&t||t.toLowerCase();if(i.skip)return{rendered:t,score:0};e=i.caseSensitive&&e||e.toLowerCase();let a=this.traverse(o,e,0,0,[]);return a?{rendered:this.render(t,a.cache,r,s),score:a.score}:null}traverse(e,t,i,r,s){if(t.length===r)return{score:this.calculateScore(s),cache:s.slice()};if(e.length===i||t.length-r>e.length-i)return;let o=t[r],a=e.indexOf(o,i),c,f;for(;a>-1;){if(s.push(a),f=this.traverse(e,t,a+1,r+1,s),s.pop(),!f)return c;(!c||c.score{s>0&&(e[s-1]+1===r?i+=i+1:i=1),t+=i}),t}render(e,t,i,r){var s=e.substring(0,t[0]);return t.forEach((o,a)=>{s+=i+e[o]+r+e.substring(o+1,t[a+1]?t[a+1]:e.length)}),s}filter(e,t,i){return i=i||{},t.reduce((r,s,o,a)=>{let c=s;i.extract&&(c=i.extract(s),c||(c=""));let f=this.match(e,c,i);return f!=null&&(r[r.length]={string:f.rendered,score:f.score,index:o,original:s}),r},[]).sort((r,s)=>{let o=s.score-r.score;return o||r.index-s.index})}}class Y{constructor({values:e=null,iframe:t=null,selectClass:i="highlight",containerClass:r="tribute-container",itemClass:s="",trigger:o="@",autocompleteMode:a=!1,selectTemplate:c=null,menuItemTemplate:f=null,lookup:d="key",fillAttr:g="value",collection:h=null,menuContainer:x=null,noMatchTemplate:b=null,requireLeadingSpace:E=!0,allowSpaces:S=!1,replaceTextSuffix:C=null,positionMenu:B=!0,spaceSelectsMatch:D=!1,searchOpts:A={},menuItemLimit:O=null,menuShowMinLength:H=0}){if(this.autocompleteMode=a,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=x,this.allowSpaces=S,this.replaceTextSuffix=C,this.positionMenu=B,this.hasTrailingSpace=!1,this.spaceSelectsMatch=D,this.autocompleteMode&&(o="",S=!1),e)this.collection=[{trigger:o,iframe:t,selectClass:i,containerClass:r,itemClass:s,selectTemplate:(c||Y.defaultSelectTemplate).bind(this),menuItemTemplate:(f||Y.defaultMenuItemTemplate).bind(this),noMatchTemplate:(p=>typeof p=="string"?p.trim()===""?null:p:typeof p=="function"?p.bind(this):b||(function(){return"
  • No Match Found!
  • "}).bind(this))(b),lookup:d,fillAttr:g,values:e,requireLeadingSpace:E,searchOpts:A,menuItemLimit:O,menuShowMinLength:H}];else if(h)this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=h.map(p=>({trigger:p.trigger||o,iframe:p.iframe||t,selectClass:p.selectClass||i,containerClass:p.containerClass||r,itemClass:p.itemClass||s,selectTemplate:(p.selectTemplate||Y.defaultSelectTemplate).bind(this),menuItemTemplate:(p.menuItemTemplate||Y.defaultMenuItemTemplate).bind(this),noMatchTemplate:(w=>typeof w=="string"?w.trim()===""?null:w:typeof w=="function"?w.bind(this):b||(function(){return"
  • No Match Found!
  • "}).bind(this))(b),lookup:p.lookup||d,fillAttr:p.fillAttr||g,values:p.values,requireLeadingSpace:p.requireLeadingSpace,searchOpts:p.searchOpts||A,menuItemLimit:p.menuItemLimit||O,menuShowMinLength:p.menuShowMinLength||H}));else throw new Error("[Tribute] No collection specified.");new Bt(this),new se(this),new Rt(this),new Ft(this)}get isActive(){return this._isActive}set isActive(e){if(this._isActive!=e&&(this._isActive=e,this.current.element)){let t=new CustomEvent(`tribute-active-${e}`);this.current.element.dispatchEvent(t)}}static defaultSelectTemplate(e){return typeof e>"u"?`${this.current.collection.trigger}${this.current.mentionText}`:this.range.isContentEditable(this.current.element)?''+(this.current.collection.trigger+e.original[this.current.collection.fillAttr])+"":this.current.collection.trigger+e.original[this.current.collection.fillAttr]}static defaultMenuItemTemplate(e){return e.string}static inputTypes(){return["TEXTAREA","INPUT"]}triggers(){return this.collection.map(e=>e.trigger)}attach(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if(typeof jQuery<"u"&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array){let i=e.length;for(var t=0;t{if(!this.isActive)return;let s=this.search.filter(this.current.mentionText,r,{pre:this.current.collection.searchOpts.pre||"",post:this.current.collection.searchOpts.post||"",skip:this.current.collection.searchOpts.skip,extract:c=>{if(typeof this.current.collection.lookup=="string")return c[this.current.collection.lookup];if(typeof this.current.collection.lookup=="function")return this.current.collection.lookup(c,this.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});this.current.collection.menuItemLimit&&(s=s.slice(0,this.current.collection.menuItemLimit)),this.current.filteredItems=s;let o=this.menu.querySelector("ul");if(this.range.positionMenuAtCaret(t),!s.length){let c=new CustomEvent("tribute-no-match",{detail:this.menu});this.current.element.dispatchEvent(c),typeof this.current.collection.noMatchTemplate=="function"&&!this.current.collection.noMatchTemplate()||!this.current.collection.noMatchTemplate?this.hideMenu():typeof this.current.collection.noMatchTemplate=="function"?o.innerHTML=this.current.collection.noMatchTemplate():o.innerHTML=this.current.collection.noMatchTemplate;return}o.innerHTML="";let a=this.range.getDocument().createDocumentFragment();s.forEach((c,f)=>{let d=this.range.getDocument().createElement("li");d.setAttribute("data-index",f),d.className=this.current.collection.itemClass,d.addEventListener("mousemove",g=>{let[h,x]=this._findLiTarget(g.target);g.movementY!==0&&this.events.setActiveLi(x)}),this.menuSelected===f&&d.classList.add(this.current.collection.selectClass),d.innerHTML=this.current.collection.menuItemTemplate(c),a.appendChild(d)}),o.appendChild(a)};typeof this.current.collection.values=="function"?this.current.collection.values(this.current.mentionText,i):i(this.current.collection.values)}_findLiTarget(e){if(!e)return[];const t=e.getAttribute("data-index");return t?[e,t]:this._findLiTarget(e.parentNode)}showMenuForCollection(e,t){e!==document.activeElement&&this.placeCaretAtEnd(e),this.current.collection=this.collection[t||0],this.current.externalTrigger=!0,this.current.element=e,e.isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(e,this.current.collection.trigger),this.showMenuFor(e)}placeCaretAtEnd(e){if(e.focus(),typeof window.getSelection<"u"&&typeof document.createRange<"u"){var t=document.createRange();t.selectNodeContents(e),t.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(t)}else if(typeof document.body.createTextRange<"u"){var r=document.body.createTextRange();r.moveToElementText(e),r.collapse(!1),r.select()}}insertTextAtCursor(e){var t,i;t=window.getSelection(),i=t.getRangeAt(0),i.deleteContents();var r=document.createTextNode(e);i.insertNode(r),i.selectNodeContents(r),i.collapse(!1),t.removeAllRanges(),t.addRange(i)}insertAtCaret(e,t){var i=e.scrollTop,r=e.selectionStart,s=e.value.substring(0,r),o=e.value.substring(e.selectionEnd,e.value.length);e.value=s+t+o,r=r+t.length,e.selectionStart=r,e.selectionEnd=r,e.focus(),e.scrollTop=i}hideMenu(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}selectItemAtIndex(e,t){if(e=parseInt(e),typeof e!="number"||isNaN(e))return;let i=this.current.filteredItems[e],r=this.current.collection.selectTemplate(i);r!==null&&this.replaceText(r,t,i)}replaceText(e,t,i){this.range.replaceTriggerText(e,!0,!0,t,i)}_append(e,t,i){if(typeof e.values=="function")throw new Error("Unable to append to values, as it is a function.");i?e.values=t:e.values=e.values.concat(t)}append(e,t,i){let r=parseInt(e);if(typeof r!="number")throw new Error("please provide an index for the collection to update.");let s=this.collection[r];this._append(s,t,i)}appendCurrent(e,t){if(this.isActive)this._append(this.current.collection,e,t);else throw new Error("No active state. Please use append instead and pass an index.")}detach(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if(typeof jQuery<"u"&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array){let i=e.length;for(var t=0;t{e.removeAttribute("data-tribute"),this.isActive=!1,e.tributeMenu&&e.tributeMenu.remove()})}}function Ot(){const n=".kanka-mentions",e=document.querySelector(n);if(!e)return;const t=e.dataset.remote,i=new Y({values:function(o,a){s(o,c=>a(c))},lookup:"name",menuShowMinLength:3,selectTemplate:function(o){return"["+o.original.model_type+":"+o.original.id+"]"},noMatchTemplate:function(){return null}});document.querySelectorAll(n).forEach(o=>{o.dataset.mentions!=="1"&&(o.dataset.mentions=1,i.attach(o))});function s(o,a){let c=new XMLHttpRequest;c.onreadystatechange=function(){if(c.readyState===4)if(c.status===200){let d=JSON.parse(c.responseText);a(d)}else c.status===403&&a([])};let f=t+"?q="+o;c.open("GET",f,!0),c.send()}}const Ye=()=>{document.querySelectorAll("form[data-shortcut]").forEach(function(e){zt(e)})},Ge=()=>{document.addEventListener("keydown",function(n){const e=n.target,t=document.getElementById("primary-dialog"),i=document.querySelector(".quick-creator-button");let r=document.querySelector('[data-keyboard="edit"]');if(n.key==="]"){if(re(e))return;n.preventDefault();const s=document.querySelector(".sidebar-toggle");s.click(),s.blur()}else if(n.key==="k"){if(re(e))return;n.preventDefault(),document.getElementById("entity-lookup").focus()}else if(n.key==="n"&&!(n.ctrlKey||n.metaKey)&&!n.altKey&&i){if(re(e)||t!=null&&t.open)return;i.click()}else if(n.key==="e"&&!(n.ctrlKey||n.metaKey)&&r){if(re(e)||t!=null&&t.open)return;r.click()}else n.key==="Escape"&&(t==null?void 0:t.classList.contains("qq-modal-selection").length)===1&&window.closeDialog(t)})},re=n=>!n||n.length===0?!1:["input","textarea","select"].includes(n.tagName.toLowerCase())||n.getAttribute("contentEditable")==="true"?!0:!!n.classList.contains("CodeMirror"),zt=n=>{n.dataset.shortcutInit||(n.dataset.shortcutInit=1,document.addEventListener("keydown",function(e){if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==="s")return e.preventDefault(),n.dataset.unload&&(window.entityFormHasUnsavedChanges=!1),e.shiftKey?me("submit-update"):e.altKey&&me("submit-new"),n.requestSubmit(),console.log("requested tos ubmit",n),!1;if((e.ctrlKey||e.metaKey)&&e.altKey&&e.key==="c")return n.dataset.unload&&(window.entityFormHasUnsavedChanges=!1),me("submit-copy"),n.submit(),!1}))},me=n=>{const e=document.getElementById("form-submit-main");e&&(e.name=n,document.getElementById("submit-mode").name=n)},$e=()=>{document.querySelectorAll('input[data-paste="fontawesome"]').forEach(function(e){e.addEventListener("paste",function(t){t.preventDefault();const i=(t.clipboardData||window.clipboardData).getData("text");if(i.startsWith('o.json()).then(o=>{s.innerHTML="",o.forEach(a=>{const c=document.createElement("a");c.href=a.url,c.text=a.name,s.appendChild(c)}),o.length>0&&i.classList.remove("hidden")})}))}const Xe=()=>{if(he=document.querySelectorAll(".form-submit-actions"),he.length===0)return;let n=document.getElementById("form-submit-main"),e=document.getElementById("submit-mode");if(e===void 0)throw new Error("No submit mode hidden input found");he.forEach(t=>{t.addEventListener("click",function(i){return i.preventDefault(),e.name=t.dataset.action,n.click(),!1})})};function Kt(){if(document.querySelectorAll('form[data-unload="1"]').length===0)return;const e=document.querySelector("#form-submit-main");document.querySelectorAll('form[data-unload="1"] input, form[data-unload="1"] select, form[data-unload="1"] textarea').forEach(i=>{i.dataset.skipUnsaved||i.classList.contains("form-control")||(i.addEventListener("change",function(){window.entityFormHasUnsavedChanges=!0}),i.classList.contains("select2")&&(i.onchange=()=>{window.entityFormHasUnsavedChanges=!0}))}),e&&window.addEventListener("beforeunload",function(i){window.entityFormHasUnsavedChanges&&(i.preventDefault(),i.returnValue="Unsaved data warning")})}const Wt=()=>{document.querySelectorAll(".dynamic-row-add").forEach(e=>{e.addEventListener("click",function(t){t.preventDefault();const i=e.dataset.target,r=e.dataset.template,s=document.createElement("div");return s.innerHTML=document.querySelector("#"+r).innerHTML,document.querySelector("."+i).append(s),Be(),window.triggerEvent(),!1})}),Be()},Be=()=>{document.querySelectorAll(".dynamic-row-delete").forEach(e=>{e.dataset.init!==1&&(e.dataset.init=1,e.addEventListener("click",function(t){t.preventDefault(),e.closest(".parent-delete-row").remove()}),e.addEventListener("keydown",function(t){t.key==="Enter"&&e.click()}))})};Wt();Xe();Kt();Qt();Ut();const Ze=()=>{const n=document.querySelector(".btn-post-collapse");n==null||n.addEventListener("click",function(t){t.preventDefault(),document.querySelectorAll(".element-toggle").forEach(r=>{r.classList.add("animate-collapsed"),document.querySelector(r.dataset.target).classList.add("hidden")})});const e=document.querySelector(".btn-post-expand");e==null||e.addEventListener("click",function(t){t.preventDefault(),document.querySelectorAll(".element-toggle").forEach(r=>{r.classList.remove("animate-collapsed"),document.querySelector(r.dataset.target).classList.remove("hidden")})})},Je=()=>{const n=document.querySelector(".story-load-more");n==null||n.addEventListener("click",function(e){return e.preventDefault(),this.classList.add("loading"),axios.get(this.dataset.url).then(t=>{n.parentNode.remove(),console.log(t),document.querySelector(".entity-posts").insertAdjacentHTML("beforeend",t.data),Je(),Ze(),window.triggerEvent()}).catch(()=>{n.classList.remove("loading")}),!1})},Vt=()=>{const n=document.querySelector(".domain-trust");n&&n.addEventListener("click",function(e){const t="kanka_trusted_domains";let i=document.cookie.match("(^|;) ?"+t+"=([^;]*)(;|$)");i=i?i[2]:"";const r=n.dataset.domain;i.includes(r)||(i&&(i+="|"),i+=r);let s=new Date;s.setTime(s.getTime()+30*24*60*60*1e3),document.cookie=t+"="+i+";path=/;expires="+s.toUTCString()+";sameSite=Strict"})};Ze();Je();Vt();const et=document.querySelectorAll(".post-perm-add"),Yt=()=>{window.onEvent(function(){$t()}),et.length!==0&&(Gt(),tt())},Gt=()=>{et.forEach(n=>{n.addEventListener("click",function(e){e.preventDefault();let t=this.dataset.type,i=document.querySelector('select[name="'+t+'"]');if(!i||!i.value)return!1;let r=i.textContent;const o=document.getElementById("post-perm-"+t+"-template").cloneNode(!0);return o.classList.remove("hidden"),o.removeAttribute("id"),o.innerHTML=o.innerHTML.replace(/\$SELECTEDID\$/g,i.value).replace(/\$SELECTEDNAME\$/g,r),document.getElementById("post-perm-target").insertAdjacentElement("afterend",o),document.getElementById("post-new-"+t).close(),tt(),i.value="",i.dispatchEvent(new Event("change")),!1})})},tt=()=>{const n=document.querySelectorAll(".post-delete-perm");console.log(n),n.forEach(e=>{e.addEventListener("click",function(t){e.closest(".perm-row").remove(),t.preventDefault(),e.removeEventListener("click",arguments.callee)})})},$t=()=>{const n=document.querySelector("form.post-visibility");n&&(n.onsubmit=function(e){return e.preventDefault(),axios.post(this.getAttribute("action"),{visibility_id:this.querySelector('[name="visibility_id"]').value}).then(t=>{document.getElementById("primary-dialog").close(),document.getElementById("visibility-icon-"+t.data.post_id).firstElementChild.className=t.data.icon.class,window.showToast(t.data.toast)}),!1})};Yt();const Xt=()=>{let n=document.getElementById("post-layout-selector");if(!n)return;const e=document.querySelector(".field-entry"),t=document.querySelector(".field-location"),i=document.querySelector(".field-display"),r=document.querySelector("#post-layout-subform");n.addEventListener("change",function(s){s.preventDefault(),this.value===""?(e.style.removeProperty("display"),e.style.removeProperty("display"),i.style.removeProperty("display"),r.style.display="none"):(e.style.display="none",t.style.display="none",i.style.display="none",r.style.removeProperty("display"))})};Xt();const Zt=()=>{if(!document.querySelector("#calendar-year-switcher"))return;document.querySelectorAll(".calendar-event-block").forEach(e=>{e.dataset.toggle!=="dialog"&&e.dataset.url&&e.addEventListener("click",function(){window.location=e.dataset.url})})},nt=()=>{var s,o,a;const n=document.querySelector('select[name="recurring_periodicity"]');if(!n)return;n.onchange=function(){const c=document.querySelector(".field-recurring-until");n.value?c.classList.remove("hidden"):c.classList.add("hidden")};const e=document.querySelector("#calendar-event-first"),t=document.querySelector(".calendar-new-event-field"),i=document.querySelector(".calendar-existing-event-field"),r=document.querySelector("#calendar-event-subform");(s=document.querySelector("#calendar-action-existing"))==null||s.addEventListener("click",function(c){c.preventDefault(),e.classList.add("!hidden"),t.classList.add("hidden"),i.classList.remove("hidden"),r.classList.remove("hidden")}),(o=document.querySelector("#calendar-action-new"))==null||o.addEventListener("click",function(c){c.preventDefault(),e.classList.add("!hidden"),t.classList.remove("hidden"),i.classList.add("hidden"),r.classList.remove("hidden")}),(a=document.querySelector("#calendar-event-switch"))==null||a.addEventListener("click",function(c){c.preventDefault(),r.classList.add("hidden"),e.classList.remove("!hidden"),i.classList.remove("hidden"),t.classList.remove("hidden")})},Jt=()=>{document.querySelector('[data-shortcut="previous"]')&&document.addEventListener("keydown",function(n){if((n.ctrlKey||n.metaKey)&&n.which===37){const e=document.querySelector('[data-shortcut="previous"]');e.classList.add("loading"),e.click()}else if((n.ctrlKey||n.metaKey)&&n.which===39){const e=document.querySelector('[data-shortcut="next"]');e.classList.add("loading"),e.click()}})};Zt();Jt();document.querySelector('select[name="recurring_periodicity"]')&&nt();window.onEvent(function(){nt()});let G,be,M,pe,V,W,R,z,oe,X;window.onEvent(function(){tn()});const en=()=>{G=document.querySelector("#entity-calendar-form-add"),M=document.querySelector('select[name="calendar_id"]'),pe=document.querySelector('[name="calendar_id"]'),document.querySelector(".entity-calendar-modal-form"),X=document.querySelector(".entity-calendar-subform"),z=document.querySelector("#entity-calendar-form-cancel"),be=document.querySelector(".entity-calendar-form"),W=document.querySelector('input[name="calendar_year"]'),V=document.querySelector('[name="calendar_month"]'),R=document.querySelector("#reminder_day"),oe=document.querySelector(".entity-calendar-loading"),G&&(G.addEventListener("click",function(n){n.preventDefault(),G.classList.add("hidden"),be.classList.remove("hidden");let e=G.dataset.defaultCalendar;return e&&(pe.value=e,z==null||z.classList.remove("hidden"),X.classList.remove("hidden"),le(e)),!1}),z.addEventListener("click",function(n){n.preventDefault(),M&&(M.value=null),pe.value=null,z.classList.add("hidden"),xe()})),M&&(M.onchange=n=>{if(X.classList.add("hidden"),!M.value)return xe(),!1;W=document.querySelector('input[name="calendar_year"]'),V=document.querySelector('[name="calendar_month"]'),R=document.querySelector("#reminder_day"),!W&&document.querySelector('input[name="year"]')&&(W=document.querySelector('input[name="year"]'),V=document.querySelector('select[name="month"]'),R=document.querySelector("#reminder_day")),le(M.value)}),it()},tn=()=>{if(!document.getElementById("entity-calendar-modal-add"))return;G=document.querySelector("input[name=calendar-data-url]"),M=document.querySelector('[name="calendar_id"]'),W=document.querySelector('input[name="year"]'),V=document.querySelector('select[name="month"]'),R=document.querySelector("#reminder_day"),oe=document.querySelector(".entity-calendar-loading"),X=document.querySelector(".entity-calendar-subform"),M&&(M.onchange=e=>{if(X.classList.add("hidden"),!M.value){xe();return}le(M.value)},M!=null&&M.value&&(z==null||z.classList.remove("hidden"),X.classList.remove("hidden"),le(M.value)));const n=document.querySelector('.entity-calendar-subform input[name="length"]');n&&n.addEventListener("focusout",function(){if(!this.value)return;const e=this.dataset.url.replace("/0/","/"+M.value+"/"),t={day:R.value,month:V.value,year:W.value,length:this.value};axios.get(e,{data:t}).then(i=>{const r=document.querySelector(".length-warning");i.data.overflow==!0?r.classList.remove("hidden"):r.classList.add("hidden")})}),it()},le=n=>{oe.classList.remove("hidden"),n=parseInt(n);const e=document.querySelector('input[name="calendar-data-url"]').dataset.url.replace("/0/","/"+n+"/");fetch(e).then(t=>t.json()).then(t=>{let i=R.value;W.innerHTML="",V.innerHTML="",R.innerHTML="";let r=1,s=1;i||(i=t.current.day);let o=parseInt(t.current.month);Object.entries(t.months).forEach((d,g)=>{const h=document.createElement("option");h.text=d[1].name,h.value=g+1,d[0]===o&&(h.selected=!0),h.dataset.length=d[1].length,V.appendChild(h),r===o&&(s=d[1].length),r++});for(let d=1;d<=s;d++){const g=document.createElement("option");g.text=d,g.value=d,d==i&&(g.selected=!0),R.appendChild(g)}oe.classList.add("hidden"),X.classList.remove("hidden"),W.value=t.current.year;const c=document.querySelector("select.reminder-periodicity");for(;c.options.length>0;)c.options.remove(0);Object.entries(t.recurring).forEach((d,g)=>{const h=document.createElement("option");h.value=d[0],h.text=d[1],c.appendChild(h)}),document.querySelector("#reminder_length").value=1,t.length===1&&(V.value=t[0].id)})},xe=()=>{be.classList.add("hidden"),G.classList.remove("hidden"),document.querySelector('[name="calendar_day"]').value=null,document.querySelector('[name="calendar_month"]').value=null,document.querySelector('input[name="calendar_year"]').value=null,document.querySelector('[name="calendar_id"]').value=null},it=()=>{const n=document.querySelector("#reminder_month");n&&n.addEventListener("change",function(e){const i=n.options[n.selectedIndex].dataset.length;nn(i)})},nn=n=>{let e=parseInt(R.value);n=parseInt(n),e>n&&(e=n),R.innerHTML="";for(let t=1;t<=n;t++){const i=document.createElement("option");i.text=t,i.value=t,t===e&&(i.selected=!0),R.appendChild(i)}};en();const rt=document.querySelector("dialog#edit-warning"),ke=300*1e3;let rn=document.querySelector('input[name="edit-warning"]'),st,Le=!0;const sn=()=>{rt&&(window.openDialog("edit-warning",rn.dataset.url),window.onEvent(function(){on()}),ln())};function on(){Le=!1;const n=document.getElementById("entity-edit-warning-ignore");n.addEventListener("click",function(e){e.preventDefault(),Le=!0,axios.post(n.dataset.url).then(()=>{rt.close()})})}const ln=()=>{const n=document.getElementById("editing-keep-alive");n&&(st=n.dataset.url,setTimeout(Se,ke))},Se=()=>{if(!Le){setTimeout(Se,ke);return}axios.post(st).then(()=>{setTimeout(Se,ke)})};window.onReady(()=>{sn()});let ee,ot,lt,ie;const Te=()=>{ot=document.querySelector("#qq-modal-loading"),lt=document.querySelector("#qq-modal-selection"),ie=document.querySelector("#qq-modal-form"),document.querySelectorAll('[data-toggle="entity-creator"]').forEach(n=>{n.addEventListener("click",an)})},an=n=>{var i;n.preventDefault();const e=n.currentTarget;return e.dataset.type==="inline"?(document.querySelector(".quick-creator-body").classList.add("hidden"),(i=document.querySelector(".quick-creator-footer"))==null||i.classList.add("hidden"),document.querySelector(".quick-creator-loading").classList.remove("!hidden")):cn(),axios.get(e.dataset.url).then(r=>{ot.classList.add("!hidden"),lt.classList.add("!hidden"),ie.innerHTML=r.data,ie.classList.remove("!hidden"),Ce(),qe(),window.triggerEvent()}),!1},at=()=>{const n=document.querySelector("#qq-name-field");!n||n.dataset.init==="1"||(n.dataset.init="1",n.addEventListener("focusout",function(){if(!this.value)return;const e=this.parentNode.querySelector(".duplicate-entity-warning");e.classList.add("hidden");const t=this.dataset.live+"?q="+this.value+"&type="+this.dataset.type;axios.get(t).then(i=>{if(i.data.length===0){e.classList.add("hidden");return}const r=Object.keys(i.data).map(function(s){return''+i.data[s].name+""}).join(", ");n.parentNode.querySelector(".duplicate-entities").innerHTML=r,e.classList.remove("hidden")})}))},cn=()=>{document.querySelector("#qq-modal-form").classList.add("!hidden"),document.querySelector("#qq-modal-selection").classList.add("!hidden"),document.querySelector("#qq-modal-loading").classList.remove("!hidden")},Ce=()=>{ee=document.querySelectorAll(".quick-creator-submit"),ee.length!==0&&(at(),qe(),ee.forEach(n=>{n.addEventListener("click",function(e){let t=this.value;return t&&(document.querySelector('#entity-creator-form [name="action"]').value=t),!0})}),document.getElementById("entity-creator-form").onsubmit=function(n){const e=n.target;n.preventDefault(),ee.forEach(r=>r.classList.add("btn-disabled","loading")),document.querySelectorAll("div.text-error").forEach(r=>r.remove());const i=new FormData(e);axios.post(e.getAttribute("action"),i).then(r=>{var o,a;if(typeof r.data=="object"){if(r.data.redirect){window.location.replace(r.data.redirect);return}let c=new Option(r.data._name,r.data._id),f=document.querySelector("#"+r.data._target);if(r.data._multi){let h=f.value;h.push(r.data._id),f.appendChild(c),f.value=h}else{for(;f.options.length>0;)f.options.remove(0);f.appendChild(c),f.value=r.data._id}f.dispatchEvent(new Event("change"));const d=document.querySelector("#qq-modal-form");d&&(d.innerHTML="",d.classList.remove("!hidden")),(o=document.querySelector("#qq-modal-loading"))==null||o.classList.add("!hidden"),(a=document.querySelector("#qq-modal-selection"))==null||a.classList.remove("!hidden"),document.getElementById("primary-dialog").close(),_e();return}let s=document.getElementById("qq-modal-form");s.innerHTML=r.data,window.triggerEvent(),Te(),_e()}).catch(r=>{r.response&&window.formErrorHandler(r.response,e),ee.forEach(s=>s.classList.remove("btn-disabled","loading")),document.querySelector('#entity-creator-form [name="action"]').value=""})})},qe=()=>{var n;document.querySelectorAll(".qq-mode-toggle").forEach(e=>{e.addEventListener("click",function(t){var i;t.preventDefault(),!this.classList.contains("active")&&(document.querySelector(".qq-mode-toggle").classList.remove("active"),this.classList.add("active"),document.querySelector(".quick-creator-body").classList.add("hidden"),(i=document.querySelector(".quick-creator-footer"))==null||i.classList.add("hidden"),document.querySelector(".quick-creator-loading").classList.remove("!hidden"),axios.get(this.dataset.url).then(r=>{ie.innerHTML=r.data,ie.classList.remove("!hidden"),_e(),window.triggerEvent()}))})}),(n=document.querySelector(".qq-action-more"))==null||n.addEventListener("click",function(e){e.preventDefault(),this.classList.add("hidden"),document.querySelector(".qq-more-fields").classList.remove("hidden")}),Te()},_e=()=>{qe(),at(),Ce()},un=()=>{document.querySelectorAll(".quick-creator-subform").forEach(e=>{e.addEventListener("click",t=>{window.openDialog("primary-dialog",e.dataset.url)})})};window.onEvent(function(){Te(),Ce()});un();const ct=()=>{const n=document.querySelectorAll("[data-bulk-action]");n==null||n.forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),mn(t.dataset.bulkAction)})});const e=document.querySelectorAll(".bulk-print");e==null||e.forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),t.closest("form").requestSubmit()})})},dn=()=>{fn();const n=document.querySelectorAll("input[name='model[]']");n==null||n.forEach(e=>{e.addEventListener("change",t=>{t.preventDefault(),Me()})})},fn=()=>{const n=document.querySelector("#datagrid-select-all");n&&n.dataset.loaded!=="1"&&(n.dataset.loaded="1",n.addEventListener("click",function(e){const t=document.querySelectorAll("input[name='model[]']");n.checked?t==null||t.forEach(i=>{i.checked=!0}):t==null||t.forEach(i=>{i.checked=!1}),Me()}))},mn=n=>{let e=[];const t=document.querySelectorAll("input[name='model[]']");t==null||t.forEach(i=>{i.checked&&e.push(i.value)}),n==="ajax"?window.onEvent(function(){document.querySelector('#primary-dialog input[name="models"]').value=e.toString()}):document.querySelector("#datagrid-bulk-"+n+"-models").value=e.toString()},Me=()=>{let n=!0;const e=document.querySelectorAll("input[name='model[]']");e==null||e.forEach(i=>{i.checked&&(n=!1)});const t=document.querySelectorAll(".datagrid-bulk-actions .btn2");t==null||t.forEach(i=>{n?(i.disabled=!0,i.classList.add("btn-disabled")):(i.disabled=!1,i.classList.remove("btn-disabled","disabled"))})},hn=()=>{const n=document.querySelector(".list-treeview");if(!n)return;let e=n.dataset.url;document.querySelectorAll(".table-nested > tbody > tr").forEach(function(i){let r=i.dataset.children;parseInt(r)>0&&(i.classList.add("tr-hover"),i.classList.add("cursor-pointer"),i.addEventListener("click",function(s){const o=s.target;s.target.type!=="checkbox"&&o.dataset.tree!=="escape"&&(window.location=e+"?parent_id="+i.dataset.id+"&m=table")}))})};dn();ct();Me();hn();window.onEvent(function(){ct()});let J;const pn=new IntersectionObserver(function(n){n.forEach(e=>{e.isIntersecting===!0&&Ae(e.target)})},{threshold:[0]}),ut=()=>{const n=document.querySelectorAll('table[data-render="datagrid2"]');n==null||n.forEach(e=>{Ae(e)})},Ae=n=>{n.dataset.initiated!=="1"&&(n.dataset.initiayed="1",gn(n),yn(n),n.dataset.url&&Ee(n,n))},gn=n=>{var e,t;(e=n.querySelectorAll("thead a"))==null||e.forEach(i=>{i.dataset.loaded!=="1"&&(i.dataset.loaded="1",i.addEventListener("click",function(r){r.preventDefault(),Ee(i,n)}))}),(t=n.parentNode.querySelectorAll('nav[role="navigation"] a'))==null||t.forEach(i=>{i.dataset.loaded!=="1"&&(i.dataset.loaded="1",i.addEventListener("click",r=>{r.preventDefault(),Ee(i,n)}))})},vn=()=>{const n=document.querySelectorAll('[data-render="datagrid2-onload"]');n.length!==0&&n.forEach(e=>{pn.observe(e)})},Ee=(n,e)=>{var i,r,s;(i=e.querySelector("thead"))==null||i.classList.add("hidden"),(r=e.querySelector("tbody"))==null||r.classList.add("hidden"),(s=e.querySelector("tfoot"))==null||s.classList.remove("hidden");let t=n.getAttribute("href");n.dataset.url&&(t=n.dataset.url),e.parentNode&&axios.get(t).then(o=>{const a=e.parentNode;if(o.data.html&&(a.innerHTML=o.data.html),o.data.deletes){const f=document.querySelector("#datagrid-delete-forms");f&&(f.innerHTML=o.data.deletes)}o.data.url&&window.history.pushState({},"",o.data.url);const c=a.querySelector('[data-render="datagrid2"]');Ae(c),window.triggerEvent()}).catch(o=>{})},yn=n=>{var r;const e=n.parentNode,t=e.querySelectorAll(".datagrid-bulk");t==null||t.forEach(s=>{wn(n,s)});const i=e.querySelectorAll(".datagrid-submit");i==null||i.forEach(s=>{s.addEventListener("click",function(o){var c;o.preventDefault(),J=s.closest("form");const a=J.querySelector('input[name="action"]');if(a.value=s.dataset.action,s.dataset.action==="delete")return window.openDialog("datagrid-bulk-delete"),!1;(c=n.parentNode.querySelectorAll(".datagrid-bulk-actions .btn2"))==null||c.forEach(f=>f.classList.add("btn-disabled")),n.parentNode.querySelector(".datagrid-bulk-actions .btn2").classList.add("loading"),J.submit()})}),(r=document.querySelector("#datagrid-action-confirm"))==null||r.addEventListener("click",function(){window.closeDialog("datagrid-bulk-delete"),J.submit()})},wn=(n,e)=>{e.dataset.loaded!=="1"&&(e.dataset.loaded="1",e.addEventListener("click",function(t){t.preventDefault(),J=n.closest("form"),axios.post(J.getAttribute("action")+"?action=edit",{model:bn(n)}).done(i=>{const r=document.getElementById("primary-dialog");r.innerHTML=i.data,window.openDialog("primary-dialog"),window.triggerEvent()})}))},bn=n=>{let e=[];const t=n.querySelectorAll("input[name='model[]']");return t==null||t.forEach(i=>{i.checked&&e.push(i.value)}),e};vn();ut();window.onEvent(function(){ut()});const dt=()=>{document.querySelectorAll('[data-animate="collapse"]').forEach(t=>{t.addEventListener("click",xn)}),document.querySelectorAll('[data-animate="reveal"]').forEach(t=>{t.addEventListener("change",kn)})};function xn(n){let e=this.dataset.target;e||(e=this.hash),document.querySelectorAll(e).forEach(i=>{i.classList.toggle("hidden")}),this.classList.toggle("animate-collapsed")}function kn(n){let e=document.querySelector(this.dataset.target);this.value?e.classList.remove("hidden"):e.classList.add("hidden")}window.onEvent(function(){dt()});dt();const Ln=()=>{const n=document.getElementById("bookmark-selector");if(!n)return!1;n.addEventListener("change",function(e){e.preventDefault();let t=n.options[n.selectedIndex];document.querySelectorAll(".bookmark-subform").forEach(s=>{s.classList.add("hidden")});let r=document.querySelector(t.dataset.target);r&&r.classList.remove("hidden")})},Sn=()=>{const n=document.getElementById("entity-selector");if(n)n.value!==""&&document.getElementById("filter-subform").style.removeProperty("display");else return!1;n.addEventListener("change",function(){n.value===""?document.getElementById("filter-subform").style.display="none":document.getElementById("filter-subform").style.removeProperty("display")})};Ln();Sn();const _n=()=>{let n=document.getElementById("webhook-selector");if(!n)return!1;n.addEventListener("change",function(e){var i;e.preventDefault();let t=this.options[this.selectedIndex];document.querySelector(".webhook-subform").classList.add("hidden"),(i=document.querySelector(t.dataset.target))==null||i.classList.remove("hidden")})};_n();window.onEvent(function(){ft()});const ft=()=>{document.querySelectorAll(".form-members").forEach(e=>{if(e.dataset.loaded===1)return;e.dataset.loaded=1;let t=e.dataset.allowClear;$(e).select2({tags:!0,allowClear:t||!0,minimumInputLength:2,ajax:{quietMillis:500,delay:500,url:e.dataset.url,dataType:"json",data:function(i){var r;return{q:(r=i.term)==null?void 0:r.trim()}},processResults:function(i){return{results:i}},cache:!0},createTag:function(){}})})};ft();const En=()=>{if(!document.getElementById("campaign-modules"))return;document.querySelectorAll('input[name="enabled"]').forEach(function(t){Tn(t)})},Tn=n=>{n.addEventListener("change",function(e){e.preventDefault(),n.closest(".toggle").classList.add("!hidden"),n.closest(".box-module").querySelector(".action-loading").classList.remove("hidden"),axios.post(n.dataset.url).then(t=>{n.closest(".toggle").classList.remove("!hidden"),n.closest(".box-module").querySelector(".action-loading").classList.add("hidden"),t.data.success&&(t.data.status?n.closest(".box-module").classList.add("module-enabled"):n.closest(".box-module").classList.remove("module-enabled"),window.showToast(t.data.toast))})})},Cn=()=>{document.querySelectorAll(".public-permission").forEach(e=>{e.addEventListener("click",qn)})},qn=n=>{n.preventDefault();let e=n.currentTarget;e.querySelector(".module-icon").classList.add("hidden"),e.querySelector(".loading-animation").classList.remove("hidden"),axios.post(e.dataset.url).then(t=>{e.querySelector(".module-icon").classList.remove("hidden"),e.querySelector(".loading-animation").classList.add("hidden"),t.data.success&&(t.data.status?e.classList.add("enabled"):e.classList.remove("enabled"),window.showToast(t.data.toast))})},Mn=()=>{document.querySelectorAll(".codemirror").forEach(function(e){CodeMirror.fromTextArea(document.getElementById(e.id),{extraKeys:{"Ctrl-Space":"autocomplete"},lineNumbers:!0,lineWrapping:!0,theme:"dracula"})})},An=()=>{let n=[].slice.call(document.querySelectorAll(".nested-sortable"));for(let e=0;e{const n=document.querySelector("form#campaign-style");n&&n.addEventListener("submit",function(e){let t=document.querySelector(n.dataset.error);return document.querySelector('textarea[name="content"]').value.length{const n=document.querySelector('input[name="vanity"]');n&&n.addEventListener("focusout",function(e){let t=this.value,i=document.getElementById("vanity-error"),r=document.getElementById("vanity-success"),s=document.getElementById("vanity-loading");if(i.innerHTML="",i.classList.add("hidden"),r.classList.add("hidden"),!t)return;r.classList.remove("hidden");let o={};o.vanity=t,axios.post(this.dataset.url,o).then(a=>{n.value=a.data.vanity,r.querySelector("code").innerHTML=a.data.vanity,i.classList.add("hidden"),s.classList.add("hidden"),r.classList.remove("hidden")}).catch(a=>{let c="";a.response.data.errors.vanity.forEach(f=>c+=f+" "),i.innerHTML=c,i.classList.remove("hidden"),r.classList.add("hidden"),s.classList.add("hidden")})})},Hn=()=>{document.querySelectorAll(".permission-toggle").forEach(e=>{e.addEventListener("change",function(t){let i=this.dataset.action;document.querySelectorAll('input[data-action="'+i+'"]').forEach(s=>{this.checked?s.checked=!0:s.checked=!1})})})};En();Mn();An();Cn();In();Dn();Hn();const mt=()=>{document.querySelectorAll("[data-clipboard]").forEach(e=>{e.addEventListener("click",Pn,!1)})};function Pn(n){n.preventDefault(),jn(this.dataset.clipboard,this);let e=this.dataset.toast;return e&&window.showToast(e),!1}async function jn(n,e){if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(n);else{const t=document.createElement("textarea");t.value=n,t.style.position="absolute",t.style.left="-999999px",e.append(t),t.select();try{document.execCommand("copy")}catch(i){console.error(i)}finally{t.remove()}}}mt();window.onEvent(function(){mt()});const ht=()=>{document.querySelectorAll('.toast-container [data-toggle="dismiss"]').forEach(e=>{e.dataset.init!=="1"&&(e.dataset.init="1",e.addEventListener("click",function(t){t.preventDefault();let i=e.closest(".toast-message");i.classList.remove("opacity-100"),i.classList.add("opacity-0"),setTimeout(function(){i.remove()},150)}))})};window.showToast=function(n,e){e=e||"bg-success text-success-content",e==="error"&&(e="bg-error text-error-content");const t=document.createElement("div");t.classList.add("opacity-100","duration-150","transition-opacity","rounded"),e&&e.split(" ").forEach(r=>{t.classList.add(r)}),t.innerHTML='
    '+n+'
    ',document.querySelector(".toast-container").appendChild(t),setTimeout(function(){t.classList.remove("opacity-100"),t.classList.add("opacity-0"),setTimeout(function(){t.remove()},150)},3e3),ht()};ht();const Nn=()=>{document.querySelectorAll(".banner-notification-dismiss").forEach(n=>{n.addEventListener("click",Rn,!1)}),document.querySelectorAll('[data-dismiss="tutorial"]').forEach(n=>{n.addEventListener("click",Bn,!1)})};function Rn(n){n.preventDefault();let e=this.dataset.dismiss;axios.post(this.dataset.url).then(()=>{if(!e)return;let t=document.querySelector(e);t&&t.classList.add("hidden")})}function Bn(n){var i;n.preventDefault();let e=this.dataset.target,t=n.currentTarget;t.classList.add("loading"),t.disabled=!0,(i=t.querySelector("i"))==null||i.remove(),axios.post(this.dataset.url).then(()=>{if(!e)return;let r=document.querySelector(e);r&&r.classList.add("hidden")})}Nn();let pt;const Fn=()=>{const n=document.getElementById("element-era-id");n&&(pt=n.value,n.addEventListener("change",function(){On(n.value)}))},On=n=>{n=parseInt(n);let e=document.querySelector('input[name="era-data-url"]').dataset.url.replace("/0/","/"+n+"/"),t=document.querySelector('input[name="oldPosition"]').dataset.url;axios.get(e).then(i=>{let r=document.querySelector('select[name="position"]');r.innerHTML="";let s=1;Object.entries(i.data.positions).forEach(function(a,c){const f=document.createElement("option");f.text=a[1],t&&!c&&pt==n&&(f.value=1,r.appendChild(f)),c&&(f.value=s,r.appendChild(f)),s++})})};Fn();window.initSortable=function(){let n=document.querySelectorAll(".sortable-elements");n.length!==0&&n.forEach(e=>{let t={},i=e.dataset.handle;i&&(t.handle=i),ze.create(e,t)})};window.initSortable();window.formErrorHandler=function(n,e){document.querySelectorAll(".input-error").forEach(d=>{d.classList.remove("input-error")});const i=document.querySelector(".text-error");i&&i.remove();const r=e.querySelector(".btn-primary");if(r&&(r.disabled=!1,r.classList.remove("loading")),n.status===503){window.showToast(n.data.message,"error");return}if(n.status===403){document.querySelector("#entity-form-403-error").classList.remove("hidden");return}if(!n.data.errors){window.showToast("Backend error","error");return}const s=n.data.errors;let o=[];const a=Object.keys(s);let c=!0;a.forEach(function(d){let g=document.querySelector('[name="'+d+'"]');if(g){g.classList.add("input-error");const h=document.createElement("div");h.classList.add("text-error"),h.innerHTML=s[d][0],g.parentNode.append(h)}else c=!1,o.push(s[d][0]);window.showToast(s[d][0],"error")});const f=document.querySelector("#entity-form-generic-error .error-logs");!c&&f&&(f.innerHTML="",o.forEach(function(d){f.append(d)}),document.querySelector("#entity-form-generic-error").classList.remove("hidden")),zn(e,s)};const zn=(n,e)=>{const t=Object.keys(e)[0],i=n.querySelector('[name="'+t+'"]');if(!i)return;if(!n.querySelector(".tab-content")){Fe(i);return}document.querySelector(".tab-content .active").classList.remove("active"),document.querySelector(".nav-tabs li.active").classList.remove("active");const r=document.querySelector('[name="'+t+'"').closest(".tab-pane");r&&(r.classList.add("active"),document.querySelector('a[href="#'+r.id+'"]').closest("li").classList.add("active")),Fe(i)},Fe=n=>{n.focus(),n.scrollIntoView({behavior:"smooth"})};window.onEvent(function(){gt()});const gt=()=>{document.querySelectorAll('[data-toggle="private"]').forEach(e=>{Qn(e)})},Qn=n=>{n.dataset.togglerinit!=="1"&&(n.dataset.togglerinit="1",n.addEventListener("click",function(e){const t=n.previousElementSibling;n.classList.contains("fa-lock-keyhole")?(n.classList.remove("fa-lock-keyhole","fa-solid"),n.classList.add("fa-unlock-keyhole","fa-regular"),n.setAttribute("title",n.dataset.public),t.value=0):(n.classList.remove("fa-unlock-keyhole","fa-regular"),n.classList.add("fa-lock-keyhole","fa-solid"),n.setAttribute("title",n.dataset.private),t.value=1)}))},Un=()=>{const n=document.querySelector('input[data-toggle="entity-privacy"]');n&&n.addEventListener("change",function(){let e=document.getElementById("entity-is-private");this.checked?e.classList.remove("hidden"):e.classList.add("hidden")})};gt();Un();const Kn={class:"mx-5"},Wn=["data-title"],Vn={class:"sr-only"},Yn=Z({__name:"NavToggler",props:{text:{},title:{}},setup(n){const e=n,t=()=>{const s=document.querySelector("body");s.classList.contains("sidebar-collapse")?(s.classList.remove("sidebar-collapse"),i(!1)):(s.classList.add("sidebar-collapse"),i(!0))},i=s=>{let o=new Date;const a=90;o.setTime(o.getTime()+a*24*60*60*1e3);let c=" expires="+o.toGMTString(),f=location.protocol==="https:"?"secure; ":"";document.cookie="toggleState="+(s?"collapsed":"open")+"; path=/; "+f+"samesite=lax; "+c},r=()=>{let o=new RegExp("toggleState=([^;]+)").exec(document.cookie);(o!=null?decodeURI(o[1]):null)==="collapsed"&&document.querySelector("body").classList.add("sidebar-collapse")};return Qe(()=>{r()}),(s,o)=>(u(),m("div",Kn,[l("span",{role:"button",class:"sidebar-toggle text-center cursor-pointer fill-current hover:text-primary-focus","data-toggle":"tooltip","data-title":e.title,"data-placement":"right","data-html":"true",tabindex:"3",onClick:o[0]||(o[0]=a=>t())},[o[1]||(o[1]=l("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"},[l("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)),o[2]||(o[2]=l("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"},[l("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)),l("span",Vn,v(e.text),1)],8,Wn)]))}}),Gn=["data-id"],$n={class:"flex-none"},Xn=["href","title"],Zn={class:"flex-grow truncate pl-1"},Jn=["title","innerHTML"],ei=["innerHTML"],vt=Z({__name:"LookupEntity",props:{entity:{}},emits:["preview"],setup(n,{emit:e}){const t=e,i=s=>"url('"+s.image+"')",r=s=>{t("preview",s)};return(s,o)=>(u(),m("div",{class:"flex justify-center gap-1 cursor-pointer hover:bg-base-200 rounded w-full","data-id":s.entity.id,onClick:o[1]||(o[1]=a=>r(s.entity))},[l("div",$n,[l("a",{href:s.entity.link,style:Q({backgroundImage:i(s.entity)}),onClick:o[0]||(o[0]=ye(()=>{},["stop"])),title:s.entity.name,class:"rounded cover-background block h-16 w-16"},null,12,Xn)]),l("div",Zn,[l("div",{class:"font-extrabold entity-name truncate",title:s.entity.name,innerHTML:s.entity.name},null,8,Jn),l("div",{class:"entity-type text-xs",innerHTML:s.entity.type},null,8,ei)])],8,Gn))}}),ti=["href"],ni={class:"flex-grow truncate"},ii=["title","innerHTML"],ri=Z({__name:"LookupPage",props:{page:{}},setup(n){return(e,t)=>(u(),m("a",{class:"flex justify-center gap-2 cursor-pointer w-full",href:e.page.url},[t[0]||(t[0]=l("div",{class:"flex-none h-4 w-4"},[l("i",{class:"fa-solid fa-angles-right","aria-hidden":"true"})],-1)),l("div",ni,[l("div",{class:"entity-name truncate",title:e.page.name,innerHTML:e.page.name},null,8,ii)])],8,ti))}}),si={props:["entity"],components:{LookupEntity:vt},data(){return{focus_profile:!0,focus_pins:!1,focus_access:!1}},methods:{hasTitle(){return this.entity.title},tagClass(n){let e="inline-block rounded-xl px-3 py-1 bg-base-100 text-base-content text-xs";return n.colour&&(e+=" bg-"+n.colour,n.colour==="black"&&(e+=" text-white")),e},backgroundImage:function(){return"url('"+this.entity.image+"')"},tabClass:function(n){let e="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 n==="profile"&&this.focus_profile||n==="links"&&this.focus_pins||n==="access"&&this.focus_access?e+=" font-black border-slate-600":e+=" cursor-pointer border-base-100",e},switchTab:function(n){this.focus_profile=!1,this.focus_pins=!1,this.focus_access=!1,n==="profile"?this.focus_profile=!0:n==="links"?this.focus_pins=!0:n==="access"&&(this.focus_access=!0)},profileClass:function(n){return"entity-profile-"+n.slug}}},oi={class:"entity-header p-3 bg-entity-focus"},li={class:"w-full flex items-center"},ai=["href","title","innerHTML"],ci={key:0,class:"fa-solid fa-skull mx-2","aria-hidden":"true"},ui=["href"],di=["innerHTML"],fi={key:1,class:"my-1 w-full flex flex-wrap gap-1"},mi=["href","data-tag-id","data-tag-slug","innerHTML"],hi=["href","data-tag"],pi=["href","title"],gi={class:"entity-sections"},vi={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"},yi={key:0,class:"tab-profile p-5 flex flex-col gap-5"},wi={key:0,class:"entity-pinned-attributes flex flex-col gap-3"},bi=["data-attribute","data-target"],xi=["innerHTML"],ki=["innerHTML"],Li={key:1},Si={class:"flex flex-col gap-3"},_i=["innerHTML"],Ei=["innerHTML"],Ti={key:1,class:"tab-links p-3"},Ci={key:0,class:"text-center italic"};function qi(n,e,t,i,r,s){const o=U("LookupEntity");return u(),m(q,null,[l("div",oi,[l("div",li,[l("a",{class:"text-2xl font-extrabold entity-name",href:t.entity.link,title:t.entity.name,innerHTML:t.entity.name},null,8,ai),t.entity.is_dead?(u(),m("i",ci)):y("",!0),l("a",{class:"ml-2 text-xs",target:"_blank",href:t.entity.link},e[3]||(e[3]=[l("i",{class:"fa-solid fa-external-link","aria-hidden":"true","aria-label":"Open in a new window"},null,-1)]),8,ui)]),s.hasTitle()?(u(),m("div",{key:0,class:"block w-full",innerHTML:t.entity.title},null,8,di)):y("",!0),t.entity.tags.length>0?(u(),m("div",fi,[(u(!0),m(q,null,I(t.entity.tags,a=>(u(),m("a",{class:_(s.tagClass(a)),href:a.link,"data-tag-id":a.id,"data-tag-slug":a.slug,innerHTML:a.name},null,10,mi))),256))])):y("",!0),t.entity.location?(u(),m("a",{key:2,class:"block w-full cursor-pointer my-2",href:t.entity.location.link,"data-tag":t.entity.id},[e[4]||(e[4]=l("i",{class:"fa-duotone circle-location-arrow","aria-hidden":"true","aria-label":"Location"},null,-1)),N(" "+v(t.entity.location.name),1)],8,hi)):y("",!0),t.entity.image?(u(),m("a",{key:3,href:t.entity.link,style:Q({backgroundImage:s.backgroundImage()}),title:t.entity.name,class:"rounded cover-background block w-full aspect-square"},null,12,pi)):y("",!0)]),l("div",gi,[l("div",vi,[l("div",{class:_(s.tabClass("profile")),onClick:e[0]||(e[0]=a=>s.switchTab("profile"))},v(t.entity.texts.profile),3),l("div",{class:_(s.tabClass("links")),onClick:e[1]||(e[1]=a=>s.switchTab("links"))},v(t.entity.texts.connections),3),l("div",{class:_(s.tabClass("access")),onClick:e[2]||(e[2]=a=>s.switchTab("access"))},null,2)]),r.focus_profile?(u(),m("div",yi,[t.entity.attributes.length>0?(u(),m("div",wi,[(u(!0),m(q,null,I(t.entity.attributes,a=>(u(),m("div",{class:"","data-attribute":a.name,"data-target":a.id},[l("span",{class:"inline-block uppercase font-extrabold mr-1",innerHTML:a.name},null,8,xi),l("span",{innerHTML:a.value},null,8,ki)],8,bi))),256))])):y("",!0),t.entity.attributes.length>0?(u(),m("hr",Li)):y("",!0),l("div",Si,[(u(!0),m(q,null,I(t.entity.profile,a=>(u(),m("div",{class:_(["",s.profileClass(a)])},[l("div",{class:"uppercase font-extrabold truncate",innerHTML:a.field},null,8,_i),l("div",{innerHTML:a.value},null,8,Ei)],2))),256))])])):y("",!0),r.focus_pins?(u(),m("div",Ti,[(u(!0),m(q,null,I(t.entity.connections,a=>(u(),K(o,{entity:a},null,8,["entity"]))),256)),t.entity.connections.length===0?(u(),m("p",Ci,v(t.entity.texts["no-connections"]),1)):y("",!0)])):y("",!0)])],64)}const Mi=ce(si,[["render",qi]]),Ai={directives:{clickOutside:We.directive},props:{api_lookup:String,api_recent:String,placeholder:String,keyboard_tooltip:String},components:{LookupEntity:vt,EntityPreview:Mi,LookupPage:ri},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:[],pages:[],cached:{},cachedPages:{},has_recent:!1,texts:{},timeout_id:null,preview_entity:null}},watch:{term(n,e){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 n=this.term.trim(),e=n.toLowerCase().replace(/ /g,"-").replace(/ [^\w-]+/g,"");if(this.cached[e])return this.displayCached(e);fetch(this.api_lookup+"?"+new URLSearchParams({q:n,v2:!0})).then(t=>t.json()).then(t=>this.parseLookupResponse(t,e))},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(n=>n.json()).then(n=>{this.recent=n.recent,this.bookmarks=n.bookmarks,this.indexes=n.indexes,this.texts.recents=n.texts.recents,this.texts.results=n.texts.results,this.texts.hint=n.texts.hint,this.texts.bookmarks=n.texts.bookmarks,this.texts.index=n.texts.index,this.texts.keyboard=n.texts.keyboard,this.texts.empty_results=n.texts.empty_results,this.texts.fulltext=n.texts.fulltext,this.texts.fulltext_route=n.fulltext_route,this.show_loading=!1,this.show_recent=!0,this.has_recent=!0,this.show_bookmarks=this.bookmarks.length>0}).catch(n=>{this.show_loading=!1,this.show_recent=!0,this.has_recent=!1})},parseLookupResponse(n,e){this.results=n.entities,this.pages=n.pages,this.cached[e]=n.entities,this.cachedPages[e]=n.pages,this.showResults()},displayCached(n){this.results=this.cached[n],this.pages=this.cachedPages[n],this.showResults()},showResults(){this.timeout_id=null,this.show_preview=!1,this.show_loading=!1,this.show_results=!0},loadPreview(n){this.show_loading=!0,fetch(n.preview).then(e=>e.json()).then(e=>this.parsePreviewResponse(e))},parsePreviewResponse(n){this.preview_entity=n,this.show_loading=!1,this.show_preview=!0,this.show_recent=!1},onClickOutside(n){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(n){return n&&this.show_bookmarks||!n&&!this.show_bookmarks?" underline":""}}},Ii={class:"flex grow mr-2"},Di={class:"relative grow field flex items-center"},Hi=["placeholder"],Pi={class:"absolute right-1 hidden md:inline"},ji=["data-title"],Ni={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"},Ri={key:0,class:"text-center"},Bi={key:1,class:"search-recent bg-lookup p-2 min-h-full shadow-r flex flex-col items-stretch"},Fi={key:0,class:"flex-none"},Oi={class:"italic text-xs text-center"},zi={class:"grow flex flex-col gap-5 p-2"},Qi={key:0,class:"search-results flex flex-col gap-2"},Ui={class:"text-sm uppercase"},Ki={key:0,class:"text-neutral-content text-sm"},Wi={key:1,class:"flex flex-col gap-2"},Vi=["href"],Yi={key:1,class:"recent-searches flex flex-col gap-2"},Gi={class:"text-sm uppercase"},$i={key:2,class:"flex gap-5 justify-center"},Xi={key:3,class:"flex flex-col gap-4"},Zi=["href","title"],Ji=["innerHTML"],er={key:4,class:"flex flex-col gap-4"},tr=["href","title"],nr=["innerHTML"],ir={key:1,class:"flex-none text-xs text-center"},rr=["innerHTML"],sr={key:2,class:"search-preview bg-lookup min-h-full shadow-r"};function or(n,e,t,i,r,s){const o=U("LookupEntity"),a=U("LookupPage"),c=U("EntityPreview"),f=Ue("click-outside");return ne((u(),m("div",Ii,[l("div",Di,[ne(l("input",{type:"text",class:"leading-4 w-20 md:w-full",maxlength:"25",ref:"searchField",id:"entity-lookup","onUpdate:modelValue":e[0]||(e[0]=d=>r.term=d),onClick:e[1]||(e[1]=d=>s.focus()),onFocus:e[2]||(e[2]=d=>s.focus()),onKeydown:e[3]||(e[3]=At(d=>s.escape(),["esc"])),placeholder:t.placeholder},null,40,Hi),[[we,r.term]]),l("span",Pi,[l("span",{class:"flex-none keyboard-shortcut py-1",id:"lookup-kb-shortcut","data-toggle":"tooltip","data-title":t.keyboard_tooltip,"data-html":"true","data-placement":"bottom"}," K ",8,ji)])]),r.show_recent||r.show_loading||r.show_preview?(u(),m("aside",Ni,[r.show_loading?(u(),m("div",Ri,e[8]||(e[8]=[l("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true","aria-label":"Loading"},null,-1)]))):y("",!0),r.show_recent?(u(),m("div",Bi,[r.show_results?y("",!0):(u(),m("div",Fi,[l("p",Oi,v(r.texts.hint),1)])),l("div",zi,[r.show_results?(u(),m("div",Qi,[l("div",Ui,v(r.texts.results),1),r.results.length===0&&r.pages.length===0?(u(),m("div",Ki,v(r.texts.empty_results),1)):(u(),m("div",Wi,[(u(!0),m(q,null,I(r.results,d=>(u(),K(o,{entity:d,onPreview:s.loadPreview},null,8,["entity","onPreview"]))),256)),(u(!0),m(q,null,I(r.pages,d=>(u(),K(a,{page:d},null,8,["page"]))),256))])),l("a",{class:"grow text-sm uppercase hover:underline",href:s.searchFullTextUrl()},v(r.texts.fulltext),9,Vi)])):y("",!0),r.recent.length>0?(u(),m("div",Yi,[l("div",Gi,v(r.texts.recents),1),(u(!0),m(q,null,I(r.recent,d=>(u(),K(o,{entity:d,onPreview:s.loadPreview},null,8,["entity","onPreview"]))),256))])):y("",!0),r.bookmarks.length>0?(u(),m("div",$i,[r.bookmarks.length>0?(u(),m("button",{key:0,class:_(["grow text-sm uppercase hover:underline",this.modeClass(!0)]),onClick:e[4]||(e[4]=d=>s.showBookmarks())},v(r.texts.bookmarks),3)):y("",!0),l("button",{class:_(["grow text-sm uppercase hover:underline",this.modeClass(!1)]),onClick:e[5]||(e[5]=d=>s.showIndexes())},v(r.texts.index),3)])):y("",!0),r.show_bookmarks?(u(),m("div",Xi,[(u(!0),m(q,null,I(r.bookmarks,d=>(u(),m("a",{href:d.url,onClick:e[6]||(e[6]=ye(()=>{},["stop"])),title:d.text,class:"flex gap-2 items-center"},[l("i",{class:_(["w-4",d.icon]),"aria-hidden":"true"},null,2),l("span",{innerHTML:d.text},null,8,Ji)],8,Zi))),256))])):(u(),m("div",er,[(u(!0),m(q,null,I(r.indexes,d=>(u(),m("a",{href:d.url,onClick:e[7]||(e[7]=ye(()=>{},["stop"])),title:d.name,class:"flex gap-2 items-center"},[l("i",{class:_(["w-4 text-center",d.icon]),"aria-hidden":"true"},null,2),l("span",{innerHTML:d.name},null,8,nr)],8,tr))),256))]))]),r.show_loading?y("",!0):(u(),m("div",ir,[e[9]||(e[9]=l("hr",null,null,-1)),l("p",{class:"italic text-xs text-center",innerHTML:r.texts.keyboard},null,8,rr)]))])):y("",!0),r.show_preview?(u(),m("div",sr,[te(c,{entity:r.preview_entity},null,8,["entity"])])):y("",!0)])):y("",!0)])),[[f,s.onClickOutside]])}const lr=ce(Ai,[["render",or]]),ar={props:["campaign"],methods:{backgroundImage:function(n){return n.image?"url("+n.image+")":""},campaignClass:function(n){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"}}},cr=["href","title"],ur={key:0,class:"absolute top-2 right-2 text-sm text-boost"},dr=["innerHTML"];function fr(n,e,t,i,r,s){return u(),m("a",{class:_(s.campaignClass(t.campaign)),href:t.campaign.url,style:Q({backgroundImage:s.backgroundImage(t.campaign)}),title:t.campaign.name},[t.campaign.is_boosted?(u(),m("div",ur,e[0]||(e[0]=[l("i",{class:"fa-solid fa-gem","aria-label":"Premium campaign"},null,-1)]))):y("",!0),l("div",{class:"flex items-end justify-center name w-full text-xs p-2 pt-6 text-center",innerHTML:t.campaign.name},null,8,dr)],14,cr)}const mr=ce(ar,[["render",fr]]),hr=["data-id"],pr={class:"flex-none p-2"},gr=["innerHTML","href"],vr=["title"],yr={key:1,class:"flex-none p-2"},wr=["data-id"],br={class:"flex-none p-2"},xr=["innerHTML"],kr=["title"],Lr={key:1,class:"flex-none p-2"},Sr=Z({__name:"Notification",props:{notification:{}},emits:["read"],setup(n,{emit:e}){const t=e,i=L(!1),r=L(!1),s=c=>{let f="notification bg-base-200 flex justify-center items-center p-2 rounded-md";return c.is_read?f:f+" unread"},o=c=>"fa-solid fa-"+c.icon,a=c=>{r.value=!0,axios.post(c.dismiss).then(()=>{i.value=!0,t("read",c)})};return(c,f)=>c.notification.url&&!i.value?(u(),m("div",{key:0,class:_(s(c.notification)),"data-id":c.notification.id},[l("div",pr,[l("i",{class:_(o(c.notification)),"aria-hidden":"true"},null,2)]),l("a",{class:"flex-grow p-2 break-all",innerHTML:c.notification.text,href:c.notification.url},null,8,gr),r.value?(u(),m("div",yr,f[3]||(f[3]=[l("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1)]))):(u(),m("div",{key:0,class:"flex-none p-2 cursor-pointer dismissable",onClick:f[0]||(f[0]=d=>a(c.notification)),title:c.notification.dismiss_text},f[2]||(f[2]=[l("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1)]),8,vr))],10,hr)):i.value?y("",!0):(u(),m("div",{key:1,class:_(s(c.notification)),"data-id":c.notification.id},[l("div",br,[l("i",{class:_(o(c.notification)),"aria-hidden":"true"},null,2)]),l("div",{class:"flex-grow p-2",innerHTML:c.notification.text},null,8,xr),r.value?(u(),m("div",Lr,f[5]||(f[5]=[l("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1)]))):(u(),m("div",{key:0,class:"flex-none p-2 cursor-pointer dismissable",onClick:f[1]||(f[1]=d=>a(c.notification)),title:c.notification.dismiss_text},f[4]||(f[4]=[l("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1)]),8,kr))],10,wr))}}),_r=["data-id"],Er={class:"flex-grow p-2"},Tr=["innerHTML","href"],Cr=["innerHTML"],qr=["title"],Mr={key:1,class:"flex-none p-2"},Ar=Z({__name:"Release",props:{release:{}},emits:["read"],setup(n,{emit:e}){const t=e,i=L(!1),r=L(!1),s=a=>"release bg-base-200 flex justify-center items-center p-2 rounded-md",o=a=>{r.value=!0,axios.post(a.dismiss).then(()=>{i.value=!0,t("read",a)})};return(a,c)=>i.value?y("",!0):(u(),m("div",{key:0,class:_(s(a.release)),"data-id":a.release.id},[l("div",Er,[l("a",{innerHTML:a.release.title,class:"font-bold cursor-pointer block w-full",href:a.release.url,target:"_blank"},null,8,Tr),l("p",{innerHTML:a.release.text},null,8,Cr)]),r.value?(u(),m("div",Mr,c[2]||(c[2]=[l("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1)]))):(u(),m("div",{key:0,class:"flex-none p-2 cursor-pointer dismissable",onClick:c[0]||(c[0]=f=>o(a.release)),title:a.release.dismiss_text},c[1]||(c[1]=[l("i",{class:"fa-solid fa-times","aria-hidden":"true"},null,-1)]),8,qr))],10,_r))}}),Ir={__name:"GridSvg",props:{size:Number},setup(n){const e=n;function t(){return"w-"+e.size+" h-"+e.size}return(i,r)=>(u(),m("svg",{class:_(t()),viewBox:"0 -0.5 21 21",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true"},r[0]||(r[0]=[l("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[l("g",{transform:"translate(-219.000000, -200.000000)",fill:"currentcolor"},[l("g",{id:"icons",transform:"translate(56.000000, 160.000000)"},[l("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)]),2))}},Dr={directives:{clickOutside:We.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:Ir,Campaign:mr,Notification:Sr,Release:Ar},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,pro:!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(n=>n.json()).then(n=>{this.profile=n.profile,this.campaigns=n.campaigns,this.notifications=n.notifications,this.marketplace=n.marketplace,this.releases=n.releases,this.show_alerts=n.has_unread,this.has_data=!0,this.is_loading=!1,this.is_loaded=!0,this.pro=n.fontawesome_pro}))},blockClass:function(n){return n?"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(n){this.is_expanded=!1},readRelease:function(n){let e=this.releases.releases.findIndex(t=>t.id===n.id);this.releases.releases.slice(e,1),this.updateUnread()},readNotification:function(n){let e=this.notifications.messages.findIndex(t=>t.id==n.id);this.notifications.messages.slice(e,1),this.updateUnread()},updateUnread:function(){this.notifications.messages.length===0&&this.releases.releases.length===0&&(this.show_alerts=!1)},updateAlerts:function(){let n=localStorage.getItem("last_notification-"+this.user_id),t=new Date().getTime()-60*5e3;if(!n||ne.json()).then(e=>{localStorage.setItem("notification-has-alerts-"+this.user_id,e.has_alerts),this.updateAlerts()})},queueFetch:function(){let n=this;setTimeout((function(){n.updateAlerts()}).bind(this),this.alert_delta)},showInitials:function(){return this.avatar.startsWith("/images/")},profilePictureUrl:function(){return"url("+this.avatar+")"}},mounted(){this.show_alerts=this.has_alerts,this.queueFetch()}},Hr={class:"nav-switcher flex items-center justify-center h-12"},Pr={class:"indicator relative inline-flex w-max"},jr={key:0,class:"notification-badge left-auto top-auto w-fit inline-flex absolute content-center items-center z-10"},Nr={key:1,class:"profile-box rounded-lg p-2 text-center font-bold"},Rr={key:0,class:"navigation-drawer bg-base-100 h-full overflow-y-auto fixed top-0 right-0 rounded-l-2xl shadow-lg"},Br={key:0,class:"temporary p-8 text-center"},Fr={key:1,class:""},Or={class:"header flex"},zr={key:0,class:"full flex items-center gap-4"},Qr={class:"flex-none"},Ur={class:"flex-grow"},Kr={class:"font-bold"},Wr=["title"],Vr={key:0,class:"full flex items-center gap-4"},Yr={key:0,class:"flex-none profile-box rounded-lg p-2 text-center uppercase font-bold"},Gr={class:"flex-grow"},$r={class:"font-bold"},Xr=["title"],Zr={key:0,class:"flex-none profile-box rounded-lg p-2 text-center uppercase font-bold"},Jr={key:0,class:"profile p-5 flex flex-col gap-5"},es={key:0,class:"notifications"},ts={class:"flex w-full py-2"},ns={class:"flex-grow uppercase font-bold"},is={class:"flex-grow text-right"},rs=["href"],ss={class:"flex flex-col gap-2"},os={key:0,class:"no-notifications help-block text-neutral-content italic"},ls={key:1,class:"releases"},as={class:"flex w-full py-2"},cs={class:"flex-grow uppercase font-bold"},us={class:"flex flex-col gap-2"},ds={key:2,class:"marketplace"},fs={class:"flex w-full py-2"},ms={class:"flex-grow uppercase font-bold"},hs={class:"flex-grow text-right"},ps=["href"],gs={class:"grid grid-cols-3 gap-2"},vs=["href"],ys={class:"text-muted text-xs"},ws=["href"],bs={class:"text-muted text-xs"},xs=["href"],ks={class:"text-muted text-xs"},Ls={key:3,class:"subscription"},Ss={class:"uppercase font-bold py-2"},_s=["href"],Es={class:"flex-none p-2"},Ts=["src","alt"],Cs={class:"flex-grow p-2"},qs={class:"font-bold text-lg"},Ms={key:0,class:"more"},As={key:1,class:"more"},Is={class:"link flex gap-1 items-center"},Ds={key:0,class:"fa-duotone fa-credit-card","aria-hidden":"true"},Hs={key:1,class:"fa-solid fa-credit-card","aria-hidden":"true"},Ps={key:4,class:"m-0 p-0 list-none flex flex-col gap-2"},js=["href"],Ns=["href"],Rs=["href"],Bs={key:5,class:"m-0 p-0 list-none flex flex-col gap-2"},Fs=["href"],Os={key:1,class:"campaigns p-5"},zs={key:0,class:"campaigns flex flex-col gap-5"},Qs={class:"flex flex-col gap-2"},Us={class:"flex w-full"},Ks={class:"flex-grow uppercase font-bold"},Ws={key:0,class:"flex-grow text-right"},Vs=["href"],Ys={class:"grid grid-cols-2 md:grid-cols-3 gap-5"},Gs=["href"],$s={class:"text-xs text-break uppercase"},Xs={key:0},Zs={class:"flex flex-col gap-2"},Js={key:0,class:"uppercase"},eo={key:1,class:"grid grid-cols-2 md:grid-cols-3 gap-5 following"},to=["href"],no={class:"text-xs uppercase text-break"};function io(n,e,t,i,r,s){const o=U("GridSvg"),a=U("Notification"),c=U("Release"),f=U("Campaign"),d=Ue("click-outside");return u(),m(q,null,[l("div",Hr,[l("div",{class:"campaigns inline cursor-pointer text-center px-3 text-2xl hover:text-primary-focus",onClick:e[0]||(e[0]=g=>s.openCampaigns()),"aria-label":"Switch campaigns",tabindex:"0",role:"button"},[te(o,{size:7}),e[5]||(e[5]=l("span",{class:"sr-only"},"Campaigns",-1))]),l("div",{class:"profile inline cursor-pointer text-center uppercase pt-1",onClick:e[1]||(e[1]=g=>s.openProfile()),"aria-label":"Profile settings",tabindex:"0",role:"button"},[l("div",Pr,[r.show_alerts?(u(),m("span",jr)):y("",!0),s.showInitials()?(u(),m("div",Nr,v(t.initials),1)):(u(),m("div",{key:2,class:"w-9 h-9 rounded-lg cover-background",style:Q({backgroundImage:s.profilePictureUrl()})},null,4))])])]),r.is_expanded?ne((u(),m("div",Rr,[r.is_loading?(u(),m("div",Br,e[6]||(e[6]=[l("i",{class:"fa-solid fa-spinner fa-spin","aria-hidden":"true"},null,-1)]))):(u(),m("div",Fr,[l("div",Or,[l("div",{class:_(s.blockClass(r.view_campaigns)),onClick:e[2]||(e[2]=g=>s.openCampaigns()),tabindex:"0",role:"button","aria-label":"Campaign list"},[r.view_campaigns?(u(),m("div",zr,[l("div",Qr,[te(o,{size:6})]),l("div",Ur,[l("div",Kr,v(r.campaigns.texts.campaigns),1),l("div",null,v(r.campaigns.texts.count),1)])])):(u(),m("div",{key:1,class:"flex items-center justify-center h-full",title:r.campaigns.texts.campaigns},[te(o,{size:6})],8,Wr))],2),l("div",{class:_(s.blockClass(r.view_profile)),onClick:e[3]||(e[3]=g=>s.openProfile()),tabindex:"0",role:"button","aria-label":"Profile pane"},[r.view_profile?(u(),m("div",Vr,[s.showInitials()?(u(),m("div",Yr,v(t.initials),1)):(u(),m("div",{key:1,class:"flex-none w-9 h-9 rounded-lg cover-background",style:Q({backgroundImage:s.profilePictureUrl()})},null,4)),l("div",Gr,[l("div",$r,v(r.profile.name),1),l("div",null,v(r.profile.created),1)])])):(u(),m("div",{key:1,class:"",title:r.profile.your_profile},[s.showInitials()?(u(),m("div",Zr,v(t.initials),1)):(u(),m("div",{key:1,class:"flex-none w-9 h-9 rounded-lg cover-background",style:Q({backgroundImage:s.profilePictureUrl()})},null,4))],8,Xr))],2)]),r.view_profile?(u(),m("div",Jr,[r.notifications.title?(u(),m("div",es,[l("div",ts,[l("div",ns,v(r.notifications.title),1),l("div",is,[l("a",{href:r.notifications.all.url},v(r.notifications.all.text),9,rs)])]),l("div",ss,[(u(!0),m(q,null,I(r.notifications.messages,g=>(u(),K(a,{notification:g,onRead:s.readNotification},null,8,["notification","onRead"]))),256))]),r.notifications.messages.length===0?(u(),m("div",os,v(r.notifications.none),1)):y("",!0)])):y("",!0),r.releases.title&&r.releases.releases.length>0?(u(),m("div",ls,[l("div",as,[l("div",cs,v(r.releases.title),1)]),l("div",us,[(u(!0),m(q,null,I(r.releases.releases,g=>(u(),K(c,{release:g,onRead:s.readRelease},null,8,["release","onRead"]))),256))])])):y("",!0),!r.profile.is_impersonating&&r.marketplace.title?(u(),m("div",ds,[l("div",fs,[l("div",ms,v(r.marketplace.title),1),l("div",hs,[l("a",{href:r.marketplace.explore.url,target:"_blank"},v(r.marketplace.explore.text),9,ps)])]),l("div",gs,[l("a",{href:r.marketplace.themes.url,class:"border py-2 items-center justify-center rounded-md hover:shadow-md flex flex-col gap-1",target:"_blank"},[e[7]||(e[7]=l("div",{class:"icon bg-base-200 rounded-full w-14 h-14 text-3xl aspect-square flex justify-center items-center"},[l("i",{class:"fa-solid fa-palette","aria-hidden":"true"})],-1)),l("div",null,v(r.marketplace.themes.title),1),l("div",ys,v(r.marketplace.themes.number),1)],8,vs),l("a",{href:r.marketplace.sheets.url,class:"border py-2 items-center justify-center rounded-md hover:shadow-md flex flex-col gap-1",target:"_blank"},[e[8]||(e[8]=l("div",{class:"icon bg-base-200 rounded-full w-14 h-14 text-3xl aspect-square flex justify-center items-center"},[l("i",{class:"fa-solid fa-columns","aria-hidden":"true"})],-1)),l("div",null,v(r.marketplace.sheets.title),1),l("div",bs,v(r.marketplace.sheets.number),1)],8,ws),l("a",{href:r.marketplace.content.url,class:"border py-2 items-center justify-center rounded-md hover:shadow-md flex flex-col gap-1",target:"_blank"},[e[9]||(e[9]=l("div",{class:"icon bg-base-200 rounded-full w-14 h-14 text-3xl aspect-square flex justify-center items-center"},[l("i",{class:"fa-solid fa-dice-d20","aria-hidden":"true"})],-1)),l("div",null,v(r.marketplace.content.title),1),l("div",ks,v(r.marketplace.content.number),1)],8,xs)])])):y("",!0),!r.profile.is_impersonating&&r.profile.subscription?(u(),m("div",Ls,[l("div",Ss,v(r.profile.subscription.title),1),l("a",{class:"border rounded-lg flex justify-center items-center hover:shadow-md",href:r.profile.urls.subscription},[l("div",Es,[l("img",{class:"w-16 h-16",src:r.profile.subscription.image,alt:r.profile.subscription.tier},null,8,Ts)]),l("div",Cs,[l("div",qs,v(r.profile.subscription.tier),1),r.profile.subscription.tier!=="Kobold"?(u(),m("div",Ms,[N(v(r.profile.subscription.created),1),e[10]||(e[10]=l("br",null,null,-1)),N(" "+v(r.profile.subscription.boosters),1)])):(u(),m("div",As,[N(v(r.profile.subscription.call_to_action)+" ",1),l("div",Is,[N(v(r.profile.subscription.call_to_action_2)+" ",1),r.pro?(u(),m("i",Ds)):(u(),m("i",Hs)),e[11]||(e[11]=l("i",{class:"fa-brands fa-paypal","aria-hidden":"true"},null,-1))])]))])],8,_s)])):y("",!0),r.profile.is_impersonating?(u(),m("ul",Bs,[l("li",null,[l("a",{href:r.profile.return.url,class:""},[e[16]||(e[16]=l("i",{class:"fa-solid fa-sign-out-alt mr-3","aria-hidden":"true"},null,-1)),N(" "+v(r.profile.return.name),1)],8,Fs)])])):(u(),m("ul",Ps,[l("li",null,[l("a",{href:r.profile.urls.settings.url,class:"p-2 block"},[e[12]||(e[12]=l("i",{class:"fa-solid fa-cog mr-3","aria-hidden":"true"},null,-1)),N(" "+v(r.profile.urls.settings.name),1)],8,js)]),l("li",null,[l("a",{href:r.profile.urls.profile.url,class:"p-2 block"},[e[13]||(e[13]=l("i",{class:"fa-solid fa-user mr-3","aria-hidden":"true"},null,-1)),N(" "+v(r.profile.urls.profile.name),1)],8,Ns)]),l("li",null,[l("a",{href:r.profile.urls.help.url,class:"p-2 block",target:"_blank"},[e[14]||(e[14]=l("i",{class:"fa-solid fa-question-circle mr-3","aria-hidden":"true"},null,-1)),N(" "+v(r.profile.urls.help.name),1)],8,Rs)]),l("li",null,[l("a",{href:"#",onClick:e[4]||(e[4]=g=>s.logout()),class:"p-2 block"},[e[15]||(e[15]=l("i",{class:"fa-solid fa-sign-out mr-3","aria-hidden":"true"},null,-1)),N(" "+v(r.profile.urls.logout.name),1)])])]))])):(u(),m("div",Os,[r.profile.is_impersonating?y("",!0):(u(),m("div",zs,[l("div",Qs,[l("div",Us,[l("div",Ks,v(r.campaigns.texts.campaigns),1),r.campaigns.member.length>0?(u(),m("div",Ws,[l("a",{href:r.campaigns.urls.reorder},v(r.campaigns.texts.reorder),9,Vs)])):y("",!0)]),l("div",Ys,[(u(!0),m(q,null,I(r.campaigns.member,g=>(u(),K(f,{campaign:g},null,8,["campaign"]))),256)),l("a",{href:r.campaigns.urls.new,class:"new-campaign flex items-center text-center border-dashed border rounded-lg h-24 p-2 overflow-hidden"},[l("span",$s,[e[17]||(e[17]=l("i",{class:"fa-solid fa-plus","aria-hidden":"true",style:{display:"none"}},null,-1)),N(" "+v(r.campaigns.texts.new),1)])],8,Gs)])]),r.profile.is_impersonating?y("",!0):(u(),m("hr",Xs)),l("div",Zs,[r.profile.is_impersonating?y("",!0):(u(),m("p",Js,v(r.campaigns.texts.followed),1)),r.profile.is_impersonating?y("",!0):(u(),m("div",eo,[(u(!0),m(q,null,I(r.campaigns.following,g=>(u(),K(f,{campaign:g},null,8,["campaign"]))),256)),l("a",{href:r.campaigns.urls.follow,class:"new-campaign flex items-center text-center border-dashed border rounded-lg h-24 p-2 overflow-hidden"},[l("span",no,v(r.campaigns.texts.follow),1)],8,to)]))])]))]))]))])),[[d,s.onClickOutside]]):y("",!0)],64)}const ro=ce(Dr,[["render",io]]),ue=Ke({});ue.component("nav-toggler",Yn);ue.component("nav-search",lr);ue.component("nav-switcher",ro);ue.mount("#header");const so={key:0},oo={class:"bg-base-200 sm:rounded-t"},lo=["innerHTML"],ao={class:"max-w-4xl"},co={key:0,class:"flex gap-1 w-full"},uo={class:"grow"},fo=["placeholder"],mo=["title"],ho=["title"],po={key:1,class:"md:h-36 md:w-80 text-center flex items-center justify-center w-full"},go=["onClick"],vo=["title"],yo=["innerHTML"],wo=["innerHTML"],bo=300,xo=Z({__name:"Browser",props:{api:{},opened:{type:Boolean},i18n:{}},emits:["selected","closed"],setup(n,{emit:e}){const t=n,i=L(null);It(()=>{i.value=JSON.parse(t.i18n)});const r=e,s=L(!0),o=L(!1),a=L(),c=L([]),f=L(""),d=L(""),g=L(null),h=L(null),x=L("large"),b=()=>{s.value=!0,a.value.showModal(),a.value.addEventListener("click",function(p){let w=this.getBoundingClientRect();!(w.top<=p.clientY&&p.clientY<=w.top+w.height&&w.left<=p.clientX&&p.clientX<=w.left+w.width)&&p.target.tagName==="DIALOG"&&E()}),axios.get(t.api).then(p=>{c.value=p.data.images,s.value=!1}).catch(p=>{s.value=!1,p.response.status===403&&(h.value=p.response.data.message,h.value+="

    "+i.value.browse.unauthorized+"

    ")})},E=()=>{a.value.close(),r("closed")},S=p=>(p=p??"",x.value==="large"?"w-40 h-28 md:w-48 md:h-36 "+p:"w-20 h-16 "+p),C=p=>(p=p??"",x.value==="large"?"w-40 md:w-48 "+p:"w-20 text-xs "+p),B=()=>x.value==="small"?"flex flex-wrap justify-center gap-2 md:gap-3":"flex flex-wrap justify-center gap-2 md:gap-5",D=p=>{if(p.folder){s.value=!0,axios.get(p.url).then(w=>{c.value=w.data.images,s.value=!1});return}r("selected",p),E()};Dt(()=>t.opened,(p,w)=>{p&&b()});const A=p=>{f.value=p.target.value,g.value&&clearTimeout(g.value),g.value=setTimeout(()=>{O()},bo)},O=()=>{d.value!=f.value&&(d.value=f.value,o.value=!0,axios.get(t.api+"?term="+d.value).then(p=>{c.value=p.data.images,o.value=!1}))},H=p=>{x.value=p};return(p,w)=>(u(),m(q,null,[s.value?(u(),m("div",so,w[3]||(w[3]=[l("i",{class:"fa-solid fa-spin fa-spinner2","aria-label":"Loading"},null,-1)]))):y("",!0),l("dialog",{class:"dialog rounded-2xl text-center",id:"gallery-dialog",ref_key:"galleryDialog",ref:a,"aria-modal":"true","aria-labelledby":"modal-card-label"},[l("header",oo,[l("h4",{innerHTML:i.value.browse.title},null,8,lo),l("button",{type:"button",class:"text-base-content",onClick:w[0]||(w[0]=P=>E()),title:"Close"},w[4]||(w[4]=[l("i",{class:"fa-regular fa-circle-xmark","aria-hidden":"true"},null,-1),l("span",{class:"sr-only"},"Close",-1)]))]),l("article",ao,[!s.value&&!h.value?(u(),m("div",co,[l("div",uo,[l("input",{type:"text",class:"w-full",placeholder:i.value.browse.search.placeholder,onInput:A},null,40,fo)]),x.value!=="large"?(u(),m("div",{key:0,class:"flex-none cursor-pointer btn2 btn-ghost btn-sm",onClick:w[1]||(w[1]=P=>H("large")),title:i.value.browse.layouts.large},w[5]||(w[5]=[l("i",{class:"fa-solid fa-grid-2","aria-label":"Large previews"},null,-1)]),8,mo)):y("",!0),x.value!=="small"?(u(),m("div",{key:1,class:"flex-none cursor-pointer btn2 btn-ghost btn-sm",onClick:w[2]||(w[2]=P=>H("small")),title:i.value.browse.layouts.small},w[6]||(w[6]=[l("i",{class:"fa-solid fa-grid-4","aria-label":"Small previews"},null,-1)]),8,ho)):y("",!0)])):y("",!0),s.value||o.value?(u(),m("div",po,w[7]||(w[7]=[l("i",{class:"fa-solid fa-spinner fa-spin","aria-label":"Loading"},null,-1)]))):(u(),m("div",{key:2,class:_(B())},[(u(!0),m(q,null,I(c.value,P=>(u(),m("div",{class:"cursor-pointer shadow rounded overflow-hidden hover:shadow-lg",onClick:De=>D(P)},[P.folder?(u(),m("div",{key:1,class:_(S("flex items-center align-middle justify-center text-4xl"))},[l("i",{class:_(P.icon),"aria-label":"Folder"},null,2)],2)):(u(),m("div",{key:0,class:_(S("cover-background")),style:Q({backgroundImage:"url('"+P.thumbnail+"')"})},null,6)),l("div",{class:_(C("truncate p-2")),title:P.name},[l("span",{innerHTML:P.name},null,8,yo)],10,vo)],8,go))),256)),h.value?(u(),m("div",{key:0,class:"alert alert-error p-2 rounded",innerHTML:h.value},null,8,wo)):y("",!0)],2))])],512)],64))}}),ko={key:0},Lo=["innerHTML"],So={key:1,class:"flex items-center gap-1"},_o=["accept"],Eo={key:2,class:"flex items-center gap-1"},To=["placeholder"],Co={key:0,class:"fa-solid fa-spin fa-spinner","aria-label":"Downloading"},qo={key:3,class:"flex items-center gap-1"},Mo=["innerHTML"],Ao={key:0,class:"flex gap-2 flex-col w-full"},Io={class:"progress h-1 w-full"},Do=["innerHTML"],Ho=["innerHTML"],Po=["name"],jo={key:2,type:"hidden",name:"remove-image",value:"1"},No=Z({__name:"Selection",props:{file:{},url:{},accepts:{},uuid:{},thumbnail:{},browse:{},field:{},old:{},i18n:{}},setup(n){const e=n,t=L(!0),i=L(!1),r=L(!1),s=L(),o=L(),a=L(),c=L(),f=L(),d=L(!1),g=L(0),h=L(null);let x;const b=L(null),E=L(!1),S=L(!1),C=L(null);Qe(()=>{t.value=!1,c.value=e.thumbnail,f.value=e.uuid,e.old==="true"&&(E.value=!0),C.value=JSON.parse(e.i18n)});const B=()=>{let k="relative flex items-end align-middle rounded overflow-hidden bg-no-repeat ";return O()?k+=" cover-background preview-bg w-48 h-36 p-2 ":k+="w-full",k},D=()=>r.value?"hidden":"flex gap-2 flex-col w-full",A=()=>E.value||f.value!==null&&f.value!=="",O=()=>h.value||E.value?!0:f.value!==null&&f.value!=="",H=()=>{f.value=null,c.value=null,E.value&&(E.value=!1,S.value=!0)},p=()=>h.value?"url('"+h.value+"')":c.value?"url('"+c.value+"')":"",w=()=>g.value+"%",P=()=>{d.value=!0},De=k=>{s.value=k.clipboardData.getData("text"),He()},He=()=>{!s.value||s.value==x||(x=s.value,i.value=!0,o.value.disabled=!0,axios.post(e.url,{url:s.value}).then(k=>{o.value.disabled=!1,i.value=!1,s.value=null,c.value=k.data.thumbnail,f.value=k.data.uuid}).catch(k=>{o.value.disabled=!1,i.value=!1,o.value.focus(),Pe(k)}))},Ct=async k=>{const T=k.target.files[0];if(!T){r.value=!1;return}const j=new FileReader;j.onload=F=>{h.value=F.target.result},j.readAsDataURL(T),r.value=!0,document.addEventListener("keydown",de),b.value=axios.CancelToken.source(),a.value.disabled=!0;const Ne=new FormData;Ne.append("file",T),axios.post(e.file,Ne,{headers:{"Content-Type":"multipart/form-data"},cancelToken:b.value.token,onUploadProgress:function(F){g.value=Math.round(F.loaded*100/F.total)}}).then(F=>{r.value=!1,a.value.disabled=!1,a.value=null,c.value=F.data.thumbnail,f.value=F.data.uuid,h.value=null,document.removeEventListener("keydown",de)}).catch(F=>{r.value=!1,a.value.disabled=!1,h.value=null,axios.isCancel(F)?a.value=null:Pe(F),document.removeEventListener("keydown",de)})},Pe=k=>{if(!k.response)return;if(k.response.data.error){window.showToast(k.response.data.error,"error");return}if(k.response&&k.response.status===403&&k.response.data.message){window.showToast(C.value.unauthorized,"error");return}Object.keys(k.response.data.errors).forEach(j=>{window.showToast(k.response.data.errors[j][0],"error")})},qt=k=>{f.value=k.uuid,c.value=k.thumbnail},Mt=()=>{d.value=!1},de=k=>{k.key==="Escape"&&r.value&&je()},je=k=>{b.value.cancel("Upload canceled by user.")};return(k,T)=>(u(),m(q,null,[t.value?(u(),m("div",ko,T[6]||(T[6]=[l("i",{class:"fa-solid fa-spin fa-spinner2","aria-label":"Loading"},null,-1)]))):(u(),m("div",{key:1,class:_(B()),style:Q({backgroundImage:p()})},[l("div",{class:_(D())},[O()?(u(),m("div",{key:0,class:"rounded p-2 cursor-pointer backdrop-blur backdrop-opacity-30 bg-red-700/50 text-white hover:backdrop-opacity-100 transition",onClick:T[0]||(T[0]=j=>H()),innerHTML:C.value.remove},null,8,Lo)):y("",!0),A()?y("",!0):(u(),m("div",So,[l("input",{type:"file",accept:e.accepts,class:"w-full",onChange:Ct,ref_key:"fileField",ref:a},null,40,_o)])),A()?y("",!0):(u(),m("div",Eo,[ne(l("input",{ref_key:"urlField",ref:o,type:"text",class:"w-full","onUpdate:modelValue":T[1]||(T[1]=j=>s.value=j),onBlur:T[2]||(T[2]=j=>He()),onPaste:De,placeholder:C.value.url},null,40,To),[[we,s.value]]),i.value?(u(),m("i",Co)):y("",!0)])),A()?y("",!0):(u(),m("div",qo,[l("span",{role:"button",class:"btn2 btn-default btn-sm",onClick:T[3]||(T[3]=j=>P()),innerHTML:C.value.gallery},null,8,Mo)]))],2),r.value?(u(),m("div",Ao,[l("div",Io,[l("div",{class:"h-1 bg-accent shadow-sm",role:"progressbar","aria-valuenow":"0","aria-valuemin":"0","aria-valuemax":"100",style:Q({width:w()})},T[7]||(T[7]=[l("span",{class:"sr-only"},null,-1)]),4)]),l("div",{class:"rounded p-2 cursor-pointer backdrop-blur backdrop-opacity-30 bg-red-700/50 text-white hover:backdrop-opacity-100 transition flex items-center gap-2",onClick:T[4]||(T[4]=j=>je())},[l("span",{class:"grow",innerHTML:C.value.cancel},null,8,Do),l("span",{class:"text-xs flex-none",innerHTML:w()},null,8,Ho)])])):y("",!0)],6)),ne(l("input",{type:"hidden",name:e.field,"onUpdate:modelValue":T[5]||(T[5]=j=>f.value=j)},null,8,Po),[[we,f.value]]),S.value?(u(),m("input",jo)):y("",!0),te(xo,{api:e.browse,opened:d.value,i18n:k.i18n,onSelected:qt,onClosed:Mt},null,8,["api","opened","i18n"])],64))}}),yt=()=>{document.querySelectorAll(".gallery-selection").forEach(e=>{if(e.dataset.init==="1")return;e.dataset.init="1";const t=Ke({});t.component("gallery-selection",No),t.mount(e)})};yt();window.onEvent(function(){yt()});const ge=Array(),wt=()=>{document.querySelectorAll('[data-toggle="tooltip-ajax"]').forEach(e=>{e.dataset.loaded!=="1"&&(e.dataset.loaded="1",ae(e,{theme:"kanka",placement:e.dataset.direction??"bottom",allowHTML:!0,interactive:!0,delay:500,appendTo:e.dataset.append??document.body,content:'