/api/realtime
diff --git a/core/settings.go b/core/settings.go index 18e910e17..4beb5dd31 100644 --- a/core/settings.go +++ b/core/settings.go @@ -10,48 +10,46 @@ import ( validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/go-ozzo/ozzo-validation/v4/is" "github.com/pocketbase/pocketbase/tools/auth" + "github.com/pocketbase/pocketbase/tools/rest" "github.com/pocketbase/pocketbase/tools/security" ) -// Common settings placeholder tokens -const ( - EmailPlaceholderAppUrl string = "%APP_URL%" - EmailPlaceholderToken string = "%TOKEN%" -) - // Settings defines common app configuration options. type Settings struct { mux sync.RWMutex - Meta MetaConfig `form:"meta" json:"meta"` - Logs LogsConfig `form:"logs" json:"logs"` - Smtp SmtpConfig `form:"smtp" json:"smtp"` - S3 S3Config `form:"s3" json:"s3"` - AdminAuthToken TokenConfig `form:"adminAuthToken" json:"adminAuthToken"` - AdminPasswordResetToken TokenConfig `form:"adminPasswordResetToken" json:"adminPasswordResetToken"` - UserAuthToken TokenConfig `form:"userAuthToken" json:"userAuthToken"` - UserPasswordResetToken TokenConfig `form:"userPasswordResetToken" json:"userPasswordResetToken"` - UserEmailChangeToken TokenConfig `form:"userEmailChangeToken" json:"userEmailChangeToken"` - UserVerificationToken TokenConfig `form:"userVerificationToken" json:"userVerificationToken"` - EmailAuth EmailAuthConfig `form:"emailAuth" json:"emailAuth"` - GoogleAuth AuthProviderConfig `form:"googleAuth" json:"googleAuth"` - FacebookAuth AuthProviderConfig `form:"facebookAuth" json:"facebookAuth"` - GithubAuth AuthProviderConfig `form:"githubAuth" json:"githubAuth"` - GitlabAuth AuthProviderConfig `form:"gitlabAuth" json:"gitlabAuth"` + Meta MetaConfig `form:"meta" json:"meta"` + Logs LogsConfig `form:"logs" json:"logs"` + Smtp SmtpConfig `form:"smtp" json:"smtp"` + S3 S3Config `form:"s3" json:"s3"` + + AdminAuthToken TokenConfig `form:"adminAuthToken" json:"adminAuthToken"` + AdminPasswordResetToken TokenConfig `form:"adminPasswordResetToken" json:"adminPasswordResetToken"` + UserAuthToken TokenConfig `form:"userAuthToken" json:"userAuthToken"` + UserPasswordResetToken TokenConfig `form:"userPasswordResetToken" json:"userPasswordResetToken"` + UserEmailChangeToken TokenConfig `form:"userEmailChangeToken" json:"userEmailChangeToken"` + UserVerificationToken TokenConfig `form:"userVerificationToken" json:"userVerificationToken"` + + EmailAuth EmailAuthConfig `form:"emailAuth" json:"emailAuth"` + GoogleAuth AuthProviderConfig `form:"googleAuth" json:"googleAuth"` + FacebookAuth AuthProviderConfig `form:"facebookAuth" json:"facebookAuth"` + GithubAuth AuthProviderConfig `form:"githubAuth" json:"githubAuth"` + GitlabAuth AuthProviderConfig `form:"gitlabAuth" json:"gitlabAuth"` } // NewSettings creates and returns a new default Settings instance. func NewSettings() *Settings { return &Settings{ Meta: MetaConfig{ - AppName: "Acme", - AppUrl: "http://localhost:8090", - SenderName: "Support", - SenderAddress: "support@example.com", - UserVerificationUrl: EmailPlaceholderAppUrl + "/_/#/users/confirm-verification/" + EmailPlaceholderToken, - UserResetPasswordUrl: EmailPlaceholderAppUrl + "/_/#/users/confirm-password-reset/" + EmailPlaceholderToken, - UserConfirmEmailChangeUrl: EmailPlaceholderAppUrl + "/_/#/users/confirm-email-change/" + EmailPlaceholderToken, + AppName: "Acme", + AppUrl: "http://localhost:8090", + SenderName: "Support", + SenderAddress: "support@example.com", + VerificationTemplate: defaultVerificationTemplate, + ResetPasswordTemplate: defaultResetPasswordTemplate, + ConfirmEmailChangeTemplate: defaultConfirmEmailChangeTemplate, }, + Logs: LogsConfig{ MaxDays: 7, }, @@ -194,6 +192,9 @@ func (s *Settings) RedactClone() (*Settings, error) { // NamedAuthProviderConfigs returns a map with all registered OAuth2 // provider configurations (indexed by their name identifier). func (s *Settings) NamedAuthProviderConfigs() map[string]AuthProviderConfig { + s.mux.RLock() + defer s.mux.RUnlock() + return map[string]AuthProviderConfig{ auth.NameGoogle: s.GoogleAuth, auth.NameFacebook: s.FacebookAuth, @@ -267,13 +268,13 @@ func (c S3Config) Validate() error { // ------------------------------------------------------------------- type MetaConfig struct { - AppName string `form:"appName" json:"appName"` - AppUrl string `form:"appUrl" json:"appUrl"` - SenderName string `form:"senderName" json:"senderName"` - SenderAddress string `form:"senderAddress" json:"senderAddress"` - UserVerificationUrl string `form:"userVerificationUrl" json:"userVerificationUrl"` - UserResetPasswordUrl string `form:"userResetPasswordUrl" json:"userResetPasswordUrl"` - UserConfirmEmailChangeUrl string `form:"userConfirmEmailChangeUrl" json:"userConfirmEmailChangeUrl"` + AppName string `form:"appName" json:"appName"` + AppUrl string `form:"appUrl" json:"appUrl"` + SenderName string `form:"senderName" json:"senderName"` + SenderAddress string `form:"senderAddress" json:"senderAddress"` + VerificationTemplate EmailTemplate `form:"verificationTemplate" json:"verificationTemplate"` + ResetPasswordTemplate EmailTemplate `form:"resetPasswordTemplate" json:"resetPasswordTemplate"` + ConfirmEmailChangeTemplate EmailTemplate `form:"confirmEmailChangeTemplate" json:"confirmEmailChangeTemplate"` } // Validate makes MetaConfig validatable by implementing [validation.Validatable] interface. @@ -283,34 +284,45 @@ func (c MetaConfig) Validate() error { validation.Field(&c.AppUrl, validation.Required, is.URL), validation.Field(&c.SenderName, validation.Required, validation.Length(1, 255)), validation.Field(&c.SenderAddress, is.Email, validation.Required), + validation.Field(&c.VerificationTemplate, validation.Required), + validation.Field(&c.ResetPasswordTemplate, validation.Required), + validation.Field(&c.ConfirmEmailChangeTemplate, validation.Required), + ) +} + +type EmailTemplate struct { + Body string `form:"body" json:"body"` + Subject string `form:"subject" json:"subject"` + ActionUrl string `form:"actionUrl" json:"actionUrl"` +} + +// Validate makes EmailTemplate validatable by implementing [validation.Validatable] interface. +func (t EmailTemplate) Validate() error { + return validation.ValidateStruct(&t, + validation.Field(&t.Subject, validation.Required), validation.Field( - &c.UserVerificationUrl, - validation.Required, - validation.By(c.checkPlaceholders(EmailPlaceholderToken)), - ), - validation.Field( - &c.UserResetPasswordUrl, + &t.Body, validation.Required, - validation.By(c.checkPlaceholders(EmailPlaceholderToken)), + validation.By(checkPlaceholderParams(EmailPlaceholderActionUrl)), ), validation.Field( - &c.UserConfirmEmailChangeUrl, + &t.ActionUrl, validation.Required, - validation.By(c.checkPlaceholders(EmailPlaceholderToken)), + validation.By(checkPlaceholderParams(EmailPlaceholderToken)), ), ) } -func (c *MetaConfig) checkPlaceholders(params ...string) validation.RuleFunc { +func checkPlaceholderParams(params ...string) validation.RuleFunc { return func(value any) error { v, _ := value.(string) - if v == "" { - return nil // nothing to check - } for _, param := range params { if !strings.Contains(v, param) { - return validation.NewError("validation_missing_required_param", fmt.Sprintf("Missing required parameter %q", param)) + return validation.NewError( + "validation_missing_required_param", + fmt.Sprintf("Missing required parameter %q", param), + ) } } @@ -318,6 +330,50 @@ func (c *MetaConfig) checkPlaceholders(params ...string) validation.RuleFunc { } } +// Resolve replaces the placeholder parameters in the current email +// template and returns its components as ready-to-use strings. +func (t EmailTemplate) Resolve( + appName string, + appUrl, + token string, +) (subject, body, actionUrl string) { + // replace action url placeholder params (if any) + actionUrlParams := map[string]string{ + EmailPlaceholderAppName: appName, + EmailPlaceholderAppUrl: appUrl, + EmailPlaceholderToken: token, + } + actionUrl = t.ActionUrl + for k, v := range actionUrlParams { + actionUrl = strings.ReplaceAll(actionUrl, k, v) + } + actionUrl, _ = rest.NormalizeUrl(actionUrl) + + // replace body placeholder params (if any) + bodyParams := map[string]string{ + EmailPlaceholderAppName: appName, + EmailPlaceholderAppUrl: appUrl, + EmailPlaceholderToken: token, + EmailPlaceholderActionUrl: actionUrl, + } + body = t.Body + for k, v := range bodyParams { + body = strings.ReplaceAll(body, k, v) + } + + // replace subject placeholder params (if any) + subjectParams := map[string]string{ + EmailPlaceholderAppName: appName, + EmailPlaceholderAppUrl: appUrl, + } + subject = t.Subject + for k, v := range subjectParams { + subject = strings.ReplaceAll(subject, k, v) + } + + return subject, body, actionUrl +} + // ------------------------------------------------------------------- type LogsConfig struct { @@ -333,6 +389,35 @@ func (c LogsConfig) Validate() error { // ------------------------------------------------------------------- +type EmailAuthConfig struct { + Enabled bool `form:"enabled" json:"enabled"` + ExceptDomains []string `form:"exceptDomains" json:"exceptDomains"` + OnlyDomains []string `form:"onlyDomains" json:"onlyDomains"` + MinPasswordLength int `form:"minPasswordLength" json:"minPasswordLength"` +} + +// Validate makes `EmailAuthConfig` validatable by implementing [validation.Validatable] interface. +func (c EmailAuthConfig) Validate() error { + return validation.ValidateStruct(&c, + validation.Field( + &c.ExceptDomains, + validation.When(len(c.OnlyDomains) > 0, validation.Empty).Else(validation.Each(is.Domain)), + ), + validation.Field( + &c.OnlyDomains, + validation.When(len(c.ExceptDomains) > 0, validation.Empty).Else(validation.Each(is.Domain)), + ), + validation.Field( + &c.MinPasswordLength, + validation.When(c.Enabled, validation.Required), + validation.Min(5), + validation.Max(100), + ), + ) +} + +// ------------------------------------------------------------------- + type AuthProviderConfig struct { Enabled bool `form:"enabled" json:"enabled"` AllowRegistrations bool `form:"allowRegistrations" json:"allowRegistrations"` @@ -382,32 +467,3 @@ func (c AuthProviderConfig) SetupProvider(provider auth.Provider) error { return nil } - -// ------------------------------------------------------------------- - -type EmailAuthConfig struct { - Enabled bool `form:"enabled" json:"enabled"` - ExceptDomains []string `form:"exceptDomains" json:"exceptDomains"` - OnlyDomains []string `form:"onlyDomains" json:"onlyDomains"` - MinPasswordLength int `form:"minPasswordLength" json:"minPasswordLength"` -} - -// Validate makes `EmailAuthConfig` validatable by implementing [validation.Validatable] interface. -func (c EmailAuthConfig) Validate() error { - return validation.ValidateStruct(&c, - validation.Field( - &c.ExceptDomains, - validation.When(len(c.OnlyDomains) > 0, validation.Empty).Else(validation.Each(is.Domain)), - ), - validation.Field( - &c.OnlyDomains, - validation.When(len(c.ExceptDomains) > 0, validation.Empty).Else(validation.Each(is.Domain)), - ), - validation.Field( - &c.MinPasswordLength, - validation.When(c.Enabled, validation.Required), - validation.Min(5), - validation.Max(100), - ), - ) -} diff --git a/core/settings_templates.go b/core/settings_templates.go new file mode 100644 index 000000000..0e25e677a --- /dev/null +++ b/core/settings_templates.go @@ -0,0 +1,55 @@ +package core + +// Common settings placeholder tokens +const ( + EmailPlaceholderAppName string = "{APP_NAME}" + EmailPlaceholderAppUrl string = "{APP_URL}" + EmailPlaceholderToken string = "{TOKEN}" + EmailPlaceholderActionUrl string = "{ACTION_URL}" +) + +var defaultVerificationTemplate = EmailTemplate{ + Subject: "Verify your " + EmailPlaceholderAppName + " email", + Body: `
Hello,
+Thank you for joining us at ` + EmailPlaceholderAppName + `.
+Click on the button below to verify your email address.
++ Verify +
+ +
+ Thanks,
+ ` + EmailPlaceholderAppName + ` team
+
Hello,
+Click on the button below to reset your password.
++ Reset password +
+If you didn't ask to reset your password, you can ignore this email.
+
+ Thanks,
+ ` + EmailPlaceholderAppName + ` team
+
Hello,
+Click on the button below to confirm your new email address.
+ +If you didn't ask to change your email address, you can ignore this email.
+
+ Thanks,
+ ` + EmailPlaceholderAppName + ` team
+
Reset password - {{.ActionUrl}}
If you did not request to reset your password, please ignore this email and the link will expire on its own.
diff --git a/mails/templates/layout.go b/mails/templates/layout.go index cbc657273..7e3375831 100644 --- a/mails/templates/layout.go +++ b/mails/templates/layout.go @@ -50,12 +50,6 @@ const Layout = ` .hidden { display: none !important; } - .fallback-link { - display: none !important; - word-break: break-all; - font-size: 11px; - color: #666f75; - } .btn { display: inline-block; vertical-align: top; diff --git a/mails/templates/user_confirm_email_change.go b/mails/templates/user_confirm_email_change.go deleted file mode 100644 index 66a7c3aaa..000000000 --- a/mails/templates/user_confirm_email_change.go +++ /dev/null @@ -1,26 +0,0 @@ -package templates - -// Available variables: -// -// ``` -// User *models.User -// AppName string -// AppUrl string -// Token string -// ActionUrl string -// ``` -const UserConfirmEmailChangeBody = ` -{{define "content"}} -Hello,
-Click on the button below to confirm your new email address.
-- Confirm new email - {{.ActionUrl}} -
-If you didn’t ask to change your email address, you can ignore this email.
-
- Thanks,
- {{.AppName}} team
-
Hello,
-Click on the button below to reset your password.
-- Reset password - {{.ActionUrl}} -
-If you didn’t ask to reset your password, you can ignore this email.
-
- Thanks,
- {{.AppName}} team
-
Hello,
-Thank you for joining us at {{.AppName}}.
-Click on the button below to verify your email address.
-- Verify - {{.ActionUrl}} -
-
- Thanks,
- {{.AppName}} team
-
Enter the email associated with your account and we\u2019ll send you a recovery link:
`,n=g(),H(l.$$.fragment),t=g(),o=_("button"),f=_("i"),m=g(),i=_("span"),i.textContent="Send recovery link",p(s,"class","content txt-center m-b-sm"),p(f,"class","ri-mail-send-line"),p(i,"class","txt"),p(o,"type","submit"),p(o,"class","btn btn-lg btn-block"),o.disabled=c[1],F(o,"btn-loading",c[1]),p(e,"class","m-b-base")},m(r,$){k(r,e,$),d(e,s),d(e,n),L(l,e,null),d(e,t),d(e,o),d(o,f),d(o,m),d(o,i),a=!0,b||(u=E(e,"submit",I(c[3])),b=!0)},p(r,$){const q={};$&97&&(q.$$scope={dirty:$,ctx:r}),l.$set(q),(!a||$&2)&&(o.disabled=r[1]),$&2&&F(o,"btn-loading",r[1])},i(r){a||(w(l.$$.fragment,r),a=!0)},o(r){y(l.$$.fragment,r),a=!1},d(r){r&&v(e),S(l),b=!1,u()}}}function O(c){let e,s,n,l,t,o,f,m,i;return{c(){e=_("div"),s=_("div"),s.innerHTML='',n=g(),l=_("div"),t=_("p"),o=h("Check "),f=_("strong"),m=h(c[0]),i=h(" for the recovery link."),p(s,"class","icon"),p(f,"class","txt-nowrap"),p(l,"class","content"),p(e,"class","alert alert-success")},m(a,b){k(a,e,b),d(e,s),d(e,n),d(e,l),d(l,t),d(t,o),d(t,f),d(f,m),d(t,i)},p(a,b){b&1&&J(m,a[0])},i:P,o:P,d(a){a&&v(e)}}}function Q(c){let e,s,n,l,t,o,f,m;return{c(){e=_("label"),s=h("Email"),l=g(),t=_("input"),p(e,"for",n=c[5]),p(t,"type","email"),p(t,"id",o=c[5]),t.required=!0,t.autofocus=!0},m(i,a){k(i,e,a),d(e,s),k(i,l,a),k(i,t,a),R(t,c[0]),t.focus(),f||(m=E(t,"input",c[4]),f=!0)},p(i,a){a&32&&n!==(n=i[5])&&p(e,"for",n),a&32&&o!==(o=i[5])&&p(t,"id",o),a&1&&t.value!==i[0]&&R(t,i[0])},d(i){i&&v(e),i&&v(l),i&&v(t),f=!1,m()}}}function U(c){let e,s,n,l,t,o,f,m;const i=[O,K],a=[];function b(u,r){return u[2]?0:1}return e=b(c),s=a[e]=i[e](c),{c(){s.c(),n=g(),l=_("div"),t=_("a"),t.textContent="Back to login",p(t,"href","/login"),p(t,"class","link-hint"),p(l,"class","content txt-center")},m(u,r){a[e].m(u,r),k(u,n,r),k(u,l,r),d(l,t),o=!0,f||(m=A(B.call(null,t)),f=!0)},p(u,r){let $=e;e=b(u),e===$?a[e].p(u,r):(N(),y(a[$],1,1,()=>{a[$]=null}),D(),s=a[e],s?s.p(u,r):(s=a[e]=i[e](u),s.c()),w(s,1),s.m(n.parentNode,n))},i(u){o||(w(s),o=!0)},o(u){y(s),o=!1},d(u){a[e].d(u),u&&v(n),u&&v(l),f=!1,m()}}}function V(c){let e,s;return e=new z({props:{$$slots:{default:[U]},$$scope:{ctx:c}}}),{c(){H(e.$$.fragment)},m(n,l){L(e,n,l),s=!0},p(n,[l]){const t={};l&71&&(t.$$scope={dirty:l,ctx:n}),e.$set(t)},i(n){s||(w(e.$$.fragment,n),s=!0)},o(n){y(e.$$.fragment,n),s=!1},d(n){S(e,n)}}}function W(c,e,s){let n="",l=!1,t=!1;async function o(){if(!l){s(1,l=!0);try{await C.admins.requestPasswordReset(n),s(2,t=!0)}catch(m){C.errorResponseHandler(m)}s(1,l=!1)}}function f(){n=this.value,s(0,n)}return[n,l,t,o,f]}class Y extends M{constructor(e){super(),T(this,e,W,V,j,{})}}export{Y as default}; diff --git a/ui/dist/assets/PageUserConfirmEmailChange.0781911d.js b/ui/dist/assets/PageUserConfirmEmailChange.1fe681aa.js similarity index 81% rename from ui/dist/assets/PageUserConfirmEmailChange.0781911d.js rename to ui/dist/assets/PageUserConfirmEmailChange.1fe681aa.js index 68a4599db..b0979f0d7 100644 --- a/ui/dist/assets/PageUserConfirmEmailChange.0781911d.js +++ b/ui/dist/assets/PageUserConfirmEmailChange.1fe681aa.js @@ -1,4 +1,4 @@ -import{S as M,i as N,s as R,F as U,c as S,m as z,t as $,a as v,d as J,C as W,E as Y,g as _,k as j,n as A,o as b,p as F,q as B,e as m,w as y,b as C,f as d,r as H,h as k,u as E,v as D,y as h,x as G,z as T}from"./index.02c04c04.js";function I(r){let e,s,t,l,n,o,c,a,i,u,g,q,p=r[3]&&L(r);return o=new B({props:{class:"form-field required",name:"password",$$slots:{default:[O,({uniqueId:f})=>({8:f}),({uniqueId:f})=>f?256:0]},$$scope:{ctx:r}}}),{c(){e=m("form"),s=m("div"),t=m("h4"),l=y(`Type your password to confirm changing your email address - `),p&&p.c(),n=C(),S(o.$$.fragment),c=C(),a=m("button"),i=m("span"),i.textContent="Confirm new email",d(t,"class","m-b-xs"),d(s,"class","content txt-center m-b-sm"),d(i,"class","txt"),d(a,"type","submit"),d(a,"class","btn btn-lg btn-block"),a.disabled=r[1],H(a,"btn-loading",r[1])},m(f,w){_(f,e,w),k(e,s),k(s,t),k(t,l),p&&p.m(t,null),k(e,n),z(o,e,null),k(e,c),k(e,a),k(a,i),u=!0,g||(q=E(e,"submit",D(r[4])),g=!0)},p(f,w){f[3]?p?p.p(f,w):(p=L(f),p.c(),p.m(t,null)):p&&(p.d(1),p=null);const P={};w&769&&(P.$$scope={dirty:w,ctx:f}),o.$set(P),(!u||w&2)&&(a.disabled=f[1]),w&2&&H(a,"btn-loading",f[1])},i(f){u||($(o.$$.fragment,f),u=!0)},o(f){v(o.$$.fragment,f),u=!1},d(f){f&&b(e),p&&p.d(),J(o),g=!1,q()}}}function K(r){let e,s,t,l,n;return{c(){e=m("div"),e.innerHTML=`Email address changed
-You can now sign in with your new email address.
Successfully changed the user email address.
+You can now sign in with your new email address.
Successfully changed the user password.
+You can now sign in with your new password.
Password changed
-You can now sign in with your new password.
Invalid or expired verification token.
Successfully verified email address.
^\\w+$
.",p(e,"for",i=n[5]),p(l,"type","text"),p(l,"id",o=n[5]),p(a,"class","help-block")},m(c,d){w(c,e,d),g(e,t),w(c,s,d),w(c,l,d),Me(l,n[0].pattern),w(c,r,d),w(c,a,d),u||(f=G(l,"input",n[4]),u=!0)},p(c,d){d&32&&i!==(i=c[5])&&p(e,"for",i),d&32&&o!==(o=c[5])&&p(l,"id",o),d&1&&l.value!==c[0].pattern&&Me(l,c[0].pattern)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function H$(n){let e,t,i,s,l,o,r,a,u,f;return i=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[F$,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[N$,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),u=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.pattern",$$slots:{default:[R$,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),r=T(),a=_("div"),V(u.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(a,"class","col-sm-12"),p(e,"class","grid")},m(c,d){w(c,e,d),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),g(e,r),g(e,a),j(u,a,null),f=!0},p(c,[d]){const h={};d&2&&(h.name="schema."+c[1]+".options.min"),d&97&&(h.$$scope={dirty:d,ctx:c}),i.$set(h);const m={};d&2&&(m.name="schema."+c[1]+".options.max"),d&97&&(m.$$scope={dirty:d,ctx:c}),o.$set(m);const v={};d&2&&(v.name="schema."+c[1]+".options.pattern"),d&97&&(v.$$scope={dirty:d,ctx:c}),u.$set(v)},i(c){f||(E(i.$$.fragment,c),E(o.$$.fragment,c),E(u.$$.fragment,c),f=!0)},o(c){P(i.$$.fragment,c),P(o.$$.fragment,c),P(u.$$.fragment,c),f=!1},d(c){c&&k(e),q(i),q(o),q(u)}}}function j$(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=At(this.value),t(0,s)}function o(){s.max=At(this.value),t(0,s)}function r(){s.pattern=this.value,t(0,s)}return n.$$set=a=>{"key"in a&&t(1,i=a.key),"options"in a&&t(0,s=a.options)},[s,i,l,o,r]}class q$ extends Ee{constructor(e){super(),Oe(this,e,j$,H$,De,{key:1,options:0})}}function V$(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Min"),s=T(),l=_("input"),p(e,"for",i=n[4]),p(l,"type","number"),p(l,"id",o=n[4])},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].min),r||(a=G(l,"input",n[2]),r=!0)},p(u,f){f&16&&i!==(i=u[4])&&p(e,"for",i),f&16&&o!==(o=u[4])&&p(l,"id",o),f&1&&At(l.value)!==u[0].min&&Me(l,u[0].min)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function z$(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=F("Max"),s=T(),l=_("input"),p(e,"for",i=n[4]),p(l,"type","number"),p(l,"id",o=n[4]),p(l,"min",r=n[0].min)},m(f,c){w(f,e,c),g(e,t),w(f,s,c),w(f,l,c),Me(l,n[0].max),a||(u=G(l,"input",n[3]),a=!0)},p(f,c){c&16&&i!==(i=f[4])&&p(e,"for",i),c&16&&o!==(o=f[4])&&p(l,"id",o),c&1&&r!==(r=f[0].min)&&p(l,"min",r),c&1&&At(l.value)!==f[0].max&&Me(l,f[0].max)},d(f){f&&k(e),f&&k(s),f&&k(l),a=!1,u()}}}function B$(n){let e,t,i,s,l,o,r;return i=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[V$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[z$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid")},m(a,u){w(a,e,u),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),r=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.min"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.max"),u&49&&(c.$$scope={dirty:u,ctx:a}),o.$set(c)},i(a){r||(E(i.$$.fragment,a),E(o.$$.fragment,a),r=!0)},o(a){P(i.$$.fragment,a),P(o.$$.fragment,a),r=!1},d(a){a&&k(e),q(i),q(o)}}}function U$(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=At(this.value),t(0,s)}function o(){s.max=At(this.value),t(0,s)}return n.$$set=r=>{"key"in r&&t(1,i=r.key),"options"in r&&t(0,s=r.options)},[s,i,l,o]}class W$ extends Ee{constructor(e){super(),Oe(this,e,U$,B$,De,{key:1,options:0})}}function Y$(n,e,t){let{key:i=""}=e,{options:s={}}=e;return n.$$set=l=>{"key"in l&&t(0,i=l.key),"options"in l&&t(1,s=l.options)},[i,s]}class K$ extends Ee{constructor(e){super(),Oe(this,e,Y$,null,De,{key:0,options:1})}}function Z$(n){let e,t,i,s,l=[{type:t=n[3].type||"text"},{value:n[2]},n[3]],o={};for(let r=0;r@request.method
- @request.query.*
- @request.data.*
- @request.user.*
`,C=T(),$=_("hr"),M=T(),D=_("p"),D.innerHTML="You could also add constraints and query other collections using the @collection filter:",O=T(),A=_("div"),A.innerHTML="@collection.ANY_COLLECTION_NAME.*
",I=T(),L=_("hr"),R=T(),B=_("p"),B.innerHTML=`Example rule:
- @request.user.id!="" && created>"2022-01-01 00:00:00"
`,p(s,"class","m-b-0"),p(o,"class","inline-flex flex-gap-5"),p(m,"class","m-t-10 m-b-5"),p(b,"class","m-b-0"),p(S,"class","inline-flex flex-gap-5"),p($,"class","m-t-10 m-b-5"),p(D,"class","m-b-0"),p(A,"class","inline-flex flex-gap-5"),p(L,"class","m-t-10 m-b-5"),p(i,"class","content"),p(t,"class","alert alert-warning m-0")},m(W,te){w(W,e,te),g(e,t),g(t,i),g(i,s),g(i,l),g(i,o),g(o,r),g(o,a),g(o,u),g(o,f),g(o,c),g(o,d);for(let x=0;xOPERAND
- OPERATOR
- OPERAND
, where:`,t=T(),i=_("ul"),s=_("li"),s.innerHTML=`OPERAND
- could be any of the above field literal, string (single or double
- quoted), number, null, true, false`,l=T(),o=_("li"),r=_("code"),r.textContent="OPERATOR",a=F(` - is one of:
- `),u=_("br"),f=T(),c=_("ul"),d=_("li"),h=_("code"),h.textContent="=",m=T(),v=_("span"),v.textContent="Equal",b=T(),y=_("li"),S=_("code"),S.textContent="!=",C=T(),$=_("span"),$.textContent="NOT equal",M=T(),D=_("li"),O=_("code"),O.textContent=">",A=T(),I=_("span"),I.textContent="Greater than",L=T(),R=_("li"),B=_("code"),B.textContent=">=",K=T(),J=_("span"),J.textContent="Greater than or equal",H=T(),X=_("li"),W=_("code"),W.textContent="<",te=T(),x=_("span"),x.textContent="Less than or equal",oe=T(),me=_("li"),se=_("code"),se.textContent="<=",ge=T(),ke=_("span"),ke.textContent="Less than or equal",Y=T(),ve=_("li"),ee=_("code"),ee.textContent="~",Q=T(),Se=_("span"),Se.textContent=`Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard
- match)`,je=T(),Ue=_("li"),Z=_("code"),Z.textContent="!~",pe=T(),ce=_("span"),ce.textContent=`NOT Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for
- wildcard match)`,we=T(),Ze=_("p"),Ze.innerHTML=`To group and combine several expressions you could use brackets
- (...)
, &&
(AND) and ||
(OR) tokens.`,p(r,"class","txt-danger"),p(h,"class","filter-op svelte-1w7s5nw"),p(v,"class","txt-hint"),p(S,"class","filter-op svelte-1w7s5nw"),p($,"class","txt-hint"),p(O,"class","filter-op svelte-1w7s5nw"),p(I,"class","txt-hint"),p(B,"class","filter-op svelte-1w7s5nw"),p(J,"class","txt-hint"),p(W,"class","filter-op svelte-1w7s5nw"),p(x,"class","txt-hint"),p(se,"class","filter-op svelte-1w7s5nw"),p(ke,"class","txt-hint"),p(ee,"class","filter-op svelte-1w7s5nw"),p(Se,"class","txt-hint"),p(Z,"class","filter-op svelte-1w7s5nw"),p(ce,"class","txt-hint")},m(tt,We){w(tt,e,We),w(tt,t,We),w(tt,i,We),g(i,s),g(i,l),g(i,o),g(o,r),g(o,a),g(o,u),g(o,f),g(o,c),g(c,d),g(d,h),g(d,m),g(d,v),g(c,b),g(c,y),g(y,S),g(y,C),g(y,$),g(c,M),g(c,D),g(D,O),g(D,A),g(D,I),g(c,L),g(c,R),g(R,B),g(R,K),g(R,J),g(c,H),g(c,X),g(X,W),g(X,te),g(X,x),g(c,oe),g(c,me),g(me,se),g(me,ge),g(me,ke),g(c,Y),g(c,ve),g(ve,ee),g(ve,Q),g(ve,Se),g(c,je),g(c,Ue),g(Ue,Z),g(Ue,pe),g(Ue,ce),w(tt,we,We),w(tt,Ze,We)},p:re,i:re,o:re,d(tt){tt&&k(e),tt&&k(t),tt&&k(i),tt&&k(we),tt&&k(Ze)}}}class W3 extends Ee{constructor(e){super(),Oe(this,e,null,U3,De,{})}}function pd(n,e,t){const i=n.slice();return i[5]=e[t],i}function hd(n,e,t){const i=n.slice();return i[5]=e[t],i}function md(n,e){let t,i,s=e[5].title+"",l,o,r,a;function u(){return e[4](e[5])}return{key:n,first:null,c(){t=_("button"),i=_("div"),l=F(s),o=T(),p(i,"class","txt"),p(t,"class","tab-item svelte-1maocj6"),ie(t,"active",e[0]===e[5].language),this.first=t},m(f,c){w(f,t,c),g(t,i),g(i,l),g(t,o),r||(a=G(t,"click",u),r=!0)},p(f,c){e=f,c&2&&s!==(s=e[5].title+"")&&ue(l,s),c&3&&ie(t,"active",e[0]===e[5].language)},d(f){f&&k(t),r=!1,a()}}}function gd(n,e){let t,i,s,l;return i=new gn({props:{language:e[5].language,content:e[5].content}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item svelte-1maocj6"),ie(t,"active",e[0]===e[5].language),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o;const a={};r&2&&(a.language=e[5].language),r&2&&(a.content=e[5].content),i.$set(a),r&3&&ie(t,"active",e[0]===e[5].language)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function Y3(n){let e,t,i=[],s=new Map,l,o,r=[],a=new Map,u,f=n[1];const c=m=>m[5].language;for(let m=0;mAuthorization: Admin TOKEN
header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function kd(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("div"),s=F(i),l=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),g(t,s),g(t,l),o||(r=G(t,"click",a),o=!0)},p(u,f){e=u,f&20&&ie(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function wd(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o,r&20&&ie(t,"active",e[2]===e[6].code)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function Z3(n){var mi,Tl,ds,Dl;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,m,v,b,y=n[0].name+"",S,C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,te,x,oe,me,se,ge,ke,Y,ve,ee,Q,Se,je,Ue,Z,pe,ce,we,Ze,tt,We,it,Ce,ze,Ge,st,ct,_e,Ie,nt,ft,vt,ot,Ot,wt,jt,Nt,Ke,$e,Be,et,at,Pt,It,Lt,lt,N,z,ne,ae=[],Ae=new Map,le,ye,Te=[],fe=new Map,de,Fe=n[1]&&yd();O=new Ls({props:{js:`
- import PocketBase from 'pocketbase';
-
- const client = new PocketBase('${n[3]}');
-
- ...
-
- // fetch a paginated records list
- const resultList = await client.records.getList('${(mi=n[0])==null?void 0:mi.name}', 1, 50, {
- filter: 'created >= "2022-01-01 00:00:00"',
- });
-
- // alternatively you can also fetch all records at once via getFullList:
- const records = await client.records.getFullList('${(Tl=n[0])==null?void 0:Tl.name}', 200 /* batch size */, {
- sort: '-created',
- });
- `,dart:`
- import 'package:pocketbase/pocketbase.dart';
-
- final client = PocketBase('${n[3]}');
-
- ...
-
- // fetch a paginated records list
- final result = await client.records.getList(
- '${(ds=n[0])==null?void 0:ds.name}',
- page: 1,
- perPage: 50,
- filter: 'created >= "2022-01-01 00:00:00"',
- );
-
- // alternatively you can also fetch all records at once via getFullList:
- final records = await client.records.getFullList('${(Dl=n[0])==null?void 0:Dl.name}', batch: 200, sort: '-created');
- `}}),Z=new gn({props:{content:`
- // DESC by created and ASC by id
- ?sort=-created,id
- `}}),ze=new gn({props:{content:`
- ?filter=(id='abc' && created>'2022-01-01')
- `}}),st=new W3({}),wt=new gn({props:{content:`
- ?expand=rel1,rel2.subrel21.subrel22
- `}});let ht=n[4];const rn=qe=>qe[6].code;for(let qe=0;qeAuthorization: Admin TOKEN
header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Md(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=F(i),l=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),g(t,s),g(t,l),o||(r=G(t,"click",a),o=!0)},p(u,f){e=u,f&20&&ie(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Td(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o,r&20&&ie(t,"active",e[2]===e[6].code)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function X3(n){var Nt,Ke;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,m,v,b,y,S=n[0].name+"",C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,te,x,oe,me,se,ge,ke,Y,ve,ee,Q,Se,je,Ue,Z,pe,ce,we,Ze,tt,We,it,Ce,ze,Ge=[],st=new Map,ct,_e,Ie=[],nt=new Map,ft,vt=n[1]&&Cd();A=new Ls({props:{js:`
- import PocketBase from 'pocketbase';
-
- const client = new PocketBase('${n[3]}');
-
- ...
-
- const record = await client.records.getOne('${(Nt=n[0])==null?void 0:Nt.name}', 'RECORD_ID', {
- expand: 'some_relation'
- });
- `,dart:`
- import 'package:pocketbase/pocketbase.dart';
-
- final client = PocketBase('${n[3]}');
-
- ...
-
- final record = await client.records.getOne('${(Ke=n[0])==null?void 0:Ke.name}', 'RECORD_ID', query: {
- 'expand': 'some_relation',
- });
- `}}),ee=new gn({props:{content:`
- ?expand=rel1,rel2.subrel21.subrel22
- `}});let ot=n[4];const Ot=$e=>$e[6].code;for(let $e=0;$eAuthorization: Admin TOKEN
header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function eC(n){let e;return{c(){e=_("span"),e.textContent="Optional",p(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function tC(n){let e;return{c(){e=_("span"),e.textContent="Required",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function nC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=F("User "),i=F(t),s=F(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ue(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function iC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=F("Relation record "),i=F(t),s=F(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ue(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function sC(n){let e,t,i,s,l;return{c(){e=F("FormData object."),t=_("br"),i=F(`
- Set to `),s=_("code"),s.textContent="null",l=F(" to delete already uploaded file(s).")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:re,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function lC(n){let e;return{c(){e=F("URL address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function oC(n){let e;return{c(){e=F("Email address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function rC(n){let e;return{c(){e=F("JSON array or object.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function aC(n){let e;return{c(){e=F("Number value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function uC(n){let e;return{c(){e=F("Plain text value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function Pd(n,e){let t,i,s,l,o,r=e[11].name+"",a,u,f,c,d=U.getFieldValueType(e[11])+"",h,m,v,b;function y(O,A){return O[11].required?tC:eC}let S=y(e),C=S(e);function $(O,A){if(O[11].type==="text")return uC;if(O[11].type==="number")return aC;if(O[11].type==="json")return rC;if(O[11].type==="email")return oC;if(O[11].type==="url")return lC;if(O[11].type==="file")return sC;if(O[11].type==="relation")return iC;if(O[11].type==="user")return nC}let M=$(e),D=M&&M(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),C.c(),l=T(),o=_("span"),a=F(r),u=T(),f=_("td"),c=_("span"),h=F(d),m=T(),v=_("td"),D&&D.c(),b=T(),p(s,"class","inline-flex"),p(c,"class","label"),this.first=t},m(O,A){w(O,t,A),g(t,i),g(i,s),C.m(s,null),g(s,l),g(s,o),g(o,a),g(t,u),g(t,f),g(f,c),g(c,h),g(t,m),g(t,v),D&&D.m(v,null),g(t,b)},p(O,A){e=O,S!==(S=y(e))&&(C.d(1),C=S(e),C&&(C.c(),C.m(s,l))),A&1&&r!==(r=e[11].name+"")&&ue(a,r),A&1&&d!==(d=U.getFieldValueType(e[11])+"")&&ue(h,d),M===(M=$(e))&&D?D.p(e,A):(D&&D.d(1),D=M&&M(e),D&&(D.c(),D.m(v,null)))},d(O){O&&k(t),C.d(),D&&D.d()}}}function Ld(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=F(i),l=T(),p(t,"class","tab-item"),ie(t,"active",e[1]===e[6].code),this.first=t},m(u,f){w(u,t,f),g(t,s),g(t,l),o||(r=G(t,"click",a),o=!0)},p(u,f){e=u,f&4&&i!==(i=e[6].code+"")&&ue(s,i),f&6&&ie(t,"active",e[1]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Id(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item"),ie(t,"active",e[1]===e[6].code),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o;const a={};r&4&&(a.content=e[6].body),i.$set(a),r&6&&ie(t,"active",e[1]===e[6].code)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function fC(n){var ne,ae,Ae;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,m,v,b,y=n[0].name+"",S,C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,te,x,oe,me=[],se=new Map,ge,ke,Y,ve,ee,Q,Se,je,Ue,Z,pe,ce,we,Ze,tt,We,it,Ce,ze,Ge,st,ct,_e,Ie,nt,ft,vt,ot,Ot,wt=[],jt=new Map,Nt,Ke,$e=[],Be=new Map,et,at=n[4]&&Ad();R=new Ls({props:{js:`
- import PocketBase from 'pocketbase';
-
- const client = new PocketBase('${n[3]}');
-
- ...
-
- const data = { ... };
-
- const record = await client.records.create('${(ne=n[0])==null?void 0:ne.name}', data);
- `,dart:`
- import 'package:pocketbase/pocketbase.dart';
-
- final client = PocketBase('${n[3]}');
-
- ...
-
- final body = multipart/form-data
.`,D=T(),O=_("p"),O.innerHTML="File upload is supported only via multipart/form-data
.",A=T(),I=_("div"),I.textContent="Client SDKs example",L=T(),V(R.$$.fragment),B=T(),K=_("div"),K.textContent="Body Parameters",J=T(),H=_("table"),X=_("thead"),X.innerHTML=`Authorization: Admin TOKEN
header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function pC(n){let e;return{c(){e=_("span"),e.textContent="Optional",p(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function hC(n){let e;return{c(){e=_("span"),e.textContent="Required",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function mC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=F("User "),i=F(t),s=F(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ue(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function gC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=F("Relation record "),i=F(t),s=F(".")},m(o,r){w(o,e,r),w(o,i,r),w(o,s,r)},p(o,r){var a;r&1&&t!==(t=((a=o[11].options)==null?void 0:a.maxSelect)>1?"ids":"id")&&ue(i,t)},d(o){o&&k(e),o&&k(i),o&&k(s)}}}function _C(n){let e,t,i,s,l;return{c(){e=F("FormData object."),t=_("br"),i=F(`
- Set to `),s=_("code"),s.textContent="null",l=F(" to delete already uploaded file(s).")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),w(o,s,r),w(o,l,r)},p:re,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function bC(n){let e;return{c(){e=F("URL address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function vC(n){let e;return{c(){e=F("Email address.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function yC(n){let e;return{c(){e=F("JSON array or object.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function kC(n){let e;return{c(){e=F("Number value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function wC(n){let e;return{c(){e=F("Plain text value.")},m(t,i){w(t,e,i)},p:re,d(t){t&&k(e)}}}function jd(n,e){let t,i,s,l,o,r=e[11].name+"",a,u,f,c,d=U.getFieldValueType(e[11])+"",h,m,v,b;function y(O,A){return O[11].required?hC:pC}let S=y(e),C=S(e);function $(O,A){if(O[11].type==="text")return wC;if(O[11].type==="number")return kC;if(O[11].type==="json")return yC;if(O[11].type==="email")return vC;if(O[11].type==="url")return bC;if(O[11].type==="file")return _C;if(O[11].type==="relation")return gC;if(O[11].type==="user")return mC}let M=$(e),D=M&&M(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),C.c(),l=T(),o=_("span"),a=F(r),u=T(),f=_("td"),c=_("span"),h=F(d),m=T(),v=_("td"),D&&D.c(),b=T(),p(s,"class","inline-flex"),p(c,"class","label"),this.first=t},m(O,A){w(O,t,A),g(t,i),g(i,s),C.m(s,null),g(s,l),g(s,o),g(o,a),g(t,u),g(t,f),g(f,c),g(c,h),g(t,m),g(t,v),D&&D.m(v,null),g(t,b)},p(O,A){e=O,S!==(S=y(e))&&(C.d(1),C=S(e),C&&(C.c(),C.m(s,l))),A&1&&r!==(r=e[11].name+"")&&ue(a,r),A&1&&d!==(d=U.getFieldValueType(e[11])+"")&&ue(h,d),M===(M=$(e))&&D?D.p(e,A):(D&&D.d(1),D=M&&M(e),D&&(D.c(),D.m(v,null)))},d(O){O&&k(t),C.d(),D&&D.d()}}}function qd(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=F(i),l=T(),p(t,"class","tab-item"),ie(t,"active",e[1]===e[6].code),this.first=t},m(u,f){w(u,t,f),g(t,s),g(t,l),o||(r=G(t,"click",a),o=!0)},p(u,f){e=u,f&4&&i!==(i=e[6].code+"")&&ue(s,i),f&6&&ie(t,"active",e[1]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Vd(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item"),ie(t,"active",e[1]===e[6].code),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o;const a={};r&4&&(a.content=e[6].body),i.$set(a),r&6&&ie(t,"active",e[1]===e[6].code)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function $C(n){var le,ye,Te;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,m,v,b,y,S=n[0].name+"",C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,te,x,oe,me,se,ge,ke=[],Y=new Map,ve,ee,Q,Se,je,Ue,Z,pe,ce,we,Ze,tt,We,it,Ce,ze,Ge,st,ct,_e,Ie,nt,ft,vt,ot,Ot,wt,jt,Nt,Ke=[],$e=new Map,Be,et,at=[],Pt=new Map,It,Lt=n[4]&&Hd();B=new Ls({props:{js:`
- import PocketBase from 'pocketbase';
-
- const client = new PocketBase('${n[3]}');
-
- ...
-
- const data = { ... };
-
- const record = await client.records.update('${(le=n[0])==null?void 0:le.name}', 'RECORD_ID', data);
- `,dart:`
- import 'package:pocketbase/pocketbase.dart';
-
- final client = PocketBase('${n[3]}');
-
- ...
-
- final body = multipart/form-data
.`,O=T(),A=_("p"),A.innerHTML="File upload is supported only via multipart/form-data
.",I=T(),L=_("div"),L.textContent="Client SDKs example",R=T(),V(B.$$.fragment),K=T(),J=_("div"),J.textContent="Path parameters",H=T(),X=_("table"),X.innerHTML=`Authorization: Admin TOKEN
header",p(e,"class","txt-hint txt-sm txt-right")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Wd(n,e){let t,i=e[6].code+"",s,l,o,r;function a(){return e[5](e[6])}return{key:n,first:null,c(){t=_("button"),s=F(i),l=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),g(t,s),g(t,l),o||(r=G(t,"click",a),o=!0)},p(u,f){e=u,f&20&&ie(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Yd(n,e){let t,i,s,l;return i=new gn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),V(i.$$.fragment),s=T(),p(t,"class","tab-item"),ie(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),j(i,t,null),g(t,s),l=!0},p(o,r){e=o,r&20&&ie(t,"active",e[2]===e[6].code)},i(o){l||(E(i.$$.fragment,o),l=!0)},o(o){P(i.$$.fragment,o),l=!1},d(o){o&&k(t),q(i)}}}function MC(n){var je,Ue;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,m,v,b,y,S=n[0].name+"",C,$,M,D,O,A,I,L,R,B,K,J,H,X,W,te=[],x=new Map,oe,me,se=[],ge=new Map,ke,Y=n[1]&&Ud();A=new Ls({props:{js:`
- import PocketBase from 'pocketbase';
-
- const client = new PocketBase('${n[3]}');
-
- ...
-
- await client.records.delete('${(je=n[0])==null?void 0:je.name}', 'RECORD_ID');
- `,dart:`
- import 'package:pocketbase/pocketbase.dart';
-
- final client = PocketBase('${n[3]}');
-
- ...
-
- await client.records.delete('${(Ue=n[0])==null?void 0:Ue.name}', 'RECORD_ID');
- `}});let ve=n[4];const ee=Z=>Z[6].code;for(let Z=0;Z/api/realtime
Subscribe to realtime changes via Server-Sent Events (SSE).
-Events are send for create, update - and delete record operations (see "Event data format" section below).
-You could subscribe to a single record or to an entire collection.
-When you subscribe to a single record, the collection's - ViewRule will be used to determine whether the subscriber has access to receive - the event message.
-When you subscribe to an entire collection, the collection's - ListRule will be used to determine whether the subscriber has access to receive - the event message.
By default PocketBase uses the OS sendmail
command for sending emails.
-
- For better emails deliverability it is recommended to enable the SMTP settings
- below.
%APP_URL%
, %TOKEN%
.`,p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23]),l.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),g(e,t),w(c,s,d),w(c,l,d),Me(l,n[0].meta.userVerificationUrl),w(c,r,d),w(c,a,d),u||(f=G(l,"input",n[10]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&p(e,"for",i),d&8388608&&o!==(o=c[23])&&p(l,"id",o),d&1&&l.value!==c[0].meta.userVerificationUrl&&Me(l,c[0].meta.userVerificationUrl)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function wD(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=F("User reset password page url"),s=T(),l=_("input"),r=T(),a=_("div"),a.innerHTML=`Used in the user password reset email. Available placeholder parameters:
- %APP_URL%
, %TOKEN%
.`,p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23]),l.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),g(e,t),w(c,s,d),w(c,l,d),Me(l,n[0].meta.userResetPasswordUrl),w(c,r,d),w(c,a,d),u||(f=G(l,"input",n[11]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&p(e,"for",i),d&8388608&&o!==(o=c[23])&&p(l,"id",o),d&1&&l.value!==c[0].meta.userResetPasswordUrl&&Me(l,c[0].meta.userResetPasswordUrl)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function $D(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=F("User confirm email change page url"),s=T(),l=_("input"),r=T(),a=_("div"),a.innerHTML=`Used in the user email change confirmation email. Available placeholder
- parameters:
- %APP_URL%
, %TOKEN%
.`,p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23]),l.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),g(e,t),w(c,s,d),w(c,l,d),Me(l,n[0].meta.userConfirmEmailChangeUrl),w(c,r,d),w(c,a,d),u||(f=G(l,"input",n[12]),u=!0)},p(c,d){d&8388608&&i!==(i=c[23])&&p(e,"for",i),d&8388608&&o!==(o=c[23])&&p(l,"id",o),d&1&&l.value!==c[0].meta.userConfirmEmailChangeUrl&&Me(l,c[0].meta.userConfirmEmailChangeUrl)},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function SD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=F("Use SMTP mail server"),p(e,"type","checkbox"),p(e,"id",t=n[23]),e.required=!0,p(s,"for",o=n[23])},m(u,f){w(u,e,f),e.checked=n[0].smtp.enabled,w(u,i,f),w(u,s,f),g(s,l),r||(a=G(e,"change",n[13]),r=!0)},p(u,f){f&8388608&&t!==(t=u[23])&&p(e,"id",t),f&1&&(e.checked=u[0].smtp.enabled),f&8388608&&o!==(o=u[23])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function rh(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C;return i=new Ne({props:{class:"form-field required",name:"smtp.host",$$slots:{default:[CD,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"smtp.port",$$slots:{default:[MD,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),u=new Ne({props:{class:"form-field required",name:"smtp.tls",$$slots:{default:[TD,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),d=new Ne({props:{class:"form-field",name:"smtp.username",$$slots:{default:[DD,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),v=new Ne({props:{class:"form-field",name:"smtp.password",$$slots:{default:[OD,({uniqueId:$})=>({23:$}),({uniqueId:$})=>$?8388608:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),r=T(),a=_("div"),V(u.$$.fragment),f=T(),c=_("div"),V(d.$$.fragment),h=T(),m=_("div"),V(v.$$.fragment),b=T(),y=_("div"),p(t,"class","col-lg-6"),p(l,"class","col-lg-3"),p(a,"class","col-lg-3"),p(c,"class","col-lg-6"),p(m,"class","col-lg-6"),p(y,"class","col-lg-12"),p(e,"class","grid")},m($,M){w($,e,M),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),g(e,r),g(e,a),j(u,a,null),g(e,f),g(e,c),j(d,c,null),g(e,h),g(e,m),j(v,m,null),g(e,b),g(e,y),C=!0},p($,M){const D={};M&25165825&&(D.$$scope={dirty:M,ctx:$}),i.$set(D);const O={};M&25165825&&(O.$$scope={dirty:M,ctx:$}),o.$set(O);const A={};M&25165825&&(A.$$scope={dirty:M,ctx:$}),u.$set(A);const I={};M&25165825&&(I.$$scope={dirty:M,ctx:$}),d.$set(I);const L={};M&25165825&&(L.$$scope={dirty:M,ctx:$}),v.$set(L)},i($){C||(E(i.$$.fragment,$),E(o.$$.fragment,$),E(u.$$.fragment,$),E(d.$$.fragment,$),E(v.$$.fragment,$),$&&Dt(()=>{S||(S=rt(e,tn,{duration:150},!0)),S.run(1)}),C=!0)},o($){P(i.$$.fragment,$),P(o.$$.fragment,$),P(u.$$.fragment,$),P(d.$$.fragment,$),P(v.$$.fragment,$),$&&(S||(S=rt(e,tn,{duration:150},!1)),S.run(0)),C=!1},d($){$&&k(e),q(i),q(o),q(u),q(d),q(v),$&&S&&S.end()}}}function CD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("SMTP server host"),s=T(),l=_("input"),p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].smtp.host),r||(a=G(l,"input",n[14]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&p(e,"for",i),f&8388608&&o!==(o=u[23])&&p(l,"id",o),f&1&&l.value!==u[0].smtp.host&&Me(l,u[0].smtp.host)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function MD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Port"),s=T(),l=_("input"),p(e,"for",i=n[23]),p(l,"type","number"),p(l,"id",o=n[23]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].smtp.port),r||(a=G(l,"input",n[15]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&p(e,"for",i),f&8388608&&o!==(o=u[23])&&p(l,"id",o),f&1&&At(l.value)!==u[0].smtp.port&&Me(l,u[0].smtp.port)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function TD(n){let e,t,i,s,l,o,r;function a(f){n[16](f)}let u={id:n[23],items:n[5]};return n[0].smtp.tls!==void 0&&(u.keyOfSelected=n[0].smtp.tls),l=new fs({props:u}),he.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=F("TLS Encryption"),s=T(),V(l.$$.fragment),p(e,"for",i=n[23])},m(f,c){w(f,e,c),g(e,t),w(f,s,c),j(l,f,c),r=!0},p(f,c){(!r||c&8388608&&i!==(i=f[23]))&&p(e,"for",i);const d={};c&8388608&&(d.id=f[23]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].smtp.tls,He(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),q(l,f)}}}function DD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Username"),s=T(),l=_("input"),p(e,"for",i=n[23]),p(l,"type","text"),p(l,"id",o=n[23])},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].smtp.username),r||(a=G(l,"input",n[17]),r=!0)},p(u,f){f&8388608&&i!==(i=u[23])&&p(e,"for",i),f&8388608&&o!==(o=u[23])&&p(l,"id",o),f&1&&l.value!==u[0].smtp.username&&Me(l,u[0].smtp.username)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function OD(n){let e,t,i,s,l,o,r;function a(f){n[18](f)}let u={id:n[23]};return n[0].smtp.password!==void 0&&(u.value=n[0].smtp.password),l=new Ka({props:u}),he.push(()=>Re(l,"value",a)),{c(){e=_("label"),t=F("Password"),s=T(),V(l.$$.fragment),p(e,"for",i=n[23])},m(f,c){w(f,e,c),g(e,t),w(f,s,c),j(l,f,c),r=!0},p(f,c){(!r||c&8388608&&i!==(i=f[23]))&&p(e,"for",i);const d={};c&8388608&&(d.id=f[23]),!o&&c&1&&(o=!0,d.value=f[0].smtp.password,He(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),q(l,f)}}}function ED(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b;const y=[bD,_D],S=[];function C($,M){return $[1]?0:1}return d=C(n),h=S[d]=y[d](n),{c(){e=_("header"),t=_("nav"),i=_("div"),i.textContent="Settings",s=T(),l=_("div"),o=F(n[4]),r=T(),a=_("div"),u=_("form"),f=_("div"),f.innerHTML="Configure common settings for sending emails.
",c=T(),h.c(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(f,"class","content txt-xl m-b-base"),p(u,"class","panel"),p(u,"autocomplete","off"),p(a,"class","wrapper")},m($,M){w($,e,M),g(e,t),g(t,i),g(t,s),g(t,l),g(l,o),w($,r,M),w($,a,M),g(a,u),g(u,f),g(u,c),S[d].m(u,null),m=!0,v||(b=G(u,"submit",Yt(n[20])),v=!0)},p($,M){(!m||M&16)&&ue(o,$[4]);let D=d;d=C($),d===D?S[d].p($,M):(Pe(),P(S[D],1,1,()=>{S[D]=null}),Le(),h=S[d],h?h.p($,M):(h=S[d]=y[d]($),h.c()),E(h,1),h.m(u,null))},i($){m||(E(h),m=!0)},o($){P(h),m=!1},d($){$&&k(e),$&&k(r),$&&k(a),S[d].d(),v=!1,b()}}}function AD(n){let e,t,i,s;return e=new Vi({}),i=new Dn({props:{$$slots:{default:[ED]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment),t=T(),V(i.$$.fragment)},m(l,o){j(e,l,o),w(l,t,o),j(i,l,o),s=!0},p(l,[o]){const r={};o&16777247&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){q(e,l),l&&k(t),q(i,l)}}}function PD(n,e,t){let i,s;kt(n,Rt,L=>t(4,s=L));const l=[{label:"Optional (StartTLS)",value:!1},{label:"Always",value:!0}];dn(Rt,s="Mail settings",s);let o={},r=!1,a=!1,u="";f();async function f(){t(1,r=!0);try{const L=await be.settings.getAll()||{};d(L)}catch(L){be.errorResponseHandler(L)}t(1,r=!1)}async function c(){if(!(a||!i)){t(2,a=!0);try{const L=await be.settings.update(U.filterRedactedProps(o));d(L),cn("Successfully saved mail settings.")}catch(L){be.errorResponseHandler(L)}t(2,a=!1)}}function d(L={}){t(0,o={meta:(L==null?void 0:L.meta)||{},smtp:(L==null?void 0:L.smtp)||{}}),t(7,u=JSON.stringify(o))}function h(){o.meta.senderName=this.value,t(0,o)}function m(){o.meta.senderAddress=this.value,t(0,o)}function v(){o.meta.userVerificationUrl=this.value,t(0,o)}function b(){o.meta.userResetPasswordUrl=this.value,t(0,o)}function y(){o.meta.userConfirmEmailChangeUrl=this.value,t(0,o)}function S(){o.smtp.enabled=this.checked,t(0,o)}function C(){o.smtp.host=this.value,t(0,o)}function $(){o.smtp.port=At(this.value),t(0,o)}function M(L){n.$$.not_equal(o.smtp.tls,L)&&(o.smtp.tls=L,t(0,o))}function D(){o.smtp.username=this.value,t(0,o)}function O(L){n.$$.not_equal(o.smtp.password,L)&&(o.smtp.password=L,t(0,o))}const A=()=>c(),I=()=>c();return n.$$.update=()=>{n.$$.dirty&129&&t(3,i=u!=JSON.stringify(o))},[o,r,a,i,s,l,c,u,h,m,v,b,y,S,C,$,M,D,O,A,I]}class LD extends Ee{constructor(e){super(),Oe(this,e,PD,AD,De,{})}}function ID(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;e=new Ne({props:{class:"form-field form-field-toggle",$$slots:{default:[ND,({uniqueId:b})=>({19:b}),({uniqueId:b})=>b?524288:0]},$$scope:{ctx:n}}});let m=n[3]!=n[0].enabled&&ah(n),v=n[0].enabled&&uh(n);return{c(){V(e.$$.fragment),t=T(),m&&m.c(),i=T(),v&&v.c(),s=T(),l=_("div"),o=_("div"),r=T(),a=_("button"),u=_("span"),u.textContent="Save changes",p(o,"class","flex-fill"),p(u,"class","txt"),p(a,"type","submit"),p(a,"class","btn btn-expanded"),a.disabled=f=!n[4]||n[2],ie(a,"btn-loading",n[2]),p(l,"class","flex")},m(b,y){j(e,b,y),w(b,t,y),m&&m.m(b,y),w(b,i,y),v&&v.m(b,y),w(b,s,y),w(b,l,y),g(l,o),g(l,r),g(l,a),g(a,u),c=!0,d||(h=G(a,"click",n[15]),d=!0)},p(b,y){const S={};y&1572865&&(S.$$scope={dirty:y,ctx:b}),e.$set(S),b[3]!=b[0].enabled?m?(m.p(b,y),y&9&&E(m,1)):(m=ah(b),m.c(),E(m,1),m.m(i.parentNode,i)):m&&(Pe(),P(m,1,1,()=>{m=null}),Le()),b[0].enabled?v?(v.p(b,y),y&1&&E(v,1)):(v=uh(b),v.c(),E(v,1),v.m(s.parentNode,s)):v&&(Pe(),P(v,1,1,()=>{v=null}),Le()),(!c||y&20&&f!==(f=!b[4]||b[2]))&&(a.disabled=f),y&4&&ie(a,"btn-loading",b[2])},i(b){c||(E(e.$$.fragment,b),E(m),E(v),c=!0)},o(b){P(e.$$.fragment,b),P(m),P(v),c=!1},d(b){q(e,b),b&&k(t),m&&m.d(b),b&&k(i),v&&v.d(b),b&&k(s),b&&k(l),d=!1,h()}}}function FD(n){let e;return{c(){e=_("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function ND(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=F("Use S3 storage"),p(e,"type","checkbox"),p(e,"id",t=n[19]),e.required=!0,p(s,"for",o=n[19])},m(u,f){w(u,e,f),e.checked=n[0].enabled,w(u,i,f),w(u,s,f),g(s,l),r||(a=G(e,"change",n[8]),r=!0)},p(u,f){f&524288&&t!==(t=u[19])&&p(e,"id",t),f&1&&(e.checked=u[0].enabled),f&524288&&o!==(o=u[19])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function ah(n){let e,t,i,s,l,o,r,a=n[3]?"S3 storage":"local file system",u,f,c,d=n[0].enabled?"S3 storage":"local file system",h,m,v,b,y,S,C,$,M,D,O,A;return{c(){e=_("div"),t=_("div"),i=_("div"),i.innerHTML='',s=T(),l=_("div"),o=F(`If you have existing uploaded files, you'll have to migrate them manually from - the - `),r=_("strong"),u=F(a),f=F(` - to the - `),c=_("strong"),h=F(d),m=F(`. - `),v=_("br"),b=F(` - There are numerous command line tools that can help you, such as: - `),y=_("a"),y.textContent=`rclone - `,S=F(`, - `),C=_("a"),C.textContent=`s5cmd - `,$=F(", etc."),M=T(),D=_("div"),p(i,"class","icon"),p(y,"href","https://github.com/rclone/rclone"),p(y,"target","_blank"),p(y,"rel","noopener"),p(y,"class","txt-bold"),p(C,"href","https://github.com/peak/s5cmd"),p(C,"target","_blank"),p(C,"rel","noopener"),p(C,"class","txt-bold"),p(l,"class","content"),p(t,"class","alert alert-warning m-0"),p(D,"class","clearfix m-t-base")},m(I,L){w(I,e,L),g(e,t),g(t,i),g(t,s),g(t,l),g(l,o),g(l,r),g(r,u),g(l,f),g(l,c),g(c,h),g(l,m),g(l,v),g(l,b),g(l,y),g(l,S),g(l,C),g(l,$),g(e,M),g(e,D),A=!0},p(I,L){(!A||L&8)&&a!==(a=I[3]?"S3 storage":"local file system")&&ue(u,a),(!A||L&1)&&d!==(d=I[0].enabled?"S3 storage":"local file system")&&ue(h,d)},i(I){A||(I&&Dt(()=>{O||(O=rt(e,tn,{duration:150},!0)),O.run(1)}),A=!0)},o(I){I&&(O||(O=rt(e,tn,{duration:150},!1)),O.run(0)),A=!1},d(I){I&&k(e),I&&O&&O.end()}}}function uh(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b,y,S,C,$,M,D;return i=new Ne({props:{class:"form-field required",name:"s3.endpoint",$$slots:{default:[RD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"s3.bucket",$$slots:{default:[HD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),u=new Ne({props:{class:"form-field required",name:"s3.region",$$slots:{default:[jD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),d=new Ne({props:{class:"form-field required",name:"s3.accessKey",$$slots:{default:[qD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),v=new Ne({props:{class:"form-field required",name:"s3.secret",$$slots:{default:[VD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),S=new Ne({props:{class:"form-field",name:"s3.forcePathStyle",$$slots:{default:[zD,({uniqueId:O})=>({19:O}),({uniqueId:O})=>O?524288:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),r=T(),a=_("div"),V(u.$$.fragment),f=T(),c=_("div"),V(d.$$.fragment),h=T(),m=_("div"),V(v.$$.fragment),b=T(),y=_("div"),V(S.$$.fragment),C=T(),$=_("div"),p(t,"class","col-lg-12"),p(l,"class","col-lg-6"),p(a,"class","col-lg-6"),p(c,"class","col-lg-6"),p(m,"class","col-lg-6"),p(y,"class","col-lg-12"),p($,"class","col-lg-12"),p(e,"class","grid")},m(O,A){w(O,e,A),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),g(e,r),g(e,a),j(u,a,null),g(e,f),g(e,c),j(d,c,null),g(e,h),g(e,m),j(v,m,null),g(e,b),g(e,y),j(S,y,null),g(e,C),g(e,$),D=!0},p(O,A){const I={};A&1572865&&(I.$$scope={dirty:A,ctx:O}),i.$set(I);const L={};A&1572865&&(L.$$scope={dirty:A,ctx:O}),o.$set(L);const R={};A&1572865&&(R.$$scope={dirty:A,ctx:O}),u.$set(R);const B={};A&1572865&&(B.$$scope={dirty:A,ctx:O}),d.$set(B);const K={};A&1572865&&(K.$$scope={dirty:A,ctx:O}),v.$set(K);const J={};A&1572865&&(J.$$scope={dirty:A,ctx:O}),S.$set(J)},i(O){D||(E(i.$$.fragment,O),E(o.$$.fragment,O),E(u.$$.fragment,O),E(d.$$.fragment,O),E(v.$$.fragment,O),E(S.$$.fragment,O),O&&Dt(()=>{M||(M=rt(e,tn,{duration:150},!0)),M.run(1)}),D=!0)},o(O){P(i.$$.fragment,O),P(o.$$.fragment,O),P(u.$$.fragment,O),P(d.$$.fragment,O),P(v.$$.fragment,O),P(S.$$.fragment,O),O&&(M||(M=rt(e,tn,{duration:150},!1)),M.run(0)),D=!1},d(O){O&&k(e),q(i),q(o),q(u),q(d),q(v),q(S),O&&M&&M.end()}}}function RD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Endpoint"),s=T(),l=_("input"),p(e,"for",i=n[19]),p(l,"type","text"),p(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].endpoint),r||(a=G(l,"input",n[9]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&p(e,"for",i),f&524288&&o!==(o=u[19])&&p(l,"id",o),f&1&&l.value!==u[0].endpoint&&Me(l,u[0].endpoint)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function HD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Bucket"),s=T(),l=_("input"),p(e,"for",i=n[19]),p(l,"type","text"),p(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].bucket),r||(a=G(l,"input",n[10]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&p(e,"for",i),f&524288&&o!==(o=u[19])&&p(l,"id",o),f&1&&l.value!==u[0].bucket&&Me(l,u[0].bucket)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function jD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Region"),s=T(),l=_("input"),p(e,"for",i=n[19]),p(l,"type","text"),p(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].region),r||(a=G(l,"input",n[11]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&p(e,"for",i),f&524288&&o!==(o=u[19])&&p(l,"id",o),f&1&&l.value!==u[0].region&&Me(l,u[0].region)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function qD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Access key"),s=T(),l=_("input"),p(e,"for",i=n[19]),p(l,"type","text"),p(l,"id",o=n[19]),l.required=!0},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].accessKey),r||(a=G(l,"input",n[12]),r=!0)},p(u,f){f&524288&&i!==(i=u[19])&&p(e,"for",i),f&524288&&o!==(o=u[19])&&p(l,"id",o),f&1&&l.value!==u[0].accessKey&&Me(l,u[0].accessKey)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function VD(n){let e,t,i,s,l,o,r;function a(f){n[13](f)}let u={id:n[19],required:!0};return n[0].secret!==void 0&&(u.value=n[0].secret),l=new Ka({props:u}),he.push(()=>Re(l,"value",a)),{c(){e=_("label"),t=F("Secret"),s=T(),V(l.$$.fragment),p(e,"for",i=n[19])},m(f,c){w(f,e,c),g(e,t),w(f,s,c),j(l,f,c),r=!0},p(f,c){(!r||c&524288&&i!==(i=f[19]))&&p(e,"for",i);const d={};c&524288&&(d.id=f[19]),!o&&c&1&&(o=!0,d.value=f[0].secret,He(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){P(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),q(l,f)}}}function zD(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("input"),i=T(),s=_("label"),l=_("span"),l.textContent="Force path-style addressing",o=T(),r=_("i"),p(e,"type","checkbox"),p(e,"id",t=n[19]),p(l,"class","txt"),p(r,"class","ri-information-line link-hint"),p(s,"for",a=n[19])},m(c,d){w(c,e,d),e.checked=n[0].forcePathStyle,w(c,i,d),w(c,s,d),g(s,l),g(s,o),g(s,r),u||(f=[G(e,"change",n[14]),Ye(Ct.call(null,r,{text:'Forces the request to use path-style addressing, eg. "https://s3.amazonaws.com/BUCKET/KEY" instead of the default "https://BUCKET.s3.amazonaws.com/KEY".',position:"top"}))],u=!0)},p(c,d){d&524288&&t!==(t=c[19])&&p(e,"id",t),d&1&&(e.checked=c[0].forcePathStyle),d&524288&&a!==(a=c[19])&&p(s,"for",a)},d(c){c&&k(e),c&&k(i),c&&k(s),u=!1,Qe(f)}}}function BD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,v,b;const y=[FD,ID],S=[];function C($,M){return $[1]?0:1}return d=C(n),h=S[d]=y[d](n),{c(){e=_("header"),t=_("nav"),i=_("div"),i.textContent="Settings",s=T(),l=_("div"),o=F(n[5]),r=T(),a=_("div"),u=_("form"),f=_("div"),f.innerHTML=`By default PocketBase uses the local file system to store uploaded files.
-If you have limited disk space, you could optionally connect to a S3 compatible storage.
`,c=T(),h.c(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(f,"class","content txt-xl m-b-base"),p(u,"class","panel"),p(u,"autocomplete","off"),p(a,"class","wrapper")},m($,M){w($,e,M),g(e,t),g(t,i),g(t,s),g(t,l),g(l,o),w($,r,M),w($,a,M),g(a,u),g(u,f),g(u,c),S[d].m(u,null),m=!0,v||(b=G(u,"submit",Yt(n[16])),v=!0)},p($,M){(!m||M&32)&&ue(o,$[5]);let D=d;d=C($),d===D?S[d].p($,M):(Pe(),P(S[D],1,1,()=>{S[D]=null}),Le(),h=S[d],h?h.p($,M):(h=S[d]=y[d]($),h.c()),E(h,1),h.m(u,null))},i($){m||(E(h),m=!0)},o($){P(h),m=!1},d($){$&&k(e),$&&k(r),$&&k(a),S[d].d(),v=!1,b()}}}function UD(n){let e,t,i,s;return e=new Vi({}),i=new Dn({props:{$$slots:{default:[BD]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment),t=T(),V(i.$$.fragment)},m(l,o){j(e,l,o),w(l,t,o),j(i,l,o),s=!0},p(l,[o]){const r={};o&1048639&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){q(e,l),l&&k(t),q(i,l)}}}function WD(n,e,t){let i,s;kt(n,Rt,D=>t(5,s=D)),dn(Rt,s="Files storage",s);let l={},o=!1,r=!1,a="",u=!1;f();async function f(){t(1,o=!0);try{const D=await be.settings.getAll()||{};d(D)}catch(D){be.errorResponseHandler(D)}t(1,o=!1)}async function c(){if(!(r||!i)){t(2,r=!0);try{const D=await be.settings.update(U.filterRedactedProps({s3:l}));d(D),Si({}),cn("Successfully saved Files storage settings.")}catch(D){be.errorResponseHandler(D)}t(2,r=!1)}}function d(D={}){t(0,l=(D==null?void 0:D.s3)||{}),t(3,u=l.enabled),t(7,a=JSON.stringify(l))}function h(){l.enabled=this.checked,t(0,l)}function m(){l.endpoint=this.value,t(0,l)}function v(){l.bucket=this.value,t(0,l)}function b(){l.region=this.value,t(0,l)}function y(){l.accessKey=this.value,t(0,l)}function S(D){n.$$.not_equal(l.secret,D)&&(l.secret=D,t(0,l))}function C(){l.forcePathStyle=this.checked,t(0,l)}const $=()=>c(),M=()=>c();return n.$$.update=()=>{n.$$.dirty&129&&t(4,i=a!=JSON.stringify(l))},[l,o,r,u,i,s,c,a,h,m,v,b,y,S,C,$,M]}class YD extends Ee{constructor(e){super(),Oe(this,e,WD,UD,De,{})}}function KD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=T(),s=_("label"),l=F("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[16]),p(s,"for",o=n[16])},m(u,f){w(u,e,f),e.checked=n[0].enabled,w(u,i,f),w(u,s,f),g(s,l),r||(a=G(e,"change",n[8]),r=!0)},p(u,f){f&65536&&t!==(t=u[16])&&p(e,"id",t),f&1&&(e.checked=u[0].enabled),f&65536&&o!==(o=u[16])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function fh(n){let e,t,i,s,l,o,r,a,u,f,c;return i=new Ne({props:{class:"form-field required",name:"emailPassword.minPasswordLength",$$slots:{default:[ZD,({uniqueId:d})=>({16:d}),({uniqueId:d})=>d?65536:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field "+(U.isEmpty(n[0].onlyDomains)?"":"disabled"),name:"emailPassword.exceptDomains",$$slots:{default:[JD,({uniqueId:d})=>({16:d}),({uniqueId:d})=>d?65536:0]},$$scope:{ctx:n}}}),u=new Ne({props:{class:"form-field "+(U.isEmpty(n[0].exceptDomains)?"":"disabled"),name:"emailPassword.onlyDomains",$$slots:{default:[GD,({uniqueId:d})=>({16:d}),({uniqueId:d})=>d?65536:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),V(i.$$.fragment),s=T(),l=_("div"),V(o.$$.fragment),r=T(),a=_("div"),V(u.$$.fragment),p(t,"class","col-sm-12 m-t-sm"),p(l,"class","col-lg-6"),p(a,"class","col-lg-6"),p(e,"class","grid")},m(d,h){w(d,e,h),g(e,t),j(i,t,null),g(e,s),g(e,l),j(o,l,null),g(e,r),g(e,a),j(u,a,null),c=!0},p(d,h){const m={};h&196609&&(m.$$scope={dirty:h,ctx:d}),i.$set(m);const v={};h&1&&(v.class="form-field "+(U.isEmpty(d[0].onlyDomains)?"":"disabled")),h&196609&&(v.$$scope={dirty:h,ctx:d}),o.$set(v);const b={};h&1&&(b.class="form-field "+(U.isEmpty(d[0].exceptDomains)?"":"disabled")),h&196609&&(b.$$scope={dirty:h,ctx:d}),u.$set(b)},i(d){c||(E(i.$$.fragment,d),E(o.$$.fragment,d),E(u.$$.fragment,d),d&&Dt(()=>{f||(f=rt(e,tn,{duration:150},!0)),f.run(1)}),c=!0)},o(d){P(i.$$.fragment,d),P(o.$$.fragment,d),P(u.$$.fragment,d),d&&(f||(f=rt(e,tn,{duration:150},!1)),f.run(0)),c=!1},d(d){d&&k(e),q(i),q(o),q(u),d&&f&&f.end()}}}function ZD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=F("Minimum password length"),s=T(),l=_("input"),p(e,"for",i=n[16]),p(l,"type","number"),p(l,"id",o=n[16]),l.required=!0,p(l,"min","5"),p(l,"max","200")},m(u,f){w(u,e,f),g(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].minPasswordLength),r||(a=G(l,"input",n[9]),r=!0)},p(u,f){f&65536&&i!==(i=u[16])&&p(e,"for",i),f&65536&&o!==(o=u[16])&&p(l,"id",o),f&1&&At(l.value)!==u[0].minPasswordLength&&Me(l,u[0].minPasswordLength)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function JD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function m(b){n[10](b)}let v={id:n[16],disabled:!U.isEmpty(n[0].onlyDomains)};return n[0].exceptDomains!==void 0&&(v.value=n[0].exceptDomains),r=new cs({props:v}),he.push(()=>Re(r,"value",m)),{c(){e=_("label"),t=_("span"),t.textContent="Except domains",i=T(),s=_("i"),o=T(),V(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[16]),p(f,"class","help-block")},m(b,y){w(b,e,y),g(e,t),g(e,i),g(e,s),w(b,o,y),j(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(h=Ye(Ct.call(null,s,{text:`Email domains that are NOT allowed to sign up. - This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&65536&&l!==(l=b[16]))&&p(e,"for",l);const S={};y&65536&&(S.id=b[16]),y&1&&(S.disabled=!U.isEmpty(b[0].onlyDomains)),!a&&y&1&&(a=!0,S.value=b[0].exceptDomains,He(()=>a=!1)),r.$set(S)},i(b){c||(E(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),q(r,b),b&&k(u),b&&k(f),d=!1,h()}}}function GD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function m(b){n[11](b)}let v={id:n[16]+".config.onlyDomains",disabled:!U.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(v.value=n[0].onlyDomains),r=new cs({props:v}),he.push(()=>Re(r,"value",m)),{c(){e=_("label"),t=_("span"),t.textContent="Only domains",i=T(),s=_("i"),o=T(),V(r.$$.fragment),u=T(),f=_("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[16]+".config.onlyDomains"),p(f,"class","help-block")},m(b,y){w(b,e,y),g(e,t),g(e,i),g(e,s),w(b,o,y),j(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(h=Ye(Ct.call(null,s,{text:`Email domains that are ONLY allowed to sign up. - This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&65536&&l!==(l=b[16]+".config.onlyDomains"))&&p(e,"for",l);const S={};y&65536&&(S.id=b[16]+".config.onlyDomains"),y&1&&(S.disabled=!U.isEmpty(b[0].exceptDomains)),!a&&y&1&&(a=!0,S.value=b[0].onlyDomains,He(()=>a=!1)),r.$set(S)},i(b){c||(E(r.$$.fragment,b),c=!0)},o(b){P(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),q(r,b),b&&k(u),b&&k(f),d=!1,h()}}}function XD(n){let e,t,i,s;e=new Ne({props:{class:"form-field form-field-toggle m-b-0",name:"emailPassword.enabled",$$slots:{default:[KD,({uniqueId:o})=>({16:o}),({uniqueId:o})=>o?65536:0]},$$scope:{ctx:n}}});let l=n[0].enabled&&fh(n);return{c(){V(e.$$.fragment),t=T(),l&&l.c(),i=Je()},m(o,r){j(e,o,r),w(o,t,r),l&&l.m(o,r),w(o,i,r),s=!0},p(o,r){const a={};r&196609&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].enabled?l?(l.p(o,r),r&1&&E(l,1)):(l=fh(o),l.c(),E(l,1),l.m(i.parentNode,i)):l&&(Pe(),P(l,1,1,()=>{l=null}),Le())},i(o){s||(E(e.$$.fragment,o),E(l),s=!0)},o(o){P(e.$$.fragment,o),P(l),s=!1},d(o){q(e,o),o&&k(t),l&&l.d(o),o&&k(i)}}}function QD(n){let e;return{c(){e=_("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function xD(n){let e;return{c(){e=_("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function ch(n){let e,t,i,s,l;return{c(){e=_("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,s||(l=Ye(Ct.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Dt(()=>{t||(t=rt(e,Un,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=rt(e,Un,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function eO(n){let e,t,i,s,l,o,r;function a(d,h){return d[0].enabled?xD:QD}let u=a(n),f=u(n),c=n[2]&&ch();return{c(){e=_("div"),e.innerHTML=` - Email/Password`,t=T(),f.c(),i=T(),s=_("div"),l=T(),c&&c.c(),o=Je(),p(e,"class","inline-flex"),p(s,"class","flex-fill")},m(d,h){w(d,e,h),w(d,t,h),f.m(d,h),w(d,i,h),w(d,s,h),w(d,l,h),c&&c.m(d,h),w(d,o,h),r=!0},p(d,h){u!==(u=a(d))&&(f.d(1),f=u(d),f&&(f.c(),f.m(i.parentNode,i))),d[2]?c?h&4&&E(c,1):(c=ch(),c.c(),E(c,1),c.m(o.parentNode,o)):c&&(Pe(),P(c,1,1,()=>{c=null}),Le())},i(d){r||(E(c),r=!0)},o(d){P(c),r=!1},d(d){d&&k(e),d&&k(t),f.d(d),d&&k(i),d&&k(s),d&&k(l),c&&c.d(d),d&&k(o)}}}function tO(n){let e,t;const i=[n[3]];let s={$$slots:{header:[eO],default:[XD]},$$scope:{ctx:n}};for(let l=0;lAdjust common token options.
",c=T(),h.c(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(f,"class","content m-b-sm txt-xl"),p(u,"class","panel"),p(u,"autocomplete","off"),p(a,"class","wrapper")},m($,M){w($,e,M),g(e,t),g(t,i),g(t,s),g(t,l),g(l,o),w($,r,M),w($,a,M),g(a,u),g(u,f),g(u,c),S[d].m(u,null),m=!0,v||(b=G(u,"submit",Yt(n[6])),v=!0)},p($,M){(!m||M&16)&&ue(o,$[4]);let D=d;d=C($),d===D?S[d].p($,M):(Pe(),P(S[D],1,1,()=>{S[D]=null}),Le(),h=S[d],h?h.p($,M):(h=S[d]=y[d]($),h.c()),E(h,1),h.m(u,null))},i($){m||(E(h),m=!0)},o($){P(h),m=!1},d($){$&&k(e),$&&k(r),$&&k(a),S[d].d(),v=!1,b()}}}function TO(n){let e,t,i,s;return e=new Vi({}),i=new Dn({props:{$$slots:{default:[MO]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment),t=T(),V(i.$$.fragment)},m(l,o){j(e,l,o),w(l,t,o),j(i,l,o),s=!0},p(l,[o]){const r={};o&131103&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){q(e,l),l&&k(t),q(i,l)}}}function DO(n,e,t){let i,s;kt(n,Rt,b=>t(4,s=b));const l=[{key:"userAuthToken",label:"Users auth token"},{key:"userVerificationToken",label:"Users email verification token"},{key:"userPasswordResetToken",label:"Users password reset token"},{key:"userEmailChangeToken",label:"Users email change token"},{key:"adminAuthToken",label:"Admins auth token"},{key:"adminPasswordResetToken",label:"Admins password reset token"}];dn(Rt,s="Token options",s);let o={},r=!1,a=!1,u="";f();async function f(){t(1,r=!0);try{const b=await be.settings.getAll()||{};d(b)}catch(b){be.errorResponseHandler(b)}t(1,r=!1)}async function c(){if(!(a||!i)){t(2,a=!0);try{const b=await be.settings.update(U.filterRedactedProps(o));d(b),cn("Successfully saved tokens options.")}catch(b){be.errorResponseHandler(b)}t(2,a=!1)}}function d(b){var y;b=b||{},t(0,o={});for(const S of l)t(0,o[S.key]={duration:((y=b[S.key])==null?void 0:y.duration)||0},o);t(7,u=JSON.stringify(o))}function h(b){o[b.key].duration=At(this.value),t(0,o)}const m=b=>{o[b.key].secret?(delete o[b.key].secret,t(0,o)):t(0,o[b.key].secret=U.randomString(50),o)},v=()=>c();return n.$$.update=()=>{n.$$.dirty&129&&t(3,i=u!=JSON.stringify(o))},[o,r,a,i,s,l,c,u,h,m,v]}class OO extends Ee{constructor(e){super(),Oe(this,e,DO,TO,De,{})}}function EO(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m;return o=new gn({props:{content:n[2]}}),{c(){e=_("div"),e.innerHTML=`Below you'll find your current collections configuration that you could import in - another PocketBase environment.
`,t=T(),i=_("div"),s=_("button"),s.innerHTML='Copy',l=T(),V(o.$$.fragment),r=T(),a=_("div"),u=_("div"),f=T(),c=_("button"),c.innerHTML=` - Download as JSON`,p(e,"class","content txt-xl m-b-base"),p(s,"type","button"),p(s,"class","btn btn-sm btn-secondary fade copy-schema svelte-jm5c4z"),p(i,"tabindex","0"),p(i,"class","export-preview svelte-jm5c4z"),p(u,"class","flex-fill"),p(c,"type","button"),p(c,"class","btn btn-expanded"),p(a,"class","flex m-t-base")},m(v,b){w(v,e,b),w(v,t,b),w(v,i,b),g(i,s),g(i,l),j(o,i,null),n[8](i),w(v,r,b),w(v,a,b),g(a,u),g(a,f),g(a,c),d=!0,h||(m=[G(s,"click",n[7]),G(i,"keydown",n[9]),G(c,"click",n[10])],h=!0)},p(v,b){const y={};b&4&&(y.content=v[2]),o.$set(y)},i(v){d||(E(o.$$.fragment,v),d=!0)},o(v){P(o.$$.fragment,v),d=!1},d(v){v&&k(e),v&&k(t),v&&k(i),q(o),n[8](null),v&&k(r),v&&k(a),h=!1,Qe(m)}}}function AO(n){let e;return{c(){e=_("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:re,i:re,o:re,d(t){t&&k(e)}}}function PO(n){let e,t,i,s,l,o,r,a,u,f,c,d;const h=[AO,EO],m=[];function v(b,y){return b[1]?0:1}return f=v(n),c=m[f]=h[f](n),{c(){e=_("header"),t=_("nav"),i=_("div"),i.textContent="Settings",s=T(),l=_("div"),o=F(n[3]),r=T(),a=_("div"),u=_("div"),c.c(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","panel"),p(a,"class","wrapper")},m(b,y){w(b,e,y),g(e,t),g(t,i),g(t,s),g(t,l),g(l,o),w(b,r,y),w(b,a,y),g(a,u),m[f].m(u,null),d=!0},p(b,y){(!d||y&8)&&ue(o,b[3]);let S=f;f=v(b),f===S?m[f].p(b,y):(Pe(),P(m[S],1,1,()=>{m[S]=null}),Le(),c=m[f],c?c.p(b,y):(c=m[f]=h[f](b),c.c()),E(c,1),c.m(u,null))},i(b){d||(E(c),d=!0)},o(b){P(c),d=!1},d(b){b&&k(e),b&&k(r),b&&k(a),m[f].d()}}}function LO(n){let e,t,i,s;return e=new Vi({}),i=new Dn({props:{$$slots:{default:[PO]},$$scope:{ctx:n}}}),{c(){V(e.$$.fragment),t=T(),V(i.$$.fragment)},m(l,o){j(e,l,o),w(l,t,o),j(i,l,o),s=!0},p(l,[o]){const r={};o&8207&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){P(e.$$.fragment,l),P(i.$$.fragment,l),s=!1},d(l){q(e,l),l&&k(t),q(i,l)}}}function IO(n,e,t){let i,s;kt(n,Rt,b=>t(3,s=b)),dn(Rt,s="Export collections",s);const l="export_"+U.randomString(5);let o,r=[],a=!1;u();async function u(){t(1,a=!0);try{t(6,r=await be.collections.getFullList(100,{$cancelKey:l}));for(let b of r)delete b.created,delete b.updated}catch(b){be.errorResponseHandler(b)}t(1,a=!1)}function f(){U.downloadJson(r,"pb_schema")}function c(){U.copyToClipboard(i),h1("The configuration was copied to your clipboard!",3e3)}const d=()=>c();function h(b){he[b?"unshift":"push"](()=>{o=b,t(0,o)})}const m=b=>{if(b.ctrlKey&&b.code==="KeyA"){b.preventDefault();const y=window.getSelection(),S=document.createRange();S.selectNodeContents(o),y.removeAllRanges(),y.addRange(S)}},v=()=>f();return n.$$.update=()=>{n.$$.dirty&64&&t(2,i=JSON.stringify(r,null,4))},[o,a,i,s,f,c,r,d,h,m,v]}class FO extends Ee{constructor(e){super(),Oe(this,e,IO,LO,De,{})}}function bh(n,e,t){const i=n.slice();return i[14]=e[t],i}function vh(n,e,t){const i=n.slice();return i[17]=e[t][0],i[18]=e[t][1],i}function yh(n,e,t){const i=n.slice();return i[14]=e[t],i}function kh(n,e,t){const i=n.slice();return i[17]=e[t][0],i[23]=e[t][1],i}function wh(n,e,t){const i=n.slice();return i[14]=e[t],i}function $h(n,e,t){const i=n.slice();return i[17]=e[t][0],i[18]=e[t][1],i}function Sh(n,e,t){const i=n.slice();return i[30]=e[t],i}function NO(n){let e,t,i,s,l=n[1].name+"",o,r=n[9]&&Ch(),a=n[0].name!==n[1].name&&Mh(n);return{c(){e=_("div"),r&&r.c(),t=T(),a&&a.c(),i=T(),s=_("strong"),o=F(l),p(s,"class","txt"),p(e,"class","inline-flex fleg-gap-5")},m(u,f){w(u,e,f),r&&r.m(e,null),g(e,t),a&&a.m(e,null),g(e,i),g(e,s),g(s,o)},p(u,f){u[9]?r||(r=Ch(),r.c(),r.m(e,t)):r&&(r.d(1),r=null),u[0].name!==u[1].name?a?a.p(u,f):(a=Mh(u),a.c(),a.m(e,i)):a&&(a.d(1),a=null),f[0]&2&&l!==(l=u[1].name+"")&&ue(o,l)},d(u){u&&k(e),r&&r.d(),a&&a.d()}}}function RO(n){var o;let e,t,i,s=((o=n[0])==null?void 0:o.name)+"",l;return{c(){e=_("span"),e.textContent="Deleted",t=T(),i=_("strong"),l=F(s),p(e,"class","label label-danger")},m(r,a){w(r,e,a),w(r,t,a),w(r,i,a),g(i,l)},p(r,a){var u;a[0]&1&&s!==(s=((u=r[0])==null?void 0:u.name)+"")&&ue(l,s)},d(r){r&&k(e),r&&k(t),r&&k(i)}}}function HO(n){var o;let e,t,i,s=((o=n[1])==null?void 0:o.name)+"",l;return{c(){e=_("span"),e.textContent="Added",t=T(),i=_("strong"),l=F(s),p(e,"class","label label-success")},m(r,a){w(r,e,a),w(r,t,a),w(r,i,a),g(i,l)},p(r,a){var u;a[0]&2&&s!==(s=((u=r[1])==null?void 0:u.name)+"")&&ue(l,s)},d(r){r&&k(e),r&&k(t),r&&k(i)}}}function Ch(n){let e;return{c(){e=_("span"),e.textContent="Changed",p(e,"class","label label-warning")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Mh(n){let e,t=n[0].name+"",i,s,l;return{c(){e=_("strong"),i=F(t),s=T(),l=_("i"),p(e,"class","txt-strikethrough txt-hint"),p(l,"class","ri-arrow-right-line txt-sm")},m(o,r){w(o,e,r),g(e,i),w(o,s,r),w(o,l,r)},p(o,r){r[0]&1&&t!==(t=o[0].name+"")&&ue(i,t)},d(o){o&&k(e),o&&k(s),o&&k(l)}}}function Th(n){var b,y;let e,t,i,s=n[30]+"",l,o,r,a,u=n[12]((b=n[0])==null?void 0:b[n[30]])+"",f,c,d,h,m=n[12]((y=n[1])==null?void 0:y[n[30]])+"",v;return{c(){var S,C,$,M,D,O;e=_("tr"),t=_("td"),i=_("span"),l=F(s),o=T(),r=_("td"),a=_("pre"),f=F(u),c=T(),d=_("td"),h=_("pre"),v=F(m),p(t,"class","min-width svelte-lmkr38"),p(a,"class","txt"),p(r,"class","svelte-lmkr38"),ie(r,"changed-old-col",!n[10]&&vn((S=n[0])==null?void 0:S[n[30]],(C=n[1])==null?void 0:C[n[30]])),ie(r,"changed-none-col",n[10]),p(h,"class","txt"),p(d,"class","svelte-lmkr38"),ie(d,"changed-new-col",!n[5]&&vn(($=n[0])==null?void 0:$[n[30]],(M=n[1])==null?void 0:M[n[30]])),ie(d,"changed-none-col",n[5]),p(e,"class","svelte-lmkr38"),ie(e,"txt-primary",vn((D=n[0])==null?void 0:D[n[30]],(O=n[1])==null?void 0:O[n[30]]))},m(S,C){w(S,e,C),g(e,t),g(t,i),g(i,l),g(e,o),g(e,r),g(r,a),g(a,f),g(e,c),g(e,d),g(d,h),g(h,v)},p(S,C){var $,M,D,O,A,I,L,R;C[0]&1&&u!==(u=S[12](($=S[0])==null?void 0:$[S[30]])+"")&&ue(f,u),C[0]&3075&&ie(r,"changed-old-col",!S[10]&&vn((M=S[0])==null?void 0:M[S[30]],(D=S[1])==null?void 0:D[S[30]])),C[0]&1024&&ie(r,"changed-none-col",S[10]),C[0]&2&&m!==(m=S[12]((O=S[1])==null?void 0:O[S[30]])+"")&&ue(v,m),C[0]&2083&&ie(d,"changed-new-col",!S[5]&&vn((A=S[0])==null?void 0:A[S[30]],(I=S[1])==null?void 0:I[S[30]])),C[0]&32&&ie(d,"changed-none-col",S[5]),C[0]&2051&&ie(e,"txt-primary",vn((L=S[0])==null?void 0:L[S[30]],(R=S[1])==null?void 0:R[S[30]]))},d(S){S&&k(e)}}}function Dh(n){let e,t=n[6],i=[];for(let s=0;s