"use strict";(self.rspackChunkcalendar=self.rspackChunkcalendar||[]).push([["node_modules_nextcloud_dialogs_dist_chunks_PublicAuthPrompt-CxPJPSnh_mjs"],{81217(e,t,a){a.r(t);var n=a(20641),l=a(50953),r=a(90033),i=a(21777),u=a(19760),s=a(94434),o=a(11008),c=a(79455),m=a(3133),d=a(44931),p=a(50240);function h(e){if(""===e.trim())return(0,m.t)("Names must not be empty.");if(e.startsWith("."))return(0,m.t)("Names must not start with a dot.");if(e.length>64)return(0,m.t)("Names may be at most 64 characters long.");try{return(0,d.KT)(e),""}catch(e){if(!(e instanceof d.di))throw e;switch(e.reason){case d.nF.Character:return(0,m.t)('"{char}" is not allowed inside a name.',{char:e.segment});case d.nF.ReservedName:return(0,m.t)('"{segment}" is a reserved name and not allowed.',{segment:e.segment});case d.nF.Extension:if(e.segment.match(/\.[a-z]/i))return(0,m.t)('"{extension}" is not an allowed name.',{extension:e.segment});return(0,m.t)('Names must not end with "{extension}".',{extension:e.segment});default:return(0,m.t)("Invalid name.")}}}let b={key:0,class:"public-auth-prompt__text"},f=(0,n.pM)({__name:"PublicAuthPrompt",props:{nickname:{default:""},title:{default:(0,m.t)("Guest identification")},text:{default:""},notice:{default:""},submitLabel:{default:(0,m.t)("Submit name")},cancellable:{type:Boolean}},emits:["close"],setup(e,{emit:t}){let a=(0,n.rk)("input"),d=(0,u.c0)("public").build(),p=(0,l.KR)(e.nickname);(0,n.wB)(()=>e.nickname,()=>{p.value=e.nickname}),(0,n.wB)(p,e=>{let t=h(e);if(!t&&a.value)return void y(t)});let f=(0,n.EW)(()=>{let a={label:(0,m.t)("Cancel"),variant:"tertiary",callback:()=>t("close")},n={label:e.submitLabel,type:"submit",variant:"primary"};return e.cancellable?[a,n]:[n]}),v=(0,n.EW)(()=>e.notice?e.notice:p.value?(0,m.t)("You are currently identified as {nickname}.",{nickname:p.value}):(0,m.t)("You are currently not identified."));function _(){let e=p.value.trim(),n=h(e);if(n)return void y(n);if(""===e)return void y((0,m.t)("You cannot leave the name empty."));if(e.length<2)return void y((0,m.t)("Please enter a name with at least 2 characters."));try{(0,i.L$)(e)}catch(e){m.l.error("Failed to set nickname",{error:e}),(0,m.s)((0,m.t)("Failed to set nickname.")),a.value.focus();return}d.setItem("public-auth-prompt-shown","true"),t("close",p.value)}function y(e){a.value&&(a.value.setCustomValidity(e),a.value.reportValidity(),a.value.focus())}return(t,a)=>((0,n.uX)(),(0,n.Wv)((0,l.R1)(s.A),{buttons:f.value,class:"public-auth-prompt","data-cy-public-auth-prompt-dialog":"",isForm:"",noClose:"",name:e.title,onSubmit:_},{default:(0,n.k6)(()=>[e.text?((0,n.uX)(),(0,n.CE)("p",b,(0,r.toDisplayString)(e.text),1)):(0,n.Q3)("",!0),(0,n.bF)((0,l.R1)(o.A),{class:"public-auth-prompt__header",text:v.value,type:"info"},null,8,["text"]),(0,n.bF)((0,l.R1)(c.A),{ref:"input",modelValue:p.value,"onUpdate:modelValue":a[0]||(a[0]=e=>p.value=e),class:"public-auth-prompt__input","data-cy-public-auth-prompt-dialog-name":"",label:(0,l.R1)(m.t)("Name"),placeholder:(0,l.R1)(m.t)("Enter your name"),required:!e.cancellable,minlength:"2",maxlength:"64",name:"name"},null,8,["modelValue","label","placeholder","required"])]),_:1},8,["buttons","name"]))}}),v=(0,p._)(f,[["__scopeId","data-v-bd4b7f1b"]]);a.d(t,{},{default:v})},79455(e,t,a){var n=a(51420);a.d(t,{A:()=>n._})}}]);
//# sourceMappingURL=calendar-node_modules_nextcloud_dialogs_dist_chunks_PublicAuthPrompt-CxPJPSnh_mjs.js.map?v=807e285e04cb058f