diff --git a/Makefile b/Makefile index 6dc9b9a8d..8dfe90412 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ lint: golangci-lint run -c ./golangci.yml ./... test: - go test -v --cover ./... + go test ./... -v --cover test-report: - go test -v --cover -coverprofile=coverage.out ./... + go test ./... -v --cover -coverprofile=coverage.out go tool cover -html=coverage.out diff --git a/README.md b/README.md index ffbcc5e94..f263fc7c3 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ func main() { return c.String(200, "Hello world!") }, Middlewares: []echo.MiddlewareFunc{ - apis.RequireAdminOrUserAuth(), + apis.RequireAdminOrRecordAuth(), }, }) diff --git a/apis/admin.go b/apis/admin.go index 1273a1478..3209911ba 100644 --- a/apis/admin.go +++ b/apis/admin.go @@ -9,20 +9,19 @@ import ( "github.com/pocketbase/pocketbase/forms" "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/tokens" - "github.com/pocketbase/pocketbase/tools/rest" "github.com/pocketbase/pocketbase/tools/routine" "github.com/pocketbase/pocketbase/tools/search" ) -// BindAdminApi registers the admin api endpoints and the corresponding handlers. -func BindAdminApi(app core.App, rg *echo.Group) { +// bindAdminApi registers the admin api endpoints and the corresponding handlers. +func bindAdminApi(app core.App, rg *echo.Group) { api := adminApi{app: app} subGroup := rg.Group("/admins", ActivityLogger(app)) - subGroup.POST("/auth-via-email", api.emailAuth, RequireGuestOnly()) + subGroup.POST("/auth-with-password", api.authWithPassword, RequireGuestOnly()) subGroup.POST("/request-password-reset", api.requestPasswordReset) subGroup.POST("/confirm-password-reset", api.confirmPasswordReset) - subGroup.POST("/refresh", api.refresh, RequireAdminAuth()) + subGroup.POST("/auth-refresh", api.authRefresh, RequireAdminAuth()) subGroup.GET("", api.list, RequireAdminAuth()) subGroup.POST("", api.create, RequireAdminAuthOnlyIfAny(app)) subGroup.GET("/:id", api.view, RequireAdminAuth()) @@ -37,7 +36,7 @@ type adminApi struct { func (api *adminApi) authResponse(c echo.Context, admin *models.Admin) error { token, tokenErr := tokens.NewAdminAuthToken(api.app, admin) if tokenErr != nil { - return rest.NewBadRequestError("Failed to create auth token.", tokenErr) + return NewBadRequestError("Failed to create auth token.", tokenErr) } event := &core.AdminAuthEvent{ @@ -54,24 +53,24 @@ func (api *adminApi) authResponse(c echo.Context, admin *models.Admin) error { }) } -func (api *adminApi) refresh(c echo.Context) error { +func (api *adminApi) authRefresh(c echo.Context) error { admin, _ := c.Get(ContextAdminKey).(*models.Admin) if admin == nil { - return rest.NewNotFoundError("Missing auth admin context.", nil) + return NewNotFoundError("Missing auth admin context.", nil) } return api.authResponse(c, admin) } -func (api *adminApi) emailAuth(c echo.Context) error { +func (api *adminApi) authWithPassword(c echo.Context) error { form := forms.NewAdminLogin(api.app) if readErr := c.Bind(form); readErr != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", readErr) + return NewBadRequestError("An error occurred while loading the submitted data.", readErr) } admin, submitErr := form.Submit() if submitErr != nil { - return rest.NewBadRequestError("Failed to authenticate.", submitErr) + return NewBadRequestError("Failed to authenticate.", submitErr) } return api.authResponse(c, admin) @@ -80,11 +79,11 @@ func (api *adminApi) emailAuth(c echo.Context) error { func (api *adminApi) requestPasswordReset(c echo.Context) error { form := forms.NewAdminPasswordResetRequest(api.app) if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", err) + return NewBadRequestError("An error occurred while loading the submitted data.", err) } if err := form.Validate(); err != nil { - return rest.NewBadRequestError("An error occurred while validating the form.", err) + return NewBadRequestError("An error occurred while validating the form.", err) } // run in background because we don't need to show the result @@ -101,12 +100,12 @@ func (api *adminApi) requestPasswordReset(c echo.Context) error { func (api *adminApi) confirmPasswordReset(c echo.Context) error { form := forms.NewAdminPasswordResetConfirm(api.app) if readErr := c.Bind(form); readErr != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", readErr) + return NewBadRequestError("An error occurred while loading the submitted data.", readErr) } admin, submitErr := form.Submit() if submitErr != nil { - return rest.NewBadRequestError("Failed to set new password.", submitErr) + return NewBadRequestError("Failed to set new password.", submitErr) } return api.authResponse(c, admin) @@ -124,7 +123,7 @@ func (api *adminApi) list(c echo.Context) error { ParseAndExec(c.QueryString(), &admins) if err != nil { - return rest.NewBadRequestError("", err) + return NewBadRequestError("", err) } event := &core.AdminsListEvent{ @@ -141,12 +140,12 @@ func (api *adminApi) list(c echo.Context) error { func (api *adminApi) view(c echo.Context) error { id := c.PathParam("id") if id == "" { - return rest.NewNotFoundError("", nil) + return NewNotFoundError("", nil) } admin, err := api.app.Dao().FindAdminById(id) if err != nil || admin == nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) } event := &core.AdminViewEvent{ @@ -166,7 +165,7 @@ func (api *adminApi) create(c echo.Context) error { // load request if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) + return NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) } event := &core.AdminCreateEvent{ @@ -179,7 +178,7 @@ func (api *adminApi) create(c echo.Context) error { return func() error { return api.app.OnAdminBeforeCreateRequest().Trigger(event, func(e *core.AdminCreateEvent) error { if err := next(); err != nil { - return rest.NewBadRequestError("Failed to create admin.", err) + return NewBadRequestError("Failed to create admin.", err) } return e.HttpContext.JSON(http.StatusOK, e.Admin) @@ -197,19 +196,19 @@ func (api *adminApi) create(c echo.Context) error { func (api *adminApi) update(c echo.Context) error { id := c.PathParam("id") if id == "" { - return rest.NewNotFoundError("", nil) + return NewNotFoundError("", nil) } admin, err := api.app.Dao().FindAdminById(id) if err != nil || admin == nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) } form := forms.NewAdminUpsert(api.app, admin) // load request if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) + return NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) } event := &core.AdminUpdateEvent{ @@ -222,7 +221,7 @@ func (api *adminApi) update(c echo.Context) error { return func() error { return api.app.OnAdminBeforeUpdateRequest().Trigger(event, func(e *core.AdminUpdateEvent) error { if err := next(); err != nil { - return rest.NewBadRequestError("Failed to update admin.", err) + return NewBadRequestError("Failed to update admin.", err) } return e.HttpContext.JSON(http.StatusOK, e.Admin) @@ -240,12 +239,12 @@ func (api *adminApi) update(c echo.Context) error { func (api *adminApi) delete(c echo.Context) error { id := c.PathParam("id") if id == "" { - return rest.NewNotFoundError("", nil) + return NewNotFoundError("", nil) } admin, err := api.app.Dao().FindAdminById(id) if err != nil || admin == nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) } event := &core.AdminDeleteEvent{ @@ -255,7 +254,7 @@ func (api *adminApi) delete(c echo.Context) error { handlerErr := api.app.OnAdminBeforeDeleteRequest().Trigger(event, func(e *core.AdminDeleteEvent) error { if err := api.app.Dao().DeleteAdmin(e.Admin); err != nil { - return rest.NewBadRequestError("Failed to delete admin.", err) + return NewBadRequestError("Failed to delete admin.", err) } return e.HttpContext.NoContent(http.StatusNoContent) diff --git a/apis/admin_test.go b/apis/admin_test.go index a95583db8..39f695892 100644 --- a/apis/admin_test.go +++ b/apis/admin_test.go @@ -14,39 +14,47 @@ import ( "github.com/pocketbase/pocketbase/tools/types" ) -func TestAdminAuth(t *testing.T) { +func TestAdminAuthWithEmail(t *testing.T) { scenarios := []tests.ApiScenario{ { Name: "empty data", Method: http.MethodPost, - Url: "/api/admins/auth-via-email", + Url: "/api/admins/auth-with-password", Body: strings.NewReader(``), ExpectedStatus: 400, - ExpectedContent: []string{`"data":{"email":{"code":"validation_required","message":"Cannot be blank."},"password":{"code":"validation_required","message":"Cannot be blank."}}`}, + ExpectedContent: []string{`"data":{"identity":{"code":"validation_required","message":"Cannot be blank."},"password":{"code":"validation_required","message":"Cannot be blank."}}`}, }, { Name: "invalid data", Method: http.MethodPost, - Url: "/api/admins/auth-via-email", + Url: "/api/admins/auth-with-password", Body: strings.NewReader(`{`), ExpectedStatus: 400, ExpectedContent: []string{`"data":{}`}, }, { - Name: "wrong email/password", + Name: "wrong email", + Method: http.MethodPost, + Url: "/api/admins/auth-with-password", + Body: strings.NewReader(`{"identity":"missing@example.com","password":"1234567890"}`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "wrong password", Method: http.MethodPost, - Url: "/api/admins/auth-via-email", - Body: strings.NewReader(`{"email":"missing@example.com","password":"wrong_pass"}`), + Url: "/api/admins/auth-with-password", + Body: strings.NewReader(`{"identity":"test@example.com","password":"invalid"}`), ExpectedStatus: 400, ExpectedContent: []string{`"data":{}`}, }, { Name: "valid email/password (already authorized)", Method: http.MethodPost, - Url: "/api/admins/auth-via-email", - Body: strings.NewReader(`{"email":"test@example.com","password":"1234567890"}`), + Url: "/api/admins/auth-with-password", + Body: strings.NewReader(`{"identity":"test@example.com","password":"1234567890"}`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4MTYwMH0.han3_sG65zLddpcX2ic78qgy7FKecuPfOpFa8Dvi5Bg", }, ExpectedStatus: 400, ExpectedContent: []string{`"message":"The request can be accessed only by guests.","data":{}`}, @@ -54,11 +62,11 @@ func TestAdminAuth(t *testing.T) { { Name: "valid email/password (guest)", Method: http.MethodPost, - Url: "/api/admins/auth-via-email", - Body: strings.NewReader(`{"email":"test@example.com","password":"1234567890"}`), + Url: "/api/admins/auth-with-password", + Body: strings.NewReader(`{"identity":"test@example.com","password":"1234567890"}`), ExpectedStatus: 200, ExpectedContent: []string{ - `"admin":{"id":"2b4a97cc-3f83-4d01-a26b-3d77bc842d3c"`, + `"admin":{"id":"sywbhecnh46rhm0"`, `"token":`, }, ExpectedEvents: map[string]int{ @@ -158,21 +166,41 @@ func TestAdminConfirmPasswordReset(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "expired token", - Method: http.MethodPost, - Url: "/api/admins/confirm-password-reset", - Body: strings.NewReader(`{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MTAxMzIwMH0.Gp_1b5WVhqjj2o3nJhNUlJmpdiwFLXN72LbMP-26gjA","password":"1234567890","passwordConfirm":"1234567890"}`), + Name: "expired token", + Method: http.MethodPost, + Url: "/api/admins/confirm-password-reset", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImV4cCI6MTY0MDk5MTY2MX0.GLwCOsgWTTEKXTK-AyGW838de1OeZGIjfHH0FoRLqZg", + "password":"1234567890", + "passwordConfirm":"1234567890" + }`), ExpectedStatus: 400, ExpectedContent: []string{`"data":{"token":{"code":"validation_invalid_token","message":"Invalid or expired token."}}}`}, }, { - Name: "valid token", - Method: http.MethodPost, - Url: "/api/admins/confirm-password-reset", - Body: strings.NewReader(`{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg5MzQ3NDAwMH0.72IhlL_5CpNGE0ZKM7sV9aAKa3wxQaMZdDiHBo0orpw","password":"1234567890","passwordConfirm":"1234567890"}`), + Name: "valid token + invalid password", + Method: http.MethodPost, + Url: "/api/admins/confirm-password-reset", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImV4cCI6MjIwODk4MTYwMH0.kwFEler6KSMKJNstuaSDvE1QnNdCta5qSnjaIQ0hhhc", + "password":"123456", + "passwordConfirm":"123456" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{"password":{"code":"validation_length_out_of_range"`}, + }, + { + Name: "valid token + valid password", + Method: http.MethodPost, + Url: "/api/admins/confirm-password-reset", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImV4cCI6MjIwODk4MTYwMH0.kwFEler6KSMKJNstuaSDvE1QnNdCta5qSnjaIQ0hhhc", + "password":"1234567891", + "passwordConfirm":"1234567891" + }`), ExpectedStatus: 200, ExpectedContent: []string{ - `"admin":{"id":"2b4a97cc-3f83-4d01-a26b-3d77bc842d3c"`, + `"admin":{"id":"sywbhecnh46rhm0"`, `"token":`, }, ExpectedEvents: map[string]int{ @@ -193,30 +221,40 @@ func TestAdminRefresh(t *testing.T) { { Name: "unauthorized", Method: http.MethodPost, - Url: "/api/admins/refresh", + Url: "/api/admins/auth-refresh", ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { Name: "authorized as user", Method: http.MethodPost, - Url: "/api/admins/refresh", + Url: "/api/admins/auth-refresh", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as admin", + Name: "authorized as admin (expired token)", + Method: http.MethodPost, + Url: "/api/admins/auth-refresh", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MDk5MTY2MX0.I7w8iktkleQvC7_UIRpD7rNzcU4OnF7i7SFIUu6lD_4", + }, + ExpectedStatus: 401, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "authorized as admin (valid token)", Method: http.MethodPost, - Url: "/api/admins/refresh", + Url: "/api/admins/auth-refresh", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ - `"admin":{"id":"2b4a97cc-3f83-4d01-a26b-3d77bc842d3c"`, + `"admin":{"id":"sywbhecnh46rhm0"`, `"token":`, }, ExpectedEvents: map[string]int{ @@ -244,7 +282,7 @@ func TestAdminsList(t *testing.T) { Method: http.MethodGet, Url: "/api/admins", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -254,16 +292,17 @@ func TestAdminsList(t *testing.T) { Method: http.MethodGet, Url: "/api/admins", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ `"page":1`, `"perPage":30`, - `"totalItems":2`, + `"totalItems":3`, `"items":[{`, - `"id":"2b4a97cc-3f83-4d01-a26b-3d77bc842d3c"`, - `"id":"3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8"`, + `"id":"sywbhecnh46rhm0"`, + `"id":"sbmbsdb40jyxf7h"`, + `"id":"9q2trqumvlyr3bd"`, }, ExpectedEvents: map[string]int{ "OnAdminsListRequest": 1, @@ -274,15 +313,19 @@ func TestAdminsList(t *testing.T) { Method: http.MethodGet, Url: "/api/admins?page=2&perPage=1&sort=-created", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ `"page":2`, `"perPage":1`, - `"totalItems":2`, + `"totalItems":3`, `"items":[{`, - `"id":"2b4a97cc-3f83-4d01-a26b-3d77bc842d3c"`, + `"id":"sbmbsdb40jyxf7h"`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, }, ExpectedEvents: map[string]int{ "OnAdminsListRequest": 1, @@ -293,7 +336,7 @@ func TestAdminsList(t *testing.T) { Method: http.MethodGet, Url: "/api/admins?filter=invalidfield~'test2'", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{`"data":{}`}, @@ -301,9 +344,9 @@ func TestAdminsList(t *testing.T) { { Name: "authorized as admin + valid filter", Method: http.MethodGet, - Url: "/api/admins?filter=email~'test2'", + Url: "/api/admins?filter=email~'test3'", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ @@ -311,7 +354,11 @@ func TestAdminsList(t *testing.T) { `"perPage":30`, `"totalItems":1`, `"items":[{`, - `"id":"3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8"`, + `"id":"9q2trqumvlyr3bd"`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, }, ExpectedEvents: map[string]int{ "OnAdminsListRequest": 1, @@ -329,36 +376,26 @@ func TestAdminView(t *testing.T) { { Name: "unauthorized", Method: http.MethodGet, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", + Url: "/api/admins/sbmbsdb40jyxf7h", ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { Name: "authorized as user", Method: http.MethodGet, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", + Url: "/api/admins/sbmbsdb40jyxf7h", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, - { - Name: "authorized as admin + invalid admin id", - Method: http.MethodGet, - Url: "/api/admins/invalid", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, { Name: "authorized as admin + nonexisting admin id", Method: http.MethodGet, - Url: "/api/admins/b97ccf83-34a2-4d01-a26b-3d77bc842d3c", + Url: "/api/admins/nonexisting", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 404, ExpectedContent: []string{`"data":{}`}, @@ -366,13 +403,17 @@ func TestAdminView(t *testing.T) { { Name: "authorized as admin + existing admin id", Method: http.MethodGet, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", + Url: "/api/admins/sbmbsdb40jyxf7h", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ - `"id":"3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8"`, + `"id":"sbmbsdb40jyxf7h"`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, }, ExpectedEvents: map[string]int{ "OnAdminViewRequest": 1, @@ -390,36 +431,26 @@ func TestAdminDelete(t *testing.T) { { Name: "unauthorized", Method: http.MethodDelete, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", + Url: "/api/admins/sbmbsdb40jyxf7h", ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { Name: "authorized as user", Method: http.MethodDelete, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", + Url: "/api/admins/sbmbsdb40jyxf7h", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as admin + invalid admin id", + Name: "authorized as admin + missing admin id", Method: http.MethodDelete, - Url: "/api/admins/invalid", + Url: "/api/admins/missing", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin + nonexisting admin id", - Method: http.MethodDelete, - Url: "/api/admins/b97ccf83-34a2-4d01-a26b-3d77bc842d3c", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 404, ExpectedContent: []string{`"data":{}`}, @@ -427,9 +458,9 @@ func TestAdminDelete(t *testing.T) { { Name: "authorized as admin + existing admin id", Method: http.MethodDelete, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", + Url: "/api/admins/sbmbsdb40jyxf7h", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 204, ExpectedEvents: map[string]int{ @@ -442,15 +473,15 @@ func TestAdminDelete(t *testing.T) { { Name: "authorized as admin - try to delete the only remaining admin", Method: http.MethodDelete, - Url: "/api/admins/2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", + Url: "/api/admins/sywbhecnh46rhm0", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { // delete all admins except the authorized one adminModel := &models.Admin{} _, err := app.Dao().DB().Delete(adminModel.TableName(), dbx.Not(dbx.HashExp{ - "id": "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", + "id": "sywbhecnh46rhm0", })).Execute() if err != nil { t.Fatal(err) @@ -508,7 +539,7 @@ func TestAdminCreate(t *testing.T) { Method: http.MethodPost, Url: "/api/admins", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -519,7 +550,7 @@ func TestAdminCreate(t *testing.T) { Url: "/api/admins", Body: strings.NewReader(``), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{`"data":{"email":{"code":"validation_required","message":"Cannot be blank."},"password":{"code":"validation_required","message":"Cannot be blank."}}`}, @@ -530,7 +561,7 @@ func TestAdminCreate(t *testing.T) { Url: "/api/admins", Body: strings.NewReader(`{`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{`"data":{}`}, @@ -539,20 +570,36 @@ func TestAdminCreate(t *testing.T) { Name: "authorized as admin + invalid data", Method: http.MethodPost, Url: "/api/admins", - Body: strings.NewReader(`{"email":"test@example.com","password":"1234","passwordConfirm":"4321","avatar":99}`), + Body: strings.NewReader(`{ + "email":"test@example.com", + "password":"1234", + "passwordConfirm":"4321", + "avatar":99 + }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"avatar":{"code":"validation_max_less_equal_than_required"`, + `"email":{"code":"validation_admin_email_exists"`, + `"password":{"code":"validation_length_out_of_range"`, + `"passwordConfirm":{"code":"validation_values_mismatch"`, }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{"avatar":{"code":"validation_max_less_equal_than_required","message":"Must be no greater than 9."},"email":{"code":"validation_admin_email_exists","message":"Admin email already exists."},"password":{"code":"validation_length_out_of_range","message":"The length must be between 10 and 100."},"passwordConfirm":{"code":"validation_values_mismatch","message":"Values don't match."}}`}, }, { Name: "authorized as admin + valid data", Method: http.MethodPost, Url: "/api/admins", - Body: strings.NewReader(`{"email":"testnew@example.com","password":"1234567890","passwordConfirm":"1234567890","avatar":3}`), + Body: strings.NewReader(`{ + "email":"testnew@example.com", + "password":"1234567890", + "passwordConfirm":"1234567890", + "avatar":3 + }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ @@ -560,6 +607,12 @@ func TestAdminCreate(t *testing.T) { `"email":"testnew@example.com"`, `"avatar":3`, }, + NotExpectedContent: []string{ + `"password"`, + `"passwordConfirm"`, + `"tokenKey"`, + `"passwordHash"`, + }, ExpectedEvents: map[string]int{ "OnModelBeforeCreate": 1, "OnModelAfterCreate": 1, @@ -579,38 +632,27 @@ func TestAdminUpdate(t *testing.T) { { Name: "unauthorized", Method: http.MethodPatch, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", + Url: "/api/admins/sbmbsdb40jyxf7h", ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { Name: "authorized as user", Method: http.MethodPatch, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", + Url: "/api/admins/sbmbsdb40jyxf7h", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as admin + invalid admin id", - Method: http.MethodPatch, - Url: "/api/admins/invalid", - Body: strings.NewReader(``), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin + nonexisting admin id", + Name: "authorized as admin + missing admin", Method: http.MethodPatch, - Url: "/api/admins/b97ccf83-34a2-4d01-a26b-3d77bc842d3c", + Url: "/api/admins/missing", Body: strings.NewReader(``), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 404, ExpectedContent: []string{`"data":{}`}, @@ -618,14 +660,14 @@ func TestAdminUpdate(t *testing.T) { { Name: "authorized as admin + empty data", Method: http.MethodPatch, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", + Url: "/api/admins/sbmbsdb40jyxf7h", Body: strings.NewReader(``), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ - `"id":"3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8"`, + `"id":"sbmbsdb40jyxf7h"`, `"email":"test2@example.com"`, `"avatar":2`, }, @@ -639,10 +681,10 @@ func TestAdminUpdate(t *testing.T) { { Name: "authorized as admin + invalid formatted data", Method: http.MethodPatch, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", + Url: "/api/admins/sbmbsdb40jyxf7h", Body: strings.NewReader(`{`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{`"data":{}`}, @@ -650,27 +692,49 @@ func TestAdminUpdate(t *testing.T) { { Name: "authorized as admin + invalid data", Method: http.MethodPatch, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", - Body: strings.NewReader(`{"email":"test@example.com","password":"1234","passwordConfirm":"4321","avatar":99}`), + Url: "/api/admins/sbmbsdb40jyxf7h", + Body: strings.NewReader(`{ + "email":"test@example.com", + "password":"1234", + "passwordConfirm":"4321", + "avatar":99 + }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"avatar":{"code":"validation_max_less_equal_than_required"`, + `"email":{"code":"validation_admin_email_exists"`, + `"password":{"code":"validation_length_out_of_range"`, + `"passwordConfirm":{"code":"validation_values_mismatch"`, }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{"avatar":{"code":"validation_max_less_equal_than_required","message":"Must be no greater than 9."},"email":{"code":"validation_admin_email_exists","message":"Admin email already exists."},"password":{"code":"validation_length_out_of_range","message":"The length must be between 10 and 100."},"passwordConfirm":{"code":"validation_values_mismatch","message":"Values don't match."}}`}, }, { Method: http.MethodPatch, - Url: "/api/admins/3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", - Body: strings.NewReader(`{"email":"testnew@example.com","password":"1234567890","passwordConfirm":"1234567890","avatar":5}`), + Url: "/api/admins/sbmbsdb40jyxf7h", + Body: strings.NewReader(`{ + "email":"testnew@example.com", + "password":"1234567891", + "passwordConfirm":"1234567891", + "avatar":5 + }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ - `"id":"3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8"`, + `"id":"sbmbsdb40jyxf7h"`, `"email":"testnew@example.com"`, `"avatar":5`, }, + NotExpectedContent: []string{ + `"password"`, + `"passwordConfirm"`, + `"tokenKey"`, + `"passwordHash"`, + }, ExpectedEvents: map[string]int{ "OnModelBeforeUpdate": 1, "OnModelAfterUpdate": 1, diff --git a/tools/rest/api_error.go b/apis/api_error.go similarity index 94% rename from tools/rest/api_error.go rename to apis/api_error.go index bef430dee..f5f823913 100644 --- a/tools/rest/api_error.go +++ b/apis/api_error.go @@ -1,4 +1,4 @@ -package rest +package apis import ( "net/http" @@ -8,7 +8,7 @@ import ( "github.com/pocketbase/pocketbase/tools/inflector" ) -// ApiError defines the properties for a basic api error response. +// ApiError defines the struct for a basic api error response. type ApiError struct { Code int `json:"code"` Message string `json:"message"` @@ -23,6 +23,7 @@ func (e *ApiError) Error() string { return e.Message } +// RawData returns the unformatted error data (could be an internal error, text, etc.) func (e *ApiError) RawData() any { return e.rawData } diff --git a/tools/rest/api_error_test.go b/apis/api_error_test.go similarity index 92% rename from tools/rest/api_error_test.go rename to apis/api_error_test.go index 89d527971..c9744f4b9 100644 --- a/tools/rest/api_error_test.go +++ b/apis/api_error_test.go @@ -1,4 +1,4 @@ -package rest_test +package apis_test import ( "encoding/json" @@ -6,11 +6,11 @@ import ( "testing" validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/pocketbase/pocketbase/tools/rest" + "github.com/pocketbase/pocketbase/apis" ) func TestNewApiErrorWithRawData(t *testing.T) { - e := rest.NewApiError( + e := apis.NewApiError( 300, "message_test", "rawData_test", @@ -33,7 +33,7 @@ func TestNewApiErrorWithRawData(t *testing.T) { } func TestNewApiErrorWithValidationData(t *testing.T) { - e := rest.NewApiError( + e := apis.NewApiError( 300, "message_test", validation.Errors{ @@ -77,7 +77,7 @@ func TestNewNotFoundError(t *testing.T) { } for i, scenario := range scenarios { - e := rest.NewNotFoundError(scenario.message, scenario.data) + e := apis.NewNotFoundError(scenario.message, scenario.data) result, _ := json.Marshal(e) if string(result) != scenario.expected { @@ -98,7 +98,7 @@ func TestNewBadRequestError(t *testing.T) { } for i, scenario := range scenarios { - e := rest.NewBadRequestError(scenario.message, scenario.data) + e := apis.NewBadRequestError(scenario.message, scenario.data) result, _ := json.Marshal(e) if string(result) != scenario.expected { @@ -119,7 +119,7 @@ func TestNewForbiddenError(t *testing.T) { } for i, scenario := range scenarios { - e := rest.NewForbiddenError(scenario.message, scenario.data) + e := apis.NewForbiddenError(scenario.message, scenario.data) result, _ := json.Marshal(e) if string(result) != scenario.expected { @@ -140,7 +140,7 @@ func TestNewUnauthorizedError(t *testing.T) { } for i, scenario := range scenarios { - e := rest.NewUnauthorizedError(scenario.message, scenario.data) + e := apis.NewUnauthorizedError(scenario.message, scenario.data) result, _ := json.Marshal(e) if string(result) != scenario.expected { diff --git a/apis/base.go b/apis/base.go index a9657b10f..934594ff1 100644 --- a/apis/base.go +++ b/apis/base.go @@ -2,6 +2,7 @@ package apis import ( + "errors" "fmt" "io/fs" "log" @@ -13,7 +14,6 @@ import ( "github.com/labstack/echo/v5" "github.com/labstack/echo/v5/middleware" "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/tools/rest" "github.com/pocketbase/pocketbase/ui" "github.com/spf13/cast" ) @@ -43,7 +43,7 @@ func InitApi(app core.App) (*echo.Echo, error) { return } - var apiErr *rest.ApiError + var apiErr *ApiError switch v := err.(type) { case *echo.HTTPError: @@ -51,8 +51,8 @@ func InitApi(app core.App) (*echo.Echo, error) { log.Println(v.Internal) } msg := fmt.Sprintf("%v", v.Message) - apiErr = rest.NewApiError(v.Code, msg, v) - case *rest.ApiError: + apiErr = NewApiError(v.Code, msg, v) + case *ApiError: if app.IsDebug() && v.RawData() != nil { log.Println(v.RawData()) } @@ -61,7 +61,7 @@ func InitApi(app core.App) (*echo.Echo, error) { if err != nil && app.IsDebug() { log.Println(err) } - apiErr = rest.NewBadRequestError("", err) + apiErr = NewBadRequestError("", err) } // Send response @@ -84,14 +84,14 @@ func InitApi(app core.App) (*echo.Echo, error) { // default routes api := e.Group("/api") - BindSettingsApi(app, api) - BindAdminApi(app, api) - BindUserApi(app, api) - BindCollectionApi(app, api) - BindRecordApi(app, api) - BindFileApi(app, api) - BindRealtimeApi(app, api) - BindLogsApi(app, api) + bindSettingsApi(app, api) + bindAdminApi(app, api) + bindCollectionApi(app, api) + bindRecordCrudApi(app, api) + bindRecordAuthApi(app, api) + bindFileApi(app, api) + bindRealtimeApi(app, api) + bindLogsApi(app, api) // trigger the custom BeforeServe hook for the created api router // allowing users to further adjust its options or register new routes @@ -114,22 +114,31 @@ func InitApi(app core.App) (*echo.Echo, error) { // StaticDirectoryHandler is similar to `echo.StaticDirectoryHandler` // but without the directory redirect which conflicts with RemoveTrailingSlash middleware. // +// If a file resource is missing and indexFallback is set, the request +// will be forwarded to the base index.html (useful also for SPA). +// // @see https://github.com/labstack/echo/issues/2211 -func StaticDirectoryHandler(fileSystem fs.FS, disablePathUnescaping bool) echo.HandlerFunc { +func StaticDirectoryHandler(fileSystem fs.FS, indexFallback bool) echo.HandlerFunc { return func(c echo.Context) error { p := c.PathParam("*") - if !disablePathUnescaping { // when router is already unescaping we do not want to do is twice - tmpPath, err := url.PathUnescape(p) - if err != nil { - return fmt.Errorf("failed to unescape path variable: %w", err) - } - p = tmpPath + + // escape url path + tmpPath, err := url.PathUnescape(p) + if err != nil { + return fmt.Errorf("failed to unescape path variable: %w", err) } + p = tmpPath // fs.FS.Open() already assumes that file names are relative to FS root path and considers name with prefix `/` as invalid name := filepath.ToSlash(filepath.Clean(strings.TrimPrefix(p, "/"))) - return c.FileFS(name, fileSystem) + fileErr := c.FileFS(name, fileSystem) + + if fileErr != nil && indexFallback && errors.Is(fileErr, echo.ErrNotFound) { + return c.FileFS("index.html", fileSystem) + } + + return fileErr } } diff --git a/apis/base_test.go b/apis/base_test.go index c96969392..b676b6594 100644 --- a/apis/base_test.go +++ b/apis/base_test.go @@ -6,8 +6,8 @@ import ( "testing" "github.com/labstack/echo/v5" + "github.com/pocketbase/pocketbase/apis" "github.com/pocketbase/pocketbase/tests" - "github.com/pocketbase/pocketbase/tools/rest" ) func Test404(t *testing.T) { @@ -91,7 +91,7 @@ func TestCustomRoutesAndErrorsHandling(t *testing.T) { Method: http.MethodGet, Path: "/api-error", Handler: func(c echo.Context) error { - return rest.NewApiError(500, "test message", errors.New("internal_test")) + return apis.NewApiError(500, "test message", errors.New("internal_test")) }, }) }, diff --git a/apis/collection.go b/apis/collection.go index e06ec81a6..861de01b0 100644 --- a/apis/collection.go +++ b/apis/collection.go @@ -7,12 +7,11 @@ import ( "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/forms" "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tools/rest" "github.com/pocketbase/pocketbase/tools/search" ) -// BindCollectionApi registers the collection api endpoints and the corresponding handlers. -func BindCollectionApi(app core.App, rg *echo.Group) { +// bindCollectionApi registers the collection api endpoints and the corresponding handlers. +func bindCollectionApi(app core.App, rg *echo.Group) { api := collectionApi{app: app} subGroup := rg.Group("/collections", ActivityLogger(app), RequireAdminAuth()) @@ -30,7 +29,7 @@ type collectionApi struct { func (api *collectionApi) list(c echo.Context) error { fieldResolver := search.NewSimpleFieldResolver( - "id", "created", "updated", "name", "system", + "id", "created", "updated", "name", "system", "type", ) collections := []*models.Collection{} @@ -40,7 +39,7 @@ func (api *collectionApi) list(c echo.Context) error { ParseAndExec(c.QueryString(), &collections) if err != nil { - return rest.NewBadRequestError("", err) + return NewBadRequestError("", err) } event := &core.CollectionsListEvent{ @@ -57,7 +56,7 @@ func (api *collectionApi) list(c echo.Context) error { func (api *collectionApi) view(c echo.Context) error { collection, err := api.app.Dao().FindCollectionByNameOrId(c.PathParam("collection")) if err != nil || collection == nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) } event := &core.CollectionViewEvent{ @@ -77,7 +76,7 @@ func (api *collectionApi) create(c echo.Context) error { // load request if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) + return NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) } event := &core.CollectionCreateEvent{ @@ -90,7 +89,7 @@ func (api *collectionApi) create(c echo.Context) error { return func() error { return api.app.OnCollectionBeforeCreateRequest().Trigger(event, func(e *core.CollectionCreateEvent) error { if err := next(); err != nil { - return rest.NewBadRequestError("Failed to create the collection.", err) + return NewBadRequestError("Failed to create the collection.", err) } return e.HttpContext.JSON(http.StatusOK, e.Collection) @@ -108,14 +107,14 @@ func (api *collectionApi) create(c echo.Context) error { func (api *collectionApi) update(c echo.Context) error { collection, err := api.app.Dao().FindCollectionByNameOrId(c.PathParam("collection")) if err != nil || collection == nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) } form := forms.NewCollectionUpsert(api.app, collection) // load request if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) + return NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) } event := &core.CollectionUpdateEvent{ @@ -128,7 +127,7 @@ func (api *collectionApi) update(c echo.Context) error { return func() error { return api.app.OnCollectionBeforeUpdateRequest().Trigger(event, func(e *core.CollectionUpdateEvent) error { if err := next(); err != nil { - return rest.NewBadRequestError("Failed to update the collection.", err) + return NewBadRequestError("Failed to update the collection.", err) } return e.HttpContext.JSON(http.StatusOK, e.Collection) @@ -146,7 +145,7 @@ func (api *collectionApi) update(c echo.Context) error { func (api *collectionApi) delete(c echo.Context) error { collection, err := api.app.Dao().FindCollectionByNameOrId(c.PathParam("collection")) if err != nil || collection == nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) } event := &core.CollectionDeleteEvent{ @@ -156,7 +155,7 @@ func (api *collectionApi) delete(c echo.Context) error { handlerErr := api.app.OnCollectionBeforeDeleteRequest().Trigger(event, func(e *core.CollectionDeleteEvent) error { if err := api.app.Dao().DeleteCollection(e.Collection); err != nil { - return rest.NewBadRequestError("Failed to delete collection. Make sure that the collection is not referenced by other collections.", err) + return NewBadRequestError("Failed to delete collection. Make sure that the collection is not referenced by other collections.", err) } return e.HttpContext.NoContent(http.StatusNoContent) @@ -174,7 +173,7 @@ func (api *collectionApi) bulkImport(c echo.Context) error { // load request data if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) + return NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) } event := &core.CollectionsImportEvent{ @@ -189,7 +188,7 @@ func (api *collectionApi) bulkImport(c echo.Context) error { form.Collections = e.Collections // ensures that the form always has the latest changes if err := next(); err != nil { - return rest.NewBadRequestError("Failed to import the submitted collections.", err) + return NewBadRequestError("Failed to import the submitted collections.", err) } return e.HttpContext.NoContent(http.StatusNoContent) diff --git a/apis/collection_test.go b/apis/collection_test.go index 2966c71e0..13792f6b4 100644 --- a/apis/collection_test.go +++ b/apis/collection_test.go @@ -2,6 +2,8 @@ package apis_test import ( "net/http" + "os" + "path/filepath" "strings" "testing" @@ -24,7 +26,7 @@ func TestCollectionsList(t *testing.T) { Method: http.MethodGet, Url: "/api/collections", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -34,19 +36,23 @@ func TestCollectionsList(t *testing.T) { Method: http.MethodGet, Url: "/api/collections", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ `"page":1`, `"perPage":30`, - `"totalItems":5`, + `"totalItems":7`, `"items":[{`, - `"id":"abe78266-fd4d-4aea-962d-8c0138ac522b"`, - `"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, - `"id":"2c1010aa-b8fe-41d9-a980-99534ca8a167"`, - `"id":"3cd6fe92-70dc-4819-8542-4d036faabd89"`, - `"id":"f12f3eb6-b980-4bf6-b1e4-36de0450c8be"`, + `"id":"_pb_users_auth_"`, + `"id":"v851q4r790rhknl"`, + `"id":"kpv709sk2lqbqk8"`, + `"id":"wsmn24bux7wo113"`, + `"id":"sz5l5z67tg7gku0"`, + `"id":"wzlqyes4orhoygb"`, + `"id":"4d1blo5cuycfaca"`, + `"type":"auth"`, + `"type":"base"`, }, ExpectedEvents: map[string]int{ "OnCollectionsListRequest": 1, @@ -57,16 +63,16 @@ func TestCollectionsList(t *testing.T) { Method: http.MethodGet, Url: "/api/collections?page=2&perPage=2&sort=-created", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ `"page":2`, `"perPage":2`, - `"totalItems":5`, + `"totalItems":7`, `"items":[{`, - `"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, - `"id":"2c1010aa-b8fe-41d9-a980-99534ca8a167"`, + `"id":"4d1blo5cuycfaca"`, + `"id":"wzlqyes4orhoygb"`, }, ExpectedEvents: map[string]int{ "OnCollectionsListRequest": 1, @@ -77,7 +83,7 @@ func TestCollectionsList(t *testing.T) { Method: http.MethodGet, Url: "/api/collections?filter=invalidfield~'demo2'", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{`"data":{}`}, @@ -85,17 +91,20 @@ func TestCollectionsList(t *testing.T) { { Name: "authorized as admin + valid filter", Method: http.MethodGet, - Url: "/api/collections?filter=name~'demo2'", + Url: "/api/collections?filter=name~'demo'", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ `"page":1`, `"perPage":30`, - `"totalItems":1`, + `"totalItems":4`, `"items":[{`, - `"id":"2c1010aa-b8fe-41d9-a980-99534ca8a167"`, + `"id":"wsmn24bux7wo113"`, + `"id":"sz5l5z67tg7gku0"`, + `"id":"wzlqyes4orhoygb"`, + `"id":"4d1blo5cuycfaca"`, }, ExpectedEvents: map[string]int{ "OnCollectionsListRequest": 1, @@ -113,16 +122,16 @@ func TestCollectionView(t *testing.T) { { Name: "unauthorized", Method: http.MethodGet, - Url: "/api/collections/demo", + Url: "/api/collections/demo1", ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { Name: "authorized as user", Method: http.MethodGet, - Url: "/api/collections/demo", + Url: "/api/collections/demo1", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -132,7 +141,7 @@ func TestCollectionView(t *testing.T) { Method: http.MethodGet, Url: "/api/collections/missing", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 404, ExpectedContent: []string{`"data":{}`}, @@ -140,13 +149,14 @@ func TestCollectionView(t *testing.T) { { Name: "authorized as admin + using the collection name", Method: http.MethodGet, - Url: "/api/collections/demo", + Url: "/api/collections/demo1", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ - `"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, + `"id":"wsmn24bux7wo113"`, + `"name":"demo1"`, }, ExpectedEvents: map[string]int{ "OnCollectionViewRequest": 1, @@ -155,13 +165,14 @@ func TestCollectionView(t *testing.T) { { Name: "authorized as admin + using the collection id", Method: http.MethodGet, - Url: "/api/collections/3f2888f8-075d-49fe-9d09-ea7e951000dc", + Url: "/api/collections/wsmn24bux7wo113", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ - `"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, + `"id":"wsmn24bux7wo113"`, + `"name":"demo1"`, }, ExpectedEvents: map[string]int{ "OnCollectionViewRequest": 1, @@ -175,20 +186,29 @@ func TestCollectionView(t *testing.T) { } func TestCollectionDelete(t *testing.T) { + ensureDeletedFiles := func(app *tests.TestApp, collectionId string) { + storageDir := filepath.Join(app.DataDir(), "storage", collectionId) + + entries, _ := os.ReadDir(storageDir) + if len(entries) != 0 { + t.Errorf("Expected empty/deleted dir, found %d", len(entries)) + } + } + scenarios := []tests.ApiScenario{ { Name: "unauthorized", Method: http.MethodDelete, - Url: "/api/collections/demo3", + Url: "/api/collections/demo1", ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { Name: "authorized as user", Method: http.MethodDelete, - Url: "/api/collections/demo3", + Url: "/api/collections/demo1", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -196,9 +216,9 @@ func TestCollectionDelete(t *testing.T) { { Name: "authorized as admin + nonexisting collection identifier", Method: http.MethodDelete, - Url: "/api/collections/b97ccf83-34a2-4d01-a26b-3d77bc842d3c", + Url: "/api/collections/missing", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 404, ExpectedContent: []string{`"data":{}`}, @@ -206,9 +226,9 @@ func TestCollectionDelete(t *testing.T) { { Name: "authorized as admin + using the collection name", Method: http.MethodDelete, - Url: "/api/collections/demo3", + Url: "/api/collections/demo1", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 204, ExpectedEvents: map[string]int{ @@ -217,13 +237,16 @@ func TestCollectionDelete(t *testing.T) { "OnCollectionBeforeDeleteRequest": 1, "OnCollectionAfterDeleteRequest": 1, }, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + ensureDeletedFiles(app, "wsmn24bux7wo113") + }, }, { Name: "authorized as admin + using the collection id", Method: http.MethodDelete, - Url: "/api/collections/3cd6fe92-70dc-4819-8542-4d036faabd89", + Url: "/api/collections/wsmn24bux7wo113", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 204, ExpectedEvents: map[string]int{ @@ -232,13 +255,16 @@ func TestCollectionDelete(t *testing.T) { "OnCollectionBeforeDeleteRequest": 1, "OnCollectionAfterDeleteRequest": 1, }, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + ensureDeletedFiles(app, "wsmn24bux7wo113") + }, }, { Name: "authorized as admin + trying to delete a system collection", Method: http.MethodDelete, - Url: "/api/collections/profiles", + Url: "/api/collections/nologin", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{`"data":{}`}, @@ -249,9 +275,9 @@ func TestCollectionDelete(t *testing.T) { { Name: "authorized as admin + trying to delete a referenced collection", Method: http.MethodDelete, - Url: "/api/collections/demo", + Url: "/api/collections/demo2", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{`"data":{}`}, @@ -280,7 +306,7 @@ func TestCollectionCreate(t *testing.T) { Method: http.MethodPost, Url: "/api/collections", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -291,7 +317,7 @@ func TestCollectionCreate(t *testing.T) { Url: "/api/collections", Body: strings.NewReader(``), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{ @@ -304,9 +330,9 @@ func TestCollectionCreate(t *testing.T) { Name: "authorized as admin + invalid data (eg. existing name)", Method: http.MethodPost, Url: "/api/collections", - Body: strings.NewReader(`{"name":"demo","schema":[{"type":"text","name":""}]}`), + Body: strings.NewReader(`{"name":"demo1","type":"base","schema":[{"type":"text","name":""}]}`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{ @@ -319,16 +345,117 @@ func TestCollectionCreate(t *testing.T) { Name: "authorized as admin + valid data", Method: http.MethodPost, Url: "/api/collections", - Body: strings.NewReader(`{"name":"new","schema":[{"type":"text","id":"12345789","name":"test"}]}`), + Body: strings.NewReader(`{"name":"new","type":"base","schema":[{"type":"text","id":"12345789","name":"test"}]}`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":`, + `"name":"new"`, + `"type":"base"`, + `"system":false`, + `"schema":[{"system":false,"id":"12345789","name":"test","type":"text","required":false,"unique":false,"options":{"min":null,"max":null,"pattern":""}}]`, + `"options":{}`, + }, + ExpectedEvents: map[string]int{ + "OnModelBeforeCreate": 1, + "OnModelAfterCreate": 1, + "OnCollectionBeforeCreateRequest": 1, + "OnCollectionAfterCreateRequest": 1, + }, + }, + { + Name: "creating auth collection without specified options", + Method: http.MethodPost, + Url: "/api/collections", + Body: strings.NewReader(`{"name":"new","type":"auth","schema":[{"type":"text","id":"12345789","name":"test"}]}`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ `"id":`, `"name":"new"`, + `"type":"auth"`, `"system":false`, `"schema":[{"system":false,"id":"12345789","name":"test","type":"text","required":false,"unique":false,"options":{"min":null,"max":null,"pattern":""}}]`, + `"options":{"allowEmailAuth":false,"allowOAuth2Auth":false,"allowUsernameAuth":false,"exceptEmailDomains":null,"manageRule":null,"minPasswordLength":0,"onlyEmailDomains":null,"requireEmail":false}`, + }, + ExpectedEvents: map[string]int{ + "OnModelBeforeCreate": 1, + "OnModelAfterCreate": 1, + "OnCollectionBeforeCreateRequest": 1, + "OnCollectionAfterCreateRequest": 1, + }, + }, + { + Name: "trying to create auth collection with reserved auth fields", + Method: http.MethodPost, + Url: "/api/collections", + Body: strings.NewReader(`{ + "name":"new", + "type":"auth", + "schema":[ + {"type":"text","name":"email"}, + {"type":"text","name":"username"}, + {"type":"text","name":"verified"}, + {"type":"text","name":"emailVisibility"}, + {"type":"text","name":"lastResetSentAt"}, + {"type":"text","name":"lastVerificationSentAt"}, + {"type":"text","name":"tokenKey"}, + {"type":"text","name":"passwordHash"}, + {"type":"text","name":"password"}, + {"type":"text","name":"passwordConfirm"}, + {"type":"text","name":"oldPassword"} + ] + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{"schema":{`, + `"0":{"name":{"code":"validation_reserved_auth_field_name"`, + `"1":{"name":{"code":"validation_reserved_auth_field_name"`, + `"2":{"name":{"code":"validation_reserved_auth_field_name"`, + `"3":{"name":{"code":"validation_reserved_auth_field_name"`, + `"4":{"name":{"code":"validation_reserved_auth_field_name"`, + `"5":{"name":{"code":"validation_reserved_auth_field_name"`, + `"6":{"name":{"code":"validation_reserved_auth_field_name"`, + `"7":{"name":{"code":"validation_reserved_auth_field_name"`, + `"8":{"name":{"code":"validation_reserved_auth_field_name"`, + }, + }, + { + Name: "creating base collection with reserved auth fields", + Method: http.MethodPost, + Url: "/api/collections", + Body: strings.NewReader(`{ + "name":"new", + "type":"base", + "schema":[ + {"type":"text","name":"email"}, + {"type":"text","name":"username"}, + {"type":"text","name":"verified"}, + {"type":"text","name":"emailVisibility"}, + {"type":"text","name":"lastResetSentAt"}, + {"type":"text","name":"lastVerificationSentAt"}, + {"type":"text","name":"tokenKey"}, + {"type":"text","name":"passwordHash"}, + {"type":"text","name":"password"}, + {"type":"text","name":"passwordConfirm"}, + {"type":"text","name":"oldPassword"} + ] + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"name":"new"`, + `"type":"base"`, + `"schema":[{`, }, ExpectedEvents: map[string]int{ "OnModelBeforeCreate": 1, @@ -337,6 +464,55 @@ func TestCollectionCreate(t *testing.T) { "OnCollectionAfterCreateRequest": 1, }, }, + { + Name: "trying to create base collection with reserved base fields", + Method: http.MethodPost, + Url: "/api/collections", + Body: strings.NewReader(`{ + "name":"new", + "type":"base", + "schema":[ + {"type":"text","name":"id"}, + {"type":"text","name":"created"}, + {"type":"text","name":"updated"}, + {"type":"text","name":"expand"}, + {"type":"text","name":"collectionId"}, + {"type":"text","name":"collectionName"} + ] + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{"schema":{`, + `"0":{"name":{"code":"validation_not_in_invalid`, + `"1":{"name":{"code":"validation_not_in_invalid`, + `"2":{"name":{"code":"validation_not_in_invalid`, + `"3":{"name":{"code":"validation_not_in_invalid`, + `"4":{"name":{"code":"validation_not_in_invalid`, + `"5":{"name":{"code":"validation_not_in_invalid`, + }, + }, + { + Name: "trying to create auth collection with invalid options", + Method: http.MethodPost, + Url: "/api/collections", + Body: strings.NewReader(`{ + "name":"new", + "type":"auth", + "schema":[{"type":"text","id":"12345789","name":"test"}], + "options":{"allowUsernameAuth": true} + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"options":{"minPasswordLength":{"code":"validation_required"`, + }, + }, } for _, scenario := range scenarios { @@ -349,64 +525,80 @@ func TestCollectionUpdate(t *testing.T) { { Name: "unauthorized", Method: http.MethodPatch, - Url: "/api/collections/demo", + Url: "/api/collections/demo1", ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { Name: "authorized as user", Method: http.MethodPatch, - Url: "/api/collections/demo", + Url: "/api/collections/demo1", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as admin + empty data", + Name: "authorized as admin + missing collection", Method: http.MethodPatch, - Url: "/api/collections/demo", - Body: strings.NewReader(``), + Url: "/api/collections/missing", + Body: strings.NewReader(`{}`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "authorized as admin + empty body", + Method: http.MethodPatch, + Url: "/api/collections/demo1", + Body: strings.NewReader(`{}`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ - `"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, + `"id":"wsmn24bux7wo113"`, + `"name":"demo1"`, }, ExpectedEvents: map[string]int{ - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - "OnCollectionBeforeUpdateRequest": 1, "OnCollectionAfterUpdateRequest": 1, + "OnCollectionBeforeUpdateRequest": 1, + "OnModelAfterUpdate": 1, + "OnModelBeforeUpdate": 1, }, }, { Name: "authorized as admin + invalid data (eg. existing name)", Method: http.MethodPatch, - Url: "/api/collections/demo", - Body: strings.NewReader(`{"name":"demo2"}`), + Url: "/api/collections/demo1", + Body: strings.NewReader(`{ + "name":"demo2", + "type":"auth" + }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{ `"data":{`, `"name":{"code":"validation_collection_name_exists"`, + `"type":{"code":"validation_collection_type_change"`, }, }, { Name: "authorized as admin + valid data", Method: http.MethodPatch, - Url: "/api/collections/demo", + Url: "/api/collections/demo1", Body: strings.NewReader(`{"name":"new"}`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ - `"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, + `"id":`, `"name":"new"`, }, ExpectedEvents: map[string]int{ @@ -415,19 +607,87 @@ func TestCollectionUpdate(t *testing.T) { "OnCollectionBeforeUpdateRequest": 1, "OnCollectionAfterUpdateRequest": 1, }, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + // check if the record table was renamed + if !app.Dao().HasTable("new") { + t.Fatal("Couldn't find record table 'new'.") + } + }, }, { - Name: "authorized as admin + valid data and id as identifier", + Name: "trying to update auth collection with reserved auth fields", Method: http.MethodPatch, - Url: "/api/collections/3f2888f8-075d-49fe-9d09-ea7e951000dc", - Body: strings.NewReader(`{"name":"new"}`), + Url: "/api/collections/users", + Body: strings.NewReader(`{ + "schema":[ + {"type":"text","name":"email"}, + {"type":"text","name":"username"}, + {"type":"text","name":"verified"}, + {"type":"text","name":"emailVisibility"}, + {"type":"text","name":"lastResetSentAt"}, + {"type":"text","name":"lastVerificationSentAt"}, + {"type":"text","name":"tokenKey"}, + {"type":"text","name":"passwordHash"}, + {"type":"text","name":"password"}, + {"type":"text","name":"passwordConfirm"}, + {"type":"text","name":"oldPassword"} + ] + }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{"schema":{`, + `"0":{"name":{"code":"validation_reserved_auth_field_name"`, + `"1":{"name":{"code":"validation_reserved_auth_field_name"`, + `"2":{"name":{"code":"validation_reserved_auth_field_name"`, + `"3":{"name":{"code":"validation_reserved_auth_field_name"`, + `"4":{"name":{"code":"validation_reserved_auth_field_name"`, + `"5":{"name":{"code":"validation_reserved_auth_field_name"`, + `"6":{"name":{"code":"validation_reserved_auth_field_name"`, + `"7":{"name":{"code":"validation_reserved_auth_field_name"`, + `"8":{"name":{"code":"validation_reserved_auth_field_name"`, + }, + }, + { + Name: "updating base collection with reserved auth fields", + Method: http.MethodPatch, + Url: "/api/collections/demo1", + Body: strings.NewReader(`{ + "schema":[ + {"type":"text","name":"email"}, + {"type":"text","name":"username"}, + {"type":"text","name":"verified"}, + {"type":"text","name":"emailVisibility"}, + {"type":"text","name":"lastResetSentAt"}, + {"type":"text","name":"lastVerificationSentAt"}, + {"type":"text","name":"tokenKey"}, + {"type":"text","name":"passwordHash"}, + {"type":"text","name":"password"}, + {"type":"text","name":"passwordConfirm"}, + {"type":"text","name":"oldPassword"} + ] + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ - `"id":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, - `"name":"new"`, + `"name":"demo1"`, + `"type":"base"`, + `"schema":[{`, + `"email"`, + `"username"`, + `"verified"`, + `"emailVisibility"`, + `"lastResetSentAt"`, + `"lastVerificationSentAt"`, + `"tokenKey"`, + `"passwordHash"`, + `"password"`, + `"passwordConfirm"`, + `"oldPassword"`, }, ExpectedEvents: map[string]int{ "OnModelBeforeUpdate": 1, @@ -436,6 +696,52 @@ func TestCollectionUpdate(t *testing.T) { "OnCollectionAfterUpdateRequest": 1, }, }, + { + Name: "trying to update base collection with reserved base fields", + Method: http.MethodPatch, + Url: "/api/collections/demo1", + Body: strings.NewReader(`{ + "name":"new", + "type":"base", + "schema":[ + {"type":"text","name":"id"}, + {"type":"text","name":"created"}, + {"type":"text","name":"updated"}, + {"type":"text","name":"expand"}, + {"type":"text","name":"collectionId"}, + {"type":"text","name":"collectionName"} + ] + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{"schema":{`, + `"0":{"name":{"code":"validation_not_in_invalid`, + `"1":{"name":{"code":"validation_not_in_invalid`, + `"2":{"name":{"code":"validation_not_in_invalid`, + `"3":{"name":{"code":"validation_not_in_invalid`, + `"4":{"name":{"code":"validation_not_in_invalid`, + `"5":{"name":{"code":"validation_not_in_invalid`, + }, + }, + { + Name: "trying to update auth collection with invalid options", + Method: http.MethodPatch, + Url: "/api/collections/users", + Body: strings.NewReader(`{ + "options":{"minPasswordLength": 4} + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"options":{"minPasswordLength":{"code":"validation_min_greater_equal_than_required"`, + }, + }, } for _, scenario := range scenarios { @@ -457,7 +763,7 @@ func TestCollectionImport(t *testing.T) { Method: http.MethodPut, Url: "/api/collections/import", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -468,7 +774,7 @@ func TestCollectionImport(t *testing.T) { Url: "/api/collections/import", Body: strings.NewReader(`{"collections":[]}`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{ @@ -480,8 +786,9 @@ func TestCollectionImport(t *testing.T) { if err := app.Dao().CollectionQuery().All(&collections); err != nil { t.Fatal(err) } - if len(collections) != 5 { - t.Fatalf("Expected %d collections, got %d", 5, len(collections)) + expected := 7 + if len(collections) != expected { + t.Fatalf("Expected %d collections, got %d", expected, len(collections)) } }, }, @@ -491,7 +798,7 @@ func TestCollectionImport(t *testing.T) { Url: "/api/collections/import", Body: strings.NewReader(`{"deleteMissing": true, "collections":[{"name": "test123"}]}`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{ @@ -500,14 +807,16 @@ func TestCollectionImport(t *testing.T) { }, ExpectedEvents: map[string]int{ "OnCollectionsBeforeImportRequest": 1, + "OnModelBeforeDelete": 6, }, AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { collections := []*models.Collection{} if err := app.Dao().CollectionQuery().All(&collections); err != nil { t.Fatal(err) } - if len(collections) != 5 { - t.Fatalf("Expected %d collections, got %d", 5, len(collections)) + expected := 7 + if len(collections) != expected { + t.Fatalf("Expected %d collections, got %d", expected, len(collections)) } }, }, @@ -531,7 +840,7 @@ func TestCollectionImport(t *testing.T) { ] }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{ @@ -547,8 +856,9 @@ func TestCollectionImport(t *testing.T) { if err := app.Dao().CollectionQuery().All(&collections); err != nil { t.Fatal(err) } - if len(collections) != 5 { - t.Fatalf("Expected %d collections, got %d", 5, len(collections)) + expected := 7 + if len(collections) != expected { + t.Fatalf("Expected %d collections, got %d", expected, len(collections)) } }, }, @@ -581,7 +891,7 @@ func TestCollectionImport(t *testing.T) { ] }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 204, ExpectedEvents: map[string]int{ @@ -595,8 +905,9 @@ func TestCollectionImport(t *testing.T) { if err := app.Dao().CollectionQuery().All(&collections); err != nil { t.Fatal(err) } - if len(collections) != 7 { - t.Fatalf("Expected %d collections, got %d", 7, len(collections)) + expected := 9 + if len(collections) != expected { + t.Fatalf("Expected %d collections, got %d", expected, len(collections)) } }, }, @@ -608,45 +919,54 @@ func TestCollectionImport(t *testing.T) { "deleteMissing": true, "collections":[ { - "id":"abe78266-fd4d-4aea-962d-8c0138ac522b", - "name":"profiles", - "system":true, - "listRule":"userId = @request.user.id", - "viewRule":"created > 'test_change'", - "createRule":"userId = @request.user.id", - "updateRule":"userId = @request.user.id", - "deleteRule":"userId = @request.user.id", - "schema":[ - { - "id":"koih1lqx", - "name":"userId", - "type":"user", - "system":true, - "required":true, - "unique":true, - "options":{ - "maxSelect":1, - "cascadeDelete":true - } - }, + "name": "new_import", + "schema": [ { - "id":"69ycbg3q", - "name":"rel", - "type":"relation", - "system":false, - "required":false, - "unique":false, - "options":{ - "maxSelect":2, - "collectionId":"abe78266-fd4d-4aea-962d-8c0138ac522b", - "cascadeDelete":false - } + "id": "koih1lqx", + "name": "test", + "type": "text" } ] }, { - "id":"3f2888f8-075d-49fe-9d09-ea7e951000dc", - "name":"demo", + "id": "kpv709sk2lqbqk8", + "system": true, + "name": "nologin", + "type": "auth", + "options": { + "allowEmailAuth": false, + "allowOAuth2Auth": false, + "allowUsernameAuth": false, + "exceptEmailDomains": [], + "manageRule": "@request.auth.collectionName = 'users'", + "minPasswordLength": 8, + "onlyEmailDomains": [], + "requireEmail": true + }, + "listRule": "", + "viewRule": "", + "createRule": "", + "updateRule": "", + "deleteRule": "", + "schema": [ + { + "id": "x8zzktwe", + "name": "name", + "type": "text", + "system": false, + "required": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" + } + } + ] + }, + { + "id":"wsmn24bux7wo113", + "name":"demo1", "schema":[ { "id":"_2hlxbmp", @@ -662,28 +982,18 @@ func TestCollectionImport(t *testing.T) { } } ] - }, - { - "name": "new_import", - "schema": [ - { - "id": "koih1lqx", - "name": "test", - "type": "text" - } - ] } ] }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 204, ExpectedEvents: map[string]int{ "OnCollectionsAfterImportRequest": 1, "OnCollectionsBeforeImportRequest": 1, - "OnModelBeforeDelete": 3, - "OnModelAfterDelete": 3, + "OnModelBeforeDelete": 5, + "OnModelAfterDelete": 5, "OnModelBeforeUpdate": 2, "OnModelAfterUpdate": 2, "OnModelBeforeCreate": 1, @@ -694,8 +1004,9 @@ func TestCollectionImport(t *testing.T) { if err := app.Dao().CollectionQuery().All(&collections); err != nil { t.Fatal(err) } - if len(collections) != 3 { - t.Fatalf("Expected %d collections, got %d", 3, len(collections)) + expected := 3 + if len(collections) != expected { + t.Fatalf("Expected %d collections, got %d", expected, len(collections)) } }, }, diff --git a/apis/file.go b/apis/file.go index 50c358b87..8bcca4439 100644 --- a/apis/file.go +++ b/apis/file.go @@ -6,14 +6,13 @@ import ( "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/models/schema" "github.com/pocketbase/pocketbase/tools/list" - "github.com/pocketbase/pocketbase/tools/rest" ) -var imageContentTypes = []string{"image/png", "image/jpg", "image/jpeg"} +var imageContentTypes = []string{"image/png", "image/jpg", "image/jpeg", "image/gif"} var defaultThumbSizes = []string{"100x100"} -// BindFileApi registers the file api endpoints and the corresponding handlers. -func BindFileApi(app core.App, rg *echo.Group) { +// bindFileApi registers the file api endpoints and the corresponding handlers. +func bindFileApi(app core.App, rg *echo.Group) { api := fileApi{app: app} subGroup := rg.Group("/files", ActivityLogger(app)) @@ -27,30 +26,30 @@ type fileApi struct { func (api *fileApi) download(c echo.Context) error { collection, _ := c.Get(ContextCollectionKey).(*models.Collection) if collection == nil { - return rest.NewNotFoundError("", nil) + return NewNotFoundError("", nil) } recordId := c.PathParam("recordId") if recordId == "" { - return rest.NewNotFoundError("", nil) + return NewNotFoundError("", nil) } - record, err := api.app.Dao().FindRecordById(collection, recordId, nil) + record, err := api.app.Dao().FindRecordById(collection.Id, recordId) if err != nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) } filename := c.PathParam("filename") fileField := record.FindFileFieldByFile(filename) if fileField == nil { - return rest.NewNotFoundError("", nil) + return NewNotFoundError("", nil) } options, _ := fileField.Options.(*schema.FileOptions) fs, err := api.app.NewFilesystem() if err != nil { - return rest.NewBadRequestError("Filesystem initialization failure.", err) + return NewBadRequestError("Filesystem initialization failure.", err) } defer fs.Close() @@ -64,7 +63,7 @@ func (api *fileApi) download(c echo.Context) error { // extract the original file meta attributes and check it existence oAttrs, oAttrsErr := fs.Attributes(originalPath) if oAttrsErr != nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) } // check if it is an image @@ -96,7 +95,7 @@ func (api *fileApi) download(c echo.Context) error { return api.app.OnFileDownloadRequest().Trigger(event, func(e *core.FileDownloadEvent) error { if err := fs.Serve(e.HttpContext.Response(), e.ServedPath, e.ServedName); err != nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) } return nil diff --git a/apis/file_test.go b/apis/file_test.go index d6d106f83..a2f10735a 100644 --- a/apis/file_test.go +++ b/apis/file_test.go @@ -14,14 +14,15 @@ import ( func TestFileDownload(t *testing.T) { _, currentFile, _, _ := runtime.Caller(0) dataDirRelPath := "../tests/data/" - testFilePath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/848a1dea-5ddd-42d6-a00d-030547bffcfe/8fe61d65-6a2e-4f11-87b3-d8a3170bfd4f.txt") - testImgPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png") - testThumbCropCenterPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50_4881bdef-06b4-4dea-8d97-6125ad242677.png") - testThumbCropTopPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50t_4881bdef-06b4-4dea-8d97-6125ad242677.png") - testThumbCropBottomPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50b_4881bdef-06b4-4dea-8d97-6125ad242677.png") - testThumbFitPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50f_4881bdef-06b4-4dea-8d97-6125ad242677.png") - testThumbZeroWidthPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/0x50_4881bdef-06b4-4dea-8d97-6125ad242677.png") - testThumbZeroHeightPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x0_4881bdef-06b4-4dea-8d97-6125ad242677.png") + + testFilePath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/_pb_users_auth_/oap640cot4yru2s/test_kfd2wYLxkz.txt") + testImgPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png") + testThumbCropCenterPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50_300_1SEi6Q6U72.png") + testThumbCropTopPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50t_300_1SEi6Q6U72.png") + testThumbCropBottomPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50b_300_1SEi6Q6U72.png") + testThumbFitPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50f_300_1SEi6Q6U72.png") + testThumbZeroWidthPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/0x50_300_1SEi6Q6U72.png") + testThumbZeroHeightPath := filepath.Join(path.Dir(currentFile), dataDirRelPath, "storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x0_300_1SEi6Q6U72.png") testFile, fileErr := os.ReadFile(testFilePath) if fileErr != nil { @@ -67,28 +68,28 @@ func TestFileDownload(t *testing.T) { { Name: "missing collection", Method: http.MethodGet, - Url: "/api/files/missing/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png", + Url: "/api/files/missing/4q1xlclmfloku33/300_1SEi6Q6U72.png", ExpectedStatus: 404, ExpectedContent: []string{`"data":{}`}, }, { Name: "missing record", Method: http.MethodGet, - Url: "/api/files/demo/00000000-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png", + Url: "/api/files/_pb_users_auth_/missing/300_1SEi6Q6U72.png", ExpectedStatus: 404, ExpectedContent: []string{`"data":{}`}, }, { Name: "missing file", Method: http.MethodGet, - Url: "/api/files/demo/577bd676-aacb-4072-b7da-99d00ee210a4/00000000-06b4-4dea-8d97-6125ad242677.png", + Url: "/api/files/_pb_users_auth_/4q1xlclmfloku33/missing.png", ExpectedStatus: 404, ExpectedContent: []string{`"data":{}`}, }, { Name: "existing image", Method: http.MethodGet, - Url: "/api/files/demo/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png", + Url: "/api/files/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png", ExpectedStatus: 200, ExpectedContent: []string{string(testImg)}, ExpectedEvents: map[string]int{ @@ -98,7 +99,7 @@ func TestFileDownload(t *testing.T) { { Name: "existing image - missing thumb (should fallback to the original)", Method: http.MethodGet, - Url: "/api/files/demo/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png?thumb=999x999", + Url: "/api/files/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png?thumb=999x999", ExpectedStatus: 200, ExpectedContent: []string{string(testImg)}, ExpectedEvents: map[string]int{ @@ -108,7 +109,7 @@ func TestFileDownload(t *testing.T) { { Name: "existing image - existing thumb (crop center)", Method: http.MethodGet, - Url: "/api/files/demo/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png?thumb=70x50", + Url: "/api/files/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png?thumb=70x50", ExpectedStatus: 200, ExpectedContent: []string{string(testThumbCropCenter)}, ExpectedEvents: map[string]int{ @@ -118,7 +119,7 @@ func TestFileDownload(t *testing.T) { { Name: "existing image - existing thumb (crop top)", Method: http.MethodGet, - Url: "/api/files/demo/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png?thumb=70x50t", + Url: "/api/files/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png?thumb=70x50t", ExpectedStatus: 200, ExpectedContent: []string{string(testThumbCropTop)}, ExpectedEvents: map[string]int{ @@ -128,7 +129,7 @@ func TestFileDownload(t *testing.T) { { Name: "existing image - existing thumb (crop bottom)", Method: http.MethodGet, - Url: "/api/files/demo/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png?thumb=70x50b", + Url: "/api/files/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png?thumb=70x50b", ExpectedStatus: 200, ExpectedContent: []string{string(testThumbCropBottom)}, ExpectedEvents: map[string]int{ @@ -138,7 +139,7 @@ func TestFileDownload(t *testing.T) { { Name: "existing image - existing thumb (fit)", Method: http.MethodGet, - Url: "/api/files/demo/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png?thumb=70x50f", + Url: "/api/files/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png?thumb=70x50f", ExpectedStatus: 200, ExpectedContent: []string{string(testThumbFit)}, ExpectedEvents: map[string]int{ @@ -148,7 +149,7 @@ func TestFileDownload(t *testing.T) { { Name: "existing image - existing thumb (zero width)", Method: http.MethodGet, - Url: "/api/files/demo/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png?thumb=0x50", + Url: "/api/files/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png?thumb=0x50", ExpectedStatus: 200, ExpectedContent: []string{string(testThumbZeroWidth)}, ExpectedEvents: map[string]int{ @@ -158,7 +159,7 @@ func TestFileDownload(t *testing.T) { { Name: "existing image - existing thumb (zero height)", Method: http.MethodGet, - Url: "/api/files/demo/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png?thumb=70x0", + Url: "/api/files/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png?thumb=70x0", ExpectedStatus: 200, ExpectedContent: []string{string(testThumbZeroHeight)}, ExpectedEvents: map[string]int{ @@ -168,7 +169,7 @@ func TestFileDownload(t *testing.T) { { Name: "existing non image file - thumb parameter should be ignored", Method: http.MethodGet, - Url: "/api/files/demo/848a1dea-5ddd-42d6-a00d-030547bffcfe/8fe61d65-6a2e-4f11-87b3-d8a3170bfd4f.txt?thumb=100x100", + Url: "/api/files/_pb_users_auth_/oap640cot4yru2s/test_kfd2wYLxkz.txt?thumb=100x100", ExpectedStatus: 200, ExpectedContent: []string{string(testFile)}, ExpectedEvents: map[string]int{ diff --git a/apis/logs.go b/apis/logs.go index 1cec710e1..7452fd656 100644 --- a/apis/logs.go +++ b/apis/logs.go @@ -7,12 +7,11 @@ import ( "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tools/rest" "github.com/pocketbase/pocketbase/tools/search" ) -// BindLogsApi registers the request logs api endpoints. -func BindLogsApi(app core.App, rg *echo.Group) { +// bindLogsApi registers the request logs api endpoints. +func bindLogsApi(app core.App, rg *echo.Group) { api := logsApi{app: app} subGroup := rg.Group("/logs", RequireAdminAuth()) @@ -39,7 +38,7 @@ func (api *logsApi) requestsList(c echo.Context) error { ParseAndExec(c.QueryString(), &[]*models.Request{}) if err != nil { - return rest.NewBadRequestError("", err) + return NewBadRequestError("", err) } return c.JSON(http.StatusOK, result) @@ -55,13 +54,13 @@ func (api *logsApi) requestsStats(c echo.Context) error { var err error expr, err = search.FilterData(filter).BuildExpr(fieldResolver) if err != nil { - return rest.NewBadRequestError("Invalid filter format.", err) + return NewBadRequestError("Invalid filter format.", err) } } stats, err := api.app.LogsDao().RequestsStats(expr) if err != nil { - return rest.NewBadRequestError("Failed to generate requests stats.", err) + return NewBadRequestError("Failed to generate requests stats.", err) } return c.JSON(http.StatusOK, stats) @@ -70,12 +69,12 @@ func (api *logsApi) requestsStats(c echo.Context) error { func (api *logsApi) requestView(c echo.Context) error { id := c.PathParam("id") if id == "" { - return rest.NewNotFoundError("", nil) + return NewNotFoundError("", nil) } request, err := api.app.LogsDao().FindRequestById(id) if err != nil || request == nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) } return c.JSON(http.StatusOK, request) diff --git a/apis/logs_test.go b/apis/logs_test.go index 98db6c1ad..648fb0e2e 100644 --- a/apis/logs_test.go +++ b/apis/logs_test.go @@ -18,11 +18,11 @@ func TestRequestsList(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as user", + Name: "authorized as auth record", Method: http.MethodGet, Url: "/api/logs/requests", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -32,7 +32,7 @@ func TestRequestsList(t *testing.T) { Method: http.MethodGet, Url: "/api/logs/requests", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { if err := tests.MockRequestLogsData(app); err != nil { @@ -54,7 +54,7 @@ func TestRequestsList(t *testing.T) { Method: http.MethodGet, Url: "/api/logs/requests?filter=status>200", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { if err := tests.MockRequestLogsData(app); err != nil { @@ -87,11 +87,11 @@ func TestRequestView(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as user", + Name: "authorized as auth record", Method: http.MethodGet, Url: "/api/logs/requests/873f2133-9f38-44fb-bf82-c8f53b310d91", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -101,7 +101,7 @@ func TestRequestView(t *testing.T) { Method: http.MethodGet, Url: "/api/logs/requests/missing1-9f38-44fb-bf82-c8f53b310d91", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { if err := tests.MockRequestLogsData(app); err != nil { @@ -116,7 +116,7 @@ func TestRequestView(t *testing.T) { Method: http.MethodGet, Url: "/api/logs/requests/873f2133-9f38-44fb-bf82-c8f53b310d91", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { if err := tests.MockRequestLogsData(app); err != nil { @@ -145,11 +145,11 @@ func TestRequestsStats(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as user", + Name: "authorized as auth record", Method: http.MethodGet, Url: "/api/logs/requests/stats", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -159,7 +159,7 @@ func TestRequestsStats(t *testing.T) { Method: http.MethodGet, Url: "/api/logs/requests/stats", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { if err := tests.MockRequestLogsData(app); err != nil { @@ -168,7 +168,7 @@ func TestRequestsStats(t *testing.T) { }, ExpectedStatus: 200, ExpectedContent: []string{ - `[{"total":1,"date":"2022-05-01 10:00:00.000"},{"total":1,"date":"2022-05-02 10:00:00.000"}]`, + `[{"total":1,"date":"2022-05-01 10:00:00.000Z"},{"total":1,"date":"2022-05-02 10:00:00.000Z"}]`, }, }, { @@ -176,7 +176,7 @@ func TestRequestsStats(t *testing.T) { Method: http.MethodGet, Url: "/api/logs/requests/stats?filter=status>200", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { if err := tests.MockRequestLogsData(app); err != nil { @@ -185,7 +185,7 @@ func TestRequestsStats(t *testing.T) { }, ExpectedStatus: 200, ExpectedContent: []string{ - `[{"total":1,"date":"2022-05-02 10:00:00.000"}]`, + `[{"total":1,"date":"2022-05-02 10:00:00.000Z"}]`, }, }, } diff --git a/apis/middlewares.go b/apis/middlewares.go index 06c6cb7b3..542ce751b 100644 --- a/apis/middlewares.go +++ b/apis/middlewares.go @@ -11,30 +11,32 @@ import ( "github.com/labstack/echo/v5" "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tools/rest" + "github.com/pocketbase/pocketbase/tokens" + "github.com/pocketbase/pocketbase/tools/list" "github.com/pocketbase/pocketbase/tools/routine" + "github.com/pocketbase/pocketbase/tools/security" "github.com/pocketbase/pocketbase/tools/types" "github.com/spf13/cast" ) // Common request context keys used by the middlewares and api handlers. const ( - ContextUserKey string = "user" ContextAdminKey string = "admin" + ContextAuthRecordKey string = "authRecord" ContextCollectionKey string = "collection" ) // RequireGuestOnly middleware requires a request to NOT have a valid -// Authorization header set. +// Authorization header. // -// This middleware is the opposite of [apis.RequireAdminOrUserAuth()]. +// This middleware is the opposite of [apis.RequireAdminOrRecordAuth()]. func RequireGuestOnly() echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - err := rest.NewBadRequestError("The request can be accessed only by guests.", nil) + err := NewBadRequestError("The request can be accessed only by guests.", nil) - user, _ := c.Get(ContextUserKey).(*models.User) - if user != nil { + record, _ := c.Get(ContextAuthRecordKey).(*models.Record) + if record != nil { return err } @@ -48,14 +50,55 @@ func RequireGuestOnly() echo.MiddlewareFunc { } } -// RequireUserAuth middleware requires a request to have -// a valid user Authorization header set (aka. `Authorization: User ...`). -func RequireUserAuth() echo.MiddlewareFunc { +// RequireRecordAuth middleware requires a request to have +// a valid record auth Authorization header. +// +// The auth record could be from any collection. +// +// You can further filter the allowed record auth collections by +// specifying their names. +// +// Example: +// apis.RequireRecordAuth() +// Or: +// apis.RequireRecordAuth("users", "supervisors") +// +// To restrict the auth record only to the loaded context collection, +// use [apis.RequireSameContextRecordAuth()] instead. +func RequireRecordAuth(optCollectionNames ...string) echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - user, _ := c.Get(ContextUserKey).(*models.User) - if user == nil { - return rest.NewUnauthorizedError("The request requires valid user authorization token to be set.", nil) + record, _ := c.Get(ContextAuthRecordKey).(*models.Record) + if record == nil { + return NewUnauthorizedError("The request requires valid record authorization token to be set.", nil) + } + + // check record collection name + if len(optCollectionNames) > 0 && !list.ExistInSlice(record.Collection().Name, optCollectionNames) { + return NewForbiddenError("The authorized record model is not allowed to perform this action.", nil) + } + + return next(c) + } + } +} + +// +// RequireSameContextRecordAuth middleware requires a request to have +// a valid record Authorization header. +// +// The auth record must be from the same collection already loaded in the context. +func RequireSameContextRecordAuth() echo.MiddlewareFunc { + return func(next echo.HandlerFunc) echo.HandlerFunc { + return func(c echo.Context) error { + record, _ := c.Get(ContextAuthRecordKey).(*models.Record) + if record == nil { + return NewUnauthorizedError("The request requires valid record authorization token to be set.", nil) + } + + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil || record.Collection().Id != collection.Id { + return NewForbiddenError(fmt.Sprintf("The request requires auth record from %s collection.", record.Collection().Name), nil) } return next(c) @@ -64,13 +107,13 @@ func RequireUserAuth() echo.MiddlewareFunc { } // RequireAdminAuth middleware requires a request to have -// a valid admin Authorization header set (aka. `Authorization: Admin ...`). +// a valid admin Authorization header. func RequireAdminAuth() echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { admin, _ := c.Get(ContextAdminKey).(*models.Admin) if admin == nil { - return rest.NewUnauthorizedError("The request requires admin authorization token to be set.", nil) + return NewUnauthorizedError("The request requires valid admin authorization token to be set.", nil) } return next(c) @@ -79,14 +122,14 @@ func RequireAdminAuth() echo.MiddlewareFunc { } // RequireAdminAuthOnlyIfAny middleware requires a request to have -// a valid admin Authorization header set (aka. `Authorization: Admin ...`) -// ONLY if the application has at least 1 existing Admin model. +// a valid admin Authorization header ONLY if the application has +// at least 1 existing Admin model. func RequireAdminAuthOnlyIfAny(app core.App) echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { totalAdmins, err := app.Dao().TotalAdmins() if err != nil { - return rest.NewBadRequestError("Failed to fetch admins info.", err) + return NewBadRequestError("Failed to fetch admins info.", err) } admin, _ := c.Get(ContextAdminKey).(*models.Admin) @@ -95,24 +138,29 @@ func RequireAdminAuthOnlyIfAny(app core.App) echo.MiddlewareFunc { return next(c) } - return rest.NewUnauthorizedError("The request requires admin authorization token to be set.", nil) + return NewUnauthorizedError("The request requires valid admin authorization token to be set.", nil) } } } -// RequireAdminOrUserAuth middleware requires a request to have -// a valid admin or user Authorization header set -// (aka. `Authorization: Admin ...` or `Authorization: User ...`). +// RequireAdminOrRecordAuth middleware requires a request to have +// a valid admin or record Authorization header set. +// +// You can further filter the allowed auth record collections by providing their names. // // This middleware is the opposite of [apis.RequireGuestOnly()]. -func RequireAdminOrUserAuth() echo.MiddlewareFunc { +func RequireAdminOrRecordAuth(optCollectionNames ...string) echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { admin, _ := c.Get(ContextAdminKey).(*models.Admin) - user, _ := c.Get(ContextUserKey).(*models.User) + record, _ := c.Get(ContextAuthRecordKey).(*models.Record) - if admin == nil && user == nil { - return rest.NewUnauthorizedError("The request requires admin or user authorization token to be set.", nil) + if admin == nil && record == nil { + return NewUnauthorizedError("The request requires admin or record authorization token to be set.", nil) + } + + if record != nil && len(optCollectionNames) > 0 && !list.ExistInSlice(record.Collection().Name, optCollectionNames) { + return NewForbiddenError("The authorized record model is not allowed to perform this action.", nil) } return next(c) @@ -121,29 +169,33 @@ func RequireAdminOrUserAuth() echo.MiddlewareFunc { } // RequireAdminOrOwnerAuth middleware requires a request to have -// a valid admin or user owner Authorization header set -// (aka. `Authorization: Admin ...` or `Authorization: User ...`). +// a valid admin or auth record owner Authorization header set. // -// This middleware is similar to [apis.RequireAdminOrUserAuth()] but -// for the user token expects to have the same id as the path parameter -// `ownerIdParam` (default to "id"). +// This middleware is similar to [apis.RequireAdminOrRecordAuth()] but +// for the auth record token expects to have the same id as the path +// parameter ownerIdParam (default to "id" if empty). func RequireAdminOrOwnerAuth(ownerIdParam string) echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { - if ownerIdParam == "" { - ownerIdParam = "id" + admin, _ := c.Get(ContextAdminKey).(*models.Admin) + if admin != nil { + return next(c) } - ownerId := c.PathParam(ownerIdParam) - admin, _ := c.Get(ContextAdminKey).(*models.Admin) - loggedUser, _ := c.Get(ContextUserKey).(*models.User) + record, _ := c.Get(ContextAuthRecordKey).(*models.Record) + if record == nil { + return NewUnauthorizedError("The request requires admin or record authorization token to be set.", nil) + } - if admin == nil && loggedUser == nil { - return rest.NewUnauthorizedError("The request requires admin or user authorization token to be set.", nil) + if ownerIdParam == "" { + ownerIdParam = "id" } + ownerId := c.PathParam(ownerIdParam) - if admin == nil && loggedUser.Id != ownerId { - return rest.NewForbiddenError("You are not allowed to perform this request.", nil) + // note: it is "safe" to compare only the record id since the auth + // record ids are treated as unique across all auth collections + if record.Id != ownerId { + return NewForbiddenError("You are not allowed to perform this request.", nil) } return next(c) @@ -152,32 +204,41 @@ func RequireAdminOrOwnerAuth(ownerIdParam string) echo.MiddlewareFunc { } // LoadAuthContext middleware reads the Authorization request header -// and loads the token related user or admin instance into the +// and loads the token related record or admin instance into the // request's context. // -// This middleware is expected to be registered by default for all routes. +// This middleware is expected to be already registered by default for all routes. func LoadAuthContext(app core.App) echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { token := c.Request().Header.Get("Authorization") + if token == "" { + return next(c) + } - if token != "" { - if strings.HasPrefix(token, "User ") { - user, err := app.Dao().FindUserByToken( - token[5:], - app.Settings().UserAuthToken.Secret, - ) - if err == nil && user != nil { - c.Set(ContextUserKey, user) - } - } else if strings.HasPrefix(token, "Admin ") { - admin, err := app.Dao().FindAdminByToken( - token[6:], - app.Settings().AdminAuthToken.Secret, - ) - if err == nil && admin != nil { - c.Set(ContextAdminKey, admin) - } + // the schema is not required and it is only for + // compatibility with the defaults of some HTTP clients + token = strings.TrimPrefix(token, "Bearer ") + + claims, _ := security.ParseUnverifiedJWT(token) + tokenType := cast.ToString(claims["type"]) + + switch tokenType { + case tokens.TypeAdmin: + admin, err := app.Dao().FindAdminByToken( + token, + app.Settings().AdminAuthToken.Secret, + ) + if err == nil && admin != nil { + c.Set(ContextAdminKey, admin) + } + case tokens.TypeAuthRecord: + record, err := app.Dao().FindAuthRecordByToken( + token, + app.Settings().RecordAuthToken.Secret, + ) + if err == nil && record != nil { + c.Set(ContextAuthRecordKey, record) } } @@ -188,13 +249,19 @@ func LoadAuthContext(app core.App) echo.MiddlewareFunc { // LoadCollectionContext middleware finds the collection with related // path identifier and loads it into the request context. -func LoadCollectionContext(app core.App) echo.MiddlewareFunc { +// +// Set optCollectionTypes to further filter the found collection by its type. +func LoadCollectionContext(app core.App, optCollectionTypes ...string) echo.MiddlewareFunc { return func(next echo.HandlerFunc) echo.HandlerFunc { return func(c echo.Context) error { if param := c.PathParam("collection"); param != "" { collection, err := app.Dao().FindCollectionByNameOrId(param) if err != nil || collection == nil { - return rest.NewNotFoundError("", err) + return NewNotFoundError("", err) + } + + if len(optCollectionTypes) > 0 && !list.ExistInSlice(collection.Type, optCollectionTypes) { + return NewBadRequestError("Invalid collection type.", nil) } c.Set(ContextCollectionKey, collection) @@ -231,7 +298,7 @@ func ActivityLogger(app core.App) echo.MiddlewareFunc { status = v.Code meta["errorMessage"] = v.Message meta["errorDetails"] = fmt.Sprint(v.Internal) - case *rest.ApiError: + case *ApiError: status = v.Code meta["errorMessage"] = v.Message meta["errorDetails"] = fmt.Sprint(v.RawData()) @@ -242,8 +309,8 @@ func ActivityLogger(app core.App) echo.MiddlewareFunc { } requestAuth := models.RequestAuthGuest - if c.Get(ContextUserKey) != nil { - requestAuth = models.RequestAuthUser + if c.Get(ContextAuthRecordKey) != nil { + requestAuth = models.RequestAuthRecord } else if c.Get(ContextAdminKey) != nil { requestAuth = models.RequestAuthAdmin } diff --git a/apis/middlewares_test.go b/apis/middlewares_test.go index 451145ce1..6dd81fdd6 100644 --- a/apis/middlewares_test.go +++ b/apis/middlewares_test.go @@ -12,11 +12,11 @@ import ( func TestRequireGuestOnly(t *testing.T) { scenarios := []tests.ApiScenario{ { - Name: "valid user token", + Name: "valid record token", Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -38,7 +38,7 @@ func TestRequireGuestOnly(t *testing.T) { Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -60,7 +60,7 @@ func TestRequireGuestOnly(t *testing.T) { Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxNjQwOTkxNjYxfQ.HkAldxpbn0EybkMfFGQKEJUIYKE5UJA0AjcsrV7Q6Io", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoxNjQwOTkxNjYxfQ.HqvpCpM0RAk3Qu9PfCMuZsk_DKh9UYuzFLwXBMTZd1w", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -103,7 +103,7 @@ func TestRequireGuestOnly(t *testing.T) { } } -func TestRequireUserAuth(t *testing.T) { +func TestRequireRecordAuth(t *testing.T) { scenarios := []tests.ApiScenario{ { Name: "guest", @@ -117,7 +117,7 @@ func TestRequireUserAuth(t *testing.T) { return c.String(200, "test123") }, Middlewares: []echo.MiddlewareFunc{ - apis.RequireUserAuth(), + apis.RequireRecordAuth(), }, }) }, @@ -129,7 +129,7 @@ func TestRequireUserAuth(t *testing.T) { Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxNjQwOTkxNjYxfQ.HkAldxpbn0EybkMfFGQKEJUIYKE5UJA0AjcsrV7Q6Io", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoxNjQwOTkxNjYxfQ.HqvpCpM0RAk3Qu9PfCMuZsk_DKh9UYuzFLwXBMTZd1w", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -139,7 +139,7 @@ func TestRequireUserAuth(t *testing.T) { return c.String(200, "test123") }, Middlewares: []echo.MiddlewareFunc{ - apis.RequireUserAuth(), + apis.RequireRecordAuth(), }, }) }, @@ -151,7 +151,7 @@ func TestRequireUserAuth(t *testing.T) { Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -161,7 +161,7 @@ func TestRequireUserAuth(t *testing.T) { return c.String(200, "test123") }, Middlewares: []echo.MiddlewareFunc{ - apis.RequireUserAuth(), + apis.RequireRecordAuth(), }, }) }, @@ -169,11 +169,11 @@ func TestRequireUserAuth(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "valid user token", + Name: "valid record token", Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -183,7 +183,167 @@ func TestRequireUserAuth(t *testing.T) { return c.String(200, "test123") }, Middlewares: []echo.MiddlewareFunc{ - apis.RequireUserAuth(), + apis.RequireRecordAuth(), + }, + }) + }, + ExpectedStatus: 200, + ExpectedContent: []string{"test123"}, + }, + { + Name: "valid record token with collection not in the restricted list", + Method: http.MethodGet, + Url: "/my/test", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/test", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireRecordAuth("demo1", "demo2"), + }, + }) + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "valid record token with collection in the restricted list", + Method: http.MethodGet, + Url: "/my/test", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/test", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireRecordAuth("demo1", "demo2", "users"), + }, + }) + }, + ExpectedStatus: 200, + ExpectedContent: []string{"test123"}, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRequireSameContextRecordAuth(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "guest", + Method: http.MethodGet, + Url: "/my/users/test", + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/:collection/test", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireSameContextRecordAuth(), + }, + }) + }, + ExpectedStatus: 401, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "expired/invalid token", + Method: http.MethodGet, + Url: "/my/users/test", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoxNjQwOTkxNjYxfQ.HqvpCpM0RAk3Qu9PfCMuZsk_DKh9UYuzFLwXBMTZd1w", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/:collection/test", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireSameContextRecordAuth(), + }, + }) + }, + ExpectedStatus: 401, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "valid admin token", + Method: http.MethodGet, + Url: "/my/users/test", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/:collection/test", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireSameContextRecordAuth(), + }, + }) + }, + ExpectedStatus: 401, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "valid record token but from different collection", + Method: http.MethodGet, + Url: "/my/users/test", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6ImdrMzkwcWVnczR5NDd3biIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoidjg1MXE0cjc5MHJoa25sIiwiZXhwIjoyMjA4OTg1MjYxfQ.q34IWXrRWsjLvbbVNRfAs_J4SoTHloNBfdGEiLmy-D8", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/:collection/test", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireSameContextRecordAuth(), + }, + }) + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "valid record token", + Method: http.MethodGet, + Url: "/my/test", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/test", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireRecordAuth(), }, }) }, @@ -223,7 +383,7 @@ func TestRequireAdminAuth(t *testing.T) { Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MTAxMzIwMH0.Gp_1b5WVhqjj2o3nJhNUlJmpdiwFLXN72LbMP-26gjA", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MTAxMzIwMH0.Gp_1b5WVhqjj2o3nJhNUlJmpdiwFLXN72LbMP-26gjA", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -241,11 +401,11 @@ func TestRequireAdminAuth(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "valid user token", + Name: "valid record token", Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -267,7 +427,7 @@ func TestRequireAdminAuth(t *testing.T) { Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -342,7 +502,7 @@ func TestRequireAdminAuthOnlyIfAny(t *testing.T) { Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MTAxMzIwMH0.Gp_1b5WVhqjj2o3nJhNUlJmpdiwFLXN72LbMP-26gjA", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MTAxMzIwMH0.Gp_1b5WVhqjj2o3nJhNUlJmpdiwFLXN72LbMP-26gjA", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -360,11 +520,11 @@ func TestRequireAdminAuthOnlyIfAny(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "valid user token", + Name: "valid record token", Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -386,7 +546,7 @@ func TestRequireAdminAuthOnlyIfAny(t *testing.T) { Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -410,7 +570,7 @@ func TestRequireAdminAuthOnlyIfAny(t *testing.T) { } } -func TestRequireAdminOrUserAuth(t *testing.T) { +func TestRequireAdminOrRecordAuth(t *testing.T) { scenarios := []tests.ApiScenario{ { Name: "guest", @@ -424,7 +584,7 @@ func TestRequireAdminOrUserAuth(t *testing.T) { return c.String(200, "test123") }, Middlewares: []echo.MiddlewareFunc{ - apis.RequireAdminOrUserAuth(), + apis.RequireAdminOrRecordAuth(), }, }) }, @@ -436,7 +596,7 @@ func TestRequireAdminOrUserAuth(t *testing.T) { Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MTAxMzIwMH0.Gp_1b5WVhqjj2o3nJhNUlJmpdiwFLXN72LbMP-26gjA", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MTAxMzIwMH0.Gp_1b5WVhqjj2o3nJhNUlJmpdiwFLXN72LbMP-26gjA", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -446,7 +606,7 @@ func TestRequireAdminOrUserAuth(t *testing.T) { return c.String(200, "test123") }, Middlewares: []echo.MiddlewareFunc{ - apis.RequireAdminOrUserAuth(), + apis.RequireAdminOrRecordAuth(), }, }) }, @@ -454,11 +614,11 @@ func TestRequireAdminOrUserAuth(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "valid user token", + Name: "valid record token", Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -468,7 +628,51 @@ func TestRequireAdminOrUserAuth(t *testing.T) { return c.String(200, "test123") }, Middlewares: []echo.MiddlewareFunc{ - apis.RequireAdminOrUserAuth(), + apis.RequireAdminOrRecordAuth(), + }, + }) + }, + ExpectedStatus: 200, + ExpectedContent: []string{"test123"}, + }, + { + Name: "valid record token with collection not in the restricted list", + Method: http.MethodGet, + Url: "/my/test", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/test", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireAdminOrRecordAuth("demo1", "demo2", "clients"), + }, + }) + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "valid record token with collection in the restricted list", + Method: http.MethodGet, + Url: "/my/test", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/test", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireAdminOrRecordAuth("demo1", "demo2", "users"), }, }) }, @@ -480,7 +684,7 @@ func TestRequireAdminOrUserAuth(t *testing.T) { Method: http.MethodGet, Url: "/my/test", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -490,7 +694,29 @@ func TestRequireAdminOrUserAuth(t *testing.T) { return c.String(200, "test123") }, Middlewares: []echo.MiddlewareFunc{ - apis.RequireAdminOrUserAuth(), + apis.RequireAdminOrRecordAuth(), + }, + }) + }, + ExpectedStatus: 200, + ExpectedContent: []string{"test123"}, + }, + { + Name: "valid admin token + restricted collections list (should be ignored)", + Method: http.MethodGet, + Url: "/my/test", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/test", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireAdminOrRecordAuth("demo1", "demo2"), }, }) }, @@ -509,7 +735,7 @@ func TestRequireAdminOrOwnerAuth(t *testing.T) { { Name: "guest", Method: http.MethodGet, - Url: "/my/test/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", + Url: "/my/test/4q1xlclmfloku33", BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ Method: http.MethodGet, @@ -528,9 +754,9 @@ func TestRequireAdminOrOwnerAuth(t *testing.T) { { Name: "expired/invalid token", Method: http.MethodGet, - Url: "/my/test/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", + Url: "/my/test/4q1xlclmfloku33", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxNjQwOTkxNjYxfQ.HkAldxpbn0EybkMfFGQKEJUIYKE5UJA0AjcsrV7Q6Io", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoxNjQwOTkxNjYxfQ.HqvpCpM0RAk3Qu9PfCMuZsk_DKh9UYuzFLwXBMTZd1w", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -548,12 +774,33 @@ func TestRequireAdminOrOwnerAuth(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "valid user token (different user)", + Name: "valid record token (different user)", + Method: http.MethodGet, + Url: "/my/test/4q1xlclmfloku33", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6ImJnczgyMG4zNjF2ajFxZCIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.tW4NZWZ0mHBgvSZsQ0OOQhWajpUNFPCvNrOF9aCZLZs", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/test/:id", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.RequireAdminOrOwnerAuth(""), + }, + }) + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "valid record token (different collection)", Method: http.MethodGet, - Url: "/my/test/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", + Url: "/my/test/4q1xlclmfloku33", RequestHeaders: map[string]string{ - // test3@example.com - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImVtYWlsIjoidGVzdDNAZXhhbXBsZS5jb20iLCJpZCI6Ijk3Y2MzZDNkLTZiYTItMzgzZi1iNDJhLTdiYzg0ZDI3NDEwYyIsImV4cCI6MTg5MzUxNTU3Nn0.Q965uvlTxxOsZbACXSgJQNXykYK0TKZ87nyPzemvN4E", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6ImdrMzkwcWVnczR5NDd3biIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoidjg1MXE0cjc5MHJoa25sIiwiZXhwIjoyMjA4OTg1MjYxfQ.q34IWXrRWsjLvbbVNRfAs_J4SoTHloNBfdGEiLmy-D8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -571,11 +818,11 @@ func TestRequireAdminOrOwnerAuth(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "valid user token (owner)", + Name: "valid record token (owner)", Method: http.MethodGet, - Url: "/my/test/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", + Url: "/my/test/4q1xlclmfloku33", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -595,9 +842,9 @@ func TestRequireAdminOrOwnerAuth(t *testing.T) { { Name: "valid admin token", Method: http.MethodGet, - Url: "/my/test/2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", + Url: "/my/test/4q1xlclmfloku33", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { e.AddRoute(echo.Route{ @@ -620,3 +867,132 @@ func TestRequireAdminOrOwnerAuth(t *testing.T) { scenario.Test(t) } } + +func TestLoadCollectionContext(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "missing collection", + Method: http.MethodGet, + Url: "/my/missing", + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/:collection", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.LoadCollectionContext(app), + }, + }) + }, + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "guest", + Method: http.MethodGet, + Url: "/my/demo1", + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/:collection", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.LoadCollectionContext(app), + }, + }) + }, + ExpectedStatus: 200, + ExpectedContent: []string{"test123"}, + }, + { + Name: "valid record token", + Method: http.MethodGet, + Url: "/my/demo1", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/:collection", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.LoadCollectionContext(app), + }, + }) + }, + ExpectedStatus: 200, + ExpectedContent: []string{"test123"}, + }, + { + Name: "valid admin token", + Method: http.MethodGet, + Url: "/my/demo1", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/:collection", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.LoadCollectionContext(app), + }, + }) + }, + ExpectedStatus: 200, + ExpectedContent: []string{"test123"}, + }, + { + Name: "mismatched type", + Method: http.MethodGet, + Url: "/my/demo1", + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/:collection", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.LoadCollectionContext(app, "auth"), + }, + }) + }, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "matched type", + Method: http.MethodGet, + Url: "/my/users", + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + e.AddRoute(echo.Route{ + Method: http.MethodGet, + Path: "/my/:collection", + Handler: func(c echo.Context) error { + return c.String(200, "test123") + }, + Middlewares: []echo.MiddlewareFunc{ + apis.LoadCollectionContext(app, "auth"), + }, + }) + }, + ExpectedStatus: 200, + ExpectedContent: []string{"test123"}, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} diff --git a/apis/realtime.go b/apis/realtime.go index d10ba9f51..5ba3fdb60 100644 --- a/apis/realtime.go +++ b/apis/realtime.go @@ -15,13 +15,12 @@ import ( "github.com/pocketbase/pocketbase/forms" "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/resolvers" - "github.com/pocketbase/pocketbase/tools/rest" "github.com/pocketbase/pocketbase/tools/search" "github.com/pocketbase/pocketbase/tools/subscriptions" ) -// BindRealtimeApi registers the realtime api endpoints. -func BindRealtimeApi(app core.App, rg *echo.Group) { +// bindRealtimeApi registers the realtime api endpoints. +func bindRealtimeApi(app core.App, rg *echo.Group) { api := realtimeApi{app: app} subGroup := rg.Group("/realtime", ActivityLogger(app)) @@ -113,25 +112,25 @@ func (api *realtimeApi) setSubscriptions(c echo.Context) error { // read request data if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("", err) + return NewBadRequestError("", err) } // validate request data if err := form.Validate(); err != nil { - return rest.NewBadRequestError("", err) + return NewBadRequestError("", err) } // find subscription client client, err := api.app.SubscriptionsBroker().ClientById(form.ClientId) if err != nil { - return rest.NewNotFoundError("Missing or invalid client id.", err) + return NewNotFoundError("Missing or invalid client id.", err) } // check if the previous request was authorized oldAuthId := extractAuthIdFromGetter(client) newAuthId := extractAuthIdFromGetter(c) if oldAuthId != "" && oldAuthId != newAuthId { - return rest.NewForbiddenError("The current and the previous request authorization don't match.", nil) + return NewForbiddenError("The current and the previous request authorization don't match.", nil) } event := &core.RealtimeSubscribeEvent{ @@ -143,7 +142,7 @@ func (api *realtimeApi) setSubscriptions(c echo.Context) error { handlerErr := api.app.OnRealtimeBeforeSubscribeRequest().Trigger(event, func(e *core.RealtimeSubscribeEvent) error { // update auth state e.Client.Set(ContextAdminKey, e.HttpContext.Get(ContextAdminKey)) - e.Client.Set(ContextUserKey, e.HttpContext.Get(ContextUserKey)) + e.Client.Set(ContextAuthRecordKey, e.HttpContext.Get(ContextAuthRecordKey)) // unsubscribe from any previous existing subscriptions e.Client.Unsubscribe() @@ -161,53 +160,52 @@ func (api *realtimeApi) setSubscriptions(c echo.Context) error { return handlerErr } -func (api *realtimeApi) bindEvents() { - userTable := (&models.User{}).TableName() - adminTable := (&models.Admin{}).TableName() +// updateClientsAuthModel updates the existing clients auth model with the new one (matched by ID). +func (api *realtimeApi) updateClientsAuthModel(contextKey string, newModel models.Model) error { + for _, client := range api.app.SubscriptionsBroker().Clients() { + clientModel, _ := client.Get(contextKey).(models.Model) + if clientModel != nil && clientModel.GetId() == newModel.GetId() { + client.Set(contextKey, newModel) + } + } + + return nil +} - // update user/admin auth state +// unregisterClientsByAuthModel unregister all clients that has the provided auth model. +func (api *realtimeApi) unregisterClientsByAuthModel(contextKey string, model models.Model) error { + for _, client := range api.app.SubscriptionsBroker().Clients() { + clientModel, _ := client.Get(contextKey).(models.Model) + if clientModel != nil && clientModel.GetId() == model.GetId() { + api.app.SubscriptionsBroker().Unregister(client.Id()) + } + } + + return nil +} + +func (api *realtimeApi) bindEvents() { + // update the clients that has admin or auth record association api.app.OnModelAfterUpdate().PreAdd(func(e *core.ModelEvent) error { - modelTable := e.Model.TableName() - - var contextKey string - switch modelTable { - case userTable: - contextKey = ContextUserKey - case adminTable: - contextKey = ContextAdminKey - default: - return nil + if record, ok := e.Model.(*models.Record); ok && record != nil && record.Collection().IsAuth() { + return api.updateClientsAuthModel(ContextAuthRecordKey, record) } - for _, client := range api.app.SubscriptionsBroker().Clients() { - model, _ := client.Get(contextKey).(models.Model) - if model != nil && model.GetId() == e.Model.GetId() { - client.Set(contextKey, e.Model) - } + if admin, ok := e.Model.(*models.Admin); ok && admin != nil { + return api.updateClientsAuthModel(ContextAdminKey, admin) } return nil }) - // remove user/admin client(s) + // remove the client(s) associated to the deleted admin or auth record api.app.OnModelAfterDelete().PreAdd(func(e *core.ModelEvent) error { - modelTable := e.Model.TableName() - - var contextKey string - switch modelTable { - case userTable: - contextKey = ContextUserKey - case adminTable: - contextKey = ContextAdminKey - default: - return nil + if record, ok := e.Model.(*models.Record); ok && record != nil && record.Collection().IsAuth() { + return api.unregisterClientsByAuthModel(ContextAuthRecordKey, record) } - for _, client := range api.app.SubscriptionsBroker().Clients() { - model, _ := client.Get(contextKey).(models.Model) - if model != nil && model.GetId() == e.Model.GetId() { - api.app.SubscriptionsBroker().Unregister(client.Id()) - } + if admin, ok := e.Model.(*models.Admin); ok && admin != nil { + return api.unregisterClientsByAuthModel(ContextAdminKey, admin) } return nil @@ -254,17 +252,17 @@ func (api *realtimeApi) canAccessRecord(client subscriptions.Client, record *mod // emulate request data requestData := map[string]any{ - "method": "get", + "method": "GET", "query": map[string]any{}, "data": map[string]any{}, - "user": nil, + "auth": nil, } - user, _ := client.Get(ContextUserKey).(*models.User) - if user != nil { - requestData["user"], _ = user.AsMap() + authRecord, _ := client.Get(ContextAuthRecordKey).(*models.Record) + if authRecord != nil { + requestData["auth"] = authRecord.PublicExport() } - resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), record.Collection(), requestData) + resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), record.Collection(), requestData, true) expr, err := search.FilterData(*accessRule).BuildExpr(resolver) if err != nil { return err @@ -275,7 +273,7 @@ func (api *realtimeApi) canAccessRecord(client subscriptions.Client, record *mod return nil } - foundRecord, err := api.app.Dao().FindRecordById(record.Collection(), record.Id, ruleFunc) + foundRecord, err := api.app.Dao().FindRecordById(record.Collection().Id, record.Id, ruleFunc) if err == nil && foundRecord != nil { return true } @@ -303,6 +301,8 @@ func (api *realtimeApi) broadcastRecord(action string, record *models.Record) er // know if the clients have access to view the expanded records cleanRecord := *record cleanRecord.SetExpand(nil) + cleanRecord.WithUnkownData(false) + cleanRecord.IgnoreEmailVisibility(false) subscriptionRuleMap := map[string]*string{ (collection.Name + "/" + cleanRecord.Id): collection.ViewRule, @@ -316,7 +316,7 @@ func (api *realtimeApi) broadcastRecord(action string, record *models.Record) er Record: &cleanRecord, } - serializedData, err := json.Marshal(data) + dataBytes, err := json.Marshal(data) if err != nil { if api.app.IsDebug() { log.Println(err) @@ -324,6 +324,8 @@ func (api *realtimeApi) broadcastRecord(action string, record *models.Record) er return err } + encodedData := string(dataBytes) + for _, client := range clients { for subscription, rule := range subscriptionRuleMap { if !client.HasSubscription(subscription) { @@ -336,7 +338,21 @@ func (api *realtimeApi) broadcastRecord(action string, record *models.Record) er msg := subscriptions.Message{ Name: subscription, - Data: string(serializedData), + Data: encodedData, + } + + // ignore the auth record email visibility checks for + // auth owner, admin or manager + if collection.IsAuth() { + authId := extractAuthIdFromGetter(client) + if authId == data.Record.Id || + api.canAccessRecord(client, data.Record, collection.AuthOptions().ManageRule) { + data.Record.IgnoreEmailVisibility(true) // ignore + if newData, err := json.Marshal(data); err == nil { + msg.Data = string(newData) + } + data.Record.IgnoreEmailVisibility(false) // restore + } } client.Channel() <- msg @@ -351,9 +367,9 @@ type getter interface { } func extractAuthIdFromGetter(val getter) string { - user, _ := val.Get(ContextUserKey).(*models.User) - if user != nil { - return user.Id + record, _ := val.Get(ContextAuthRecordKey).(*models.Record) + if record != nil { + return record.Id } admin, _ := val.Get(ContextAdminKey).(*models.Admin) diff --git a/apis/realtime_test.go b/apis/realtime_test.go index 9de66139b..6810ad228 100644 --- a/apis/realtime_test.go +++ b/apis/realtime_test.go @@ -46,7 +46,7 @@ func TestRealtimeSubscribe(t *testing.T) { resetClient := func() { client.Unsubscribe() client.Set(apis.ContextAdminKey, nil) - client.Set(apis.ContextUserKey, nil) + client.Set(apis.ContextAuthRecordKey, nil) } scenarios := []tests.ApiScenario{ @@ -113,7 +113,7 @@ func TestRealtimeSubscribe(t *testing.T) { Url: "/api/realtime", Body: strings.NewReader(`{"clientId":"` + client.Id() + `","subscriptions":["test1", "test2"]}`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 204, ExpectedEvents: map[string]int{ @@ -132,12 +132,12 @@ func TestRealtimeSubscribe(t *testing.T) { }, }, { - Name: "existing client - authorized user", + Name: "existing client - authorized record", Method: http.MethodPost, Url: "/api/realtime", Body: strings.NewReader(`{"clientId":"` + client.Id() + `","subscriptions":["test1", "test2"]}`), RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 204, ExpectedEvents: map[string]int{ @@ -148,9 +148,9 @@ func TestRealtimeSubscribe(t *testing.T) { app.SubscriptionsBroker().Register(client) }, AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - user, _ := client.Get(apis.ContextUserKey).(*models.User) - if user == nil { - t.Errorf("Expected user auth model, got nil") + authRecord, _ := client.Get(apis.ContextAuthRecordKey).(*models.Record) + if authRecord == nil { + t.Errorf("Expected auth record model, got nil") } resetClient() }, @@ -161,21 +161,21 @@ func TestRealtimeSubscribe(t *testing.T) { Url: "/api/realtime", Body: strings.NewReader(`{"clientId":"` + client.Id() + `","subscriptions":["test1", "test2"]}`), RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 403, ExpectedContent: []string{`"data":{}`}, BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - initialAuth := &models.User{} + initialAuth := &models.Record{} initialAuth.RefreshId() - client.Set(apis.ContextUserKey, initialAuth) + client.Set(apis.ContextAuthRecordKey, initialAuth) app.SubscriptionsBroker().Register(client) }, AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - user, _ := client.Get(apis.ContextUserKey).(*models.User) - if user == nil { - t.Errorf("Expected user auth model, got nil") + authRecord, _ := client.Get(apis.ContextAuthRecordKey).(*models.Record) + if authRecord == nil { + t.Errorf("Expected auth record model, got nil") } resetClient() }, @@ -187,55 +187,55 @@ func TestRealtimeSubscribe(t *testing.T) { } } -func TestRealtimeUserDeleteEvent(t *testing.T) { +func TestRealtimeAuthRecordDeleteEvent(t *testing.T) { testApp, _ := tests.NewTestApp() defer testApp.Cleanup() apis.InitApi(testApp) - user, err := testApp.Dao().FindUserByEmail("test@example.com") + authRecord, err := testApp.Dao().FindFirstRecordByData("users", "email", "test@example.com") if err != nil { t.Fatal(err) } client := subscriptions.NewDefaultClient() - client.Set(apis.ContextUserKey, user) + client.Set(apis.ContextAuthRecordKey, authRecord) testApp.SubscriptionsBroker().Register(client) - testApp.OnModelAfterDelete().Trigger(&core.ModelEvent{Dao: testApp.Dao(), Model: user}) + testApp.OnModelAfterDelete().Trigger(&core.ModelEvent{Dao: testApp.Dao(), Model: authRecord}) if len(testApp.SubscriptionsBroker().Clients()) != 0 { t.Fatalf("Expected no subscription clients, found %d", len(testApp.SubscriptionsBroker().Clients())) } } -func TestRealtimeUserUpdateEvent(t *testing.T) { +func TestRealtimeAuthRecordUpdateEvent(t *testing.T) { testApp, _ := tests.NewTestApp() defer testApp.Cleanup() apis.InitApi(testApp) - user1, err := testApp.Dao().FindUserByEmail("test@example.com") + authRecord1, err := testApp.Dao().FindFirstRecordByData("users", "email", "test@example.com") if err != nil { t.Fatal(err) } client := subscriptions.NewDefaultClient() - client.Set(apis.ContextUserKey, user1) + client.Set(apis.ContextAuthRecordKey, authRecord1) testApp.SubscriptionsBroker().Register(client) - // refetch the user and change its email - user2, err := testApp.Dao().FindUserByEmail("test@example.com") + // refetch the authRecord and change its email + authRecord2, err := testApp.Dao().FindFirstRecordByData("users", "email", "test@example.com") if err != nil { t.Fatal(err) } - user2.Email = "new@example.com" + authRecord2.SetEmail("new@example.com") - testApp.OnModelAfterUpdate().Trigger(&core.ModelEvent{Dao: testApp.Dao(), Model: user2}) + testApp.OnModelAfterUpdate().Trigger(&core.ModelEvent{Dao: testApp.Dao(), Model: authRecord2}) - clientUser, _ := client.Get(apis.ContextUserKey).(*models.User) - if clientUser.Email != user2.Email { - t.Fatalf("Expected user with email %q, got %q", user2.Email, clientUser.Email) + clientAuthRecord, _ := client.Get(apis.ContextAuthRecordKey).(*models.Record) + if clientAuthRecord.Email() != authRecord2.Email() { + t.Fatalf("Expected authRecord with email %q, got %q", authRecord2.Email(), clientAuthRecord.Email()) } } @@ -276,7 +276,7 @@ func TestRealtimeAdminUpdateEvent(t *testing.T) { client.Set(apis.ContextAdminKey, admin1) testApp.SubscriptionsBroker().Register(client) - // refetch the user and change its email + // refetch the authRecord and change its email admin2, err := testApp.Dao().FindAdminByEmail("test@example.com") if err != nil { t.Fatal(err) @@ -287,6 +287,6 @@ func TestRealtimeAdminUpdateEvent(t *testing.T) { clientAdmin, _ := client.Get(apis.ContextAdminKey).(*models.Admin) if clientAdmin.Email != admin2.Email { - t.Fatalf("Expected user with email %q, got %q", admin2.Email, clientAdmin.Email) + t.Fatalf("Expected authRecord with email %q, got %q", admin2.Email, clientAdmin.Email) } } diff --git a/apis/record_auth.go b/apis/record_auth.go new file mode 100644 index 000000000..76ae9d635 --- /dev/null +++ b/apis/record_auth.go @@ -0,0 +1,477 @@ +package apis + +import ( + "errors" + "fmt" + "log" + "net/http" + "strings" + + "github.com/labstack/echo/v5" + "github.com/pocketbase/dbx" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/forms" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/resolvers" + "github.com/pocketbase/pocketbase/tokens" + "github.com/pocketbase/pocketbase/tools/auth" + "github.com/pocketbase/pocketbase/tools/routine" + "github.com/pocketbase/pocketbase/tools/search" + "github.com/pocketbase/pocketbase/tools/security" + "golang.org/x/oauth2" +) + +// bindRecordAuthApi registers the auth record api endpoints and +// the corresponding handlers. +func bindRecordAuthApi(app core.App, rg *echo.Group) { + api := recordAuthApi{app: app} + + subGroup := rg.Group( + "/collections/:collection", + ActivityLogger(app), + LoadCollectionContext(app, models.CollectionTypeAuth), + ) + + subGroup.GET("/auth-methods", api.authMethods) + subGroup.POST("/auth-refresh", api.authRefresh, RequireSameContextRecordAuth()) + subGroup.POST("/auth-with-oauth2", api.authWithOAuth2) // allow anyone so that we can link the OAuth2 profile with the authenticated record + subGroup.POST("/auth-with-password", api.authWithPassword, RequireGuestOnly()) + subGroup.POST("/request-password-reset", api.requestPasswordReset) + subGroup.POST("/confirm-password-reset", api.confirmPasswordReset) + subGroup.POST("/request-verification", api.requestVerification) + subGroup.POST("/confirm-verification", api.confirmVerification) + subGroup.POST("/request-email-change", api.requestEmailChange, RequireSameContextRecordAuth()) + subGroup.POST("/confirm-email-change", api.confirmEmailChange) + subGroup.GET("/records/:id/external-auths", api.listExternalAuths, RequireAdminOrOwnerAuth("id")) + subGroup.DELETE("/records/:id/external-auths/:provider", api.unlinkExternalAuth, RequireAdminOrOwnerAuth("id")) +} + +type recordAuthApi struct { + app core.App +} + +func (api *recordAuthApi) authResponse(c echo.Context, authRecord *models.Record, meta any) error { + token, tokenErr := tokens.NewRecordAuthToken(api.app, authRecord) + if tokenErr != nil { + return NewBadRequestError("Failed to create auth token.", tokenErr) + } + + event := &core.RecordAuthEvent{ + HttpContext: c, + Record: authRecord, + Token: token, + Meta: meta, + } + + return api.app.OnRecordAuthRequest().Trigger(event, func(e *core.RecordAuthEvent) error { + admin, _ := e.HttpContext.Get(ContextAdminKey).(*models.Admin) + + // allow always returning the email address of the authenticated account + e.Record.IgnoreEmailVisibility(true) + + // expand record relations + expands := strings.Split(c.QueryParam(expandQueryParam), ",") + if len(expands) > 0 { + requestData := exportRequestData(e.HttpContext) + requestData["auth"] = e.Record.PublicExport() + failed := api.app.Dao().ExpandRecord( + e.Record, + expands, + expandFetch(api.app.Dao(), admin != nil, requestData), + ) + if len(failed) > 0 && api.app.IsDebug() { + log.Println("Failed to expand relations: ", failed) + } + } + + result := map[string]any{ + "token": e.Token, + "record": e.Record, + } + + if e.Meta != nil { + result["meta"] = e.Meta + } + + return e.HttpContext.JSON(http.StatusOK, result) + }) +} + +func (api *recordAuthApi) authRefresh(c echo.Context) error { + record, _ := c.Get(ContextAuthRecordKey).(*models.Record) + if record == nil { + return NewNotFoundError("Missing auth record context.", nil) + } + + return api.authResponse(c, record, nil) +} + +type providerInfo struct { + Name string `json:"name"` + State string `json:"state"` + CodeVerifier string `json:"codeVerifier"` + CodeChallenge string `json:"codeChallenge"` + CodeChallengeMethod string `json:"codeChallengeMethod"` + AuthUrl string `json:"authUrl"` +} + +func (api *recordAuthApi) authMethods(c echo.Context) error { + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil { + return NewNotFoundError("Missing collection context.", nil) + } + + authOptions := collection.AuthOptions() + + result := struct { + UsernamePassword bool `json:"usernamePassword"` + EmailPassword bool `json:"emailPassword"` + AuthProviders []providerInfo `json:"authProviders"` + }{ + UsernamePassword: authOptions.AllowUsernameAuth, + EmailPassword: authOptions.AllowEmailAuth, + AuthProviders: []providerInfo{}, + } + + if !authOptions.AllowOAuth2Auth { + return c.JSON(http.StatusOK, result) + } + + nameConfigMap := api.app.Settings().NamedAuthProviderConfigs() + for name, config := range nameConfigMap { + if !config.Enabled { + continue + } + + provider, err := auth.NewProviderByName(name) + if err != nil { + if api.app.IsDebug() { + log.Println(err) + } + continue // skip provider + } + + if err := config.SetupProvider(provider); err != nil { + if api.app.IsDebug() { + log.Println(err) + } + continue // skip provider + } + + state := security.RandomString(30) + codeVerifier := security.RandomString(43) + codeChallenge := security.S256Challenge(codeVerifier) + codeChallengeMethod := "S256" + result.AuthProviders = append(result.AuthProviders, providerInfo{ + Name: name, + State: state, + CodeVerifier: codeVerifier, + CodeChallenge: codeChallenge, + CodeChallengeMethod: codeChallengeMethod, + AuthUrl: provider.BuildAuthUrl( + state, + oauth2.SetAuthURLParam("code_challenge", codeChallenge), + oauth2.SetAuthURLParam("code_challenge_method", codeChallengeMethod), + ) + "&redirect_uri=", // empty redirect_uri so that users can append their url + }) + } + + return c.JSON(http.StatusOK, result) +} + +func (api *recordAuthApi) authWithOAuth2(c echo.Context) error { + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil { + return NewNotFoundError("Missing collection context.", nil) + } + + if !collection.AuthOptions().AllowOAuth2Auth { + return NewBadRequestError("The collection is not configured to allow OAuth2 authentication.", nil) + } + + var fallbackAuthRecord *models.Record + + loggedAuthRecord, _ := c.Get(ContextAuthRecordKey).(*models.Record) + if loggedAuthRecord != nil && loggedAuthRecord.Collection().Id == collection.Id { + fallbackAuthRecord = loggedAuthRecord + } + + form := forms.NewRecordOAuth2Login(api.app, collection, fallbackAuthRecord) + if readErr := c.Bind(form); readErr != nil { + return NewBadRequestError("An error occurred while loading the submitted data.", readErr) + } + + record, authData, submitErr := form.Submit(func(createForm *forms.RecordUpsert, authRecord *models.Record, authUser *auth.AuthUser) error { + return createForm.DrySubmit(func(txDao *daos.Dao) error { + requestData := exportRequestData(c) + requestData["data"] = form.CreateData + + createRuleFunc := func(q *dbx.SelectQuery) error { + admin, _ := c.Get(ContextAdminKey).(*models.Admin) + if admin != nil { + return nil // either admin or the rule is empty + } + + if collection.CreateRule == nil { + return errors.New("Only admins can create new accounts with OAuth2") + } + + if *collection.CreateRule != "" { + resolver := resolvers.NewRecordFieldResolver(txDao, collection, requestData, true) + expr, err := search.FilterData(*collection.CreateRule).BuildExpr(resolver) + if err != nil { + return err + } + resolver.UpdateQuery(q) + q.AndWhere(expr) + } + + return nil + } + + if _, err := txDao.FindRecordById(collection.Id, createForm.Id, createRuleFunc); err != nil { + return fmt.Errorf("Failed create rule constraint: %v", err) + } + + return nil + }) + }) + if submitErr != nil { + return NewBadRequestError("Failed to authenticate.", submitErr) + } + + return api.authResponse(c, record, authData) +} + +func (api *recordAuthApi) authWithPassword(c echo.Context) error { + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil { + return NewNotFoundError("Missing collection context.", nil) + } + + form := forms.NewRecordPasswordLogin(api.app, collection) + if readErr := c.Bind(form); readErr != nil { + return NewBadRequestError("An error occurred while loading the submitted data.", readErr) + } + + record, submitErr := form.Submit() + if submitErr != nil { + return NewBadRequestError("Failed to authenticate.", submitErr) + } + + return api.authResponse(c, record, nil) +} + +func (api *recordAuthApi) requestPasswordReset(c echo.Context) error { + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil { + return NewNotFoundError("Missing collection context.", nil) + } + + authOptions := collection.AuthOptions() + if !authOptions.AllowUsernameAuth && !authOptions.AllowEmailAuth { + return NewBadRequestError("The collection is not configured to allow password authentication.", nil) + } + + form := forms.NewRecordPasswordResetRequest(api.app, collection) + if err := c.Bind(form); err != nil { + return NewBadRequestError("An error occurred while loading the submitted data.", err) + } + + if err := form.Validate(); err != nil { + return NewBadRequestError("An error occurred while validating the form.", err) + } + + // run in background because we don't need to show + // the result to the user (prevents users enumeration) + routine.FireAndForget(func() { + if err := form.Submit(); err != nil && api.app.IsDebug() { + log.Println(err) + } + }) + + return c.NoContent(http.StatusNoContent) +} + +func (api *recordAuthApi) confirmPasswordReset(c echo.Context) error { + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil { + return NewNotFoundError("Missing collection context.", nil) + } + + form := forms.NewRecordPasswordResetConfirm(api.app, collection) + if readErr := c.Bind(form); readErr != nil { + return NewBadRequestError("An error occurred while loading the submitted data.", readErr) + } + + record, submitErr := form.Submit() + if submitErr != nil { + return NewBadRequestError("Failed to set new password.", submitErr) + } + + return api.authResponse(c, record, nil) +} + +func (api *recordAuthApi) requestVerification(c echo.Context) error { + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil { + return NewNotFoundError("Missing collection context.", nil) + } + + form := forms.NewRecordVerificationRequest(api.app, collection) + if err := c.Bind(form); err != nil { + return NewBadRequestError("An error occurred while loading the submitted data.", err) + } + + if err := form.Validate(); err != nil { + return NewBadRequestError("An error occurred while validating the form.", err) + } + + // run in background because we don't need to show + // the result to the user (prevents users enumeration) + routine.FireAndForget(func() { + if err := form.Submit(); err != nil && api.app.IsDebug() { + log.Println(err) + } + }) + + return c.NoContent(http.StatusNoContent) +} + +func (api *recordAuthApi) confirmVerification(c echo.Context) error { + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil { + return NewNotFoundError("Missing collection context.", nil) + } + + form := forms.NewRecordVerificationConfirm(api.app, collection) + if readErr := c.Bind(form); readErr != nil { + return NewBadRequestError("An error occurred while loading the submitted data.", readErr) + } + + record, submitErr := form.Submit() + if submitErr != nil { + return NewBadRequestError("An error occurred while submitting the form.", submitErr) + } + + // don't return an auth response if the collection doesn't allow email or username authentication + authOptions := collection.AuthOptions() + if !authOptions.AllowEmailAuth && !authOptions.AllowUsernameAuth { + return c.NoContent(http.StatusNoContent) + } + + return api.authResponse(c, record, nil) +} + +func (api *recordAuthApi) requestEmailChange(c echo.Context) error { + record, _ := c.Get(ContextAuthRecordKey).(*models.Record) + if record == nil { + return NewUnauthorizedError("The request requires valid auth record.", nil) + } + + form := forms.NewRecordEmailChangeRequest(api.app, record) + if err := c.Bind(form); err != nil { + return NewBadRequestError("An error occurred while loading the submitted data.", err) + } + + if err := form.Submit(); err != nil { + return NewBadRequestError("Failed to request email change.", err) + } + + return c.NoContent(http.StatusNoContent) +} + +func (api *recordAuthApi) confirmEmailChange(c echo.Context) error { + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil { + return NewNotFoundError("Missing collection context.", nil) + } + + form := forms.NewRecordEmailChangeConfirm(api.app, collection) + if readErr := c.Bind(form); readErr != nil { + return NewBadRequestError("An error occurred while loading the submitted data.", readErr) + } + + record, submitErr := form.Submit() + if submitErr != nil { + return NewBadRequestError("Failed to confirm email change.", submitErr) + } + + return api.authResponse(c, record, nil) +} + +func (api *recordAuthApi) listExternalAuths(c echo.Context) error { + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil { + return NewNotFoundError("Missing collection context.", nil) + } + + id := c.PathParam("id") + if id == "" { + return NewNotFoundError("", nil) + } + + record, err := api.app.Dao().FindRecordById(collection.Id, id) + if err != nil || record == nil { + return NewNotFoundError("", err) + } + + externalAuths, err := api.app.Dao().FindAllExternalAuthsByRecord(record) + if err != nil { + return NewBadRequestError("Failed to fetch the external auths for the specified auth record.", err) + } + + event := &core.RecordListExternalAuthsEvent{ + HttpContext: c, + Record: record, + ExternalAuths: externalAuths, + } + + return api.app.OnRecordListExternalAuths().Trigger(event, func(e *core.RecordListExternalAuthsEvent) error { + return e.HttpContext.JSON(http.StatusOK, e.ExternalAuths) + }) +} + +func (api *recordAuthApi) unlinkExternalAuth(c echo.Context) error { + collection, _ := c.Get(ContextCollectionKey).(*models.Collection) + if collection == nil { + return NewNotFoundError("Missing collection context.", nil) + } + + id := c.PathParam("id") + provider := c.PathParam("provider") + if id == "" || provider == "" { + return NewNotFoundError("", nil) + } + + record, err := api.app.Dao().FindRecordById(collection.Id, id) + if err != nil || record == nil { + return NewNotFoundError("", err) + } + + externalAuth, err := api.app.Dao().FindExternalAuthByRecordAndProvider(record, provider) + if err != nil { + return NewNotFoundError("Missing external auth provider relation.", err) + } + + event := &core.RecordUnlinkExternalAuthEvent{ + HttpContext: c, + Record: record, + ExternalAuth: externalAuth, + } + + handlerErr := api.app.OnRecordBeforeUnlinkExternalAuthRequest().Trigger(event, func(e *core.RecordUnlinkExternalAuthEvent) error { + if err := api.app.Dao().DeleteExternalAuth(externalAuth); err != nil { + return NewBadRequestError("Cannot unlink the external auth provider.", err) + } + + return e.HttpContext.NoContent(http.StatusNoContent) + }) + + if handlerErr == nil { + api.app.OnRecordAfterUnlinkExternalAuthRequest().Trigger(event) + } + + return handlerErr +} diff --git a/apis/record_auth_test.go b/apis/record_auth_test.go new file mode 100644 index 000000000..97dc98a3b --- /dev/null +++ b/apis/record_auth_test.go @@ -0,0 +1,1115 @@ +package apis_test + +import ( + "net/http" + "strings" + "testing" + "time" + + "github.com/labstack/echo/v5" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/tests" + "github.com/pocketbase/pocketbase/tools/types" +) + +func TestRecordAuthMethodsList(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "missing collection", + Method: http.MethodGet, + Url: "/api/collections/missing/auth-methods", + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "non auth collection", + Method: http.MethodGet, + Url: "/api/collections/demo1/auth-methods", + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth collection with all auth methods allowed", + Method: http.MethodGet, + Url: "/api/collections/users/auth-methods", + ExpectedStatus: 200, + ExpectedContent: []string{ + `"usernamePassword":true`, + `"emailPassword":true`, + `"authProviders":[{`, + `"name":"gitlab"`, + `"state":`, + `"codeVerifier":`, + `"codeChallenge":`, + `"codeChallengeMethod":`, + `"authUrl":`, + `redirect_uri="`, // ensures that the redirect_uri is the last url param + }, + }, + { + Name: "auth collection with only email/password auth allowed", + Method: http.MethodGet, + Url: "/api/collections/clients/auth-methods", + ExpectedStatus: 200, + ExpectedContent: []string{ + `"usernamePassword":false`, + `"emailPassword":true`, + `"authProviders":[]`, + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordAuthWithPassword(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "authenticated record", + Method: http.MethodPost, + Url: "/api/collections/users/auth-with-password", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "authenticated admin", + Method: http.MethodPost, + Url: "/api/collections/users/auth-with-password", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "invalid body format", + Method: http.MethodPost, + Url: "/api/collections/users/auth-with-password", + Body: strings.NewReader(`{"identity`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "empty body params", + Method: http.MethodPost, + Url: "/api/collections/users/auth-with-password", + Body: strings.NewReader(`{"identity":"","password":""}`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"identity":{`, + `"password":{`, + }, + }, + + // username + { + Name: "invalid username and valid password", + Method: http.MethodPost, + Url: "/api/collections/users/auth-with-password", + Body: strings.NewReader(`{ + "identity":"invalid", + "password":"1234567890" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{}`, + }, + }, + { + Name: "valid username and invalid password", + Method: http.MethodPost, + Url: "/api/collections/users/auth-with-password", + Body: strings.NewReader(`{ + "identity":"test2_username", + "password":"invalid" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{}`, + }, + }, + { + Name: "valid username and valid password in restricted collection", + Method: http.MethodPost, + Url: "/api/collections/nologin/auth-with-password", + Body: strings.NewReader(`{ + "identity":"test_username", + "password":"1234567890" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{}`, + }, + }, + { + Name: "valid username and valid password in allowed collection", + Method: http.MethodPost, + Url: "/api/collections/users/auth-with-password", + Body: strings.NewReader(`{ + "identity":"test2_username", + "password":"1234567890" + }`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"record":{`, + `"token":"`, + `"id":"oap640cot4yru2s"`, + `"email":"test2@example.com"`, + }, + ExpectedEvents: map[string]int{ + "OnRecordAuthRequest": 1, + }, + }, + + // email + { + Name: "invalid email and valid password", + Method: http.MethodPost, + Url: "/api/collections/users/auth-with-password", + Body: strings.NewReader(`{ + "identity":"missing@example.com", + "password":"1234567890" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{}`, + }, + }, + { + Name: "valid email and invalid password", + Method: http.MethodPost, + Url: "/api/collections/users/auth-with-password", + Body: strings.NewReader(`{ + "identity":"test@example.com", + "password":"invalid" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{}`, + }, + }, + { + Name: "valid email and valid password in restricted collection", + Method: http.MethodPost, + Url: "/api/collections/nologin/auth-with-password", + Body: strings.NewReader(`{ + "identity":"test@example.com", + "password":"1234567890" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{}`, + }, + }, + { + Name: "valid email and valid password in allowed collection", + Method: http.MethodPost, + Url: "/api/collections/users/auth-with-password", + Body: strings.NewReader(`{ + "identity":"test@example.com", + "password":"1234567890" + }`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"record":{`, + `"token":"`, + `"id":"4q1xlclmfloku33"`, + `"email":"test@example.com"`, + }, + ExpectedEvents: map[string]int{ + "OnRecordAuthRequest": 1, + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordAuthRefresh(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "unauthorized", + Method: http.MethodPost, + Url: "/api/collections/users/auth-refresh", + ExpectedStatus: 401, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "admin", + Method: http.MethodPost, + Url: "/api/collections/users/auth-refresh", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 401, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record + not an auth collection", + Method: http.MethodPost, + Url: "/api/collections/demo1/auth-refresh", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record + different auth collection", + Method: http.MethodPost, + Url: "/api/collections/clients/auth-refresh?expand=rel,missing", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record + same auth collection as the token", + Method: http.MethodPost, + Url: "/api/collections/users/auth-refresh?expand=rel,missing", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"token":`, + `"record":`, + `"id":"4q1xlclmfloku33"`, + `"emailVisibility":false`, + `"email":"test@example.com"`, // the owner can always view their email address + `"expand":`, + `"rel":`, + `"id":"llvuca81nly1qls"`, + }, + NotExpectedContent: []string{ + `"missing":`, + }, + ExpectedEvents: map[string]int{ + "OnRecordAuthRequest": 1, + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordAuthRequestPasswordReset(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "not an auth collection", + Method: http.MethodPost, + Url: "/api/collections/demo1/request-password-reset", + Body: strings.NewReader(``), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "empty data", + Method: http.MethodPost, + Url: "/api/collections/users/request-password-reset", + Body: strings.NewReader(``), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{"email":{"code":"validation_required","message":"Cannot be blank."}}`}, + }, + { + Name: "invalid data", + Method: http.MethodPost, + Url: "/api/collections/users/request-password-reset", + Body: strings.NewReader(`{"email`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "missing auth record", + Method: http.MethodPost, + Url: "/api/collections/users/request-password-reset", + Body: strings.NewReader(`{"email":"missing@example.com"}`), + Delay: 100 * time.Millisecond, + ExpectedStatus: 204, + }, + { + Name: "existing auth record", + Method: http.MethodPost, + Url: "/api/collections/users/request-password-reset", + Body: strings.NewReader(`{"email":"test@example.com"}`), + Delay: 100 * time.Millisecond, + ExpectedStatus: 204, + ExpectedEvents: map[string]int{ + "OnModelBeforeUpdate": 1, + "OnModelAfterUpdate": 1, + "OnMailerBeforeRecordResetPasswordSend": 1, + "OnMailerAfterRecordResetPasswordSend": 1, + }, + }, + { + Name: "existing auth record (after already sent)", + Method: http.MethodPost, + Url: "/api/collections/clients/request-password-reset", + Body: strings.NewReader(`{"email":"test@example.com"}`), + Delay: 100 * time.Millisecond, + ExpectedStatus: 204, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + // simulate recent password request sent + authRecord, err := app.Dao().FindFirstRecordByData("clients", "email", "test@example.com") + if err != nil { + t.Fatal(err) + } + authRecord.SetLastResetSentAt(types.NowDateTime()) + dao := daos.New(app.Dao().DB()) // new dao to ignore hooks + if err := dao.Save(authRecord); err != nil { + t.Fatal(err) + } + }, + }, + { + Name: "existing auth record in a collection with disabled password login", + Method: http.MethodPost, + Url: "/api/collections/nologin/request-password-reset", + Body: strings.NewReader(`{"email":"test@example.com"}`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordAuthConfirmPasswordReset(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "empty data", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-password-reset", + Body: strings.NewReader(``), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"password":{"code":"validation_required"`, + `"passwordConfirm":{"code":"validation_required"`, + `"token":{"code":"validation_required"`, + }, + }, + { + Name: "invalid data format", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-password-reset", + Body: strings.NewReader(`{"password`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "expired token and invalid password", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-password-reset", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoxNjQwOTkxNjYxfQ.TayHoXkOTM0w8InkBEb86npMJEaf6YVUrxrRmMgFjeY", + "password":"1234567", + "passwordConfirm":"7654321" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"token":{"code":"validation_invalid_token"`, + `"password":{"code":"validation_length_out_of_range"`, + `"passwordConfirm":{"code":"validation_values_mismatch"`, + }, + }, + { + Name: "non auth collection", + Method: http.MethodPost, + Url: "/api/collections/demo1/confirm-password-reset?expand=rel,missing", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.R_4FOSUHIuJQ5Crl3PpIPCXMsoHzuTaNlccpXg_3FOg", + "password":"12345678", + "passwordConfirm":"12345678" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{}`, + }, + }, + { + Name: "different auth collection", + Method: http.MethodPost, + Url: "/api/collections/clients/confirm-password-reset?expand=rel,missing", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.R_4FOSUHIuJQ5Crl3PpIPCXMsoHzuTaNlccpXg_3FOg", + "password":"12345678", + "passwordConfirm":"12345678" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{"token":{"code":"validation_token_collection_mismatch"`, + }, + }, + { + Name: "valid token and data", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-password-reset?expand=rel,missing", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.R_4FOSUHIuJQ5Crl3PpIPCXMsoHzuTaNlccpXg_3FOg", + "password":"12345678", + "passwordConfirm":"12345678" + }`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"token":`, + `"record":`, + `"id":"4q1xlclmfloku33"`, + `"email":"test@example.com"`, + `"expand":`, + `"rel":`, + `"id":"llvuca81nly1qls"`, + }, + NotExpectedContent: []string{ + `"missing":`, + }, + ExpectedEvents: map[string]int{ + "OnRecordAuthRequest": 1, + "OnModelAfterUpdate": 1, + "OnModelBeforeUpdate": 1, + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordAuthRequestVerification(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "not an auth collection", + Method: http.MethodPost, + Url: "/api/collections/demo1/request-verification", + Body: strings.NewReader(``), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "empty data", + Method: http.MethodPost, + Url: "/api/collections/users/request-verification", + Body: strings.NewReader(``), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{"email":{"code":"validation_required","message":"Cannot be blank."}}`}, + }, + { + Name: "invalid data", + Method: http.MethodPost, + Url: "/api/collections/users/request-verification", + Body: strings.NewReader(`{"email`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "missing auth record", + Method: http.MethodPost, + Url: "/api/collections/users/request-verification", + Body: strings.NewReader(`{"email":"missing@example.com"}`), + Delay: 100 * time.Millisecond, + ExpectedStatus: 204, + }, + { + Name: "already verified auth record", + Method: http.MethodPost, + Url: "/api/collections/users/request-verification", + Body: strings.NewReader(`{"email":"test2@example.com"}`), + Delay: 100 * time.Millisecond, + ExpectedStatus: 204, + }, + { + Name: "existing auth record", + Method: http.MethodPost, + Url: "/api/collections/users/request-verification", + Body: strings.NewReader(`{"email":"test@example.com"}`), + Delay: 100 * time.Millisecond, + ExpectedStatus: 204, + ExpectedEvents: map[string]int{ + "OnModelBeforeUpdate": 1, + "OnModelAfterUpdate": 1, + "OnMailerBeforeRecordVerificationSend": 1, + "OnMailerAfterRecordVerificationSend": 1, + }, + }, + { + Name: "existing auth record (after already sent)", + Method: http.MethodPost, + Url: "/api/collections/users/request-verification", + Body: strings.NewReader(`{"email":"test@example.com"}`), + Delay: 100 * time.Millisecond, + ExpectedStatus: 204, + BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + // simulate recent verification sent + authRecord, err := app.Dao().FindFirstRecordByData("users", "email", "test@example.com") + if err != nil { + t.Fatal(err) + } + authRecord.SetLastVerificationSentAt(types.NowDateTime()) + dao := daos.New(app.Dao().DB()) // new dao to ignore hooks + if err := dao.Save(authRecord); err != nil { + t.Fatal(err) + } + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordAuthConfirmVerification(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "empty data", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-verification", + Body: strings.NewReader(``), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"token":{"code":"validation_required"`, + }, + }, + { + Name: "invalid data format", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-verification", + Body: strings.NewReader(`{"password`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "expired token", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-verification", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoxNjQwOTkxNjYxfQ.Avbt9IP8sBisVz_2AGrlxLDvangVq4PhL2zqQVYLKlE" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"token":{"code":"validation_invalid_token"`, + }, + }, + { + Name: "non auth collection", + Method: http.MethodPost, + Url: "/api/collections/demo1/confirm-verification?expand=rel,missing", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.R_4FOSUHIuJQ5Crl3PpIPCXMsoHzuTaNlccpXg_3FOg" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{}`, + }, + }, + { + Name: "different auth collection", + Method: http.MethodPost, + Url: "/api/collections/clients/confirm-verification?expand=rel,missing", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.hL16TVmStHFdHLc4a860bRqJ3sFfzjv0_NRNzwsvsrc" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{"token":{"code":"validation_token_collection_mismatch"`, + }, + }, + { + Name: "valid token", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-verification?expand=rel,missing", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.hL16TVmStHFdHLc4a860bRqJ3sFfzjv0_NRNzwsvsrc" + }`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"token":`, + `"record":`, + `"id":"4q1xlclmfloku33"`, + `"email":"test@example.com"`, + `"verified":true`, + `"expand":`, + `"rel":`, + `"id":"llvuca81nly1qls"`, + }, + NotExpectedContent: []string{ + `"missing":`, + }, + ExpectedEvents: map[string]int{ + "OnRecordAuthRequest": 1, + "OnModelAfterUpdate": 1, + "OnModelBeforeUpdate": 1, + }, + }, + { + Name: "valid token (already verified)", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-verification?expand=rel,missing", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Im9hcDY0MGNvdDR5cnUycyIsImVtYWlsIjoidGVzdDJAZXhhbXBsZS5jb20iLCJjb2xsZWN0aW9uSWQiOiJfcGJfdXNlcnNfYXV0aF8iLCJ0eXBlIjoiYXV0aFJlY29yZCIsImV4cCI6MjIwODk4NTI2MX0.PsOABmYUzGbd088g8iIBL4-pf7DUZm0W5Ju6lL5JVRg" + }`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"token":`, + `"record":`, + `"id":"oap640cot4yru2s"`, + `"email":"test2@example.com"`, + `"verified":true`, + }, + NotExpectedContent: []string{ + `"expand":`, // no rel id attached + `"missing":`, + }, + ExpectedEvents: map[string]int{ + "OnRecordAuthRequest": 1, + }, + }, + { + Name: "valid verification token from a collection without allowed login", + Method: http.MethodPost, + Url: "/api/collections/nologin/confirm-verification?expand=rel,missing", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImRjNDlrNmpnZWpuNDBoMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6ImtwdjcwOXNrMmxxYnFrOCIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.coREjeTDS3_Go7DP1nxHtevIX5rujwHU-_mRB6oOm3w" + }`), + ExpectedStatus: 204, + ExpectedContent: []string{}, + ExpectedEvents: map[string]int{ + "OnModelAfterUpdate": 1, + "OnModelBeforeUpdate": 1, + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordAuthRequestEmailChange(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "unauthorized", + Method: http.MethodPost, + Url: "/api/collections/users/request-email-change", + Body: strings.NewReader(`{"newEmail":"change@example.com"}`), + ExpectedStatus: 401, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "not an auth collection", + Method: http.MethodPost, + Url: "/api/collections/demo1/request-email-change", + Body: strings.NewReader(`{"newEmail":"change@example.com"}`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "admin authentication", + Method: http.MethodPost, + Url: "/api/collections/users/request-email-change", + Body: strings.NewReader(`{"newEmail":"change@example.com"}`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 401, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "record authentication but from different auth collection", + Method: http.MethodPost, + Url: "/api/collections/clients/request-email-change", + Body: strings.NewReader(`{"newEmail":"change@example.com"}`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "invalid data", + Method: http.MethodPost, + Url: "/api/collections/users/request-email-change", + Body: strings.NewReader(`{"newEmail`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "empty data", + Method: http.MethodPost, + Url: "/api/collections/users/request-email-change", + Body: strings.NewReader(`{}`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":`, + `"newEmail":{"code":"validation_required"`, + }, + }, + { + Name: "valid data (existing email)", + Method: http.MethodPost, + Url: "/api/collections/users/request-email-change", + Body: strings.NewReader(`{"newEmail":"test2@example.com"}`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":`, + `"newEmail":{"code":"validation_record_email_exists"`, + }, + }, + { + Name: "valid data (new email)", + Method: http.MethodPost, + Url: "/api/collections/users/request-email-change", + Body: strings.NewReader(`{"newEmail":"change@example.com"}`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 204, + ExpectedEvents: map[string]int{ + "OnMailerBeforeRecordChangeEmailSend": 1, + "OnMailerAfterRecordChangeEmailSend": 1, + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordAuthConfirmEmailChange(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "not an auth collection", + Method: http.MethodPost, + Url: "/api/collections/demo1/confirm-email-change", + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{}`, + }, + }, + { + Name: "empty data", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-email-change", + Body: strings.NewReader(``), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":`, + `"token":{"code":"validation_required"`, + `"password":{"code":"validation_required"`, + }, + }, + { + Name: "invalid data", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-email-change", + Body: strings.NewReader(`{"token`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "expired token and correct password", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-email-change", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJjaGFuZ2VAZXhhbXBsZS5jb20iLCJleHAiOjE2NDA5OTE2NjF9.D20jh5Ss7SZyXRUXjjEyLCYo9Ky0N5cE5dKB_MGJ8G8", + "password":"1234567890" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"token":{`, + `"code":"validation_invalid_token"`, + }, + }, + { + Name: "valid token and incorrect password", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-email-change", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJjaGFuZ2VAZXhhbXBsZS5jb20iLCJleHAiOjIyMDg5ODUyNjF9.1sG6cL708pRXXjiHRZhG-in0X5fnttSf5nNcadKoYRs", + "password":"1234567891" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"password":{`, + `"code":"validation_invalid_password"`, + }, + }, + { + Name: "valid token and correct password", + Method: http.MethodPost, + Url: "/api/collections/users/confirm-email-change", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJjaGFuZ2VAZXhhbXBsZS5jb20iLCJleHAiOjIyMDg5ODUyNjF9.1sG6cL708pRXXjiHRZhG-in0X5fnttSf5nNcadKoYRs", + "password":"1234567890" + }`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"token":`, + `"record":`, + `"id":"4q1xlclmfloku33"`, + `"email":"change@example.com"`, + `"verified":true`, + }, + ExpectedEvents: map[string]int{ + "OnRecordAuthRequest": 1, + "OnModelAfterUpdate": 1, + "OnModelBeforeUpdate": 1, + }, + }, + { + Name: "valid token and correct password in different auth collection", + Method: http.MethodPost, + Url: "/api/collections/clients/confirm-email-change", + Body: strings.NewReader(`{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJjaGFuZ2VAZXhhbXBsZS5jb20iLCJleHAiOjIyMDg5ODUyNjF9.1sG6cL708pRXXjiHRZhG-in0X5fnttSf5nNcadKoYRs", + "password":"1234567890" + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"token":{"code":"validation_token_collection_mismatch"`, + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordAuthListExternalsAuths(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "unauthorized", + Method: http.MethodGet, + Url: "/api/collections/users/records/4q1xlclmfloku33/external-auths", + ExpectedStatus: 401, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "admin + nonexisting record id", + Method: http.MethodGet, + Url: "/api/collections/users/records/missing/external-auths", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "admin + existing record id and no external auths", + Method: http.MethodGet, + Url: "/api/collections/users/records/oap640cot4yru2s/external-auths", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{`[]`}, + ExpectedEvents: map[string]int{"OnRecordListExternalAuths": 1}, + }, + { + Name: "admin + existing user id and 2 external auths", + Method: http.MethodGet, + Url: "/api/collections/users/records/4q1xlclmfloku33/external-auths", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"clmflokuq1xl341"`, + `"id":"dlmflokuq1xl342"`, + `"recordId":"4q1xlclmfloku33"`, + `"collectionId":"_pb_users_auth_"`, + }, + ExpectedEvents: map[string]int{"OnRecordListExternalAuths": 1}, + }, + { + Name: "auth record + trying to list another user external auths", + Method: http.MethodGet, + Url: "/api/collections/users/records/4q1xlclmfloku33/external-auths", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6Im9hcDY0MGNvdDR5cnUycyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.uatnTBFqMnF0p4FkmwEpA9R-uGFu0Putwyk6NJCKBno", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record + trying to list another user external auths from different collection", + Method: http.MethodGet, + Url: "/api/collections/clients/records/o1y0dd0spd786md/external-auths", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6Im9hcDY0MGNvdDR5cnUycyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.uatnTBFqMnF0p4FkmwEpA9R-uGFu0Putwyk6NJCKBno", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record + owner without external auths", + Method: http.MethodGet, + Url: "/api/collections/users/records/oap640cot4yru2s/external-auths", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6Im9hcDY0MGNvdDR5cnUycyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.uatnTBFqMnF0p4FkmwEpA9R-uGFu0Putwyk6NJCKBno", + }, + ExpectedStatus: 200, + ExpectedContent: []string{`[]`}, + ExpectedEvents: map[string]int{"OnRecordListExternalAuths": 1}, + }, + { + Name: "authorized as user - owner with 2 external auths", + Method: http.MethodGet, + Url: "/api/collections/users/records/4q1xlclmfloku33/external-auths", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"clmflokuq1xl341"`, + `"id":"dlmflokuq1xl342"`, + `"recordId":"4q1xlclmfloku33"`, + `"collectionId":"_pb_users_auth_"`, + }, + ExpectedEvents: map[string]int{"OnRecordListExternalAuths": 1}, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordAuthUnlinkExternalsAuth(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "unauthorized", + Method: http.MethodDelete, + Url: "/api/collections/users/records/4q1xlclmfloku33/external-auths/google", + ExpectedStatus: 401, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "admin - nonexisting recod id", + Method: http.MethodDelete, + Url: "/api/collections/users/records/missing/external-auths/google", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "admin - nonlinked provider", + Method: http.MethodDelete, + Url: "/api/collections/users/records/4q1xlclmfloku33/external-auths/facebook", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "admin - linked provider", + Method: http.MethodDelete, + Url: "/api/collections/users/records/4q1xlclmfloku33/external-auths/google", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 204, + ExpectedContent: []string{}, + ExpectedEvents: map[string]int{ + "OnModelAfterDelete": 1, + "OnModelBeforeDelete": 1, + "OnRecordAfterUnlinkExternalAuthRequest": 1, + "OnRecordBeforeUnlinkExternalAuthRequest": 1, + }, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + record, err := app.Dao().FindRecordById("users", "4q1xlclmfloku33") + if err != nil { + t.Fatal(err) + } + auth, _ := app.Dao().FindExternalAuthByRecordAndProvider(record, "google") + if auth != nil { + t.Fatalf("Expected the google ExternalAuth to be deleted, got got \n%v", auth) + } + }, + }, + { + Name: "auth record - trying to unlink another user external auth", + Method: http.MethodDelete, + Url: "/api/collections/users/records/4q1xlclmfloku33/external-auths/google", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6Im9hcDY0MGNvdDR5cnUycyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.uatnTBFqMnF0p4FkmwEpA9R-uGFu0Putwyk6NJCKBno", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record - trying to unlink another user external auth from different collection", + Method: http.MethodDelete, + Url: "/api/collections/clients/records/o1y0dd0spd786md/external-auths/google", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record - owner with existing external auth", + Method: http.MethodDelete, + Url: "/api/collections/users/records/4q1xlclmfloku33/external-auths/google", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 204, + ExpectedContent: []string{}, + ExpectedEvents: map[string]int{ + "OnModelAfterDelete": 1, + "OnModelBeforeDelete": 1, + "OnRecordAfterUnlinkExternalAuthRequest": 1, + "OnRecordBeforeUnlinkExternalAuthRequest": 1, + }, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + record, err := app.Dao().FindRecordById("users", "4q1xlclmfloku33") + if err != nil { + t.Fatal(err) + } + auth, _ := app.Dao().FindExternalAuthByRecordAndProvider(record, "google") + if auth != nil { + t.Fatalf("Expected the google ExternalAuth to be deleted, got got \n%v", auth) + } + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} diff --git a/apis/record.go b/apis/record_crud.go similarity index 63% rename from apis/record.go rename to apis/record_crud.go index 8493ac8e6..ea8790f77 100644 --- a/apis/record.go +++ b/apis/record_crud.go @@ -13,27 +13,27 @@ import ( "github.com/pocketbase/pocketbase/forms" "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/resolvers" - "github.com/pocketbase/pocketbase/tools/rest" "github.com/pocketbase/pocketbase/tools/search" ) const expandQueryParam = "expand" -// BindRecordApi registers the record api endpoints and the corresponding handlers. -func BindRecordApi(app core.App, rg *echo.Group) { +// bindRecordCrudApi registers the record crud api endpoints and +// the corresponding handlers. +func bindRecordCrudApi(app core.App, rg *echo.Group) { api := recordApi{app: app} subGroup := rg.Group( - "/collections/:collection/records", + "/collections/:collection", ActivityLogger(app), LoadCollectionContext(app), ) - subGroup.GET("", api.list) - subGroup.POST("", api.create) - subGroup.GET("/:id", api.view) - subGroup.PATCH("/:id", api.update) - subGroup.DELETE("/:id", api.delete) + subGroup.GET("/records", api.list) + subGroup.POST("/records", api.create) + subGroup.GET("/records/:id", api.view) + subGroup.PATCH("/records/:id", api.update) + subGroup.DELETE("/records/:id", api.delete) } type recordApi struct { @@ -43,13 +43,13 @@ type recordApi struct { func (api *recordApi) list(c echo.Context) error { collection, _ := c.Get(ContextCollectionKey).(*models.Collection) if collection == nil { - return rest.NewNotFoundError("", "Missing collection context.") + return NewNotFoundError("", "Missing collection context.") } admin, _ := c.Get(ContextAdminKey).(*models.Admin) if admin == nil && collection.ListRule == nil { // only admins can access if the rule is nil - return rest.NewForbiddenError("Only admins can perform this action.", nil) + return NewForbiddenError("Only admins can perform this action.", nil) } // forbid users and guests to query special filter/sort fields @@ -57,13 +57,18 @@ func (api *recordApi) list(c echo.Context) error { return err } - requestData := api.exportRequestData(c) + requestData := exportRequestData(c) - fieldsResolver := resolvers.NewRecordFieldResolver(api.app.Dao(), collection, requestData) + fieldsResolver := resolvers.NewRecordFieldResolver( + api.app.Dao(), + collection, + requestData, + // hidden fields are searchable only by admins + admin != nil, + ) searchProvider := search.NewProvider(fieldsResolver). - Query(api.app.Dao().RecordQuery(collection)). - CountColumn(fmt.Sprintf("%s.id", api.app.Dao().DB().QuoteSimpleColumnName(collection.Name))) + Query(api.app.Dao().RecordQuery(collection)) if admin == nil && collection.ListRule != nil { searchProvider.AddFilter(search.FilterData(*collection.ListRule)) @@ -72,7 +77,7 @@ func (api *recordApi) list(c echo.Context) error { var rawRecords = []dbx.NullStringMap{} result, err := searchProvider.ParseAndExec(c.QueryString(), &rawRecords) if err != nil { - return rest.NewBadRequestError("Invalid filter parameters.", err) + return NewBadRequestError("Invalid filter parameters.", err) } records := models.NewRecordsFromNullStringMaps(collection, rawRecords) @@ -83,13 +88,22 @@ func (api *recordApi) list(c echo.Context) error { failed := api.app.Dao().ExpandRecords( records, expands, - api.expandFunc(c, requestData), + expandFetch(api.app.Dao(), admin != nil, requestData), ) if len(failed) > 0 && api.app.IsDebug() { log.Println("Failed to expand relations: ", failed) } } + if collection.IsAuth() { + err := autoIgnoreAuthRecordsEmailVisibility( + api.app.Dao(), records, admin != nil, requestData, + ) + if err != nil && api.app.IsDebug() { + log.Println("IgnoreEmailVisibility failure:", err) + } + } + result.Items = records event := &core.RecordsListEvent{ @@ -107,25 +121,25 @@ func (api *recordApi) list(c echo.Context) error { func (api *recordApi) view(c echo.Context) error { collection, _ := c.Get(ContextCollectionKey).(*models.Collection) if collection == nil { - return rest.NewNotFoundError("", "Missing collection context.") + return NewNotFoundError("", "Missing collection context.") } admin, _ := c.Get(ContextAdminKey).(*models.Admin) if admin == nil && collection.ViewRule == nil { // only admins can access if the rule is nil - return rest.NewForbiddenError("Only admins can perform this action.", nil) + return NewForbiddenError("Only admins can perform this action.", nil) } recordId := c.PathParam("id") if recordId == "" { - return rest.NewNotFoundError("", nil) + return NewNotFoundError("", nil) } - requestData := api.exportRequestData(c) + requestData := exportRequestData(c) ruleFunc := func(q *dbx.SelectQuery) error { if admin == nil && collection.ViewRule != nil && *collection.ViewRule != "" { - resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), collection, requestData) + resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), collection, requestData, true) expr, err := search.FilterData(*collection.ViewRule).BuildExpr(resolver) if err != nil { return err @@ -136,21 +150,30 @@ func (api *recordApi) view(c echo.Context) error { return nil } - record, fetchErr := api.app.Dao().FindRecordById(collection, recordId, ruleFunc) + record, fetchErr := api.app.Dao().FindRecordById(collection.Id, recordId, ruleFunc) if fetchErr != nil || record == nil { - return rest.NewNotFoundError("", fetchErr) + return NewNotFoundError("", fetchErr) } // expand record relations failed := api.app.Dao().ExpandRecord( record, strings.Split(c.QueryParam(expandQueryParam), ","), - api.expandFunc(c, requestData), + expandFetch(api.app.Dao(), admin != nil, requestData), ) if len(failed) > 0 && api.app.IsDebug() { log.Println("Failed to expand relations: ", failed) } + if collection.IsAuth() { + err := autoIgnoreAuthRecordsEmailVisibility( + api.app.Dao(), []*models.Record{record}, admin != nil, requestData, + ) + if err != nil && api.app.IsDebug() { + log.Println("IgnoreEmailVisibility failure:", err) + } + } + event := &core.RecordViewEvent{ HttpContext: c, Record: record, @@ -164,21 +187,27 @@ func (api *recordApi) view(c echo.Context) error { func (api *recordApi) create(c echo.Context) error { collection, _ := c.Get(ContextCollectionKey).(*models.Collection) if collection == nil { - return rest.NewNotFoundError("", "Missing collection context.") + return NewNotFoundError("", "Missing collection context.") } admin, _ := c.Get(ContextAdminKey).(*models.Admin) if admin == nil && collection.CreateRule == nil { // only admins can access if the rule is nil - return rest.NewForbiddenError("Only admins can perform this action.", nil) + return NewForbiddenError("Only admins can perform this action.", nil) } - requestData := api.exportRequestData(c) + requestData := exportRequestData(c) + + hasFullManageAccess := admin != nil // temporary save the record and check it against the create rule - if admin == nil && collection.CreateRule != nil && *collection.CreateRule != "" { - ruleFunc := func(q *dbx.SelectQuery) error { - resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), collection, requestData) + if admin == nil && collection.CreateRule != nil { + createRuleFunc := func(q *dbx.SelectQuery) error { + if *collection.CreateRule == "" { + return nil // no create rule to resolve + } + + resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), collection, requestData, true) expr, err := search.FilterData(*collection.CreateRule).BuildExpr(resolver) if err != nil { return err @@ -190,25 +219,32 @@ func (api *recordApi) create(c echo.Context) error { testRecord := models.NewRecord(collection) testForm := forms.NewRecordUpsert(api.app, testRecord) - if err := testForm.LoadData(c.Request()); err != nil { - return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) + testForm.SetFullManageAccess(true) + if err := testForm.LoadRequest(c.Request(), ""); err != nil { + return NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) } testErr := testForm.DrySubmit(func(txDao *daos.Dao) error { - _, fetchErr := txDao.FindRecordById(collection, testRecord.Id, ruleFunc) - return fetchErr + foundRecord, err := txDao.FindRecordById(collection.Id, testRecord.Id, createRuleFunc) + if err != nil { + return err + } + hasFullManageAccess = hasAuthManageAccess(txDao, foundRecord, requestData) + return nil }) + if testErr != nil { - return rest.NewBadRequestError("Failed to create record.", testErr) + return NewBadRequestError("Failed to create record.", fmt.Errorf("DrySubmit error: %v", testErr)) } } record := models.NewRecord(collection) form := forms.NewRecordUpsert(api.app, record) + form.SetFullManageAccess(hasFullManageAccess) // load request - if err := form.LoadData(c.Request()); err != nil { - return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) + if err := form.LoadRequest(c.Request(), ""); err != nil { + return NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) } event := &core.RecordCreateEvent{ @@ -221,19 +257,28 @@ func (api *recordApi) create(c echo.Context) error { return func() error { return api.app.OnRecordBeforeCreateRequest().Trigger(event, func(e *core.RecordCreateEvent) error { if err := next(); err != nil { - return rest.NewBadRequestError("Failed to create record.", err) + return NewBadRequestError("Failed to create record.", err) } // expand record relations failed := api.app.Dao().ExpandRecord( e.Record, strings.Split(e.HttpContext.QueryParam(expandQueryParam), ","), - api.expandFunc(e.HttpContext, requestData), + expandFetch(api.app.Dao(), admin != nil, requestData), ) if len(failed) > 0 && api.app.IsDebug() { log.Println("Failed to expand relations: ", failed) } + if collection.IsAuth() { + err := autoIgnoreAuthRecordsEmailVisibility( + api.app.Dao(), []*models.Record{e.Record}, admin != nil, requestData, + ) + if err != nil && api.app.IsDebug() { + log.Println("IgnoreEmailVisibility failure:", err) + } + } + return e.HttpContext.JSON(http.StatusOK, e.Record) }) } @@ -249,25 +294,25 @@ func (api *recordApi) create(c echo.Context) error { func (api *recordApi) update(c echo.Context) error { collection, _ := c.Get(ContextCollectionKey).(*models.Collection) if collection == nil { - return rest.NewNotFoundError("", "Missing collection context.") + return NewNotFoundError("", "Missing collection context.") } admin, _ := c.Get(ContextAdminKey).(*models.Admin) if admin == nil && collection.UpdateRule == nil { // only admins can access if the rule is nil - return rest.NewForbiddenError("Only admins can perform this action.", nil) + return NewForbiddenError("Only admins can perform this action.", nil) } recordId := c.PathParam("id") if recordId == "" { - return rest.NewNotFoundError("", nil) + return NewNotFoundError("", nil) } - requestData := api.exportRequestData(c) + requestData := exportRequestData(c) ruleFunc := func(q *dbx.SelectQuery) error { if admin == nil && collection.UpdateRule != nil && *collection.UpdateRule != "" { - resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), collection, requestData) + resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), collection, requestData, true) expr, err := search.FilterData(*collection.UpdateRule).BuildExpr(resolver) if err != nil { return err @@ -279,16 +324,17 @@ func (api *recordApi) update(c echo.Context) error { } // fetch record - record, fetchErr := api.app.Dao().FindRecordById(collection, recordId, ruleFunc) + record, fetchErr := api.app.Dao().FindRecordById(collection.Id, recordId, ruleFunc) if fetchErr != nil || record == nil { - return rest.NewNotFoundError("", fetchErr) + return NewNotFoundError("", fetchErr) } form := forms.NewRecordUpsert(api.app, record) + form.SetFullManageAccess(admin != nil || hasAuthManageAccess(api.app.Dao(), record, requestData)) // load request - if err := form.LoadData(c.Request()); err != nil { - return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) + if err := form.LoadRequest(c.Request(), ""); err != nil { + return NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) } event := &core.RecordUpdateEvent{ @@ -301,19 +347,28 @@ func (api *recordApi) update(c echo.Context) error { return func() error { return api.app.OnRecordBeforeUpdateRequest().Trigger(event, func(e *core.RecordUpdateEvent) error { if err := next(); err != nil { - return rest.NewBadRequestError("Failed to update record.", err) + return NewBadRequestError("Failed to update record.", err) } // expand record relations failed := api.app.Dao().ExpandRecord( e.Record, strings.Split(e.HttpContext.QueryParam(expandQueryParam), ","), - api.expandFunc(e.HttpContext, requestData), + expandFetch(api.app.Dao(), admin != nil, requestData), ) if len(failed) > 0 && api.app.IsDebug() { log.Println("Failed to expand relations: ", failed) } + if collection.IsAuth() { + err := autoIgnoreAuthRecordsEmailVisibility( + api.app.Dao(), []*models.Record{e.Record}, admin != nil, requestData, + ) + if err != nil && api.app.IsDebug() { + log.Println("IgnoreEmailVisibility failure:", err) + } + } + return e.HttpContext.JSON(http.StatusOK, e.Record) }) } @@ -329,25 +384,25 @@ func (api *recordApi) update(c echo.Context) error { func (api *recordApi) delete(c echo.Context) error { collection, _ := c.Get(ContextCollectionKey).(*models.Collection) if collection == nil { - return rest.NewNotFoundError("", "Missing collection context.") + return NewNotFoundError("", "Missing collection context.") } admin, _ := c.Get(ContextAdminKey).(*models.Admin) if admin == nil && collection.DeleteRule == nil { // only admins can access if the rule is nil - return rest.NewForbiddenError("Only admins can perform this action.", nil) + return NewForbiddenError("Only admins can perform this action.", nil) } recordId := c.PathParam("id") if recordId == "" { - return rest.NewNotFoundError("", nil) + return NewNotFoundError("", nil) } - requestData := api.exportRequestData(c) + requestData := exportRequestData(c) ruleFunc := func(q *dbx.SelectQuery) error { if admin == nil && collection.DeleteRule != nil && *collection.DeleteRule != "" { - resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), collection, requestData) + resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), collection, requestData, true) expr, err := search.FilterData(*collection.DeleteRule).BuildExpr(resolver) if err != nil { return err @@ -358,9 +413,9 @@ func (api *recordApi) delete(c echo.Context) error { return nil } - record, fetchErr := api.app.Dao().FindRecordById(collection, recordId, ruleFunc) + record, fetchErr := api.app.Dao().FindRecordById(collection.Id, recordId, ruleFunc) if fetchErr != nil || record == nil { - return rest.NewNotFoundError("", fetchErr) + return NewNotFoundError("", fetchErr) } event := &core.RecordDeleteEvent{ @@ -371,7 +426,7 @@ func (api *recordApi) delete(c echo.Context) error { handlerErr := api.app.OnRecordBeforeDeleteRequest().Trigger(event, func(e *core.RecordDeleteEvent) error { // delete the record if err := api.app.Dao().DeleteRecord(e.Record); err != nil { - return rest.NewBadRequestError("Failed to delete record. Make sure that the record is not part of a required relation reference.", err) + return NewBadRequestError("Failed to delete record. Make sure that the record is not part of a required relation reference.", err) } return e.HttpContext.NoContent(http.StatusNoContent) @@ -384,29 +439,6 @@ func (api *recordApi) delete(c echo.Context) error { return handlerErr } -func (api *recordApi) exportRequestData(c echo.Context) map[string]any { - result := map[string]any{} - queryParams := map[string]any{} - bodyData := map[string]any{} - method := c.Request().Method - - echo.BindQueryParams(c, &queryParams) - - rest.BindBody(c, &bodyData) - - result["method"] = method - result["query"] = queryParams - result["data"] = bodyData - result["user"] = nil - - loggedUser, _ := c.Get(ContextUserKey).(*models.User) - if loggedUser != nil { - result["user"], _ = loggedUser.AsMap() - } - - return result -} - func (api *recordApi) checkForForbiddenQueryFields(c echo.Context) error { admin, _ := c.Get(ContextAdminKey).(*models.Admin) if admin != nil { @@ -418,37 +450,9 @@ func (api *recordApi) checkForForbiddenQueryFields(c echo.Context) error { for _, field := range forbiddenFields { if strings.Contains(decodedQuery, field) { - return rest.NewForbiddenError("Only admins can filter by @collection and @request query params", nil) + return NewForbiddenError("Only admins can filter by @collection and @request query params", nil) } } return nil } - -func (api *recordApi) expandFunc(c echo.Context, requestData map[string]any) daos.ExpandFetchFunc { - admin, _ := c.Get(ContextAdminKey).(*models.Admin) - - return func(relCollection *models.Collection, relIds []string) ([]*models.Record, error) { - return api.app.Dao().FindRecordsByIds(relCollection, relIds, func(q *dbx.SelectQuery) error { - if admin != nil { - return nil // admin can access everything - } - - if relCollection.ViewRule == nil { - return fmt.Errorf("Only admins can view collection %q records", relCollection.Name) - } - - if *relCollection.ViewRule != "" { - resolver := resolvers.NewRecordFieldResolver(api.app.Dao(), relCollection, requestData) - expr, err := search.FilterData(*(relCollection.ViewRule)).BuildExpr(resolver) - if err != nil { - return err - } - resolver.UpdateQuery(q) - q.AndWhere(expr) - } - - return nil - }) - } -} diff --git a/apis/record_crud_test.go b/apis/record_crud_test.go new file mode 100644 index 000000000..4e47b7a87 --- /dev/null +++ b/apis/record_crud_test.go @@ -0,0 +1,1725 @@ +package apis_test + +import ( + "net/http" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/labstack/echo/v5" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/tests" +) + +func TestRecordCrudList(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "missing collection", + Method: http.MethodGet, + Url: "/api/collections/missing/records", + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "unauthenticated trying to access nil rule collection (aka. need admin auth)", + Method: http.MethodGet, + Url: "/api/collections/demo1/records", + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "authenticated record trying to access nil rule collection (aka. need admin auth)", + Method: http.MethodGet, + Url: "/api/collections/demo1/records", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "public collection but with admin only filter/sort (aka. @collection)", + Method: http.MethodGet, + Url: "/api/collections/demo2/records?filter=@collection.demo2.title='test1'", + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "public collection but with ENCODED admin only filter/sort (aka. @collection)", + Method: http.MethodGet, + Url: "/api/collections/demo2/records?filter=%40collection.demo2.title%3D%27test1%27", + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "public collection", + Method: http.MethodGet, + Url: "/api/collections/demo2/records", + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalPages":1`, + `"totalItems":3`, + `"items":[{`, + `"id":"0yxhwia2amd8gec"`, + `"id":"achvryl401bhse3"`, + `"id":"llvuca81nly1qls"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + { + Name: "public collection (using the collection id)", + Method: http.MethodGet, + Url: "/api/collections/sz5l5z67tg7gku0/records", + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalPages":1`, + `"totalItems":3`, + `"items":[{`, + `"id":"0yxhwia2amd8gec"`, + `"id":"achvryl401bhse3"`, + `"id":"llvuca81nly1qls"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + { + Name: "authorized as admin trying to access nil rule collection (aka. need admin auth)", + Method: http.MethodGet, + Url: "/api/collections/demo1/records", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalPages":1`, + `"totalItems":3`, + `"items":[{`, + `"id":"al1h9ijdeojtsjy"`, + `"id":"84nmscqy84lsi1t"`, + `"id":"imy661ixudk5izi"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + { + Name: "valid query params", + Method: http.MethodGet, + Url: "/api/collections/demo1/records?filter=text~'test'&sort=-bool", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalItems":2`, + `"items":[{`, + `"id":"al1h9ijdeojtsjy"`, + `"id":"84nmscqy84lsi1t"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + { + Name: "invalid filter", + Method: http.MethodGet, + Url: "/api/collections/demo1/records?filter=invalid~'test'", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "expand relations", + Method: http.MethodGet, + Url: "/api/collections/demo1/records?expand=rel_one,rel_many.rel,missing&perPage=2&sort=created", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":2`, + `"totalPages":2`, + `"totalItems":3`, + `"items":[{`, + `"collectionName":"demo1"`, + `"id":"84nmscqy84lsi1t"`, + `"id":"al1h9ijdeojtsjy"`, + `"expand":{`, + `"rel_one":""`, + `"rel_one":{"`, + `"rel_many":[{`, + `"rel":{`, + `"rel":""`, + `"json":[1,2,3]`, + `"select_many":["optionB","optionC"]`, + `"select_many":["optionB"]`, + // subrel items + `"id":"0yxhwia2amd8gec"`, + `"id":"llvuca81nly1qls"`, + // email visibility should be ignored for admins even in expanded rels + `"email":"test@example.com"`, + `"email":"test2@example.com"`, + `"email":"test3@example.com"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + { + Name: "authenticated record model that DOESN'T match the collection list rule", + Method: http.MethodGet, + Url: "/api/collections/demo3/records", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalItems":0`, + `"items":[]`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + { + Name: "authenticated record that matches the collection list rule", + Method: http.MethodGet, + Url: "/api/collections/demo3/records", + RequestHeaders: map[string]string{ + // clients, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6ImdrMzkwcWVnczR5NDd3biIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoidjg1MXE0cjc5MHJoa25sIiwiZXhwIjoyMjA4OTg1MjYxfQ.q34IWXrRWsjLvbbVNRfAs_J4SoTHloNBfdGEiLmy-D8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalPages":1`, + `"totalItems":4`, + `"items":[{`, + `"id":"1tmknxy2868d869"`, + `"id":"lcl9d87w22ml6jy"`, + `"id":"7nwo8tuiatetxdm"`, + `"id":"mk5fmymtx4wsprk"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + + // auth collection checks + // ----------------------------------------------------------- + { + Name: "check email visibility as guest", + Method: http.MethodGet, + Url: "/api/collections/nologin/records", + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalPages":1`, + `"totalItems":3`, + `"items":[{`, + `"id":"phhq3wr65cap535"`, + `"id":"dc49k6jgejn40h3"`, + `"id":"oos036e9xvqeexy"`, + `"email":"test2@example.com"`, + `"emailVisibility":true`, + `"emailVisibility":false`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, + `"email":"test@example.com"`, + `"email":"test3@example.com"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + { + Name: "check email visibility as any authenticated record", + Method: http.MethodGet, + Url: "/api/collections/nologin/records", + RequestHeaders: map[string]string{ + // clients, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6ImdrMzkwcWVnczR5NDd3biIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoidjg1MXE0cjc5MHJoa25sIiwiZXhwIjoyMjA4OTg1MjYxfQ.q34IWXrRWsjLvbbVNRfAs_J4SoTHloNBfdGEiLmy-D8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalPages":1`, + `"totalItems":3`, + `"items":[{`, + `"id":"phhq3wr65cap535"`, + `"id":"dc49k6jgejn40h3"`, + `"id":"oos036e9xvqeexy"`, + `"email":"test2@example.com"`, + `"emailVisibility":true`, + `"emailVisibility":false`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, + `"email":"test@example.com"`, + `"email":"test3@example.com"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + { + Name: "check email visibility as manage auth record", + Method: http.MethodGet, + Url: "/api/collections/nologin/records", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalPages":1`, + `"totalItems":3`, + `"items":[{`, + `"id":"phhq3wr65cap535"`, + `"id":"dc49k6jgejn40h3"`, + `"id":"oos036e9xvqeexy"`, + `"email":"test@example.com"`, + `"email":"test2@example.com"`, + `"email":"test3@example.com"`, + `"emailVisibility":true`, + `"emailVisibility":false`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + { + Name: "check email visibility as admin", + Method: http.MethodGet, + Url: "/api/collections/nologin/records", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalPages":1`, + `"totalItems":3`, + `"items":[{`, + `"id":"phhq3wr65cap535"`, + `"id":"dc49k6jgejn40h3"`, + `"id":"oos036e9xvqeexy"`, + `"email":"test@example.com"`, + `"email":"test2@example.com"`, + `"email":"test3@example.com"`, + `"emailVisibility":true`, + `"emailVisibility":false`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + { + Name: "check self email visibility resolver", + Method: http.MethodGet, + Url: "/api/collections/nologin/records", + RequestHeaders: map[string]string{ + // nologin, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6ImRjNDlrNmpnZWpuNDBoMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoia3B2NzA5c2sybHFicWs4IiwiZXhwIjoyMjA4OTg1MjYxfQ.DOYSon3x1-C0hJbwjEU6dp2-6oLeEa8bOlkyP1CinyM", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"page":1`, + `"perPage":30`, + `"totalPages":1`, + `"totalItems":3`, + `"items":[{`, + `"id":"phhq3wr65cap535"`, + `"id":"dc49k6jgejn40h3"`, + `"id":"oos036e9xvqeexy"`, + `"email":"test2@example.com"`, + `"email":"test@example.com"`, + `"emailVisibility":true`, + `"emailVisibility":false`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, + `"email":"test3@example.com"`, + }, + ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordCrudView(t *testing.T) { + scenarios := []tests.ApiScenario{ + { + Name: "missing collection", + Method: http.MethodGet, + Url: "/api/collections/missing/records/0yxhwia2amd8gec", + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "missing record", + Method: http.MethodGet, + Url: "/api/collections/demo2/records/missing", + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "unauthenticated trying to access nil rule collection (aka. need admin auth)", + Method: http.MethodGet, + Url: "/api/collections/demo1/records/imy661ixudk5izi", + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "authenticated record trying to access nil rule collection (aka. need admin auth)", + Method: http.MethodGet, + Url: "/api/collections/demo1/records/imy661ixudk5izi", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "authenticated record that doesn't match the collection view rule", + Method: http.MethodGet, + Url: "/api/collections/users/records/bgs820n361vj1qd", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "public collection view", + Method: http.MethodGet, + Url: "/api/collections/demo2/records/0yxhwia2amd8gec", + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"0yxhwia2amd8gec"`, + `"collectionName":"demo2"`, + }, + ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, + }, + { + Name: "public collection view (using the collection id)", + Method: http.MethodGet, + Url: "/api/collections/sz5l5z67tg7gku0/records/0yxhwia2amd8gec", + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"0yxhwia2amd8gec"`, + `"collectionName":"demo2"`, + }, + ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, + }, + { + Name: "authorized as admin trying to access nil rule collection view (aka. need admin auth)", + Method: http.MethodGet, + Url: "/api/collections/demo1/records/imy661ixudk5izi", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"imy661ixudk5izi"`, + `"collectionName":"demo1"`, + }, + ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, + }, + { + Name: "authenticated record that does match the collection view rule", + Method: http.MethodGet, + Url: "/api/collections/users/records/4q1xlclmfloku33", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"4q1xlclmfloku33"`, + `"collectionName":"users"`, + // owners can always view their email + `"emailVisibility":false`, + `"email":"test@example.com"`, + }, + ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, + }, + { + Name: "expand relations", + Method: http.MethodGet, + Url: "/api/collections/demo1/records/al1h9ijdeojtsjy?expand=rel_one,rel_many.rel,missing&perPage=2&sort=created", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"al1h9ijdeojtsjy"`, + `"collectionName":"demo1"`, + `"rel_many":[{`, + `"rel_one":{`, + `"collectionName":"users"`, + `"id":"bgs820n361vj1qd"`, + `"expand":{"rel":{`, + `"id":"0yxhwia2amd8gec"`, + `"collectionName":"demo2"`, + }, + ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, + }, + + // auth collection checks + // ----------------------------------------------------------- + { + Name: "check email visibility as guest", + Method: http.MethodGet, + Url: "/api/collections/nologin/records/oos036e9xvqeexy", + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"oos036e9xvqeexy"`, + `"emailVisibility":false`, + `"verified":true`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, + `"email":"test3@example.com"`, + }, + ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, + }, + { + Name: "check email visibility as any authenticated record", + Method: http.MethodGet, + Url: "/api/collections/nologin/records/oos036e9xvqeexy", + RequestHeaders: map[string]string{ + // clients, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6ImdrMzkwcWVnczR5NDd3biIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoidjg1MXE0cjc5MHJoa25sIiwiZXhwIjoyMjA4OTg1MjYxfQ.q34IWXrRWsjLvbbVNRfAs_J4SoTHloNBfdGEiLmy-D8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"oos036e9xvqeexy"`, + `"emailVisibility":false`, + `"verified":true`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, + `"email":"test3@example.com"`, + }, + ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, + }, + { + Name: "check email visibility as manage auth record", + Method: http.MethodGet, + Url: "/api/collections/nologin/records/oos036e9xvqeexy", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"oos036e9xvqeexy"`, + `"emailVisibility":false`, + `"email":"test3@example.com"`, + `"verified":true`, + }, + ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, + }, + { + Name: "check email visibility as admin", + Method: http.MethodGet, + Url: "/api/collections/nologin/records/oos036e9xvqeexy", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"oos036e9xvqeexy"`, + `"emailVisibility":false`, + `"email":"test3@example.com"`, + `"verified":true`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, + }, + ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, + }, + { + Name: "check self email visibility resolver", + Method: http.MethodGet, + Url: "/api/collections/nologin/records/dc49k6jgejn40h3", + RequestHeaders: map[string]string{ + // nologin, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6ImRjNDlrNmpnZWpuNDBoMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoia3B2NzA5c2sybHFicWs4IiwiZXhwIjoyMjA4OTg1MjYxfQ.DOYSon3x1-C0hJbwjEU6dp2-6oLeEa8bOlkyP1CinyM", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"dc49k6jgejn40h3"`, + `"email":"test@example.com"`, + `"emailVisibility":false`, + `"verified":false`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"passwordHash"`, + }, + ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordCrudDelete(t *testing.T) { + ensureDeletedFiles := func(app *tests.TestApp, collectionId string, recordId string) { + storageDir := filepath.Join(app.DataDir(), "storage", collectionId, recordId) + + entries, _ := os.ReadDir(storageDir) + if len(entries) != 0 { + t.Errorf("Expected empty/deleted dir, found %d", len(entries)) + } + } + + scenarios := []tests.ApiScenario{ + { + Name: "missing collection", + Method: http.MethodDelete, + Url: "/api/collections/missing/records/0yxhwia2amd8gec", + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "missing record", + Method: http.MethodDelete, + Url: "/api/collections/demo2/records/missing", + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "unauthenticated trying to delete nil rule collection (aka. need admin auth)", + Method: http.MethodDelete, + Url: "/api/collections/demo1/records/imy661ixudk5izi", + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "authenticated record trying to delete nil rule collection (aka. need admin auth)", + Method: http.MethodDelete, + Url: "/api/collections/demo1/records/imy661ixudk5izi", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "authenticated record that doesn't match the collection delete rule", + Method: http.MethodDelete, + Url: "/api/collections/users/records/bgs820n361vj1qd", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "public collection record delete", + Method: http.MethodDelete, + Url: "/api/collections/nologin/records/dc49k6jgejn40h3", + ExpectedStatus: 204, + ExpectedEvents: map[string]int{ + "OnModelAfterDelete": 1, + "OnModelBeforeDelete": 1, + "OnRecordAfterDeleteRequest": 1, + "OnRecordBeforeDeleteRequest": 1, + }, + }, + { + Name: "public collection record delete (using the collection id as identifier)", + Method: http.MethodDelete, + Url: "/api/collections/kpv709sk2lqbqk8/records/dc49k6jgejn40h3", + ExpectedStatus: 204, + ExpectedEvents: map[string]int{ + "OnModelAfterDelete": 1, + "OnModelBeforeDelete": 1, + "OnRecordAfterDeleteRequest": 1, + "OnRecordBeforeDeleteRequest": 1, + }, + }, + { + Name: "authorized as admin trying to delete nil rule collection view (aka. need admin auth)", + Method: http.MethodDelete, + Url: "/api/collections/clients/records/o1y0dd0spd786md", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 204, + ExpectedEvents: map[string]int{ + "OnModelAfterDelete": 1, + "OnModelBeforeDelete": 1, + "OnRecordAfterDeleteRequest": 1, + "OnRecordBeforeDeleteRequest": 1, + }, + }, + { + Name: "authenticated record that does match the collection delete rule", + Method: http.MethodDelete, + Url: "/api/collections/users/records/4q1xlclmfloku33", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 204, + ExpectedEvents: map[string]int{ + "OnModelAfterDelete": 1, + "OnModelAfterUpdate": 1, + "OnModelBeforeDelete": 1, + "OnModelBeforeUpdate": 1, + "OnRecordAfterDeleteRequest": 1, + "OnRecordBeforeDeleteRequest": 1, + }, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + ensureDeletedFiles(app, "_pb_users_auth_", "4q1xlclmfloku33") + + // check if all the external auths records were deleted + collection, _ := app.Dao().FindCollectionByNameOrId("users") + record := models.NewRecord(collection) + record.Id = "4q1xlclmfloku33" + externalAuths, err := app.Dao().FindAllExternalAuthsByRecord(record) + if err != nil { + t.Errorf("Failed to fetch external auths: %v", err) + } + if len(externalAuths) > 0 { + t.Errorf("Expected the linked external auths to be deleted, got %d", len(externalAuths)) + } + }, + }, + + // cascade delete checks + // ----------------------------------------------------------- + { + Name: "trying to delete a record while being part of a non-cascade required relation", + Method: http.MethodDelete, + Url: "/api/collections/demo3/records/7nwo8tuiatetxdm", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + ExpectedEvents: map[string]int{ + "OnRecordBeforeDeleteRequest": 1, + "OnModelBeforeUpdate": 1, // self_rel_many update of test1 record + "OnModelBeforeDelete": 1, // rel_one_cascade of test1 record + }, + }, + { + Name: "delete a record with non-cascade references", + Method: http.MethodDelete, + Url: "/api/collections/demo3/records/1tmknxy2868d869", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 204, + ExpectedEvents: map[string]int{ + "OnModelBeforeDelete": 1, + "OnModelAfterDelete": 1, + "OnModelBeforeUpdate": 2, + "OnModelAfterUpdate": 2, + "OnRecordBeforeDeleteRequest": 1, + "OnRecordAfterDeleteRequest": 1, + }, + }, + { + Name: "delete a record with cascade references", + Method: http.MethodDelete, + Url: "/api/collections/users/records/oap640cot4yru2s", + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 204, + ExpectedEvents: map[string]int{ + "OnModelBeforeDelete": 2, + "OnModelAfterDelete": 2, + "OnModelBeforeUpdate": 2, + "OnModelAfterUpdate": 2, + "OnRecordBeforeDeleteRequest": 1, + "OnRecordAfterDeleteRequest": 1, + }, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + recId := "84nmscqy84lsi1t" + rec, _ := app.Dao().FindRecordById("demo1", recId, nil) + if rec != nil { + t.Errorf("Expected record %s to be cascade deleted", recId) + } + ensureDeletedFiles(app, "wsmn24bux7wo113", recId) + ensureDeletedFiles(app, "_pb_users_auth_", "oap640cot4yru2s") + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordCrudCreate(t *testing.T) { + formData, mp, err := tests.MockMultipartData(map[string]string{ + "title": "title_test", + }, "files") + if err != nil { + t.Fatal(err) + } + + scenarios := []tests.ApiScenario{ + { + Name: "missing collection", + Method: http.MethodPost, + Url: "/api/collections/missing/records", + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "guest trying to access nil-rule collection", + Method: http.MethodPost, + Url: "/api/collections/demo1/records", + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record trying to access nil-rule collection", + Method: http.MethodPost, + Url: "/api/collections/demo1/records", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "submit invalid format", + Method: http.MethodPost, + Url: "/api/collections/demo2/records", + Body: strings.NewReader(`{"`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "submit nil body", + Method: http.MethodPost, + Url: "/api/collections/demo2/records", + Body: nil, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "guest submit in public collection", + Method: http.MethodPost, + Url: "/api/collections/demo2/records", + Body: strings.NewReader(`{"title":"new"}`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":`, + `"title":"new"`, + `"active":false`, + }, + ExpectedEvents: map[string]int{ + "OnRecordBeforeCreateRequest": 1, + "OnRecordAfterCreateRequest": 1, + "OnModelBeforeCreate": 1, + "OnModelAfterCreate": 1, + }, + }, + { + Name: "guest trying to submit in restricted collection", + Method: http.MethodPost, + Url: "/api/collections/demo3/records", + Body: strings.NewReader(`{"title":"test123"}`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record submit in restricted collection (rule failure check)", + Method: http.MethodPost, + Url: "/api/collections/demo3/records", + Body: strings.NewReader(`{"title":"test123"}`), + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record submit in restricted collection (rule pass check) + expand relations", + Method: http.MethodPost, + Url: "/api/collections/demo4/records?expand=missing,rel_one_no_cascade,rel_many_no_cascade_required", + Body: strings.NewReader(`{ + "title":"test123", + "rel_one_no_cascade":"mk5fmymtx4wsprk", + "rel_one_no_cascade_required":"7nwo8tuiatetxdm", + "rel_one_cascade":"mk5fmymtx4wsprk", + "rel_many_no_cascade":"mk5fmymtx4wsprk", + "rel_many_no_cascade_required":["7nwo8tuiatetxdm","lcl9d87w22ml6jy"], + "rel_many_cascade":"lcl9d87w22ml6jy" + }`), + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":`, + `"title":"test123"`, + `"rel_one_no_cascade":"mk5fmymtx4wsprk"`, + `"rel_one_no_cascade_required":"7nwo8tuiatetxdm"`, + `"rel_one_cascade":"mk5fmymtx4wsprk"`, + `"rel_many_no_cascade":["mk5fmymtx4wsprk"]`, + `"rel_many_no_cascade_required":["7nwo8tuiatetxdm","lcl9d87w22ml6jy"]`, + `"rel_many_cascade":["lcl9d87w22ml6jy"]`, + }, + NotExpectedContent: []string{ + // the users auth records don't have access to view the demo3 expands + `"expand":{`, + `"missing"`, + `"id":"mk5fmymtx4wsprk"`, + `"id":"7nwo8tuiatetxdm"`, + `"id":"lcl9d87w22ml6jy"`, + }, + ExpectedEvents: map[string]int{ + "OnRecordBeforeCreateRequest": 1, + "OnRecordAfterCreateRequest": 1, + "OnModelBeforeCreate": 1, + "OnModelAfterCreate": 1, + }, + }, + { + Name: "admin submit in restricted collection (rule skip check) + expand relations", + Method: http.MethodPost, + Url: "/api/collections/demo4/records?expand=missing,rel_one_no_cascade,rel_many_no_cascade_required", + Body: strings.NewReader(`{ + "title":"test123", + "rel_one_no_cascade":"mk5fmymtx4wsprk", + "rel_one_no_cascade_required":"7nwo8tuiatetxdm", + "rel_one_cascade":"mk5fmymtx4wsprk", + "rel_many_no_cascade":"mk5fmymtx4wsprk", + "rel_many_no_cascade_required":["7nwo8tuiatetxdm","lcl9d87w22ml6jy"], + "rel_many_cascade":"lcl9d87w22ml6jy" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":`, + `"title":"test123"`, + `"rel_one_no_cascade":"mk5fmymtx4wsprk"`, + `"rel_one_no_cascade_required":"7nwo8tuiatetxdm"`, + `"rel_one_cascade":"mk5fmymtx4wsprk"`, + `"rel_many_no_cascade":["mk5fmymtx4wsprk"]`, + `"rel_many_no_cascade_required":["7nwo8tuiatetxdm","lcl9d87w22ml6jy"]`, + `"rel_many_cascade":["lcl9d87w22ml6jy"]`, + `"expand":{`, + `"id":"mk5fmymtx4wsprk"`, + `"id":"7nwo8tuiatetxdm"`, + `"id":"lcl9d87w22ml6jy"`, + }, + NotExpectedContent: []string{ + `"missing"`, + }, + ExpectedEvents: map[string]int{ + "OnRecordBeforeCreateRequest": 1, + "OnRecordAfterCreateRequest": 1, + "OnModelBeforeCreate": 1, + "OnModelAfterCreate": 1, + }, + }, + { + Name: "submit via multipart form data", + Method: http.MethodPost, + Url: "/api/collections/demo3/records", + Body: formData, + RequestHeaders: map[string]string{ + "Content-Type": mp.FormDataContentType(), + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"`, + `"title":"title_test"`, + `"files":["`, + }, + ExpectedEvents: map[string]int{ + "OnRecordBeforeCreateRequest": 1, + "OnRecordAfterCreateRequest": 1, + "OnModelBeforeCreate": 1, + "OnModelAfterCreate": 1, + }, + }, + + // ID checks + // ----------------------------------------------------------- + { + Name: "invalid custom insertion id (less than 15 chars)", + Method: http.MethodPost, + Url: "/api/collections/demo3/records", + Body: strings.NewReader(`{ + "id": "12345678901234", + "title": "test" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"id":{"code":"validation_length_invalid"`, + }, + }, + { + Name: "invalid custom insertion id (more than 15 chars)", + Method: http.MethodPost, + Url: "/api/collections/demo3/records", + Body: strings.NewReader(`{ + "id": "1234567890123456", + "title": "test" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"id":{"code":"validation_length_invalid"`, + }, + }, + { + Name: "valid custom insertion id (exactly 15 chars)", + Method: http.MethodPost, + Url: "/api/collections/demo3/records", + Body: strings.NewReader(`{ + "id": "123456789012345", + "title": "test" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"123456789012345"`, + `"title":"test"`, + }, + ExpectedEvents: map[string]int{ + "OnRecordBeforeCreateRequest": 1, + "OnRecordAfterCreateRequest": 1, + "OnModelBeforeCreate": 1, + "OnModelAfterCreate": 1, + }, + }, + { + Name: "valid custom insertion id existing in another non-auth collection", + Method: http.MethodPost, + Url: "/api/collections/demo3/records", + Body: strings.NewReader(`{ + "id": "0yxhwia2amd8gec", + "title": "test" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"0yxhwia2amd8gec"`, + `"title":"test"`, + }, + ExpectedEvents: map[string]int{ + "OnRecordBeforeCreateRequest": 1, + "OnRecordAfterCreateRequest": 1, + "OnModelBeforeCreate": 1, + "OnModelAfterCreate": 1, + }, + }, + { + Name: "valid custom insertion auth id duplicating in another auth collection", + Method: http.MethodPost, + Url: "/api/collections/users/records", + Body: strings.NewReader(`{ + "id":"o1y0dd0spd786md", + "title":"test", + "password":"1234567890", + "passwordConfirm":"1234567890" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + ExpectedEvents: map[string]int{ + "OnRecordBeforeCreateRequest": 1, + }, + }, + + // auth records + // ----------------------------------------------------------- + { + Name: "auth record with invalid data", + Method: http.MethodPost, + Url: "/api/collections/users/records", + Body: strings.NewReader(`{ + "id":"o1y0pd786mq", + "username":"Users75657", + "email":"invalid", + "password":"1234567", + "passwordConfirm":"1234560" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"id":{"code":"validation_length_invalid"`, + `"username":{"code":"validation_invalid_username"`, // for duplicated case-insensitive username + `"email":{"code":"validation_is_email"`, + `"password":{"code":"validation_length_out_of_range"`, + `"passwordConfirm":{"code":"validation_values_mismatch"`, + }, + NotExpectedContent: []string{ + // schema fields are not checked if the base fields has errors + `"rel":{"code":`, + }, + }, + { + Name: "auth record with valid base fields but invalid schema data", + Method: http.MethodPost, + Url: "/api/collections/users/records", + Body: strings.NewReader(`{ + "password":"12345678", + "passwordConfirm":"12345678", + "rel":"invalid" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"rel":{"code":`, + }, + }, + { + Name: "auth record with valid data and explicitly verified state by guest", + Method: http.MethodPost, + Url: "/api/collections/users/records", + Body: strings.NewReader(`{ + "password":"12345678", + "passwordConfirm":"12345678", + "verified":true + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"verified":{"code":`, + }, + }, + { + Name: "auth record with valid data and explicitly verified state by random user", + Method: http.MethodPost, + Url: "/api/collections/users/records", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + Body: strings.NewReader(`{ + "password":"12345678", + "passwordConfirm":"12345678", + "emailVisibility":true, + "verified":true + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"verified":{"code":`, + }, + NotExpectedContent: []string{ + `"emailVisibility":{"code":`, + }, + }, + { + Name: "auth record with valid data by admin", + Method: http.MethodPost, + Url: "/api/collections/users/records", + Body: strings.NewReader(`{ + "id":"o1o1y0pd78686mq", + "username":"test.valid", + "email":"new@example.com", + "password":"12345678", + "passwordConfirm":"12345678", + "rel":"achvryl401bhse3", + "emailVisibility":true, + "verified":true + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"o1o1y0pd78686mq"`, + `"username":"test.valid"`, + `"email":"new@example.com"`, + `"rel":"achvryl401bhse3"`, + `"emailVisibility":true`, + `"verified":true`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"password"`, + `"passwordConfirm"`, + `"passwordHash"`, + }, + ExpectedEvents: map[string]int{ + "OnModelAfterCreate": 1, + "OnModelBeforeCreate": 1, + "OnRecordAfterCreateRequest": 1, + "OnRecordBeforeCreateRequest": 1, + }, + }, + { + Name: "auth record with valid data by auth record with manage access", + Method: http.MethodPost, + Url: "/api/collections/nologin/records", + Body: strings.NewReader(`{ + "email":"new@example.com", + "password":"12345678", + "passwordConfirm":"12345678", + "name":"test_name", + "emailVisibility":true, + "verified":true + }`), + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"`, + `"username":"`, + `"email":"new@example.com"`, + `"name":"test_name"`, + `"emailVisibility":true`, + `"verified":true`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"password"`, + `"passwordConfirm"`, + `"passwordHash"`, + }, + ExpectedEvents: map[string]int{ + "OnModelAfterCreate": 1, + "OnModelBeforeCreate": 1, + "OnRecordAfterCreateRequest": 1, + "OnRecordBeforeCreateRequest": 1, + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} + +func TestRecordCrudUpdate(t *testing.T) { + formData, mp, err := tests.MockMultipartData(map[string]string{ + "title": "title_test", + }, "files") + if err != nil { + t.Fatal(err) + } + + scenarios := []tests.ApiScenario{ + { + Name: "missing collection", + Method: http.MethodPatch, + Url: "/api/collections/missing/records/0yxhwia2amd8gec", + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "guest trying to access nil-rule collection record", + Method: http.MethodPatch, + Url: "/api/collections/demo1/records/imy661ixudk5izi", + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record trying to access nil-rule collection", + Method: http.MethodPatch, + Url: "/api/collections/demo1/records/imy661ixudk5izi", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 403, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "submit invalid body", + Method: http.MethodPatch, + Url: "/api/collections/demo2/records/0yxhwia2amd8gec", + Body: strings.NewReader(`{"`), + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "submit nil body", + Method: http.MethodPatch, + Url: "/api/collections/demo2/records/0yxhwia2amd8gec", + Body: nil, + ExpectedStatus: 400, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "submit empty body (aka. no fields change)", + Method: http.MethodPatch, + Url: "/api/collections/demo2/records/0yxhwia2amd8gec", + Body: strings.NewReader(`{}`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"collectionName":"demo2"`, + `"id":"0yxhwia2amd8gec"`, + }, + ExpectedEvents: map[string]int{ + "OnModelAfterUpdate": 1, + "OnModelBeforeUpdate": 1, + "OnRecordAfterUpdateRequest": 1, + "OnRecordBeforeUpdateRequest": 1, + }, + }, + { + Name: "guest submit in public collection", + Method: http.MethodPatch, + Url: "/api/collections/demo2/records/0yxhwia2amd8gec", + Body: strings.NewReader(`{"title":"new"}`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"0yxhwia2amd8gec"`, + `"title":"new"`, + `"active":true`, + }, + ExpectedEvents: map[string]int{ + "OnRecordBeforeUpdateRequest": 1, + "OnRecordAfterUpdateRequest": 1, + "OnModelBeforeUpdate": 1, + "OnModelAfterUpdate": 1, + }, + }, + { + Name: "guest trying to submit in restricted collection", + Method: http.MethodPatch, + Url: "/api/collections/demo3/records/mk5fmymtx4wsprk", + Body: strings.NewReader(`{"title":"new"}`), + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record submit in restricted collection (rule failure check)", + Method: http.MethodPatch, + Url: "/api/collections/demo3/records/mk5fmymtx4wsprk", + Body: strings.NewReader(`{"title":"new"}`), + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 404, + ExpectedContent: []string{`"data":{}`}, + }, + { + Name: "auth record submit in restricted collection (rule pass check) + expand relations", + Method: http.MethodPatch, + Url: "/api/collections/demo4/records/i9naidtvr6qsgb4?expand=missing,rel_one_no_cascade,rel_many_no_cascade_required", + Body: strings.NewReader(`{ + "title":"test123", + "rel_one_no_cascade":"mk5fmymtx4wsprk", + "rel_one_no_cascade_required":"7nwo8tuiatetxdm", + "rel_one_cascade":"mk5fmymtx4wsprk", + "rel_many_no_cascade":"mk5fmymtx4wsprk", + "rel_many_no_cascade_required":["7nwo8tuiatetxdm","lcl9d87w22ml6jy"], + "rel_many_cascade":"lcl9d87w22ml6jy" + }`), + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"i9naidtvr6qsgb4"`, + `"title":"test123"`, + `"rel_one_no_cascade":"mk5fmymtx4wsprk"`, + `"rel_one_no_cascade_required":"7nwo8tuiatetxdm"`, + `"rel_one_cascade":"mk5fmymtx4wsprk"`, + `"rel_many_no_cascade":["mk5fmymtx4wsprk"]`, + `"rel_many_no_cascade_required":["7nwo8tuiatetxdm","lcl9d87w22ml6jy"]`, + `"rel_many_cascade":["lcl9d87w22ml6jy"]`, + }, + NotExpectedContent: []string{ + // the users auth records don't have access to view the demo3 expands + `"expand":{`, + `"missing"`, + `"id":"mk5fmymtx4wsprk"`, + `"id":"7nwo8tuiatetxdm"`, + `"id":"lcl9d87w22ml6jy"`, + }, + ExpectedEvents: map[string]int{ + "OnRecordBeforeUpdateRequest": 1, + "OnRecordAfterUpdateRequest": 1, + "OnModelBeforeUpdate": 1, + "OnModelAfterUpdate": 1, + }, + }, + { + Name: "admin submit in restricted collection (rule skip check) + expand relations", + Method: http.MethodPatch, + Url: "/api/collections/demo4/records/i9naidtvr6qsgb4?expand=missing,rel_one_no_cascade,rel_many_no_cascade_required", + Body: strings.NewReader(`{ + "title":"test123", + "rel_one_no_cascade":"mk5fmymtx4wsprk", + "rel_one_no_cascade_required":"7nwo8tuiatetxdm", + "rel_one_cascade":"mk5fmymtx4wsprk", + "rel_many_no_cascade":"mk5fmymtx4wsprk", + "rel_many_no_cascade_required":["7nwo8tuiatetxdm","lcl9d87w22ml6jy"], + "rel_many_cascade":"lcl9d87w22ml6jy" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"i9naidtvr6qsgb4"`, + `"title":"test123"`, + `"rel_one_no_cascade":"mk5fmymtx4wsprk"`, + `"rel_one_no_cascade_required":"7nwo8tuiatetxdm"`, + `"rel_one_cascade":"mk5fmymtx4wsprk"`, + `"rel_many_no_cascade":["mk5fmymtx4wsprk"]`, + `"rel_many_no_cascade_required":["7nwo8tuiatetxdm","lcl9d87w22ml6jy"]`, + `"rel_many_cascade":["lcl9d87w22ml6jy"]`, + `"expand":{`, + `"id":"mk5fmymtx4wsprk"`, + `"id":"7nwo8tuiatetxdm"`, + `"id":"lcl9d87w22ml6jy"`, + }, + NotExpectedContent: []string{ + `"missing"`, + }, + ExpectedEvents: map[string]int{ + "OnRecordBeforeUpdateRequest": 1, + "OnRecordAfterUpdateRequest": 1, + "OnModelBeforeUpdate": 1, + "OnModelAfterUpdate": 1, + }, + }, + { + Name: "submit via multipart form data", + Method: http.MethodPatch, + Url: "/api/collections/demo3/records/mk5fmymtx4wsprk", + Body: formData, + RequestHeaders: map[string]string{ + "Content-Type": mp.FormDataContentType(), + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"mk5fmymtx4wsprk"`, + `"title":"title_test"`, + `"files":["`, + }, + ExpectedEvents: map[string]int{ + "OnRecordBeforeUpdateRequest": 1, + "OnRecordAfterUpdateRequest": 1, + "OnModelBeforeUpdate": 1, + "OnModelAfterUpdate": 1, + }, + }, + { + Name: "try to change the id of an existing record", + Method: http.MethodPatch, + Url: "/api/collections/demo3/records/mk5fmymtx4wsprk", + Body: strings.NewReader(`{ + "id": "mk5fmymtx4wspra" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"id":{"code":"validation_in_invalid"`, + }, + }, + + // auth records + // ----------------------------------------------------------- + { + Name: "auth record with invalid data", + Method: http.MethodPatch, + Url: "/api/collections/users/records/bgs820n361vj1qd", + Body: strings.NewReader(`{ + "username":"Users75657", + "email":"invalid", + "password":"1234567", + "passwordConfirm":"1234560", + "verified":false + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"username":{"code":"validation_invalid_username"`, // for duplicated case-insensitive username + `"email":{"code":"validation_is_email"`, + `"password":{"code":"validation_length_out_of_range"`, + `"passwordConfirm":{"code":"validation_values_mismatch"`, + }, + NotExpectedContent: []string{ + // admins are allowed to change the verified state + `"verified"`, + // schema fields are not checked if the base fields has errors + `"rel":{"code":`, + }, + }, + { + Name: "auth record with valid base fields but invalid schema data", + Method: http.MethodPatch, + Url: "/api/collections/users/records/bgs820n361vj1qd", + Body: strings.NewReader(`{ + "password":"12345678", + "passwordConfirm":"12345678", + "rel":"invalid" + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"rel":{"code":`, + }, + }, + { + Name: "try to change account managing fields by guest", + Method: http.MethodPatch, + Url: "/api/collections/nologin/records/phhq3wr65cap535", + Body: strings.NewReader(`{ + "password":"12345678", + "passwordConfirm":"12345678", + "emailVisibility":true, + "verified":true + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"verified":{"code":`, + `"oldPassword":{"code":`, + }, + NotExpectedContent: []string{ + `"emailVisibility":{"code":`, + }, + }, + { + Name: "try to change account managing fields by auth record (owner)", + Method: http.MethodPatch, + Url: "/api/collections/users/records/4q1xlclmfloku33", + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + Body: strings.NewReader(`{ + "password":"12345678", + "passwordConfirm":"12345678", + "emailVisibility":true, + "verified":true + }`), + ExpectedStatus: 400, + ExpectedContent: []string{ + `"data":{`, + `"verified":{"code":`, + `"oldPassword":{"code":`, + }, + NotExpectedContent: []string{ + `"emailVisibility":{"code":`, + }, + }, + { + Name: "try to change account managing fields by auth record with managing rights", + Method: http.MethodPatch, + Url: "/api/collections/nologin/records/phhq3wr65cap535", + Body: strings.NewReader(`{ + "email":"new@example.com", + "password":"12345678", + "passwordConfirm":"12345678", + "name":"test_name", + "emailVisibility":true, + "verified":true + }`), + RequestHeaders: map[string]string{ + // users, test@example.com + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"email":"new@example.com"`, + `"name":"test_name"`, + `"emailVisibility":true`, + `"verified":true`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"password"`, + `"passwordConfirm"`, + `"passwordHash"`, + }, + ExpectedEvents: map[string]int{ + "OnModelAfterUpdate": 1, + "OnModelBeforeUpdate": 1, + "OnRecordAfterUpdateRequest": 1, + "OnRecordBeforeUpdateRequest": 1, + }, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + record, _ := app.Dao().FindRecordById("nologin", "phhq3wr65cap535") + if !record.ValidatePassword("12345678") { + t.Fatal("Password update failed.") + } + }, + }, + { + Name: "update auth record with valid data by admin", + Method: http.MethodPatch, + Url: "/api/collections/users/records/oap640cot4yru2s", + Body: strings.NewReader(`{ + "username":"test.valid", + "email":"new@example.com", + "password":"12345678", + "passwordConfirm":"12345678", + "rel":"achvryl401bhse3", + "emailVisibility":true, + "verified":false + }`), + RequestHeaders: map[string]string{ + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + }, + ExpectedStatus: 200, + ExpectedContent: []string{ + `"username":"test.valid"`, + `"email":"new@example.com"`, + `"rel":"achvryl401bhse3"`, + `"emailVisibility":true`, + `"verified":false`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"password"`, + `"passwordConfirm"`, + `"passwordHash"`, + }, + ExpectedEvents: map[string]int{ + "OnModelAfterUpdate": 1, + "OnModelBeforeUpdate": 1, + "OnRecordAfterUpdateRequest": 1, + "OnRecordBeforeUpdateRequest": 1, + }, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + record, _ := app.Dao().FindRecordById("users", "oap640cot4yru2s") + if !record.ValidatePassword("12345678") { + t.Fatal("Password update failed.") + } + }, + }, + { + Name: "update auth record with valid data by guest (empty update filter)", + Method: http.MethodPatch, + Url: "/api/collections/nologin/records/dc49k6jgejn40h3", + Body: strings.NewReader(`{ + "username":"test_new", + "emailVisibility":true, + "name":"test" + }`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"username":"test_new"`, + `"email":"test@example.com"`, // the email should be visible since we updated the emailVisibility + `"emailVisibility":true`, + `"verified":false`, + `"name":"test"`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"password"`, + `"passwordConfirm"`, + `"passwordHash"`, + }, + ExpectedEvents: map[string]int{ + "OnModelAfterUpdate": 1, + "OnModelBeforeUpdate": 1, + "OnRecordAfterUpdateRequest": 1, + "OnRecordBeforeUpdateRequest": 1, + }, + }, + { + Name: "success password change with oldPassword", + Method: http.MethodPatch, + Url: "/api/collections/nologin/records/dc49k6jgejn40h3", + Body: strings.NewReader(`{ + "password":"123456789", + "passwordConfirm":"123456789", + "oldPassword":"1234567890" + }`), + ExpectedStatus: 200, + ExpectedContent: []string{ + `"id":"dc49k6jgejn40h3"`, + }, + NotExpectedContent: []string{ + `"tokenKey"`, + `"password"`, + `"passwordConfirm"`, + `"passwordHash"`, + }, + ExpectedEvents: map[string]int{ + "OnModelAfterUpdate": 1, + "OnModelBeforeUpdate": 1, + "OnRecordAfterUpdateRequest": 1, + "OnRecordBeforeUpdateRequest": 1, + }, + AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { + record, _ := app.Dao().FindRecordById("nologin", "dc49k6jgejn40h3") + if !record.ValidatePassword("123456789") { + t.Fatal("Password update failed.") + } + }, + }, + } + + for _, scenario := range scenarios { + scenario.Test(t) + } +} diff --git a/apis/record_helpers.go b/apis/record_helpers.go new file mode 100644 index 000000000..c2b8c98c1 --- /dev/null +++ b/apis/record_helpers.go @@ -0,0 +1,186 @@ +package apis + +import ( + "fmt" + + "github.com/labstack/echo/v5" + "github.com/pocketbase/dbx" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/resolvers" + "github.com/pocketbase/pocketbase/tools/rest" + "github.com/pocketbase/pocketbase/tools/search" + "github.com/spf13/cast" +) + +// exportRequestData exports a map with common request fields. +// +// @todo consider changing the map to a typed struct after v0.8 and the +// IN operator support. +func exportRequestData(c echo.Context) map[string]any { + result := map[string]any{} + queryParams := map[string]any{} + bodyData := map[string]any{} + method := c.Request().Method + + echo.BindQueryParams(c, &queryParams) + + rest.BindBody(c, &bodyData) + + result["method"] = method + result["query"] = queryParams + result["data"] = bodyData + result["auth"] = nil + + auth, _ := c.Get(ContextAuthRecordKey).(*models.Record) + if auth != nil { + result["auth"] = auth.PublicExport() + } + + return result +} + +// expandFetch is the records fetch function that is used to expand related records. +func expandFetch( + dao *daos.Dao, + isAdmin bool, + requestData map[string]any, +) daos.ExpandFetchFunc { + return func(relCollection *models.Collection, relIds []string) ([]*models.Record, error) { + records, err := dao.FindRecordsByIds(relCollection.Id, relIds, func(q *dbx.SelectQuery) error { + if isAdmin { + return nil // admins can access everything + } + + if relCollection.ViewRule == nil { + return fmt.Errorf("Only admins can view collection %q records", relCollection.Name) + } + + if *relCollection.ViewRule != "" { + resolver := resolvers.NewRecordFieldResolver(dao, relCollection, requestData, true) + expr, err := search.FilterData(*(relCollection.ViewRule)).BuildExpr(resolver) + if err != nil { + return err + } + resolver.UpdateQuery(q) + q.AndWhere(expr) + } + + return nil + }) + + if err == nil && len(records) > 0 { + autoIgnoreAuthRecordsEmailVisibility(dao, records, isAdmin, requestData) + } + + return records, err + } +} + +// autoIgnoreAuthRecordsEmailVisibility ignores the email visibility check for +// the provided record if the current auth model is admin, owner or a "manager". +// +// Note: Expects all records to be from the same auth collection! +func autoIgnoreAuthRecordsEmailVisibility( + dao *daos.Dao, + records []*models.Record, + isAdmin bool, + requestData map[string]any, +) error { + if len(records) == 0 || !records[0].Collection().IsAuth() { + return nil // nothing to check + } + + if isAdmin { + for _, rec := range records { + rec.IgnoreEmailVisibility(true) + } + return nil + } + + collection := records[0].Collection() + + mappedRecords := make(map[string]*models.Record, len(records)) + recordIds := make([]any, 0, len(records)) + for _, rec := range records { + mappedRecords[rec.Id] = rec + recordIds = append(recordIds, rec.Id) + } + + if auth, ok := requestData["auth"].(map[string]any); ok && mappedRecords[cast.ToString(auth["id"])] != nil { + mappedRecords[cast.ToString(auth["id"])].IgnoreEmailVisibility(true) + } + + authOptions := collection.AuthOptions() + if authOptions.ManageRule == nil || *authOptions.ManageRule == "" { + return nil // no manage rule to check + } + + // fetch the ids of the managed records + // --- + managedIds := []string{} + + query := dao.RecordQuery(collection). + Select(dao.DB().QuoteSimpleColumnName(collection.Name) + ".id"). + AndWhere(dbx.In(dao.DB().QuoteSimpleColumnName(collection.Name)+".id", recordIds...)) + + resolver := resolvers.NewRecordFieldResolver(dao, collection, requestData, true) + expr, err := search.FilterData(*authOptions.ManageRule).BuildExpr(resolver) + if err != nil { + return err + } + resolver.UpdateQuery(query) + query.AndWhere(expr) + + if err := query.Column(&managedIds); err != nil { + return err + } + // --- + + // ignore the email visibility check for the managed records + for _, id := range managedIds { + if rec, ok := mappedRecords[id]; ok { + rec.IgnoreEmailVisibility(true) + } + } + + return nil +} + +// hasAuthManageAccess checks whether the client is allowed to have full +// [forms.RecordUpsert] auth management permissions +// (aka. allowing to change system auth fields without oldPassword). +func hasAuthManageAccess( + dao *daos.Dao, + record *models.Record, + requestData map[string]any, +) bool { + if !record.Collection().IsAuth() { + return false + } + + manageRule := record.Collection().AuthOptions().ManageRule + + if manageRule == nil || *manageRule == "" { + return false // only for admins (manageRule can't be empty) + } + + if auth, ok := requestData["auth"].(map[string]any); !ok || cast.ToString(auth["id"]) == "" { + return false // no auth record + } + + ruleFunc := func(q *dbx.SelectQuery) error { + resolver := resolvers.NewRecordFieldResolver(dao, record.Collection(), requestData, true) + expr, err := search.FilterData(*manageRule).BuildExpr(resolver) + if err != nil { + return err + } + resolver.UpdateQuery(q) + q.AndWhere(expr) + return nil + } + + _, findErr := dao.FindRecordById(record.Collection().Id, record.Id, ruleFunc) + + return findErr == nil +} diff --git a/apis/record_test.go b/apis/record_test.go deleted file mode 100644 index e0ed740d5..000000000 --- a/apis/record_test.go +++ /dev/null @@ -1,1052 +0,0 @@ -package apis_test - -import ( - "net/http" - "os" - "path/filepath" - "strings" - "testing" - - "github.com/labstack/echo/v5" - "github.com/pocketbase/pocketbase/tests" -) - -func TestRecordsList(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "missing collection", - Method: http.MethodGet, - Url: "/api/collections/missing/records", - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "unauthorized trying to access nil rule collection (aka. need admin auth)", - Method: http.MethodGet, - Url: "/api/collections/demo/records", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as user trying to access nil rule collection (aka. need admin auth)", - Method: http.MethodGet, - Url: "/api/collections/demo/records", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "public collection but with admin only filter/sort (aka. @collection)", - Method: http.MethodGet, - Url: "/api/collections/demo3/records?filter=@collection.demo.title='test'", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "public collection but with ENCODED admin only filter/sort (aka. @collection)", - Method: http.MethodGet, - Url: "/api/collections/demo3/records?filter=%40collection.demo.title%3D%27test%27", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin trying to access nil rule collection (aka. need admin auth)", - Method: http.MethodGet, - Url: "/api/collections/demo/records", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"page":1`, - `"perPage":30`, - `"totalItems":3`, - `"items":[{`, - `"id":"848a1dea-5ddd-42d6-a00d-030547bffcfe"`, - `"id":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - `"id":"b5c2ffc2-bafd-48f7-b8b7-090638afe209"`, - }, - ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, - }, - { - Name: "public collection", - Method: http.MethodGet, - Url: "/api/collections/demo3/records", - ExpectedStatus: 200, - ExpectedContent: []string{ - `"page":1`, - `"perPage":30`, - `"totalItems":1`, - `"items":[{`, - `"id":"2c542824-9de1-42fe-8924-e57c86267760"`, - }, - ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, - }, - { - Name: "using the collection id as identifier", - Method: http.MethodGet, - Url: "/api/collections/3cd6fe92-70dc-4819-8542-4d036faabd89/records", - ExpectedStatus: 200, - ExpectedContent: []string{ - `"page":1`, - `"perPage":30`, - `"totalItems":1`, - `"items":[{`, - `"id":"2c542824-9de1-42fe-8924-e57c86267760"`, - }, - ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, - }, - { - Name: "valid query params", - Method: http.MethodGet, - Url: "/api/collections/demo/records?filter=title%7E%27test%27&sort=-title", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"page":1`, - `"perPage":30`, - `"totalItems":2`, - `"items":[{`, - `"id":"848a1dea-5ddd-42d6-a00d-030547bffcfe"`, - `"id":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - }, - ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, - }, - { - Name: "invalid filter", - Method: http.MethodGet, - Url: "/api/collections/demo/records?filter=invalid~'test'", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "expand relations", - Method: http.MethodGet, - Url: "/api/collections/demo2/records?expand=manyrels,onerel&perPage=2&sort=created", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"page":1`, - `"perPage":2`, - `"totalItems":2`, - `"items":[{`, - `"@expand":{`, - `"id":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - `"id":"848a1dea-5ddd-42d6-a00d-030547bffcfe"`, - `"manyrels":[{`, - `"manyrels":[]`, - `"cascaderel":"`, - `"onerel":{"@collectionId":"3f2888f8-075d-49fe-9d09-ea7e951000dc","@collectionName":"demo",`, - `"json":[1,2,3]`, - `"select":["a","b"]`, - `"select":[]`, - `"user":""`, - `"bool":true`, - `"number":456`, - `"user":"97cc3d3d-6ba2-383f-b42a-7bc84d27410c"`, - }, - ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, - }, - { - Name: "authorized as user that DOESN'T match the collection list rule", - Method: http.MethodGet, - Url: "/api/collections/demo2/records", - RequestHeaders: map[string]string{ - // test@example.com - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"page":1`, - `"perPage":30`, - `"totalItems":0`, - `"items":[]`, - }, - ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, - }, - { - Name: "authorized as user that matches the collection list rule", - Method: http.MethodGet, - Url: "/api/collections/demo2/records", - RequestHeaders: map[string]string{ - // test3@example.com - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImVtYWlsIjoidGVzdDNAZXhhbXBsZS5jb20iLCJpZCI6Ijk3Y2MzZDNkLTZiYTItMzgzZi1iNDJhLTdiYzg0ZDI3NDEwYyIsImV4cCI6MTg5MzUxNTU3Nn0.Q965uvlTxxOsZbACXSgJQNXykYK0TKZ87nyPzemvN4E", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"page":1`, - `"perPage":30`, - `"totalItems":2`, - `"items":[{`, - `"id":"63c2ab80-84ab-4057-a592-4604a731f78f"`, - `"id":"94568ca2-0bee-49d7-b749-06cb97956fd9"`, - }, - ExpectedEvents: map[string]int{"OnRecordsListRequest": 1}, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestRecordView(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "missing collection", - Method: http.MethodGet, - Url: "/api/collections/missing/records/b5c2ffc2-bafd-48f7-b8b7-090638afe209", - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "missing record (unauthorized)", - Method: http.MethodGet, - Url: "/api/collections/demo/records/00000000-bafd-48f7-b8b7-090638afe209", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "invalid record id (authorized)", - Method: http.MethodGet, - Url: "/api/collections/demo/records/invalid", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "missing record (authorized)", - Method: http.MethodGet, - Url: "/api/collections/demo/records/00000000-bafd-48f7-b8b7-090638afe209", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "mismatched collection-record pair (unauthorized)", - Method: http.MethodGet, - Url: "/api/collections/demo/records/63c2ab80-84ab-4057-a592-4604a731f78f", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "mismatched collection-record pair (authorized)", - Method: http.MethodGet, - Url: "/api/collections/demo/records/63c2ab80-84ab-4057-a592-4604a731f78f", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "unauthorized trying to access nil rule collection (aka. need admin auth)", - Method: http.MethodGet, - Url: "/api/collections/demo/records/b5c2ffc2-bafd-48f7-b8b7-090638afe209", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as user trying to access nil rule collection (aka. need admin auth)", - Method: http.MethodGet, - Url: "/api/collections/demo/records/b5c2ffc2-bafd-48f7-b8b7-090638afe209", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "access record as admin", - Method: http.MethodGet, - Url: "/api/collections/demo/records/b5c2ffc2-bafd-48f7-b8b7-090638afe209", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"@collectionId":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, - `"@collectionName":"demo"`, - `"id":"b5c2ffc2-bafd-48f7-b8b7-090638afe209"`, - }, - ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, - }, - { - Name: "access record as admin (using the collection id as identifier)", - Method: http.MethodGet, - Url: "/api/collections/3f2888f8-075d-49fe-9d09-ea7e951000dc/records/b5c2ffc2-bafd-48f7-b8b7-090638afe209", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"@collectionId":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, - `"@collectionName":"demo"`, - `"id":"b5c2ffc2-bafd-48f7-b8b7-090638afe209"`, - }, - ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, - }, - { - Name: "access record as admin (test rule skipping)", - Method: http.MethodGet, - Url: "/api/collections/demo2/records/94568ca2-0bee-49d7-b749-06cb97956fd9", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"@collectionId":"2c1010aa-b8fe-41d9-a980-99534ca8a167"`, - `"@collectionName":"demo2"`, - `"id":"94568ca2-0bee-49d7-b749-06cb97956fd9"`, - `"manyrels":[]`, - `"onerel":"b5c2ffc2-bafd-48f7-b8b7-090638afe209"`, - }, - ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, - }, - { - Name: "access record as user (filter mismatch)", - Method: http.MethodGet, - Url: "/api/collections/demo2/records/94568ca2-0bee-49d7-b749-06cb97956fd9", - RequestHeaders: map[string]string{ - // test3@example.com - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImVtYWlsIjoidGVzdDNAZXhhbXBsZS5jb20iLCJpZCI6Ijk3Y2MzZDNkLTZiYTItMzgzZi1iNDJhLTdiYzg0ZDI3NDEwYyIsImV4cCI6MTg5MzUxNTU3Nn0.Q965uvlTxxOsZbACXSgJQNXykYK0TKZ87nyPzemvN4E", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "access record as user (filter match)", - Method: http.MethodGet, - Url: "/api/collections/demo2/records/63c2ab80-84ab-4057-a592-4604a731f78f", - RequestHeaders: map[string]string{ - // test3@example.com - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImVtYWlsIjoidGVzdDNAZXhhbXBsZS5jb20iLCJpZCI6Ijk3Y2MzZDNkLTZiYTItMzgzZi1iNDJhLTdiYzg0ZDI3NDEwYyIsImV4cCI6MTg5MzUxNTU3Nn0.Q965uvlTxxOsZbACXSgJQNXykYK0TKZ87nyPzemvN4E", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"@collectionId":"2c1010aa-b8fe-41d9-a980-99534ca8a167"`, - `"@collectionName":"demo2"`, - `"id":"63c2ab80-84ab-4057-a592-4604a731f78f"`, - `"manyrels":["848a1dea-5ddd-42d6-a00d-030547bffcfe","577bd676-aacb-4072-b7da-99d00ee210a4"]`, - `"onerel":"848a1dea-5ddd-42d6-a00d-030547bffcfe"`, - }, - ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, - }, - { - Name: "expand relations", - Method: http.MethodGet, - Url: "/api/collections/demo2/records/63c2ab80-84ab-4057-a592-4604a731f78f?expand=manyrels,onerel", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"@collectionId":"2c1010aa-b8fe-41d9-a980-99534ca8a167"`, - `"@collectionName":"demo2"`, - `"id":"63c2ab80-84ab-4057-a592-4604a731f78f"`, - `"@expand":{`, - `"manyrels":[{`, - `"onerel":{`, - `"@collectionId":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, - `"@collectionName":"demo"`, - `"id":"848a1dea-5ddd-42d6-a00d-030547bffcfe"`, - `"id":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - }, - ExpectedEvents: map[string]int{"OnRecordViewRequest": 1}, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestRecordDelete(t *testing.T) { - ensureDeletedFiles := func(app *tests.TestApp, collectionId string, recordId string) { - storageDir := filepath.Join(app.DataDir(), "storage", collectionId, recordId) - - entries, _ := os.ReadDir(storageDir) - if len(entries) != 0 { - t.Errorf("Expected empty/deleted dir, found %d", len(entries)) - } - } - - scenarios := []tests.ApiScenario{ - { - Name: "missing collection", - Method: http.MethodDelete, - Url: "/api/collections/missing/records/b5c2ffc2-bafd-48f7-b8b7-090638afe209", - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "missing record (unauthorized)", - Method: http.MethodDelete, - Url: "/api/collections/demo/records/00000000-bafd-48f7-b8b7-090638afe209", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "missing record (authorized)", - Method: http.MethodDelete, - Url: "/api/collections/demo/records/00000000-bafd-48f7-b8b7-090638afe209", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "mismatched collection-record pair (unauthorized)", - Method: http.MethodDelete, - Url: "/api/collections/demo/records/63c2ab80-84ab-4057-a592-4604a731f78f", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "mismatched collection-record pair (authorized)", - Method: http.MethodDelete, - Url: "/api/collections/demo/records/63c2ab80-84ab-4057-a592-4604a731f78f", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "unauthorized trying to access nil rule collection (aka. need admin auth)", - Method: http.MethodDelete, - Url: "/api/collections/demo/records/577bd676-aacb-4072-b7da-99d00ee210a4", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as user trying to access nil rule collection (aka. need admin auth)", - Method: http.MethodDelete, - Url: "/api/collections/demo/records/577bd676-aacb-4072-b7da-99d00ee210a4", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "access record as admin", - Method: http.MethodDelete, - Url: "/api/collections/demo/records/577bd676-aacb-4072-b7da-99d00ee210a4", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 204, - ExpectedEvents: map[string]int{ - "OnRecordBeforeDeleteRequest": 1, - "OnRecordAfterDeleteRequest": 1, - "OnModelAfterUpdate": 1, // nullify related record - "OnModelBeforeUpdate": 1, // nullify related record - "OnModelBeforeDelete": 3, // +2 cascade delete related records - "OnModelAfterDelete": 3, // +2 cascade delete related records - }, - AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - ensureDeletedFiles(app, "3f2888f8-075d-49fe-9d09-ea7e951000dc", "577bd676-aacb-4072-b7da-99d00ee210a4") - ensureDeletedFiles(app, "2c1010aa-b8fe-41d9-a980-99534ca8a167", "94568ca2-0bee-49d7-b749-06cb97956fd9") - ensureDeletedFiles(app, "2c1010aa-b8fe-41d9-a980-99534ca8a167", "63c2ab80-84ab-4057-a592-4604a731f78f") - }, - }, - { - Name: "access record as admin (using the collection id as identifier)", - Method: http.MethodDelete, - Url: "/api/collections/3f2888f8-075d-49fe-9d09-ea7e951000dc/records/577bd676-aacb-4072-b7da-99d00ee210a4", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 204, - ExpectedEvents: map[string]int{ - "OnRecordBeforeDeleteRequest": 1, - "OnRecordAfterDeleteRequest": 1, - "OnModelAfterUpdate": 1, // nullify related record - "OnModelBeforeUpdate": 1, // nullify related record - "OnModelBeforeDelete": 3, // +2 cascade delete related records - "OnModelAfterDelete": 3, // +2 cascade delete related records - }, - AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - ensureDeletedFiles(app, "3f2888f8-075d-49fe-9d09-ea7e951000dc", "577bd676-aacb-4072-b7da-99d00ee210a4") - ensureDeletedFiles(app, "2c1010aa-b8fe-41d9-a980-99534ca8a167", "94568ca2-0bee-49d7-b749-06cb97956fd9") - ensureDeletedFiles(app, "2c1010aa-b8fe-41d9-a980-99534ca8a167", "63c2ab80-84ab-4057-a592-4604a731f78f") - }, - }, - { - Name: "deleting record as admin (test rule skipping)", - Method: http.MethodDelete, - Url: "/api/collections/demo2/records/94568ca2-0bee-49d7-b749-06cb97956fd9", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 204, - ExpectedEvents: map[string]int{ - "OnRecordBeforeDeleteRequest": 1, - "OnRecordAfterDeleteRequest": 1, - "OnModelBeforeDelete": 1, - "OnModelAfterDelete": 1, - }, - AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - ensureDeletedFiles(app, "2c1010aa-b8fe-41d9-a980-99534ca8a167", "94568ca2-0bee-49d7-b749-06cb97956fd9") - }, - }, - { - Name: "deleting record as user (filter mismatch)", - Method: http.MethodDelete, - Url: "/api/collections/demo2/records/94568ca2-0bee-49d7-b749-06cb97956fd9", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImVtYWlsIjoidGVzdDNAZXhhbXBsZS5jb20iLCJpZCI6Ijk3Y2MzZDNkLTZiYTItMzgzZi1iNDJhLTdiYzg0ZDI3NDEwYyIsImV4cCI6MTg5MzUxNTU3Nn0.Q965uvlTxxOsZbACXSgJQNXykYK0TKZ87nyPzemvN4E", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "deleting record as user (filter match)", - Method: http.MethodDelete, - Url: "/api/collections/demo2/records/63c2ab80-84ab-4057-a592-4604a731f78f", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImVtYWlsIjoidGVzdDNAZXhhbXBsZS5jb20iLCJpZCI6Ijk3Y2MzZDNkLTZiYTItMzgzZi1iNDJhLTdiYzg0ZDI3NDEwYyIsImV4cCI6MTg5MzUxNTU3Nn0.Q965uvlTxxOsZbACXSgJQNXykYK0TKZ87nyPzemvN4E", - }, - ExpectedStatus: 204, - ExpectedEvents: map[string]int{ - "OnRecordBeforeDeleteRequest": 1, - "OnRecordAfterDeleteRequest": 1, - "OnModelBeforeDelete": 1, - "OnModelAfterDelete": 1, - }, - AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - ensureDeletedFiles(app, "2c1010aa-b8fe-41d9-a980-99534ca8a167", "63c2ab80-84ab-4057-a592-4604a731f78f") - }, - }, - { - Name: "trying to delete record while being part of a non-cascade required relation", - Method: http.MethodDelete, - Url: "/api/collections/demo/records/848a1dea-5ddd-42d6-a00d-030547bffcfe", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - ExpectedEvents: map[string]int{ - "OnRecordBeforeDeleteRequest": 1, - }, - }, - { - Name: "cascade delete referenced records", - Method: http.MethodDelete, - Url: "/api/collections/demo/records/577bd676-aacb-4072-b7da-99d00ee210a4", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 204, - ExpectedEvents: map[string]int{ - "OnRecordBeforeDeleteRequest": 1, - "OnRecordAfterDeleteRequest": 1, - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - "OnModelBeforeDelete": 3, - "OnModelAfterDelete": 3, - }, - AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - recId := "63c2ab80-84ab-4057-a592-4604a731f78f" - col, _ := app.Dao().FindCollectionByNameOrId("demo2") - rec, _ := app.Dao().FindRecordById(col, recId, nil) - if rec != nil { - t.Errorf("Expected record %s to be cascade deleted", recId) - } - ensureDeletedFiles(app, "3f2888f8-075d-49fe-9d09-ea7e951000dc", "577bd676-aacb-4072-b7da-99d00ee210a4") - ensureDeletedFiles(app, "2c1010aa-b8fe-41d9-a980-99534ca8a167", "94568ca2-0bee-49d7-b749-06cb97956fd9") - ensureDeletedFiles(app, "2c1010aa-b8fe-41d9-a980-99534ca8a167", "63c2ab80-84ab-4057-a592-4604a731f78f") - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestRecordCreate(t *testing.T) { - formData, mp, err := tests.MockMultipartData(map[string]string{ - "title": "new", - }, "file") - if err != nil { - t.Fatal(err) - } - - scenarios := []tests.ApiScenario{ - { - Name: "missing collection", - Method: http.MethodPost, - Url: "/api/collections/missing/records", - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "guest trying to access nil-rule collection", - Method: http.MethodPost, - Url: "/api/collections/demo/records", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "user trying to access nil-rule collection", - Method: http.MethodPost, - Url: "/api/collections/demo/records", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "submit invalid format", - Method: http.MethodPost, - Url: "/api/collections/demo3/records", - Body: strings.NewReader(`{"`), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "submit nil body", - Method: http.MethodPost, - Url: "/api/collections/demo3/records", - Body: nil, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "guest submit in public collection", - Method: http.MethodPost, - Url: "/api/collections/demo3/records", - Body: strings.NewReader(`{"title":"new"}`), - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":`, - `"title":"new"`, - }, - ExpectedEvents: map[string]int{ - "OnRecordBeforeCreateRequest": 1, - "OnRecordAfterCreateRequest": 1, - "OnModelBeforeCreate": 1, - "OnModelAfterCreate": 1, - }, - }, - { - Name: "user submit in restricted collection (rule failure check)", - Method: http.MethodPost, - Url: "/api/collections/demo2/records", - Body: strings.NewReader(`{ - "cascaderel": "577bd676-aacb-4072-b7da-99d00ee210a4", - "onerel": "577bd676-aacb-4072-b7da-99d00ee210a4", - "manyrels": ["577bd676-aacb-4072-b7da-99d00ee210a4"], - "text": "test123", - "bool": "false", - "number": 1 - }`), - RequestHeaders: map[string]string{ - // test@example.com - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "user submit in restricted collection (rule pass check) + expand relations", - Method: http.MethodPost, - Url: "/api/collections/demo2/records?expand=missing,onerel,manyrels,selfrel", - Body: strings.NewReader(`{ - "cascaderel":"577bd676-aacb-4072-b7da-99d00ee210a4", - "onerel":"577bd676-aacb-4072-b7da-99d00ee210a4", - "manyrels":["577bd676-aacb-4072-b7da-99d00ee210a4"], - "selfrel":"63c2ab80-84ab-4057-a592-4604a731f78f", - "text":"test123", - "bool":true, - "number":1 - }`), - RequestHeaders: map[string]string{ - // test3@example.com - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImVtYWlsIjoidGVzdDNAZXhhbXBsZS5jb20iLCJpZCI6Ijk3Y2MzZDNkLTZiYTItMzgzZi1iNDJhLTdiYzg0ZDI3NDEwYyIsImV4cCI6MTg5MzUxNTU3Nn0.Q965uvlTxxOsZbACXSgJQNXykYK0TKZ87nyPzemvN4E", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":`, - `"cascaderel":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - `"onerel":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - `"manyrels":["577bd676-aacb-4072-b7da-99d00ee210a4"]`, - `"selfrel":"63c2ab80-84ab-4057-a592-4604a731f78f"`, - `"text":"test123"`, - `"bool":true`, - `"number":1`, - `"@expand":{`, - `"selfrel":{`, - `"id":"63c2ab80-84ab-4057-a592-4604a731f78f"`, - }, - NotExpectedContent: []string{ - // user don't have access to view the below expands - `"manyrels":[{`, - `"onerel":{`, - }, - ExpectedEvents: map[string]int{ - "OnRecordBeforeCreateRequest": 1, - "OnRecordAfterCreateRequest": 1, - "OnModelBeforeCreate": 1, - "OnModelAfterCreate": 1, - }, - }, - { - Name: "admin submit in restricted collection (rule skip check) + expand relations", - Method: http.MethodPost, - Url: "/api/collections/demo2/records?expand=missing,onerel,manyrels,selfrel", - Body: strings.NewReader(`{ - "cascaderel": "577bd676-aacb-4072-b7da-99d00ee210a4", - "onerel": "577bd676-aacb-4072-b7da-99d00ee210a4", - "manyrels":["577bd676-aacb-4072-b7da-99d00ee210a4"], - "selfrel":"94568ca2-0bee-49d7-b749-06cb97956fd9", - "text": "test123", - "bool": false, - "number": 1 - }`), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":`, - `"cascaderel":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - `"onerel":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - `"manyrels":["577bd676-aacb-4072-b7da-99d00ee210a4"]`, - `"text":"test123"`, - `"bool":false`, - `"number":1`, - `"@expand":{`, - `"manyrels":[{`, - `"onerel":{`, - `"selfrel":{`, - `"@collectionId":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, - `"@collectionName":"demo"`, - `"id":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - `"id":"94568ca2-0bee-49d7-b749-06cb97956fd9"`, - }, - ExpectedEvents: map[string]int{ - "OnRecordBeforeCreateRequest": 1, - "OnRecordAfterCreateRequest": 1, - "OnModelBeforeCreate": 1, - "OnModelAfterCreate": 1, - }, - }, - { - Name: "invalid custom insertion id (less than 15 chars)", - Method: http.MethodPost, - Url: "/api/collections/demo3/records", - Body: strings.NewReader(`{ - "id": "12345678901234", - "title": "test" - }`), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 400, - ExpectedContent: []string{ - `"id":{"code":"validation_length_invalid"`, - }, - }, - { - Name: "invalid custom insertion id (more than 15 chars)", - Method: http.MethodPost, - Url: "/api/collections/demo3/records", - Body: strings.NewReader(`{ - "id": "1234567890123456", - "title": "test" - }`), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 400, - ExpectedContent: []string{ - `"id":{"code":"validation_length_invalid"`, - }, - }, - { - Name: "valid custom insertion id (exactly 15 chars)", - Method: http.MethodPost, - Url: "/api/collections/demo3/records", - Body: strings.NewReader(`{ - "id": "123456789012345", - "title": "test" - }`), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"123456789012345"`, - `"title":"test"`, - }, - ExpectedEvents: map[string]int{ - "OnRecordBeforeCreateRequest": 1, - "OnRecordAfterCreateRequest": 1, - "OnModelBeforeCreate": 1, - "OnModelAfterCreate": 1, - }, - }, - - { - Name: "submit via multipart form data", - Method: http.MethodPost, - Url: "/api/collections/demo/records", - Body: formData, - RequestHeaders: map[string]string{ - "Content-Type": mp.FormDataContentType(), - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"`, - `"title":"new"`, - `"file":"`, - }, - ExpectedEvents: map[string]int{ - "OnRecordBeforeCreateRequest": 1, - "OnRecordAfterCreateRequest": 1, - "OnModelBeforeCreate": 1, - "OnModelAfterCreate": 1, - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestRecordUpdate(t *testing.T) { - formData, mp, err := tests.MockMultipartData(map[string]string{ - "title": "new", - }, "file") - if err != nil { - t.Fatal(err) - } - - scenarios := []tests.ApiScenario{ - { - Name: "missing collection", - Method: http.MethodPatch, - Url: "/api/collections/missing/records/2c542824-9de1-42fe-8924-e57c86267760", - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "missing record", - Method: http.MethodPatch, - Url: "/api/collections/demo3/records/00000000-9de1-42fe-8924-e57c86267760", - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "guest trying to edit nil-rule collection record", - Method: http.MethodPatch, - Url: "/api/collections/demo/records/b5c2ffc2-bafd-48f7-b8b7-090638afe209", - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "user trying to edit nil-rule collection record", - Method: http.MethodPatch, - Url: "/api/collections/demo/records/b5c2ffc2-bafd-48f7-b8b7-090638afe209", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "submit invalid format", - Method: http.MethodPatch, - Url: "/api/collections/demo3/records/2c542824-9de1-42fe-8924-e57c86267760", - Body: strings.NewReader(`{"`), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "submit nil body", - Method: http.MethodPatch, - Url: "/api/collections/demo3/records/2c542824-9de1-42fe-8924-e57c86267760", - Body: nil, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "guest submit in public collection", - Method: http.MethodPatch, - Url: "/api/collections/demo3/records/2c542824-9de1-42fe-8924-e57c86267760", - Body: strings.NewReader(`{"title":"new"}`), - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"2c542824-9de1-42fe-8924-e57c86267760"`, - `"title":"new"`, - }, - ExpectedEvents: map[string]int{ - "OnRecordBeforeUpdateRequest": 1, - "OnRecordAfterUpdateRequest": 1, - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - }, - }, - { - Name: "user submit in restricted collection (rule failure check)", - Method: http.MethodPatch, - Url: "/api/collections/demo2/records/94568ca2-0bee-49d7-b749-06cb97956fd9", - Body: strings.NewReader(`{"text": "test_new"}`), - RequestHeaders: map[string]string{ - // test@example.com - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "user submit in restricted collection (rule pass check) + expand relations", - Method: http.MethodPatch, - Url: "/api/collections/demo2/records/63c2ab80-84ab-4057-a592-4604a731f78f?expand=missing,onerel,manyrels,selfrel", - Body: strings.NewReader(`{ - "text":"test_new", - "selfrel":"63c2ab80-84ab-4057-a592-4604a731f78f", - "bool":true - }`), - RequestHeaders: map[string]string{ - // test3@example.com - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImVtYWlsIjoidGVzdDNAZXhhbXBsZS5jb20iLCJpZCI6Ijk3Y2MzZDNkLTZiYTItMzgzZi1iNDJhLTdiYzg0ZDI3NDEwYyIsImV4cCI6MTg5MzUxNTU3Nn0.Q965uvlTxxOsZbACXSgJQNXykYK0TKZ87nyPzemvN4E", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"63c2ab80-84ab-4057-a592-4604a731f78f"`, - `"cascaderel":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - `"onerel":"848a1dea-5ddd-42d6-a00d-030547bffcfe"`, - `"manyrels":["848a1dea-5ddd-42d6-a00d-030547bffcfe","577bd676-aacb-4072-b7da-99d00ee210a4"]`, - `"bool":true`, - `"text":"test_new"`, - `"selfrel":"63c2ab80-84ab-4057-a592-4604a731f78f"`, - `"@expand":{`, - `"selfrel":{`, - }, - NotExpectedContent: []string{ - // user don't have access to view the below expands - `"manyrels":[{`, - `"onerel":{`, - }, - ExpectedEvents: map[string]int{ - "OnRecordBeforeUpdateRequest": 1, - "OnRecordAfterUpdateRequest": 1, - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - }, - }, - { - Name: "user submit in restricted collection (rule pass check) + expand relations (no view rule access when bool is false)", - Method: http.MethodPatch, - Url: "/api/collections/demo2/records/63c2ab80-84ab-4057-a592-4604a731f78f?expand=missing,onerel,manyrels,selfrel", - Body: strings.NewReader(`{ - "selfrel":"63c2ab80-84ab-4057-a592-4604a731f78f", - "bool":false - }`), - RequestHeaders: map[string]string{ - // test3@example.com - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImVtYWlsIjoidGVzdDNAZXhhbXBsZS5jb20iLCJpZCI6Ijk3Y2MzZDNkLTZiYTItMzgzZi1iNDJhLTdiYzg0ZDI3NDEwYyIsImV4cCI6MTg5MzUxNTU3Nn0.Q965uvlTxxOsZbACXSgJQNXykYK0TKZ87nyPzemvN4E", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"63c2ab80-84ab-4057-a592-4604a731f78f"`, - `"bool":false`, - `"selfrel":"63c2ab80-84ab-4057-a592-4604a731f78f"`, - }, - NotExpectedContent: []string{ - `"@expand":{`, - `"manyrels":[{`, // admin only - `"onerel":{`, // admin only - `"selfrel":{`, // bool=true view rule - }, - ExpectedEvents: map[string]int{ - "OnRecordBeforeUpdateRequest": 1, - "OnRecordAfterUpdateRequest": 1, - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - }, - }, - { - Name: "admin submit in restricted collection (rule skip check) + expand relations", - Method: http.MethodPatch, - Url: "/api/collections/demo2/records/63c2ab80-84ab-4057-a592-4604a731f78f?expand=onerel,manyrels,selfrel,missing", - Body: strings.NewReader(`{ - "text":"test_new", - "number":1, - "selfrel":"94568ca2-0bee-49d7-b749-06cb97956fd9" - }`), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"63c2ab80-84ab-4057-a592-4604a731f78f"`, - `"text":"test_new"`, - `"number":1`, - `"@expand":{`, - `"manyrels":[{`, - `"onerel":{`, - `"selfrel":{`, - `"@collectionId":"3f2888f8-075d-49fe-9d09-ea7e951000dc"`, - `"@collectionName":"demo"`, - `"id":"848a1dea-5ddd-42d6-a00d-030547bffcfe"`, - `"id":"577bd676-aacb-4072-b7da-99d00ee210a4"`, - `"id":"94568ca2-0bee-49d7-b749-06cb97956fd9"`, - }, - ExpectedEvents: map[string]int{ - "OnRecordBeforeUpdateRequest": 1, - "OnRecordAfterUpdateRequest": 1, - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - }, - }, - { - Name: "submit via multipart form data", - Method: http.MethodPatch, - Url: "/api/collections/demo/records/b5c2ffc2-bafd-48f7-b8b7-090638afe209", - Body: formData, - RequestHeaders: map[string]string{ - "Content-Type": mp.FormDataContentType(), - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"b5c2ffc2-bafd-48f7-b8b7-090638afe209"`, - `"title":"new"`, - `"file":"`, - }, - ExpectedEvents: map[string]int{ - "OnRecordBeforeUpdateRequest": 1, - "OnRecordAfterUpdateRequest": 1, - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} diff --git a/apis/settings.go b/apis/settings.go index 415eea23e..56035a1f2 100644 --- a/apis/settings.go +++ b/apis/settings.go @@ -7,12 +7,11 @@ import ( "github.com/labstack/echo/v5" "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/forms" - "github.com/pocketbase/pocketbase/tools/rest" "github.com/pocketbase/pocketbase/tools/security" ) -// BindSettingsApi registers the settings api endpoints. -func BindSettingsApi(app core.App, rg *echo.Group) { +// bindSettingsApi registers the settings api endpoints. +func bindSettingsApi(app core.App, rg *echo.Group) { api := settingsApi{app: app} subGroup := rg.Group("/settings", ActivityLogger(app), RequireAdminAuth()) @@ -29,7 +28,7 @@ type settingsApi struct { func (api *settingsApi) list(c echo.Context) error { settings, err := api.app.Settings().RedactClone() if err != nil { - return rest.NewBadRequestError("", err) + return NewBadRequestError("", err) } event := &core.SettingsListEvent{ @@ -47,7 +46,7 @@ func (api *settingsApi) set(c echo.Context) error { // load request if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", err) + return NewBadRequestError("An error occurred while loading the submitted data.", err) } event := &core.SettingsUpdateEvent{ @@ -61,12 +60,12 @@ func (api *settingsApi) set(c echo.Context) error { return func() error { return api.app.OnSettingsBeforeUpdateRequest().Trigger(event, func(e *core.SettingsUpdateEvent) error { if err := next(); err != nil { - return rest.NewBadRequestError("An error occurred while submitting the form.", err) + return NewBadRequestError("An error occurred while submitting the form.", err) } redactedSettings, err := api.app.Settings().RedactClone() if err != nil { - return rest.NewBadRequestError("", err) + return NewBadRequestError("", err) } return e.HttpContext.JSON(http.StatusOK, redactedSettings) @@ -83,23 +82,23 @@ func (api *settingsApi) set(c echo.Context) error { func (api *settingsApi) testS3(c echo.Context) error { if !api.app.Settings().S3.Enabled { - return rest.NewBadRequestError("S3 storage is not enabled.", nil) + return NewBadRequestError("S3 storage is not enabled.", nil) } fs, err := api.app.NewFilesystem() if err != nil { - return rest.NewBadRequestError("Failed to initialize the S3 storage. Raw error: \n"+err.Error(), nil) + return NewBadRequestError("Failed to initialize the S3 storage. Raw error: \n"+err.Error(), nil) } defer fs.Close() testFileKey := "pb_test_" + security.RandomString(5) + "/test.txt" if err := fs.Upload([]byte("test"), testFileKey); err != nil { - return rest.NewBadRequestError("Failed to upload a test file. Raw error: \n"+err.Error(), nil) + return NewBadRequestError("Failed to upload a test file. Raw error: \n"+err.Error(), nil) } if err := fs.Delete(testFileKey); err != nil { - return rest.NewBadRequestError("Failed to delete a test file. Raw error: \n"+err.Error(), nil) + return NewBadRequestError("Failed to delete a test file. Raw error: \n"+err.Error(), nil) } return c.NoContent(http.StatusNoContent) @@ -110,18 +109,18 @@ func (api *settingsApi) testEmail(c echo.Context) error { // load request if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", err) + return NewBadRequestError("An error occurred while loading the submitted data.", err) } // send if err := form.Submit(); err != nil { if fErr, ok := err.(validation.Errors); ok { // form error - return rest.NewBadRequestError("Failed to send the test email.", fErr) + return NewBadRequestError("Failed to send the test email.", fErr) } // mailer error - return rest.NewBadRequestError("Failed to send the test email. Raw error: \n"+err.Error(), nil) + return NewBadRequestError("Failed to send the test email. Raw error: \n"+err.Error(), nil) } return c.NoContent(http.StatusNoContent) diff --git a/apis/settings_test.go b/apis/settings_test.go index 55020ad1e..70f21264a 100644 --- a/apis/settings_test.go +++ b/apis/settings_test.go @@ -19,11 +19,11 @@ func TestSettingsList(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as user", + Name: "authorized as auth record", Method: http.MethodGet, Url: "/api/settings", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -33,7 +33,7 @@ func TestSettingsList(t *testing.T) { Method: http.MethodGet, Url: "/api/settings", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ @@ -43,15 +43,16 @@ func TestSettingsList(t *testing.T) { `"s3":{`, `"adminAuthToken":{`, `"adminPasswordResetToken":{`, - `"userAuthToken":{`, - `"userPasswordResetToken":{`, - `"userEmailChangeToken":{`, - `"userVerificationToken":{`, + `"recordAuthToken":{`, + `"recordPasswordResetToken":{`, + `"recordEmailChangeToken":{`, + `"recordVerificationToken":{`, `"emailAuth":{`, `"googleAuth":{`, `"facebookAuth":{`, `"githubAuth":{`, `"gitlabAuth":{`, + `"twitterAuth":{`, `"discordAuth":{`, `"secret":"******"`, `"clientSecret":"******"`, @@ -68,7 +69,7 @@ func TestSettingsList(t *testing.T) { } func TestSettingsSet(t *testing.T) { - validData := `{"meta":{"appName":"update_test"},"emailAuth":{"minPasswordLength": 12}}` + validData := `{"meta":{"appName":"update_test"}}` scenarios := []tests.ApiScenario{ { @@ -80,12 +81,12 @@ func TestSettingsSet(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as user", + Name: "authorized as auth record", Method: http.MethodPatch, Url: "/api/settings", Body: strings.NewReader(validData), RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -96,7 +97,7 @@ func TestSettingsSet(t *testing.T) { Url: "/api/settings", Body: strings.NewReader(``), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ @@ -106,10 +107,10 @@ func TestSettingsSet(t *testing.T) { `"s3":{`, `"adminAuthToken":{`, `"adminPasswordResetToken":{`, - `"userAuthToken":{`, - `"userPasswordResetToken":{`, - `"userEmailChangeToken":{`, - `"userVerificationToken":{`, + `"recordAuthToken":{`, + `"recordPasswordResetToken":{`, + `"recordEmailChangeToken":{`, + `"recordVerificationToken":{`, `"emailAuth":{`, `"googleAuth":{`, `"facebookAuth":{`, @@ -119,7 +120,6 @@ func TestSettingsSet(t *testing.T) { `"secret":"******"`, `"clientSecret":"******"`, `"appName":"Acme"`, - `"minPasswordLength":8`, }, ExpectedEvents: map[string]int{ "OnModelBeforeUpdate": 1, @@ -132,15 +132,14 @@ func TestSettingsSet(t *testing.T) { Name: "authorized as admin submitting invalid data", Method: http.MethodPatch, Url: "/api/settings", - Body: strings.NewReader(`{"meta":{"appName":""},"emailAuth":{"minPasswordLength": 3}}`), + Body: strings.NewReader(`{"meta":{"appName":""}}`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{ `"data":{`, - `"emailAuth":{"minPasswordLength":{"code":"validation_min_greater_equal_than_required","message":"Must be no less than 5."}}`, - `"meta":{"appName":{"code":"validation_required","message":"Cannot be blank."}}`, + `"meta":{"appName":{"code":"validation_required"`, }, }, { @@ -149,7 +148,7 @@ func TestSettingsSet(t *testing.T) { Url: "/api/settings", Body: strings.NewReader(validData), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 200, ExpectedContent: []string{ @@ -159,20 +158,20 @@ func TestSettingsSet(t *testing.T) { `"s3":{`, `"adminAuthToken":{`, `"adminPasswordResetToken":{`, - `"userAuthToken":{`, - `"userPasswordResetToken":{`, - `"userEmailChangeToken":{`, - `"userVerificationToken":{`, + `"recordAuthToken":{`, + `"recordPasswordResetToken":{`, + `"recordEmailChangeToken":{`, + `"recordVerificationToken":{`, `"emailAuth":{`, `"googleAuth":{`, `"facebookAuth":{`, `"githubAuth":{`, `"gitlabAuth":{`, + `"twitterAuth":{`, `"discordAuth":{`, `"secret":"******"`, `"clientSecret":"******"`, `"appName":"update_test"`, - `"minPasswordLength":12`, }, ExpectedEvents: map[string]int{ "OnModelBeforeUpdate": 1, @@ -198,11 +197,11 @@ func TestSettingsTestS3(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as user", + Name: "authorized as auth record", Method: http.MethodPost, Url: "/api/settings/test/s3", RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -212,12 +211,11 @@ func TestSettingsTestS3(t *testing.T) { Method: http.MethodPost, Url: "/api/settings/test/s3", RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{`"data":{}`}, }, - // @todo consider creating a test S3 filesystem } for _, scenario := range scenarios { @@ -239,7 +237,7 @@ func TestSettingsTestEmail(t *testing.T) { ExpectedContent: []string{`"data":{}`}, }, { - Name: "authorized as user", + Name: "authorized as auth record", Method: http.MethodPost, Url: "/api/settings/test/email", Body: strings.NewReader(`{ @@ -247,7 +245,7 @@ func TestSettingsTestEmail(t *testing.T) { "email": "test@example.com" }`), RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", + "Authorization": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", }, ExpectedStatus: 401, ExpectedContent: []string{`"data":{}`}, @@ -258,7 +256,7 @@ func TestSettingsTestEmail(t *testing.T) { Url: "/api/settings/test/email", Body: strings.NewReader(`{`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{`"data":{}`}, @@ -269,7 +267,7 @@ func TestSettingsTestEmail(t *testing.T) { Url: "/api/settings/test/email", Body: strings.NewReader(`{}`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, ExpectedStatus: 400, ExpectedContent: []string{ @@ -286,7 +284,7 @@ func TestSettingsTestEmail(t *testing.T) { "email": "test@example.com" }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { if app.TestMailer.TotalSend != 1 { @@ -304,8 +302,8 @@ func TestSettingsTestEmail(t *testing.T) { ExpectedStatus: 204, ExpectedContent: []string{}, ExpectedEvents: map[string]int{ - "OnMailerBeforeUserVerificationSend": 1, - "OnMailerAfterUserVerificationSend": 1, + "OnMailerBeforeRecordVerificationSend": 1, + "OnMailerAfterRecordVerificationSend": 1, }, }, { @@ -317,7 +315,7 @@ func TestSettingsTestEmail(t *testing.T) { "email": "test@example.com" }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { if app.TestMailer.TotalSend != 1 { @@ -335,8 +333,8 @@ func TestSettingsTestEmail(t *testing.T) { ExpectedStatus: 204, ExpectedContent: []string{}, ExpectedEvents: map[string]int{ - "OnMailerBeforeUserResetPasswordSend": 1, - "OnMailerAfterUserResetPasswordSend": 1, + "OnMailerBeforeRecordResetPasswordSend": 1, + "OnMailerAfterRecordResetPasswordSend": 1, }, }, { @@ -348,7 +346,7 @@ func TestSettingsTestEmail(t *testing.T) { "email": "test@example.com" }`), RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", }, AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { if app.TestMailer.TotalSend != 1 { @@ -366,8 +364,8 @@ func TestSettingsTestEmail(t *testing.T) { ExpectedStatus: 204, ExpectedContent: []string{}, ExpectedEvents: map[string]int{ - "OnMailerBeforeUserChangeEmailSend": 1, - "OnMailerAfterUserChangeEmailSend": 1, + "OnMailerBeforeRecordChangeEmailSend": 1, + "OnMailerAfterRecordChangeEmailSend": 1, }, }, } diff --git a/apis/user.go b/apis/user.go deleted file mode 100644 index c7f00eeaa..000000000 --- a/apis/user.go +++ /dev/null @@ -1,519 +0,0 @@ -package apis - -import ( - "log" - "net/http" - - "github.com/labstack/echo/v5" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/forms" - "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tokens" - "github.com/pocketbase/pocketbase/tools/auth" - "github.com/pocketbase/pocketbase/tools/rest" - "github.com/pocketbase/pocketbase/tools/routine" - "github.com/pocketbase/pocketbase/tools/search" - "github.com/pocketbase/pocketbase/tools/security" - "golang.org/x/oauth2" -) - -// BindUserApi registers the user api endpoints and the corresponding handlers. -func BindUserApi(app core.App, rg *echo.Group) { - api := userApi{app: app} - - subGroup := rg.Group("/users", ActivityLogger(app)) - subGroup.GET("/auth-methods", api.authMethods) - subGroup.POST("/auth-via-oauth2", api.oauth2Auth, RequireGuestOnly()) - subGroup.POST("/auth-via-email", api.emailAuth, RequireGuestOnly()) - subGroup.POST("/request-password-reset", api.requestPasswordReset) - subGroup.POST("/confirm-password-reset", api.confirmPasswordReset) - subGroup.POST("/request-verification", api.requestVerification) - subGroup.POST("/confirm-verification", api.confirmVerification) - subGroup.POST("/request-email-change", api.requestEmailChange, RequireUserAuth()) - subGroup.POST("/confirm-email-change", api.confirmEmailChange) - subGroup.POST("/refresh", api.refresh, RequireUserAuth()) - // crud - subGroup.GET("", api.list, RequireAdminAuth()) - subGroup.POST("", api.create) - subGroup.GET("/:id", api.view, RequireAdminOrOwnerAuth("id")) - subGroup.PATCH("/:id", api.update, RequireAdminAuth()) - subGroup.DELETE("/:id", api.delete, RequireAdminOrOwnerAuth("id")) - subGroup.GET("/:id/external-auths", api.listExternalAuths, RequireAdminOrOwnerAuth("id")) - subGroup.DELETE("/:id/external-auths/:provider", api.unlinkExternalAuth, RequireAdminOrOwnerAuth("id")) -} - -type userApi struct { - app core.App -} - -func (api *userApi) authResponse(c echo.Context, user *models.User, meta any) error { - token, tokenErr := tokens.NewUserAuthToken(api.app, user) - if tokenErr != nil { - return rest.NewBadRequestError("Failed to create auth token.", tokenErr) - } - - event := &core.UserAuthEvent{ - HttpContext: c, - User: user, - Token: token, - Meta: meta, - } - - return api.app.OnUserAuthRequest().Trigger(event, func(e *core.UserAuthEvent) error { - result := map[string]any{ - "token": e.Token, - "user": e.User, - } - - if e.Meta != nil { - result["meta"] = e.Meta - } - - return e.HttpContext.JSON(http.StatusOK, result) - }) -} - -func (api *userApi) refresh(c echo.Context) error { - user, _ := c.Get(ContextUserKey).(*models.User) - if user == nil { - return rest.NewNotFoundError("Missing auth user context.", nil) - } - - return api.authResponse(c, user, nil) -} - -type providerInfo struct { - Name string `json:"name"` - State string `json:"state"` - CodeVerifier string `json:"codeVerifier"` - CodeChallenge string `json:"codeChallenge"` - CodeChallengeMethod string `json:"codeChallengeMethod"` - AuthUrl string `json:"authUrl"` -} - -func (api *userApi) authMethods(c echo.Context) error { - result := struct { - EmailPassword bool `json:"emailPassword"` - AuthProviders []providerInfo `json:"authProviders"` - }{ - EmailPassword: true, - AuthProviders: []providerInfo{}, - } - - settings := api.app.Settings() - - result.EmailPassword = settings.EmailAuth.Enabled - - nameConfigMap := settings.NamedAuthProviderConfigs() - - for name, config := range nameConfigMap { - if !config.Enabled { - continue - } - - provider, err := auth.NewProviderByName(name) - if err != nil { - if api.app.IsDebug() { - log.Println(err) - } - - // skip provider - continue - } - - if err := config.SetupProvider(provider); err != nil { - if api.app.IsDebug() { - log.Println(err) - } - - // skip provider - continue - } - - state := security.RandomString(30) - codeVerifier := security.RandomString(43) - codeChallenge := security.S256Challenge(codeVerifier) - codeChallengeMethod := "S256" - result.AuthProviders = append(result.AuthProviders, providerInfo{ - Name: name, - State: state, - CodeVerifier: codeVerifier, - CodeChallenge: codeChallenge, - CodeChallengeMethod: codeChallengeMethod, - AuthUrl: provider.BuildAuthUrl( - state, - oauth2.SetAuthURLParam("code_challenge", codeChallenge), - oauth2.SetAuthURLParam("code_challenge_method", codeChallengeMethod), - ) + "&redirect_uri=", // empty redirect_uri so that users can append their url - }) - } - - return c.JSON(http.StatusOK, result) -} - -func (api *userApi) oauth2Auth(c echo.Context) error { - form := forms.NewUserOauth2Login(api.app) - if readErr := c.Bind(form); readErr != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", readErr) - } - - user, authData, submitErr := form.Submit() - if submitErr != nil { - return rest.NewBadRequestError("Failed to authenticate.", submitErr) - } - - return api.authResponse(c, user, authData) -} - -func (api *userApi) emailAuth(c echo.Context) error { - if !api.app.Settings().EmailAuth.Enabled { - return rest.NewBadRequestError("Email/Password authentication is not enabled.", nil) - } - - form := forms.NewUserEmailLogin(api.app) - if readErr := c.Bind(form); readErr != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", readErr) - } - - user, submitErr := form.Submit() - if submitErr != nil { - return rest.NewBadRequestError("Failed to authenticate.", submitErr) - } - - return api.authResponse(c, user, nil) -} - -func (api *userApi) requestPasswordReset(c echo.Context) error { - form := forms.NewUserPasswordResetRequest(api.app) - if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", err) - } - - if err := form.Validate(); err != nil { - return rest.NewBadRequestError("An error occurred while validating the form.", err) - } - - // run in background because we don't need to show - // the result to the user (prevents users enumeration) - routine.FireAndForget(func() { - if err := form.Submit(); err != nil && api.app.IsDebug() { - log.Println(err) - } - }) - - return c.NoContent(http.StatusNoContent) -} - -func (api *userApi) confirmPasswordReset(c echo.Context) error { - form := forms.NewUserPasswordResetConfirm(api.app) - if readErr := c.Bind(form); readErr != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", readErr) - } - - user, submitErr := form.Submit() - if submitErr != nil { - return rest.NewBadRequestError("Failed to set new password.", submitErr) - } - - return api.authResponse(c, user, nil) -} - -func (api *userApi) requestEmailChange(c echo.Context) error { - loggedUser, _ := c.Get(ContextUserKey).(*models.User) - if loggedUser == nil { - return rest.NewUnauthorizedError("The request requires valid authorized user.", nil) - } - - form := forms.NewUserEmailChangeRequest(api.app, loggedUser) - if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", err) - } - - if err := form.Submit(); err != nil { - return rest.NewBadRequestError("Failed to request email change.", err) - } - - return c.NoContent(http.StatusNoContent) -} - -func (api *userApi) confirmEmailChange(c echo.Context) error { - form := forms.NewUserEmailChangeConfirm(api.app) - if readErr := c.Bind(form); readErr != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", readErr) - } - - user, submitErr := form.Submit() - if submitErr != nil { - return rest.NewBadRequestError("Failed to confirm email change.", submitErr) - } - - return api.authResponse(c, user, nil) -} - -func (api *userApi) requestVerification(c echo.Context) error { - form := forms.NewUserVerificationRequest(api.app) - if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", err) - } - - if err := form.Validate(); err != nil { - return rest.NewBadRequestError("An error occurred while validating the form.", err) - } - - // run in background because we don't need to show - // the result to the user (prevents users enumeration) - routine.FireAndForget(func() { - if err := form.Submit(); err != nil && api.app.IsDebug() { - log.Println(err) - } - }) - - return c.NoContent(http.StatusNoContent) -} - -func (api *userApi) confirmVerification(c echo.Context) error { - form := forms.NewUserVerificationConfirm(api.app) - if readErr := c.Bind(form); readErr != nil { - return rest.NewBadRequestError("An error occurred while loading the submitted data.", readErr) - } - - user, submitErr := form.Submit() - if submitErr != nil { - return rest.NewBadRequestError("An error occurred while submitting the form.", submitErr) - } - - return api.authResponse(c, user, nil) -} - -// ------------------------------------------------------------------- -// CRUD -// ------------------------------------------------------------------- - -func (api *userApi) list(c echo.Context) error { - fieldResolver := search.NewSimpleFieldResolver( - "id", "created", "updated", "email", "verified", - ) - - users := []*models.User{} - - result, searchErr := search.NewProvider(fieldResolver). - Query(api.app.Dao().UserQuery()). - ParseAndExec(c.QueryString(), &users) - if searchErr != nil { - return rest.NewBadRequestError("", searchErr) - } - - // eager load user profiles (if any) - if err := api.app.Dao().LoadProfiles(users); err != nil { - return rest.NewBadRequestError("", err) - } - - event := &core.UsersListEvent{ - HttpContext: c, - Users: users, - Result: result, - } - - return api.app.OnUsersListRequest().Trigger(event, func(e *core.UsersListEvent) error { - return e.HttpContext.JSON(http.StatusOK, e.Result) - }) -} - -func (api *userApi) view(c echo.Context) error { - id := c.PathParam("id") - if id == "" { - return rest.NewNotFoundError("", nil) - } - - user, err := api.app.Dao().FindUserById(id) - if err != nil || user == nil { - return rest.NewNotFoundError("", err) - } - - event := &core.UserViewEvent{ - HttpContext: c, - User: user, - } - - return api.app.OnUserViewRequest().Trigger(event, func(e *core.UserViewEvent) error { - return e.HttpContext.JSON(http.StatusOK, e.User) - }) -} - -func (api *userApi) create(c echo.Context) error { - if !api.app.Settings().EmailAuth.Enabled { - return rest.NewBadRequestError("Email/Password authentication is not enabled.", nil) - } - - user := &models.User{} - form := forms.NewUserUpsert(api.app, user) - - // load request - if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) - } - - event := &core.UserCreateEvent{ - HttpContext: c, - User: user, - } - - // create the user - submitErr := form.Submit(func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc { - return func() error { - return api.app.OnUserBeforeCreateRequest().Trigger(event, func(e *core.UserCreateEvent) error { - if err := next(); err != nil { - return rest.NewBadRequestError("Failed to create user.", err) - } - - return e.HttpContext.JSON(http.StatusOK, e.User) - }) - } - }) - - if submitErr == nil { - api.app.OnUserAfterCreateRequest().Trigger(event) - } - - return submitErr -} - -func (api *userApi) update(c echo.Context) error { - id := c.PathParam("id") - if id == "" { - return rest.NewNotFoundError("", nil) - } - - user, err := api.app.Dao().FindUserById(id) - if err != nil || user == nil { - return rest.NewNotFoundError("", err) - } - - form := forms.NewUserUpsert(api.app, user) - - // load request - if err := c.Bind(form); err != nil { - return rest.NewBadRequestError("Failed to load the submitted data due to invalid formatting.", err) - } - - event := &core.UserUpdateEvent{ - HttpContext: c, - User: user, - } - - // update the user - submitErr := form.Submit(func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc { - return func() error { - return api.app.OnUserBeforeUpdateRequest().Trigger(event, func(e *core.UserUpdateEvent) error { - if err := next(); err != nil { - return rest.NewBadRequestError("Failed to update user.", err) - } - - return e.HttpContext.JSON(http.StatusOK, e.User) - }) - } - }) - - if submitErr == nil { - api.app.OnUserAfterUpdateRequest().Trigger(event) - } - - return submitErr -} - -func (api *userApi) delete(c echo.Context) error { - id := c.PathParam("id") - if id == "" { - return rest.NewNotFoundError("", nil) - } - - user, err := api.app.Dao().FindUserById(id) - if err != nil || user == nil { - return rest.NewNotFoundError("", err) - } - - event := &core.UserDeleteEvent{ - HttpContext: c, - User: user, - } - - handlerErr := api.app.OnUserBeforeDeleteRequest().Trigger(event, func(e *core.UserDeleteEvent) error { - // delete the user model - if err := api.app.Dao().DeleteUser(e.User); err != nil { - return rest.NewBadRequestError("Failed to delete user. Make sure that the user is not part of a required relation reference.", err) - } - - return e.HttpContext.NoContent(http.StatusNoContent) - }) - - if handlerErr == nil { - api.app.OnUserAfterDeleteRequest().Trigger(event) - } - - return handlerErr -} - -func (api *userApi) listExternalAuths(c echo.Context) error { - id := c.PathParam("id") - if id == "" { - return rest.NewNotFoundError("", nil) - } - - user, err := api.app.Dao().FindUserById(id) - if err != nil || user == nil { - return rest.NewNotFoundError("", err) - } - - externalAuths, err := api.app.Dao().FindAllExternalAuthsByUserId(user.Id) - if err != nil { - return rest.NewBadRequestError("Failed to fetch the external auths for the specified user.", err) - } - - event := &core.UserListExternalAuthsEvent{ - HttpContext: c, - User: user, - ExternalAuths: externalAuths, - } - - return api.app.OnUserListExternalAuths().Trigger(event, func(e *core.UserListExternalAuthsEvent) error { - return e.HttpContext.JSON(http.StatusOK, e.ExternalAuths) - }) -} - -func (api *userApi) unlinkExternalAuth(c echo.Context) error { - id := c.PathParam("id") - provider := c.PathParam("provider") - if id == "" || provider == "" { - return rest.NewNotFoundError("", nil) - } - - user, err := api.app.Dao().FindUserById(id) - if err != nil || user == nil { - return rest.NewNotFoundError("", err) - } - - externalAuth, err := api.app.Dao().FindExternalAuthByUserIdAndProvider(user.Id, provider) - if err != nil { - return rest.NewNotFoundError("Missing external auth provider relation.", err) - } - - event := &core.UserUnlinkExternalAuthEvent{ - HttpContext: c, - User: user, - ExternalAuth: externalAuth, - } - - handlerErr := api.app.OnUserBeforeUnlinkExternalAuthRequest().Trigger(event, func(e *core.UserUnlinkExternalAuthEvent) error { - if err := api.app.Dao().DeleteExternalAuth(externalAuth); err != nil { - return rest.NewBadRequestError("Cannot unlink the external auth provider. Make sure that the user has other linked auth providers OR has an email address.", err) - } - - return e.HttpContext.NoContent(http.StatusNoContent) - }) - - if handlerErr == nil { - api.app.OnUserAfterUnlinkExternalAuthRequest().Trigger(event) - } - - return handlerErr -} diff --git a/apis/user_test.go b/apis/user_test.go deleted file mode 100644 index d1576f777..000000000 --- a/apis/user_test.go +++ /dev/null @@ -1,1113 +0,0 @@ -package apis_test - -import ( - "net/http" - "strings" - "testing" - "time" - - "github.com/labstack/echo/v5" - "github.com/pocketbase/pocketbase/daos" - "github.com/pocketbase/pocketbase/tests" - "github.com/pocketbase/pocketbase/tools/types" -) - -func TestUsersAuthMethods(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Method: http.MethodGet, - Url: "/api/users/auth-methods", - ExpectedStatus: 200, - ExpectedContent: []string{ - `"emailPassword":true`, - `"authProviders":[{`, - `"authProviders":[{`, - `"name":"gitlab"`, - `"state":`, - `"codeVerifier":`, - `"codeChallenge":`, - `"codeChallengeMethod":`, - `"authUrl":`, - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserEmailAuth(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "authorized as user", - Method: http.MethodPost, - Url: "/api/users/auth-via-email", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin", - Method: http.MethodPost, - Url: "/api/users/auth-via-email", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "invalid body format", - Method: http.MethodPost, - Url: "/api/users/auth-via-email", - Body: strings.NewReader(`{"email`), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "invalid data", - Method: http.MethodPost, - Url: "/api/users/auth-via-email", - Body: strings.NewReader(`{"email":"","password":""}`), - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":{`, - `"email":{`, - `"password":{`, - }, - }, - { - Name: "disabled email/pass auth with valid data", - Method: http.MethodPost, - Url: "/api/users/auth-via-email", - Body: strings.NewReader(`{"email":"test@example.com","password":"123456"}`), - BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - app.Settings().EmailAuth.Enabled = false - }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "valid data", - Method: http.MethodPost, - Url: "/api/users/auth-via-email", - Body: strings.NewReader(`{"email":"test2@example.com","password":"123456"}`), - ExpectedStatus: 200, - ExpectedContent: []string{ - `"token"`, - `"user"`, - `"id":"7bc84d27-6ba2-b42a-383f-4197cc3d3d0c"`, - `"email":"test2@example.com"`, - `"verified":false`, // unverified user should be able to authenticate - }, - ExpectedEvents: map[string]int{"OnUserAuthRequest": 1}, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserRequestPasswordReset(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "empty data", - Method: http.MethodPost, - Url: "/api/users/request-password-reset", - Body: strings.NewReader(``), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{"email":{"code":"validation_required","message":"Cannot be blank."}}`}, - }, - { - Name: "invalid data", - Method: http.MethodPost, - Url: "/api/users/request-password-reset", - Body: strings.NewReader(`{"email`), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "missing user", - Method: http.MethodPost, - Url: "/api/users/request-password-reset", - Body: strings.NewReader(`{"email":"missing@example.com"}`), - Delay: 100 * time.Millisecond, - ExpectedStatus: 204, - }, - { - Name: "existing user", - Method: http.MethodPost, - Url: "/api/users/request-password-reset", - Body: strings.NewReader(`{"email":"test@example.com"}`), - Delay: 100 * time.Millisecond, - ExpectedStatus: 204, - ExpectedEvents: map[string]int{ - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - "OnMailerBeforeUserResetPasswordSend": 1, - "OnMailerAfterUserResetPasswordSend": 1, - }, - }, - { - Name: "existing user (after already sent)", - Method: http.MethodPost, - Url: "/api/users/request-password-reset", - Body: strings.NewReader(`{"email":"test@example.com"}`), - Delay: 100 * time.Millisecond, - ExpectedStatus: 204, - BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - // simulate recent password request - user, err := app.Dao().FindUserByEmail("test@example.com") - if err != nil { - t.Fatal(err) - } - user.LastResetSentAt = types.NowDateTime() - dao := daos.New(app.Dao().DB()) // new dao to ignore hooks - if err := dao.Save(user); err != nil { - t.Fatal(err) - } - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserConfirmPasswordReset(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "empty data", - Method: http.MethodPost, - Url: "/api/users/confirm-password-reset", - Body: strings.NewReader(``), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{"password":{"code":"validation_required","message":"Cannot be blank."},"passwordConfirm":{"code":"validation_required","message":"Cannot be blank."},"token":{"code":"validation_required","message":"Cannot be blank."}}`}, - }, - { - Name: "invalid data format", - Method: http.MethodPost, - Url: "/api/users/confirm-password-reset", - Body: strings.NewReader(`{"password`), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "expired token", - Method: http.MethodPost, - Url: "/api/users/confirm-password-reset", - Body: strings.NewReader(`{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImlkIjoiNGQwMTk3Y2MtMmI0YS0zZjgzLWEyNmItZDc3YmM4NDIzZDNjIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxNjQxMDMxMjAwfQ.t2lVe0ny9XruQsSFQdXqBi0I85i6vIUAQjFXZY5HPxc","password":"123456789","passwordConfirm":"123456789"}`), - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":{`, - `"token":{`, - `"code":"validation_invalid_token"`, - }, - }, - { - Name: "valid token and data", - Method: http.MethodPost, - Url: "/api/users/confirm-password-reset", - Body: strings.NewReader(`{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImlkIjoiNGQwMTk3Y2MtMmI0YS0zZjgzLWEyNmItZDc3YmM4NDIzZDNjIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxODYxOTU2MDAwfQ.V1gEbY4caEIF6IhQAJ8KZD4RvOGvTCFuYg1fTRSvhe0","password":"123456789","passwordConfirm":"123456789"}`), - ExpectedStatus: 200, - ExpectedContent: []string{ - `"token":`, - `"user":`, - `"id":"4d0197cc-2b4a-3f83-a26b-d77bc8423d3c"`, - `"email":"test@example.com"`, - }, - ExpectedEvents: map[string]int{"OnUserAuthRequest": 1, "OnModelAfterUpdate": 1, "OnModelBeforeUpdate": 1}, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserRequestVerification(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "empty data", - Method: http.MethodPost, - Url: "/api/users/request-verification", - Body: strings.NewReader(``), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{"email":{"code":"validation_required","message":"Cannot be blank."}}`}, - }, - { - Name: "invalid data", - Method: http.MethodPost, - Url: "/api/users/request-verification", - Body: strings.NewReader(`{"email`), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "missing user", - Method: http.MethodPost, - Url: "/api/users/request-verification", - Body: strings.NewReader(`{"email":"missing@example.com"}`), - Delay: 100 * time.Millisecond, - ExpectedStatus: 204, - }, - { - Name: "existing already verified user", - Method: http.MethodPost, - Url: "/api/users/request-verification", - Body: strings.NewReader(`{"email":"test@example.com"}`), - Delay: 100 * time.Millisecond, - ExpectedStatus: 204, - }, - { - Name: "existing unverified user", - Method: http.MethodPost, - Url: "/api/users/request-verification", - Body: strings.NewReader(`{"email":"test2@example.com"}`), - Delay: 100 * time.Millisecond, - ExpectedStatus: 204, - ExpectedEvents: map[string]int{ - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - "OnMailerBeforeUserVerificationSend": 1, - "OnMailerAfterUserVerificationSend": 1, - }, - }, - { - Name: "existing unverified user (after already sent)", - Method: http.MethodPost, - Url: "/api/users/request-verification", - Body: strings.NewReader(`{"email":"test2@example.com"}`), - Delay: 100 * time.Millisecond, - ExpectedStatus: 204, - BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - // simulate recent verification sent - user, err := app.Dao().FindUserByEmail("test2@example.com") - if err != nil { - t.Fatal(err) - } - user.LastVerificationSentAt = types.NowDateTime() - dao := daos.New(app.Dao().DB()) // new dao to ignore hooks - if err := dao.Save(user); err != nil { - t.Fatal(err) - } - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserConfirmVerification(t *testing.T) { - scenarios := []tests.ApiScenario{ - // empty data - { - Method: http.MethodPost, - Url: "/api/users/confirm-verification", - Body: strings.NewReader(``), - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":`, - `"token":{"code":"validation_required"`, - }, - }, - // invalid data - { - Method: http.MethodPost, - Url: "/api/users/confirm-verification", - Body: strings.NewReader(`{"token`), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - // expired token - { - Method: http.MethodPost, - Url: "/api/users/confirm-verification", - Body: strings.NewReader(`{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImlkIjoiN2JjODRkMjctNmJhMi1iNDJhLTM4M2YtNDE5N2NjM2QzZDBjIiwiZW1haWwiOiJ0ZXN0MkBleGFtcGxlLmNvbSIsImV4cCI6MTY0MTAzMTIwMH0.YCqyREksfqn7cWu-innNNTbWQCr9DgYr7dduM2wxrtQ"}`), - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":{`, - `"token":{`, - `"code":"validation_invalid_token"`, - }, - }, - // valid token - { - Method: http.MethodPost, - Url: "/api/users/confirm-verification", - Body: strings.NewReader(`{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0eXBlIjoidXNlciIsImlkIjoiN2JjODRkMjctNmJhMi1iNDJhLTM4M2YtNDE5N2NjM2QzZDBjIiwiZW1haWwiOiJ0ZXN0MkBleGFtcGxlLmNvbSIsImV4cCI6MTg2MTk1NjAwMH0.OsxRKuZrNTnwyVjvCwB4jY8TbT-NPZ-UFCpRhCvuv2U"}`), - ExpectedStatus: 200, - ExpectedContent: []string{ - `"token":`, - `"user":`, - `"id":"7bc84d27-6ba2-b42a-383f-4197cc3d3d0c"`, - `"email":"test2@example.com"`, - `"verified":true`, - }, - ExpectedEvents: map[string]int{ - "OnUserAuthRequest": 1, - "OnModelAfterUpdate": 1, - "OnModelBeforeUpdate": 1, - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserRequestEmailChange(t *testing.T) { - scenarios := []tests.ApiScenario{ - // unauthorized - { - Method: http.MethodPost, - Url: "/api/users/request-email-change", - Body: strings.NewReader(`{"newEmail":"change@example.com"}`), - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - // authorized as admin - { - Method: http.MethodPost, - Url: "/api/users/request-email-change", - Body: strings.NewReader(`{"newEmail":"change@example.com"}`), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - // invalid data - { - Method: http.MethodPost, - Url: "/api/users/request-email-change", - Body: strings.NewReader(`{"newEmail`), - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - // empty data - { - Method: http.MethodPost, - Url: "/api/users/request-email-change", - Body: strings.NewReader(``), - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":`, - `"newEmail":{"code":"validation_required"`, - }, - }, - // valid data (existing email) - { - Method: http.MethodPost, - Url: "/api/users/request-email-change", - Body: strings.NewReader(`{"newEmail":"test2@example.com"}`), - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":`, - `"newEmail":{"code":"validation_user_email_exists"`, - }, - }, - // valid data (new email) - { - Method: http.MethodPost, - Url: "/api/users/request-email-change", - Body: strings.NewReader(`{"newEmail":"change@example.com"}`), - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 204, - ExpectedEvents: map[string]int{ - "OnMailerBeforeUserChangeEmailSend": 1, - "OnMailerAfterUserChangeEmailSend": 1, - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserConfirmEmailChange(t *testing.T) { - scenarios := []tests.ApiScenario{ - // empty data - { - Method: http.MethodPost, - Url: "/api/users/confirm-email-change", - Body: strings.NewReader(``), - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":`, - `"token":{"code":"validation_required"`, - `"password":{"code":"validation_required"`, - }, - }, - // invalid data - { - Method: http.MethodPost, - Url: "/api/users/confirm-email-change", - Body: strings.NewReader(`{"token`), - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - // expired token and correct password - { - Method: http.MethodPost, - Url: "/api/users/confirm-email-change", - Body: strings.NewReader(`{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjdiYzg0ZDI3LTZiYTItYjQyYS0zODNmLTQxOTdjYzNkM2QwYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0MkBleGFtcGxlLmNvbSIsIm5ld0VtYWlsIjoiY2hhbmdlQGV4YW1wbGUuY29tIiwiZXhwIjoxNjQwOTkxNjAwfQ.DOqNtSDcXbWix8OsK13X-tjfWi6jZNlAzIZiwG_YDOs","password":"123456"}`), - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":{`, - `"token":{`, - `"code":"validation_invalid_token"`, - }, - }, - // valid token and incorrect password - { - Method: http.MethodPost, - Url: "/api/users/confirm-email-change", - Body: strings.NewReader(`{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjdiYzg0ZDI3LTZiYTItYjQyYS0zODNmLTQxOTdjYzNkM2QwYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0MkBleGFtcGxlLmNvbSIsIm5ld0VtYWlsIjoiY2hhbmdlQGV4YW1wbGUuY29tIiwiZXhwIjoxODkzNDUyNDAwfQ.aWMQJ_c49yFbzHO5TNhlkbKRokQ_isc2RbLGuSJx44c","password":"654321"}`), - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":{`, - `"password":{`, - `"code":"validation_invalid_password"`, - }, - }, - // valid token and correct password - { - Method: http.MethodPost, - Url: "/api/users/confirm-email-change", - Body: strings.NewReader(`{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjdiYzg0ZDI3LTZiYTItYjQyYS0zODNmLTQxOTdjYzNkM2QwYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0MkBleGFtcGxlLmNvbSIsIm5ld0VtYWlsIjoiY2hhbmdlQGV4YW1wbGUuY29tIiwiZXhwIjoxODkzNDUyNDAwfQ.aWMQJ_c49yFbzHO5TNhlkbKRokQ_isc2RbLGuSJx44c","password":"123456"}`), - ExpectedStatus: 200, - ExpectedContent: []string{ - `"token":`, - `"user":`, - `"id":"7bc84d27-6ba2-b42a-383f-4197cc3d3d0c"`, - `"email":"change@example.com"`, - `"verified":true`, - }, - ExpectedEvents: map[string]int{"OnUserAuthRequest": 1, "OnModelAfterUpdate": 1, "OnModelBeforeUpdate": 1}, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserRefresh(t *testing.T) { - scenarios := []tests.ApiScenario{ - // unauthorized - { - Method: http.MethodPost, - Url: "/api/users/refresh", - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - // authorized as admin - { - Method: http.MethodPost, - Url: "/api/users/refresh", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - // authorized as user - { - Method: http.MethodPost, - Url: "/api/users/refresh", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"token":`, - `"user":`, - `"id":"4d0197cc-2b4a-3f83-a26b-d77bc8423d3c"`, - }, - ExpectedEvents: map[string]int{"OnUserAuthRequest": 1}, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUsersList(t *testing.T) { - scenarios := []tests.ApiScenario{ - // unauthorized - { - Method: http.MethodGet, - Url: "/api/users", - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - // authorized as user - { - Method: http.MethodGet, - Url: "/api/users", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - // authorized as admin - { - Method: http.MethodGet, - Url: "/api/users", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"page":1`, - `"perPage":30`, - `"totalItems":4`, - `"items":[{`, - `"id":"4d0197cc-2b4a-3f83-a26b-d77bc8423d3c"`, - `"id":"7bc84d27-6ba2-b42a-383f-4197cc3d3d0c"`, - `"id":"97cc3d3d-6ba2-383f-b42a-7bc84d27410c"`, - `"id":"cx9u0dh2udo8xol"`, - }, - ExpectedEvents: map[string]int{"OnUsersListRequest": 1}, - }, - // authorized as admin + paging and sorting - { - Method: http.MethodGet, - Url: "/api/users?page=2&perPage=2&sort=-created", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"page":2`, - `"perPage":2`, - `"totalItems":4`, - `"items":[{`, - `"id":"7bc84d27-6ba2-b42a-383f-4197cc3d3d0c"`, - `"id":"4d0197cc-2b4a-3f83-a26b-d77bc8423d3c"`, - }, - ExpectedEvents: map[string]int{"OnUsersListRequest": 1}, - }, - // authorized as admin + invalid filter - { - Method: http.MethodGet, - Url: "/api/users?filter=invalidfield~'test2'", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - // authorized as admin + valid filter - { - Method: http.MethodGet, - Url: "/api/users?filter=verified=true", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"page":1`, - `"perPage":30`, - `"totalItems":3`, - `"items":[{`, - `"id":"4d0197cc-2b4a-3f83-a26b-d77bc8423d3c"`, - `"id":"97cc3d3d-6ba2-383f-b42a-7bc84d27410c"`, - `"id":"cx9u0dh2udo8xol"`, - }, - ExpectedEvents: map[string]int{"OnUsersListRequest": 1}, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserView(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "unauthorized", - Method: http.MethodGet, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin + nonexisting user id", - Method: http.MethodGet, - Url: "/api/users/00000000-0000-0000-0000-d77bc8423d3c", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin + existing user id", - Method: http.MethodGet, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"4d0197cc-2b4a-3f83-a26b-d77bc8423d3c"`, - }, - ExpectedEvents: map[string]int{"OnUserViewRequest": 1}, - }, - { - Name: "authorized as user - trying to view another user", - Method: http.MethodGet, - Url: "/api/users/7bc84d27-6ba2-b42a-383f-4197cc3d3d0c", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as user - owner", - Method: http.MethodGet, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"4d0197cc-2b4a-3f83-a26b-d77bc8423d3c"`, - }, - ExpectedEvents: map[string]int{"OnUserViewRequest": 1}, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserDelete(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "unauthorized", - Method: http.MethodDelete, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin + nonexisting user id", - Method: http.MethodDelete, - Url: "/api/users/00000000-0000-0000-0000-d77bc8423d3c", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin + existing user id", - Method: http.MethodDelete, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 204, - ExpectedEvents: map[string]int{ - "OnUserBeforeDeleteRequest": 1, - "OnUserAfterDeleteRequest": 1, - "OnModelBeforeDelete": 2, // cascade delete to related Record model - "OnModelAfterDelete": 2, // cascade delete to related Record model - }, - }, - { - Name: "authorized as user - trying to delete another user", - Method: http.MethodDelete, - Url: "/api/users/7bc84d27-6ba2-b42a-383f-4197cc3d3d0c", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as user - owner", - Method: http.MethodDelete, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 204, - ExpectedEvents: map[string]int{ - "OnUserBeforeDeleteRequest": 1, - "OnUserAfterDeleteRequest": 1, - "OnModelBeforeDelete": 2, // cascade delete to related Record model - "OnModelAfterDelete": 2, // cascade delete to related Record model - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserCreate(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "empty data", - Method: http.MethodPost, - Url: "/api/users", - Body: strings.NewReader(``), - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":{`, - `"email":{"code":"validation_required"`, - `"password":{"code":"validation_required"`, - }, - }, - { - Name: "invalid data", - Method: http.MethodPost, - Url: "/api/users", - Body: strings.NewReader(`{"email":"test@example.com","password":"1234","passwordConfirm":"4321"}`), - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":{`, - `"email":{"code":"validation_user_email_exists"`, - `"password":{"code":"validation_length_out_of_range"`, - `"passwordConfirm":{"code":"validation_values_mismatch"`, - }, - }, - { - Name: "valid data but with disabled email/pass auth", - Method: http.MethodPost, - Url: "/api/users", - Body: strings.NewReader(`{"email":"newuser@example.com","password":"123456789","passwordConfirm":"123456789"}`), - BeforeTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - app.Settings().EmailAuth.Enabled = false - }, - ExpectedStatus: 400, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "valid data", - Method: http.MethodPost, - Url: "/api/users", - Body: strings.NewReader(`{"email":"newuser@example.com","password":"123456789","passwordConfirm":"123456789"}`), - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":`, - `"email":"newuser@example.com"`, - }, - ExpectedEvents: map[string]int{ - "OnUserBeforeCreateRequest": 1, - "OnUserAfterCreateRequest": 1, - "OnModelBeforeCreate": 2, // +1 for the created profile record - "OnModelAfterCreate": 2, // +1 for the created profile record - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserUpdate(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "unauthorized", - Method: http.MethodPatch, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - Body: strings.NewReader(`{"email":"new@example.com"}`), - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as user (owner)", - Method: http.MethodPatch, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - Body: strings.NewReader(`{"email":"new@example.com"}`), - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin - invalid/missing user id", - Method: http.MethodPatch, - Url: "/api/users/invalid", - Body: strings.NewReader(``), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin - empty data", - Method: http.MethodPatch, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - Body: strings.NewReader(``), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"4d0197cc-2b4a-3f83-a26b-d77bc8423d3c"`, - `"email":"test@example.com"`, - }, - ExpectedEvents: map[string]int{ - "OnUserBeforeUpdateRequest": 1, - "OnUserAfterUpdateRequest": 1, - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - }, - }, - { - Name: "authorized as admin - invalid data", - Method: http.MethodPatch, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - Body: strings.NewReader(`{"email":"test2@example.com"}`), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 400, - ExpectedContent: []string{ - `"data":{`, - `"email":{"code":"validation_user_email_exists"`, - }, - }, - { - Name: "authorized as admin - valid data", - Method: http.MethodPatch, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - Body: strings.NewReader(`{"email":"new@example.com"}`), - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"4d0197cc-2b4a-3f83-a26b-d77bc8423d3c"`, - `"email":"new@example.com"`, - }, - ExpectedEvents: map[string]int{ - "OnUserBeforeUpdateRequest": 1, - "OnUserAfterUpdateRequest": 1, - "OnModelBeforeUpdate": 1, - "OnModelAfterUpdate": 1, - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserListExternalsAuths(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "unauthorized", - Method: http.MethodGet, - Url: "/api/users/cx9u0dh2udo8xol/external-auths", - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin + nonexisting user id", - Method: http.MethodGet, - Url: "/api/users/000000000000000/external-auths", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin + existing user id and no external auths", - Method: http.MethodGet, - Url: "/api/users/97cc3d3d-6ba2-383f-b42a-7bc84d27410c/external-auths", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `[]`, - }, - ExpectedEvents: map[string]int{"OnUserListExternalAuths": 1}, - }, - { - Name: "authorized as admin + existing user id and 2 external auths", - Method: http.MethodGet, - Url: "/api/users/cx9u0dh2udo8xol/external-auths", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"abcdefghijklmn1"`, - `"id":"abcdefghijklmn0"`, - `"userId":"cx9u0dh2udo8xol"`, - }, - ExpectedEvents: map[string]int{"OnUserListExternalAuths": 1}, - }, - { - Name: "authorized as user - trying to list another user external auths", - Method: http.MethodGet, - Url: "/api/users/cx9u0dh2udo8xol/external-auths", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as user - owner without external auths", - Method: http.MethodGet, - Url: "/api/users/4d0197cc-2b4a-3f83-a26b-d77bc8423d3c/external-auths", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `[]`, - }, - ExpectedEvents: map[string]int{"OnUserListExternalAuths": 1}, - }, - { - Name: "authorized as user - owner with 2 external auths", - Method: http.MethodGet, - Url: "/api/users/cx9u0dh2udo8xol/external-auths", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImN4OXUwZGgydWRvOHhvbCIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.NgFYG2D7PftFW1tcfe5E2oDi_AVakDR9J6WI6VUZQfw", - }, - ExpectedStatus: 200, - ExpectedContent: []string{ - `"id":"abcdefghijklmn1"`, - `"id":"abcdefghijklmn0"`, - `"userId":"cx9u0dh2udo8xol"`, - }, - ExpectedEvents: map[string]int{"OnUserListExternalAuths": 1}, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} - -func TestUserUnlinkExternalsAuth(t *testing.T) { - scenarios := []tests.ApiScenario{ - { - Name: "unauthorized", - Method: http.MethodDelete, - Url: "/api/users/cx9u0dh2udo8xol/external-auths/google", - ExpectedStatus: 401, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin - nonexisting user id", - Method: http.MethodDelete, - Url: "/api/users/000000000000000/external-auths/google", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin - nonexisting provider", - Method: http.MethodDelete, - Url: "/api/users/cx9u0dh2udo8xol/external-auths/facebook", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 404, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as admin - existing provider", - Method: http.MethodDelete, - Url: "/api/users/cx9u0dh2udo8xol/external-auths/google", - RequestHeaders: map[string]string{ - "Authorization": "Admin eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - }, - ExpectedStatus: 204, - ExpectedContent: []string{}, - ExpectedEvents: map[string]int{ - "OnModelAfterDelete": 1, - "OnModelBeforeDelete": 1, - "OnUserAfterUnlinkExternalAuthRequest": 1, - "OnUserBeforeUnlinkExternalAuthRequest": 1, - }, - AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - auth, _ := app.Dao().FindExternalAuthByUserIdAndProvider("cx9u0dh2udo8xol", "google") - if auth != nil { - t.Fatalf("Expected the google ExternalAuth to be deleted, got got \n%v", auth) - } - }, - }, - { - Name: "authorized as user - trying to unlink another user external auth", - Method: http.MethodDelete, - Url: "/api/users/cx9u0dh2udo8xol/external-auths/google", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - }, - ExpectedStatus: 403, - ExpectedContent: []string{`"data":{}`}, - }, - { - Name: "authorized as user - owner with existing external auth", - Method: http.MethodDelete, - Url: "/api/users/cx9u0dh2udo8xol/external-auths/google", - RequestHeaders: map[string]string{ - "Authorization": "User eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImN4OXUwZGgydWRvOHhvbCIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.NgFYG2D7PftFW1tcfe5E2oDi_AVakDR9J6WI6VUZQfw", - }, - ExpectedStatus: 204, - ExpectedContent: []string{}, - ExpectedEvents: map[string]int{ - "OnModelAfterDelete": 1, - "OnModelBeforeDelete": 1, - "OnUserAfterUnlinkExternalAuthRequest": 1, - "OnUserBeforeUnlinkExternalAuthRequest": 1, - }, - AfterTestFunc: func(t *testing.T, app *tests.TestApp, e *echo.Echo) { - auth, _ := app.Dao().FindExternalAuthByUserIdAndProvider("cx9u0dh2udo8xol", "google") - if auth != nil { - t.Fatalf("Expected the google ExternalAuth to be deleted, got got \n%v", auth) - } - }, - }, - } - - for _, scenario := range scenarios { - scenario.Test(t) - } -} diff --git a/cmd/temp_upgrade.go b/cmd/temp_upgrade.go new file mode 100644 index 000000000..127e16822 --- /dev/null +++ b/cmd/temp_upgrade.go @@ -0,0 +1,444 @@ +package cmd + +import ( + "errors" + "fmt" + "regexp" + "strings" + + "github.com/fatih/color" + "github.com/pocketbase/dbx" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/models/schema" + "github.com/pocketbase/pocketbase/tools/types" + "github.com/spf13/cobra" +) + +// Temporary console command to update the pb_data structure to be compatible with the v0.8.0 changes. +// +// NB! It will be removed in v0.9.0! +func NewTempUpgradeCommand(app core.App) *cobra.Command { + command := &cobra.Command{ + Use: "upgrade", + Short: "Upgrades your existing pb_data to be compatible with the v0.8.x changes", + Long: ` +Upgrades your existing pb_data to be compatible with the v0.8.x changes +Prerequisites and caveats: +- already upgraded to v0.7.* +- no existing users collection +- existing profiles collection fields like email, username, verified, etc. will be renamed to username2, email2, etc. +`, + Run: func(command *cobra.Command, args []string) { + if err := upgrade(app); err != nil { + color.Red("Error: %v", err) + } + }, + } + + return command +} + +func upgrade(app core.App) error { + if _, err := app.Dao().FindCollectionByNameOrId("users"); err == nil { + return errors.New("It seems that you've already upgraded or have an existing 'users' collection.") + } + + return app.Dao().RunInTransaction(func(txDao *daos.Dao) error { + if err := migrateCollections(txDao); err != nil { + return err + } + + if err := migrateUsers(app, txDao); err != nil { + return err + } + + if err := resetMigrationsTable(txDao); err != nil { + return err + } + + bold := color.New(color.Bold).Add(color.FgGreen) + bold.Println("The pb_data upgrade completed successfully!") + bold.Println("You can now start the application as usual with the 'serve' command.") + bold.Println("Please review the migrated collection API rules and fields in the Admin UI and apply the necessary changes in your client-side code.") + fmt.Println() + + return nil + }) +} + +// ------------------------------------------------------------------- + +func migrateCollections(txDao *daos.Dao) error { + // add new collection columns + if _, err := txDao.DB().AddColumn("_collections", "type", "TEXT DEFAULT 'base' NOT NULL").Execute(); err != nil { + return err + } + if _, err := txDao.DB().AddColumn("_collections", "options", "JSON DEFAULT '{}' NOT NULL").Execute(); err != nil { + return err + } + + ruleReplacements := []struct { + old string + new string + }{ + {"expand", "expand2"}, + {"collecitonId", "collectionId2"}, + {"collecitonName", "collectionName2"}, + {"profile.userId", "profile.id"}, + + // @collection.* + {"@collection.profiles.userId", "@collection.users.id"}, + {"@collection.profiles.username", "@collection.users.username2"}, + {"@collection.profiles.email", "@collection.users.email2"}, + {"@collection.profiles.emailVisibility", "@collection.users.emailVisibility2"}, + {"@collection.profiles.verified", "@collection.users.verified2"}, + {"@collection.profiles.tokenKey", "@collection.users.tokenKey2"}, + {"@collection.profiles.passwordHash", "@collection.users.passwordHash2"}, + {"@collection.profiles.lastResetSentAt", "@collection.users.lastResetSentAt2"}, + {"@collection.profiles.lastVerificationSentAt", "@collection.users.lastVerificationSentAt2"}, + {"@collection.profiles.", "@collection.users."}, + + // @request.* + {"@request.user.profile.userId", "@request.auth.id"}, + {"@request.user.profile.username", "@request.auth.username2"}, + {"@request.user.profile.email", "@request.auth.email2"}, + {"@request.user.profile.emailVisibility", "@request.auth.emailVisibility2"}, + {"@request.user.profile.verified", "@request.auth.verified2"}, + {"@request.user.profile.tokenKey", "@request.auth.tokenKey2"}, + {"@request.user.profile.passwordHash", "@request.auth.passwordHash2"}, + {"@request.user.profile.lastResetSentAt", "@request.auth.lastResetSentAt2"}, + {"@request.user.profile.lastVerificationSentAt", "@request.auth.lastVerificationSentAt2"}, + {"@request.user.profile.", "@request.auth."}, + {"@request.user", "@request.auth"}, + } + + collections := []*models.Collection{} + if err := txDao.CollectionQuery().All(&collections); err != nil { + return err + } + + for _, collection := range collections { + collection.Type = models.CollectionTypeBase + collection.NormalizeOptions() + + // rename profile fields + // --- + fieldsToRename := []string{ + "collectionId", + "collectionName", + "expand", + } + if collection.Name == "profiles" { + fieldsToRename = append(fieldsToRename, + "username", + "email", + "emailVisibility", + "verified", + "tokenKey", + "passwordHash", + "lastResetSentAt", + "lastVerificationSentAt", + ) + } + for _, name := range fieldsToRename { + f := collection.Schema.GetFieldByName(name) + if f != nil { + color.Blue("[%s - renamed field]", collection.Name) + color.Yellow(" - old: %s", f.Name) + color.Green(" - new: %s2", f.Name) + fmt.Println() + f.Name += "2" + } + } + // --- + + // replace rule fields + // --- + rules := map[string]*string{ + "ListRule": collection.ListRule, + "ViewRule": collection.ViewRule, + "CreateRule": collection.CreateRule, + "UpdateRule": collection.UpdateRule, + "DeleteRule": collection.DeleteRule, + } + + for ruleKey, rule := range rules { + if rule == nil || *rule == "" { + continue + } + + originalRule := *rule + + for _, replacement := range ruleReplacements { + re := regexp.MustCompile(regexp.QuoteMeta(replacement.old) + `\b`) + *rule = re.ReplaceAllString(*rule, replacement.new) + } + + *rule = replaceReversedLikes(*rule) + + if originalRule != *rule { + color.Blue("[%s - replaced %s]:", collection.Name, ruleKey) + color.Yellow(" - old: %s", strings.TrimSpace(originalRule)) + color.Green(" - new: %s", strings.TrimSpace(*rule)) + fmt.Println() + } + } + // --- + + if err := txDao.SaveCollection(collection); err != nil { + return err + } + } + + return nil +} + +func migrateUsers(app core.App, txDao *daos.Dao) error { + color.Blue(`[merging "_users" and "profiles"]:`) + + profilesCollection, err := txDao.FindCollectionByNameOrId("profiles") + if err != nil { + return err + } + + originalProfilesCollectionId := profilesCollection.Id + + // change the profiles collection id to something else since we will be using + // it for the new users collection in order to avoid renaming the storage dir + _, idRenameErr := txDao.DB().NewQuery(fmt.Sprintf( + `UPDATE {{_collections}} + SET id = '%s' + WHERE id = '%s'; + `, + (originalProfilesCollectionId + "__old__"), + originalProfilesCollectionId, + )).Execute() + if idRenameErr != nil { + return idRenameErr + } + + // refresh profiles collection + profilesCollection, err = txDao.FindCollectionByNameOrId("profiles") + if err != nil { + return err + } + + usersSchema, _ := profilesCollection.Schema.Clone() + userIdField := usersSchema.GetFieldByName("userId") + if userIdField != nil { + usersSchema.RemoveField(userIdField.Id) + } + + usersCollection := &models.Collection{} + usersCollection.MarkAsNew() + usersCollection.Id = originalProfilesCollectionId + usersCollection.Name = "users" + usersCollection.Type = models.CollectionTypeAuth + usersCollection.Schema = *usersSchema + usersCollection.CreateRule = types.Pointer("") + if profilesCollection.ListRule != nil && *profilesCollection.ListRule != "" { + *profilesCollection.ListRule = strings.ReplaceAll(*profilesCollection.ListRule, "userId", "id") + usersCollection.ListRule = profilesCollection.ListRule + } + if profilesCollection.ViewRule != nil && *profilesCollection.ViewRule != "" { + *profilesCollection.ViewRule = strings.ReplaceAll(*profilesCollection.ViewRule, "userId", "id") + usersCollection.ViewRule = profilesCollection.ViewRule + } + if profilesCollection.UpdateRule != nil && *profilesCollection.UpdateRule != "" { + *profilesCollection.UpdateRule = strings.ReplaceAll(*profilesCollection.UpdateRule, "userId", "id") + usersCollection.UpdateRule = profilesCollection.UpdateRule + } + if profilesCollection.DeleteRule != nil && *profilesCollection.DeleteRule != "" { + *profilesCollection.DeleteRule = strings.ReplaceAll(*profilesCollection.DeleteRule, "userId", "id") + usersCollection.DeleteRule = profilesCollection.DeleteRule + } + + // set auth options + settings := app.Settings() + authOptions := usersCollection.AuthOptions() + authOptions.ManageRule = nil + authOptions.AllowOAuth2Auth = true + authOptions.AllowUsernameAuth = false + authOptions.AllowEmailAuth = settings.EmailAuth.Enabled + authOptions.MinPasswordLength = settings.EmailAuth.MinPasswordLength + authOptions.OnlyEmailDomains = settings.EmailAuth.OnlyDomains + authOptions.ExceptEmailDomains = settings.EmailAuth.ExceptDomains + // twitter currently is the only provider that doesn't return an email + authOptions.RequireEmail = !settings.TwitterAuth.Enabled + + usersCollection.SetOptions(authOptions) + + if err := txDao.SaveCollection(usersCollection); err != nil { + return err + } + + // copy the original users + _, usersErr := txDao.DB().NewQuery(` + INSERT INTO {{users}} (id, created, updated, username, email, emailVisibility, verified, tokenKey, passwordHash, lastResetSentAt, lastVerificationSentAt) + SELECT id, created, updated, ("u_" || id), email, false, verified, tokenKey, passwordHash, lastResetSentAt, lastVerificationSentAt + FROM {{_users}}; + `).Execute() + if usersErr != nil { + return usersErr + } + + // generate the profile fields copy statements + sets := []string{"id = p.id"} + for _, f := range usersSchema.Fields() { + sets = append(sets, fmt.Sprintf("%s = p.%s", f.Name, f.Name)) + } + + // copy profile fields + _, copyProfileErr := txDao.DB().NewQuery(fmt.Sprintf(` + UPDATE {{users}} as u + SET %s + FROM {{profiles}} as p + WHERE u.id = p.userId; + `, strings.Join(sets, ", "))).Execute() + if copyProfileErr != nil { + return copyProfileErr + } + + profileRecords, err := txDao.FindRecordsByExpr("profiles") + if err != nil { + return err + } + + // update all profiles and users fields to point to the new users collection + collections := []*models.Collection{} + if err := txDao.CollectionQuery().All(&collections); err != nil { + return err + } + for _, collection := range collections { + var hasChanges bool + + for _, f := range collection.Schema.Fields() { + f.InitOptions() + + if f.Type == schema.FieldTypeUser { + if collection.Name == "profiles" && f.Name == "userId" { + continue + } + + hasChanges = true + + // change the user field to a relation field + options, _ := f.Options.(*schema.UserOptions) + f.Type = schema.FieldTypeRelation + f.Options = &schema.RelationOptions{ + CollectionId: usersCollection.Id, + MaxSelect: &options.MaxSelect, + CascadeDelete: options.CascadeDelete, + } + + for _, p := range profileRecords { + pId := p.Id + pUserId := p.GetString("userId") + // replace all user record id references with the profile id + _, replaceErr := txDao.DB().NewQuery(fmt.Sprintf(` + UPDATE %s + SET [[%s]] = REPLACE([[%s]], '%s', '%s') + WHERE [[%s]] LIKE ('%%%s%%'); + `, collection.Name, f.Name, f.Name, pUserId, pId, f.Name, pUserId)).Execute() + if replaceErr != nil { + return replaceErr + } + } + } + } + + if hasChanges { + if err := txDao.Save(collection); err != nil { + return err + } + } + } + + if err := migrateExternalAuths(txDao, originalProfilesCollectionId); err != nil { + return err + } + + // drop _users table + if _, err := txDao.DB().DropTable("_users").Execute(); err != nil { + return err + } + + // drop profiles table + if _, err := txDao.DB().DropTable("profiles").Execute(); err != nil { + return err + } + + // delete profiles collection + if err := txDao.Delete(profilesCollection); err != nil { + return err + } + + color.Green(` - Successfully merged "_users" and "profiles" into a new collection "users".`) + fmt.Println() + + return nil +} + +func migrateExternalAuths(txDao *daos.Dao, userCollectionId string) error { + _, alterErr := txDao.DB().NewQuery(` + -- crate new externalAuths table + CREATE TABLE {{_newExternalAuths}} ( + [[id]] TEXT PRIMARY KEY, + [[collectionId]] TEXT NOT NULL, + [[recordId]] TEXT NOT NULL, + [[provider]] TEXT NOT NULL, + [[providerId]] TEXT NOT NULL, + [[created]] TEXT DEFAULT "" NOT NULL, + [[updated]] TEXT DEFAULT "" NOT NULL, + --- + FOREIGN KEY ([[collectionId]]) REFERENCES {{_collections}} ([[id]]) ON UPDATE CASCADE ON DELETE CASCADE + ); + + -- copy all data from the old table to the new one + INSERT INTO {{_newExternalAuths}} + SELECT auth.id, "` + userCollectionId + `" as collectionId, [[profiles.id]] as recordId, auth.provider, auth.providerId, auth.created, auth.updated + FROM {{_externalAuths}} auth + INNER JOIN {{profiles}} on [[profiles.userId]] = [[auth.userId]]; + + -- drop old table + DROP TABLE {{_externalAuths}}; + + -- rename new table + ALTER TABLE {{_newExternalAuths}} RENAME TO {{_externalAuths}}; + + -- create named indexes + CREATE UNIQUE INDEX _externalAuths_record_provider_idx on {{_externalAuths}} ([[collectionId]], [[recordId]], [[provider]]); + CREATE UNIQUE INDEX _externalAuths_provider_providerId_idx on {{_externalAuths}} ([[provider]], [[providerId]]); + `).Execute() + + return alterErr +} + +func resetMigrationsTable(txDao *daos.Dao) error { + // reset the migration state to the new init + _, err := txDao.DB().Delete("_migrations", dbx.HashExp{ + "file": "1661586591_add_externalAuths_table.go", + }).Execute() + + return err +} + +var reverseLikeRegex = regexp.MustCompile(`(['"]\w*['"])\s*(\~|!~)\s*([\w\@\.]*)`) + +func replaceReversedLikes(rule string) string { + parts := reverseLikeRegex.FindAllStringSubmatch(rule, -1) + + for _, p := range parts { + if len(p) != 4 { + continue + } + + newPart := fmt.Sprintf("%s %s %s", p[3], p[2], p[1]) + + rule = strings.ReplaceAll(rule, p[0], newPart) + } + + return rule +} diff --git a/core/app.go b/core/app.go index 8e0ea52c9..75dde9ed2 100644 --- a/core/app.go +++ b/core/app.go @@ -126,38 +126,38 @@ type App interface { // admin password reset email was successfully sent. OnMailerAfterAdminResetPasswordSend() *hook.Hook[*MailerAdminEvent] - // OnMailerBeforeUserResetPasswordSend hook is triggered right before - // sending a password reset email to a user. + // OnMailerBeforeRecordResetPasswordSend hook is triggered right before + // sending a password reset email to an auth record. // // Could be used to send your own custom email template if // [hook.StopPropagation] is returned in one of its listeners. - OnMailerBeforeUserResetPasswordSend() *hook.Hook[*MailerUserEvent] + OnMailerBeforeRecordResetPasswordSend() *hook.Hook[*MailerRecordEvent] - // OnMailerAfterUserResetPasswordSend hook is triggered after - // a user password reset email was successfully sent. - OnMailerAfterUserResetPasswordSend() *hook.Hook[*MailerUserEvent] + // OnMailerAfterRecordResetPasswordSend hook is triggered after + // an auth record password reset email was successfully sent. + OnMailerAfterRecordResetPasswordSend() *hook.Hook[*MailerRecordEvent] - // OnMailerBeforeUserVerificationSend hook is triggered right before - // sending a verification email to a user. + // OnMailerBeforeRecordVerificationSend hook is triggered right before + // sending a verification email to an auth record. // // Could be used to send your own custom email template if // [hook.StopPropagation] is returned in one of its listeners. - OnMailerBeforeUserVerificationSend() *hook.Hook[*MailerUserEvent] + OnMailerBeforeRecordVerificationSend() *hook.Hook[*MailerRecordEvent] - // OnMailerAfterUserVerificationSend hook is triggered after a user - // verification email was successfully sent. - OnMailerAfterUserVerificationSend() *hook.Hook[*MailerUserEvent] + // OnMailerAfterRecordVerificationSend hook is triggered after a + // verification email was successfully sent to an auth record. + OnMailerAfterRecordVerificationSend() *hook.Hook[*MailerRecordEvent] - // OnMailerBeforeUserChangeEmailSend hook is triggered right before - // sending a confirmation new address email to a a user. + // OnMailerBeforeRecordChangeEmailSend hook is triggered right before + // sending a confirmation new address email to an auth record. // // Could be used to send your own custom email template if // [hook.StopPropagation] is returned in one of its listeners. - OnMailerBeforeUserChangeEmailSend() *hook.Hook[*MailerUserEvent] + OnMailerBeforeRecordChangeEmailSend() *hook.Hook[*MailerRecordEvent] - // OnMailerAfterUserChangeEmailSend hook is triggered after a user - // change address email was successfully sent. - OnMailerAfterUserChangeEmailSend() *hook.Hook[*MailerUserEvent] + // OnMailerAfterRecordChangeEmailSend hook is triggered after a + // verification email was successfully sent to an auth record. + OnMailerAfterRecordChangeEmailSend() *hook.Hook[*MailerRecordEvent] // --------------------------------------------------------------- // Realtime API event hooks @@ -264,74 +264,31 @@ type App interface { OnAdminAuthRequest() *hook.Hook[*AdminAuthEvent] // --------------------------------------------------------------- - // User API event hooks + // Auth Record API event hooks // --------------------------------------------------------------- - // OnUsersListRequest hook is triggered on each API Users list request. + // OnRecordAuthRequest hook is triggered on each successful API + // record authentication request (sign-in, token refresh, etc.). // - // Could be used to validate or modify the response before returning it to the client. - OnUsersListRequest() *hook.Hook[*UsersListEvent] - - // OnUserViewRequest hook is triggered on each API User view request. - // - // Could be used to validate or modify the response before returning it to the client. - OnUserViewRequest() *hook.Hook[*UserViewEvent] - - // OnUserBeforeCreateRequest hook is triggered before each API User - // create request (after request data load and before model persistence). - // - // Could be used to additionally validate the request data or implement - // completely different persistence behavior (returning [hook.StopPropagation]). - OnUserBeforeCreateRequest() *hook.Hook[*UserCreateEvent] - - // OnUserAfterCreateRequest hook is triggered after each - // successful API User create request. - OnUserAfterCreateRequest() *hook.Hook[*UserCreateEvent] - - // OnUserBeforeUpdateRequest hook is triggered before each API User - // update request (after request data load and before model persistence). - // - // Could be used to additionally validate the request data or implement - // completely different persistence behavior (returning [hook.StopPropagation]). - OnUserBeforeUpdateRequest() *hook.Hook[*UserUpdateEvent] - - // OnUserAfterUpdateRequest hook is triggered after each - // successful API User update request. - OnUserAfterUpdateRequest() *hook.Hook[*UserUpdateEvent] - - // OnUserBeforeDeleteRequest hook is triggered before each API User - // delete request (after model load and before actual deletion). - // - // Could be used to additionally validate the request data or implement - // completely different delete behavior (returning [hook.StopPropagation]). - OnUserBeforeDeleteRequest() *hook.Hook[*UserDeleteEvent] - - // OnUserAfterDeleteRequest hook is triggered after each - // successful API User delete request. - OnUserAfterDeleteRequest() *hook.Hook[*UserDeleteEvent] - - // OnUserAuthRequest hook is triggered on each successful API User - // authentication request (sign-in, token refresh, etc.). - // - // Could be used to additionally validate or modify the - // authenticated user data and token. - OnUserAuthRequest() *hook.Hook[*UserAuthEvent] + // Could be used to additionally validate or modify the authenticated + // record data and token. + OnRecordAuthRequest() *hook.Hook[*RecordAuthEvent] - // OnUserListExternalAuths hook is triggered on each API user's external auths list request. + // OnRecordListExternalAuths hook is triggered on each API record external auths list request. // // Could be used to validate or modify the response before returning it to the client. - OnUserListExternalAuths() *hook.Hook[*UserListExternalAuthsEvent] + OnRecordListExternalAuths() *hook.Hook[*RecordListExternalAuthsEvent] - // OnUserBeforeUnlinkExternalAuthRequest hook is triggered before each API user's + // OnRecordBeforeUnlinkExternalAuthRequest hook is triggered before each API record // external auth unlink request (after models load and before the actual relation deletion). // // Could be used to additionally validate the request data or implement // completely different delete behavior (returning [hook.StopPropagation]). - OnUserBeforeUnlinkExternalAuthRequest() *hook.Hook[*UserUnlinkExternalAuthEvent] + OnRecordBeforeUnlinkExternalAuthRequest() *hook.Hook[*RecordUnlinkExternalAuthEvent] - // OnUserAfterUnlinkExternalAuthRequest hook is triggered after each - // successful API user's external auth unlink request. - OnUserAfterUnlinkExternalAuthRequest() *hook.Hook[*UserUnlinkExternalAuthEvent] + // OnRecordAfterUnlinkExternalAuthRequest hook is triggered after each + // successful API record external auth unlink request. + OnRecordAfterUnlinkExternalAuthRequest() *hook.Hook[*RecordUnlinkExternalAuthEvent] // --------------------------------------------------------------- // Record API event hooks diff --git a/core/base.go b/core/base.go index 708fe9654..5369ef92e 100644 --- a/core/base.go +++ b/core/base.go @@ -52,14 +52,14 @@ type BaseApp struct { onModelAfterDelete *hook.Hook[*ModelEvent] // mailer event hooks - onMailerBeforeAdminResetPasswordSend *hook.Hook[*MailerAdminEvent] - onMailerAfterAdminResetPasswordSend *hook.Hook[*MailerAdminEvent] - onMailerBeforeUserResetPasswordSend *hook.Hook[*MailerUserEvent] - onMailerAfterUserResetPasswordSend *hook.Hook[*MailerUserEvent] - onMailerBeforeUserVerificationSend *hook.Hook[*MailerUserEvent] - onMailerAfterUserVerificationSend *hook.Hook[*MailerUserEvent] - onMailerBeforeUserChangeEmailSend *hook.Hook[*MailerUserEvent] - onMailerAfterUserChangeEmailSend *hook.Hook[*MailerUserEvent] + onMailerBeforeAdminResetPasswordSend *hook.Hook[*MailerAdminEvent] + onMailerAfterAdminResetPasswordSend *hook.Hook[*MailerAdminEvent] + onMailerBeforeRecordResetPasswordSend *hook.Hook[*MailerRecordEvent] + onMailerAfterRecordResetPasswordSend *hook.Hook[*MailerRecordEvent] + onMailerBeforeRecordVerificationSend *hook.Hook[*MailerRecordEvent] + onMailerAfterRecordVerificationSend *hook.Hook[*MailerRecordEvent] + onMailerBeforeRecordChangeEmailSend *hook.Hook[*MailerRecordEvent] + onMailerAfterRecordChangeEmailSend *hook.Hook[*MailerRecordEvent] // realtime api event hooks onRealtimeConnectRequest *hook.Hook[*RealtimeConnectEvent] @@ -85,19 +85,11 @@ type BaseApp struct { onAdminAfterDeleteRequest *hook.Hook[*AdminDeleteEvent] onAdminAuthRequest *hook.Hook[*AdminAuthEvent] - // user api event hooks - onUsersListRequest *hook.Hook[*UsersListEvent] - onUserViewRequest *hook.Hook[*UserViewEvent] - onUserBeforeCreateRequest *hook.Hook[*UserCreateEvent] - onUserAfterCreateRequest *hook.Hook[*UserCreateEvent] - onUserBeforeUpdateRequest *hook.Hook[*UserUpdateEvent] - onUserAfterUpdateRequest *hook.Hook[*UserUpdateEvent] - onUserBeforeDeleteRequest *hook.Hook[*UserDeleteEvent] - onUserAfterDeleteRequest *hook.Hook[*UserDeleteEvent] - onUserAuthRequest *hook.Hook[*UserAuthEvent] - onUserListExternalAuths *hook.Hook[*UserListExternalAuthsEvent] - onUserBeforeUnlinkExternalAuthRequest *hook.Hook[*UserUnlinkExternalAuthEvent] - onUserAfterUnlinkExternalAuthRequest *hook.Hook[*UserUnlinkExternalAuthEvent] + // user api event hooks + onRecordAuthRequest *hook.Hook[*RecordAuthEvent] + onRecordListExternalAuths *hook.Hook[*RecordListExternalAuthsEvent] + onRecordBeforeUnlinkExternalAuthRequest *hook.Hook[*RecordUnlinkExternalAuthEvent] + onRecordAfterUnlinkExternalAuthRequest *hook.Hook[*RecordUnlinkExternalAuthEvent] // record api event hooks onRecordsListRequest *hook.Hook[*RecordsListEvent] @@ -147,14 +139,14 @@ func NewBaseApp(dataDir string, encryptionEnv string, isDebug bool) *BaseApp { onModelAfterDelete: &hook.Hook[*ModelEvent]{}, // mailer event hooks - onMailerBeforeAdminResetPasswordSend: &hook.Hook[*MailerAdminEvent]{}, - onMailerAfterAdminResetPasswordSend: &hook.Hook[*MailerAdminEvent]{}, - onMailerBeforeUserResetPasswordSend: &hook.Hook[*MailerUserEvent]{}, - onMailerAfterUserResetPasswordSend: &hook.Hook[*MailerUserEvent]{}, - onMailerBeforeUserVerificationSend: &hook.Hook[*MailerUserEvent]{}, - onMailerAfterUserVerificationSend: &hook.Hook[*MailerUserEvent]{}, - onMailerBeforeUserChangeEmailSend: &hook.Hook[*MailerUserEvent]{}, - onMailerAfterUserChangeEmailSend: &hook.Hook[*MailerUserEvent]{}, + onMailerBeforeAdminResetPasswordSend: &hook.Hook[*MailerAdminEvent]{}, + onMailerAfterAdminResetPasswordSend: &hook.Hook[*MailerAdminEvent]{}, + onMailerBeforeRecordResetPasswordSend: &hook.Hook[*MailerRecordEvent]{}, + onMailerAfterRecordResetPasswordSend: &hook.Hook[*MailerRecordEvent]{}, + onMailerBeforeRecordVerificationSend: &hook.Hook[*MailerRecordEvent]{}, + onMailerAfterRecordVerificationSend: &hook.Hook[*MailerRecordEvent]{}, + onMailerBeforeRecordChangeEmailSend: &hook.Hook[*MailerRecordEvent]{}, + onMailerAfterRecordChangeEmailSend: &hook.Hook[*MailerRecordEvent]{}, // realtime API event hooks onRealtimeConnectRequest: &hook.Hook[*RealtimeConnectEvent]{}, @@ -181,18 +173,10 @@ func NewBaseApp(dataDir string, encryptionEnv string, isDebug bool) *BaseApp { onAdminAuthRequest: &hook.Hook[*AdminAuthEvent]{}, // user API event hooks - onUsersListRequest: &hook.Hook[*UsersListEvent]{}, - onUserViewRequest: &hook.Hook[*UserViewEvent]{}, - onUserBeforeCreateRequest: &hook.Hook[*UserCreateEvent]{}, - onUserAfterCreateRequest: &hook.Hook[*UserCreateEvent]{}, - onUserBeforeUpdateRequest: &hook.Hook[*UserUpdateEvent]{}, - onUserAfterUpdateRequest: &hook.Hook[*UserUpdateEvent]{}, - onUserBeforeDeleteRequest: &hook.Hook[*UserDeleteEvent]{}, - onUserAfterDeleteRequest: &hook.Hook[*UserDeleteEvent]{}, - onUserAuthRequest: &hook.Hook[*UserAuthEvent]{}, - onUserListExternalAuths: &hook.Hook[*UserListExternalAuthsEvent]{}, - onUserBeforeUnlinkExternalAuthRequest: &hook.Hook[*UserUnlinkExternalAuthEvent]{}, - onUserAfterUnlinkExternalAuthRequest: &hook.Hook[*UserUnlinkExternalAuthEvent]{}, + onRecordAuthRequest: &hook.Hook[*RecordAuthEvent]{}, + onRecordListExternalAuths: &hook.Hook[*RecordListExternalAuthsEvent]{}, + onRecordBeforeUnlinkExternalAuthRequest: &hook.Hook[*RecordUnlinkExternalAuthEvent]{}, + onRecordAfterUnlinkExternalAuthRequest: &hook.Hook[*RecordUnlinkExternalAuthEvent]{}, // record API event hooks onRecordsListRequest: &hook.Hook[*RecordsListEvent]{}, @@ -469,28 +453,28 @@ func (app *BaseApp) OnMailerAfterAdminResetPasswordSend() *hook.Hook[*MailerAdmi return app.onMailerAfterAdminResetPasswordSend } -func (app *BaseApp) OnMailerBeforeUserResetPasswordSend() *hook.Hook[*MailerUserEvent] { - return app.onMailerBeforeUserResetPasswordSend +func (app *BaseApp) OnMailerBeforeRecordResetPasswordSend() *hook.Hook[*MailerRecordEvent] { + return app.onMailerBeforeRecordResetPasswordSend } -func (app *BaseApp) OnMailerAfterUserResetPasswordSend() *hook.Hook[*MailerUserEvent] { - return app.onMailerAfterUserResetPasswordSend +func (app *BaseApp) OnMailerAfterRecordResetPasswordSend() *hook.Hook[*MailerRecordEvent] { + return app.onMailerAfterRecordResetPasswordSend } -func (app *BaseApp) OnMailerBeforeUserVerificationSend() *hook.Hook[*MailerUserEvent] { - return app.onMailerBeforeUserVerificationSend +func (app *BaseApp) OnMailerBeforeRecordVerificationSend() *hook.Hook[*MailerRecordEvent] { + return app.onMailerBeforeRecordVerificationSend } -func (app *BaseApp) OnMailerAfterUserVerificationSend() *hook.Hook[*MailerUserEvent] { - return app.onMailerAfterUserVerificationSend +func (app *BaseApp) OnMailerAfterRecordVerificationSend() *hook.Hook[*MailerRecordEvent] { + return app.onMailerAfterRecordVerificationSend } -func (app *BaseApp) OnMailerBeforeUserChangeEmailSend() *hook.Hook[*MailerUserEvent] { - return app.onMailerBeforeUserChangeEmailSend +func (app *BaseApp) OnMailerBeforeRecordChangeEmailSend() *hook.Hook[*MailerRecordEvent] { + return app.onMailerBeforeRecordChangeEmailSend } -func (app *BaseApp) OnMailerAfterUserChangeEmailSend() *hook.Hook[*MailerUserEvent] { - return app.onMailerAfterUserChangeEmailSend +func (app *BaseApp) OnMailerAfterRecordChangeEmailSend() *hook.Hook[*MailerRecordEvent] { + return app.onMailerAfterRecordChangeEmailSend } // ------------------------------------------------------------------- @@ -574,55 +558,23 @@ func (app *BaseApp) OnAdminAuthRequest() *hook.Hook[*AdminAuthEvent] { } // ------------------------------------------------------------------- -// User API event hooks +// Auth Record API event hooks // ------------------------------------------------------------------- -func (app *BaseApp) OnUsersListRequest() *hook.Hook[*UsersListEvent] { - return app.onUsersListRequest +func (app *BaseApp) OnRecordAuthRequest() *hook.Hook[*RecordAuthEvent] { + return app.onRecordAuthRequest } -func (app *BaseApp) OnUserViewRequest() *hook.Hook[*UserViewEvent] { - return app.onUserViewRequest +func (app *BaseApp) OnRecordListExternalAuths() *hook.Hook[*RecordListExternalAuthsEvent] { + return app.onRecordListExternalAuths } -func (app *BaseApp) OnUserBeforeCreateRequest() *hook.Hook[*UserCreateEvent] { - return app.onUserBeforeCreateRequest +func (app *BaseApp) OnRecordBeforeUnlinkExternalAuthRequest() *hook.Hook[*RecordUnlinkExternalAuthEvent] { + return app.onRecordBeforeUnlinkExternalAuthRequest } -func (app *BaseApp) OnUserAfterCreateRequest() *hook.Hook[*UserCreateEvent] { - return app.onUserAfterCreateRequest -} - -func (app *BaseApp) OnUserBeforeUpdateRequest() *hook.Hook[*UserUpdateEvent] { - return app.onUserBeforeUpdateRequest -} - -func (app *BaseApp) OnUserAfterUpdateRequest() *hook.Hook[*UserUpdateEvent] { - return app.onUserAfterUpdateRequest -} - -func (app *BaseApp) OnUserBeforeDeleteRequest() *hook.Hook[*UserDeleteEvent] { - return app.onUserBeforeDeleteRequest -} - -func (app *BaseApp) OnUserAfterDeleteRequest() *hook.Hook[*UserDeleteEvent] { - return app.onUserAfterDeleteRequest -} - -func (app *BaseApp) OnUserAuthRequest() *hook.Hook[*UserAuthEvent] { - return app.onUserAuthRequest -} - -func (app *BaseApp) OnUserListExternalAuths() *hook.Hook[*UserListExternalAuthsEvent] { - return app.onUserListExternalAuths -} - -func (app *BaseApp) OnUserBeforeUnlinkExternalAuthRequest() *hook.Hook[*UserUnlinkExternalAuthEvent] { - return app.onUserBeforeUnlinkExternalAuthRequest -} - -func (app *BaseApp) OnUserAfterUnlinkExternalAuthRequest() *hook.Hook[*UserUnlinkExternalAuthEvent] { - return app.onUserAfterUnlinkExternalAuthRequest +func (app *BaseApp) OnRecordAfterUnlinkExternalAuthRequest() *hook.Hook[*RecordUnlinkExternalAuthEvent] { + return app.onRecordAfterUnlinkExternalAuthRequest } // ------------------------------------------------------------------- diff --git a/core/base_test.go b/core/base_test.go index c09f66389..dfa042614 100644 --- a/core/base_test.go +++ b/core/base_test.go @@ -195,28 +195,28 @@ func TestBaseAppGetters(t *testing.T) { t.Fatalf("Getter app.OnMailerAfterAdminResetPasswordSend does not match or nil (%v vs %v)", app.OnMailerAfterAdminResetPasswordSend(), app.onMailerAfterAdminResetPasswordSend) } - if app.onMailerBeforeUserResetPasswordSend != app.OnMailerBeforeUserResetPasswordSend() || app.OnMailerBeforeUserResetPasswordSend() == nil { - t.Fatalf("Getter app.OnMailerBeforeUserResetPasswordSend does not match or nil (%v vs %v)", app.OnMailerBeforeUserResetPasswordSend(), app.onMailerBeforeUserResetPasswordSend) + if app.onMailerBeforeRecordResetPasswordSend != app.OnMailerBeforeRecordResetPasswordSend() || app.OnMailerBeforeRecordResetPasswordSend() == nil { + t.Fatalf("Getter app.OnMailerBeforeRecordResetPasswordSend does not match or nil (%v vs %v)", app.OnMailerBeforeRecordResetPasswordSend(), app.onMailerBeforeRecordResetPasswordSend) } - if app.onMailerAfterUserResetPasswordSend != app.OnMailerAfterUserResetPasswordSend() || app.OnMailerAfterUserResetPasswordSend() == nil { - t.Fatalf("Getter app.OnMailerAfterUserResetPasswordSend does not match or nil (%v vs %v)", app.OnMailerAfterUserResetPasswordSend(), app.onMailerAfterUserResetPasswordSend) + if app.onMailerAfterRecordResetPasswordSend != app.OnMailerAfterRecordResetPasswordSend() || app.OnMailerAfterRecordResetPasswordSend() == nil { + t.Fatalf("Getter app.OnMailerAfterRecordResetPasswordSend does not match or nil (%v vs %v)", app.OnMailerAfterRecordResetPasswordSend(), app.onMailerAfterRecordResetPasswordSend) } - if app.onMailerBeforeUserVerificationSend != app.OnMailerBeforeUserVerificationSend() || app.OnMailerBeforeUserVerificationSend() == nil { - t.Fatalf("Getter app.OnMailerBeforeUserVerificationSend does not match or nil (%v vs %v)", app.OnMailerBeforeUserVerificationSend(), app.onMailerBeforeUserVerificationSend) + if app.onMailerBeforeRecordVerificationSend != app.OnMailerBeforeRecordVerificationSend() || app.OnMailerBeforeRecordVerificationSend() == nil { + t.Fatalf("Getter app.OnMailerBeforeRecordVerificationSend does not match or nil (%v vs %v)", app.OnMailerBeforeRecordVerificationSend(), app.onMailerBeforeRecordVerificationSend) } - if app.onMailerAfterUserVerificationSend != app.OnMailerAfterUserVerificationSend() || app.OnMailerAfterUserVerificationSend() == nil { - t.Fatalf("Getter app.OnMailerAfterUserVerificationSend does not match or nil (%v vs %v)", app.OnMailerAfterUserVerificationSend(), app.onMailerAfterUserVerificationSend) + if app.onMailerAfterRecordVerificationSend != app.OnMailerAfterRecordVerificationSend() || app.OnMailerAfterRecordVerificationSend() == nil { + t.Fatalf("Getter app.OnMailerAfterRecordVerificationSend does not match or nil (%v vs %v)", app.OnMailerAfterRecordVerificationSend(), app.onMailerAfterRecordVerificationSend) } - if app.onMailerBeforeUserChangeEmailSend != app.OnMailerBeforeUserChangeEmailSend() || app.OnMailerBeforeUserChangeEmailSend() == nil { - t.Fatalf("Getter app.OnMailerBeforeUserChangeEmailSend does not match or nil (%v vs %v)", app.OnMailerBeforeUserChangeEmailSend(), app.onMailerBeforeUserChangeEmailSend) + if app.onMailerBeforeRecordChangeEmailSend != app.OnMailerBeforeRecordChangeEmailSend() || app.OnMailerBeforeRecordChangeEmailSend() == nil { + t.Fatalf("Getter app.OnMailerBeforeRecordChangeEmailSend does not match or nil (%v vs %v)", app.OnMailerBeforeRecordChangeEmailSend(), app.onMailerBeforeRecordChangeEmailSend) } - if app.onMailerAfterUserChangeEmailSend != app.OnMailerAfterUserChangeEmailSend() || app.OnMailerAfterUserChangeEmailSend() == nil { - t.Fatalf("Getter app.OnMailerAfterUserChangeEmailSend does not match or nil (%v vs %v)", app.OnMailerAfterUserChangeEmailSend(), app.onMailerAfterUserChangeEmailSend) + if app.onMailerAfterRecordChangeEmailSend != app.OnMailerAfterRecordChangeEmailSend() || app.OnMailerAfterRecordChangeEmailSend() == nil { + t.Fatalf("Getter app.OnMailerAfterRecordChangeEmailSend does not match or nil (%v vs %v)", app.OnMailerAfterRecordChangeEmailSend(), app.onMailerAfterRecordChangeEmailSend) } if app.onRealtimeConnectRequest != app.OnRealtimeConnectRequest() || app.OnRealtimeConnectRequest() == nil { @@ -283,52 +283,52 @@ func TestBaseAppGetters(t *testing.T) { t.Fatalf("Getter app.OnAdminAuthRequest does not match or nil (%v vs %v)", app.OnAdminAuthRequest(), app.onAdminAuthRequest) } - if app.onUsersListRequest != app.OnUsersListRequest() || app.OnUsersListRequest() == nil { - t.Fatalf("Getter app.OnUsersListRequest does not match or nil (%v vs %v)", app.OnUsersListRequest(), app.onUsersListRequest) + if app.onRecordsListRequest != app.OnRecordsListRequest() || app.OnRecordsListRequest() == nil { + t.Fatalf("Getter app.OnRecordsListRequest does not match or nil (%v vs %v)", app.OnRecordsListRequest(), app.onRecordsListRequest) } - if app.onUserViewRequest != app.OnUserViewRequest() || app.OnUserViewRequest() == nil { - t.Fatalf("Getter app.OnUserViewRequest does not match or nil (%v vs %v)", app.OnUserViewRequest(), app.onUserViewRequest) + if app.onRecordViewRequest != app.OnRecordViewRequest() || app.OnRecordViewRequest() == nil { + t.Fatalf("Getter app.OnRecordViewRequest does not match or nil (%v vs %v)", app.OnRecordViewRequest(), app.onRecordViewRequest) } - if app.onUserBeforeCreateRequest != app.OnUserBeforeCreateRequest() || app.OnUserBeforeCreateRequest() == nil { - t.Fatalf("Getter app.OnUserBeforeCreateRequest does not match or nil (%v vs %v)", app.OnUserBeforeCreateRequest(), app.onUserBeforeCreateRequest) + if app.onRecordBeforeCreateRequest != app.OnRecordBeforeCreateRequest() || app.OnRecordBeforeCreateRequest() == nil { + t.Fatalf("Getter app.OnRecordBeforeCreateRequest does not match or nil (%v vs %v)", app.OnRecordBeforeCreateRequest(), app.onRecordBeforeCreateRequest) } - if app.onUserAfterCreateRequest != app.OnUserAfterCreateRequest() || app.OnUserAfterCreateRequest() == nil { - t.Fatalf("Getter app.OnUserAfterCreateRequest does not match or nil (%v vs %v)", app.OnUserAfterCreateRequest(), app.onUserAfterCreateRequest) + if app.onRecordAfterCreateRequest != app.OnRecordAfterCreateRequest() || app.OnRecordAfterCreateRequest() == nil { + t.Fatalf("Getter app.OnRecordAfterCreateRequest does not match or nil (%v vs %v)", app.OnRecordAfterCreateRequest(), app.onRecordAfterCreateRequest) } - if app.onUserBeforeUpdateRequest != app.OnUserBeforeUpdateRequest() || app.OnUserBeforeUpdateRequest() == nil { - t.Fatalf("Getter app.OnUserBeforeUpdateRequest does not match or nil (%v vs %v)", app.OnUserBeforeUpdateRequest(), app.onUserBeforeUpdateRequest) + if app.onRecordBeforeUpdateRequest != app.OnRecordBeforeUpdateRequest() || app.OnRecordBeforeUpdateRequest() == nil { + t.Fatalf("Getter app.OnRecordBeforeUpdateRequest does not match or nil (%v vs %v)", app.OnRecordBeforeUpdateRequest(), app.onRecordBeforeUpdateRequest) } - if app.onUserAfterUpdateRequest != app.OnUserAfterUpdateRequest() || app.OnUserAfterUpdateRequest() == nil { - t.Fatalf("Getter app.OnUserAfterUpdateRequest does not match or nil (%v vs %v)", app.OnUserAfterUpdateRequest(), app.onUserAfterUpdateRequest) + if app.onRecordAfterUpdateRequest != app.OnRecordAfterUpdateRequest() || app.OnRecordAfterUpdateRequest() == nil { + t.Fatalf("Getter app.OnRecordAfterUpdateRequest does not match or nil (%v vs %v)", app.OnRecordAfterUpdateRequest(), app.onRecordAfterUpdateRequest) } - if app.onUserBeforeDeleteRequest != app.OnUserBeforeDeleteRequest() || app.OnUserBeforeDeleteRequest() == nil { - t.Fatalf("Getter app.OnUserBeforeDeleteRequest does not match or nil (%v vs %v)", app.OnUserBeforeDeleteRequest(), app.onUserBeforeDeleteRequest) + if app.onRecordBeforeDeleteRequest != app.OnRecordBeforeDeleteRequest() || app.OnRecordBeforeDeleteRequest() == nil { + t.Fatalf("Getter app.OnRecordBeforeDeleteRequest does not match or nil (%v vs %v)", app.OnRecordBeforeDeleteRequest(), app.onRecordBeforeDeleteRequest) } - if app.onUserAfterDeleteRequest != app.OnUserAfterDeleteRequest() || app.OnUserAfterDeleteRequest() == nil { - t.Fatalf("Getter app.OnUserAfterDeleteRequest does not match or nil (%v vs %v)", app.OnUserAfterDeleteRequest(), app.onUserAfterDeleteRequest) + if app.onRecordAfterDeleteRequest != app.OnRecordAfterDeleteRequest() || app.OnRecordAfterDeleteRequest() == nil { + t.Fatalf("Getter app.OnRecordAfterDeleteRequest does not match or nil (%v vs %v)", app.OnRecordAfterDeleteRequest(), app.onRecordAfterDeleteRequest) } - if app.onUserAuthRequest != app.OnUserAuthRequest() || app.OnUserAuthRequest() == nil { - t.Fatalf("Getter app.OnUserAuthRequest does not match or nil (%v vs %v)", app.OnUserAuthRequest(), app.onUserAuthRequest) + if app.onRecordAuthRequest != app.OnRecordAuthRequest() || app.OnRecordAuthRequest() == nil { + t.Fatalf("Getter app.OnRecordAuthRequest does not match or nil (%v vs %v)", app.OnRecordAuthRequest(), app.onRecordAuthRequest) } - if app.onUserListExternalAuths != app.OnUserListExternalAuths() || app.OnUserListExternalAuths() == nil { - t.Fatalf("Getter app.OnUserListExternalAuths does not match or nil (%v vs %v)", app.OnUserListExternalAuths(), app.onUserListExternalAuths) + if app.onRecordListExternalAuths != app.OnRecordListExternalAuths() || app.OnRecordListExternalAuths() == nil { + t.Fatalf("Getter app.OnRecordListExternalAuths does not match or nil (%v vs %v)", app.OnRecordListExternalAuths(), app.onRecordListExternalAuths) } - if app.onUserBeforeUnlinkExternalAuthRequest != app.OnUserBeforeUnlinkExternalAuthRequest() || app.OnUserBeforeUnlinkExternalAuthRequest() == nil { - t.Fatalf("Getter app.OnUserBeforeUnlinkExternalAuthRequest does not match or nil (%v vs %v)", app.OnUserBeforeUnlinkExternalAuthRequest(), app.onUserBeforeUnlinkExternalAuthRequest) + if app.onRecordBeforeUnlinkExternalAuthRequest != app.OnRecordBeforeUnlinkExternalAuthRequest() || app.OnRecordBeforeUnlinkExternalAuthRequest() == nil { + t.Fatalf("Getter app.OnRecordBeforeUnlinkExternalAuthRequest does not match or nil (%v vs %v)", app.OnRecordBeforeUnlinkExternalAuthRequest(), app.onRecordBeforeUnlinkExternalAuthRequest) } - if app.onUserAfterUnlinkExternalAuthRequest != app.OnUserAfterUnlinkExternalAuthRequest() || app.OnUserAfterUnlinkExternalAuthRequest() == nil { - t.Fatalf("Getter app.OnUserAfterUnlinkExternalAuthRequest does not match or nil (%v vs %v)", app.OnUserAfterUnlinkExternalAuthRequest(), app.onUserAfterUnlinkExternalAuthRequest) + if app.onRecordAfterUnlinkExternalAuthRequest != app.OnRecordAfterUnlinkExternalAuthRequest() || app.OnRecordAfterUnlinkExternalAuthRequest() == nil { + t.Fatalf("Getter app.OnRecordAfterUnlinkExternalAuthRequest does not match or nil (%v vs %v)", app.OnRecordAfterUnlinkExternalAuthRequest(), app.onRecordAfterUnlinkExternalAuthRequest) } if app.onRecordsListRequest != app.OnRecordsListRequest() || app.OnRecordsListRequest() == nil { diff --git a/core/events.go b/core/events.go index 11f885348..e2c55bec6 100644 --- a/core/events.go +++ b/core/events.go @@ -33,9 +33,9 @@ type ModelEvent struct { // Mailer events data // ------------------------------------------------------------------- -type MailerUserEvent struct { +type MailerRecordEvent struct { MailClient mailer.Mailer - User *models.User + Record *models.Record Meta map[string]any } @@ -143,51 +143,25 @@ type AdminAuthEvent struct { } // ------------------------------------------------------------------- -// User API events data +// Auth Record API events data // ------------------------------------------------------------------- -type UsersListEvent struct { +type RecordAuthEvent struct { HttpContext echo.Context - Users []*models.User - Result *search.Result -} - -type UserViewEvent struct { - HttpContext echo.Context - User *models.User -} - -type UserCreateEvent struct { - HttpContext echo.Context - User *models.User -} - -type UserUpdateEvent struct { - HttpContext echo.Context - User *models.User -} - -type UserDeleteEvent struct { - HttpContext echo.Context - User *models.User -} - -type UserAuthEvent struct { - HttpContext echo.Context - User *models.User + Record *models.Record Token string Meta any } -type UserListExternalAuthsEvent struct { +type RecordListExternalAuthsEvent struct { HttpContext echo.Context - User *models.User + Record *models.Record ExternalAuths []*models.ExternalAuth } -type UserUnlinkExternalAuthEvent struct { +type RecordUnlinkExternalAuthEvent struct { HttpContext echo.Context - User *models.User + Record *models.Record ExternalAuth *models.ExternalAuth } diff --git a/core/settings.go b/core/settings.go index 4a592855a..d87518c05 100644 --- a/core/settings.go +++ b/core/settings.go @@ -23,14 +23,16 @@ type Settings struct { 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"` + AdminAuthToken TokenConfig `form:"adminAuthToken" json:"adminAuthToken"` + AdminPasswordResetToken TokenConfig `form:"adminPasswordResetToken" json:"adminPasswordResetToken"` + RecordAuthToken TokenConfig `form:"recordAuthToken" json:"recordAuthToken"` + RecordPasswordResetToken TokenConfig `form:"recordPasswordResetToken" json:"recordPasswordResetToken"` + RecordEmailChangeToken TokenConfig `form:"recordEmailChangeToken" json:"recordEmailChangeToken"` + RecordVerificationToken TokenConfig `form:"recordVerificationToken" json:"recordVerificationToken"` + + // Deprecated: Will be removed in v0.9! + EmailAuth EmailAuthConfig `form:"emailAuth" json:"emailAuth"` + GoogleAuth AuthProviderConfig `form:"googleAuth" json:"googleAuth"` FacebookAuth AuthProviderConfig `form:"facebookAuth" json:"facebookAuth"` GithubAuth AuthProviderConfig `form:"githubAuth" json:"githubAuth"` @@ -52,9 +54,8 @@ func NewSettings() *Settings { ResetPasswordTemplate: defaultResetPasswordTemplate, ConfirmEmailChangeTemplate: defaultConfirmEmailChangeTemplate, }, - Logs: LogsConfig{ - MaxDays: 7, + MaxDays: 5, }, Smtp: SmtpConfig{ Enabled: false, @@ -72,49 +73,39 @@ func NewSettings() *Settings { Secret: security.RandomString(50), Duration: 1800, // 30 minutes, }, - UserAuthToken: TokenConfig{ + RecordAuthToken: TokenConfig{ Secret: security.RandomString(50), Duration: 1209600, // 14 days, }, - UserPasswordResetToken: TokenConfig{ + RecordPasswordResetToken: TokenConfig{ Secret: security.RandomString(50), Duration: 1800, // 30 minutes, }, - UserVerificationToken: TokenConfig{ + RecordVerificationToken: TokenConfig{ Secret: security.RandomString(50), Duration: 604800, // 7 days, }, - UserEmailChangeToken: TokenConfig{ + RecordEmailChangeToken: TokenConfig{ Secret: security.RandomString(50), Duration: 1800, // 30 minutes, }, - EmailAuth: EmailAuthConfig{ - Enabled: true, - MinPasswordLength: 8, - }, GoogleAuth: AuthProviderConfig{ - Enabled: false, - AllowRegistrations: true, + Enabled: false, }, FacebookAuth: AuthProviderConfig{ - Enabled: false, - AllowRegistrations: true, + Enabled: false, }, GithubAuth: AuthProviderConfig{ - Enabled: false, - AllowRegistrations: true, + Enabled: false, }, GitlabAuth: AuthProviderConfig{ - Enabled: false, - AllowRegistrations: true, + Enabled: false, }, DiscordAuth: AuthProviderConfig{ - Enabled: false, - AllowRegistrations: true, + Enabled: false, }, TwitterAuth: AuthProviderConfig{ - Enabled: false, - AllowRegistrations: true, + Enabled: false, }, } } @@ -129,13 +120,12 @@ func (s *Settings) Validate() error { validation.Field(&s.Logs), validation.Field(&s.AdminAuthToken), validation.Field(&s.AdminPasswordResetToken), - validation.Field(&s.UserAuthToken), - validation.Field(&s.UserPasswordResetToken), - validation.Field(&s.UserEmailChangeToken), - validation.Field(&s.UserVerificationToken), + validation.Field(&s.RecordAuthToken), + validation.Field(&s.RecordPasswordResetToken), + validation.Field(&s.RecordEmailChangeToken), + validation.Field(&s.RecordVerificationToken), validation.Field(&s.Smtp), validation.Field(&s.S3), - validation.Field(&s.EmailAuth), validation.Field(&s.GoogleAuth), validation.Field(&s.FacebookAuth), validation.Field(&s.GithubAuth), @@ -182,10 +172,10 @@ func (s *Settings) RedactClone() (*Settings, error) { &clone.S3.Secret, &clone.AdminAuthToken.Secret, &clone.AdminPasswordResetToken.Secret, - &clone.UserAuthToken.Secret, - &clone.UserPasswordResetToken.Secret, - &clone.UserEmailChangeToken.Secret, - &clone.UserVerificationToken.Secret, + &clone.RecordAuthToken.Secret, + &clone.RecordPasswordResetToken.Secret, + &clone.RecordEmailChangeToken.Secret, + &clone.RecordVerificationToken.Secret, &clone.GoogleAuth.ClientSecret, &clone.FacebookAuth.ClientSecret, &clone.GithubAuth.ClientSecret, @@ -407,43 +397,13 @@ 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"` - ClientId string `form:"clientId" json:"clientId,omitempty"` - ClientSecret string `form:"clientSecret" json:"clientSecret,omitempty"` - AuthUrl string `form:"authUrl" json:"authUrl,omitempty"` - TokenUrl string `form:"tokenUrl" json:"tokenUrl,omitempty"` - UserApiUrl string `form:"userApiUrl" json:"userApiUrl,omitempty"` + Enabled bool `form:"enabled" json:"enabled"` + ClientId string `form:"clientId" json:"clientId,omitempty"` + ClientSecret string `form:"clientSecret" json:"clientSecret,omitempty"` + AuthUrl string `form:"authUrl" json:"authUrl,omitempty"` + TokenUrl string `form:"tokenUrl" json:"tokenUrl,omitempty"` + UserApiUrl string `form:"userApiUrl" json:"userApiUrl,omitempty"` } // Validate makes `ProviderConfig` validatable by implementing [validation.Validatable] interface. @@ -485,3 +445,18 @@ func (c AuthProviderConfig) SetupProvider(provider auth.Provider) error { return nil } + +// ------------------------------------------------------------------- + +// Deprecated: Will be removed in v0.9! +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"` +} + +// Deprecated: Will be removed in v0.9! +func (c EmailAuthConfig) Validate() error { + return nil +} diff --git a/core/settings_templates.go b/core/settings_templates.go index 23c0083cf..006e56e07 100644 --- a/core/settings_templates.go +++ b/core/settings_templates.go @@ -20,7 +20,7 @@ var defaultVerificationTemplate = EmailTemplate{ Thanks,
` + EmailPlaceholderAppName + ` team

`, - ActionUrl: EmailPlaceholderAppUrl + "/_/#/users/confirm-verification/" + EmailPlaceholderToken, + ActionUrl: EmailPlaceholderAppUrl + "/_/#/auth/confirm-verification/" + EmailPlaceholderToken, } var defaultResetPasswordTemplate = EmailTemplate{ @@ -35,7 +35,7 @@ var defaultResetPasswordTemplate = EmailTemplate{ Thanks,
` + EmailPlaceholderAppName + ` team

`, - ActionUrl: EmailPlaceholderAppUrl + "/_/#/users/confirm-password-reset/" + EmailPlaceholderToken, + ActionUrl: EmailPlaceholderAppUrl + "/_/#/auth/confirm-password-reset/" + EmailPlaceholderToken, } var defaultConfirmEmailChangeTemplate = EmailTemplate{ @@ -50,5 +50,5 @@ var defaultConfirmEmailChangeTemplate = EmailTemplate{ Thanks,
` + EmailPlaceholderAppName + ` team

`, - ActionUrl: EmailPlaceholderAppUrl + "/_/#/users/confirm-email-change/" + EmailPlaceholderToken, + ActionUrl: EmailPlaceholderAppUrl + "/_/#/auth/confirm-email-change/" + EmailPlaceholderToken, } diff --git a/core/settings_test.go b/core/settings_test.go index 01ccbae01..cd19b45df 100644 --- a/core/settings_test.go +++ b/core/settings_test.go @@ -23,12 +23,10 @@ func TestSettingsValidate(t *testing.T) { s.S3.Endpoint = "invalid" s.AdminAuthToken.Duration = -10 s.AdminPasswordResetToken.Duration = -10 - s.UserAuthToken.Duration = -10 - s.UserPasswordResetToken.Duration = -10 - s.UserEmailChangeToken.Duration = -10 - s.UserVerificationToken.Duration = -10 - s.EmailAuth.Enabled = true - s.EmailAuth.MinPasswordLength = -10 + s.RecordAuthToken.Duration = -10 + s.RecordPasswordResetToken.Duration = -10 + s.RecordEmailChangeToken.Duration = -10 + s.RecordVerificationToken.Duration = -10 s.GoogleAuth.Enabled = true s.GoogleAuth.ClientId = "" s.FacebookAuth.Enabled = true @@ -55,16 +53,16 @@ func TestSettingsValidate(t *testing.T) { `"s3":{`, `"adminAuthToken":{`, `"adminPasswordResetToken":{`, - `"userAuthToken":{`, - `"userPasswordResetToken":{`, - `"userEmailChangeToken":{`, - `"userVerificationToken":{`, - `"emailAuth":{`, + `"recordAuthToken":{`, + `"recordPasswordResetToken":{`, + `"recordEmailChangeToken":{`, + `"recordVerificationToken":{`, `"googleAuth":{`, `"facebookAuth":{`, `"githubAuth":{`, `"gitlabAuth":{`, `"discordAuth":{`, + `"twitterAuth":{`, } errBytes, _ := json.Marshal(err) @@ -89,12 +87,10 @@ func TestSettingsMerge(t *testing.T) { s2.S3.Endpoint = "test" s2.AdminAuthToken.Duration = 1 s2.AdminPasswordResetToken.Duration = 2 - s2.UserAuthToken.Duration = 3 - s2.UserPasswordResetToken.Duration = 4 - s2.UserEmailChangeToken.Duration = 5 - s2.UserVerificationToken.Duration = 6 - s2.EmailAuth.Enabled = false - s2.EmailAuth.MinPasswordLength = 30 + s2.RecordAuthToken.Duration = 3 + s2.RecordPasswordResetToken.Duration = 4 + s2.RecordEmailChangeToken.Duration = 5 + s2.RecordVerificationToken.Duration = 6 s2.GoogleAuth.Enabled = true s2.GoogleAuth.ClientId = "google_test" s2.FacebookAuth.Enabled = true @@ -164,10 +160,10 @@ func TestSettingsRedactClone(t *testing.T) { s1.S3.Secret = "test123" s1.AdminAuthToken.Secret = "test123" s1.AdminPasswordResetToken.Secret = "test123" - s1.UserAuthToken.Secret = "test123" - s1.UserPasswordResetToken.Secret = "test123" - s1.UserEmailChangeToken.Secret = "test123" - s1.UserVerificationToken.Secret = "test123" + s1.RecordAuthToken.Secret = "test123" + s1.RecordPasswordResetToken.Secret = "test123" + s1.RecordEmailChangeToken.Secret = "test123" + s1.RecordVerificationToken.Secret = "test123" s1.GoogleAuth.ClientSecret = "test123" s1.FacebookAuth.ClientSecret = "test123" s1.GithubAuth.ClientSecret = "test123" @@ -185,10 +181,10 @@ func TestSettingsRedactClone(t *testing.T) { t.Fatal(err) } - expected := `{"meta":{"appName":"test123","appUrl":"http://localhost:8090","hideControls":false,"senderName":"Support","senderAddress":"support@example.com","verificationTemplate":{"body":"\u003cp\u003eHello,\u003c/p\u003e\n\u003cp\u003eThank you for joining us at {APP_NAME}.\u003c/p\u003e\n\u003cp\u003eClick on the button below to verify your email address.\u003c/p\u003e\n\u003cp\u003e\n \u003ca class=\"btn\" href=\"{ACTION_URL}\" target=\"_blank\" rel=\"noopener\"\u003eVerify\u003c/a\u003e\n\u003c/p\u003e\n\u003cp\u003e\n Thanks,\u003cbr/\u003e\n {APP_NAME} team\n\u003c/p\u003e","subject":"Verify your {APP_NAME} email","actionUrl":"{APP_URL}/_/#/users/confirm-verification/{TOKEN}"},"resetPasswordTemplate":{"body":"\u003cp\u003eHello,\u003c/p\u003e\n\u003cp\u003eClick on the button below to reset your password.\u003c/p\u003e\n\u003cp\u003e\n \u003ca class=\"btn\" href=\"{ACTION_URL}\" target=\"_blank\" rel=\"noopener\"\u003eReset password\u003c/a\u003e\n\u003c/p\u003e\n\u003cp\u003e\u003ci\u003eIf you didn't ask to reset your password, you can ignore this email.\u003c/i\u003e\u003c/p\u003e\n\u003cp\u003e\n Thanks,\u003cbr/\u003e\n {APP_NAME} team\n\u003c/p\u003e","subject":"Reset your {APP_NAME} password","actionUrl":"{APP_URL}/_/#/users/confirm-password-reset/{TOKEN}"},"confirmEmailChangeTemplate":{"body":"\u003cp\u003eHello,\u003c/p\u003e\n\u003cp\u003eClick on the button below to confirm your new email address.\u003c/p\u003e\n\u003cp\u003e\n \u003ca class=\"btn\" href=\"{ACTION_URL}\" target=\"_blank\" rel=\"noopener\"\u003eConfirm new email\u003c/a\u003e\n\u003c/p\u003e\n\u003cp\u003e\u003ci\u003eIf you didn't ask to change your email address, you can ignore this email.\u003c/i\u003e\u003c/p\u003e\n\u003cp\u003e\n Thanks,\u003cbr/\u003e\n {APP_NAME} team\n\u003c/p\u003e","subject":"Confirm your {APP_NAME} new email address","actionUrl":"{APP_URL}/_/#/users/confirm-email-change/{TOKEN}"}},"logs":{"maxDays":7},"smtp":{"enabled":false,"host":"smtp.example.com","port":587,"username":"","password":"******","tls":true},"s3":{"enabled":false,"bucket":"","region":"","endpoint":"","accessKey":"","secret":"******","forcePathStyle":false},"adminAuthToken":{"secret":"******","duration":1209600},"adminPasswordResetToken":{"secret":"******","duration":1800},"userAuthToken":{"secret":"******","duration":1209600},"userPasswordResetToken":{"secret":"******","duration":1800},"userEmailChangeToken":{"secret":"******","duration":1800},"userVerificationToken":{"secret":"******","duration":604800},"emailAuth":{"enabled":true,"exceptDomains":null,"onlyDomains":null,"minPasswordLength":8},"googleAuth":{"enabled":false,"allowRegistrations":true,"clientSecret":"******"},"facebookAuth":{"enabled":false,"allowRegistrations":true,"clientSecret":"******"},"githubAuth":{"enabled":false,"allowRegistrations":true,"clientSecret":"******"},"gitlabAuth":{"enabled":false,"allowRegistrations":true,"clientSecret":"******"},"discordAuth":{"enabled":false,"allowRegistrations":true,"clientSecret":"******"},"twitterAuth":{"enabled":false,"allowRegistrations":true,"clientSecret":"******"}}` + expected := `{"meta":{"appName":"test123","appUrl":"http://localhost:8090","hideControls":false,"senderName":"Support","senderAddress":"support@example.com","verificationTemplate":{"body":"\u003cp\u003eHello,\u003c/p\u003e\n\u003cp\u003eThank you for joining us at {APP_NAME}.\u003c/p\u003e\n\u003cp\u003eClick on the button below to verify your email address.\u003c/p\u003e\n\u003cp\u003e\n \u003ca class=\"btn\" href=\"{ACTION_URL}\" target=\"_blank\" rel=\"noopener\"\u003eVerify\u003c/a\u003e\n\u003c/p\u003e\n\u003cp\u003e\n Thanks,\u003cbr/\u003e\n {APP_NAME} team\n\u003c/p\u003e","subject":"Verify your {APP_NAME} email","actionUrl":"{APP_URL}/_/#/auth/confirm-verification/{TOKEN}"},"resetPasswordTemplate":{"body":"\u003cp\u003eHello,\u003c/p\u003e\n\u003cp\u003eClick on the button below to reset your password.\u003c/p\u003e\n\u003cp\u003e\n \u003ca class=\"btn\" href=\"{ACTION_URL}\" target=\"_blank\" rel=\"noopener\"\u003eReset password\u003c/a\u003e\n\u003c/p\u003e\n\u003cp\u003e\u003ci\u003eIf you didn't ask to reset your password, you can ignore this email.\u003c/i\u003e\u003c/p\u003e\n\u003cp\u003e\n Thanks,\u003cbr/\u003e\n {APP_NAME} team\n\u003c/p\u003e","subject":"Reset your {APP_NAME} password","actionUrl":"{APP_URL}/_/#/auth/confirm-password-reset/{TOKEN}"},"confirmEmailChangeTemplate":{"body":"\u003cp\u003eHello,\u003c/p\u003e\n\u003cp\u003eClick on the button below to confirm your new email address.\u003c/p\u003e\n\u003cp\u003e\n \u003ca class=\"btn\" href=\"{ACTION_URL}\" target=\"_blank\" rel=\"noopener\"\u003eConfirm new email\u003c/a\u003e\n\u003c/p\u003e\n\u003cp\u003e\u003ci\u003eIf you didn't ask to change your email address, you can ignore this email.\u003c/i\u003e\u003c/p\u003e\n\u003cp\u003e\n Thanks,\u003cbr/\u003e\n {APP_NAME} team\n\u003c/p\u003e","subject":"Confirm your {APP_NAME} new email address","actionUrl":"{APP_URL}/_/#/auth/confirm-email-change/{TOKEN}"}},"logs":{"maxDays":5},"smtp":{"enabled":false,"host":"smtp.example.com","port":587,"username":"","password":"******","tls":true},"s3":{"enabled":false,"bucket":"","region":"","endpoint":"","accessKey":"","secret":"******","forcePathStyle":false},"adminAuthToken":{"secret":"******","duration":1209600},"adminPasswordResetToken":{"secret":"******","duration":1800},"recordAuthToken":{"secret":"******","duration":1209600},"recordPasswordResetToken":{"secret":"******","duration":1800},"recordEmailChangeToken":{"secret":"******","duration":1800},"recordVerificationToken":{"secret":"******","duration":604800},"emailAuth":{"enabled":false,"exceptDomains":null,"onlyDomains":null,"minPasswordLength":0},"googleAuth":{"enabled":false,"clientSecret":"******"},"facebookAuth":{"enabled":false,"clientSecret":"******"},"githubAuth":{"enabled":false,"clientSecret":"******"},"gitlabAuth":{"enabled":false,"clientSecret":"******"},"discordAuth":{"enabled":false,"clientSecret":"******"},"twitterAuth":{"enabled":false,"clientSecret":"******"}}` if encodedStr := string(encoded); encodedStr != expected { - t.Fatalf("Expected %v, got \n%v", expected, encodedStr) + t.Fatalf("Expected\n%v\ngot\n%v", expected, encodedStr) } } @@ -210,10 +206,10 @@ func TestNamedAuthProviderConfigs(t *testing.T) { t.Fatal(err) } - expected := `{"discord":{"enabled":false,"allowRegistrations":true,"clientId":"discord_test"},"facebook":{"enabled":false,"allowRegistrations":true,"clientId":"facebook_test"},"github":{"enabled":false,"allowRegistrations":true,"clientId":"github_test"},"gitlab":{"enabled":true,"allowRegistrations":true,"clientId":"gitlab_test"},"google":{"enabled":false,"allowRegistrations":true,"clientId":"google_test"},"twitter":{"enabled":false,"allowRegistrations":true,"clientId":"twitter_test"}}` + expected := `{"discord":{"enabled":false,"clientId":"discord_test"},"facebook":{"enabled":false,"clientId":"facebook_test"},"github":{"enabled":false,"clientId":"github_test"},"gitlab":{"enabled":true,"clientId":"gitlab_test"},"google":{"enabled":false,"clientId":"google_test"},"twitter":{"enabled":false,"clientId":"twitter_test"}}` if encodedStr := string(encoded); encodedStr != expected { - t.Fatalf("Expected the same serialization, got %v", encodedStr) + t.Fatalf("Expected the same serialization, got \n%v", encodedStr) } } @@ -701,83 +697,24 @@ func TestAuthProviderConfigSetupProvider(t *testing.T) { if err := c2.SetupProvider(provider); err != nil { t.Error(err) } - encoded, _ := json.Marshal(c2) - expected := `{"enabled":true,"allowRegistrations":false,"clientId":"test_ClientId","clientSecret":"test_ClientSecret","authUrl":"test_AuthUrl","tokenUrl":"test_TokenUrl","userApiUrl":"test_UserApiUrl"}` - if string(encoded) != expected { - t.Errorf("Expected %s, got %s", expected, string(encoded)) + + if provider.ClientId() != c2.ClientId { + t.Fatalf("Expected ClientId %s, got %s", c2.ClientId, provider.ClientId()) } -} -func TestEmailAuthConfigValidate(t *testing.T) { - scenarios := []struct { - config core.EmailAuthConfig - expectError bool - }{ - // zero values (disabled) - { - core.EmailAuthConfig{}, - false, - }, - // zero values (enabled) - { - core.EmailAuthConfig{Enabled: true}, - true, - }, - // invalid data (only the required) - { - core.EmailAuthConfig{ - Enabled: true, - MinPasswordLength: 4, - }, - true, - }, - // valid data (only the required) - { - core.EmailAuthConfig{ - Enabled: true, - MinPasswordLength: 5, - }, - false, - }, - // invalid data (both OnlyDomains and ExceptDomains set) - { - core.EmailAuthConfig{ - Enabled: true, - MinPasswordLength: 5, - OnlyDomains: []string{"example.com", "test.com"}, - ExceptDomains: []string{"example.com", "test.com"}, - }, - true, - }, - // valid data (only onlyDomains set) - { - core.EmailAuthConfig{ - Enabled: true, - MinPasswordLength: 5, - OnlyDomains: []string{"example.com", "test.com"}, - }, - false, - }, - // valid data (only exceptDomains set) - { - core.EmailAuthConfig{ - Enabled: true, - MinPasswordLength: 5, - ExceptDomains: []string{"example.com", "test.com"}, - }, - false, - }, + if provider.ClientSecret() != c2.ClientSecret { + t.Fatalf("Expected ClientSecret %s, got %s", c2.ClientSecret, provider.ClientSecret()) } - for i, scenario := range scenarios { - result := scenario.config.Validate() + if provider.AuthUrl() != c2.AuthUrl { + t.Fatalf("Expected AuthUrl %s, got %s", c2.AuthUrl, provider.AuthUrl()) + } - if result != nil && !scenario.expectError { - t.Errorf("(%d) Didn't expect error, got %v", i, result) - } + if provider.UserApiUrl() != c2.UserApiUrl { + t.Fatalf("Expected UserApiUrl %s, got %s", c2.UserApiUrl, provider.UserApiUrl()) + } - if result == nil && scenario.expectError { - t.Errorf("(%d) Expected error, got nil", i) - } + if provider.TokenUrl() != c2.TokenUrl { + t.Fatalf("Expected TokenUrl %s, got %s", c2.TokenUrl, provider.TokenUrl()) } } diff --git a/daos/admin.go b/daos/admin.go index 86ad77ac5..3a0000231 100644 --- a/daos/admin.go +++ b/daos/admin.go @@ -5,6 +5,7 @@ import ( "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/tools/list" "github.com/pocketbase/pocketbase/tools/security" ) @@ -49,6 +50,7 @@ func (dao *Dao) FindAdminByEmail(email string) (*models.Admin, error) { // // Returns an error if the JWT token is invalid or expired. func (dao *Dao) FindAdminByToken(token string, baseTokenKey string) (*models.Admin, error) { + // @todo consider caching the unverified claims unverifiedClaims, err := security.ParseUnverifiedJWT(token) if err != nil { return nil, err @@ -86,20 +88,22 @@ func (dao *Dao) TotalAdmins() (int, error) { // IsAdminEmailUnique checks if the provided email address is not // already in use by other admins. -func (dao *Dao) IsAdminEmailUnique(email string, excludeId string) bool { +func (dao *Dao) IsAdminEmailUnique(email string, excludeIds ...string) bool { if email == "" { return false } - var exists bool - err := dao.AdminQuery(). - Select("count(*)"). - AndWhere(dbx.Not(dbx.HashExp{"id": excludeId})). + query := dao.AdminQuery().Select("count(*)"). AndWhere(dbx.HashExp{"email": email}). - Limit(1). - Row(&exists) + Limit(1) + + if len(excludeIds) > 0 { + query.AndWhere(dbx.NotIn("id", list.ToInterfaceSlice(excludeIds)...)) + } + + var exists bool - return err == nil && !exists + return query.Row(&exists) == nil && !exists } // DeleteAdmin deletes the provided Admin model. diff --git a/daos/admin_test.go b/daos/admin_test.go index 4f56b7e5c..d49f5972b 100644 --- a/daos/admin_test.go +++ b/daos/admin_test.go @@ -27,8 +27,9 @@ func TestFindAdminById(t *testing.T) { id string expectError bool }{ - {"00000000-2b4a-a26b-4d01-42d3c3d77bc8", true}, - {"3f8397cc-2b4a-a26b-4d01-42d3c3d77bc8", false}, + {" ", true}, + {"missing", true}, + {"9q2trqumvlyr3bd", false}, } for i, scenario := range scenarios { @@ -53,6 +54,7 @@ func TestFindAdminByEmail(t *testing.T) { email string expectError bool }{ + {"", true}, {"invalid", true}, {"missing@example.com", true}, {"test@example.com", false}, @@ -83,23 +85,30 @@ func TestFindAdminByToken(t *testing.T) { expectedEmail string expectError bool }{ - // invalid base key (password reset key for auth token) + // invalid auth token { - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", - app.Settings().AdminPasswordResetToken.Secret, + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MDk5MTY2MX0.qrbkI2TITtFKMP6vrATrBVKPGjEiDIBeQ0mlqPGMVeY", + app.Settings().AdminAuthToken.Secret, "", true, }, // expired token { - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MDk5MTY2MX0.uXZ_ywsZeRFSvDNQ9zBoYUXKXw7VEr48Fzx-E06OkS8", + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MDk5MTY2MX0.I7w8iktkleQvC7_UIRpD7rNzcU4OnF7i7SFIUu6lD_4", app.Settings().AdminAuthToken.Secret, "", true, }, + // wrong base token (password reset token secret instead of auth secret) + { + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", + app.Settings().AdminPasswordResetToken.Secret, + "", + true, + }, // valid token { - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg3MzQ2Mjc5Mn0.AtRtXR6FHBrCUGkj5OffhmxLbSZaQ4L_Qgw4gfoHyfo", + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImV4cCI6MjIwODk4NTI2MX0.M1m--VOqGyv0d23eeUc0r9xE8ZzHaYVmVFw1VZW6gT8", app.Settings().AdminAuthToken.Secret, "test@example.com", false, @@ -129,8 +138,8 @@ func TestTotalAdmins(t *testing.T) { if err != nil { t.Fatal(err) } - if result1 != 2 { - t.Fatalf("Expected 2 admins, got %d", result1) + if result1 != 3 { + t.Fatalf("Expected 3 admins, got %d", result1) } // delete all @@ -156,8 +165,10 @@ func TestIsAdminEmailUnique(t *testing.T) { }{ {"", "", false}, {"test@example.com", "", false}, + {"test2@example.com", "", false}, + {"test3@example.com", "", false}, {"new@example.com", "", true}, - {"test@example.com", "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", true}, + {"test@example.com", "sywbhecnh46rhm0", true}, } for i, scenario := range scenarios { @@ -186,15 +197,24 @@ func TestDeleteAdmin(t *testing.T) { if err != nil { t.Fatal(err) } + admin3, err := app.Dao().FindAdminByEmail("test3@example.com") + if err != nil { + t.Fatal(err) + } deleteErr1 := app.Dao().DeleteAdmin(admin1) if deleteErr1 != nil { t.Fatal(deleteErr1) } - // cannot delete the only remaining admin deleteErr2 := app.Dao().DeleteAdmin(admin2) - if deleteErr2 == nil { + if deleteErr2 != nil { + t.Fatal(deleteErr2) + } + + // cannot delete the only remaining admin + deleteErr3 := app.Dao().DeleteAdmin(admin3) + if deleteErr3 == nil { t.Fatal("Expected delete error, got nil") } diff --git a/daos/base_test.go b/daos/base_test.go index 3b5ed45f4..37f45e3ea 100644 --- a/daos/base_test.go +++ b/daos/base_test.go @@ -35,8 +35,8 @@ func TestDaoModelQuery(t *testing.T) { "SELECT {{_collections}}.* FROM `_collections`", }, { - &models.User{}, - "SELECT {{_users}}.* FROM `_users`", + &models.Admin{}, + "SELECT {{_admins}}.* FROM `_admins`", }, { &models.Request{}, @@ -64,19 +64,19 @@ func TestDaoFindById(t *testing.T) { // missing id { &models.Collection{}, - "00000000-075d-49fe-9d09-ea7e951000dc", + "missing", true, }, // existing collection id { &models.Collection{}, - "3f2888f8-075d-49fe-9d09-ea7e951000dc", + "wsmn24bux7wo113", false, }, - // existing user id + // existing admin id { - &models.User{}, - "97cc3d3d-6ba2-383f-b42a-7bc84d27410c", + &models.Admin{}, + "sbmbsdb40jyxf7h", false, }, } diff --git a/daos/collection.go b/daos/collection.go index 104cf8879..c7c591550 100644 --- a/daos/collection.go +++ b/daos/collection.go @@ -8,6 +8,7 @@ import ( "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/models/schema" + "github.com/pocketbase/pocketbase/tools/list" ) // CollectionQuery returns a new Collection select query. @@ -15,6 +16,22 @@ func (dao *Dao) CollectionQuery() *dbx.SelectQuery { return dao.ModelQuery(&models.Collection{}) } +// FindCollectionsByType finds all collections by the given type +func (dao *Dao) FindCollectionsByType(collectionType string) ([]*models.Collection, error) { + models := []*models.Collection{} + + err := dao.CollectionQuery(). + AndWhere(dbx.HashExp{"type": collectionType}). + OrderBy("created ASC"). + All(&models) + + if err != nil { + return nil, err + } + + return models, nil +} + // FindCollectionByNameOrId finds the first collection by its name or id. func (dao *Dao) FindCollectionByNameOrId(nameOrId string) (*models.Collection, error) { model := &models.Collection{} @@ -38,38 +55,24 @@ func (dao *Dao) FindCollectionByNameOrId(nameOrId string) (*models.Collection, e // with the provided name (case insensitive!). // // Note: case sensitive check because the name is used also as a table name for the records. -func (dao *Dao) IsCollectionNameUnique(name string, excludeId string) bool { +func (dao *Dao) IsCollectionNameUnique(name string, excludeIds ...string) bool { if name == "" { return false } - var exists bool - err := dao.CollectionQuery(). + query := dao.CollectionQuery(). Select("count(*)"). - AndWhere(dbx.Not(dbx.HashExp{"id": excludeId})). AndWhere(dbx.NewExp("LOWER([[name]])={:name}", dbx.Params{"name": strings.ToLower(name)})). - Limit(1). - Row(&exists) + Limit(1) - return err == nil && !exists -} + if len(excludeIds) > 0 { + uniqueExcludeIds := list.NonzeroUniques(excludeIds) + query.AndWhere(dbx.NotIn("id", list.ToInterfaceSlice(uniqueExcludeIds)...)) + } -// FindCollectionsWithUserFields finds all collections that has -// at least one user schema field. -func (dao *Dao) FindCollectionsWithUserFields() ([]*models.Collection, error) { - result := []*models.Collection{} + var exists bool - err := dao.CollectionQuery(). - InnerJoin( - "json_each(schema) as jsonField", - dbx.NewExp( - "json_extract(jsonField.value, '$.type') = {:type}", - dbx.Params{"type": schema.FieldTypeUser}, - ), - ). - All(&result) - - return result, err + return query.Row(&exists) == nil && !exists } // FindCollectionReferences returns information for all @@ -78,13 +81,15 @@ func (dao *Dao) FindCollectionsWithUserFields() ([]*models.Collection, error) { // If the provided collection has reference to itself then it will be // also included in the result. To exclude it, pass the collection id // as the excludeId argument. -func (dao *Dao) FindCollectionReferences(collection *models.Collection, excludeId string) (map[*models.Collection][]*schema.SchemaField, error) { +func (dao *Dao) FindCollectionReferences(collection *models.Collection, excludeIds ...string) (map[*models.Collection][]*schema.SchemaField, error) { collections := []*models.Collection{} - err := dao.CollectionQuery(). - AndWhere(dbx.Not(dbx.HashExp{"id": excludeId})). - All(&collections) - if err != nil { + query := dao.CollectionQuery() + if len(excludeIds) > 0 { + uniqueExcludeIds := list.NonzeroUniques(excludeIds) + query.AndWhere(dbx.NotIn("id", list.ToInterfaceSlice(uniqueExcludeIds)...)) + } + if err := query.All(&collections); err != nil { return nil, err } @@ -152,6 +157,11 @@ func (dao *Dao) SaveCollection(collection *models.Collection) error { } return dao.RunInTransaction(func(txDao *Dao) error { + // set default collection type + if collection.Type == "" { + collection.Type = models.CollectionTypeBase + } + // persist the collection model if err := txDao.Save(collection); err != nil { return err @@ -196,6 +206,11 @@ func (dao *Dao) ImportCollections( imported.RefreshId() } + // set default type if missing + if imported.Type == "" { + imported.Type = models.CollectionTypeBase + } + if existing, ok := mappedExisting[imported.GetId()]; ok { // preserve original created date if !existing.Created.IsZero() { diff --git a/daos/collection_test.go b/daos/collection_test.go index 0a4ac10e8..a58980f87 100644 --- a/daos/collection_test.go +++ b/daos/collection_test.go @@ -24,6 +24,41 @@ func TestCollectionQuery(t *testing.T) { } } +func TestFindCollectionsByType(t *testing.T) { + app, _ := tests.NewTestApp() + defer app.Cleanup() + + scenarios := []struct { + collectionType string + expectError bool + expectTotal int + }{ + {"", false, 0}, + {"unknown", false, 0}, + {models.CollectionTypeAuth, false, 3}, + {models.CollectionTypeBase, false, 4}, + } + + for i, scenario := range scenarios { + collections, err := app.Dao().FindCollectionsByType(scenario.collectionType) + + hasErr := err != nil + if hasErr != scenario.expectError { + t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, scenario.expectError, hasErr, err) + } + + if len(collections) != scenario.expectTotal { + t.Errorf("(%d) Expected %d collections, got %d", i, scenario.expectTotal, len(collections)) + } + + for _, c := range collections { + if c.Type != scenario.collectionType { + t.Errorf("(%d) Expected collection with type %s, got %s: \n%v", i, scenario.collectionType, c.Type, c) + } + } + } +} + func TestFindCollectionByNameOrId(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() @@ -34,9 +69,8 @@ func TestFindCollectionByNameOrId(t *testing.T) { }{ {"", true}, {"missing", true}, - {"00000000-075d-49fe-9d09-ea7e951000dc", true}, - {"3f2888f8-075d-49fe-9d09-ea7e951000dc", false}, - {"demo", false}, + {"wsmn24bux7wo113", false}, + {"demo1", false}, } for i, scenario := range scenarios { @@ -63,9 +97,10 @@ func TestIsCollectionNameUnique(t *testing.T) { expected bool }{ {"", "", false}, - {"demo", "", false}, + {"demo1", "", false}, + {"Demo1", "", false}, {"new", "", true}, - {"demo", "3f2888f8-075d-49fe-9d09-ea7e951000dc", true}, + {"demo1", "wsmn24bux7wo113", true}, } for i, scenario := range scenarios { @@ -76,33 +111,11 @@ func TestIsCollectionNameUnique(t *testing.T) { } } -func TestFindCollectionsWithUserFields(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - result, err := app.Dao().FindCollectionsWithUserFields() - if err != nil { - t.Fatal(err) - } - - expectedNames := []string{"demo2", models.ProfileCollectionName} - - if len(result) != len(expectedNames) { - t.Fatalf("Expected collections %v, got %v", expectedNames, result) - } - - for i, col := range result { - if !list.ExistInSlice(col.Name, expectedNames) { - t.Errorf("(%d) Couldn't find %s in %v", i, col.Name, expectedNames) - } - } -} - func TestFindCollectionReferences(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, err := app.Dao().FindCollectionByNameOrId("demo") + collection, err := app.Dao().FindCollectionByNameOrId("demo3") if err != nil { t.Fatal(err) } @@ -116,11 +129,18 @@ func TestFindCollectionReferences(t *testing.T) { t.Fatalf("Expected 1 collection, got %d: %v", len(result), result) } - expectedFields := []string{"onerel", "manyrels", "cascaderel"} + expectedFields := []string{ + "rel_one_no_cascade", + "rel_one_no_cascade_required", + "rel_one_cascade", + "rel_many_no_cascade", + "rel_many_no_cascade_required", + "rel_many_cascade", + } for col, fields := range result { - if col.Name != "demo2" { - t.Fatalf("Expected collection demo2, got %s", col.Name) + if col.Name != "demo4" { + t.Fatalf("Expected collection demo4, got %s", col.Name) } if len(fields) != len(expectedFields) { t.Fatalf("Expected fields %v, got %v", expectedFields, fields) @@ -138,7 +158,7 @@ func TestDeleteCollection(t *testing.T) { defer app.Cleanup() c0 := &models.Collection{} - c1, err := app.Dao().FindCollectionByNameOrId("demo") + c1, err := app.Dao().FindCollectionByNameOrId("clients") if err != nil { t.Fatal(err) } @@ -146,18 +166,22 @@ func TestDeleteCollection(t *testing.T) { if err != nil { t.Fatal(err) } - c3, err := app.Dao().FindCollectionByNameOrId(models.ProfileCollectionName) + c3, err := app.Dao().FindCollectionByNameOrId("demo1") if err != nil { t.Fatal(err) } + c3.System = true + if err := app.Dao().Save(c3); err != nil { + t.Fatal(err) + } scenarios := []struct { model *models.Collection expectError bool }{ {c0, true}, - {c1, true}, // is part of a reference - {c2, false}, + {c1, false}, + {c2, true}, // is part of a reference {c3, true}, // system } @@ -177,6 +201,7 @@ func TestSaveCollectionCreate(t *testing.T) { collection := &models.Collection{ Name: "new_test", + Type: models.CollectionTypeBase, Schema: schema.NewSchema( &schema.SchemaField{ Type: schema.FieldTypeText, @@ -239,7 +264,7 @@ func TestSaveCollectionUpdate(t *testing.T) { } // check if the records table has the schema fields - expectedColumns := []string{"id", "created", "updated", "title_update", "test"} + expectedColumns := []string{"id", "created", "updated", "title_update", "test", "files"} columns, err := app.Dao().GetTableColumns(collection.Name) if err != nil { t.Fatal(err) @@ -262,13 +287,14 @@ func TestImportCollections(t *testing.T) { beforeRecordsSync func(txDao *daos.Dao, mappedImported, mappedExisting map[string]*models.Collection) error expectError bool expectCollectionsCount int + beforeTestFunc func(testApp *tests.TestApp, resultCollections []*models.Collection) afterTestFunc func(testApp *tests.TestApp, resultCollections []*models.Collection) }{ { name: "empty collections", jsonData: `[]`, expectError: true, - expectCollectionsCount: 5, + expectCollectionsCount: 7, }, { name: "check db constraints", @@ -277,7 +303,7 @@ func TestImportCollections(t *testing.T) { ]`, deleteMissing: false, expectError: true, - expectCollectionsCount: 5, + expectCollectionsCount: 7, }, { name: "minimal collection import", @@ -286,7 +312,7 @@ func TestImportCollections(t *testing.T) { ]`, deleteMissing: false, expectError: false, - expectCollectionsCount: 6, + expectCollectionsCount: 8, }, { name: "minimal collection import + failed beforeRecordsSync", @@ -298,7 +324,7 @@ func TestImportCollections(t *testing.T) { }, deleteMissing: false, expectError: true, - expectCollectionsCount: 5, + expectCollectionsCount: 7, }, { name: "minimal collection import + successful beforeRecordsSync", @@ -310,13 +336,13 @@ func TestImportCollections(t *testing.T) { }, deleteMissing: false, expectError: false, - expectCollectionsCount: 6, + expectCollectionsCount: 8, }, { name: "new + update + delete system collection", jsonData: `[ { - "id":"3f2888f8-075d-49fe-9d09-ea7e951000dc", + "id":"wsmn24bux7wo113", "name":"demo", "schema":[ { @@ -346,50 +372,49 @@ func TestImportCollections(t *testing.T) { ]`, deleteMissing: true, expectError: true, - expectCollectionsCount: 5, + expectCollectionsCount: 7, }, { name: "new + update + delete non-system collection", jsonData: `[ { - "id":"abe78266-fd4d-4aea-962d-8c0138ac522b", - "name":"profiles", - "system":true, - "listRule":"userId = @request.user.id", - "viewRule":"created > 'test_change'", - "createRule":"userId = @request.user.id", - "updateRule":"userId = @request.user.id", - "deleteRule":"userId = @request.user.id", - "schema":[ - { - "id":"koih1lqx", - "name":"userId", - "type":"user", - "system":true, - "required":true, - "unique":true, - "options":{ - "maxSelect":1, - "cascadeDelete":true - } - }, + "id": "kpv709sk2lqbqk8", + "system": true, + "name": "nologin", + "type": "auth", + "options": { + "allowEmailAuth": false, + "allowOAuth2Auth": false, + "allowUsernameAuth": false, + "exceptEmailDomains": [], + "manageRule": "@request.auth.collectionName = 'users'", + "minPasswordLength": 8, + "onlyEmailDomains": [], + "requireEmail": true + }, + "listRule": "", + "viewRule": "", + "createRule": "", + "updateRule": "", + "deleteRule": "", + "schema": [ { - "id":"69ycbg3q", - "name":"rel", - "type":"relation", - "system":false, - "required":false, - "unique":false, - "options":{ - "maxSelect":2, - "collectionId":"abe78266-fd4d-4aea-962d-8c0138ac522b", - "cascadeDelete":false + "id": "x8zzktwe", + "name": "name", + "type": "text", + "system": false, + "required": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" } } ] }, { - "id":"3f2888f8-075d-49fe-9d09-ea7e951000dc", + "id":"wsmn24bux7wo113", "name":"demo", "schema":[ { @@ -427,38 +452,8 @@ func TestImportCollections(t *testing.T) { name: "test with deleteMissing: false", jsonData: `[ { - "id":"abe78266-fd4d-4aea-962d-8c0138ac522b", - "name":"profiles", - "system":true, - "listRule":"userId = @request.user.id", - "viewRule":"created > 'test_change'", - "createRule":"userId = @request.user.id", - "updateRule":"userId = @request.user.id", - "deleteRule":"userId = @request.user.id", - "schema":[ - { - "id":"69ycbg3q", - "name":"rel", - "type":"relation", - "system":false, - "required":false, - "unique":false, - "options":{ - "maxSelect":2, - "collectionId":"abe78266-fd4d-4aea-962d-8c0138ac522b", - "cascadeDelete":true - } - }, - { - "id":"abcd_import", - "name":"new_field", - "type":"bool" - } - ] - }, - { - "id":"3f2888f8-075d-49fe-9d09-ea7e951000dc", - "name":"demo", + "id":"wsmn24bux7wo113", + "name":"demo1", "schema":[ { "id":"_2hlxbmp", @@ -506,14 +501,14 @@ func TestImportCollections(t *testing.T) { ]`, deleteMissing: false, expectError: false, - expectCollectionsCount: 6, + expectCollectionsCount: 8, afterTestFunc: func(testApp *tests.TestApp, resultCollections []*models.Collection) { expectedCollectionFields := map[string]int{ - "profiles": 6, - "demo": 3, - "demo2": 14, - "demo3": 1, - "demo4": 6, + "nologin": 1, + "demo1": 15, + "demo2": 2, + "demo3": 2, + "demo4": 11, "new_import": 1, } for name, expectedCount := range expectedCollectionFields { diff --git a/daos/external_auth.go b/daos/external_auth.go index 7eea5758f..525c273c6 100644 --- a/daos/external_auth.go +++ b/daos/external_auth.go @@ -12,13 +12,16 @@ func (dao *Dao) ExternalAuthQuery() *dbx.SelectQuery { return dao.ModelQuery(&models.ExternalAuth{}) } -/// FindAllExternalAuthsByUserId returns all ExternalAuth models -/// linked to the provided userId. -func (dao *Dao) FindAllExternalAuthsByUserId(userId string) ([]*models.ExternalAuth, error) { +/// FindAllExternalAuthsByRecord returns all ExternalAuth models +/// linked to the provided auth record. +func (dao *Dao) FindAllExternalAuthsByRecord(authRecord *models.Record) ([]*models.ExternalAuth, error) { auths := []*models.ExternalAuth{} err := dao.ExternalAuthQuery(). - AndWhere(dbx.HashExp{"userId": userId}). + AndWhere(dbx.HashExp{ + "collectionId": authRecord.Collection().Id, + "recordId": authRecord.Id, + }). OrderBy("created ASC"). All(&auths) @@ -50,15 +53,16 @@ func (dao *Dao) FindExternalAuthByProvider(provider, providerId string) (*models return model, nil } -// FindExternalAuthByUserIdAndProvider returns the first available -// ExternalAuth model for the specified userId and provider. -func (dao *Dao) FindExternalAuthByUserIdAndProvider(userId, provider string) (*models.ExternalAuth, error) { +// FindExternalAuthByRecordAndProvider returns the first available +// ExternalAuth model for the specified record data and provider. +func (dao *Dao) FindExternalAuthByRecordAndProvider(authRecord *models.Record, provider string) (*models.ExternalAuth, error) { model := &models.ExternalAuth{} err := dao.ExternalAuthQuery(). AndWhere(dbx.HashExp{ - "userId": userId, - "provider": provider, + "collectionId": authRecord.Collection().Id, + "recordId": authRecord.Id, + "provider": provider, }). Limit(1). One(model) @@ -74,7 +78,7 @@ func (dao *Dao) FindExternalAuthByUserIdAndProvider(userId, provider string) (*m func (dao *Dao) SaveExternalAuth(model *models.ExternalAuth) error { // extra check the model data in case the provider's API response // has changed and no longer returns the expected fields - if model.UserId == "" || model.Provider == "" || model.ProviderId == "" { + if model.CollectionId == "" || model.RecordId == "" || model.Provider == "" || model.ProviderId == "" { return errors.New("Missing required ExternalAuth fields.") } @@ -82,27 +86,6 @@ func (dao *Dao) SaveExternalAuth(model *models.ExternalAuth) error { } // DeleteExternalAuth deletes the provided ExternalAuth model. -// -// The delete may fail if the linked user doesn't have an email and -// there are no other linked ExternalAuth models available. func (dao *Dao) DeleteExternalAuth(model *models.ExternalAuth) error { - user, err := dao.FindUserById(model.UserId) - if err != nil { - return err - } - - // if the user doesn't have an email, make sure that there - // is at least one other external auth relation available - if user.Email == "" { - allExternalAuths, err := dao.FindAllExternalAuthsByUserId(user.Id) - if err != nil { - return err - } - - if len(allExternalAuths) <= 1 { - return errors.New("You cannot delete the only available external auth relation because the user doesn't have an email address.") - } - } - return dao.Delete(model) } diff --git a/daos/external_auth_test.go b/daos/external_auth_test.go index 68a58e713..f4d05c080 100644 --- a/daos/external_auth_test.go +++ b/daos/external_auth_test.go @@ -19,7 +19,7 @@ func TestExternalAuthQuery(t *testing.T) { } } -func TestFindAllExternalAuthsByUserId(t *testing.T) { +func TestFindAllExternalAuthsByRecord(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() @@ -27,16 +27,20 @@ func TestFindAllExternalAuthsByUserId(t *testing.T) { userId string expectedCount int }{ - {"", 0}, - {"missing", 0}, - {"97cc3d3d-6ba2-383f-b42a-7bc84d27410c", 0}, - {"cx9u0dh2udo8xol", 2}, + {"oap640cot4yru2s", 0}, + {"4q1xlclmfloku33", 2}, } for i, s := range scenarios { - auths, err := app.Dao().FindAllExternalAuthsByUserId(s.userId) + record, err := app.Dao().FindRecordById("users", s.userId) if err != nil { - t.Errorf("(%d) Unexpected error %v", i, err) + t.Errorf("(%d) Unexpected record fetch error %v", i, err) + continue + } + + auths, err := app.Dao().FindAllExternalAuthsByRecord(record) + if err != nil { + t.Errorf("(%d) Unexpected auths fetch error %v", i, err) continue } @@ -45,8 +49,8 @@ func TestFindAllExternalAuthsByUserId(t *testing.T) { } for _, auth := range auths { - if auth.UserId != s.userId { - t.Errorf("(%d) Expected all auths to be linked to userId %s, got %v", i, s.userId, auth) + if auth.RecordId != record.Id { + t.Errorf("(%d) Expected all auths to be linked to record id %s, got %v", i, record.Id, auth) } } } @@ -65,8 +69,8 @@ func TestFindExternalAuthByProvider(t *testing.T) { {"github", "", ""}, {"github", "id1", ""}, {"github", "id2", ""}, - {"google", "id1", "abcdefghijklmn0"}, - {"gitlab", "id2", "abcdefghijklmn1"}, + {"google", "test123", "clmflokuq1xl341"}, + {"gitlab", "test123", "dlmflokuq1xl342"}, } for i, s := range scenarios { @@ -85,7 +89,7 @@ func TestFindExternalAuthByProvider(t *testing.T) { } } -func TestFindExternalAuthByUserIdAndProvider(t *testing.T) { +func TestFindExternalAuthByRecordAndProvider(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() @@ -94,17 +98,19 @@ func TestFindExternalAuthByUserIdAndProvider(t *testing.T) { provider string expectedId string }{ - {"", "", ""}, - {"", "github", ""}, - {"123456", "github", ""}, // missing user and provider record - {"123456", "google", ""}, // missing user but existing provider record - {"97cc3d3d-6ba2-383f-b42a-7bc84d27410c", "google", ""}, - {"cx9u0dh2udo8xol", "google", "abcdefghijklmn0"}, - {"cx9u0dh2udo8xol", "gitlab", "abcdefghijklmn1"}, + {"bgs820n361vj1qd", "google", ""}, + {"4q1xlclmfloku33", "google", "clmflokuq1xl341"}, + {"4q1xlclmfloku33", "gitlab", "dlmflokuq1xl342"}, } for i, s := range scenarios { - auth, err := app.Dao().FindExternalAuthByUserIdAndProvider(s.userId, s.provider) + record, err := app.Dao().FindRecordById("users", s.userId) + if err != nil { + t.Errorf("(%d) Unexpected record fetch error %v", i, err) + continue + } + + auth, err := app.Dao().FindExternalAuthByRecordAndProvider(record, s.provider) hasErr := err != nil expectErr := s.expectedId == "" @@ -130,9 +136,10 @@ func TestSaveExternalAuth(t *testing.T) { } auth := &models.ExternalAuth{ - UserId: "97cc3d3d-6ba2-383f-b42a-7bc84d27410c", - Provider: "test", - ProviderId: "test_id", + RecordId: "o1y0dd0spd786md", + CollectionId: "v851q4r790rhknl", + Provider: "test", + ProviderId: "test_id", } if err := app.Dao().SaveExternalAuth(auth); err != nil { @@ -154,42 +161,29 @@ func TestDeleteExternalAuth(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - user, err := app.Dao().FindUserById("cx9u0dh2udo8xol") + record, err := app.Dao().FindRecordById("users", "4q1xlclmfloku33") if err != nil { t.Fatal(err) } - auths, err := app.Dao().FindAllExternalAuthsByUserId(user.Id) + auths, err := app.Dao().FindAllExternalAuthsByRecord(record) if err != nil { t.Fatal(err) } - if err := app.Dao().DeleteExternalAuth(auths[0]); err != nil { - t.Fatalf("Failed to delete the first ExternalAuth relation, got \n%v", err) - } - - if err := app.Dao().DeleteExternalAuth(auths[1]); err == nil { - t.Fatal("Expected delete to fail, got nil") - } - - // update the user model and try again - user.Email = "test_new@example.com" - if err := app.Dao().SaveUser(user); err != nil { - t.Fatal(err) - } - - // try to delete auths[1] again - if err := app.Dao().DeleteExternalAuth(auths[1]); err != nil { - t.Fatalf("Failed to delete the last ExternalAuth relation, got \n%v", err) + for _, auth := range auths { + if err := app.Dao().DeleteExternalAuth(auth); err != nil { + t.Fatalf("Failed to delete the ExternalAuth relation, got \n%v", err) + } } // check if the relations were really deleted - newAuths, err := app.Dao().FindAllExternalAuthsByUserId(user.Id) + newAuths, err := app.Dao().FindAllExternalAuthsByRecord(record) if err != nil { t.Fatal(err) } if len(newAuths) != 0 { - t.Fatalf("Expected all user %s ExternalAuth relations to be deleted, got \n%v", user.Id, newAuths) + t.Fatalf("Expected all record %s ExternalAuth relations to be deleted, got \n%v", record.Id, newAuths) } } diff --git a/daos/record.go b/daos/record.go index 6980b0751..caf9e3221 100644 --- a/daos/record.go +++ b/daos/record.go @@ -8,9 +8,11 @@ import ( "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/models/schema" + "github.com/pocketbase/pocketbase/tools/inflector" "github.com/pocketbase/pocketbase/tools/list" "github.com/pocketbase/pocketbase/tools/security" "github.com/pocketbase/pocketbase/tools/types" + "github.com/spf13/cast" ) // RecordQuery returns a new Record select query. @@ -23,16 +25,24 @@ func (dao *Dao) RecordQuery(collection *models.Collection) *dbx.SelectQuery { // FindRecordById finds the Record model by its id. func (dao *Dao) FindRecordById( - collection *models.Collection, + collectionNameOrId string, recordId string, - filter func(q *dbx.SelectQuery) error, + optFilters ...func(q *dbx.SelectQuery) error, ) (*models.Record, error) { + collection, err := dao.FindCollectionByNameOrId(collectionNameOrId) + if err != nil { + return nil, err + } + tableName := collection.Name query := dao.RecordQuery(collection). AndWhere(dbx.HashExp{tableName + ".id": recordId}) - if filter != nil { + for _, filter := range optFilters { + if filter == nil { + continue + } if err := filter(query); err != nil { return nil, err } @@ -49,16 +59,25 @@ func (dao *Dao) FindRecordById( // FindRecordsByIds finds all Record models by the provided ids. // If no records are found, returns an empty slice. func (dao *Dao) FindRecordsByIds( - collection *models.Collection, + collectionNameOrId string, recordIds []string, - filter func(q *dbx.SelectQuery) error, + optFilters ...func(q *dbx.SelectQuery) error, ) ([]*models.Record, error) { - tableName := collection.Name + collection, err := dao.FindCollectionByNameOrId(collectionNameOrId) + if err != nil { + return nil, err + } query := dao.RecordQuery(collection). - AndWhere(dbx.In(tableName+".id", list.ToInterfaceSlice(recordIds)...)) - - if filter != nil { + AndWhere(dbx.In( + collection.Name+".id", + list.ToInterfaceSlice(recordIds)..., + )) + + for _, filter := range optFilters { + if filter == nil { + continue + } if err := filter(query); err != nil { return nil, err } @@ -72,24 +91,34 @@ func (dao *Dao) FindRecordsByIds( return models.NewRecordsFromNullStringMaps(collection, rows), nil } -// FindRecordsByExpr finds all records by the provided db expression. -// If no records are found, returns an empty slice. +// FindRecordsByExpr finds all records by the specified db expression. +// +// Returns all collection records if no expressions are provided. +// +// Returns an empty slice if no records are found. // // Example: -// expr := dbx.HashExp{"email": "test@example.com"} -// dao.FindRecordsByExpr(collection, expr) -func (dao *Dao) FindRecordsByExpr(collection *models.Collection, expr dbx.Expression) ([]*models.Record, error) { - if expr == nil { - return nil, errors.New("Missing filter expression") +// expr1 := dbx.HashExp{"email": "test@example.com"} +// expr2 := dbx.HashExp{"status": "active"} +// dao.FindRecordsByExpr("example", expr1, expr2) +func (dao *Dao) FindRecordsByExpr(collectionNameOrId string, exprs ...dbx.Expression) ([]*models.Record, error) { + collection, err := dao.FindCollectionByNameOrId(collectionNameOrId) + if err != nil { + return nil, err } - rows := []dbx.NullStringMap{} + query := dao.RecordQuery(collection) - err := dao.RecordQuery(collection). - AndWhere(expr). - All(&rows) + // add only the non-nil expressions + for _, expr := range exprs { + if expr != nil { + query.AndWhere(expr) + } + } - if err != nil { + rows := []dbx.NullStringMap{} + + if err := query.All(&rows); err != nil { return nil, err } @@ -98,11 +127,16 @@ func (dao *Dao) FindRecordsByExpr(collection *models.Collection, expr dbx.Expres // FindFirstRecordByData returns the first found record matching // the provided key-value pair. -func (dao *Dao) FindFirstRecordByData(collection *models.Collection, key string, value any) (*models.Record, error) { +func (dao *Dao) FindFirstRecordByData(collectionNameOrId string, key string, value any) (*models.Record, error) { + collection, err := dao.FindCollectionByNameOrId(collectionNameOrId) + if err != nil { + return nil, err + } + row := dbx.NullStringMap{} - err := dao.RecordQuery(collection). - AndWhere(dbx.HashExp{key: value}). + err = dao.RecordQuery(collection). + AndWhere(dbx.HashExp{inflector.Columnify(key): value}). Limit(1). One(row) @@ -115,85 +149,193 @@ func (dao *Dao) FindFirstRecordByData(collection *models.Collection, key string, // IsRecordValueUnique checks if the provided key-value pair is a unique Record value. // +// For correctness, if the collection is "auth" and the key is "username", +// the unique check will be case insensitive. +// // NB! Array values (eg. from multiple select fields) are matched // as a serialized json strings (eg. `["a","b"]`), so the value uniqueness // depends on the elements order. Or in other words the following values // are considered different: `[]string{"a","b"}` and `[]string{"b","a"}` func (dao *Dao) IsRecordValueUnique( - collection *models.Collection, + collectionNameOrId string, key string, value any, - excludeId string, + excludeIds ...string, ) bool { - var exists bool + collection, err := dao.FindCollectionByNameOrId(collectionNameOrId) + if err != nil { + return false + } - var normalizedVal any - switch val := value.(type) { - case []string: - normalizedVal = append(types.JsonArray{}, list.ToInterfaceSlice(val)...) - case []any: - normalizedVal = append(types.JsonArray{}, val...) - default: - normalizedVal = val + var expr dbx.Expression + if collection.IsAuth() && key == schema.FieldNameUsername { + expr = dbx.NewExp("LOWER([["+schema.FieldNameUsername+"]])={:username}", dbx.Params{ + "username": strings.ToLower(cast.ToString(value)), + }) + } else { + var normalizedVal any + switch val := value.(type) { + case []string: + normalizedVal = append(types.JsonArray{}, list.ToInterfaceSlice(val)...) + case []any: + normalizedVal = append(types.JsonArray{}, val...) + default: + normalizedVal = val + } + + expr = dbx.HashExp{inflector.Columnify(key): normalizedVal} } - err := dao.RecordQuery(collection). + query := dao.RecordQuery(collection). Select("count(*)"). - AndWhere(dbx.Not(dbx.HashExp{"id": excludeId})). - AndWhere(dbx.HashExp{key: normalizedVal}). - Limit(1). - Row(&exists) + AndWhere(expr). + Limit(1) + + if len(excludeIds) > 0 { + uniqueExcludeIds := list.NonzeroUniques(excludeIds) + query.AndWhere(dbx.NotIn(collection.Name+".id", list.ToInterfaceSlice(uniqueExcludeIds)...)) + } - return err == nil && !exists + var exists bool + + return query.Row(&exists) == nil && !exists } -// FindUserRelatedRecords returns all records that has a reference -// to the provided User model (via the user shema field). -func (dao *Dao) FindUserRelatedRecords(user *models.User) ([]*models.Record, error) { - if user.Id == "" { - return []*models.Record{}, nil +// FindAuthRecordByToken finds the auth record associated with the provided JWT token. +// +// Returns an error if the JWT token is invalid, expired or not associated to an auth collection record. +func (dao *Dao) FindAuthRecordByToken(token string, baseTokenKey string) (*models.Record, error) { + unverifiedClaims, err := security.ParseUnverifiedJWT(token) + if err != nil { + return nil, err + } + + // check required claims + id, _ := unverifiedClaims["id"].(string) + collectionId, _ := unverifiedClaims["collectionId"].(string) + if id == "" || collectionId == "" { + return nil, errors.New("Missing or invalid token claims.") } - collections, err := dao.FindCollectionsWithUserFields() + record, err := dao.FindRecordById(collectionId, id) if err != nil { return nil, err } - result := []*models.Record{} - for _, collection := range collections { - userFields := []*schema.SchemaField{} + if !record.Collection().IsAuth() { + return nil, errors.New("The token is not associated to an auth collection record.") + } - // prepare fields options - if err := collection.Schema.InitFieldsOptions(); err != nil { - return nil, err - } + verificationKey := record.TokenKey() + baseTokenKey - // extract user fields - for _, field := range collection.Schema.Fields() { - if field.Type == schema.FieldTypeUser { - userFields = append(userFields, field) - } - } + // verify token signature + if _, err := security.ParseJWT(token, verificationKey); err != nil { + return nil, err + } - // fetch records associated to the user - exprs := []dbx.Expression{} - for _, field := range userFields { - exprs = append(exprs, dbx.HashExp{field.Name: user.Id}) - } - rows := []dbx.NullStringMap{} - if err := dao.RecordQuery(collection).AndWhere(dbx.Or(exprs...)).All(&rows); err != nil { - return nil, err - } - records := models.NewRecordsFromNullStringMaps(collection, rows) + return record, nil +} + +// FindAuthRecordByEmail finds the auth record associated with the provided email. +// +// Returns an error if it is not an auth collection or the record is not found. +func (dao *Dao) FindAuthRecordByEmail(collectionNameOrId string, email string) (*models.Record, error) { + collection, err := dao.FindCollectionByNameOrId(collectionNameOrId) + if err != nil || !collection.IsAuth() { + return nil, errors.New("Missing or not an auth collection.") + } + + row := dbx.NullStringMap{} + + err = dao.RecordQuery(collection). + AndWhere(dbx.HashExp{schema.FieldNameEmail: email}). + Limit(1). + One(row) + + if err != nil { + return nil, err + } + + return models.NewRecordFromNullStringMap(collection, row), nil +} + +// FindAuthRecordByUsername finds the auth record associated with the provided username (case insensitive). +// +// Returns an error if it is not an auth collection or the record is not found. +func (dao *Dao) FindAuthRecordByUsername(collectionNameOrId string, username string) (*models.Record, error) { + collection, err := dao.FindCollectionByNameOrId(collectionNameOrId) + if err != nil || !collection.IsAuth() { + return nil, errors.New("Missing or not an auth collection.") + } + + row := dbx.NullStringMap{} - result = append(result, records...) + err = dao.RecordQuery(collection). + AndWhere(dbx.NewExp("LOWER([["+schema.FieldNameUsername+"]])={:username}", dbx.Params{ + "username": strings.ToLower(username), + })). + Limit(1). + One(row) + + if err != nil { + return nil, err } - return result, nil + return models.NewRecordFromNullStringMap(collection, row), nil +} + +// SuggestUniqueAuthRecordUsername checks if the provided username is unique +// and return a new "unique" username with appended random numeric part +// (eg. "existingName" -> "existingName583"). +// +// The same username will be returned if the provided string is already unique. +func (dao *Dao) SuggestUniqueAuthRecordUsername( + collectionNameOrId string, + baseUsername string, + excludeIds ...string, +) string { + username := baseUsername + + for i := 0; i < 10; i++ { // max 10 attempts + isUnique := dao.IsRecordValueUnique( + collectionNameOrId, + schema.FieldNameUsername, + username, + excludeIds..., + ) + if isUnique { + break // already unique + } + username = baseUsername + security.RandomStringWithAlphabet(3+i, "123456789") + } + + return username } // SaveRecord upserts the provided Record model. func (dao *Dao) SaveRecord(record *models.Record) error { + if record.Collection().IsAuth() { + if record.Username() == "" { + return errors.New("Unable to save auth record without username.") + } + + // Cross-check that the auth record id is unique for all auth collections. + // This is to make sure that the filter `@request.auth.id` always returns a unique id. + authCollections, err := dao.FindCollectionsByType(models.CollectionTypeAuth) + if err != nil { + return fmt.Errorf("Unable to fetch the auth collections for cross-id unique check: %v", err) + } + for _, collection := range authCollections { + if record.Collection().Id == collection.Id { + continue // skip current collection (sqlite will do the check for us) + } + isUnique := dao.IsRecordValueUnique(collection.Id, schema.FieldNameId, record.Id) + if !isUnique { + return errors.New("The auth record ID must be unique across all auth collections.") + } + } + } + return dao.Save(record) } @@ -206,8 +348,8 @@ func (dao *Dao) SaveRecord(record *models.Record) error { // reference in another record (aka. cannot be deleted or set to NULL). func (dao *Dao) DeleteRecord(record *models.Record) error { // check for references - // note: the select is outside of the transaction to prevent SQLITE_LOCKED error when mixing read&write in a single transaction - refs, err := dao.FindCollectionReferences(record.Collection(), "") + // note: the select is outside of the transaction to prevent SQLITE_LOCKED error when mixing read&write in a single transaction. + refs, err := dao.FindCollectionReferences(record.Collection()) if err != nil { return err } @@ -217,6 +359,7 @@ func (dao *Dao) DeleteRecord(record *models.Record) error { // just unset the record id from any relation field values (if they are not required) // ----------------------------------------------------------- return dao.RunInTransaction(func(txDao *Dao) error { + // delete/update references for refCollection, fields := range refs { for _, field := range fields { options, _ := field.Options.(*schema.RelationOptions) @@ -234,7 +377,7 @@ func (dao *Dao) DeleteRecord(record *models.Record) error { refRecords := models.NewRecordsFromNullStringMaps(refCollection, rows) for _, refRecord := range refRecords { - ids := refRecord.GetStringSliceDataValue(field.Name) + ids := refRecord.GetStringSlice(field.Name) // unset the record id for i := len(ids) - 1; i >= 0; i-- { @@ -259,7 +402,7 @@ func (dao *Dao) DeleteRecord(record *models.Record) error { } // save the reference changes - refRecord.SetDataValue(field.Name, field.PrepareValue(ids)) + refRecord.Set(field.Name, field.PrepareValue(ids)) if err := txDao.SaveRecord(refRecord); err != nil { return err } @@ -267,6 +410,17 @@ func (dao *Dao) DeleteRecord(record *models.Record) error { } } + // delete linked external auths + if record.Collection().IsAuth() { + _, err = txDao.DB().Delete((&models.ExternalAuth{}).TableName(), dbx.HashExp{ + "collectionId": record.Collection().Id, + "recordId": record.Id, + }).Execute() + if err != nil { + return err + } + } + return txDao.Delete(record) }) } @@ -279,9 +433,26 @@ func (dao *Dao) SyncRecordTableSchema(newCollection *models.Collection, oldColle // create if oldCollection == nil { cols := map[string]string{ - schema.ReservedFieldNameId: "TEXT PRIMARY KEY", - schema.ReservedFieldNameCreated: `TEXT DEFAULT "" NOT NULL`, - schema.ReservedFieldNameUpdated: `TEXT DEFAULT "" NOT NULL`, + schema.FieldNameId: "TEXT PRIMARY KEY", + schema.FieldNameCreated: "TEXT DEFAULT '' NOT NULL", + schema.FieldNameUpdated: "TEXT DEFAULT '' NOT NULL", + } + + if newCollection.IsAuth() { + cols[schema.FieldNameUsername] = "TEXT NOT NULL" + cols[schema.FieldNameEmail] = "TEXT DEFAULT '' NOT NULL" + cols[schema.FieldNameEmailVisibility] = "BOOLEAN DEFAULT FALSE NOT NULL" + cols[schema.FieldNameVerified] = "BOOLEAN DEFAULT FALSE NOT NULL" + cols[schema.FieldNameTokenKey] = "TEXT NOT NULL" + cols[schema.FieldNamePasswordHash] = "TEXT NOT NULL" + cols[schema.FieldNameLastResetSentAt] = "TEXT DEFAULT '' NOT NULL" + cols[schema.FieldNameLastVerificationSentAt] = "TEXT DEFAULT '' NOT NULL" + } + + // ensure that the new collection has an id + if !newCollection.HasId() { + newCollection.RefreshId() + newCollection.MarkAsNew() } tableName := newCollection.Name @@ -292,15 +463,30 @@ func (dao *Dao) SyncRecordTableSchema(newCollection *models.Collection, oldColle } // create table - _, tableErr := dao.DB().CreateTable(tableName, cols).Execute() - if tableErr != nil { - return tableErr + if _, err := dao.DB().CreateTable(tableName, cols).Execute(); err != nil { + return err + } + + // add named index on the base `created` column + if _, err := dao.DB().CreateIndex(tableName, "_"+newCollection.Id+"_created_idx", "created").Execute(); err != nil { + return err } - // add index on the base `created` column - _, indexErr := dao.DB().CreateIndex(tableName, tableName+"_created_idx", "created").Execute() - if indexErr != nil { - return indexErr + // add named unique index on the email and tokenKey columns + if newCollection.IsAuth() { + _, err := dao.DB().NewQuery(fmt.Sprintf( + ` + CREATE UNIQUE INDEX _%s_username_idx ON {{%s}} ([[username]]); + CREATE UNIQUE INDEX _%s_email_idx ON {{%s}} ([[email]]) WHERE [[email]] != ''; + CREATE UNIQUE INDEX _%s_tokenKey_idx ON {{%s}} ([[tokenKey]]); + `, + newCollection.Id, tableName, + newCollection.Id, tableName, + newCollection.Id, tableName, + )).Execute() + if err != nil { + return err + } } return nil @@ -315,7 +501,7 @@ func (dao *Dao) SyncRecordTableSchema(newCollection *models.Collection, oldColle // check for renamed table if !strings.EqualFold(oldTableName, newTableName) { - _, err := dao.DB().RenameTable(oldTableName, newTableName).Execute() + _, err := txDao.DB().RenameTable(oldTableName, newTableName).Execute() if err != nil { return err } diff --git a/daos/record_expand.go b/daos/record_expand.go index 816bec5ff..cbff9e2f7 100644 --- a/daos/record_expand.go +++ b/daos/record_expand.go @@ -3,11 +3,16 @@ package daos import ( "errors" "fmt" + "regexp" "strings" + "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/models/schema" + "github.com/pocketbase/pocketbase/tools/inflector" "github.com/pocketbase/pocketbase/tools/list" + "github.com/pocketbase/pocketbase/tools/security" + "github.com/pocketbase/pocketbase/tools/types" ) // MaxExpandDepth specifies the max allowed nested expand depth path. @@ -40,10 +45,13 @@ func (dao *Dao) ExpandRecords(records []*models.Record, expands []string, fetchF return failed } +var indirectExpandRegex = regexp.MustCompile(`^(\w+)\((\w+)\)$`) + // notes: // - fetchFunc must be non-nil func // - all records are expected to be from the same collection // - if MaxExpandDepth is reached, the function returns nil ignoring the remaining expand path +// - indirect expands are supported only with single relation fields func (dao *Dao) expandRecords(records []*models.Record, expandPath string, fetchFunc ExpandFetchFunc, recursionLevel int) error { if fetchFunc == nil { return errors.New("Relation records fetchFunc is not set.") @@ -53,29 +61,104 @@ func (dao *Dao) expandRecords(records []*models.Record, expandPath string, fetch return nil } + mainCollection := records[0].Collection() + + var relField *schema.SchemaField + var relFieldOptions *schema.RelationOptions + var relCollection *models.Collection + parts := strings.SplitN(expandPath, ".", 2) + matches := indirectExpandRegex.FindStringSubmatch(parts[0]) - // extract the relation field (if exist) - mainCollection := records[0].Collection() - relField := mainCollection.Schema.GetFieldByName(parts[0]) - if relField == nil || relField.Type != schema.FieldTypeRelation { - return fmt.Errorf("Couldn't find relation field %q in collection %q.", parts[0], mainCollection.Name) - } - relField.InitOptions() - relFieldOptions, ok := relField.Options.(*schema.RelationOptions) - if !ok { - return fmt.Errorf("Cannot initialize the options of relation field %q.", parts[0]) - } + if len(matches) == 3 { + indirectRel, _ := dao.FindCollectionByNameOrId(matches[1]) + if indirectRel == nil { + return fmt.Errorf("Couldn't find indirect related collection %q.", matches[1]) + } + + indirectRelField := indirectRel.Schema.GetFieldByName(matches[2]) + if indirectRelField == nil || indirectRelField.Type != schema.FieldTypeRelation { + return fmt.Errorf("Couldn't find indirect relation field %q in collection %q.", matches[2], mainCollection.Name) + } + + indirectRelField.InitOptions() + indirectRelFieldOptions, _ := indirectRelField.Options.(*schema.RelationOptions) + if indirectRelFieldOptions == nil || indirectRelFieldOptions.CollectionId != mainCollection.Id { + return fmt.Errorf("Invalid indirect relation field path %q.", parts[0]) + } + if indirectRelFieldOptions.MaxSelect != nil && *indirectRelFieldOptions.MaxSelect != 1 { + // for now don't allow multi-relation indirect fields expand + // due to eventual poor query performance with large data sets. + return fmt.Errorf("Multi-relation fields cannot be indirectly expanded in %q.", parts[0]) + } + + recordIds := make([]any, len(records)) + for _, record := range records { + recordIds = append(recordIds, record.Id) + } + + indirectRecords, err := dao.FindRecordsByExpr( + indirectRel.Id, + dbx.In(inflector.Columnify(matches[2]), recordIds...), + ) + if err != nil { + return err + } + mappedIndirectRecordIds := make(map[string][]string, len(indirectRecords)) + for _, indirectRecord := range indirectRecords { + recId := indirectRecord.GetString(matches[2]) + if recId != "" { + mappedIndirectRecordIds[recId] = append(mappedIndirectRecordIds[recId], indirectRecord.Id) + } + } + + // add the indirect relation ids as a new relation field value + for _, record := range records { + relIds, ok := mappedIndirectRecordIds[record.Id] + if ok && len(relIds) > 0 { + record.Set(parts[0], relIds) + } + } - relCollection, err := dao.FindCollectionByNameOrId(relFieldOptions.CollectionId) - if err != nil { - return fmt.Errorf("Couldn't find collection %q.", relFieldOptions.CollectionId) + relFieldOptions = &schema.RelationOptions{ + MaxSelect: nil, + CollectionId: indirectRel.Id, + } + if indirectRelField.Unique { + relFieldOptions.MaxSelect = types.Pointer(1) + } + // indirect relation + relField = &schema.SchemaField{ + Id: "indirect_" + security.RandomString(3), + Type: schema.FieldTypeRelation, + Name: parts[0], + Options: relFieldOptions, + } + relCollection = indirectRel + } else { + // direct relation + relField = mainCollection.Schema.GetFieldByName(parts[0]) + if relField == nil || relField.Type != schema.FieldTypeRelation { + return fmt.Errorf("Couldn't find relation field %q in collection %q.", parts[0], mainCollection.Name) + } + relField.InitOptions() + relFieldOptions, _ = relField.Options.(*schema.RelationOptions) + if relFieldOptions == nil { + return fmt.Errorf("Couldn't initialize the options of relation field %q.", parts[0]) + } + + relCollection, _ = dao.FindCollectionByNameOrId(relFieldOptions.CollectionId) + if relCollection == nil { + return fmt.Errorf("Couldn't find related collection %q.", relFieldOptions.CollectionId) + } } + // --------------------------------------------------------------- + // extract the id of the relations to expand relIds := make([]string, 0, len(records)) for _, record := range records { - relIds = append(relIds, record.GetStringSliceDataValue(relField.Name)...) + relIds = append(relIds, record.GetStringSlice(relField.Name)...) } // fetch rels @@ -99,7 +182,7 @@ func (dao *Dao) expandRecords(records []*models.Record, expandPath string, fetch } for _, model := range records { - relIds := model.GetStringSliceDataValue(relField.Name) + relIds := model.GetStringSlice(relField.Name) validRels := make([]*models.Record, 0, len(relIds)) for _, id := range relIds { @@ -112,7 +195,7 @@ func (dao *Dao) expandRecords(records []*models.Record, expandPath string, fetch continue // no valid relations } - expandData := model.GetExpand() + expandData := model.Expand() // normalize access to the previously expanded rel records (if any) var oldExpandedRels []*models.Record @@ -133,8 +216,8 @@ func (dao *Dao) expandRecords(records []*models.Record, expandPath string, fetch continue } - oldRelExpand := oldExpandedRel.GetExpand() - newRelExpand := rel.GetExpand() + oldRelExpand := oldExpandedRel.Expand() + newRelExpand := rel.Expand() for k, v := range oldRelExpand { newRelExpand[k] = v } @@ -143,7 +226,7 @@ func (dao *Dao) expandRecords(records []*models.Record, expandPath string, fetch } // update the expanded data - if relFieldOptions.MaxSelect == 1 { + if relFieldOptions.MaxSelect != nil && *relFieldOptions.MaxSelect <= 1 { expandData[relField.Name] = validRels[0] } else { expandData[relField.Name] = validRels diff --git a/daos/record_expand_test.go b/daos/record_expand_test.go index 689a0d632..d5059bd21 100644 --- a/daos/record_expand_test.go +++ b/daos/record_expand_test.go @@ -8,6 +8,7 @@ import ( "github.com/pocketbase/pocketbase/daos" "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/models/schema" "github.com/pocketbase/pocketbase/tests" "github.com/pocketbase/pocketbase/tools/list" ) @@ -16,152 +17,173 @@ func TestExpandRecords(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - col, _ := app.Dao().FindCollectionByNameOrId("demo4") - scenarios := []struct { + testName string + collectionIdOrName string recordIds []string expands []string fetchFunc daos.ExpandFetchFunc expectExpandProps int expectExpandFailures int }{ - // empty records { + "empty records", + "", []string{}, - []string{"onerel", "manyrels.onerel.manyrels"}, + []string{"self_rel_one", "self_rel_many.self_rel_one"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, 0, 0, }, - // empty expand { - []string{"b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", "df55c8ff-45ef-4c82-8aed-6e2183fe1125"}, + "empty expand", + "demo4", + []string{"i9naidtvr6qsgb4", "qzaqccwrmva4o1n"}, []string{}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, 0, 0, }, - // empty fetchFunc { - []string{"b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", "df55c8ff-45ef-4c82-8aed-6e2183fe1125"}, - []string{"onerel", "manyrels.onerel.manyrels"}, + "empty fetchFunc", + "demo4", + []string{"i9naidtvr6qsgb4", "qzaqccwrmva4o1n"}, + []string{"self_rel_one", "self_rel_many.self_rel_one"}, nil, 0, 2, }, - // fetchFunc with error { - []string{"b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", "df55c8ff-45ef-4c82-8aed-6e2183fe1125"}, - []string{"onerel", "manyrels.onerel.manyrels"}, + "fetchFunc with error", + "demo4", + []string{"i9naidtvr6qsgb4", "qzaqccwrmva4o1n"}, + []string{"self_rel_one", "self_rel_many.self_rel_one"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { return nil, errors.New("test error") }, 0, 2, }, - // missing relation field { - []string{"b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", "df55c8ff-45ef-4c82-8aed-6e2183fe1125"}, - []string{"invalid"}, + "missing relation field", + "demo4", + []string{"i9naidtvr6qsgb4", "qzaqccwrmva4o1n"}, + []string{"missing"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, 0, 1, }, - // existing, but non-relation type field { - []string{"b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", "df55c8ff-45ef-4c82-8aed-6e2183fe1125"}, + "existing, but non-relation type field", + "demo4", + []string{"i9naidtvr6qsgb4", "qzaqccwrmva4o1n"}, []string{"title"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, 0, 1, }, - // invalid/missing second level expand { - []string{"b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", "df55c8ff-45ef-4c82-8aed-6e2183fe1125"}, - []string{"manyrels.invalid"}, + "invalid/missing second level expand", + "demo4", + []string{"i9naidtvr6qsgb4", "qzaqccwrmva4o1n"}, + []string{"rel_one_no_cascade.title"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, 0, 1, }, - // expand normalizations { + "expand normalizations", + "demo4", + []string{"i9naidtvr6qsgb4", "qzaqccwrmva4o1n"}, []string{ - "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", - "df55c8ff-45ef-4c82-8aed-6e2183fe1125", - "b84cd893-7119-43c9-8505-3c4e22da28a9", - "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2", + "self_rel_one", "self_rel_many.self_rel_many.rel_one_no_cascade", + "self_rel_many.self_rel_one.self_rel_many.self_rel_one.rel_one_no_cascade", + "self_rel_many", "self_rel_many.", + " self_rel_many ", "", }, - []string{"manyrels.onerel.manyrels.onerel", "manyrels.onerel", "onerel", "onerel.", " onerel ", ""}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, 9, 0, }, - // expand multiple relations sharing a common root path { + "single expand", + "users", []string{ - "i15r5aa28ad06c8", + "bgs820n361vj1qd", + "4q1xlclmfloku33", + "oap640cot4yru2s", // no rels }, - []string{"manyrels.onerel.manyrels.onerel", "manyrels.onerel.onerel"}, + []string{"rel"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, - 4, + 2, 0, }, - // single expand { - []string{ - "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", - "df55c8ff-45ef-4c82-8aed-6e2183fe1125", - "b84cd893-7119-43c9-8505-3c4e22da28a9", // no manyrels - "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2", // no manyrels + "maxExpandDepth reached", + "demo4", + []string{"qzaqccwrmva4o1n"}, + []string{"self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many"}, + func(c *models.Collection, ids []string) ([]*models.Record, error) { + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, - []string{"manyrels"}, + 6, + 0, + }, + { + "simple indirect expand", + "demo3", + []string{"lcl9d87w22ml6jy"}, + []string{"demo4(rel_one_no_cascade_required)"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, - 2, + 1, 0, }, - // maxExpandDepth reached { - []string{"b8ba58f9-e2d7-42a0-b0e7-a11efd98236b"}, - []string{"manyrels.onerel.manyrels.onerel.manyrels.onerel.manyrels.onerel.manyrels"}, + "nested indirect expand", + "demo3", + []string{"lcl9d87w22ml6jy"}, + []string{ + "demo4(rel_one_no_cascade_required).self_rel_many.self_rel_many.self_rel_one", + }, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, - 6, + 5, 0, }, } - for i, s := range scenarios { + for _, s := range scenarios { ids := list.ToUniqueStringSlice(s.recordIds) - records, _ := app.Dao().FindRecordsByIds(col, ids, nil) + records, _ := app.Dao().FindRecordsByIds(s.collectionIdOrName, ids) failed := app.Dao().ExpandRecords(records, s.expands, s.fetchFunc) if len(failed) != s.expectExpandFailures { - t.Errorf("(%d) Expected %d failures, got %d: \n%v", i, s.expectExpandFailures, len(failed), failed) + t.Errorf("[%s] Expected %d failures, got %d: \n%v", s.testName, s.expectExpandFailures, len(failed), failed) } encoded, _ := json.Marshal(records) encodedStr := string(encoded) - totalExpandProps := strings.Count(encodedStr, "@expand") + totalExpandProps := strings.Count(encodedStr, schema.FieldNameExpand) if s.expectExpandProps != totalExpandProps { - t.Errorf("(%d) Expected %d @expand props, got %d: \n%v", i, s.expectExpandProps, totalExpandProps, encodedStr) + t.Errorf("[%s] Expected %d expand props, got %d: \n%v", s.testName, s.expectExpandProps, totalExpandProps, encodedStr) } } } @@ -170,109 +192,157 @@ func TestExpandRecord(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - col, _ := app.Dao().FindCollectionByNameOrId("demo4") - scenarios := []struct { + testName string + collectionIdOrName string recordId string expands []string fetchFunc daos.ExpandFetchFunc expectExpandProps int expectExpandFailures int }{ - // empty expand { - "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", + "empty expand", + "demo4", + "i9naidtvr6qsgb4", []string{}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, 0, 0, }, - // empty fetchFunc { - "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", - []string{"onerel", "manyrels.onerel.manyrels"}, + "empty fetchFunc", + "demo4", + "i9naidtvr6qsgb4", + []string{"self_rel_one", "self_rel_many.self_rel_one"}, nil, 0, 2, }, - // fetchFunc with error { - "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", - []string{"onerel", "manyrels.onerel.manyrels"}, + "fetchFunc with error", + "demo4", + "i9naidtvr6qsgb4", + []string{"self_rel_one", "self_rel_many.self_rel_one"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { return nil, errors.New("test error") }, 0, 2, }, - // invalid missing first level expand { - "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", - []string{"invalid"}, + "missing relation field", + "demo4", + "i9naidtvr6qsgb4", + []string{"missing"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, 0, 1, }, - // invalid missing second level expand { - "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", - []string{"manyrels.invalid"}, + "existing, but non-relation type field", + "demo4", + "i9naidtvr6qsgb4", + []string{"title"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, 0, 1, }, - // expand normalizations { - "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", - []string{"manyrels.onerel.manyrels", "manyrels.onerel", "onerel", " onerel "}, + "invalid/missing second level expand", + "demo4", + "qzaqccwrmva4o1n", + []string{"rel_one_no_cascade.title"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, - 3, 0, + 1, }, - // single expand { - "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", - []string{"manyrels"}, + "expand normalizations", + "demo4", + "qzaqccwrmva4o1n", + []string{ + "self_rel_one", "self_rel_many.self_rel_many.rel_one_no_cascade", + "self_rel_many.self_rel_one.self_rel_many.self_rel_one.rel_one_no_cascade", + "self_rel_many", "self_rel_many.", + " self_rel_many ", "", + }, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, - 1, + 8, 0, }, - // maxExpandDepth reached { - "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", - []string{"manyrels.onerel.manyrels.onerel.manyrels.onerel.manyrels.onerel.manyrels"}, + "no rels to expand", + "users", + "oap640cot4yru2s", + []string{"rel"}, func(c *models.Collection, ids []string) ([]*models.Record, error) { - return app.Dao().FindRecordsByIds(c, ids, nil) + return app.Dao().FindRecordsByIds(c.Id, ids, nil) + }, + 0, + 0, + }, + { + "maxExpandDepth reached", + "demo4", + "qzaqccwrmva4o1n", + []string{"self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many.self_rel_many"}, + func(c *models.Collection, ids []string) ([]*models.Record, error) { + return app.Dao().FindRecordsByIds(c.Id, ids, nil) }, 6, 0, }, + { + "simple indirect expand", + "demo3", + "lcl9d87w22ml6jy", + []string{"demo4(rel_one_no_cascade_required)"}, + func(c *models.Collection, ids []string) ([]*models.Record, error) { + return app.Dao().FindRecordsByIds(c.Id, ids, nil) + }, + 1, + 0, + }, + { + "nested indirect expand", + "demo3", + "lcl9d87w22ml6jy", + []string{ + "demo4(rel_one_no_cascade_required).self_rel_many.self_rel_many.self_rel_one", + }, + func(c *models.Collection, ids []string) ([]*models.Record, error) { + return app.Dao().FindRecordsByIds(c.Id, ids, nil) + }, + 5, + 0, + }, } - for i, s := range scenarios { - record, _ := app.Dao().FindFirstRecordByData(col, "id", s.recordId) + for _, s := range scenarios { + record, _ := app.Dao().FindRecordById(s.collectionIdOrName, s.recordId) failed := app.Dao().ExpandRecord(record, s.expands, s.fetchFunc) if len(failed) != s.expectExpandFailures { - t.Errorf("(%d) Expected %d failures, got %d: \n%v", i, s.expectExpandFailures, len(failed), failed) + t.Errorf("[%s] Expected %d failures, got %d: \n%v", s.testName, s.expectExpandFailures, len(failed), failed) } encoded, _ := json.Marshal(record) encodedStr := string(encoded) - totalExpandProps := strings.Count(encodedStr, "@expand") + totalExpandProps := strings.Count(encodedStr, schema.FieldNameExpand) if s.expectExpandProps != totalExpandProps { - t.Errorf("(%d) Expected %d @expand props, got %d: \n%v", i, s.expectExpandProps, totalExpandProps, encodedStr) + t.Errorf("[%s] Expected %d expand props, got %d: \n%v", s.testName, s.expectExpandProps, totalExpandProps, encodedStr) } } } diff --git a/daos/record_test.go b/daos/record_test.go index 024be661b..f21004d2c 100644 --- a/daos/record_test.go +++ b/daos/record_test.go @@ -3,6 +3,8 @@ package daos_test import ( "errors" "fmt" + "regexp" + "strings" "testing" "github.com/pocketbase/dbx" @@ -16,7 +18,10 @@ func TestRecordQuery(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo") + collection, err := app.Dao().FindCollectionByNameOrId("demo1") + if err != nil { + t.Fatal(err) + } expected := fmt.Sprintf("SELECT `%s`.* FROM `%s`", collection.Name, collection.Name) @@ -30,30 +35,50 @@ func TestFindRecordById(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo") - scenarios := []struct { - id string - filter func(q *dbx.SelectQuery) error - expectError bool + collectionIdOrName string + id string + filter1 func(q *dbx.SelectQuery) error + filter2 func(q *dbx.SelectQuery) error + expectError bool }{ - {"00000000-bafd-48f7-b8b7-090638afe209", nil, true}, - {"b5c2ffc2-bafd-48f7-b8b7-090638afe209", nil, false}, - {"b5c2ffc2-bafd-48f7-b8b7-090638afe209", func(q *dbx.SelectQuery) error { + {"demo2", "missing", nil, nil, true}, + {"missing", "0yxhwia2amd8gec", nil, nil, true}, + {"demo2", "0yxhwia2amd8gec", nil, nil, false}, + {"demo2", "0yxhwia2amd8gec", func(q *dbx.SelectQuery) error { q.AndWhere(dbx.HashExp{"title": "missing"}) return nil - }, true}, - {"b5c2ffc2-bafd-48f7-b8b7-090638afe209", func(q *dbx.SelectQuery) error { + }, nil, true}, + {"demo2", "0yxhwia2amd8gec", func(q *dbx.SelectQuery) error { return errors.New("test error") + }, nil, true}, + {"demo2", "0yxhwia2amd8gec", func(q *dbx.SelectQuery) error { + q.AndWhere(dbx.HashExp{"title": "test3"}) + return nil + }, nil, false}, + {"demo2", "0yxhwia2amd8gec", func(q *dbx.SelectQuery) error { + q.AndWhere(dbx.HashExp{"title": "test3"}) + return nil + }, func(q *dbx.SelectQuery) error { + q.AndWhere(dbx.HashExp{"active": false}) + return nil }, true}, - {"b5c2ffc2-bafd-48f7-b8b7-090638afe209", func(q *dbx.SelectQuery) error { - q.AndWhere(dbx.HashExp{"title": "lorem"}) + {"sz5l5z67tg7gku0", "0yxhwia2amd8gec", func(q *dbx.SelectQuery) error { + q.AndWhere(dbx.HashExp{"title": "test3"}) + return nil + }, func(q *dbx.SelectQuery) error { + q.AndWhere(dbx.HashExp{"active": true}) return nil }, false}, } for i, scenario := range scenarios { - record, err := app.Dao().FindRecordById(collection, scenario.id, scenario.filter) + record, err := app.Dao().FindRecordById( + scenario.collectionIdOrName, + scenario.id, + scenario.filter1, + scenario.filter2, + ) hasErr := err != nil if hasErr != scenario.expectError { @@ -70,25 +95,34 @@ func TestFindRecordsByIds(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo") - scenarios := []struct { - ids []string - filter func(q *dbx.SelectQuery) error - expectTotal int - expectError bool + collectionIdOrName string + ids []string + filter1 func(q *dbx.SelectQuery) error + filter2 func(q *dbx.SelectQuery) error + expectTotal int + expectError bool }{ - {[]string{}, nil, 0, false}, - {[]string{"00000000-bafd-48f7-b8b7-090638afe209"}, nil, 0, false}, - {[]string{"b5c2ffc2-bafd-48f7-b8b7-090638afe209"}, nil, 1, false}, + {"demo2", []string{}, nil, nil, 0, false}, + {"demo2", []string{""}, nil, nil, 0, false}, + {"demo2", []string{"missing"}, nil, nil, 0, false}, + {"missing", []string{"0yxhwia2amd8gec"}, nil, nil, 0, true}, + {"demo2", []string{"0yxhwia2amd8gec"}, nil, nil, 1, false}, + {"sz5l5z67tg7gku0", []string{"0yxhwia2amd8gec"}, nil, nil, 1, false}, { - []string{"b5c2ffc2-bafd-48f7-b8b7-090638afe209", "848a1dea-5ddd-42d6-a00d-030547bffcfe"}, + "demo2", + []string{"0yxhwia2amd8gec", "llvuca81nly1qls"}, + nil, nil, 2, false, }, { - []string{"b5c2ffc2-bafd-48f7-b8b7-090638afe209", "848a1dea-5ddd-42d6-a00d-030547bffcfe"}, + "demo2", + []string{"0yxhwia2amd8gec", "llvuca81nly1qls"}, + func(q *dbx.SelectQuery) error { + return nil // empty filter + }, func(q *dbx.SelectQuery) error { return errors.New("test error") }, @@ -96,9 +130,25 @@ func TestFindRecordsByIds(t *testing.T) { true, }, { - []string{"b5c2ffc2-bafd-48f7-b8b7-090638afe209", "848a1dea-5ddd-42d6-a00d-030547bffcfe"}, + "demo2", + []string{"0yxhwia2amd8gec", "llvuca81nly1qls"}, func(q *dbx.SelectQuery) error { - q.AndWhere(dbx.Like("title", "test").Match(true, true)) + q.AndWhere(dbx.HashExp{"active": true}) + return nil + }, + nil, + 1, + false, + }, + { + "sz5l5z67tg7gku0", + []string{"0yxhwia2amd8gec", "llvuca81nly1qls"}, + func(q *dbx.SelectQuery) error { + q.AndWhere(dbx.HashExp{"active": true}) + return nil + }, + func(q *dbx.SelectQuery) error { + q.AndWhere(dbx.Not(dbx.HashExp{"title": ""})) return nil }, 1, @@ -107,7 +157,12 @@ func TestFindRecordsByIds(t *testing.T) { } for i, scenario := range scenarios { - records, err := app.Dao().FindRecordsByIds(collection, scenario.ids, scenario.filter) + records, err := app.Dao().FindRecordsByIds( + scenario.collectionIdOrName, + scenario.ids, + scenario.filter1, + scenario.filter2, + ) hasErr := err != nil if hasErr != scenario.expectError { @@ -131,35 +186,53 @@ func TestFindRecordsByExpr(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo") - scenarios := []struct { - expression dbx.Expression - expectIds []string - expectError bool + collectionIdOrName string + expressions []dbx.Expression + expectIds []string + expectError bool }{ { + "missing", nil, []string{}, true, }, { - dbx.HashExp{"id": 123}, + "demo2", + nil, + []string{ + "achvryl401bhse3", + "llvuca81nly1qls", + "0yxhwia2amd8gec", + }, + false, + }, + { + "demo2", + []dbx.Expression{ + nil, + dbx.HashExp{"id": "123"}, + }, []string{}, false, }, { - dbx.Like("title", "test").Match(true, true), + "sz5l5z67tg7gku0", + []dbx.Expression{ + dbx.Like("title", "test").Match(true, true), + dbx.HashExp{"active": true}, + }, []string{ - "848a1dea-5ddd-42d6-a00d-030547bffcfe", - "577bd676-aacb-4072-b7da-99d00ee210a4", + "achvryl401bhse3", + "0yxhwia2amd8gec", }, false, }, } for i, scenario := range scenarios { - records, err := app.Dao().FindRecordsByExpr(collection, scenario.expression) + records, err := app.Dao().FindRecordsByExpr(scenario.collectionIdOrName, scenario.expressions...) hasErr := err != nil if hasErr != scenario.expectError { @@ -183,42 +256,52 @@ func TestFindFirstRecordByData(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo") - scenarios := []struct { - key string - value any - expectId string - expectError bool + collectionIdOrName string + key string + value any + expectId string + expectError bool }{ { + "missing", + "id", + "llvuca81nly1qls", + "llvuca81nly1qls", + true, + }, + { + "demo2", "", - "848a1dea-5ddd-42d6-a00d-030547bffcfe", + "llvuca81nly1qls", "", true, }, { + "demo2", "id", "invalid", "", true, }, { + "demo2", "id", - "848a1dea-5ddd-42d6-a00d-030547bffcfe", - "848a1dea-5ddd-42d6-a00d-030547bffcfe", + "llvuca81nly1qls", + "llvuca81nly1qls", false, }, { + "sz5l5z67tg7gku0", "title", - "lorem", - "b5c2ffc2-bafd-48f7-b8b7-090638afe209", + "test3", + "0yxhwia2amd8gec", false, }, } for i, scenario := range scenarios { - record, err := app.Dao().FindFirstRecordByData(collection, scenario.key, scenario.value) + record, err := app.Dao().FindFirstRecordByData(scenario.collectionIdOrName, scenario.key, scenario.value) hasErr := err != nil if hasErr != scenario.expectError { @@ -236,32 +319,44 @@ func TestIsRecordValueUnique(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - - testManyRelsId1 := "df55c8ff-45ef-4c82-8aed-6e2183fe1125" - testManyRelsId2 := "b84cd893-7119-43c9-8505-3c4e22da28a9" + testManyRelsId1 := "bgs820n361vj1qd" + testManyRelsId2 := "4q1xlclmfloku33" + testManyRelsId3 := "oap640cot4yru2s" scenarios := []struct { - key string - value any - excludeId string - expected bool + collectionIdOrName string + key string + value any + excludeIds []string + expected bool }{ - {"", "", "", false}, - {"missing", "unique", "", false}, - {"title", "unique", "", true}, - {"title", "demo1", "", false}, - {"title", "demo1", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2", true}, - {"manyrels", []string{testManyRelsId2}, "", false}, - {"manyrels", []any{testManyRelsId2}, "", false}, - // with exclude - {"manyrels", []string{testManyRelsId1, testManyRelsId2}, "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b", true}, - // reverse order - {"manyrels", []string{testManyRelsId2, testManyRelsId1}, "", true}, + {"demo2", "", "", nil, false}, + {"demo2", "", "", []string{""}, false}, + {"demo2", "missing", "unique", nil, false}, + {"demo2", "title", "unique", nil, true}, + {"demo2", "title", "unique", []string{}, true}, + {"demo2", "title", "unique", []string{""}, true}, + {"demo2", "title", "test1", []string{""}, false}, + {"demo2", "title", "test1", []string{"llvuca81nly1qls"}, true}, + {"demo1", "rel_many", []string{testManyRelsId3}, nil, false}, + {"wsmn24bux7wo113", "rel_many", []any{testManyRelsId3}, []string{""}, false}, + {"wsmn24bux7wo113", "rel_many", []any{testManyRelsId3}, []string{"84nmscqy84lsi1t"}, true}, + // mixed json array order + {"demo1", "rel_many", []string{testManyRelsId1, testManyRelsId3, testManyRelsId2}, nil, true}, + // username special case-insensitive match + {"users", "username", "test2_username", nil, false}, + {"users", "username", "TEST2_USERNAME", nil, false}, + {"users", "username", "new_username", nil, true}, + {"users", "username", "TEST2_USERNAME", []string{"oap640cot4yru2s"}, true}, } for i, scenario := range scenarios { - result := app.Dao().IsRecordValueUnique(collection, scenario.key, scenario.value, scenario.excludeId) + result := app.Dao().IsRecordValueUnique( + scenario.collectionIdOrName, + scenario.key, + scenario.value, + scenario.excludeIds..., + ) if result != scenario.expected { t.Errorf("(%d) Expected %v, got %v", i, scenario.expected, result) @@ -269,43 +364,164 @@ func TestIsRecordValueUnique(t *testing.T) { } } -func TestFindUserRelatedRecords(t *testing.T) { +func TestFindAuthRecordByToken(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - u0 := &models.User{} - u1, _ := app.Dao().FindUserByEmail("test3@example.com") - u2, _ := app.Dao().FindUserByEmail("test2@example.com") + scenarios := []struct { + token string + baseKey string + expectedEmail string + expectError bool + }{ + // invalid auth token + { + "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.H2KKcIXiAfxvuXMFzizo1SgsinDP4hcWhD3pYoP4Nqw", + app.Settings().RecordAuthToken.Secret, + "", + true, + }, + // expired token + { + "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoxNjQwOTkxNjYxfQ.HqvpCpM0RAk3Qu9PfCMuZsk_DKh9UYuzFLwXBMTZd1w", + app.Settings().RecordAuthToken.Secret, + "", + true, + }, + // wrong base key (password reset token secret instead of auth secret) + { + "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + app.Settings().RecordPasswordResetToken.Secret, + "", + true, + }, + // valid token and base key but with deleted/missing collection + { + "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoibWlzc2luZyIsImV4cCI6MjIwODk4NTI2MX0.0oEHQpdpHp0Nb3VN8La0ssg-SjwWKiRl_k1mUGxdKlU", + app.Settings().RecordAuthToken.Secret, + "test@example.com", + true, + }, + // valid token + { + "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.UwD8JvkbQtXpymT09d7J6fdA0aP9g4FJ1GPh_ggEkzc", + app.Settings().RecordAuthToken.Secret, + "test@example.com", + false, + }, + } + + for i, scenario := range scenarios { + record, err := app.Dao().FindAuthRecordByToken(scenario.token, scenario.baseKey) + + hasErr := err != nil + if hasErr != scenario.expectError { + t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, scenario.expectError, hasErr, err) + continue + } + + if !scenario.expectError && record.Email() != scenario.expectedEmail { + t.Errorf("(%d) Expected record model %s, got %s", i, scenario.expectedEmail, record.Email()) + } + } +} + +func TestFindAuthRecordByEmail(t *testing.T) { + app, _ := tests.NewTestApp() + defer app.Cleanup() scenarios := []struct { - user *models.User - expectedIds []string + collectionIdOrName string + email string + expectError bool }{ - {u0, []string{}}, - {u1, []string{ - "94568ca2-0bee-49d7-b749-06cb97956fd9", // demo2 - "fc69274d-ca5c-416a-b9ef-561b101cfbb1", // profile - }}, - {u2, []string{ - "b2d5e39d-f569-4cc1-b593-3f074ad026bf", // profile - }}, + {"missing", "test@example.com", true}, + {"demo2", "test@example.com", true}, + {"users", "missing@example.com", true}, + {"users", "test@example.com", false}, + {"clients", "test2@example.com", false}, } for i, scenario := range scenarios { - records, err := app.Dao().FindUserRelatedRecords(scenario.user) - if err != nil { - t.Fatal(err) + record, err := app.Dao().FindAuthRecordByEmail(scenario.collectionIdOrName, scenario.email) + + hasErr := err != nil + if hasErr != scenario.expectError { + t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, scenario.expectError, hasErr, err) + continue + } + + if !scenario.expectError && record.Email() != scenario.email { + t.Errorf("(%d) Expected record with email %s, got %s", i, scenario.email, record.Email()) } + } +} + +func TestFindAuthRecordByUsername(t *testing.T) { + app, _ := tests.NewTestApp() + defer app.Cleanup() + + scenarios := []struct { + collectionIdOrName string + username string + expectError bool + }{ + {"missing", "test_username", true}, + {"demo2", "test_username", true}, + {"users", "missing", true}, + {"users", "test2_username", false}, + {"users", "TEST2_USERNAME", false}, // case insensitive check + {"clients", "clients43362", false}, + } - if len(records) != len(scenario.expectedIds) { - t.Errorf("(%d) Expected %d records, got %d (%v)", i, len(scenario.expectedIds), len(records), records) + for i, scenario := range scenarios { + record, err := app.Dao().FindAuthRecordByUsername(scenario.collectionIdOrName, scenario.username) + + hasErr := err != nil + if hasErr != scenario.expectError { + t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, scenario.expectError, hasErr, err) continue } - for _, r := range records { - if !list.ExistInSlice(r.Id, scenario.expectedIds) { - t.Errorf("(%d) Couldn't find %s in %v", i, r.Id, scenario.expectedIds) - } + if !scenario.expectError && !strings.EqualFold(record.Username(), scenario.username) { + t.Errorf("(%d) Expected record with username %s, got %s", i, scenario.username, record.Username()) + } + } +} + +func TestSuggestUniqueAuthRecordUsername(t *testing.T) { + app, _ := tests.NewTestApp() + defer app.Cleanup() + + scenarios := []struct { + collectionIdOrName string + baseUsername string + expectedPattern string + }{ + // missing collection + {"missing", "test2_username", `^test2_username\d{12}$`}, + // not an auth collection + {"demo2", "test2_username", `^test2_username\d{12}$`}, + // auth collection with unique base username + {"users", "new_username", `^new_username$`}, + {"users", "NEW_USERNAME", `^NEW_USERNAME$`}, + // auth collection with existing username + {"users", "test2_username", `^test2_username\d{3}$`}, + {"users", "TEST2_USERNAME", `^TEST2_USERNAME\d{3}$`}, + } + + for i, scenario := range scenarios { + username := app.Dao().SuggestUniqueAuthRecordUsername( + scenario.collectionIdOrName, + scenario.baseUsername, + ) + + pattern, err := regexp.Compile(scenario.expectedPattern) + if err != nil { + t.Errorf("[%d] Invalid username pattern %q: %v", i, scenario.expectedPattern, err) + } + if !pattern.MatchString(username) { + t.Fatalf("Expected username to match %s, got username %s", scenario.expectedPattern, username) } } } @@ -314,32 +530,64 @@ func TestSaveRecord(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo") + collection, _ := app.Dao().FindCollectionByNameOrId("demo2") // create // --- r1 := models.NewRecord(collection) - r1.SetDataValue("title", "test_new") + r1.Set("title", "test_new") err1 := app.Dao().SaveRecord(r1) if err1 != nil { t.Fatal(err1) } - newR1, _ := app.Dao().FindFirstRecordByData(collection, "title", "test_new") - if newR1 == nil || newR1.Id != r1.Id || newR1.GetStringDataValue("title") != r1.GetStringDataValue("title") { - t.Errorf("Expected to find record %v, got %v", r1, newR1) + newR1, _ := app.Dao().FindFirstRecordByData(collection.Id, "title", "test_new") + if newR1 == nil || newR1.Id != r1.Id || newR1.GetString("title") != r1.GetString("title") { + t.Fatalf("Expected to find record %v, got %v", r1, newR1) } // update // --- - r2, _ := app.Dao().FindFirstRecordByData(collection, "id", "b5c2ffc2-bafd-48f7-b8b7-090638afe209") - r2.SetDataValue("title", "test_update") + r2, _ := app.Dao().FindFirstRecordByData(collection.Id, "id", "0yxhwia2amd8gec") + r2.Set("title", "test_update") err2 := app.Dao().SaveRecord(r2) if err2 != nil { t.Fatal(err2) } - newR2, _ := app.Dao().FindFirstRecordByData(collection, "title", "test_update") - if newR2 == nil || newR2.Id != r2.Id || newR2.GetStringDataValue("title") != r2.GetStringDataValue("title") { - t.Errorf("Expected to find record %v, got %v", r2, newR2) + newR2, _ := app.Dao().FindFirstRecordByData(collection.Id, "title", "test_update") + if newR2 == nil || newR2.Id != r2.Id || newR2.GetString("title") != r2.GetString("title") { + t.Fatalf("Expected to find record %v, got %v", r2, newR2) + } +} + +func TestSaveRecordWithIdFromOtherCollection(t *testing.T) { + app, _ := tests.NewTestApp() + defer app.Cleanup() + + baseCollection, _ := app.Dao().FindCollectionByNameOrId("demo2") + authCollection, _ := app.Dao().FindCollectionByNameOrId("nologin") + + // base collection test + r1 := models.NewRecord(baseCollection) + r1.Set("title", "test_new") + r1.Set("id", "mk5fmymtx4wsprk") // existing id of demo3 record + r1.MarkAsNew() + if err := app.Dao().SaveRecord(r1); err != nil { + t.Fatalf("Expected nil, got error %v", err) + } + + // auth collection test + r2 := models.NewRecord(authCollection) + r2.Set("username", "test_new") + r2.Set("id", "gk390qegs4y47wn") // existing id of "clients" record + r2.MarkAsNew() + if err := app.Dao().SaveRecord(r2); err == nil { + t.Fatal("Expected error, got nil") + } + + // try again with unique id + r2.Set("id", "unique_id") + if err := app.Dao().SaveRecord(r2); err != nil { + t.Fatalf("Expected nil, got error %v", err) } } @@ -347,41 +595,50 @@ func TestDeleteRecord(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - demo, _ := app.Dao().FindCollectionByNameOrId("demo") - demo2, _ := app.Dao().FindCollectionByNameOrId("demo2") + demoCollection, _ := app.Dao().FindCollectionByNameOrId("demo2") // delete unsaved record // --- - rec1 := models.NewRecord(demo) - err1 := app.Dao().DeleteRecord(rec1) - if err1 == nil { - t.Fatal("(rec1) Didn't expect to succeed deleting new record") + rec0 := models.NewRecord(demoCollection) + if err := app.Dao().DeleteRecord(rec0); err == nil { + t.Fatal("(rec0) Didn't expect to succeed deleting unsaved record") + } + + // delete existing record + external auths + // --- + rec1, _ := app.Dao().FindRecordById("users", "4q1xlclmfloku33") + if err := app.Dao().DeleteRecord(rec1); err != nil { + t.Fatalf("(rec1) Expected nil, got error %v", err) + } + // check if it was really deleted + if refreshed, _ := app.Dao().FindRecordById(rec1.Collection().Id, rec1.Id); refreshed != nil { + t.Fatalf("(rec1) Expected record to be deleted, got %v", refreshed) + } + // check if the external auths were deleted + if auths, _ := app.Dao().FindAllExternalAuthsByRecord(rec1); len(auths) > 0 { + t.Fatalf("(rec1) Expected external auths to be deleted, got %v", auths) } // delete existing record while being part of a non-cascade required relation // --- - rec2, _ := app.Dao().FindFirstRecordByData(demo, "id", "848a1dea-5ddd-42d6-a00d-030547bffcfe") - err2 := app.Dao().DeleteRecord(rec2) - if err2 == nil { + rec2, _ := app.Dao().FindRecordById("demo3", "7nwo8tuiatetxdm") + if err := app.Dao().DeleteRecord(rec2); err == nil { t.Fatalf("(rec2) Expected error, got nil") } - // delete existing record + // delete existing record + cascade // --- - rec3, _ := app.Dao().FindFirstRecordByData(demo, "id", "577bd676-aacb-4072-b7da-99d00ee210a4") - err3 := app.Dao().DeleteRecord(rec3) - if err3 != nil { - t.Fatalf("(rec3) Expected nil, got error %v", err3) + rec3, _ := app.Dao().FindRecordById("users", "oap640cot4yru2s") + if err := app.Dao().DeleteRecord(rec3); err != nil { + t.Fatalf("(rec3) Expected nil, got error %v", err) } - // check if it was really deleted - rec3, _ = app.Dao().FindRecordById(demo, rec3.Id, nil) + rec3, _ = app.Dao().FindRecordById(rec3.Collection().Id, rec3.Id) if rec3 != nil { t.Fatalf("(rec3) Expected record to be deleted, got %v", rec3) } - // check if the operation cascaded - rel, _ := app.Dao().FindFirstRecordByData(demo2, "id", "63c2ab80-84ab-4057-a592-4604a731f78f") + rel, _ := app.Dao().FindRecordById("demo1", "84nmscqy84lsi1t") if rel != nil { t.Fatalf("(rec3) Expected the delete to cascade, found relation %v", rel) } @@ -391,16 +648,16 @@ func TestSyncRecordTableSchema(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - oldCollection, err := app.Dao().FindCollectionByNameOrId("demo") + oldCollection, err := app.Dao().FindCollectionByNameOrId("demo2") if err != nil { t.Fatal(err) } - updatedCollection, err := app.Dao().FindCollectionByNameOrId("demo") + updatedCollection, err := app.Dao().FindCollectionByNameOrId("demo2") if err != nil { t.Fatal(err) } updatedCollection.Name = "demo_renamed" - updatedCollection.Schema.RemoveField(updatedCollection.Schema.GetFieldByName("file").Id) + updatedCollection.Schema.RemoveField(updatedCollection.Schema.GetFieldByName("active").Id) updatedCollection.Schema.AddField( &schema.SchemaField{ Name: "new_field", @@ -421,6 +678,7 @@ func TestSyncRecordTableSchema(t *testing.T) { expectedTableName string expectedColumns []string }{ + // new base collection { &models.Collection{ Name: "new_table", @@ -435,12 +693,32 @@ func TestSyncRecordTableSchema(t *testing.T) { "new_table", []string{"id", "created", "updated", "test"}, }, + // new auth collection + { + &models.Collection{ + Name: "new_table_auth", + Type: models.CollectionTypeAuth, + Schema: schema.NewSchema( + &schema.SchemaField{ + Name: "test", + Type: schema.FieldTypeText, + }, + ), + }, + nil, + "new_table_auth", + []string{ + "id", "created", "updated", "test", + "username", "email", "verified", "emailVisibility", + "tokenKey", "passwordHash", "lastResetSentAt", "lastVerificationSentAt", + }, + }, // no changes { oldCollection, oldCollection, - "demo", - []string{"id", "created", "updated", "title", "file"}, + "demo3", + []string{"id", "created", "updated", "title", "active"}, }, // renamed table, deleted column, renamed columnd and new column { diff --git a/daos/request_test.go b/daos/request_test.go index 97a1c28e0..e41b8e399 100644 --- a/daos/request_test.go +++ b/daos/request_test.go @@ -59,7 +59,7 @@ func TestRequestsStats(t *testing.T) { tests.MockRequestLogsData(app) - expected := `[{"total":1,"date":"2022-05-01 10:00:00.000"},{"total":1,"date":"2022-05-02 10:00:00.000"}]` + expected := `[{"total":1,"date":"2022-05-01 10:00:00.000Z"},{"total":1,"date":"2022-05-02 10:00:00.000Z"}]` now := time.Now().UTC().Format(types.DefaultDateLayout) exp := dbx.NewExp("[[created]] <= {:date}", dbx.Params{"date": now}) @@ -84,10 +84,10 @@ func TestDeleteOldRequests(t *testing.T) { date string expectedTotal int }{ - {"2022-01-01 10:00:00.000", 2}, // no requests to delete before that time - {"2022-05-01 11:00:00.000", 1}, // only 1 request should have left - {"2022-05-03 11:00:00.000", 0}, // no more requests should have left - {"2022-05-04 11:00:00.000", 0}, // no more requests should have left + {"2022-01-01 10:00:00.000Z", 2}, // no requests to delete before that time + {"2022-05-01 11:00:00.000Z", 1}, // only 1 request should have left + {"2022-05-03 11:00:00.000Z", 0}, // no more requests should have left + {"2022-05-04 11:00:00.000Z", 0}, // no more requests should have left } for i, scenario := range scenarios { diff --git a/daos/user.go b/daos/user.go deleted file mode 100644 index 33ddd2851..000000000 --- a/daos/user.go +++ /dev/null @@ -1,282 +0,0 @@ -package daos - -import ( - "database/sql" - "errors" - "fmt" - "log" - - "github.com/pocketbase/dbx" - "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/models/schema" - "github.com/pocketbase/pocketbase/tools/list" - "github.com/pocketbase/pocketbase/tools/security" -) - -// UserQuery returns a new User model select query. -func (dao *Dao) UserQuery() *dbx.SelectQuery { - return dao.ModelQuery(&models.User{}) -} - -// LoadProfile loads the profile record associated to the provided user. -func (dao *Dao) LoadProfile(user *models.User) error { - collection, err := dao.FindCollectionByNameOrId(models.ProfileCollectionName) - if err != nil { - return err - } - - profile, err := dao.FindFirstRecordByData(collection, models.ProfileCollectionUserFieldName, user.Id) - if err != nil && err != sql.ErrNoRows { - return err - } - - user.Profile = profile - - return nil -} - -// LoadProfiles loads the profile records associated to the provided users list. -func (dao *Dao) LoadProfiles(users []*models.User) error { - collection, err := dao.FindCollectionByNameOrId(models.ProfileCollectionName) - if err != nil { - return err - } - - // extract user ids - ids := make([]string, len(users)) - usersMap := map[string]*models.User{} - for i, user := range users { - ids[i] = user.Id - usersMap[user.Id] = user - } - - profiles, err := dao.FindRecordsByExpr(collection, dbx.HashExp{ - models.ProfileCollectionUserFieldName: list.ToInterfaceSlice(ids), - }) - if err != nil { - return err - } - - // populate each user.Profile member - for _, profile := range profiles { - userId := profile.GetStringDataValue(models.ProfileCollectionUserFieldName) - user, ok := usersMap[userId] - if !ok { - continue - } - user.Profile = profile - } - - return nil -} - -// FindUserById finds a single User model by its id. -// -// This method also auto loads the related user profile record -// into the found model. -func (dao *Dao) FindUserById(id string) (*models.User, error) { - model := &models.User{} - - err := dao.UserQuery(). - AndWhere(dbx.HashExp{"id": id}). - Limit(1). - One(model) - - if err != nil { - return nil, err - } - - // try to load the user profile (if exist) - if err := dao.LoadProfile(model); err != nil { - log.Println(err) - } - - return model, nil -} - -// FindUserByEmail finds a single User model by its non-empty email address. -// -// This method also auto loads the related user profile record -// into the found model. -func (dao *Dao) FindUserByEmail(email string) (*models.User, error) { - model := &models.User{} - - err := dao.UserQuery(). - AndWhere(dbx.Not(dbx.HashExp{"email": ""})). - AndWhere(dbx.HashExp{"email": email}). - Limit(1). - One(model) - - if err != nil { - return nil, err - } - - // try to load the user profile (if exist) - if err := dao.LoadProfile(model); err != nil { - log.Println(err) - } - - return model, nil -} - -// FindUserByToken finds the user associated with the provided JWT token. -// Returns an error if the JWT token is invalid or expired. -// -// This method also auto loads the related user profile record -// into the found model. -func (dao *Dao) FindUserByToken(token string, baseTokenKey string) (*models.User, error) { - unverifiedClaims, err := security.ParseUnverifiedJWT(token) - if err != nil { - return nil, err - } - - // check required claims - id, _ := unverifiedClaims["id"].(string) - if id == "" { - return nil, errors.New("Missing or invalid token claims.") - } - - user, err := dao.FindUserById(id) - if err != nil || user == nil { - return nil, err - } - - verificationKey := user.TokenKey + baseTokenKey - - // verify token signature - if _, err := security.ParseJWT(token, verificationKey); err != nil { - return nil, err - } - - return user, nil -} - -// IsUserEmailUnique checks if the provided email address is not -// already in use by other users. -func (dao *Dao) IsUserEmailUnique(email string, excludeId string) bool { - if email == "" { - return false - } - - var exists bool - err := dao.UserQuery(). - Select("count(*)"). - AndWhere(dbx.Not(dbx.HashExp{"id": excludeId})). - AndWhere(dbx.HashExp{"email": email}). - Limit(1). - Row(&exists) - - return err == nil && !exists -} - -// DeleteUser deletes the provided User model. -// -// This method will also cascade the delete operation to all -// Record models that references the provided User model -// (delete or set to NULL, depending on the related user shema field settings). -// -// The delete operation may fail if the user is part of a required -// reference in another Record model (aka. cannot be deleted or set to NULL). -func (dao *Dao) DeleteUser(user *models.User) error { - // fetch related records - // note: the select is outside of the transaction to prevent SQLITE_LOCKED error when mixing read&write in a single transaction - relatedRecords, err := dao.FindUserRelatedRecords(user) - if err != nil { - return err - } - - return dao.RunInTransaction(func(txDao *Dao) error { - // check if related records has to be deleted (if `CascadeDelete` is set) - // OR - // just unset the user related fields (if they are not required) - // ----------------------------------------------------------- - recordsLoop: - for _, record := range relatedRecords { - var needSave bool - - for _, field := range record.Collection().Schema.Fields() { - if field.Type != schema.FieldTypeUser { - continue // not a user field - } - - ids := record.GetStringSliceDataValue(field.Name) - - // unset the user id - for i := len(ids) - 1; i >= 0; i-- { - if ids[i] == user.Id { - ids = append(ids[:i], ids[i+1:]...) - break - } - } - - options, _ := field.Options.(*schema.UserOptions) - - // cascade delete - // (only if there are no other user references in case of multiple select) - if options.CascadeDelete && len(ids) == 0 { - if err := txDao.DeleteRecord(record); err != nil { - return err - } - // no need to further iterate the user fields (the record is deleted) - continue recordsLoop - } - - if field.Required && len(ids) == 0 { - return fmt.Errorf("Failed delete the user because a record exist with required user reference to the current model (%q, %q).", record.Id, record.Collection().Name) - } - - // apply the reference changes - record.SetDataValue(field.Name, field.PrepareValue(ids)) - needSave = true - } - - if needSave { - if err := txDao.SaveRecord(record); err != nil { - return err - } - } - } - // ----------------------------------------------------------- - - return txDao.Delete(user) - }) -} - -// SaveUser upserts the provided User model. -// -// An empty profile record will be created if the user -// doesn't have a profile record set yet. -func (dao *Dao) SaveUser(user *models.User) error { - profileCollection, err := dao.FindCollectionByNameOrId(models.ProfileCollectionName) - if err != nil { - return err - } - - // fetch the related user profile record (if exist) - var userProfile *models.Record - if user.HasId() { - userProfile, _ = dao.FindFirstRecordByData( - profileCollection, - models.ProfileCollectionUserFieldName, - user.Id, - ) - } - - return dao.RunInTransaction(func(txDao *Dao) error { - if err := txDao.Save(user); err != nil { - return err - } - - // create default/empty profile record if doesn't exist - if userProfile == nil { - userProfile = models.NewRecord(profileCollection) - userProfile.SetDataValue(models.ProfileCollectionUserFieldName, user.Id) - if err := txDao.Save(userProfile); err != nil { - return err - } - user.Profile = userProfile - } - - return nil - }) -} diff --git a/daos/user_test.go b/daos/user_test.go deleted file mode 100644 index 895328c9d..000000000 --- a/daos/user_test.go +++ /dev/null @@ -1,275 +0,0 @@ -package daos_test - -import ( - "testing" - - "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tests" -) - -func TestUserQuery(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - expected := "SELECT {{_users}}.* FROM `_users`" - - sql := app.Dao().UserQuery().Build().SQL() - if sql != expected { - t.Errorf("Expected sql %s, got %s", expected, sql) - } -} - -func TestLoadProfile(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - // try to load missing profile (shouldn't return an error) - // --- - newUser := &models.User{} - err1 := app.Dao().LoadProfile(newUser) - if err1 != nil { - t.Fatalf("Expected nil, got error %v", err1) - } - - // try to load existing profile - // --- - existingUser, _ := app.Dao().FindUserByEmail("test@example.com") - existingUser.Profile = nil // reset - - err2 := app.Dao().LoadProfile(existingUser) - if err2 != nil { - t.Fatal(err2) - } - - if existingUser.Profile == nil { - t.Fatal("Expected user profile to be loaded, got nil") - } - - if existingUser.Profile.GetStringDataValue("name") != "test" { - t.Fatalf("Expected profile.name to be 'test', got %s", existingUser.Profile.GetStringDataValue("name")) - } -} - -func TestLoadProfiles(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - u0 := &models.User{} - u1, _ := app.Dao().FindUserByEmail("test@example.com") - u2, _ := app.Dao().FindUserByEmail("test2@example.com") - - users := []*models.User{u0, u1, u2} - - err := app.Dao().LoadProfiles(users) - if err != nil { - t.Fatal(err) - } - - if u0.Profile != nil { - t.Errorf("Expected profile to be nil for u0, got %v", u0.Profile) - } - if u1.Profile == nil { - t.Errorf("Expected profile to be set for u1, got nil") - } - if u2.Profile == nil { - t.Errorf("Expected profile to be set for u2, got nil") - } -} - -func TestFindUserById(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - id string - expectError bool - }{ - {"00000000-2b4a-a26b-4d01-42d3c3d77bc8", true}, - {"97cc3d3d-6ba2-383f-b42a-7bc84d27410c", false}, - } - - for i, scenario := range scenarios { - user, err := app.Dao().FindUserById(scenario.id) - - hasErr := err != nil - if hasErr != scenario.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, scenario.expectError, hasErr, err) - } - - if user != nil && user.Id != scenario.id { - t.Errorf("(%d) Expected user with id %s, got %s", i, scenario.id, user.Id) - } - } -} - -func TestFindUserByEmail(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - email string - expectError bool - }{ - {"", true}, - {"invalid", true}, - {"missing@example.com", true}, - {"test@example.com", false}, - } - - for i, scenario := range scenarios { - user, err := app.Dao().FindUserByEmail(scenario.email) - - hasErr := err != nil - if hasErr != scenario.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, scenario.expectError, hasErr, err) - continue - } - - if !scenario.expectError && user.Email != scenario.email { - t.Errorf("(%d) Expected user with email %s, got %s", i, scenario.email, user.Email) - } - } -} - -func TestFindUserByToken(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - token string - baseKey string - expectedEmail string - expectError bool - }{ - // invalid base key (password reset key for auth token) - { - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - app.Settings().UserPasswordResetToken.Secret, - "", - true, - }, - // expired token - { - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxNjQwOTkxNjYxfQ.RrSG5NwysI38DEZrIQiz3lUgI6sEuYGTll_jLRbBSiw", - app.Settings().UserAuthToken.Secret, - "", - true, - }, - // valid token - { - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZXhwIjoxODkzNDc0MDAwfQ.Wq5ac1q1f5WntIzEngXk22ydMj-eFgvfSRg7dhmPKic", - app.Settings().UserAuthToken.Secret, - "test@example.com", - false, - }, - } - - for i, scenario := range scenarios { - user, err := app.Dao().FindUserByToken(scenario.token, scenario.baseKey) - - hasErr := err != nil - if hasErr != scenario.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, scenario.expectError, hasErr, err) - continue - } - - if !scenario.expectError && user.Email != scenario.expectedEmail { - t.Errorf("(%d) Expected user model %s, got %s", i, scenario.expectedEmail, user.Email) - } - } -} - -func TestIsUserEmailUnique(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - email string - excludeId string - expected bool - }{ - {"", "", false}, - {"test@example.com", "", false}, - {"new@example.com", "", true}, - {"test@example.com", "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", true}, - } - - for i, scenario := range scenarios { - result := app.Dao().IsUserEmailUnique(scenario.email, scenario.excludeId) - if result != scenario.expected { - t.Errorf("(%d) Expected %v, got %v", i, scenario.expected, result) - } - } -} - -func TestDeleteUser(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - // try to delete unsaved user - // --- - err1 := app.Dao().DeleteUser(&models.User{}) - if err1 == nil { - t.Fatal("Expected error, got nil") - } - - // try to delete existing user - // --- - user, _ := app.Dao().FindUserByEmail("test3@example.com") - err2 := app.Dao().DeleteUser(user) - if err2 != nil { - t.Fatalf("Expected nil, got error %v", err2) - } - - // check if the delete operation was cascaded to the profiles collection (record delete) - profilesCol, _ := app.Dao().FindCollectionByNameOrId(models.ProfileCollectionName) - profile, _ := app.Dao().FindRecordById(profilesCol, user.Profile.Id, nil) - if profile != nil { - t.Fatalf("Expected user profile to be deleted, got %v", profile) - } - - // check if delete operation was cascaded to the related demo2 collection (null set) - demo2Col, _ := app.Dao().FindCollectionByNameOrId("demo2") - record, _ := app.Dao().FindRecordById(demo2Col, "94568ca2-0bee-49d7-b749-06cb97956fd9", nil) - if record == nil { - t.Fatal("Expected to found related record, got nil") - } - if record.GetStringDataValue("user") != "" { - t.Fatalf("Expected user field to be set to empty string, got %v", record.GetStringDataValue("user")) - } -} - -func TestSaveUser(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - // create - // --- - u1 := &models.User{} - u1.Email = "new@example.com" - u1.SetPassword("123456") - err1 := app.Dao().SaveUser(u1) - if err1 != nil { - t.Fatal(err1) - } - u1, refreshErr1 := app.Dao().FindUserByEmail("new@example.com") - if refreshErr1 != nil { - t.Fatalf("Expected user with email new@example.com to have been created, got error %v", refreshErr1) - } - if u1.Profile == nil { - t.Fatalf("Expected creating a user to create also an empty profile record") - } - - // update - // --- - u2, _ := app.Dao().FindUserByEmail("test@example.com") - u2.Email = "test_update@example.com" - err2 := app.Dao().SaveUser(u2) - if err2 != nil { - t.Fatal(err2) - } - u2, refreshErr2 := app.Dao().FindUserByEmail("test_update@example.com") - if u2 == nil { - t.Fatalf("Couldn't find user with email test_update@example.com (%v)", refreshErr2) - } -} diff --git a/examples/base/main.go b/examples/base/main.go index abd1cc719..41655c04c 100644 --- a/examples/base/main.go +++ b/examples/base/main.go @@ -35,7 +35,7 @@ func main() { app.OnBeforeServe().Add(func(e *core.ServeEvent) error { // serves static files from the provided public dir (if exists) - e.Router.GET("/*", apis.StaticDirectoryHandler(os.DirFS(publicDirFlag), false)) + e.Router.GET("/*", apis.StaticDirectoryHandler(os.DirFS(publicDirFlag), true)) return nil }) diff --git a/forms/admin_login.go b/forms/admin_login.go index d2e7b8332..a88d1ad58 100644 --- a/forms/admin_login.go +++ b/forms/admin_login.go @@ -10,53 +10,36 @@ import ( "github.com/pocketbase/pocketbase/models" ) -// AdminLogin specifies an admin email/pass login form. +// AdminLogin is an admin email/pass login form. type AdminLogin struct { - config AdminLoginConfig + app core.App + dao *daos.Dao - Email string `form:"email" json:"email"` + Identity string `form:"identity" json:"identity"` Password string `form:"password" json:"password"` } -// AdminLoginConfig is the [AdminLogin] factory initializer config. +// NewAdminLogin creates a new [AdminLogin] form initialized with +// the provided [core.App] instance. // -// NB! App is a required struct member. -type AdminLoginConfig struct { - App core.App - Dao *daos.Dao -} - -// NewAdminLogin creates a new [AdminLogin] form with initializer -// config created from the provided [core.App] instance. -// -// If you want to submit the form as part of another transaction, use -// [NewAdminLoginWithConfig] with explicitly set Dao. +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. func NewAdminLogin(app core.App) *AdminLogin { - return NewAdminLoginWithConfig(AdminLoginConfig{ - App: app, - }) -} - -// NewAdminLoginWithConfig creates a new [AdminLogin] form -// with the provided config or panics on invalid configuration. -func NewAdminLoginWithConfig(config AdminLoginConfig) *AdminLogin { - form := &AdminLogin{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() + return &AdminLogin{ + app: app, + dao: app.Dao(), } +} - return form +// SetDao replaces the default form Dao instance with the provided one. +func (form *AdminLogin) SetDao(dao *daos.Dao) { + form.dao = dao } // Validate makes the form validatable by implementing [validation.Validatable] interface. func (form *AdminLogin) Validate() error { return validation.ValidateStruct(form, - validation.Field(&form.Email, validation.Required, validation.Length(1, 255), is.EmailFormat), + validation.Field(&form.Identity, validation.Required, validation.Length(1, 255), is.EmailFormat), validation.Field(&form.Password, validation.Required, validation.Length(1, 255)), ) } @@ -68,7 +51,7 @@ func (form *AdminLogin) Submit() (*models.Admin, error) { return nil, err } - admin, err := form.config.Dao.FindAdminByEmail(form.Email) + admin, err := form.dao.FindAdminByEmail(form.Identity) if err != nil { return nil, err } diff --git a/forms/admin_login_test.go b/forms/admin_login_test.go index 5124bdc7c..bd63e7c27 100644 --- a/forms/admin_login_test.go +++ b/forms/admin_login_test.go @@ -7,48 +7,7 @@ import ( "github.com/pocketbase/pocketbase/tests" ) -func TestAdminLoginPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewAdminLogin(nil) -} - -func TestAdminLoginValidate(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - form := forms.NewAdminLogin(app) - - scenarios := []struct { - email string - password string - expectError bool - }{ - {"", "", true}, - {"", "123", true}, - {"test@example.com", "", true}, - {"test", "123", true}, - {"test@example.com", "123", false}, - } - - for i, s := range scenarios { - form.Email = s.email - form.Password = s.password - - err := form.Validate() - - hasErr := err != nil - if hasErr != s.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err) - } - } -} - -func TestAdminLoginSubmit(t *testing.T) { +func TestAdminLoginValidateAndSubmit(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() @@ -62,14 +21,14 @@ func TestAdminLoginSubmit(t *testing.T) { {"", "", true}, {"", "1234567890", true}, {"test@example.com", "", true}, - {"test", "1234567890", true}, + {"test", "test", true}, {"missing@example.com", "1234567890", true}, {"test@example.com", "123456789", true}, {"test@example.com", "1234567890", false}, } for i, s := range scenarios { - form.Email = s.email + form.Identity = s.email form.Password = s.password admin, err := form.Submit() diff --git a/forms/admin_password_reset_confirm.go b/forms/admin_password_reset_confirm.go index 9898c0788..134abc3f2 100644 --- a/forms/admin_password_reset_confirm.go +++ b/forms/admin_password_reset_confirm.go @@ -8,55 +8,41 @@ import ( "github.com/pocketbase/pocketbase/models" ) -// AdminPasswordResetConfirm specifies an admin password reset confirmation form. +// AdminPasswordResetConfirm is an admin password reset confirmation form. type AdminPasswordResetConfirm struct { - config AdminPasswordResetConfirmConfig + app core.App + dao *daos.Dao Token string `form:"token" json:"token"` Password string `form:"password" json:"password"` PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"` } -// AdminPasswordResetConfirmConfig is the [AdminPasswordResetConfirm] factory initializer config. -// -// NB! App is required struct member. -type AdminPasswordResetConfirmConfig struct { - App core.App - Dao *daos.Dao -} - // NewAdminPasswordResetConfirm creates a new [AdminPasswordResetConfirm] -// form with initializer config created from the provided [core.App] instance. +// form initialized with from the provided [core.App] instance. // -// If you want to submit the form as part of another transaction, use -// [NewAdminPasswordResetConfirmWithConfig] with explicitly set Dao. +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. func NewAdminPasswordResetConfirm(app core.App) *AdminPasswordResetConfirm { - return NewAdminPasswordResetConfirmWithConfig(AdminPasswordResetConfirmConfig{ - App: app, - }) -} - -// NewAdminPasswordResetConfirmWithConfig creates a new [AdminPasswordResetConfirm] -// form with the provided config or panics on invalid configuration. -func NewAdminPasswordResetConfirmWithConfig(config AdminPasswordResetConfirmConfig) *AdminPasswordResetConfirm { - form := &AdminPasswordResetConfirm{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() + return &AdminPasswordResetConfirm{ + app: app, + dao: app.Dao(), } +} - return form +// SetDao replaces the form Dao instance with the provided one. +// +// This is useful if you want to use a specific transaction Dao instance +// instead of the default app.Dao(). +func (form *AdminPasswordResetConfirm) SetDao(dao *daos.Dao) { + form.dao = dao } // Validate makes the form validatable by implementing [validation.Validatable] interface. func (form *AdminPasswordResetConfirm) Validate() error { return validation.ValidateStruct(form, validation.Field(&form.Token, validation.Required, validation.By(form.checkToken)), - validation.Field(&form.Password, validation.Required, validation.Length(10, 100)), + validation.Field(&form.Password, validation.Required, validation.Length(10, 72)), validation.Field(&form.PasswordConfirm, validation.Required, validation.By(validators.Compare(form.Password))), ) } @@ -67,10 +53,7 @@ func (form *AdminPasswordResetConfirm) checkToken(value any) error { return nil // nothing to check } - admin, err := form.config.Dao.FindAdminByToken( - v, - form.config.App.Settings().AdminPasswordResetToken.Secret, - ) + admin, err := form.dao.FindAdminByToken(v, form.app.Settings().AdminPasswordResetToken.Secret) if err != nil || admin == nil { return validation.NewError("validation_invalid_token", "Invalid or expired token.") } @@ -85,9 +68,9 @@ func (form *AdminPasswordResetConfirm) Submit() (*models.Admin, error) { return nil, err } - admin, err := form.config.Dao.FindAdminByToken( + admin, err := form.dao.FindAdminByToken( form.Token, - form.config.App.Settings().AdminPasswordResetToken.Secret, + form.app.Settings().AdminPasswordResetToken.Secret, ) if err != nil { return nil, err @@ -97,7 +80,7 @@ func (form *AdminPasswordResetConfirm) Submit() (*models.Admin, error) { return nil, err } - if err := form.config.Dao.SaveAdmin(admin); err != nil { + if err := form.dao.SaveAdmin(admin); err != nil { return nil, err } diff --git a/forms/admin_password_reset_confirm_test.go b/forms/admin_password_reset_confirm_test.go index de894f57e..fc825838b 100644 --- a/forms/admin_password_reset_confirm_test.go +++ b/forms/admin_password_reset_confirm_test.go @@ -8,17 +8,7 @@ import ( "github.com/pocketbase/pocketbase/tools/security" ) -func TestAdminPasswordResetPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewAdminPasswordResetConfirm(nil) -} - -func TestAdminPasswordResetConfirmValidate(t *testing.T) { +func TestAdminPasswordResetConfirmValidateAndSubmit(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() @@ -38,64 +28,23 @@ func TestAdminPasswordResetConfirmValidate(t *testing.T) { {"test", "123", "123", true}, { // expired - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MTAxMzIwMH0.Gp_1b5WVhqjj2o3nJhNUlJmpdiwFLXN72LbMP-26gjA", + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImV4cCI6MTY0MDk5MTY2MX0.GLwCOsgWTTEKXTK-AyGW838de1OeZGIjfHH0FoRLqZg", "1234567890", "1234567890", true, }, { - // valid - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg5MzQ3NDAwMH0.72IhlL_5CpNGE0ZKM7sV9aAKa3wxQaMZdDiHBo0orpw", - "1234567890", - "1234567890", - false, - }, - } - - for i, s := range scenarios { - form.Token = s.token - form.Password = s.password - form.PasswordConfirm = s.passwordConfirm - - err := form.Validate() - - hasErr := err != nil - if hasErr != s.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err) - } - } -} - -func TestAdminPasswordResetConfirmSubmit(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - form := forms.NewAdminPasswordResetConfirm(app) - - scenarios := []struct { - token string - password string - passwordConfirm string - expectError bool - }{ - {"", "", "", true}, - {"", "123", "", true}, - {"", "", "123", true}, - {"test", "", "", true}, - {"test", "123", "", true}, - {"test", "123", "123", true}, - { - // expired - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTY0MTAxMzIwMH0.Gp_1b5WVhqjj2o3nJhNUlJmpdiwFLXN72LbMP-26gjA", - "1234567890", + // valid with mismatched passwords + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImV4cCI6MjIwODk4MTYwMH0.kwFEler6KSMKJNstuaSDvE1QnNdCta5qSnjaIQ0hhhc", "1234567890", + "1234567891", true, }, { - // valid - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjJiNGE5N2NjLTNmODMtNGQwMS1hMjZiLTNkNzdiYzg0MmQzYyIsInR5cGUiOiJhZG1pbiIsImV4cCI6MTg5MzQ3NDAwMH0.72IhlL_5CpNGE0ZKM7sV9aAKa3wxQaMZdDiHBo0orpw", - "1234567890", - "1234567890", + // valid with matching passwords + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InN5d2JoZWNuaDQ2cmhtMCIsInR5cGUiOiJhZG1pbiIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImV4cCI6MjIwODk4MTYwMH0.kwFEler6KSMKJNstuaSDvE1QnNdCta5qSnjaIQ0hhhc", + "1234567891", + "1234567891", false, }, } @@ -110,6 +59,7 @@ func TestAdminPasswordResetConfirmSubmit(t *testing.T) { hasErr := err != nil if hasErr != s.expectError { t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err) + continue } if s.expectError { diff --git a/forms/admin_password_reset_request.go b/forms/admin_password_reset_request.go index 546113fde..1abfd9d80 100644 --- a/forms/admin_password_reset_request.go +++ b/forms/admin_password_reset_request.go @@ -12,48 +12,31 @@ import ( "github.com/pocketbase/pocketbase/tools/types" ) -// AdminPasswordResetRequest specifies an admin password reset request form. +// AdminPasswordResetRequest is an admin password reset request form. type AdminPasswordResetRequest struct { - config AdminPasswordResetRequestConfig + app core.App + dao *daos.Dao + resendThreshold float64 // in seconds Email string `form:"email" json:"email"` } -// AdminPasswordResetRequestConfig is the [AdminPasswordResetRequest] factory initializer config. -// -// NB! App is required struct member. -type AdminPasswordResetRequestConfig struct { - App core.App - Dao *daos.Dao - ResendThreshold float64 // in seconds -} - // NewAdminPasswordResetRequest creates a new [AdminPasswordResetRequest] -// form with initializer config created from the provided [core.App] instance. +// form initialized with from the provided [core.App] instance. // -// If you want to submit the form as part of another transaction, use -// [NewAdminPasswordResetRequestWithConfig] with explicitly set Dao. +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. func NewAdminPasswordResetRequest(app core.App) *AdminPasswordResetRequest { - return NewAdminPasswordResetRequestWithConfig(AdminPasswordResetRequestConfig{ - App: app, - ResendThreshold: 120, // 2min - }) -} - -// NewAdminPasswordResetRequestWithConfig creates a new [AdminPasswordResetRequest] -// form with the provided config or panics on invalid configuration. -func NewAdminPasswordResetRequestWithConfig(config AdminPasswordResetRequestConfig) *AdminPasswordResetRequest { - form := &AdminPasswordResetRequest{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() + return &AdminPasswordResetRequest{ + app: app, + dao: app.Dao(), + resendThreshold: 120, // 2min } +} - return form +// SetDao replaces the default form Dao instance with the provided one. +func (form *AdminPasswordResetRequest) SetDao(dao *daos.Dao) { + form.dao = dao } // Validate makes the form validatable by implementing [validation.Validatable] interface. @@ -77,23 +60,23 @@ func (form *AdminPasswordResetRequest) Submit() error { return err } - admin, err := form.config.Dao.FindAdminByEmail(form.Email) + admin, err := form.dao.FindAdminByEmail(form.Email) if err != nil { return err } now := time.Now().UTC() lastResetSentAt := admin.LastResetSentAt.Time() - if now.Sub(lastResetSentAt).Seconds() < form.config.ResendThreshold { + if now.Sub(lastResetSentAt).Seconds() < form.resendThreshold { return errors.New("You have already requested a password reset.") } - if err := mails.SendAdminPasswordReset(form.config.App, admin); err != nil { + if err := mails.SendAdminPasswordReset(form.app, admin); err != nil { return err } // update last sent timestamp admin.LastResetSentAt = types.NowDateTime() - return form.config.Dao.SaveAdmin(admin) + return form.dao.SaveAdmin(admin) } diff --git a/forms/admin_password_reset_request_test.go b/forms/admin_password_reset_request_test.go index 123804a21..0261c9357 100644 --- a/forms/admin_password_reset_request_test.go +++ b/forms/admin_password_reset_request_test.go @@ -7,46 +7,7 @@ import ( "github.com/pocketbase/pocketbase/tests" ) -func TestAdminPasswordResetRequestPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewAdminPasswordResetRequest(nil) -} - -func TestAdminPasswordResetRequestValidate(t *testing.T) { - testApp, _ := tests.NewTestApp() - defer testApp.Cleanup() - - form := forms.NewAdminPasswordResetRequest(testApp) - - scenarios := []struct { - email string - expectError bool - }{ - {"", true}, - {"", true}, - {"invalid", true}, - {"missing@example.com", false}, // doesn't check for existing admin - {"test@example.com", false}, - } - - for i, s := range scenarios { - form.Email = s.email - - err := form.Validate() - - hasErr := err != nil - if hasErr != s.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err) - } - } -} - -func TestAdminPasswordResetRequestSubmit(t *testing.T) { +func TestAdminPasswordResetRequestValidateAndSubmit(t *testing.T) { testApp, _ := tests.NewTestApp() defer testApp.Cleanup() diff --git a/forms/admin_upsert.go b/forms/admin_upsert.go index f2916d435..b1212c09b 100644 --- a/forms/admin_upsert.go +++ b/forms/admin_upsert.go @@ -9,10 +9,11 @@ import ( "github.com/pocketbase/pocketbase/models" ) -// AdminUpsert specifies a [models.Admin] upsert (create/update) form. +// AdminUpsert is a [models.Admin] upsert (create/update) form. type AdminUpsert struct { - config AdminUpsertConfig - admin *models.Admin + app core.App + dao *daos.Dao + admin *models.Admin Id string `form:"id" json:"id"` Avatar int `form:"avatar" json:"avatar"` @@ -21,41 +22,17 @@ type AdminUpsert struct { PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"` } -// AdminUpsertConfig is the [AdminUpsert] factory initializer config. -// -// NB! App is a required struct member. -type AdminUpsertConfig struct { - App core.App - Dao *daos.Dao -} - // NewAdminUpsert creates a new [AdminUpsert] form with initializer // config created from the provided [core.App] and [models.Admin] instances // (for create you could pass a pointer to an empty Admin - `&models.Admin{}`). // -// If you want to submit the form as part of another transaction, use -// [NewAdminUpsertWithConfig] with explicitly set Dao. +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. func NewAdminUpsert(app core.App, admin *models.Admin) *AdminUpsert { - return NewAdminUpsertWithConfig(AdminUpsertConfig{ - App: app, - }, admin) -} - -// NewAdminUpsertWithConfig creates a new [AdminUpsert] form -// with the provided config and [models.Admin] instance or panics on invalid configuration -// (for create you could pass a pointer to an empty Admin - `&models.Admin{}`). -func NewAdminUpsertWithConfig(config AdminUpsertConfig, admin *models.Admin) *AdminUpsert { form := &AdminUpsert{ - config: config, - admin: admin, - } - - if form.config.App == nil || form.admin == nil { - panic("Invalid initializer config or nil upsert model.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() + app: app, + dao: app.Dao(), + admin: admin, } // load defaults @@ -66,6 +43,11 @@ func NewAdminUpsertWithConfig(config AdminUpsertConfig, admin *models.Admin) *Ad return form } +// SetDao replaces the default form Dao instance with the provided one. +func (form *AdminUpsert) SetDao(dao *daos.Dao) { + form.dao = dao +} + // Validate makes the form validatable by implementing [validation.Validatable] interface. func (form *AdminUpsert) Validate() error { return validation.ValidateStruct(form, @@ -92,7 +74,7 @@ func (form *AdminUpsert) Validate() error { validation.Field( &form.Password, validation.When(form.admin.IsNew(), validation.Required), - validation.Length(10, 100), + validation.Length(10, 72), ), validation.Field( &form.PasswordConfirm, @@ -105,7 +87,7 @@ func (form *AdminUpsert) Validate() error { func (form *AdminUpsert) checkUniqueEmail(value any) error { v, _ := value.(string) - if form.config.Dao.IsAdminEmailUnique(v, form.admin.Id) { + if form.dao.IsAdminEmailUnique(v, form.admin.Id) { return nil } @@ -135,6 +117,6 @@ func (form *AdminUpsert) Submit(interceptors ...InterceptorFunc) error { } return runInterceptors(func() error { - return form.config.Dao.SaveAdmin(form.admin) + return form.dao.SaveAdmin(form.admin) }, interceptors...) } diff --git a/forms/admin_upsert_test.go b/forms/admin_upsert_test.go index 2ec6c42e5..e92f029ef 100644 --- a/forms/admin_upsert_test.go +++ b/forms/admin_upsert_test.go @@ -6,35 +6,11 @@ import ( "fmt" "testing" - validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/pocketbase/pocketbase/forms" "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/tests" ) -func TestAdminUpsertPanic1(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewAdminUpsert(nil, nil) -} - -func TestAdminUpsertPanic2(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewAdminUpsert(app, nil) -} - func TestNewAdminUpsert(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() @@ -54,125 +30,7 @@ func TestNewAdminUpsert(t *testing.T) { } } -func TestAdminUpsertValidate(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - id string - avatar int - email string - password string - passwordConfirm string - expectedErrors int - }{ - { - "", - -1, - "", - "", - "", - 3, - }, - { - "", - 10, - "invalid", - "12345678", - "87654321", - 4, - }, - { - // existing email - "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", - 3, - "test2@example.com", - "1234567890", - "1234567890", - 1, - }, - { - // mismatching passwords - "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", - 3, - "test@example.com", - "1234567890", - "1234567891", - 1, - }, - { - // create without setting password - "", - 9, - "test_create@example.com", - "", - "", - 1, - }, - { - // create with existing email - "", - 9, - "test@example.com", - "1234567890!", - "1234567890!", - 1, - }, - { - // update without setting password - "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", - 3, - "test_update@example.com", - "", - "", - 0, - }, - { - // create with password - "", - 9, - "test_create@example.com", - "1234567890!", - "1234567890!", - 0, - }, - { - // update with password - "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", - 4, - "test_update@example.com", - "1234567890", - "1234567890", - 0, - }, - } - - for i, s := range scenarios { - admin := &models.Admin{} - if s.id != "" { - admin, _ = app.Dao().FindAdminById(s.id) - } - - form := forms.NewAdminUpsert(app, admin) - form.Avatar = s.avatar - form.Email = s.email - form.Password = s.password - form.PasswordConfirm = s.passwordConfirm - - result := form.Validate() - errs, ok := result.(validation.Errors) - if !ok && result != nil { - t.Errorf("(%d) Failed to parse errors %v", i, result) - continue - } - - if len(errs) != s.expectedErrors { - t.Errorf("(%d) Expected %d errors, got %d (%v)", i, s.expectedErrors, len(errs), errs) - } - } -} - -func TestAdminUpsertSubmit(t *testing.T) { +func TestAdminUpsertValidateAndSubmit(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() @@ -189,7 +47,7 @@ func TestAdminUpsertSubmit(t *testing.T) { }, { // update empty - "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", + "sywbhecnh46rhm0", `{}`, false, }, @@ -225,7 +83,7 @@ func TestAdminUpsertSubmit(t *testing.T) { }, { // update failure - existing email - "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", + "sywbhecnh46rhm0", `{ "email": "test2@example.com" }`, @@ -233,7 +91,7 @@ func TestAdminUpsertSubmit(t *testing.T) { }, { // update failure - mismatching passwords - "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", + "sywbhecnh46rhm0", `{ "password": "1234567890", "passwordConfirm": "1234567891" @@ -242,7 +100,7 @@ func TestAdminUpsertSubmit(t *testing.T) { }, { // update success - new email - "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", + "sywbhecnh46rhm0", `{ "email": "test_update@example.com" }`, @@ -250,7 +108,7 @@ func TestAdminUpsertSubmit(t *testing.T) { }, { // update success - new password - "2b4a97cc-3f83-4d01-a26b-3d77bc842d3c", + "sywbhecnh46rhm0", `{ "password": "1234567890", "passwordConfirm": "1234567890" diff --git a/forms/base.go b/forms/base.go index ee7bad20f..46c2251f6 100644 --- a/forms/base.go +++ b/forms/base.go @@ -2,7 +2,9 @@ // validation and applying changes to existing DB models through the app Dao. package forms -import "regexp" +import ( + "regexp" +) // base ID value regex pattern var idRegex = regexp.MustCompile(`^[^\@\#\$\&\|\.\,\'\"\\\/\s]+$`) diff --git a/forms/collection_upsert.go b/forms/collection_upsert.go index 387bca28a..7ab76d15e 100644 --- a/forms/collection_upsert.go +++ b/forms/collection_upsert.go @@ -1,6 +1,7 @@ package forms import ( + "encoding/json" "fmt" "regexp" "strings" @@ -11,17 +12,21 @@ import ( "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/models/schema" "github.com/pocketbase/pocketbase/resolvers" + "github.com/pocketbase/pocketbase/tools/list" "github.com/pocketbase/pocketbase/tools/search" + "github.com/pocketbase/pocketbase/tools/types" ) var collectionNameRegex = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_]*$`) -// CollectionUpsert specifies a [models.Collection] upsert (create/update) form. +// CollectionUpsert is a [models.Collection] upsert (create/update) form. type CollectionUpsert struct { - config CollectionUpsertConfig + app core.App + dao *daos.Dao collection *models.Collection Id string `form:"id" json:"id"` + Type string `form:"type" json:"type"` Name string `form:"name" json:"name"` System bool `form:"system" json:"system"` Schema schema.Schema `form:"schema" json:"schema"` @@ -30,47 +35,25 @@ type CollectionUpsert struct { CreateRule *string `form:"createRule" json:"createRule"` UpdateRule *string `form:"updateRule" json:"updateRule"` DeleteRule *string `form:"deleteRule" json:"deleteRule"` -} - -// CollectionUpsertConfig is the [CollectionUpsert] factory initializer config. -// -// NB! App is a required struct member. -type CollectionUpsertConfig struct { - App core.App - Dao *daos.Dao + Options types.JsonMap `form:"options" json:"options"` } // NewCollectionUpsert creates a new [CollectionUpsert] form with initializer // config created from the provided [core.App] and [models.Collection] instances // (for create you could pass a pointer to an empty Collection - `&models.Collection{}`). // -// If you want to submit the form as part of another transaction, use -// [NewCollectionUpsertWithConfig] with explicitly set Dao. +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. func NewCollectionUpsert(app core.App, collection *models.Collection) *CollectionUpsert { - return NewCollectionUpsertWithConfig(CollectionUpsertConfig{ - App: app, - }, collection) -} - -// NewCollectionUpsertWithConfig creates a new [CollectionUpsert] form -// with the provided config and [models.Collection] instance or panics on invalid configuration -// (for create you could pass a pointer to an empty Collection - `&models.Collection{}`). -func NewCollectionUpsertWithConfig(config CollectionUpsertConfig, collection *models.Collection) *CollectionUpsert { form := &CollectionUpsert{ - config: config, + app: app, + dao: app.Dao(), collection: collection, } - if form.config.App == nil || form.collection == nil { - panic("Invalid initializer config or nil upsert model.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - // load defaults form.Id = form.collection.Id + form.Type = form.collection.Type form.Name = form.collection.Name form.System = form.collection.System form.ListRule = form.collection.ListRule @@ -78,6 +61,11 @@ func NewCollectionUpsertWithConfig(config CollectionUpsertConfig, collection *mo form.CreateRule = form.collection.CreateRule form.UpdateRule = form.collection.UpdateRule form.DeleteRule = form.collection.DeleteRule + form.Options = form.collection.Options + + if form.Type == "" { + form.Type = models.CollectionTypeBase + } clone, _ := form.collection.Schema.Clone() if clone != nil { @@ -89,8 +77,15 @@ func NewCollectionUpsertWithConfig(config CollectionUpsertConfig, collection *mo return form } +// SetDao replaces the default form Dao instance with the provided one. +func (form *CollectionUpsert) SetDao(dao *daos.Dao) { + form.dao = dao +} + // Validate makes the form validatable by implementing [validation.Validatable] interface. func (form *CollectionUpsert) Validate() error { + isAuth := form.Type == models.CollectionTypeAuth + return validation.ValidateStruct(form, validation.Field( &form.Id, @@ -104,6 +99,12 @@ func (form *CollectionUpsert) Validate() error { &form.System, validation.By(form.ensureNoSystemFlagChange), ), + validation.Field( + &form.Type, + validation.Required, + validation.In(models.CollectionTypeAuth, models.CollectionTypeBase), + validation.By(form.ensureNoTypeChange), + ), validation.Field( &form.Name, validation.Required, @@ -118,23 +119,35 @@ func (form *CollectionUpsert) Validate() error { validation.By(form.ensureNoSystemFieldsChange), validation.By(form.ensureNoFieldsTypeChange), validation.By(form.ensureExistingRelationCollectionId), + validation.When( + isAuth, + validation.By(form.ensureNoAuthFieldName), + ), ), validation.Field(&form.ListRule, validation.By(form.checkRule)), validation.Field(&form.ViewRule, validation.By(form.checkRule)), validation.Field(&form.CreateRule, validation.By(form.checkRule)), validation.Field(&form.UpdateRule, validation.By(form.checkRule)), validation.Field(&form.DeleteRule, validation.By(form.checkRule)), + validation.Field(&form.Options, validation.By(form.checkOptions)), ) } func (form *CollectionUpsert) checkUniqueName(value any) error { v, _ := value.(string) - if !form.config.Dao.IsCollectionNameUnique(v, form.collection.Id) { + // ensure unique collection name + if !form.dao.IsCollectionNameUnique(v, form.collection.Id) { return validation.NewError("validation_collection_name_exists", "Collection name must be unique (case insensitive).") } - if (form.collection.IsNew() || !strings.EqualFold(v, form.collection.Name)) && form.config.Dao.HasTable(v) { + // ensure that the collection name doesn't collide with the id of any collection + if form.dao.FindById(&models.Collection{}, v) == nil { + return validation.NewError("validation_collection_name_id_duplicate", "The name must not match an existing collection id.") + } + + // ensure that there is no existing table name with the same name + if (form.collection.IsNew() || !strings.EqualFold(v, form.collection.Name)) && form.dao.HasTable(v) { return validation.NewError("validation_collection_name_table_exists", "The collection name must be also unique table name.") } @@ -144,21 +157,31 @@ func (form *CollectionUpsert) checkUniqueName(value any) error { func (form *CollectionUpsert) ensureNoSystemNameChange(value any) error { v, _ := value.(string) - if form.collection.IsNew() || !form.collection.System || v == form.collection.Name { - return nil + if !form.collection.IsNew() && form.collection.System && v != form.collection.Name { + return validation.NewError("validation_collection_system_name_change", "System collections cannot be renamed.") } - return validation.NewError("validation_system_collection_name_change", "System collections cannot be renamed.") + return nil } func (form *CollectionUpsert) ensureNoSystemFlagChange(value any) error { v, _ := value.(bool) - if form.collection.IsNew() || v == form.collection.System { - return nil + if !form.collection.IsNew() && v != form.collection.System { + return validation.NewError("validation_collection_system_flag_change", "System collection state cannot be changed.") } - return validation.NewError("validation_system_collection_flag_change", "System collection state cannot be changed.") + return nil +} + +func (form *CollectionUpsert) ensureNoTypeChange(value any) error { + v, _ := value.(string) + + if !form.collection.IsNew() && v != form.collection.Type { + return validation.NewError("validation_collection_type_change", "Collection type cannot be changed.") + } + + return nil } func (form *CollectionUpsert) ensureNoFieldsTypeChange(value any) error { @@ -191,7 +214,7 @@ func (form *CollectionUpsert) ensureExistingRelationCollectionId(value any) erro continue } - if _, err := form.config.Dao.FindCollectionByNameOrId(options.CollectionId); err != nil { + if _, err := form.dao.FindCollectionByNameOrId(options.CollectionId); err != nil { return validation.Errors{fmt.Sprint(i): validation.NewError( "validation_field_invalid_relation", "The relation collection doesn't exist.", @@ -202,6 +225,36 @@ func (form *CollectionUpsert) ensureExistingRelationCollectionId(value any) erro return nil } +func (form *CollectionUpsert) ensureNoAuthFieldName(value any) error { + v, _ := value.(schema.Schema) + + if form.Type != models.CollectionTypeAuth { + return nil // not an auth collection + } + + authFieldNames := schema.AuthFieldNames() + // exclude the meta RecordUpsert form fields + authFieldNames = append(authFieldNames, "password", "passwordConfirm", "oldPassword") + + errs := validation.Errors{} + for i, field := range v.Fields() { + if list.ExistInSlice(field.Name, authFieldNames) { + errs[fmt.Sprint(i)] = validation.Errors{ + "name": validation.NewError( + "validation_reserved_auth_field_name", + "The field name is reserved and cannot be used.", + ), + } + } + } + + if len(errs) > 0 { + return errs + } + + return nil +} + func (form *CollectionUpsert) ensureNoSystemFieldsChange(value any) error { v, _ := value.(schema.Schema) @@ -222,17 +275,44 @@ func (form *CollectionUpsert) ensureNoSystemFieldsChange(value any) error { func (form *CollectionUpsert) checkRule(value any) error { v, _ := value.(*string) - if v == nil || *v == "" { return nil // nothing to check } dummy := &models.Collection{Schema: form.Schema} - r := resolvers.NewRecordFieldResolver(form.config.Dao, dummy, nil) + r := resolvers.NewRecordFieldResolver(form.dao, dummy, nil, true) _, err := search.FilterData(*v).BuildExpr(r) if err != nil { - return validation.NewError("validation_collection_rule", "Invalid filter rule.") + return validation.NewError("validation_invalid_rule", "Invalid filter rule.") + } + + return nil +} + +func (form *CollectionUpsert) checkOptions(value any) error { + v, _ := value.(types.JsonMap) + + if form.Type == models.CollectionTypeAuth { + raw, err := v.MarshalJSON() + if err != nil { + return validation.NewError("validation_invalid_options", "Invalid options.") + } + + options := models.CollectionAuthOptions{} + if err := json.Unmarshal(raw, &options); err != nil { + return validation.NewError("validation_invalid_options", "Invalid options.") + } + + // check the generic validations + if err := options.Validate(); err != nil { + return err + } + + // additional form specific validations + if err := form.checkRule(options.ManageRule); err != nil { + return validation.Errors{"manageRule": err} + } } return nil @@ -250,6 +330,9 @@ func (form *CollectionUpsert) Submit(interceptors ...InterceptorFunc) error { } if form.collection.IsNew() { + // type can be set only on create + form.collection.Type = form.Type + // system flag can be set only on create form.collection.System = form.System @@ -271,8 +354,9 @@ func (form *CollectionUpsert) Submit(interceptors ...InterceptorFunc) error { form.collection.CreateRule = form.CreateRule form.collection.UpdateRule = form.UpdateRule form.collection.DeleteRule = form.DeleteRule + form.collection.SetOptions(form.Options) return runInterceptors(func() error { - return form.config.Dao.SaveCollection(form.collection) + return form.dao.SaveCollection(form.collection) }, interceptors...) } diff --git a/forms/collection_upsert_test.go b/forms/collection_upsert_test.go index 0595f493c..db2bd6bb5 100644 --- a/forms/collection_upsert_test.go +++ b/forms/collection_upsert_test.go @@ -14,35 +14,13 @@ import ( "github.com/spf13/cast" ) -func TestCollectionUpsertPanic1(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewCollectionUpsert(nil, nil) -} - -func TestCollectionUpsertPanic2(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewCollectionUpsert(app, nil) -} - func TestNewCollectionUpsert(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() collection := &models.Collection{} - collection.Name = "test" + collection.Name = "test_name" + collection.Type = "test_type" collection.System = true listRule := "testview" collection.ListRule = &listRule @@ -65,6 +43,10 @@ func TestNewCollectionUpsert(t *testing.T) { t.Errorf("Expected Name %q, got %q", collection.Name, form.Name) } + if form.Type != collection.Type { + t.Errorf("Expected Type %q, got %q", collection.Type, form.Type) + } + if form.System != collection.System { t.Errorf("Expected System %v, got %v", collection.System, form.System) } @@ -104,95 +86,24 @@ func TestNewCollectionUpsert(t *testing.T) { } } -func TestCollectionUpsertValidate(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - jsonData string - expectedErrors []string - }{ - {"{}", []string{"name", "schema"}}, - { - `{ - "name": "test ?!@#$", - "system": true, - "schema": [ - {"name":"","type":"text"} - ], - "listRule": "missing = '123'", - "viewRule": "missing = '123'", - "createRule": "missing = '123'", - "updateRule": "missing = '123'", - "deleteRule": "missing = '123'" - }`, - []string{"name", "schema", "listRule", "viewRule", "createRule", "updateRule", "deleteRule"}, - }, - { - `{ - "name": "test", - "system": true, - "schema": [ - {"name":"test","type":"text"} - ], - "listRule": "test='123'", - "viewRule": "test='123'", - "createRule": "test='123'", - "updateRule": "test='123'", - "deleteRule": "test='123'" - }`, - []string{}, - }, - } - - for i, s := range scenarios { - form := forms.NewCollectionUpsert(app, &models.Collection{}) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - // parse errors - result := form.Validate() - errs, ok := result.(validation.Errors) - if !ok && result != nil { - t.Errorf("(%d) Failed to parse errors %v", i, result) - continue - } - - // check errors - if len(errs) > len(s.expectedErrors) { - t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) - } - for _, k := range s.expectedErrors { - if _, ok := errs[k]; !ok { - t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) - } - } - } -} - -func TestCollectionUpsertSubmit(t *testing.T) { +func TestCollectionUpsertValidateAndSubmit(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() scenarios := []struct { + testName string existingName string jsonData string expectedErrors []string }{ - // empty create - {"", "{}", []string{"name", "schema"}}, - // empty update - {"demo", "{}", []string{}}, - // create failure + {"empty create", "", "{}", []string{"name", "schema"}}, + {"empty update", "demo2", "{}", []string{}}, { + "create failure", "", `{ "name": "test ?!@#$", + "type": "invalid", "system": true, "schema": [ {"name":"","type":"text"} @@ -203,13 +114,13 @@ func TestCollectionUpsertSubmit(t *testing.T) { "updateRule": "missing = '123'", "deleteRule": "missing = '123'" }`, - []string{"name", "schema", "listRule", "viewRule", "createRule", "updateRule", "deleteRule"}, + []string{"name", "type", "schema", "listRule", "viewRule", "createRule", "updateRule", "deleteRule"}, }, - // create failure - existing name { + "create failure - existing name", "", `{ - "name": "demo", + "name": "demo1", "system": true, "schema": [ {"name":"test","type":"text"} @@ -222,19 +133,19 @@ func TestCollectionUpsertSubmit(t *testing.T) { }`, []string{"name"}, }, - // create failure - existing internal table { + "create failure - existing internal table", "", `{ - "name": "_users", + "name": "_admins", "schema": [ {"name":"test","type":"text"} ] }`, []string{"name"}, }, - // create failure - name starting with underscore { + "create failure - name starting with underscore", "", `{ "name": "_test_new", @@ -244,8 +155,8 @@ func TestCollectionUpsertSubmit(t *testing.T) { }`, []string{"name"}, }, - // create failure - duplicated field names (case insensitive) { + "create failure - duplicated field names (case insensitive)", "", `{ "name": "test_new", @@ -256,8 +167,21 @@ func TestCollectionUpsertSubmit(t *testing.T) { }`, []string{"schema"}, }, - // create success { + "create failure - check type options validators", + "", + `{ + "name": "test_new", + "type": "auth", + "schema": [ + {"name":"test","type":"text"} + ], + "options": { "minPasswordLength": 3 } + }`, + []string{"options"}, + }, + { + "create success", "", `{ "name": "test_new", @@ -274,8 +198,8 @@ func TestCollectionUpsertSubmit(t *testing.T) { }`, []string{}, }, - // update failure - changing field type { + "update failure - changing field type", "test_new", `{ "schema": [ @@ -285,8 +209,8 @@ func TestCollectionUpsertSubmit(t *testing.T) { }`, []string{"schema"}, }, - // update success - rename fields to existing field names (aka. reusing field names) { + "update success - rename fields to existing field names (aka. reusing field names)", "test_new", `{ "schema": [ @@ -296,34 +220,43 @@ func TestCollectionUpsertSubmit(t *testing.T) { }`, []string{}, }, - // update failure - existing name { - "demo", - `{"name": "demo2"}`, + "update failure - existing name", + "demo2", + `{"name": "demo3"}`, []string{"name"}, }, - // update failure - changing system collection { - models.ProfileCollectionName, + "update failure - changing system collection", + "nologin", `{ "name": "update", "system": false, "schema": [ - {"id":"koih1lqx","name":"userId","type":"text"} + {"id":"koih1lqx","name":"abc","type":"text"} ], - "listRule": "userId = '123'", - "viewRule": "userId = '123'", - "createRule": "userId = '123'", - "updateRule": "userId = '123'", - "deleteRule": "userId = '123'" + "listRule": "abc = '123'", + "viewRule": "abc = '123'", + "createRule": "abc = '123'", + "updateRule": "abc = '123'", + "deleteRule": "abc = '123'" + }`, + []string{"name", "system"}, + }, + { + "update failure - changing collection type", + "demo3", + `{ + "type": "auth" }`, - []string{"name", "system", "schema"}, + []string{"type"}, }, - // update failure - all fields { - "demo", + "update failure - all fields", + "demo2", `{ "name": "test ?!@#$", + "type": "invalid", "system": true, "schema": [ {"name":"","type":"text"} @@ -332,15 +265,17 @@ func TestCollectionUpsertSubmit(t *testing.T) { "viewRule": "missing = '123'", "createRule": "missing = '123'", "updateRule": "missing = '123'", - "deleteRule": "missing = '123'" + "deleteRule": "missing = '123'", + "options": {"test": 123} }`, - []string{"name", "system", "schema", "listRule", "viewRule", "createRule", "updateRule", "deleteRule"}, + []string{"name", "type", "system", "schema", "listRule", "viewRule", "createRule", "updateRule", "deleteRule"}, }, - // update success - update all fields { - "demo", + "update success - update all fields", + "clients", `{ "name": "demo_update", + "type": "auth", "schema": [ {"id":"_2hlxbmp","name":"test","type":"text"} ], @@ -348,13 +283,14 @@ func TestCollectionUpsertSubmit(t *testing.T) { "viewRule": "test='123'", "createRule": "test='123'", "updateRule": "test='123'", - "deleteRule": "test='123'" + "deleteRule": "test='123'", + "options": {"minPasswordLength": 10} }`, []string{}, }, - // update failure - rename the schema field of the last updated collection // (fail due to filters old field references) { + "update failure - rename the schema field of the last updated collection", "demo_update", `{ "schema": [ @@ -363,9 +299,9 @@ func TestCollectionUpsertSubmit(t *testing.T) { }`, []string{"listRule", "viewRule", "createRule", "updateRule", "deleteRule"}, }, - // update success - rename the schema field of the last updated collection // (cleared filter references) { + "update success - rename the schema field of the last updated collection", "demo_update", `{ "schema": [ @@ -379,21 +315,21 @@ func TestCollectionUpsertSubmit(t *testing.T) { }`, []string{}, }, - // update success - system collection { - models.ProfileCollectionName, + "update success - system collection", + "nologin", `{ - "listRule": "userId='123'", - "viewRule": "userId='123'", - "createRule": "userId='123'", - "updateRule": "userId='123'", - "deleteRule": "userId='123'" + "listRule": "name='123'", + "viewRule": "name='123'", + "createRule": "name='123'", + "updateRule": "name='123'", + "deleteRule": "name='123'" }`, []string{}, }, } - for i, s := range scenarios { + for _, s := range scenarios { collection := &models.Collection{} if s.existingName != "" { var err error @@ -408,7 +344,7 @@ func TestCollectionUpsertSubmit(t *testing.T) { // load data loadErr := json.Unmarshal([]byte(s.jsonData), form) if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) + t.Errorf("[%s] Failed to load form data: %v", s.testName, loadErr) continue } @@ -424,7 +360,7 @@ func TestCollectionUpsertSubmit(t *testing.T) { result := form.Submit(interceptor) errs, ok := result.(validation.Errors) if !ok && result != nil { - t.Errorf("(%d) Failed to parse errors %v", i, result) + t.Errorf("[%s] Failed to parse errors %v", s.testName, result) continue } @@ -434,16 +370,16 @@ func TestCollectionUpsertSubmit(t *testing.T) { expectInterceptorCall = 0 } if interceptorCalls != expectInterceptorCall { - t.Errorf("(%d) Expected interceptor to be called %d, got %d", i, expectInterceptorCall, interceptorCalls) + t.Errorf("[%s] Expected interceptor to be called %d, got %d", s.testName, expectInterceptorCall, interceptorCalls) } // check errors if len(errs) > len(s.expectedErrors) { - t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) + t.Errorf("[%s] Expected error keys %v, got %v", s.testName, s.expectedErrors, errs) } for _, k := range s.expectedErrors { if _, ok := errs[k]; !ok { - t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) + t.Errorf("[%s] Missing expected error key %q in %v", s.testName, k, errs) } } @@ -453,42 +389,46 @@ func TestCollectionUpsertSubmit(t *testing.T) { collection, _ = app.Dao().FindCollectionByNameOrId(form.Name) if collection == nil { - t.Errorf("(%d) Expected to find collection %q, got nil", i, form.Name) + t.Errorf("[%s] Expected to find collection %q, got nil", s.testName, form.Name) continue } if form.Name != collection.Name { - t.Errorf("(%d) Expected Name %q, got %q", i, collection.Name, form.Name) + t.Errorf("[%s] Expected Name %q, got %q", s.testName, collection.Name, form.Name) + } + + if form.Type != collection.Type { + t.Errorf("[%s] Expected Type %q, got %q", s.testName, collection.Type, form.Type) } if form.System != collection.System { - t.Errorf("(%d) Expected System %v, got %v", i, collection.System, form.System) + t.Errorf("[%s] Expected System %v, got %v", s.testName, collection.System, form.System) } if cast.ToString(form.ListRule) != cast.ToString(collection.ListRule) { - t.Errorf("(%d) Expected ListRule %v, got %v", i, collection.ListRule, form.ListRule) + t.Errorf("[%s] Expected ListRule %v, got %v", s.testName, collection.ListRule, form.ListRule) } if cast.ToString(form.ViewRule) != cast.ToString(collection.ViewRule) { - t.Errorf("(%d) Expected ViewRule %v, got %v", i, collection.ViewRule, form.ViewRule) + t.Errorf("[%s] Expected ViewRule %v, got %v", s.testName, collection.ViewRule, form.ViewRule) } if cast.ToString(form.CreateRule) != cast.ToString(collection.CreateRule) { - t.Errorf("(%d) Expected CreateRule %v, got %v", i, collection.CreateRule, form.CreateRule) + t.Errorf("[%s] Expected CreateRule %v, got %v", s.testName, collection.CreateRule, form.CreateRule) } if cast.ToString(form.UpdateRule) != cast.ToString(collection.UpdateRule) { - t.Errorf("(%d) Expected UpdateRule %v, got %v", i, collection.UpdateRule, form.UpdateRule) + t.Errorf("[%s] Expected UpdateRule %v, got %v", s.testName, collection.UpdateRule, form.UpdateRule) } if cast.ToString(form.DeleteRule) != cast.ToString(collection.DeleteRule) { - t.Errorf("(%d) Expected DeleteRule %v, got %v", i, collection.DeleteRule, form.DeleteRule) + t.Errorf("[%s] Expected DeleteRule %v, got %v", s.testName, collection.DeleteRule, form.DeleteRule) } formSchema, _ := form.Schema.MarshalJSON() collectionSchema, _ := collection.Schema.MarshalJSON() if string(formSchema) != string(collectionSchema) { - t.Errorf("(%d) Expected Schema %v, got %v", i, string(collectionSchema), string(formSchema)) + t.Errorf("[%s] Expected Schema %v, got %v", s.testName, string(collectionSchema), string(formSchema)) } } } @@ -497,7 +437,7 @@ func TestCollectionUpsertSubmitInterceptors(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, err := app.Dao().FindCollectionByNameOrId("demo") + collection, err := app.Dao().FindCollectionByNameOrId("demo2") if err != nil { t.Fatal(err) } @@ -547,7 +487,7 @@ func TestCollectionUpsertWithCustomId(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - existingCollection, err := app.Dao().FindCollectionByNameOrId("demo3") + existingCollection, err := app.Dao().FindCollectionByNameOrId("demo2") if err != nil { t.Fatal(err) } @@ -621,27 +561,27 @@ func TestCollectionUpsertWithCustomId(t *testing.T) { }, } - for _, scenario := range scenarios { - form := forms.NewCollectionUpsert(app, scenario.collection) + for _, s := range scenarios { + form := forms.NewCollectionUpsert(app, s.collection) // load data - loadErr := json.Unmarshal([]byte(scenario.jsonData), form) + loadErr := json.Unmarshal([]byte(s.jsonData), form) if loadErr != nil { - t.Errorf("[%s] Failed to load form data: %v", scenario.name, loadErr) + t.Errorf("[%s] Failed to load form data: %v", s.name, loadErr) continue } submitErr := form.Submit() hasErr := submitErr != nil - if hasErr != scenario.expectError { - t.Errorf("[%s] Expected hasErr to be %v, got %v (%v)", scenario.name, scenario.expectError, hasErr, submitErr) + if hasErr != s.expectError { + t.Errorf("[%s] Expected hasErr to be %v, got %v (%v)", s.name, s.expectError, hasErr, submitErr) } if !hasErr && form.Id != "" { _, err := app.Dao().FindCollectionByNameOrId(form.Id) if err != nil { - t.Errorf("[%s] Expected to find record with id %s, got %v", scenario.name, form.Id, err) + t.Errorf("[%s] Expected to find record with id %s, got %v", s.name, form.Id, err) } } } diff --git a/forms/collections_import.go b/forms/collections_import.go index 8a1e8c503..2b5a2d381 100644 --- a/forms/collections_import.go +++ b/forms/collections_import.go @@ -11,48 +11,31 @@ import ( "github.com/pocketbase/pocketbase/models" ) -// CollectionsImport specifies a form model to bulk import +// CollectionsImport is a form model to bulk import // (create, replace and delete) collections from a user provided list. type CollectionsImport struct { - config CollectionsImportConfig + app core.App + dao *daos.Dao Collections []*models.Collection `form:"collections" json:"collections"` DeleteMissing bool `form:"deleteMissing" json:"deleteMissing"` } -// CollectionsImportConfig is the [CollectionsImport] factory initializer config. -// -// NB! App is a required struct member. -type CollectionsImportConfig struct { - App core.App - Dao *daos.Dao -} - // NewCollectionsImport creates a new [CollectionsImport] form with -// initializer config created from the provided [core.App] instance. +// initialized with from the provided [core.App] instance. // -// If you want to submit the form as part of another transaction, use -// [NewCollectionsImportWithConfig] with explicitly set Dao. +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. func NewCollectionsImport(app core.App) *CollectionsImport { - return NewCollectionsImportWithConfig(CollectionsImportConfig{ - App: app, - }) -} - -// NewCollectionsImportWithConfig creates a new [CollectionsImport] -// form with the provided config or panics on invalid configuration. -func NewCollectionsImportWithConfig(config CollectionsImportConfig) *CollectionsImport { - form := &CollectionsImport{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() + return &CollectionsImport{ + app: app, + dao: app.Dao(), } +} - return form +// SetDao replaces the default form Dao instance with the provided one. +func (form *CollectionsImport) SetDao(dao *daos.Dao) { + form.dao = dao } // Validate makes the form validatable by implementing [validation.Validatable] interface. @@ -79,7 +62,7 @@ func (form *CollectionsImport) Submit(interceptors ...InterceptorFunc) error { } return runInterceptors(func() error { - return form.config.Dao.RunInTransaction(func(txDao *daos.Dao) error { + return form.dao.RunInTransaction(func(txDao *daos.Dao) error { importErr := txDao.ImportCollections( form.Collections, form.DeleteMissing, @@ -95,7 +78,7 @@ func (form *CollectionsImport) Submit(interceptors ...InterceptorFunc) error { } // generic/db failure - if form.config.App.IsDebug() { + if form.app.IsDebug() { log.Println("Internal import failure:", importErr) } return validation.Errors{"collections": validation.NewError( @@ -121,13 +104,12 @@ func (form *CollectionsImport) beforeRecordsSync(txDao *daos.Dao, mappedNew, map upsertModel = collection } - upsertForm := NewCollectionUpsertWithConfig(CollectionUpsertConfig{ - App: form.config.App, - Dao: txDao, - }, upsertModel) + upsertForm := NewCollectionUpsert(form.app, upsertModel) + upsertForm.SetDao(txDao) // load form fields with the refreshed collection state upsertForm.Id = collection.Id + upsertForm.Type = collection.Type upsertForm.Name = collection.Name upsertForm.System = collection.System upsertForm.ListRule = collection.ListRule @@ -136,6 +118,7 @@ func (form *CollectionsImport) beforeRecordsSync(txDao *daos.Dao, mappedNew, map upsertForm.UpdateRule = collection.UpdateRule upsertForm.DeleteRule = collection.DeleteRule upsertForm.Schema = collection.Schema + upsertForm.Options = collection.Options if err := upsertForm.Validate(); err != nil { // serialize the validation error(s) diff --git a/forms/collections_import_test.go b/forms/collections_import_test.go index 671affbb6..d811fe405 100644 --- a/forms/collections_import_test.go +++ b/forms/collections_import_test.go @@ -10,16 +10,6 @@ import ( "github.com/pocketbase/pocketbase/tests" ) -func TestCollectionsImportPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewCollectionsImport(nil) -} - func TestCollectionsImportValidate(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() @@ -62,7 +52,7 @@ func TestCollectionsImportSubmit(t *testing.T) { "collections": [] }`, expectError: true, - expectCollectionsCount: 5, + expectCollectionsCount: 7, expectEvents: nil, }, { @@ -92,7 +82,7 @@ func TestCollectionsImportSubmit(t *testing.T) { ] }`, expectError: true, - expectCollectionsCount: 5, + expectCollectionsCount: 7, expectEvents: map[string]int{ "OnModelBeforeCreate": 2, }, @@ -124,7 +114,7 @@ func TestCollectionsImportSubmit(t *testing.T) { ] }`, expectError: false, - expectCollectionsCount: 7, + expectCollectionsCount: 9, expectEvents: map[string]int{ "OnModelBeforeCreate": 2, "OnModelAfterCreate": 2, @@ -147,7 +137,7 @@ func TestCollectionsImportSubmit(t *testing.T) { ] }`, expectError: true, - expectCollectionsCount: 5, + expectCollectionsCount: 7, expectEvents: map[string]int{ "OnModelBeforeCreate": 1, }, @@ -158,8 +148,8 @@ func TestCollectionsImportSubmit(t *testing.T) { "deleteMissing": true, "collections": [ { - "id":"3f2888f8-075d-49fe-9d09-ea7e951000dc", - "name":"demo", + "id":"sz5l5z67tg7gku0", + "name":"demo2", "schema":[ { "id":"_2hlxbmp", @@ -189,19 +179,22 @@ func TestCollectionsImportSubmit(t *testing.T) { ] }`, expectError: true, - expectCollectionsCount: 5, + expectCollectionsCount: 7, + expectEvents: map[string]int{ + "OnModelBeforeDelete": 5, + }, }, { name: "modified + new collection", jsonData: `{ "collections": [ { - "id":"3f2888f8-075d-49fe-9d09-ea7e951000dc", - "name":"demo", + "id":"sz5l5z67tg7gku0", + "name":"demo2", "schema":[ { "id":"_2hlxbmp", - "name":"title", + "name":"title_new", "type":"text", "system":false, "required":true, @@ -237,7 +230,7 @@ func TestCollectionsImportSubmit(t *testing.T) { ] }`, expectError: false, - expectCollectionsCount: 7, + expectCollectionsCount: 9, expectEvents: map[string]int{ "OnModelBeforeUpdate": 1, "OnModelAfterUpdate": 1, @@ -251,45 +244,44 @@ func TestCollectionsImportSubmit(t *testing.T) { "deleteMissing": true, "collections": [ { - "id":"abe78266-fd4d-4aea-962d-8c0138ac522b", - "name":"profiles", - "system":true, - "listRule":"userId = @request.user.id", - "viewRule":"created > 'test_change'", - "createRule":"userId = @request.user.id", - "updateRule":"userId = @request.user.id", - "deleteRule":"userId = @request.user.id", - "schema":[ - { - "id":"koih1lqx", - "name":"userId", - "type":"user", - "system":true, - "required":true, - "unique":true, - "options":{ - "maxSelect":1, - "cascadeDelete":true - } - }, + "id": "kpv709sk2lqbqk8", + "system": true, + "name": "nologin", + "type": "auth", + "options": { + "allowEmailAuth": false, + "allowOAuth2Auth": false, + "allowUsernameAuth": false, + "exceptEmailDomains": [], + "manageRule": "@request.auth.collectionName = 'users'", + "minPasswordLength": 8, + "onlyEmailDomains": [], + "requireEmail": true + }, + "listRule": "", + "viewRule": "", + "createRule": "", + "updateRule": "", + "deleteRule": "", + "schema": [ { - "id":"69ycbg3q", - "name":"rel", - "type":"relation", - "system":false, - "required":false, - "unique":false, - "options":{ - "maxSelect":2, - "collectionId":"abe78266-fd4d-4aea-962d-8c0138ac522b", - "cascadeDelete":false + "id": "x8zzktwe", + "name": "name", + "type": "text", + "system": false, + "required": false, + "unique": false, + "options": { + "min": null, + "max": null, + "pattern": "" } } ] }, { - "id":"3f2888f8-075d-49fe-9d09-ea7e951000dc", - "name":"demo", + "id":"sz5l5z67tg7gku0", + "name":"demo2", "schema":[ { "id":"_2hlxbmp", @@ -308,7 +300,7 @@ func TestCollectionsImportSubmit(t *testing.T) { }, { "id": "test_deleted_collection_name_reuse", - "name": "demo2", + "name": "demo1", "schema": [ { "id":"fz6iql2m", @@ -326,8 +318,8 @@ func TestCollectionsImportSubmit(t *testing.T) { "OnModelAfterUpdate": 2, "OnModelBeforeCreate": 1, "OnModelAfterCreate": 1, - "OnModelBeforeDelete": 3, - "OnModelAfterDelete": 3, + "OnModelBeforeDelete": 5, + "OnModelAfterDelete": 5, }, }, } diff --git a/forms/record_email_change_confirm.go b/forms/record_email_change_confirm.go new file mode 100644 index 000000000..f4712299a --- /dev/null +++ b/forms/record_email_change_confirm.go @@ -0,0 +1,135 @@ +package forms + +import ( + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/models/schema" + "github.com/pocketbase/pocketbase/tools/security" +) + +// RecordEmailChangeConfirm is an auth record email change confirmation form. +type RecordEmailChangeConfirm struct { + app core.App + dao *daos.Dao + collection *models.Collection + + Token string `form:"token" json:"token"` + Password string `form:"password" json:"password"` +} + +// NewRecordEmailChangeConfirm creates a new [RecordEmailChangeConfirm] form +// initialized with from the provided [core.App] and [models.Collection] instances. +// +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. +func NewRecordEmailChangeConfirm(app core.App, collection *models.Collection) *RecordEmailChangeConfirm { + return &RecordEmailChangeConfirm{ + app: app, + dao: app.Dao(), + collection: collection, + } +} + +// SetDao replaces the default form Dao instance with the provided one. +func (form *RecordEmailChangeConfirm) SetDao(dao *daos.Dao) { + form.dao = dao +} + +// Validate makes the form validatable by implementing [validation.Validatable] interface. +func (form *RecordEmailChangeConfirm) Validate() error { + return validation.ValidateStruct(form, + validation.Field( + &form.Token, + validation.Required, + validation.By(form.checkToken), + ), + validation.Field( + &form.Password, + validation.Required, + validation.Length(1, 100), + validation.By(form.checkPassword), + ), + ) +} + +func (form *RecordEmailChangeConfirm) checkToken(value any) error { + v, _ := value.(string) + if v == "" { + return nil // nothing to check + } + + authRecord, _, err := form.parseToken(v) + if err != nil { + return err + } + + if authRecord.Collection().Id != form.collection.Id { + return validation.NewError("validation_token_collection_mismatch", "The provided token is for different auth collection.") + } + + return nil +} + +func (form *RecordEmailChangeConfirm) checkPassword(value any) error { + v, _ := value.(string) + if v == "" { + return nil // nothing to check + } + + authRecord, _, _ := form.parseToken(form.Token) + if authRecord == nil || !authRecord.ValidatePassword(v) { + return validation.NewError("validation_invalid_password", "Missing or invalid auth record password.") + } + + return nil +} + +func (form *RecordEmailChangeConfirm) parseToken(token string) (*models.Record, string, error) { + // check token payload + claims, _ := security.ParseUnverifiedJWT(token) + newEmail, _ := claims["newEmail"].(string) + if newEmail == "" { + return nil, "", validation.NewError("validation_invalid_token_payload", "Invalid token payload - newEmail must be set.") + } + + // ensure that there aren't other users with the new email + if !form.dao.IsRecordValueUnique(form.collection.Id, schema.FieldNameEmail, newEmail) { + return nil, "", validation.NewError("validation_existing_token_email", "The new email address is already registered: "+newEmail) + } + + // verify that the token is not expired and its signature is valid + authRecord, err := form.dao.FindAuthRecordByToken( + token, + form.app.Settings().RecordEmailChangeToken.Secret, + ) + if err != nil || authRecord == nil { + return nil, "", validation.NewError("validation_invalid_token", "Invalid or expired token.") + } + + return authRecord, newEmail, nil +} + +// Submit validates and submits the auth record email change confirmation form. +// On success returns the updated auth record associated to `form.Token`. +func (form *RecordEmailChangeConfirm) Submit() (*models.Record, error) { + if err := form.Validate(); err != nil { + return nil, err + } + + authRecord, newEmail, err := form.parseToken(form.Token) + if err != nil { + return nil, err + } + + authRecord.SetEmail(newEmail) + authRecord.SetVerified(true) + authRecord.RefreshTokenKey() // invalidate old tokens + + if err := form.dao.SaveRecord(authRecord); err != nil { + return nil, err + } + + return authRecord, nil +} diff --git a/forms/record_email_change_confirm_test.go b/forms/record_email_change_confirm_test.go new file mode 100644 index 000000000..5d6ee1d1b --- /dev/null +++ b/forms/record_email_change_confirm_test.go @@ -0,0 +1,126 @@ +package forms_test + +import ( + "encoding/json" + "testing" + + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/pocketbase/pocketbase/forms" + "github.com/pocketbase/pocketbase/tests" + "github.com/pocketbase/pocketbase/tools/security" +) + +func TestRecordEmailChangeConfirmValidateAndSubmit(t *testing.T) { + testApp, _ := tests.NewTestApp() + defer testApp.Cleanup() + + authCollection, err := testApp.Dao().FindCollectionByNameOrId("users") + if err != nil { + t.Fatal(err) + } + + scenarios := []struct { + jsonData string + expectedErrors []string + }{ + // empty payload + {"{}", []string{"token", "password"}}, + // empty data + { + `{"token": "", "password": ""}`, + []string{"token", "password"}, + }, + // invalid token payload + { + `{ + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZXhwIjoyMjA4OTg1MjYxfQ.quDgaCi2rGTRx3qO06CrFvHdeCua_5J7CCVWSaFhkus", + "password": "123456" + }`, + []string{"token", "password"}, + }, + // expired token + { + `{ + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJ0ZXN0X25ld0BleGFtcGxlLmNvbSIsImV4cCI6MTYwOTQ1NTY2MX0.n1OJXJEACMNPT9aMTO48cVJexIiZEtHsz4UNBIfMcf4", + "password": "123456" + }`, + []string{"token", "password"}, + }, + // existing new email + { + `{ + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJ0ZXN0MkBleGFtcGxlLmNvbSIsImV4cCI6MjIwODk4NTI2MX0.Q_o6zpc2URggTU0mWv2CS0rIPbQhFdmrjZ-ASwHh1Ww", + "password": "1234567890" + }`, + []string{"token", "password"}, + }, + // wrong confirmation password + { + `{ + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJ0ZXN0X25ld0BleGFtcGxlLmNvbSIsImV4cCI6MjIwODk4NTI2MX0.hmR7Ye23C68tS1LgHgYgT7NBJczTad34kzcT4sqW3FY", + "password": "123456" + }`, + []string{"password"}, + }, + // valid data + { + `{ + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiY29sbGVjdGlvbklkIjoiX3BiX3VzZXJzX2F1dGhfIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJ0ZXN0X25ld0BleGFtcGxlLmNvbSIsImV4cCI6MjIwODk4NTI2MX0.hmR7Ye23C68tS1LgHgYgT7NBJczTad34kzcT4sqW3FY", + "password": "1234567890" + }`, + []string{}, + }, + } + + for i, s := range scenarios { + form := forms.NewRecordEmailChangeConfirm(testApp, authCollection) + + // load data + loadErr := json.Unmarshal([]byte(s.jsonData), form) + if loadErr != nil { + t.Errorf("(%d) Failed to load form data: %v", i, loadErr) + continue + } + + record, err := form.Submit() + + // parse errors + errs, ok := err.(validation.Errors) + if !ok && err != nil { + t.Errorf("(%d) Failed to parse errors %v", i, err) + continue + } + + // check errors + if len(errs) > len(s.expectedErrors) { + t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) + } + for _, k := range s.expectedErrors { + if _, ok := errs[k]; !ok { + t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) + } + } + + if len(errs) > 0 { + continue + } + + claims, _ := security.ParseUnverifiedJWT(form.Token) + newEmail, _ := claims["newEmail"].(string) + + // check whether the user was updated + // --- + if record.Email() != newEmail { + t.Errorf("(%d) Expected record email %q, got %q", i, newEmail, record.Email()) + } + + if !record.Verified() { + t.Errorf("(%d) Expected record to be verified, got false", i) + } + + // shouldn't validate second time due to refreshed record token + if err := form.Validate(); err == nil { + t.Errorf("(%d) Expected error, got nil", i) + } + } +} diff --git a/forms/record_email_change_request.go b/forms/record_email_change_request.go new file mode 100644 index 000000000..8c655f7e4 --- /dev/null +++ b/forms/record_email_change_request.go @@ -0,0 +1,70 @@ +package forms + +import ( + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/go-ozzo/ozzo-validation/v4/is" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/mails" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/models/schema" +) + +// RecordEmailChangeRequest is an auth record email change request form. +type RecordEmailChangeRequest struct { + app core.App + dao *daos.Dao + record *models.Record + + NewEmail string `form:"newEmail" json:"newEmail"` +} + +// NewRecordEmailChangeRequest creates a new [RecordEmailChangeRequest] form +// initialized with from the provided [core.App] and [models.Record] instances. +// +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. +func NewRecordEmailChangeRequest(app core.App, record *models.Record) *RecordEmailChangeRequest { + return &RecordEmailChangeRequest{ + app: app, + dao: app.Dao(), + record: record, + } +} + +// SetDao replaces the default form Dao instance with the provided one. +func (form *RecordEmailChangeRequest) SetDao(dao *daos.Dao) { + form.dao = dao +} + +// Validate makes the form validatable by implementing [validation.Validatable] interface. +func (form *RecordEmailChangeRequest) Validate() error { + return validation.ValidateStruct(form, + validation.Field( + &form.NewEmail, + validation.Required, + validation.Length(1, 255), + is.EmailFormat, + validation.By(form.checkUniqueEmail), + ), + ) +} + +func (form *RecordEmailChangeRequest) checkUniqueEmail(value any) error { + v, _ := value.(string) + + if !form.dao.IsRecordValueUnique(form.record.Collection().Id, schema.FieldNameEmail, v) { + return validation.NewError("validation_record_email_exists", "User email already exists.") + } + + return nil +} + +// Submit validates and sends the change email request. +func (form *RecordEmailChangeRequest) Submit() error { + if err := form.Validate(); err != nil { + return err + } + + return mails.SendRecordChangeEmail(form.app, form.record, form.NewEmail) +} diff --git a/forms/user_email_change_request_test.go b/forms/record_email_change_request_test.go similarity index 71% rename from forms/user_email_change_request_test.go rename to forms/record_email_change_request_test.go index ed209be70..af364f073 100644 --- a/forms/user_email_change_request_test.go +++ b/forms/record_email_change_request_test.go @@ -9,34 +9,11 @@ import ( "github.com/pocketbase/pocketbase/tests" ) -func TestUserEmailChangeRequestPanic1(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserEmailChangeRequest(nil, nil) -} - -func TestUserEmailChangeRequestPanic2(t *testing.T) { - testApp, _ := tests.NewTestApp() - defer testApp.Cleanup() - - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserEmailChangeRequest(testApp, nil) -} - -func TestUserEmailChangeRequestValidateAndSubmit(t *testing.T) { +func TestRecordEmailChangeRequestValidateAndSubmit(t *testing.T) { testApp, _ := tests.NewTestApp() defer testApp.Cleanup() - user, err := testApp.Dao().FindUserByEmail("test@example.com") + user, err := testApp.Dao().FindAuthRecordByEmail("users", "test@example.com") if err != nil { t.Fatal(err) } @@ -59,7 +36,7 @@ func TestUserEmailChangeRequestValidateAndSubmit(t *testing.T) { }, // existing email token { - `{"newEmail": "test@example.com"}`, + `{"newEmail": "test2@example.com"}`, []string{"newEmail"}, }, // valid new email @@ -71,7 +48,7 @@ func TestUserEmailChangeRequestValidateAndSubmit(t *testing.T) { for i, s := range scenarios { testApp.TestMailer.TotalSend = 0 // reset - form := forms.NewUserEmailChangeRequest(testApp, user) + form := forms.NewRecordEmailChangeRequest(testApp, user) // load data loadErr := json.Unmarshal([]byte(s.jsonData), form) diff --git a/forms/record_oauth2_login.go b/forms/record_oauth2_login.go new file mode 100644 index 000000000..cb559f60e --- /dev/null +++ b/forms/record_oauth2_login.go @@ -0,0 +1,234 @@ +package forms + +import ( + "errors" + "fmt" + + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/go-ozzo/ozzo-validation/v4/is" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/tools/auth" + "github.com/pocketbase/pocketbase/tools/security" + "golang.org/x/oauth2" +) + +// RecordOAuth2Login is an auth record OAuth2 login form. +type RecordOAuth2Login struct { + app core.App + dao *daos.Dao + collection *models.Collection + + // Optional auth record that will be used if no external + // auth relation is found (if it is from the same collection) + loggedAuthRecord *models.Record + + // The name of the OAuth2 client provider (eg. "google") + Provider string `form:"provider" json:"provider"` + + // The authorization code returned from the initial request. + Code string `form:"code" json:"code"` + + // The code verifier sent with the initial request as part of the code_challenge. + CodeVerifier string `form:"codeVerifier" json:"codeVerifier"` + + // The redirect url sent with the initial request. + RedirectUrl string `form:"redirectUrl" json:"redirectUrl"` + + // Additional data that will be used for creating a new auth record + // if an existing OAuth2 account doesn't exist. + CreateData map[string]any `form:"createData" json:"createData"` +} + +// NewRecordOAuth2Login creates a new [RecordOAuth2Login] form with +// initialized with from the provided [core.App] instance. +// +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. +func NewRecordOAuth2Login(app core.App, collection *models.Collection, optAuthRecord *models.Record) *RecordOAuth2Login { + form := &RecordOAuth2Login{ + app: app, + dao: app.Dao(), + collection: collection, + loggedAuthRecord: optAuthRecord, + } + + return form +} + +// SetDao replaces the default form Dao instance with the provided one. +func (form *RecordOAuth2Login) SetDao(dao *daos.Dao) { + form.dao = dao +} + +// Validate makes the form validatable by implementing [validation.Validatable] interface. +func (form *RecordOAuth2Login) Validate() error { + return validation.ValidateStruct(form, + validation.Field(&form.Provider, validation.Required, validation.By(form.checkProviderName)), + validation.Field(&form.Code, validation.Required), + validation.Field(&form.CodeVerifier, validation.Required), + validation.Field(&form.RedirectUrl, validation.Required, is.URL), + ) +} + +func (form *RecordOAuth2Login) checkProviderName(value any) error { + name, _ := value.(string) + + config, ok := form.app.Settings().NamedAuthProviderConfigs()[name] + if !ok || !config.Enabled { + return validation.NewError("validation_invalid_provider", fmt.Sprintf("%q is missing or is not enabled.", name)) + } + + return nil +} + +// Submit validates and submits the form. +// +// If an auth record doesn't exist, it will make an attempt to create it +// based on the fetched OAuth2 profile data via a local [RecordUpsert] form. +// You can intercept/modify the create form by setting the optional beforeCreateFuncs argument. +// +// On success returns the authorized record model and the fetched provider's data. +func (form *RecordOAuth2Login) Submit( + beforeCreateFuncs ...func(createForm *RecordUpsert, authRecord *models.Record, authUser *auth.AuthUser) error, +) (*models.Record, *auth.AuthUser, error) { + if err := form.Validate(); err != nil { + return nil, nil, err + } + + if !form.collection.AuthOptions().AllowOAuth2Auth { + return nil, nil, errors.New("OAuth2 authentication is not allowed for the auth collection.") + } + + provider, err := auth.NewProviderByName(form.Provider) + if err != nil { + return nil, nil, err + } + + // load provider configuration + providerConfig := form.app.Settings().NamedAuthProviderConfigs()[form.Provider] + if err := providerConfig.SetupProvider(provider); err != nil { + return nil, nil, err + } + + provider.SetRedirectUrl(form.RedirectUrl) + + // fetch token + token, err := provider.FetchToken( + form.Code, + oauth2.SetAuthURLParam("code_verifier", form.CodeVerifier), + ) + if err != nil { + return nil, nil, err + } + + // fetch external auth user + authUser, err := provider.FetchAuthUser(token) + if err != nil { + return nil, nil, err + } + + var authRecord *models.Record + + // check for existing relation with the auth record + rel, _ := form.dao.FindExternalAuthByProvider(form.Provider, authUser.Id) + switch { + case rel != nil: + authRecord, err = form.dao.FindRecordById(form.collection.Id, rel.RecordId) + if err != nil { + return nil, authUser, err + } + case form.loggedAuthRecord != nil && form.loggedAuthRecord.Collection().Id == form.collection.Id: + // fallback to the logged auth record (if any) + authRecord = form.loggedAuthRecord + case authUser.Email != "": + // look for an existing auth record by the external auth record's email + authRecord, _ = form.dao.FindAuthRecordByEmail(form.collection.Id, authUser.Email) + } + + saveErr := form.dao.RunInTransaction(func(txDao *daos.Dao) error { + if authRecord == nil { + authRecord = models.NewRecord(form.collection) + authRecord.RefreshId() + authRecord.MarkAsNew() + createForm := NewRecordUpsert(form.app, authRecord) + createForm.SetFullManageAccess(true) + createForm.SetDao(txDao) + if authUser.Username != "" { + createForm.Username = form.dao.SuggestUniqueAuthRecordUsername(form.collection.Id, authUser.Username) + } + + // load custom data + createForm.LoadData(form.CreateData) + + // load the OAuth2 profile data as fallback + if createForm.Email == "" { + createForm.Email = authUser.Email + } + createForm.Verified = false + if createForm.Email == authUser.Email { + // mark as verified as long as it matches the OAuth2 data (even if the email is empty) + createForm.Verified = true + } + if createForm.Password == "" { + createForm.Password = security.RandomString(30) + createForm.PasswordConfirm = createForm.Password + } + + for _, f := range beforeCreateFuncs { + if f == nil { + continue + } + if err := f(createForm, authRecord, authUser); err != nil { + return err + } + } + + // create the new auth record + if err := createForm.Submit(); err != nil { + return err + } + } else { + // update the existing auth record empty email if the authUser has one + // (this is in case previously the auth record was created + // with an OAuth2 provider that didn't return an email address) + if authRecord.Email() == "" && authUser.Email != "" { + authRecord.SetEmail(authUser.Email) + if err := txDao.SaveRecord(authRecord); err != nil { + return err + } + } + + // update the existing auth record verified state + // (only if the auth record doesn't have an email or the auth record email match with the one in authUser) + if !authRecord.Verified() && (authRecord.Email() == "" || authRecord.Email() == authUser.Email) { + authRecord.SetVerified(true) + if err := txDao.SaveRecord(authRecord); err != nil { + return err + } + } + } + + // create ExternalAuth relation if missing + if rel == nil { + rel = &models.ExternalAuth{ + CollectionId: authRecord.Collection().Id, + RecordId: authRecord.Id, + Provider: form.Provider, + ProviderId: authUser.Id, + } + if err := txDao.SaveExternalAuth(rel); err != nil { + return err + } + } + + return nil + }) + + if saveErr != nil { + return nil, authUser, saveErr + } + + return authRecord, authUser, nil +} diff --git a/forms/user_oauth2_login_test.go b/forms/record_oauth2_login_test.go similarity index 61% rename from forms/user_oauth2_login_test.go rename to forms/record_oauth2_login_test.go index e0a9674cc..637ed0837 100644 --- a/forms/user_oauth2_login_test.go +++ b/forms/record_oauth2_login_test.go @@ -9,55 +9,60 @@ import ( "github.com/pocketbase/pocketbase/tests" ) -func TestUserOauth2LoginPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserOauth2Login(nil) -} - func TestUserOauth2LoginValidate(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() scenarios := []struct { + testName string + collectionName string jsonData string expectedErrors []string }{ - // empty payload - {"{}", []string{"provider", "code", "codeVerifier", "redirectUrl"}}, - // empty data { + "empty payload", + "users", + "{}", + []string{"provider", "code", "codeVerifier", "redirectUrl"}, + }, + { + "empty data", + "users", `{"provider":"","code":"","codeVerifier":"","redirectUrl":""}`, []string{"provider", "code", "codeVerifier", "redirectUrl"}, }, - // missing provider { + "missing provider", + "users", `{"provider":"missing","code":"123","codeVerifier":"123","redirectUrl":"https://example.com"}`, []string{"provider"}, }, - // disabled provider { + "disabled provider", + "users", `{"provider":"github","code":"123","codeVerifier":"123","redirectUrl":"https://example.com"}`, []string{"provider"}, }, - // enabled provider { + "enabled provider", + "users", `{"provider":"gitlab","code":"123","codeVerifier":"123","redirectUrl":"https://example.com"}`, []string{}, }, } - for i, s := range scenarios { - form := forms.NewUserOauth2Login(app) + for _, s := range scenarios { + authCollection, _ := app.Dao().FindCollectionByNameOrId(s.collectionName) + if authCollection == nil { + t.Errorf("[%s] Failed to fetch auth collection", s.testName) + } + + form := forms.NewRecordOAuth2Login(app, authCollection, nil) // load data loadErr := json.Unmarshal([]byte(s.jsonData), form) if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) + t.Errorf("[%s] Failed to load form data: %v", s.testName, loadErr) continue } @@ -66,17 +71,17 @@ func TestUserOauth2LoginValidate(t *testing.T) { // parse errors errs, ok := err.(validation.Errors) if !ok && err != nil { - t.Errorf("(%d) Failed to parse errors %v", i, err) + t.Errorf("[%s] Failed to parse errors %v", s.testName, err) continue } // check errors if len(errs) > len(s.expectedErrors) { - t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) + t.Errorf("[%s] Expected error keys %v, got %v", s.testName, s.expectedErrors, errs) } for _, k := range s.expectedErrors { if _, ok := errs[k]; !ok { - t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) + t.Errorf("[%s] Missing expected error key %q in %v", s.testName, k, errs) } } } diff --git a/forms/record_password_login.go b/forms/record_password_login.go new file mode 100644 index 000000000..2c01e9a80 --- /dev/null +++ b/forms/record_password_login.go @@ -0,0 +1,77 @@ +package forms + +import ( + "errors" + + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/go-ozzo/ozzo-validation/v4/is" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/models" +) + +// RecordPasswordLogin is record username/email + password login form. +type RecordPasswordLogin struct { + app core.App + dao *daos.Dao + collection *models.Collection + + Identity string `form:"identity" json:"identity"` + Password string `form:"password" json:"password"` +} + +// NewRecordPasswordLogin creates a new [RecordPasswordLogin] form initialized +// with from the provided [core.App] and [models.Collection] instance. +// +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. +func NewRecordPasswordLogin(app core.App, collection *models.Collection) *RecordPasswordLogin { + return &RecordPasswordLogin{ + app: app, + dao: app.Dao(), + collection: collection, + } +} + +// SetDao replaces the default form Dao instance with the provided one. +func (form *RecordPasswordLogin) SetDao(dao *daos.Dao) { + form.dao = dao +} + +// Validate makes the form validatable by implementing [validation.Validatable] interface. +func (form *RecordPasswordLogin) Validate() error { + return validation.ValidateStruct(form, + validation.Field(&form.Identity, validation.Required, validation.Length(1, 255)), + validation.Field(&form.Password, validation.Required, validation.Length(1, 255)), + ) +} + +// Submit validates and submits the form. +// On success returns the authorized record model. +func (form *RecordPasswordLogin) Submit() (*models.Record, error) { + if err := form.Validate(); err != nil { + return nil, err + } + + authOptions := form.collection.AuthOptions() + + if !authOptions.AllowEmailAuth && !authOptions.AllowUsernameAuth { + return nil, errors.New("Password authentication is not allowed for the collection.") + } + + var record *models.Record + var fetchErr error + + if authOptions.AllowEmailAuth && + (!authOptions.AllowUsernameAuth || is.EmailFormat.Validate(form.Identity) == nil) { + record, fetchErr = form.dao.FindAuthRecordByEmail(form.collection.Id, form.Identity) + } else { + record, fetchErr = form.dao.FindAuthRecordByUsername(form.collection.Id, form.Identity) + } + + if fetchErr != nil || !record.ValidatePassword(form.Password) { + return nil, errors.New("Invalid login credentials.") + } + + return record, nil +} diff --git a/forms/record_password_login_test.go b/forms/record_password_login_test.go new file mode 100644 index 000000000..c36dc72dd --- /dev/null +++ b/forms/record_password_login_test.go @@ -0,0 +1,130 @@ +package forms_test + +import ( + "testing" + + "github.com/pocketbase/pocketbase/forms" + "github.com/pocketbase/pocketbase/tests" +) + +func TestRecordEmailLoginValidateAndSubmit(t *testing.T) { + testApp, _ := tests.NewTestApp() + defer testApp.Cleanup() + + scenarios := []struct { + testName string + collectionName string + identity string + password string + expectError bool + }{ + { + "empty data", + "users", + "", + "", + true, + }, + + // username + { + "existing username + wrong password", + "users", + "users75657", + "invalid", + true, + }, + { + "missing username + valid password", + "users", + "clients57772", // not in the "users" collection + "1234567890", + true, + }, + { + "existing username + valid password but in restricted username auth collection", + "clients", + "clients57772", + "1234567890", + true, + }, + { + "existing username + valid password but in restricted username and email auth collection", + "nologin", + "test_username", + "1234567890", + true, + }, + { + "existing username + valid password", + "users", + "users75657", + "1234567890", + false, + }, + + // email + { + "existing email + wrong password", + "users", + "test@example.com", + "invalid", + true, + }, + { + "missing email + valid password", + "users", + "test_missing@example.com", + "1234567890", + true, + }, + { + "existing username + valid password but in restricted username auth collection", + "clients", + "test@example.com", + "1234567890", + false, + }, + { + "existing username + valid password but in restricted username and email auth collection", + "nologin", + "test@example.com", + "1234567890", + true, + }, + { + "existing email + valid password", + "users", + "test@example.com", + "1234567890", + false, + }, + } + + for _, s := range scenarios { + authCollection, err := testApp.Dao().FindCollectionByNameOrId(s.collectionName) + if err != nil { + t.Errorf("[%s] Failed to fetch auth collection: %v", s.testName, err) + } + + form := forms.NewRecordPasswordLogin(testApp, authCollection) + form.Identity = s.identity + form.Password = s.password + + record, err := form.Submit() + + hasErr := err != nil + if hasErr != s.expectError { + t.Errorf("[%s] Expected hasErr to be %v, got %v (%v)", s.testName, s.expectError, hasErr, err) + continue + } + + if hasErr { + continue + } + + if record.Email() != s.identity && record.Username() != s.identity { + t.Errorf("[%s] Expected record with identity %q, got \n%v", s.testName, s.identity, record) + } + } +} diff --git a/forms/record_password_reset_confirm.go b/forms/record_password_reset_confirm.go new file mode 100644 index 000000000..a3ca10860 --- /dev/null +++ b/forms/record_password_reset_confirm.go @@ -0,0 +1,96 @@ +package forms + +import ( + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/forms/validators" + "github.com/pocketbase/pocketbase/models" +) + +// RecordPasswordResetConfirm is an auth record password reset confirmation form. +type RecordPasswordResetConfirm struct { + app core.App + collection *models.Collection + dao *daos.Dao + + Token string `form:"token" json:"token"` + Password string `form:"password" json:"password"` + PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"` +} + +// NewRecordPasswordResetConfirm creates a new [RecordPasswordResetConfirm] +// form initialized with from the provided [core.App] instance. +// +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. +func NewRecordPasswordResetConfirm(app core.App, collection *models.Collection) *RecordPasswordResetConfirm { + return &RecordPasswordResetConfirm{ + app: app, + dao: app.Dao(), + collection: collection, + } +} + +// SetDao replaces the default form Dao instance with the provided one. +func (form *RecordPasswordResetConfirm) SetDao(dao *daos.Dao) { + form.dao = dao +} + +// Validate makes the form validatable by implementing [validation.Validatable] interface. +func (form *RecordPasswordResetConfirm) Validate() error { + minPasswordLength := form.collection.AuthOptions().MinPasswordLength + + return validation.ValidateStruct(form, + validation.Field(&form.Token, validation.Required, validation.By(form.checkToken)), + validation.Field(&form.Password, validation.Required, validation.Length(minPasswordLength, 100)), + validation.Field(&form.PasswordConfirm, validation.Required, validation.By(validators.Compare(form.Password))), + ) +} + +func (form *RecordPasswordResetConfirm) checkToken(value any) error { + v, _ := value.(string) + if v == "" { + return nil // nothing to check + } + + record, err := form.dao.FindAuthRecordByToken( + v, + form.app.Settings().RecordPasswordResetToken.Secret, + ) + if err != nil || record == nil { + return validation.NewError("validation_invalid_token", "Invalid or expired token.") + } + + if record.Collection().Id != form.collection.Id { + return validation.NewError("validation_token_collection_mismatch", "The provided token is for different auth collection.") + } + + return nil +} + +// Submit validates and submits the form. +// On success returns the updated auth record associated to `form.Token`. +func (form *RecordPasswordResetConfirm) Submit() (*models.Record, error) { + if err := form.Validate(); err != nil { + return nil, err + } + + authRecord, err := form.dao.FindAuthRecordByToken( + form.Token, + form.app.Settings().RecordPasswordResetToken.Secret, + ) + if err != nil { + return nil, err + } + + if err := authRecord.SetPassword(form.Password); err != nil { + return nil, err + } + + if err := form.dao.SaveRecord(authRecord); err != nil { + return nil, err + } + + return authRecord, nil +} diff --git a/forms/record_password_reset_confirm_test.go b/forms/record_password_reset_confirm_test.go new file mode 100644 index 000000000..c3ef54669 --- /dev/null +++ b/forms/record_password_reset_confirm_test.go @@ -0,0 +1,117 @@ +package forms_test + +import ( + "encoding/json" + "testing" + + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/pocketbase/pocketbase/forms" + "github.com/pocketbase/pocketbase/tests" + "github.com/pocketbase/pocketbase/tools/security" +) + +func TestRecordPasswordResetConfirmValidateAndSubmit(t *testing.T) { + testApp, _ := tests.NewTestApp() + defer testApp.Cleanup() + + authCollection, err := testApp.Dao().FindCollectionByNameOrId("users") + if err != nil { + t.Fatal(err) + } + + scenarios := []struct { + jsonData string + expectedErrors []string + }{ + // empty data (Validate call check) + { + `{}`, + []string{"token", "password", "passwordConfirm"}, + }, + // expired token + { + `{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoxNjQwOTkxNjYxfQ.TayHoXkOTM0w8InkBEb86npMJEaf6YVUrxrRmMgFjeY", + "password":"12345678", + "passwordConfirm":"12345678" + }`, + []string{"token"}, + }, + // valid token but invalid passwords lengths + { + `{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.R_4FOSUHIuJQ5Crl3PpIPCXMsoHzuTaNlccpXg_3FOg", + "password":"1234567", + "passwordConfirm":"1234567" + }`, + []string{"password"}, + }, + // valid token but mismatched passwordConfirm + { + `{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.R_4FOSUHIuJQ5Crl3PpIPCXMsoHzuTaNlccpXg_3FOg", + "password":"12345678", + "passwordConfirm":"12345679" + }`, + []string{"passwordConfirm"}, + }, + // valid token and password + { + `{ + "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.R_4FOSUHIuJQ5Crl3PpIPCXMsoHzuTaNlccpXg_3FOg", + "password":"12345678", + "passwordConfirm":"12345678" + }`, + []string{}, + }, + } + + for i, s := range scenarios { + form := forms.NewRecordPasswordResetConfirm(testApp, authCollection) + + // load data + loadErr := json.Unmarshal([]byte(s.jsonData), form) + if loadErr != nil { + t.Errorf("(%d) Failed to load form data: %v", i, loadErr) + continue + } + + record, submitErr := form.Submit() + + // parse errors + errs, ok := submitErr.(validation.Errors) + if !ok && submitErr != nil { + t.Errorf("(%d) Failed to parse errors %v", i, submitErr) + continue + } + + // check errors + if len(errs) > len(s.expectedErrors) { + t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) + } + for _, k := range s.expectedErrors { + if _, ok := errs[k]; !ok { + t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) + } + } + + if len(errs) > 0 || len(s.expectedErrors) > 0 { + continue + } + + claims, _ := security.ParseUnverifiedJWT(form.Token) + tokenRecordId := claims["id"] + + if record.Id != tokenRecordId { + t.Errorf("(%d) Expected record with id %s, got %v", i, tokenRecordId, record) + } + + if !record.LastResetSentAt().IsZero() { + t.Errorf("(%d) Expected record.LastResetSentAt to be empty, got %v", i, record.LastResetSentAt()) + } + + if !record.ValidatePassword(form.Password) { + t.Errorf("(%d) Expected the record password to have been updated to %q", i, form.Password) + } + } +} diff --git a/forms/record_password_reset_request.go b/forms/record_password_reset_request.go new file mode 100644 index 000000000..bbba8cffa --- /dev/null +++ b/forms/record_password_reset_request.go @@ -0,0 +1,86 @@ +package forms + +import ( + "errors" + "time" + + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/go-ozzo/ozzo-validation/v4/is" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/mails" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/models/schema" + "github.com/pocketbase/pocketbase/tools/types" +) + +// RecordPasswordResetRequest is an auth record reset password request form. +type RecordPasswordResetRequest struct { + app core.App + dao *daos.Dao + collection *models.Collection + resendThreshold float64 // in seconds + + Email string `form:"email" json:"email"` +} + +// NewRecordPasswordResetRequest creates a new [RecordPasswordResetRequest] +// form initialized with from the provided [core.App] instance. +// +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. +func NewRecordPasswordResetRequest(app core.App, collection *models.Collection) *RecordPasswordResetRequest { + return &RecordPasswordResetRequest{ + app: app, + dao: app.Dao(), + collection: collection, + resendThreshold: 120, // 2 min + } +} + +// SetDao replaces the default form Dao instance with the provided one. +func (form *RecordPasswordResetRequest) SetDao(dao *daos.Dao) { + form.dao = dao +} + +// Validate makes the form validatable by implementing [validation.Validatable] interface. +// +// This method doesn't checks whether auth record with `form.Email` exists (this is done on Submit). +func (form *RecordPasswordResetRequest) Validate() error { + return validation.ValidateStruct(form, + validation.Field( + &form.Email, + validation.Required, + validation.Length(1, 255), + is.EmailFormat, + ), + ) +} + +// Submit validates and submits the form. +// On success, sends a password reset email to the `form.Email` auth record. +func (form *RecordPasswordResetRequest) Submit() error { + if err := form.Validate(); err != nil { + return err + } + + authRecord, err := form.dao.FindFirstRecordByData(form.collection.Id, schema.FieldNameEmail, form.Email) + if err != nil { + return err + } + + now := time.Now().UTC() + lastResetSentAt := authRecord.LastResetSentAt().Time() + if now.Sub(lastResetSentAt).Seconds() < form.resendThreshold { + return errors.New("You've already requested a password reset.") + } + + if err := mails.SendRecordPasswordReset(form.app, authRecord); err != nil { + return err + } + + // update last sent timestamp + authRecord.Set(schema.FieldNameLastResetSentAt, types.NowDateTime()) + + return form.dao.SaveRecord(authRecord) +} diff --git a/forms/user_password_reset_request_test.go b/forms/record_password_reset_request_test.go similarity index 50% rename from forms/user_password_reset_request_test.go rename to forms/record_password_reset_request_test.go index 19e8d7048..b6413887e 100644 --- a/forms/user_password_reset_request_test.go +++ b/forms/record_password_reset_request_test.go @@ -5,85 +5,19 @@ import ( "testing" "time" - validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/pocketbase/pocketbase/forms" "github.com/pocketbase/pocketbase/tests" "github.com/pocketbase/pocketbase/tools/types" ) -func TestUserPasswordResetRequestPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserPasswordResetRequest(nil) -} - -func TestUserPasswordResetRequestValidate(t *testing.T) { +func TestRecordPasswordResetRequestSubmit(t *testing.T) { testApp, _ := tests.NewTestApp() defer testApp.Cleanup() - scenarios := []struct { - jsonData string - expectedErrors []string - }{ - // empty data - { - `{}`, - []string{"email"}, - }, - // empty fields - { - `{"email":""}`, - []string{"email"}, - }, - // invalid email format - { - `{"email":"invalid"}`, - []string{"email"}, - }, - // valid email - { - `{"email":"new@example.com"}`, - []string{}, - }, - } - - for i, s := range scenarios { - form := forms.NewUserPasswordResetRequest(testApp) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - // parse errors - result := form.Validate() - errs, ok := result.(validation.Errors) - if !ok && result != nil { - t.Errorf("(%d) Failed to parse errors %v", i, result) - continue - } - - // check errors - if len(errs) > len(s.expectedErrors) { - t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) - } - for _, k := range s.expectedErrors { - if _, ok := errs[k]; !ok { - t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) - } - } + authCollection, err := testApp.Dao().FindCollectionByNameOrId("users") + if err != nil { + t.Fatal(err) } -} - -func TestUserPasswordResetRequestSubmit(t *testing.T) { - testApp, _ := tests.NewTestApp() - defer testApp.Cleanup() scenarios := []struct { jsonData string @@ -121,7 +55,7 @@ func TestUserPasswordResetRequestSubmit(t *testing.T) { for i, s := range scenarios { testApp.TestMailer.TotalSend = 0 // reset - form := forms.NewUserPasswordResetRequest(testApp) + form := forms.NewRecordPasswordResetRequest(testApp, authCollection) // load data loadErr := json.Unmarshal([]byte(s.jsonData), form) @@ -150,14 +84,14 @@ func TestUserPasswordResetRequestSubmit(t *testing.T) { } // check whether LastResetSentAt was updated - user, err := testApp.Dao().FindUserByEmail(form.Email) + user, err := testApp.Dao().FindAuthRecordByEmail(authCollection.Id, form.Email) if err != nil { t.Errorf("(%d) Expected user with email %q to exist, got nil", i, form.Email) continue } - if user.LastResetSentAt.Time().Sub(now.Time()) < 0 { - t.Errorf("(%d) Expected LastResetSentAt to be after %v, got %v", i, now, user.LastResetSentAt) + if user.LastResetSentAt().Time().Sub(now.Time()) < 0 { + t.Errorf("(%d) Expected LastResetSentAt to be after %v, got %v", i, now, user.LastResetSentAt()) } } } diff --git a/forms/record_upsert.go b/forms/record_upsert.go index becfa8adf..690db5138 100644 --- a/forms/record_upsert.go +++ b/forms/record_upsert.go @@ -8,8 +8,10 @@ import ( "net/http" "regexp" "strconv" + "strings" validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/go-ozzo/ozzo-validation/v4/is" "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/daos" @@ -18,68 +20,86 @@ import ( "github.com/pocketbase/pocketbase/models/schema" "github.com/pocketbase/pocketbase/tools/list" "github.com/pocketbase/pocketbase/tools/rest" + "github.com/pocketbase/pocketbase/tools/security" "github.com/spf13/cast" ) -// RecordUpsert specifies a [models.Record] upsert (create/update) form. +// username value regex pattern +var usernameRegex = regexp.MustCompile(`^[\w][\w\.]*$`) + +// RecordUpsert is a [models.Record] upsert (create/update) form. type RecordUpsert struct { - config RecordUpsertConfig - record *models.Record + app core.App + dao *daos.Dao + manageAccess bool + record *models.Record filesToDelete []string // names list - filesToUpload []*rest.UploadedFile + filesToUpload map[string][]*rest.UploadedFile + + // base model fields + Id string `json:"id"` + + // auth collection fields + // --- + Username string `json:"username"` + Email string `json:"email"` + EmailVisibility bool `json:"emailVisibility"` + Verified bool `json:"verified"` + Password string `json:"password"` + PasswordConfirm string `json:"passwordConfirm"` + OldPassword string `json:"oldPassword"` + // --- - Id string `form:"id" json:"id"` Data map[string]any `json:"data"` } -// RecordUpsertConfig is the [RecordUpsert] factory initializer config. -// -// NB! App is required struct member. -type RecordUpsertConfig struct { - App core.App - Dao *daos.Dao -} - // NewRecordUpsert creates a new [RecordUpsert] form with initializer // config created from the provided [core.App] and [models.Record] instances -// (for create you could pass a pointer to an empty Record - `models.NewRecord(collection)`). +// (for create you could pass a pointer to an empty Record - models.NewRecord(collection)). // -// If you want to submit the form as part of another transaction, use -// [NewRecordUpsertWithConfig] with explicitly set Dao. +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. func NewRecordUpsert(app core.App, record *models.Record) *RecordUpsert { - return NewRecordUpsertWithConfig(RecordUpsertConfig{ - App: app, - }, record) -} - -// NewRecordUpsertWithConfig creates a new [RecordUpsert] form -// with the provided config and [models.Record] instance or panics on invalid configuration -// (for create you could pass a pointer to an empty Record - `models.NewRecord(collection)`). -func NewRecordUpsertWithConfig(config RecordUpsertConfig, record *models.Record) *RecordUpsert { form := &RecordUpsert{ - config: config, + app: app, + dao: app.Dao(), record: record, filesToDelete: []string{}, - filesToUpload: []*rest.UploadedFile{}, + filesToUpload: map[string][]*rest.UploadedFile{}, } - if form.config.App == nil || form.record == nil { - panic("Invalid initializer config or nil upsert model.") - } + form.loadFormDefaults() - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } + return form +} - form.Id = record.Id +// SetFullManageAccess sets the manageAccess bool flag of the current +// form to enable/disable directly changing some system record fields +// (often used with auth collection records). +func (form *RecordUpsert) SetFullManageAccess(fullManageAccess bool) { + form.manageAccess = fullManageAccess +} - form.Data = map[string]any{} - for _, field := range record.Collection().Schema.Fields() { - form.Data[field.Name] = record.GetDataValue(field.Name) +// SetDao replaces the default form Dao instance with the provided one. +func (form *RecordUpsert) SetDao(dao *daos.Dao) { + form.dao = dao +} + +func (form *RecordUpsert) loadFormDefaults() { + form.Id = form.record.Id + + if form.record.Collection().IsAuth() { + form.Username = form.record.Username() + form.Email = form.record.Email() + form.EmailVisibility = form.record.EmailVisibility() + form.Verified = form.record.Verified() } - return form + form.Data = map[string]any{} + for _, field := range form.record.Collection().Schema.Fields() { + form.Data[field.Name] = form.record.Get(field.Name) + } } func (form *RecordUpsert) getContentType(r *http.Request) string { @@ -92,26 +112,38 @@ func (form *RecordUpsert) getContentType(r *http.Request) string { return t } -func (form *RecordUpsert) extractRequestData(r *http.Request) (map[string]any, error) { +func (form *RecordUpsert) extractRequestData(r *http.Request, keyPrefix string) (map[string]any, error) { switch form.getContentType(r) { case "application/json": - return form.extractJsonData(r) + return form.extractJsonData(r, keyPrefix) case "multipart/form-data": - return form.extractMultipartFormData(r) + return form.extractMultipartFormData(r, keyPrefix) default: return nil, errors.New("Unsupported request Content-Type.") } } -func (form *RecordUpsert) extractJsonData(r *http.Request) (map[string]any, error) { +func (form *RecordUpsert) extractJsonData(r *http.Request, keyPrefix string) (map[string]any, error) { result := map[string]any{} - err := rest.ReadJsonBodyCopy(r, &result) + err := rest.CopyJsonBody(r, &result) + + if keyPrefix != "" { + parts := strings.Split(keyPrefix, ".") + for _, part := range parts { + if result[part] == nil { + break + } + if v, ok := result[part].(map[string]any); ok { + result = v + } + } + } return result, err } -func (form *RecordUpsert) extractMultipartFormData(r *http.Request) (map[string]any, error) { +func (form *RecordUpsert) extractMultipartFormData(r *http.Request, keyPrefix string) (map[string]any, error) { result := map[string]any{} // parse form data (if not already) @@ -121,7 +153,14 @@ func (form *RecordUpsert) extractMultipartFormData(r *http.Request) (map[string] arrayValueSupportTypes := schema.ArraybleFieldTypes() - for key, values := range r.PostForm { + form.filesToUpload = map[string][]*rest.UploadedFile{} + + for fullKey, values := range r.PostForm { + key := fullKey + if keyPrefix != "" { + key = strings.TrimPrefix(key, keyPrefix+".") + } + if len(values) == 0 { result[key] = nil continue @@ -135,6 +174,44 @@ func (form *RecordUpsert) extractMultipartFormData(r *http.Request) (map[string] } } + // load uploaded files (if any) + for _, field := range form.record.Collection().Schema.Fields() { + if field.Type != schema.FieldTypeFile { + continue // not a file field + } + + key := field.Name + fullKey := key + if keyPrefix != "" { + fullKey = keyPrefix + "." + key + } + + files, err := rest.FindUploadedFiles(r, fullKey) + if err != nil || len(files) == 0 { + if err != nil && err != http.ErrMissingFile && form.app.IsDebug() { + log.Printf("%q uploaded file error: %v\n", fullKey, err) + } + + // skip invalid or missing file(s) + continue + } + + options, ok := field.Options.(*schema.FileOptions) + if !ok { + continue + } + + if form.filesToUpload[key] == nil { + form.filesToUpload[key] = []*rest.UploadedFile{} + } + + if options.MaxSelect == 1 { + form.filesToUpload[key] = append(form.filesToUpload[key], files[0]) + } else if options.MaxSelect > 1 { + form.filesToUpload[key] = append(form.filesToUpload[key], files...) + } + } + return result, nil } @@ -144,35 +221,66 @@ func (form *RecordUpsert) normalizeData() error { form.Data[field.Name] = field.PrepareValue(v) } } - return nil } -// LoadData loads and normalizes json OR multipart/form-data request data. +// LoadRequest extracts the json or multipart/form-data request data +// and lods it into the form. // // File upload is supported only via multipart/form-data. // -// To REPLACE previously uploaded file(s) you can suffix the field name -// with the file index (eg. `myfile.0`) and set the new value. -// For single file upload fields, you can skip the index and directly -// assign the file value to the field name (eg. `myfile`). -// // To DELETE previously uploaded file(s) you can suffix the field name -// with the file index (eg. `myfile.0`) and set it to null or empty string. +// with the file index or filename (eg. `myfile.0`) and set it to null or empty string. // For single file upload fields, you can skip the index and directly -// reset the field using its field name (eg. `myfile`). -func (form *RecordUpsert) LoadData(r *http.Request) error { - requestData, err := form.extractRequestData(r) +// reset the field using its field name (eg. `myfile = null`). +func (form *RecordUpsert) LoadRequest(r *http.Request, keyPrefix string) error { + requestData, err := form.extractRequestData(r, keyPrefix) if err != nil { return err } - if id, ok := requestData["id"]; ok { - form.Id = cast.ToString(id) + return form.LoadData(requestData) +} + +// LoadData loads and normalizes the provided data into the form. +// +// To DELETE previously uploaded file(s) you can suffix the field name +// with the file index or filename (eg. `myfile.0`) and set it to null or empty string. +// For single file upload fields, you can skip the index and directly +// reset the field using its field name (eg. `myfile = null`). +func (form *RecordUpsert) LoadData(requestData map[string]any) error { + // load base system fields + if v, ok := requestData["id"]; ok { + form.Id = cast.ToString(v) } - // extend base data with the extracted one - extendedData := form.record.Data() + // load auth system fields + if form.record.Collection().IsAuth() { + if v, ok := requestData["username"]; ok { + form.Username = cast.ToString(v) + } + if v, ok := requestData["email"]; ok { + form.Email = cast.ToString(v) + } + if v, ok := requestData["emailVisibility"]; ok { + form.EmailVisibility = cast.ToBool(v) + } + if v, ok := requestData["verified"]; ok { + form.Verified = cast.ToBool(v) + } + if v, ok := requestData["password"]; ok { + form.Password = cast.ToString(v) + } + if v, ok := requestData["passwordConfirm"]; ok { + form.PasswordConfirm = cast.ToString(v) + } + if v, ok := requestData["oldPassword"]; ok { + form.OldPassword = cast.ToString(v) + } + } + + // extend the record schema data with the request data + extendedData := form.record.SchemaData() rawData, err := json.Marshal(requestData) if err != nil { return err @@ -243,17 +351,8 @@ func (form *RecordUpsert) LoadData(r *http.Request) error { // Check for new uploaded file // ----------------------------------------------------------- - if form.getContentType(r) != "multipart/form-data" { - continue // file upload is supported only via multipart/form-data - } - - files, err := rest.FindUploadedFiles(r, key) - if err != nil { - if form.config.App.IsDebug() { - log.Printf("%q uploaded file error: %v\n", key, err) - } - - continue // skip invalid or missing file(s) + if len(form.filesToUpload[key]) == 0 { + continue } // refresh oldNames list @@ -264,12 +363,10 @@ func (form *RecordUpsert) LoadData(r *http.Request) error { if len(oldNames) > 0 { form.filesToDelete = list.ToUniqueStringSlice(append(form.filesToDelete, oldNames...)) } - form.filesToUpload = append(form.filesToUpload, files[0]) - form.Data[key] = files[0].Name() + form.Data[key] = form.filesToUpload[key][0].Name() } else if options.MaxSelect > 1 { // append the id of each uploaded file instance - form.filesToUpload = append(form.filesToUpload, files...) - for _, file := range files { + for _, file := range form.filesToUpload[key] { oldNames = append(oldNames, file.Name()) } form.Data[key] = oldNames @@ -282,7 +379,7 @@ func (form *RecordUpsert) LoadData(r *http.Request) error { // Validate makes the form validatable by implementing [validation.Validatable] interface. func (form *RecordUpsert) Validate() error { // base form fields validator - baseFieldsErrors := validation.ValidateStruct(form, + baseFieldsRules := []*validation.FieldRules{ validation.Field( &form.Id, validation.When( @@ -291,26 +388,159 @@ func (form *RecordUpsert) Validate() error { validation.Match(idRegex), ).Else(validation.In(form.record.Id)), ), - ) - if baseFieldsErrors != nil { - return baseFieldsErrors + } + + // auth fields validators + if form.record.Collection().IsAuth() { + baseFieldsRules = append(baseFieldsRules, + validation.Field( + &form.Username, + // require only on update, because on create we fallback to auto generated username + validation.When(!form.record.IsNew(), validation.Required), + validation.Length(4, 100), + validation.Match(usernameRegex), + validation.By(form.checkUniqueUsername), + ), + validation.Field( + &form.Email, + validation.When( + form.record.Collection().AuthOptions().RequireEmail, + validation.Required, + ), + // don't allow direct email change (or unset) if the form doesn't have manage access permissions + // (aka. allow only admin or authorized auth models to directly update the field) + validation.When( + !form.record.IsNew() && !form.manageAccess, + validation.In(form.record.Email()), + ), + validation.Length(1, 255), + is.EmailFormat, + validation.By(form.checkEmailDomain), + validation.By(form.checkUniqueEmail), + ), + validation.Field( + &form.Verified, + // don't allow changing verified if the form doesn't have manage access permissions + // (aka. allow only admin or authorized auth models to directly change the field) + validation.When( + !form.manageAccess, + validation.In(form.record.Verified()), + ), + ), + validation.Field( + &form.Password, + validation.When(form.record.IsNew(), validation.Required), + validation.Length(form.record.Collection().AuthOptions().MinPasswordLength, 72), + ), + validation.Field( + &form.PasswordConfirm, + validation.When( + (form.record.IsNew() || form.Password != ""), + validation.Required, + ), + validation.By(validators.Compare(form.Password)), + ), + validation.Field( + &form.OldPassword, + // require old password only on update when: + // - form.manageAccess is not set + // - changing the existing password + validation.When( + !form.record.IsNew() && !form.manageAccess && form.Password != "", + validation.Required, + validation.By(form.checkOldPassword), + ), + ), + ) + } + + if err := validation.ValidateStruct(form, baseFieldsRules...); err != nil { + return err } // record data validator - dataValidator := validators.NewRecordDataValidator( - form.config.Dao, + return validators.NewRecordDataValidator( + form.dao, form.record, form.filesToUpload, + ).Validate(form.Data) +} + +func (form *RecordUpsert) checkUniqueUsername(value any) error { + v, _ := value.(string) + if v == "" { + return nil + } + + isUnique := form.dao.IsRecordValueUnique( + form.record.Collection().Id, + schema.FieldNameUsername, + v, + form.record.Id, ) + if !isUnique { + return validation.NewError("validation_invalid_username", "The username is invalid or already in use.") + } - return dataValidator.Validate(form.Data) + return nil } -// DrySubmit performs a form submit within a transaction and reverts it. -// For actual record persistence, check the `form.Submit()` method. -// -// This method doesn't handle file uploads/deletes or trigger any app events! -func (form *RecordUpsert) DrySubmit(callback func(txDao *daos.Dao) error) error { +func (form *RecordUpsert) checkUniqueEmail(value any) error { + v, _ := value.(string) + if v == "" { + return nil + } + + isUnique := form.dao.IsRecordValueUnique( + form.record.Collection().Id, + schema.FieldNameEmail, + v, + form.record.Id, + ) + if !isUnique { + return validation.NewError("validation_invalid_email", "The email is invalid or already in use.") + } + + return nil +} + +func (form *RecordUpsert) checkEmailDomain(value any) error { + val, _ := value.(string) + if val == "" { + return nil // nothing to check + } + + domain := val[strings.LastIndex(val, "@")+1:] + only := form.record.Collection().AuthOptions().OnlyEmailDomains + except := form.record.Collection().AuthOptions().ExceptEmailDomains + + // only domains check + if len(only) > 0 && !list.ExistInSlice(domain, only) { + return validation.NewError("validation_email_domain_not_allowed", "Email domain is not allowed.") + } + + // except domains check + if len(except) > 0 && list.ExistInSlice(domain, except) { + return validation.NewError("validation_email_domain_not_allowed", "Email domain is not allowed.") + } + + return nil +} + +func (form *RecordUpsert) checkOldPassword(value any) error { + v, _ := value.(string) + if v == "" { + return nil // nothing to check + } + + if !form.record.ValidatePassword(v) { + return validation.NewError("validation_invalid_old_password", "Missing or invalid old password.") + } + + return nil +} + +func (form *RecordUpsert) ValidateAndFill() error { if err := form.Validate(); err != nil { return err } @@ -319,16 +549,67 @@ func (form *RecordUpsert) DrySubmit(callback func(txDao *daos.Dao) error) error // custom insertion id can be set only on create if isNew && form.Id != "" { - form.record.MarkAsNew() form.record.SetId(form.Id) + form.record.MarkAsNew() + } + + // set auth fields + if form.record.Collection().IsAuth() { + // generate a default username during create (if missing) + if form.record.IsNew() && form.Username == "" { + baseUsername := form.record.Collection().Name + security.RandomStringWithAlphabet(5, "123456789") + form.Username = form.dao.SuggestUniqueAuthRecordUsername(form.record.Collection().Id, baseUsername) + } + + if form.Username != "" { + if err := form.record.SetUsername(form.Username); err != nil { + return err + } + } + + if isNew || form.manageAccess { + if err := form.record.SetEmail(form.Email); err != nil { + return err + } + } + + if err := form.record.SetEmailVisibility(form.EmailVisibility); err != nil { + return err + } + + if form.manageAccess { + if err := form.record.SetVerified(form.Verified); err != nil { + return err + } + } + + if form.Password != "" { + if err := form.record.SetPassword(form.Password); err != nil { + return err + } + } } - // bulk load form data - if err := form.record.Load(form.Data); err != nil { + // bulk load the remaining form data + form.record.Load(form.Data) + + return nil +} + +// DrySubmit performs a form submit within a transaction and reverts it. +// For actual record persistence, check the `form.Submit()` method. +// +// This method doesn't handle file uploads/deletes or trigger any app events! +func (form *RecordUpsert) DrySubmit(callback func(txDao *daos.Dao) error) error { + isNew := form.record.IsNew() + + if err := form.ValidateAndFill(); err != nil { return err } - return form.config.Dao.RunInTransaction(func(txDao *daos.Dao) error { + // use the default app.Dao to prevent changing the transaction form.Dao + // and causing "transaction has already been committed or rolled back" error + return form.app.Dao().RunInTransaction(func(txDao *daos.Dao) error { tx, ok := txDao.DB().(*dbx.Tx) if !ok { return errors.New("failed to get transaction db") @@ -362,31 +643,20 @@ func (form *RecordUpsert) DrySubmit(callback func(txDao *daos.Dao) error) error // You can optionally provide a list of InterceptorFunc to further // modify the form behavior before persisting it. func (form *RecordUpsert) Submit(interceptors ...InterceptorFunc) error { - if err := form.Validate(); err != nil { - return err - } - - // custom insertion id can be set only on create - if form.record.IsNew() && form.Id != "" { - form.record.MarkAsNew() - form.record.SetId(form.Id) - } - - // bulk load form data - if err := form.record.Load(form.Data); err != nil { + if err := form.ValidateAndFill(); err != nil { return err } return runInterceptors(func() error { - return form.config.Dao.RunInTransaction(func(txDao *daos.Dao) error { + return form.dao.RunInTransaction(func(txDao *daos.Dao) error { // persist record model if err := txDao.SaveRecord(form.record); err != nil { - return err + return fmt.Errorf("Failed to save the record: %v", err) } // upload new files (if any) if err := form.processFilesToUpload(); err != nil { - return err + return fmt.Errorf("Failed to process the upload files: %v", err) } // delete old files (if any) @@ -402,30 +672,33 @@ func (form *RecordUpsert) Submit(interceptors ...InterceptorFunc) error { func (form *RecordUpsert) processFilesToUpload() error { if len(form.filesToUpload) == 0 { - return nil // nothing to upload + return nil // no parsed file fields } if !form.record.HasId() { return errors.New("The record is not persisted yet.") } - fs, err := form.config.App.NewFilesystem() + fs, err := form.app.NewFilesystem() if err != nil { return err } defer fs.Close() var uploadErrors []error - for i := len(form.filesToUpload) - 1; i >= 0; i-- { - file := form.filesToUpload[i] - path := form.record.BaseFilesPath() + "/" + file.Name() - if err := fs.Upload(file.Bytes(), path); err == nil { - // remove the uploaded file from the list - form.filesToUpload = append(form.filesToUpload[:i], form.filesToUpload[i+1:]...) - } else { - // store the upload error - uploadErrors = append(uploadErrors, fmt.Errorf("File %d: %v", i, err)) + for fieldKey := range form.filesToUpload { + for i := len(form.filesToUpload[fieldKey]) - 1; i >= 0; i-- { + file := form.filesToUpload[fieldKey][i] + path := form.record.BaseFilesPath() + "/" + file.Name() + + if err := fs.UploadMultipart(file.Header(), path); err == nil { + // remove the uploaded file from the list + form.filesToUpload[fieldKey] = append(form.filesToUpload[fieldKey][:i], form.filesToUpload[fieldKey][i+1:]...) + } else { + // store the upload error + uploadErrors = append(uploadErrors, fmt.Errorf("File %d: %v", i, err)) + } } } @@ -445,7 +718,7 @@ func (form *RecordUpsert) processFilesToDelete() error { return errors.New("The record is not persisted yet.") } - fs, err := form.config.App.NewFilesystem() + fs, err := form.app.NewFilesystem() if err != nil { return err } diff --git a/forms/record_upsert_test.go b/forms/record_upsert_test.go index 4bba9fef6..9809132da 100644 --- a/forms/record_upsert_test.go +++ b/forms/record_upsert_test.go @@ -10,7 +10,6 @@ import ( "strings" "testing" - validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/labstack/echo/v5" "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/daos" @@ -20,36 +19,28 @@ import ( "github.com/pocketbase/pocketbase/tools/list" ) -func TestRecordUpsertPanic1(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewRecordUpsert(nil, nil) -} +func hasRecordFile(app core.App, record *models.Record, filename string) bool { + fs, _ := app.NewFilesystem() + defer fs.Close() -func TestRecordUpsertPanic2(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() + fileKey := filepath.Join( + record.Collection().Id, + record.Id, + filename, + ) - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() + exists, _ := fs.Exists(fileKey) - forms.NewRecordUpsert(app, nil) + return exists } func TestNewRecordUpsert(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo") + collection, _ := app.Dao().FindCollectionByNameOrId("demo2") record := models.NewRecord(collection) - record.SetDataValue("title", "test_value") + record.Set("title", "test_value") form := forms.NewRecordUpsert(app, record) @@ -59,12 +50,11 @@ func TestNewRecordUpsert(t *testing.T) { } } -func TestRecordUpsertLoadDataUnsupported(t *testing.T) { +func TestRecordUpsertLoadRequestUnsupported(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - record, err := app.Dao().FindFirstRecordByData(collection, "id", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2") + record, err := app.Dao().FindRecordById("demo2", "0yxhwia2amd8gec") if err != nil { t.Fatal(err) } @@ -75,37 +65,40 @@ func TestRecordUpsertLoadDataUnsupported(t *testing.T) { req := httptest.NewRequest(http.MethodGet, "/", strings.NewReader(testData)) req.Header.Set(echo.HeaderContentType, echo.MIMEApplicationForm) - if err := form.LoadData(req); err == nil { - t.Fatal("Expected LoadData to fail, got nil") + if err := form.LoadRequest(req, ""); err == nil { + t.Fatal("Expected LoadRequest to fail, got nil") } } -func TestRecordUpsertLoadDataJson(t *testing.T) { +func TestRecordUpsertLoadRequestJson(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - record, err := app.Dao().FindFirstRecordByData(collection, "id", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2") + record, err := app.Dao().FindRecordById("demo1", "84nmscqy84lsi1t") if err != nil { t.Fatal(err) } testData := map[string]any{ - "id": "test_id", - "title": "test123", - "unknown": "test456", - // file fields unset/delete - "onefile": nil, - "manyfiles.0": "", - "manyfiles.1": "test.png", // should be ignored - "onlyimages": nil, + "a": map[string]any{ + "b": map[string]any{ + "id": "test_id", + "text": "test123", + "unknown": "test456", + // file fields unset/delete + "file_one": nil, + "file_many.0": "", // delete by index + "file_many.1": "test.png", // should be ignored + "file_many.300_WlbFWSGmW9.png": nil, // delete by filename + }, + }, } form := forms.NewRecordUpsert(app, record) jsonBody, _ := json.Marshal(testData) req := httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(jsonBody)) req.Header.Set(echo.HeaderContentType, echo.MIMEApplicationJSON) - loadErr := form.LoadData(req) + loadErr := form.LoadRequest(req, "a.b") if loadErr != nil { t.Fatal(loadErr) } @@ -114,7 +107,7 @@ func TestRecordUpsertLoadDataJson(t *testing.T) { t.Fatalf("Expect id field to be %q, got %q", "test_id", form.Id) } - if v, ok := form.Data["title"]; !ok || v != "test123" { + if v, ok := form.Data["text"]; !ok || v != "test123" { t.Fatalf("Expect title field to be %q, got %q", "test123", v) } @@ -122,50 +115,43 @@ func TestRecordUpsertLoadDataJson(t *testing.T) { t.Fatalf("Didn't expect unknown field to be set, got %v", v) } - onefile, ok := form.Data["onefile"] + fileOne, ok := form.Data["file_one"] if !ok { - t.Fatal("Expect onefile field to be set") + t.Fatal("Expect file_one field to be set") } - if onefile != "" { - t.Fatalf("Expect onefile field to be empty string, got %v", onefile) + if fileOne != "" { + t.Fatalf("Expect file_one field to be empty string, got %v", fileOne) } - manyfiles, ok := form.Data["manyfiles"] - if !ok || manyfiles == nil { - t.Fatal("Expect manyfiles field to be set") + fileMany, ok := form.Data["file_many"] + if !ok || fileMany == nil { + t.Fatal("Expect file_many field to be set") } - manyfilesRemains := len(list.ToUniqueStringSlice(manyfiles)) + manyfilesRemains := len(list.ToUniqueStringSlice(fileMany)) if manyfilesRemains != 1 { - t.Fatalf("Expect only 1 manyfiles to remain, got \n%v", manyfiles) - } - - onlyimages := form.Data["onlyimages"] - if len(list.ToUniqueStringSlice(onlyimages)) != 0 { - t.Fatalf("Expect onlyimages field to be deleted, got \n%v", onlyimages) + t.Fatalf("Expect only 1 file_many to remain, got \n%v", fileMany) } } -func TestRecordUpsertLoadDataMultipart(t *testing.T) { +func TestRecordUpsertLoadRequestMultipart(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - record, err := app.Dao().FindFirstRecordByData(collection, "id", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2") + record, err := app.Dao().FindRecordById("demo1", "84nmscqy84lsi1t") if err != nil { t.Fatal(err) } formData, mp, err := tests.MockMultipartData(map[string]string{ - "id": "test_id", - "title": "test123", - "unknown": "test456", + "a.b.id": "test_id", + "a.b.text": "test123", + "a.b.unknown": "test456", // file fields unset/delete - "onefile": "", - "manyfiles.0": "", // delete by index - "manyfiles.b635c395-6837-49e5-8535-b0a6ebfbdbf3.png": "", // delete by name - "manyfiles.1": "test.png", // should be ignored - "onlyimages": "", - }, "onlyimages") + "a.b.file_one": "", + "a.b.file_many.0": "", + "a.b.file_many.300_WlbFWSGmW9.png": "test.png", // delete by name + "a.b.file_many.1": "test.png", // should be ignored + }, "file_many") if err != nil { t.Fatal(err) } @@ -173,7 +159,7 @@ func TestRecordUpsertLoadDataMultipart(t *testing.T) { form := forms.NewRecordUpsert(app, record) req := httptest.NewRequest(http.MethodGet, "/", formData) req.Header.Set(echo.HeaderContentType, mp.FormDataContentType()) - loadErr := form.LoadData(req) + loadErr := form.LoadRequest(req, "a.b") if loadErr != nil { t.Fatal(loadErr) } @@ -182,117 +168,58 @@ func TestRecordUpsertLoadDataMultipart(t *testing.T) { t.Fatalf("Expect id field to be %q, got %q", "test_id", form.Id) } - if v, ok := form.Data["title"]; !ok || v != "test123" { - t.Fatalf("Expect title field to be %q, got %q", "test123", v) + if v, ok := form.Data["text"]; !ok || v != "test123" { + t.Fatalf("Expect text field to be %q, got %q", "test123", v) } if v, ok := form.Data["unknown"]; ok { t.Fatalf("Didn't expect unknown field to be set, got %v", v) } - onefile, ok := form.Data["onefile"] + fileOne, ok := form.Data["file_one"] if !ok { - t.Fatal("Expect onefile field to be set") + t.Fatal("Expect file_one field to be set") } - if onefile != "" { - t.Fatalf("Expect onefile field to be empty string, got %v", onefile) + if fileOne != "" { + t.Fatalf("Expect file_one field to be empty string, got %v", fileOne) } - manyfiles, ok := form.Data["manyfiles"] - if !ok || manyfiles == nil { - t.Fatal("Expect manyfiles field to be set") + fileMany, ok := form.Data["file_many"] + if !ok || fileMany == nil { + t.Fatal("Expect file_many field to be set") } - manyfilesRemains := len(list.ToUniqueStringSlice(manyfiles)) - if manyfilesRemains != 0 { - t.Fatalf("Expect 0 manyfiles to remain, got %v", manyfiles) - } - - onlyimages, ok := form.Data["onlyimages"] - if !ok || onlyimages == nil { - t.Fatal("Expect onlyimages field to be set") - } - onlyimagesRemains := len(list.ToUniqueStringSlice(onlyimages)) - expectedRemains := 1 // -2 removed + 1 new upload - if onlyimagesRemains != expectedRemains { - t.Fatalf("Expect onlyimages to be %d, got %d (%v)", expectedRemains, onlyimagesRemains, onlyimages) + manyfilesRemains := len(list.ToUniqueStringSlice(fileMany)) + expectedRemains := 2 // -2 from 3 removed + 1 new upload + if manyfilesRemains != expectedRemains { + t.Fatalf("Expect file_many to be %d, got %d (%v)", expectedRemains, manyfilesRemains, fileMany) } } -func TestRecordUpsertValidateFailure(t *testing.T) { +func TestRecordUpsertLoadData(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - record, err := app.Dao().FindFirstRecordByData(collection, "id", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2") + record, err := app.Dao().FindRecordById("demo2", "llvuca81nly1qls") if err != nil { t.Fatal(err) } - // try with invalid test data to check whether the RecordDataValidator is triggered - formData, mp, err := tests.MockMultipartData(map[string]string{ - "id": "", - "unknown": "test456", // should be ignored - "title": "a", - "onerel": "00000000-84ab-4057-a592-4604a731f78f", - }, "manyfiles", "manyfiles") - if err != nil { - t.Fatal(err) - } - - expectedErrors := []string{"title", "onerel", "manyfiles"} - form := forms.NewRecordUpsert(app, record) - req := httptest.NewRequest(http.MethodGet, "/", formData) - req.Header.Set(echo.HeaderContentType, mp.FormDataContentType()) - form.LoadData(req) - - result := form.Validate() - - // parse errors - errs, ok := result.(validation.Errors) - if !ok && result != nil { - t.Fatalf("Failed to parse errors %v", result) - } - - // check errors - if len(errs) > len(expectedErrors) { - t.Fatalf("Expected error keys %v, got %v", expectedErrors, errs) - } - for _, k := range expectedErrors { - if _, ok := errs[k]; !ok { - t.Errorf("Missing expected error key %q in %v", k, errs) - } - } -} - -func TestRecordUpsertValidateSuccess(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - record, err := app.Dao().FindFirstRecordByData(collection, "id", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2") - if err != nil { - t.Fatal(err) + loadErr := form.LoadData(map[string]any{ + "title": "test_new", + "active": true, + }) + if loadErr != nil { + t.Fatal(loadErr) } - formData, mp, err := tests.MockMultipartData(map[string]string{ - "id": record.Id, - "unknown": "test456", // should be ignored - "title": "abc", - "onerel": "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2", - }, "manyfiles", "onefile") - if err != nil { - t.Fatal(err) + if v, ok := form.Data["title"]; !ok || v != "test_new" { + t.Fatalf("Expect title field to be %v, got %v", "test_new", v) } - form := forms.NewRecordUpsert(app, record) - req := httptest.NewRequest(http.MethodGet, "/", formData) - req.Header.Set(echo.HeaderContentType, mp.FormDataContentType()) - form.LoadData(req) - - result := form.Validate() - if result != nil { - t.Fatal(result) + if v, ok := form.Data["active"]; !ok || v != true { + t.Fatalf("Expect active field to be %v, got %v", true, v) } } @@ -300,15 +227,15 @@ func TestRecordUpsertDrySubmitFailure(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - recordBefore, err := app.Dao().FindFirstRecordByData(collection, "id", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2") + collection, _ := app.Dao().FindCollectionByNameOrId("demo1") + recordBefore, err := app.Dao().FindRecordById(collection.Id, "al1h9ijdeojtsjy") if err != nil { t.Fatal(err) } formData, mp, err := tests.MockMultipartData(map[string]string{ - "title": "a", - "onerel": "00000000-84ab-4057-a592-4604a731f78f", + "title": "abc", + "rel_one": "missing", }) if err != nil { t.Fatal(err) @@ -317,7 +244,7 @@ func TestRecordUpsertDrySubmitFailure(t *testing.T) { form := forms.NewRecordUpsert(app, recordBefore) req := httptest.NewRequest(http.MethodGet, "/", formData) req.Header.Set(echo.HeaderContentType, mp.FormDataContentType()) - form.LoadData(req) + form.LoadRequest(req, "") callbackCalls := 0 @@ -336,17 +263,17 @@ func TestRecordUpsertDrySubmitFailure(t *testing.T) { // ensure that the record changes weren't persisted // --- - recordAfter, err := app.Dao().FindFirstRecordByData(collection, "id", recordBefore.Id) + recordAfter, err := app.Dao().FindRecordById(collection.Id, recordBefore.Id) if err != nil { t.Fatal(err) } - if recordAfter.GetStringDataValue("title") == "a" { - t.Fatalf("Expected record.title to be %v, got %v", recordAfter.GetStringDataValue("title"), "a") + if recordAfter.GetString("title") == "abc" { + t.Fatalf("Expected record.title to be %v, got %v", recordAfter.GetString("title"), "abc") } - if recordAfter.GetStringDataValue("onerel") == "00000000-84ab-4057-a592-4604a731f78f" { - t.Fatalf("Expected record.onerel to be %s, got %s", recordBefore.GetStringDataValue("onerel"), recordAfter.GetStringDataValue("onerel")) + if recordAfter.GetString("rel_one") == "missing" { + t.Fatalf("Expected record.rel_one to be %s, got %s", recordBefore.GetString("rel_one"), "missing") } } @@ -354,16 +281,16 @@ func TestRecordUpsertDrySubmitSuccess(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - recordBefore, err := app.Dao().FindFirstRecordByData(collection, "id", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2") + collection, _ := app.Dao().FindCollectionByNameOrId("demo1") + recordBefore, err := app.Dao().FindRecordById(collection.Id, "84nmscqy84lsi1t") if err != nil { t.Fatal(err) } formData, mp, err := tests.MockMultipartData(map[string]string{ - "title": "dry_test", - "onefile": "", - }, "manyfiles") + "title": "dry_test", + "file_one": "", + }, "file_many") if err != nil { t.Fatal(err) } @@ -371,7 +298,7 @@ func TestRecordUpsertDrySubmitSuccess(t *testing.T) { form := forms.NewRecordUpsert(app, recordBefore) req := httptest.NewRequest(http.MethodGet, "/", formData) req.Header.Set(echo.HeaderContentType, mp.FormDataContentType()) - form.LoadData(req) + form.LoadRequest(req, "") callbackCalls := 0 @@ -390,21 +317,21 @@ func TestRecordUpsertDrySubmitSuccess(t *testing.T) { // ensure that the record changes weren't persisted // --- - recordAfter, err := app.Dao().FindFirstRecordByData(collection, "id", recordBefore.Id) + recordAfter, err := app.Dao().FindRecordById(collection.Id, recordBefore.Id) if err != nil { t.Fatal(err) } - if recordAfter.GetStringDataValue("title") == "dry_test" { - t.Fatalf("Expected record.title to be %v, got %v", recordAfter.GetStringDataValue("title"), "dry_test") + if recordAfter.GetString("title") == "dry_test" { + t.Fatalf("Expected record.title to be %v, got %v", recordAfter.GetString("title"), "dry_test") } - if recordAfter.GetStringDataValue("onefile") == "" { - t.Fatal("Expected record.onefile to be set, got empty string") + if recordAfter.GetString("file_one") == "" { + t.Fatal("Expected record.file_one to not be changed, got empty string") } // file wasn't removed - if !hasRecordFile(app, recordAfter, recordAfter.GetStringDataValue("onefile")) { - t.Fatal("onefile file should not have been deleted") + if !hasRecordFile(app, recordAfter, recordAfter.GetString("file_one")) { + t.Fatal("file_one file should not have been deleted") } } @@ -412,16 +339,23 @@ func TestRecordUpsertSubmitFailure(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - recordBefore, err := app.Dao().FindFirstRecordByData(collection, "id", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2") + collection, err := app.Dao().FindCollectionByNameOrId("demo1") + if err != nil { + t.Fatal(err) + } + + recordBefore, err := app.Dao().FindRecordById(collection.Id, "84nmscqy84lsi1t") if err != nil { t.Fatal(err) } formData, mp, err := tests.MockMultipartData(map[string]string{ - "title": "a", - "onefile": "", - }) + "text": "abc", + "bool": "false", + "select_one": "invalid", + "file_many": "invalid", + "email": "invalid", + }, "file_one") if err != nil { t.Fatal(err) } @@ -429,7 +363,7 @@ func TestRecordUpsertSubmitFailure(t *testing.T) { form := forms.NewRecordUpsert(app, recordBefore) req := httptest.NewRequest(http.MethodGet, "/", formData) req.Header.Set(echo.HeaderContentType, mp.FormDataContentType()) - form.LoadData(req) + form.LoadRequest(req, "") interceptorCalls := 0 interceptor := func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc { @@ -454,22 +388,32 @@ func TestRecordUpsertSubmitFailure(t *testing.T) { // ensure that the record changes weren't persisted // --- - recordAfter, err := app.Dao().FindFirstRecordByData(collection, "id", recordBefore.Id) + recordAfter, err := app.Dao().FindRecordById(collection.Id, recordBefore.Id) if err != nil { t.Fatal(err) } - if recordAfter.GetStringDataValue("title") == "a" { - t.Fatalf("Expected record.title to be %v, got %v", recordAfter.GetStringDataValue("title"), "a") + if v := recordAfter.Get("text"); v == "abc" { + t.Fatalf("Expected record.text not to change, got %v", v) } - - if recordAfter.GetStringDataValue("onefile") == "" { - t.Fatal("Expected record.onefile to be set, got empty string") + if v := recordAfter.Get("bool"); v == false { + t.Fatalf("Expected record.bool not to change, got %v", v) + } + if v := recordAfter.Get("select_one"); v == "invalid" { + t.Fatalf("Expected record.select_one not to change, got %v", v) + } + if v := recordAfter.Get("email"); v == "invalid" { + t.Fatalf("Expected record.email not to change, got %v", v) + } + if v := recordAfter.GetStringSlice("file_many"); len(v) != 3 { + t.Fatalf("Expected record.file_many not to change, got %v", v) } - // file wasn't removed - if !hasRecordFile(app, recordAfter, recordAfter.GetStringDataValue("onefile")) { - t.Fatal("onefile file should not have been deleted") + // ensure the files weren't removed + for _, f := range recordAfter.GetStringSlice("file_many") { + if !hasRecordFile(app, recordAfter, f) { + t.Fatal("file_many file should not have been deleted") + } } } @@ -477,17 +421,18 @@ func TestRecordUpsertSubmitSuccess(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - recordBefore, err := app.Dao().FindFirstRecordByData(collection, "id", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2") + collection, _ := app.Dao().FindCollectionByNameOrId("demo1") + recordBefore, err := app.Dao().FindRecordById(collection.Id, "84nmscqy84lsi1t") if err != nil { t.Fatal(err) } formData, mp, err := tests.MockMultipartData(map[string]string{ - "title": "test_save", - "onefile": "", - "onlyimages": "", - }, "manyfiles.1", "manyfiles") // replace + new file + "text": "test_save", + "bool": "true", + "select_one": "optionA", + "file_one": "", + }, "file_many.1", "file_many") // replace + new file if err != nil { t.Fatal(err) } @@ -495,7 +440,7 @@ func TestRecordUpsertSubmitSuccess(t *testing.T) { form := forms.NewRecordUpsert(app, recordBefore) req := httptest.NewRequest(http.MethodGet, "/", formData) req.Header.Set(echo.HeaderContentType, mp.FormDataContentType()) - form.LoadData(req) + form.LoadRequest(req, "") interceptorCalls := 0 interceptor := func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc { @@ -518,29 +463,24 @@ func TestRecordUpsertSubmitSuccess(t *testing.T) { // ensure that the record changes were persisted // --- - recordAfter, err := app.Dao().FindFirstRecordByData(collection, "id", recordBefore.Id) + recordAfter, err := app.Dao().FindRecordById(collection.Id, recordBefore.Id) if err != nil { t.Fatal(err) } - if recordAfter.GetStringDataValue("title") != "test_save" { - t.Fatalf("Expected record.title to be %v, got %v", recordAfter.GetStringDataValue("title"), "test_save") + if v := recordAfter.GetString("text"); v != "test_save" { + t.Fatalf("Expected record.text to be %v, got %v", v, "test_save") } - if hasRecordFile(app, recordAfter, recordAfter.GetStringDataValue("onefile")) { - t.Fatal("Expected record.onefile to be deleted") + if hasRecordFile(app, recordAfter, recordAfter.GetString("file_one")) { + t.Fatal("Expected record.file_one to be deleted") } - onlyimages := (recordAfter.GetStringSliceDataValue("onlyimages")) - if len(onlyimages) != 0 { - t.Fatalf("Expected all onlyimages files to be deleted, got %d (%v)", len(onlyimages), onlyimages) + fileMany := (recordAfter.GetStringSlice("file_many")) + if len(fileMany) != 4 { // 1 replace + 1 new + t.Fatalf("Expected 4 record.file_many, got %d (%v)", len(fileMany), fileMany) } - - manyfiles := (recordAfter.GetStringSliceDataValue("manyfiles")) - if len(manyfiles) != 3 { - t.Fatalf("Expected 3 manyfiles, got %d (%v)", len(manyfiles), manyfiles) - } - for _, f := range manyfiles { + for _, f := range fileMany { if !hasRecordFile(app, recordAfter, f) { t.Fatalf("Expected file %q to exist", f) } @@ -551,8 +491,8 @@ func TestRecordUpsertSubmitInterceptors(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo4") - record, err := app.Dao().FindFirstRecordByData(collection, "id", "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2") + collection, _ := app.Dao().FindCollectionByNameOrId("demo3") + record, err := app.Dao().FindRecordById(collection.Id, "mk5fmymtx4wsprk") if err != nil { t.Fatal(err) } @@ -574,7 +514,7 @@ func TestRecordUpsertSubmitInterceptors(t *testing.T) { interceptor2Called := false interceptor2 := func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc { return func() error { - interceptorRecordTitle = record.GetStringDataValue("title") // to check if the record was filled + interceptorRecordTitle = record.GetString("title") // to check if the record was filled interceptor2Called = true return testErr } @@ -598,27 +538,16 @@ func TestRecordUpsertSubmitInterceptors(t *testing.T) { } } -func hasRecordFile(app core.App, record *models.Record, filename string) bool { - fs, _ := app.NewFilesystem() - defer fs.Close() - - fileKey := filepath.Join( - record.Collection().Id, - record.Id, - filename, - ) - - exists, _ := fs.Exists(fileKey) - - return exists -} - func TestRecordUpsertWithCustomId(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo3") - existingRecord, err := app.Dao().FindFirstRecordByData(collection, "id", "2c542824-9de1-42fe-8924-e57c86267760") + collection, err := app.Dao().FindCollectionByNameOrId("demo3") + if err != nil { + t.Fatal(err) + } + + existingRecord, err := app.Dao().FindRecordById(collection.Id, "mk5fmymtx4wsprk") if err != nil { t.Fatal(err) } @@ -694,7 +623,7 @@ func TestRecordUpsertWithCustomId(t *testing.T) { form := forms.NewRecordUpsert(app, scenario.record) req := httptest.NewRequest(http.MethodGet, "/", formData) req.Header.Set(echo.HeaderContentType, mp.FormDataContentType()) - form.LoadData(req) + form.LoadRequest(req, "") dryErr := form.DrySubmit(nil) hasDryErr := dryErr != nil @@ -711,10 +640,191 @@ func TestRecordUpsertWithCustomId(t *testing.T) { } if id, ok := scenario.data["id"]; ok && id != "" && !hasSubmitErr { - _, err := app.Dao().FindRecordById(collection, id, nil) + _, err := app.Dao().FindRecordById(collection.Id, id) if err != nil { t.Errorf("[%s] Expected to find record with id %s, got %v", scenario.name, id, err) } } } } + +func TestRecordUpsertAuthRecord(t *testing.T) { + scenarios := []struct { + testName string + existingId string + data map[string]any + manageAccess bool + expectError bool + }{ + { + "empty create data", + "", + map[string]any{}, + false, + true, + }, + { + "empty update data", + "4q1xlclmfloku33", + map[string]any{}, + false, + false, + }, + { + "minimum valid create data", + "", + map[string]any{ + "password": "12345678", + "passwordConfirm": "12345678", + }, + false, + false, + }, + { + "create with all allowed auth fields", + "", + map[string]any{ + "username": "test_new", + "email": "test_new@example.com", + "emailVisibility": true, + "password": "12345678", + "passwordConfirm": "12345678", + }, + false, + false, + }, + + // verified + { + "try to set verified without managed access", + "", + map[string]any{ + "verified": true, + "password": "12345678", + "passwordConfirm": "12345678", + }, + false, + true, + }, + { + "try to update verified without managed access", + "4q1xlclmfloku33", + map[string]any{ + "verified": true, + }, + false, + true, + }, + { + "set verified with managed access", + "", + map[string]any{ + "verified": true, + "password": "12345678", + "passwordConfirm": "12345678", + }, + true, + false, + }, + { + "update verified with managed access", + "4q1xlclmfloku33", + map[string]any{ + "verified": true, + }, + true, + false, + }, + + // email + { + "try to update email without managed access", + "4q1xlclmfloku33", + map[string]any{ + "email": "test_update@example.com", + }, + false, + true, + }, + { + "update email with managed access", + "4q1xlclmfloku33", + map[string]any{ + "email": "test_update@example.com", + }, + true, + false, + }, + + // password + { + "try to update password without managed access", + "4q1xlclmfloku33", + map[string]any{ + "password": "1234567890", + "passwordConfirm": "1234567890", + }, + false, + true, + }, + { + "update password without managed access but with oldPassword", + "4q1xlclmfloku33", + map[string]any{ + "oldPassword": "1234567890", + "password": "1234567890", + "passwordConfirm": "1234567890", + }, + false, + false, + }, + { + "update email with managed access (without oldPassword)", + "4q1xlclmfloku33", + map[string]any{ + "password": "1234567890", + "passwordConfirm": "1234567890", + }, + true, + false, + }, + } + + for _, s := range scenarios { + app, _ := tests.NewTestApp() + defer app.Cleanup() + + collection, err := app.Dao().FindCollectionByNameOrId("users") + if err != nil { + t.Fatal(err) + } + + record := models.NewRecord(collection) + if s.existingId != "" { + var err error + record, err = app.Dao().FindRecordById(collection.Id, s.existingId) + if err != nil { + t.Errorf("[%s] Failed to fetch auth record with id %s", s.testName, s.existingId) + continue + } + } + + form := forms.NewRecordUpsert(app, record) + form.SetFullManageAccess(s.manageAccess) + if err := form.LoadData(s.data); err != nil { + t.Errorf("[%s] Failed to load form data", s.testName) + continue + } + + submitErr := form.Submit() + + hasErr := submitErr != nil + if hasErr != s.expectError { + t.Errorf("[%s] Expected hasErr %v, got %v (%v)", s.testName, s.expectError, hasErr, submitErr) + } + + if !hasErr && record.Username() == "" { + t.Errorf("[%s] Expected username to be set, got empty string: \n%v", s.testName, record) + } + } +} diff --git a/forms/record_verification_confirm.go b/forms/record_verification_confirm.go new file mode 100644 index 000000000..87bab3267 --- /dev/null +++ b/forms/record_verification_confirm.go @@ -0,0 +1,103 @@ +package forms + +import ( + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/tools/security" + "github.com/spf13/cast" +) + +// RecordVerificationConfirm is an auth record email verification confirmation form. +type RecordVerificationConfirm struct { + app core.App + collection *models.Collection + dao *daos.Dao + + Token string `form:"token" json:"token"` +} + +// NewRecordVerificationConfirm creates a new [RecordVerificationConfirm] +// form initialized with from the provided [core.App] instance. +// +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. +func NewRecordVerificationConfirm(app core.App, collection *models.Collection) *RecordVerificationConfirm { + return &RecordVerificationConfirm{ + app: app, + dao: app.Dao(), + collection: collection, + } +} + +// SetDao replaces the default form Dao instance with the provided one. +func (form *RecordVerificationConfirm) SetDao(dao *daos.Dao) { + form.dao = dao +} + +// Validate makes the form validatable by implementing [validation.Validatable] interface. +func (form *RecordVerificationConfirm) Validate() error { + return validation.ValidateStruct(form, + validation.Field(&form.Token, validation.Required, validation.By(form.checkToken)), + ) +} + +func (form *RecordVerificationConfirm) checkToken(value any) error { + v, _ := value.(string) + if v == "" { + return nil // nothing to check + } + + claims, _ := security.ParseUnverifiedJWT(v) + email := cast.ToString(claims["email"]) + if email == "" { + return validation.NewError("validation_invalid_token_claims", "Missing email token claim.") + } + + record, err := form.dao.FindAuthRecordByToken( + v, + form.app.Settings().RecordVerificationToken.Secret, + ) + if err != nil || record == nil { + return validation.NewError("validation_invalid_token", "Invalid or expired token.") + } + + if record.Collection().Id != form.collection.Id { + return validation.NewError("validation_token_collection_mismatch", "The provided token is for different auth collection.") + } + + if record.Email() != email { + return validation.NewError("validation_token_email_mismatch", "The record email doesn't match with the requested token claims.") + } + + return nil +} + +// Submit validates and submits the form. +// On success returns the verified auth record associated to `form.Token`. +func (form *RecordVerificationConfirm) Submit() (*models.Record, error) { + if err := form.Validate(); err != nil { + return nil, err + } + + record, err := form.dao.FindAuthRecordByToken( + form.Token, + form.app.Settings().RecordVerificationToken.Secret, + ) + if err != nil { + return nil, err + } + + if record.Verified() { + return record, nil // already verified + } + + record.SetVerified(true) + + if err := form.dao.SaveRecord(record); err != nil { + return nil, err + } + + return record, nil +} diff --git a/forms/record_verification_confirm_test.go b/forms/record_verification_confirm_test.go new file mode 100644 index 000000000..7059a58ab --- /dev/null +++ b/forms/record_verification_confirm_test.go @@ -0,0 +1,79 @@ +package forms_test + +import ( + "encoding/json" + "testing" + + "github.com/pocketbase/pocketbase/forms" + "github.com/pocketbase/pocketbase/tests" + "github.com/pocketbase/pocketbase/tools/security" +) + +func TestRecordVerificationConfirmValidateAndSubmit(t *testing.T) { + testApp, _ := tests.NewTestApp() + defer testApp.Cleanup() + + authCollection, err := testApp.Dao().FindCollectionByNameOrId("users") + if err != nil { + t.Fatal(err) + } + + scenarios := []struct { + jsonData string + expectError bool + }{ + // empty data (Validate call check) + { + `{}`, + true, + }, + // expired token (Validate call check) + { + `{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoxNjQwOTkxNjYxfQ.Avbt9IP8sBisVz_2AGrlxLDvangVq4PhL2zqQVYLKlE"}`, + true, + }, + // valid token (already verified record) + { + `{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Im9hcDY0MGNvdDR5cnUycyIsImVtYWlsIjoidGVzdDJAZXhhbXBsZS5jb20iLCJjb2xsZWN0aW9uSWQiOiJfcGJfdXNlcnNfYXV0aF8iLCJ0eXBlIjoiYXV0aFJlY29yZCIsImV4cCI6MjIwODk4NTI2MX0.PsOABmYUzGbd088g8iIBL4-pf7DUZm0W5Ju6lL5JVRg"}`, + false, + }, + // valid token (unverified record) + { + `{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRxMXhsY2xtZmxva3UzMyIsImVtYWlsIjoidGVzdEBleGFtcGxlLmNvbSIsImNvbGxlY3Rpb25JZCI6Il9wYl91c2Vyc19hdXRoXyIsInR5cGUiOiJhdXRoUmVjb3JkIiwiZXhwIjoyMjA4OTg1MjYxfQ.hL16TVmStHFdHLc4a860bRqJ3sFfzjv0_NRNzwsvsrc"}`, + false, + }, + } + + for i, s := range scenarios { + form := forms.NewRecordVerificationConfirm(testApp, authCollection) + + // load data + loadErr := json.Unmarshal([]byte(s.jsonData), form) + if loadErr != nil { + t.Errorf("(%d) Failed to load form data: %v", i, loadErr) + continue + } + + record, err := form.Submit() + + hasErr := err != nil + if hasErr != s.expectError { + t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err) + } + + if hasErr { + continue + } + + claims, _ := security.ParseUnverifiedJWT(form.Token) + tokenRecordId := claims["id"] + + if record.Id != tokenRecordId { + t.Errorf("(%d) Expected record.Id %q, got %q", i, tokenRecordId, record.Id) + } + + if !record.Verified() { + t.Errorf("(%d) Expected record.Verified() to be true, got false", i) + } + } +} diff --git a/forms/record_verification_request.go b/forms/record_verification_request.go new file mode 100644 index 000000000..d702e9365 --- /dev/null +++ b/forms/record_verification_request.go @@ -0,0 +1,94 @@ +package forms + +import ( + "errors" + "time" + + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/go-ozzo/ozzo-validation/v4/is" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/daos" + "github.com/pocketbase/pocketbase/mails" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/models/schema" + "github.com/pocketbase/pocketbase/tools/types" +) + +// RecordVerificationRequest is an auth record email verification request form. +type RecordVerificationRequest struct { + app core.App + collection *models.Collection + dao *daos.Dao + resendThreshold float64 // in seconds + + Email string `form:"email" json:"email"` +} + +// NewRecordVerificationRequest creates a new [RecordVerificationRequest] +// form initialized with from the provided [core.App] instance. +// +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. +func NewRecordVerificationRequest(app core.App, collection *models.Collection) *RecordVerificationRequest { + return &RecordVerificationRequest{ + app: app, + dao: app.Dao(), + collection: collection, + resendThreshold: 120, // 2 min + } +} + +// SetDao replaces the default form Dao instance with the provided one. +func (form *RecordVerificationRequest) SetDao(dao *daos.Dao) { + form.dao = dao +} + +// Validate makes the form validatable by implementing [validation.Validatable] interface. +// +// // This method doesn't verify that auth record with `form.Email` exists (this is done on Submit). +func (form *RecordVerificationRequest) Validate() error { + return validation.ValidateStruct(form, + validation.Field( + &form.Email, + validation.Required, + validation.Length(1, 255), + is.EmailFormat, + ), + ) +} + +// Submit validates and sends a verification request email +// to the `form.Email` auth record. +func (form *RecordVerificationRequest) Submit() error { + if err := form.Validate(); err != nil { + return err + } + + record, err := form.dao.FindFirstRecordByData( + form.collection.Id, + schema.FieldNameEmail, + form.Email, + ) + if err != nil { + return err + } + + if record.GetBool(schema.FieldNameVerified) { + return nil // already verified + } + + now := time.Now().UTC() + lastVerificationSentAt := record.LastVerificationSentAt().Time() + if (now.Sub(lastVerificationSentAt)).Seconds() < form.resendThreshold { + return errors.New("A verification email was already sent.") + } + + if err := mails.SendRecordVerification(form.app, record); err != nil { + return err + } + + // update last sent timestamp + record.Set(schema.FieldNameLastVerificationSentAt, types.NowDateTime()) + + return form.dao.SaveRecord(record) +} diff --git a/forms/user_verification_request_test.go b/forms/record_verification_request_test.go similarity index 54% rename from forms/user_verification_request_test.go rename to forms/record_verification_request_test.go index 598d6d101..b0ce71660 100644 --- a/forms/user_verification_request_test.go +++ b/forms/record_verification_request_test.go @@ -5,85 +5,19 @@ import ( "testing" "time" - validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/pocketbase/pocketbase/forms" "github.com/pocketbase/pocketbase/tests" "github.com/pocketbase/pocketbase/tools/types" ) -func TestUserVerificationRequestPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserVerificationRequest(nil) -} - -func TestUserVerificationRequestValidate(t *testing.T) { +func TestRecordVerificationRequestSubmit(t *testing.T) { testApp, _ := tests.NewTestApp() defer testApp.Cleanup() - scenarios := []struct { - jsonData string - expectedErrors []string - }{ - // empty data - { - `{}`, - []string{"email"}, - }, - // empty fields - { - `{"email":""}`, - []string{"email"}, - }, - // invalid email format - { - `{"email":"invalid"}`, - []string{"email"}, - }, - // valid email - { - `{"email":"new@example.com"}`, - []string{}, - }, - } - - for i, s := range scenarios { - form := forms.NewUserVerificationRequest(testApp) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - // parse errors - result := form.Validate() - errs, ok := result.(validation.Errors) - if !ok && result != nil { - t.Errorf("(%d) Failed to parse errors %v", i, result) - continue - } - - // check errors - if len(errs) > len(s.expectedErrors) { - t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) - } - for _, k := range s.expectedErrors { - if _, ok := errs[k]; !ok { - t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) - } - } + authCollection, err := testApp.Dao().FindCollectionByNameOrId("clients") + if err != nil { + t.Fatal(err) } -} - -func TestUserVerificationRequestSubmit(t *testing.T) { - testApp, _ := tests.NewTestApp() - defer testApp.Cleanup() scenarios := []struct { jsonData string @@ -139,7 +73,7 @@ func TestUserVerificationRequestSubmit(t *testing.T) { for i, s := range scenarios { testApp.TestMailer.TotalSend = 0 // reset - form := forms.NewUserVerificationRequest(testApp) + form := forms.NewRecordVerificationRequest(testApp, authCollection) // load data loadErr := json.Unmarshal([]byte(s.jsonData), form) @@ -167,15 +101,15 @@ func TestUserVerificationRequestSubmit(t *testing.T) { continue } - user, err := testApp.Dao().FindUserByEmail(form.Email) + user, err := testApp.Dao().FindAuthRecordByEmail(authCollection.Id, form.Email) if err != nil { t.Errorf("(%d) Expected user with email %q to exist, got nil", i, form.Email) continue } // check whether LastVerificationSentAt was updated - if !user.Verified && user.LastVerificationSentAt.Time().Sub(now.Time()) < 0 { - t.Errorf("(%d) Expected LastVerificationSentAt to be after %v, got %v", i, now, user.LastVerificationSentAt) + if !user.Verified() && user.LastVerificationSentAt().Time().Sub(now.Time()) < 0 { + t.Errorf("(%d) Expected LastVerificationSentAt to be after %v, got %v", i, now, user.LastVerificationSentAt()) } } } diff --git a/forms/settings_upsert.go b/forms/settings_upsert.go index 8d5eb562f..7ca42f3fa 100644 --- a/forms/settings_upsert.go +++ b/forms/settings_upsert.go @@ -9,56 +9,36 @@ import ( "github.com/pocketbase/pocketbase/models" ) -// SettingsUpsert specifies a [core.Settings] upsert (create/update) form. +// SettingsUpsert is a [core.Settings] upsert (create/update) form. type SettingsUpsert struct { *core.Settings - config SettingsUpsertConfig -} - -// SettingsUpsertConfig is the [SettingsUpsert] factory initializer config. -// -// NB! App is required struct member. -type SettingsUpsertConfig struct { - App core.App - Dao *daos.Dao - LogsDao *daos.Dao + app core.App + dao *daos.Dao } // NewSettingsUpsert creates a new [SettingsUpsert] form with initializer // config created from the provided [core.App] instance. // -// If you want to submit the form as part of another transaction, use -// [NewSettingsUpsertWithConfig] with explicitly set Dao. +// If you want to submit the form as part of a transaction, +// you can change the default Dao via [SetDao()]. func NewSettingsUpsert(app core.App) *SettingsUpsert { - return NewSettingsUpsertWithConfig(SettingsUpsertConfig{ - App: app, - }) -} - -// NewSettingsUpsertWithConfig creates a new [SettingsUpsert] form -// with the provided config or panics on invalid configuration. -func NewSettingsUpsertWithConfig(config SettingsUpsertConfig) *SettingsUpsert { - form := &SettingsUpsert{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - - if form.config.LogsDao == nil { - form.config.LogsDao = form.config.App.LogsDao() + form := &SettingsUpsert{ + app: app, + dao: app.Dao(), } // load the application settings into the form - form.Settings, _ = config.App.Settings().Clone() + form.Settings, _ = app.Settings().Clone() return form } +// SetDao replaces the default form Dao instance with the provided one. +func (form *SettingsUpsert) SetDao(dao *daos.Dao) { + form.dao = dao +} + // Validate makes the form validatable by implementing [validation.Validatable] interface. func (form *SettingsUpsert) Validate() error { return form.Settings.Validate() @@ -75,10 +55,10 @@ func (form *SettingsUpsert) Submit(interceptors ...InterceptorFunc) error { return err } - encryptionKey := os.Getenv(form.config.App.EncryptionEnv()) + encryptionKey := os.Getenv(form.app.EncryptionEnv()) return runInterceptors(func() error { - saveErr := form.config.Dao.SaveParam( + saveErr := form.dao.SaveParam( models.ParamAppSettings, form.Settings, encryptionKey, @@ -88,11 +68,11 @@ func (form *SettingsUpsert) Submit(interceptors ...InterceptorFunc) error { } // explicitly trigger old logs deletion - form.config.LogsDao.DeleteOldRequests( + form.app.LogsDao().DeleteOldRequests( time.Now().AddDate(0, 0, -1*form.Settings.Logs.MaxDays), ) // merge the application settings with the form ones - return form.config.App.Settings().Merge(form.Settings) + return form.app.Settings().Merge(form.Settings) }, interceptors...) } diff --git a/forms/settings_upsert_test.go b/forms/settings_upsert_test.go index 1d3806a4f..494545c00 100644 --- a/forms/settings_upsert_test.go +++ b/forms/settings_upsert_test.go @@ -12,16 +12,6 @@ import ( "github.com/pocketbase/pocketbase/tools/security" ) -func TestSettingsUpsertPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewSettingsUpsert(nil) -} - func TestNewSettingsUpsert(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() @@ -38,29 +28,7 @@ func TestNewSettingsUpsert(t *testing.T) { } } -func TestSettingsUpsertValidate(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - form := forms.NewSettingsUpsert(app) - - // check if settings validations are triggered - // (there are already individual tests for each setting) - form.Meta.AppName = "" - form.Logs.MaxDays = -10 - - // parse errors - err := form.Validate() - jsonResult, _ := json.Marshal(err) - - expected := `{"logs":{"maxDays":"must be no less than 0"},"meta":{"appName":"cannot be blank"}}` - - if string(jsonResult) != expected { - t.Errorf("Expected %v, got %v", expected, string(jsonResult)) - } -} - -func TestSettingsUpsertSubmit(t *testing.T) { +func TestSettingsUpsertValidateAndSubmit(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() @@ -75,19 +43,19 @@ func TestSettingsUpsertSubmit(t *testing.T) { {"{}", true, nil}, // failure - invalid data { - `{"emailAuth": {"minPasswordLength": 1}, "logs": {"maxDays": -1}}`, + `{"meta": {"appName": ""}, "logs": {"maxDays": -1}}`, false, - []string{"emailAuth", "logs"}, + []string{"meta", "logs"}, }, // success - valid data (plain) { - `{"emailAuth": {"minPasswordLength": 6}, "logs": {"maxDays": 0}}`, + `{"meta": {"appName": "test"}, "logs": {"maxDays": 0}}`, false, nil, }, // success - valid data (encrypt) { - `{"emailAuth": {"minPasswordLength": 6}, "logs": {"maxDays": 0}}`, + `{"meta": {"appName": "test"}, "logs": {"maxDays": 7}}`, true, nil, }, diff --git a/forms/test_email_send.go b/forms/test_email_send.go index 61c211751..5dd902e41 100644 --- a/forms/test_email_send.go +++ b/forms/test_email_send.go @@ -6,6 +6,7 @@ import ( "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/mails" "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/models/schema" ) const ( @@ -39,7 +40,7 @@ func (form *TestEmailSend) Validate() error { validation.Field( &form.Template, validation.Required, - validation.In(templateVerification, templateEmailChange, templatePasswordReset), + validation.In(templateVerification, templatePasswordReset, templateEmailChange), ), ) } @@ -50,19 +51,26 @@ func (form *TestEmailSend) Submit() error { return err } - // create a test user - user := &models.User{} - user.Id = "__pb_test_id__" - user.Email = form.Email - user.RefreshTokenKey() + // create a test auth record + collection := &models.Collection{ + BaseModel: models.BaseModel{Id: "__pb_test_collection_id__"}, + Name: "__pb_test_collection_name__", + Type: models.CollectionTypeAuth, + } + + record := models.NewRecord(collection) + record.Id = "__pb_test_id__" + record.Set(schema.FieldNameUsername, "pb_test") + record.Set(schema.FieldNameEmail, form.Email) + record.RefreshTokenKey() switch form.Template { case templateVerification: - return mails.SendUserVerification(form.app, user) + return mails.SendRecordVerification(form.app, record) case templatePasswordReset: - return mails.SendUserPasswordReset(form.app, user) + return mails.SendRecordPasswordReset(form.app, record) case templateEmailChange: - return mails.SendUserChangeEmail(form.app, user, form.Email) + return mails.SendRecordChangeEmail(form.app, record, form.Email) } return nil diff --git a/forms/test_email_send_test.go b/forms/test_email_send_test.go index 21995ad0e..551d17609 100644 --- a/forms/test_email_send_test.go +++ b/forms/test_email_send_test.go @@ -9,10 +9,7 @@ import ( "github.com/pocketbase/pocketbase/tests" ) -func TestEmailSendValidate(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - +func TestEmailSendValidateAndSubmit(t *testing.T) { scenarios := []struct { template string email string @@ -27,11 +24,14 @@ func TestEmailSendValidate(t *testing.T) { } for i, s := range scenarios { + app, _ := tests.NewTestApp() + defer app.Cleanup() + form := forms.NewTestEmailSend(app) form.Email = s.email form.Template = s.template - result := form.Validate() + result := form.Submit() // parse errors errs, ok := result.(validation.Errors) @@ -43,50 +43,26 @@ func TestEmailSendValidate(t *testing.T) { // check errors if len(errs) > len(s.expectedErrors) { t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) + continue } for _, k := range s.expectedErrors { if _, ok := errs[k]; !ok { t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) + continue } } - } -} - -func TestEmailSendSubmit(t *testing.T) { - scenarios := []struct { - template string - email string - expectError bool - }{ - {"", "", true}, - {"invalid", "test@example.com", true}, - {"verification", "invalid", true}, - {"verification", "test@example.com", false}, - {"password-reset", "test@example.com", false}, - {"email-change", "test@example.com", false}, - } - for i, s := range scenarios { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - form := forms.NewTestEmailSend(app) - form.Email = s.email - form.Template = s.template - - err := form.Submit() - - hasErr := err != nil - if hasErr != s.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err) + expectedEmails := 1 + if len(s.expectedErrors) > 0 { + expectedEmails = 0 } - if hasErr { - continue + if app.TestMailer.TotalSend != expectedEmails { + t.Errorf("(%d) Expected %d email(s) to be sent, got %d", i, expectedEmails, app.TestMailer.TotalSend) } - if app.TestMailer.TotalSend != 1 { - t.Errorf("(%d) Expected one email to be sent, got %d", i, app.TestMailer.TotalSend) + if len(s.expectedErrors) > 0 { + continue } expectedContent := "Verify" diff --git a/forms/user_email_change_confirm.go b/forms/user_email_change_confirm.go deleted file mode 100644 index 3e9db0d5c..000000000 --- a/forms/user_email_change_confirm.go +++ /dev/null @@ -1,143 +0,0 @@ -package forms - -import ( - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/daos" - "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tools/security" -) - -// UserEmailChangeConfirm specifies a user email change confirmation form. -type UserEmailChangeConfirm struct { - config UserEmailChangeConfirmConfig - - Token string `form:"token" json:"token"` - Password string `form:"password" json:"password"` -} - -// UserEmailChangeConfirmConfig is the [UserEmailChangeConfirm] factory initializer config. -// -// NB! App is required struct member. -type UserEmailChangeConfirmConfig struct { - App core.App - Dao *daos.Dao -} - -// NewUserEmailChangeConfirm creates a new [UserEmailChangeConfirm] -// form with initializer config created from the provided [core.App] instance. -// -// This factory method is used primarily for convenience (and backward compatibility). -// If you want to submit the form as part of another transaction, use -// [NewUserEmailChangeConfirmWithConfig] with explicitly set Dao. -func NewUserEmailChangeConfirm(app core.App) *UserEmailChangeConfirm { - return NewUserEmailChangeConfirmWithConfig(UserEmailChangeConfirmConfig{ - App: app, - }) -} - -// NewUserEmailChangeConfirmWithConfig creates a new [UserEmailChangeConfirm] -// form with the provided config or panics on invalid configuration. -func NewUserEmailChangeConfirmWithConfig(config UserEmailChangeConfirmConfig) *UserEmailChangeConfirm { - form := &UserEmailChangeConfirm{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - - return form -} - -// Validate makes the form validatable by implementing [validation.Validatable] interface. -func (form *UserEmailChangeConfirm) Validate() error { - return validation.ValidateStruct(form, - validation.Field( - &form.Token, - validation.Required, - validation.By(form.checkToken), - ), - validation.Field( - &form.Password, - validation.Required, - validation.Length(1, 100), - validation.By(form.checkPassword), - ), - ) -} - -func (form *UserEmailChangeConfirm) checkToken(value any) error { - v, _ := value.(string) - if v == "" { - return nil // nothing to check - } - - _, _, err := form.parseToken(v) - - return err -} - -func (form *UserEmailChangeConfirm) checkPassword(value any) error { - v, _ := value.(string) - if v == "" { - return nil // nothing to check - } - - user, _, _ := form.parseToken(form.Token) - if user == nil || !user.ValidatePassword(v) { - return validation.NewError("validation_invalid_password", "Missing or invalid user password.") - } - - return nil -} - -func (form *UserEmailChangeConfirm) parseToken(token string) (*models.User, string, error) { - // check token payload - claims, _ := security.ParseUnverifiedJWT(token) - newEmail, _ := claims["newEmail"].(string) - if newEmail == "" { - return nil, "", validation.NewError("validation_invalid_token_payload", "Invalid token payload - newEmail must be set.") - } - - // ensure that there aren't other users with the new email - if !form.config.Dao.IsUserEmailUnique(newEmail, "") { - return nil, "", validation.NewError("validation_existing_token_email", "The new email address is already registered: "+newEmail) - } - - // verify that the token is not expired and its signature is valid - user, err := form.config.Dao.FindUserByToken( - token, - form.config.App.Settings().UserEmailChangeToken.Secret, - ) - if err != nil || user == nil { - return nil, "", validation.NewError("validation_invalid_token", "Invalid or expired token.") - } - - return user, newEmail, nil -} - -// Submit validates and submits the user email change confirmation form. -// On success returns the updated user model associated to `form.Token`. -func (form *UserEmailChangeConfirm) Submit() (*models.User, error) { - if err := form.Validate(); err != nil { - return nil, err - } - - user, newEmail, err := form.parseToken(form.Token) - if err != nil { - return nil, err - } - - user.Email = newEmail - user.Verified = true - user.RefreshTokenKey() // invalidate old tokens - - if err := form.config.Dao.SaveUser(user); err != nil { - return nil, err - } - - return user, nil -} diff --git a/forms/user_email_change_confirm_test.go b/forms/user_email_change_confirm_test.go deleted file mode 100644 index d68f9ca75..000000000 --- a/forms/user_email_change_confirm_test.go +++ /dev/null @@ -1,131 +0,0 @@ -package forms_test - -import ( - "encoding/json" - "testing" - - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/pocketbase/pocketbase/forms" - "github.com/pocketbase/pocketbase/tests" - "github.com/pocketbase/pocketbase/tools/security" -) - -func TestUserEmailChangeConfirmPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserEmailChangeConfirm(nil) -} - -func TestUserEmailChangeConfirmValidateAndSubmit(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - jsonData string - expectedErrors []string - }{ - // empty payload - {"{}", []string{"token", "password"}}, - // empty data - { - `{"token": "", "password": ""}`, - []string{"token", "password"}, - }, - // invalid token payload - { - `{ - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxODYxOTE2NDYxfQ.VjT3wc3IES--1Vye-1KRuk8RpO5mfdhVp2aKGbNluZ0", - "password": "123456" - }`, - []string{"token", "password"}, - }, - // expired token - { - `{ - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJ0ZXN0X25ld0BleGFtcGxlLmNvbSIsImV4cCI6MTY0MDk5MTY2MX0.oPxbpJjcBpdZVBFbIW35FEXTCMkzJ7-RmQdHrz7zP3s", - "password": "123456" - }`, - []string{"token", "password"}, - }, - // existing new email - { - `{ - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJ0ZXN0MkBleGFtcGxlLmNvbSIsImV4cCI6MTg2MTkxNjQ2MX0.RwHRZma5YpCwxHdj3y2obeBNy_GQrG6lT9CQHIUz6Ys", - "password": "123456" - }`, - []string{"token", "password"}, - }, - // wrong confirmation password - { - `{ - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJ0ZXN0X25ld0BleGFtcGxlLmNvbSIsImV4cCI6MTg2MTkxNjQ2MX0.nS2qDonX25tOf9-6bKCwJXOm1CE88z_EVAA2B72NYM0", - "password": "1234" - }`, - []string{"password"}, - }, - // valid data - { - `{ - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwibmV3RW1haWwiOiJ0ZXN0X25ld0BleGFtcGxlLmNvbSIsImV4cCI6MTg2MTkxNjQ2MX0.nS2qDonX25tOf9-6bKCwJXOm1CE88z_EVAA2B72NYM0", - "password": "123456" - }`, - []string{}, - }, - } - - for i, s := range scenarios { - form := forms.NewUserEmailChangeConfirm(app) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - user, err := form.Submit() - - // parse errors - errs, ok := err.(validation.Errors) - if !ok && err != nil { - t.Errorf("(%d) Failed to parse errors %v", i, err) - continue - } - - // check errors - if len(errs) > len(s.expectedErrors) { - t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) - } - for _, k := range s.expectedErrors { - if _, ok := errs[k]; !ok { - t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) - } - } - - if len(s.expectedErrors) > 0 { - continue - } - - claims, _ := security.ParseUnverifiedJWT(form.Token) - newEmail, _ := claims["newEmail"].(string) - - // check whether the user was updated - // --- - if user.Email != newEmail { - t.Errorf("(%d) Expected user email %q, got %q", i, newEmail, user.Email) - } - - if !user.Verified { - t.Errorf("(%d) Expected user to be verified, got false", i) - } - - // shouldn't validate second time due to refreshed user token - if err := form.Validate(); err == nil { - t.Errorf("(%d) Expected error, got nil", i) - } - } -} diff --git a/forms/user_email_change_request.go b/forms/user_email_change_request.go deleted file mode 100644 index 488239920..000000000 --- a/forms/user_email_change_request.go +++ /dev/null @@ -1,88 +0,0 @@ -package forms - -import ( - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/go-ozzo/ozzo-validation/v4/is" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/daos" - "github.com/pocketbase/pocketbase/mails" - "github.com/pocketbase/pocketbase/models" -) - -// UserEmailChangeRequest defines a user email change request form. -type UserEmailChangeRequest struct { - config UserEmailChangeRequestConfig - user *models.User - - NewEmail string `form:"newEmail" json:"newEmail"` -} - -// UserEmailChangeRequestConfig is the [UserEmailChangeRequest] factory initializer config. -// -// NB! App is required struct member. -type UserEmailChangeRequestConfig struct { - App core.App - Dao *daos.Dao -} - -// NewUserEmailChangeRequest creates a new [UserEmailChangeRequest] -// form with initializer config created from the provided [core.App] instance. -// -// If you want to submit the form as part of another transaction, use -// [NewUserEmailChangeConfirmWithConfig] with explicitly set Dao. -func NewUserEmailChangeRequest(app core.App, user *models.User) *UserEmailChangeRequest { - return NewUserEmailChangeRequestWithConfig(UserEmailChangeRequestConfig{ - App: app, - }, user) -} - -// NewUserEmailChangeRequestWithConfig creates a new [UserEmailChangeRequest] -// form with the provided config or panics on invalid configuration. -func NewUserEmailChangeRequestWithConfig(config UserEmailChangeRequestConfig, user *models.User) *UserEmailChangeRequest { - form := &UserEmailChangeRequest{ - config: config, - user: user, - } - - if form.config.App == nil || form.user == nil { - panic("Invalid initializer config or nil user model.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - - return form -} - -// Validate makes the form validatable by implementing [validation.Validatable] interface. -func (form *UserEmailChangeRequest) Validate() error { - return validation.ValidateStruct(form, - validation.Field( - &form.NewEmail, - validation.Required, - validation.Length(1, 255), - is.EmailFormat, - validation.By(form.checkUniqueEmail), - ), - ) -} - -func (form *UserEmailChangeRequest) checkUniqueEmail(value any) error { - v, _ := value.(string) - - if !form.config.Dao.IsUserEmailUnique(v, "") { - return validation.NewError("validation_user_email_exists", "User email already exists.") - } - - return nil -} - -// Submit validates and sends the change email request. -func (form *UserEmailChangeRequest) Submit() error { - if err := form.Validate(); err != nil { - return err - } - - return mails.SendUserChangeEmail(form.config.App, form.user, form.NewEmail) -} diff --git a/forms/user_email_login.go b/forms/user_email_login.go deleted file mode 100644 index d3946add8..000000000 --- a/forms/user_email_login.go +++ /dev/null @@ -1,80 +0,0 @@ -package forms - -import ( - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/go-ozzo/ozzo-validation/v4/is" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/daos" - "github.com/pocketbase/pocketbase/models" -) - -// UserEmailLogin specifies a user email/pass login form. -type UserEmailLogin struct { - config UserEmailLoginConfig - - Email string `form:"email" json:"email"` - Password string `form:"password" json:"password"` -} - -// UserEmailLoginConfig is the [UserEmailLogin] factory initializer config. -// -// NB! App is required struct member. -type UserEmailLoginConfig struct { - App core.App - Dao *daos.Dao -} - -// NewUserEmailLogin creates a new [UserEmailLogin] form with -// initializer config created from the provided [core.App] instance. -// -// This factory method is used primarily for convenience (and backward compatibility). -// If you want to submit the form as part of another transaction, use -// [NewUserEmailLoginWithConfig] with explicitly set Dao. -func NewUserEmailLogin(app core.App) *UserEmailLogin { - return NewUserEmailLoginWithConfig(UserEmailLoginConfig{ - App: app, - }) -} - -// NewUserEmailLoginWithConfig creates a new [UserEmailLogin] -// form with the provided config or panics on invalid configuration. -func NewUserEmailLoginWithConfig(config UserEmailLoginConfig) *UserEmailLogin { - form := &UserEmailLogin{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - - return form -} - -// Validate makes the form validatable by implementing [validation.Validatable] interface. -func (form *UserEmailLogin) Validate() error { - return validation.ValidateStruct(form, - validation.Field(&form.Email, validation.Required, validation.Length(1, 255), is.EmailFormat), - validation.Field(&form.Password, validation.Required, validation.Length(1, 255)), - ) -} - -// Submit validates and submits the form. -// On success returns the authorized user model. -func (form *UserEmailLogin) Submit() (*models.User, error) { - if err := form.Validate(); err != nil { - return nil, err - } - - user, err := form.config.Dao.FindUserByEmail(form.Email) - if err != nil { - return nil, err - } - - if !user.ValidatePassword(form.Password) { - return nil, validation.NewError("invalid_login", "Invalid login credentials.") - } - - return user, nil -} diff --git a/forms/user_email_login_test.go b/forms/user_email_login_test.go deleted file mode 100644 index 1049f12a4..000000000 --- a/forms/user_email_login_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package forms_test - -import ( - "encoding/json" - "testing" - - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/pocketbase/pocketbase/forms" - "github.com/pocketbase/pocketbase/tests" -) - -func TestUserEmailLoginPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserEmailLogin(nil) -} - -func TestUserEmailLoginValidate(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - jsonData string - expectedErrors []string - }{ - // empty payload - {"{}", []string{"email", "password"}}, - // empty data - { - `{"email": "","password": ""}`, - []string{"email", "password"}, - }, - // invalid email - { - `{"email": "invalid","password": "123"}`, - []string{"email"}, - }, - // valid email - { - `{"email": "test@example.com","password": "123"}`, - []string{}, - }, - } - - for i, s := range scenarios { - form := forms.NewUserEmailLogin(app) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - err := form.Validate() - - // parse errors - errs, ok := err.(validation.Errors) - if !ok && err != nil { - t.Errorf("(%d) Failed to parse errors %v", i, err) - continue - } - - // check errors - if len(errs) > len(s.expectedErrors) { - t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) - } - for _, k := range s.expectedErrors { - if _, ok := errs[k]; !ok { - t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) - } - } - } -} - -func TestUserEmailLoginSubmit(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - email string - password string - expectError bool - }{ - // invalid email - {"invalid", "123456", true}, - // missing user - {"missing@example.com", "123456", true}, - // invalid password - {"test@example.com", "123", true}, - // valid email and password - {"test@example.com", "123456", false}, - } - - for i, s := range scenarios { - form := forms.NewUserEmailLogin(app) - form.Email = s.email - form.Password = s.password - - user, err := form.Submit() - - hasErr := err != nil - if hasErr != s.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err) - continue - } - - if !s.expectError && user.Email != s.email { - t.Errorf("(%d) Expected user with email %q, got %q", i, s.email, user.Email) - } - } -} diff --git a/forms/user_oauth2_login.go b/forms/user_oauth2_login.go deleted file mode 100644 index b337ca5e5..000000000 --- a/forms/user_oauth2_login.go +++ /dev/null @@ -1,195 +0,0 @@ -package forms - -import ( - "errors" - "fmt" - - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/go-ozzo/ozzo-validation/v4/is" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/daos" - "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tools/auth" - "github.com/pocketbase/pocketbase/tools/security" - "golang.org/x/oauth2" -) - -// UserOauth2Login specifies a user Oauth2 login form. -type UserOauth2Login struct { - config UserOauth2LoginConfig - - // The name of the OAuth2 client provider (eg. "google") - Provider string `form:"provider" json:"provider"` - - // The authorization code returned from the initial request. - Code string `form:"code" json:"code"` - - // The code verifier sent with the initial request as part of the code_challenge. - CodeVerifier string `form:"codeVerifier" json:"codeVerifier"` - - // The redirect url sent with the initial request. - RedirectUrl string `form:"redirectUrl" json:"redirectUrl"` -} - -// UserOauth2LoginConfig is the [UserOauth2Login] factory initializer config. -// -// NB! App is required struct member. -type UserOauth2LoginConfig struct { - App core.App - Dao *daos.Dao -} - -// NewUserOauth2Login creates a new [UserOauth2Login] form with -// initializer config created from the provided [core.App] instance. -// -// If you want to submit the form as part of another transaction, use -// [NewUserOauth2LoginWithConfig] with explicitly set Dao. -func NewUserOauth2Login(app core.App) *UserOauth2Login { - return NewUserOauth2LoginWithConfig(UserOauth2LoginConfig{ - App: app, - }) -} - -// NewUserOauth2LoginWithConfig creates a new [UserOauth2Login] -// form with the provided config or panics on invalid configuration. -func NewUserOauth2LoginWithConfig(config UserOauth2LoginConfig) *UserOauth2Login { - form := &UserOauth2Login{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - - return form -} - -// Validate makes the form validatable by implementing [validation.Validatable] interface. -func (form *UserOauth2Login) Validate() error { - return validation.ValidateStruct(form, - validation.Field(&form.Provider, validation.Required, validation.By(form.checkProviderName)), - validation.Field(&form.Code, validation.Required), - validation.Field(&form.CodeVerifier, validation.Required), - validation.Field(&form.RedirectUrl, validation.Required, is.URL), - ) -} - -func (form *UserOauth2Login) checkProviderName(value any) error { - name, _ := value.(string) - - config, ok := form.config.App.Settings().NamedAuthProviderConfigs()[name] - if !ok || !config.Enabled { - return validation.NewError("validation_invalid_provider", fmt.Sprintf("%q is missing or is not enabled.", name)) - } - - return nil -} - -// Submit validates and submits the form. -// On success returns the authorized user model and the fetched provider's data. -func (form *UserOauth2Login) Submit() (*models.User, *auth.AuthUser, error) { - if err := form.Validate(); err != nil { - return nil, nil, err - } - - provider, err := auth.NewProviderByName(form.Provider) - if err != nil { - return nil, nil, err - } - - // load provider configuration - config := form.config.App.Settings().NamedAuthProviderConfigs()[form.Provider] - if err := config.SetupProvider(provider); err != nil { - return nil, nil, err - } - - provider.SetRedirectUrl(form.RedirectUrl) - - // fetch token - token, err := provider.FetchToken( - form.Code, - oauth2.SetAuthURLParam("code_verifier", form.CodeVerifier), - ) - if err != nil { - return nil, nil, err - } - - // fetch external auth user - authData, err := provider.FetchAuthUser(token) - if err != nil { - return nil, nil, err - } - - var user *models.User - - // check for existing relation with the external auth user - rel, _ := form.config.Dao.FindExternalAuthByProvider(form.Provider, authData.Id) - if rel != nil { - user, err = form.config.Dao.FindUserById(rel.UserId) - if err != nil { - return nil, authData, err - } - } else if authData.Email != "" { - // look for an existing user by the external user's email - user, _ = form.config.Dao.FindUserByEmail(authData.Email) - } - - if user == nil && !config.AllowRegistrations { - return nil, authData, errors.New("New users registration is not allowed for the authorized provider.") - } - - saveErr := form.config.Dao.RunInTransaction(func(txDao *daos.Dao) error { - if user == nil { - user = &models.User{} - user.Verified = true - user.Email = authData.Email - user.SetPassword(security.RandomString(30)) - - // create the new user - if err := txDao.SaveUser(user); err != nil { - return err - } - } else { - // update the existing user empty email if the authData has one - // (this in case previously the user was created with - // an OAuth2 provider that didn't return an email address) - if user.Email == "" && authData.Email != "" { - user.Email = authData.Email - if err := txDao.SaveUser(user); err != nil { - return err - } - } - - // update the existing user verified state - // (only if the user doesn't have an email or the user email match with the one in authData) - if !user.Verified && (user.Email == "" || user.Email == authData.Email) { - user.Verified = true - if err := txDao.SaveUser(user); err != nil { - return err - } - } - } - - // create ExternalAuth relation if missing - if rel == nil { - rel = &models.ExternalAuth{ - UserId: user.Id, - Provider: form.Provider, - ProviderId: authData.Id, - } - if err := txDao.SaveExternalAuth(rel); err != nil { - return err - } - } - - return nil - }) - - if saveErr != nil { - return nil, authData, saveErr - } - - return user, authData, nil -} diff --git a/forms/user_password_reset_confirm.go b/forms/user_password_reset_confirm.go deleted file mode 100644 index ab9680e03..000000000 --- a/forms/user_password_reset_confirm.go +++ /dev/null @@ -1,108 +0,0 @@ -package forms - -import ( - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/daos" - "github.com/pocketbase/pocketbase/forms/validators" - "github.com/pocketbase/pocketbase/models" -) - -// UserPasswordResetConfirm specifies a user password reset confirmation form. -type UserPasswordResetConfirm struct { - config UserPasswordResetConfirmConfig - - Token string `form:"token" json:"token"` - Password string `form:"password" json:"password"` - PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"` -} - -// UserPasswordResetConfirmConfig is the [UserPasswordResetConfirm] -// factory initializer config. -// -// NB! App is required struct member. -type UserPasswordResetConfirmConfig struct { - App core.App - Dao *daos.Dao -} - -// NewUserPasswordResetConfirm creates a new [UserPasswordResetConfirm] -// form with initializer config created from the provided [core.App] instance. -// -// If you want to submit the form as part of another transaction, use -// [NewUserPasswordResetConfirmWithConfig] with explicitly set Dao. -func NewUserPasswordResetConfirm(app core.App) *UserPasswordResetConfirm { - return NewUserPasswordResetConfirmWithConfig(UserPasswordResetConfirmConfig{ - App: app, - }) -} - -// NewUserPasswordResetConfirmWithConfig creates a new [UserPasswordResetConfirm] -// form with the provided config or panics on invalid configuration. -func NewUserPasswordResetConfirmWithConfig(config UserPasswordResetConfirmConfig) *UserPasswordResetConfirm { - form := &UserPasswordResetConfirm{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - - return form -} - -// Validate makes the form validatable by implementing [validation.Validatable] interface. -func (form *UserPasswordResetConfirm) Validate() error { - minPasswordLength := form.config.App.Settings().EmailAuth.MinPasswordLength - - return validation.ValidateStruct(form, - validation.Field(&form.Token, validation.Required, validation.By(form.checkToken)), - validation.Field(&form.Password, validation.Required, validation.Length(minPasswordLength, 100)), - validation.Field(&form.PasswordConfirm, validation.Required, validation.By(validators.Compare(form.Password))), - ) -} - -func (form *UserPasswordResetConfirm) checkToken(value any) error { - v, _ := value.(string) - if v == "" { - return nil // nothing to check - } - - user, err := form.config.Dao.FindUserByToken( - v, - form.config.App.Settings().UserPasswordResetToken.Secret, - ) - if err != nil || user == nil { - return validation.NewError("validation_invalid_token", "Invalid or expired token.") - } - - return nil -} - -// Submit validates and submits the form. -// On success returns the updated user model associated to `form.Token`. -func (form *UserPasswordResetConfirm) Submit() (*models.User, error) { - if err := form.Validate(); err != nil { - return nil, err - } - - user, err := form.config.Dao.FindUserByToken( - form.Token, - form.config.App.Settings().UserPasswordResetToken.Secret, - ) - if err != nil { - return nil, err - } - - if err := user.SetPassword(form.Password); err != nil { - return nil, err - } - - if err := form.config.Dao.SaveUser(user); err != nil { - return nil, err - } - - return user, nil -} diff --git a/forms/user_password_reset_confirm_test.go b/forms/user_password_reset_confirm_test.go deleted file mode 100644 index f9437a3a6..000000000 --- a/forms/user_password_reset_confirm_test.go +++ /dev/null @@ -1,175 +0,0 @@ -package forms_test - -import ( - "encoding/json" - "testing" - - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/pocketbase/pocketbase/forms" - "github.com/pocketbase/pocketbase/tests" - "github.com/pocketbase/pocketbase/tools/security" -) - -func TestUserPasswordResetConfirmPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserPasswordResetConfirm(nil) -} - -func TestUserPasswordResetConfirmValidate(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - jsonData string - expectedErrors []string - }{ - // empty data - { - `{}`, - []string{"token", "password", "passwordConfirm"}, - }, - // empty fields - { - `{"token":"","password":"","passwordConfirm":""}`, - []string{"token", "password", "passwordConfirm"}, - }, - // invalid password length - { - `{"token":"invalid","password":"1234","passwordConfirm":"1234"}`, - []string{"token", "password"}, - }, - // mismatched passwords - { - `{"token":"invalid","password":"12345678","passwordConfirm":"87654321"}`, - []string{"token", "passwordConfirm"}, - }, - // invalid JWT token - { - `{"token":"invalid","password":"12345678","passwordConfirm":"12345678"}`, - []string{"token"}, - }, - // expired token - { - `{ - "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxNjQwOTkxNjYxfQ.cSUFKWLAKEvulWV4fqPD6RRtkZYoyat_Tb8lrA2xqtw", - "password":"12345678", - "passwordConfirm":"12345678" - }`, - []string{"token"}, - }, - // valid data - { - `{ - "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxODkzNDUyNDYxfQ.YfpL4VOdsYh2gS30VIiPShgwwqPgt2CySD8TuuB1XD4", - "password":"12345678", - "passwordConfirm":"12345678" - }`, - []string{}, - }, - } - - for i, s := range scenarios { - form := forms.NewUserPasswordResetConfirm(app) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - // parse errors - result := form.Validate() - errs, ok := result.(validation.Errors) - if !ok && result != nil { - t.Errorf("(%d) Failed to parse errors %v", i, result) - continue - } - - // check errors - if len(errs) > len(s.expectedErrors) { - t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) - } - for _, k := range s.expectedErrors { - if _, ok := errs[k]; !ok { - t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) - } - } - } -} - -func TestUserPasswordResetConfirmSubmit(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - jsonData string - expectError bool - }{ - // empty data (Validate call check) - { - `{}`, - true, - }, - // expired token - { - `{ - "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxNjQwOTkxNjYxfQ.cSUFKWLAKEvulWV4fqPD6RRtkZYoyat_Tb8lrA2xqtw", - "password":"12345678", - "passwordConfirm":"12345678" - }`, - true, - }, - // valid data - { - `{ - "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxODkzNDUyNDYxfQ.YfpL4VOdsYh2gS30VIiPShgwwqPgt2CySD8TuuB1XD4", - "password":"12345678", - "passwordConfirm":"12345678" - }`, - false, - }, - } - - for i, s := range scenarios { - form := forms.NewUserPasswordResetConfirm(app) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - user, err := form.Submit() - - hasErr := err != nil - if hasErr != s.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err) - } - - if s.expectError { - continue - } - - claims, _ := security.ParseUnverifiedJWT(form.Token) - tokenUserId := claims["id"] - - if user.Id != tokenUserId { - t.Errorf("(%d) Expected user with id %s, got %v", i, tokenUserId, user) - } - - if !user.LastResetSentAt.IsZero() { - t.Errorf("(%d) Expected user.LastResetSentAt to be empty, got %v", i, user.LastResetSentAt) - } - - if !user.ValidatePassword(form.Password) { - t.Errorf("(%d) Expected the user password to have been updated to %q", i, form.Password) - } - } -} diff --git a/forms/user_password_reset_request.go b/forms/user_password_reset_request.go deleted file mode 100644 index b5c6e4915..000000000 --- a/forms/user_password_reset_request.go +++ /dev/null @@ -1,100 +0,0 @@ -package forms - -import ( - "errors" - "time" - - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/go-ozzo/ozzo-validation/v4/is" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/daos" - "github.com/pocketbase/pocketbase/mails" - "github.com/pocketbase/pocketbase/tools/types" -) - -// UserPasswordResetRequest specifies a user password reset request form. -type UserPasswordResetRequest struct { - config UserPasswordResetRequestConfig - - Email string `form:"email" json:"email"` -} - -// UserPasswordResetRequestConfig is the [UserPasswordResetRequest] -// factory initializer config. -// -// NB! App is required struct member. -type UserPasswordResetRequestConfig struct { - App core.App - Dao *daos.Dao - ResendThreshold float64 // in seconds -} - -// NewUserPasswordResetRequest creates a new [UserPasswordResetRequest] -// form with initializer config created from the provided [core.App] instance. -// -// If you want to submit the form as part of another transaction, use -// [NewUserPasswordResetRequestWithConfig] with explicitly set Dao. -func NewUserPasswordResetRequest(app core.App) *UserPasswordResetRequest { - return NewUserPasswordResetRequestWithConfig(UserPasswordResetRequestConfig{ - App: app, - ResendThreshold: 120, // 2 min - }) -} - -// NewUserPasswordResetRequestWithConfig creates a new [UserPasswordResetRequest] -// form with the provided config or panics on invalid configuration. -func NewUserPasswordResetRequestWithConfig(config UserPasswordResetRequestConfig) *UserPasswordResetRequest { - form := &UserPasswordResetRequest{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - - return form -} - -// Validate makes the form validatable by implementing [validation.Validatable] interface. -// -// This method doesn't checks whether user with `form.Email` exists (this is done on Submit). -func (form *UserPasswordResetRequest) Validate() error { - return validation.ValidateStruct(form, - validation.Field( - &form.Email, - validation.Required, - validation.Length(1, 255), - is.EmailFormat, - ), - ) -} - -// Submit validates and submits the form. -// On success sends a password reset email to the `form.Email` user. -func (form *UserPasswordResetRequest) Submit() error { - if err := form.Validate(); err != nil { - return err - } - - user, err := form.config.Dao.FindUserByEmail(form.Email) - if err != nil { - return err - } - - now := time.Now().UTC() - lastResetSentAt := user.LastResetSentAt.Time() - if now.Sub(lastResetSentAt).Seconds() < form.config.ResendThreshold { - return errors.New("You've already requested a password reset.") - } - - if err := mails.SendUserPasswordReset(form.config.App, user); err != nil { - return err - } - - // update last sent timestamp - user.LastResetSentAt = types.NowDateTime() - - return form.config.Dao.SaveUser(user) -} diff --git a/forms/user_upsert.go b/forms/user_upsert.go deleted file mode 100644 index f6bf5c483..000000000 --- a/forms/user_upsert.go +++ /dev/null @@ -1,165 +0,0 @@ -package forms - -import ( - "strings" - - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/go-ozzo/ozzo-validation/v4/is" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/daos" - "github.com/pocketbase/pocketbase/forms/validators" - "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tools/list" - "github.com/pocketbase/pocketbase/tools/types" -) - -// UserUpsert specifies a [models.User] upsert (create/update) form. -type UserUpsert struct { - config UserUpsertConfig - user *models.User - - Id string `form:"id" json:"id"` - Email string `form:"email" json:"email"` - Password string `form:"password" json:"password"` - PasswordConfirm string `form:"passwordConfirm" json:"passwordConfirm"` -} - -// UserUpsertConfig is the [UserUpsert] factory initializer config. -// -// NB! App is required struct member. -type UserUpsertConfig struct { - App core.App - Dao *daos.Dao -} - -// NewUserUpsert creates a new [UserUpsert] form with initializer -// config created from the provided [core.App] instance -// (for create you could pass a pointer to an empty User - `&models.User{}`). -// -// If you want to submit the form as part of another transaction, use -// [NewUserEmailChangeConfirmWithConfig] with explicitly set Dao. -func NewUserUpsert(app core.App, user *models.User) *UserUpsert { - return NewUserUpsertWithConfig(UserUpsertConfig{ - App: app, - }, user) -} - -// NewUserUpsertWithConfig creates a new [UserUpsert] form with the provided -// config and [models.User] instance or panics on invalid configuration -// (for create you could pass a pointer to an empty User - `&models.User{}`). -func NewUserUpsertWithConfig(config UserUpsertConfig, user *models.User) *UserUpsert { - form := &UserUpsert{ - config: config, - user: user, - } - - if form.config.App == nil || form.user == nil { - panic("Invalid initializer config or nil upsert model.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - - // load defaults - form.Id = user.Id - form.Email = user.Email - - return form -} - -// Validate makes the form validatable by implementing [validation.Validatable] interface. -func (form *UserUpsert) Validate() error { - return validation.ValidateStruct(form, - validation.Field( - &form.Id, - validation.When( - form.user.IsNew(), - validation.Length(models.DefaultIdLength, models.DefaultIdLength), - validation.Match(idRegex), - ).Else(validation.In(form.user.Id)), - ), - validation.Field( - &form.Email, - validation.Required, - validation.Length(1, 255), - is.EmailFormat, - validation.By(form.checkEmailDomain), - validation.By(form.checkUniqueEmail), - ), - validation.Field( - &form.Password, - validation.When(form.user.IsNew(), validation.Required), - validation.Length(form.config.App.Settings().EmailAuth.MinPasswordLength, 100), - ), - validation.Field( - &form.PasswordConfirm, - validation.When(form.user.IsNew() || form.Password != "", validation.Required), - validation.By(validators.Compare(form.Password)), - ), - ) -} - -func (form *UserUpsert) checkUniqueEmail(value any) error { - v, _ := value.(string) - - if v == "" || form.config.Dao.IsUserEmailUnique(v, form.user.Id) { - return nil - } - - return validation.NewError("validation_user_email_exists", "User email already exists.") -} - -func (form *UserUpsert) checkEmailDomain(value any) error { - val, _ := value.(string) - if val == "" { - return nil // nothing to check - } - - domain := val[strings.LastIndex(val, "@")+1:] - only := form.config.App.Settings().EmailAuth.OnlyDomains - except := form.config.App.Settings().EmailAuth.ExceptDomains - - // only domains check - if len(only) > 0 && !list.ExistInSlice(domain, only) { - return validation.NewError("validation_email_domain_not_allowed", "Email domain is not allowed.") - } - - // except domains check - if len(except) > 0 && list.ExistInSlice(domain, except) { - return validation.NewError("validation_email_domain_not_allowed", "Email domain is not allowed.") - } - - return nil -} - -// Submit validates the form and upserts the form user model. -// -// You can optionally provide a list of InterceptorFunc to further -// modify the form behavior before persisting it. -func (form *UserUpsert) Submit(interceptors ...InterceptorFunc) error { - if err := form.Validate(); err != nil { - return err - } - - if form.Password != "" { - form.user.SetPassword(form.Password) - } - - // custom insertion id can be set only on create - if form.user.IsNew() && form.Id != "" { - form.user.MarkAsNew() - form.user.SetId(form.Id) - } - - if !form.user.IsNew() && form.Email != form.user.Email { - form.user.Verified = false - form.user.LastVerificationSentAt = types.DateTime{} // reset - } - - form.user.Email = form.Email - - return runInterceptors(func() error { - return form.config.Dao.SaveUser(form.user) - }, interceptors...) -} diff --git a/forms/user_upsert_test.go b/forms/user_upsert_test.go deleted file mode 100644 index e1ae14874..000000000 --- a/forms/user_upsert_test.go +++ /dev/null @@ -1,432 +0,0 @@ -package forms_test - -import ( - "encoding/json" - "errors" - "fmt" - "testing" - - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/pocketbase/pocketbase/forms" - "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tests" -) - -func TestUserUpsertPanic1(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserUpsert(nil, nil) -} - -func TestUserUpsertPanic2(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserUpsert(app, nil) -} - -func TestNewUserUpsert(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - user := &models.User{} - user.Email = "new@example.com" - - form := forms.NewUserUpsert(app, user) - - // check defaults loading - if form.Email != user.Email { - t.Fatalf("Expected email %q, got %q", user.Email, form.Email) - } -} - -func TestUserUpsertValidate(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - // mock app constraints - app.Settings().EmailAuth.MinPasswordLength = 5 - app.Settings().EmailAuth.ExceptDomains = []string{"test.com"} - app.Settings().EmailAuth.OnlyDomains = []string{"example.com", "test.com"} - - scenarios := []struct { - id string - jsonData string - expectedErrors []string - }{ - // empty data - create - { - "", - `{}`, - []string{"email", "password", "passwordConfirm"}, - }, - // empty data - update - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{}`, - []string{}, - }, - // invalid email address - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"email":"invalid"}`, - []string{"email"}, - }, - // unique email constraint check (same email, aka. no changes) - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"email":"test@example.com"}`, - []string{}, - }, - // unique email constraint check (existing email) - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"email":"test2@something.com"}`, - []string{"email"}, - }, - // unique email constraint check (new email) - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"email":"new@example.com"}`, - []string{}, - }, - // EmailAuth.OnlyDomains constraints check - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"email":"test@something.com"}`, - []string{"email"}, - }, - // EmailAuth.ExceptDomains constraints check - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"email":"test@test.com"}`, - []string{"email"}, - }, - // password length constraint check - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"password":"1234", "passwordConfirm": "1234"}`, - []string{"password"}, - }, - // passwords mismatch - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"password":"12345", "passwordConfirm": "54321"}`, - []string{"passwordConfirm"}, - }, - // valid data - all fields - { - "", - `{"email":"new@example.com","password":"12345","passwordConfirm":"12345"}`, - []string{}, - }, - } - - for i, s := range scenarios { - user := &models.User{} - if s.id != "" { - user, _ = app.Dao().FindUserById(s.id) - } - - form := forms.NewUserUpsert(app, user) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - // parse errors - result := form.Validate() - errs, ok := result.(validation.Errors) - if !ok && result != nil { - t.Errorf("(%d) Failed to parse errors %v", i, result) - continue - } - - // check errors - if len(errs) > len(s.expectedErrors) { - t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) - } - for _, k := range s.expectedErrors { - if _, ok := errs[k]; !ok { - t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) - } - } - } -} - -func TestUserUpsertSubmit(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - id string - jsonData string - expectError bool - }{ - // empty fields - create (Validate call check) - { - "", - `{}`, - true, - }, - // empty fields - update (Validate call check) - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{}`, - false, - }, - // updating with existing user email - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"email":"test2@example.com"}`, - true, - }, - // updating with nonexisting user email - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"email":"update_new@example.com"}`, - false, - }, - // changing password - { - "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - `{"password":"123456789","passwordConfirm":"123456789"}`, - false, - }, - // creating user (existing email) - { - "", - `{"email":"test3@example.com","password":"123456789","passwordConfirm":"123456789"}`, - true, - }, - // creating user (new email) - { - "", - `{"email":"create_new@example.com","password":"123456789","passwordConfirm":"123456789"}`, - false, - }, - } - - for i, s := range scenarios { - user := &models.User{} - originalUser := &models.User{} - if s.id != "" { - user, _ = app.Dao().FindUserById(s.id) - originalUser, _ = app.Dao().FindUserById(s.id) - } - - form := forms.NewUserUpsert(app, user) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - interceptorCalls := 0 - - err := form.Submit(func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc { - return func() error { - interceptorCalls++ - return next() - } - }) - - hasErr := err != nil - if hasErr != s.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err) - } - - expectInterceptorCall := 1 - if s.expectError { - expectInterceptorCall = 0 - } - if interceptorCalls != expectInterceptorCall { - t.Errorf("(%d) Expected interceptor to be called %d, got %d", i, expectInterceptorCall, interceptorCalls) - } - - if s.expectError { - continue - } - - if user.Email != form.Email { - t.Errorf("(%d) Expected email %q, got %q", i, form.Email, user.Email) - } - - // on email change Verified should reset - if user.Email != originalUser.Email && user.Verified { - t.Errorf("(%d) Expected Verified to be false, got true", i) - } - - if form.Password != "" && !user.ValidatePassword(form.Password) { - t.Errorf("(%d) Expected password to be updated to %q", i, form.Password) - } - if form.Password != "" && originalUser.TokenKey == user.TokenKey { - t.Errorf("(%d) Expected TokenKey to change, got %q", i, user.TokenKey) - } - } -} - -func TestUserUpsertSubmitInterceptors(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - user := &models.User{} - form := forms.NewUserUpsert(app, user) - form.Email = "test_new@example.com" - form.Password = "1234567890" - form.PasswordConfirm = form.Password - - testErr := errors.New("test_error") - interceptorUserEmail := "" - - interceptor1Called := false - interceptor1 := func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc { - return func() error { - interceptor1Called = true - return next() - } - } - - interceptor2Called := false - interceptor2 := func(next forms.InterceptorNextFunc) forms.InterceptorNextFunc { - return func() error { - interceptorUserEmail = user.Email // to check if the record was filled - interceptor2Called = true - return testErr - } - } - - err := form.Submit(interceptor1, interceptor2) - if err != testErr { - t.Fatalf("Expected error %v, got %v", testErr, err) - } - - if !interceptor1Called { - t.Fatalf("Expected interceptor1 to be called") - } - - if !interceptor2Called { - t.Fatalf("Expected interceptor2 to be called") - } - - if interceptorUserEmail != form.Email { - t.Fatalf("Expected the form model to be filled before calling the interceptors") - } -} - -func TestUserUpsertWithCustomId(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - existingUser, err := app.Dao().FindUserByEmail("test@example.com") - if err != nil { - t.Fatal(err) - } - - scenarios := []struct { - name string - jsonData string - collection *models.User - expectError bool - }{ - { - "empty data", - "{}", - &models.User{}, - false, - }, - { - "empty id", - `{"id":""}`, - &models.User{}, - false, - }, - { - "id < 15 chars", - `{"id":"a23"}`, - &models.User{}, - true, - }, - { - "id > 15 chars", - `{"id":"a234567890123456"}`, - &models.User{}, - true, - }, - { - "id = 15 chars (invalid chars)", - `{"id":"a@3456789012345"}`, - &models.User{}, - true, - }, - { - "id = 15 chars (valid chars)", - `{"id":"a23456789012345"}`, - &models.User{}, - false, - }, - { - "changing the id of an existing item", - `{"id":"b23456789012345"}`, - existingUser, - true, - }, - { - "using the same existing item id", - `{"id":"` + existingUser.Id + `"}`, - existingUser, - false, - }, - { - "skipping the id for existing item", - `{}`, - existingUser, - false, - }, - } - - for i, scenario := range scenarios { - form := forms.NewUserUpsert(app, scenario.collection) - if form.Email == "" { - form.Email = fmt.Sprintf("test_id_%d@example.com", i) - } - form.Password = "1234567890" - form.PasswordConfirm = form.Password - - // load data - loadErr := json.Unmarshal([]byte(scenario.jsonData), form) - if loadErr != nil { - t.Errorf("[%s] Failed to load form data: %v", scenario.name, loadErr) - continue - } - - submitErr := form.Submit() - hasErr := submitErr != nil - - if hasErr != scenario.expectError { - t.Errorf("[%s] Expected hasErr to be %v, got %v (%v)", scenario.name, scenario.expectError, hasErr, submitErr) - } - - if !hasErr && form.Id != "" { - _, err := app.Dao().FindUserById(form.Id) - if err != nil { - t.Errorf("[%s] Expected to find record with id %s, got %v", scenario.name, form.Id, err) - } - } - } -} diff --git a/forms/user_verification_confirm.go b/forms/user_verification_confirm.go deleted file mode 100644 index ff0dcb920..000000000 --- a/forms/user_verification_confirm.go +++ /dev/null @@ -1,103 +0,0 @@ -package forms - -import ( - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/daos" - "github.com/pocketbase/pocketbase/models" -) - -// UserVerificationConfirm specifies a user email verification confirmation form. -type UserVerificationConfirm struct { - config UserVerificationConfirmConfig - - Token string `form:"token" json:"token"` -} - -// UserVerificationConfirmConfig is the [UserVerificationConfirm] -// factory initializer config. -// -// NB! App is required struct member. -type UserVerificationConfirmConfig struct { - App core.App - Dao *daos.Dao -} - -// NewUserVerificationConfirm creates a new [UserVerificationConfirm] -// form with initializer config created from the provided [core.App] instance. -// -// If you want to submit the form as part of another transaction, use -// [NewUserVerificationConfirmWithConfig] with explicitly set Dao. -func NewUserVerificationConfirm(app core.App) *UserVerificationConfirm { - return NewUserVerificationConfirmWithConfig(UserVerificationConfirmConfig{ - App: app, - }) -} - -// NewUserVerificationConfirmWithConfig creates a new [UserVerificationConfirmConfig] -// form with the provided config or panics on invalid configuration. -func NewUserVerificationConfirmWithConfig(config UserVerificationConfirmConfig) *UserVerificationConfirm { - form := &UserVerificationConfirm{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - - return form -} - -// Validate makes the form validatable by implementing [validation.Validatable] interface. -func (form *UserVerificationConfirm) Validate() error { - return validation.ValidateStruct(form, - validation.Field(&form.Token, validation.Required, validation.By(form.checkToken)), - ) -} - -func (form *UserVerificationConfirm) checkToken(value any) error { - v, _ := value.(string) - if v == "" { - return nil // nothing to check - } - - user, err := form.config.Dao.FindUserByToken( - v, - form.config.App.Settings().UserVerificationToken.Secret, - ) - if err != nil || user == nil { - return validation.NewError("validation_invalid_token", "Invalid or expired token.") - } - - return nil -} - -// Submit validates and submits the form. -// On success returns the verified user model associated to `form.Token`. -func (form *UserVerificationConfirm) Submit() (*models.User, error) { - if err := form.Validate(); err != nil { - return nil, err - } - - user, err := form.config.Dao.FindUserByToken( - form.Token, - form.config.App.Settings().UserVerificationToken.Secret, - ) - if err != nil { - return nil, err - } - - if user.Verified { - return user, nil // already verified - } - - user.Verified = true - - if err := form.config.Dao.SaveUser(user); err != nil { - return nil, err - } - - return user, nil -} diff --git a/forms/user_verification_confirm_test.go b/forms/user_verification_confirm_test.go deleted file mode 100644 index cff5c68ed..000000000 --- a/forms/user_verification_confirm_test.go +++ /dev/null @@ -1,150 +0,0 @@ -package forms_test - -import ( - "encoding/json" - "testing" - - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/pocketbase/pocketbase/forms" - "github.com/pocketbase/pocketbase/tests" - "github.com/pocketbase/pocketbase/tools/security" -) - -func TestUserVerificationConfirmPanic(t *testing.T) { - defer func() { - if recover() == nil { - t.Fatal("The form did not panic") - } - }() - - forms.NewUserVerificationConfirm(nil) -} - -func TestUserVerificationConfirmValidate(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - jsonData string - expectedErrors []string - }{ - // empty data - { - `{}`, - []string{"token"}, - }, - // empty fields - { - `{"token":""}`, - []string{"token"}, - }, - // invalid JWT token - { - `{"token":"invalid"}`, - []string{"token"}, - }, - // expired token - { - `{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxNjQwOTkxNjYxfQ.6KBn19eFa9aFAZ6hvuhQtK7Ovxb6QlBQ97vJtulb_P8"}`, - []string{"token"}, - }, - // valid token - { - `{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxOTA2MTA2NDIxfQ.yvH96FwtPHGvzhFSKl8Tsi1FnGytKpMrvb7K9F2_zQA"}`, - []string{}, - }, - } - - for i, s := range scenarios { - form := forms.NewUserVerificationConfirm(app) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - // parse errors - result := form.Validate() - errs, ok := result.(validation.Errors) - if !ok && result != nil { - t.Errorf("(%d) Failed to parse errors %v", i, result) - continue - } - - // check errors - if len(errs) > len(s.expectedErrors) { - t.Errorf("(%d) Expected error keys %v, got %v", i, s.expectedErrors, errs) - } - for _, k := range s.expectedErrors { - if _, ok := errs[k]; !ok { - t.Errorf("(%d) Missing expected error key %q in %v", i, k, errs) - } - } - } -} - -func TestUserVerificationConfirmSubmit(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - scenarios := []struct { - jsonData string - expectError bool - }{ - // empty data (Validate call check) - { - `{}`, - true, - }, - // expired token (Validate call check) - { - `{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxNjQwOTkxNjYxfQ.6KBn19eFa9aFAZ6hvuhQtK7Ovxb6QlBQ97vJtulb_P8"}`, - true, - }, - // valid token (already verified user) - { - `{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjRkMDE5N2NjLTJiNGEtM2Y4My1hMjZiLWQ3N2JjODQyM2QzYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0QGV4YW1wbGUuY29tIiwiZXhwIjoxOTA2MTA2NDIxfQ.yvH96FwtPHGvzhFSKl8Tsi1FnGytKpMrvb7K9F2_zQA"}`, - false, - }, - // valid token (unverified user) - { - `{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjdiYzg0ZDI3LTZiYTItYjQyYS0zODNmLTQxOTdjYzNkM2QwYyIsInR5cGUiOiJ1c2VyIiwiZW1haWwiOiJ0ZXN0MkBleGFtcGxlLmNvbSIsImV4cCI6MTkwNjEwNjQyMX0.KbSucLGasQqTkGxUgqaaCjKNOHJ3ZVkL1WTzSApc6oM"}`, - false, - }, - } - - for i, s := range scenarios { - form := forms.NewUserVerificationConfirm(app) - - // load data - loadErr := json.Unmarshal([]byte(s.jsonData), form) - if loadErr != nil { - t.Errorf("(%d) Failed to load form data: %v", i, loadErr) - continue - } - - user, err := form.Submit() - - hasErr := err != nil - if hasErr != s.expectError { - t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err) - } - - if s.expectError { - continue - } - - claims, _ := security.ParseUnverifiedJWT(form.Token) - tokenUserId := claims["id"] - - if user.Id != tokenUserId { - t.Errorf("(%d) Expected user.Id %q, got %q", i, tokenUserId, user.Id) - } - - if !user.Verified { - t.Errorf("(%d) Expected user.Verified to be true, got false", i) - } - } -} diff --git a/forms/user_verification_request.go b/forms/user_verification_request.go deleted file mode 100644 index 76a3aaa95..000000000 --- a/forms/user_verification_request.go +++ /dev/null @@ -1,104 +0,0 @@ -package forms - -import ( - "errors" - "time" - - validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/go-ozzo/ozzo-validation/v4/is" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/daos" - "github.com/pocketbase/pocketbase/mails" - "github.com/pocketbase/pocketbase/tools/types" -) - -// UserVerificationRequest defines a user email verification request form. -type UserVerificationRequest struct { - config UserVerificationRequestConfig - - Email string `form:"email" json:"email"` -} - -// UserVerificationRequestConfig is the [UserVerificationRequest] -// factory initializer config. -// -// NB! App is required struct member. -type UserVerificationRequestConfig struct { - App core.App - Dao *daos.Dao - ResendThreshold float64 // in seconds -} - -// NewUserVerificationRequest creates a new [UserVerificationRequest] -// form with initializer config created from the provided [core.App] instance. -// -// If you want to submit the form as part of another transaction, use -// [NewUserVerificationRequestWithConfig] with explicitly set Dao. -func NewUserVerificationRequest(app core.App) *UserVerificationRequest { - return NewUserVerificationRequestWithConfig(UserVerificationRequestConfig{ - App: app, - ResendThreshold: 120, // 2 min - }) -} - -// NewUserVerificationRequestWithConfig creates a new [UserVerificationRequest] -// form with the provided config or panics on invalid configuration. -func NewUserVerificationRequestWithConfig(config UserVerificationRequestConfig) *UserVerificationRequest { - form := &UserVerificationRequest{config: config} - - if form.config.App == nil { - panic("Missing required config.App instance.") - } - - if form.config.Dao == nil { - form.config.Dao = form.config.App.Dao() - } - - return form -} - -// Validate makes the form validatable by implementing [validation.Validatable] interface. -// -// // This method doesn't verify that user with `form.Email` exists (this is done on Submit). -func (form *UserVerificationRequest) Validate() error { - return validation.ValidateStruct(form, - validation.Field( - &form.Email, - validation.Required, - validation.Length(1, 255), - is.EmailFormat, - ), - ) -} - -// Submit validates and sends a verification request email -// to the `form.Email` user. -func (form *UserVerificationRequest) Submit() error { - if err := form.Validate(); err != nil { - return err - } - - user, err := form.config.Dao.FindUserByEmail(form.Email) - if err != nil { - return err - } - - if user.Verified { - return nil // already verified - } - - now := time.Now().UTC() - lastVerificationSentAt := user.LastVerificationSentAt.Time() - if (now.Sub(lastVerificationSentAt)).Seconds() < form.config.ResendThreshold { - return errors.New("A verification email was already sent.") - } - - if err := mails.SendUserVerification(form.config.App, user); err != nil { - return err - } - - // update last sent timestamp - user.LastVerificationSentAt = types.NowDateTime() - - return form.config.Dao.SaveUser(user) -} diff --git a/forms/validators/file.go b/forms/validators/file.go index 05473198b..c1fbdca4e 100644 --- a/forms/validators/file.go +++ b/forms/validators/file.go @@ -1,7 +1,6 @@ package validators import ( - "encoding/binary" "fmt" "strings" @@ -22,7 +21,7 @@ func UploadedFileSize(maxBytes int) validation.RuleFunc { return nil // nothing to validate } - if binary.Size(v.Bytes()) > maxBytes { + if int(v.Header().Size) > maxBytes { return validation.NewError("validation_file_size_limit", fmt.Sprintf("Maximum allowed file size is %v bytes.", maxBytes)) } @@ -47,7 +46,16 @@ func UploadedFileMimeType(validTypes []string) validation.RuleFunc { return validation.NewError("validation_invalid_mime_type", "Unsupported file type.") } - filetype := mimetype.Detect(v.Bytes()) + f, err := v.Header().Open() + if err != nil { + return validation.NewError("validation_invalid_mime_type", "Unsupported file type.") + } + defer f.Close() + + filetype, err := mimetype.DetectReader(f) + if err != nil { + return validation.NewError("validation_invalid_mime_type", "Unsupported file type.") + } for _, t := range validTypes { if filetype.Is(t) { diff --git a/forms/validators/record_data.go b/forms/validators/record_data.go index a5f09f95c..106b0404f 100644 --- a/forms/validators/record_data.go +++ b/forms/validators/record_data.go @@ -28,7 +28,7 @@ var requiredErr = validation.NewError("validation_required", "Missing required v func NewRecordDataValidator( dao *daos.Dao, record *models.Record, - uploadedFiles []*rest.UploadedFile, + uploadedFiles map[string][]*rest.UploadedFile, ) *RecordDataValidator { return &RecordDataValidator{ dao: dao, @@ -42,7 +42,7 @@ func NewRecordDataValidator( type RecordDataValidator struct { dao *daos.Dao record *models.Record - uploadedFiles []*rest.UploadedFile + uploadedFiles map[string][]*rest.UploadedFile } // Validate validates the provided `data` by checking it against @@ -88,7 +88,7 @@ func (validator *RecordDataValidator) Validate(data map[string]any) error { // check unique constraint if field.Unique && !validator.dao.IsRecordValueUnique( - validator.record.Collection(), + validator.record.Collection().Id, key, value, validator.record.GetId(), @@ -127,8 +127,6 @@ func (validator *RecordDataValidator) checkFieldValue(field *schema.SchemaField, return validator.checkFileValue(field, value) case schema.FieldTypeRelation: return validator.checkRelationValue(field, value) - case schema.FieldTypeUser: - return validator.checkUserValue(field, value) } return nil @@ -316,8 +314,8 @@ func (validator *RecordDataValidator) checkFileValue(field *schema.SchemaField, } // extract the uploaded files - files := make([]*rest.UploadedFile, 0, len(validator.uploadedFiles)) - for _, file := range validator.uploadedFiles { + files := make([]*rest.UploadedFile, 0, len(validator.uploadedFiles[field.Name])) + for _, file := range validator.uploadedFiles[field.Name] { if list.ExistInSlice(file.Name(), names) { files = append(files, file) } @@ -351,8 +349,8 @@ func (validator *RecordDataValidator) checkRelationValue(field *schema.SchemaFie options, _ := field.Options.(*schema.RelationOptions) - if len(ids) > options.MaxSelect { - return validation.NewError("validation_too_many_values", fmt.Sprintf("Select no more than %d", options.MaxSelect)) + if options.MaxSelect != nil && len(ids) > *options.MaxSelect { + return validation.NewError("validation_too_many_values", fmt.Sprintf("Select no more than %d", *options.MaxSelect)) } // check if the related records exist @@ -374,31 +372,3 @@ func (validator *RecordDataValidator) checkRelationValue(field *schema.SchemaFie return nil } - -func (validator *RecordDataValidator) checkUserValue(field *schema.SchemaField, value any) error { - ids := list.ToUniqueStringSlice(value) - if len(ids) == 0 { - if field.Required { - return requiredErr - } - return nil // nothing to check - } - - options, _ := field.Options.(*schema.UserOptions) - - if len(ids) > options.MaxSelect { - return validation.NewError("validation_too_many_values", fmt.Sprintf("Select no more than %d", options.MaxSelect)) - } - - // check if the related users exist - var total int - validator.dao.UserQuery(). - Select("count(*)"). - AndWhere(dbx.In("id", list.ToInterfaceSlice(ids)...)). - Row(&total) - if total != len(ids) { - return validation.NewError("validation_missing_users", "Failed to fetch all users with the provided ids") - } - - return nil -} diff --git a/forms/validators/record_data_test.go b/forms/validators/record_data_test.go index 3af5d5f44..a3d552a7e 100644 --- a/forms/validators/record_data_test.go +++ b/forms/validators/record_data_test.go @@ -20,7 +20,7 @@ import ( type testDataFieldScenario struct { name string data map[string]any - files []*rest.UploadedFile + files map[string][]*rest.UploadedFile expectedErrors []string } @@ -28,7 +28,7 @@ func TestRecordDataValidatorEmptyAndUnknown(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, _ := app.Dao().FindCollectionByNameOrId("demo") + collection, _ := app.Dao().FindCollectionByNameOrId("demo2") record := models.NewRecord(collection) validator := validators.NewRecordDataValidator(app.Dao(), record, nil) @@ -80,9 +80,9 @@ func TestRecordDataValidatorValidateText(t *testing.T) { // create dummy record (used for the unique check) dummy := models.NewRecord(collection) - dummy.SetDataValue("field1", "test") - dummy.SetDataValue("field2", "test") - dummy.SetDataValue("field3", "test") + dummy.Set("field1", "test") + dummy.Set("field2", "test") + dummy.Set("field3", "test") if err := app.Dao().SaveRecord(dummy); err != nil { t.Fatal(err) } @@ -196,9 +196,9 @@ func TestRecordDataValidatorValidateNumber(t *testing.T) { // create dummy record (used for the unique check) dummy := models.NewRecord(collection) - dummy.SetDataValue("field1", 123) - dummy.SetDataValue("field2", 123) - dummy.SetDataValue("field3", 123) + dummy.Set("field1", 123) + dummy.Set("field2", 123) + dummy.Set("field3", 123) if err := app.Dao().SaveRecord(dummy); err != nil { t.Fatal(err) } @@ -307,9 +307,9 @@ func TestRecordDataValidatorValidateBool(t *testing.T) { // create dummy record (used for the unique check) dummy := models.NewRecord(collection) - dummy.SetDataValue("field1", false) - dummy.SetDataValue("field2", true) - dummy.SetDataValue("field3", true) + dummy.Set("field1", false) + dummy.Set("field2", true) + dummy.Set("field3", true) if err := app.Dao().SaveRecord(dummy); err != nil { t.Fatal(err) } @@ -403,9 +403,9 @@ func TestRecordDataValidatorValidateEmail(t *testing.T) { // create dummy record (used for the unique check) dummy := models.NewRecord(collection) - dummy.SetDataValue("field1", "test@demo.com") - dummy.SetDataValue("field2", "test@test.com") - dummy.SetDataValue("field3", "test@example.com") + dummy.Set("field1", "test@demo.com") + dummy.Set("field2", "test@test.com") + dummy.Set("field3", "test@example.com") if err := app.Dao().SaveRecord(dummy); err != nil { t.Fatal(err) } @@ -519,9 +519,9 @@ func TestRecordDataValidatorValidateUrl(t *testing.T) { // create dummy record (used for the unique check) dummy := models.NewRecord(collection) - dummy.SetDataValue("field1", "http://demo.com") - dummy.SetDataValue("field2", "http://test.com") - dummy.SetDataValue("field3", "http://example.com") + dummy.Set("field1", "http://demo.com") + dummy.Set("field2", "http://test.com") + dummy.Set("field3", "http://example.com") if err := app.Dao().SaveRecord(dummy); err != nil { t.Fatal(err) } @@ -647,9 +647,9 @@ func TestRecordDataValidatorValidateDate(t *testing.T) { // create dummy record (used for the unique check) dummy := models.NewRecord(collection) - dummy.SetDataValue("field1", "2022-01-01 01:01:01") - dummy.SetDataValue("field2", "2029-01-01 01:01:01.123") - dummy.SetDataValue("field3", "2029-01-01 01:01:01.123") + dummy.Set("field1", "2022-01-01 01:01:01") + dummy.Set("field2", "2029-01-01 01:01:01.123") + dummy.Set("field3", "2029-01-01 01:01:01.123") if err := app.Dao().SaveRecord(dummy); err != nil { t.Fatal(err) } @@ -779,9 +779,9 @@ func TestRecordDataValidatorValidateSelect(t *testing.T) { // create dummy record (used for the unique check) dummy := models.NewRecord(collection) - dummy.SetDataValue("field1", "a") - dummy.SetDataValue("field2", []string{"a", "b"}) - dummy.SetDataValue("field3", []string{"a", "b", "c"}) + dummy.Set("field1", "a") + dummy.Set("field2", []string{"a", "b"}) + dummy.Set("field3", []string{"a", "b", "c"}) if err := app.Dao().SaveRecord(dummy); err != nil { t.Fatal(err) } @@ -909,9 +909,9 @@ func TestRecordDataValidatorValidateJson(t *testing.T) { // create dummy record (used for the unique check) dummy := models.NewRecord(collection) - dummy.SetDataValue("field1", `{"test":123}`) - dummy.SetDataValue("field2", `{"test":123}`) - dummy.SetDataValue("field3", `{"test":123}`) + dummy.Set("field1", `{"test":123}`) + dummy.Set("field2", `{"test":123}`) + dummy.Set("field3", `{"test":123}`) if err := app.Dao().SaveRecord(dummy); err != nil { t.Fatal(err) } @@ -1080,7 +1080,9 @@ func TestRecordDataValidatorValidateFile(t *testing.T) { "field2": []string{"test1", testFiles[0].Name(), testFiles[3].Name()}, "field3": []string{"test1", "test2", "test3", "test4"}, }, - []*rest.UploadedFile{testFiles[0], testFiles[1], testFiles[2]}, + map[string][]*rest.UploadedFile{ + "field2": {testFiles[0], testFiles[3]}, + }, []string{"field2", "field3"}, }, { @@ -1090,7 +1092,10 @@ func TestRecordDataValidatorValidateFile(t *testing.T) { "field2": []string{"test1", testFiles[0].Name()}, "field3": []string{"test1", "test2", "test3"}, }, - []*rest.UploadedFile{testFiles[0], testFiles[1], testFiles[2]}, + map[string][]*rest.UploadedFile{ + "field1": {testFiles[0]}, + "field2": {testFiles[0]}, + }, []string{"field1"}, }, { @@ -1100,7 +1105,10 @@ func TestRecordDataValidatorValidateFile(t *testing.T) { "field2": []string{"test1", testFiles[0].Name()}, "field3": []string{testFiles[1].Name(), testFiles[2].Name()}, }, - []*rest.UploadedFile{testFiles[0], testFiles[1], testFiles[2]}, + map[string][]*rest.UploadedFile{ + "field2": {testFiles[0], testFiles[1], testFiles[2]}, + "field3": {testFiles[1], testFiles[2]}, + }, []string{"field3"}, }, { @@ -1120,7 +1128,9 @@ func TestRecordDataValidatorValidateFile(t *testing.T) { "field2": []string{testFiles[0].Name(), testFiles[1].Name()}, "field3": nil, }, - []*rest.UploadedFile{testFiles[0], testFiles[1], testFiles[2]}, + map[string][]*rest.UploadedFile{ + "field2": {testFiles[0], testFiles[1]}, + }, []string{}, }, { @@ -1130,7 +1140,9 @@ func TestRecordDataValidatorValidateFile(t *testing.T) { "field2": []string{"test1", testFiles[0].Name()}, "field3": "test1", // will be casted }, - []*rest.UploadedFile{testFiles[0], testFiles[1], testFiles[2]}, + map[string][]*rest.UploadedFile{ + "field2": {testFiles[0], testFiles[1], testFiles[2]}, + }, []string{}, }, } @@ -1142,17 +1154,17 @@ func TestRecordDataValidatorValidateRelation(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - demo, _ := app.Dao().FindCollectionByNameOrId("demo4") + demo, _ := app.Dao().FindCollectionByNameOrId("demo3") - // demo4 rel ids - relId1 := "b8ba58f9-e2d7-42a0-b0e7-a11efd98236b" - relId2 := "df55c8ff-45ef-4c82-8aed-6e2183fe1125" - relId3 := "b84cd893-7119-43c9-8505-3c4e22da28a9" - relId4 := "054f9f24-0a0a-4e09-87b1-bc7ff2b336a2" + // demo3 rel ids + relId1 := "mk5fmymtx4wsprk" + relId2 := "7nwo8tuiatetxdm" + relId3 := "lcl9d87w22ml6jy" + relId4 := "1tmknxy2868d869" // record rel ids from different collections - diffRelId1 := "63c2ab80-84ab-4057-a592-4604a731f78f" - diffRelId2 := "2c542824-9de1-42fe-8924-e57c86267760" + diffRelId1 := "0yxhwia2amd8gec" + diffRelId2 := "llvuca81nly1qls" // create new test collection collection := &models.Collection{} @@ -1162,7 +1174,7 @@ func TestRecordDataValidatorValidateRelation(t *testing.T) { Name: "field1", Type: schema.FieldTypeRelation, Options: &schema.RelationOptions{ - MaxSelect: 1, + MaxSelect: types.Pointer(1), CollectionId: demo.Id, }, }, @@ -1171,7 +1183,7 @@ func TestRecordDataValidatorValidateRelation(t *testing.T) { Required: true, Type: schema.FieldTypeRelation, Options: &schema.RelationOptions{ - MaxSelect: 2, + MaxSelect: types.Pointer(2), CollectionId: demo.Id, }, }, @@ -1180,7 +1192,6 @@ func TestRecordDataValidatorValidateRelation(t *testing.T) { Unique: true, Type: schema.FieldTypeRelation, Options: &schema.RelationOptions{ - MaxSelect: 3, CollectionId: demo.Id, }, }, @@ -1188,7 +1199,7 @@ func TestRecordDataValidatorValidateRelation(t *testing.T) { Name: "field4", Type: schema.FieldTypeRelation, Options: &schema.RelationOptions{ - MaxSelect: 3, + MaxSelect: types.Pointer(3), CollectionId: "", // missing or non-existing collection id }, }, @@ -1199,9 +1210,9 @@ func TestRecordDataValidatorValidateRelation(t *testing.T) { // create dummy record (used for the unique check) dummy := models.NewRecord(collection) - dummy.SetDataValue("field1", relId1) - dummy.SetDataValue("field2", []string{relId1, relId2}) - dummy.SetDataValue("field3", []string{relId1, relId2, relId3}) + dummy.Set("field1", relId1) + dummy.Set("field2", []string{relId1, relId2}) + dummy.Set("field3", []string{relId1, relId2, relId3}) if err := app.Dao().SaveRecord(dummy); err != nil { t.Fatal(err) } @@ -1254,7 +1265,7 @@ func TestRecordDataValidatorValidateRelation(t *testing.T) { "field3": []string{relId1, relId2, relId3, relId4}, }, nil, - []string{"field2", "field3"}, + []string{"field2"}, }, { "check with ids from different collections", @@ -1289,130 +1300,6 @@ func TestRecordDataValidatorValidateRelation(t *testing.T) { checkValidatorErrors(t, app.Dao(), models.NewRecord(collection), scenarios) } -func TestRecordDataValidatorValidateUser(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - userId1 := "97cc3d3d-6ba2-383f-b42a-7bc84d27410c" - userId2 := "7bc84d27-6ba2-b42a-383f-4197cc3d3d0c" - userId3 := "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c" - missingUserId := "00000000-84ab-4057-a592-4604a731f78f" - - // create new test collection - collection := &models.Collection{} - collection.Name = "validate_test" - collection.Schema = schema.NewSchema( - &schema.SchemaField{ - Name: "field1", - Type: schema.FieldTypeUser, - Options: &schema.UserOptions{ - MaxSelect: 1, - }, - }, - &schema.SchemaField{ - Name: "field2", - Required: true, - Type: schema.FieldTypeUser, - Options: &schema.UserOptions{ - MaxSelect: 2, - }, - }, - &schema.SchemaField{ - Name: "field3", - Unique: true, - Type: schema.FieldTypeUser, - Options: &schema.UserOptions{ - MaxSelect: 3, - }, - }, - ) - if err := app.Dao().SaveCollection(collection); err != nil { - t.Fatal(err) - } - - // create dummy record (used for the unique check) - dummy := models.NewRecord(collection) - dummy.SetDataValue("field1", userId1) - dummy.SetDataValue("field2", []string{userId1, userId2}) - dummy.SetDataValue("field3", []string{userId1, userId2, userId3}) - if err := app.Dao().SaveRecord(dummy); err != nil { - t.Fatal(err) - } - - scenarios := []testDataFieldScenario{ - { - "check required constraint - nil", - map[string]any{ - "field1": nil, - "field2": nil, - "field3": nil, - }, - nil, - []string{"field2"}, - }, - { - "check required constraint - zero id", - map[string]any{ - "field1": "", - "field2": "", - "field3": "", - }, - nil, - []string{"field2"}, - }, - { - "check unique constraint", - map[string]any{ - "field1": nil, - "field2": userId1, - "field3": []string{userId1, userId2, userId3, userId3}, // repeating values are collapsed - }, - nil, - []string{"field3"}, - }, - { - "check MaxSelect constraint", - map[string]any{ - "field1": []string{userId1, userId2}, // maxSelect is 1 and will be normalized to userId1 only - "field2": []string{userId1, userId2, userId3}, - "field3": []string{userId1, userId3, userId2}, - }, - nil, - []string{"field2"}, - }, - { - "check with mixed existing and nonexisting user ids", - map[string]any{ - "field1": missingUserId, - "field2": []string{missingUserId, userId1}, - "field3": []string{userId1, missingUserId}, - }, - nil, - []string{"field1", "field2", "field3"}, - }, - { - "valid data - only required fields", - map[string]any{ - "field2": []string{userId1, userId2}, - }, - nil, - []string{}, - }, - { - "valid data - all fields with normalization", - map[string]any{ - "field1": []string{userId1, userId2}, - "field2": userId2, - "field3": []string{userId3, userId2, userId1}, // unique is not triggered because the order is different - }, - nil, - []string{}, - }, - } - - checkValidatorErrors(t, app.Dao(), models.NewRecord(collection), scenarios) -} - func checkValidatorErrors(t *testing.T, dao *daos.Dao, record *models.Record, scenarios []testDataFieldScenario) { for i, s := range scenarios { validator := validators.NewRecordDataValidator(dao, record, s.files) diff --git a/go.mod b/go.mod index dcec85d20..ac8ca6eae 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/AlecAivazis/survey/v2 v2.3.6 - github.com/aws/aws-sdk-go v1.44.102 + github.com/aws/aws-sdk-go v1.44.126 github.com/disintegration/imaging v1.6.2 github.com/domodwyer/mailyak/v3 v3.3.4 github.com/fatih/color v1.13.0 @@ -13,71 +13,71 @@ require ( github.com/go-ozzo/ozzo-validation/v4 v4.3.0 github.com/golang-jwt/jwt/v4 v4.4.2 github.com/labstack/echo/v5 v5.0.0-20220201181537-ed2888cfa198 - github.com/mattn/go-sqlite3 v1.14.15 - github.com/pocketbase/dbx v1.6.0 + github.com/mattn/go-sqlite3 v1.14.16 + github.com/pocketbase/dbx v1.7.0 github.com/spf13/cast v1.5.0 - github.com/spf13/cobra v1.5.0 - gocloud.dev v0.26.0 - golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0 - golang.org/x/net v0.0.0-20220921155015-db77216a4ee9 - golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 - modernc.org/sqlite v1.19.1 + github.com/spf13/cobra v1.6.1 + gocloud.dev v0.27.0 + golang.org/x/crypto v0.1.0 + golang.org/x/net v0.1.0 + golang.org/x/oauth2 v0.1.0 + modernc.org/sqlite v1.19.3 ) require ( github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect - github.com/aws/aws-sdk-go-v2 v1.16.16 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.8 // indirect - github.com/aws/aws-sdk-go-v2/config v1.17.7 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.12.20 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.17 // indirect - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.33 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.24 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.14 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.9 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.18 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.17 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.17 // indirect - github.com/aws/aws-sdk-go-v2/service/s3 v1.27.11 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.11.23 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.5 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.16.19 // indirect - github.com/aws/smithy-go v1.13.3 // indirect + github.com/aws/aws-sdk-go-v2 v1.17.1 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.9 // indirect + github.com/aws/aws-sdk-go-v2/config v1.17.10 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.12.23 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.37 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.16 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.10 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.20 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.19 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.29.1 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.11.25 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.17.1 // indirect + github.com/aws/smithy-go v1.13.4 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/uuid v1.3.0 // indirect github.com/google/wire v0.5.0 // indirect - github.com/googleapis/gax-go/v2 v2.5.1 // indirect + github.com/googleapis/gax-go/v2 v2.6.0 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect - github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasttemplate v1.2.1 // indirect + github.com/valyala/fasttemplate v1.2.2 // indirect go.opencensus.io v0.23.0 // indirect - golang.org/x/image v0.0.0-20220902085622-e7cb96979f69 // indirect - golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/term v0.0.0-20220919170432-7a66f970e087 // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/time v0.0.0-20220920022843-2ce7c2934d45 // indirect - golang.org/x/tools v0.1.12 // indirect + golang.org/x/image v0.1.0 // indirect + golang.org/x/mod v0.6.0 // indirect + golang.org/x/sys v0.1.0 // indirect + golang.org/x/term v0.1.0 // indirect + golang.org/x/text v0.4.0 // indirect + golang.org/x/time v0.1.0 // indirect + golang.org/x/tools v0.2.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.96.0 // indirect + google.golang.org/api v0.101.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006 // indirect - google.golang.org/grpc v1.49.0 // indirect + google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect + google.golang.org/grpc v1.50.1 // indirect google.golang.org/protobuf v1.28.1 // indirect lukechampine.com/uint128 v1.2.0 // indirect - modernc.org/cc/v3 v3.39.0 // indirect - modernc.org/ccgo/v3 v3.16.9 // indirect - modernc.org/libc v1.19.0 // indirect + modernc.org/cc/v3 v3.40.0 // indirect + modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8 // indirect + modernc.org/libc v1.21.4 // indirect modernc.org/mathutil v1.5.0 // indirect modernc.org/memory v1.4.0 // indirect modernc.org/opt v0.1.3 // indirect diff --git a/go.sum b/go.sum index 38301dab1..ab307b5e9 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= +bazil.org/fuse v0.0.0-20200407214033-5883e5a4b512/go.mod h1:FbcW6z/2VytnFDhZfumh8Ss8zxHE6qpMP5sHTRe0EaM= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -29,8 +31,10 @@ cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Ud cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go v0.100.1/go.mod h1:fs4QogzfH5n2pBXBP9vRiU+eCny7lD2vmFZy79Iuw1U= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= -cloud.google.com/go v0.102.0 h1:DAq3r8y4mDgyB/ZPJ9v/5VJNqjgJAxTn6ZYLlUywOu8= cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= +cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= +cloud.google.com/go v0.103.0/go.mod h1:vwLx1nqLrzLX/fpwSMOXmFIqBOyHsvHbnAdbGSJ+mKk= +cloud.google.com/go v0.105.0 h1:DNtEKRBAAzeS4KyIory52wWHuClNaXJ5x1F7xa4q+5Y= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -38,200 +42,282 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= -cloud.google.com/go/compute v1.2.0/go.mod h1:xlogom/6gr8RJGBe7nT2eGsQYAFUbbv8dbC29qE3Xmw= cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= -cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9Uk= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= +cloud.google.com/go/compute v1.10.0 h1:aoLIYaA1fX3ywihqpBk2APQKOo20nXsp1GEZQbx5Jk4= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/iam v0.1.0/go.mod h1:vcUNEa0pEm0qRVpmWepWaFMIAI8/hjB9mO8rNCJtF6c= -cloud.google.com/go/iam v0.1.1/go.mod h1:CKqrcnI/suGpybEHxZ7BMehL0oA4LpdyJdUlTl9jVMw= -cloud.google.com/go/iam v0.3.0 h1:exkAomrVUuzx9kWFI1wm3KI0uoDeUFPB4kKGzx6x+Gc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= -cloud.google.com/go/kms v1.1.0/go.mod h1:WdbppnCDMDpOvoYBMn1+gNmOeEoZYqAv+HeuKARGCXI= +cloud.google.com/go/iam v0.6.0 h1:nsqQC88kT5Iwlm4MeNGTpfMWddp6NB/UOLFTH6m1QfQ= cloud.google.com/go/kms v1.4.0/go.mod h1:fajBHndQ+6ubNw6Ss2sSd+SWvjL26RNo/dr7uxsnnOA= +cloud.google.com/go/longrunning v0.1.1 h1:y50CXG4j0+qvEukslYFBCrzaXX0qpFbBzc3PchSu/LE= cloud.google.com/go/monitoring v1.1.0/go.mod h1:L81pzz7HKn14QCMaCs6NTQkdBnE87TElyanS95vIcl4= -cloud.google.com/go/monitoring v1.4.0/go.mod h1:y6xnxfwI3hTFWOdkOaD7nfJVlwuC3/mS/5kvtT131p4= +cloud.google.com/go/monitoring v1.5.0/go.mod h1:/o9y8NYX5j91JjD/JvGLYbi86kL11OjyJXq2XziLJu4= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/pubsub v1.19.0/go.mod h1:/O9kmSe9bb9KRnIAWkzmqhPjHo6LtzGOBYd/kr06XSs= -cloud.google.com/go/secretmanager v1.3.0/go.mod h1:+oLTkouyiYiabAQNugCeTS3PAArGiMJuBqvJnJsyH+U= +cloud.google.com/go/pubsub v1.24.0/go.mod h1:rWv09Te1SsRpRGPiWOMDKraMQTJyJps4MkUCoMGUgqw= +cloud.google.com/go/secretmanager v1.5.0/go.mod h1:5C9kM+RwSpkURNovKySkNvGQLUaOgyoR5W0RUx2SyHQ= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.21.0/go.mod h1:XmRlxkgPjlBONznT2dDUU/5XlpU2OjMnKuqnZI01LAA= -cloud.google.com/go/storage v1.22.1 h1:F6IlQJZrZM++apn9V5/VfS3gbTUYg98PS3EMQAzqtfg= cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= +cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= +cloud.google.com/go/storage v1.24.0 h1:a4N0gIkx83uoVFGz8B2eAV3OhN90QoWF5OZWLKl39ig= +cloud.google.com/go/storage v1.24.0/go.mod h1:3xrJEFMXBsQLgxwThyjuD3aYlroL0TMRec1ypGUQ0KE= cloud.google.com/go/trace v1.0.0/go.mod h1:4iErSByzxkyHWzzlAj63/Gmjz0NH1ASqhJguHpGcr6A= cloud.google.com/go/trace v1.2.0/go.mod h1:Wc8y/uYyOhPy12KEnXG9XGrvfMz5F5SrYecQlbW1rwM= +code.cloudfoundry.org/clock v0.0.0-20180518195852-02e53af36e6c/go.mod h1:QD9Lzhd/ux6eNQVUDVRJX/RKTigpewimNYBi7ivZKY8= contrib.go.opencensus.io/exporter/aws v0.0.0-20200617204711-c478e41e60e9/go.mod h1:uu1P0UCM/6RbsMrgPa98ll8ZcHM858i/AD06a9aLRCA= -contrib.go.opencensus.io/exporter/stackdriver v0.13.10/go.mod h1:I5htMbyta491eUxufwwZPQdcKvvgzMB4O9ni41YnIM8= +contrib.go.opencensus.io/exporter/stackdriver v0.13.13/go.mod h1:5pSSGY0Bhuk7waTHuDf4aQ8D2DrhgETRo9fy6k3Xlzc= contrib.go.opencensus.io/integrations/ocsql v0.1.7/go.mod h1:8DsSdjz3F+APR+0z0WkU1aRorQCFfRxvqjUUPMbF3fE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/AlecAivazis/survey/v2 v2.3.5 h1:A8cYupsAZkjaUmhtTYv3sSqc7LO5mp1XDfqe5E/9wRQ= -github.com/AlecAivazis/survey/v2 v2.3.5/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20210715213245-6c3934b029d8/go.mod h1:CzsSbkDixRphAF5hS6wbMKq0eI6ccJRb7/A0M6JBnwg= github.com/AlecAivazis/survey/v2 v2.3.6 h1:NvTuVHISgTHEHeBFqt6BHOe4Ny/NwGZr7w+F8S9ziyw= github.com/AlecAivazis/survey/v2 v2.3.6/go.mod h1:4AuI9b7RjAR+G7v9+C4YSlX/YL3K3cWNXgWXOhllqvI= -github.com/Azure/azure-amqp-common-go/v3 v3.2.1/go.mod h1:O6X1iYHP7s2x7NjUKsXVhkwWrQhxrd+d8/3rRadj4CI= -github.com/Azure/azure-amqp-common-go/v3 v3.2.2/go.mod h1:O6X1iYHP7s2x7NjUKsXVhkwWrQhxrd+d8/3rRadj4CI= -github.com/Azure/azure-pipeline-go v0.2.3 h1:7U9HBg1JFK3jHl5qmo4CTZKFTVgMwdFHMVtCdfBE21U= -github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k= -github.com/Azure/azure-sdk-for-go v51.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v59.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-amqp-common-go/v3 v3.2.3/go.mod h1:7rPmbSfszeovxGfc5fSAXE4ehlXQZHpMja2OtxC2Tas= +github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v63.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v65.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v66.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.1/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= -github.com/Azure/azure-service-bus-go v0.11.5/go.mod h1:MI6ge2CuQWBVq+ly456MY7XqNLJip5LO1iSFodbNLbU= -github.com/Azure/azure-storage-blob-go v0.14.0 h1:1BCg74AmVdYwO3dlKwtFU1V0wU2PZdREkXvAmZJRUlM= -github.com/Azure/azure-storage-blob-go v0.14.0/go.mod h1:SMqIBi+SuiQH32bvyjngEewEeXoPfKMgWlBDaYf6fck= -github.com/Azure/go-amqp v0.16.0/go.mod h1:9YJ3RhxRT1gquYnzpZO1vcYMMpAdJT+QEg6fwmw9Zlg= -github.com/Azure/go-amqp v0.16.4/go.mod h1:9YJ3RhxRT1gquYnzpZO1vcYMMpAdJT+QEg6fwmw9Zlg= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus v1.0.2/go.mod h1:LH9XQnMr2ZYxQdVdCrzLO9mxeDyrDFa6wbSI3x5zCZk= +github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.4.1/go.mod h1:eZ4g6GUvXiGulfIbbhh1Xr4XwUYaYaWMqzGD/284wCA= +github.com/Azure/go-amqp v0.17.0/go.mod h1:9YJ3RhxRT1gquYnzpZO1vcYMMpAdJT+QEg6fwmw9Zlg= +github.com/Azure/go-amqp v0.17.5/go.mod h1:9YJ3RhxRT1gquYnzpZO1vcYMMpAdJT+QEg6fwmw9Zlg= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20210608223527-2377c96fe795/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw= github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= -github.com/Azure/go-autorest/autorest v0.11.19/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA= -github.com/Azure/go-autorest/autorest v0.11.22/go.mod h1:BAWYUWGPEtKPzjVkp0Q6an0MJcJDsoh5Z1BFAEFs4Xs= +github.com/Azure/go-autorest/autorest v0.11.24/go.mod h1:G6kyRlFnTuSbEYkQGawPfsCswgme4iYf6rfSKUDzbCc= +github.com/Azure/go-autorest/autorest v0.11.25/go.mod h1:7l8ybrIdUmGqZMTD0sRtAr8NvbHjfofbf8RSP2q7w7U= +github.com/Azure/go-autorest/autorest v0.11.27/go.mod h1:7l8ybrIdUmGqZMTD0sRtAr8NvbHjfofbf8RSP2q7w7U= +github.com/Azure/go-autorest/autorest v0.11.28/go.mod h1:MrkzG3Y3AH668QyF9KRk5neJnGgmhQ6krbhR8Q5eMvA= +github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg= github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= -github.com/Azure/go-autorest/autorest/adal v0.9.14/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M= -github.com/Azure/go-autorest/autorest/adal v0.9.17/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ= -github.com/Azure/go-autorest/autorest/azure/auth v0.5.9/go.mod h1:hg3/1yw0Bq87O3KvvnJoAh34/0zbP7SFizX/qN5JvjU= -github.com/Azure/go-autorest/autorest/azure/cli v0.4.2/go.mod h1:7qkJkT+j6b+hIpzMOwPChJhTqS8VbsqqgULzMNRugoM= +github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ= +github.com/Azure/go-autorest/autorest/adal v0.9.20/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ= +github.com/Azure/go-autorest/autorest/adal v0.9.21/go.mod h1:zua7mBUaCc5YnSLKYgGJR/w5ePdMDA6H56upLsHzA9U= +github.com/Azure/go-autorest/autorest/azure/auth v0.5.11/go.mod h1:84w/uV8E37feW2NCJ08uT9VBfjfUHpgLVnG2InYD6cg= +github.com/Azure/go-autorest/autorest/azure/cli v0.4.5/go.mod h1:ADQAXrkgm7acgWVUNamOgh8YNrv4p27l3Wc55oVfpzg= +github.com/Azure/go-autorest/autorest/azure/cli v0.4.6/go.mod h1:piCfgPho7BiIDdEQ1+g4VmKyD5y+p/XtSNqE6Hc4QD0= github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74= +github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= +github.com/Azure/go-autorest/autorest/mocks v0.4.2/go.mod h1:Vy7OitM9Kei0i1Oj+LvyAWMXJHeKH1MVlzFugfVrmyU= github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE= github.com/Azure/go-autorest/autorest/validation v0.3.1/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E= +github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/GoogleCloudPlatform/cloudsql-proxy v1.29.0/go.mod h1:spvB9eLJH9dutlbPSRmHvSXXHOwGRyeXh1jVdquA2G8= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/GoogleCloudPlatform/cloudsql-proxy v1.31.2/go.mod h1:qR6jVnZTKDCW3j+fC9mOEPHm++1nKDMkqbbkD6KNsfo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= +github.com/Microsoft/go-winio v0.4.16-0.20201130162521-d1ffc52c7331/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/go-winio v0.4.17-0.20210211115548-6eac466e5fa3/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.4.17-0.20210324224401-5516f17a5958/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.4.17/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= +github.com/Microsoft/hcsshim v0.8.6/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= +github.com/Microsoft/hcsshim v0.8.7-0.20190325164909-8abdbb8205e4/go.mod h1:Op3hHsoHPAvb6lceZHDtd9OkTew38wNoXnJs8iY7rUg= +github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= +github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg38RRsjT5y8= +github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= +github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= +github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= +github.com/Microsoft/hcsshim v0.8.20/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= +github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= +github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= +github.com/Microsoft/hcsshim v0.9.2/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc= +github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= +github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s= github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= +github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.3.3/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= -github.com/aws/aws-sdk-go v1.37.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws/aws-sdk-go v1.43.11/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go v1.43.31/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.44.85 h1:JM2rkKY/GtTDCQXW0StkImbLn6n4Q/Dm2bj+u1rm7Kw= -github.com/aws/aws-sdk-go v1.44.85/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.44.102 h1:6tUCTGL2UDbFZae1TLGk8vTgeXuzkb8KbAe2FiAeKHc= -github.com/aws/aws-sdk-go v1.44.102/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go-v2 v1.16.2/go.mod h1:ytwTPBG6fXTZLxxeeCCWj2/EMYp/xDUgX+OET6TLNNU= -github.com/aws/aws-sdk-go-v2 v1.16.11 h1:xM1ZPSvty3xVmdxiGr7ay/wlqv+MWhH0rMlyLdbC0YQ= -github.com/aws/aws-sdk-go-v2 v1.16.11/go.mod h1:WTACcleLz6VZTp7fak4EO5b9Q4foxbn+8PIz3PmyKlo= -github.com/aws/aws-sdk-go-v2 v1.16.16 h1:M1fj4FE2lB4NzRb9Y0xdWsn2P0+2UHVxwKyOa4YJNjk= -github.com/aws/aws-sdk-go-v2 v1.16.16/go.mod h1:SwiyXi/1zTUZ6KIAmLK5V5ll8SiURNUYOqTerZPaF9k= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.1/go.mod h1:n8Bs1ElDD2wJ9kCRTczA83gYbBmjSwZp3umc6zF4EeM= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.4 h1:zfT11pa7ifu/VlLDpmc5OY2W4nYmnKkFDGeMVnmqAI0= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.4/go.mod h1:ES0I1GBs+YYgcDS1ek47Erbn4TOL811JKqBXtgzqyZ8= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.8 h1:tcFliCWne+zOuUfKNRn8JdFBuWPDuISDH08wD2ULkhk= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.8/go.mod h1:JTnlBSot91steJeti4ryyu/tLd4Sk84O5W22L7O2EQU= -github.com/aws/aws-sdk-go-v2/config v1.15.3/go.mod h1:9YL3v07Xc/ohTsxFXzan9ZpFpdTOFl4X65BAKYaz8jg= -github.com/aws/aws-sdk-go-v2/config v1.17.1 h1:BWxTjokU/69BZ4DnLrZco6OvBDii6ToEdfBL/y5I1nA= -github.com/aws/aws-sdk-go-v2/config v1.17.1/go.mod h1:uOxDHjBemNTF2Zos+fgG0NNfE86wn1OAHDTGxjMEYi0= -github.com/aws/aws-sdk-go-v2/config v1.17.7 h1:odVM52tFHhpqZBKNjVW5h+Zt1tKHbhdTQRb+0WHrNtw= -github.com/aws/aws-sdk-go-v2/config v1.17.7/go.mod h1:dN2gja/QXxFF15hQreyrqYhLBaQo1d9ZKe/v/uplQoI= -github.com/aws/aws-sdk-go-v2/credentials v1.11.2/go.mod h1:j8YsY9TXTm31k4eFhspiQicfXPLZ0gYXA50i4gxPE8g= -github.com/aws/aws-sdk-go-v2/credentials v1.12.14 h1:AtVG/amkjbDBfnPr/tuW2IG18HGNznP6L12Dx0rLz+Q= -github.com/aws/aws-sdk-go-v2/credentials v1.12.14/go.mod h1:opAndTyq+YN7IpVG57z2CeNuXSQMqTYxGGlYH0m0RMY= -github.com/aws/aws-sdk-go-v2/credentials v1.12.20 h1:9+ZhlDY7N9dPnUmf7CDfW9In4sW5Ff3bh7oy4DzS1IE= -github.com/aws/aws-sdk-go-v2/credentials v1.12.20/go.mod h1:UKY5HyIux08bbNA7Blv4PcXQ8cTkGh7ghHMFklaviR4= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.3/go.mod h1:uk1vhHHERfSVCUnqSqz8O48LBYDSC+k6brng09jcMOk= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 h1:wgJBHO58Pc1V1QAnzdVM3JK3WbE/6eUF0JxCZ+/izz0= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12/go.mod h1:aZ4vZnyUuxedC7eD4JyEHpGnCz+O2sHQEx3VvAwklSE= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.17 h1:r08j4sbZu/RVi+BNxkBJwPMUYY3P8mgSDuKkZ/ZN1lE= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.17/go.mod h1:yIkQcCDYNsZfXpd5UX2Cy+sWA1jPgIhGTw9cOBzfVnQ= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.3/go.mod h1:0dHuD2HZZSiwfJSy1FO5bX1hQ1TxVV1QXXjpn3XUE44= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.27 h1:xFXIMBci0UXStoOHq/8w0XIZPB2hgb9CD7uATJhqt10= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.27/go.mod h1:+tj2cHQkChanggNZn1J2fJ1Cv6RO1TV0AA3472do31I= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.33 h1:fAoVmNGhir6BR+RU0/EI+6+D7abM+MCwWf8v4ip5jNI= -github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.33/go.mod h1:84XgODVR8uRhmOnUkKGUZKqIMxmjmLOR8Uyp7G/TPwc= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.9/go.mod h1:AnVH5pvai0pAF4lXRq0bmhbes1u9R8wTE+g+183bZNM= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 h1:OmiwoVyLKEqqD5GvB683dbSqxiOfvx4U2lDZhG2Esc4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18/go.mod h1:348MLhzV1GSlZSMusdwQpXKbhD7X2gbI/TxwAPKkYZQ= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23 h1:s4g/wnzMf+qepSNgTvaQQHNxyMLKSawNhKCPNy++2xY= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23/go.mod h1:2DFxAQ9pfIRy0imBCJv+vZ2X6RKxves6fbnEuSry6b4= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.3/go.mod h1:ssOhaLpRlh88H3UmEcsBoVKq309quMvm3Ds8e9d4eJM= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 h1:5mvQDtNWtI6H56+E4LUnLWEmATMB7oEh+Z9RurtIuC0= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12/go.mod h1:ckaCVTEdGAxO6KwTGzgskxR1xM+iJW4lxMyDFVda2Fc= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17 h1:/K482T5A3623WJgWT8w1yRAFK4RzGzEl7y39yhtn9eA= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17/go.mod h1:pRwaTYCJemADaqCbUAxltMoHKata7hmB5PjEXeu0kfg= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.10/go.mod h1:8DcYQcz0+ZJaSxANlHIsbbi6S+zMwjwdDqwW3r9AzaE= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19 h1:g5qq9sgtEzt2szMaDqQO6fqKe026T6dHTFJp5NsPzkQ= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19/go.mod h1:cVHo8KTuHjShb9V8/VjH3S/8+xPu16qx8fdGwmotJhE= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.24 h1:wj5Rwc05hvUSvKuOF29IYb9QrCLjU+rHAy/x/o0DK2c= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.24/go.mod h1:jULHjqqjDlbyTa7pfM7WICATnOv+iOhjletM3N0Xbu8= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.9 h1:agLpf3vtYX1rtKTrOGpevdP3iC2W0hKDmzmhhxJzL+A= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.9/go.mod h1:cv+n1mdyh+0B8tAtlEBzTYFA2Uv15SISEn6kabYhIgE= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.14 h1:ZSIPAkAsCCjYrhqfw2+lNzWDzxzHXEckFkTePL5RSWQ= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.14/go.mod h1:AyGgqiKv9ECM6IZeNQtdT8NnMvUb3/2wokeq2Fgryto= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.1/go.mod h1:GeUru+8VzrTXV/83XyMJ80KpH8xO89VPoUileyNQ+tc= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.5 h1:g1ITJ9i9ixa+/WVggLNK20KyliAA8ltnuxfZEDfo2hM= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.5/go.mod h1:oehQLbMQkppKLXvpx/1Eo0X47Fe+0971DXC9UjGnKcI= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.9 h1:Lh1AShsuIJTwMkoxVCAYPJgNG5H+eN6SmoUn8nOZ5wE= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.9/go.mod h1:a9j48l6yL5XINLHLcOKInjdvknN+vWqPBxqeIDw7ktw= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.3/go.mod h1:Seb8KNmD6kVTjwRjVEgOT5hPin6sq+v4C2ycJQDwuH8= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.13 h1:3GamN8jcdz/a3nvL/ZVtoH/6xxeshfsiXj5O+6GW4Rg= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.13/go.mod h1:89CSPn69UECDLVn0H6FwKNgbtirksl8C8i3aBeeeihw= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.18 h1:BBYoNQt2kUZUUK4bIPsKrCcjVPUMNsgQpNAwhznK/zo= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.18/go.mod h1:NS55eQ4YixUJPTC+INxi2/jCqe1y2Uw3rnh9wEOVJxY= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.3/go.mod h1:wlY6SVjuwvh3TVRpTqdy4I1JpBFLX4UGeKZdWntaocw= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 h1:7iPTTX4SAI2U2VOogD7/gmHlsgnYSgoNHt7MSQXtG2M= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12/go.mod h1:1TODGhheLWjpQWSuhYuAUWYTCKwEjx2iblIFKDHjeTc= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.17 h1:Jrd/oMh0PKQc6+BowB+pLEwLIgaQF29eYbe7E1Av9Ug= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.17/go.mod h1:4nYOrY41Lrbk2170/BGkcJKBhws9Pfn8MG3aGqjjeFI= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.3/go.mod h1:Bm/v2IaN6rZ+Op7zX+bOUMdL4fsrYZiD0dsjLhNKwZc= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.12 h1:QFjSOmHSb77qRTv7KI9UFon9X5wLWY5/M+6la3dTcZc= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.12/go.mod h1:MADjAN0GHFDuc5lRa5Y5ki+oIO/w7X4qczHy+OUx0IA= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.17 h1:HfVVR1vItaG6le+Bpw6P4midjBDMKnjMyZnw9MXYUcE= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.17/go.mod h1:YqMdV+gEKCQ59NrB7rzrJdALeBIsYiVi8Inj3+KcqHI= -github.com/aws/aws-sdk-go-v2/service/kms v1.16.3/go.mod h1:QuiHPBqlOFCi4LqdSskYYAWpQlx3PKmohy+rE2F+o5g= -github.com/aws/aws-sdk-go-v2/service/s3 v1.26.3/go.mod h1:g1qvDuRsJY+XghsV6zg00Z4KJ7DtFFCx8fJD2a491Ak= -github.com/aws/aws-sdk-go-v2/service/s3 v1.27.5 h1:h9qqTedYnA9JcWjKyLV6UYIMSdp91ExLCUbjbpDLH7A= -github.com/aws/aws-sdk-go-v2/service/s3 v1.27.5/go.mod h1:J8SS5Tp/zeLxaubB0xGfKnVrvssNBNLwTipreTKLhjQ= -github.com/aws/aws-sdk-go-v2/service/s3 v1.27.11 h1:3/gm/JTX9bX8CpzTgIlrtYpB3EVBDxyg/GY/QdcIEZw= -github.com/aws/aws-sdk-go-v2/service/s3 v1.27.11/go.mod h1:fmgDANqTUCxciViKl9hb/zD5LFbvPINFRgWhDbR+vZo= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.4/go.mod h1:PJc8s+lxyU8rrre0/4a0pn2wgwiDvOEzoOjcJUBr67o= -github.com/aws/aws-sdk-go-v2/service/sns v1.17.4/go.mod h1:kElt+uCcXxcqFyc+bQqZPFD9DME/eC6oHBXvFzQ9Bcw= -github.com/aws/aws-sdk-go-v2/service/sqs v1.18.3/go.mod h1:skmQo0UPvsjsuYYSYMVmrPc1HWCbHUJyrCEp+ZaLzqM= -github.com/aws/aws-sdk-go-v2/service/ssm v1.24.1/go.mod h1:NR/xoKjdbRJ+qx0pMR4mI+N/H1I1ynHwXnO6FowXJc0= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.3/go.mod h1:7UQ/e69kU7LDPtY40OyoHYgRmgfGM4mgsLYtcObdveU= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.17 h1:pXxu9u2z1UqSbjO9YA8kmFJBhFc1EVTDaf7A+S+Ivq8= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.17/go.mod h1:mS5xqLZc/6kc06IpXn5vRxdLaED+jEuaSRv5BxtnsiY= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.23 h1:pwvCchFUEnlceKIgPUouBJwK81aCkQ8UDMORfeFtW10= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.23/go.mod h1:/w0eg9IhFGjGyyncHIQrXtU8wvNsTJOP0R6PPj0wf80= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.5 h1:GUnZ62TevLqIoDyHeiWj2P7EqaosgakBKVvWriIdLQY= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.5/go.mod h1:csZuQY65DAdFBt1oIjO5hhBR49kQqop4+lcuCjf2arA= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.3/go.mod h1:bfBj0iVmsUyUg4weDB4NxktD9rDGeKSVWnjTnwbx9b8= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 h1:dl8T0PJlN92rvEGOEUiD0+YPYdPEaCZK0TqHukvSfII= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.13/go.mod h1:Ru3QVMLygVs/07UQ3YDur1AQZZp2tUNje8wfloFttC0= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.19 h1:9pPi0PsFNAGILFfPCk8Y0iyEBGc6lu6OQ97U7hmdesg= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.19/go.mod h1:h4J3oPZQbxLhzGnk+j9dfYHi5qIOVJ5kczZd658/ydM= -github.com/aws/smithy-go v1.11.2/go.mod h1:3xHYmszWVx2c0kIwQeEVf9uSm4fYZt67FBJnwub1bgM= -github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag= -github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/aws/smithy-go v1.13.3 h1:l7LYxGuzK6/K+NzJ2mC+VvLUbae0sL3bXU//04MkmnA= -github.com/aws/smithy-go v1.13.3/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/aws-sdk-go v1.44.45/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go v1.44.68/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go v1.44.126 h1:7HQJw2DNiwpxqMe2H7odGNT2rhO4SRrUe5/8dYXl0Jk= +github.com/aws/aws-sdk-go v1.44.126/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/aws/aws-sdk-go-v2 v1.16.8/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw= +github.com/aws/aws-sdk-go-v2 v1.17.1 h1:02c72fDJr87N8RAC2s3Qu0YuvMRZKNZJ9F+lAehCazk= +github.com/aws/aws-sdk-go-v2 v1.17.1/go.mod h1:JLnGeGONAyi2lWXI1p0PCIOIy333JMVK1U7Hf0aRFLw= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3/go.mod h1:gNsR5CaXKmQSSzrmGxmwmct/r+ZBfbxorAuXYsj/M5Y= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.9 h1:RKci2D7tMwpvGpDNZnGQw9wk6v7o/xSwFcUAuNPoB8k= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.9/go.mod h1:vCmV1q1VK8eoQJ5+aYE7PkK1K6v41qJ5pJdK3ggCDvg= +github.com/aws/aws-sdk-go-v2/config v1.15.15/go.mod h1:A1Lzyy/o21I5/s2FbyX5AevQfSVXpvvIDCoVFD0BC4E= +github.com/aws/aws-sdk-go-v2/config v1.17.10 h1:zBy5QQ/mkvHElM1rygHPAzuH+sl8nsdSaxSWj0+rpdE= +github.com/aws/aws-sdk-go-v2/config v1.17.10/go.mod h1:/4np+UiJJKpWHN7Q+LZvqXYgyjgeXm5+lLfDI6TPZao= +github.com/aws/aws-sdk-go-v2/credentials v1.12.10/go.mod h1:g5eIM5XRs/OzIIK81QMBl+dAuDyoLN0VYaLP+tBqEOk= +github.com/aws/aws-sdk-go-v2/credentials v1.12.23 h1:LctvcJMIb8pxvk5hQhChpCu0WlU6oKQmcYb1HA4IZSA= +github.com/aws/aws-sdk-go-v2/credentials v1.12.23/go.mod h1:0awX9iRr/+UO7OwRQFpV1hNtXxOVuehpjVEzrIAYNcA= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.9/go.mod h1:KDCCm4ONIdHtUloDcFvK2+vshZvx4Zmj7UMDfusuz5s= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19 h1:E3PXZSI3F2bzyj6XxUXdTIfvp425HHhwKsFvmzBwHgs= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19/go.mod h1:VihW95zQpeKQWVPGkwT+2+WJNQV8UXFfMTWdU6VErL8= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.21/go.mod h1:iIYPrQ2rYfZiB/iADYlhj9HHZ9TTi6PqKQPAqygohbE= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.37 h1:e1VtTBo+cLNjres0wTlMkmwCGGRjDEkkrz3frxxcaCs= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.37/go.mod h1:kdAV1UMnCkyG6tZJUC4mHbPoRjPA3dIK0L8mnsHERiM= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.15/go.mod h1:pWrr2OoHlT7M/Pd2y4HV3gJyPb3qj5qMmnPkKSNPYK4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25 h1:nBO/RFxeq/IS5G9Of+ZrgucRciie2qpLy++3UGZ+q2E= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25/go.mod h1:Zb29PYkf42vVYQY6pvSyJCJcFHlPIiY+YKdPtwnvMkY= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.9/go.mod h1:08tUpeSGN33QKSO7fwxXczNfiwCpbj+GxK6XKwqWVv0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19 h1:oRHDrwCTVT8ZXi4sr9Ld+EXk7N/KGssOr2ygNeojEhw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19/go.mod h1:6Q0546uHDp421okhmmGfbxzq2hBqbXFNpi4k+Q1JnQA= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.16/go.mod h1:CYmI+7x03jjJih8kBEEFKRQc40UjUokT0k7GbvrhhTc= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26 h1:Mza+vlnZr+fPKFKRq/lKGVvM6B/8ZZmNdEopOwSQLms= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26/go.mod h1:Y2OJ+P+MC1u1VKnavT+PshiEuGPyh/7DqxoDNij4/bg= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.6/go.mod h1:O7Oc4peGZDEKlddivslfYFvAbgzvl/GH3J8j3JIGBXc= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.16 h1:2EXB7dtGwRYIN3XQ9qwIW504DVbKIw3r89xQnonGdsQ= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.16/go.mod h1:XH+3h395e3WVdd6T2Z3mPxuI+x/HVtdqVOREkTiyubs= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3/go.mod h1:gkb2qADY+OHaGLKNTYxMaQNacfeyQpZ4csDTQMeFmcw= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.10 h1:dpiPHgmFstgkLG07KaYAewvuptq5kvo52xn7tVSrtrQ= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.10/go.mod h1:9cBNUHI2aW4ho0A5T87O294iPDuuUOSIEDjnd1Lq/z0= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.10/go.mod h1:Qks+dxK3O+Z2deAhNo6cJ8ls1bam3tUGUAcgxQP1c70= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.20 h1:KSvtm1+fPXE0swe9GPjc6msyrdTT0LB/BP8eLugL1FI= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.20/go.mod h1:Mp4XI/CkWGD79AQxZ5lIFlgvC0A+gl+4BmyG1F+SfNc= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.9/go.mod h1:yQowTpvdZkFVuHrLBXmczat4W+WJKg/PafBZnGBLga0= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19 h1:GE25AWCdNUPh9AOJzI9KIJnja7IwUc1WyUqz/JTyJ/I= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19/go.mod h1:02CP6iuYP+IVnBX5HULVdSAku/85eHB2Y9EsFhrkEwU= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.9/go.mod h1:Rc5+wn2k8gFSi3V1Ch4mhxOzjMh+bYSXVFfVaqowQOY= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.19 h1:piDBAaWkaxkkVV3xJJbTehXCZRXYs49kvpi/LG6LR2o= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.19/go.mod h1:BmQWRVkLTmyNzYPFAZgon53qKLWBNSvonugD1MrSWUs= +github.com/aws/aws-sdk-go-v2/service/kms v1.18.1/go.mod h1:4PZMUkc9rXHWGVB5J9vKaZy3D7Nai79ORworQ3ASMiM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.27.2/go.mod h1:u+566cosFI+d+motIz3USXEh6sN8Nq4GrNXSg2RXVMo= +github.com/aws/aws-sdk-go-v2/service/s3 v1.29.1 h1:/EMdFPW/Ppieh0WUtQf1+qCGNLdsq5UWUyevBQ6vMVc= +github.com/aws/aws-sdk-go-v2/service/s3 v1.29.1/go.mod h1:/NHbqPRiwxSPVOB2Xr+StDEH+GWV/64WwnUjv4KYzV0= +github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.15.14/go.mod h1:xakbH8KMsQQKqzX87uyyzTHshc/0/Df8bsTneTS5pFU= +github.com/aws/aws-sdk-go-v2/service/sns v1.17.10/go.mod h1:uITsRNVMeCB3MkWpXxXw0eDz8pW4TYLzj+eyQtbhSxM= +github.com/aws/aws-sdk-go-v2/service/sqs v1.19.1/go.mod h1:A94o564Gj+Yn+7QO1eLFeI7UVv3riy/YBFOfICVqFvU= +github.com/aws/aws-sdk-go-v2/service/ssm v1.27.6/go.mod h1:fiFzQgj4xNOg4/wqmAiPvzgDMXPD+cUEplX/CYn+0j0= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.13/go.mod h1:d7ptRksDDgvXaUvxyHZ9SYh+iMDymm94JbVcgvSYSzU= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.25 h1:GFZitO48N/7EsFDt8fMa5iYdmWqkUDDB3Eje6z3kbG0= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.25/go.mod h1:IARHuzTXmj1C0KS35vboR0FeJ89OkEy1M9mWbK2ifCI= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8 h1:jcw6kKZrtNfBPJkaHrscDOZoe5gvi9wjudnxvozYFJo= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8/go.mod h1:er2JHN+kBY6FcMfcBBKNGCT3CarImmdFzishsqBmSRI= +github.com/aws/aws-sdk-go-v2/service/sts v1.16.10/go.mod h1:cftkHYN6tCDNfkSasAmclSfl4l7cySoay8vz7p/ce0E= +github.com/aws/aws-sdk-go-v2/service/sts v1.17.1 h1:KRAix/KHvjGODaHAMXnxRk9t0D+4IJVUuS/uwXxngXk= +github.com/aws/aws-sdk-go-v2/service/sts v1.17.1/go.mod h1:bXcN3koeVYiJcdDU89n3kCYILob7Y34AeLopUbZgLT4= +github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/smithy-go v1.13.4 h1:/RN2z1txIJWeXeOkzX+Hk/4Uuvv7dWtCjbmVJcrskyk= +github.com/aws/smithy-go v1.13.4/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= +github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= +github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= +github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= +github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= +github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= +github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= +github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmEg9bt0VpxxWqJlO4iwu3FBdHUzV7wQVg= +github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= +github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= +github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -242,28 +328,192 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= +github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= +github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= +github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU= +github.com/containerd/aufs v0.0.0-20210316121734-20793ff83c97/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= +github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= +github.com/containerd/btrfs v0.0.0-20201111183144-404b9149801e/go.mod h1:jg2QkJcsabfHugurUvvPhS3E08Oxiuh5W/g1ybB4e0E= +github.com/containerd/btrfs v0.0.0-20210316141732-918d888fb676/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= +github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= +github.com/containerd/cgroups v0.0.0-20190717030353-c4b9ac5c7601/go.mod h1:X9rLEHIqSf/wfK8NsPqxJmeZgW4pcfzdXITDrUSJ6uI= +github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= +github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM= +github.com/containerd/cgroups v0.0.0-20200710171044-318312a37340/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= +github.com/containerd/cgroups v0.0.0-20200824123100-0b889c03f102/go.mod h1:s5q4SojHctfxANBDvMeIaIovkq29IP48TKAxnhYRxvo= +github.com/containerd/cgroups v0.0.0-20210114181951-8a68de567b68/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= +github.com/containerd/cgroups v1.0.1/go.mod h1:0SJrPIenamHDcZhEcJMNBB85rHcUsw4f25ZfBiPYRkU= +github.com/containerd/cgroups v1.0.3/go.mod h1:/ofk34relqNjSGyqPrmEULrO4Sc8LJhvJmWbUCUKqj8= +github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= +github.com/containerd/console v0.0.0-20181022165439-0650fd9eeb50/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= +github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= +github.com/containerd/console v1.0.1/go.mod h1:XUsP6YE/mKtz6bxc+I8UiKKTP04qjQL4qcS3XoQ5xkw= +github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= +github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= +github.com/containerd/containerd v1.2.10/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.1-0.20191213020239-082f7e3aed57/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.0-beta.2.0.20200729163537-40b22ef07410/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.9/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7V960Tmcumvqn8Mc+pCYQ= +github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= +github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= +github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= +github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= +github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= +github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= +github.com/containerd/containerd v1.6.1/go.mod h1:1nJz5xCZPusx6jJU8Frfct988y0NpumIq9ODB0kLtoE= +github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cECdGN1O8G9bgKTlLhuPJimka6Xb/Gg7vYzCTNVxhvo= +github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y= +github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= +github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= +github.com/containerd/continuity v0.2.2/go.mod h1:pWygW9u7LtS1o4N/Tn0FoCFDIXZ7rxcMX7HX1Dmibvk= +github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= +github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= +github.com/containerd/fifo v0.0.0-20200410184934-f15a3290365b/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= +github.com/containerd/fifo v0.0.0-20201026212402-0724c46b320c/go.mod h1:jPQ2IAeZRCYxpS/Cm1495vGFww6ecHmMk1YJH2Q5ln0= +github.com/containerd/fifo v0.0.0-20210316144830-115abcc95a1d/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= +github.com/containerd/fifo v1.0.0/go.mod h1:ocF/ME1SX5b1AOlWi9r677YJmCPSwwWnQ9O123vzpE4= +github.com/containerd/go-cni v1.0.1/go.mod h1:+vUpYxKvAF72G9i1WoDOiPGRtQpqsNW/ZHtSlv++smU= +github.com/containerd/go-cni v1.0.2/go.mod h1:nrNABBHzu0ZwCug9Ije8hL2xBCYh/pjfMb1aZGrrohk= +github.com/containerd/go-cni v1.1.0/go.mod h1:Rflh2EJ/++BA2/vY5ao3K6WJRR/bZKsX123aPk+kUtA= +github.com/containerd/go-cni v1.1.3/go.mod h1:Rflh2EJ/++BA2/vY5ao3K6WJRR/bZKsX123aPk+kUtA= +github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= +github.com/containerd/go-runc v0.0.0-20190911050354-e029b79d8cda/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= +github.com/containerd/go-runc v0.0.0-20200220073739-7016d3ce2328/go.mod h1:PpyHrqVs8FTi9vpyHwPwiNEGaACDxT/N/pLcvMSRA9g= +github.com/containerd/go-runc v0.0.0-20201020171139-16b287bc67d0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= +github.com/containerd/go-runc v1.0.0/go.mod h1:cNU0ZbCgCQVZK4lgG3P+9tn9/PaJNmoDXPpoJhDR+Ok= +github.com/containerd/imgcrypt v1.0.1/go.mod h1:mdd8cEPW7TPgNG4FpuP3sGBiQ7Yi/zak9TYCG3juvb0= +github.com/containerd/imgcrypt v1.0.4-0.20210301171431-0ae5c75f59ba/go.mod h1:6TNsg0ctmizkrOgXRNQjAPFWpMYRWuiB6dSF4Pfa5SA= +github.com/containerd/imgcrypt v1.1.1-0.20210312161619-7ed62a527887/go.mod h1:5AZJNI6sLHJljKuI9IHnw1pWqo/F0nGDOuR9zgTs7ow= +github.com/containerd/imgcrypt v1.1.1/go.mod h1:xpLnwiQmEUJPvQoAapeb2SNCxz7Xr6PJrXQb0Dpc4ms= +github.com/containerd/imgcrypt v1.1.3/go.mod h1:/TPA1GIDXMzbj01yd8pIbQiLdQxed5ue1wb8bP7PQu4= +github.com/containerd/nri v0.0.0-20201007170849-eb1350a75164/go.mod h1:+2wGSDGFYfE5+So4M5syatU0N0f0LbWpuqyMi4/BE8c= +github.com/containerd/nri v0.0.0-20210316161719-dbaa18c31c14/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= +github.com/containerd/nri v0.1.0/go.mod h1:lmxnXF6oMkbqs39FiCt1s0R2HSMhcLel9vNL3m4AaeY= +github.com/containerd/stargz-snapshotter/estargz v0.4.1/go.mod h1:x7Q9dg9QYb4+ELgxmo4gBUeJB0tl5dqH1Sdz0nJU1QM= +github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= +github.com/containerd/ttrpc v0.0.0-20190828172938-92c8520ef9f8/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= +github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c/go.mod h1:LPm1u0xBw8r8NOKoOdNMeVHSawSsltak+Ihv+etqsE8= +github.com/containerd/ttrpc v1.0.1/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= +github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= +github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ= +github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= +github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk= +github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg= +github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= +github.com/containerd/zfs v0.0.0-20200918131355-0a33824f23a2/go.mod h1:8IgZOBdv8fAgXddBT4dBXJPtxyRsejFIpXoklgxgEjw= +github.com/containerd/zfs v0.0.0-20210301145711-11e8f1707f62/go.mod h1:A9zfAbMlQwE+/is6hi0Xw8ktpL+6glmqZYtevJgaB8Y= +github.com/containerd/zfs v0.0.0-20210315114300-dde8f0fda960/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= +github.com/containerd/zfs v0.0.0-20210324211415-d5c4544f0433/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= +github.com/containerd/zfs v1.0.0/go.mod h1:m+m51S1DvAP6r3FcmYCp54bQ34pyOwTieQDNRIRHsFY= +github.com/containernetworking/cni v0.7.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= +github.com/containernetworking/cni v0.8.0/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= +github.com/containernetworking/cni v0.8.1/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= +github.com/containernetworking/cni v1.0.1/go.mod h1:AKuhXbN5EzmD4yTNtfSsX3tPcmtrBI6QcRV0NiNt15Y= +github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM= +github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8= +github.com/containernetworking/plugins v1.0.1/go.mod h1:QHCfGpaTwYTbbH+nZXKVTxNBDZcxSOplJT5ico8/FLE= +github.com/containers/ocicrypt v1.0.1/go.mod h1:MeJDzk1RJHv89LjsH0Sp5KTY3ZYkjXO/C+bKAeWFIrc= +github.com/containers/ocicrypt v1.1.0/go.mod h1:b8AOe0YR67uU8OqfVNcznfFpAzu3rdgUV4GP9qXPfu4= +github.com/containers/ocicrypt v1.1.1/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= +github.com/containers/ocicrypt v1.1.2/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= +github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= +github.com/coreos/go-iptables v0.6.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q= +github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= +github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI= github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= +github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= +github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= +github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= +github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= +github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denisenkom/go-mssqldb v0.12.0/go.mod h1:iiK0YP1ZeepvmBQk/QpLEhhTNJgfzrpArPY/aFvc9yU= +github.com/denisenkom/go-mssqldb v0.12.2/go.mod h1:lnIw1mZukFRZDJYQ0Pb833QS2IaC3l5HkEfra2LJ+sk= +github.com/dennwc/varint v1.0.0/go.mod h1:hnItb35rvZvJrbTALZtY/iQfDs48JKRG1RPpgziApxA= +github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= github.com/devigned/tab v0.1.1/go.mod h1:XG9mPq0dFghrYvoBF3xdRrJzSTX1b7IQrvaL9mzjeJY= -github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= +github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dgryski/go-sip13 v0.0.0-20200911182023-62edffca9245/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/digitalocean/godo v1.78.0/go.mod h1:GBmu8MkjZmNARE7IXRPmkbbnocNN8+uBm0xbEVw2LCs= +github.com/digitalocean/godo v1.81.0/go.mod h1:BPCqvwbjbGqxuUnIKB4EvS/AX7IDnNmt5fwvIkWo+ew= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= +github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/docker/cli v0.0.0-20191017083524-a8ff7f821017/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= +github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.14+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= +github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= +github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= +github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw= +github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= +github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= +github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/domodwyer/mailyak/v3 v3.3.4 h1:AG/pvcz2/ocFqZkPEG7lPAa0MhCq1warfUEKJt6Fagk= github.com/domodwyer/mailyak/v3 v3.3.4/go.mod h1:lOm/u9CyCVWHeaAmHIdF4RiKVxKUT/H5XX10lIKAL6c= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/edsrzf/mmap-go v1.1.0/go.mod h1:19H/e8pUPLicwkyNgOykDXkJ9F0MHE+Z52B8EIth78Q= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -272,28 +522,97 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= +github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= +github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/gabriel-vasile/mimetype v1.4.1 h1:TRWk7se+TOjCYgRth7+1/OYLNiRNIotknkFtf/dnN7Q= github.com/gabriel-vasile/mimetype v1.4.1/go.mod h1:05Vi0w3Y9c/lNvJOdmIwvrrAhX3rYhfQQCaf9VJcv7M= github.com/ganigeorgiev/fexpr v0.1.1 h1:La9kYEgTcIutvOnqNZ8pOUD0O0Q/Gn15sTVEX+IeBE8= github.com/ganigeorgiev/fexpr v0.1.1/go.mod h1:RyGiGqmeXhEQ6+mlGdnUleLHgtzzu/VGO2WtJkF5drE= +github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= +github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= +github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= +github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/gin-gonic/gin v1.7.3/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= +github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/loads v0.21.1/go.mod h1:/DtAMXXneXFjbQMGEtbamCZb+4x7eGwkvZCvBmwUG+g= +github.com/go-openapi/runtime v0.23.1/go.mod h1:AKurw9fNre+h3ELZfk6ILsfvPN+bvvlaU/M9q/r9hpk= +github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= +github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= +github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-openapi/strfmt v0.21.2/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/validate v0.21.0/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= @@ -301,22 +620,73 @@ github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTM github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= +github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= +github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= +github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= +github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= +github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= +github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= +github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= +github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= +github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= +github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= +github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= +github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= +github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= +github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= +github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/goccy/go-yaml v1.9.5/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA= +github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= +github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU= +github.com/gogo/googleapis v1.4.0/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= -github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+wXQnTPR4KqTKDgJukSZ6amVRtWMPEjE6sQoK8= +github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -349,9 +719,14 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= +github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -365,13 +740,18 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-containerregistry v0.5.1/go.mod h1:Ct15B4yir3PLOP5jsy0GNeYVaIZs/MK/Jz5any1wFW0= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/go-replayers/grpcreplay v1.1.0 h1:S5+I3zYyZ+GQz68OfbURDdt/+cSMqCK1wrvNx7WBzTE= github.com/google/go-replayers/grpcreplay v1.1.0/go.mod h1:qzAvJ8/wi57zq7gWqaE6AwLM6miiXUQwP1S+I9icmhk= github.com/google/go-replayers/httpreplay v1.1.1 h1:H91sIMlt1NZzN7R+/ASswyouLJfW0WLW7fhyUFvDEkY= github.com/google/go-replayers/httpreplay v1.1.1/go.mod h1:gN9GeLIs7l6NUoVaSSnv2RiqK1NiwAmD0MrKeC9IIks= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible h1:xmapqc1AyLoB+ddYT6r04bD9lIjlOqGaREovi0SzFaE= github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -395,8 +775,12 @@ github.com/google/pprof v0.0.0-20210506205249-923b5ab0fc1a/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20220318212150-b2ab0324ddda/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= +github.com/google/pprof v0.0.0-20220608213341-c488b8fa1db3/go.mod h1:gSuNB+gJaOiQKLEZ+q+PK9Mq3SOzhRcw2GsGS/FhYDk= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -404,8 +788,8 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/wire v0.5.0 h1:I7ELFeVBr3yfPIcc8+MWvrjk+3VjbcSzoXm3JVa+jD8= github.com/google/wire v0.5.0/go.mod h1:ngWDr9Qvq3yZA10YrxfyGELY/AFWGVpy9c1LTRi1EoU= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.1.0 h1:zO8WHNx/MYiAKJ3d5spxZXZE6KHmIQGQcAzwUzV7qQw= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.2.0 h1:y8Yozv7SZtlU//QXbezB6QkpuE6jMD2/gfzk4AftXjs= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -413,23 +797,110 @@ github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0 github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= -github.com/googleapis/gax-go/v2 v2.5.1 h1:kBRZU0PSuI7PspsSb/ChWoVResUcwNVIdpB049pKTiw= -github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= -github.com/googleapis/go-type-adapters v1.0.0 h1:9XdMn+d/G57qq1s8dNc5IesGCXHf6V2HZ2JwRxfA2tA= +github.com/googleapis/gax-go/v2 v2.6.0 h1:SXk3ABtQYDT/OH8jAyvEOQ58mgawq5C4o/4/89qN2ZU= +github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= +github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= +github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= +github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= +github.com/gophercloud/gophercloud v0.24.0/go.mod h1:Q8fZtyi5zZxPS/j9aj3sSxtvj41AdQMDwyo1myduD5c= +github.com/gophercloud/gophercloud v0.25.0/go.mod h1:Q8fZtyi5zZxPS/j9aj3sSxtvj41AdQMDwyo1myduD5c= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2/go.mod h1:M5qHK+eWfAv8VR/265dIuEpL3fNfeC21tXXp9itM24A= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.2/go.mod h1:chrfS3YoLAlKTRE5cFWvCbt8uGAjshktT4PveTUpsFQ= github.com/hanwen/go-fuse v1.0.0/go.mod h1:unqXarDXqzAk0rt98O2tVndEPIpUgLD9+rwFisZH3Ok= github.com/hanwen/go-fuse/v2 v2.1.0/go.mod h1:oRyA5eK+pvJyv5otpO/DgccS8y/RvYMaO00GgRLGryc= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= +github.com/hashicorp/consul/api v1.13.0/go.mod h1:ZlVrynguJKcYr54zGaDbaL3fOvKC9m72FhPvA8T35KQ= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= +github.com/hashicorp/cronexpr v1.1.1/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4= +github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v0.12.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.2.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/memberlist v0.3.1/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/nomad/api v0.0.0-20220629141207-c2428e1673ec/go.mod h1:jP79oXjopTyH6E8LF0CEMq67STgrlmBRIyijA0tuR5o= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hetznercloud/hcloud-go v1.33.1/go.mod h1:XX/TQub3ge0yWR2yHWmnDVIrB+MQbda1pHxkUmDlUME= +github.com/hetznercloud/hcloud-go v1.35.0/go.mod h1:mepQwR6va27S3UQthaEPGS86jtzSY9xWL1e9dyxXpgA= github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog= github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= +github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= +github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.10/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/intel/goresctrl v0.2.0/go.mod h1:+CZdzouYFn5EsxgqAQTEzMfwKwuc0fVdMrT9FCCAVRQ= +github.com/ionos-cloud/sdk-go/v6 v6.1.0/go.mod h1:Ox3W0iiEz0GHnfY9e5LmAxwklsxguuNFEUSu0gVRTME= +github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= +github.com/j-keck/arping v1.0.2/go.mod h1:aJbELhR92bSk7tp79AWM/ftfc90EfEi2bQJrbBFOsPw= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= @@ -439,7 +910,7 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.11.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.12.1/go.mod h1:ZkhRC59Llhrq3oSfrikvwQ5NaxYExr6twkdkMLaKono= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= @@ -452,46 +923,80 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvW github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.2.0/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.3.0/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgtype v1.10.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgtype v1.11.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.15.0/go.mod h1:D/zyOyXiaM1TmVWnOM18p0xdDtdakRBa0RsVGI3U3bw= +github.com/jackc/pgx/v4 v4.16.1/go.mod h1:SIhx0D5hoADaiXZVyv+3gSm3LCIIINTVO0PficsvWGQ= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.2.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= +github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/labstack/echo/v5 v5.0.0-20220201181537-ed2888cfa198 h1:lFz33AOOXwTpqOiHvrN8nmTdkxSfuNLHLPjgQ1muPpU= github.com/labstack/echo/v5 v5.0.0-20220201181537-ed2888cfa198/go.mod h1:uh3YlzsEJj7OG57rDWj6c3WEkOF1ZHGBQkDuUZw3rE8= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= @@ -499,85 +1004,436 @@ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/linode/linodego v1.4.0/go.mod h1:PVsRxSlOiJyvG4/scTszpmZDTdgS+to3X6eS8pRrWI8= +github.com/linode/linodego v1.8.0/go.mod h1:heqhl91D8QTPVm2k9qZHP78zzbOdTFLXE9NJc3bcc50= +github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo= +github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-ieproxy v0.0.1 h1:qiyop7gCflfhwCzGyeT0gro3sF9AIg9HU98JORTkqfI= -github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI= -github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= +github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= +github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= +github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= +github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/microsoft/ApplicationInsights-Go v0.4.4/go.mod h1:fKRUseBqkw6bDiXTs3ESTiU/4YTIHsQS4W3fP2ieF4U= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= +github.com/miekg/dns v1.1.48/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= +github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= +github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= +github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= +github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= +github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= +github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= +github.com/moby/sys/signal v0.6.0/go.mod h1:GQ6ObYZfqacOwTtlXvcmh9A26dVRul/hbOZn88Kg8Tg= +github.com/moby/sys/symlink v0.1.0/go.mod h1:GGDODQmbFOjFsXvfLVn3+ZRxkch54RkSiGqsZeMYowQ= +github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs= +github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo= +github.com/moby/term v0.0.0-20210610120745-9d4ed1856297/go.mod h1:vgPCkQMyxTZ7IDy8SXRufE172gr8+K/JE/7hHFxHW3A= +github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= +github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2-0.20211117181255-693428a734f5/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= +github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= +github.com/opencontainers/runc v1.1.0/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= +github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= +github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= +github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= +github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= +github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= +github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= +github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= +github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= +github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/pocketbase/dbx v1.6.0 h1:iPQi99GpaMRne0KRVnd/kCfxayCP/f4QDb6hGxMRI3I= -github.com/pocketbase/dbx v1.6.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs= +github.com/pocketbase/dbx v1.7.0 h1:MY6/up//aIeH6WA8VqYt3EeQt082bEdKcUDcEF4UrWw= +github.com/pocketbase/dbx v1.7.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= +github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= +github.com/prometheus/alertmanager v0.24.0/go.mod h1:r6fy/D7FRuZh5YbnX6J3MBY0eI4Pb5yPYS7/bPSXXqI= +github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.34.0/go.mod h1:gB3sOl7P0TvJabZpLY5uQMpUqRCPPCyRLCZYc7JZTNE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/common/assets v0.1.0/go.mod h1:D17UVUE12bHbim7HzwUvtqm6gwBEaDQ0F+hIGbFbccI= +github.com/prometheus/common/assets v0.2.0/go.mod h1:D17UVUE12bHbim7HzwUvtqm6gwBEaDQ0F+hIGbFbccI= +github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= +github.com/prometheus/exporter-toolkit v0.7.1/go.mod h1:ZUBIj498ePooX9t/2xtDjeQYwvRpiPP2lh5u4iblj2g= +github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/prometheus v0.35.0/go.mod h1:7HaLx5kEPKJ0GDgbODG0fZgXbQ8K/XjZNJXQmbmgQlY= +github.com/prometheus/prometheus v0.37.0/go.mod h1:egARUgz+K93zwqsVIAneFlLZefyGOON44WyAp4Xqbbk= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rakyll/embedmd v0.0.0-20171029212350-c8060a0752a2/go.mod h1:7jOTMgqac46PZcF54q6l2hkLEG8op93fZu61KmxWDV4= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa h1:tEkEyxYeZ43TR55QU/hsIt9aRGBxbgGuz9CGykjvogY= +github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= +github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= +github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= +github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= +github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= +github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= -github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= +github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= +github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= +github.com/tedsuo/ifrit v0.0.0-20180802180643-bea94bb476cc/go.mod h1:eyZnKCc955uh98WQvzOm0dgAeLnf2O0Rz0LPoC5ze+0= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= +github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= +github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= +github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= +github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= +github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= +github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= +github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= +github.com/vultr/govultr/v2 v2.17.2/go.mod h1:ZFOKGWmgjytfyjeyAdhQlSWwTjh2ig+X49cAp50dzXI= +github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= +github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= +github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= +github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= +go.etcd.io/etcd/pkg/v3 v3.5.0/go.mod h1:UzJGatBQ1lXChBkQF0AuAtkRQMYnHubxAEYIrC3MSsE= +go.etcd.io/etcd/raft/v3 v3.5.0/go.mod h1:UFOHSIvO/nKwd4lhkwabrTD3cqW5yVyYYf/KlD00Szc= +go.etcd.io/etcd/server/v3 v3.5.0/go.mod h1:3Ah5ruV+M+7RZr0+Y/5mNLwC+eQlni+mQmOVdCRJoS4= +go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= +go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +go.mongodb.org/mongo-driver v1.8.3/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= +go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.opencensus.io v0.15.0/go.mod h1:UffZAU+4sDEINUGP/B7UfBBkq4fqLu9zXAX7ke6CHW0= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -586,14 +1442,60 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.28.0/go.mod h1:vEhqr0m4eTc+DWxfsXoXue2GBgV2uUwVznkGIHW/e5w= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.31.0/go.mod h1:PFmBsWbldL1kiWZk9+0LBZz2brhByaGsvp6pRICMlPE= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0/go.mod h1:5eCOqeGphOyz6TsY3ZDNjE33SM/TFAK3RGuCL2naTgY= +go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo= +go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel v1.6.1/go.mod h1:blzUabWHkX6LJewxvadmzafgh/wnvBSDBdOuwkAtrWQ= +go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= +go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1/go.mod h1:NEu79Xo32iVb+0gVNV8PMd7GoWqnyDXRlj04yFjqz40= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0/go.mod h1:M1hVZHNxcbkAlcvrOMlpQ4YOO3Awf+4N2dxkZL3xm04= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0/go.mod h1:hO1KLR7jcKaDDKDkvI9dP/FIhpmna5lkqPUQdEjFAM8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.1/go.mod h1:YJ/JbY5ag/tSQFXzH3mtDmHqzF3aFn3DI/aB1n7pt4w= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0/go.mod h1:ceUgdyfNv4h4gLxHR0WNfDiiVmZFodZhZSbOLhpxqXE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0/go.mod h1:keUU7UfnwWTWpJ+FWnyqmogPa82nuU5VUANFq49hlMY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.6.1/go.mod h1:UJJXJj0rltNIemDMwkOJyggsvyMG9QHfJeFH0HS5JjM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.7.0/go.mod h1:E+/KKhwOSw8yoPxSSuUHG6vKppkvhN+S1Jc7Nib3k3o= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0/go.mod h1:QNX1aly8ehqqX1LEa6YniTU7VY9I6R3X/oPxhGdTceE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.6.1/go.mod h1:DAKwdo06hFLc0U88O10x4xnb5sc7dDRDqRuiN+io8JE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.7.0/go.mod h1:aFXT9Ng2seM9eizF+LfKiyPBGy8xIZKwhusC1gIu3hA= +go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/metric v0.30.0/go.mod h1:/ShZ7+TS4dHzDFmfi1kSXMhMVubNoP0oIaBp70J6UXU= +go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= +go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= +go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs= +go.opentelemetry.io/otel/sdk v1.6.1/go.mod h1:IVYrddmFZ+eJqu2k38qD3WezFR2pymCzm8tdxyh3R4E= +go.opentelemetry.io/otel/sdk v1.7.0/go.mod h1:uTEOTwaqIVuTGiJN7ii13Ibp75wJmYUDe374q6cZwUU= +go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE= +go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE= +go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= +go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= +go.opentelemetry.io/otel/trace v1.6.1/go.mod h1:RkFRM1m0puWIq10oxImnGEduNBzxiN7TXluRBtE+5j0= +go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= +go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/automaxprocs v1.5.1/go.mod h1:BF4eumQw0P9GtnuxxovUd06vwm1o18oMzFtK66vU6XU= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= @@ -603,28 +1505,44 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= -gocloud.dev v0.26.0 h1:4rM/SVL0lLs+rhC0Gmc+gt/82DBpb7nbpIZKXXnfMXg= -gocloud.dev v0.26.0/go.mod h1:mkUgejbnbLotorqDyvedJO20XcZNTynmSeVSQS9btVg= +gocloud.dev v0.27.0 h1:j0WTUsnKTxCsWO7y8T+YCiBZUmLl9w/WIowqAY3yo0g= +gocloud.dev v0.27.0/go.mod h1:YlYKhYsY5/1JdHGWQDkAuqkezVKowu7qbe9aIeUF6p0= +golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503 h1:vJ2V3lFLg+bBhgroYuRfyN583UzVveQmIXjc8T/y3to= -golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0 h1:a5Yg6ylndHHYJqIPrdq0AhvR6KTvDTAvgBtaidhEevY= -golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -638,10 +1556,8 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20220722155232-062f8c9fd539 h1:/eM0PCrQI2xd471rI+snWuu251/+/jpBpZqir2mPdnU= -golang.org/x/image v0.0.0-20220722155232-062f8c9fd539/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY= -golang.org/x/image v0.0.0-20220902085622-e7cb96979f69 h1:Lj6HJGCSn5AjxRAH2+r35Mir4icalbqku+CLUtjnvXY= -golang.org/x/image v0.0.0-20220902085622-e7cb96979f69/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY= +golang.org/x/image v0.1.0 h1:r8Oj8ZA2Xy12/b5KZYj3tuv7NG/fBz3TwQVvpJ9l8Rk= +golang.org/x/image v0.1.0/go.mod h1:iyPr49SD/G/TBxYVB/9RRtGUT5eNbo2u4NamWeQcD5c= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -666,22 +1582,37 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -692,35 +1623,49 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220401154927-543a649e0bdd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c h1:JVAXQ10yGGVbSyoer5VILysz6YKjdNT2bsvlayjqhes= -golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20220921155015-db77216a4ee9 h1:SdDGdqRuKrF2R4XGcnPzcvZ63c/55GvhoHUus0o+BNI= -golang.org/x/net v0.0.0-20220921155015-db77216a4ee9/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220802222814-0bcc04d9c69b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -743,14 +1688,16 @@ golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 h1:2o1E+E8TpNLklK9nHiPiK1uzIYrIHt+cQx3ynCwq9V8= -golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 h1:lxqLZaMad/dJHMFZH0NiNpiEZI/nhgWhe4wgzpE+MuA= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20220628200809-02e64fa58f26/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.1.0 h1:isLCZuhj4v+tYv7eskaN4v/TM+A1begWWgyVJDdl1+Y= +golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -759,30 +1706,62 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190522044717-8097e1b27ff5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190812073006-9eafafc0a87e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191112214154-59a1497f0cea/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200120151820-655fe14d7479/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -790,65 +1769,96 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200916030750-2334cc1a136f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200922070232-aee5d888a860/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201117170446-d9b008d0a637/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 h1:UiNENfZ8gDvpiWw7IpOMQ27spWmThO1RwwdQVbJahJM= -golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= +golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc= -golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.0.0-20220919170432-7a66f970e087 h1:tPwmk4vmvVCMdr98VgL4JH+qZxPL8fqlUOHnyOM8N3w= -golang.org/x/term v0.0.0-20220919170432-7a66f970e087/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -857,37 +1867,58 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220224211638-0e9765cccd65/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 h1:ftMN5LMiBFjbzleLqtoBZk7KdJwhuybIU+FckUHgoyQ= +golang.org/x/time v0.0.0-20220609170525-579cf78fd858/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220920022843-2ce7c2934d45 h1:yuLAip3bfURHClMG9VBdzPrQvCWjWiWUTBGV+/fCbUs= -golang.org/x/time v0.0.0-20220920022843-2ce7c2934d45/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.1.0 h1:xYY+Bajn2a7VBmTM5GikTmnK8ZuX8YgnQCqZpbBNtmA= +golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190422233926-fe54fb35175b/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190706070813-72ffa07ba3db/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -908,26 +1939,36 @@ golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjs golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200616133436-c1934b75d054/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= +golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -936,10 +1977,11 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f h1:uF6paiQQebLeSXkrTqHqz0MXhXXS1KgF41eUdBNvxK0= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -974,11 +2016,7 @@ google.golang.org/api v0.58.0/go.mod h1:cAbP2FsxoGVNwtgNAmmn3y5G1TWAiVYRmg4yku3l google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= -google.golang.org/api v0.64.0/go.mod h1:931CdxA8Rm4t6zqTFGSsgwbAEZ2+GMYurbndwSimebM= -google.golang.org/api v0.66.0/go.mod h1:I1dmXYpX7HGwz/ejRxwQp2qj5bFAz93HiCU1C1oYd9M= google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= -google.golang.org/api v0.68.0/go.mod h1:sOM8pTpwgflXRhz+oC8H2Dr+UcbMqkPPWNJo88Q7TH8= -google.golang.org/api v0.69.0/go.mod h1:boanBiw+h5c3s+tBPgEzLDRHfFLWV0qXxRHz3ws7C80= google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= @@ -986,11 +2024,14 @@ google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69 google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= -google.golang.org/api v0.94.0 h1:KtKM9ru3nzQioV1HLlUf1cR7vMYJIpgls5VhAYQXIwA= -google.golang.org/api v0.94.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= -google.golang.org/api v0.96.0 h1:F60cuQPJq7K7FzsxMYHAUJSiXh2oKctHxBMbDygxhfM= -google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= +google.golang.org/api v0.86.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.91.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.101.0 h1:lJPPeEBIRxGpGLwnBTam1NPEM8Z2BmmXEd3z812pjwM= +google.golang.org/api v0.101.0/go.mod h1:CjxAAWWt3A3VrUE2IGDY2bgK5qhoG/OkyWVlYcP05MY= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= @@ -998,11 +2039,14 @@ google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190522204451-c2c4e71fbf69/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= @@ -1011,6 +2055,7 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200117163144-32f20d992d24/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -1019,17 +2064,21 @@ google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1066,21 +2115,14 @@ google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220114231437-d2e6a121cae0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220201184016-50beb8ab5c44/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220204002441-d6cc3cc0770e/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220211171837-173942840c17/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220216160803-4663080d8bc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220401170504-314d38edb7de/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220329172620-7be39ac1afc7/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= @@ -1088,18 +2130,27 @@ google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc h1:Nf+EdcTLHR8qDNN/KfkQL0u0ssxt9OhbaWCl5C0ucEI= -google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006 h1:mmbq5q8M1t7dhkLw320YK4PsOXm6jdnUAkErImaIqOg= -google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= +google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220802133213-ce4fa296bf78/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= +google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+Ca/rDdKubLIU9rcJ3xfy1DC/Wd2Oo= +google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= +google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -1122,13 +2173,16 @@ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1146,19 +2200,51 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/telebot.v3 v3.0.0/go.mod h1:7rExV8/0mDDNu9epSrDm/8j22KLaActH1Tbee6YjzWg= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1166,51 +2252,104 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= +k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= +k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= +k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= +k8s.io/api v0.22.5/go.mod h1:mEhXyLaSD1qTOf40rRiKXkc+2iCem09rWLlFwhCEiAs= +k8s.io/api v0.23.5/go.mod h1:Na4XuKng8PXJ2JsploYYrivXrINeTaycCGcYgF91Xm8= +k8s.io/api v0.24.2/go.mod h1:AHqbSkTm6YrQ0ObxjO3Pmp/ubFF/KuM7jU+3khoBsOg= +k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= +k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= +k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= +k8s.io/apimachinery v0.22.1/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= +k8s.io/apimachinery v0.22.5/go.mod h1:xziclGKwuuJ2RM5/rSFQSYAj0zdbci3DH8kj+WvyN0U= +k8s.io/apimachinery v0.23.5/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM= +k8s.io/apimachinery v0.24.2/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM= +k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= +k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= +k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q= +k8s.io/apiserver v0.22.5/go.mod h1:s2WbtgZAkTKt679sYtSudEQrTGWUSQAPe6MupLnlmaQ= +k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= +k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= +k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= +k8s.io/client-go v0.22.5/go.mod h1:cs6yf/61q2T1SdQL5Rdcjg9J1ElXSwbjSrW2vFImM4Y= +k8s.io/client-go v0.23.5/go.mod h1:flkeinTO1CirYgzMPRWxUCnV0G4Fbu2vLhYCObnt/r4= +k8s.io/client-go v0.24.2/go.mod h1:zg4Xaoo+umDsfCWr4fCnmLEtQXyCNXCvJuSsglNcV30= +k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NIla0= +k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk= +k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI= +k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM= +k8s.io/component-base v0.22.5/go.mod h1:VK3I+TjuF9eaa+Ln67dKxhGar5ynVbwnGrUiNF4MqCI= +k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= +k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= +k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI= +k8s.io/cri-api v0.20.6/go.mod h1:ew44AjNXwyn1s0U4xCKGodU7J1HzBeZ1MpGrpa5r8Yc= +k8s.io/cri-api v0.23.1/go.mod h1:REJE3PSU0h/LOV1APBrupxrEJqnoxZC8KWzkBUHwrK4= +k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20201113003025-83324d819ded/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= +k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= +k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= +k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.40.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.60.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.70.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o= +k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= +k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= +k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= +k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65/go.mod h1:sX9MT8g7NVZM5lVL/j8QyCCJe8YSMW30QvGZWaCIDIk= +k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdiUkI+v/ImEGAvu3WatcZl3lPMR4Rk= +k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= +k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI= lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/cc/v3 v3.36.2/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.36.3 h1:uISP3F66UlixxWEcKuIWERa4TwrZENHSL8tWxZz8bHg= -modernc.org/cc/v3 v3.36.3/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.39.0 h1:sd+UyMj63acEV1jaFqxFGPQfllSncJgL+roJjFlo6lI= -modernc.org/cc/v3 v3.39.0/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= -modernc.org/ccgo/v3 v3.16.9 h1:AXquSwg7GuMk11pIdw7fmO1Y/ybgazVkMhsZWCV0mHM= -modernc.org/ccgo/v3 v3.16.9/go.mod h1:zNMzC9A9xeNUepy6KuZBbugn3c0Mc9TeiJO4lgvkJDo= +modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw= +modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0= +modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8 h1:0+dsXf0zeLx9ixj4nilg6jKe5Bg1ilzBwSFq4kJmIUc= +modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8/go.mod h1:fUB3Vn0nVPReA+7IG7yZDfjv1TMWjhQP8gCxrFAtL5g= modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk= -modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= -modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= -modernc.org/libc v1.17.0 h1:nbL2Lv0I323wLc1GmTh/AqVtI9JeBVc7Nhapdg9EONs= -modernc.org/libc v1.17.0/go.mod h1:XsgLldpP4aWlPlsjqKRdHPqCxCjISdHfM/yeWC5GyW0= -modernc.org/libc v1.19.0 h1:bXyVhGQg6KIClTr8FMVIDPl7jtbcs7aS5WP7vLDaxPs= -modernc.org/libc v1.19.0/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0= -modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= +modernc.org/libc v1.21.4 h1:CzTlumWeIbPV5/HVIMzYHNPCRP8uiU/CWiN2gtd/Qu8= +modernc.org/libc v1.21.4/go.mod h1:przBsL5RDOZajTVslkugzLBj1evTue36jEomFQOoYuI= modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.2.0 h1:zXehBrt9n+Pjn+4RoRCZ0KqRA/0ePFqcecxZ/hXCIVw= -modernc.org/memory v1.2.0/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= modernc.org/memory v1.4.0 h1:crykUfNSnMAXaOJnnxcSzbUGMqkLWjklJKkBK2nwZwk= modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.18.1 h1:ko32eKt3jf7eqIkCgPAeHMBXw3riNSLhl2f3loEF7o8= -modernc.org/sqlite v1.18.1/go.mod h1:6ho+Gow7oX5V+OiOQ6Tr4xeqbx13UZ6t+Fw9IRUG4d4= -modernc.org/sqlite v1.19.1 h1:8xmS5oLnZtAK//vnd4aTVj8VOeTAccEFOtUnIzfSw+4= -modernc.org/sqlite v1.19.1/go.mod h1:UfQ83woKMaPW/ZBruK0T7YaFCrI+IE0LeWVY6pmnVms= -modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= -modernc.org/strutil v1.1.2 h1:iFBDH6j1Z0bN/Q9udJnnFoFpENA4252qe/7/5woE5MI= -modernc.org/strutil v1.1.2/go.mod h1:OYajnUAcI/MX+XD/Wx7v1bbdvcQSvxgtb0gC+u3d3eg= +modernc.org/sqlite v1.19.3 h1:dIoagx6yIQT3V/zOSeAyZ8OqQyEr17YTgETOXTZNJMA= +modernc.org/sqlite v1.19.3/go.mod h1:xiyJD7FY8mTZXnQwE/gEL1STtFrrnDx03V8KhVQmcr8= modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= -modernc.org/tcl v1.13.1 h1:npxzTwFTZYM8ghWicVIX1cRWzj7Nd8i6AqqX2p+IYao= -modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk= -modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= +modernc.org/tcl v1.15.0 h1:oY+JeD11qVVSgVvodMJsu7Edf8tr5E/7tuhF5cNYz34= modernc.org/token v1.0.1 h1:A3qvTqOwexpfZZeyI0FeGPDlSWX5pjZu9hF4lU+EKWg= modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/z v1.5.1 h1:RTNHdsrOpeoSeOF4FbzTo8gBYByaJ5xT7NgZ9ZqRiJM= -nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE= +nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= +sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs= +sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY= +sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.0.3/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= +sigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/mails/user.go b/mails/record.go similarity index 62% rename from mails/user.go rename to mails/record.go index d21909a85..6371f6b45 100644 --- a/mails/user.go +++ b/mails/record.go @@ -7,25 +7,26 @@ import ( "github.com/pocketbase/pocketbase/core" "github.com/pocketbase/pocketbase/mails/templates" "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/models/schema" "github.com/pocketbase/pocketbase/tokens" ) -// SendUserPasswordReset sends a password reset request email to the specified user. -func SendUserPasswordReset(app core.App, user *models.User) error { - token, tokenErr := tokens.NewUserResetPasswordToken(app, user) +// SendRecordPasswordReset sends a password reset request email to the specified user. +func SendRecordPasswordReset(app core.App, authRecord *models.Record) error { + token, tokenErr := tokens.NewRecordResetPasswordToken(app, authRecord) if tokenErr != nil { return tokenErr } mailClient := app.NewMailClient() - event := &core.MailerUserEvent{ + event := &core.MailerRecordEvent{ MailClient: mailClient, - User: user, + Record: authRecord, Meta: map[string]any{"token": token}, } - sendErr := app.OnMailerBeforeUserResetPasswordSend().Trigger(event, func(e *core.MailerUserEvent) error { + sendErr := app.OnMailerBeforeRecordResetPasswordSend().Trigger(event, func(e *core.MailerRecordEvent) error { settings := app.Settings() subject, body, err := resolveEmailTemplate(app, token, settings.Meta.ResetPasswordTemplate) @@ -38,7 +39,7 @@ func SendUserPasswordReset(app core.App, user *models.User) error { Name: settings.Meta.SenderName, Address: settings.Meta.SenderAddress, }, - mail.Address{Address: e.User.Email}, + mail.Address{Address: e.Record.GetString(schema.FieldNameEmail)}, subject, body, nil, @@ -46,28 +47,28 @@ func SendUserPasswordReset(app core.App, user *models.User) error { }) if sendErr == nil { - app.OnMailerAfterUserResetPasswordSend().Trigger(event) + app.OnMailerAfterRecordResetPasswordSend().Trigger(event) } return sendErr } -// SendUserVerification sends a verification request email to the specified user. -func SendUserVerification(app core.App, user *models.User) error { - token, tokenErr := tokens.NewUserVerifyToken(app, user) +// SendRecordVerification sends a verification request email to the specified user. +func SendRecordVerification(app core.App, authRecord *models.Record) error { + token, tokenErr := tokens.NewRecordVerifyToken(app, authRecord) if tokenErr != nil { return tokenErr } mailClient := app.NewMailClient() - event := &core.MailerUserEvent{ + event := &core.MailerRecordEvent{ MailClient: mailClient, - User: user, + Record: authRecord, Meta: map[string]any{"token": token}, } - sendErr := app.OnMailerBeforeUserVerificationSend().Trigger(event, func(e *core.MailerUserEvent) error { + sendErr := app.OnMailerBeforeRecordVerificationSend().Trigger(event, func(e *core.MailerRecordEvent) error { settings := app.Settings() subject, body, err := resolveEmailTemplate(app, token, settings.Meta.VerificationTemplate) @@ -80,7 +81,7 @@ func SendUserVerification(app core.App, user *models.User) error { Name: settings.Meta.SenderName, Address: settings.Meta.SenderAddress, }, - mail.Address{Address: e.User.Email}, + mail.Address{Address: e.Record.GetString(schema.FieldNameEmail)}, subject, body, nil, @@ -88,31 +89,31 @@ func SendUserVerification(app core.App, user *models.User) error { }) if sendErr == nil { - app.OnMailerAfterUserVerificationSend().Trigger(event) + app.OnMailerAfterRecordVerificationSend().Trigger(event) } return sendErr } // SendUserChangeEmail sends a change email confirmation email to the specified user. -func SendUserChangeEmail(app core.App, user *models.User, newEmail string) error { - token, tokenErr := tokens.NewUserChangeEmailToken(app, user, newEmail) +func SendRecordChangeEmail(app core.App, record *models.Record, newEmail string) error { + token, tokenErr := tokens.NewRecordChangeEmailToken(app, record, newEmail) if tokenErr != nil { return tokenErr } mailClient := app.NewMailClient() - event := &core.MailerUserEvent{ + event := &core.MailerRecordEvent{ MailClient: mailClient, - User: user, + Record: record, Meta: map[string]any{ "token": token, "newEmail": newEmail, }, } - sendErr := app.OnMailerBeforeUserChangeEmailSend().Trigger(event, func(e *core.MailerUserEvent) error { + sendErr := app.OnMailerBeforeRecordChangeEmailSend().Trigger(event, func(e *core.MailerRecordEvent) error { settings := app.Settings() subject, body, err := resolveEmailTemplate(app, token, settings.Meta.ConfirmEmailChangeTemplate) @@ -133,7 +134,7 @@ func SendUserChangeEmail(app core.App, user *models.User, newEmail string) error }) if sendErr == nil { - app.OnMailerAfterUserChangeEmailSend().Trigger(event) + app.OnMailerAfterRecordChangeEmailSend().Trigger(event) } return sendErr diff --git a/mails/user_test.go b/mails/record_test.go similarity index 64% rename from mails/user_test.go rename to mails/record_test.go index ddaf64637..2f74c4024 100644 --- a/mails/user_test.go +++ b/mails/record_test.go @@ -8,16 +8,16 @@ import ( "github.com/pocketbase/pocketbase/tests" ) -func TestSendUserPasswordReset(t *testing.T) { +func TestSendRecordPasswordReset(t *testing.T) { testApp, _ := tests.NewTestApp() defer testApp.Cleanup() // ensure that action url normalization will be applied testApp.Settings().Meta.AppUrl = "http://localhost:8090////" - user, _ := testApp.Dao().FindUserByEmail("test@example.com") + user, _ := testApp.Dao().FindFirstRecordByData("users", "email", "test@example.com") - err := mails.SendUserPasswordReset(testApp, user) + err := mails.SendRecordPasswordReset(testApp, user) if err != nil { t.Fatal(err) } @@ -27,7 +27,7 @@ func TestSendUserPasswordReset(t *testing.T) { } expectedParts := []string{ - "http://localhost:8090/_/#/users/confirm-password-reset/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.", + "http://localhost:8090/_/#/auth/confirm-password-reset/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.", } for _, part := range expectedParts { if !strings.Contains(testApp.TestMailer.LastHtmlBody, part) { @@ -36,13 +36,13 @@ func TestSendUserPasswordReset(t *testing.T) { } } -func TestSendUserVerification(t *testing.T) { +func TestSendRecordVerification(t *testing.T) { testApp, _ := tests.NewTestApp() defer testApp.Cleanup() - user, _ := testApp.Dao().FindUserByEmail("test@example.com") + user, _ := testApp.Dao().FindFirstRecordByData("users", "email", "test@example.com") - err := mails.SendUserVerification(testApp, user) + err := mails.SendRecordVerification(testApp, user) if err != nil { t.Fatal(err) } @@ -52,7 +52,7 @@ func TestSendUserVerification(t *testing.T) { } expectedParts := []string{ - "http://localhost:8090/_/#/users/confirm-verification/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.", + "http://localhost:8090/_/#/auth/confirm-verification/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.", } for _, part := range expectedParts { if !strings.Contains(testApp.TestMailer.LastHtmlBody, part) { @@ -61,13 +61,13 @@ func TestSendUserVerification(t *testing.T) { } } -func TestSendUserChangeEmail(t *testing.T) { +func TestSendRecordChangeEmail(t *testing.T) { testApp, _ := tests.NewTestApp() defer testApp.Cleanup() - user, _ := testApp.Dao().FindUserByEmail("test@example.com") + user, _ := testApp.Dao().FindFirstRecordByData("users", "email", "test@example.com") - err := mails.SendUserChangeEmail(testApp, user, "new_test@example.com") + err := mails.SendRecordChangeEmail(testApp, user, "new_test@example.com") if err != nil { t.Fatal(err) } @@ -77,7 +77,7 @@ func TestSendUserChangeEmail(t *testing.T) { } expectedParts := []string{ - "http://localhost:8090/_/#/users/confirm-email-change/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.", + "http://localhost:8090/_/#/auth/confirm-email-change/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.", } for _, part := range expectedParts { if !strings.Contains(testApp.TestMailer.LastHtmlBody, part) { diff --git a/migrations/1640988000_init.go b/migrations/1640988000_init.go index 439c9138b..9533f3755 100644 --- a/migrations/1640988000_init.go +++ b/migrations/1640988000_init.go @@ -2,7 +2,6 @@ package migrations import ( - "fmt" "path/filepath" "runtime" @@ -11,6 +10,7 @@ import ( "github.com/pocketbase/pocketbase/models" "github.com/pocketbase/pocketbase/models/schema" "github.com/pocketbase/pocketbase/tools/migrate" + "github.com/pocketbase/pocketbase/tools/types" ) var AppMigrations migrate.MigrationsList @@ -46,21 +46,10 @@ func init() { [[updated]] TEXT DEFAULT "" NOT NULL ); - CREATE TABLE {{_users}} ( - [[id]] TEXT PRIMARY KEY, - [[verified]] BOOLEAN DEFAULT FALSE NOT NULL, - [[email]] TEXT UNIQUE NOT NULL, - [[tokenKey]] TEXT UNIQUE NOT NULL, - [[passwordHash]] TEXT NOT NULL, - [[lastResetSentAt]] TEXT DEFAULT "" NOT NULL, - [[lastVerificationSentAt]] TEXT DEFAULT "" NOT NULL, - [[created]] TEXT DEFAULT "" NOT NULL, - [[updated]] TEXT DEFAULT "" NOT NULL - ); - CREATE TABLE {{_collections}} ( [[id]] TEXT PRIMARY KEY, [[system]] BOOLEAN DEFAULT FALSE NOT NULL, + [[type]] TEXT DEFAULT "base" NOT NULL, [[name]] TEXT UNIQUE NOT NULL, [[schema]] JSON DEFAULT "[]" NOT NULL, [[listRule]] TEXT DEFAULT NULL, @@ -68,6 +57,7 @@ func init() { [[createRule]] TEXT DEFAULT NULL, [[updateRule]] TEXT DEFAULT NULL, [[deleteRule]] TEXT DEFAULT NULL, + [[options]] JSON DEFAULT "{}" NOT NULL, [[created]] TEXT DEFAULT "" NOT NULL, [[updated]] TEXT DEFAULT "" NOT NULL ); @@ -79,6 +69,21 @@ func init() { [[created]] TEXT DEFAULT "" NOT NULL, [[updated]] TEXT DEFAULT "" NOT NULL ); + + CREATE TABLE {{_externalAuths}} ( + [[id]] TEXT PRIMARY KEY, + [[collectionId]] TEXT NOT NULL, + [[recordId]] TEXT NOT NULL, + [[provider]] TEXT NOT NULL, + [[providerId]] TEXT NOT NULL, + [[created]] TEXT DEFAULT "" NOT NULL, + [[updated]] TEXT DEFAULT "" NOT NULL, + --- + FOREIGN KEY ([[collectionId]]) REFERENCES {{_collections}} ([[id]]) ON UPDATE CASCADE ON DELETE CASCADE + ); + + CREATE UNIQUE INDEX _externalAuths_record_provider_idx on {{_externalAuths}} ([[collectionId]], [[recordId]], [[provider]]); + CREATE UNIQUE INDEX _externalAuths_provider_providerId_idx on {{_externalAuths}} ([[provider]], [[providerId]]); `).Execute() if tablesErr != nil { return tablesErr @@ -86,62 +91,61 @@ func init() { // inserts the system profiles collection // ----------------------------------------------------------- - profileOwnerRule := fmt.Sprintf("%s = @request.user.id", models.ProfileCollectionUserFieldName) - collection := &models.Collection{ - Name: models.ProfileCollectionName, - System: true, - CreateRule: &profileOwnerRule, - ListRule: &profileOwnerRule, - ViewRule: &profileOwnerRule, - UpdateRule: &profileOwnerRule, - Schema: schema.NewSchema( - &schema.SchemaField{ - Id: "pbfielduser", - Name: models.ProfileCollectionUserFieldName, - Type: schema.FieldTypeUser, - Unique: true, - Required: true, - System: true, - Options: &schema.UserOptions{ - MaxSelect: 1, - CascadeDelete: true, - }, - }, - &schema.SchemaField{ - Id: "pbfieldname", - Name: "name", - Type: schema.FieldTypeText, - Options: &schema.TextOptions{}, - }, - &schema.SchemaField{ - Id: "pbfieldavatar", - Name: "avatar", - Type: schema.FieldTypeFile, - Options: &schema.FileOptions{ - MaxSelect: 1, - MaxSize: 5242880, - MimeTypes: []string{ - "image/jpg", - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif", - }, + usersCollection := &models.Collection{} + usersCollection.MarkAsNew() + usersCollection.Id = "_pb_users_auth_" + usersCollection.Name = "users" + usersCollection.Type = models.CollectionTypeAuth + usersCollection.ListRule = types.Pointer("id = @request.auth.id") + usersCollection.ViewRule = types.Pointer("id = @request.auth.id") + usersCollection.CreateRule = types.Pointer("") + usersCollection.UpdateRule = types.Pointer("id = @request.auth.id") + usersCollection.DeleteRule = types.Pointer("id = @request.auth.id") + + // set auth options + usersCollection.SetOptions(models.CollectionAuthOptions{ + ManageRule: nil, + AllowOAuth2Auth: true, + AllowUsernameAuth: true, + AllowEmailAuth: true, + MinPasswordLength: 8, + RequireEmail: false, + }) + + // set optional default fields + usersCollection.Schema = schema.NewSchema( + &schema.SchemaField{ + Id: "users_name", + Type: schema.FieldTypeText, + Name: "name", + Options: &schema.TextOptions{}, + }, + &schema.SchemaField{ + Id: "users_avatar", + Type: schema.FieldTypeFile, + Name: "avatar", + Options: &schema.FileOptions{ + MaxSelect: 1, + MaxSize: 5242880, + MimeTypes: []string{ + "image/jpg", + "image/jpeg", + "image/png", + "image/svg+xml", + "image/gif", }, }, - ), - } - collection.Id = "systemprofiles0" - collection.MarkAsNew() + }, + ) - return daos.New(db).SaveCollection(collection) + return daos.New(db).SaveCollection(usersCollection) }, func(db dbx.Builder) error { tables := []string{ + "users", + "_externalAuths", "_params", "_collections", - "_users", "_admins", - models.ProfileCollectionName, } for _, name := range tables { diff --git a/migrations/1661586591_add_externalAuths_table.go b/migrations/1661586591_add_externalAuths_table.go deleted file mode 100644 index 71bde5d65..000000000 --- a/migrations/1661586591_add_externalAuths_table.go +++ /dev/null @@ -1,76 +0,0 @@ -package migrations - -import "github.com/pocketbase/dbx" - -func init() { - AppMigrations.Register(func(db dbx.Builder) error { - _, createErr := db.NewQuery(` - CREATE TABLE {{_externalAuths}} ( - [[id]] TEXT PRIMARY KEY, - [[userId]] TEXT NOT NULL, - [[provider]] TEXT NOT NULL, - [[providerId]] TEXT NOT NULL, - [[created]] TEXT DEFAULT "" NOT NULL, - [[updated]] TEXT DEFAULT "" NOT NULL, - --- - FOREIGN KEY ([[userId]]) REFERENCES {{_users}} ([[id]]) ON UPDATE CASCADE ON DELETE CASCADE - ); - - CREATE UNIQUE INDEX _externalAuths_userId_provider_idx on {{_externalAuths}} ([[userId]], [[provider]]); - CREATE UNIQUE INDEX _externalAuths_provider_providerId_idx on {{_externalAuths}} ([[provider]], [[providerId]]); - `).Execute() - if createErr != nil { - return createErr - } - - // remove the unique email index from the _users table and - // replace it with partial index - _, alterErr := db.NewQuery(` - -- crate new users table - CREATE TABLE {{_newUsers}} ( - [[id]] TEXT PRIMARY KEY, - [[verified]] BOOLEAN DEFAULT FALSE NOT NULL, - [[email]] TEXT DEFAULT "" NOT NULL, - [[tokenKey]] TEXT NOT NULL, - [[passwordHash]] TEXT NOT NULL, - [[lastResetSentAt]] TEXT DEFAULT "" NOT NULL, - [[lastVerificationSentAt]] TEXT DEFAULT "" NOT NULL, - [[created]] TEXT DEFAULT "" NOT NULL, - [[updated]] TEXT DEFAULT "" NOT NULL - ); - - -- copy all data from the old users table to the new one - INSERT INTO {{_newUsers}} SELECT * FROM {{_users}}; - - -- drop old table - DROP TABLE {{_users}}; - - -- rename new table - ALTER TABLE {{_newUsers}} RENAME TO {{_users}}; - - -- create named indexes - CREATE UNIQUE INDEX _users_email_idx ON {{_users}} ([[email]]) WHERE [[email]] != ""; - CREATE UNIQUE INDEX _users_tokenKey_idx ON {{_users}} ([[tokenKey]]); - `).Execute() - if alterErr != nil { - return alterErr - } - - return nil - }, func(db dbx.Builder) error { - if _, err := db.DropTable("_externalAuths").Execute(); err != nil { - return err - } - - // drop the partial email unique index and replace it with normal unique index - _, indexErr := db.NewQuery(` - DROP INDEX IF EXISTS _users_email_idx; - CREATE UNIQUE INDEX _users_email_idx on {{_users}} ([[email]]); - `).Execute() - if indexErr != nil { - return indexErr - } - - return nil - }) -} diff --git a/models/admin.go b/models/admin.go index ff0b1289b..c85e133ca 100644 --- a/models/admin.go +++ b/models/admin.go @@ -1,13 +1,67 @@ package models -var _ Model = (*Admin)(nil) +import ( + "errors" + + "github.com/pocketbase/pocketbase/tools/security" + "github.com/pocketbase/pocketbase/tools/types" + "golang.org/x/crypto/bcrypt" +) + +var ( + _ Model = (*Admin)(nil) +) type Admin struct { - BaseAccount + BaseModel - Avatar int `db:"avatar" json:"avatar"` + Avatar int `db:"avatar" json:"avatar"` + Email string `db:"email" json:"email"` + TokenKey string `db:"tokenKey" json:"-"` + PasswordHash string `db:"passwordHash" json:"-"` + LastResetSentAt types.DateTime `db:"lastResetSentAt" json:"-"` } +// TableName returns the Admin model SQL table name. func (m *Admin) TableName() string { return "_admins" } + +// ValidatePassword validates a plain password against the model's password. +func (m *Admin) ValidatePassword(password string) bool { + bytePassword := []byte(password) + bytePasswordHash := []byte(m.PasswordHash) + + // comparing the password with the hash + err := bcrypt.CompareHashAndPassword(bytePasswordHash, bytePassword) + + // nil means it is a match + return err == nil +} + +// SetPassword sets cryptographically secure string to `model.Password`. +// +// Additionally this method also resets the LastResetSentAt and the TokenKey fields. +func (m *Admin) SetPassword(password string) error { + if password == "" { + return errors.New("The provided plain password is empty") + } + + // hash the password + hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), 13) + if err != nil { + return err + } + + m.PasswordHash = string(hashedPassword) + m.LastResetSentAt = types.DateTime{} // reset + + // invalidate previously issued tokens + return m.RefreshTokenKey() +} + +// RefreshTokenKey generates and sets new random token key. +func (m *Admin) RefreshTokenKey() error { + m.TokenKey = security.RandomString(50) + return nil +} diff --git a/models/admin_test.go b/models/admin_test.go index d2fc911c6..261135dd2 100644 --- a/models/admin_test.go +++ b/models/admin_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/tools/types" ) func TestAdminTableName(t *testing.T) { @@ -12,3 +13,92 @@ func TestAdminTableName(t *testing.T) { t.Fatalf("Unexpected table name, got %q", m.TableName()) } } + +func TestAdminValidatePassword(t *testing.T) { + scenarios := []struct { + admin models.Admin + password string + expected bool + }{ + { + // empty passwordHash + empty pass + models.Admin{}, + "", + false, + }, + { + // empty passwordHash + nonempty pass + models.Admin{}, + "123456", + false, + }, + { + // nonempty passwordHash + empty pass + models.Admin{PasswordHash: "$2a$10$SKk/Y/Yc925PBtsSYBvq3Ous9Jy18m4KTn6b/PQQ.Y9QVjy3o/Fv."}, + "", + false, + }, + { + // nonempty passwordHash + wrong pass + models.Admin{PasswordHash: "$2a$10$SKk/Y/Yc925PBtsSYBvq3Ous9Jy18m4KTn6b/PQQ.Y9QVjy3o/Fv."}, + "654321", + false, + }, + { + // nonempty passwordHash + correct pass + models.Admin{PasswordHash: "$2a$10$SKk/Y/Yc925PBtsSYBvq3Ous9Jy18m4KTn6b/PQQ.Y9QVjy3o/Fv."}, + "123456", + true, + }, + } + + for i, s := range scenarios { + result := s.admin.ValidatePassword(s.password) + if result != s.expected { + t.Errorf("(%d) Expected %v, got %v", i, s.expected, result) + } + } +} + +func TestAdminSetPassword(t *testing.T) { + m := models.Admin{ + // 123456 + PasswordHash: "$2a$10$SKk/Y/Yc925PBtsSYBvq3Ous9Jy18m4KTn6b/PQQ.Y9QVjy3o/Fv.", + LastResetSentAt: types.NowDateTime(), + TokenKey: "test", + } + + // empty pass + err1 := m.SetPassword("") + if err1 == nil { + t.Fatal("Expected empty password error") + } + + err2 := m.SetPassword("654321") + if err2 != nil { + t.Fatalf("Expected nil, got error %v", err2) + } + + if !m.ValidatePassword("654321") { + t.Fatalf("Password is invalid") + } + + if m.TokenKey == "test" { + t.Fatalf("Expected TokenKey to change, got %v", m.TokenKey) + } + + if !m.LastResetSentAt.IsZero() { + t.Fatalf("Expected LastResetSentAt to be zero datetime, got %v", m.LastResetSentAt) + } +} + +func TestAdminRefreshTokenKey(t *testing.T) { + m := models.Admin{TokenKey: "test"} + + m.RefreshTokenKey() + + // empty pass + if m.TokenKey == "" || m.TokenKey == "test" { + t.Fatalf("Expected TokenKey to change, got %q", m.TokenKey) + } +} diff --git a/models/base.go b/models/base.go index 034e81e4f..b4fb8788e 100644 --- a/models/base.go +++ b/models/base.go @@ -2,11 +2,8 @@ package models import ( - "errors" - "github.com/pocketbase/pocketbase/tools/security" "github.com/pocketbase/pocketbase/tools/types" - "golang.org/x/crypto/bcrypt" ) const ( @@ -103,6 +100,9 @@ func (m *BaseModel) GetUpdated() types.DateTime { // // The generated id is a cryptographically random 15 characters length string. func (m *BaseModel) RefreshId() { + if m.Id == "" { // no previous id + m.MarkAsNew() + } m.Id = security.RandomStringWithAlphabet(DefaultIdLength, DefaultIdAlphabet) } @@ -115,57 +115,3 @@ func (m *BaseModel) RefreshCreated() { func (m *BaseModel) RefreshUpdated() { m.Updated = types.NowDateTime() } - -// ------------------------------------------------------------------- -// BaseAccount -// ------------------------------------------------------------------- - -// BaseAccount defines common fields and methods used by auth models (aka. users and admins). -type BaseAccount struct { - BaseModel - - Email string `db:"email" json:"email"` - TokenKey string `db:"tokenKey" json:"-"` - PasswordHash string `db:"passwordHash" json:"-"` - LastResetSentAt types.DateTime `db:"lastResetSentAt" json:"lastResetSentAt"` -} - -// ValidatePassword validates a plain password against the model's password. -func (m *BaseAccount) ValidatePassword(password string) bool { - bytePassword := []byte(password) - bytePasswordHash := []byte(m.PasswordHash) - - // comparing the password with the hash - err := bcrypt.CompareHashAndPassword(bytePasswordHash, bytePassword) - - // nil means it is a match - return err == nil -} - -// SetPassword sets cryptographically secure string to `model.Password`. -// -// Additionally this method also resets the LastResetSentAt and the TokenKey fields. -func (m *BaseAccount) SetPassword(password string) error { - if password == "" { - return errors.New("The provided plain password is empty") - } - - // hash the password - hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), 13) - if err != nil { - return err - } - - m.PasswordHash = string(hashedPassword) - m.LastResetSentAt = types.DateTime{} // reset - - // invalidate previously issued tokens - m.RefreshTokenKey() - - return nil -} - -// RefreshTokenKey generates and sets new random token key. -func (m *BaseAccount) RefreshTokenKey() { - m.TokenKey = security.RandomString(50) -} diff --git a/models/base_test.go b/models/base_test.go index c56e52846..c4091c74a 100644 --- a/models/base_test.go +++ b/models/base_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tools/types" ) func TestBaseModelHasId(t *testing.T) { @@ -65,6 +64,9 @@ func TestBaseModelIsNew(t *testing.T) { m5 := models.BaseModel{Id: "test"} m5.MarkAsNew() m5.UnmarkAsNew() + // check if MarkAsNew will be called on initial RefreshId() + m6 := models.BaseModel{} + m6.RefreshId() scenarios := []struct { model models.BaseModel @@ -76,6 +78,7 @@ func TestBaseModelIsNew(t *testing.T) { {m3, true}, {m4, true}, {m5, false}, + {m6, true}, } for i, s := range scenarios { @@ -113,96 +116,3 @@ func TestBaseModelUpdated(t *testing.T) { t.Fatalf("Expected non-zero datetime, got %v", m.GetUpdated()) } } - -// ------------------------------------------------------------------- -// BaseAccount tests -// ------------------------------------------------------------------- - -func TestBaseAccountValidatePassword(t *testing.T) { - scenarios := []struct { - account models.BaseAccount - password string - expected bool - }{ - { - // empty passwordHash + empty pass - models.BaseAccount{}, - "", - false, - }, - { - // empty passwordHash + nonempty pass - models.BaseAccount{}, - "123456", - false, - }, - { - // nonempty passwordHash + empty pass - models.BaseAccount{PasswordHash: "$2a$10$SKk/Y/Yc925PBtsSYBvq3Ous9Jy18m4KTn6b/PQQ.Y9QVjy3o/Fv."}, - "", - false, - }, - { - // nonempty passwordHash + wrong pass - models.BaseAccount{PasswordHash: "$2a$10$SKk/Y/Yc925PBtsSYBvq3Ous9Jy18m4KTn6b/PQQ.Y9QVjy3o/Fv."}, - "654321", - false, - }, - { - // nonempty passwordHash + correct pass - models.BaseAccount{PasswordHash: "$2a$10$SKk/Y/Yc925PBtsSYBvq3Ous9Jy18m4KTn6b/PQQ.Y9QVjy3o/Fv."}, - "123456", - true, - }, - } - - for i, s := range scenarios { - result := s.account.ValidatePassword(s.password) - if result != s.expected { - t.Errorf("(%d) Expected %v, got %v", i, s.expected, result) - } - } -} - -func TestBaseAccountSetPassword(t *testing.T) { - m := models.BaseAccount{ - // 123456 - PasswordHash: "$2a$10$SKk/Y/Yc925PBtsSYBvq3Ous9Jy18m4KTn6b/PQQ.Y9QVjy3o/Fv.", - LastResetSentAt: types.NowDateTime(), - TokenKey: "test", - } - - // empty pass - err1 := m.SetPassword("") - if err1 == nil { - t.Fatal("Expected empty password error") - } - - err2 := m.SetPassword("654321") - if err2 != nil { - t.Fatalf("Expected nil, got error %v", err2) - } - - if !m.ValidatePassword("654321") { - t.Fatalf("Password is invalid") - } - - if m.TokenKey == "test" { - t.Fatalf("Expected TokenKey to change, got %v", m.TokenKey) - } - - if !m.LastResetSentAt.IsZero() { - t.Fatalf("Expected LastResetSentAt to be zero datetime, got %v", m.LastResetSentAt) - } -} - -func TestBaseAccountRefreshTokenKey(t *testing.T) { - m := models.BaseAccount{TokenKey: "test"} - - m.RefreshTokenKey() - - // empty pass - if m.TokenKey == "" || m.TokenKey == "test" { - t.Fatalf("Expected TokenKey to change, got %q", m.TokenKey) - } -} diff --git a/models/collection.go b/models/collection.go index b90cb4b65..47ecf4a10 100644 --- a/models/collection.go +++ b/models/collection.go @@ -1,23 +1,43 @@ package models -import "github.com/pocketbase/pocketbase/models/schema" +import ( + "encoding/json" -var _ Model = (*Collection)(nil) -var _ FilesManager = (*Collection)(nil) + validation "github.com/go-ozzo/ozzo-validation/v4" + "github.com/go-ozzo/ozzo-validation/v4/is" + "github.com/pocketbase/pocketbase/models/schema" + "github.com/pocketbase/pocketbase/tools/types" +) + +var ( + _ Model = (*Collection)(nil) + _ FilesManager = (*Collection)(nil) +) + +const ( + CollectionTypeBase = "base" + CollectionTypeAuth = "auth" +) type Collection struct { BaseModel - Name string `db:"name" json:"name"` - System bool `db:"system" json:"system"` - Schema schema.Schema `db:"schema" json:"schema"` - ListRule *string `db:"listRule" json:"listRule"` - ViewRule *string `db:"viewRule" json:"viewRule"` - CreateRule *string `db:"createRule" json:"createRule"` - UpdateRule *string `db:"updateRule" json:"updateRule"` - DeleteRule *string `db:"deleteRule" json:"deleteRule"` + Name string `db:"name" json:"name"` + Type string `db:"type" json:"type"` + System bool `db:"system" json:"system"` + Schema schema.Schema `db:"schema" json:"schema"` + + // rules + ListRule *string `db:"listRule" json:"listRule"` + ViewRule *string `db:"viewRule" json:"viewRule"` + CreateRule *string `db:"createRule" json:"createRule"` + UpdateRule *string `db:"updateRule" json:"updateRule"` + DeleteRule *string `db:"deleteRule" json:"deleteRule"` + + Options types.JsonMap `db:"options" json:"options"` } +// TableName returns the Collection model SQL table name. func (m *Collection) TableName() string { return "_collections" } @@ -26,3 +46,141 @@ func (m *Collection) TableName() string { func (m *Collection) BaseFilesPath() string { return m.Id } + +// IsBase checks if the current collection has "base" type. +func (m *Collection) IsBase() bool { + return m.Type == CollectionTypeBase +} + +// IsBase checks if the current collection has "auth" type. +func (m *Collection) IsAuth() bool { + return m.Type == CollectionTypeAuth +} + +// MarshalJSON implements the [json.Marshaler] interface. +func (m Collection) MarshalJSON() ([]byte, error) { + type alias Collection // prevent recursion + + m.NormalizeOptions() + + return json.Marshal(alias(m)) +} + +// BaseOptions decodes the current collection options and returns them +// as new [CollectionBaseOptions] instance. +func (m *Collection) BaseOptions() CollectionBaseOptions { + result := CollectionBaseOptions{} + m.DecodeOptions(&result) + return result +} + +// AuthOptions decodes the current collection options and returns them +// as new [CollectionAuthOptions] instance. +func (m *Collection) AuthOptions() CollectionAuthOptions { + result := CollectionAuthOptions{} + m.DecodeOptions(&result) + return result +} + +// NormalizeOptions updates the current collection options with a +// new normalized state based on the collection type. +func (m *Collection) NormalizeOptions() error { + var typedOptions any + switch m.Type { + case CollectionTypeAuth: + typedOptions = m.AuthOptions() + default: + typedOptions = m.BaseOptions() + } + + // serialize + raw, err := json.Marshal(typedOptions) + if err != nil { + return err + } + + // load into a new JsonMap + m.Options = types.JsonMap{} + if err := json.Unmarshal(raw, &m.Options); err != nil { + return err + } + + return nil +} + +// DecodeOptions decodes the current collection options into the +// provided "result" (must be a pointer). +func (m *Collection) DecodeOptions(result any) error { + // raw serialize + raw, err := json.Marshal(m.Options) + if err != nil { + return err + } + + // decode into the provided result + if err := json.Unmarshal(raw, result); err != nil { + return err + } + + return nil +} + +// SetOptions normalizes and unmarshals the specified options into m.Options. +func (m *Collection) SetOptions(typedOptions any) error { + // serialize + raw, err := json.Marshal(typedOptions) + if err != nil { + return err + } + + m.Options = types.JsonMap{} + if err := json.Unmarshal(raw, &m.Options); err != nil { + return err + } + + return m.NormalizeOptions() +} + +// ------------------------------------------------------------------- + +// CollectionAuthOptions defines the "base" Collection.Options fields. +type CollectionBaseOptions struct { +} + +// Validate implements [validation.Validatable] interface. +func (o CollectionBaseOptions) Validate() error { + return nil +} + +// CollectionAuthOptions defines the "auth" Collection.Options fields. +type CollectionAuthOptions struct { + ManageRule *string `form:"manageRule" json:"manageRule"` + AllowOAuth2Auth bool `form:"allowOAuth2Auth" json:"allowOAuth2Auth"` + AllowUsernameAuth bool `form:"allowUsernameAuth" json:"allowUsernameAuth"` + AllowEmailAuth bool `form:"allowEmailAuth" json:"allowEmailAuth"` + RequireEmail bool `form:"requireEmail" json:"requireEmail"` + ExceptEmailDomains []string `form:"exceptEmailDomains" json:"exceptEmailDomains"` + OnlyEmailDomains []string `form:"onlyEmailDomains" json:"onlyEmailDomains"` + MinPasswordLength int `form:"minPasswordLength" json:"minPasswordLength"` +} + +// Validate implements [validation.Validatable] interface. +func (o CollectionAuthOptions) Validate() error { + return validation.ValidateStruct(&o, + validation.Field(&o.ManageRule, validation.NilOrNotEmpty), + validation.Field( + &o.ExceptEmailDomains, + validation.When(len(o.OnlyEmailDomains) > 0, validation.Empty).Else(validation.Each(is.Domain)), + ), + validation.Field( + &o.OnlyEmailDomains, + validation.When(len(o.ExceptEmailDomains) > 0, validation.Empty).Else(validation.Each(is.Domain)), + ), + validation.Field( + &o.MinPasswordLength, + validation.When(o.AllowUsernameAuth || o.AllowEmailAuth, validation.Required), + validation.Min(5), + validation.Max(72), + ), + ) +} diff --git a/models/collection_test.go b/models/collection_test.go index 16473d019..57a1b9bef 100644 --- a/models/collection_test.go +++ b/models/collection_test.go @@ -1,9 +1,13 @@ package models_test import ( + "encoding/json" "testing" + validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/tools/list" + "github.com/pocketbase/pocketbase/tools/types" ) func TestCollectionTableName(t *testing.T) { @@ -23,3 +27,370 @@ func TestCollectionBaseFilesPath(t *testing.T) { t.Fatalf("Expected path %s, got %s", expected, m.BaseFilesPath()) } } + +func TestCollectionIsBase(t *testing.T) { + scenarios := []struct { + collection models.Collection + expected bool + }{ + {models.Collection{}, false}, + {models.Collection{Type: "unknown"}, false}, + {models.Collection{Type: models.CollectionTypeBase}, true}, + {models.Collection{Type: models.CollectionTypeAuth}, false}, + } + + for i, s := range scenarios { + result := s.collection.IsBase() + if result != s.expected { + t.Errorf("(%d) Expected %v, got %v", i, s.expected, result) + } + } +} + +func TestCollectionIsAuth(t *testing.T) { + scenarios := []struct { + collection models.Collection + expected bool + }{ + {models.Collection{}, false}, + {models.Collection{Type: "unknown"}, false}, + {models.Collection{Type: models.CollectionTypeBase}, false}, + {models.Collection{Type: models.CollectionTypeAuth}, true}, + } + + for i, s := range scenarios { + result := s.collection.IsAuth() + if result != s.expected { + t.Errorf("(%d) Expected %v, got %v", i, s.expected, result) + } + } +} + +func TestCollectionMarshalJSON(t *testing.T) { + scenarios := []struct { + name string + collection models.Collection + expected string + }{ + { + "no type", + models.Collection{Name: "test"}, + `{"id":"","created":"","updated":"","name":"test","type":"","system":false,"schema":[],"listRule":null,"viewRule":null,"createRule":null,"updateRule":null,"deleteRule":null,"options":{}}`, + }, + { + "unknown type + non empty options", + models.Collection{Name: "test", Type: "unknown", ListRule: types.Pointer("test_list"), Options: types.JsonMap{"test": 123}}, + `{"id":"","created":"","updated":"","name":"test","type":"unknown","system":false,"schema":[],"listRule":"test_list","viewRule":null,"createRule":null,"updateRule":null,"deleteRule":null,"options":{}}`, + }, + { + "base type + non empty options", + models.Collection{Name: "test", Type: models.CollectionTypeBase, ListRule: types.Pointer("test_list"), Options: types.JsonMap{"test": 123}}, + `{"id":"","created":"","updated":"","name":"test","type":"base","system":false,"schema":[],"listRule":"test_list","viewRule":null,"createRule":null,"updateRule":null,"deleteRule":null,"options":{}}`, + }, + { + "auth type + non empty options", + models.Collection{BaseModel: models.BaseModel{Id: "test"}, Type: models.CollectionTypeAuth, Options: types.JsonMap{"test": 123, "allowOAuth2Auth": true, "minPasswordLength": 4}}, + `{"id":"test","created":"","updated":"","name":"","type":"auth","system":false,"schema":[],"listRule":null,"viewRule":null,"createRule":null,"updateRule":null,"deleteRule":null,"options":{"allowEmailAuth":false,"allowOAuth2Auth":true,"allowUsernameAuth":false,"exceptEmailDomains":null,"manageRule":null,"minPasswordLength":4,"onlyEmailDomains":null,"requireEmail":false}}`, + }, + } + + for _, s := range scenarios { + result, err := s.collection.MarshalJSON() + if err != nil { + t.Errorf("(%s) Unexpected error %v", s.name, err) + continue + } + if string(result) != s.expected { + t.Errorf("(%s) Expected\n%v \ngot \n%v", s.name, s.expected, string(result)) + } + } +} + +func TestCollectionBaseOptions(t *testing.T) { + scenarios := []struct { + name string + collection models.Collection + expected string + }{ + { + "no type", + models.Collection{Options: types.JsonMap{"test": 123}}, + "{}", + }, + { + "unknown type", + models.Collection{Type: "anything", Options: types.JsonMap{"test": 123}}, + "{}", + }, + { + "different type", + models.Collection{Type: models.CollectionTypeAuth, Options: types.JsonMap{"test": 123, "minPasswordLength": 4}}, + "{}", + }, + { + "base type", + models.Collection{Type: models.CollectionTypeBase, Options: types.JsonMap{"test": 123}}, + "{}", + }, + } + + for _, s := range scenarios { + result := s.collection.BaseOptions() + + encoded, err := json.Marshal(result) + if err != nil { + t.Fatal(err) + } + + if strEncoded := string(encoded); strEncoded != s.expected { + t.Errorf("(%s) Expected \n%v \ngot \n%v", s.name, s.expected, strEncoded) + } + } +} + +func TestCollectionAuthOptions(t *testing.T) { + options := types.JsonMap{"test": 123, "minPasswordLength": 4} + expectedSerialization := `{"manageRule":null,"allowOAuth2Auth":false,"allowUsernameAuth":false,"allowEmailAuth":false,"requireEmail":false,"exceptEmailDomains":null,"onlyEmailDomains":null,"minPasswordLength":4}` + + scenarios := []struct { + name string + collection models.Collection + expected string + }{ + { + "no type", + models.Collection{Options: options}, + expectedSerialization, + }, + { + "unknown type", + models.Collection{Type: "anything", Options: options}, + expectedSerialization, + }, + { + "different type", + models.Collection{Type: models.CollectionTypeBase, Options: options}, + expectedSerialization, + }, + { + "auth type", + models.Collection{Type: models.CollectionTypeAuth, Options: options}, + expectedSerialization, + }, + } + + for _, s := range scenarios { + result := s.collection.AuthOptions() + + encoded, err := json.Marshal(result) + if err != nil { + t.Fatal(err) + } + + if strEncoded := string(encoded); strEncoded != s.expected { + t.Errorf("(%s) Expected \n%v \ngot \n%v", s.name, s.expected, strEncoded) + } + } +} + +func TestNormalizeOptions(t *testing.T) { + scenarios := []struct { + name string + collection models.Collection + expected string // serialized options + }{ + { + "unknown type", + models.Collection{Type: "unknown", Options: types.JsonMap{"test": 123, "minPasswordLength": 4}}, + "{}", + }, + { + "base type", + models.Collection{Type: models.CollectionTypeBase, Options: types.JsonMap{"test": 123, "minPasswordLength": 4}}, + "{}", + }, + { + "auth type", + models.Collection{Type: models.CollectionTypeAuth, Options: types.JsonMap{"test": 123, "minPasswordLength": 4}}, + `{"allowEmailAuth":false,"allowOAuth2Auth":false,"allowUsernameAuth":false,"exceptEmailDomains":null,"manageRule":null,"minPasswordLength":4,"onlyEmailDomains":null,"requireEmail":false}`, + }, + } + + for _, s := range scenarios { + if err := s.collection.NormalizeOptions(); err != nil { + t.Errorf("(%s) Unexpected error %v", s.name, err) + continue + } + + encoded, err := json.Marshal(s.collection.Options) + if err != nil { + t.Fatal(err) + } + + if strEncoded := string(encoded); strEncoded != s.expected { + t.Errorf("(%s) Expected \n%v \ngot \n%v", s.name, s.expected, strEncoded) + } + } +} + +func TestDecodeOptions(t *testing.T) { + m := models.Collection{ + Options: types.JsonMap{"test": 123}, + } + + result := struct { + Test int + }{} + + if err := m.DecodeOptions(&result); err != nil { + t.Fatal(err) + } + + if result.Test != 123 { + t.Fatalf("Expected %v, got %v", 123, result.Test) + } +} + +func TestSetOptions(t *testing.T) { + scenarios := []struct { + name string + collection models.Collection + options any + expected string // serialized options + }{ + { + "no type", + models.Collection{}, + map[string]any{}, + "{}", + }, + { + "unknown type + non empty options", + models.Collection{Type: "unknown", Options: types.JsonMap{"test": 123}}, + map[string]any{"test": 456, "minPasswordLength": 4}, + "{}", + }, + { + "base type", + models.Collection{Type: models.CollectionTypeBase, Options: types.JsonMap{"test": 123}}, + map[string]any{"test": 456, "minPasswordLength": 4}, + "{}", + }, + { + "auth type", + models.Collection{Type: models.CollectionTypeAuth, Options: types.JsonMap{"test": 123}}, + map[string]any{"test": 456, "minPasswordLength": 4}, + `{"allowEmailAuth":false,"allowOAuth2Auth":false,"allowUsernameAuth":false,"exceptEmailDomains":null,"manageRule":null,"minPasswordLength":4,"onlyEmailDomains":null,"requireEmail":false}`, + }, + } + + for _, s := range scenarios { + if err := s.collection.SetOptions(s.options); err != nil { + t.Errorf("(%s) Unexpected error %v", s.name, err) + continue + } + + encoded, err := json.Marshal(s.collection.Options) + if err != nil { + t.Fatal(err) + } + + if strEncoded := string(encoded); strEncoded != s.expected { + t.Errorf("(%s) Expected \n%v \ngot \n%v", s.name, s.expected, strEncoded) + } + } +} + +func TestCollectionBaseOptionsValidate(t *testing.T) { + opt := models.CollectionBaseOptions{} + if err := opt.Validate(); err != nil { + t.Fatal(err) + } +} + +func TestCollectionAuthOptionsValidate(t *testing.T) { + scenarios := []struct { + name string + options models.CollectionAuthOptions + expectedErrors []string + }{ + { + "empty", + models.CollectionAuthOptions{}, + nil, + }, + { + "empty string ManageRule", + models.CollectionAuthOptions{ManageRule: types.Pointer("")}, + []string{"manageRule"}, + }, + { + "minPasswordLength < 5", + models.CollectionAuthOptions{MinPasswordLength: 3}, + []string{"minPasswordLength"}, + }, + { + "minPasswordLength > 72", + models.CollectionAuthOptions{MinPasswordLength: 73}, + []string{"minPasswordLength"}, + }, + { + "both OnlyDomains and ExceptDomains set", + models.CollectionAuthOptions{ + OnlyEmailDomains: []string{"example.com", "test.com"}, + ExceptEmailDomains: []string{"example.com", "test.com"}, + }, + []string{"onlyEmailDomains", "exceptEmailDomains"}, + }, + { + "only OnlyDomains set", + models.CollectionAuthOptions{ + OnlyEmailDomains: []string{"example.com", "test.com"}, + }, + []string{}, + }, + { + "only ExceptEmailDomains set", + models.CollectionAuthOptions{ + ExceptEmailDomains: []string{"example.com", "test.com"}, + }, + []string{}, + }, + { + "all fields with valid data", + models.CollectionAuthOptions{ + ManageRule: types.Pointer("test"), + AllowOAuth2Auth: true, + AllowUsernameAuth: true, + AllowEmailAuth: true, + RequireEmail: true, + ExceptEmailDomains: []string{"example.com", "test.com"}, + OnlyEmailDomains: nil, + MinPasswordLength: 5, + }, + []string{}, + }, + } + + for _, s := range scenarios { + result := s.options.Validate() + + // parse errors + errs, ok := result.(validation.Errors) + if !ok && result != nil { + t.Errorf("(%s) Failed to parse errors %v", s.name, result) + continue + } + + if len(errs) != len(s.expectedErrors) { + t.Errorf("(%s) Expected error keys %v, got errors \n%v", s.name, s.expectedErrors, result) + continue + } + + for key := range errs { + if !list.ExistInSlice(key, s.expectedErrors) { + t.Errorf("(%s) Unexpected error key %q in \n%v", s.name, key, errs) + } + } + } +} diff --git a/models/external_auth.go b/models/external_auth.go index 74399fafe..bf9e0314a 100644 --- a/models/external_auth.go +++ b/models/external_auth.go @@ -5,9 +5,10 @@ var _ Model = (*ExternalAuth)(nil) type ExternalAuth struct { BaseModel - UserId string `db:"userId" json:"userId"` - Provider string `db:"provider" json:"provider"` - ProviderId string `db:"providerId" json:"providerId"` + CollectionId string `db:"collectionId" json:"collectionId"` + RecordId string `db:"recordId" json:"recordId"` + Provider string `db:"provider" json:"provider"` + ProviderId string `db:"providerId" json:"providerId"` } func (m *ExternalAuth) TableName() string { diff --git a/models/record.go b/models/record.go index 787fde9e1..f646d9f30 100644 --- a/models/record.go +++ b/models/record.go @@ -2,28 +2,34 @@ package models import ( "encoding/json" + "errors" "fmt" - "log" - "strings" "time" "github.com/pocketbase/dbx" "github.com/pocketbase/pocketbase/models/schema" "github.com/pocketbase/pocketbase/tools/list" + "github.com/pocketbase/pocketbase/tools/security" "github.com/pocketbase/pocketbase/tools/types" "github.com/spf13/cast" + "golang.org/x/crypto/bcrypt" ) -var _ Model = (*Record)(nil) -var _ ColumnValueMapper = (*Record)(nil) -var _ FilesManager = (*Record)(nil) +var ( + _ Model = (*Record)(nil) + _ ColumnValueMapper = (*Record)(nil) + _ FilesManager = (*Record)(nil) +) type Record struct { BaseModel collection *Collection - data map[string]any - expand map[string]any + + exportUnknown bool // whether to export unknown fields + ignoreEmailVisibility bool // whether to ignore the emailVisibility flag for auth collections + data map[string]any // any custom data in addition to the base model fields + expand map[string]any // expanded relations } // NewRecord initializes a new empty Record model. @@ -34,34 +40,43 @@ func NewRecord(collection *Collection) *Record { } } +// nullStringMapValue returns the raw string value if it exist and +// its not NULL, otherwise - nil. +func nullStringMapValue(data dbx.NullStringMap, key string) any { + nullString, ok := data[key] + + if ok && nullString.Valid { + return nullString.String + } + + return nil +} + // NewRecordFromNullStringMap initializes a single new Record model // with data loaded from the provided NullStringMap. func NewRecordFromNullStringMap(collection *Collection, data dbx.NullStringMap) *Record { resultMap := map[string]any{} + // load schema fields for _, field := range collection.Schema.Fields() { - var rawValue any + resultMap[field.Name] = nullStringMapValue(data, field.Name) + } - nullString, ok := data[field.Name] - if !ok || !nullString.Valid { - rawValue = nil - } else { - rawValue = nullString.String - } + // load base model fields + for _, name := range schema.BaseModelFieldNames() { + resultMap[name] = nullStringMapValue(data, name) + } - resultMap[field.Name] = rawValue + // load auth fields + if collection.IsAuth() { + for _, name := range schema.AuthFieldNames() { + resultMap[name] = nullStringMapValue(data, name) + } } record := NewRecord(collection) - // load base mode fields - resultMap[schema.ReservedFieldNameId] = data[schema.ReservedFieldNameId].String - resultMap[schema.ReservedFieldNameCreated] = data[schema.ReservedFieldNameCreated].String - resultMap[schema.ReservedFieldNameUpdated] = data[schema.ReservedFieldNameUpdated].String - - if err := record.Load(resultMap); err != nil { - log.Println("Failed to unmarshal record:", err) - } + record.Load(resultMap) return record } @@ -88,77 +103,150 @@ func (m *Record) Collection() *Collection { return m.collection } -// GetExpand returns a shallow copy of the optional `expand` data +// Expand returns a shallow copy of the record.expand data // attached to the current Record model. -func (m *Record) GetExpand() map[string]any { +func (m *Record) Expand() map[string]any { return shallowCopy(m.expand) } -// SetExpand assigns the provided data to `record.expand`. -func (m *Record) SetExpand(data map[string]any) { - m.expand = shallowCopy(data) +// SetExpand assigns the provided data to record.expand. +func (m *Record) SetExpand(expand map[string]any) { + m.expand = shallowCopy(expand) } -// Data returns a shallow copy of the currently loaded record's data. -func (m *Record) Data() map[string]any { - return shallowCopy(m.data) +// SchemaData returns a shallow copy ONLY of the defined record schema fields data. +func (m *Record) SchemaData() map[string]any { + result := map[string]any{} + + for _, field := range m.collection.Schema.Fields() { + if v, ok := m.data[field.Name]; ok { + result[field.Name] = v + } + } + + return result } -// SetDataValue sets the provided key-value data pair for the current Record model. +// UnknownData returns a shallow copy ONLY of the unknown record fields data, +// aka. fields that are neither one of the base and special system ones, +// nor defined by the collection schema. +func (m *Record) UnknownData() map[string]any { + return m.extractUnknownData(m.data) +} + +// IgnoreEmailVisibility toggles the flag to ignore the auth record email visibility check. +func (m *Record) IgnoreEmailVisibility(state bool) { + m.ignoreEmailVisibility = state +} + +// WithUnkownData toggles the export/serialization of unknown data fields +// (false by default). +func (m *Record) WithUnkownData(state bool) { + m.exportUnknown = state +} + +// Set sets the provided key-value data pair for the current Record model. // -// This method does nothing if the record doesn't have a `key` field. -func (m *Record) SetDataValue(key string, value any) { - if m.data == nil { - m.data = map[string]any{} - } +// If the record collection has field with name matching the provided "key", +// the value will be further normalized according to the field rules. +func (m *Record) Set(key string, value any) { + switch key { + case schema.FieldNameId: + m.Id = cast.ToString(value) + case schema.FieldNameCreated: + m.Created, _ = types.ParseDateTime(value) + case schema.FieldNameUpdated: + m.Updated, _ = types.ParseDateTime(value) + case schema.FieldNameExpand: + m.SetExpand(cast.ToStringMap(value)) + default: + var v = value + + if field := m.Collection().Schema.GetFieldByName(key); field != nil { + v = field.PrepareValue(value) + } else if m.collection.IsAuth() { + // normalize auth fields + switch key { + case schema.FieldNameEmailVisibility, schema.FieldNameVerified: + v = cast.ToBool(value) + case schema.FieldNameLastResetSentAt, schema.FieldNameLastVerificationSentAt: + v, _ = types.ParseDateTime(value) + case schema.FieldNameUsername, schema.FieldNameEmail, schema.FieldNameTokenKey, schema.FieldNamePasswordHash: + v = cast.ToString(value) + } + } + + if m.data == nil { + m.data = map[string]any{} + } - field := m.Collection().Schema.GetFieldByName(key) - if field != nil { - m.data[key] = field.PrepareValue(value) + m.data[key] = v } } -// GetDataValue returns the current record's data value for `key`. -// -// Returns nil if data value with `key` is not found or set. -func (m *Record) GetDataValue(key string) any { - return m.data[key] +// Get returns a single record model data value for "key". +func (m *Record) Get(key string) any { + switch key { + case schema.FieldNameId: + return m.Id + case schema.FieldNameCreated: + return m.Created + case schema.FieldNameUpdated: + return m.Updated + default: + if v, ok := m.data[key]; ok { + return v + } + + return nil + } } -// GetBoolDataValue returns the data value for `key` as a bool. -func (m *Record) GetBoolDataValue(key string) bool { - return cast.ToBool(m.GetDataValue(key)) +// GetBool returns the data value for "key" as a bool. +func (m *Record) GetBool(key string) bool { + return cast.ToBool(m.Get(key)) } -// GetStringDataValue returns the data value for `key` as a string. -func (m *Record) GetStringDataValue(key string) string { - return cast.ToString(m.GetDataValue(key)) +// GetString returns the data value for "key" as a string. +func (m *Record) GetString(key string) string { + return cast.ToString(m.Get(key)) } -// GetIntDataValue returns the data value for `key` as an int. -func (m *Record) GetIntDataValue(key string) int { - return cast.ToInt(m.GetDataValue(key)) +// GetInt returns the data value for "key" as an int. +func (m *Record) GetInt(key string) int { + return cast.ToInt(m.Get(key)) } -// GetFloatDataValue returns the data value for `key` as a float64. -func (m *Record) GetFloatDataValue(key string) float64 { - return cast.ToFloat64(m.GetDataValue(key)) +// GetFloat returns the data value for "key" as a float64. +func (m *Record) GetFloat(key string) float64 { + return cast.ToFloat64(m.Get(key)) } -// GetTimeDataValue returns the data value for `key` as a [time.Time] instance. -func (m *Record) GetTimeDataValue(key string) time.Time { - return cast.ToTime(m.GetDataValue(key)) +// GetTime returns the data value for "key" as a [time.Time] instance. +func (m *Record) GetTime(key string) time.Time { + return cast.ToTime(m.Get(key)) } -// GetDateTimeDataValue returns the data value for `key` as a DateTime instance. -func (m *Record) GetDateTimeDataValue(key string) types.DateTime { - d, _ := types.ParseDateTime(m.GetDataValue(key)) +// GetDateTime returns the data value for "key" as a DateTime instance. +func (m *Record) GetDateTime(key string) types.DateTime { + d, _ := types.ParseDateTime(m.Get(key)) return d } -// GetStringSliceDataValue returns the data value for `key` as a slice of unique strings. -func (m *Record) GetStringSliceDataValue(key string) []string { - return list.ToUniqueStringSlice(m.GetDataValue(key)) +// GetStringSlice returns the data value for "key" as a slice of unique strings. +func (m *Record) GetStringSlice(key string) []string { + return list.ToUniqueStringSlice(m.Get(key)) +} + +// Retrieves the "key" json field value and unmarshals it into "result". +// +// Example +// result := struct { +// FirstName string `json:"first_name"` +// }{} +// err := m.UnmarshalJSONField("my_field_name", &result) +func (m *Record) UnmarshalJSONField(key string, result any) error { + return json.Unmarshal([]byte(m.GetString(key)), &result) } // BaseFilesPath returns the storage dir path used by the record. @@ -171,7 +259,7 @@ func (m *Record) BaseFilesPath() string { func (m *Record) FindFileFieldByFile(filename string) *schema.SchemaField { for _, field := range m.Collection().Schema.Fields() { if field.Type == schema.FieldTypeFile { - names := m.GetStringSliceDataValue(field.Name) + names := m.GetStringSlice(field.Name) if list.ExistInSlice(filename, names) { return field } @@ -181,63 +269,76 @@ func (m *Record) FindFileFieldByFile(filename string) *schema.SchemaField { } // Load bulk loads the provided data into the current Record model. -func (m *Record) Load(data map[string]any) error { - if data[schema.ReservedFieldNameId] != nil { - id, err := cast.ToStringE(data[schema.ReservedFieldNameId]) - if err != nil { - return err - } - m.Id = id - } - - if data[schema.ReservedFieldNameCreated] != nil { - m.Created, _ = types.ParseDateTime(data[schema.ReservedFieldNameCreated]) - } - - if data[schema.ReservedFieldNameUpdated] != nil { - m.Updated, _ = types.ParseDateTime(data[schema.ReservedFieldNameUpdated]) - } - +func (m *Record) Load(data map[string]any) { for k, v := range data { - m.SetDataValue(k, v) + m.Set(k, v) } - - return nil } // ColumnValueMap implements [ColumnValueMapper] interface. func (m *Record) ColumnValueMap() map[string]any { result := map[string]any{} - for key := range m.data { - result[key] = m.normalizeDataValueForDB(key) + + // export schema field values + for _, field := range m.collection.Schema.Fields() { + result[field.Name] = m.getNormalizeDataValueForDB(field.Name) } - // set base model fields - result[schema.ReservedFieldNameId] = m.Id - result[schema.ReservedFieldNameCreated] = m.Created - result[schema.ReservedFieldNameUpdated] = m.Updated + // export auth collection fields + if m.collection.IsAuth() { + for _, name := range schema.AuthFieldNames() { + result[name] = m.getNormalizeDataValueForDB(name) + } + } + + // export base model fields + result[schema.FieldNameId] = m.getNormalizeDataValueForDB(schema.FieldNameId) + result[schema.FieldNameCreated] = m.getNormalizeDataValueForDB(schema.FieldNameCreated) + result[schema.FieldNameUpdated] = m.getNormalizeDataValueForDB(schema.FieldNameUpdated) return result } // PublicExport exports only the record fields that are safe to be public. // -// This method also skips the "hidden" fields, aka. fields prefixed with `#`. +// Fields marked as hidden will be exported only if `m.IgnoreEmailVisibility(true)` is set. func (m *Record) PublicExport() map[string]any { - result := skipHiddenFields(m.data) + result := map[string]any{} + + // export unknown data fields if allowed + if m.exportUnknown { + for k, v := range m.UnknownData() { + result[k] = v + } + } + + // export schema field values + for _, field := range m.collection.Schema.Fields() { + result[field.Name] = m.Get(field.Name) + } + + // export some of the safe auth collection fields + if m.collection.IsAuth() { + result[schema.FieldNameVerified] = m.Verified() + result[schema.FieldNameUsername] = m.Username() + result[schema.FieldNameEmailVisibility] = m.EmailVisibility() + if m.ignoreEmailVisibility || m.EmailVisibility() { + result[schema.FieldNameEmail] = m.Email() + } + } - // set base model fields - result[schema.ReservedFieldNameId] = m.Id - result[schema.ReservedFieldNameCreated] = m.Created - result[schema.ReservedFieldNameUpdated] = m.Updated + // export base model fields + result[schema.FieldNameId] = m.GetId() + result[schema.FieldNameCreated] = m.GetCreated() + result[schema.FieldNameUpdated] = m.GetUpdated() - // add helper collection fields - result["@collectionId"] = m.collection.Id - result["@collectionName"] = m.collection.Name + // add helper collection reference fields + result[schema.FieldNameCollectionId] = m.collection.Id + result[schema.FieldNameCollectionName] = m.collection.Name // add expand (if set) if m.expand != nil { - result["@expand"] = m.expand + result[schema.FieldNameExpand] = m.expand } return result @@ -258,19 +359,41 @@ func (m *Record) UnmarshalJSON(data []byte) error { return err } - return m.Load(result) + m.Load(result) + + return nil } -// normalizeDataValueForDB returns the `key` data value formatted for db storage. -func (m *Record) normalizeDataValueForDB(key string) any { - val := m.GetDataValue(key) +// getNormalizeDataValueForDB returns the "key" data value formatted for db storage. +func (m *Record) getNormalizeDataValueForDB(key string) any { + var val any + + // normalize auth fields + if m.collection.IsAuth() { + switch key { + case schema.FieldNameEmailVisibility, schema.FieldNameVerified: + return m.GetBool(key) + case schema.FieldNameLastResetSentAt, schema.FieldNameLastVerificationSentAt: + return m.GetDateTime(key) + case schema.FieldNameUsername, schema.FieldNameEmail, schema.FieldNameTokenKey, schema.FieldNamePasswordHash: + return m.GetString(key) + } + } + + val = m.Get(key) switch ids := val.(type) { case []string: - // encode strings slice + // encode string slice + return append(types.JsonArray{}, list.ToInterfaceSlice(ids)...) + case []int: + // encode int slice + return append(types.JsonArray{}, list.ToInterfaceSlice(ids)...) + case []float64: + // encode float64 slice return append(types.JsonArray{}, list.ToInterfaceSlice(ids)...) case []any: - // encode interfaces slice + // encode interface slice return append(types.JsonArray{}, ids...) default: // no changes @@ -289,17 +412,218 @@ func shallowCopy(data map[string]any) map[string]any { return result } -// skipHiddenFields returns a new data map without the "#" prefixed fields. -func skipHiddenFields(data map[string]any) map[string]any { +func (m *Record) extractUnknownData(data map[string]any) map[string]any { + knownFields := map[string]struct{}{} + + for _, name := range schema.SystemFieldNames() { + knownFields[name] = struct{}{} + } + for _, name := range schema.BaseModelFieldNames() { + knownFields[name] = struct{}{} + } + + for _, f := range m.collection.Schema.Fields() { + knownFields[f.Name] = struct{}{} + } + + if m.collection.IsAuth() { + for _, name := range schema.AuthFieldNames() { + knownFields[name] = struct{}{} + } + } + result := map[string]any{} - for key, val := range data { - // ignore "#" prefixed fields - if strings.HasPrefix(key, "#") { - continue + for k, v := range m.data { + if _, ok := knownFields[k]; !ok { + result[k] = v } - result[key] = val } return result } + +// ------------------------------------------------------------------- +// Auth helpers +// ------------------------------------------------------------------- + +var notAuthRecordErr = errors.New("Not an auth collection record.") + +// Username returns the "username" auth record data value. +func (m *Record) Username() string { + return m.GetString(schema.FieldNameUsername) +} + +// SetUsername sets the "username" auth record data value. +// +// This method doesn't check whether the provided value is a valid username. +// +// Returns an error if the record is not from an auth collection. +func (m *Record) SetUsername(username string) error { + if !m.collection.IsAuth() { + return notAuthRecordErr + } + + m.Set(schema.FieldNameUsername, username) + + return nil +} + +// Email returns the "email" auth record data value. +func (m *Record) Email() string { + return m.GetString(schema.FieldNameEmail) +} + +// SetEmail sets the "email" auth record data value. +// +// This method doesn't check whether the provided value is a valid email. +// +// Returns an error if the record is not from an auth collection. +func (m *Record) SetEmail(email string) error { + if !m.collection.IsAuth() { + return notAuthRecordErr + } + + m.Set(schema.FieldNameEmail, email) + + return nil +} + +// Verified returns the "emailVisibility" auth record data value. +func (m *Record) EmailVisibility() bool { + return m.GetBool(schema.FieldNameEmailVisibility) +} + +// SetEmailVisibility sets the "emailVisibility" auth record data value. +// +// Returns an error if the record is not from an auth collection. +func (m *Record) SetEmailVisibility(visible bool) error { + if !m.collection.IsAuth() { + return notAuthRecordErr + } + + m.Set(schema.FieldNameEmailVisibility, visible) + + return nil +} + +// Verified returns the "verified" auth record data value. +func (m *Record) Verified() bool { + return m.GetBool(schema.FieldNameVerified) +} + +// SetVerified sets the "verified" auth record data value. +// +// Returns an error if the record is not from an auth collection. +func (m *Record) SetVerified(verified bool) error { + if !m.collection.IsAuth() { + return notAuthRecordErr + } + + m.Set(schema.FieldNameVerified, verified) + + return nil +} + +// TokenKey returns the "tokenKey" auth record data value. +func (m *Record) TokenKey() string { + return m.GetString(schema.FieldNameTokenKey) +} + +// SetTokenKey sets the "tokenKey" auth record data value. +// +// Returns an error if the record is not from an auth collection. +func (m *Record) SetTokenKey(key string) error { + if !m.collection.IsAuth() { + return notAuthRecordErr + } + + m.Set(schema.FieldNameTokenKey, key) + + return nil +} + +// RefreshTokenKey generates and sets new random auth record "tokenKey". +// +// Returns an error if the record is not from an auth collection. +func (m *Record) RefreshTokenKey() error { + return m.SetTokenKey(security.RandomString(50)) +} + +// LastResetSentAt returns the "lastResentSentAt" auth record data value. +func (m *Record) LastResetSentAt() types.DateTime { + return m.GetDateTime(schema.FieldNameLastResetSentAt) +} + +// SetLastResetSentAt sets the "lastResentSentAt" auth record data value. +// +// Returns an error if the record is not from an auth collection. +func (m *Record) SetLastResetSentAt(dateTime types.DateTime) error { + if !m.collection.IsAuth() { + return notAuthRecordErr + } + + m.Set(schema.FieldNameLastResetSentAt, dateTime) + + return nil +} + +// LastVerificationSentAt returns the "lastVerificationSentAt" auth record data value. +func (m *Record) LastVerificationSentAt() types.DateTime { + return m.GetDateTime(schema.FieldNameLastVerificationSentAt) +} + +// SetLastVerificationSentAt sets an "lastVerificationSentAt" auth record data value. +// +// Returns an error if the record is not from an auth collection. +func (m *Record) SetLastVerificationSentAt(dateTime types.DateTime) error { + if !m.collection.IsAuth() { + return notAuthRecordErr + } + + m.Set(schema.FieldNameLastVerificationSentAt, dateTime) + + return nil +} + +// ValidatePassword validates a plain password against the auth record password. +// +// Returns false if the password is incorrect or record is not from an auth collection. +func (m *Record) ValidatePassword(password string) bool { + if !m.collection.IsAuth() { + return false + } + + err := bcrypt.CompareHashAndPassword( + []byte(m.GetString(schema.FieldNamePasswordHash)), + []byte(password), + ) + return err == nil +} + +// SetPassword sets cryptographically secure string to the auth record "password" field. +// This method also resets the "lastResetSentAt" and the "tokenKey" fields. +// +// Returns an error if the record is not from an auth collection or +// an empty password is provided. +func (m *Record) SetPassword(password string) error { + if !m.collection.IsAuth() { + return notAuthRecordErr + } + + if password == "" { + return errors.New("The provided plain password is empty") + } + + // hash the password + hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), 13) + if err != nil { + return err + } + + m.Set(schema.FieldNamePasswordHash, string(hashedPassword)) + m.Set(schema.FieldNameLastResetSentAt, types.DateTime{}) + + // invalidate previously issued tokens + return m.RefreshTokenKey() +} diff --git a/models/record_test.go b/models/record_test.go index 68d57279b..790594811 100644 --- a/models/record_test.go +++ b/models/record_test.go @@ -15,6 +15,7 @@ import ( func TestNewRecord(t *testing.T) { collection := &models.Collection{ + Name: "test_collection", Schema: schema.NewSchema( &schema.SchemaField{ Name: "test", @@ -25,12 +26,12 @@ func TestNewRecord(t *testing.T) { m := models.NewRecord(collection) - if m.Collection().Id != collection.Id { - t.Fatalf("Expected collection with id %v, got %v", collection.Id, m.Collection().Id) + if m.Collection().Name != collection.Name { + t.Fatalf("Expected collection with name %q, got %q", collection.Id, m.Collection().Id) } - if len(m.Data()) != 0 { - t.Fatalf("Expected empty data, got %v", m.Data()) + if len(m.SchemaData()) != 0 { + t.Fatalf("Expected empty schema data, got %v", m.SchemaData()) } } @@ -75,17 +76,51 @@ func TestNewRecordFromNullStringMap(t *testing.T) { data := dbx.NullStringMap{ "id": sql.NullString{ - String: "c23eb053-d07e-4fbe-86b3-b8ac31982e9a", + String: "test_id", Valid: true, }, "created": sql.NullString{ - String: "2022-01-01 10:00:00.123", + String: "2022-01-01 10:00:00.123Z", Valid: true, }, "updated": sql.NullString{ - String: "2022-01-01 10:00:00.456", + String: "2022-01-01 10:00:00.456Z", + Valid: true, + }, + // auth collection specific fields + "username": sql.NullString{ + String: "test_username", + Valid: true, + }, + "email": sql.NullString{ + String: "test_email", + Valid: true, + }, + "emailVisibility": sql.NullString{ + String: "true", + Valid: true, + }, + "verified": sql.NullString{ + String: "", + Valid: false, + }, + "tokenKey": sql.NullString{ + String: "test_tokenKey", + Valid: true, + }, + "passwordHash": sql.NullString{ + String: "test_passwordHash", + Valid: true, + }, + "lastResetSentAt": sql.NullString{ + String: "2022-01-02 10:00:00.123Z", Valid: true, }, + "lastVerificationSentAt": sql.NullString{ + String: "2022-02-03 10:00:00.456Z", + Valid: true, + }, + // custom schema fields "field1": sql.NullString{ String: "test", Valid: true, @@ -110,18 +145,56 @@ func TestNewRecordFromNullStringMap(t *testing.T) { String: "test", // will be converted to slice Valid: true, }, + "unknown": sql.NullString{ + String: "test", + Valid: true, + }, } - m := models.NewRecordFromNullStringMap(collection, data) - encoded, err := m.MarshalJSON() - if err != nil { - t.Fatal(err) + scenarios := []struct { + collectionType string + expectedJson string + }{ + { + models.CollectionTypeBase, + `{"collectionId":"","collectionName":"test","created":"2022-01-01 10:00:00.123Z","field1":"test","field2":"","field3":true,"field4":123.123,"field5":"test1","field6":["test"],"id":"test_id","updated":"2022-01-01 10:00:00.456Z"}`, + }, + { + models.CollectionTypeAuth, + `{"collectionId":"","collectionName":"test","created":"2022-01-01 10:00:00.123Z","email":"test_email","emailVisibility":true,"field1":"test","field2":"","field3":true,"field4":123.123,"field5":"test1","field6":["test"],"id":"test_id","updated":"2022-01-01 10:00:00.456Z","username":"test_username","verified":false}`, + }, } - expected := `{"@collectionId":"","@collectionName":"test","created":"2022-01-01 10:00:00.123","field1":"test","field2":"","field3":true,"field4":123.123,"field5":"test1","field6":["test"],"id":"c23eb053-d07e-4fbe-86b3-b8ac31982e9a","updated":"2022-01-01 10:00:00.456"}` + for i, s := range scenarios { + collection.Type = s.collectionType + m := models.NewRecordFromNullStringMap(collection, data) + m.IgnoreEmailVisibility(true) - if string(encoded) != expected { - t.Fatalf("Expected %v, got \n%v", expected, string(encoded)) + encoded, err := m.MarshalJSON() + if err != nil { + t.Errorf("(%d) Unexpected error: %v", i, err) + continue + } + + if string(encoded) != s.expectedJson { + t.Errorf("(%d) Expected \n%v \ngot \n%v", i, s.expectedJson, string(encoded)) + } + + // additional data checks + if collection.IsAuth() { + if v := m.GetString(schema.FieldNamePasswordHash); v != "test_passwordHash" { + t.Errorf("(%d) Expected %q, got %q", i, "test_passwordHash", v) + } + if v := m.GetString(schema.FieldNameTokenKey); v != "test_tokenKey" { + t.Errorf("(%d) Expected %q, got %q", i, "test_tokenKey", v) + } + if v := m.GetString(schema.FieldNameLastResetSentAt); v != "2022-01-02 10:00:00.123Z" { + t.Errorf("(%d) Expected %q, got %q", i, "2022-01-02 10:00:00.123Z", v) + } + if v := m.GetString(schema.FieldNameLastVerificationSentAt); v != "2022-02-03 10:00:00.456Z" { + t.Errorf("(%d) Expected %q, got %q", i, "2022-01-02 10:00:00.123Z", v) + } + } } } @@ -137,81 +210,124 @@ func TestNewRecordsFromNullStringMaps(t *testing.T) { Name: "field2", Type: schema.FieldTypeNumber, }, + &schema.SchemaField{ + Name: "field3", + Type: schema.FieldTypeUrl, + }, ), } data := []dbx.NullStringMap{ { "id": sql.NullString{ - String: "11111111-d07e-4fbe-86b3-b8ac31982e9a", + String: "test_id1", Valid: true, }, "created": sql.NullString{ - String: "2022-01-01 10:00:00.123", + String: "2022-01-01 10:00:00.123Z", Valid: true, }, "updated": sql.NullString{ - String: "2022-01-01 10:00:00.456", + String: "2022-01-01 10:00:00.456Z", + Valid: true, + }, + // partial auth fields + "email": sql.NullString{ + String: "test_email", + Valid: true, + }, + "tokenKey": sql.NullString{ + String: "test_tokenKey", + Valid: true, + }, + "emailVisibility": sql.NullString{ + String: "true", Valid: true, }, + // custom schema fields "field1": sql.NullString{ - String: "test1", + String: "test", Valid: true, }, "field2": sql.NullString{ - String: "123", - Valid: false, // test invalid db serialization + String: "123.123", + Valid: true, + }, + "field3": sql.NullString{ + String: "test", + Valid: false, // should force resolving to empty string + }, + "unknown": sql.NullString{ + String: "test", + Valid: true, }, }, { - "id": sql.NullString{ - String: "22222222-d07e-4fbe-86b3-b8ac31982e9a", + "field3": sql.NullString{ + String: "test", Valid: true, }, - "field1": sql.NullString{ - String: "test2", + "email": sql.NullString{ + String: "test_email", Valid: true, }, - "field2": sql.NullString{ - String: "123", + "emailVisibility": sql.NullString{ + String: "false", Valid: true, }, }, } - result := models.NewRecordsFromNullStringMaps(collection, data) - encoded, err := json.Marshal(result) - if err != nil { - t.Fatal(err) + scenarios := []struct { + collectionType string + expectedJson string + }{ + { + models.CollectionTypeBase, + `[{"collectionId":"","collectionName":"test","created":"2022-01-01 10:00:00.123Z","field1":"test","field2":123.123,"field3":"","id":"test_id1","updated":"2022-01-01 10:00:00.456Z"},{"collectionId":"","collectionName":"test","created":"","field1":"","field2":0,"field3":"test","id":"","updated":""}]`, + }, + { + models.CollectionTypeAuth, + `[{"collectionId":"","collectionName":"test","created":"2022-01-01 10:00:00.123Z","email":"test_email","emailVisibility":true,"field1":"test","field2":123.123,"field3":"","id":"test_id1","updated":"2022-01-01 10:00:00.456Z","username":"","verified":false},{"collectionId":"","collectionName":"test","created":"","emailVisibility":false,"field1":"","field2":0,"field3":"test","id":"","updated":"","username":"","verified":false}]`, + }, } - expected := `[{"@collectionId":"","@collectionName":"test","created":"2022-01-01 10:00:00.123","field1":"test1","field2":0,"id":"11111111-d07e-4fbe-86b3-b8ac31982e9a","updated":"2022-01-01 10:00:00.456"},{"@collectionId":"","@collectionName":"test","created":"","field1":"test2","field2":123,"id":"22222222-d07e-4fbe-86b3-b8ac31982e9a","updated":""}]` + for i, s := range scenarios { + collection.Type = s.collectionType + result := models.NewRecordsFromNullStringMaps(collection, data) + + encoded, err := json.Marshal(result) + if err != nil { + t.Errorf("(%d) Unexpected error: %v", i, err) + continue + } - if string(encoded) != expected { - t.Fatalf("Expected \n%v, got \n%v", expected, string(encoded)) + if string(encoded) != s.expectedJson { + t.Errorf("(%d) Expected \n%v \ngot \n%v", i, s.expectedJson, string(encoded)) + } } } -func TestRecordCollection(t *testing.T) { +func TestRecordTableName(t *testing.T) { collection := &models.Collection{} + collection.Name = "test" collection.RefreshId() m := models.NewRecord(collection) - if m.Collection().Id != collection.Id { - t.Fatalf("Expected collection with id %v, got %v", collection.Id, m.Collection().Id) + if m.TableName() != collection.Name { + t.Fatalf("Expected table %q, got %q", collection.Name, m.TableName()) } } -func TestRecordTableName(t *testing.T) { +func TestRecordCollection(t *testing.T) { collection := &models.Collection{} - collection.Name = "test" collection.RefreshId() m := models.NewRecord(collection) - if m.TableName() != collection.Name { - t.Fatalf("Expected table %q, got %q", collection.Name, m.TableName()) + if m.Collection().Id != collection.Id { + t.Fatalf("Expected collection with id %v, got %v", collection.Id, m.Collection().Id) } } @@ -226,80 +342,131 @@ func TestRecordExpand(t *testing.T) { // change the original data to check if it was shallow copied data["test"] = 456 - expand := m.GetExpand() + expand := m.Expand() if v, ok := expand["test"]; !ok || v != 123 { t.Fatalf("Expected expand.test to be %v, got %v", 123, v) } } -func TestRecordLoadAndData(t *testing.T) { +func TestRecordSchemaData(t *testing.T) { collection := &models.Collection{ + Type: models.CollectionTypeAuth, Schema: schema.NewSchema( &schema.SchemaField{ - Name: "field", + Name: "field1", Type: schema.FieldTypeText, }, + &schema.SchemaField{ + Name: "field2", + Type: schema.FieldTypeNumber, + }, ), } + m := models.NewRecord(collection) + m.Set("email", "test@example.com") + m.Set("field1", 123) + m.Set("field2", 456) + m.Set("unknown", 789) - data := map[string]any{ - "id": "11111111-d07e-4fbe-86b3-b8ac31982e9a", - "created": "2022-01-01 10:00:00.123", - "updated": "2022-01-01 10:00:00.456", - "field": "test", - "unknown": "test", + encoded, err := json.Marshal(m.SchemaData()) + if err != nil { + t.Fatal(err) } - m.Load(data) - - // change some of original data fields to check if they were shallow copied - data["id"] = "22222222-d07e-4fbe-86b3-b8ac31982e9a" - data["field"] = "new_test" - - expectedData := `{"field":"test"}` - encodedData, _ := json.Marshal(m.Data()) - if string(encodedData) != expectedData { - t.Fatalf("Expected data %v, got \n%v", expectedData, string(encodedData)) - } + expected := `{"field1":"123","field2":456}` - expectedModel := `{"@collectionId":"","@collectionName":"","created":"2022-01-01 10:00:00.123","field":"test","id":"11111111-d07e-4fbe-86b3-b8ac31982e9a","updated":"2022-01-01 10:00:00.456"}` - encodedModel, _ := json.Marshal(m) - if string(encodedModel) != expectedModel { - t.Fatalf("Expected model %v, got \n%v", expectedModel, string(encodedModel)) + if v := string(encoded); v != expected { + t.Fatalf("Expected \n%v \ngot \n%v", v, expected) } } -func TestRecordSetDataValue(t *testing.T) { +func TestRecordUnknownData(t *testing.T) { collection := &models.Collection{ Schema: schema.NewSchema( &schema.SchemaField{ - Name: "field", + Name: "field1", Type: schema.FieldTypeText, }, + &schema.SchemaField{ + Name: "field2", + Type: schema.FieldTypeNumber, + }, ), } - m := models.NewRecord(collection) - m.SetDataValue("unknown", 123) - m.SetDataValue("field", 123) // test whether PrepareValue will be called and casted to string + data := map[string]any{ + "id": "test_id", + "created": "2022-01-01 00:00:00.000", + "updated": "2022-01-01 00:00:00.000", + "collectionId": "test_collectionId", + "collectionName": "test_collectionName", + "expand": "test_expand", + "field1": "test_field1", + "field2": "test_field1", + "unknown1": "test_unknown1", + "unknown2": "test_unknown2", + "passwordHash": "test_passwordHash", + "username": "test_username", + "emailVisibility": true, + "email": "test_email", + "verified": true, + "tokenKey": "test_tokenKey", + "lastResetSentAt": "2022-01-01 00:00:00.000", + "lastVerificationSentAt": "2022-01-01 00:00:00.000", + } - data := m.Data() - if len(data) != 1 { - t.Fatalf("Expected only 1 data field to be set, got %v", data) + scenarios := []struct { + collectionType string + expectedKeys []string + }{ + { + models.CollectionTypeBase, + []string{ + "unknown1", + "unknown2", + "passwordHash", + "username", + "emailVisibility", + "email", + "verified", + "tokenKey", + "lastResetSentAt", + "lastVerificationSentAt", + }, + }, + { + models.CollectionTypeAuth, + []string{"unknown1", "unknown2"}, + }, } - if v, ok := data["field"]; !ok || v != "123" { - t.Fatalf("Expected field to be %v, got %v", "123", v) + for i, s := range scenarios { + collection.Type = s.collectionType + m := models.NewRecord(collection) + m.Load(data) + + result := m.UnknownData() + + if len(result) != len(s.expectedKeys) { + t.Errorf("(%d) Expected data \n%v \ngot \n%v", i, s.expectedKeys, result) + continue + } + + for _, key := range s.expectedKeys { + if _, ok := result[key]; !ok { + t.Errorf("(%d) Missing expected key %q in \n%v", i, key, result) + } + } } } -func TestRecordGetDataValue(t *testing.T) { +func TestRecordSetAndGet(t *testing.T) { collection := &models.Collection{ Schema: schema.NewSchema( &schema.SchemaField{ Name: "field1", - Type: schema.FieldTypeNumber, + Type: schema.FieldTypeText, }, &schema.SchemaField{ Name: "field2", @@ -307,30 +474,46 @@ func TestRecordGetDataValue(t *testing.T) { }, ), } + m := models.NewRecord(collection) + m.Set("id", "test_id") + m.Set("created", "2022-09-15 00:00:00.123Z") + m.Set("updated", "invalid") + m.Set("field1", 123) // should be casted to string + m.Set("field2", "invlaid") // should be casted to zero-number + m.Set("unknown", 456) // undefined fields are allowed but not exported by default + m.Set("expand", map[string]any{"test": 123}) // should store the value in m.expand + + if m.Get("id") != "test_id" { + t.Fatalf("Expected id %q, got %q", "test_id", m.Get("id")) + } + + if m.GetString("created") != "2022-09-15 00:00:00.123Z" { + t.Fatalf("Expected created %q, got %q", "2022-09-15 00:00:00.123Z", m.GetString("created")) + } - m.SetDataValue("field2", 123) + if m.GetString("updated") != "" { + t.Fatalf("Expected updated to be empty, got %q", m.GetString("updated")) + } + + if m.Get("field1") != "123" { + t.Fatalf("Expected field1 %q, got %v", "123", m.Get("field1")) + } - // missing - v0 := m.GetDataValue("missing") - if v0 != nil { - t.Fatalf("Unexpected value for key 'missing'") + if m.Get("field2") != 0.0 { + t.Fatalf("Expected field2 %v, got %v", 0.0, m.Get("field2")) } - // existing - not set - v1 := m.GetDataValue("field1") - if v1 != nil { - t.Fatalf("Unexpected value for key 'field1'") + if m.Get("unknown") != 456 { + t.Fatalf("Expected unknown %v, got %v", 456, m.Get("unknown")) } - // existing - set - v2 := m.GetDataValue("field2") - if v2 != 123.0 { - t.Fatalf("Expected 123.0, got %v", v2) + if m.Expand()["test"] != 123 { + t.Fatalf("Expected expand to be %v, got %v", map[string]any{"test": 123}, m.Expand()) } } -func TestRecordGetBoolDataValue(t *testing.T) { +func TestRecordGetBool(t *testing.T) { scenarios := []struct { value any expected bool @@ -348,24 +531,20 @@ func TestRecordGetBoolDataValue(t *testing.T) { {true, true}, } - collection := &models.Collection{ - Schema: schema.NewSchema( - &schema.SchemaField{Name: "test"}, - ), - } + collection := &models.Collection{} for i, s := range scenarios { m := models.NewRecord(collection) - m.SetDataValue("test", s.value) + m.Set("test", s.value) - result := m.GetBoolDataValue("test") + result := m.GetBool("test") if result != s.expected { t.Errorf("(%d) Expected %v, got %v", i, s.expected, result) } } } -func TestRecordGetStringDataValue(t *testing.T) { +func TestRecordGetString(t *testing.T) { scenarios := []struct { value any expected string @@ -382,24 +561,20 @@ func TestRecordGetStringDataValue(t *testing.T) { {true, "true"}, } - collection := &models.Collection{ - Schema: schema.NewSchema( - &schema.SchemaField{Name: "test"}, - ), - } + collection := &models.Collection{} for i, s := range scenarios { m := models.NewRecord(collection) - m.SetDataValue("test", s.value) + m.Set("test", s.value) - result := m.GetStringDataValue("test") + result := m.GetString("test") if result != s.expected { t.Errorf("(%d) Expected %v, got %v", i, s.expected, result) } } } -func TestRecordGetIntDataValue(t *testing.T) { +func TestRecordGetInt(t *testing.T) { scenarios := []struct { value any expected int @@ -418,24 +593,20 @@ func TestRecordGetIntDataValue(t *testing.T) { {true, 1}, } - collection := &models.Collection{ - Schema: schema.NewSchema( - &schema.SchemaField{Name: "test"}, - ), - } + collection := &models.Collection{} for i, s := range scenarios { m := models.NewRecord(collection) - m.SetDataValue("test", s.value) + m.Set("test", s.value) - result := m.GetIntDataValue("test") + result := m.GetInt("test") if result != s.expected { t.Errorf("(%d) Expected %v, got %v", i, s.expected, result) } } } -func TestRecordGetFloatDataValue(t *testing.T) { +func TestRecordGetFloat(t *testing.T) { scenarios := []struct { value any expected float64 @@ -454,26 +625,22 @@ func TestRecordGetFloatDataValue(t *testing.T) { {true, 1}, } - collection := &models.Collection{ - Schema: schema.NewSchema( - &schema.SchemaField{Name: "test"}, - ), - } + collection := &models.Collection{} for i, s := range scenarios { m := models.NewRecord(collection) - m.SetDataValue("test", s.value) + m.Set("test", s.value) - result := m.GetFloatDataValue("test") + result := m.GetFloat("test") if result != s.expected { t.Errorf("(%d) Expected %v, got %v", i, s.expected, result) } } } -func TestRecordGetTimeDataValue(t *testing.T) { +func TestRecordGetTime(t *testing.T) { nowTime := time.Now() - testTime, _ := time.Parse(types.DefaultDateLayout, "2022-01-01 08:00:40.000") + testTime, _ := time.Parse(types.DefaultDateLayout, "2022-01-01 08:00:40.000Z") scenarios := []struct { value any @@ -491,26 +658,22 @@ func TestRecordGetTimeDataValue(t *testing.T) { {nowTime, nowTime}, } - collection := &models.Collection{ - Schema: schema.NewSchema( - &schema.SchemaField{Name: "test"}, - ), - } + collection := &models.Collection{} for i, s := range scenarios { m := models.NewRecord(collection) - m.SetDataValue("test", s.value) + m.Set("test", s.value) - result := m.GetTimeDataValue("test") + result := m.GetTime("test") if !result.Equal(s.expected) { t.Errorf("(%d) Expected %v, got %v", i, s.expected, result) } } } -func TestRecordGetDateTimeDataValue(t *testing.T) { +func TestRecordGetDateTime(t *testing.T) { nowTime := time.Now() - testTime, _ := time.Parse(types.DefaultDateLayout, "2022-01-01 08:00:40.000") + testTime, _ := time.Parse(types.DefaultDateLayout, "2022-01-01 08:00:40.000Z") scenarios := []struct { value any @@ -528,24 +691,20 @@ func TestRecordGetDateTimeDataValue(t *testing.T) { {nowTime, nowTime}, } - collection := &models.Collection{ - Schema: schema.NewSchema( - &schema.SchemaField{Name: "test"}, - ), - } + collection := &models.Collection{} for i, s := range scenarios { m := models.NewRecord(collection) - m.SetDataValue("test", s.value) + m.Set("test", s.value) - result := m.GetDateTimeDataValue("test") + result := m.GetDateTime("test") if !result.Time().Equal(s.expected) { t.Errorf("(%d) Expected %v, got %v", i, s.expected, result) } } } -func TestRecordGetStringSliceDataValue(t *testing.T) { +func TestRecordGetStringSlice(t *testing.T) { nowTime := time.Now() scenarios := []struct { @@ -565,17 +724,13 @@ func TestRecordGetStringSliceDataValue(t *testing.T) { {[]string{"test", "test", "123"}, []string{"test", "123"}}, } - collection := &models.Collection{ - Schema: schema.NewSchema( - &schema.SchemaField{Name: "test"}, - ), - } + collection := &models.Collection{} for i, s := range scenarios { m := models.NewRecord(collection) - m.SetDataValue("test", s.value) + m.Set("test", s.value) - result := m.GetStringSliceDataValue("test") + result := m.GetStringSlice("test") if len(result) != len(s.expected) { t.Errorf("(%d) Expected %d elements, got %d: %v", i, len(s.expected), len(result), result) @@ -590,6 +745,61 @@ func TestRecordGetStringSliceDataValue(t *testing.T) { } } +func TestRecordUnmarshalJSONField(t *testing.T) { + collection := &models.Collection{ + Schema: schema.NewSchema(&schema.SchemaField{ + Name: "field", + Type: schema.FieldTypeJson, + }), + } + m := models.NewRecord(collection) + + var testPointer *string + var testStr string + var testInt int + var testBool bool + var testSlice []int + var testMap map[string]any + + scenarios := []struct { + value any + destination any + expectError bool + expectedJson string + }{ + {nil, testStr, true, `""`}, + {"", testStr, true, `""`}, + {1, testInt, false, `1`}, + {true, testBool, false, `true`}, + {[]int{1, 2, 3}, testSlice, false, `[1,2,3]`}, + {map[string]any{"test": 123}, testMap, false, `{"test":123}`}, + // json encoded values + {`null`, testPointer, false, `null`}, + {`true`, testBool, false, `true`}, + {`456`, testInt, false, `456`}, + {`"test"`, testStr, false, `"test"`}, + {`[4,5,6]`, testSlice, false, `[4,5,6]`}, + {`{"test":456}`, testMap, false, `{"test":456}`}, + } + + for i, s := range scenarios { + m.Set("field", s.value) + + err := m.UnmarshalJSONField("field", &s.destination) + hasErr := err != nil + + if hasErr != s.expectError { + t.Errorf("(%d) Expected hasErr %v, got %v", i, s.expectError, hasErr) + continue + } + + raw, _ := json.Marshal(s.destination) + if v := string(raw); v != s.expectedJson { + t.Errorf("(%d) Expected %q, got %q", i, s.expectedJson, v) + } + } +} + func TestRecordBaseFilesPath(t *testing.T) { collection := &models.Collection{} collection.RefreshId() @@ -633,9 +843,9 @@ func TestRecordFindFileFieldByFile(t *testing.T) { } m := models.NewRecord(collection) - m.SetDataValue("field1", "test") - m.SetDataValue("field2", "test.png") - m.SetDataValue("field3", []string{"test1.png", "test2.png"}) + m.Set("field1", "test") + m.Set("field2", "test.png") + m.Set("field3", []string{"test1.png", "test2.png"}) scenarios := []struct { filename string @@ -663,6 +873,79 @@ func TestRecordFindFileFieldByFile(t *testing.T) { } } +func TestRecordLoadAndData(t *testing.T) { + collection := &models.Collection{ + Schema: schema.NewSchema( + &schema.SchemaField{ + Name: "field1", + Type: schema.FieldTypeText, + }, + &schema.SchemaField{ + Name: "field2", + Type: schema.FieldTypeNumber, + }, + ), + } + + data := map[string]any{ + "id": "test_id", + "created": "2022-01-01 10:00:00.123Z", + "updated": "2022-01-01 10:00:00.456Z", + "field1": "test_field", + "field2": "123", // should be casted to float + "unknown": "test_unknown", + // auth collection sepcific casting test + "passwordHash": "test_passwordHash", + "emailVisibility": "12345", // should be casted to bool only for auth collections + "username": 123, // should be casted to string only for auth collections + "email": "test_email", + "verified": true, + "tokenKey": "test_tokenKey", + "lastResetSentAt": "2022-01-01 11:00:00.000", // should be casted to DateTime only for auth collections + "lastVerificationSentAt": "2022-01-01 12:00:00.000", // should be casted to DateTime only for auth collections + } + + scenarios := []struct { + collectionType string + }{ + {models.CollectionTypeBase}, + {models.CollectionTypeAuth}, + } + + for i, s := range scenarios { + collection.Type = s.collectionType + m := models.NewRecord(collection) + + m.Load(data) + + expectations := map[string]any{} + for k, v := range data { + expectations[k] = v + } + + expectations["created"], _ = types.ParseDateTime("2022-01-01 10:00:00.123Z") + expectations["updated"], _ = types.ParseDateTime("2022-01-01 10:00:00.456Z") + expectations["field2"] = 123.0 + + // extra casting test + if collection.IsAuth() { + lastResetSentAt, _ := types.ParseDateTime(expectations["lastResetSentAt"]) + lastVerificationSentAt, _ := types.ParseDateTime(expectations["lastVerificationSentAt"]) + expectations["emailVisibility"] = false + expectations["username"] = "123" + expectations["verified"] = true + expectations["lastResetSentAt"] = lastResetSentAt + expectations["lastVerificationSentAt"] = lastVerificationSentAt + } + + for k, v := range expectations { + if m.Get(k) != v { + t.Errorf("(%d) Expected field %s to be %v, got %v", i, k, v, m.Get(k)) + } + } + } +} + func TestRecordColumnValueMap(t *testing.T) { collection := &models.Collection{ Schema: schema.NewSchema( @@ -679,7 +962,7 @@ func TestRecordColumnValueMap(t *testing.T) { }, }, &schema.SchemaField{ - Name: "#field3", + Name: "field3", Type: schema.FieldTypeSelect, Options: &schema.SelectOptions{ MaxSelect: 2, @@ -690,41 +973,69 @@ func TestRecordColumnValueMap(t *testing.T) { Name: "field4", Type: schema.FieldTypeRelation, Options: &schema.RelationOptions{ - MaxSelect: 2, + MaxSelect: types.Pointer(2), }, }, ), } - id1 := "11111111-1e32-4c94-ae06-90c25fcf6791" - id2 := "22222222-1e32-4c94-ae06-90c25fcf6791" - created, _ := types.ParseDateTime("2022-01-01 10:00:30.123") + scenarios := []struct { + collectionType string + expectedJson string + }{ + { + models.CollectionTypeBase, + `{"created":"2022-01-01 10:00:30.123Z","field1":"test","field2":"test.png","field3":["test1","test2"],"field4":["test11","test12"],"id":"test_id","updated":""}`, + }, + { + models.CollectionTypeAuth, + `{"created":"2022-01-01 10:00:30.123Z","email":"test_email","emailVisibility":true,"field1":"test","field2":"test.png","field3":["test1","test2"],"field4":["test11","test12"],"id":"test_id","lastResetSentAt":"2022-01-02 10:00:30.123Z","lastVerificationSentAt":"","passwordHash":"test_passwordHash","tokenKey":"test_tokenKey","updated":"","username":"test_username","verified":false}`, + }, + } + + created, _ := types.ParseDateTime("2022-01-01 10:00:30.123Z") + lastResetSentAt, _ := types.ParseDateTime("2022-01-02 10:00:30.123Z") + data := map[string]any{ + "id": "test_id", + "created": created, + "field1": "test", + "field2": "test.png", + "field3": []string{"test1", "test2"}, + "field4": []string{"test11", "test12", "test11"}, // strip duplicate, + "unknown": "test_unknown", + "passwordHash": "test_passwordHash", + "username": "test_username", + "emailVisibility": true, + "email": "test_email", + "verified": "invalid", // should be casted + "tokenKey": "test_tokenKey", + "lastResetSentAt": lastResetSentAt, + } m := models.NewRecord(collection) - m.Id = id1 - m.Created = created - m.SetDataValue("field1", "test") - m.SetDataValue("field2", "test.png") - m.SetDataValue("#field3", []string{"test1", "test2"}) - m.SetDataValue("field4", []string{id1, id2, id1}) - result := m.ColumnValueMap() + for i, s := range scenarios { + collection.Type = s.collectionType - encoded, err := json.Marshal(result) - if err != nil { - t.Fatal(err) - } + m.Load(data) - expected := `{"#field3":["test1","test2"],"created":"2022-01-01 10:00:30.123","field1":"test","field2":"test.png","field4":["11111111-1e32-4c94-ae06-90c25fcf6791","22222222-1e32-4c94-ae06-90c25fcf6791"],"id":"11111111-1e32-4c94-ae06-90c25fcf6791","updated":""}` + result := m.ColumnValueMap() - if string(encoded) != expected { - t.Fatalf("Expected %v, got \n%v", expected, string(encoded)) + encoded, err := json.Marshal(result) + if err != nil { + t.Errorf("(%d) Unexpected error %v", i, err) + continue + } + + if str := string(encoded); str != s.expectedJson { + t.Errorf("(%d) Expected \n%v \ngot \n%v", i, s.expectedJson, str) + } } } -func TestRecordPublicExport(t *testing.T) { +func TestRecordPublicExportAndMarshalJSON(t *testing.T) { collection := &models.Collection{ - Name: "test", + Name: "c_name", Schema: schema.NewSchema( &schema.SchemaField{ Name: "field1", @@ -739,7 +1050,7 @@ func TestRecordPublicExport(t *testing.T) { }, }, &schema.SchemaField{ - Name: "#field3", + Name: "field3", Type: schema.FieldTypeSelect, Options: &schema.SelectOptions{ MaxSelect: 2, @@ -748,34 +1059,126 @@ func TestRecordPublicExport(t *testing.T) { }, ), } + collection.Id = "c_id" - created, _ := types.ParseDateTime("2022-01-01 10:00:30.123") + scenarios := []struct { + collectionType string + exportHidden bool + exportUnknown bool + expectedJson string + }{ + // base + { + models.CollectionTypeBase, + false, + false, + `{"collectionId":"c_id","collectionName":"c_name","created":"2022-01-01 10:00:30.123Z","expand":{"test":123},"field1":"test","field2":"test.png","field3":["test1","test2"],"id":"test_id","updated":""}`, + }, + { + models.CollectionTypeBase, + true, + false, + `{"collectionId":"c_id","collectionName":"c_name","created":"2022-01-01 10:00:30.123Z","expand":{"test":123},"field1":"test","field2":"test.png","field3":["test1","test2"],"id":"test_id","updated":""}`, + }, + { + models.CollectionTypeBase, + false, + true, + `{"collectionId":"c_id","collectionName":"c_name","created":"2022-01-01 10:00:30.123Z","email":"test_email","emailVisibility":"test_invalid","expand":{"test":123},"field1":"test","field2":"test.png","field3":["test1","test2"],"id":"test_id","lastResetSentAt":"2022-01-02 10:00:30.123Z","lastVerificationSentAt":"test_lastVerificationSentAt","passwordHash":"test_passwordHash","tokenKey":"test_tokenKey","unknown":"test_unknown","updated":"","username":123,"verified":true}`, + }, + { + models.CollectionTypeBase, + true, + true, + `{"collectionId":"c_id","collectionName":"c_name","created":"2022-01-01 10:00:30.123Z","email":"test_email","emailVisibility":"test_invalid","expand":{"test":123},"field1":"test","field2":"test.png","field3":["test1","test2"],"id":"test_id","lastResetSentAt":"2022-01-02 10:00:30.123Z","lastVerificationSentAt":"test_lastVerificationSentAt","passwordHash":"test_passwordHash","tokenKey":"test_tokenKey","unknown":"test_unknown","updated":"","username":123,"verified":true}`, + }, - m := models.NewRecord(collection) - m.Id = "210a896c-1e32-4c94-ae06-90c25fcf6791" - m.Created = created - m.SetDataValue("field1", "test") - m.SetDataValue("field2", "test.png") - m.SetDataValue("#field3", []string{"test1", "test2"}) - m.SetExpand(map[string]any{"test": 123}) + // auth + { + models.CollectionTypeAuth, + false, + false, + `{"collectionId":"c_id","collectionName":"c_name","created":"2022-01-01 10:00:30.123Z","emailVisibility":false,"expand":{"test":123},"field1":"test","field2":"test.png","field3":["test1","test2"],"id":"test_id","updated":"","username":"123","verified":true}`, + }, + { + models.CollectionTypeAuth, + true, + false, + `{"collectionId":"c_id","collectionName":"c_name","created":"2022-01-01 10:00:30.123Z","email":"test_email","emailVisibility":false,"expand":{"test":123},"field1":"test","field2":"test.png","field3":["test1","test2"],"id":"test_id","updated":"","username":"123","verified":true}`, + }, + { + models.CollectionTypeAuth, + false, + true, + `{"collectionId":"c_id","collectionName":"c_name","created":"2022-01-01 10:00:30.123Z","emailVisibility":false,"expand":{"test":123},"field1":"test","field2":"test.png","field3":["test1","test2"],"id":"test_id","unknown":"test_unknown","updated":"","username":"123","verified":true}`, + }, + { + models.CollectionTypeAuth, + true, + true, + `{"collectionId":"c_id","collectionName":"c_name","created":"2022-01-01 10:00:30.123Z","email":"test_email","emailVisibility":false,"expand":{"test":123},"field1":"test","field2":"test.png","field3":["test1","test2"],"id":"test_id","unknown":"test_unknown","updated":"","username":"123","verified":true}`, + }, + } - result := m.PublicExport() + created, _ := types.ParseDateTime("2022-01-01 10:00:30.123Z") + lastResetSentAt, _ := types.ParseDateTime("2022-01-02 10:00:30.123Z") - encoded, err := json.Marshal(result) - if err != nil { - t.Fatal(err) + data := map[string]any{ + "id": "test_id", + "created": created, + "field1": "test", + "field2": "test.png", + "field3": []string{"test1", "test2"}, + "expand": map[string]any{"test": 123}, + "collectionId": "m_id", // should be always ignored + "collectionName": "m_name", // should be always ignored + "unknown": "test_unknown", + "passwordHash": "test_passwordHash", + "username": 123, // for auth collections should be casted to string + "emailVisibility": "test_invalid", // for auth collections should be casted to bool + "email": "test_email", + "verified": true, + "tokenKey": "test_tokenKey", + "lastResetSentAt": lastResetSentAt, + "lastVerificationSentAt": "test_lastVerificationSentAt", } - expected := `{"@collectionId":"","@collectionName":"test","@expand":{"test":123},"created":"2022-01-01 10:00:30.123","field1":"test","field2":"test.png","id":"210a896c-1e32-4c94-ae06-90c25fcf6791","updated":""}` + m := models.NewRecord(collection) + + for i, s := range scenarios { + collection.Type = s.collectionType + + m.Load(data) + m.IgnoreEmailVisibility(s.exportHidden) + m.WithUnkownData(s.exportUnknown) - if string(encoded) != expected { - t.Fatalf("Expected %v, got \n%v", expected, string(encoded)) + exportResult, err := json.Marshal(m.PublicExport()) + if err != nil { + t.Errorf("(%d) Unexpected error %v", i, err) + continue + } + exportResultStr := string(exportResult) + + // MarshalJSON and PublicExport should return the same + marshalResult, err := m.MarshalJSON() + if err != nil { + t.Errorf("(%d) Unexpected error %v", i, err) + continue + } + marshalResultStr := string(marshalResult) + + if exportResultStr != marshalResultStr { + t.Errorf("(%d) Expected the PublicExport to be the same as MarshalJSON, but got \n%v \nvs \n%v", i, exportResultStr, marshalResultStr) + } + + if exportResultStr != s.expectedJson { + t.Errorf("(%d) Expected json \n%v \ngot \n%v", i, s.expectedJson, exportResultStr) + } } } -func TestRecordMarshalJSON(t *testing.T) { +func TestRecordUnmarshalJSON(t *testing.T) { collection := &models.Collection{ - Name: "test", Schema: schema.NewSchema( &schema.SchemaField{ Name: "field1", @@ -783,67 +1186,484 @@ func TestRecordMarshalJSON(t *testing.T) { }, &schema.SchemaField{ Name: "field2", - Type: schema.FieldTypeFile, - Options: &schema.FileOptions{ - MaxSelect: 1, - MaxSize: 1, - }, - }, - &schema.SchemaField{ - Name: "#field3", - Type: schema.FieldTypeSelect, - Options: &schema.SelectOptions{ - MaxSelect: 2, - Values: []string{"test1", "test2", "test3"}, - }, + Type: schema.FieldTypeNumber, }, ), } - created, _ := types.ParseDateTime("2022-01-01 10:00:30.123") + data := map[string]any{ + "id": "test_id", + "created": "2022-01-01 10:00:00.123Z", + "updated": "2022-01-01 10:00:00.456Z", + "field1": "test_field", + "field2": "123", // should be casted to float + "unknown": "test_unknown", + // auth collection sepcific casting test + "passwordHash": "test_passwordHash", + "emailVisibility": "12345", // should be casted to bool only for auth collections + "username": 123.123, // should be casted to string only for auth collections + "email": "test_email", + "verified": true, + "tokenKey": "test_tokenKey", + "lastResetSentAt": "2022-01-01 11:00:00.000", // should be casted to DateTime only for auth collections + "lastVerificationSentAt": "2022-01-01 12:00:00.000", // should be casted to DateTime only for auth collections + } + dataRaw, err := json.Marshal(data) + if err != nil { + t.Fatalf("Unexpected data marshal error %v", err) + } - m := models.NewRecord(collection) - m.Id = "210a896c-1e32-4c94-ae06-90c25fcf6791" - m.Created = created - m.SetDataValue("field1", "test") - m.SetDataValue("field2", "test.png") - m.SetDataValue("#field3", []string{"test1", "test2"}) - m.SetExpand(map[string]any{"test": 123}) - - encoded, err := m.MarshalJSON() + scenarios := []struct { + collectionType string + }{ + {models.CollectionTypeBase}, + {models.CollectionTypeAuth}, + } + + // with invalid data + m0 := models.NewRecord(collection) + if err := m0.UnmarshalJSON([]byte("test")); err == nil { + t.Fatal("Expected error, got nil") + } + + // with valid data (it should be pretty much the same as load) + for i, s := range scenarios { + collection.Type = s.collectionType + m := models.NewRecord(collection) + + err := m.UnmarshalJSON(dataRaw) + if err != nil { + t.Errorf("(%d) Unexpected error %v", i, err) + continue + } + + expectations := map[string]any{} + for k, v := range data { + expectations[k] = v + } + + expectations["created"], _ = types.ParseDateTime("2022-01-01 10:00:00.123Z") + expectations["updated"], _ = types.ParseDateTime("2022-01-01 10:00:00.456Z") + expectations["field2"] = 123.0 + + // extra casting test + if collection.IsAuth() { + lastResetSentAt, _ := types.ParseDateTime(expectations["lastResetSentAt"]) + lastVerificationSentAt, _ := types.ParseDateTime(expectations["lastVerificationSentAt"]) + expectations["emailVisibility"] = false + expectations["username"] = "123.123" + expectations["verified"] = true + expectations["lastResetSentAt"] = lastResetSentAt + expectations["lastVerificationSentAt"] = lastVerificationSentAt + } + + for k, v := range expectations { + if m.Get(k) != v { + t.Errorf("(%d) Expected field %s to be %v, got %v", i, k, v, m.Get(k)) + } + } + } +} + +// ------------------------------------------------------------------- +// Auth helpers: +// ------------------------------------------------------------------- + +func TestRecordUsername(t *testing.T) { + scenarios := []struct { + collectionType string + expectError bool + }{ + {models.CollectionTypeBase, true}, + {models.CollectionTypeAuth, false}, + } + + testValue := "test 1232 !@#%" // formatting isn't checked + + for i, s := range scenarios { + collection := &models.Collection{Type: s.collectionType} + m := models.NewRecord(collection) + + if s.expectError { + if err := m.SetUsername(testValue); err == nil { + t.Errorf("(%d) Expected error, got nil", i) + } + if v := m.Username(); v != "" { + t.Fatalf("(%d) Expected empty string, got %q", i, v) + } + // verify that nothing is stored in the record data slice + if v := m.Get(schema.FieldNameUsername); v != nil { + t.Fatalf("(%d) Didn't expect data field %q: %v", i, schema.FieldNameUsername, v) + } + } else { + if err := m.SetUsername(testValue); err != nil { + t.Fatalf("(%d) Expected nil, got error %v", i, err) + } + if v := m.Username(); v != testValue { + t.Fatalf("(%d) Expected %q, got %q", i, testValue, v) + } + // verify that the field is stored in the record data slice + if v := m.Get(schema.FieldNameUsername); v != testValue { + t.Fatalf("(%d) Expected data field value %q, got %q", i, testValue, v) + } + } + } +} + +func TestRecordEmail(t *testing.T) { + scenarios := []struct { + collectionType string + expectError bool + }{ + {models.CollectionTypeBase, true}, + {models.CollectionTypeAuth, false}, + } + + testValue := "test 1232 !@#%" // formatting isn't checked + + for i, s := range scenarios { + collection := &models.Collection{Type: s.collectionType} + m := models.NewRecord(collection) + + if s.expectError { + if err := m.SetEmail(testValue); err == nil { + t.Errorf("(%d) Expected error, got nil", i) + } + if v := m.Email(); v != "" { + t.Fatalf("(%d) Expected empty string, got %q", i, v) + } + // verify that nothing is stored in the record data slice + if v := m.Get(schema.FieldNameEmail); v != nil { + t.Fatalf("(%d) Didn't expect data field %q: %v", i, schema.FieldNameEmail, v) + } + } else { + if err := m.SetEmail(testValue); err != nil { + t.Fatalf("(%d) Expected nil, got error %v", i, err) + } + if v := m.Email(); v != testValue { + t.Fatalf("(%d) Expected %q, got %q", i, testValue, v) + } + // verify that the field is stored in the record data slice + if v := m.Get(schema.FieldNameEmail); v != testValue { + t.Fatalf("(%d) Expected data field value %q, got %q", i, testValue, v) + } + } + } +} + +func TestRecordEmailVisibility(t *testing.T) { + scenarios := []struct { + collectionType string + value bool + expectError bool + }{ + {models.CollectionTypeBase, true, true}, + {models.CollectionTypeBase, true, true}, + {models.CollectionTypeAuth, false, false}, + {models.CollectionTypeAuth, true, false}, + } + + for i, s := range scenarios { + collection := &models.Collection{Type: s.collectionType} + m := models.NewRecord(collection) + + if s.expectError { + if err := m.SetEmailVisibility(s.value); err == nil { + t.Errorf("(%d) Expected error, got nil", i) + } + if v := m.EmailVisibility(); v != false { + t.Fatalf("(%d) Expected empty string, got %v", i, v) + } + // verify that nothing is stored in the record data slice + if v := m.Get(schema.FieldNameEmailVisibility); v != nil { + t.Fatalf("(%d) Didn't expect data field %q: %v", i, schema.FieldNameEmailVisibility, v) + } + } else { + if err := m.SetEmailVisibility(s.value); err != nil { + t.Fatalf("(%d) Expected nil, got error %v", i, err) + } + if v := m.EmailVisibility(); v != s.value { + t.Fatalf("(%d) Expected %v, got %v", i, s.value, v) + } + // verify that the field is stored in the record data slice + if v := m.Get(schema.FieldNameEmailVisibility); v != s.value { + t.Fatalf("(%d) Expected data field value %v, got %v", i, s.value, v) + } + } + } +} + +func TestRecordEmailVerified(t *testing.T) { + scenarios := []struct { + collectionType string + value bool + expectError bool + }{ + {models.CollectionTypeBase, true, true}, + {models.CollectionTypeBase, true, true}, + {models.CollectionTypeAuth, false, false}, + {models.CollectionTypeAuth, true, false}, + } + + for i, s := range scenarios { + collection := &models.Collection{Type: s.collectionType} + m := models.NewRecord(collection) + + if s.expectError { + if err := m.SetVerified(s.value); err == nil { + t.Errorf("(%d) Expected error, got nil", i) + } + if v := m.Verified(); v != false { + t.Fatalf("(%d) Expected empty string, got %v", i, v) + } + // verify that nothing is stored in the record data slice + if v := m.Get(schema.FieldNameVerified); v != nil { + t.Fatalf("(%d) Didn't expect data field %q: %v", i, schema.FieldNameVerified, v) + } + } else { + if err := m.SetVerified(s.value); err != nil { + t.Fatalf("(%d) Expected nil, got error %v", i, err) + } + if v := m.Verified(); v != s.value { + t.Fatalf("(%d) Expected %v, got %v", i, s.value, v) + } + // verify that the field is stored in the record data slice + if v := m.Get(schema.FieldNameVerified); v != s.value { + t.Fatalf("(%d) Expected data field value %v, got %v", i, s.value, v) + } + } + } +} + +func TestRecordTokenKey(t *testing.T) { + scenarios := []struct { + collectionType string + expectError bool + }{ + {models.CollectionTypeBase, true}, + {models.CollectionTypeAuth, false}, + } + + testValue := "test 1232 !@#%" // formatting isn't checked + + for i, s := range scenarios { + collection := &models.Collection{Type: s.collectionType} + m := models.NewRecord(collection) + + if s.expectError { + if err := m.SetTokenKey(testValue); err == nil { + t.Errorf("(%d) Expected error, got nil", i) + } + if v := m.TokenKey(); v != "" { + t.Fatalf("(%d) Expected empty string, got %q", i, v) + } + // verify that nothing is stored in the record data slice + if v := m.Get(schema.FieldNameTokenKey); v != nil { + t.Fatalf("(%d) Didn't expect data field %q: %v", i, schema.FieldNameTokenKey, v) + } + } else { + if err := m.SetTokenKey(testValue); err != nil { + t.Fatalf("(%d) Expected nil, got error %v", i, err) + } + if v := m.TokenKey(); v != testValue { + t.Fatalf("(%d) Expected %q, got %q", i, testValue, v) + } + // verify that the field is stored in the record data slice + if v := m.Get(schema.FieldNameTokenKey); v != testValue { + t.Fatalf("(%d) Expected data field value %q, got %q", i, testValue, v) + } + } + } +} + +func TestRecordRefreshTokenKey(t *testing.T) { + scenarios := []struct { + collectionType string + expectError bool + }{ + {models.CollectionTypeBase, true}, + {models.CollectionTypeAuth, false}, + } + + for i, s := range scenarios { + collection := &models.Collection{Type: s.collectionType} + m := models.NewRecord(collection) + + if s.expectError { + if err := m.RefreshTokenKey(); err == nil { + t.Errorf("(%d) Expected error, got nil", i) + } + if v := m.TokenKey(); v != "" { + t.Fatalf("(%d) Expected empty string, got %q", i, v) + } + // verify that nothing is stored in the record data slice + if v := m.Get(schema.FieldNameTokenKey); v != nil { + t.Fatalf("(%d) Didn't expect data field %q: %v", i, schema.FieldNameTokenKey, v) + } + } else { + if err := m.RefreshTokenKey(); err != nil { + t.Fatalf("(%d) Expected nil, got error %v", i, err) + } + if v := m.TokenKey(); len(v) != 50 { + t.Fatalf("(%d) Expected 50 chars, got %d", i, len(v)) + } + // verify that the field is stored in the record data slice + if v := m.Get(schema.FieldNameTokenKey); v != m.TokenKey() { + t.Fatalf("(%d) Expected data field value %q, got %q", i, m.TokenKey(), v) + } + } + } +} + +func TestRecordLastResetSentAt(t *testing.T) { + scenarios := []struct { + collectionType string + expectError bool + }{ + {models.CollectionTypeBase, true}, + {models.CollectionTypeAuth, false}, + } + + testValue, err := types.ParseDateTime("2022-01-01 00:00:00.123Z") if err != nil { t.Fatal(err) } - expected := `{"@collectionId":"","@collectionName":"test","@expand":{"test":123},"created":"2022-01-01 10:00:30.123","field1":"test","field2":"test.png","id":"210a896c-1e32-4c94-ae06-90c25fcf6791","updated":""}` + for i, s := range scenarios { + collection := &models.Collection{Type: s.collectionType} + m := models.NewRecord(collection) - if string(encoded) != expected { - t.Fatalf("Expected %v, got \n%v", expected, string(encoded)) + if s.expectError { + if err := m.SetLastResetSentAt(testValue); err == nil { + t.Errorf("(%d) Expected error, got nil", i) + } + if v := m.LastResetSentAt(); !v.IsZero() { + t.Fatalf("(%d) Expected empty value, got %v", i, v) + } + // verify that nothing is stored in the record data slice + if v := m.Get(schema.FieldNameLastResetSentAt); v != nil { + t.Fatalf("(%d) Didn't expect data field %q: %v", i, schema.FieldNameLastResetSentAt, v) + } + } else { + if err := m.SetLastResetSentAt(testValue); err != nil { + t.Fatalf("(%d) Expected nil, got error %v", i, err) + } + if v := m.LastResetSentAt(); v != testValue { + t.Fatalf("(%d) Expected %v, got %v", i, testValue, v) + } + // verify that the field is stored in the record data slice + if v := m.Get(schema.FieldNameLastResetSentAt); v != testValue { + t.Fatalf("(%d) Expected data field value %v, got %v", i, testValue, v) + } + } } } -func TestRecordUnmarshalJSON(t *testing.T) { - collection := &models.Collection{ - Schema: schema.NewSchema( - &schema.SchemaField{ - Name: "field", - Type: schema.FieldTypeText, - }, - ), +func TestRecordLastVerificationSentAt(t *testing.T) { + scenarios := []struct { + collectionType string + expectError bool + }{ + {models.CollectionTypeBase, true}, + {models.CollectionTypeAuth, false}, + } + + testValue, err := types.ParseDateTime("2022-01-01 00:00:00.123Z") + if err != nil { + t.Fatal(err) + } + + for i, s := range scenarios { + collection := &models.Collection{Type: s.collectionType} + m := models.NewRecord(collection) + + if s.expectError { + if err := m.SetLastVerificationSentAt(testValue); err == nil { + t.Errorf("(%d) Expected error, got nil", i) + } + if v := m.LastVerificationSentAt(); !v.IsZero() { + t.Fatalf("(%d) Expected empty value, got %v", i, v) + } + // verify that nothing is stored in the record data slice + if v := m.Get(schema.FieldNameLastVerificationSentAt); v != nil { + t.Fatalf("(%d) Didn't expect data field %q: %v", i, schema.FieldNameLastVerificationSentAt, v) + } + } else { + if err := m.SetLastVerificationSentAt(testValue); err != nil { + t.Fatalf("(%d) Expected nil, got error %v", i, err) + } + if v := m.LastVerificationSentAt(); v != testValue { + t.Fatalf("(%d) Expected %v, got %v", i, testValue, v) + } + // verify that the field is stored in the record data slice + if v := m.Get(schema.FieldNameLastVerificationSentAt); v != testValue { + t.Fatalf("(%d) Expected data field value %v, got %v", i, testValue, v) + } + } + } +} + +func TestRecordValidatePassword(t *testing.T) { + // 123456 + hash := "$2a$10$YKU8mPP8sTE3xZrpuM.xQuq27KJ7aIJB2oUeKPsDDqZshbl5g5cDK" + + scenarios := []struct { + collectionType string + password string + hash string + expected bool + }{ + {models.CollectionTypeBase, "123456", hash, false}, + {models.CollectionTypeAuth, "", "", false}, + {models.CollectionTypeAuth, "", hash, false}, + {models.CollectionTypeAuth, "123456", hash, true}, + {models.CollectionTypeAuth, "654321", hash, false}, + } + + for i, s := range scenarios { + collection := &models.Collection{Type: s.collectionType} + m := models.NewRecord(collection) + m.Set(schema.FieldNamePasswordHash, hash) + + if v := m.ValidatePassword(s.password); v != s.expected { + t.Errorf("(%d) Expected %v, got %v", i, s.expected, v) + } + } +} + +func TestRecordSetPassword(t *testing.T) { + scenarios := []struct { + collectionType string + password string + expectError bool + }{ + {models.CollectionTypeBase, "", true}, + {models.CollectionTypeBase, "123456", true}, + {models.CollectionTypeAuth, "", true}, + {models.CollectionTypeAuth, "123456", false}, } - m := models.NewRecord(collection) - m.UnmarshalJSON([]byte(`{ - "id": "11111111-d07e-4fbe-86b3-b8ac31982e9a", - "created": "2022-01-01 10:00:00.123", - "updated": "2022-01-01 10:00:00.456", - "field": "test", - "unknown": "test" - }`)) - - expected := `{"@collectionId":"","@collectionName":"","created":"2022-01-01 10:00:00.123","field":"test","id":"11111111-d07e-4fbe-86b3-b8ac31982e9a","updated":"2022-01-01 10:00:00.456"}` - encoded, _ := json.Marshal(m) - if string(encoded) != expected { - t.Fatalf("Expected model %v, got \n%v", expected, string(encoded)) + for i, s := range scenarios { + collection := &models.Collection{Type: s.collectionType} + m := models.NewRecord(collection) + + if s.expectError { + if err := m.SetPassword(s.password); err == nil { + t.Errorf("(%d) Expected error, got nil", i) + } + if v := m.GetString(schema.FieldNamePasswordHash); v != "" { + t.Errorf("(%d) Expected empty hash, got %q", i, v) + } + } else { + if err := m.SetPassword(s.password); err != nil { + t.Errorf("(%d) Expected nil, got err", i) + } + if v := m.GetString(schema.FieldNamePasswordHash); v == "" { + t.Errorf("(%d) Expected non empty hash", i) + } + if !m.ValidatePassword(s.password) { + t.Errorf("(%d) Expected true, got false", i) + } + } } } diff --git a/models/request.go b/models/request.go index 662b97894..dbefc91c7 100644 --- a/models/request.go +++ b/models/request.go @@ -6,9 +6,9 @@ var _ Model = (*Request)(nil) // list with the supported values for `Request.Auth` const ( - RequestAuthGuest = "guest" - RequestAuthUser = "user" - RequestAuthAdmin = "admin" + RequestAuthGuest = "guest" + RequestAuthAdmin = "admin" + RequestAuthRecord = "auth_record" ) type Request struct { diff --git a/models/schema/schema_field.go b/models/schema/schema_field.go index dd8e772d9..64ab04de1 100644 --- a/models/schema/schema_field.go +++ b/models/schema/schema_field.go @@ -13,21 +13,55 @@ import ( "github.com/spf13/cast" ) -var schemaFieldNameRegex = regexp.MustCompile(`^\#?\w+$`) +var schemaFieldNameRegex = regexp.MustCompile(`^\w+$`) -// reserved internal field names +// commonly used field names const ( - ReservedFieldNameId = "id" - ReservedFieldNameCreated = "created" - ReservedFieldNameUpdated = "updated" + FieldNameId = "id" + FieldNameCreated = "created" + FieldNameUpdated = "updated" + FieldNameCollectionId = "collectionId" + FieldNameCollectionName = "collectionName" + FieldNameExpand = "expand" + FieldNameUsername = "username" + FieldNameEmail = "email" + FieldNameEmailVisibility = "emailVisibility" + FieldNameVerified = "verified" + FieldNameTokenKey = "tokenKey" + FieldNamePasswordHash = "passwordHash" + FieldNameLastResetSentAt = "lastResetSentAt" + FieldNameLastVerificationSentAt = "lastVerificationSentAt" ) -// ReservedFieldNames returns slice with reserved/system field names. -func ReservedFieldNames() []string { +// BaseModelFieldNames returns the field names that all models have (id, created, updated). +func BaseModelFieldNames() []string { return []string{ - ReservedFieldNameId, - ReservedFieldNameCreated, - ReservedFieldNameUpdated, + FieldNameId, + FieldNameCreated, + FieldNameUpdated, + } +} + +// SystemFields returns special internal field names that are usually readonly. +func SystemFieldNames() []string { + return []string{ + FieldNameCollectionId, + FieldNameCollectionName, + FieldNameExpand, + } +} + +// AuthFieldNames returns the reserved "auth" collection auth field names. +func AuthFieldNames() []string { + return []string{ + FieldNameUsername, + FieldNameEmail, + FieldNameEmailVisibility, + FieldNameVerified, + FieldNameTokenKey, + FieldNamePasswordHash, + FieldNameLastResetSentAt, + FieldNameLastVerificationSentAt, } } @@ -43,7 +77,9 @@ const ( FieldTypeJson string = "json" FieldTypeFile string = "file" FieldTypeRelation string = "relation" - FieldTypeUser string = "user" + + // Deprecated: Will be removed in v0.9! + FieldTypeUser string = "user" ) // FieldTypes returns slice with all supported field types. @@ -59,7 +95,6 @@ func FieldTypes() []string { FieldTypeJson, FieldTypeFile, FieldTypeRelation, - FieldTypeUser, } } @@ -69,7 +104,6 @@ func ArraybleFieldTypes() []string { FieldTypeSelect, FieldTypeFile, FieldTypeRelation, - FieldTypeUser, } } @@ -90,7 +124,7 @@ func (f *SchemaField) ColDefinition() string { case FieldTypeNumber: return "REAL DEFAULT 0" case FieldTypeBool: - return "Boolean DEFAULT FALSE" + return "BOOLEAN DEFAULT FALSE" case FieldTypeJson: return "JSON DEFAULT NULL" default: @@ -133,9 +167,11 @@ func (f SchemaField) Validate() error { // init field options (if not already) f.InitOptions() - // add commonly used filter literals to the exclude names list - excludeNames := ReservedFieldNames() + excludeNames := BaseModelFieldNames() + // exclude filter literals excludeNames = append(excludeNames, "null", "true", "false") + // exclude system literals + excludeNames = append(excludeNames, SystemFieldNames()...) return validation.ValidateStruct(&f, validation.Field(&f.Options, validation.Required, validation.By(f.checkOptions)), @@ -198,8 +234,11 @@ func (f *SchemaField) InitOptions() error { options = &FileOptions{} case FieldTypeRelation: options = &RelationOptions{} + + // Deprecated: Will be removed in v0.9! case FieldTypeUser: options = &UserOptions{} + default: return errors.New("Missing or unknown field field type.") } @@ -259,19 +298,7 @@ func (f *SchemaField) PrepareValue(value any) any { ids := list.ToUniqueStringSlice(value) options, _ := f.Options.(*RelationOptions) - if options.MaxSelect <= 1 { - if len(ids) > 0 { - return ids[0] - } - return "" - } - - return ids - case FieldTypeUser: - ids := list.ToUniqueStringSlice(value) - - options, _ := f.Options.(*UserOptions) - if options.MaxSelect <= 1 { + if options.MaxSelect != nil && *options.MaxSelect <= 1 { if len(ids) > 0 { return ids[0] } @@ -426,13 +453,18 @@ type SelectOptions struct { } func (o SelectOptions) Validate() error { + max := len(o.Values) + if max == 0 { + max = 1 + } + return validation.ValidateStruct(&o, validation.Field(&o.Values, validation.Required), validation.Field( &o.MaxSelect, validation.Required, validation.Min(1), - validation.Max(len(o.Values)), + validation.Max(max), ), ) } @@ -469,27 +501,27 @@ func (o FileOptions) Validate() error { // ------------------------------------------------------------------- type RelationOptions struct { - MaxSelect int `form:"maxSelect" json:"maxSelect"` + MaxSelect *int `form:"maxSelect" json:"maxSelect"` CollectionId string `form:"collectionId" json:"collectionId"` CascadeDelete bool `form:"cascadeDelete" json:"cascadeDelete"` } func (o RelationOptions) Validate() error { return validation.ValidateStruct(&o, - validation.Field(&o.MaxSelect, validation.Required, validation.Min(1)), validation.Field(&o.CollectionId, validation.Required), + validation.Field(&o.MaxSelect, validation.NilOrNotEmpty, validation.Min(1)), ) } // ------------------------------------------------------------------- +// Deprecated: Will be removed in v0.9! type UserOptions struct { MaxSelect int `form:"maxSelect" json:"maxSelect"` CascadeDelete bool `form:"cascadeDelete" json:"cascadeDelete"` } +// Deprecated: Will be removed in v0.9! func (o UserOptions) Validate() error { - return validation.ValidateStruct(&o, - validation.Field(&o.MaxSelect, validation.Required, validation.Min(1)), - ) + return nil } diff --git a/models/schema/schema_field_test.go b/models/schema/schema_field_test.go index fb752deb8..3a9db74b8 100644 --- a/models/schema/schema_field_test.go +++ b/models/schema/schema_field_test.go @@ -11,27 +11,48 @@ import ( "github.com/pocketbase/pocketbase/tools/types" ) -func TestReservedFieldNames(t *testing.T) { - result := schema.ReservedFieldNames() +func TestBaseModelFieldNames(t *testing.T) { + result := schema.BaseModelFieldNames() + expected := 3 - if len(result) != 3 { - t.Fatalf("Expected %d names, got %d (%v)", 3, len(result), result) + if len(result) != expected { + t.Fatalf("Expected %d field names, got %d (%v)", expected, len(result), result) + } +} + +func TestSystemFieldNames(t *testing.T) { + result := schema.SystemFieldNames() + expected := 3 + + if len(result) != expected { + t.Fatalf("Expected %d field names, got %d (%v)", expected, len(result), result) + } +} + +func TestAuthFieldNames(t *testing.T) { + result := schema.AuthFieldNames() + expected := 8 + + if len(result) != expected { + t.Fatalf("Expected %d auth field names, got %d (%v)", expected, len(result), result) } } func TestFieldTypes(t *testing.T) { result := schema.FieldTypes() + expected := 10 - if len(result) != 11 { - t.Fatalf("Expected %d types, got %d (%v)", 3, len(result), result) + if len(result) != expected { + t.Fatalf("Expected %d types, got %d (%v)", expected, len(result), result) } } func TestArraybleFieldTypes(t *testing.T) { result := schema.ArraybleFieldTypes() + expected := 3 - if len(result) != 4 { - t.Fatalf("Expected %d types, got %d (%v)", 3, len(result), result) + if len(result) != expected { + t.Fatalf("Expected %d arrayble types, got %d (%v)", expected, len(result), result) } } @@ -50,7 +71,7 @@ func TestSchemaFieldColDefinition(t *testing.T) { }, { schema.SchemaField{Type: schema.FieldTypeBool, Name: "test"}, - "Boolean DEFAULT FALSE", + "BOOLEAN DEFAULT FALSE", }, { schema.SchemaField{Type: schema.FieldTypeEmail, Name: "test"}, @@ -80,10 +101,6 @@ func TestSchemaFieldColDefinition(t *testing.T) { schema.SchemaField{Type: schema.FieldTypeRelation, Name: "test"}, "TEXT DEFAULT ''", }, - { - schema.SchemaField{Type: schema.FieldTypeUser, Name: "test"}, - "TEXT DEFAULT ''", - }, } for i, s := range scenarios { @@ -297,7 +314,7 @@ func TestSchemaFieldValidate(t *testing.T) { schema.SchemaField{ Type: schema.FieldTypeText, Id: "1234567890", - Name: schema.ReservedFieldNameId, + Name: schema.FieldNameId, }, []string{"name"}, }, @@ -306,7 +323,7 @@ func TestSchemaFieldValidate(t *testing.T) { schema.SchemaField{ Type: schema.FieldTypeText, Id: "1234567890", - Name: schema.ReservedFieldNameCreated, + Name: schema.FieldNameCreated, }, []string{"name"}, }, @@ -315,7 +332,34 @@ func TestSchemaFieldValidate(t *testing.T) { schema.SchemaField{ Type: schema.FieldTypeText, Id: "1234567890", - Name: schema.ReservedFieldNameUpdated, + Name: schema.FieldNameUpdated, + }, + []string{"name"}, + }, + { + "reserved name (collectionId)", + schema.SchemaField{ + Type: schema.FieldTypeText, + Id: "1234567890", + Name: schema.FieldNameCollectionId, + }, + []string{"name"}, + }, + { + "reserved name (collectionName)", + schema.SchemaField{ + Type: schema.FieldTypeText, + Id: "1234567890", + Name: schema.FieldNameCollectionName, + }, + []string{"name"}, + }, + { + "reserved name (expand)", + schema.SchemaField{ + Type: schema.FieldTypeText, + Id: "1234567890", + Name: schema.FieldNameExpand, }, []string{"name"}, }, @@ -456,7 +500,7 @@ func TestSchemaFieldInitOptions(t *testing.T) { { schema.SchemaField{Type: schema.FieldTypeRelation}, false, - `{"system":false,"id":"","name":"","type":"relation","required":false,"unique":false,"options":{"maxSelect":0,"collectionId":"","cascadeDelete":false}}`, + `{"system":false,"id":"","name":"","type":"relation","required":false,"unique":false,"options":{"maxSelect":null,"collectionId":"","cascadeDelete":false}}`, }, { schema.SchemaField{Type: schema.FieldTypeUser}, @@ -548,8 +592,9 @@ func TestSchemaFieldPrepareValue(t *testing.T) { {schema.SchemaField{Type: schema.FieldTypeDate}, nil, `""`}, {schema.SchemaField{Type: schema.FieldTypeDate}, "", `""`}, {schema.SchemaField{Type: schema.FieldTypeDate}, "test", `""`}, - {schema.SchemaField{Type: schema.FieldTypeDate}, 1641024040, `"2022-01-01 08:00:40.000"`}, - {schema.SchemaField{Type: schema.FieldTypeDate}, "2022-01-01 11:27:10.123", `"2022-01-01 11:27:10.123"`}, + {schema.SchemaField{Type: schema.FieldTypeDate}, 1641024040, `"2022-01-01 08:00:40.000Z"`}, + {schema.SchemaField{Type: schema.FieldTypeDate}, "2022-01-01 11:27:10.123", `"2022-01-01 11:27:10.123Z"`}, + {schema.SchemaField{Type: schema.FieldTypeDate}, "2022-01-01 11:27:10.123Z", `"2022-01-01 11:27:10.123Z"`}, {schema.SchemaField{Type: schema.FieldTypeDate}, types.DateTime{}, `""`}, {schema.SchemaField{Type: schema.FieldTypeDate}, time.Time{}, `""`}, @@ -697,123 +742,88 @@ func TestSchemaFieldPrepareValue(t *testing.T) { }, // relation (single) - {schema.SchemaField{Type: schema.FieldTypeRelation}, nil, `""`}, - {schema.SchemaField{Type: schema.FieldTypeRelation}, "", `""`}, - {schema.SchemaField{Type: schema.FieldTypeRelation}, 123, `"123"`}, - {schema.SchemaField{Type: schema.FieldTypeRelation}, "abc", `"abc"`}, - {schema.SchemaField{Type: schema.FieldTypeRelation}, "1ba88b4f-e9da-42f0-9764-9a55c953e724", `"1ba88b4f-e9da-42f0-9764-9a55c953e724"`}, - { - schema.SchemaField{Type: schema.FieldTypeRelation}, - []string{"1ba88b4f-e9da-42f0-9764-9a55c953e724", "2ba88b4f-e9da-42f0-9764-9a55c953e724"}, - `"1ba88b4f-e9da-42f0-9764-9a55c953e724"`, - }, - // relation (multiple) { schema.SchemaField{ Type: schema.FieldTypeRelation, - Options: &schema.RelationOptions{MaxSelect: 2}, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(1)}, }, nil, - `[]`, + `""`, }, { schema.SchemaField{ Type: schema.FieldTypeRelation, - Options: &schema.RelationOptions{MaxSelect: 2}, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(1)}, }, "", - `[]`, - }, - { - schema.SchemaField{ - Type: schema.FieldTypeRelation, - Options: &schema.RelationOptions{MaxSelect: 2}, - }, - []string{}, - `[]`, + `""`, }, { schema.SchemaField{ Type: schema.FieldTypeRelation, - Options: &schema.RelationOptions{MaxSelect: 2}, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(1)}, }, 123, - `["123"]`, - }, - { - schema.SchemaField{ - Type: schema.FieldTypeRelation, - Options: &schema.RelationOptions{MaxSelect: 2}, - }, - []string{"", "abc"}, - `["abc"]`, + `"123"`, }, { - // no values validation schema.SchemaField{ Type: schema.FieldTypeRelation, - Options: &schema.RelationOptions{MaxSelect: 2}, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(1)}, }, - []string{"1ba88b4f-e9da-42f0-9764-9a55c953e724", "2ba88b4f-e9da-42f0-9764-9a55c953e724"}, - `["1ba88b4f-e9da-42f0-9764-9a55c953e724","2ba88b4f-e9da-42f0-9764-9a55c953e724"]`, + "abc", + `"abc"`, }, { - // duplicated values schema.SchemaField{ Type: schema.FieldTypeRelation, - Options: &schema.RelationOptions{MaxSelect: 2}, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(1)}, }, - []string{"1ba88b4f-e9da-42f0-9764-9a55c953e724", "2ba88b4f-e9da-42f0-9764-9a55c953e724", "1ba88b4f-e9da-42f0-9764-9a55c953e724"}, - `["1ba88b4f-e9da-42f0-9764-9a55c953e724","2ba88b4f-e9da-42f0-9764-9a55c953e724"]`, + "1ba88b4f-e9da-42f0-9764-9a55c953e724", + `"1ba88b4f-e9da-42f0-9764-9a55c953e724"`, }, - - // user (single) - {schema.SchemaField{Type: schema.FieldTypeUser}, nil, `""`}, - {schema.SchemaField{Type: schema.FieldTypeUser}, "", `""`}, - {schema.SchemaField{Type: schema.FieldTypeUser}, 123, `"123"`}, - {schema.SchemaField{Type: schema.FieldTypeUser}, "1ba88b4f-e9da-42f0-9764-9a55c953e724", `"1ba88b4f-e9da-42f0-9764-9a55c953e724"`}, { - schema.SchemaField{Type: schema.FieldTypeUser}, + schema.SchemaField{Type: schema.FieldTypeRelation, Options: &schema.RelationOptions{MaxSelect: types.Pointer(1)}}, []string{"1ba88b4f-e9da-42f0-9764-9a55c953e724", "2ba88b4f-e9da-42f0-9764-9a55c953e724"}, `"1ba88b4f-e9da-42f0-9764-9a55c953e724"`, }, - // user (multiple) + // relation (multiple) { schema.SchemaField{ - Type: schema.FieldTypeUser, - Options: &schema.UserOptions{MaxSelect: 2}, + Type: schema.FieldTypeRelation, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(2)}, }, nil, `[]`, }, { schema.SchemaField{ - Type: schema.FieldTypeUser, - Options: &schema.UserOptions{MaxSelect: 2}, + Type: schema.FieldTypeRelation, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(2)}, }, "", `[]`, }, { schema.SchemaField{ - Type: schema.FieldTypeUser, - Options: &schema.UserOptions{MaxSelect: 2}, + Type: schema.FieldTypeRelation, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(2)}, }, []string{}, `[]`, }, { schema.SchemaField{ - Type: schema.FieldTypeUser, - Options: &schema.UserOptions{MaxSelect: 2}, + Type: schema.FieldTypeRelation, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(2)}, }, 123, `["123"]`, }, { schema.SchemaField{ - Type: schema.FieldTypeUser, - Options: &schema.UserOptions{MaxSelect: 2}, + Type: schema.FieldTypeRelation, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(2)}, }, []string{"", "abc"}, `["abc"]`, @@ -821,8 +831,8 @@ func TestSchemaFieldPrepareValue(t *testing.T) { { // no values validation schema.SchemaField{ - Type: schema.FieldTypeUser, - Options: &schema.UserOptions{MaxSelect: 2}, + Type: schema.FieldTypeRelation, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(2)}, }, []string{"1ba88b4f-e9da-42f0-9764-9a55c953e724", "2ba88b4f-e9da-42f0-9764-9a55c953e724"}, `["1ba88b4f-e9da-42f0-9764-9a55c953e724","2ba88b4f-e9da-42f0-9764-9a55c953e724"]`, @@ -830,8 +840,8 @@ func TestSchemaFieldPrepareValue(t *testing.T) { { // duplicated values schema.SchemaField{ - Type: schema.FieldTypeUser, - Options: &schema.UserOptions{MaxSelect: 2}, + Type: schema.FieldTypeRelation, + Options: &schema.RelationOptions{MaxSelect: types.Pointer(2)}, }, []string{"1ba88b4f-e9da-42f0-9764-9a55c953e724", "2ba88b4f-e9da-42f0-9764-9a55c953e724", "1ba88b4f-e9da-42f0-9764-9a55c953e724"}, `["1ba88b4f-e9da-42f0-9764-9a55c953e724","2ba88b4f-e9da-42f0-9764-9a55c953e724"]`, @@ -1277,13 +1287,13 @@ func TestRelationOptionsValidate(t *testing.T) { { "empty", schema.RelationOptions{}, - []string{"maxSelect", "collectionId"}, + []string{"collectionId"}, }, { "empty CollectionId", schema.RelationOptions{ CollectionId: "", - MaxSelect: 1, + MaxSelect: types.Pointer(1), }, []string{"collectionId"}, }, @@ -1291,7 +1301,7 @@ func TestRelationOptionsValidate(t *testing.T) { "MaxSelect <= 0", schema.RelationOptions{ CollectionId: "abc", - MaxSelect: 0, + MaxSelect: types.Pointer(0), }, []string{"maxSelect"}, }, @@ -1299,33 +1309,7 @@ func TestRelationOptionsValidate(t *testing.T) { "MaxSelect > 0 && non-empty CollectionId", schema.RelationOptions{ CollectionId: "abc", - MaxSelect: 1, - }, - []string{}, - }, - } - - checkFieldOptionsScenarios(t, scenarios) -} - -func TestUserOptionsValidate(t *testing.T) { - scenarios := []fieldOptionsScenario{ - { - "empty", - schema.UserOptions{}, - []string{"maxSelect"}, - }, - { - "MaxSelect <= 0", - schema.UserOptions{ - MaxSelect: 0, - }, - []string{"maxSelect"}, - }, - { - "MaxSelect > 0", - schema.UserOptions{ - MaxSelect: 1, + MaxSelect: types.Pointer(1), }, []string{}, }, diff --git a/models/user.go b/models/user.go deleted file mode 100644 index 6982c0e3d..000000000 --- a/models/user.go +++ /dev/null @@ -1,47 +0,0 @@ -package models - -import ( - "encoding/json" - - "github.com/pocketbase/pocketbase/tools/types" -) - -var _ Model = (*User)(nil) - -const ( - // ProfileCollectionName is the name of the system user profiles collection. - ProfileCollectionName = "profiles" - - // ProfileCollectionUserFieldName is the name of the user field from the system user profiles collection. - ProfileCollectionUserFieldName = "userId" -) - -type User struct { - BaseAccount - - Verified bool `db:"verified" json:"verified"` - LastVerificationSentAt types.DateTime `db:"lastVerificationSentAt" json:"lastVerificationSentAt"` - - // profile rel - Profile *Record `db:"-" json:"profile"` -} - -func (m *User) TableName() string { - return "_users" -} - -// AsMap returns the current user data as a plain map -// (including the profile relation, if loaded). -func (m *User) AsMap() (map[string]any, error) { - userBytes, err := json.Marshal(m) - if err != nil { - return nil, err - } - - result := map[string]any{} - if err := json.Unmarshal(userBytes, &result); err != nil { - return nil, err - } - - return result, nil -} diff --git a/models/user_test.go b/models/user_test.go deleted file mode 100644 index 195502130..000000000 --- a/models/user_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package models_test - -import ( - "encoding/json" - "testing" - - "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tools/types" -) - -func TestUserTableName(t *testing.T) { - m := models.User{} - if m.TableName() != "_users" { - t.Fatalf("Unexpected table name, got %q", m.TableName()) - } -} - -func TestUserAsMap(t *testing.T) { - date, _ := types.ParseDateTime("2022-01-01 01:12:23.456") - - m := models.User{} - m.Id = "210a896c-1e32-4c94-ae06-90c25fcf6791" - m.Email = "test@example.com" - m.PasswordHash = "test" - m.LastResetSentAt = date - m.Updated = date - m.RefreshTokenKey() - - result, err := m.AsMap() - if err != nil { - t.Fatal(err) - } - - encoded, err := json.Marshal(result) - if err != nil { - t.Fatal(err) - } - - expected := `{"created":"","email":"test@example.com","id":"210a896c-1e32-4c94-ae06-90c25fcf6791","lastResetSentAt":"2022-01-01 01:12:23.456","lastVerificationSentAt":"","profile":null,"updated":"2022-01-01 01:12:23.456","verified":false}` - if string(encoded) != expected { - t.Errorf("Expected %s, got %s", expected, string(encoded)) - } -} diff --git a/pocketbase.go b/pocketbase.go index 67c57b2b3..6043ec0fc 100644 --- a/pocketbase.go +++ b/pocketbase.go @@ -128,6 +128,7 @@ func (pb *PocketBase) Start() error { // register system commands pb.RootCmd.AddCommand(cmd.NewServeCommand(pb, !pb.hideStartBanner)) pb.RootCmd.AddCommand(cmd.NewMigrateCommand(pb)) + pb.RootCmd.AddCommand(cmd.NewTempUpgradeCommand(pb)) return pb.Execute() } diff --git a/resolvers/record_field_resolver.go b/resolvers/record_field_resolver.go index 09bbb9a79..10dd5b36d 100644 --- a/resolvers/record_field_resolver.go +++ b/resolvers/record_field_resolver.go @@ -3,6 +3,7 @@ package resolvers import ( "encoding/json" "fmt" + "strconv" "strings" "github.com/pocketbase/dbx" @@ -19,6 +20,20 @@ import ( // ensure that `search.FieldResolver` interface is implemented var _ search.FieldResolver = (*RecordFieldResolver)(nil) +// list of auth filter fields that don't require join with the auth +// collection or any other extra checks to be resolved +var plainRequestAuthFields = []string{ + "@request.auth." + schema.FieldNameId, + "@request.auth." + schema.FieldNameCollectionId, + "@request.auth." + schema.FieldNameCollectionName, + "@request.auth." + schema.FieldNameUsername, + "@request.auth." + schema.FieldNameEmail, + "@request.auth." + schema.FieldNameEmailVisibility, + "@request.auth." + schema.FieldNameVerified, + "@request.auth." + schema.FieldNameCreated, + "@request.auth." + schema.FieldNameUpdated, +} + type join struct { id string table string @@ -35,28 +50,37 @@ type join struct { type RecordFieldResolver struct { dao *daos.Dao baseCollection *models.Collection + allowHiddenFields bool allowedFields []string requestData map[string]any - joins []join // we cannot use a map because the insertion order is not preserved loadedCollections []*models.Collection + joins []join // we cannot use a map because the insertion order is not preserved + exprs []dbx.Expression } // NewRecordFieldResolver creates and initializes a new `RecordFieldResolver`. +// +// @todo consider changing in v0.8+: +// - requestData to a typed struct when introducing the "IN" operator +// - allowHiddenFields -> isSystemAdmin func NewRecordFieldResolver( dao *daos.Dao, baseCollection *models.Collection, requestData map[string]any, + allowHiddenFields bool, ) *RecordFieldResolver { return &RecordFieldResolver{ dao: dao, baseCollection: baseCollection, requestData: requestData, + allowHiddenFields: allowHiddenFields, joins: []join{}, + exprs: []dbx.Expression{}, loadedCollections: []*models.Collection{baseCollection}, allowedFields: []string{ `^\w+[\w\.]*$`, `^\@request\.method$`, - `^\@request\.user\.\w+[\w\.]*$`, + `^\@request\.auth\.\w+[\w\.]*$`, `^\@request\.data\.\w+[\w\.]*$`, `^\@request\.query\.\w+[\w\.]*$`, `^\@collection\.\w+\.\w+[\w\.]*$`, @@ -77,6 +101,12 @@ func (r *RecordFieldResolver) UpdateQuery(query *dbx.SelectQuery) error { } } + for _, expr := range r.exprs { + if expr != nil { + query.AndWhere(expr) + } + } + return nil } @@ -86,7 +116,7 @@ func (r *RecordFieldResolver) UpdateQuery(query *dbx.SelectQuery) error { // id // project.screen.status // @request.status -// @request.user.profile.someRelation.name +// @request.auth.someRelation.name // @collection.product.name func (r *RecordFieldResolver) Resolve(fieldName string) (resultName string, placeholderParams dbx.Params, err error) { if len(r.allowedFields) > 0 && !list.ExistInSliceWithRegex(fieldName, r.allowedFields) { @@ -98,6 +128,11 @@ func (r *RecordFieldResolver) Resolve(fieldName string) (resultName string, plac currentCollectionName := r.baseCollection.Name currentTableAlias := inflector.Columnify(currentCollectionName) + // flag indicating whether to return null on missing field or return on an error + nullifyMisingField := false + + allowHiddenFields := r.allowHiddenFields + // check for @collection field (aka. non-relational join) // must be in the format "@collection.COLLECTION_NAME.FIELD[.FIELD2....]" if props[0] == "@collection" { @@ -113,55 +148,70 @@ func (r *RecordFieldResolver) Resolve(fieldName string) (resultName string, plac return "", nil, fmt.Errorf("Failed to load collection %q from field path %q.", currentCollectionName, fieldName) } - r.addJoin(inflector.Columnify(collection.Name), currentTableAlias, nil) + // always allow hidden fields since the @collection.* filter is a system one + allowHiddenFields = true + + r.registerJoin(inflector.Columnify(collection.Name), currentTableAlias, nil) props = props[2:] // leave only the collection fields } else if props[0] == "@request" { - // check for @request field if len(props) == 1 { return "", nil, fmt.Errorf("Invalid @request data field path in %q.", fieldName) } - // not a profile relational field - if !strings.HasPrefix(fieldName, "@request.user.profile.") { + // plain @request.* field + if !strings.HasPrefix(fieldName, "@request.auth.") || list.ExistInSlice(fieldName, plainRequestAuthFields) { return r.resolveStaticRequestField(props[1:]...) } - // resolve the profile collection fields - currentCollectionName = models.ProfileCollectionName - currentTableAlias = inflector.Columnify("__user_" + currentCollectionName) + // always allow hidden fields since the @request.* filter is a system one + allowHiddenFields = true - collection, err := r.loadCollection(currentCollectionName) - if err != nil { - return "", nil, fmt.Errorf("Failed to load collection %q from field path %q.", currentCollectionName, fieldName) - } + // enable the ignore flag for missing @request.auth.* fields + // for consistency with @request.data.* and @request.query.* + nullifyMisingField = true - profileIdPlaceholder, profileIdPlaceholderParam, err := r.resolveStaticRequestField("user", "profile", "id") - if err != nil { - return "", nil, fmt.Errorf("Failed to resolve @request.user.profile.id path in %q.", fieldName) + // resolve the auth collection fields + // --- + rawAuthRecordId, _ := extractNestedMapVal(r.requestData, "auth", "id") + authRecordId := cast.ToString(rawAuthRecordId) + if authRecordId == "" { + return "NULL", nil, nil } - if strings.ToLower(profileIdPlaceholder) == "null" { - // the user doesn't have an associated profile + + rawAuthCollectionId, _ := extractNestedMapVal(r.requestData, "auth", schema.FieldNameCollectionId) + authCollectionId := cast.ToString(rawAuthCollectionId) + if authCollectionId == "" { return "NULL", nil, nil } - // join the profile collection - r.addJoin( + collection, err := r.loadCollection(authCollectionId) + if err != nil { + return "", nil, fmt.Errorf("Failed to load collection %q from field path %q.", currentCollectionName, fieldName) + } + + currentCollectionName = collection.Name + currentTableAlias = "__auth_" + inflector.Columnify(currentCollectionName) + + authIdParamKey := "auth" + security.RandomString(5) + authIdParams := dbx.Params{authIdParamKey: authRecordId} + // --- + + // join the auth collection + r.registerJoin( inflector.Columnify(collection.Name), currentTableAlias, dbx.NewExp(fmt.Sprintf( - // aka. profiles.id = profileId - "[[%s.id]] = %s", - currentTableAlias, - profileIdPlaceholder, - ), profileIdPlaceholderParam), + // aka. __auth_users.id = :userId + "[[%s.id]] = {:%s}", + inflector.Columnify(currentTableAlias), + authIdParamKey, + ), authIdParams), ) - props = props[3:] // leave only the profile fields + props = props[2:] // leave only the auth relation fields } - baseModelFields := schema.ReservedFieldNames() - totalProps := len(props) for i, prop := range props { @@ -170,13 +220,37 @@ func (r *RecordFieldResolver) Resolve(fieldName string) (resultName string, plac return "", nil, fmt.Errorf("Failed to resolve field %q.", prop) } - // base model prop (always available but not part of the collection schema) - if list.ExistInSlice(prop, baseModelFields) { + systemFieldNames := schema.BaseModelFieldNames() + if collection.IsAuth() { + systemFieldNames = append( + systemFieldNames, + schema.FieldNameUsername, + schema.FieldNameVerified, + schema.FieldNameEmailVisibility, + schema.FieldNameEmail, + ) + } + + // internal model prop (always available but not part of the collection schema) + if list.ExistInSlice(prop, systemFieldNames) { + // allow querying only auth records with emails marked as public + if prop == schema.FieldNameEmail && !allowHiddenFields { + r.registerExpr(dbx.NewExp(fmt.Sprintf( + "[[%s.%s]] = TRUE", + currentTableAlias, + inflector.Columnify(schema.FieldNameEmailVisibility), + ))) + } + return fmt.Sprintf("[[%s.%s]]", currentTableAlias, inflector.Columnify(prop)), nil, nil } field := collection.Schema.GetFieldByName(prop) if field == nil { + if nullifyMisingField { + return "NULL", nil, nil + } + return "", nil, fmt.Errorf("Unrecognized field %q.", prop) } @@ -185,6 +259,28 @@ func (r *RecordFieldResolver) Resolve(fieldName string) (resultName string, plac return fmt.Sprintf("[[%s.%s]]", currentTableAlias, inflector.Columnify(prop)), nil, nil } + // check if it is a json field + if field.Type == schema.FieldTypeJson { + var jsonPath strings.Builder + jsonPath.WriteString("$") + for _, p := range props[i+1:] { + if _, err := strconv.Atoi(p); err == nil { + jsonPath.WriteString("[") + jsonPath.WriteString(inflector.Columnify(p)) + jsonPath.WriteString("]") + } else { + jsonPath.WriteString(".") + jsonPath.WriteString(inflector.Columnify(p)) + } + } + return fmt.Sprintf( + "JSON_EXTRACT([[%s.%s]], '%s')", + currentTableAlias, + inflector.Columnify(prop), + jsonPath.String(), + ), nil, nil + } + // check if it is a relation field if field.Type != schema.FieldTypeRelation { return "", nil, fmt.Errorf("Field %q is not a valid relation.", prop) @@ -210,7 +306,7 @@ func (r *RecordFieldResolver) Resolve(fieldName string) (resultName string, plac jeTable := currentTableAlias + "_" + cleanFieldName + "_je" jePair := currentTableAlias + "." + cleanFieldName - r.addJoin( + r.registerJoin( fmt.Sprintf( // note: the case is used to normalize value access for single and multiple relations. `json_each(CASE WHEN json_valid([[%s]]) THEN [[%s]] ELSE json_array([[%s]]) END)`, @@ -219,7 +315,7 @@ func (r *RecordFieldResolver) Resolve(fieldName string) (resultName string, plac jeTable, nil, ) - r.addJoin( + r.registerJoin( inflector.Columnify(newCollectionName), newTableAlias, dbx.NewExp(fmt.Sprintf("[[%s.id]] = [[%s.value]]", newTableAlias, jeTable)), @@ -306,7 +402,7 @@ func (r *RecordFieldResolver) loadCollection(collectionNameOrId string) (*models return collection, nil } -func (r *RecordFieldResolver) addJoin(tableName string, tableAlias string, on dbx.Expression) { +func (r *RecordFieldResolver) registerJoin(tableName string, tableAlias string, on dbx.Expression) { tableExpr := fmt.Sprintf("%s %s", tableName, tableAlias) join := join{ @@ -326,3 +422,7 @@ func (r *RecordFieldResolver) addJoin(tableName string, tableAlias string, on db // register new join r.joins = append(r.joins, join) } + +func (r *RecordFieldResolver) registerExpr(expr dbx.Expression) { + r.exprs = append(r.exprs, expr) +} diff --git a/resolvers/record_field_resolver_test.go b/resolvers/record_field_resolver_test.go index 6393ef922..30467cde6 100644 --- a/resolvers/record_field_resolver_test.go +++ b/resolvers/record_field_resolver_test.go @@ -14,111 +14,155 @@ func TestRecordFieldResolverUpdateQuery(t *testing.T) { app, _ := tests.NewTestApp() defer app.Cleanup() - collection, err := app.Dao().FindCollectionByNameOrId("demo4") + authRecord, err := app.Dao().FindRecordById("users", "4q1xlclmfloku33") if err != nil { t.Fatal(err) } requestData := map[string]any{ - "user": map[string]any{ - "id": "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - "profile": map[string]any{ - "id": "d13f60a4-5765-48c7-9e1d-3e782340f833", - "name": "test", - }, - }, + "auth": authRecord.PublicExport(), } scenarios := []struct { - name string - fields []string - expectQuery string + name string + collectionIdOrName string + fields []string + allowHiddenFields bool + expectQuery string }{ { "missing field", + "demo4", []string{""}, + false, "SELECT `demo4`.* FROM `demo4`", }, { "non relation field", + "demo4", []string{"title"}, + false, "SELECT `demo4`.* FROM `demo4`", }, { "incomplete rel", - []string{"onerel"}, + "demo4", + []string{"self_rel_one"}, + false, "SELECT `demo4`.* FROM `demo4`", }, { - "single rel", - []string{"onerel.title"}, - "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.onerel]]) THEN [[demo4.onerel]] ELSE json_array([[demo4.onerel]]) END) `demo4_onerel_je` LEFT JOIN `demo4` `demo4_onerel` ON [[demo4_onerel.id]] = [[demo4_onerel_je.value]]", + "single rel (self rel)", + "demo4", + []string{"self_rel_one.title"}, + false, + "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.self_rel_one]]) THEN [[demo4.self_rel_one]] ELSE json_array([[demo4.self_rel_one]]) END) `demo4_self_rel_one_je` LEFT JOIN `demo4` `demo4_self_rel_one` ON [[demo4_self_rel_one.id]] = [[demo4_self_rel_one_je.value]]", + }, + { + "single rel (other collection)", + "demo4", + []string{"rel_one_cascade.title"}, + false, + "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.rel_one_cascade]]) THEN [[demo4.rel_one_cascade]] ELSE json_array([[demo4.rel_one_cascade]]) END) `demo4_rel_one_cascade_je` LEFT JOIN `demo3` `demo4_rel_one_cascade` ON [[demo4_rel_one_cascade.id]] = [[demo4_rel_one_cascade_je.value]]", }, { "non-relation field + single rel", - []string{"title", "onerel.title"}, - "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.onerel]]) THEN [[demo4.onerel]] ELSE json_array([[demo4.onerel]]) END) `demo4_onerel_je` LEFT JOIN `demo4` `demo4_onerel` ON [[demo4_onerel.id]] = [[demo4_onerel_je.value]]", + "demo4", + []string{"title", "self_rel_one.title"}, + false, + "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.self_rel_one]]) THEN [[demo4.self_rel_one]] ELSE json_array([[demo4.self_rel_one]]) END) `demo4_self_rel_one_je` LEFT JOIN `demo4` `demo4_self_rel_one` ON [[demo4_self_rel_one.id]] = [[demo4_self_rel_one_je.value]]", }, { "nested incomplete rels", - []string{"manyrels.onerel"}, - "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.manyrels]]) THEN [[demo4.manyrels]] ELSE json_array([[demo4.manyrels]]) END) `demo4_manyrels_je` LEFT JOIN `demo4` `demo4_manyrels` ON [[demo4_manyrels.id]] = [[demo4_manyrels_je.value]]", + "demo4", + []string{"self_rel_many.self_rel_one"}, + false, + "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.self_rel_many]]) THEN [[demo4.self_rel_many]] ELSE json_array([[demo4.self_rel_many]]) END) `demo4_self_rel_many_je` LEFT JOIN `demo4` `demo4_self_rel_many` ON [[demo4_self_rel_many.id]] = [[demo4_self_rel_many_je.value]]", }, { "nested complete rels", - []string{"manyrels.onerel.title"}, - "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.manyrels]]) THEN [[demo4.manyrels]] ELSE json_array([[demo4.manyrels]]) END) `demo4_manyrels_je` LEFT JOIN `demo4` `demo4_manyrels` ON [[demo4_manyrels.id]] = [[demo4_manyrels_je.value]] LEFT JOIN json_each(CASE WHEN json_valid([[demo4_manyrels.onerel]]) THEN [[demo4_manyrels.onerel]] ELSE json_array([[demo4_manyrels.onerel]]) END) `demo4_manyrels_onerel_je` LEFT JOIN `demo4` `demo4_manyrels_onerel` ON [[demo4_manyrels_onerel.id]] = [[demo4_manyrels_onerel_je.value]]", + "demo4", + []string{"self_rel_many.self_rel_one.title"}, + false, + "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.self_rel_many]]) THEN [[demo4.self_rel_many]] ELSE json_array([[demo4.self_rel_many]]) END) `demo4_self_rel_many_je` LEFT JOIN `demo4` `demo4_self_rel_many` ON [[demo4_self_rel_many.id]] = [[demo4_self_rel_many_je.value]] LEFT JOIN json_each(CASE WHEN json_valid([[demo4_self_rel_many.self_rel_one]]) THEN [[demo4_self_rel_many.self_rel_one]] ELSE json_array([[demo4_self_rel_many.self_rel_one]]) END) `demo4_self_rel_many_self_rel_one_je` LEFT JOIN `demo4` `demo4_self_rel_many_self_rel_one` ON [[demo4_self_rel_many_self_rel_one.id]] = [[demo4_self_rel_many_self_rel_one_je.value]]", }, { "repeated nested rels", - []string{"manyrels.onerel.manyrels.onerel.title"}, - "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.manyrels]]) THEN [[demo4.manyrels]] ELSE json_array([[demo4.manyrels]]) END) `demo4_manyrels_je` LEFT JOIN `demo4` `demo4_manyrels` ON [[demo4_manyrels.id]] = [[demo4_manyrels_je.value]] LEFT JOIN json_each(CASE WHEN json_valid([[demo4_manyrels.onerel]]) THEN [[demo4_manyrels.onerel]] ELSE json_array([[demo4_manyrels.onerel]]) END) `demo4_manyrels_onerel_je` LEFT JOIN `demo4` `demo4_manyrels_onerel` ON [[demo4_manyrels_onerel.id]] = [[demo4_manyrels_onerel_je.value]] LEFT JOIN json_each(CASE WHEN json_valid([[demo4_manyrels_onerel.manyrels]]) THEN [[demo4_manyrels_onerel.manyrels]] ELSE json_array([[demo4_manyrels_onerel.manyrels]]) END) `demo4_manyrels_onerel_manyrels_je` LEFT JOIN `demo4` `demo4_manyrels_onerel_manyrels` ON [[demo4_manyrels_onerel_manyrels.id]] = [[demo4_manyrels_onerel_manyrels_je.value]] LEFT JOIN json_each(CASE WHEN json_valid([[demo4_manyrels_onerel_manyrels.onerel]]) THEN [[demo4_manyrels_onerel_manyrels.onerel]] ELSE json_array([[demo4_manyrels_onerel_manyrels.onerel]]) END) `demo4_manyrels_onerel_manyrels_onerel_je` LEFT JOIN `demo4` `demo4_manyrels_onerel_manyrels_onerel` ON [[demo4_manyrels_onerel_manyrels_onerel.id]] = [[demo4_manyrels_onerel_manyrels_onerel_je.value]]", + "demo4", + []string{"self_rel_many.self_rel_one.self_rel_many.self_rel_one.title"}, + false, + "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.self_rel_many]]) THEN [[demo4.self_rel_many]] ELSE json_array([[demo4.self_rel_many]]) END) `demo4_self_rel_many_je` LEFT JOIN `demo4` `demo4_self_rel_many` ON [[demo4_self_rel_many.id]] = [[demo4_self_rel_many_je.value]] LEFT JOIN json_each(CASE WHEN json_valid([[demo4_self_rel_many.self_rel_one]]) THEN [[demo4_self_rel_many.self_rel_one]] ELSE json_array([[demo4_self_rel_many.self_rel_one]]) END) `demo4_self_rel_many_self_rel_one_je` LEFT JOIN `demo4` `demo4_self_rel_many_self_rel_one` ON [[demo4_self_rel_many_self_rel_one.id]] = [[demo4_self_rel_many_self_rel_one_je.value]] LEFT JOIN json_each(CASE WHEN json_valid([[demo4_self_rel_many_self_rel_one.self_rel_many]]) THEN [[demo4_self_rel_many_self_rel_one.self_rel_many]] ELSE json_array([[demo4_self_rel_many_self_rel_one.self_rel_many]]) END) `demo4_self_rel_many_self_rel_one_self_rel_many_je` LEFT JOIN `demo4` `demo4_self_rel_many_self_rel_one_self_rel_many` ON [[demo4_self_rel_many_self_rel_one_self_rel_many.id]] = [[demo4_self_rel_many_self_rel_one_self_rel_many_je.value]] LEFT JOIN json_each(CASE WHEN json_valid([[demo4_self_rel_many_self_rel_one_self_rel_many.self_rel_one]]) THEN [[demo4_self_rel_many_self_rel_one_self_rel_many.self_rel_one]] ELSE json_array([[demo4_self_rel_many_self_rel_one_self_rel_many.self_rel_one]]) END) `demo4_self_rel_many_self_rel_one_self_rel_many_self_rel_one_je` LEFT JOIN `demo4` `demo4_self_rel_many_self_rel_one_self_rel_many_self_rel_one` ON [[demo4_self_rel_many_self_rel_one_self_rel_many_self_rel_one.id]] = [[demo4_self_rel_many_self_rel_one_self_rel_many_self_rel_one_je.value]]", }, { "multiple rels", - []string{"manyrels.title", "onerel.onefile"}, - "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.manyrels]]) THEN [[demo4.manyrels]] ELSE json_array([[demo4.manyrels]]) END) `demo4_manyrels_je` LEFT JOIN `demo4` `demo4_manyrels` ON [[demo4_manyrels.id]] = [[demo4_manyrels_je.value]] LEFT JOIN json_each(CASE WHEN json_valid([[demo4.onerel]]) THEN [[demo4.onerel]] ELSE json_array([[demo4.onerel]]) END) `demo4_onerel_je` LEFT JOIN `demo4` `demo4_onerel` ON [[demo4_onerel.id]] = [[demo4_onerel_je.value]]", + "demo4", + []string{"self_rel_many.title", "self_rel_one.onefile"}, + false, + "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN json_each(CASE WHEN json_valid([[demo4.self_rel_many]]) THEN [[demo4.self_rel_many]] ELSE json_array([[demo4.self_rel_many]]) END) `demo4_self_rel_many_je` LEFT JOIN `demo4` `demo4_self_rel_many` ON [[demo4_self_rel_many.id]] = [[demo4_self_rel_many_je.value]] LEFT JOIN json_each(CASE WHEN json_valid([[demo4.self_rel_one]]) THEN [[demo4.self_rel_one]] ELSE json_array([[demo4.self_rel_one]]) END) `demo4_self_rel_one_je` LEFT JOIN `demo4` `demo4_self_rel_one` ON [[demo4_self_rel_one.id]] = [[demo4_self_rel_one_je.value]]", }, { "@collection join", - []string{"@collection.demo.title", "@collection.demo2.text", "@collection.demo.file"}, - "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN `demo` `__collection_demo` LEFT JOIN `demo2` `__collection_demo2`", - }, - { - "static @request.user.profile fields", - []string{"@request.user.id", "@request.user.profile.id", "@request.data.demo"}, - "^" + - regexp.QuoteMeta("SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN `profiles` `__user_profiles` ON [[__user_profiles.id]] =") + - " {:.*}$", + "demo4", + []string{"@collection.demo1.text", "@collection.demo2.active", "@collection.demo1.file_one"}, + false, + "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN `demo1` `__collection_demo1` LEFT JOIN `demo2` `__collection_demo2`", }, { - "relational @request.user.profile fields", - []string{"@request.user.profile.rel.id", "@request.user.profile.rel.name"}, + "@request.auth fields", + "demo4", + []string{"@request.auth.id", "@request.auth.username", "@request.auth.rel.title", "@request.data.demo"}, + false, "^" + - regexp.QuoteMeta("SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN `profiles` `__user_profiles` ON [[__user_profiles.id]] =") + + regexp.QuoteMeta("SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN `users` `__auth_users` ON [[__auth_users.id]] =") + " {:.*} " + - regexp.QuoteMeta("LEFT JOIN json_each(CASE WHEN json_valid([[__user_profiles.rel]]) THEN [[__user_profiles.rel]] ELSE json_array([[__user_profiles.rel]]) END) `__user_profiles_rel_je` LEFT JOIN `profiles` `__user_profiles_rel` ON [[__user_profiles_rel.id]] = [[__user_profiles_rel_je.value]]") + + regexp.QuoteMeta("LEFT JOIN json_each(CASE WHEN json_valid([[__auth_users.rel]]) THEN [[__auth_users.rel]] ELSE json_array([[__auth_users.rel]]) END) `__auth_users_rel_je` LEFT JOIN `demo2` `__auth_users_rel` ON [[__auth_users_rel.id]] = [[__auth_users_rel_je.value]]") + "$", }, + { + "hidden field with system filters (ignore emailVisibility)", + "demo4", + []string{"@collection.users.email", "@request.auth.email"}, + false, + "SELECT DISTINCT `demo4`.* FROM `demo4` LEFT JOIN `users` `__collection_users`", + }, + { + "hidden field (add emailVisibility)", + "users", + []string{"email"}, + false, + "SELECT `users`.* FROM `users` WHERE [[users.emailVisibility]] = TRUE", + }, + { + "hidden field (force ignore emailVisibility)", + "users", + []string{"email"}, + true, + "SELECT `users`.* FROM `users`", + }, } for _, s := range scenarios { + collection, err := app.Dao().FindCollectionByNameOrId(s.collectionIdOrName) + if err != nil { + t.Errorf("[%s] Failed to load collection %s: %v", s.name, s.collectionIdOrName, err) + } + query := app.Dao().RecordQuery(collection) - r := resolvers.NewRecordFieldResolver(app.Dao(), collection, requestData) + r := resolvers.NewRecordFieldResolver(app.Dao(), collection, requestData, s.allowHiddenFields) for _, field := range s.fields { r.Resolve(field) } if err := r.UpdateQuery(query); err != nil { - t.Errorf("(%s) UpdateQuery failed with error %v", s.name, err) + t.Errorf("[%s] UpdateQuery failed with error %v", s.name, err) continue } rawQuery := query.Build().SQL() if !list.ExistInSliceWithRegex(rawQuery, []string{s.expectQuery}) { - t.Errorf("(%s) Expected query\n %v \ngot:\n %v", s.name, s.expectQuery, rawQuery) + t.Errorf("[%s] Expected query\n %v \ngot:\n %v", s.name, s.expectQuery, rawQuery) } } } @@ -132,16 +176,16 @@ func TestRecordFieldResolverResolveSchemaFields(t *testing.T) { t.Fatal(err) } + authRecord, err := app.Dao().FindRecordById("users", "4q1xlclmfloku33") + if err != nil { + t.Fatal(err) + } + requestData := map[string]any{ - "user": map[string]any{ - "id": "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - "profile": map[string]any{ - "id": "d13f60a4-5765-48c7-9e1d-3e782340f833", - }, - }, + "auth": authRecord.PublicExport(), } - r := resolvers.NewRecordFieldResolver(app.Dao(), collection, requestData) + r := resolvers.NewRecordFieldResolver(app.Dao(), collection, requestData, true) scenarios := []struct { fieldName string @@ -157,28 +201,31 @@ func TestRecordFieldResolverResolveSchemaFields(t *testing.T) { {"updated", false, "[[demo4.updated]]"}, {"title", false, "[[demo4.title]]"}, {"title.test", true, ""}, - {"manyrels", false, "[[demo4.manyrels]]"}, - {"manyrels.", true, ""}, - {"manyrels.unknown", true, ""}, - {"manyrels.title", false, "[[demo4_manyrels.title]]"}, - {"manyrels.onerel.manyrels.onefile", false, "[[demo4_manyrels_onerel_manyrels.onefile]]"}, - // @request.user.profile relation join: - {"@request.user.profile.rel", false, "[[__user_profiles.rel]]"}, - {"@request.user.profile.rel.name", false, "[[__user_profiles_rel.name]]"}, + {"self_rel_many", false, "[[demo4.self_rel_many]]"}, + {"self_rel_many.", true, ""}, + {"self_rel_many.unknown", true, ""}, + {"self_rel_many.title", false, "[[demo4_self_rel_many.title]]"}, + {"self_rel_many.self_rel_one.self_rel_many.title", false, "[[demo4_self_rel_many_self_rel_one_self_rel_many.title]]"}, + // json_extract + {"json_array.0", false, "JSON_EXTRACT([[demo4.json_array]], '$[0]')"}, + {"json_object.a.b.c", false, "JSON_EXTRACT([[demo4.json_object]], '$.a.b.c')"}, + // @request.auth relation join: + {"@request.auth.rel", false, "[[__auth_users.rel]]"}, + {"@request.auth.rel.title", false, "[[__auth_users_rel.title]]"}, // @collection fieds: {"@collect", true, ""}, {"collection.demo4.title", true, ""}, {"@collection", true, ""}, {"@collection.unknown", true, ""}, - {"@collection.demo", true, ""}, - {"@collection.demo.", true, ""}, - {"@collection.demo.title", false, "[[__collection_demo.title]]"}, + {"@collection.demo2", true, ""}, + {"@collection.demo2.", true, ""}, + {"@collection.demo2.title", false, "[[__collection_demo2.title]]"}, {"@collection.demo4.title", false, "[[__collection_demo4.title]]"}, {"@collection.demo4.id", false, "[[__collection_demo4.id]]"}, {"@collection.demo4.created", false, "[[__collection_demo4.created]]"}, {"@collection.demo4.updated", false, "[[__collection_demo4.updated]]"}, - {"@collection.demo4.manyrels.missing", true, ""}, - {"@collection.demo4.manyrels.onerel.manyrels.onerel.onefile", false, "[[__collection_demo4_manyrels_onerel_manyrels_onerel.onefile]]"}, + {"@collection.demo4.self_rel_many.missing", true, ""}, + {"@collection.demo4.self_rel_many.self_rel_one.self_rel_many.self_rel_one.title", false, "[[__collection_demo4_self_rel_many_self_rel_one_self_rel_many_self_rel_one.title]]"}, } for _, s := range scenarios { @@ -210,6 +257,11 @@ func TestRecordFieldResolverResolveStaticRequestDataFields(t *testing.T) { t.Fatal(err) } + authRecord, err := app.Dao().FindRecordById("users", "4q1xlclmfloku33") + if err != nil { + t.Fatal(err) + } + requestData := map[string]any{ "method": "get", "query": map[string]any{ @@ -219,16 +271,10 @@ func TestRecordFieldResolverResolveStaticRequestDataFields(t *testing.T) { "b": 456, "c": map[string]int{"sub": 1}, }, - "user": map[string]any{ - "id": "4d0197cc-2b4a-3f83-a26b-d77bc8423d3c", - "profile": map[string]any{ - "id": "d13f60a4-5765-48c7-9e1d-3e782340f833", - "name": "test", - }, - }, + "user": authRecord.PublicExport(), } - r := resolvers.NewRecordFieldResolver(app.Dao(), collection, requestData) + r := resolvers.NewRecordFieldResolver(app.Dao(), collection, requestData, true) scenarios := []struct { fieldName string @@ -247,9 +293,9 @@ func TestRecordFieldResolverResolveStaticRequestDataFields(t *testing.T) { {"@request.data.b", false, `456`}, {"@request.data.b.missing", false, ``}, {"@request.data.c", false, `"{\"sub\":1}"`}, - {"@request.user", true, ""}, - {"@request.user.id", false, `"4d0197cc-2b4a-3f83-a26b-d77bc8423d3c"`}, - {"@request.user.profile", false, `"{\"id\":\"d13f60a4-5765-48c7-9e1d-3e782340f833\",\"name\":\"test\"}"`}, + {"@request.auth", true, ""}, + {"@request.auth.id", false, `"4q1xlclmfloku33"`}, + {"@request.auth.file", false, `"[]"`}, } for i, s := range scenarios { diff --git a/tests/app.go b/tests/app.go index 60410e2c9..4a93d0ea4 100644 --- a/tests/app.go +++ b/tests/app.go @@ -157,63 +157,23 @@ func NewTestApp(optTestDataDir ...string) (*TestApp, error) { return nil }) - t.OnUsersListRequest().Add(func(e *core.UsersListEvent) error { - t.EventCalls["OnUsersListRequest"]++ + t.OnRecordAuthRequest().Add(func(e *core.RecordAuthEvent) error { + t.EventCalls["OnRecordAuthRequest"]++ return nil }) - t.OnUserViewRequest().Add(func(e *core.UserViewEvent) error { - t.EventCalls["OnUserViewRequest"]++ + t.OnRecordListExternalAuths().Add(func(e *core.RecordListExternalAuthsEvent) error { + t.EventCalls["OnRecordListExternalAuths"]++ return nil }) - t.OnUserBeforeCreateRequest().Add(func(e *core.UserCreateEvent) error { - t.EventCalls["OnUserBeforeCreateRequest"]++ + t.OnRecordBeforeUnlinkExternalAuthRequest().Add(func(e *core.RecordUnlinkExternalAuthEvent) error { + t.EventCalls["OnRecordBeforeUnlinkExternalAuthRequest"]++ return nil }) - t.OnUserAfterCreateRequest().Add(func(e *core.UserCreateEvent) error { - t.EventCalls["OnUserAfterCreateRequest"]++ - return nil - }) - - t.OnUserBeforeUpdateRequest().Add(func(e *core.UserUpdateEvent) error { - t.EventCalls["OnUserBeforeUpdateRequest"]++ - return nil - }) - - t.OnUserAfterUpdateRequest().Add(func(e *core.UserUpdateEvent) error { - t.EventCalls["OnUserAfterUpdateRequest"]++ - return nil - }) - - t.OnUserBeforeDeleteRequest().Add(func(e *core.UserDeleteEvent) error { - t.EventCalls["OnUserBeforeDeleteRequest"]++ - return nil - }) - - t.OnUserAfterDeleteRequest().Add(func(e *core.UserDeleteEvent) error { - t.EventCalls["OnUserAfterDeleteRequest"]++ - return nil - }) - - t.OnUserAuthRequest().Add(func(e *core.UserAuthEvent) error { - t.EventCalls["OnUserAuthRequest"]++ - return nil - }) - - t.OnUserListExternalAuths().Add(func(e *core.UserListExternalAuthsEvent) error { - t.EventCalls["OnUserListExternalAuths"]++ - return nil - }) - - t.OnUserBeforeUnlinkExternalAuthRequest().Add(func(e *core.UserUnlinkExternalAuthEvent) error { - t.EventCalls["OnUserBeforeUnlinkExternalAuthRequest"]++ - return nil - }) - - t.OnUserAfterUnlinkExternalAuthRequest().Add(func(e *core.UserUnlinkExternalAuthEvent) error { - t.EventCalls["OnUserAfterUnlinkExternalAuthRequest"]++ + t.OnRecordAfterUnlinkExternalAuthRequest().Add(func(e *core.RecordUnlinkExternalAuthEvent) error { + t.EventCalls["OnRecordAfterUnlinkExternalAuthRequest"]++ return nil }) @@ -227,33 +187,33 @@ func NewTestApp(optTestDataDir ...string) (*TestApp, error) { return nil }) - t.OnMailerBeforeUserResetPasswordSend().Add(func(e *core.MailerUserEvent) error { - t.EventCalls["OnMailerBeforeUserResetPasswordSend"]++ + t.OnMailerBeforeRecordResetPasswordSend().Add(func(e *core.MailerRecordEvent) error { + t.EventCalls["OnMailerBeforeRecordResetPasswordSend"]++ return nil }) - t.OnMailerAfterUserResetPasswordSend().Add(func(e *core.MailerUserEvent) error { - t.EventCalls["OnMailerAfterUserResetPasswordSend"]++ + t.OnMailerAfterRecordResetPasswordSend().Add(func(e *core.MailerRecordEvent) error { + t.EventCalls["OnMailerAfterRecordResetPasswordSend"]++ return nil }) - t.OnMailerBeforeUserVerificationSend().Add(func(e *core.MailerUserEvent) error { - t.EventCalls["OnMailerBeforeUserVerificationSend"]++ + t.OnMailerBeforeRecordVerificationSend().Add(func(e *core.MailerRecordEvent) error { + t.EventCalls["OnMailerBeforeRecordVerificationSend"]++ return nil }) - t.OnMailerAfterUserVerificationSend().Add(func(e *core.MailerUserEvent) error { - t.EventCalls["OnMailerAfterUserVerificationSend"]++ + t.OnMailerAfterRecordVerificationSend().Add(func(e *core.MailerRecordEvent) error { + t.EventCalls["OnMailerAfterRecordVerificationSend"]++ return nil }) - t.OnMailerBeforeUserChangeEmailSend().Add(func(e *core.MailerUserEvent) error { - t.EventCalls["OnMailerBeforeUserChangeEmailSend"]++ + t.OnMailerBeforeRecordChangeEmailSend().Add(func(e *core.MailerRecordEvent) error { + t.EventCalls["OnMailerBeforeRecordChangeEmailSend"]++ return nil }) - t.OnMailerAfterUserChangeEmailSend().Add(func(e *core.MailerUserEvent) error { - t.EventCalls["OnMailerAfterUserChangeEmailSend"]++ + t.OnMailerAfterRecordChangeEmailSend().Add(func(e *core.MailerRecordEvent) error { + t.EventCalls["OnMailerAfterRecordChangeEmailSend"]++ return nil }) diff --git a/tests/data/data.db b/tests/data/data.db index bf707cb4f..87d713c82 100644 Binary files a/tests/data/data.db and b/tests/data/data.db differ diff --git a/tests/data/logs.db b/tests/data/logs.db index 3861eea09..62f9fe561 100644 Binary files a/tests/data/logs.db and b/tests/data/logs.db differ diff --git a/tests/data/storage/2c1010aa-b8fe-41d9-a980-99534ca8a167/94568ca2-0bee-49d7-b749-06cb97956fd9/01562272-e67e-4925-9f37-02b5f899853c.txt b/tests/data/storage/2c1010aa-b8fe-41d9-a980-99534ca8a167/94568ca2-0bee-49d7-b749-06cb97956fd9/01562272-e67e-4925-9f37-02b5f899853c.txt deleted file mode 100644 index 16b14f5da..000000000 --- a/tests/data/storage/2c1010aa-b8fe-41d9-a980-99534ca8a167/94568ca2-0bee-49d7-b749-06cb97956fd9/01562272-e67e-4925-9f37-02b5f899853c.txt +++ /dev/null @@ -1 +0,0 @@ -test file diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png deleted file mode 100644 index dc980c39c..000000000 Binary files a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png and /dev/null differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/0x50_4881bdef-06b4-4dea-8d97-6125ad242677.png b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/0x50_4881bdef-06b4-4dea-8d97-6125ad242677.png deleted file mode 100644 index f69bb6806..000000000 Binary files a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/0x50_4881bdef-06b4-4dea-8d97-6125ad242677.png and /dev/null differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/100x100_4881bdef-06b4-4dea-8d97-6125ad242677.png b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/100x100_4881bdef-06b4-4dea-8d97-6125ad242677.png deleted file mode 100644 index d727b11ec..000000000 Binary files a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/100x100_4881bdef-06b4-4dea-8d97-6125ad242677.png and /dev/null differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x0_4881bdef-06b4-4dea-8d97-6125ad242677.png b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x0_4881bdef-06b4-4dea-8d97-6125ad242677.png deleted file mode 100644 index 7e2962902..000000000 Binary files a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x0_4881bdef-06b4-4dea-8d97-6125ad242677.png and /dev/null differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50_4881bdef-06b4-4dea-8d97-6125ad242677.png b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50_4881bdef-06b4-4dea-8d97-6125ad242677.png deleted file mode 100644 index 26bd720de..000000000 Binary files a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50_4881bdef-06b4-4dea-8d97-6125ad242677.png and /dev/null differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs deleted file mode 100644 index f3935aef8..000000000 --- a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"b+ZUvKPaIXEEHnFZW1BaAQ=="} diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50b_4881bdef-06b4-4dea-8d97-6125ad242677.png b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50b_4881bdef-06b4-4dea-8d97-6125ad242677.png deleted file mode 100644 index a12c046ec..000000000 Binary files a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50b_4881bdef-06b4-4dea-8d97-6125ad242677.png and /dev/null differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50b_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50b_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs deleted file mode 100644 index b0805cd35..000000000 --- a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50b_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"DHDmiDWZfc+R37OBSxmx6A=="} diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50f_4881bdef-06b4-4dea-8d97-6125ad242677.png b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50f_4881bdef-06b4-4dea-8d97-6125ad242677.png deleted file mode 100644 index f69bb6806..000000000 Binary files a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50f_4881bdef-06b4-4dea-8d97-6125ad242677.png and /dev/null differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50f_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50f_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs deleted file mode 100644 index 27bd0f023..000000000 --- a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50f_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"UlDqO9tdyG/wZHge4djvfg=="} diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50t_4881bdef-06b4-4dea-8d97-6125ad242677.png b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50t_4881bdef-06b4-4dea-8d97-6125ad242677.png deleted file mode 100644 index 44c75d7bf..000000000 Binary files a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50t_4881bdef-06b4-4dea-8d97-6125ad242677.png and /dev/null differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50t_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50t_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs deleted file mode 100644 index cd45c5099..000000000 --- a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x50t_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"s3qk32WZOj9nnnteIt8Gew=="} diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/848a1dea-5ddd-42d6-a00d-030547bffcfe/8fe61d65-6a2e-4f11-87b3-d8a3170bfd4f.txt b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/848a1dea-5ddd-42d6-a00d-030547bffcfe/8fe61d65-6a2e-4f11-87b3-d8a3170bfd4f.txt deleted file mode 100644 index 16b14f5da..000000000 --- a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/848a1dea-5ddd-42d6-a00d-030547bffcfe/8fe61d65-6a2e-4f11-87b3-d8a3170bfd4f.txt +++ /dev/null @@ -1 +0,0 @@ -test file diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/848a1dea-5ddd-42d6-a00d-030547bffcfe/8fe61d65-6a2e-4f11-87b3-d8a3170bfd4f.txt.attrs b/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/848a1dea-5ddd-42d6-a00d-030547bffcfe/8fe61d65-6a2e-4f11-87b3-d8a3170bfd4f.txt.attrs deleted file mode 100644 index 5fad56f79..000000000 --- a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/848a1dea-5ddd-42d6-a00d-030547bffcfe/8fe61d65-6a2e-4f11-87b3-d8a3170bfd4f.txt.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"sFQDISxmvcjMxZf+32zV/g=="} diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png new file mode 100644 index 000000000..f6ce991a8 Binary files /dev/null and b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x0_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png.attrs similarity index 67% rename from tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x0_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs rename to tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png.attrs index 4ee96fcc8..e78288f65 100644 --- a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/70x0_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs +++ b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/300_1SEi6Q6U72.png.attrs @@ -1 +1 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"eVVDssRj5yVxpXa/D13Oxg=="} +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"zZhZjzVvCvpcxtMAJie3GQ=="} diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/0x50_300_1SEi6Q6U72.png b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/0x50_300_1SEi6Q6U72.png new file mode 100644 index 000000000..21cedaff3 Binary files /dev/null and b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/0x50_300_1SEi6Q6U72.png differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/0x50_300_1SEi6Q6U72.png.attrs similarity index 67% rename from tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs rename to tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/0x50_300_1SEi6Q6U72.png.attrs index 6d00eb887..25de6a1b6 100644 --- a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs +++ b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/0x50_300_1SEi6Q6U72.png.attrs @@ -1 +1 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"n/jfHKrjRJEIh1wHLtCjQw=="} +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"iqCiUST0LvGibMMM1qxZAA=="} diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/100x100_300_1SEi6Q6U72.png b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/100x100_300_1SEi6Q6U72.png new file mode 100644 index 000000000..1b876773a Binary files /dev/null and b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/100x100_300_1SEi6Q6U72.png differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/0x50_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/100x100_300_1SEi6Q6U72.png.attrs similarity index 67% rename from tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/0x50_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs rename to tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/100x100_300_1SEi6Q6U72.png.attrs index 27bd0f023..64e4c1d2d 100644 --- a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/0x50_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs +++ b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/100x100_300_1SEi6Q6U72.png.attrs @@ -1 +1 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"UlDqO9tdyG/wZHge4djvfg=="} +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"R7TqfvF8HP3C4+FO2eZ9tg=="} diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x0_300_1SEi6Q6U72.png b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x0_300_1SEi6Q6U72.png new file mode 100644 index 000000000..8eef56dab Binary files /dev/null and b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x0_300_1SEi6Q6U72.png differ diff --git a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/100x100_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x0_300_1SEi6Q6U72.png.attrs similarity index 67% rename from tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/100x100_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs rename to tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x0_300_1SEi6Q6U72.png.attrs index f2ea2b4ce..a382ad30b 100644 --- a/tests/data/storage/3f2888f8-075d-49fe-9d09-ea7e951000dc/577bd676-aacb-4072-b7da-99d00ee210a4/thumbs_4881bdef-06b4-4dea-8d97-6125ad242677.png/100x100_4881bdef-06b4-4dea-8d97-6125ad242677.png.attrs +++ b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x0_300_1SEi6Q6U72.png.attrs @@ -1 +1 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"mKtFIey+FX5Y7HWg+EAfNA=="} +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"XQUKRr4ZwZ9MTo2kR+KfIg=="} diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50_300_1SEi6Q6U72.png b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50_300_1SEi6Q6U72.png new file mode 100644 index 000000000..e261a55ca Binary files /dev/null and b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50_300_1SEi6Q6U72.png differ diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50_300_1SEi6Q6U72.png.attrs b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50_300_1SEi6Q6U72.png.attrs new file mode 100644 index 000000000..df305abc3 --- /dev/null +++ b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50_300_1SEi6Q6U72.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"EoyFICWlQdYZgUYTEMsp/A=="} diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50b_300_1SEi6Q6U72.png b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50b_300_1SEi6Q6U72.png new file mode 100644 index 000000000..77b110742 Binary files /dev/null and b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50b_300_1SEi6Q6U72.png differ diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50b_300_1SEi6Q6U72.png.attrs b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50b_300_1SEi6Q6U72.png.attrs new file mode 100644 index 000000000..0a7f16556 --- /dev/null +++ b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50b_300_1SEi6Q6U72.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"Pb/AI46vKOtcBW9bOsdREA=="} diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50f_300_1SEi6Q6U72.png b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50f_300_1SEi6Q6U72.png new file mode 100644 index 000000000..21cedaff3 Binary files /dev/null and b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50f_300_1SEi6Q6U72.png differ diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50f_300_1SEi6Q6U72.png.attrs b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50f_300_1SEi6Q6U72.png.attrs new file mode 100644 index 000000000..25de6a1b6 --- /dev/null +++ b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50f_300_1SEi6Q6U72.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"iqCiUST0LvGibMMM1qxZAA=="} diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50t_300_1SEi6Q6U72.png b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50t_300_1SEi6Q6U72.png new file mode 100644 index 000000000..beeaf735c Binary files /dev/null and b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50t_300_1SEi6Q6U72.png differ diff --git a/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50t_300_1SEi6Q6U72.png.attrs b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50t_300_1SEi6Q6U72.png.attrs new file mode 100644 index 000000000..7774ef0ab --- /dev/null +++ b/tests/data/storage/_pb_users_auth_/4q1xlclmfloku33/thumbs_300_1SEi6Q6U72.png/70x50t_300_1SEi6Q6U72.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"rcwrlxKlvwTgDpsHLHzBqA=="} diff --git a/tests/data/storage/_pb_users_auth_/oap640cot4yru2s/test_kfd2wYLxkz.txt b/tests/data/storage/_pb_users_auth_/oap640cot4yru2s/test_kfd2wYLxkz.txt new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/tests/data/storage/_pb_users_auth_/oap640cot4yru2s/test_kfd2wYLxkz.txt @@ -0,0 +1 @@ +test diff --git a/tests/data/storage/2c1010aa-b8fe-41d9-a980-99534ca8a167/94568ca2-0bee-49d7-b749-06cb97956fd9/01562272-e67e-4925-9f37-02b5f899853c.txt.attrs b/tests/data/storage/_pb_users_auth_/oap640cot4yru2s/test_kfd2wYLxkz.txt.attrs similarity index 60% rename from tests/data/storage/2c1010aa-b8fe-41d9-a980-99534ca8a167/94568ca2-0bee-49d7-b749-06cb97956fd9/01562272-e67e-4925-9f37-02b5f899853c.txt.attrs rename to tests/data/storage/_pb_users_auth_/oap640cot4yru2s/test_kfd2wYLxkz.txt.attrs index 5fad56f79..3396b8b70 100644 --- a/tests/data/storage/2c1010aa-b8fe-41d9-a980-99534ca8a167/94568ca2-0bee-49d7-b749-06cb97956fd9/01562272-e67e-4925-9f37-02b5f899853c.txt.attrs +++ b/tests/data/storage/_pb_users_auth_/oap640cot4yru2s/test_kfd2wYLxkz.txt.attrs @@ -1 +1 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"sFQDISxmvcjMxZf+32zV/g=="} +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"2Oj8otwPiW/Xy0ywAxuiSQ=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/315d3131-c1f7-453a-8a91-f12c06207edc.png b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/315d3131-c1f7-453a-8a91-f12c06207edc.png deleted file mode 100644 index dc980c39c..000000000 Binary files a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/315d3131-c1f7-453a-8a91-f12c06207edc.png and /dev/null differ diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/315d3131-c1f7-453a-8a91-f12c06207edc.png.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/315d3131-c1f7-453a-8a91-f12c06207edc.png.attrs deleted file mode 100644 index 6d00eb887..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/315d3131-c1f7-453a-8a91-f12c06207edc.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"n/jfHKrjRJEIh1wHLtCjQw=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/55aa6938-e53c-4b58-b446-146f3d80b2c4.txt b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/55aa6938-e53c-4b58-b446-146f3d80b2c4.txt deleted file mode 100644 index 16b14f5da..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/55aa6938-e53c-4b58-b446-146f3d80b2c4.txt +++ /dev/null @@ -1 +0,0 @@ -test file diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/55aa6938-e53c-4b58-b446-146f3d80b2c4.txt.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/55aa6938-e53c-4b58-b446-146f3d80b2c4.txt.attrs deleted file mode 100644 index 5fad56f79..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/55aa6938-e53c-4b58-b446-146f3d80b2c4.txt.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"sFQDISxmvcjMxZf+32zV/g=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/b635c395-6837-49e5-8535-b0a6ebfbdbf3.png b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/b635c395-6837-49e5-8535-b0a6ebfbdbf3.png deleted file mode 100644 index dc980c39c..000000000 Binary files a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/b635c395-6837-49e5-8535-b0a6ebfbdbf3.png and /dev/null differ diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/b635c395-6837-49e5-8535-b0a6ebfbdbf3.png.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/b635c395-6837-49e5-8535-b0a6ebfbdbf3.png.attrs deleted file mode 100644 index 6d00eb887..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/b635c395-6837-49e5-8535-b0a6ebfbdbf3.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"n/jfHKrjRJEIh1wHLtCjQw=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/c2c58441-27f5-4574-96f8-6f79dae9ff4d.png b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/c2c58441-27f5-4574-96f8-6f79dae9ff4d.png deleted file mode 100644 index dc980c39c..000000000 Binary files a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/c2c58441-27f5-4574-96f8-6f79dae9ff4d.png and /dev/null differ diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/c2c58441-27f5-4574-96f8-6f79dae9ff4d.png.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/c2c58441-27f5-4574-96f8-6f79dae9ff4d.png.attrs deleted file mode 100644 index 6d00eb887..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/c2c58441-27f5-4574-96f8-6f79dae9ff4d.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"n/jfHKrjRJEIh1wHLtCjQw=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/e526d938-c5ab-41cb-a334-85b9c3e37f72.png b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/e526d938-c5ab-41cb-a334-85b9c3e37f72.png deleted file mode 100644 index dc980c39c..000000000 Binary files a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/e526d938-c5ab-41cb-a334-85b9c3e37f72.png and /dev/null differ diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/e526d938-c5ab-41cb-a334-85b9c3e37f72.png.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/e526d938-c5ab-41cb-a334-85b9c3e37f72.png.attrs deleted file mode 100644 index 6d00eb887..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/e526d938-c5ab-41cb-a334-85b9c3e37f72.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"n/jfHKrjRJEIh1wHLtCjQw=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_315d3131-c1f7-453a-8a91-f12c06207edc.png/100x100_315d3131-c1f7-453a-8a91-f12c06207edc.png b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_315d3131-c1f7-453a-8a91-f12c06207edc.png/100x100_315d3131-c1f7-453a-8a91-f12c06207edc.png deleted file mode 100644 index d727b11ec..000000000 Binary files a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_315d3131-c1f7-453a-8a91-f12c06207edc.png/100x100_315d3131-c1f7-453a-8a91-f12c06207edc.png and /dev/null differ diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_315d3131-c1f7-453a-8a91-f12c06207edc.png/100x100_315d3131-c1f7-453a-8a91-f12c06207edc.png.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_315d3131-c1f7-453a-8a91-f12c06207edc.png/100x100_315d3131-c1f7-453a-8a91-f12c06207edc.png.attrs deleted file mode 100644 index f2ea2b4ce..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_315d3131-c1f7-453a-8a91-f12c06207edc.png/100x100_315d3131-c1f7-453a-8a91-f12c06207edc.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"mKtFIey+FX5Y7HWg+EAfNA=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png/100x100_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png/100x100_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png deleted file mode 100644 index d727b11ec..000000000 Binary files a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png/100x100_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png and /dev/null differ diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png/100x100_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png/100x100_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png.attrs deleted file mode 100644 index f2ea2b4ce..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png/100x100_b635c395-6837-49e5-8535-b0a6ebfbdbf3.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"mKtFIey+FX5Y7HWg+EAfNA=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png/100x100_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png/100x100_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png deleted file mode 100644 index d727b11ec..000000000 Binary files a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png/100x100_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png and /dev/null differ diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png/100x100_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png/100x100_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png.attrs deleted file mode 100644 index f2ea2b4ce..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png/100x100_c2c58441-27f5-4574-96f8-6f79dae9ff4d.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"mKtFIey+FX5Y7HWg+EAfNA=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_e526d938-c5ab-41cb-a334-85b9c3e37f72.png/100x100_e526d938-c5ab-41cb-a334-85b9c3e37f72.png b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_e526d938-c5ab-41cb-a334-85b9c3e37f72.png/100x100_e526d938-c5ab-41cb-a334-85b9c3e37f72.png deleted file mode 100644 index d727b11ec..000000000 Binary files a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_e526d938-c5ab-41cb-a334-85b9c3e37f72.png/100x100_e526d938-c5ab-41cb-a334-85b9c3e37f72.png and /dev/null differ diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_e526d938-c5ab-41cb-a334-85b9c3e37f72.png/100x100_e526d938-c5ab-41cb-a334-85b9c3e37f72.png.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_e526d938-c5ab-41cb-a334-85b9c3e37f72.png/100x100_e526d938-c5ab-41cb-a334-85b9c3e37f72.png.attrs deleted file mode 100644 index f2ea2b4ce..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/054f9f24-0a0a-4e09-87b1-bc7ff2b336a2/thumbs_e526d938-c5ab-41cb-a334-85b9c3e37f72.png/100x100_e526d938-c5ab-41cb-a334-85b9c3e37f72.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"mKtFIey+FX5Y7HWg+EAfNA=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/5e74d0b5-c183-4419-9d7c-a6a3d4a7faca.txt b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/5e74d0b5-c183-4419-9d7c-a6a3d4a7faca.txt deleted file mode 100644 index 16b14f5da..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/5e74d0b5-c183-4419-9d7c-a6a3d4a7faca.txt +++ /dev/null @@ -1 +0,0 @@ -test file diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/5e74d0b5-c183-4419-9d7c-a6a3d4a7faca.txt.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/5e74d0b5-c183-4419-9d7c-a6a3d4a7faca.txt.attrs deleted file mode 100644 index 5fad56f79..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/5e74d0b5-c183-4419-9d7c-a6a3d4a7faca.txt.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"sFQDISxmvcjMxZf+32zV/g=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/f80296fb-9fa5-4372-80f2-be196b973c7b.txt b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/f80296fb-9fa5-4372-80f2-be196b973c7b.txt deleted file mode 100644 index 16b14f5da..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/f80296fb-9fa5-4372-80f2-be196b973c7b.txt +++ /dev/null @@ -1 +0,0 @@ -test file diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/f80296fb-9fa5-4372-80f2-be196b973c7b.txt.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/f80296fb-9fa5-4372-80f2-be196b973c7b.txt.attrs deleted file mode 100644 index 5fad56f79..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/f80296fb-9fa5-4372-80f2-be196b973c7b.txt.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"sFQDISxmvcjMxZf+32zV/g=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/ff3b7633-6440-43d8-a957-1bfb3d3421ec.txt b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/ff3b7633-6440-43d8-a957-1bfb3d3421ec.txt deleted file mode 100644 index 16b14f5da..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/ff3b7633-6440-43d8-a957-1bfb3d3421ec.txt +++ /dev/null @@ -1 +0,0 @@ -test file diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/ff3b7633-6440-43d8-a957-1bfb3d3421ec.txt.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/ff3b7633-6440-43d8-a957-1bfb3d3421ec.txt.attrs deleted file mode 100644 index 5fad56f79..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/b84cd893-7119-43c9-8505-3c4e22da28a9/ff3b7633-6440-43d8-a957-1bfb3d3421ec.txt.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"sFQDISxmvcjMxZf+32zV/g=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/935a3325-f511-4d11-87f4-51034234a8d9.png b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/935a3325-f511-4d11-87f4-51034234a8d9.png deleted file mode 100644 index dc980c39c..000000000 Binary files a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/935a3325-f511-4d11-87f4-51034234a8d9.png and /dev/null differ diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/935a3325-f511-4d11-87f4-51034234a8d9.png.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/935a3325-f511-4d11-87f4-51034234a8d9.png.attrs deleted file mode 100644 index 6d00eb887..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/935a3325-f511-4d11-87f4-51034234a8d9.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"n/jfHKrjRJEIh1wHLtCjQw=="} diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/thumbs_935a3325-f511-4d11-87f4-51034234a8d9.png/100x100_935a3325-f511-4d11-87f4-51034234a8d9.png b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/thumbs_935a3325-f511-4d11-87f4-51034234a8d9.png/100x100_935a3325-f511-4d11-87f4-51034234a8d9.png deleted file mode 100644 index d727b11ec..000000000 Binary files a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/thumbs_935a3325-f511-4d11-87f4-51034234a8d9.png/100x100_935a3325-f511-4d11-87f4-51034234a8d9.png and /dev/null differ diff --git a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/thumbs_935a3325-f511-4d11-87f4-51034234a8d9.png/100x100_935a3325-f511-4d11-87f4-51034234a8d9.png.attrs b/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/thumbs_935a3325-f511-4d11-87f4-51034234a8d9.png/100x100_935a3325-f511-4d11-87f4-51034234a8d9.png.attrs deleted file mode 100644 index f2ea2b4ce..000000000 --- a/tests/data/storage/f12f3eb6-b980-4bf6-b1e4-36de0450c8be/df55c8ff-45ef-4c82-8aed-6e2183fe1125/thumbs_935a3325-f511-4d11-87f4-51034234a8d9.png/100x100_935a3325-f511-4d11-87f4-51034234a8d9.png.attrs +++ /dev/null @@ -1 +0,0 @@ -{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"mKtFIey+FX5Y7HWg+EAfNA=="} diff --git a/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/300_WlbFWSGmW9.png b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/300_WlbFWSGmW9.png new file mode 100644 index 000000000..f6ce991a8 Binary files /dev/null and b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/300_WlbFWSGmW9.png differ diff --git a/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/300_WlbFWSGmW9.png.attrs b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/300_WlbFWSGmW9.png.attrs new file mode 100644 index 000000000..e78288f65 --- /dev/null +++ b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/300_WlbFWSGmW9.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"zZhZjzVvCvpcxtMAJie3GQ=="} diff --git a/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/logo_vcfJJG5TAh.svg b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/logo_vcfJJG5TAh.svg new file mode 100644 index 000000000..5b5de956b --- /dev/null +++ b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/logo_vcfJJG5TAh.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/logo_vcfJJG5TAh.svg.attrs b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/logo_vcfJJG5TAh.svg.attrs new file mode 100644 index 000000000..7938a5a42 --- /dev/null +++ b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/logo_vcfJJG5TAh.svg.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/svg+xml","user.metadata":null,"md5":"9/B7afas4c3O6vbFcbpOug=="} diff --git a/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_QZFjKjXchk.txt b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_QZFjKjXchk.txt new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_QZFjKjXchk.txt @@ -0,0 +1 @@ +test diff --git a/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_QZFjKjXchk.txt.attrs b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_QZFjKjXchk.txt.attrs new file mode 100644 index 000000000..3396b8b70 --- /dev/null +++ b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_QZFjKjXchk.txt.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"2Oj8otwPiW/Xy0ywAxuiSQ=="} diff --git a/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_d61b33QdDU.txt b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_d61b33QdDU.txt new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_d61b33QdDU.txt @@ -0,0 +1 @@ +test diff --git a/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_d61b33QdDU.txt.attrs b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_d61b33QdDU.txt.attrs new file mode 100644 index 000000000..3396b8b70 --- /dev/null +++ b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/test_d61b33QdDU.txt.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"2Oj8otwPiW/Xy0ywAxuiSQ=="} diff --git a/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/thumbs_300_WlbFWSGmW9.png/100x100_300_WlbFWSGmW9.png b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/thumbs_300_WlbFWSGmW9.png/100x100_300_WlbFWSGmW9.png new file mode 100644 index 000000000..1b876773a Binary files /dev/null and b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/thumbs_300_WlbFWSGmW9.png/100x100_300_WlbFWSGmW9.png differ diff --git a/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/thumbs_300_WlbFWSGmW9.png/100x100_300_WlbFWSGmW9.png.attrs b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/thumbs_300_WlbFWSGmW9.png/100x100_300_WlbFWSGmW9.png.attrs new file mode 100644 index 000000000..64e4c1d2d --- /dev/null +++ b/tests/data/storage/wsmn24bux7wo113/84nmscqy84lsi1t/thumbs_300_WlbFWSGmW9.png/100x100_300_WlbFWSGmW9.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"R7TqfvF8HP3C4+FO2eZ9tg=="} diff --git a/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/300_Jsjq7RdBgA.png b/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/300_Jsjq7RdBgA.png new file mode 100644 index 000000000..f6ce991a8 Binary files /dev/null and b/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/300_Jsjq7RdBgA.png differ diff --git a/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/300_Jsjq7RdBgA.png.attrs b/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/300_Jsjq7RdBgA.png.attrs new file mode 100644 index 000000000..e78288f65 --- /dev/null +++ b/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/300_Jsjq7RdBgA.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"zZhZjzVvCvpcxtMAJie3GQ=="} diff --git a/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/thumbs_300_Jsjq7RdBgA.png/100x100_300_Jsjq7RdBgA.png b/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/thumbs_300_Jsjq7RdBgA.png/100x100_300_Jsjq7RdBgA.png new file mode 100644 index 000000000..1b876773a Binary files /dev/null and b/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/thumbs_300_Jsjq7RdBgA.png/100x100_300_Jsjq7RdBgA.png differ diff --git a/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/thumbs_300_Jsjq7RdBgA.png/100x100_300_Jsjq7RdBgA.png.attrs b/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/thumbs_300_Jsjq7RdBgA.png/100x100_300_Jsjq7RdBgA.png.attrs new file mode 100644 index 000000000..64e4c1d2d --- /dev/null +++ b/tests/data/storage/wsmn24bux7wo113/al1h9ijdeojtsjy/thumbs_300_Jsjq7RdBgA.png/100x100_300_Jsjq7RdBgA.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"R7TqfvF8HP3C4+FO2eZ9tg=="} diff --git a/tests/data/storage/wzlqyes4orhoygb/7nwo8tuiatetxdm/test_JnXeKEwgwr.txt b/tests/data/storage/wzlqyes4orhoygb/7nwo8tuiatetxdm/test_JnXeKEwgwr.txt new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/tests/data/storage/wzlqyes4orhoygb/7nwo8tuiatetxdm/test_JnXeKEwgwr.txt @@ -0,0 +1 @@ +test diff --git a/tests/data/storage/wzlqyes4orhoygb/7nwo8tuiatetxdm/test_JnXeKEwgwr.txt.attrs b/tests/data/storage/wzlqyes4orhoygb/7nwo8tuiatetxdm/test_JnXeKEwgwr.txt.attrs new file mode 100644 index 000000000..3396b8b70 --- /dev/null +++ b/tests/data/storage/wzlqyes4orhoygb/7nwo8tuiatetxdm/test_JnXeKEwgwr.txt.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"2Oj8otwPiW/Xy0ywAxuiSQ=="} diff --git a/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/300_UhLKX91HVb.png b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/300_UhLKX91HVb.png new file mode 100644 index 000000000..f6ce991a8 Binary files /dev/null and b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/300_UhLKX91HVb.png differ diff --git a/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/300_UhLKX91HVb.png.attrs b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/300_UhLKX91HVb.png.attrs new file mode 100644 index 000000000..e78288f65 --- /dev/null +++ b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/300_UhLKX91HVb.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"zZhZjzVvCvpcxtMAJie3GQ=="} diff --git a/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/test_FLurQTgrY8.txt b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/test_FLurQTgrY8.txt new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/test_FLurQTgrY8.txt @@ -0,0 +1 @@ +test diff --git a/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/test_FLurQTgrY8.txt.attrs b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/test_FLurQTgrY8.txt.attrs new file mode 100644 index 000000000..3396b8b70 --- /dev/null +++ b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/test_FLurQTgrY8.txt.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"text/plain; charset=utf-8","user.metadata":null,"md5":"2Oj8otwPiW/Xy0ywAxuiSQ=="} diff --git a/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/thumbs_300_UhLKX91HVb.png/100x100_300_UhLKX91HVb.png b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/thumbs_300_UhLKX91HVb.png/100x100_300_UhLKX91HVb.png new file mode 100644 index 000000000..1b876773a Binary files /dev/null and b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/thumbs_300_UhLKX91HVb.png/100x100_300_UhLKX91HVb.png differ diff --git a/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/thumbs_300_UhLKX91HVb.png/100x100_300_UhLKX91HVb.png.attrs b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/thumbs_300_UhLKX91HVb.png/100x100_300_UhLKX91HVb.png.attrs new file mode 100644 index 000000000..64e4c1d2d --- /dev/null +++ b/tests/data/storage/wzlqyes4orhoygb/lcl9d87w22ml6jy/thumbs_300_UhLKX91HVb.png/100x100_300_UhLKX91HVb.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"R7TqfvF8HP3C4+FO2eZ9tg=="} diff --git a/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/300_JdfBOieXAW.png b/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/300_JdfBOieXAW.png new file mode 100644 index 000000000..f6ce991a8 Binary files /dev/null and b/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/300_JdfBOieXAW.png differ diff --git a/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/300_JdfBOieXAW.png.attrs b/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/300_JdfBOieXAW.png.attrs new file mode 100644 index 000000000..e78288f65 --- /dev/null +++ b/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/300_JdfBOieXAW.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"zZhZjzVvCvpcxtMAJie3GQ=="} diff --git a/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/thumbs_300_JdfBOieXAW.png/100x100_300_JdfBOieXAW.png b/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/thumbs_300_JdfBOieXAW.png/100x100_300_JdfBOieXAW.png new file mode 100644 index 000000000..1b876773a Binary files /dev/null and b/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/thumbs_300_JdfBOieXAW.png/100x100_300_JdfBOieXAW.png differ diff --git a/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/thumbs_300_JdfBOieXAW.png/100x100_300_JdfBOieXAW.png.attrs b/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/thumbs_300_JdfBOieXAW.png/100x100_300_JdfBOieXAW.png.attrs new file mode 100644 index 000000000..64e4c1d2d --- /dev/null +++ b/tests/data/storage/wzlqyes4orhoygb/mk5fmymtx4wsprk/thumbs_300_JdfBOieXAW.png/100x100_300_JdfBOieXAW.png.attrs @@ -0,0 +1 @@ +{"user.cache_control":"","user.content_disposition":"","user.content_encoding":"","user.content_language":"","user.content_type":"image/png","user.metadata":null,"md5":"R7TqfvF8HP3C4+FO2eZ9tg=="} diff --git a/tests/logs.go b/tests/logs.go index 24ee5f632..39ed21724 100644 --- a/tests/logs.go +++ b/tests/logs.go @@ -30,8 +30,8 @@ func MockRequestLogsData(app *TestApp) error { "", "", "{}", - "2022-05-01 10:00:00.123", - "2022-05-01 10:00:00.123" + "2022-05-01 10:00:00.123Z", + "2022-05-01 10:00:00.123Z" ), ( "f2133873-44fb-9f38-bf82-c918f53b310d", @@ -44,8 +44,8 @@ func MockRequestLogsData(app *TestApp) error { "", "", '{"errorDetails":"error_details..."}', - "2022-05-02 10:00:00.123", - "2022-05-02 10:00:00.123" + "2022-05-02 10:00:00.123Z", + "2022-05-02 10:00:00.123Z" ); `).Execute() diff --git a/tokens/admin.go b/tokens/admin.go index 83b9158cc..3a21b90ab 100644 --- a/tokens/admin.go +++ b/tokens/admin.go @@ -10,7 +10,7 @@ import ( // NewAdminAuthToken generates and returns a new admin authentication token. func NewAdminAuthToken(app core.App, admin *models.Admin) (string, error) { return security.NewToken( - jwt.MapClaims{"id": admin.Id, "type": "admin"}, + jwt.MapClaims{"id": admin.Id, "type": TypeAdmin}, (admin.TokenKey + app.Settings().AdminAuthToken.Secret), app.Settings().AdminAuthToken.Duration, ) @@ -19,7 +19,7 @@ func NewAdminAuthToken(app core.App, admin *models.Admin) (string, error) { // NewAdminResetPasswordToken generates and returns a new admin password reset request token. func NewAdminResetPasswordToken(app core.App, admin *models.Admin) (string, error) { return security.NewToken( - jwt.MapClaims{"id": admin.Id, "type": "admin", "email": admin.Email}, + jwt.MapClaims{"id": admin.Id, "type": TypeAdmin, "email": admin.Email}, (admin.TokenKey + app.Settings().AdminPasswordResetToken.Secret), app.Settings().AdminPasswordResetToken.Duration, ) diff --git a/tokens/record.go b/tokens/record.go new file mode 100644 index 000000000..0cf7d0f09 --- /dev/null +++ b/tokens/record.go @@ -0,0 +1,78 @@ +package tokens + +import ( + "errors" + + "github.com/golang-jwt/jwt/v4" + "github.com/pocketbase/pocketbase/core" + "github.com/pocketbase/pocketbase/models" + "github.com/pocketbase/pocketbase/tools/security" +) + +// NewRecordAuthToken generates and returns a new auth record authentication token. +func NewRecordAuthToken(app core.App, record *models.Record) (string, error) { + if !record.Collection().IsAuth() { + return "", errors.New("The record is not from an auth collection.") + } + + return security.NewToken( + jwt.MapClaims{ + "id": record.Id, + "type": TypeAuthRecord, + "collectionId": record.Collection().Id, + }, + (record.TokenKey() + app.Settings().RecordAuthToken.Secret), + app.Settings().RecordAuthToken.Duration, + ) +} + +// NewRecordVerifyToken generates and returns a new record verification token. +func NewRecordVerifyToken(app core.App, record *models.Record) (string, error) { + if !record.Collection().IsAuth() { + return "", errors.New("The record is not from an auth collection.") + } + + return security.NewToken( + jwt.MapClaims{ + "id": record.Id, + "type": TypeAuthRecord, + "collectionId": record.Collection().Id, + "email": record.Email(), + }, + (record.TokenKey() + app.Settings().RecordVerificationToken.Secret), + app.Settings().RecordVerificationToken.Duration, + ) +} + +// NewRecordResetPasswordToken generates and returns a new auth record password reset request token. +func NewRecordResetPasswordToken(app core.App, record *models.Record) (string, error) { + if !record.Collection().IsAuth() { + return "", errors.New("The record is not from an auth collection.") + } + + return security.NewToken( + jwt.MapClaims{ + "id": record.Id, + "type": TypeAuthRecord, + "collectionId": record.Collection().Id, + "email": record.Email(), + }, + (record.TokenKey() + app.Settings().RecordPasswordResetToken.Secret), + app.Settings().RecordPasswordResetToken.Duration, + ) +} + +// NewRecordChangeEmailToken generates and returns a new auth record change email request token. +func NewRecordChangeEmailToken(app core.App, record *models.Record, newEmail string) (string, error) { + return security.NewToken( + jwt.MapClaims{ + "id": record.Id, + "type": TypeAuthRecord, + "collectionId": record.Collection().Id, + "email": record.Email(), + "newEmail": newEmail, + }, + (record.TokenKey() + app.Settings().RecordEmailChangeToken.Secret), + app.Settings().RecordEmailChangeToken.Duration, + ) +} diff --git a/tokens/record_test.go b/tokens/record_test.go new file mode 100644 index 000000000..e9470cbdd --- /dev/null +++ b/tokens/record_test.go @@ -0,0 +1,100 @@ +package tokens_test + +import ( + "testing" + + "github.com/pocketbase/pocketbase/tests" + "github.com/pocketbase/pocketbase/tokens" +) + +func TestNewRecordAuthToken(t *testing.T) { + app, _ := tests.NewTestApp() + defer app.Cleanup() + + user, err := app.Dao().FindAuthRecordByEmail("users", "test@example.com") + if err != nil { + t.Fatal(err) + } + + token, err := tokens.NewRecordAuthToken(app, user) + if err != nil { + t.Fatal(err) + } + + tokenRecord, _ := app.Dao().FindAuthRecordByToken( + token, + app.Settings().RecordAuthToken.Secret, + ) + if tokenRecord == nil || tokenRecord.Id != user.Id { + t.Fatalf("Expected auth record %v, got %v", user, tokenRecord) + } +} + +func TestNewRecordVerifyToken(t *testing.T) { + app, _ := tests.NewTestApp() + defer app.Cleanup() + + user, err := app.Dao().FindAuthRecordByEmail("users", "test@example.com") + if err != nil { + t.Fatal(err) + } + + token, err := tokens.NewRecordVerifyToken(app, user) + if err != nil { + t.Fatal(err) + } + + tokenRecord, _ := app.Dao().FindAuthRecordByToken( + token, + app.Settings().RecordVerificationToken.Secret, + ) + if tokenRecord == nil || tokenRecord.Id != user.Id { + t.Fatalf("Expected auth record %v, got %v", user, tokenRecord) + } +} + +func TestNewRecordResetPasswordToken(t *testing.T) { + app, _ := tests.NewTestApp() + defer app.Cleanup() + + user, err := app.Dao().FindAuthRecordByEmail("users", "test@example.com") + if err != nil { + t.Fatal(err) + } + + token, err := tokens.NewRecordResetPasswordToken(app, user) + if err != nil { + t.Fatal(err) + } + + tokenRecord, _ := app.Dao().FindAuthRecordByToken( + token, + app.Settings().RecordPasswordResetToken.Secret, + ) + if tokenRecord == nil || tokenRecord.Id != user.Id { + t.Fatalf("Expected auth record %v, got %v", user, tokenRecord) + } +} + +func TestNewRecordChangeEmailToken(t *testing.T) { + app, _ := tests.NewTestApp() + defer app.Cleanup() + + user, err := app.Dao().FindAuthRecordByEmail("users", "test@example.com") + if err != nil { + t.Fatal(err) + } + + token, err := tokens.NewRecordChangeEmailToken(app, user, "test_new@example.com") + if err != nil { + t.Fatal(err) + } + + tokenRecord, _ := app.Dao().FindAuthRecordByToken( + token, + app.Settings().RecordEmailChangeToken.Secret, + ) + if tokenRecord == nil || tokenRecord.Id != user.Id { + t.Fatalf("Expected auth record %v, got %v", user, tokenRecord) + } +} diff --git a/tokens/tokens.go b/tokens/tokens.go index cccd2a0e6..7a0a928ae 100644 --- a/tokens/tokens.go +++ b/tokens/tokens.go @@ -1,2 +1,7 @@ // Package tokens implements various user and admin tokens generation methods. package tokens + +const ( + TypeAdmin = "admin" + TypeAuthRecord = "authRecord" +) diff --git a/tokens/user.go b/tokens/user.go deleted file mode 100644 index 858d30e52..000000000 --- a/tokens/user.go +++ /dev/null @@ -1,44 +0,0 @@ -package tokens - -import ( - "github.com/golang-jwt/jwt/v4" - "github.com/pocketbase/pocketbase/core" - "github.com/pocketbase/pocketbase/models" - "github.com/pocketbase/pocketbase/tools/security" -) - -// NewUserAuthToken generates and returns a new user authentication token. -func NewUserAuthToken(app core.App, user *models.User) (string, error) { - return security.NewToken( - jwt.MapClaims{"id": user.Id, "type": "user"}, - (user.TokenKey + app.Settings().UserAuthToken.Secret), - app.Settings().UserAuthToken.Duration, - ) -} - -// NewUserVerifyToken generates and returns a new user verification token. -func NewUserVerifyToken(app core.App, user *models.User) (string, error) { - return security.NewToken( - jwt.MapClaims{"id": user.Id, "type": "user", "email": user.Email}, - (user.TokenKey + app.Settings().UserVerificationToken.Secret), - app.Settings().UserVerificationToken.Duration, - ) -} - -// NewUserResetPasswordToken generates and returns a new user password reset request token. -func NewUserResetPasswordToken(app core.App, user *models.User) (string, error) { - return security.NewToken( - jwt.MapClaims{"id": user.Id, "type": "user", "email": user.Email}, - (user.TokenKey + app.Settings().UserPasswordResetToken.Secret), - app.Settings().UserPasswordResetToken.Duration, - ) -} - -// NewUserChangeEmailToken generates and returns a new user change email request token. -func NewUserChangeEmailToken(app core.App, user *models.User, newEmail string) (string, error) { - return security.NewToken( - jwt.MapClaims{"id": user.Id, "type": "user", "email": user.Email, "newEmail": newEmail}, - (user.TokenKey + app.Settings().UserEmailChangeToken.Secret), - app.Settings().UserEmailChangeToken.Duration, - ) -} diff --git a/tokens/user_test.go b/tokens/user_test.go deleted file mode 100644 index 2152af877..000000000 --- a/tokens/user_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package tokens_test - -import ( - "testing" - - "github.com/pocketbase/pocketbase/tests" - "github.com/pocketbase/pocketbase/tokens" -) - -func TestNewUserAuthToken(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - user, err := app.Dao().FindUserByEmail("test@example.com") - if err != nil { - t.Fatal(err) - } - - token, err := tokens.NewUserAuthToken(app, user) - if err != nil { - t.Fatal(err) - } - - tokenUser, _ := app.Dao().FindUserByToken( - token, - app.Settings().UserAuthToken.Secret, - ) - if tokenUser == nil || tokenUser.Id != user.Id { - t.Fatalf("Expected user %v, got %v", user, tokenUser) - } -} - -func TestNewUserVerifyToken(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - user, err := app.Dao().FindUserByEmail("test@example.com") - if err != nil { - t.Fatal(err) - } - - token, err := tokens.NewUserVerifyToken(app, user) - if err != nil { - t.Fatal(err) - } - - tokenUser, _ := app.Dao().FindUserByToken( - token, - app.Settings().UserVerificationToken.Secret, - ) - if tokenUser == nil || tokenUser.Id != user.Id { - t.Fatalf("Expected user %v, got %v", user, tokenUser) - } -} - -func TestNewUserResetPasswordToken(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - user, err := app.Dao().FindUserByEmail("test@example.com") - if err != nil { - t.Fatal(err) - } - - token, err := tokens.NewUserResetPasswordToken(app, user) - if err != nil { - t.Fatal(err) - } - - tokenUser, _ := app.Dao().FindUserByToken( - token, - app.Settings().UserPasswordResetToken.Secret, - ) - if tokenUser == nil || tokenUser.Id != user.Id { - t.Fatalf("Expected user %v, got %v", user, tokenUser) - } -} - -func TestNewUserChangeEmailToken(t *testing.T) { - app, _ := tests.NewTestApp() - defer app.Cleanup() - - user, err := app.Dao().FindUserByEmail("test@example.com") - if err != nil { - t.Fatal(err) - } - - token, err := tokens.NewUserChangeEmailToken(app, user, "test_new@example.com") - if err != nil { - t.Fatal(err) - } - - tokenUser, _ := app.Dao().FindUserByToken( - token, - app.Settings().UserEmailChangeToken.Secret, - ) - if tokenUser == nil || tokenUser.Id != user.Id { - t.Fatalf("Expected user %v, got %v", user, tokenUser) - } -} diff --git a/tools/filesystem/filesystem.go b/tools/filesystem/filesystem.go index 503562e86..3ee3c5f2d 100644 --- a/tools/filesystem/filesystem.go +++ b/tools/filesystem/filesystem.go @@ -5,6 +5,7 @@ import ( "errors" "image" "io" + "mime/multipart" "net/http" "os" "path/filepath" @@ -116,6 +117,39 @@ func (s *System) Upload(content []byte, fileKey string) error { return w.Close() } +// UploadMultipart upload the provided multipart file to the fileKey location. +func (s *System) UploadMultipart(fh *multipart.FileHeader, fileKey string) error { + f, err := fh.Open() + if err != nil { + return err + } + defer f.Close() + + mt, err := mimetype.DetectReader(f) + if err != nil { + return err + } + + // rewind + f.Seek(0, io.SeekStart) + + opts := &blob.WriterOptions{ + ContentType: mt.String(), + } + + w, err := s.bucket.NewWriter(s.ctx, fileKey, opts) + if err != nil { + return err + } + + if _, err := w.ReadFrom(f); err != nil { + w.Close() + return err + } + + return w.Close() +} + // Delete deletes stored file at fileKey location. func (s *System) Delete(fileKey string) error { return s.bucket.Delete(s.ctx, fileKey) @@ -233,7 +267,7 @@ func (s *System) Serve(response http.ResponseWriter, fileKey string, name string response.Header().Set("Content-Length", strconv.FormatInt(r.Size(), 10)) response.Header().Set("Content-Security-Policy", "default-src 'none'; media-src 'self'; style-src 'unsafe-inline'; sandbox") - // All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT) + // all HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT) // (see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1) // // NB! time.LoadLocation may fail on non-Unix systems (see https://github.com/pocketbase/pocketbase/issues/45) @@ -242,6 +276,13 @@ func (s *System) Serve(response http.ResponseWriter, fileKey string, name string response.Header().Set("Last-Modified", r.ModTime().In(location).Format("Mon, 02 Jan 06 15:04:05 MST")) } + // set a default cache-control header + // (valid for 30 days but the cache is allowed to reuse the file for any requests + // that are made in the last day while revalidating the response in the background) + if response.Header().Get("Cache-Control") == "" { + response.Header().Set("Cache-Control", "max-age=2592000, stale-while-revalidate=86400") + } + // copy from the read range to response. _, err := io.Copy(response, r) @@ -282,6 +323,7 @@ func (s *System) CreateThumb(originalKey string, thumbKey, thumbSize string) err defer r.Close() // create imaging object from the original reader + // (note: only the first frame for animated image formats) img, decodeErr := imaging.Decode(r, imaging.AutoOrientation(true)) if decodeErr != nil { return decodeErr diff --git a/tools/filesystem/filesystem_test.go b/tools/filesystem/filesystem_test.go index eb3ec7b9d..69c27d050 100644 --- a/tools/filesystem/filesystem_test.go +++ b/tools/filesystem/filesystem_test.go @@ -1,8 +1,11 @@ package filesystem_test import ( + "bytes" "image" "image/png" + "mime/multipart" + "net/http" "net/http/httptest" "os" "path/filepath" @@ -128,6 +131,46 @@ func TestFileSystemDeletePrefix(t *testing.T) { } } +func TestFileSystemUploadMultipart(t *testing.T) { + dir := createTestDir(t) + defer os.RemoveAll(dir) + + // create multipart form file + body := new(bytes.Buffer) + mp := multipart.NewWriter(body) + w, err := mp.CreateFormFile("test", "test") + if err != nil { + t.Fatalf("Failed creating form file: %v", err) + } + w.Write([]byte("demo")) + mp.Close() + + req := httptest.NewRequest(http.MethodPost, "/", body) + req.Header.Add("Content-Type", mp.FormDataContentType()) + + file, fh, err := req.FormFile("test") + if err != nil { + t.Fatalf("Failed to fetch form file: %v", err) + } + defer file.Close() + // --- + + fs, err := filesystem.NewLocal(dir) + if err != nil { + t.Fatal(err) + } + defer fs.Close() + + uploadErr := fs.UploadMultipart(fh, "newdir/newkey.txt") + if uploadErr != nil { + t.Fatal(uploadErr) + } + + if exists, _ := fs.Exists("newdir/newkey.txt"); !exists { + t.Fatalf("Expected newdir/newkey.txt to exist") + } +} + func TestFileSystemUpload(t *testing.T) { dir := createTestDir(t) defer os.RemoveAll(dir) @@ -232,6 +275,10 @@ func TestFileSystemServe(t *testing.T) { continue } + if scenario.expectError { + continue + } + result := r.Result() for hName, hValue := range scenario.expectHeaders { @@ -244,6 +291,10 @@ func TestFileSystemServe(t *testing.T) { if v := result.Header.Get("X-Frame-Options"); v != "" { t.Errorf("(%s) Expected the X-Frame-Options header to be unset, got %v", scenario.path, v) } + + if v := result.Header.Get("Cache-Control"); v == "" { + t.Errorf("(%s) Expected Cache-Control header to be set, got empty string", scenario.path) + } } } diff --git a/tools/hook/hook.go b/tools/hook/hook.go index e3d941477..090acd153 100644 --- a/tools/hook/hook.go +++ b/tools/hook/hook.go @@ -54,12 +54,12 @@ func (h *Hook[T]) Reset() { // - hook.StopPropagation is returned in one of the handlers // - any non-nil error is returned in one of the handlers func (h *Hook[T]) Trigger(data T, oneOffHandlers ...Handler[T]) error { - h.mux.Lock() + h.mux.RLock() handlers := make([]Handler[T], 0, len(h.handlers)+len(oneOffHandlers)) handlers = append(handlers, h.handlers...) handlers = append(handlers, oneOffHandlers...) // unlock is not deferred to avoid deadlocks when Trigger is called recursive by the handlers - h.mux.Unlock() + h.mux.RUnlock() for _, fn := range handlers { err := fn(data) diff --git a/tools/mailer/smtp.go b/tools/mailer/smtp.go index f21ff5726..d93013521 100644 --- a/tools/mailer/smtp.go +++ b/tools/mailer/smtp.go @@ -46,7 +46,10 @@ func (m *SmtpClient) Send( htmlContent string, attachments map[string]io.Reader, ) error { - smtpAuth := smtp.PlainAuth("", m.username, m.password, m.host) + var smtpAuth smtp.Auth + if m.username != "" || m.password != "" { + smtpAuth = smtp.PlainAuth("", m.username, m.password, m.host) + } // create mail instance var yak *mailyak.MailYak diff --git a/tools/rest/multi_binder.go b/tools/rest/multi_binder.go index 757237dad..5467909ad 100644 --- a/tools/rest/multi_binder.go +++ b/tools/rest/multi_binder.go @@ -23,7 +23,7 @@ func BindBody(c echo.Context, i interface{}) error { ctype := req.Header.Get(echo.HeaderContentType) switch { case strings.HasPrefix(ctype, echo.MIMEApplicationJSON): - err := ReadJsonBodyCopy(c.Request(), i) + err := CopyJsonBody(c.Request(), i) if err != nil { return echo.NewHTTPErrorWithInternal(http.StatusBadRequest, err, err.Error()) } @@ -34,9 +34,9 @@ func BindBody(c echo.Context, i interface{}) error { } } -// ReadJsonBodyCopy reads the request body into i by +// CopyJsonBody reads the request body into i by // creating a copy of `r.Body` to allow multiple reads. -func ReadJsonBodyCopy(r *http.Request, i interface{}) error { +func CopyJsonBody(r *http.Request, i interface{}) error { body := r.Body // this usually shouldn't be needed because the Server calls close for us diff --git a/tools/rest/multi_binder_test.go b/tools/rest/multi_binder_test.go index 6dc905380..853e21911 100644 --- a/tools/rest/multi_binder_test.go +++ b/tools/rest/multi_binder_test.go @@ -75,14 +75,14 @@ func TestBindBody(t *testing.T) { } } -func TestReadJsonBodyCopy(t *testing.T) { +func TestCopyJsonBody(t *testing.T) { req := httptest.NewRequest(http.MethodGet, "/", strings.NewReader(`{"test":"test123"}`)) // simulate multiple reads from the same request result1 := map[string]string{} - rest.ReadJsonBodyCopy(req, &result1) + rest.CopyJsonBody(req, &result1) result2 := map[string]string{} - rest.ReadJsonBodyCopy(req, &result2) + rest.CopyJsonBody(req, &result2) if len(result1) == 0 { t.Error("Expected result1 to be filled") diff --git a/tools/rest/uploaded_file.go b/tools/rest/uploaded_file.go index 050509238..dcbb2212f 100644 --- a/tools/rest/uploaded_file.go +++ b/tools/rest/uploaded_file.go @@ -1,15 +1,14 @@ package rest import ( - "bytes" "fmt" - "io" "mime/multipart" "net/http" "path/filepath" "regexp" "strings" + "github.com/gabriel-vasile/mimetype" "github.com/pocketbase/pocketbase/tools/inflector" "github.com/pocketbase/pocketbase/tools/security" ) @@ -24,7 +23,6 @@ var extensionInvalidCharsRegex = regexp.MustCompile(`[^\w\.\*\-\+\=\#]+`) type UploadedFile struct { name string header *multipart.FileHeader - bytes []byte } // Name returns an assigned unique name to the uploaded file. @@ -37,11 +35,6 @@ func (f *UploadedFile) Header() *multipart.FileHeader { return f.header } -// Bytes returns a slice with the file content. -func (f *UploadedFile) Bytes() []byte { - return f.bytes -} - // FindUploadedFiles extracts all form files of `key` from a http request // and returns a slice with `UploadedFile` instances (if any). func FindUploadedFiles(r *http.Request, key string) ([]*UploadedFile, error) { @@ -56,26 +49,32 @@ func FindUploadedFiles(r *http.Request, key string) ([]*UploadedFile, error) { return nil, http.ErrMissingFile } - result := make([]*UploadedFile, len(r.MultipartForm.File[key])) + result := make([]*UploadedFile, 0, len(r.MultipartForm.File[key])) - for i, fh := range r.MultipartForm.File[key] { + for _, fh := range r.MultipartForm.File[key] { file, err := fh.Open() if err != nil { return nil, err } defer file.Close() - buf := bytes.NewBuffer(nil) - if _, err := io.Copy(buf, file); err != nil { - return nil, err - } - + // extension + // --- originalExt := filepath.Ext(fh.Filename) sanitizedExt := extensionInvalidCharsRegex.ReplaceAllString(originalExt, "") + if sanitizedExt == "" { + // try to detect the extension from the mime type + mt, err := mimetype.DetectReader(file) + if err != nil { + return nil, err + } + sanitizedExt = mt.Extension() + } + // name + // --- originalName := strings.TrimSuffix(fh.Filename, originalExt) sanitizedName := inflector.Snakecase(originalName) - if length := len(sanitizedName); length < 3 { // the name is too short so we concatenate an additional random part sanitizedName += ("_" + security.RandomString(10)) @@ -91,11 +90,10 @@ func FindUploadedFiles(r *http.Request, key string) ([]*UploadedFile, error) { sanitizedExt, ) - result[i] = &UploadedFile{ + result = append(result, &UploadedFile{ name: uploadedFilename, header: fh, - bytes: buf.Bytes(), - } + }) } return result, nil diff --git a/tools/rest/uploaded_file_test.go b/tools/rest/uploaded_file_test.go index 1bdb76d1a..832c49359 100644 --- a/tools/rest/uploaded_file_test.go +++ b/tools/rest/uploaded_file_test.go @@ -2,11 +2,10 @@ package rest_test import ( "bytes" - "io" "mime/multipart" "net/http" "net/http/httptest" - "os" + "regexp" "strings" "testing" @@ -14,58 +13,51 @@ import ( ) func TestFindUploadedFiles(t *testing.T) { - // create a test temporary file (with very large prefix to test if it will be truncated) - tmpFile, err := os.CreateTemp(os.TempDir(), strings.Repeat("a", 150)+"tmpfile-*.txt") - if err != nil { - t.Fatal(err) + scenarios := []struct { + filename string + expectedPattern string + }{ + {"ab.png", `^ab_\w{10}_\w{10}\.png$`}, + {"test", `^test_\w{10}\.txt$`}, + {"a b c d!@$.j!@$pg", `^a_b_c_d_\w{10}\.jpg$`}, + {strings.Repeat("a", 150), `^a{100}_\w{10}\.txt$`}, } - if _, err := tmpFile.Write([]byte("test")); err != nil { - t.Fatal(err) - } - tmpFile.Seek(0, 0) - defer tmpFile.Close() - defer os.Remove(tmpFile.Name()) - // --- - - // stub multipart form file body - body := new(bytes.Buffer) - mp := multipart.NewWriter(body) - w, err := mp.CreateFormFile("test", tmpFile.Name()) - if err != nil { - t.Fatal(err) - } - if _, err := io.Copy(w, tmpFile); err != nil { - t.Fatal(err) - } - mp.Close() - // --- - - req := httptest.NewRequest(http.MethodPost, "/", body) - req.Header.Add("Content-Type", mp.FormDataContentType()) - result, err := rest.FindUploadedFiles(req, "test") - if err != nil { - t.Fatal(err) - } + for i, s := range scenarios { + // create multipart form file body + body := new(bytes.Buffer) + mp := multipart.NewWriter(body) + w, err := mp.CreateFormFile("test", s.filename) + if err != nil { + t.Fatal(err) + } + w.Write([]byte("test")) + mp.Close() + // --- - if len(result) != 1 { - t.Fatalf("Expected 1 file, got %d", len(result)) - } + req := httptest.NewRequest(http.MethodPost, "/", body) + req.Header.Add("Content-Type", mp.FormDataContentType()) - if result[0].Header().Size != 4 { - t.Fatalf("Expected the file size to be 4 bytes, got %d", result[0].Header().Size) - } + result, err := rest.FindUploadedFiles(req, "test") + if err != nil { + t.Fatal(err) + } - if !strings.HasSuffix(result[0].Name(), ".txt") { - t.Fatalf("Expected the file name to have suffix .txt, got %v", result[0].Name()) - } + if len(result) != 1 { + t.Errorf("[%d] Expected 1 file, got %d", i, len(result)) + } - if length := len(result[0].Name()); length != 115 { // truncated + random part + ext - t.Fatalf("Expected the file name to have length of 115, got %d\n%q", length, result[0].Name()) - } + if result[0].Header().Size != 4 { + t.Errorf("[%d] Expected the file size to be 4 bytes, got %d", i, result[0].Header().Size) + } - if string(result[0].Bytes()) != "test" { - t.Fatalf("Expected the file content to be %q, got %q", "test", string(result[0].Bytes())) + pattern, err := regexp.Compile(s.expectedPattern) + if err != nil { + t.Errorf("[%d] Invalid filename pattern %q: %v", i, s.expectedPattern, err) + } + if !pattern.MatchString(result[0].Name()) { + t.Fatalf("Expected filename to match %s, got filename %s", s.expectedPattern, result[0].Name()) + } } } diff --git a/tools/search/filter.go b/tools/search/filter.go index 5db97b8e1..837aa8287 100644 --- a/tools/search/filter.go +++ b/tools/search/filter.go @@ -89,52 +89,39 @@ func (f FilterData) resolveTokenizedExpr(expr fexpr.Expr, fieldResolver FieldRes return nil, fmt.Errorf("Invalid right operand %q - %v.", expr.Right.Literal, rErr) } - // merge both operands parameters (if any) - params := dbx.Params{} - for k, v := range lParams { - params[k] = v - } - for k, v := range rParams { - params[k] = v - } - switch expr.Op { case fexpr.SignEq: - return dbx.NewExp(fmt.Sprintf("COALESCE(%s, '') = COALESCE(%s, '')", lName, rName), params), nil + return dbx.NewExp(fmt.Sprintf("COALESCE(%s, '') = COALESCE(%s, '')", lName, rName), mergeParams(lParams, rParams)), nil case fexpr.SignNeq: - return dbx.NewExp(fmt.Sprintf("COALESCE(%s, '') != COALESCE(%s, '')", lName, rName), params), nil + return dbx.NewExp(fmt.Sprintf("COALESCE(%s, '') != COALESCE(%s, '')", lName, rName), mergeParams(lParams, rParams)), nil case fexpr.SignLike: - // both sides are columns and therefore wrap the right side with "%" for contains like behavior - if len(params) == 0 { - return dbx.NewExp(fmt.Sprintf("%s LIKE ('%%' || %s || '%%')", lName, rName), params), nil + // the right side is a column and therefor wrap it with "%" for contains like behavior + if len(rParams) == 0 { + return dbx.NewExp(fmt.Sprintf("%s LIKE ('%%' || %s || '%%')", lName, rName), lParams), nil } - // normalize operands and switch sides if the left operand is a number or text - if len(lParams) > 0 { - return dbx.NewExp(fmt.Sprintf("%s LIKE %s", rName, lName), f.normalizeLikeParams(params)), nil - } - - return dbx.NewExp(fmt.Sprintf("%s LIKE %s", lName, rName), f.normalizeLikeParams(params)), nil + return dbx.NewExp(fmt.Sprintf("%s LIKE %s", lName, rName), mergeParams(lParams, wrapLikeParams(rParams))), nil case fexpr.SignNlike: - // both sides are columns and therefore wrap the right side with "%" for not-contains like behavior - if len(params) == 0 { - return dbx.NewExp(fmt.Sprintf("%s NOT LIKE ('%%' || %s || '%%')", lName, rName), params), nil + // the right side is a column and therefor wrap it with "%" for not-contains like behavior + if len(rParams) == 0 { + return dbx.NewExp(fmt.Sprintf("%s NOT LIKE ('%%' || %s || '%%')", lName, rName), lParams), nil } - // normalize operands and switch sides if the left operand is a number or text - if len(lParams) > 0 { - return dbx.NewExp(fmt.Sprintf("%s NOT LIKE %s", rName, lName), f.normalizeLikeParams(params)), nil + // normalize operands and switch sides if the left operand is a number/text, but the right one is a column + // (usually this shouldn't be needed, but it's kept for backward compatibility) + if len(lParams) > 0 && len(rParams) == 0 { + return dbx.NewExp(fmt.Sprintf("%s NOT LIKE %s", rName, lName), wrapLikeParams(lParams)), nil } - return dbx.NewExp(fmt.Sprintf("%s NOT LIKE %s", lName, rName), f.normalizeLikeParams(params)), nil + return dbx.NewExp(fmt.Sprintf("%s NOT LIKE %s", lName, rName), mergeParams(lParams, wrapLikeParams(rParams))), nil case fexpr.SignLt: - return dbx.NewExp(fmt.Sprintf("%s < %s", lName, rName), params), nil + return dbx.NewExp(fmt.Sprintf("%s < %s", lName, rName), mergeParams(lParams, rParams)), nil case fexpr.SignLte: - return dbx.NewExp(fmt.Sprintf("%s <= %s", lName, rName), params), nil + return dbx.NewExp(fmt.Sprintf("%s <= %s", lName, rName), mergeParams(lParams, rParams)), nil case fexpr.SignGt: - return dbx.NewExp(fmt.Sprintf("%s > %s", lName, rName), params), nil + return dbx.NewExp(fmt.Sprintf("%s > %s", lName, rName), mergeParams(lParams, rParams)), nil case fexpr.SignGte: - return dbx.NewExp(fmt.Sprintf("%s >= %s", lName, rName), params), nil + return dbx.NewExp(fmt.Sprintf("%s >= %s", lName, rName), mergeParams(lParams, rParams)), nil } return nil, fmt.Errorf("Unknown expression operator %q", expr.Op) @@ -190,12 +177,31 @@ func (f FilterData) resolveToken(token fexpr.Token, fieldResolver FieldResolver) return "", nil, errors.New("Unresolvable token type.") } -func (f FilterData) normalizeLikeParams(params dbx.Params) dbx.Params { +// mergeParams returns new dbx.Params where each provided params item +// is merged in the order they are specified. +func mergeParams(params ...dbx.Params) dbx.Params { + result := dbx.Params{} + + for _, p := range params { + for k, v := range p { + result[k] = v + } + } + + return result +} + +// wrapLikeParams wraps each provided param value string with `%` +// if the string doesn't contains the `%` char (including its escape sequence). +func wrapLikeParams(params dbx.Params) dbx.Params { result := dbx.Params{} for k, v := range params { vStr := cast.ToString(v) if !strings.Contains(vStr, "%") { + for i := 0; i < len(dbx.DefaultLikeEscape); i += 2 { + vStr = strings.ReplaceAll(vStr, dbx.DefaultLikeEscape[i], dbx.DefaultLikeEscape[i+1]) + } vStr = "%" + vStr + "%" } result[k] = vStr diff --git a/tools/search/filter_test.go b/tools/search/filter_test.go index d9c079a6d..98a8c23c7 100644 --- a/tools/search/filter_test.go +++ b/tools/search/filter_test.go @@ -38,8 +38,16 @@ func TestFilterDataBuildExpr(t *testing.T) { regexp.QuoteMeta("[[test1]] LIKE ('%' || [[test2]] || '%')") + "$", }, - // reversed like with text + // like with right column operand {"'lorem' ~ test1", false, + "^" + + regexp.QuoteMeta("{:") + + ".+" + + regexp.QuoteMeta("} LIKE ('%' || [[test1]] || '%')") + + "$", + }, + // like with left column operand and text as right operand + {"test1 ~ 'lorem'", false, "^" + regexp.QuoteMeta("[[test1]] LIKE {:") + ".+" + @@ -52,8 +60,16 @@ func TestFilterDataBuildExpr(t *testing.T) { regexp.QuoteMeta("[[test1]] NOT LIKE ('%' || [[test2]] || '%')") + "$", }, - // reversed not like with text + // not like with right column operand {"'lorem' !~ test1", false, + "^" + + regexp.QuoteMeta("{:") + + ".+" + + regexp.QuoteMeta("} NOT LIKE ('%' || [[test1]] || '%')") + + "$", + }, + // like with left column operand and text as right operand + {"test1 !~ 'lorem'", false, "^" + regexp.QuoteMeta("[[test1]] NOT LIKE {:") + ".+" + @@ -97,11 +113,11 @@ func TestFilterDataBuildExpr(t *testing.T) { ".+" + regexp.QuoteMeta("}) OR ([[test2]] NOT LIKE {:") + ".+" + - regexp.QuoteMeta("}))) AND ([[test1]] LIKE {:") + + regexp.QuoteMeta("}))) AND ({:") + ".+" + - regexp.QuoteMeta("})) AND ([[test2]] NOT LIKE {:") + + regexp.QuoteMeta("} LIKE ('%' || [[test1]] || '%'))) AND ({:") + ".+" + - regexp.QuoteMeta("})) AND ([[test3]] > {:") + + regexp.QuoteMeta("} NOT LIKE ('%' || [[test2]] || '%'))) AND ([[test3]] > {:") + ".+" + regexp.QuoteMeta("})) AND ([[test3]] >= {:") + ".+" + diff --git a/tools/search/provider.go b/tools/search/provider.go index 24379052f..f8d728fb1 100644 --- a/tools/search/provider.go +++ b/tools/search/provider.go @@ -5,6 +5,7 @@ import ( "math" "net/url" "strconv" + "strings" "github.com/pocketbase/dbx" ) @@ -13,7 +14,7 @@ import ( const DefaultPerPage int = 30 // MaxPerPage specifies the maximum allowed search result items returned in a single page. -const MaxPerPage int = 400 +const MaxPerPage int = 500 // url search query params const ( @@ -38,7 +39,6 @@ type Provider struct { query *dbx.SelectQuery page int perPage int - countColumn string sort []SortField filter []FilterData } @@ -53,7 +53,7 @@ type Provider struct { // // result, err := search.NewProvider(fieldResolver). // Query(baseQuery). -// ParseAndExec("page=2&filter=id>0&sort=-name", &models) +// ParseAndExec("page=2&filter=id>0&sort=-email", &models) func NewProvider(fieldResolver FieldResolver) *Provider { return &Provider{ fieldResolver: fieldResolver, @@ -70,13 +70,6 @@ func (s *Provider) Query(query *dbx.SelectQuery) *Provider { return s } -// CountColumn specifies an optional distinct column to use in the -// SELECT COUNT query. -func (s *Provider) CountColumn(countColumn string) *Provider { - s.countColumn = countColumn - return s -} - // Page sets the `page` field of the current search provider. // // Normalization on the `page` value is done during `Exec()`. @@ -170,7 +163,7 @@ func (s *Provider) Exec(items any) (*Result, error) { // clone provider's query modelsQuery := *s.query - // apply filters + // build filters for _, f := range s.filter { expr, err := f.BuildExpr(s.fieldResolver) if err != nil { @@ -197,14 +190,19 @@ func (s *Provider) Exec(items any) (*Result, error) { return nil, err } + queryInfo := modelsQuery.Info() + // count var totalCount int64 - countQuery := modelsQuery - countQuery.Distinct(false).Select("COUNT(*)").OrderBy() // unset ORDER BY statements - if s.countColumn != "" { - countQuery.Select("COUNT(DISTINCT(" + s.countColumn + "))") + var baseTable string + if len(queryInfo.From) > 0 { + baseTable = queryInfo.From[0] } - if err := countQuery.Row(&totalCount); err != nil { + countQuery := modelsQuery + rawCountQuery := countQuery.Select(strings.Join([]string{baseTable, "id"}, ".")).OrderBy().Build().SQL() + wrappedCountQuery := queryInfo.Builder.NewQuery("SELECT COUNT(*) FROM (" + rawCountQuery + ")") + wrappedCountQuery.Bind(countQuery.Build().Params()) + if err := wrappedCountQuery.Row(&totalCount); err != nil { return nil, err } diff --git a/tools/search/provider_test.go b/tools/search/provider_test.go index d03a41664..c65fe7c33 100644 --- a/tools/search/provider_test.go +++ b/tools/search/provider_test.go @@ -60,15 +60,6 @@ func TestProviderPerPage(t *testing.T) { } } -func TestProviderCountColumn(t *testing.T) { - r := &testFieldResolver{} - p := NewProvider(r).CountColumn("test") - - if p.countColumn != "test" { - t.Fatalf("Expected distinct count column %v, got %v", "test", p.countColumn) - } -} - func TestProviderSort(t *testing.T) { initialSort := []SortField{{"test1", SortAsc}, {"test2", SortAsc}} r := &testFieldResolver{} @@ -223,7 +214,6 @@ func TestProviderExecNonEmptyQuery(t *testing.T) { perPage int sort []SortField filter []FilterData - countColumn string expectError bool expectResult string expectQueries []string @@ -234,11 +224,10 @@ func TestProviderExecNonEmptyQuery(t *testing.T) { 10, []SortField{}, []FilterData{}, - "", false, `{"page":1,"perPage":10,"totalItems":2,"totalPages":1,"items":[{"test1":1,"test2":"test2.1","test3":""},{"test1":2,"test2":"test2.2","test3":""}]}`, []string{ - "SELECT COUNT(*) FROM `test` WHERE NOT (`test1` IS NULL)", + "SELECT COUNT(*) FROM (SELECT `test`.`id` FROM `test` WHERE NOT (`test1` IS NULL))", "SELECT * FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC LIMIT 10", }, }, @@ -248,11 +237,10 @@ func TestProviderExecNonEmptyQuery(t *testing.T) { 0, // fallback to default []SortField{}, []FilterData{}, - "", false, `{"page":1,"perPage":30,"totalItems":2,"totalPages":1,"items":[{"test1":1,"test2":"test2.1","test3":""},{"test1":2,"test2":"test2.2","test3":""}]}`, []string{ - "SELECT COUNT(*) FROM `test` WHERE NOT (`test1` IS NULL)", + "SELECT COUNT(*) FROM (SELECT `test`.`id` FROM `test` WHERE NOT (`test1` IS NULL))", "SELECT * FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC LIMIT 30", }, }, @@ -262,7 +250,6 @@ func TestProviderExecNonEmptyQuery(t *testing.T) { 10, []SortField{{"unknown", SortAsc}}, []FilterData{}, - "", true, "", nil, @@ -273,7 +260,6 @@ func TestProviderExecNonEmptyQuery(t *testing.T) { 10, []SortField{}, []FilterData{"test2 = 'test2.1'", "invalid"}, - "", true, "", nil, @@ -284,12 +270,11 @@ func TestProviderExecNonEmptyQuery(t *testing.T) { 5555, // will be limited by MaxPerPage []SortField{{"test2", SortDesc}}, []FilterData{"test2 != null", "test1 >= 2"}, - "", false, `{"page":1,"perPage":` + fmt.Sprint(MaxPerPage) + `,"totalItems":1,"totalPages":1,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`, []string{ - "SELECT COUNT(*) FROM `test` WHERE ((NOT (`test1` IS NULL)) AND (COALESCE(test2, '') != COALESCE(null, ''))) AND (test1 >= 2)", - "SELECT * FROM `test` WHERE ((NOT (`test1` IS NULL)) AND (COALESCE(test2, '') != COALESCE(null, ''))) AND (test1 >= 2) ORDER BY `test1` ASC, `test2` DESC LIMIT 400", + "SELECT COUNT(*) FROM (SELECT `test`.`id` FROM `test` WHERE ((NOT (`test1` IS NULL)) AND (COALESCE(test2, '') != COALESCE(null, ''))) AND (test1 >= 2))", + "SELECT * FROM `test` WHERE ((NOT (`test1` IS NULL)) AND (COALESCE(test2, '') != COALESCE(null, ''))) AND (test1 >= 2) ORDER BY `test1` ASC, `test2` DESC LIMIT 500", }, }, // valid sort and filter fields (zero results) @@ -298,11 +283,10 @@ func TestProviderExecNonEmptyQuery(t *testing.T) { 10, []SortField{{"test3", SortAsc}}, []FilterData{"test3 != ''"}, - "", false, `{"page":1,"perPage":10,"totalItems":0,"totalPages":0,"items":[]}`, []string{ - "SELECT COUNT(*) FROM `test` WHERE (NOT (`test1` IS NULL)) AND (COALESCE(test3, '') != COALESCE('', ''))", + "SELECT COUNT(*) FROM (SELECT `test`.`id` FROM `test` WHERE (NOT (`test1` IS NULL)) AND (COALESCE(test3, '') != COALESCE('', '')))", "SELECT * FROM `test` WHERE (NOT (`test1` IS NULL)) AND (COALESCE(test3, '') != COALESCE('', '')) ORDER BY `test1` ASC, `test3` ASC LIMIT 10", }, }, @@ -312,25 +296,10 @@ func TestProviderExecNonEmptyQuery(t *testing.T) { 1, []SortField{}, []FilterData{}, - "", - false, - `{"page":2,"perPage":1,"totalItems":2,"totalPages":2,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`, - []string{ - "SELECT COUNT(*) FROM `test` WHERE NOT (`test1` IS NULL)", - "SELECT * FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC LIMIT 1 OFFSET 1", - }, - }, - // distinct count column - { - 3, - 1, - []SortField{}, - []FilterData{}, - "test.test1", false, `{"page":2,"perPage":1,"totalItems":2,"totalPages":2,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`, []string{ - "SELECT COUNT(DISTINCT(test.test1)) FROM `test` WHERE NOT (`test1` IS NULL)", + "SELECT COUNT(*) FROM (SELECT `test`.`id` FROM `test` WHERE NOT (`test1` IS NULL))", "SELECT * FROM `test` WHERE NOT (`test1` IS NULL) ORDER BY `test1` ASC LIMIT 1 OFFSET 1", }, }, @@ -345,8 +314,7 @@ func TestProviderExecNonEmptyQuery(t *testing.T) { Page(s.page). PerPage(s.perPage). Sort(s.sort). - Filter(s.filter). - CountColumn(s.countColumn) + Filter(s.filter) result, err := p.Exec(&[]testTableStruct{}) @@ -376,7 +344,7 @@ func TestProviderExecNonEmptyQuery(t *testing.T) { for _, q := range testDB.CalledQueries { if !list.ExistInSliceWithRegex(q, s.expectQueries) { - t.Errorf("(%d) Didn't expect query \n%v", i, q) + t.Errorf("(%d) Didn't expect query \n%v in \n%v", i, q, testDB.CalledQueries) } } } @@ -439,7 +407,7 @@ func TestProviderParseAndExec(t *testing.T) { { "page=3&perPage=9999&filter=test1>1&sort=-test2,test3", false, - `{"page":1,"perPage":400,"totalItems":1,"totalPages":1,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`, + `{"page":1,"perPage":500,"totalItems":1,"totalPages":1,"items":[{"test1":2,"test2":"test2.2","test3":""}]}`, }, } @@ -504,9 +472,9 @@ func createTestDB() (*testDB, error) { } db := testDB{DB: dbx.NewFromDB(sqlDB, "sqlite")} - db.CreateTable("test", map[string]string{"test1": "int default 0", "test2": "text default ''", "test3": "text default ''"}).Execute() - db.Insert("test", dbx.Params{"test1": 1, "test2": "test2.1"}).Execute() - db.Insert("test", dbx.Params{"test1": 2, "test2": "test2.2"}).Execute() + db.CreateTable("test", map[string]string{"id": "int default 0", "test1": "int default 0", "test2": "text default ''", "test3": "text default ''"}).Execute() + db.Insert("test", dbx.Params{"id": 1, "test1": 1, "test2": "test2.1"}).Execute() + db.Insert("test", dbx.Params{"id": 2, "test1": 2, "test2": "test2.2"}).Execute() db.QueryLogFunc = func(ctx context.Context, t time.Duration, sql string, rows *sql.Rows, err error) { db.CalledQueries = append(db.CalledQueries, sql) } diff --git a/tools/security/jwt.go b/tools/security/jwt.go index c7bce5538..4f6e2b46c 100644 --- a/tools/security/jwt.go +++ b/tools/security/jwt.go @@ -9,6 +9,8 @@ import ( // ParseUnverifiedJWT parses JWT token and returns its claims // but DOES NOT verify the signature. +// +// It verifies only the exp, iat and nbf claims. func ParseUnverifiedJWT(token string) (jwt.MapClaims, error) { claims := jwt.MapClaims{} diff --git a/tools/security/random_test.go b/tools/security/random_test.go index 5f6fd1439..e27b92d65 100644 --- a/tools/security/random_test.go +++ b/tools/security/random_test.go @@ -44,7 +44,7 @@ func TestRandomStringWithAlphabet(t *testing.T) { } for i, s := range scenarios { - generated := make([]string, 100) + generated := make([]string, 0, 100) length := 10 for j := 0; j < 100; j++ { diff --git a/tools/store/store.go b/tools/store/store.go index d194105ca..e2a290d33 100644 --- a/tools/store/store.go +++ b/tools/store/store.go @@ -33,8 +33,8 @@ func (s *Store[T]) Remove(key string) { // Has checks if element with the specified key exist or not. func (s *Store[T]) Has(key string) bool { - s.mux.Lock() - defer s.mux.Unlock() + s.mux.RLock() + defer s.mux.RUnlock() _, ok := s.data[key] @@ -45,8 +45,8 @@ func (s *Store[T]) Has(key string) bool { // // If key is not set, the zero T value is returned. func (s *Store[T]) Get(key string) T { - s.mux.Lock() - defer s.mux.Unlock() + s.mux.RLock() + defer s.mux.RUnlock() return s.data[key] } diff --git a/tools/subscriptions/broker.go b/tools/subscriptions/broker.go index b90161ed3..bdee3552c 100644 --- a/tools/subscriptions/broker.go +++ b/tools/subscriptions/broker.go @@ -20,6 +20,9 @@ func NewBroker() *Broker { // Clients returns all registered clients. func (b *Broker) Clients() map[string]Client { + b.mux.RLock() + defer b.mux.RUnlock() + return b.clients } diff --git a/tools/subscriptions/client.go b/tools/subscriptions/client.go index 49872ef37..c948a530a 100644 --- a/tools/subscriptions/client.go +++ b/tools/subscriptions/client.go @@ -61,25 +61,25 @@ func NewDefaultClient() *DefaultClient { } } -// Id implements the Client.Id interface method. +// Id implements the [Client.Id] interface method. func (c *DefaultClient) Id() string { return c.id } -// Channel implements the Client.Channel interface method. +// Channel implements the [Client.Channel] interface method. func (c *DefaultClient) Channel() chan Message { return c.channel } -// Subscriptions implements the Client.Subscriptions interface method. +// Subscriptions implements the [Client.Subscriptions] interface method. func (c *DefaultClient) Subscriptions() map[string]struct{} { - c.mux.Lock() - defer c.mux.Unlock() + c.mux.RLock() + defer c.mux.RUnlock() return c.subscriptions } -// Subscribe implements the Client.Subscribe interface method. +// Subscribe implements the [Client.Subscribe] interface method. // // Empty subscriptions (aka. "") are ignored. func (c *DefaultClient) Subscribe(subs ...string) { @@ -95,7 +95,7 @@ func (c *DefaultClient) Subscribe(subs ...string) { } } -// Unsubscribe implements the Client.Unsubscribe interface method. +// Unsubscribe implements the [Client.Unsubscribe] interface method. // // If subs is not set, this method removes all registered client's subscriptions. func (c *DefaultClient) Unsubscribe(subs ...string) { @@ -114,25 +114,25 @@ func (c *DefaultClient) Unsubscribe(subs ...string) { } } -// HasSubscription implements the Client.HasSubscription interface method. +// HasSubscription implements the [Client.HasSubscription] interface method. func (c *DefaultClient) HasSubscription(sub string) bool { - c.mux.Lock() - defer c.mux.Unlock() + c.mux.RLock() + defer c.mux.RUnlock() _, ok := c.subscriptions[sub] return ok } -// Get implements the Client.Get interface method. +// Get implements the [Client.Get] interface method. func (c *DefaultClient) Get(key string) any { - c.mux.Lock() - defer c.mux.Unlock() + c.mux.RLock() + defer c.mux.RUnlock() return c.store[key] } -// Set implements the Client.Set interface method. +// Set implements the [Client.Set] interface method. func (c *DefaultClient) Set(key string, value any) { c.mux.Lock() defer c.mux.Unlock() diff --git a/tools/types/datetime.go b/tools/types/datetime.go index 27c7f7368..27036dd3c 100644 --- a/tools/types/datetime.go +++ b/tools/types/datetime.go @@ -9,7 +9,7 @@ import ( ) // DefaultDateLayout specifies the default app date strings layout. -const DefaultDateLayout = "2006-01-02 15:04:05.000" +const DefaultDateLayout = "2006-01-02 15:04:05.000Z" // NowDateTime returns new DateTime instance with the current local time. func NowDateTime() DateTime { diff --git a/tools/types/datetime_test.go b/tools/types/datetime_test.go index 5d7963aa1..309151803 100644 --- a/tools/types/datetime_test.go +++ b/tools/types/datetime_test.go @@ -31,8 +31,8 @@ func TestParseDateTime(t *testing.T) { {"invalid", ""}, {nowDateTime, nowStr}, {nowTime, nowStr}, - {1641024040, "2022-01-01 08:00:40.000"}, - {"2022-01-01 11:23:45.678", "2022-01-01 11:23:45.678"}, + {1641024040, "2022-01-01 08:00:40.000Z"}, + {"2022-01-01 11:23:45.678", "2022-01-01 11:23:45.678Z"}, } for i, s := range scenarios { @@ -49,7 +49,7 @@ func TestParseDateTime(t *testing.T) { } func TestDateTimeTime(t *testing.T) { - str := "2022-01-01 11:23:45.678" + str := "2022-01-01 11:23:45.678Z" expected, err := time.Parse(types.DefaultDateLayout, str) if err != nil { @@ -86,7 +86,7 @@ func TestDateTimeString(t *testing.T) { t.Fatalf("Expected empty string for zer datetime, got %q", dt0.String()) } - expected := "2022-01-01 11:23:45.678" + expected := "2022-01-01 11:23:45.678Z" dt1, _ := types.ParseDateTime(expected) if dt1.String() != expected { t.Fatalf("Expected %q, got %v", expected, dt1) @@ -99,7 +99,7 @@ func TestDateTimeMarshalJSON(t *testing.T) { expected string }{ {"", `""`}, - {"2022-01-01 11:23:45.678", `"2022-01-01 11:23:45.678"`}, + {"2022-01-01 11:23:45.678", `"2022-01-01 11:23:45.678Z"`}, } for i, s := range scenarios { @@ -128,7 +128,7 @@ func TestDateTimeUnmarshalJSON(t *testing.T) { {"invalid_json", ""}, {"'123'", ""}, {"2022-01-01 11:23:45.678", ""}, - {`"2022-01-01 11:23:45.678"`, "2022-01-01 11:23:45.678"}, + {`"2022-01-01 11:23:45.678"`, "2022-01-01 11:23:45.678Z"}, } for i, s := range scenarios { @@ -148,8 +148,8 @@ func TestDateTimeValue(t *testing.T) { }{ {"", ""}, {"invalid", ""}, - {1641024040, "2022-01-01 08:00:40.000"}, - {"2022-01-01 11:23:45.678", "2022-01-01 11:23:45.678"}, + {1641024040, "2022-01-01 08:00:40.000Z"}, + {"2022-01-01 11:23:45.678", "2022-01-01 11:23:45.678Z"}, {types.NowDateTime(), types.NowDateTime().String()}, } @@ -179,8 +179,8 @@ func TestDateTimeScan(t *testing.T) { {"invalid", ""}, {types.NowDateTime(), now}, {time.Now(), now}, - {1641024040, "2022-01-01 08:00:40.000"}, - {"2022-01-01 11:23:45.678", "2022-01-01 11:23:45.678"}, + {1641024040, "2022-01-01 08:00:40.000Z"}, + {"2022-01-01 11:23:45.678", "2022-01-01 11:23:45.678Z"}, } for i, s := range scenarios { diff --git a/tools/types/json_array.go b/tools/types/json_array.go index 6542f4fec..2b555268d 100644 --- a/tools/types/json_array.go +++ b/tools/types/json_array.go @@ -23,10 +23,6 @@ func (m JsonArray) MarshalJSON() ([]byte, error) { // Value implements the [driver.Valuer] interface. func (m JsonArray) Value() (driver.Value, error) { - if m == nil { - return nil, nil - } - data, err := json.Marshal(m) return string(data), err diff --git a/tools/types/json_array_test.go b/tools/types/json_array_test.go index cdf19c6f2..bbe239a02 100644 --- a/tools/types/json_array_test.go +++ b/tools/types/json_array_test.go @@ -36,7 +36,7 @@ func TestJsonArrayValue(t *testing.T) { json types.JsonArray expected driver.Value }{ - {nil, nil}, + {nil, `[]`}, {types.JsonArray{}, `[]`}, {types.JsonArray{1, 2, 3}, `[1,2,3]`}, {types.JsonArray{"test1", "test2", "test3"}, `["test1","test2","test3"]`}, diff --git a/tools/types/json_map.go b/tools/types/json_map.go index 4bec210db..6358959cd 100644 --- a/tools/types/json_map.go +++ b/tools/types/json_map.go @@ -23,10 +23,6 @@ func (m JsonMap) MarshalJSON() ([]byte, error) { // Value implements the [driver.Valuer] interface. func (m JsonMap) Value() (driver.Value, error) { - if m == nil { - return nil, nil - } - data, err := json.Marshal(m) return string(data), err diff --git a/tools/types/json_map_test.go b/tools/types/json_map_test.go index 59272cc77..c0e5628d3 100644 --- a/tools/types/json_map_test.go +++ b/tools/types/json_map_test.go @@ -35,7 +35,7 @@ func TestJsonMapValue(t *testing.T) { json types.JsonMap expected driver.Value }{ - {nil, nil}, + {nil, `{}`}, {types.JsonMap{}, `{}`}, {types.JsonMap{"test1": 123, "test2": "lorem"}, `{"test1":123,"test2":"lorem"}`}, {types.JsonMap{"test": []int{1, 2, 3}}, `{"test":[1,2,3]}`}, diff --git a/tools/types/types.go b/tools/types/types.go new file mode 100644 index 000000000..c07d80541 --- /dev/null +++ b/tools/types/types.go @@ -0,0 +1,8 @@ +// Package types implements some commonly used db serializable types +// like datetime, json, etc. +package types + +// Pointer is a generic helper that returns val as *T. +func Pointer[T any](val T) *T { + return &val +} diff --git a/tools/types/types_test.go b/tools/types/types_test.go new file mode 100644 index 000000000..615ac4c61 --- /dev/null +++ b/tools/types/types_test.go @@ -0,0 +1,24 @@ +package types_test + +import ( + "testing" + + "github.com/pocketbase/pocketbase/tools/types" +) + +func TestPointer(t *testing.T) { + s1 := types.Pointer("") + if s1 == nil || *s1 != "" { + t.Fatalf("Expected empty string pointer, got %#v", s1) + } + + s2 := types.Pointer("test") + if s2 == nil || *s2 != "test" { + t.Fatalf("Expected 'test' string pointer, got %#v", s2) + } + + s3 := types.Pointer(123) + if s3 == nil || *s3 != 123 { + t.Fatalf("Expected 123 string pointer, got %#v", s3) + } +} diff --git a/tools/types/untitled.js.erb b/tools/types/untitled.js.erb new file mode 100644 index 000000000..93939fcfa --- /dev/null +++ b/tools/types/untitled.js.erb @@ -0,0 +1,27 @@ +const { exec } = require('node:child_process'); + +// you can use any other library for copying directories recursively +const fse = require('fs-extra'); + +let controller; // this will be used to terminate the PocketBase process + +const srcTestDirPath = "./test_pb_data"; +const tempTestDirPath = "./temp_test_pb_data"; + +beforeEach(() => { + // copy test_pb_date to a temp location + fse.copySync(srcTestDirPath, tempTestDirPath); + + controller = new AbortController(); + + // start PocketBase with the test_pb_data + exec('./pocketbase serve --dir=' + tempTestDirPath, { signal: controller.signal}); +}); + +afterEach(() => { + // stop the PocketBase process + controller.abort(); + + // clean up the temp test directory + fse.removeSync(tempTestDirPath); +}); diff --git a/ui/.env b/ui/.env index 25a446de8..182e47116 100644 --- a/ui/.env +++ b/ui/.env @@ -1,7 +1,10 @@ # all environments should start with 'PB_' prefix -PB_BACKEND_URL = "../" -PB_PROFILE_COLLECTION = "profiles" -PB_INSTALLER_PARAM = "installer" -PB_RULES_SYNTAX_DOCS = "https://pocketbase.io/docs/manage-collections#rules-filters-syntax" -PB_RELEASES = "https://github.com/pocketbase/pocketbase/releases" -PB_VERSION = "v0.7.9" +PB_BACKEND_URL = "../" +PB_INSTALLER_PARAM = "installer" +PB_OAUTH2_EXAMPLE = "https://pocketbase.io/docs/manage-users/#auth-via-oauth2" +PB_RULES_SYNTAX_DOCS = "https://pocketbase.io/docs/manage-collections#rules-filters-syntax" +PB_FILE_UPLOAD_DOCS = "https://pocketbase.io/docs/files-handling/#uploading-files" +PB_JS_SDK_URL = "https://github.com/pocketbase/js-sdk/tree/rc" +PB_DART_SDK_URL = "https://github.com/pocketbase/dart-sdk/tree/rc" +PB_RELEASES = "https://github.com/pocketbase/pocketbase/releases" +PB_VERSION = "v0.8.0-rc1" diff --git a/ui/dist/assets/AuthMethodsDocs.6da908f0.js b/ui/dist/assets/AuthMethodsDocs.6da908f0.js new file mode 100644 index 000000000..17106509f --- /dev/null +++ b/ui/dist/assets/AuthMethodsDocs.6da908f0.js @@ -0,0 +1,64 @@ +import{S as ke,i as be,s as ge,e as r,w as b,b as g,c as _e,f as k,g as h,h as n,m as me,x as G,P as re,Q as we,k as ve,R as Ce,n as Pe,t as J,a as Y,o as _,d as pe,L as Me,C as Se,p as $e,r as H,u as je,O as Ae}from"./index.97f016a1.js";import{S as Be}from"./SdkTabs.88269ae0.js";function ue(a,l,o){const s=a.slice();return s[5]=l[o],s}function de(a,l,o){const s=a.slice();return s[5]=l[o],s}function fe(a,l){let o,s=l[5].code+"",m,f,i,u;function d(){return l[4](l[5])}return{key:a,first:null,c(){o=r("button"),m=b(s),f=g(),k(o,"class","tab-item"),H(o,"active",l[1]===l[5].code),this.first=o},m(v,C){h(v,o,C),n(o,m),n(o,f),i||(u=je(o,"click",d),i=!0)},p(v,C){l=v,C&4&&s!==(s=l[5].code+"")&&G(m,s),C&6&&H(o,"active",l[1]===l[5].code)},d(v){v&&_(o),i=!1,u()}}}function he(a,l){let o,s,m,f;return s=new Ae({props:{content:l[5].body}}),{key:a,first:null,c(){o=r("div"),_e(s.$$.fragment),m=g(),k(o,"class","tab-item"),H(o,"active",l[1]===l[5].code),this.first=o},m(i,u){h(i,o,u),me(s,o,null),n(o,m),f=!0},p(i,u){l=i;const d={};u&4&&(d.content=l[5].body),s.$set(d),(!f||u&6)&&H(o,"active",l[1]===l[5].code)},i(i){f||(J(s.$$.fragment,i),f=!0)},o(i){Y(s.$$.fragment,i),f=!1},d(i){i&&_(o),pe(s)}}}function Oe(a){var ae,ne;let l,o,s=a[0].name+"",m,f,i,u,d,v,C,K=a[0].name+"",U,R,q,P,D,j,W,M,N,X,Q,A,Z,V,y=a[0].name+"",I,x,L,B,E,S,O,w=[],ee=new Map,te,T,p=[],le=new Map,$;P=new Be({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${a[3]}'); + + ... + + const result = await pb.collection('${(ae=a[0])==null?void 0:ae.name}').listAuthMethods(); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${a[3]}'); + + ... + + final result = await pb.collection('${(ne=a[0])==null?void 0:ne.name}').listAuthMethods(); + `}});let z=a[2];const oe=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eo(1,f=d.code);return a.$$set=d=>{"collection"in d&&o(0,m=d.collection)},o(3,s=Se.getApiExampleUrl($e.baseUrl)),o(2,i=[{code:200,body:` + { + "usernamePassword": true, + "emailPassword": true, + "authProviders": [ + { + "name": "github", + "state": "3Yd8jNkK_6PJG6hPWwBjLqKwse6Ejd", + "codeVerifier": "KxFDWz1B3fxscCDJ_9gHQhLuh__ie7", + "codeChallenge": "NM1oVexB6Q6QH8uPtOUfK7tq4pmu4Jz6lNDIwoxHZNE=", + "codeChallengeMethod": "S256", + "authUrl": "https://github.com/login/oauth/authorize?client_id=demo&code_challenge=NM1oVexB6Q6QH8uPtOUfK7tq4pmu4Jz6lNDIwoxHZNE%3D&code_challenge_method=S256&response_type=code&scope=user&state=3Yd8jNkK_6PJG6hPWwBjLqKwse6Ejd&redirect_uri=" + }, + { + "name": "gitlab", + "state": "NeQSbtO5cShr_mk5__3CUukiMnymeb", + "codeVerifier": "ahTFHOgua8mkvPAlIBGwCUJbWKR_xi", + "codeChallenge": "O-GATkTj4eXDCnfonsqGLCd6njvTixlpCMvy5kjgOOg=", + "codeChallengeMethod": "S256", + "authUrl": "https://gitlab.com/oauth/authorize?client_id=demo&code_challenge=O-GATkTj4eXDCnfonsqGLCd6njvTixlpCMvy5kjgOOg%3D&code_challenge_method=S256&response_type=code&scope=read_user&state=NeQSbtO5cShr_mk5__3CUukiMnymeb&redirect_uri=" + }, + { + "name": "google", + "state": "zB3ZPifV1TW2GMuvuFkamSXfSNkHPQ", + "codeVerifier": "t3CmO5VObGzdXqieakvR_fpjiW0zdO", + "codeChallenge": "KChwoQPKYlz2anAdqtgsSTdIo8hdwtc1fh2wHMwW2Yk=", + "codeChallengeMethod": "S256", + "authUrl": "https://accounts.google.com/o/oauth2/auth?client_id=demo&code_challenge=KChwoQPKYlz2anAdqtgsSTdIo8hdwtc1fh2wHMwW2Yk%3D&code_challenge_method=S256&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&state=zB3ZPifV1TW2GMuvuFkamSXfSNkHPQ&redirect_uri=" + } + ] + } + `}]),[m,f,i,s,u]}class Ne extends ke{constructor(l){super(),be(this,l,Te,Oe,ge,{collection:0})}}export{Ne as default}; diff --git a/ui/dist/assets/AuthRefreshDocs.1d6e4e08.js b/ui/dist/assets/AuthRefreshDocs.1d6e4e08.js new file mode 100644 index 000000000..80b1480f9 --- /dev/null +++ b/ui/dist/assets/AuthRefreshDocs.1d6e4e08.js @@ -0,0 +1,87 @@ +import{S as Ne,i as Ue,s as je,O as ze,e as s,w as k,b as p,c as se,f as b,g as c,h as o,m as ne,x as re,P as Oe,Q as Ie,k as Je,R as Ke,n as Qe,t as U,a as j,o as d,d as ie,L as xe,C as Fe,p as We,r as I,u as Ge}from"./index.97f016a1.js";import{S as Xe}from"./SdkTabs.88269ae0.js";function He(r,l,a){const n=r.slice();return n[5]=l[a],n}function Le(r,l,a){const n=r.slice();return n[5]=l[a],n}function Ee(r,l){let a,n=l[5].code+"",m,_,i,f;function v(){return l[4](l[5])}return{key:r,first:null,c(){a=s("button"),m=k(n),_=p(),b(a,"class","tab-item"),I(a,"active",l[1]===l[5].code),this.first=a},m(g,w){c(g,a,w),o(a,m),o(a,_),i||(f=Ge(a,"click",v),i=!0)},p(g,w){l=g,w&4&&n!==(n=l[5].code+"")&&re(m,n),w&6&&I(a,"active",l[1]===l[5].code)},d(g){g&&d(a),i=!1,f()}}}function Ve(r,l){let a,n,m,_;return n=new ze({props:{content:l[5].body}}),{key:r,first:null,c(){a=s("div"),se(n.$$.fragment),m=p(),b(a,"class","tab-item"),I(a,"active",l[1]===l[5].code),this.first=a},m(i,f){c(i,a,f),ne(n,a,null),o(a,m),_=!0},p(i,f){l=i;const v={};f&4&&(v.content=l[5].body),n.$set(v),(!_||f&6)&&I(a,"active",l[1]===l[5].code)},i(i){_||(U(n.$$.fragment,i),_=!0)},o(i){j(n.$$.fragment,i),_=!1},d(i){i&&d(a),ie(n)}}}function Ye(r){var Be,Me;let l,a,n=r[0].name+"",m,_,i,f,v,g,w,B,J,S,L,ce,E,M,de,K,V=r[0].name+"",Q,ue,pe,z,x,q,W,T,G,fe,X,C,Y,he,Z,be,h,me,P,_e,ke,ve,ee,ge,te,ye,Se,$e,oe,we,le,D,ae,R,O,$=[],Te=new Map,Ce,F,y=[],Re=new Map,A;g=new Xe({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${r[3]}'); + + ... + + const authData = await pb.collection('${(Be=r[0])==null?void 0:Be.name}').authRefresh(); + + // after the above you can also access the refreshed auth data from the authStore + console.log(pb.authStore.isValid); + console.log(pb.authStore.token); + console.log(pb.authStore.model.id); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${r[3]}'); + + ... + + final authData = await pb.collection('${(Me=r[0])==null?void 0:Me.name}').authRefresh(); + + // after the above you can also access the refreshed auth data from the authStore + print(pb.authStore.isValid); + print(pb.authStore.token); + print(pb.authStore.model.id); + `}}),P=new ze({props:{content:"?expand=relField1,relField2.subRelField"}});let N=r[2];const Pe=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eReturns a new auth response (token and account data) for an + already authenticated record.

+

This method is usually called by users on page/screen reload to ensure that the previously stored + data in pb.authStore is still valid and up-to-date.

`,v=p(),se(g.$$.fragment),w=p(),B=s("h6"),B.textContent="API details",J=p(),S=s("div"),L=s("strong"),L.textContent="POST",ce=p(),E=s("div"),M=s("p"),de=k("/api/collections/"),K=s("strong"),Q=k(V),ue=k("/auth-refresh"),pe=p(),z=s("p"),z.innerHTML="Requires record Authorization:TOKEN header",x=p(),q=s("div"),q.textContent="Query parameters",W=p(),T=s("table"),G=s("thead"),G.innerHTML=`Param + Type + Description`,fe=p(),X=s("tbody"),C=s("tr"),Y=s("td"),Y.textContent="expand",he=p(),Z=s("td"),Z.innerHTML='String',be=p(),h=s("td"),me=k(`Auto expand record relations. Ex.: + `),se(P.$$.fragment),_e=k(` + Supports up to 6-levels depth nested relations expansion. `),ke=s("br"),ve=k(` + The expanded relations will be appended to the record under the + `),ee=s("code"),ee.textContent="expand",ge=k(" property (eg. "),te=s("code"),te.textContent='"expand": {"relField1": {...}, ...}',ye=k(`). + `),Se=s("br"),$e=k(` + Only the relations to which the account has permissions to `),oe=s("strong"),oe.textContent="view",we=k(" will be expanded."),le=p(),D=s("div"),D.textContent="Responses",ae=p(),R=s("div"),O=s("div");for(let e=0;e<$.length;e+=1)$[e].c();Ce=p(),F=s("div");for(let e=0;ea(1,_=v.code);return r.$$set=v=>{"collection"in v&&a(0,m=v.collection)},r.$$.update=()=>{r.$$.dirty&1&&a(2,i=[{code:200,body:JSON.stringify({token:"JWT_TOKEN",record:Fe.dummyCollectionRecord(m)},null,2)},{code:400,body:` + { + "code": 400, + "message": "Failed to authenticate.", + "data": { + "identity": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `},{code:401,body:` + { + "code": 401, + "message": "The request requires valid record authorization token to be set.", + "data": {} + } + `},{code:403,body:` + { + "code": 403, + "message": "The authorized record model is not allowed to perform this action.", + "data": {} + } + `}])},a(3,n=Fe.getApiExampleUrl(We.baseUrl)),[m,_,i,n,f]}class ot extends Ne{constructor(l){super(),Ue(this,l,Ze,Ye,je,{collection:0})}}export{ot as default}; diff --git a/ui/dist/assets/AuthWithOAuth2Docs.169fa55a.js b/ui/dist/assets/AuthWithOAuth2Docs.169fa55a.js new file mode 100644 index 000000000..a4c32f758 --- /dev/null +++ b/ui/dist/assets/AuthWithOAuth2Docs.169fa55a.js @@ -0,0 +1,151 @@ +import{S as je,i as He,s as Je,O as We,e as s,w as v,b as p,c as re,f as h,g as r,h as a,m as ce,x as de,P as Ue,Q as Ne,k as Qe,R as ze,n as Ke,t as j,a as H,o as c,d as ue,L as Ye,C as Ve,p as Ge,r as J,u as Xe}from"./index.97f016a1.js";import{S as Ze}from"./SdkTabs.88269ae0.js";function Be(i,l,o){const n=i.slice();return n[5]=l[o],n}function Fe(i,l,o){const n=i.slice();return n[5]=l[o],n}function xe(i,l){let o,n=l[5].code+"",m,_,d,b;function g(){return l[4](l[5])}return{key:i,first:null,c(){o=s("button"),m=v(n),_=p(),h(o,"class","tab-item"),J(o,"active",l[1]===l[5].code),this.first=o},m(k,R){r(k,o,R),a(o,m),a(o,_),d||(b=Xe(o,"click",g),d=!0)},p(k,R){l=k,R&4&&n!==(n=l[5].code+"")&&de(m,n),R&6&&J(o,"active",l[1]===l[5].code)},d(k){k&&c(o),d=!1,b()}}}function Me(i,l){let o,n,m,_;return n=new We({props:{content:l[5].body}}),{key:i,first:null,c(){o=s("div"),re(n.$$.fragment),m=p(),h(o,"class","tab-item"),J(o,"active",l[1]===l[5].code),this.first=o},m(d,b){r(d,o,b),ce(n,o,null),a(o,m),_=!0},p(d,b){l=d;const g={};b&4&&(g.content=l[5].body),n.$set(g),(!_||b&6)&&J(o,"active",l[1]===l[5].code)},i(d){_||(j(n.$$.fragment,d),_=!0)},o(d){H(n.$$.fragment,d),_=!1},d(d){d&&c(o),ue(n)}}}function et(i){var Ie,qe;let l,o,n=i[0].name+"",m,_,d,b,g,k,R,C,N,y,F,pe,x,D,he,Q,M=i[0].name+"",z,be,K,I,Y,q,G,P,X,O,Z,fe,ee,$,te,me,ae,_e,f,ve,E,ge,ke,we,le,Se,oe,Re,ye,Oe,se,$e,ne,L,ie,A,U,S=[],Ae=new Map,Ee,V,w=[],Te=new Map,T;k=new Ze({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${i[3]}'); + + ... + + const authData = await pb.collection('${(Ie=i[0])==null?void 0:Ie.name}').authWithOAuth2( + 'google', + 'CODE', + 'VERIFIER', + 'REDIRECT_URL', + // optional data that will be used for the new account on OAuth2 sign-up + { + 'name': 'test', + }, + ); + + // after the above you can also access the auth data from the authStore + console.log(pb.authStore.isValid); + console.log(pb.authStore.token); + console.log(pb.authStore.model.id); + + // "logout" the last authenticated account + pb.authStore.clear(); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${i[3]}'); + + ... + + final authData = await pb.collection('${(qe=i[0])==null?void 0:qe.name}').authWithOAuth2( + 'google', + 'CODE', + 'VERIFIER', + 'REDIRECT_URL', + // optional data that will be used for the new account on OAuth2 sign-up + createData: { + 'name': 'test', + }, + ); + + // after the above you can also access the auth data from the authStore + print(pb.authStore.isValid); + print(pb.authStore.token); + print(pb.authStore.model.id); + + // "logout" the last authenticated account + pb.authStore.clear(); + `}}),E=new We({props:{content:"?expand=relField1,relField2.subRelField"}});let W=i[2];const Ce=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eAuthenticate with an OAuth2 provider and returns a new auth token and account data.

+

This action usually should be called right after the provider login page redirect.

+

You could also check the + OAuth2 web integration example + .

`,g=p(),re(k.$$.fragment),R=p(),C=s("h6"),C.textContent="API details",N=p(),y=s("div"),F=s("strong"),F.textContent="POST",pe=p(),x=s("div"),D=s("p"),he=v("/api/collections/"),Q=s("strong"),z=v(M),be=v("/auth-with-oauth2"),K=p(),I=s("div"),I.textContent="Body Parameters",Y=p(),q=s("table"),q.innerHTML=`Param + Type + Description +
Required + provider
+ String + The name of the OAuth2 client provider (eg. "google"). +
Required + code
+ String + The authorization code returned from the initial request. +
Required + codeVerifier
+ String + The code verifier sent with the initial request as part of the code_challenge. +
Required + redirectUrl
+ String + The redirect url sent with the initial request. +
Optional + createData
+ Object +

Optional data that will be used when creating the auth record on OAuth2 sign-up.

+

The created auth record must comply with the same requirements and validations in the + regular create action. +
+ The data can only be in json, aka. multipart/form-data and files + upload currently are not supported during OAuth2 sign-ups.

`,G=p(),P=s("div"),P.textContent="Query parameters",X=p(),O=s("table"),Z=s("thead"),Z.innerHTML=`Param + Type + Description`,fe=p(),ee=s("tbody"),$=s("tr"),te=s("td"),te.textContent="expand",me=p(),ae=s("td"),ae.innerHTML='String',_e=p(),f=s("td"),ve=v(`Auto expand record relations. Ex.: + `),re(E.$$.fragment),ge=v(` + Supports up to 6-levels depth nested relations expansion. `),ke=s("br"),we=v(` + The expanded relations will be appended to the record under the + `),le=s("code"),le.textContent="expand",Se=v(" property (eg. "),oe=s("code"),oe.textContent='"expand": {"relField1": {...}, ...}',Re=v(`). + `),ye=s("br"),Oe=v(` + Only the relations to which the account has permissions to `),se=s("strong"),se.textContent="view",$e=v(" will be expanded."),ne=p(),L=s("div"),L.textContent="Responses",ie=p(),A=s("div"),U=s("div");for(let e=0;eo(1,_=g.code);return i.$$set=g=>{"collection"in g&&o(0,m=g.collection)},i.$$.update=()=>{i.$$.dirty&1&&o(2,d=[{code:200,body:JSON.stringify({token:"JWT_TOKEN",record:Ve.dummyCollectionRecord(m),meta:{id:"abc123",name:"John Doe",username:"john.doe",email:"test@example.com",avatarUrl:"https://example.com/avatar.png"}},null,2)},{code:400,body:` + { + "code": 400, + "message": "An error occurred while submitting the form.", + "data": { + "provider": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `}])},o(3,n=Ve.getApiExampleUrl(Ge.baseUrl)),[m,_,d,n,b]}class ot extends je{constructor(l){super(),He(this,l,tt,et,Je,{collection:0})}}export{ot as default}; diff --git a/ui/dist/assets/AuthWithPasswordDocs.f656a4b9.js b/ui/dist/assets/AuthWithPasswordDocs.f656a4b9.js new file mode 100644 index 000000000..ec9eda3b6 --- /dev/null +++ b/ui/dist/assets/AuthWithPasswordDocs.f656a4b9.js @@ -0,0 +1,106 @@ +import{S as Se,i as ve,s as we,O as ke,e as s,w as f,b as u,c as Ot,f as h,g as r,h as o,m as At,x as Tt,P as ce,Q as ye,k as ge,R as Pe,n as Re,t as tt,a as et,o as c,d as Ut,L as $e,C as de,p as Ce,r as lt,u as Oe}from"./index.97f016a1.js";import{S as Ae}from"./SdkTabs.88269ae0.js";function ue(n,e,l){const i=n.slice();return i[8]=e[l],i}function fe(n,e,l){const i=n.slice();return i[8]=e[l],i}function Te(n){let e;return{c(){e=f("email")},m(l,i){r(l,e,i)},d(l){l&&c(e)}}}function Ue(n){let e;return{c(){e=f("username")},m(l,i){r(l,e,i)},d(l){l&&c(e)}}}function Me(n){let e;return{c(){e=f("username/email")},m(l,i){r(l,e,i)},d(l){l&&c(e)}}}function pe(n){let e;return{c(){e=s("strong"),e.textContent="username"},m(l,i){r(l,e,i)},d(l){l&&c(e)}}}function be(n){let e;return{c(){e=f("or")},m(l,i){r(l,e,i)},d(l){l&&c(e)}}}function me(n){let e;return{c(){e=s("strong"),e.textContent="email"},m(l,i){r(l,e,i)},d(l){l&&c(e)}}}function he(n,e){let l,i=e[8].code+"",S,m,p,d;function _(){return e[7](e[8])}return{key:n,first:null,c(){l=s("button"),S=f(i),m=u(),h(l,"class","tab-item"),lt(l,"active",e[3]===e[8].code),this.first=l},m($,C){r($,l,C),o(l,S),o(l,m),p||(d=Oe(l,"click",_),p=!0)},p($,C){e=$,C&16&&i!==(i=e[8].code+"")&&Tt(S,i),C&24&<(l,"active",e[3]===e[8].code)},d($){$&&c(l),p=!1,d()}}}function _e(n,e){let l,i,S,m;return i=new ke({props:{content:e[8].body}}),{key:n,first:null,c(){l=s("div"),Ot(i.$$.fragment),S=u(),h(l,"class","tab-item"),lt(l,"active",e[3]===e[8].code),this.first=l},m(p,d){r(p,l,d),At(i,l,null),o(l,S),m=!0},p(p,d){e=p;const _={};d&16&&(_.content=e[8].body),i.$set(_),(!m||d&24)&<(l,"active",e[3]===e[8].code)},i(p){m||(tt(i.$$.fragment,p),m=!0)},o(p){et(i.$$.fragment,p),m=!1},d(p){p&&c(l),Ut(i)}}}function De(n){var se,ne;let e,l,i=n[0].name+"",S,m,p,d,_,$,C,O,B,Mt,ot,T,at,F,st,U,G,Dt,X,I,Et,nt,Z=n[0].name+"",it,Lt,rt,N,ct,M,dt,Wt,V,D,ut,Bt,ft,Ht,g,Yt,pt,bt,mt,qt,ht,_t,j,kt,E,St,Ft,vt,L,wt,It,yt,Nt,k,Vt,H,jt,Jt,Qt,gt,Kt,Pt,zt,Gt,Xt,Rt,Zt,$t,J,Ct,W,Q,A=[],xt=new Map,te,K,P=[],ee=new Map,Y;function le(t,a){if(t[1]&&t[2])return Me;if(t[1])return Ue;if(t[2])return Te}let q=le(n),R=q&&q(n);T=new Ae({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${n[6]}'); + + ... + + const authData = await pb.collection('${(se=n[0])==null?void 0:se.name}').authWithPassword( + '${n[5]}', + 'YOUR_PASSWORD', + ); + + // after the above you can also access the auth data from the authStore + console.log(pb.authStore.isValid); + console.log(pb.authStore.token); + console.log(pb.authStore.model.id); + + // "logout" the last authenticated account + pb.authStore.clear(); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${n[6]}'); + + ... + + final authData = await pb.collection('${(ne=n[0])==null?void 0:ne.name}').authWithPassword( + '${n[5]}', + 'YOUR_PASSWORD', + ); + + // after the above you can also access the auth data from the authStore + print(pb.authStore.isValid); + print(pb.authStore.token); + print(pb.authStore.model.id); + + // "logout" the last authenticated account + pb.authStore.clear(); + `}});let v=n[1]&&pe(),w=n[1]&&n[2]&&be(),y=n[2]&&me();H=new ke({props:{content:"?expand=relField1,relField2.subRelField"}});let x=n[4];const oe=t=>t[8].code;for(let t=0;tt[8].code;for(let t=0;tParam + Type + Description`,Wt=u(),V=s("tbody"),D=s("tr"),ut=s("td"),ut.innerHTML=`
Required + identity
`,Bt=u(),ft=s("td"),ft.innerHTML='String',Ht=u(),g=s("td"),Yt=f(`The + `),v&&v.c(),pt=u(),w&&w.c(),bt=u(),y&&y.c(),mt=f(` + of the record to authenticate.`),qt=u(),ht=s("tr"),ht.innerHTML=`
Required + password
+ String + The auth record password.`,_t=u(),j=s("div"),j.textContent="Query parameters",kt=u(),E=s("table"),St=s("thead"),St.innerHTML=`Param + Type + Description`,Ft=u(),vt=s("tbody"),L=s("tr"),wt=s("td"),wt.textContent="expand",It=u(),yt=s("td"),yt.innerHTML='String',Nt=u(),k=s("td"),Vt=f(`Auto expand record relations. Ex.: + `),Ot(H.$$.fragment),jt=f(` + Supports up to 6-levels depth nested relations expansion. `),Jt=s("br"),Qt=f(` + The expanded relations will be appended to the record under the + `),gt=s("code"),gt.textContent="expand",Kt=f(" property (eg. "),Pt=s("code"),Pt.textContent='"expand": {"relField1": {...}, ...}',zt=f(`). + `),Gt=s("br"),Xt=f(` + Only the relations to which the account has permissions to `),Rt=s("strong"),Rt.textContent="view",Zt=f(" will be expanded."),$t=u(),J=s("div"),J.textContent="Responses",Ct=u(),W=s("div"),Q=s("div");for(let t=0;tl(3,_=O.code);return n.$$set=O=>{"collection"in O&&l(0,d=O.collection)},n.$$.update=()=>{var O,B;n.$$.dirty&1&&l(2,S=(O=d==null?void 0:d.options)==null?void 0:O.allowEmailAuth),n.$$.dirty&1&&l(1,m=(B=d==null?void 0:d.options)==null?void 0:B.allowUsernameAuth),n.$$.dirty&6&&l(5,p=m&&S?"YOUR_USERNAME_OR_EMAIL":m?"YOUR_USERNAME":"YOUR_EMAIL"),n.$$.dirty&1&&l(4,$=[{code:200,body:JSON.stringify({token:"JWT_TOKEN",record:de.dummyCollectionRecord(d)},null,2)},{code:400,body:` + { + "code": 400, + "message": "Failed to authenticate.", + "data": { + "identity": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `}])},l(6,i=de.getApiExampleUrl(Ce.baseUrl)),[d,m,S,_,$,p,i,C]}class Be extends Se{constructor(e){super(),ve(this,e,Ee,De,we,{collection:0})}}export{Be as default}; diff --git a/ui/dist/assets/CodeEditor.0b64cb4e.js b/ui/dist/assets/CodeEditor.0b64cb4e.js deleted file mode 100644 index 57f2b21b0..000000000 --- a/ui/dist/assets/CodeEditor.0b64cb4e.js +++ /dev/null @@ -1,13 +0,0 @@ -import{S as me,i as Te,s as Se,e as be,f as Pe,N as SO,g as Re,y as bO,o as xe,J as ke,L as Xe,M as ye}from"./index.e13041a6.js";import{P as Ze,N as We,u as je,D as we,v as lO,T as Y,I as KO,w as QO,x as o,y as _e,L as cO,z as uO,A as V,B as dO,F as HO,G as $O,H as z,J as ve,K as qe,E as X,M as q,O as ze,Q as Ge,R as T,U as Ce,a as w,h as Ue,b as Ye,c as Ve,d as Ee,e as Ie,s as Ae,f as Ne,g as De,i as Le,r as Fe,j as Je,k as Me,l as Be,m as Ke,n as He,o as Ot,p as et,q as tt,t as PO,C as G}from"./index.a9121ab1.js";class N{constructor(O,e,a,i,r,s,n,Q,u,d=0,l){this.p=O,this.stack=e,this.state=a,this.reducePos=i,this.pos=r,this.score=s,this.buffer=n,this.bufferBase=Q,this.curContext=u,this.lookAhead=d,this.parent=l}toString(){return`[${this.stack.filter((O,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(O,e,a=0){let i=O.parser.context;return new N(O,[],e,a,a,0,[],0,i?new RO(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(O,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=O}reduce(O){let e=O>>19,a=O&65535,{parser:i}=this.p,r=i.dynamicPrecedence(a);if(r&&(this.score+=r),e==0){this.pushState(i.getGoto(this.state,a,!0),this.reducePos),as;)this.stack.pop();this.reduceContext(a,n)}storeNode(O,e,a,i=4,r=!1){if(O==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&s.buffer[n-4]==0&&s.buffer[n-1]>-1){if(e==a)return;if(s.buffer[n-2]>=e){s.buffer[n-2]=a;return}}}if(!r||this.pos==a)this.buffer.push(O,e,a,i);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0)for(;s>0&&this.buffer[s-2]>a;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4);this.buffer[s]=O,this.buffer[s+1]=e,this.buffer[s+2]=a,this.buffer[s+3]=i}}shift(O,e,a){let i=this.pos;if(O&131072)this.pushState(O&65535,this.pos);else if((O&262144)==0){let r=O,{parser:s}=this.p;(a>this.pos||e<=s.maxNode)&&(this.pos=a,s.stateFlag(r,1)||(this.reducePos=a)),this.pushState(r,i),this.shiftContext(e,i),e<=s.maxNode&&this.buffer.push(e,i,a,4)}else this.pos=a,this.shiftContext(e,i),e<=this.p.parser.maxNode&&this.buffer.push(e,i,a,4)}apply(O,e,a){O&65536?this.reduce(O):this.shift(O,e,a)}useNode(O,e){let a=this.p.reused.length-1;(a<0||this.p.reused[a]!=O)&&(this.p.reused.push(O),a++);let i=this.pos;this.reducePos=this.pos=i+O.length,this.pushState(e,i),this.buffer.push(a,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,O,this,this.p.stream.reset(this.pos-O.length)))}split(){let O=this,e=O.buffer.length;for(;e>0&&O.buffer[e-2]>O.reducePos;)e-=4;let a=O.buffer.slice(e),i=O.bufferBase+e;for(;O&&i==O.bufferBase;)O=O.parent;return new N(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,a,i,this.curContext,this.lookAhead,O)}recoverByDelete(O,e){let a=O<=this.p.parser.maxNode;a&&this.storeNode(O,this.pos,e,4),this.storeNode(0,this.pos,e,a?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(O){for(let e=new at(this);;){let a=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,O);if((a&65536)==0)return!0;if(a==0)return!1;e.reduce(a)}}recoverByInsert(O){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>4<<1||this.stack.length>=120){let i=[];for(let r=0,s;rQ&1&&n==s)||i.push(e[r],s)}e=i}let a=[];for(let i=0;i>19,i=O&65535,r=this.stack.length-a*3;if(r<0||e.getGoto(this.stack[r],i,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(O),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:O}=this.p;return O.data[O.stateSlot(this.state,1)]==65535&&!O.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(O){if(this.state!=O.state||this.stack.length!=O.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=O)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class RO{constructor(O,e){this.tracker=O,this.context=e,this.hash=O.strict?O.hash(e):0}}var xO;(function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth"})(xO||(xO={}));class at{constructor(O){this.start=O,this.state=O.state,this.stack=O.stack,this.base=this.stack.length}reduce(O){let e=O&65535,a=O>>19;a==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(a-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class D{constructor(O,e,a){this.stack=O,this.pos=e,this.index=a,this.buffer=O.buffer,this.index==0&&this.maybeNext()}static create(O,e=O.bufferBase+O.buffer.length){return new D(O,e,e-O.bufferBase)}maybeNext(){let O=this.stack.parent;O!=null&&(this.index=this.stack.bufferBase-O.bufferBase,this.stack=O,this.buffer=O.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new D(this.stack,this.pos,this.index)}}class E{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const kO=new E;class it{constructor(O,e){this.input=O,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=kO,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(O,e){let a=this.range,i=this.rangeIndex,r=this.pos+O;for(;ra.to:r>=a.to;){if(i==this.ranges.length-1)return null;let s=this.ranges[++i];r+=s.from-a.to,a=s}return r}clipPos(O){if(O>=this.range.from&&OO)return Math.max(O,e.from);return this.end}peek(O){let e=this.chunkOff+O,a,i;if(e>=0&&e=this.chunk2Pos&&an.to&&(this.chunk2=this.chunk2.slice(0,n.to-a)),i=this.chunk2.charCodeAt(0)}}return a>=this.token.lookAhead&&(this.token.lookAhead=a+1),i}acceptToken(O,e=0){let a=e?this.resolveOffset(e,-1):this.pos;if(a==null||a=this.chunk2Pos&&this.posthis.range.to?O.slice(0,this.range.to-this.pos):O,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(O=1){for(this.chunkOff+=O;this.pos+O>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();O-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=O,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(O,e){if(e?(this.token=e,e.start=O,e.lookAhead=O+1,e.value=e.extended=-1):this.token=kO,this.pos!=O){if(this.pos=O,O==this.end)return this.setDone(),this;for(;O=this.range.to;)this.range=this.ranges[++this.rangeIndex];O>=this.chunkPos&&O=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(O-this.chunkPos,e-this.chunkPos);if(O>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(O-this.chunk2Pos,e-this.chunk2Pos);if(O>=this.range.from&&e<=this.range.to)return this.input.read(O,e);let a="";for(let i of this.ranges){if(i.from>=e)break;i.to>O&&(a+=this.input.read(Math.max(i.from,O),Math.min(i.to,e)))}return a}}class I{constructor(O,e){this.data=O,this.id=e}token(O,e){rt(this.data,O,e,this.id)}}I.prototype.contextual=I.prototype.fallback=I.prototype.extend=!1;class b{constructor(O,e={}){this.token=O,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function rt(t,O,e,a){let i=0,r=1<0){let h=t[$];if(n.allows(h)&&(O.token.value==-1||O.token.value==h||s.overrides(h,O.token.value))){O.acceptToken(h);break}}let u=O.next,d=0,l=t[i+2];if(O.next<0&&l>d&&t[Q+l*3-3]==65535){i=t[Q+l*3-1];continue O}for(;d>1,h=Q+$+($<<1),p=t[h],P=t[h+1];if(u=P)d=$+1;else{i=t[h+2],O.advance();continue O}}break}}function C(t,O=Uint16Array){if(typeof t!="string")return t;let e=null;for(let a=0,i=0;a=92&&s--,s>=34&&s--;let Q=s-32;if(Q>=46&&(Q-=46,n=!0),r+=Q,n)break;r*=46}e?e[i++]=r:e=new O(r)}return e}const S=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let B=null;var XO;(function(t){t[t.Margin=25]="Margin"})(XO||(XO={}));function yO(t,O,e){let a=t.cursor(KO.IncludeAnonymous);for(a.moveTo(O);;)if(!(e<0?a.childBefore(O):a.childAfter(O)))for(;;){if((e<0?a.toO)&&!a.type.isError)return e<0?Math.max(0,Math.min(a.to-1,O-25)):Math.min(t.length,Math.max(a.from+1,O+25));if(e<0?a.prevSibling():a.nextSibling())break;if(!a.parent())return e<0?0:t.length}}class st{constructor(O,e){this.fragments=O,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let O=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(O){for(this.safeFrom=O.openStart?yO(O.tree,O.from+O.offset,1)-O.offset:O.from,this.safeTo=O.openEnd?yO(O.tree,O.to+O.offset,-1)-O.offset:O.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(O.tree),this.start.push(-O.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(O){if(OO)return this.nextStart=s,null;if(r instanceof Y){if(s==O){if(s=Math.max(this.safeFrom,O)&&(this.trees.push(r),this.start.push(s),this.index.push(0))}else this.index[e]++,this.nextStart=s+r.length}}}class nt{constructor(O,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=O.tokenizers.map(a=>new E)}getActions(O){let e=0,a=null,{parser:i}=O.p,{tokenizers:r}=i,s=i.stateSlot(O.state,3),n=O.curContext?O.curContext.hash:0,Q=0;for(let u=0;ul.end+25&&(Q=Math.max(l.lookAhead,Q)),l.value!=0)){let $=e;if(l.extended>-1&&(e=this.addActions(O,l.extended,l.end,e)),e=this.addActions(O,l.value,l.end,e),!d.extend&&(a=l,e>$))break}}for(;this.actions.length>e;)this.actions.pop();return Q&&O.setLookAhead(Q),!a&&O.pos==this.stream.end&&(a=new E,a.value=O.p.parser.eofTerm,a.start=a.end=O.pos,e=this.addActions(O,a.value,a.end,e)),this.mainToken=a,this.actions}getMainToken(O){if(this.mainToken)return this.mainToken;let e=new E,{pos:a,p:i}=O;return e.start=a,e.end=Math.min(a+1,i.stream.end),e.value=a==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(O,e,a){let i=this.stream.clipPos(a.pos);if(e.token(this.stream.reset(i,O),a),O.value>-1){let{parser:r}=a.p;for(let s=0;s=0&&a.p.parser.dialect.allows(n>>1)){(n&1)==0?O.value=n>>1:O.extended=n>>1;break}}}else O.value=0,O.end=this.stream.clipPos(i+1)}putAction(O,e,a,i){for(let r=0;rO.bufferLength*4?new st(a,O.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let O=this.stacks,e=this.minStackPos,a=this.stacks=[],i,r;for(let s=0;se)a.push(n);else{if(this.advanceStack(n,a,O))continue;{i||(i=[],r=[]),i.push(n);let Q=this.tokens.getMainToken(n);r.push(Q.value,Q.end)}}break}}if(!a.length){let s=i&&Qt(i);if(s)return this.stackToTree(s);if(this.parser.strict)throw S&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let s=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,r,a);if(s)return this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(a.length>s)for(a.sort((n,Q)=>Q.score-n.score);a.length>s;)a.pop();a.some(n=>n.reducePos>e)&&this.recovering--}else if(a.length>1){O:for(let s=0;s500&&u.buffer.length>500)if((n.score-u.score||n.buffer.length-u.buffer.length)>0)a.splice(Q--,1);else{a.splice(s--,1);continue O}}}}this.minStackPos=a[0].pos;for(let s=1;s ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return O.forceReduce()?O:null;if(this.fragments){let u=O.curContext&&O.curContext.tracker.strict,d=u?O.curContext.hash:0;for(let l=this.fragments.nodeAt(i);l;){let $=this.parser.nodeSet.types[l.type.id]==l.type?r.getGoto(O.state,l.type.id):-1;if($>-1&&l.length&&(!u||(l.prop(lO.contextHash)||0)==d))return O.useNode(l,$),S&&console.log(s+this.stackID(O)+` (via reuse of ${r.getName(l.type.id)})`),!0;if(!(l instanceof Y)||l.children.length==0||l.positions[0]>0)break;let h=l.children[0];if(h instanceof Y&&l.positions[0]==0)l=h;else break}}let n=r.stateSlot(O.state,4);if(n>0)return O.reduce(n),S&&console.log(s+this.stackID(O)+` (via always-reduce ${r.getName(n&65535)})`),!0;if(O.stack.length>=15e3)for(;O.stack.length>9e3&&O.forceReduce(););let Q=this.tokens.getActions(O);for(let u=0;ui?e.push(p):a.push(p)}return!1}advanceFully(O,e){let a=O.pos;for(;;){if(!this.advanceStack(O,null,null))return!1;if(O.pos>a)return WO(O,e),!0}}runRecovery(O,e,a){let i=null,r=!1;for(let s=0;s ":"";if(n.deadEnd&&(r||(r=!0,n.restart(),S&&console.log(d+this.stackID(n)+" (restarted)"),this.advanceFully(n,a))))continue;let l=n.split(),$=d;for(let h=0;l.forceReduce()&&h<10&&(S&&console.log($+this.stackID(l)+" (via force-reduce)"),!this.advanceFully(l,a));h++)S&&($=this.stackID(l)+" -> ");for(let h of n.recoverByInsert(Q))S&&console.log(d+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,a);this.stream.end>n.pos?(u==n.pos&&(u++,Q=0),n.recoverByDelete(Q,u),S&&console.log(d+this.stackID(n)+` (via recover-delete ${this.parser.getName(Q)})`),WO(n,a)):(!i||i.scoret;class Oe{constructor(O){this.start=O.start,this.shift=O.shift||K,this.reduce=O.reduce||K,this.reuse=O.reuse||K,this.hash=O.hash||(()=>0),this.strict=O.strict!==!1}}class y extends Ze{constructor(O){if(super(),this.wrappers=[],O.version!=14)throw new RangeError(`Parser version (${O.version}) doesn't match runtime version (${14})`);let e=O.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;nO.topRules[n][1]),i=[];for(let n=0;n=0)r(d,Q,n[u++]);else{let l=n[u+-d];for(let $=-d;$>0;$--)r(n[u++],Q,l);u++}}}this.nodeSet=new We(e.map((n,Q)=>je.define({name:Q>=this.minRepeatTerm?void 0:n,id:Q,props:i[Q],top:a.indexOf(Q)>-1,error:Q==0,skipped:O.skippedNodes&&O.skippedNodes.indexOf(Q)>-1}))),O.propSources&&(this.nodeSet=this.nodeSet.extend(...O.propSources)),this.strict=!1,this.bufferLength=we;let s=C(O.tokenData);this.context=O.context,this.specializerSpecs=O.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;ntypeof n=="number"?new I(s,n):n),this.topRules=O.topRules,this.dialects=O.dialects||{},this.dynamicPrecedences=O.dynamicPrecedences||null,this.tokenPrecTable=O.tokenPrec,this.termNames=O.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(O,e,a){let i=new ot(this,O,e,a);for(let r of this.wrappers)i=r(i,O,e,a);return i}getGoto(O,e,a=!1){let i=this.goto;if(e>=i[0])return-1;for(let r=i[e+1];;){let s=i[r++],n=s&1,Q=i[r++];if(n&&a)return Q;for(let u=r+(s>>1);r0}validAction(O,e){if(e==this.stateSlot(O,4))return!0;for(let a=this.stateSlot(O,1);;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=R(this.data,a+2);else return!1;if(e==R(this.data,a+1))return!0}}nextStates(O){let e=[];for(let a=this.stateSlot(O,1);;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=R(this.data,a+2);else break;if((this.data[a+2]&1)==0){let i=this.data[a+1];e.some((r,s)=>s&1&&r==i)||e.push(this.data[a],i)}}return e}overrides(O,e){let a=jO(this.data,this.tokenPrecTable,e);return a<0||jO(this.data,this.tokenPrecTable,O){let i=O.tokenizers.find(r=>r.from==a);return i?i.to:a})),O.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((a,i)=>{let r=O.specializers.find(n=>n.from==a.external);if(!r)return a;let s=Object.assign(Object.assign({},a),{external:r.to});return e.specializers[i]=wO(s),s})),O.contextTracker&&(e.context=O.contextTracker),O.dialect&&(e.dialect=this.parseDialect(O.dialect)),O.strict!=null&&(e.strict=O.strict),O.wrap&&(e.wrappers=e.wrappers.concat(O.wrap)),O.bufferLength!=null&&(e.bufferLength=O.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(O){return this.termNames?this.termNames[O]:String(O<=this.maxNode&&this.nodeSet.types[O].name||O)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(O){let e=this.dynamicPrecedences;return e==null?0:e[O]||0}parseDialect(O){let e=Object.keys(this.dialects),a=e.map(()=>!1);if(O)for(let r of O.split(" ")){let s=e.indexOf(r);s>=0&&(a[s]=!0)}let i=null;for(let r=0;ra)&&e.p.parser.stateFlag(e.state,2)&&(!O||O.scoret.external(e,a)<<1|O}return t.get}const ct=53,ut=1,dt=54,$t=2,ht=55,pt=3,L=4,ee=5,te=6,ae=7,ie=8,ft=9,gt=10,mt=11,H=56,Tt=12,_O=57,St=18,bt=27,Pt=30,Rt=33,xt=35,kt=0,Xt={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},yt={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},vO={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Zt(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}function re(t){return t==9||t==10||t==13||t==32}let qO=null,zO=null,GO=0;function sO(t,O){let e=t.pos+O;if(GO==e&&zO==t)return qO;let a=t.peek(O);for(;re(a);)a=t.peek(++O);let i="";for(;Zt(a);)i+=String.fromCharCode(a),a=t.peek(++O);return zO=t,GO=e,qO=i?i.toLowerCase():a==Wt||a==jt?void 0:null}const se=60,ne=62,oe=47,Wt=63,jt=33,wt=45;function CO(t,O){this.name=t,this.parent=O,this.hash=O?O.hash:0;for(let e=0;e-1?new CO(sO(a,1)||"",t):t},reduce(t,O){return O==St&&t?t.parent:t},reuse(t,O,e,a){let i=O.type.id;return i==L||i==xt?new CO(sO(a,1)||"",t):t},hash(t){return t?t.hash:0},strict:!1}),qt=new b((t,O)=>{if(t.next!=se){t.next<0&&O.context&&t.acceptToken(H);return}t.advance();let e=t.next==oe;e&&t.advance();let a=sO(t,0);if(a===void 0)return;if(!a)return t.acceptToken(e?Tt:L);let i=O.context?O.context.name:null;if(e){if(a==i)return t.acceptToken(ft);if(i&&yt[i])return t.acceptToken(H,-2);if(O.dialectEnabled(kt))return t.acceptToken(gt);for(let r=O.context;r;r=r.parent)if(r.name==a)return;t.acceptToken(mt)}else{if(a=="script")return t.acceptToken(ee);if(a=="style")return t.acceptToken(te);if(a=="textarea")return t.acceptToken(ae);if(Xt.hasOwnProperty(a))return t.acceptToken(ie);i&&vO[i]&&vO[i][a]?t.acceptToken(H,-1):t.acceptToken(L)}},{contextual:!0}),zt=new b(t=>{for(let O=0,e=0;;e++){if(t.next<0){e&&t.acceptToken(_O);break}if(t.next==wt)O++;else if(t.next==ne&&O>=2){e>3&&t.acceptToken(_O,-2);break}else O=0;t.advance()}});function hO(t,O,e){let a=2+t.length;return new b(i=>{for(let r=0,s=0,n=0;;n++){if(i.next<0){n&&i.acceptToken(O);break}if(r==0&&i.next==se||r==1&&i.next==oe||r>=2&&rs?i.acceptToken(O,-s):i.acceptToken(e,-(s-2));break}else if((i.next==10||i.next==13)&&n){i.acceptToken(O,1);break}else r=s=0;i.advance()}})}const Gt=hO("script",ct,ut),Ct=hO("style",dt,$t),Ut=hO("textarea",ht,pt),Yt=QO({"Text RawText":o.content,"StartTag StartCloseTag SelfCloserEndTag EndTag SelfCloseEndTag":o.angleBracket,TagName:o.tagName,"MismatchedCloseTag/TagName":[o.tagName,o.invalid],AttributeName:o.attributeName,"AttributeValue UnquotedAttributeValue":o.attributeValue,Is:o.definitionOperator,"EntityReference CharacterReference":o.character,Comment:o.blockComment,ProcessingInst:o.processingInstruction,DoctypeDecl:o.documentMeta}),Vt=y.deserialize({version:14,states:",xOVOxOOO!WQ!bO'#CoO!]Q!bO'#CyO!bQ!bO'#C|O!gQ!bO'#DPO!lQ!bO'#DRO!qOXO'#CnO!|OYO'#CnO#XO[O'#CnO$eOxO'#CnOOOW'#Cn'#CnO$lO!rO'#DSO$tQ!bO'#DUO$yQ!bO'#DVOOOW'#Dj'#DjOOOW'#DX'#DXQVOxOOO%OQ#tO,59ZO%WQ#tO,59eO%`Q#tO,59hO%hQ#tO,59kO%pQ#tO,59mOOOX'#D]'#D]O%xOXO'#CwO&TOXO,59YOOOY'#D^'#D^O&]OYO'#CzO&hOYO,59YOOO['#D_'#D_O&pO[O'#C}O&{O[O,59YOOOW'#D`'#D`O'TOxO,59YO'[Q!bO'#DQOOOW,59Y,59YOOO`'#Da'#DaO'aO!rO,59nOOOW,59n,59nO'iQ!bO,59pO'nQ!bO,59qOOOW-E7V-E7VO'sQ#tO'#CqOOQO'#DY'#DYO(OQ#tO1G.uOOOX1G.u1G.uO(WQ#tO1G/POOOY1G/P1G/PO(`Q#tO1G/SOOO[1G/S1G/SO(hQ#tO1G/VOOOW1G/V1G/VO(pQ#tO1G/XOOOW1G/X1G/XOOOX-E7Z-E7ZO(xQ!bO'#CxOOOW1G.t1G.tOOOY-E7[-E7[O(}Q!bO'#C{OOO[-E7]-E7]O)SQ!bO'#DOOOOW-E7^-E7^O)XQ!bO,59lOOO`-E7_-E7_OOOW1G/Y1G/YOOOW1G/[1G/[OOOW1G/]1G/]O)^Q&jO,59]OOQO-E7W-E7WOOOX7+$a7+$aOOOY7+$k7+$kOOO[7+$n7+$nOOOW7+$q7+$qOOOW7+$s7+$sO)iQ!bO,59dO)nQ!bO,59gO)sQ!bO,59jOOOW1G/W1G/WO)xO,UO'#CtO*ZO7[O'#CtOOQO1G.w1G.wOOOW1G/O1G/OOOOW1G/R1G/ROOOW1G/U1G/UOOOO'#DZ'#DZO*lO,UO,59`OOQO,59`,59`OOOO'#D['#D[O*}O7[O,59`OOOO-E7X-E7XOOQO1G.z1G.zOOOO-E7Y-E7Y",stateData:"+h~O!]OS~OSSOTPOUQOVROWTOY]OZ[O[^O^^O_^O`^Oa^Ow^Oz_O!cZO~OdaO~OdbO~OdcO~OddO~OdeO~O!VfOPkP!YkP~O!WiOQnP!YnP~O!XlORqP!YqP~OSSOTPOUQOVROWTOXqOY]OZ[O[^O^^O_^O`^Oa^Ow^O!cZO~O!YrO~P#dO!ZsO!duO~OdvO~OdwO~OfyOj|O~OfyOj!OO~OfyOj!QO~OfyOj!SO~OfyOj!UO~O!VfOPkX!YkX~OP!WO!Y!XO~O!WiOQnX!YnX~OQ!ZO!Y!XO~O!XlORqX!YqX~OR!]O!Y!XO~O!Y!XO~P#dOd!_O~O!ZsO!d!aO~Oj!bO~Oj!cO~Og!dOfeXjeX~OfyOj!fO~OfyOj!gO~OfyOj!hO~OfyOj!iO~OfyOj!jO~Od!kO~Od!lO~Od!mO~Oj!nO~Oi!qO!_!oO!a!pO~Oj!rO~Oj!sO~Oj!tO~O_!uO`!uOa!uO!_!wO!`!uO~O_!xO`!xOa!xO!a!wO!b!xO~O_!uO`!uOa!uO!_!{O!`!uO~O_!xO`!xOa!xO!a!{O!b!xO~O`_a!cwz!c~",goto:"%o!_PPPPPPPPPPPPPPPPPP!`!fP!lPP!xPP!{#O#R#X#[#_#e#h#k#q#w!`P!`!`P#}$T$k$q$w$}%T%Z%aPPPPPPPP%gX^OX`pXUOX`pezabcde{}!P!R!TR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!TeZ!e{}!P!R!TQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"\u26A0 StartCloseTag StartCloseTag StartCloseTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue EndTag ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:66,context:vt,nodeProps:[["closedBy",-11,1,2,3,4,5,6,7,8,9,10,11,"EndTag",-4,19,29,32,35,"CloseTag"],["group",-9,12,15,16,17,18,38,39,40,41,"Entity",14,"Entity TextContent",-3,27,30,33,"TextContent Entity"],["openedBy",26,"StartTag StartCloseTag",-4,28,31,34,36,"OpenTag"]],propSources:[Yt],skippedNodes:[0],repeatNodeCount:9,tokenData:"!#b!aR!WOX$kXY)sYZ)sZ]$k]^)s^p$kpq)sqr$krs*zsv$kvw+dwx2yx}$k}!O3f!O!P$k!P!Q7_!Q![$k![!]8u!]!^$k!^!_>b!_!`!!p!`!a8T!a!c$k!c!}8u!}#R$k#R#S8u#S#T$k#T#o8u#o$f$k$f$g&R$g%W$k%W%o8u%o%p$k%p&a8u&a&b$k&b1p8u1p4U$k4U4d8u4d4e$k4e$IS8u$IS$I`$k$I`$Ib8u$Ib$Kh$k$Kh%#t8u%#t&/x$k&/x&Et8u&Et&FV$k&FV;'S8u;'S;:jiW!``!bpOq(kqr?Rrs'gsv(kwx(]x!a(k!a!bKj!b~(k!R?YZ!``!bpOr(krs'gsv(kwx(]x}(k}!O?{!O!f(k!f!gAR!g#W(k#W#XGz#X~(k!R@SV!``!bpOr(krs'gsv(kwx(]x}(k}!O@i!O~(k!R@rT!``!bp!cPOr(krs'gsv(kwx(]x~(k!RAYV!``!bpOr(krs'gsv(kwx(]x!q(k!q!rAo!r~(k!RAvV!``!bpOr(krs'gsv(kwx(]x!e(k!e!fB]!f~(k!RBdV!``!bpOr(krs'gsv(kwx(]x!v(k!v!wBy!w~(k!RCQV!``!bpOr(krs'gsv(kwx(]x!{(k!{!|Cg!|~(k!RCnV!``!bpOr(krs'gsv(kwx(]x!r(k!r!sDT!s~(k!RD[V!``!bpOr(krs'gsv(kwx(]x!g(k!g!hDq!h~(k!RDxW!``!bpOrDqrsEbsvDqvwEvwxFfx!`Dq!`!aGb!a~DqqEgT!bpOvEbvxEvx!`Eb!`!aFX!a~EbPEyRO!`Ev!`!aFS!a~EvPFXOzPqF`Q!bpzPOv'gx~'gaFkV!``OrFfrsEvsvFfvwEvw!`Ff!`!aGQ!a~FfaGXR!``zPOr(]sv(]w~(]!RGkT!``!bpzPOr(krs'gsv(kwx(]x~(k!RHRV!``!bpOr(krs'gsv(kwx(]x#c(k#c#dHh#d~(k!RHoV!``!bpOr(krs'gsv(kwx(]x#V(k#V#WIU#W~(k!RI]V!``!bpOr(krs'gsv(kwx(]x#h(k#h#iIr#i~(k!RIyV!``!bpOr(krs'gsv(kwx(]x#m(k#m#nJ`#n~(k!RJgV!``!bpOr(krs'gsv(kwx(]x#d(k#d#eJ|#e~(k!RKTV!``!bpOr(krs'gsv(kwx(]x#X(k#X#YDq#Y~(k!RKqW!``!bpOrKjrsLZsvKjvwLowxNPx!aKj!a!b! g!b~KjqL`T!bpOvLZvxLox!aLZ!a!bM^!b~LZPLrRO!aLo!a!bL{!b~LoPMORO!`Lo!`!aMX!a~LoPM^OwPqMcT!bpOvLZvxLox!`LZ!`!aMr!a~LZqMyQ!bpwPOv'gx~'gaNUV!``OrNPrsLosvNPvwLow!aNP!a!bNk!b~NPaNpV!``OrNPrsLosvNPvwLow!`NP!`!a! V!a~NPa! ^R!``wPOr(]sv(]w~(]!R! nW!``!bpOrKjrsLZsvKjvwLowxNPx!`Kj!`!a!!W!a~Kj!R!!aT!``!bpwPOr(krs'gsv(kwx(]x~(k!V!!{VgS^P!``!bpOr&Rrs&qsv&Rwx'rx!^&R!^!_(k!_~&R",tokenizers:[Gt,Ct,Ut,qt,zt,0,1,2,3,4,5],topRules:{Document:[0,13]},dialects:{noMatch:0},tokenPrec:476});function Et(t,O){let e=Object.create(null);for(let a of t.firstChild.getChildren("Attribute")){let i=a.getChild("AttributeName"),r=a.getChild("AttributeValue")||a.getChild("UnquotedAttributeValue");i&&(e[O.read(i.from,i.to)]=r?r.name=="AttributeValue"?O.read(r.from+1,r.to-1):O.read(r.from,r.to):"")}return e}function OO(t,O,e){let a;for(let i of e)if(!i.attrs||i.attrs(a||(a=Et(t.node.parent,O))))return{parser:i.parser};return null}function It(t){let O=[],e=[],a=[];for(let i of t){let r=i.tag=="script"?O:i.tag=="style"?e:i.tag=="textarea"?a:null;if(!r)throw new RangeError("Only script, style, and textarea tags can host nested parsers");r.push(i)}return _e((i,r)=>{let s=i.type.id;return s==bt?OO(i,r,O):s==Pt?OO(i,r,e):s==Rt?OO(i,r,a):null})}const At=93,UO=1,Nt=94,Dt=95,YO=2,le=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Lt=58,Ft=40,Qe=95,Jt=91,A=45,Mt=46,Bt=35,Kt=37;function F(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Ht(t){return t>=48&&t<=57}const Oa=new b((t,O)=>{for(let e=!1,a=0,i=0;;i++){let{next:r}=t;if(F(r)||r==A||r==Qe||e&&Ht(r))!e&&(r!=A||i>0)&&(e=!0),a===i&&r==A&&a++,t.advance();else{e&&t.acceptToken(r==Ft?Nt:a==2&&O.canShift(YO)?YO:Dt);break}}}),ea=new b(t=>{if(le.includes(t.peek(-1))){let{next:O}=t;(F(O)||O==Qe||O==Bt||O==Mt||O==Jt||O==Lt||O==A)&&t.acceptToken(At)}}),ta=new b(t=>{if(!le.includes(t.peek(-1))){let{next:O}=t;if(O==Kt&&(t.advance(),t.acceptToken(UO)),F(O)){do t.advance();while(F(t.next));t.acceptToken(UO)}}}),aa=QO({"import charset namespace keyframes":o.definitionKeyword,"media supports":o.controlKeyword,"from to selector":o.keyword,NamespaceName:o.namespace,KeyframeName:o.labelName,TagName:o.tagName,ClassName:o.className,PseudoClassName:o.constant(o.className),IdName:o.labelName,"FeatureName PropertyName":o.propertyName,AttributeName:o.attributeName,NumberLiteral:o.number,KeywordQuery:o.keyword,UnaryQueryOp:o.operatorKeyword,"CallTag ValueName":o.atom,VariableName:o.variableName,Callee:o.operatorKeyword,Unit:o.unit,"UniversalSelector NestingSelector":o.definitionOperator,AtKeyword:o.keyword,MatchOp:o.compareOperator,"ChildOp SiblingOp, LogicOp":o.logicOperator,BinOp:o.arithmeticOperator,Important:o.modifier,Comment:o.blockComment,ParenthesizedContent:o.special(o.name),ColorLiteral:o.color,StringLiteral:o.string,":":o.punctuation,"PseudoOp #":o.derefOperator,"; ,":o.separator,"( )":o.paren,"[ ]":o.squareBracket,"{ }":o.brace}),ia={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,dir:32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},ra={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},sa={__proto__:null,not:128,only:128,from:158,to:160},na=y.deserialize({version:14,states:"7WOYQ[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO!ZQ[O'#CfO!}QXO'#CaO#UQ[O'#ChO#aQ[O'#DPO#fQ[O'#DTOOQP'#Ec'#EcO#kQdO'#DeO$VQ[O'#DrO#kQdO'#DtO$hQ[O'#DvO$sQ[O'#DyO$xQ[O'#EPO%WQ[O'#EROOQS'#Eb'#EbOOQS'#ES'#ESQYQ[OOOOQP'#Cg'#CgOOQP,59Q,59QO!ZQ[O,59QO%_Q[O'#EVO%yQWO,58{O&RQ[O,59SO#aQ[O,59kO#fQ[O,59oO%_Q[O,59sO%_Q[O,59uO%_Q[O,59vO'bQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO'iQWO,59SO'nQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO'sQ`O,59oOOQS'#Cp'#CpO#kQdO'#CqO'{QvO'#CsO)VQtO,5:POOQO'#Cx'#CxO'iQWO'#CwO)kQWO'#CyOOQS'#Ef'#EfOOQO'#Dh'#DhO)pQ[O'#DoO*OQWO'#EiO$xQ[O'#DmO*^QWO'#DpOOQO'#Ej'#EjO%|QWO,5:^O*cQpO,5:`OOQS'#Dx'#DxO*kQWO,5:bO*pQ[O,5:bOOQO'#D{'#D{O*xQWO,5:eO*}QWO,5:kO+VQWO,5:mOOQS-E8Q-E8QOOQP1G.l1G.lO+yQXO,5:qOOQO-E8T-E8TOOQS1G.g1G.gOOQP1G.n1G.nO'iQWO1G.nO'nQWO1G.nOOQP1G/V1G/VO,WQ`O1G/ZO,qQXO1G/_O-XQXO1G/aO-oQXO1G/bO.VQXO'#CdO.zQWO'#DaOOQS,59z,59zO/PQWO,59zO/XQ[O,59zO/`QdO'#CoO/gQ[O'#DOOOQP1G/Z1G/ZO#kQdO1G/ZO/nQpO,59]OOQS,59_,59_O#kQdO,59aO/vQWO1G/kOOQS,59c,59cO/{Q!bO,59eO0TQWO'#DhO0`QWO,5:TO0eQWO,5:ZO$xQ[O,5:VO$xQ[O'#EYO0mQWO,5;TO0xQWO,5:XO%_Q[O,5:[OOQS1G/x1G/xOOQS1G/z1G/zOOQS1G/|1G/|O1ZQWO1G/|O1`QdO'#D|OOQS1G0P1G0POOQS1G0V1G0VOOQS1G0X1G0XOOQP7+$Y7+$YOOQP7+$u7+$uO#kQdO7+$uO#kQdO,59{O1nQ[O'#EXO1xQWO1G/fOOQS1G/f1G/fO1xQWO1G/fO2QQtO'#ETO2uQdO'#EeO3PQWO,59ZO3UQXO'#EhO3]QWO,59jO3bQpO7+$uOOQS1G.w1G.wOOQS1G.{1G.{OOQS7+%V7+%VO3jQWO1G/PO#kQdO1G/oOOQO1G/u1G/uOOQO1G/q1G/qO3oQWO,5:tOOQO-E8W-E8WO3}QXO1G/vOOQS7+%h7+%hO4UQYO'#CsO%|QWO'#EZO4^QdO,5:hOOQS,5:h,5:hO4lQpO<O!c!}$w!}#O?[#O#P$w#P#Q?g#Q#R2U#R#T$w#T#U?r#U#c$w#c#d@q#d#o$w#o#pAQ#p#q2U#q#rA]#r#sAh#s#y$w#y#z%]#z$f$w$f$g%]$g#BY$w#BY#BZ%]#BZ$IS$w$IS$I_%]$I_$I|$w$I|$JO%]$JO$JT$w$JT$JU%]$JU$KV$w$KV$KW%]$KW&FU$w&FU&FV%]&FV~$wW$zQOy%Qz~%QW%VQoWOy%Qz~%Q~%bf#T~OX%QX^&v^p%Qpq&vqy%Qz#y%Q#y#z&v#z$f%Q$f$g&v$g#BY%Q#BY#BZ&v#BZ$IS%Q$IS$I_&v$I_$I|%Q$I|$JO&v$JO$JT%Q$JT$JU&v$JU$KV%Q$KV$KW&v$KW&FU%Q&FU&FV&v&FV~%Q~&}f#T~oWOX%QX^&v^p%Qpq&vqy%Qz#y%Q#y#z&v#z$f%Q$f$g&v$g#BY%Q#BY#BZ&v#BZ$IS%Q$IS$I_&v$I_$I|%Q$I|$JO&v$JO$JT%Q$JT$JU&v$JU$KV%Q$KV$KW&v$KW&FU%Q&FU&FV&v&FV~%Q^(fSOy%Qz#]%Q#]#^(r#^~%Q^(wSoWOy%Qz#a%Q#a#b)T#b~%Q^)YSoWOy%Qz#d%Q#d#e)f#e~%Q^)kSoWOy%Qz#c%Q#c#d)w#d~%Q^)|SoWOy%Qz#f%Q#f#g*Y#g~%Q^*_SoWOy%Qz#h%Q#h#i*k#i~%Q^*pSoWOy%Qz#T%Q#T#U*|#U~%Q^+RSoWOy%Qz#b%Q#b#c+_#c~%Q^+dSoWOy%Qz#h%Q#h#i+p#i~%Q^+wQ!VUoWOy%Qz~%Q~,QUOY+}Zr+}rs,ds#O+}#O#P,i#P~+}~,iOh~~,lPO~+}_,tWtPOy%Qz!Q%Q!Q![-^![!c%Q!c!i-^!i#T%Q#T#Z-^#Z~%Q^-cWoWOy%Qz!Q%Q!Q![-{![!c%Q!c!i-{!i#T%Q#T#Z-{#Z~%Q^.QWoWOy%Qz!Q%Q!Q![.j![!c%Q!c!i.j!i#T%Q#T#Z.j#Z~%Q^.qWfUoWOy%Qz!Q%Q!Q![/Z![!c%Q!c!i/Z!i#T%Q#T#Z/Z#Z~%Q^/bWfUoWOy%Qz!Q%Q!Q![/z![!c%Q!c!i/z!i#T%Q#T#Z/z#Z~%Q^0PWoWOy%Qz!Q%Q!Q![0i![!c%Q!c!i0i!i#T%Q#T#Z0i#Z~%Q^0pWfUoWOy%Qz!Q%Q!Q![1Y![!c%Q!c!i1Y!i#T%Q#T#Z1Y#Z~%Q^1_WoWOy%Qz!Q%Q!Q![1w![!c%Q!c!i1w!i#T%Q#T#Z1w#Z~%Q^2OQfUoWOy%Qz~%QY2XSOy%Qz!_%Q!_!`2e!`~%QY2lQzQoWOy%Qz~%QX2wQXPOy%Qz~%Q~3QUOY2}Zw2}wx,dx#O2}#O#P3d#P~2}~3gPO~2}_3oQbVOy%Qz~%Q~3zOa~_4RSUPjSOy%Qz!_%Q!_!`2e!`~%Q_4fUjS!PPOy%Qz!O%Q!O!P4x!P!Q%Q!Q![7_![~%Q^4}SoWOy%Qz!Q%Q!Q![5Z![~%Q^5bWoW#ZUOy%Qz!Q%Q!Q![5Z![!g%Q!g!h5z!h#X%Q#X#Y5z#Y~%Q^6PWoWOy%Qz{%Q{|6i|}%Q}!O6i!O!Q%Q!Q![6z![~%Q^6nSoWOy%Qz!Q%Q!Q![6z![~%Q^7RSoW#ZUOy%Qz!Q%Q!Q![6z![~%Q^7fYoW#ZUOy%Qz!O%Q!O!P5Z!P!Q%Q!Q![7_![!g%Q!g!h5z!h#X%Q#X#Y5z#Y~%Q_8ZQpVOy%Qz~%Q^8fUjSOy%Qz!O%Q!O!P4x!P!Q%Q!Q![7_![~%Q_8}S#WPOy%Qz!Q%Q!Q![5Z![~%Q~9`RjSOy%Qz{9i{~%Q~9nSoWOy9iyz9zz{:o{~9i~9}ROz9zz{:W{~9z~:ZTOz9zz{:W{!P9z!P!Q:j!Q~9z~:oOR~~:tUoWOy9iyz9zz{:o{!P9i!P!Q;W!Q~9i~;_QoWR~Oy%Qz~%Q^;jY#ZUOy%Qz!O%Q!O!P5Z!P!Q%Q!Q![7_![!g%Q!g!h5z!h#X%Q#X#Y5z#Y~%QX<_S]POy%Qz![%Q![!]RUOy%Qz!c%Q!c!}>e!}#T%Q#T#o>e#o~%QX>lY!YPoWOy%Qz}%Q}!O>e!O!Q%Q!Q![>e![!c%Q!c!}>e!}#T%Q#T#o>e#o~%QX?aQxPOy%Qz~%Q^?lQvUOy%Qz~%QX?uSOy%Qz#b%Q#b#c@R#c~%QX@WSoWOy%Qz#W%Q#W#X@d#X~%QX@kQ!`PoWOy%Qz~%QX@tSOy%Qz#f%Q#f#g@d#g~%QXAVQ!RPOy%Qz~%Q_AbQ!QVOy%Qz~%QZAmS!PPOy%Qz!_%Q!_!`2e!`~%Q",tokenizers:[ea,ta,Oa,0,1,2,3],topRules:{StyleSheet:[0,4]},specialized:[{term:94,get:t=>ia[t]||-1},{term:56,get:t=>ra[t]||-1},{term:95,get:t=>sa[t]||-1}],tokenPrec:1078});let eO=null;function tO(){if(!eO&&typeof document=="object"&&document.body){let t=[];for(let O in document.body.style)/[A-Z]|^-|^(item|length)$/.test(O)||t.push(O);eO=t.sort().map(O=>({type:"property",label:O}))}return eO||[]}const VO=["active","after","before","checked","default","disabled","empty","enabled","first-child","first-letter","first-line","first-of-type","focus","hover","in-range","indeterminate","invalid","lang","last-child","last-of-type","link","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-of-type","only-child","optional","out-of-range","placeholder","read-only","read-write","required","root","selection","target","valid","visited"].map(t=>({type:"class",label:t})),EO=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),oa=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),x=/^[\w-]*/,la=t=>{let{state:O,pos:e}=t,a=z(O).resolveInner(e,-1);if(a.name=="PropertyName")return{from:a.from,options:tO(),validFor:x};if(a.name=="ValueName")return{from:a.from,options:EO,validFor:x};if(a.name=="PseudoClassName")return{from:a.from,options:VO,validFor:x};if(a.name=="TagName"){for(let{parent:s}=a;s;s=s.parent)if(s.name=="Block")return{from:a.from,options:tO(),validFor:x};return{from:a.from,options:oa,validFor:x}}if(!t.explicit)return null;let i=a.resolve(e),r=i.childBefore(e);return r&&r.name==":"&&i.name=="PseudoClassSelector"?{from:e,options:VO,validFor:x}:r&&r.name==":"&&i.name=="Declaration"||i.name=="ArgList"?{from:e,options:EO,validFor:x}:i.name=="Block"?{from:e,options:tO(),validFor:x}:null},nO=cO.define({parser:na.configure({props:[uO.add({Declaration:V()}),dO.add({Block:HO})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qa(){return new $O(nO,nO.data.of({autocomplete:la}))}const ca=1,IO=281,AO=2,ua=3,U=282,da=4,$a=283,NO=284,ha=286,pa=287,fa=5,ga=6,ma=1,Ta=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],ce=125,Sa=123,ba=59,DO=47,Pa=42,Ra=43,xa=45,ka=36,Xa=96,ya=92,Za=new Oe({start:!1,shift(t,O){return O==fa||O==ga||O==ha?t:O==pa},strict:!1}),Wa=new b((t,O)=>{let{next:e}=t;(e==ce||e==-1||O.context)&&O.canShift(NO)&&t.acceptToken(NO)},{contextual:!0,fallback:!0}),ja=new b((t,O)=>{let{next:e}=t,a;Ta.indexOf(e)>-1||e==DO&&((a=t.peek(1))==DO||a==Pa)||e!=ce&&e!=ba&&e!=-1&&!O.context&&O.canShift(IO)&&t.acceptToken(IO)},{contextual:!0}),wa=new b((t,O)=>{let{next:e}=t;if((e==Ra||e==xa)&&(t.advance(),e==t.next)){t.advance();let a=!O.context&&O.canShift(AO);t.acceptToken(a?AO:ua)}},{contextual:!0}),_a=new b(t=>{for(let O=!1,e=0;;e++){let{next:a}=t;if(a<0){e&&t.acceptToken(U);break}else if(a==Xa){e?t.acceptToken(U):t.acceptToken($a,1);break}else if(a==Sa&&O){e==1?t.acceptToken(da,1):t.acceptToken(U,-1);break}else if(a==10&&e){t.advance(),t.acceptToken(U);break}else a==ya&&t.advance();O=a==ka,t.advance()}}),va=new b((t,O)=>{if(!(t.next!=101||!O.dialectEnabled(ma))){t.advance();for(let e=0;e<6;e++){if(t.next!="xtends".charCodeAt(e))return;t.advance()}t.next>=57&&t.next<=65||t.next>=48&&t.next<=90||t.next==95||t.next>=97&&t.next<=122||t.next>160||t.acceptToken(ca)}}),qa=QO({"get set async static":o.modifier,"for while do if else switch try catch finally return throw break continue default case":o.controlKeyword,"in of await yield void typeof delete instanceof":o.operatorKeyword,"let var const function class extends":o.definitionKeyword,"import export from":o.moduleKeyword,"with debugger as new":o.keyword,TemplateString:o.special(o.string),super:o.atom,BooleanLiteral:o.bool,this:o.self,null:o.null,Star:o.modifier,VariableName:o.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":o.function(o.variableName),VariableDefinition:o.definition(o.variableName),Label:o.labelName,PropertyName:o.propertyName,PrivatePropertyName:o.special(o.propertyName),"CallExpression/MemberExpression/PropertyName":o.function(o.propertyName),"FunctionDeclaration/VariableDefinition":o.function(o.definition(o.variableName)),"ClassDeclaration/VariableDefinition":o.definition(o.className),PropertyDefinition:o.definition(o.propertyName),PrivatePropertyDefinition:o.definition(o.special(o.propertyName)),UpdateOp:o.updateOperator,LineComment:o.lineComment,BlockComment:o.blockComment,Number:o.number,String:o.string,ArithOp:o.arithmeticOperator,LogicOp:o.logicOperator,BitOp:o.bitwiseOperator,CompareOp:o.compareOperator,RegExp:o.regexp,Equals:o.definitionOperator,Arrow:o.function(o.punctuation),": Spread":o.punctuation,"( )":o.paren,"[ ]":o.squareBracket,"{ }":o.brace,"InterpolationStart InterpolationEnd":o.special(o.brace),".":o.derefOperator,", ;":o.separator,TypeName:o.typeName,TypeDefinition:o.definition(o.typeName),"type enum interface implements namespace module declare":o.definitionKeyword,"abstract global Privacy readonly override":o.modifier,"is keyof unique infer":o.operatorKeyword,JSXAttributeValue:o.attributeValue,JSXText:o.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":o.angleBracket,"JSXIdentifier JSXNameSpacedName":o.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":o.attributeName}),za={__proto__:null,export:18,as:23,from:29,default:32,async:37,function:38,this:48,true:56,false:56,void:66,typeof:70,null:86,super:88,new:122,await:139,yield:141,delete:142,class:152,extends:154,public:197,private:197,protected:197,readonly:199,instanceof:220,in:222,const:224,import:256,keyof:307,unique:311,infer:317,is:351,abstract:371,implements:373,type:375,let:378,var:380,interface:387,enum:391,namespace:397,module:399,declare:403,global:407,for:428,of:437,while:440,with:444,do:448,if:452,else:454,switch:458,case:464,try:470,catch:474,finally:478,return:482,throw:486,break:490,continue:494,debugger:498},Ga={__proto__:null,async:109,get:111,set:113,public:161,private:161,protected:161,static:163,abstract:165,override:167,readonly:173,new:355},Ca={__proto__:null,"<":129},Ua=y.deserialize({version:14,states:"$8SO`QdOOO'QQ(C|O'#ChO'XOWO'#DVO)dQdO'#D]O)tQdO'#DhO){QdO'#DrO-xQdO'#DxOOQO'#E]'#E]O.]Q`O'#E[O.bQ`O'#E[OOQ(C['#Ef'#EfO0aQ(C|O'#ItO2wQ(C|O'#IuO3eQ`O'#EzO3jQ!bO'#FaOOQ(C['#FS'#FSO3rO#tO'#FSO4QQ&jO'#FhO5bQ`O'#FgOOQ(C['#Iu'#IuOOQ(CW'#It'#ItOOQS'#J^'#J^O5gQ`O'#HpO5lQ(ChO'#HqOOQS'#Ih'#IhOOQS'#Hr'#HrQ`QdOOO){QdO'#DjO5tQ`O'#G[O5yQ&jO'#CmO6XQ`O'#EZO6dQ`O'#EgO6iQ,UO'#FRO7TQ`O'#G[O7YQ`O'#G`O7eQ`O'#G`O7sQ`O'#GcO7sQ`O'#GdO7sQ`O'#GfO5tQ`O'#GiO8dQ`O'#GlO9rQ`O'#CdO:SQ`O'#GyO:[Q`O'#HPO:[Q`O'#HRO`QdO'#HTO:[Q`O'#HVO:[Q`O'#HYO:aQ`O'#H`O:fQ(CjO'#HfO){QdO'#HhO:qQ(CjO'#HjO:|Q(CjO'#HlO5lQ(ChO'#HnO){QdO'#DWOOOW'#Ht'#HtO;XOWO,59qOOQ(C[,59q,59qO=jQtO'#ChO=tQdO'#HuO>XQ`O'#IvO@WQtO'#IvO'dQdO'#IvO@_Q`O,59wO@uQ7[O'#DbOAnQ`O'#E]OA{Q`O'#JROBWQ`O'#JQOBWQ`O'#JQOB`Q`O,5:yOBeQ`O'#JPOBlQaO'#DyO5yQ&jO'#EZOBzQ`O'#EZOCVQpO'#FROOQ(C[,5:S,5:SOC_QdO,5:SOE]Q(C|O,5:^OEyQ`O,5:dOFdQ(ChO'#JOO7YQ`O'#I}OFkQ`O'#I}OFsQ`O,5:xOFxQ`O'#I}OGWQdO,5:vOIWQ&jO'#EWOJeQ`O,5:vOKwQ&jO'#DlOLOQdO'#DqOLYQ7[O,5;PO){QdO,5;POOQS'#Er'#ErOOQS'#Et'#EtO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;ROOQS'#Ex'#ExOLbQdO,5;cOOQ(C[,5;h,5;hOOQ(C[,5;i,5;iONbQ`O,5;iOOQ(C[,5;j,5;jO){QdO'#IPONgQ(ChO,5[OOQS'#Ik'#IkOOQS,5>],5>]OOQS-E;p-E;pO!+kQ(C|O,5:UOOQ(CX'#Cp'#CpO!,[Q&kO,5Q,5>QO){QdO,5>QO5lQ(ChO,5>SOOQS,5>U,5>UO!8cQ`O,5>UOOQS,5>W,5>WO!8cQ`O,5>WOOQS,5>Y,5>YO!8hQpO,59rOOOW-E;r-E;rOOQ(C[1G/]1G/]O!8mQtO,5>aO'dQdO,5>aOOQO,5>f,5>fO!8wQdO'#HuOOQO-E;s-E;sO!9UQ`O,5?bO!9^QtO,5?bO!9eQ`O,5?lOOQ(C[1G/c1G/cO!9mQ!bO'#DTOOQO'#Ix'#IxO){QdO'#IxO!:[Q!bO'#IxO!:yQ!bO'#DcO!;[Q7[O'#DcO!=gQdO'#DcO!=nQ`O'#IwO!=vQ`O,59|O!={Q`O'#EaO!>ZQ`O'#JSO!>cQ`O,5:zO!>yQ7[O'#DcO){QdO,5?mO!?TQ`O'#HzOOQO-E;x-E;xO!9eQ`O,5?lOOQ(CW1G0e1G0eO!@aQ7[O'#D|OOQ(C[,5:e,5:eO){QdO,5:eOIWQ&jO,5:eO!@hQaO,5:eO:aQ`O,5:uO!-OQ!bO,5:uO!-WQ&jO,5:uO5yQ&jO,5:uOOQ(C[1G/n1G/nOOQ(C[1G0O1G0OOOQ(CW'#EV'#EVO){QdO,5?jO!@sQ(ChO,5?jO!AUQ(ChO,5?jO!A]Q`O,5?iO!AeQ`O'#H|O!A]Q`O,5?iOOQ(CW1G0d1G0dO7YQ`O,5?iOOQ(C[1G0b1G0bO!BPQ(C|O1G0bO!CRQ(CyO,5:rOOQ(C]'#Fq'#FqO!CoQ(C}O'#IqOGWQdO1G0bO!EqQ,VO'#IyO!E{Q`O,5:WO!FQQtO'#IzO){QdO'#IzO!F[Q`O,5:]OOQ(C]'#DT'#DTOOQ(C[1G0k1G0kO!FaQ`O1G0kO!HrQ(C|O1G0mO!HyQ(C|O1G0mO!K^Q(C|O1G0mO!KeQ(C|O1G0mO!MlQ(C|O1G0mO!NPQ(C|O1G0mO#!pQ(C|O1G0mO#!wQ(C|O1G0mO#%[Q(C|O1G0mO#%cQ(C|O1G0mO#'WQ(C|O1G0mO#*QQMlO'#ChO#+{QMlO1G0}O#-vQMlO'#IuOOQ(C[1G1T1G1TO#.ZQ(C|O,5>kOOQ(CW-E;}-E;}O#.zQ(C}O1G0mOOQ(C[1G0m1G0mO#1PQ(C|O1G1QO#1pQ!bO,5;sO#1uQ!bO,5;tO#1zQ!bO'#F[O#2`Q`O'#FZOOQO'#JW'#JWOOQO'#H}'#H}O#2eQ!bO1G1]OOQ(C[1G1]1G1]OOOO1G1f1G1fO#2sQMlO'#ItO#2}Q`O,5;}OLbQdO,5;}OOOO-E;|-E;|OOQ(C[1G1Y1G1YOOQ(C[,5PQtO1G1VOOQ(C[1G1X1G1XO5tQ`O1G2}O#>WQ`O1G2}O#>]Q`O1G2}O#>bQ`O1G2}OOQS1G2}1G2}O#>gQ&kO1G2bO7YQ`O'#JQO7YQ`O'#EaO7YQ`O'#IWO#>xQ(ChO,5?yOOQS1G2f1G2fO!0VQ`O1G2lOIWQ&jO1G2iO#?TQ`O1G2iOOQS1G2j1G2jOIWQ&jO1G2jO#?YQaO1G2jO#?bQ7[O'#GhOOQS1G2l1G2lO!'VQ7[O'#IYO!0[QpO1G2oOOQS1G2o1G2oOOQS,5=Y,5=YO#?jQ&kO,5=[O5tQ`O,5=[O#6SQ`O,5=_O5bQ`O,5=_O!-OQ!bO,5=_O!-WQ&jO,5=_O5yQ&jO,5=_O#?{Q`O'#JaO#@WQ`O,5=`OOQS1G.j1G.jO#@]Q(ChO1G.jO#@hQ`O1G.jO#@mQ`O1G.jO5lQ(ChO1G.jO#@uQtO,5@OO#APQ`O,5@OO#A[QdO,5=gO#AcQ`O,5=gO7YQ`O,5@OOOQS1G3P1G3PO`QdO1G3POOQS1G3V1G3VOOQS1G3X1G3XO:[Q`O1G3ZO#AhQdO1G3]O#EcQdO'#H[OOQS1G3`1G3`O#EpQ`O'#HbO:aQ`O'#HdOOQS1G3f1G3fO#ExQdO1G3fO5lQ(ChO1G3lOOQS1G3n1G3nOOQ(CW'#Fx'#FxO5lQ(ChO1G3pO5lQ(ChO1G3rOOOW1G/^1G/^O#IvQpO,5aO#JYQ`O1G4|O#JbQ`O1G5WO#JjQ`O,5?dOLbQdO,5:{O7YQ`O,5:{O:aQ`O,59}OLbQdO,59}O!-OQ!bO,59}O#JoQMlO,59}OOQO,5:{,5:{O#JyQ7[O'#HvO#KaQ`O,5?cOOQ(C[1G/h1G/hO#KiQ7[O'#H{O#K}Q`O,5?nOOQ(CW1G0f1G0fO!;[Q7[O,59}O#LVQtO1G5XO7YQ`O,5>fOOQ(CW'#ES'#ESO#LaQ(DjO'#ETO!@XQ7[O'#D}OOQO'#Hy'#HyO#L{Q7[O,5:hOOQ(C[,5:h,5:hO#MSQ7[O'#D}O#MeQ7[O'#D}O#MlQ7[O'#EYO#MoQ7[O'#ETO#M|Q7[O'#ETO!@XQ7[O'#ETO#NaQ`O1G0PO#NfQqO1G0POOQ(C[1G0P1G0PO){QdO1G0POIWQ&jO1G0POOQ(C[1G0a1G0aO:aQ`O1G0aO!-OQ!bO1G0aO!-WQ&jO1G0aO#NmQ(C|O1G5UO){QdO1G5UO#N}Q(ChO1G5UO$ `Q`O1G5TO7YQ`O,5>hOOQO,5>h,5>hO$ hQ`O,5>hOOQO-E;z-E;zO$ `Q`O1G5TO$ vQ(C}O,59jO$#xQ(C}O,5m,5>mO$-rQ`O,5>mOOQ(C]1G2P1G2PP$-wQ`O'#IRPOQ(C]-Eo,5>oOOQO-Ep,5>pOOQO-Ex,5>xOOQO-E<[-E<[OOQ(C[7+&q7+&qO$6OQ`O7+(iO5lQ(ChO7+(iO5tQ`O7+(iO$6TQ`O7+(iO$6YQaO7+'|OOQ(CW,5>r,5>rOOQ(CW-Et,5>tOOQO-EO,5>OOOQS7+)Q7+)QOOQS7+)W7+)WOOQS7+)[7+)[OOQS7+)^7+)^OOQO1G5O1G5OO$:nQMlO1G0gO$:xQ`O1G0gOOQO1G/i1G/iO$;TQMlO1G/iO:aQ`O1G/iOLbQdO'#DcOOQO,5>b,5>bOOQO-E;t-E;tOOQO,5>g,5>gOOQO-E;y-E;yO!-OQ!bO1G/iO:aQ`O,5:iOOQO,5:o,5:oO){QdO,5:oO$;_Q(ChO,5:oO$;jQ(ChO,5:oO!-OQ!bO,5:iOOQO-E;w-E;wOOQ(C[1G0S1G0SO!@XQ7[O,5:iO$;xQ7[O,5:iO$PQ`O7+*oO$>XQ(C}O1G2[O$@^Q(C}O1G2^O$BcQ(C}O1G1yO$DnQ,VO,5>cOOQO-E;u-E;uO$DxQtO,5>dO){QdO,5>dOOQO-E;v-E;vO$ESQ`O1G5QO$E[QMlO1G0bO$GcQMlO1G0mO$GjQMlO1G0mO$IkQMlO1G0mO$IrQMlO1G0mO$KgQMlO1G0mO$KzQMlO1G0mO$NXQMlO1G0mO$N`QMlO1G0mO%!aQMlO1G0mO%!hQMlO1G0mO%$]QMlO1G0mO%$pQ(C|O<kOOOO7+'T7+'TOOOW1G/R1G/ROOQ(C]1G4X1G4XOJjQ&jO7+'zO%*VQ`O,5>lO5tQ`O,5>lOOQO-EnO%+dQ`O,5>nOIWQ&jO,5>nOOQO-Ew,5>wO%.vQ`O,5>wO%.{Q`O,5>wOOQO-EvOOQO-EqOOQO-EsOOQO-E{AN>{OOQOAN>uAN>uO%3rQ(C|OAN>{O:aQ`OAN>uO){QdOAN>{O!-OQ!bOAN>uO&)wQ(ChOAN>{O&*SQ(C}OG26lOOQ(CWG26bG26bOOQS!$( t!$( tOOQO<QQ`O'#E[O&>YQ`O'#EzO&>_Q`O'#EgO&>dQ`O'#JRO&>oQ`O'#JPO&>zQ`O,5:vO&?PQ,VO,5aO!O&PO~Ox&SO!W&^O!X&VO!Y&VO'^$dO~O]&TOk&TO!Q&WO'g&QO!S'kP!S'vP~P@dO!O'sX!R'sX!]'sX!c'sX'p'sX~O!{'sX#W#PX!S'sX~PA]O!{&_O!O'uX!R'uX~O!R&`O!O'tX~O!O&cO~O!{#eO~PA]OP&gO!T&dO!o&fO']$bO~Oc&lO!d$ZO']$bO~Ou$oO!d$nO~O!S&mO~P`Ou!{Ov!{Ox!|O!b!yO!d!zO'fQOQ!faZ!faj!fa!R!fa!a!fa!j!fa#[!fa#]!fa#^!fa#_!fa#`!fa#a!fa#b!fa#c!fa#e!fa#g!fa#i!fa#j!fa'p!fa'w!fa'x!fa~O_!fa'W!fa!O!fa!c!fan!fa!T!fa%Q!fa!]!fa~PCfO!c&nO~O!]!wO!{&pO'p&oO!R'rX_'rX'W'rX~O!c'rX~PFOO!R&tO!c'qX~O!c&vO~Ox$uO!T$vO#V&wO']$bO~OQTORTO]cOb!kOc!jOhcOjTOkcOlcOqTOsTOxRO{cO|cO}cO!TSO!_kO!dUO!gTO!hTO!iTO!jTO!kTO!n!iO#t!lO#x^O']9aO'fQO'oYO'|aO~O]#qOh$QOj#rOk#qOl#qOq$ROs9tOx#yO!T#zO!_;eO!d#vO#V9}O#t$VO$_9wO$a9zO$d$WO']&{O'b$PO'f#sO~O#W&}O~O]#qOh$QOj#rOk#qOl#qOq$ROs$SOx#yO!T#zO!_$XO!d#vO#V$YO#t$VO$_$TO$a$UO$d$WO']&{O'b$PO'f#sO~O'a'mP~PJjO!Q'RO!c'nP~P){O'g'TO'oYO~OQ9^OR9^O]cOb;`Oc!jOhcOj9^OkcOlcOq9^Os9^OxRO{cO|cO}cO!T!bO!_9`O!dUO!g9^O!h9^O!i9^O!j9^O!k9^O!n!iO#t!lO#x^O']'cO'fQO'oYO'|;^O~O!d!zO~O!R#bO_$]a'W$]a!c$]a!O$]a!T$]a%Q$]a!]$]a~O#d'jO~PIWO!]'lO!T'yX#w'yX#z'yX$R'yX~Ou'mO~P! YOu'mO!T'yX#w'yX#z'yX$R'yX~O!T'oO#w'sO#z'nO$R'tO~O!Q'wO~PLbO#z#fO$R'zO~OP$eXu$eXx$eX!b$eX'w$eX'x$eX~OPfX!RfX!{fX'afX'a$eX~P!!rOk'|O~OS'}O'U(OO'V(QO~OP(ZOu(SOx(TO'w(VO'x(XO~O'a(RO~P!#{O'a([O~O]#qOh$QOj#rOk#qOl#qOq$ROs9tOx#yO!T#zO!_;eO!d#vO#V9}O#t$VO$_9wO$a9zO$d$WO'b$PO'f#sO~O!Q(`O'](]O!c'}P~P!$jO#W(bO~O!d(cO~O!Q(hO'](eO!O(OP~P!$jOj(uOx(mO!W(sO!X(lO!Y(lO!d(cO!x(tO$w(oO'^$dO'g(jO~O!S(rO~P!&jO!b!yOP'eXu'eXx'eX'w'eX'x'eX!R'eX!{'eX~O'a'eX#m'eX~P!'cOP(xO!{(wO!R'dX'a'dX~O!R(yO'a'cX~O']${O'a'cP~O'](|O~O!d)RO~O']&{O~Ox$uO!Q!rO!T$vO#U!uO#V!rO']$bO!c'qP~O!]!wO#W)VO~OQ#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO#i#YO#j#ZO'fQO'p#[O'w!}O'x#OO~O_!^a!R!^a'W!^a!O!^a!c!^an!^a!T!^a%Q!^a!]!^a~P!)wOP)_O!T&dO!o)^O%Q)]O'b$PO~O!])aO!T'`X_'`X!R'`X'W'`X~O!d$ZO'b$PO~O!d$ZO']$bO'b$PO~O!]!wO#W&}O~O])lO%R)mO'])iO!S(VP~O!R)nO^(UX~O'g'TO~OZ)rO~O^)sO~O!T$lO']$bO'^$dO^(UP~Ox$uO!Q)xO!R&`O!T$vO']$bO!O'tP~O]&ZOk&ZO!Q)yO'g'TO!S'vP~O!R)zO_(RX'W(RX~O!{*OO'b$PO~OP*RO!T#zO'b$PO~O!T*TO~Ou*VO!TSO~O!n*[O~Oc*aO~O'](|O!S(TP~Oc$jO~O%RtO']${O~P8wOZ*gO^*fO~OQTORTO]cObnOcmOhcOjTOkcOlcOqTOsTOxRO{cO|cO}cO!_kO!dUO!gTO!hTO!iTO!jTO!kTO!nlO#x^O%PqO'fQO'oYO'|aO~O!T!bO#t!lO']9aO~P!1_O^*fO_$^O'W$^O~O_*kO#d*mO%T*mO%U*mO~P){O!d%`O~O%t*rO~O!T*tO~O&V*vO&X*wOQ&SaR&SaX&Sa]&Sa_&Sab&Sac&Sah&Saj&Sak&Sal&Saq&Sas&Sax&Sa{&Sa|&Sa}&Sa!T&Sa!_&Sa!d&Sa!g&Sa!h&Sa!i&Sa!j&Sa!k&Sa!n&Sa#d&Sa#t&Sa#x&Sa%P&Sa%R&Sa%T&Sa%U&Sa%X&Sa%Z&Sa%^&Sa%_&Sa%a&Sa%n&Sa%t&Sa%v&Sa%x&Sa%z&Sa%}&Sa&T&Sa&Z&Sa&]&Sa&_&Sa&a&Sa&c&Sa'S&Sa']&Sa'f&Sa'o&Sa'|&Sa!S&Sa%{&Sa`&Sa&Q&Sa~O']*|O~On+PO~O!O&ia!R&ia~P!)wO!Q+TO!O&iX!R&iX~P){O!R%zO!O'ja~O!O'ja~P>aO!R&`O!O'ta~O!RwX!R!ZX!SwX!S!ZX!]wX!]!ZX!d!ZX!{wX'b!ZX~O!]+YO!{+XO!R#TX!R'lX!S#TX!S'lX!]'lX!d'lX'b'lX~O!]+[O!d$ZO'b$PO!R!VX!S!VX~O]&ROk&ROx&SO'g(jO~OQ9^OR9^O]cOb;`Oc!jOhcOj9^OkcOlcOq9^Os9^OxRO{cO|cO}cO!T!bO!_9`O!dUO!g9^O!h9^O!i9^O!j9^O!k9^O!n!iO#t!lO#x^O'fQO'oYO'|;^O~O']:SO~P!;jO!R+`O!S'kX~O!S+bO~O!]+YO!{+XO!R#TX!S#TX~O!R+cO!S'vX~O!S+eO~O]&ROk&ROx&SO'^$dO'g(jO~O!X+fO!Y+fO~P!>hOx$uO!Q+hO!T$vO']$bO!O&nX!R&nX~O_+lO!W+oO!X+kO!Y+kO!r+sO!s+qO!t+rO!u+pO!x+tO'^$dO'g(jO'o+iO~O!S+nO~P!?iOP+yO!T&dO!o+xO~O!{,PO!R'ra!c'ra_'ra'W'ra~O!]!wO~P!@sO!R&tO!c'qa~Ox$uO!Q,SO!T$vO#U,UO#V,SO']$bO!R&pX!c&pX~O_#Oi!R#Oi'W#Oi!O#Oi!c#Oin#Oi!T#Oi%Q#Oi!]#Oi~P!)wOP;tOu(SOx(TO'w(VO'x(XO~O#W!za!R!za!c!za!{!za!T!za_!za'W!za!O!za~P!BpO#W'eXQ'eXZ'eX_'eXj'eXv'eX!a'eX!d'eX!j'eX#['eX#]'eX#^'eX#_'eX#`'eX#a'eX#b'eX#c'eX#e'eX#g'eX#i'eX#j'eX'W'eX'f'eX'p'eX!c'eX!O'eX!T'eXn'eX%Q'eX!]'eX~P!'cO!R,_O'a'mX~P!#{O'a,aO~O!R,bO!c'nX~P!)wO!c,eO~O!O,fO~OQ#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O'fQOZ#Zi_#Zij#Zi!R#Zi!a#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O#[#Zi~P!FfO#[#PO~P!FfOQ#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO'fQOZ#Zi_#Zi!R#Zi!a#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~Oj#Zi~P!IQOj#RO~P!IQOQ#^Oj#ROu!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO'fQO_#Zi!R#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~OZ#Zi!a#Zi#a#Zi#b#Zi#c#Zi~P!KlOZ#dO!a#TO#a#TO#b#TO#c#TO~P!KlOQ#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO'fQO_#Zi!R#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O'w#Zi~P!NdO'w!}O~P!NdOQ#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO'fQO'w!}O_#Zi!R#Zi#i#Zi#j#Zi'W#Zi'p#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O'x#Zi~P##OO'x#OO~P##OOQ#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO#i#YO'fQO'w!}O'x#OO~O_#Zi!R#Zi#j#Zi'W#Zi'p#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~P#%jOQ[XZ[Xj[Xu[Xv[Xx[X!a[X!b[X!d[X!j[X!{[X#WdX#[[X#][X#^[X#_[X#`[X#a[X#b[X#c[X#e[X#g[X#i[X#j[X#o[X'f[X'p[X'w[X'x[X!R[X!S[X~O#m[X~P#'}OQ#^OZ9rOj9gOu!{Ov!{Ox!|O!a9iO!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO#`9hO#a9iO#b9iO#c9iO#e9jO#g9lO#i9nO#j9oO'fQO'p#[O'w!}O'x#OO~O#m,hO~P#*XOQ'iXZ'iXj'iXu'iXv'iXx'iX!a'iX!b'iX!d'iX!j'iX#['iX#]'iX#^'iX#_'iX#`'iX#a'iX#b'iX#e'iX#g'iX#i'iX#j'iX'f'iX'p'iX'w'iX'x'iX!R'iX~O!{9sO#o9sO#c'iX#m'iX!S'iX~P#,SO_&sa!R&sa'W&sa!c&san&sa!O&sa!T&sa%Q&sa!]&sa~P!)wOQ#ZiZ#Zi_#Zij#Ziv#Zi!R#Zi!a#Zi!b#Zi!d#Zi!j#Zi#[#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'f#Zi'p#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~P!BpO_#ni!R#ni'W#ni!O#ni!c#nin#ni!T#ni%Q#ni!]#ni~P!)wO#z,jO~O#z,kO~O!]'lO!{,lO!T$OX#w$OX#z$OX$R$OX~O!Q,mO~O!T'oO#w,oO#z'nO$R,pO~O!R9pO!S'hX~P#*XO!S,qO~O$R,sO~OS'}O'U(OO'V,vO~O],yOk,yO!O,zO~O!RdX!]dX!cdX!c$eX'pdX~P!!rO!c-QO~P!BpO!R-RO!]!wO'p&oO!c'}X~O!c-WO~O!Q(`O']$bO!c'}P~O#W-YO~O!O$eX!R$eX!]$lX~P!!rO!R-ZO!O(OX~P!BpO!]-]O~O!O-_O~Oj-cO!]!wO!d$ZO'b$PO'p&oO~O!])aO~O_$^O!R-hO'W$^O~O!S-jO~P!&jO!X-kO!Y-kO'^$dO'g(jO~Ox-mO'g(jO~O!x-nO~O']${O!R&xX'a&xX~O!R(yO'a'ca~O'a-sO~Ou-tOv-tOx-uOPra'wra'xra!Rra!{ra~O'ara#mra~P#7pOu(SOx(TOP$^a'w$^a'x$^a!R$^a!{$^a~O'a$^a#m$^a~P#8fOu(SOx(TOP$`a'w$`a'x$`a!R$`a!{$`a~O'a$`a#m$`a~P#9XO]-vO~O#W-wO~O'a$na!R$na!{$na#m$na~P!#{O#W-zO~OP.TO!T&dO!o.SO%Q.RO~O]#qOj#rOk#qOl#qOq$ROs9tOx#yO!T#zO!_;eO!d#vO#V9}O#t$VO$_9wO$a9zO$d$WO'b$PO'f#sO~Oh.VO'].UO~P#:yO!])aO!T'`a_'`a!R'`a'W'`a~O#W.]O~OZ[X!RdX!SdX~O!R.^O!S(VX~O!S.`O~OZ.aO~O].cO'])iO~O!T$lO']$bO^'QX!R'QX~O!R)nO^(Ua~O!c.fO~P!)wO].hO~OZ.iO~O^.jO~OP.TO!T&dO!o.SO%Q.RO'b$PO~O!R)zO_(Ra'W(Ra~O!{.pO~OP.sO!T#zO~O'g'TO!S(SP~OP.}O!T.yO!o.|O%Q.{O'b$PO~OZ/XO!R/VO!S(TX~O!S/YO~O^/[O_$^O'W$^O~O]/]O~O]/^O'](|O~O#c/_O%r/`O~P0zO!{#eO#c/_O%r/`O~O_/aO~P){O_/cO~O%{/gOQ%yiR%yiX%yi]%yi_%yib%yic%yih%yij%yik%yil%yiq%yis%yix%yi{%yi|%yi}%yi!T%yi!_%yi!d%yi!g%yi!h%yi!i%yi!j%yi!k%yi!n%yi#d%yi#t%yi#x%yi%P%yi%R%yi%T%yi%U%yi%X%yi%Z%yi%^%yi%_%yi%a%yi%n%yi%t%yi%v%yi%x%yi%z%yi%}%yi&T%yi&Z%yi&]%yi&_%yi&a%yi&c%yi'S%yi']%yi'f%yi'o%yi'|%yi!S%yi`%yi&Q%yi~O`/mO!S/kO&Q/lO~P`O!TSO!d/oO~O&X*wOQ&SiR&SiX&Si]&Si_&Sib&Sic&Sih&Sij&Sik&Sil&Siq&Sis&Six&Si{&Si|&Si}&Si!T&Si!_&Si!d&Si!g&Si!h&Si!i&Si!j&Si!k&Si!n&Si#d&Si#t&Si#x&Si%P&Si%R&Si%T&Si%U&Si%X&Si%Z&Si%^&Si%_&Si%a&Si%n&Si%t&Si%v&Si%x&Si%z&Si%}&Si&T&Si&Z&Si&]&Si&_&Si&a&Si&c&Si'S&Si']&Si'f&Si'o&Si'|&Si!S&Si%{&Si`&Si&Q&Si~O!R#bOn$]a~O!O&ii!R&ii~P!)wO!R%zO!O'ji~O!R&`O!O'ti~O!O/uO~O!R!Va!S!Va~P#*XO]&ROk&RO!Q/{O'g(jO!R&jX!S&jX~P@dO!R+`O!S'ka~O]&ZOk&ZO!Q)yO'g'TO!R&oX!S&oX~O!R+cO!S'va~O!O'ui!R'ui~P!)wO_$^O!]!wO!d$ZO!j0VO!{0TO'W$^O'b$PO'p&oO~O!S0YO~P!?iO!X0ZO!Y0ZO'^$dO'g(jO'o+iO~O!W0[O~P#MSO!TSO!W0[O!u0^O!x0_O~P#MSO!W0[O!s0aO!t0aO!u0^O!x0_O~P#MSO!T&dO~O!T&dO~P!BpO!R'ri!c'ri_'ri'W'ri~P!)wO!{0jO!R'ri!c'ri_'ri'W'ri~O!R&tO!c'qi~Ox$uO!T$vO#V0lO']$bO~O#WraQraZra_rajra!ara!bra!dra!jra#[ra#]ra#^ra#_ra#`ra#ara#bra#cra#era#gra#ira#jra'Wra'fra'pra!cra!Ora!Tranra%Qra!]ra~P#7pO#W$^aQ$^aZ$^a_$^aj$^av$^a!a$^a!b$^a!d$^a!j$^a#[$^a#]$^a#^$^a#_$^a#`$^a#a$^a#b$^a#c$^a#e$^a#g$^a#i$^a#j$^a'W$^a'f$^a'p$^a!c$^a!O$^a!T$^an$^a%Q$^a!]$^a~P#8fO#W$`aQ$`aZ$`a_$`aj$`av$`a!a$`a!b$`a!d$`a!j$`a#[$`a#]$`a#^$`a#_$`a#`$`a#a$`a#b$`a#c$`a#e$`a#g$`a#i$`a#j$`a'W$`a'f$`a'p$`a!c$`a!O$`a!T$`an$`a%Q$`a!]$`a~P#9XO#W$naQ$naZ$na_$naj$nav$na!R$na!a$na!b$na!d$na!j$na#[$na#]$na#^$na#_$na#`$na#a$na#b$na#c$na#e$na#g$na#i$na#j$na'W$na'f$na'p$na!c$na!O$na!T$na!{$nan$na%Q$na!]$na~P!BpO_#Oq!R#Oq'W#Oq!O#Oq!c#Oqn#Oq!T#Oq%Q#Oq!]#Oq~P!)wO!R&kX'a&kX~PJjO!R,_O'a'ma~O!Q0tO!R&lX!c&lX~P){O!R,bO!c'na~O!R,bO!c'na~P!)wO#m!fa!S!fa~PCfO#m!^a!R!^a!S!^a~P#*XO!T1XO#x^O$P1YO~O!S1^O~On1_O~P!BpO_$Yq!R$Yq'W$Yq!O$Yq!c$Yqn$Yq!T$Yq%Q$Yq!]$Yq~P!)wO!O1`O~O],yOk,yO~Ou(SOx(TO'x(XOP$xi'w$xi!R$xi!{$xi~O'a$xi#m$xi~P$.POu(SOx(TOP$zi'w$zi'x$zi!R$zi!{$zi~O'a$zi#m$zi~P$.rO'p#[O~P!BpO!Q1cO']$bO!R&tX!c&tX~O!R-RO!c'}a~O!R-RO!]!wO!c'}a~O!R-RO!]!wO'p&oO!c'}a~O'a$gi!R$gi!{$gi#m$gi~P!#{O!Q1kO'](eO!O&vX!R&vX~P!$jO!R-ZO!O(Oa~O!R-ZO!O(Oa~P!BpO!]!wO~O!]!wO#c1sO~Oj1vO!]!wO'p&oO~O!R'di'a'di~P!#{O!{1yO!R'di'a'di~P!#{O!c1|O~O_$Zq!R$Zq'W$Zq!O$Zq!c$Zqn$Zq!T$Zq%Q$Zq!]$Zq~P!)wO!R2QO!T(PX~P!BpO!T&dO%Q2TO~O!T&dO%Q2TO~P!BpO!T$eX$u[X_$eX!R$eX'W$eX~P!!rO$u2XOPgXugXxgX!TgX'wgX'xgX_gX!RgX'WgX~O$u2XO~O]2_O%R2`O'])iO!R'PX!S'PX~O!R.^O!S(Va~OZ2dO~O^2eO~O]2hO~OP2jO!T&dO!o2iO%Q2TO~O_$^O'W$^O~P!BpO!T#zO~P!BpO!R2oO!{2qO!S(SX~O!S2rO~Ox;oO!W2{O!X2tO!Y2tO!r2zO!s2yO!t2yO!x2xO'^$dO'g(jO'o+iO~O!S2wO~P$7ZOP3SO!T.yO!o3RO%Q3QO~OP3SO!T.yO!o3RO%Q3QO'b$PO~O'](|O!R'OX!S'OX~O!R/VO!S(Ta~O]3^O'g3]O~O]3_O~O^3aO~O!c3dO~P){O_3fO~O_3fO~P){O#c3hO%r3iO~PFOO`/mO!S3mO&Q/lO~P`O!]3oO~O!R#Ti!S#Ti~P#*XO!{3qO!R#Ti!S#Ti~O!R!Vi!S!Vi~P#*XO_$^O!{3xO'W$^O~O_$^O!]!wO!{3xO'W$^O~O!X3|O!Y3|O'^$dO'g(jO'o+iO~O_$^O!]!wO!d$ZO!j3}O!{3xO'W$^O'b$PO'p&oO~O!W4OO~P$;xO!W4OO!u4RO!x4SO~P$;xO_$^O!]!wO!j3}O!{3xO'W$^O'p&oO~O!R'rq!c'rq_'rq'W'rq~P!)wO!R&tO!c'qq~O#W$xiQ$xiZ$xi_$xij$xiv$xi!a$xi!b$xi!d$xi!j$xi#[$xi#]$xi#^$xi#_$xi#`$xi#a$xi#b$xi#c$xi#e$xi#g$xi#i$xi#j$xi'W$xi'f$xi'p$xi!c$xi!O$xi!T$xin$xi%Q$xi!]$xi~P$.PO#W$ziQ$ziZ$zi_$zij$ziv$zi!a$zi!b$zi!d$zi!j$zi#[$zi#]$zi#^$zi#_$zi#`$zi#a$zi#b$zi#c$zi#e$zi#g$zi#i$zi#j$zi'W$zi'f$zi'p$zi!c$zi!O$zi!T$zin$zi%Q$zi!]$zi~P$.rO#W$giQ$giZ$gi_$gij$giv$gi!R$gi!a$gi!b$gi!d$gi!j$gi#[$gi#]$gi#^$gi#_$gi#`$gi#a$gi#b$gi#c$gi#e$gi#g$gi#i$gi#j$gi'W$gi'f$gi'p$gi!c$gi!O$gi!T$gi!{$gin$gi%Q$gi!]$gi~P!BpO!R&ka'a&ka~P!#{O!R&la!c&la~P!)wO!R,bO!c'ni~O#m#Oi!R#Oi!S#Oi~P#*XOQ#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O'fQOZ#Zij#Zi!a#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~O#[#Zi~P$EiO#[9eO~P$EiOQ#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO'fQOZ#Zi!a#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~Oj#Zi~P$GqOj9gO~P$GqOQ#^Oj9gOu!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO#`9hO'fQO#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~OZ#Zi!a#Zi#a#Zi#b#Zi#c#Zi~P$IyOZ9rO!a9iO#a9iO#b9iO#c9iO~P$IyOQ#^OZ9rOj9gOu!{Ov!{Ox!|O!a9iO!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO#`9hO#a9iO#b9iO#c9iO#e9jO'fQO#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'x#Zi!R#Zi!S#Zi~O'w#Zi~P$L_O'w!}O~P$L_OQ#^OZ9rOj9gOu!{Ov!{Ox!|O!a9iO!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO#`9hO#a9iO#b9iO#c9iO#e9jO#g9lO'fQO'w!}O#i#Zi#j#Zi#m#Zi'p#Zi!R#Zi!S#Zi~O'x#Zi~P$NgO'x#OO~P$NgOQ#^OZ9rOj9gOu!{Ov!{Ox!|O!a9iO!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO#`9hO#a9iO#b9iO#c9iO#e9jO#g9lO#i9nO'fQO'w!}O'x#OO~O#j#Zi#m#Zi'p#Zi!R#Zi!S#Zi~P%!oO_#ky!R#ky'W#ky!O#ky!c#kyn#ky!T#ky%Q#ky!]#ky~P!)wOP;vOu(SOx(TO'w(VO'x(XO~OQ#ZiZ#Zij#Ziv#Zi!a#Zi!b#Zi!d#Zi!j#Zi#[#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'f#Zi'p#Zi!R#Zi!S#Zi~P%%aO!b!yOP'eXu'eXx'eX'w'eX'x'eX!S'eX~OQ'eXZ'eXj'eXv'eX!a'eX!d'eX!j'eX#['eX#]'eX#^'eX#_'eX#`'eX#a'eX#b'eX#c'eX#e'eX#g'eX#i'eX#j'eX#m'eX'f'eX'p'eX!R'eX~P%'eO#m#ni!R#ni!S#ni~P#*XO!S4eO~O!R&sa!S&sa~P#*XO!]!wO'p&oO!R&ta!c&ta~O!R-RO!c'}i~O!R-RO!]!wO!c'}i~O'a$gq!R$gq!{$gq#m$gq~P!#{O!O&va!R&va~P!BpO!]4lO~O!R-ZO!O(Oi~P!BpO!R-ZO!O(Oi~O!O4pO~O!]!wO#c4uO~Oj4vO!]!wO'p&oO~O!O4xO~O'a$iq!R$iq!{$iq#m$iq~P!#{O_$Zy!R$Zy'W$Zy!O$Zy!c$Zyn$Zy!T$Zy%Q$Zy!]$Zy~P!)wO!R2QO!T(Pa~O!T&dO%Q4}O~O!T&dO%Q4}O~P!BpO_#Oy!R#Oy'W#Oy!O#Oy!c#Oyn#Oy!T#Oy%Q#Oy!]#Oy~P!)wOZ5QO~O]5SO'])iO~O!R.^O!S(Vi~O]5VO~O^5WO~O'g'TO!R&{X!S&{X~O!R2oO!S(Sa~O!S5eO~P$7ZOx;sO'g(jO'o+iO~O!W5hO!X5gO!Y5gO!x0_O'^$dO'g(jO'o+iO~O!s5iO!t5iO~P%0^O!X5gO!Y5gO'^$dO'g(jO'o+iO~O!T.yO~O!T.yO%Q5kO~O!T.yO%Q5kO~P!BpOP5pO!T.yO!o5oO%Q5kO~OZ5uO!R'Oa!S'Oa~O!R/VO!S(Ti~O]5xO~O!c5yO~O!c5zO~O!c5{O~O!c5{O~P){O_5}O~O!]6QO~O!c6RO~O!R'ui!S'ui~P#*XO_$^O'W$^O~P!)wO_$^O!{6WO'W$^O~O_$^O!]!wO!{6WO'W$^O~O!X6]O!Y6]O'^$dO'g(jO'o+iO~O_$^O!]!wO!j6^O!{6WO'W$^O'p&oO~O!d$ZO'b$PO~P%4xO!W6_O~P%4gO!R'ry!c'ry_'ry'W'ry~P!)wO#W$gqQ$gqZ$gq_$gqj$gqv$gq!R$gq!a$gq!b$gq!d$gq!j$gq#[$gq#]$gq#^$gq#_$gq#`$gq#a$gq#b$gq#c$gq#e$gq#g$gq#i$gq#j$gq'W$gq'f$gq'p$gq!c$gq!O$gq!T$gq!{$gqn$gq%Q$gq!]$gq~P!BpO#W$iqQ$iqZ$iq_$iqj$iqv$iq!R$iq!a$iq!b$iq!d$iq!j$iq#[$iq#]$iq#^$iq#_$iq#`$iq#a$iq#b$iq#c$iq#e$iq#g$iq#i$iq#j$iq'W$iq'f$iq'p$iq!c$iq!O$iq!T$iq!{$iqn$iq%Q$iq!]$iq~P!BpO!R&li!c&li~P!)wO#m#Oq!R#Oq!S#Oq~P#*XOu-tOv-tOx-uOPra'wra'xra!Sra~OQraZrajra!ara!bra!dra!jra#[ra#]ra#^ra#_ra#`ra#ara#bra#cra#era#gra#ira#jra#mra'fra'pra!Rra~P%;OOu(SOx(TOP$^a'w$^a'x$^a!S$^a~OQ$^aZ$^aj$^av$^a!a$^a!b$^a!d$^a!j$^a#[$^a#]$^a#^$^a#_$^a#`$^a#a$^a#b$^a#c$^a#e$^a#g$^a#i$^a#j$^a#m$^a'f$^a'p$^a!R$^a~P%=SOu(SOx(TOP$`a'w$`a'x$`a!S$`a~OQ$`aZ$`aj$`av$`a!a$`a!b$`a!d$`a!j$`a#[$`a#]$`a#^$`a#_$`a#`$`a#a$`a#b$`a#c$`a#e$`a#g$`a#i$`a#j$`a#m$`a'f$`a'p$`a!R$`a~P%?WOQ$naZ$naj$nav$na!a$na!b$na!d$na!j$na#[$na#]$na#^$na#_$na#`$na#a$na#b$na#c$na#e$na#g$na#i$na#j$na#m$na'f$na'p$na!R$na!S$na~P%%aO#m$Yq!R$Yq!S$Yq~P#*XO#m$Zq!R$Zq!S$Zq~P#*XO!S6hO~O#m6iO~P!#{O!]!wO!R&ti!c&ti~O!]!wO'p&oO!R&ti!c&ti~O!R-RO!c'}q~O!O&vi!R&vi~P!BpO!R-ZO!O(Oq~O!O6oO~P!BpO!O6oO~O!R'dy'a'dy~P!#{O!R&ya!T&ya~P!BpO!T$tq_$tq!R$tq'W$tq~P!BpOZ6vO~O!R.^O!S(Vq~O]6yO~O!T&dO%Q6zO~O!T&dO%Q6zO~P!BpO!{6{O!R&{a!S&{a~O!R2oO!S(Si~P#*XO!X7RO!Y7RO'^$dO'g(jO'o+iO~O!W7TO!x4SO~P%GXO!T.yO%Q7WO~O!T.yO%Q7WO~P!BpO]7_O'g7^O~O!R/VO!S(Tq~O!c7aO~O!c7aO~P){O!c7cO~O!c7dO~O!R#Ty!S#Ty~P#*XO_$^O!{7jO'W$^O~O_$^O!]!wO!{7jO'W$^O~O!X7mO!Y7mO'^$dO'g(jO'o+iO~O_$^O!]!wO!j7nO!{7jO'W$^O'p&oO~O#m#ky!R#ky!S#ky~P#*XOQ$giZ$gij$giv$gi!a$gi!b$gi!d$gi!j$gi#[$gi#]$gi#^$gi#_$gi#`$gi#a$gi#b$gi#c$gi#e$gi#g$gi#i$gi#j$gi#m$gi'f$gi'p$gi!R$gi!S$gi~P%%aOu(SOx(TO'x(XOP$xi'w$xi!S$xi~OQ$xiZ$xij$xiv$xi!a$xi!b$xi!d$xi!j$xi#[$xi#]$xi#^$xi#_$xi#`$xi#a$xi#b$xi#c$xi#e$xi#g$xi#i$xi#j$xi#m$xi'f$xi'p$xi!R$xi~P%LjOu(SOx(TOP$zi'w$zi'x$zi!S$zi~OQ$ziZ$zij$ziv$zi!a$zi!b$zi!d$zi!j$zi#[$zi#]$zi#^$zi#_$zi#`$zi#a$zi#b$zi#c$zi#e$zi#g$zi#i$zi#j$zi#m$zi'f$zi'p$zi!R$zi~P%NnO#m$Zy!R$Zy!S$Zy~P#*XO#m#Oy!R#Oy!S#Oy~P#*XO!]!wO!R&tq!c&tq~O!R-RO!c'}y~O!O&vq!R&vq~P!BpO!O7tO~P!BpO!R.^O!S(Vy~O!R2oO!S(Sq~O!X8QO!Y8QO'^$dO'g(jO'o+iO~O!T.yO%Q8TO~O!T.yO%Q8TO~P!BpO!c8WO~O_$^O!{8]O'W$^O~O_$^O!]!wO!{8]O'W$^O~OQ$gqZ$gqj$gqv$gq!a$gq!b$gq!d$gq!j$gq#[$gq#]$gq#^$gq#_$gq#`$gq#a$gq#b$gq#c$gq#e$gq#g$gq#i$gq#j$gq#m$gq'f$gq'p$gq!R$gq!S$gq~P%%aOQ$iqZ$iqj$iqv$iq!a$iq!b$iq!d$iq!j$iq#[$iq#]$iq#^$iq#_$iq#`$iq#a$iq#b$iq#c$iq#e$iq#g$iq#i$iq#j$iq#m$iq'f$iq'p$iq!R$iq!S$iq~P%%aO'a$|!Z!R$|!Z!{$|!Z#m$|!Z~P!#{O!R&{q!S&{q~P#*XO_$^O!{8oO'W$^O~O#W$|!ZQ$|!ZZ$|!Z_$|!Zj$|!Zv$|!Z!R$|!Z!a$|!Z!b$|!Z!d$|!Z!j$|!Z#[$|!Z#]$|!Z#^$|!Z#_$|!Z#`$|!Z#a$|!Z#b$|!Z#c$|!Z#e$|!Z#g$|!Z#i$|!Z#j$|!Z'W$|!Z'f$|!Z'p$|!Z!c$|!Z!O$|!Z!T$|!Z!{$|!Zn$|!Z%Q$|!Z!]$|!Z~P!BpOP;uOu(SOx(TO'w(VO'x(XO~O!S!za!W!za!X!za!Y!za!r!za!s!za!t!za!x!za'^!za'g!za'o!za~P&,_O!W'eX!X'eX!Y'eX!r'eX!s'eX!t'eX!x'eX'^'eX'g'eX'o'eX~P%'eOQ$|!ZZ$|!Zj$|!Zv$|!Z!a$|!Z!b$|!Z!d$|!Z!j$|!Z#[$|!Z#]$|!Z#^$|!Z#_$|!Z#`$|!Z#a$|!Z#b$|!Z#c$|!Z#e$|!Z#g$|!Z#i$|!Z#j$|!Z#m$|!Z'f$|!Z'p$|!Z!R$|!Z!S$|!Z~P%%aO!Wra!Xra!Yra!rra!sra!tra!xra'^ra'gra'ora~P%;OO!W$^a!X$^a!Y$^a!r$^a!s$^a!t$^a!x$^a'^$^a'g$^a'o$^a~P%=SO!W$`a!X$`a!Y$`a!r$`a!s$`a!t$`a!x$`a'^$`a'g$`a'o$`a~P%?WO!S$na!W$na!X$na!Y$na!r$na!s$na!t$na!x$na'^$na'g$na'o$na~P&,_O!W$xi!X$xi!Y$xi!r$xi!s$xi!t$xi!x$xi'^$xi'g$xi'o$xi~P%LjO!W$zi!X$zi!Y$zi!r$zi!s$zi!t$zi!x$zi'^$zi'g$zi'o$zi~P%NnO!S$gi!W$gi!X$gi!Y$gi!r$gi!s$gi!t$gi!x$gi'^$gi'g$gi'o$gi~P&,_O!S$gq!W$gq!X$gq!Y$gq!r$gq!s$gq!t$gq!x$gq'^$gq'g$gq'o$gq~P&,_O!S$iq!W$iq!X$iq!Y$iq!r$iq!s$iq!t$iq!x$iq'^$iq'g$iq'o$iq~P&,_O!S$|!Z!W$|!Z!X$|!Z!Y$|!Z!r$|!Z!s$|!Z!t$|!Z!x$|!Z'^$|!Z'g$|!Z'o$|!Z~P&,_On'hX~P.jOn[X!O[X!c[X%r[X!T[X%Q[X!][X~P$zO!]dX!c[X!cdX'pdX~P;dOQ9^OR9^O]cOb;`Oc!jOhcOj9^OkcOlcOq9^Os9^OxRO{cO|cO}cO!TSO!_9`O!dUO!g9^O!h9^O!i9^O!j9^O!k9^O!n!iO#t!lO#x^O']'cO'fQO'oYO'|;^O~O]#qOh$QOj#rOk#qOl#qOq$ROs9uOx#yO!T#zO!_;fO!d#vO#V:OO#t$VO$_9xO$a9{O$d$WO']&{O'b$PO'f#sO~O!R9pO!S$]a~O]#qOh$QOj#rOk#qOl#qOq$ROs9vOx#yO!T#zO!_;gO!d#vO#V:PO#t$VO$_9yO$a9|O$d$WO']&{O'b$PO'f#sO~O#d'jO~P&]P!AQ!AY!A^!A^P!>YP!Ab!AbP!DVP!DZ?Z?Z!Da!GT8SP8SP8S8SP!HW8S8S!Jf8S!M_8S# g8S8S#!T#$c#$c#$g#$c#$oP#$cP8S#%k8S#'X8S8S-zPPP#(yPP#)c#)cP#)cP#)x#)cPP#*OP#)uP#)u#*b!!X#)u#+P#+V#+Y([#+]([P#+d#+d#+dP([P([P([P([PP([P#+j#+mP#+m([P#+qP#+tP([P([P([P([P([P([([#+z#,U#,[#,b#,p#,v#,|#-W#-^#-m#-s#.R#.X#._#.m#/S#0z#1Y#1`#1f#1l#1r#1|#2S#2Y#2d#2v#2|PPPPPPPP#3SPP#3v#7OPP#8f#8m#8uPP#>a#@t#Fp#Fs#Fv#GR#GUPP#GX#G]#Gz#Hq#Hu#IZPP#I_#Ie#IiP#Il#Ip#Is#Jc#Jy#KO#KR#KU#K[#K_#Kc#KgmhOSj}!n$]%c%f%g%i*o*t/g/jQ$imQ$ppQ%ZyS&V!b+`Q&k!jS(l#z(qQ)g$jQ)t$rQ*`%TQ+f&^S+k&d+mQ+}&lQ-k(sQ/U*aY0Z+o+p+q+r+sS2t.y2vU3|0[0^0aU5g2y2z2{S6]4O4RS7R5h5iQ7m6_R8Q7T$p[ORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8o!j'e#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aQ(}$SQ)l$lQ*b%WQ*i%`Q,X9tQ.W)aQ.c)mQ/^*gQ2_.^Q3Z/VQ4^9vQ5S2`R8{9upeOSjy}!n$]%Y%c%f%g%i*o*t/g/jR*d%[&WVOSTjkn}!S!W!k!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k$]$n%[%_%`%c%e%f%g%i%m%z&S&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;`;a[!cRU!]!`%x&WQ$clQ$hmS$mp$rv$wrs!r!u$Z$u&`&t&w)x)y)z*m+Y+h,S,U/o0lQ%PwQ&h!iQ&j!jS(_#v(cS)f$i$jQ)j$lQ)w$tQ*Z%RQ*_%TS+|&k&lQ-V(`Q.[)gQ.b)mQ.d)nQ.g)rQ/P*[S/T*`*aQ0h+}Q1b-RQ2^.^Q2b.aQ2g.iQ3Y/UQ4i1cQ5R2`Q5U2dQ6u5QR7w6vx#xa!y$T$U$Y(W(Y(b(w(x,_-Y-w1a1y6i;^;i;j;k!Y$fm!j$h$i$j&U&j&k&l(k)f)g+]+j+|+}-d.[0Q0W0]0h1u3{4Q6Z7k8^Q)`$cQ*P$|Q*S$}Q*^%TQ.k)wQ/O*ZU/S*_*`*aQ3T/PS3X/T/UQ5b2sQ5t3YS7P5c5fS8O7Q7SQ8f8PQ8u8g#[;b!w#d#v#y&g'}(Z(h)])_)a*O*R+y-Z-].R.T.p.s.{.}1k1s2Q2T2X2j3Q3S4l4u4}5k5p6z7W8T9w9z9}:U:X:[:a:d:j;l;n;t;u;vd;c9d9x9{:O:V:Y:]:b:e:ke;d9r9y9|:P:W:Z:^:c:f:lW#}a$P(y;^S$|t%YQ$}uQ%OvR)}$z%P#|a!w!y#d#v#y$T$U$Y&g'}(W(Y(Z(b(h(w(x)])_)a*O*R+y,_-Y-Z-]-w.R.T.p.s.{.}1a1k1s1y2Q2T2X2j3Q3S4l4u4}5k5p6i6z7W8T9d9r9w9x9y9z9{9|9}:O:P:U:V:W:X:Y:Z:[:]:^:a:b:c:d:e:f:j:k:l;^;i;j;k;l;n;t;u;vT(O#s(PX)O$S9t9u9vU&Z!b$v+cQ'U!{Q)q$oQ.t*TQ1z-tR5^2o&^cORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;a$]#aZ!_!o$a%w%}&y'Q'W'X'Y'Z'[']'^'_'`'a'b'd'g'k'u)p+R+^+g,O,^,d,g,i,w-x/v/y0i0s0w0x0y0z0{0|0}1O1P1Q1R1S1T1W1]2O2[3s3v4W4[4]4b4c5`6S6V6b6f6g7g7z8Z8m8y9_:|T!XQ!Y&_cORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aQ&X!bR/|+`Y&R!b&V&^+`+fS(k#z(qS+j&d+mS-d(l(sQ-e(mQ-l(tQ.v*VU0W+k+o+pU0]+q+r+sS0b+t2xQ1u-kQ1w-mQ1x-nS2s.y2vU3{0Z0[0^Q4P0_Q4Q0aS5c2t2{S5f2y2zU6Z3|4O4RQ6`4SS7Q5g5hQ7S5iS7k6]6_S8P7R7TQ8^7mQ8g8QQ;h;oR;m;slhOSj}!n$]%c%f%g%i*o*t/g/jQ%k!QS&x!v9cQ)d$gQ*X%PQ*Y%QQ+z&iS,]&}:RS-y)V:_Q.Y)eQ.x*WQ/n*vQ/p*wQ/x+ZQ0`+qQ0f+{S2P-z:gQ2Y.ZS2].]:hQ3r/zQ3u0RQ4U0gQ5P2ZQ6T3tQ6X3zQ6a4VQ7e6RQ7h6YQ8Y7iQ8l8[R8x8n$W#`Z!_!o%w%}&y'Q'W'X'Y'Z'[']'^'_'`'a'b'd'g'k'u)p+R+^+g,O,^,d,g,w-x/v/y0i0s0w0x0y0z0{0|0}1O1P1Q1R1S1T1W1]2O2[3s3v4W4[4]4b4c5`6S6V6b6f6g7g7z8Z8m8y9_:|W(v#{&|1V8qT)Z$a,i$W#_Z!_!o%w%}&y'Q'W'X'Y'Z'[']'^'_'`'a'b'd'g'k'u)p+R+^+g,O,^,d,g,w-x/v/y0i0s0w0x0y0z0{0|0}1O1P1Q1R1S1T1W1]2O2[3s3v4W4[4]4b4c5`6S6V6b6f6g7g7z8Z8m8y9_:|Q'f#`S)Y$a,iR-{)Z&^cORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aQ%f{Q%g|Q%i!OQ%j!PR/f*rQ&e!iQ)[$cQ+w&hS.Q)`)wS0c+u+vW2S-}.O.P.kS4T0d0eU4|2U2V2WU6s4{5Y5ZQ7v6tR8b7yT+l&d+mS+j&d+mU0W+k+o+pU0]+q+r+sS0b+t2xS2s.y2vU3{0Z0[0^Q4P0_Q4Q0aS5c2t2{S5f2y2zU6Z3|4O4RQ6`4SS7Q5g5hQ7S5iS7k6]6_S8P7R7TQ8^7mR8g8QS+l&d+mT2u.y2vS&r!q/dQ-U(_Q-b(kS0V+j2sQ1g-VS1p-c-lU3}0]0b5fQ4h1bS4s1v1xU6^4P4Q7SQ6k4iQ6r4vR7n6`Q!xXS&q!q/dQ)W$[Q)b$eQ)h$kQ,Q&rQ-T(_Q-a(kQ-f(nQ.X)cQ/Q*]S0U+j2sS1f-U-VS1o-b-lQ1r-eQ1t-gQ3V/RW3y0V0]0b5fQ4g1bQ4k1gS4o1p1xQ4t1wQ5r3WW6[3}4P4Q7SS6j4h4iS6n4p:iQ6p4sQ6}5aQ7[5sS7l6^6`Q7r6kS7s6o:mQ7u6rQ7|7OQ8V7]Q8_7nS8a7t:nQ8d7}Q8s8eQ9Q8tQ9X9RQ:u:pQ;T:zQ;U:{Q;V;hR;[;m$rWORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%`%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8oS!xn!k!j:o#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aR:u;`$rXORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%`%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8oQ$[b!Y$em!j$h$i$j&U&j&k&l(k)f)g+]+j+|+}-d.[0Q0W0]0h1u3{4Q6Z7k8^S$kn!kQ)c$fQ*]%TW/R*^*_*`*aU3W/S/T/UQ5a2sS5s3X3YU7O5b5c5fQ7]5tU7}7P7Q7SS8e8O8PS8t8f8gQ9R8u!j:p#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aQ:z;_R:{;`$f]OSTjk}!S!W!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%c%e%f%g%i%m%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8oY!hRU!]!`%xv$wrs!r!u$Z$u&`&t&w)x)y)z*m+Y+h,S,U/o0lQ*j%`!h:q#]#k'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aR:t&WS&[!b$vR0O+c$p[ORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8o!j'e#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aR*i%`$roORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%`%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8oQ'U!{!k:r#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;a!h#VZ!_$a%w%}&y'Q'_'`'a'b'g'k)p+R+g,O,^,d,w-x0i0s1T2O2[3v4W4[6V7g8Z8m8y9_!R9k'd'u+^,i/v/y0w1P1Q1R1S1W1]3s4]4b4c5`6S6b6f6g7z:|!d#XZ!_$a%w%}&y'Q'a'b'g'k)p+R+g,O,^,d,w-x0i0s1T2O2[3v4W4[6V7g8Z8m8y9_}9m'd'u+^,i/v/y0w1R1S1W1]3s4]4b4c5`6S6b6f6g7z:|!`#]Z!_$a%w%}&y'Q'g'k)p+R+g,O,^,d,w-x0i0s1T2O2[3v4W4[6V7g8Z8m8y9_Q1a-Px;a'd'u+^,i/v/y0w1W1]3s4]4b4c5`6S6b6f6g7z:|Q;i;pQ;j;qR;k;r&^cORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aS#l`#mR1Y,l&e_ORSTU`jk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k#m$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,l,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aS#g^#nT'n#i'rT#h^#nT'p#i'r&e`ORSTU`jk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k#m$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,l,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aT#l`#mQ#o`R'y#m$rbORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%`%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8o!k;_#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;a#RdOSUj}!S!W!n!|#k$]%[%_%`%c%e%f%g%i%m&S&f'w)^*k*o*t+x,m-u.S.|/_/`/a/c/g/j/l1X2i3R3f3h3i5o5}x#{a!y$T$U$Y(W(Y(b(w(x,_-Y-w1a1y6i;^;i;j;k#[&|!w#d#v#y&g'}(Z(h)])_)a*O*R+y-Z-].R.T.p.s.{.}1k1s2Q2T2X2j3Q3S4l4u4}5k5p6z7W8T9w9z9}:U:X:[:a:d:j;l;n;t;u;vQ)S$WQ,x(Sd1V9r9y9|:P:W:Z:^:c:f:le8q9d9x9{:O:V:Y:]:b:e:kx#wa!y$T$U$Y(W(Y(b(w(x,_-Y-w1a1y6i;^;i;j;kQ(d#xS(n#z(qQ)T$XQ-g(o#[:w!w#d#v#y&g'}(Z(h)])_)a*O*R+y-Z-].R.T.p.s.{.}1k1s2Q2T2X2j3Q3S4l4u4}5k5p6z7W8T9w9z9}:U:X:[:a:d:j;l;n;t;u;vd:x9d9x9{:O:V:Y:]:b:e:kd:y9r9y9|:P:W:Z:^:c:f:lQ:};bQ;O;cQ;P;dQ;Q;eQ;R;fR;S;gx#{a!y$T$U$Y(W(Y(b(w(x,_-Y-w1a1y6i;^;i;j;k#[&|!w#d#v#y&g'}(Z(h)])_)a*O*R+y-Z-].R.T.p.s.{.}1k1s2Q2T2X2j3Q3S4l4u4}5k5p6z7W8T9w9z9}:U:X:[:a:d:j;l;n;t;u;vd1V9r9y9|:P:W:Z:^:c:f:le8q9d9x9{:O:V:Y:]:b:e:klfOSj}!n$]%c%f%g%i*o*t/g/jQ(g#yQ*}%pQ+O%rR1j-Z%O#|a!w!y#d#v#y$T$U$Y&g'}(W(Y(Z(b(h(w(x)])_)a*O*R+y,_-Y-Z-]-w.R.T.p.s.{.}1a1k1s1y2Q2T2X2j3Q3S4l4u4}5k5p6i6z7W8T9d9r9w9x9y9z9{9|9}:O:P:U:V:W:X:Y:Z:[:]:^:a:b:c:d:e:f:j:k:l;^;i;j;k;l;n;t;u;vQ*Q$}Q.r*SQ2m.qR5]2nT(p#z(qS(p#z(qT2u.y2vQ)b$eQ-f(nQ.X)cQ/Q*]Q3V/RQ5r3WQ6}5aQ7[5sQ7|7OQ8V7]Q8d7}Q8s8eQ9Q8tR9X9Rp(W#t'O)U-X-o-p0q1h1}4f4w7q:v;W;X;Y!n:U&z'i(^(f+v,[,t-P-^-|.P.o.q0e0p1i1m2W2l2n3O4Y4Z4m4q4y5O5Z5n6m6q7Y8`;Z;];p;q;r[:V8p9O9V9Y9Z9]]:W1U4a6c7o7p8zr(Y#t'O)U,}-X-o-p0q1h1}4f4w7q:v;W;X;Y!p:X&z'i(^(f+v,[,t-P-^-|.P.o.q0e0n0p1i1m2W2l2n3O4Y4Z4m4q4y5O5Z5n6m6q7Y8`;Z;];p;q;r^:Y8p9O9T9V9Y9Z9]_:Z1U4a6c6d7o7p8zpeOSjy}!n$]%Y%c%f%g%i*o*t/g/jQ%VxR*k%`peOSjy}!n$]%Y%c%f%g%i*o*t/g/jR%VxQ*U%OR.n)}qeOSjy}!n$]%Y%c%f%g%i*o*t/g/jQ.z*ZS3P/O/PW5j2|2}3O3TU7V5l5m5nU8R7U7X7YQ8h8SR8v8iQ%^yR*e%YR3^/XR7_5uS$mp$rR.d)nQ%czR*o%dR*u%jT/h*t/jR*y%kQ*x%kR/q*yQjOQ!nST$`j!nQ(P#sR,u(PQ!YQR%u!YQ!^RU%{!^%|+UQ%|!_R+U%}Q+a&XR/}+aQ,`'OR0r,`Q,c'QS0u,c0vR0v,dQ+m&dR0X+mS!eR$uU&a!e&b+VQ&b!fR+V&OQ+d&[R0P+dQ&u!sQ,R&sU,V&u,R0mR0m,WQ'r#iR,n'rQ#m`R'x#mQ#cZU'h#c+Q9qQ+Q9_R9q'uQ-S(_W1d-S1e4j6lU1e-T-U-VS4j1f1gR6l4k$k(U#t&z'O'i(^(f)P)Q)U+v,Y,Z,[,t,}-O-P-X-^-o-p-|.P.o.q0e0n0o0p0q1U1h1i1m1}2W2l2n3O4Y4Z4_4`4a4f4m4q4w4y5O5Z5n6c6d6e6m6q7Y7o7p7q8`8p8z8|8}9O9T9U9V9Y9Z9]:v;W;X;Y;Z;];p;q;rQ-[(fU1l-[1n4nQ1n-^R4n1mQ(q#zR-i(qQ(z$OR-r(zQ2R-|R4z2RQ){$xR.m){Q2p.tS5_2p6|R6|5`Q*W%PR.w*WQ2v.yR5d2vQ/W*bS3[/W5vR5v3^Q._)jW2a._2c5T6wQ2c.bQ5T2bR6w5UQ)o$mR.e)oQ/j*tR3l/jWiOSj!nQ%h}Q)X$]Q*n%cQ*p%fQ*q%gQ*s%iQ/e*oS/h*t/jR3k/gQ$_gQ%l!RQ%o!TQ%q!UQ%s!VQ)v$sQ)|$yQ*d%^Q*{%nQ-h(pS/Z*e*hQ/r*zQ/s*}Q/t+OS0S+j2sQ2f.hQ2k.oQ3U/QQ3`/]Q3j/fY3w0U0V0]0b5fQ5X2hQ5[2lQ5q3VQ5w3_[6U3v3y3}4P4Q7SQ6x5VQ7Z5rQ7`5xW7f6V6[6^6`Q7x6yQ7{6}Q8U7[U8X7g7l7nQ8c7|Q8j8VS8k8Z8_Q8r8dQ8w8mQ9P8sQ9S8yQ9W9QR9[9XQ$gmQ&i!jU)e$h$i$jQ+Z&UU+{&j&k&lQ-`(kS.Z)f)gQ/z+]Q0R+jS0g+|+}Q1q-dQ2Z.[Q3t0QS3z0W0]Q4V0hQ4r1uS6Y3{4QQ7i6ZQ8[7kR8n8^S#ua;^R({$PU$Oa$P;^R-q(yQ#taS&z!w)aQ'O!yQ'i#dQ(^#vQ(f#yQ)P$TQ)Q$UQ)U$YQ+v&gQ,Y9wQ,Z9zQ,[9}Q,t'}Q,}(WQ-O(YQ-P(ZQ-X(bQ-^(hQ-o(wQ-p(xd-|)].R.{2T3Q4}5k6z7W8TQ.P)_Q.o*OQ.q*RQ0e+yQ0n:UQ0o:XQ0p:[Q0q,_Q1U9rQ1h-YQ1i-ZQ1m-]Q1}-wQ2W.TQ2l.pQ2n.sQ3O.}Q4Y:aQ4Z:dQ4_9yQ4`9|Q4a:PQ4f1aQ4m1kQ4q1sQ4w1yQ4y2QQ5O2XQ5Z2jQ5n3SQ6c:^Q6d:WQ6e:ZQ6m4lQ6q4uQ7Y5pQ7o:cQ7p:fQ7q6iQ8`:jQ8p9dQ8z:lQ8|9xQ8}9{Q9O:OQ9T:VQ9U:YQ9V:]Q9Y:bQ9Z:eQ9]:kQ:v;^Q;W;iQ;X;jQ;Y;kQ;Z;lQ;];nQ;p;tQ;q;uR;r;vlgOSj}!n$]%c%f%g%i*o*t/g/jS!pU%eQ%n!SQ%t!WQ'V!|Q'v#kS*h%[%_Q*l%`Q*z%mQ+W&SQ+u&fQ,r'wQ.O)^Q/b*kQ0d+xQ1[,mQ1{-uQ2V.SQ2}.|Q3b/_Q3c/`Q3e/aQ3g/cQ3n/lQ4d1XQ5Y2iQ5m3RQ5|3fQ6O3hQ6P3iQ7X5oR7b5}!vZOSUj}!S!n!|$]%[%_%`%c%e%f%g%i%m&S&f)^*k*o*t+x-u.S.|/_/`/a/c/g/j/l2i3R3f3h3i5o5}Q!_RQ!oTQ$akS%w!]%zQ%}!`Q&y!vQ'Q!zQ'W#PQ'X#QQ'Y#RQ'Z#SQ'[#TQ']#UQ'^#VQ'_#WQ'`#XQ'a#YQ'b#ZQ'd#]Q'g#bQ'k#eW'u#k'w,m1XQ)p$nS+R%x+TS+^&W/{Q+g&_Q,O&pQ,^&}Q,d'RQ,g9^Q,i9`Q,w(RQ-x)VQ/v+XQ/y+[Q0i,PQ0s,bQ0w9cQ0x9eQ0y9fQ0z9gQ0{9hQ0|9iQ0}9jQ1O9kQ1P9lQ1Q9mQ1R9nQ1S9oQ1T,hQ1W9sQ1]9pQ2O-zQ2[.]Q3s:QQ3v0TQ4W0jQ4[0tQ4]:RQ4b:TQ4c:_Q5`2qQ6S3qQ6V3xQ6b:`Q6f:gQ6g:hQ7g6WQ7z6{Q8Z7jQ8m8]Q8y8oQ9_!WR:|;aR!aRR&Y!bS&U!b+`S+]&V&^R0Q+fR'P!yR'S!zT!tU$ZS!sU$ZU$xrs*mS&s!r!uQ,T&tQ,W&wQ.l)zS0k,S,UR4X0l`!dR!]!`$u%x&`)x+hh!qUrs!r!u$Z&t&w)z,S,U0lQ/d*mQ/w+YQ3p/oT:s&W)yT!gR$uS!fR$uS%y!]&`S&O!`)xS+S%x+hT+_&W)yT&]!b$vQ#i^R'{#nT'q#i'rR1Z,lT(a#v(cR(i#yQ-})]Q2U.RQ2|.{Q4{2TQ5l3QQ6t4}Q7U5kQ7y6zQ8S7WR8i8TlhOSj}!n$]%c%f%g%i*o*t/g/jQ%]yR*d%YV$yrs*mR.u*TR*c%WQ$qpR)u$rR)k$lT%az%dT%bz%dT/i*t/j",nodeNames:"\u26A0 extends ArithOp ArithOp InterpolationStart LineComment BlockComment Script ExportDeclaration export Star as VariableName String from ; default FunctionDeclaration async function VariableDefinition TypeParamList TypeDefinition ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Interpolation null super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression await yield delete LogicOp BitOp ParenthesizedExpression ClassExpression class extends ClassBody MethodDeclaration Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression PrivatePropertyName BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody MethodDeclaration AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement",maxTerm:332,context:Za,nodeProps:[["closedBy",4,"InterpolationEnd",40,"]",51,"}",66,")",132,"JSXSelfCloseEndTag JSXEndTag",146,"JSXEndTag"],["group",-26,8,15,17,58,184,188,191,192,194,197,200,211,213,219,221,223,225,228,234,240,242,244,246,248,250,251,"Statement",-30,12,13,24,27,28,41,43,44,45,47,52,60,68,74,75,91,92,101,103,119,122,124,125,126,127,129,130,148,149,151,"Expression",-22,23,25,29,32,34,152,154,156,157,159,160,161,163,164,165,167,168,169,178,180,182,183,"Type",-3,79,85,90,"ClassItem"],["openedBy",30,"InterpolationStart",46,"[",50,"{",65,"(",131,"JSXStartTag",141,"JSXStartTag JSXStartCloseTag"]],propSources:[qa],skippedNodes:[0,5,6],repeatNodeCount:28,tokenData:"!C}~R!`OX%TXY%cYZ'RZ[%c[]%T]^'R^p%Tpq%cqr'crs(kst0htu2`uv4pvw5ewx6cxyk|}?O}!O>k!O!P?`!P!QCl!Q!R!0[!R![!1q![!]!7s!]!^!8V!^!_!8g!_!`!9d!`!a!:[!a!b!U#R#S2`#S#T!>i#T#o2`#o#p!>y#p#q!?O#q#r!?f#r#s!?x#s$f%T$f$g%c$g#BY2`#BY#BZ!@Y#BZ$IS2`$IS$I_!@Y$I_$I|2`$I|$I}!Bq$I}$JO!Bq$JO$JT2`$JT$JU!@Y$JU$KV2`$KV$KW!@Y$KW&FU2`&FU&FV!@Y&FV?HT2`?HT?HU!@Y?HU~2`W%YR$UWO!^%T!_#o%T#p~%T7Z%jg$UW'Y7ROX%TXY%cYZ%TZ[%c[p%Tpq%cq!^%T!_#o%T#p$f%T$f$g%c$g#BY%T#BY#BZ%c#BZ$IS%T$IS$I_%c$I_$JT%T$JT$JU%c$JU$KV%T$KV$KW%c$KW&FU%T&FU&FV%c&FV?HT%T?HT?HU%c?HU~%T7Z'YR$UW'Z7RO!^%T!_#o%T#p~%T$T'jS$UW!j#{O!^%T!_!`'v!`#o%T#p~%T$O'}S#e#v$UWO!^%T!_!`(Z!`#o%T#p~%T$O(bR#e#v$UWO!^%T!_#o%T#p~%T)X(rZ$UW]#eOY(kYZ)eZr(krs*rs!^(k!^!_+U!_#O(k#O#P-b#P#o(k#o#p+U#p~(k&r)jV$UWOr)ers*Ps!^)e!^!_*a!_#o)e#o#p*a#p~)e&r*WR$P&j$UWO!^%T!_#o%T#p~%T&j*dROr*ars*ms~*a&j*rO$P&j)X*{R$P&j$UW]#eO!^%T!_#o%T#p~%T)P+ZV]#eOY+UYZ*aZr+Urs+ps#O+U#O#P+w#P~+U)P+wO$P&j]#e)P+zROr+Urs,Ts~+U)P,[U$P&j]#eOY,nZr,nrs-Vs#O,n#O#P-[#P~,n#e,sU]#eOY,nZr,nrs-Vs#O,n#O#P-[#P~,n#e-[O]#e#e-_PO~,n)X-gV$UWOr(krs-|s!^(k!^!_+U!_#o(k#o#p+U#p~(k)X.VZ$P&j$UW]#eOY.xYZ%TZr.xrs/rs!^.x!^!_,n!_#O.x#O#P0S#P#o.x#o#p,n#p~.x#m/PZ$UW]#eOY.xYZ%TZr.xrs/rs!^.x!^!_,n!_#O.x#O#P0S#P#o.x#o#p,n#p~.x#m/yR$UW]#eO!^%T!_#o%T#p~%T#m0XT$UWO!^.x!^!_,n!_#o.x#o#p,n#p~.x3]0mZ$UWOt%Ttu1`u!^%T!_!c%T!c!}1`!}#R%T#R#S1`#S#T%T#T#o1`#p$g%T$g~1`3]1g]$UW'o3TOt%Ttu1`u!Q%T!Q![1`![!^%T!_!c%T!c!}1`!}#R%T#R#S1`#S#T%T#T#o1`#p$g%T$g~1`7Z2k_$UW#zS']$y'g3SOt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$g%T$g~2`[3q_$UW#zSOt%Ttu3ju}%T}!O3j!O!Q%T!Q![3j![!^%T!_!c%T!c!}3j!}#R%T#R#S3j#S#T%T#T#o3j#p$g%T$g~3j$O4wS#^#v$UWO!^%T!_!`5T!`#o%T#p~%T$O5[R$UW#o#vO!^%T!_#o%T#p~%T5b5lU'x5Y$UWOv%Tvw6Ow!^%T!_!`5T!`#o%T#p~%T$O6VS$UW#i#vO!^%T!_!`5T!`#o%T#p~%T)X6jZ$UW]#eOY6cYZ7]Zw6cwx*rx!^6c!^!_8T!_#O6c#O#P:T#P#o6c#o#p8T#p~6c&r7bV$UWOw7]wx*Px!^7]!^!_7w!_#o7]#o#p7w#p~7]&j7zROw7wwx*mx~7w)P8YV]#eOY8TYZ7wZw8Twx+px#O8T#O#P8o#P~8T)P8rROw8Twx8{x~8T)P9SU$P&j]#eOY9fZw9fwx-Vx#O9f#O#P9}#P~9f#e9kU]#eOY9fZw9fwx-Vx#O9f#O#P9}#P~9f#e:QPO~9f)X:YV$UWOw6cwx:ox!^6c!^!_8T!_#o6c#o#p8T#p~6c)X:xZ$P&j$UW]#eOY;kYZ%TZw;kwx/rx!^;k!^!_9f!_#O;k#O#PW{!^%T!_!`5T!`#o%T#p~%T$O>_S#[#v$UWO!^%T!_!`5T!`#o%T#p~%T%w>rSj%o$UWO!^%T!_!`5T!`#o%T#p~%T&i?VR!R&a$UWO!^%T!_#o%T#p~%T7Z?gVu5^$UWO!O%T!O!P?|!P!Q%T!Q![@r![!^%T!_#o%T#p~%T!{@RT$UWO!O%T!O!P@b!P!^%T!_#o%T#p~%T!{@iR!Q!s$UWO!^%T!_#o%T#p~%T!{@yZ$UWk!sO!Q%T!Q![@r![!^%T!_!g%T!g!hAl!h#R%T#R#S@r#S#X%T#X#YAl#Y#o%T#p~%T!{AqZ$UWO{%T{|Bd|}%T}!OBd!O!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%T!{BiV$UWO!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%T!{CVV$UWk!sO!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%T7ZCs`$UW#]#vOYDuYZ%TZzDuz{Jl{!PDu!P!Q!-e!Q!^Du!^!_Fx!_!`!.^!`!a!/]!a!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~DuXD|[$UW}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~DuXEy_$UW}PO!^%T!_#Z%T#Z#[Er#[#]%T#]#^Er#^#a%T#a#bEr#b#g%T#g#hEr#h#i%T#i#jEr#j#m%T#m#nEr#n#o%T#p~%TPF}V}POYFxZ!PFx!P!QGd!Q!}Fx!}#OG{#O#PHh#P~FxPGiU}P#Z#[Gd#]#^Gd#a#bGd#g#hGd#i#jGd#m#nGdPHOTOYG{Z#OG{#O#PH_#P#QFx#Q~G{PHbQOYG{Z~G{PHkQOYFxZ~FxXHvY$UWOYHqYZ%TZ!^Hq!^!_G{!_#OHq#O#PIf#P#QDu#Q#oHq#o#pG{#p~HqXIkV$UWOYHqYZ%TZ!^Hq!^!_G{!_#oHq#o#pG{#p~HqXJVV$UWOYDuYZ%TZ!^Du!^!_Fx!_#oDu#o#pFx#p~Du7ZJs^$UW}POYJlYZKoZzJlz{NQ{!PJl!P!Q!,R!Q!^Jl!^!_!!]!_!}Jl!}#O!'|#O#P!+a#P#oJl#o#p!!]#p~Jl7ZKtV$UWOzKoz{LZ{!^Ko!^!_M]!_#oKo#o#pM]#p~Ko7ZL`X$UWOzKoz{LZ{!PKo!P!QL{!Q!^Ko!^!_M]!_#oKo#o#pM]#p~Ko7ZMSR$UWU7RO!^%T!_#o%T#p~%T7RM`ROzM]z{Mi{~M]7RMlTOzM]z{Mi{!PM]!P!QM{!Q~M]7RNQOU7R7ZNX^$UW}POYJlYZKoZzJlz{NQ{!PJl!P!Q! T!Q!^Jl!^!_!!]!_!}Jl!}#O!'|#O#P!+a#P#oJl#o#p!!]#p~Jl7Z! ^_$UWU7R}PO!^%T!_#Z%T#Z#[Er#[#]%T#]#^Er#^#a%T#a#bEr#b#g%T#g#hEr#h#i%T#i#jEr#j#m%T#m#nEr#n#o%T#p~%T7R!!bY}POY!!]YZM]Zz!!]z{!#Q{!P!!]!P!Q!&x!Q!}!!]!}#O!$`#O#P!&f#P~!!]7R!#VY}POY!!]YZM]Zz!!]z{!#Q{!P!!]!P!Q!#u!Q!}!!]!}#O!$`#O#P!&f#P~!!]7R!#|UU7R}P#Z#[Gd#]#^Gd#a#bGd#g#hGd#i#jGd#m#nGd7R!$cWOY!$`YZM]Zz!$`z{!${{#O!$`#O#P!&S#P#Q!!]#Q~!$`7R!%OYOY!$`YZM]Zz!$`z{!${{!P!$`!P!Q!%n!Q#O!$`#O#P!&S#P#Q!!]#Q~!$`7R!%sTU7ROYG{Z#OG{#O#PH_#P#QFx#Q~G{7R!&VTOY!$`YZM]Zz!$`z{!${{~!$`7R!&iTOY!!]YZM]Zz!!]z{!#Q{~!!]7R!&}_}POzM]z{Mi{#ZM]#Z#[!&x#[#]M]#]#^!&x#^#aM]#a#b!&x#b#gM]#g#h!&x#h#iM]#i#j!&x#j#mM]#m#n!&x#n~M]7Z!(R[$UWOY!'|YZKoZz!'|z{!(w{!^!'|!^!_!$`!_#O!'|#O#P!*o#P#QJl#Q#o!'|#o#p!$`#p~!'|7Z!(|^$UWOY!'|YZKoZz!'|z{!(w{!P!'|!P!Q!)x!Q!^!'|!^!_!$`!_#O!'|#O#P!*o#P#QJl#Q#o!'|#o#p!$`#p~!'|7Z!*PY$UWU7ROYHqYZ%TZ!^Hq!^!_G{!_#OHq#O#PIf#P#QDu#Q#oHq#o#pG{#p~Hq7Z!*tX$UWOY!'|YZKoZz!'|z{!(w{!^!'|!^!_!$`!_#o!'|#o#p!$`#p~!'|7Z!+fX$UWOYJlYZKoZzJlz{NQ{!^Jl!^!_!!]!_#oJl#o#p!!]#p~Jl7Z!,Yc$UW}POzKoz{LZ{!^Ko!^!_M]!_#ZKo#Z#[!,R#[#]Ko#]#^!,R#^#aKo#a#b!,R#b#gKo#g#h!,R#h#iKo#i#j!,R#j#mKo#m#n!,R#n#oKo#o#pM]#p~Ko7Z!-lV$UWT7ROY!-eYZ%TZ!^!-e!^!_!.R!_#o!-e#o#p!.R#p~!-e7R!.WQT7ROY!.RZ~!.R$P!.g[$UW#o#v}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~Du]!/f[#wS$UW}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~Du!{!0cd$UWk!sO!O%T!O!P@r!P!Q%T!Q![!1q![!^%T!_!g%T!g!hAl!h#R%T#R#S!1q#S#U%T#U#V!3X#V#X%T#X#YAl#Y#b%T#b#c!2w#c#d!4m#d#l%T#l#m!5{#m#o%T#p~%T!{!1x_$UWk!sO!O%T!O!P@r!P!Q%T!Q![!1q![!^%T!_!g%T!g!hAl!h#R%T#R#S!1q#S#X%T#X#YAl#Y#b%T#b#c!2w#c#o%T#p~%T!{!3OR$UWk!sO!^%T!_#o%T#p~%T!{!3^W$UWO!Q%T!Q!R!3v!R!S!3v!S!^%T!_#R%T#R#S!3v#S#o%T#p~%T!{!3}Y$UWk!sO!Q%T!Q!R!3v!R!S!3v!S!^%T!_#R%T#R#S!3v#S#b%T#b#c!2w#c#o%T#p~%T!{!4rV$UWO!Q%T!Q!Y!5X!Y!^%T!_#R%T#R#S!5X#S#o%T#p~%T!{!5`X$UWk!sO!Q%T!Q!Y!5X!Y!^%T!_#R%T#R#S!5X#S#b%T#b#c!2w#c#o%T#p~%T!{!6QZ$UWO!Q%T!Q![!6s![!^%T!_!c%T!c!i!6s!i#R%T#R#S!6s#S#T%T#T#Z!6s#Z#o%T#p~%T!{!6z]$UWk!sO!Q%T!Q![!6s![!^%T!_!c%T!c!i!6s!i#R%T#R#S!6s#S#T%T#T#Z!6s#Z#b%T#b#c!2w#c#o%T#p~%T$u!7|R!]V$UW#m$fO!^%T!_#o%T#p~%T!q!8^R_!i$UWO!^%T!_#o%T#p~%T5w!8rR'bd!a/n#x&s'|P!P!Q!8{!^!_!9Q!_!`!9_W!9QO$WW#v!9VP#`#v!_!`!9Y#v!9_O#o#v#v!9dO#a#v$u!9kT!{$m$UWO!^%T!_!`'v!`!a!9z!a#o%T#p~%T$P!:RR#W#w$UWO!^%T!_#o%T#p~%T%V!:gT'a!R#a#v$RS$UWO!^%T!_!`!:v!`!a!;W!a#o%T#p~%T$O!:}R#a#v$UWO!^%T!_#o%T#p~%T$O!;_T#`#v$UWO!^%T!_!`5T!`!a!;n!a#o%T#p~%T$O!;uS#`#v$UWO!^%T!_!`5T!`#o%T#p~%T*a!]S#g#v$UWO!^%T!_!`5T!`#o%T#p~%T$a!>pR$UW'f$XO!^%T!_#o%T#p~%T~!?OO!T~5b!?VT'w5Y$UWO!^%T!_!`5T!`#o%T#p#q!=P#q~%T6X!?oR!S5}nQ$UWO!^%T!_#o%T#p~%TX!@PR!kP$UWO!^%T!_#o%T#p~%T7Z!@gr$UW'Y7R#zS']$y'g3SOX%TXY%cYZ%TZ[%c[p%Tpq%cqt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$f%T$f$g%c$g#BY2`#BY#BZ!@Y#BZ$IS2`$IS$I_!@Y$I_$JT2`$JT$JU!@Y$JU$KV2`$KV$KW!@Y$KW&FU2`&FU&FV!@Y&FV?HT2`?HT?HU!@Y?HU~2`7Z!CO_$UW'Z7R#zS']$y'g3SOt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$g%T$g~2`",tokenizers:[va,ja,wa,_a,0,1,2,3,4,5,6,7,8,9,Wa],topRules:{Script:[0,7]},dialects:{jsx:12107,ts:12109},dynamicPrecedences:{149:1,176:1},specialized:[{term:289,get:t=>za[t]||-1},{term:299,get:t=>Ga[t]||-1},{term:63,get:t=>Ca[t]||-1}],tokenPrec:12130}),Ya=[T("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),T("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),T("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),T("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),T("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),T(`try { - \${} -} catch (\${error}) { - \${} -}`,{label:"try",detail:"/ catch block",type:"keyword"}),T("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),T(`if (\${}) { - \${} -} else { - \${} -}`,{label:"if",detail:"/ else block",type:"keyword"}),T(`class \${name} { - constructor(\${params}) { - \${} - } -}`,{label:"class",detail:"definition",type:"keyword"}),T('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),T('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],LO=new Ce,ue=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function _(t){return(O,e)=>{let a=O.node.getChild("VariableDefinition");return a&&e(a,t),!0}}const Va=["FunctionDeclaration"],Ea={FunctionDeclaration:_("function"),ClassDeclaration:_("class"),ClassExpression:()=>!0,EnumDeclaration:_("constant"),TypeAliasDeclaration:_("type"),NamespaceDeclaration:_("namespace"),VariableDefinition(t,O){t.matchContext(Va)||O(t,"variable")},TypeDefinition(t,O){O(t,"type")},__proto__:null};function de(t,O){let e=LO.get(O);if(e)return e;let a=[],i=!0;function r(s,n){let Q=t.sliceString(s.from,s.to);a.push({label:Q,type:n})}return O.cursor(KO.IncludeAnonymous).iterate(s=>{if(i)i=!1;else if(s.name){let n=Ea[s.name];if(n&&n(s,r)||ue.has(s.name))return!1}else if(s.to-s.from>8192){for(let n of de(t,s.node))a.push(n);return!1}}),LO.set(O,a),a}const FO=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,$e=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Ia(t){let O=z(t.state).resolveInner(t.pos,-1);if($e.indexOf(O.name)>-1)return null;let e=O.name=="VariableName"||O.to-O.from<20&&FO.test(t.state.sliceDoc(O.from,O.to));if(!e&&!t.explicit)return null;let a=[];for(let i=O;i;i=i.parent)ue.has(i.name)&&(a=a.concat(de(t.state.doc,i)));return{options:a,from:e?O.from:t.pos,validFor:FO}}const k=cO.define({parser:Ua.configure({props:[uO.add({IfStatement:V({except:/^\s*({|else\b)/}),TryStatement:V({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:ze,SwitchBody:t=>{let O=t.textAfter,e=/^\s*\}/.test(O),a=/^\s*(case|default)\b/.test(O);return t.baseIndent+(e?0:a?1:2)*t.unit},Block:Ge({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":V({except:/^{/}),JSXElement(t){let O=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(O?0:t.unit)},JSXEscape(t){let O=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(O?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),dO.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":HO,BlockComment(t){return{from:t.from+2,to:t.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Aa=k.configure({dialect:"ts"}),Na=k.configure({dialect:"jsx"}),Da=k.configure({dialect:"jsx ts"}),La="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(t=>({label:t,type:"keyword"}));function he(t={}){let O=t.jsx?t.typescript?Da:Na:t.typescript?Aa:k;return new $O(O,[k.data.of({autocomplete:ve($e,qe(Ya.concat(La)))}),k.data.of({autocomplete:Ia}),t.jsx?Ja:[]])}function JO(t,O,e=t.length){if(!O)return"";let a=O.getChild("JSXIdentifier");return a?t.sliceString(a.from,Math.min(a.to,e)):""}const Fa=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ja=X.inputHandler.of((t,O,e,a)=>{if((Fa?t.composing:t.compositionStarted)||t.state.readOnly||O!=e||a!=">"&&a!="/"||!k.isActiveAt(t.state,O,-1))return!1;let{state:i}=t,r=i.changeByRange(s=>{var n,Q,u;let{head:d}=s,l=z(i).resolveInner(d,-1),$;if(l.name=="JSXStartTag"&&(l=l.parent),a==">"&&l.name=="JSXFragmentTag")return{range:q.cursor(d+1),changes:{from:d,insert:"><>"}};if(a==">"&&l.name=="JSXIdentifier"){if(((Q=(n=l.parent)===null||n===void 0?void 0:n.lastChild)===null||Q===void 0?void 0:Q.name)!="JSXEndTag"&&($=JO(i.doc,l.parent,d)))return{range:q.cursor(d+1),changes:{from:d,insert:`>`}}}else if(a=="/"&&l.name=="JSXFragmentTag"){let h=l.parent,p=h==null?void 0:h.parent;if(h.from==d-1&&((u=p.lastChild)===null||u===void 0?void 0:u.name)!="JSXEndTag"&&($=JO(i.doc,p==null?void 0:p.firstChild,d))){let P=`/${$}>`;return{range:q.cursor(d+P.length),changes:{from:d,insert:P}}}}return{range:s}});return r.changes.empty?!1:(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}),v=["_blank","_self","_top","_parent"],aO=["ascii","utf-8","utf-16","latin1","latin1"],iO=["get","post","put","delete"],rO=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],g=["true","false"],c={},Ma={a:{attrs:{href:null,ping:null,type:null,media:null,target:v,hreflang:null}},abbr:c,acronym:c,address:c,applet:c,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:c,aside:c,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:c,base:{attrs:{href:null,target:v}},basefont:c,bdi:c,bdo:c,big:c,blockquote:{attrs:{cite:null}},body:c,br:c,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:rO,formmethod:iO,formnovalidate:["novalidate"],formtarget:v,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:c,center:c,cite:c,code:c,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:c,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:c,dir:c,div:c,dl:c,dt:c,em:c,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:c,figure:c,font:c,footer:c,form:{attrs:{action:null,name:null,"accept-charset":aO,autocomplete:["on","off"],enctype:rO,method:iO,novalidate:["novalidate"],target:v}},frame:c,frameset:c,h1:c,h2:c,h3:c,h4:c,h5:c,h6:c,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:c,hgroup:c,hr:c,html:{attrs:{manifest:null}},i:c,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:rO,formmethod:iO,formnovalidate:["novalidate"],formtarget:v,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:c,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:c,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:c,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:aO,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:c,noframes:c,noscript:c,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:c,param:{attrs:{name:null,value:null}},pre:c,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:c,rt:c,ruby:c,s:c,samp:c,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:aO}},section:c,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:c,source:{attrs:{src:null,type:null,media:null}},span:c,strike:c,strong:c,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:c,summary:c,sup:c,table:c,tbody:c,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:c,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:c,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:c,time:{attrs:{datetime:null}},title:c,tr:c,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},tt:c,u:c,ul:{children:["li","script","template","ul","ol"]},var:c,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:c},Ba={accesskey:null,class:null,contenteditable:g,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:g,autocorrect:g,autocapitalize:g,style:null,tabindex:null,title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":g,"aria-autocomplete":["inline","list","both","none"],"aria-busy":g,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":g,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":g,"aria-hidden":g,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":g,"aria-multiselectable":g,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":g,"aria-relevant":null,"aria-required":g,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null};class J{constructor(O,e){this.tags=Object.assign(Object.assign({},Ma),O),this.globalAttrs=Object.assign(Object.assign({},Ba),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}J.default=new J;function Z(t,O,e=t.length){if(!O)return"";let a=O.firstChild,i=a&&a.getChild("TagName");return i?t.sliceString(i.from,Math.min(i.to,e)):""}function M(t,O=!1){for(let e=t.parent;e;e=e.parent)if(e.name=="Element")if(O)O=!1;else return e;return null}function pe(t,O,e){let a=e.tags[Z(t,M(O,!0))];return(a==null?void 0:a.children)||e.allTags}function pO(t,O){let e=[];for(let a=O;a=M(a);){let i=Z(t,a);if(i&&a.lastChild.name=="CloseTag")break;i&&e.indexOf(i)<0&&(O.name=="EndTag"||O.from>=a.firstChild.to)&&e.push(i)}return e}const fe=/^[:\-\.\w\u00b7-\uffff]*$/;function MO(t,O,e,a,i){let r=/\s*>/.test(t.sliceDoc(i,i+5))?"":">";return{from:a,to:i,options:pe(t.doc,e,O).map(s=>({label:s,type:"type"})).concat(pO(t.doc,e).map((s,n)=>({label:"/"+s,apply:"/"+s+r,type:"type",boost:99-n}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function BO(t,O,e,a){let i=/\s*>/.test(t.sliceDoc(a,a+5))?"":">";return{from:e,to:a,options:pO(t.doc,O).map((r,s)=>({label:r,apply:r+i,type:"type",boost:99-s})),validFor:fe}}function Ka(t,O,e,a){let i=[],r=0;for(let s of pe(t.doc,e,O))i.push({label:"<"+s,type:"type"});for(let s of pO(t.doc,e))i.push({label:"",type:"type",boost:99-r++});return{from:a,to:a,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Ha(t,O,e,a,i){let r=M(e),s=r?O.tags[Z(t.doc,r)]:null,n=s&&s.attrs?Object.keys(s.attrs).concat(O.globalAttrNames):O.globalAttrNames;return{from:a,to:i,options:n.map(Q=>({label:Q,type:"property"})),validFor:fe}}function Oi(t,O,e,a,i){var r;let s=(r=e.parent)===null||r===void 0?void 0:r.getChild("AttributeName"),n=[],Q;if(s){let u=t.sliceDoc(s.from,s.to),d=O.globalAttrs[u];if(!d){let l=M(e),$=l?O.tags[Z(t.doc,l)]:null;d=($==null?void 0:$.attrs)&&$.attrs[u]}if(d){let l=t.sliceDoc(a,i).toLowerCase(),$='"',h='"';/^['"]/.test(l)?(Q=l[0]=='"'?/^[^"]*$/:/^[^']*$/,$="",h=t.sliceDoc(i,i+1)==l[0]?"":l[0],l=l.slice(1),a++):Q=/^[^\s<>='"]*$/;for(let p of d)n.push({label:p,apply:$+p+h,type:"constant"})}}return{from:a,to:i,options:n,validFor:Q}}function ei(t,O){let{state:e,pos:a}=O,i=z(e).resolveInner(a),r=i.resolve(a,-1);for(let s=a,n;i==r&&(n=r.childBefore(s));){let Q=n.lastChild;if(!Q||!Q.type.isError||Q.fromei(a,i)}const oO=cO.define({parser:Vt.configure({props:[uO.add({Element(t){let O=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+O[0].length?t.continue():t.lineIndent(t.node.from)+(O[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].length"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function ai(t={}){let O=oO;return t.matchClosingTags===!1&&(O=O.configure({dialect:"noMatch"})),new $O(O,[oO.data.of({autocomplete:ti(t)}),t.autoCloseTags!==!1?ii:[],he().support,Qa().support])}const ii=X.inputHandler.of((t,O,e,a)=>{if(t.composing||t.state.readOnly||O!=e||a!=">"&&a!="/"||!oO.isActiveAt(t.state,O,-1))return!1;let{state:i}=t,r=i.changeByRange(s=>{var n,Q,u;let{head:d}=s,l=z(i).resolveInner(d,-1),$;if((l.name=="TagName"||l.name=="StartTag")&&(l=l.parent),a==">"&&l.name=="OpenTag"){if(((Q=(n=l.parent)===null||n===void 0?void 0:n.lastChild)===null||Q===void 0?void 0:Q.name)!="CloseTag"&&($=Z(i.doc,l.parent,d))){let h=t.state.doc.sliceString(d,d+1)===">",p=`${h?"":">"}`;return{range:q.cursor(d+1),changes:{from:d+(h?1:0),insert:p}}}}else if(a=="/"&&l.name=="OpenTag"){let h=l.parent,p=h==null?void 0:h.parent;if(h.from==d-1&&((u=p.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&($=Z(i.doc,p,d))){let P=t.state.doc.sliceString(d,d+1)===">",W=`/${$}${P?"":">"}`,j=d+W.length+(P?1:0);return{range:q.cursor(j),changes:{from:d,insert:W}}}}return{range:s}});return r.changes.empty?!1:(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)});function ri(t){let O;return{c(){O=be("div"),Pe(O,"class","code-editor"),SO(O,"max-height",t[0]?t[0]+"px":"auto",!1)},m(e,a){Re(e,O,a),t[10](O)},p(e,[a]){a&1&&SO(O,"max-height",e[0]?e[0]+"px":"auto",!1)},i:bO,o:bO,d(e){e&&xe(O),t[10](null)}}}function si(t,O,e){const a=ke();let{id:i=""}=O,{value:r=""}=O,{maxHeight:s=null}=O,{disabled:n=!1}=O,{placeholder:Q=""}=O,{language:u="javascript"}=O,{singleLine:d=!1}=O,l,$,h=new G,p=new G,P=new G,W=new G;function j(){l==null||l.focus()}function fO(){$==null||$.dispatchEvent(new CustomEvent("change",{detail:{value:r},bubbles:!0}))}function gO(){if(!i)return;const f=document.querySelectorAll('[for="'+i+'"]');for(let m of f)m.removeEventListener("click",j)}function mO(){if(!i)return;gO();const f=document.querySelectorAll('[for="'+i+'"]');for(let m of f)m.addEventListener("click",j)}function TO(){return u==="html"?ai():he()}Xe(()=>{const f={key:"Enter",run:m=>{d&&a("submit",r)}};return mO(),e(9,l=new X({parent:$,state:w.create({doc:r,extensions:[Ue(),Ye(),Ve(),Ee(),Ie(),w.allowMultipleSelections.of(!0),Ae(Ne,{fallback:!0}),De(),Le(),Fe(),Je(),Me.of([f,...Be,...Ke,He.find(m=>m.key==="Mod-d"),...Ot,...et]),X.lineWrapping,tt({icons:!1}),h.of(TO()),W.of(PO(Q)),p.of(X.editable.of(!0)),P.of(w.readOnly.of(!1)),w.transactionFilter.of(m=>d&&m.newDoc.lines>1?[]:m),X.updateListener.of(m=>{!m.docChanged||n||(e(2,r=m.state.doc.toString()),fO())})]})})),()=>{gO(),l==null||l.destroy()}});function ge(f){ye[f?"unshift":"push"](()=>{$=f,e(1,$)})}return t.$$set=f=>{"id"in f&&e(3,i=f.id),"value"in f&&e(2,r=f.value),"maxHeight"in f&&e(0,s=f.maxHeight),"disabled"in f&&e(4,n=f.disabled),"placeholder"in f&&e(5,Q=f.placeholder),"language"in f&&e(6,u=f.language),"singleLine"in f&&e(7,d=f.singleLine)},t.$$.update=()=>{t.$$.dirty&8&&i&&mO(),t.$$.dirty&576&&l&&u&&l.dispatch({effects:[h.reconfigure(TO())]}),t.$$.dirty&528&&l&&typeof n<"u"&&(l.dispatch({effects:[p.reconfigure(X.editable.of(!n)),P.reconfigure(w.readOnly.of(n))]}),fO()),t.$$.dirty&516&&l&&r!=l.state.doc.toString()&&l.dispatch({changes:{from:0,to:l.state.doc.length,insert:r}}),t.$$.dirty&544&&l&&typeof Q<"u"&&l.dispatch({effects:[W.reconfigure(PO(Q))]})},[s,$,r,i,n,Q,u,d,j,l,ge]}class li extends me{constructor(O){super(),Te(this,O,si,ri,Se,{id:3,value:2,maxHeight:0,disabled:4,placeholder:5,language:6,singleLine:7,focus:8})}get focus(){return this.$$.ctx[8]}}export{li as default}; diff --git a/ui/dist/assets/CodeEditor.45f24efe.js b/ui/dist/assets/CodeEditor.45f24efe.js new file mode 100644 index 000000000..c43efee4d --- /dev/null +++ b/ui/dist/assets/CodeEditor.45f24efe.js @@ -0,0 +1,13 @@ +import{S as me,i as Te,s as Se,e as be,f as Pe,T as SO,g as Re,y as bO,o as ke,K as xe,M as Xe,N as ye}from"./index.97f016a1.js";import{P as Ze,N as We,u as je,D as we,v as lO,T as Y,I as KO,w as QO,x as o,y as _e,L as cO,z as uO,A as V,B as dO,F as HO,G as hO,H as z,J as ve,K as qe,E as X,M as q,O as ze,Q as Ge,R as T,U as Ce,a as w,h as Ue,b as Ye,c as Ve,d as Ee,e as Ie,s as Ae,f as Ne,g as De,i as Le,r as Fe,j as Je,k as Me,l as Be,m as Ke,n as He,o as Ot,p as et,q as tt,t as PO,C as G}from"./index.9c8b95cd.js";class N{constructor(O,e,a,i,r,s,n,Q,c,u=0,l){this.p=O,this.stack=e,this.state=a,this.reducePos=i,this.pos=r,this.score=s,this.buffer=n,this.bufferBase=Q,this.curContext=c,this.lookAhead=u,this.parent=l}toString(){return`[${this.stack.filter((O,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(O,e,a=0){let i=O.parser.context;return new N(O,[],e,a,a,0,[],0,i?new RO(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(O,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=O}reduce(O){let e=O>>19,a=O&65535,{parser:i}=this.p,r=i.dynamicPrecedence(a);if(r&&(this.score+=r),e==0){this.pushState(i.getGoto(this.state,a,!0),this.reducePos),as;)this.stack.pop();this.reduceContext(a,n)}storeNode(O,e,a,i=4,r=!1){if(O==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&s.buffer[n-4]==0&&s.buffer[n-1]>-1){if(e==a)return;if(s.buffer[n-2]>=e){s.buffer[n-2]=a;return}}}if(!r||this.pos==a)this.buffer.push(O,e,a,i);else{let s=this.buffer.length;if(s>0&&this.buffer[s-4]!=0)for(;s>0&&this.buffer[s-2]>a;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4);this.buffer[s]=O,this.buffer[s+1]=e,this.buffer[s+2]=a,this.buffer[s+3]=i}}shift(O,e,a){let i=this.pos;if(O&131072)this.pushState(O&65535,this.pos);else if((O&262144)==0){let r=O,{parser:s}=this.p;(a>this.pos||e<=s.maxNode)&&(this.pos=a,s.stateFlag(r,1)||(this.reducePos=a)),this.pushState(r,i),this.shiftContext(e,i),e<=s.maxNode&&this.buffer.push(e,i,a,4)}else this.pos=a,this.shiftContext(e,i),e<=this.p.parser.maxNode&&this.buffer.push(e,i,a,4)}apply(O,e,a){O&65536?this.reduce(O):this.shift(O,e,a)}useNode(O,e){let a=this.p.reused.length-1;(a<0||this.p.reused[a]!=O)&&(this.p.reused.push(O),a++);let i=this.pos;this.reducePos=this.pos=i+O.length,this.pushState(e,i),this.buffer.push(a,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,O,this,this.p.stream.reset(this.pos-O.length)))}split(){let O=this,e=O.buffer.length;for(;e>0&&O.buffer[e-2]>O.reducePos;)e-=4;let a=O.buffer.slice(e),i=O.bufferBase+e;for(;O&&i==O.bufferBase;)O=O.parent;return new N(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,a,i,this.curContext,this.lookAhead,O)}recoverByDelete(O,e){let a=O<=this.p.parser.maxNode;a&&this.storeNode(O,this.pos,e,4),this.storeNode(0,this.pos,e,a?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(O){for(let e=new at(this);;){let a=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,O);if((a&65536)==0)return!0;if(a==0)return!1;e.reduce(a)}}recoverByInsert(O){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>4<<1||this.stack.length>=120){let i=[];for(let r=0,s;rQ&1&&n==s)||i.push(e[r],s)}e=i}let a=[];for(let i=0;i>19,i=O&65535,r=this.stack.length-a*3;if(r<0||e.getGoto(this.stack[r],i,!1)<0)return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(O),!0}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:O}=this.p;return O.data[O.stateSlot(this.state,1)]==65535&&!O.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(O){if(this.state!=O.state||this.stack.length!=O.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=O)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class RO{constructor(O,e){this.tracker=O,this.context=e,this.hash=O.strict?O.hash(e):0}}var kO;(function(t){t[t.Insert=200]="Insert",t[t.Delete=190]="Delete",t[t.Reduce=100]="Reduce",t[t.MaxNext=4]="MaxNext",t[t.MaxInsertStackDepth=300]="MaxInsertStackDepth",t[t.DampenInsertStackDepth=120]="DampenInsertStackDepth"})(kO||(kO={}));class at{constructor(O){this.start=O,this.state=O.state,this.stack=O.stack,this.base=this.stack.length}reduce(O){let e=O&65535,a=O>>19;a==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(a-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class D{constructor(O,e,a){this.stack=O,this.pos=e,this.index=a,this.buffer=O.buffer,this.index==0&&this.maybeNext()}static create(O,e=O.bufferBase+O.buffer.length){return new D(O,e,e-O.bufferBase)}maybeNext(){let O=this.stack.parent;O!=null&&(this.index=this.stack.bufferBase-O.bufferBase,this.stack=O,this.buffer=O.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new D(this.stack,this.pos,this.index)}}class E{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const xO=new E;class it{constructor(O,e){this.input=O,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=xO,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(O,e){let a=this.range,i=this.rangeIndex,r=this.pos+O;for(;ra.to:r>=a.to;){if(i==this.ranges.length-1)return null;let s=this.ranges[++i];r+=s.from-a.to,a=s}return r}clipPos(O){if(O>=this.range.from&&OO)return Math.max(O,e.from);return this.end}peek(O){let e=this.chunkOff+O,a,i;if(e>=0&&e=this.chunk2Pos&&an.to&&(this.chunk2=this.chunk2.slice(0,n.to-a)),i=this.chunk2.charCodeAt(0)}}return a>=this.token.lookAhead&&(this.token.lookAhead=a+1),i}acceptToken(O,e=0){let a=e?this.resolveOffset(e,-1):this.pos;if(a==null||a=this.chunk2Pos&&this.posthis.range.to?O.slice(0,this.range.to-this.pos):O,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(O=1){for(this.chunkOff+=O;this.pos+O>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();O-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=O,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(O,e){if(e?(this.token=e,e.start=O,e.lookAhead=O+1,e.value=e.extended=-1):this.token=xO,this.pos!=O){if(this.pos=O,O==this.end)return this.setDone(),this;for(;O=this.range.to;)this.range=this.ranges[++this.rangeIndex];O>=this.chunkPos&&O=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(O-this.chunkPos,e-this.chunkPos);if(O>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(O-this.chunk2Pos,e-this.chunk2Pos);if(O>=this.range.from&&e<=this.range.to)return this.input.read(O,e);let a="";for(let i of this.ranges){if(i.from>=e)break;i.to>O&&(a+=this.input.read(Math.max(i.from,O),Math.min(i.to,e)))}return a}}class I{constructor(O,e){this.data=O,this.id=e}token(O,e){rt(this.data,O,e,this.id)}}I.prototype.contextual=I.prototype.fallback=I.prototype.extend=!1;class b{constructor(O,e={}){this.token=O,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function rt(t,O,e,a){let i=0,r=1<0){let $=t[h];if(n.allows($)&&(O.token.value==-1||O.token.value==$||s.overrides($,O.token.value))){O.acceptToken($);break}}let c=O.next,u=0,l=t[i+2];if(O.next<0&&l>u&&t[Q+l*3-3]==65535){i=t[Q+l*3-1];continue O}for(;u>1,$=Q+h+(h<<1),p=t[$],P=t[$+1];if(c=P)u=h+1;else{i=t[$+2],O.advance();continue O}}break}}function C(t,O=Uint16Array){if(typeof t!="string")return t;let e=null;for(let a=0,i=0;a=92&&s--,s>=34&&s--;let Q=s-32;if(Q>=46&&(Q-=46,n=!0),r+=Q,n)break;r*=46}e?e[i++]=r:e=new O(r)}return e}const S=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let B=null;var XO;(function(t){t[t.Margin=25]="Margin"})(XO||(XO={}));function yO(t,O,e){let a=t.cursor(KO.IncludeAnonymous);for(a.moveTo(O);;)if(!(e<0?a.childBefore(O):a.childAfter(O)))for(;;){if((e<0?a.toO)&&!a.type.isError)return e<0?Math.max(0,Math.min(a.to-1,O-25)):Math.min(t.length,Math.max(a.from+1,O+25));if(e<0?a.prevSibling():a.nextSibling())break;if(!a.parent())return e<0?0:t.length}}class st{constructor(O,e){this.fragments=O,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let O=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(O){for(this.safeFrom=O.openStart?yO(O.tree,O.from+O.offset,1)-O.offset:O.from,this.safeTo=O.openEnd?yO(O.tree,O.to+O.offset,-1)-O.offset:O.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(O.tree),this.start.push(-O.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(O){if(OO)return this.nextStart=s,null;if(r instanceof Y){if(s==O){if(s=Math.max(this.safeFrom,O)&&(this.trees.push(r),this.start.push(s),this.index.push(0))}else this.index[e]++,this.nextStart=s+r.length}}}class nt{constructor(O,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=O.tokenizers.map(a=>new E)}getActions(O){let e=0,a=null,{parser:i}=O.p,{tokenizers:r}=i,s=i.stateSlot(O.state,3),n=O.curContext?O.curContext.hash:0,Q=0;for(let c=0;cl.end+25&&(Q=Math.max(l.lookAhead,Q)),l.value!=0)){let h=e;if(l.extended>-1&&(e=this.addActions(O,l.extended,l.end,e)),e=this.addActions(O,l.value,l.end,e),!u.extend&&(a=l,e>h))break}}for(;this.actions.length>e;)this.actions.pop();return Q&&O.setLookAhead(Q),!a&&O.pos==this.stream.end&&(a=new E,a.value=O.p.parser.eofTerm,a.start=a.end=O.pos,e=this.addActions(O,a.value,a.end,e)),this.mainToken=a,this.actions}getMainToken(O){if(this.mainToken)return this.mainToken;let e=new E,{pos:a,p:i}=O;return e.start=a,e.end=Math.min(a+1,i.stream.end),e.value=a==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(O,e,a){let i=this.stream.clipPos(a.pos);if(e.token(this.stream.reset(i,O),a),O.value>-1){let{parser:r}=a.p;for(let s=0;s=0&&a.p.parser.dialect.allows(n>>1)){(n&1)==0?O.value=n>>1:O.extended=n>>1;break}}}else O.value=0,O.end=this.stream.clipPos(i+1)}putAction(O,e,a,i){for(let r=0;rO.bufferLength*4?new st(a,O.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let O=this.stacks,e=this.minStackPos,a=this.stacks=[],i,r;for(let s=0;se)a.push(n);else{if(this.advanceStack(n,a,O))continue;{i||(i=[],r=[]),i.push(n);let Q=this.tokens.getMainToken(n);r.push(Q.value,Q.end)}}break}}if(!a.length){let s=i&&Qt(i);if(s)return this.stackToTree(s);if(this.parser.strict)throw S&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let s=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,r,a);if(s)return this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(a.length>s)for(a.sort((n,Q)=>Q.score-n.score);a.length>s;)a.pop();a.some(n=>n.reducePos>e)&&this.recovering--}else if(a.length>1){O:for(let s=0;s500&&c.buffer.length>500)if((n.score-c.score||n.buffer.length-c.buffer.length)>0)a.splice(Q--,1);else{a.splice(s--,1);continue O}}}}this.minStackPos=a[0].pos;for(let s=1;s ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return O.forceReduce()?O:null;if(this.fragments){let c=O.curContext&&O.curContext.tracker.strict,u=c?O.curContext.hash:0;for(let l=this.fragments.nodeAt(i);l;){let h=this.parser.nodeSet.types[l.type.id]==l.type?r.getGoto(O.state,l.type.id):-1;if(h>-1&&l.length&&(!c||(l.prop(lO.contextHash)||0)==u))return O.useNode(l,h),S&&console.log(s+this.stackID(O)+` (via reuse of ${r.getName(l.type.id)})`),!0;if(!(l instanceof Y)||l.children.length==0||l.positions[0]>0)break;let $=l.children[0];if($ instanceof Y&&l.positions[0]==0)l=$;else break}}let n=r.stateSlot(O.state,4);if(n>0)return O.reduce(n),S&&console.log(s+this.stackID(O)+` (via always-reduce ${r.getName(n&65535)})`),!0;if(O.stack.length>=15e3)for(;O.stack.length>9e3&&O.forceReduce(););let Q=this.tokens.getActions(O);for(let c=0;ci?e.push(p):a.push(p)}return!1}advanceFully(O,e){let a=O.pos;for(;;){if(!this.advanceStack(O,null,null))return!1;if(O.pos>a)return WO(O,e),!0}}runRecovery(O,e,a){let i=null,r=!1;for(let s=0;s ":"";if(n.deadEnd&&(r||(r=!0,n.restart(),S&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,a))))continue;let l=n.split(),h=u;for(let $=0;l.forceReduce()&&$<10&&(S&&console.log(h+this.stackID(l)+" (via force-reduce)"),!this.advanceFully(l,a));$++)S&&(h=this.stackID(l)+" -> ");for(let $ of n.recoverByInsert(Q))S&&console.log(u+this.stackID($)+" (via recover-insert)"),this.advanceFully($,a);this.stream.end>n.pos?(c==n.pos&&(c++,Q=0),n.recoverByDelete(Q,c),S&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(Q)})`),WO(n,a)):(!i||i.scoret;class Oe{constructor(O){this.start=O.start,this.shift=O.shift||K,this.reduce=O.reduce||K,this.reuse=O.reuse||K,this.hash=O.hash||(()=>0),this.strict=O.strict!==!1}}class y extends Ze{constructor(O){if(super(),this.wrappers=[],O.version!=14)throw new RangeError(`Parser version (${O.version}) doesn't match runtime version (${14})`);let e=O.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;nO.topRules[n][1]),i=[];for(let n=0;n=0)r(u,Q,n[c++]);else{let l=n[c+-u];for(let h=-u;h>0;h--)r(n[c++],Q,l);c++}}}this.nodeSet=new We(e.map((n,Q)=>je.define({name:Q>=this.minRepeatTerm?void 0:n,id:Q,props:i[Q],top:a.indexOf(Q)>-1,error:Q==0,skipped:O.skippedNodes&&O.skippedNodes.indexOf(Q)>-1}))),O.propSources&&(this.nodeSet=this.nodeSet.extend(...O.propSources)),this.strict=!1,this.bufferLength=we;let s=C(O.tokenData);this.context=O.context,this.specializerSpecs=O.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;ntypeof n=="number"?new I(s,n):n),this.topRules=O.topRules,this.dialects=O.dialects||{},this.dynamicPrecedences=O.dynamicPrecedences||null,this.tokenPrecTable=O.tokenPrec,this.termNames=O.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(O,e,a){let i=new ot(this,O,e,a);for(let r of this.wrappers)i=r(i,O,e,a);return i}getGoto(O,e,a=!1){let i=this.goto;if(e>=i[0])return-1;for(let r=i[e+1];;){let s=i[r++],n=s&1,Q=i[r++];if(n&&a)return Q;for(let c=r+(s>>1);r0}validAction(O,e){if(e==this.stateSlot(O,4))return!0;for(let a=this.stateSlot(O,1);;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=R(this.data,a+2);else return!1;if(e==R(this.data,a+1))return!0}}nextStates(O){let e=[];for(let a=this.stateSlot(O,1);;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=R(this.data,a+2);else break;if((this.data[a+2]&1)==0){let i=this.data[a+1];e.some((r,s)=>s&1&&r==i)||e.push(this.data[a],i)}}return e}overrides(O,e){let a=jO(this.data,this.tokenPrecTable,e);return a<0||jO(this.data,this.tokenPrecTable,O){let i=O.tokenizers.find(r=>r.from==a);return i?i.to:a})),O.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((a,i)=>{let r=O.specializers.find(n=>n.from==a.external);if(!r)return a;let s=Object.assign(Object.assign({},a),{external:r.to});return e.specializers[i]=wO(s),s})),O.contextTracker&&(e.context=O.contextTracker),O.dialect&&(e.dialect=this.parseDialect(O.dialect)),O.strict!=null&&(e.strict=O.strict),O.wrap&&(e.wrappers=e.wrappers.concat(O.wrap)),O.bufferLength!=null&&(e.bufferLength=O.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(O){return this.termNames?this.termNames[O]:String(O<=this.maxNode&&this.nodeSet.types[O].name||O)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(O){let e=this.dynamicPrecedences;return e==null?0:e[O]||0}parseDialect(O){let e=Object.keys(this.dialects),a=e.map(()=>!1);if(O)for(let r of O.split(" ")){let s=e.indexOf(r);s>=0&&(a[s]=!0)}let i=null;for(let r=0;ra)&&e.p.parser.stateFlag(e.state,2)&&(!O||O.scoret.external(e,a)<<1|O}return t.get}const ct=53,ut=1,dt=54,ht=2,$t=55,pt=3,L=4,ee=5,te=6,ae=7,ie=8,ft=9,gt=10,mt=11,H=56,Tt=12,_O=57,St=18,bt=27,Pt=30,Rt=33,kt=35,xt=0,Xt={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},yt={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},vO={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Zt(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}function re(t){return t==9||t==10||t==13||t==32}let qO=null,zO=null,GO=0;function sO(t,O){let e=t.pos+O;if(GO==e&&zO==t)return qO;let a=t.peek(O);for(;re(a);)a=t.peek(++O);let i="";for(;Zt(a);)i+=String.fromCharCode(a),a=t.peek(++O);return zO=t,GO=e,qO=i?i.toLowerCase():a==Wt||a==jt?void 0:null}const se=60,ne=62,oe=47,Wt=63,jt=33,wt=45;function CO(t,O){this.name=t,this.parent=O,this.hash=O?O.hash:0;for(let e=0;e-1?new CO(sO(a,1)||"",t):t},reduce(t,O){return O==St&&t?t.parent:t},reuse(t,O,e,a){let i=O.type.id;return i==L||i==kt?new CO(sO(a,1)||"",t):t},hash(t){return t?t.hash:0},strict:!1}),qt=new b((t,O)=>{if(t.next!=se){t.next<0&&O.context&&t.acceptToken(H);return}t.advance();let e=t.next==oe;e&&t.advance();let a=sO(t,0);if(a===void 0)return;if(!a)return t.acceptToken(e?Tt:L);let i=O.context?O.context.name:null;if(e){if(a==i)return t.acceptToken(ft);if(i&&yt[i])return t.acceptToken(H,-2);if(O.dialectEnabled(xt))return t.acceptToken(gt);for(let r=O.context;r;r=r.parent)if(r.name==a)return;t.acceptToken(mt)}else{if(a=="script")return t.acceptToken(ee);if(a=="style")return t.acceptToken(te);if(a=="textarea")return t.acceptToken(ae);if(Xt.hasOwnProperty(a))return t.acceptToken(ie);i&&vO[i]&&vO[i][a]?t.acceptToken(H,-1):t.acceptToken(L)}},{contextual:!0}),zt=new b(t=>{for(let O=0,e=0;;e++){if(t.next<0){e&&t.acceptToken(_O);break}if(t.next==wt)O++;else if(t.next==ne&&O>=2){e>3&&t.acceptToken(_O,-2);break}else O=0;t.advance()}});function $O(t,O,e){let a=2+t.length;return new b(i=>{for(let r=0,s=0,n=0;;n++){if(i.next<0){n&&i.acceptToken(O);break}if(r==0&&i.next==se||r==1&&i.next==oe||r>=2&&rs?i.acceptToken(O,-s):i.acceptToken(e,-(s-2));break}else if((i.next==10||i.next==13)&&n){i.acceptToken(O,1);break}else r=s=0;i.advance()}})}const Gt=$O("script",ct,ut),Ct=$O("style",dt,ht),Ut=$O("textarea",$t,pt),Yt=QO({"Text RawText":o.content,"StartTag StartCloseTag SelfCloserEndTag EndTag SelfCloseEndTag":o.angleBracket,TagName:o.tagName,"MismatchedCloseTag/TagName":[o.tagName,o.invalid],AttributeName:o.attributeName,"AttributeValue UnquotedAttributeValue":o.attributeValue,Is:o.definitionOperator,"EntityReference CharacterReference":o.character,Comment:o.blockComment,ProcessingInst:o.processingInstruction,DoctypeDecl:o.documentMeta}),Vt=y.deserialize({version:14,states:",xOVOxOOO!WQ!bO'#CoO!]Q!bO'#CyO!bQ!bO'#C|O!gQ!bO'#DPO!lQ!bO'#DRO!qOXO'#CnO!|OYO'#CnO#XO[O'#CnO$eOxO'#CnOOOW'#Cn'#CnO$lO!rO'#DSO$tQ!bO'#DUO$yQ!bO'#DVOOOW'#Dj'#DjOOOW'#DX'#DXQVOxOOO%OQ#tO,59ZO%WQ#tO,59eO%`Q#tO,59hO%hQ#tO,59kO%pQ#tO,59mOOOX'#D]'#D]O%xOXO'#CwO&TOXO,59YOOOY'#D^'#D^O&]OYO'#CzO&hOYO,59YOOO['#D_'#D_O&pO[O'#C}O&{O[O,59YOOOW'#D`'#D`O'TOxO,59YO'[Q!bO'#DQOOOW,59Y,59YOOO`'#Da'#DaO'aO!rO,59nOOOW,59n,59nO'iQ!bO,59pO'nQ!bO,59qOOOW-E7V-E7VO'sQ#tO'#CqOOQO'#DY'#DYO(OQ#tO1G.uOOOX1G.u1G.uO(WQ#tO1G/POOOY1G/P1G/PO(`Q#tO1G/SOOO[1G/S1G/SO(hQ#tO1G/VOOOW1G/V1G/VO(pQ#tO1G/XOOOW1G/X1G/XOOOX-E7Z-E7ZO(xQ!bO'#CxOOOW1G.t1G.tOOOY-E7[-E7[O(}Q!bO'#C{OOO[-E7]-E7]O)SQ!bO'#DOOOOW-E7^-E7^O)XQ!bO,59lOOO`-E7_-E7_OOOW1G/Y1G/YOOOW1G/[1G/[OOOW1G/]1G/]O)^Q&jO,59]OOQO-E7W-E7WOOOX7+$a7+$aOOOY7+$k7+$kOOO[7+$n7+$nOOOW7+$q7+$qOOOW7+$s7+$sO)iQ!bO,59dO)nQ!bO,59gO)sQ!bO,59jOOOW1G/W1G/WO)xO,UO'#CtO*ZO7[O'#CtOOQO1G.w1G.wOOOW1G/O1G/OOOOW1G/R1G/ROOOW1G/U1G/UOOOO'#DZ'#DZO*lO,UO,59`OOQO,59`,59`OOOO'#D['#D[O*}O7[O,59`OOOO-E7X-E7XOOQO1G.z1G.zOOOO-E7Y-E7Y",stateData:"+h~O!]OS~OSSOTPOUQOVROWTOY]OZ[O[^O^^O_^O`^Oa^Ow^Oz_O!cZO~OdaO~OdbO~OdcO~OddO~OdeO~O!VfOPkP!YkP~O!WiOQnP!YnP~O!XlORqP!YqP~OSSOTPOUQOVROWTOXqOY]OZ[O[^O^^O_^O`^Oa^Ow^O!cZO~O!YrO~P#dO!ZsO!duO~OdvO~OdwO~OfyOj|O~OfyOj!OO~OfyOj!QO~OfyOj!SO~OfyOj!UO~O!VfOPkX!YkX~OP!WO!Y!XO~O!WiOQnX!YnX~OQ!ZO!Y!XO~O!XlORqX!YqX~OR!]O!Y!XO~O!Y!XO~P#dOd!_O~O!ZsO!d!aO~Oj!bO~Oj!cO~Og!dOfeXjeX~OfyOj!fO~OfyOj!gO~OfyOj!hO~OfyOj!iO~OfyOj!jO~Od!kO~Od!lO~Od!mO~Oj!nO~Oi!qO!_!oO!a!pO~Oj!rO~Oj!sO~Oj!tO~O_!uO`!uOa!uO!_!wO!`!uO~O_!xO`!xOa!xO!a!wO!b!xO~O_!uO`!uOa!uO!_!{O!`!uO~O_!xO`!xOa!xO!a!{O!b!xO~O`_a!cwz!c~",goto:"%o!_PPPPPPPPPPPPPPPPPP!`!fP!lPP!xPP!{#O#R#X#[#_#e#h#k#q#w!`P!`!`P#}$T$k$q$w$}%T%Z%aPPPPPPPP%gX^OX`pXUOX`pezabcde{}!P!R!TR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!TeZ!e{}!P!R!TQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"\u26A0 StartCloseTag StartCloseTag StartCloseTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue EndTag ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:66,context:vt,nodeProps:[["closedBy",-11,1,2,3,4,5,6,7,8,9,10,11,"EndTag",-4,19,29,32,35,"CloseTag"],["group",-9,12,15,16,17,18,38,39,40,41,"Entity",14,"Entity TextContent",-3,27,30,33,"TextContent Entity"],["openedBy",26,"StartTag StartCloseTag",-4,28,31,34,36,"OpenTag"]],propSources:[Yt],skippedNodes:[0],repeatNodeCount:9,tokenData:"!#b!aR!WOX$kXY)sYZ)sZ]$k]^)s^p$kpq)sqr$krs*zsv$kvw+dwx2yx}$k}!O3f!O!P$k!P!Q7_!Q![$k![!]8u!]!^$k!^!_>b!_!`!!p!`!a8T!a!c$k!c!}8u!}#R$k#R#S8u#S#T$k#T#o8u#o$f$k$f$g&R$g%W$k%W%o8u%o%p$k%p&a8u&a&b$k&b1p8u1p4U$k4U4d8u4d4e$k4e$IS8u$IS$I`$k$I`$Ib8u$Ib$Kh$k$Kh%#t8u%#t&/x$k&/x&Et8u&Et&FV$k&FV;'S8u;'S;:jiW!``!bpOq(kqr?Rrs'gsv(kwx(]x!a(k!a!bKj!b~(k!R?YZ!``!bpOr(krs'gsv(kwx(]x}(k}!O?{!O!f(k!f!gAR!g#W(k#W#XGz#X~(k!R@SV!``!bpOr(krs'gsv(kwx(]x}(k}!O@i!O~(k!R@rT!``!bp!cPOr(krs'gsv(kwx(]x~(k!RAYV!``!bpOr(krs'gsv(kwx(]x!q(k!q!rAo!r~(k!RAvV!``!bpOr(krs'gsv(kwx(]x!e(k!e!fB]!f~(k!RBdV!``!bpOr(krs'gsv(kwx(]x!v(k!v!wBy!w~(k!RCQV!``!bpOr(krs'gsv(kwx(]x!{(k!{!|Cg!|~(k!RCnV!``!bpOr(krs'gsv(kwx(]x!r(k!r!sDT!s~(k!RD[V!``!bpOr(krs'gsv(kwx(]x!g(k!g!hDq!h~(k!RDxW!``!bpOrDqrsEbsvDqvwEvwxFfx!`Dq!`!aGb!a~DqqEgT!bpOvEbvxEvx!`Eb!`!aFX!a~EbPEyRO!`Ev!`!aFS!a~EvPFXOzPqF`Q!bpzPOv'gx~'gaFkV!``OrFfrsEvsvFfvwEvw!`Ff!`!aGQ!a~FfaGXR!``zPOr(]sv(]w~(]!RGkT!``!bpzPOr(krs'gsv(kwx(]x~(k!RHRV!``!bpOr(krs'gsv(kwx(]x#c(k#c#dHh#d~(k!RHoV!``!bpOr(krs'gsv(kwx(]x#V(k#V#WIU#W~(k!RI]V!``!bpOr(krs'gsv(kwx(]x#h(k#h#iIr#i~(k!RIyV!``!bpOr(krs'gsv(kwx(]x#m(k#m#nJ`#n~(k!RJgV!``!bpOr(krs'gsv(kwx(]x#d(k#d#eJ|#e~(k!RKTV!``!bpOr(krs'gsv(kwx(]x#X(k#X#YDq#Y~(k!RKqW!``!bpOrKjrsLZsvKjvwLowxNPx!aKj!a!b! g!b~KjqL`T!bpOvLZvxLox!aLZ!a!bM^!b~LZPLrRO!aLo!a!bL{!b~LoPMORO!`Lo!`!aMX!a~LoPM^OwPqMcT!bpOvLZvxLox!`LZ!`!aMr!a~LZqMyQ!bpwPOv'gx~'gaNUV!``OrNPrsLosvNPvwLow!aNP!a!bNk!b~NPaNpV!``OrNPrsLosvNPvwLow!`NP!`!a! V!a~NPa! ^R!``wPOr(]sv(]w~(]!R! nW!``!bpOrKjrsLZsvKjvwLowxNPx!`Kj!`!a!!W!a~Kj!R!!aT!``!bpwPOr(krs'gsv(kwx(]x~(k!V!!{VgS^P!``!bpOr&Rrs&qsv&Rwx'rx!^&R!^!_(k!_~&R",tokenizers:[Gt,Ct,Ut,qt,zt,0,1,2,3,4,5],topRules:{Document:[0,13]},dialects:{noMatch:0},tokenPrec:476});function Et(t,O){let e=Object.create(null);for(let a of t.firstChild.getChildren("Attribute")){let i=a.getChild("AttributeName"),r=a.getChild("AttributeValue")||a.getChild("UnquotedAttributeValue");i&&(e[O.read(i.from,i.to)]=r?r.name=="AttributeValue"?O.read(r.from+1,r.to-1):O.read(r.from,r.to):"")}return e}function OO(t,O,e){let a;for(let i of e)if(!i.attrs||i.attrs(a||(a=Et(t.node.parent,O))))return{parser:i.parser};return null}function It(t){let O=[],e=[],a=[];for(let i of t){let r=i.tag=="script"?O:i.tag=="style"?e:i.tag=="textarea"?a:null;if(!r)throw new RangeError("Only script, style, and textarea tags can host nested parsers");r.push(i)}return _e((i,r)=>{let s=i.type.id;return s==bt?OO(i,r,O):s==Pt?OO(i,r,e):s==Rt?OO(i,r,a):null})}const At=93,UO=1,Nt=94,Dt=95,YO=2,le=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Lt=58,Ft=40,Qe=95,Jt=91,A=45,Mt=46,Bt=35,Kt=37;function F(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Ht(t){return t>=48&&t<=57}const Oa=new b((t,O)=>{for(let e=!1,a=0,i=0;;i++){let{next:r}=t;if(F(r)||r==A||r==Qe||e&&Ht(r))!e&&(r!=A||i>0)&&(e=!0),a===i&&r==A&&a++,t.advance();else{e&&t.acceptToken(r==Ft?Nt:a==2&&O.canShift(YO)?YO:Dt);break}}}),ea=new b(t=>{if(le.includes(t.peek(-1))){let{next:O}=t;(F(O)||O==Qe||O==Bt||O==Mt||O==Jt||O==Lt||O==A)&&t.acceptToken(At)}}),ta=new b(t=>{if(!le.includes(t.peek(-1))){let{next:O}=t;if(O==Kt&&(t.advance(),t.acceptToken(UO)),F(O)){do t.advance();while(F(t.next));t.acceptToken(UO)}}}),aa=QO({"AtKeyword import charset namespace keyframes media supports":o.definitionKeyword,"from to selector":o.keyword,NamespaceName:o.namespace,KeyframeName:o.labelName,TagName:o.tagName,ClassName:o.className,PseudoClassName:o.constant(o.className),IdName:o.labelName,"FeatureName PropertyName":o.propertyName,AttributeName:o.attributeName,NumberLiteral:o.number,KeywordQuery:o.keyword,UnaryQueryOp:o.operatorKeyword,"CallTag ValueName":o.atom,VariableName:o.variableName,Callee:o.operatorKeyword,Unit:o.unit,"UniversalSelector NestingSelector":o.definitionOperator,MatchOp:o.compareOperator,"ChildOp SiblingOp, LogicOp":o.logicOperator,BinOp:o.arithmeticOperator,Important:o.modifier,Comment:o.blockComment,ParenthesizedContent:o.special(o.name),ColorLiteral:o.color,StringLiteral:o.string,":":o.punctuation,"PseudoOp #":o.derefOperator,"; ,":o.separator,"( )":o.paren,"[ ]":o.squareBracket,"{ }":o.brace}),ia={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},ra={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},sa={__proto__:null,not:128,only:128,from:158,to:160},na=y.deserialize({version:14,states:"7WOYQ[OOOOQP'#Cd'#CdOOQP'#Cc'#CcO!ZQ[O'#CfO!}QXO'#CaO#UQ[O'#ChO#aQ[O'#DPO#fQ[O'#DTOOQP'#Ec'#EcO#kQdO'#DeO$VQ[O'#DrO#kQdO'#DtO$hQ[O'#DvO$sQ[O'#DyO$xQ[O'#EPO%WQ[O'#EROOQS'#Eb'#EbOOQS'#ES'#ESQYQ[OOOOQP'#Cg'#CgOOQP,59Q,59QO!ZQ[O,59QO%_Q[O'#EVO%yQWO,58{O&RQ[O,59SO#aQ[O,59kO#fQ[O,59oO%_Q[O,59sO%_Q[O,59uO%_Q[O,59vO'bQ[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO'iQWO,59SO'nQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO'sQ`O,59oOOQS'#Cp'#CpO#kQdO'#CqO'{QvO'#CsO)VQtO,5:POOQO'#Cx'#CxO'nQWO'#CwO)kQWO'#CyOOQS'#Ef'#EfOOQO'#Dh'#DhO)pQ[O'#DoO*OQWO'#EiO$xQ[O'#DmO*^QWO'#DpOOQO'#Ej'#EjO%|QWO,5:^O*cQpO,5:`OOQS'#Dx'#DxO*kQWO,5:bO*pQ[O,5:bOOQO'#D{'#D{O*xQWO,5:eO*}QWO,5:kO+VQWO,5:mOOQS-E8Q-E8QOOQP1G.l1G.lO+yQXO,5:qOOQO-E8T-E8TOOQS1G.g1G.gOOQP1G.n1G.nO'iQWO1G.nO'nQWO1G.nOOQP1G/V1G/VO,WQ`O1G/ZO,qQXO1G/_O-XQXO1G/aO-oQXO1G/bO.VQXO'#CdO.zQWO'#DaOOQS,59z,59zO/PQWO,59zO/XQ[O,59zO/`Q[O'#DOO/gQdO'#CoOOQP1G/Z1G/ZO#kQdO1G/ZO/nQpO,59]OOQS,59_,59_O#kQdO,59aO/vQWO1G/kOOQS,59c,59cO/{Q!bO,59eO0TQWO'#DhO0`QWO,5:TO0eQWO,5:ZO$xQ[O,5:VO$xQ[O'#EYO0mQWO,5;TO0xQWO,5:XO%_Q[O,5:[OOQS1G/x1G/xOOQS1G/z1G/zOOQS1G/|1G/|O1ZQWO1G/|O1`QdO'#D|OOQS1G0P1G0POOQS1G0V1G0VOOQS1G0X1G0XOOQP7+$Y7+$YOOQP7+$u7+$uO#kQdO7+$uO#kQdO,59{O1nQ[O'#EXO1xQWO1G/fOOQS1G/f1G/fO1xQWO1G/fO2QQXO'#EhO2XQWO,59jO2^QtO'#ETO3RQdO'#EeO3]QWO,59ZO3bQpO7+$uOOQS1G.w1G.wOOQS1G.{1G.{OOQS7+%V7+%VO3jQWO1G/PO#kQdO1G/oOOQO1G/u1G/uOOQO1G/q1G/qO3oQWO,5:tOOQO-E8W-E8WO3}QXO1G/vOOQS7+%h7+%hO4UQYO'#CsO%|QWO'#EZO4^QdO,5:hOOQS,5:h,5:hO4lQpO<O!c!}$w!}#O?[#O#P$w#P#Q?g#Q#R2U#R#T$w#T#U?r#U#c$w#c#d@q#d#o$w#o#pAQ#p#q2U#q#rA]#r#sAh#s#y$w#y#z%]#z$f$w$f$g%]$g#BY$w#BY#BZ%]#BZ$IS$w$IS$I_%]$I_$I|$w$I|$JO%]$JO$JT$w$JT$JU%]$JU$KV$w$KV$KW%]$KW&FU$w&FU&FV%]&FV~$wW$zQOy%Qz~%QW%VQoWOy%Qz~%Q~%bf#T~OX%QX^&v^p%Qpq&vqy%Qz#y%Q#y#z&v#z$f%Q$f$g&v$g#BY%Q#BY#BZ&v#BZ$IS%Q$IS$I_&v$I_$I|%Q$I|$JO&v$JO$JT%Q$JT$JU&v$JU$KV%Q$KV$KW&v$KW&FU%Q&FU&FV&v&FV~%Q~&}f#T~oWOX%QX^&v^p%Qpq&vqy%Qz#y%Q#y#z&v#z$f%Q$f$g&v$g#BY%Q#BY#BZ&v#BZ$IS%Q$IS$I_&v$I_$I|%Q$I|$JO&v$JO$JT%Q$JT$JU&v$JU$KV%Q$KV$KW&v$KW&FU%Q&FU&FV&v&FV~%Q^(fSOy%Qz#]%Q#]#^(r#^~%Q^(wSoWOy%Qz#a%Q#a#b)T#b~%Q^)YSoWOy%Qz#d%Q#d#e)f#e~%Q^)kSoWOy%Qz#c%Q#c#d)w#d~%Q^)|SoWOy%Qz#f%Q#f#g*Y#g~%Q^*_SoWOy%Qz#h%Q#h#i*k#i~%Q^*pSoWOy%Qz#T%Q#T#U*|#U~%Q^+RSoWOy%Qz#b%Q#b#c+_#c~%Q^+dSoWOy%Qz#h%Q#h#i+p#i~%Q^+wQ!VUoWOy%Qz~%Q~,QUOY+}Zr+}rs,ds#O+}#O#P,i#P~+}~,iOh~~,lPO~+}_,tWtPOy%Qz!Q%Q!Q![-^![!c%Q!c!i-^!i#T%Q#T#Z-^#Z~%Q^-cWoWOy%Qz!Q%Q!Q![-{![!c%Q!c!i-{!i#T%Q#T#Z-{#Z~%Q^.QWoWOy%Qz!Q%Q!Q![.j![!c%Q!c!i.j!i#T%Q#T#Z.j#Z~%Q^.qWfUoWOy%Qz!Q%Q!Q![/Z![!c%Q!c!i/Z!i#T%Q#T#Z/Z#Z~%Q^/bWfUoWOy%Qz!Q%Q!Q![/z![!c%Q!c!i/z!i#T%Q#T#Z/z#Z~%Q^0PWoWOy%Qz!Q%Q!Q![0i![!c%Q!c!i0i!i#T%Q#T#Z0i#Z~%Q^0pWfUoWOy%Qz!Q%Q!Q![1Y![!c%Q!c!i1Y!i#T%Q#T#Z1Y#Z~%Q^1_WoWOy%Qz!Q%Q!Q![1w![!c%Q!c!i1w!i#T%Q#T#Z1w#Z~%Q^2OQfUoWOy%Qz~%QY2XSOy%Qz!_%Q!_!`2e!`~%QY2lQzQoWOy%Qz~%QX2wQXPOy%Qz~%Q~3QUOY2}Zw2}wx,dx#O2}#O#P3d#P~2}~3gPO~2}_3oQbVOy%Qz~%Q~3zOa~_4RSUPjSOy%Qz!_%Q!_!`2e!`~%Q_4fUjS!PPOy%Qz!O%Q!O!P4x!P!Q%Q!Q![7_![~%Q^4}SoWOy%Qz!Q%Q!Q![5Z![~%Q^5bWoW#ZUOy%Qz!Q%Q!Q![5Z![!g%Q!g!h5z!h#X%Q#X#Y5z#Y~%Q^6PWoWOy%Qz{%Q{|6i|}%Q}!O6i!O!Q%Q!Q![6z![~%Q^6nSoWOy%Qz!Q%Q!Q![6z![~%Q^7RSoW#ZUOy%Qz!Q%Q!Q![6z![~%Q^7fYoW#ZUOy%Qz!O%Q!O!P5Z!P!Q%Q!Q![7_![!g%Q!g!h5z!h#X%Q#X#Y5z#Y~%Q_8ZQpVOy%Qz~%Q^8fUjSOy%Qz!O%Q!O!P4x!P!Q%Q!Q![7_![~%Q_8}S#WPOy%Qz!Q%Q!Q![5Z![~%Q~9`RjSOy%Qz{9i{~%Q~9nSoWOy9iyz9zz{:o{~9i~9}ROz9zz{:W{~9z~:ZTOz9zz{:W{!P9z!P!Q:j!Q~9z~:oOR~~:tUoWOy9iyz9zz{:o{!P9i!P!Q;W!Q~9i~;_QoWR~Oy%Qz~%Q^;jY#ZUOy%Qz!O%Q!O!P5Z!P!Q%Q!Q![7_![!g%Q!g!h5z!h#X%Q#X#Y5z#Y~%QX<_S]POy%Qz![%Q![!]RUOy%Qz!c%Q!c!}>e!}#T%Q#T#o>e#o~%QX>lY!YPoWOy%Qz}%Q}!O>e!O!Q%Q!Q![>e![!c%Q!c!}>e!}#T%Q#T#o>e#o~%QX?aQxPOy%Qz~%Q^?lQvUOy%Qz~%QX?uSOy%Qz#b%Q#b#c@R#c~%QX@WSoWOy%Qz#W%Q#W#X@d#X~%QX@kQ!`PoWOy%Qz~%QX@tSOy%Qz#f%Q#f#g@d#g~%QXAVQ!RPOy%Qz~%Q_AbQ!QVOy%Qz~%QZAmS!PPOy%Qz!_%Q!_!`2e!`~%Q",tokenizers:[ea,ta,Oa,0,1,2,3],topRules:{StyleSheet:[0,4]},specialized:[{term:94,get:t=>ia[t]||-1},{term:56,get:t=>ra[t]||-1},{term:95,get:t=>sa[t]||-1}],tokenPrec:1078});let eO=null;function tO(){if(!eO&&typeof document=="object"&&document.body){let t=[];for(let O in document.body.style)/[A-Z]|^-|^(item|length)$/.test(O)||t.push(O);eO=t.sort().map(O=>({type:"property",label:O}))}return eO||[]}const VO=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(t=>({type:"class",label:t})),EO=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),oa=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),k=/^[\w-]*/,la=t=>{let{state:O,pos:e}=t,a=z(O).resolveInner(e,-1);if(a.name=="PropertyName")return{from:a.from,options:tO(),validFor:k};if(a.name=="ValueName")return{from:a.from,options:EO,validFor:k};if(a.name=="PseudoClassName")return{from:a.from,options:VO,validFor:k};if(a.name=="TagName"){for(let{parent:s}=a;s;s=s.parent)if(s.name=="Block")return{from:a.from,options:tO(),validFor:k};return{from:a.from,options:oa,validFor:k}}if(!t.explicit)return null;let i=a.resolve(e),r=i.childBefore(e);return r&&r.name==":"&&i.name=="PseudoClassSelector"?{from:e,options:VO,validFor:k}:r&&r.name==":"&&i.name=="Declaration"||i.name=="ArgList"?{from:e,options:EO,validFor:k}:i.name=="Block"?{from:e,options:tO(),validFor:k}:null},nO=cO.define({name:"css",parser:na.configure({props:[uO.add({Declaration:V()}),dO.add({Block:HO})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Qa(){return new hO(nO,nO.data.of({autocomplete:la}))}const ca=1,IO=281,AO=2,ua=3,U=282,da=4,ha=283,NO=284,$a=286,pa=287,fa=5,ga=6,ma=1,Ta=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],ce=125,Sa=123,ba=59,DO=47,Pa=42,Ra=43,ka=45,xa=36,Xa=96,ya=92,Za=new Oe({start:!1,shift(t,O){return O==fa||O==ga||O==$a?t:O==pa},strict:!1}),Wa=new b((t,O)=>{let{next:e}=t;(e==ce||e==-1||O.context)&&O.canShift(NO)&&t.acceptToken(NO)},{contextual:!0,fallback:!0}),ja=new b((t,O)=>{let{next:e}=t,a;Ta.indexOf(e)>-1||e==DO&&((a=t.peek(1))==DO||a==Pa)||e!=ce&&e!=ba&&e!=-1&&!O.context&&O.canShift(IO)&&t.acceptToken(IO)},{contextual:!0}),wa=new b((t,O)=>{let{next:e}=t;if((e==Ra||e==ka)&&(t.advance(),e==t.next)){t.advance();let a=!O.context&&O.canShift(AO);t.acceptToken(a?AO:ua)}},{contextual:!0}),_a=new b(t=>{for(let O=!1,e=0;;e++){let{next:a}=t;if(a<0){e&&t.acceptToken(U);break}else if(a==Xa){e?t.acceptToken(U):t.acceptToken(ha,1);break}else if(a==Sa&&O){e==1?t.acceptToken(da,1):t.acceptToken(U,-1);break}else if(a==10&&e){t.advance(),t.acceptToken(U);break}else a==ya&&t.advance();O=a==xa,t.advance()}}),va=new b((t,O)=>{if(!(t.next!=101||!O.dialectEnabled(ma))){t.advance();for(let e=0;e<6;e++){if(t.next!="xtends".charCodeAt(e))return;t.advance()}t.next>=57&&t.next<=65||t.next>=48&&t.next<=90||t.next==95||t.next>=97&&t.next<=122||t.next>160||t.acceptToken(ca)}}),qa=QO({"get set async static":o.modifier,"for while do if else switch try catch finally return throw break continue default case":o.controlKeyword,"in of await yield void typeof delete instanceof":o.operatorKeyword,"let var const function class extends":o.definitionKeyword,"import export from":o.moduleKeyword,"with debugger as new":o.keyword,TemplateString:o.special(o.string),super:o.atom,BooleanLiteral:o.bool,this:o.self,null:o.null,Star:o.modifier,VariableName:o.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":o.function(o.variableName),VariableDefinition:o.definition(o.variableName),Label:o.labelName,PropertyName:o.propertyName,PrivatePropertyName:o.special(o.propertyName),"CallExpression/MemberExpression/PropertyName":o.function(o.propertyName),"FunctionDeclaration/VariableDefinition":o.function(o.definition(o.variableName)),"ClassDeclaration/VariableDefinition":o.definition(o.className),PropertyDefinition:o.definition(o.propertyName),PrivatePropertyDefinition:o.definition(o.special(o.propertyName)),UpdateOp:o.updateOperator,LineComment:o.lineComment,BlockComment:o.blockComment,Number:o.number,String:o.string,ArithOp:o.arithmeticOperator,LogicOp:o.logicOperator,BitOp:o.bitwiseOperator,CompareOp:o.compareOperator,RegExp:o.regexp,Equals:o.definitionOperator,Arrow:o.function(o.punctuation),": Spread":o.punctuation,"( )":o.paren,"[ ]":o.squareBracket,"{ }":o.brace,"InterpolationStart InterpolationEnd":o.special(o.brace),".":o.derefOperator,", ;":o.separator,TypeName:o.typeName,TypeDefinition:o.definition(o.typeName),"type enum interface implements namespace module declare":o.definitionKeyword,"abstract global Privacy readonly override":o.modifier,"is keyof unique infer":o.operatorKeyword,JSXAttributeValue:o.attributeValue,JSXText:o.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":o.angleBracket,"JSXIdentifier JSXNameSpacedName":o.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":o.attributeName}),za={__proto__:null,export:18,as:23,from:29,default:32,async:37,function:38,this:48,true:56,false:56,void:66,typeof:70,null:86,super:88,new:122,await:139,yield:141,delete:142,class:152,extends:154,public:197,private:197,protected:197,readonly:199,instanceof:220,in:222,const:224,import:256,keyof:307,unique:311,infer:317,is:351,abstract:371,implements:373,type:375,let:378,var:380,interface:387,enum:391,namespace:397,module:399,declare:403,global:407,for:428,of:437,while:440,with:444,do:448,if:452,else:454,switch:458,case:464,try:470,catch:474,finally:478,return:482,throw:486,break:490,continue:494,debugger:498},Ga={__proto__:null,async:109,get:111,set:113,public:161,private:161,protected:161,static:163,abstract:165,override:167,readonly:173,new:355},Ca={__proto__:null,"<":129},Ua=y.deserialize({version:14,states:"$8SO`QdOOO'QQ(C|O'#ChO'XOWO'#DVO)dQdO'#D]O)tQdO'#DhO){QdO'#DrO-xQdO'#DxOOQO'#E]'#E]O.]Q`O'#E[O.bQ`O'#E[OOQ(C['#Ef'#EfO0aQ(C|O'#ItO2wQ(C|O'#IuO3eQ`O'#EzO3jQ!bO'#FaOOQ(C['#FS'#FSO3rO#tO'#FSO4QQ&jO'#FhO5bQ`O'#FgOOQ(C['#Iu'#IuOOQ(CW'#It'#ItOOQS'#J^'#J^O5gQ`O'#HpO5lQ(ChO'#HqOOQS'#Ih'#IhOOQS'#Hr'#HrQ`QdOOO){QdO'#DjO5tQ`O'#G[O5yQ&jO'#CmO6XQ`O'#EZO6dQ`O'#EgO6iQ,UO'#FRO7TQ`O'#G[O7YQ`O'#G`O7eQ`O'#G`O7sQ`O'#GcO7sQ`O'#GdO7sQ`O'#GfO5tQ`O'#GiO8dQ`O'#GlO9rQ`O'#CdO:SQ`O'#GyO:[Q`O'#HPO:[Q`O'#HRO`QdO'#HTO:[Q`O'#HVO:[Q`O'#HYO:aQ`O'#H`O:fQ(CjO'#HfO){QdO'#HhO:qQ(CjO'#HjO:|Q(CjO'#HlO5lQ(ChO'#HnO){QdO'#DWOOOW'#Ht'#HtO;XOWO,59qOOQ(C[,59q,59qO=jQtO'#ChO=tQdO'#HuO>XQ`O'#IvO@WQtO'#IvO'dQdO'#IvO@_Q`O,59wO@uQ7[O'#DbOAnQ`O'#E]OA{Q`O'#JROBWQ`O'#JQOBWQ`O'#JQOB`Q`O,5:yOBeQ`O'#JPOBlQaO'#DyO5yQ&jO'#EZOBzQ`O'#EZOCVQpO'#FROOQ(C[,5:S,5:SOC_QdO,5:SOE]Q(C|O,5:^OEyQ`O,5:dOFdQ(ChO'#JOO7YQ`O'#I}OFkQ`O'#I}OFsQ`O,5:xOFxQ`O'#I}OGWQdO,5:vOIWQ&jO'#EWOJeQ`O,5:vOKwQ&jO'#DlOLOQdO'#DqOLYQ7[O,5;PO){QdO,5;POOQS'#Er'#ErOOQS'#Et'#EtO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;RO){QdO,5;ROOQS'#Ex'#ExOLbQdO,5;cOOQ(C[,5;h,5;hOOQ(C[,5;i,5;iONbQ`O,5;iOOQ(C[,5;j,5;jO){QdO'#IPONgQ(ChO,5[OOQS'#Ik'#IkOOQS,5>],5>]OOQS-E;p-E;pO!+kQ(C|O,5:UOOQ(CX'#Cp'#CpO!,[Q&kO,5Q,5>QO){QdO,5>QO5lQ(ChO,5>SOOQS,5>U,5>UO!8cQ`O,5>UOOQS,5>W,5>WO!8cQ`O,5>WOOQS,5>Y,5>YO!8hQpO,59rOOOW-E;r-E;rOOQ(C[1G/]1G/]O!8mQtO,5>aO'dQdO,5>aOOQO,5>f,5>fO!8wQdO'#HuOOQO-E;s-E;sO!9UQ`O,5?bO!9^QtO,5?bO!9eQ`O,5?lOOQ(C[1G/c1G/cO!9mQ!bO'#DTOOQO'#Ix'#IxO){QdO'#IxO!:[Q!bO'#IxO!:yQ!bO'#DcO!;[Q7[O'#DcO!=gQdO'#DcO!=nQ`O'#IwO!=vQ`O,59|O!={Q`O'#EaO!>ZQ`O'#JSO!>cQ`O,5:zO!>yQ7[O'#DcO){QdO,5?mO!?TQ`O'#HzOOQO-E;x-E;xO!9eQ`O,5?lOOQ(CW1G0e1G0eO!@aQ7[O'#D|OOQ(C[,5:e,5:eO){QdO,5:eOIWQ&jO,5:eO!@hQaO,5:eO:aQ`O,5:uO!-OQ!bO,5:uO!-WQ&jO,5:uO5yQ&jO,5:uOOQ(C[1G/n1G/nOOQ(C[1G0O1G0OOOQ(CW'#EV'#EVO){QdO,5?jO!@sQ(ChO,5?jO!AUQ(ChO,5?jO!A]Q`O,5?iO!AeQ`O'#H|O!A]Q`O,5?iOOQ(CW1G0d1G0dO7YQ`O,5?iOOQ(C[1G0b1G0bO!BPQ(C|O1G0bO!CRQ(CyO,5:rOOQ(C]'#Fq'#FqO!CoQ(C}O'#IqOGWQdO1G0bO!EqQ,VO'#IyO!E{Q`O,5:WO!FQQtO'#IzO){QdO'#IzO!F[Q`O,5:]OOQ(C]'#DT'#DTOOQ(C[1G0k1G0kO!FaQ`O1G0kO!HrQ(C|O1G0mO!HyQ(C|O1G0mO!K^Q(C|O1G0mO!KeQ(C|O1G0mO!MlQ(C|O1G0mO!NPQ(C|O1G0mO#!pQ(C|O1G0mO#!wQ(C|O1G0mO#%[Q(C|O1G0mO#%cQ(C|O1G0mO#'WQ(C|O1G0mO#*QQMlO'#ChO#+{QMlO1G0}O#-vQMlO'#IuOOQ(C[1G1T1G1TO#.ZQ(C|O,5>kOOQ(CW-E;}-E;}O#.zQ(C}O1G0mOOQ(C[1G0m1G0mO#1PQ(C|O1G1QO#1pQ!bO,5;sO#1uQ!bO,5;tO#1zQ!bO'#F[O#2`Q`O'#FZOOQO'#JW'#JWOOQO'#H}'#H}O#2eQ!bO1G1]OOQ(C[1G1]1G1]OOOO1G1f1G1fO#2sQMlO'#ItO#2}Q`O,5;}OLbQdO,5;}OOOO-E;|-E;|OOQ(C[1G1Y1G1YOOQ(C[,5PQtO1G1VOOQ(C[1G1X1G1XO5tQ`O1G2}O#>WQ`O1G2}O#>]Q`O1G2}O#>bQ`O1G2}OOQS1G2}1G2}O#>gQ&kO1G2bO7YQ`O'#JQO7YQ`O'#EaO7YQ`O'#IWO#>xQ(ChO,5?yOOQS1G2f1G2fO!0VQ`O1G2lOIWQ&jO1G2iO#?TQ`O1G2iOOQS1G2j1G2jOIWQ&jO1G2jO#?YQaO1G2jO#?bQ7[O'#GhOOQS1G2l1G2lO!'VQ7[O'#IYO!0[QpO1G2oOOQS1G2o1G2oOOQS,5=Y,5=YO#?jQ&kO,5=[O5tQ`O,5=[O#6SQ`O,5=_O5bQ`O,5=_O!-OQ!bO,5=_O!-WQ&jO,5=_O5yQ&jO,5=_O#?{Q`O'#JaO#@WQ`O,5=`OOQS1G.j1G.jO#@]Q(ChO1G.jO#@hQ`O1G.jO#@mQ`O1G.jO5lQ(ChO1G.jO#@uQtO,5@OO#APQ`O,5@OO#A[QdO,5=gO#AcQ`O,5=gO7YQ`O,5@OOOQS1G3P1G3PO`QdO1G3POOQS1G3V1G3VOOQS1G3X1G3XO:[Q`O1G3ZO#AhQdO1G3]O#EcQdO'#H[OOQS1G3`1G3`O#EpQ`O'#HbO:aQ`O'#HdOOQS1G3f1G3fO#ExQdO1G3fO5lQ(ChO1G3lOOQS1G3n1G3nOOQ(CW'#Fx'#FxO5lQ(ChO1G3pO5lQ(ChO1G3rOOOW1G/^1G/^O#IvQpO,5aO#JYQ`O1G4|O#JbQ`O1G5WO#JjQ`O,5?dOLbQdO,5:{O7YQ`O,5:{O:aQ`O,59}OLbQdO,59}O!-OQ!bO,59}O#JoQMlO,59}OOQO,5:{,5:{O#JyQ7[O'#HvO#KaQ`O,5?cOOQ(C[1G/h1G/hO#KiQ7[O'#H{O#K}Q`O,5?nOOQ(CW1G0f1G0fO!;[Q7[O,59}O#LVQtO1G5XO7YQ`O,5>fOOQ(CW'#ES'#ESO#LaQ(DjO'#ETO!@XQ7[O'#D}OOQO'#Hy'#HyO#L{Q7[O,5:hOOQ(C[,5:h,5:hO#MSQ7[O'#D}O#MeQ7[O'#D}O#MlQ7[O'#EYO#MoQ7[O'#ETO#M|Q7[O'#ETO!@XQ7[O'#ETO#NaQ`O1G0PO#NfQqO1G0POOQ(C[1G0P1G0PO){QdO1G0POIWQ&jO1G0POOQ(C[1G0a1G0aO:aQ`O1G0aO!-OQ!bO1G0aO!-WQ&jO1G0aO#NmQ(C|O1G5UO){QdO1G5UO#N}Q(ChO1G5UO$ `Q`O1G5TO7YQ`O,5>hOOQO,5>h,5>hO$ hQ`O,5>hOOQO-E;z-E;zO$ `Q`O1G5TO$ vQ(C}O,59jO$#xQ(C}O,5m,5>mO$-rQ`O,5>mOOQ(C]1G2P1G2PP$-wQ`O'#IRPOQ(C]-Eo,5>oOOQO-Ep,5>pOOQO-Ex,5>xOOQO-E<[-E<[OOQ(C[7+&q7+&qO$6OQ`O7+(iO5lQ(ChO7+(iO5tQ`O7+(iO$6TQ`O7+(iO$6YQaO7+'|OOQ(CW,5>r,5>rOOQ(CW-Et,5>tOOQO-EO,5>OOOQS7+)Q7+)QOOQS7+)W7+)WOOQS7+)[7+)[OOQS7+)^7+)^OOQO1G5O1G5OO$:nQMlO1G0gO$:xQ`O1G0gOOQO1G/i1G/iO$;TQMlO1G/iO:aQ`O1G/iOLbQdO'#DcOOQO,5>b,5>bOOQO-E;t-E;tOOQO,5>g,5>gOOQO-E;y-E;yO!-OQ!bO1G/iO:aQ`O,5:iOOQO,5:o,5:oO){QdO,5:oO$;_Q(ChO,5:oO$;jQ(ChO,5:oO!-OQ!bO,5:iOOQO-E;w-E;wOOQ(C[1G0S1G0SO!@XQ7[O,5:iO$;xQ7[O,5:iO$PQ`O7+*oO$>XQ(C}O1G2[O$@^Q(C}O1G2^O$BcQ(C}O1G1yO$DnQ,VO,5>cOOQO-E;u-E;uO$DxQtO,5>dO){QdO,5>dOOQO-E;v-E;vO$ESQ`O1G5QO$E[QMlO1G0bO$GcQMlO1G0mO$GjQMlO1G0mO$IkQMlO1G0mO$IrQMlO1G0mO$KgQMlO1G0mO$KzQMlO1G0mO$NXQMlO1G0mO$N`QMlO1G0mO%!aQMlO1G0mO%!hQMlO1G0mO%$]QMlO1G0mO%$pQ(C|O<kOOOO7+'T7+'TOOOW1G/R1G/ROOQ(C]1G4X1G4XOJjQ&jO7+'zO%*VQ`O,5>lO5tQ`O,5>lOOQO-EnO%+dQ`O,5>nOIWQ&jO,5>nOOQO-Ew,5>wO%.vQ`O,5>wO%.{Q`O,5>wOOQO-EvOOQO-EqOOQO-EsOOQO-E{AN>{OOQOAN>uAN>uO%3rQ(C|OAN>{O:aQ`OAN>uO){QdOAN>{O!-OQ!bOAN>uO&)wQ(ChOAN>{O&*SQ(C}OG26lOOQ(CWG26bG26bOOQS!$( t!$( tOOQO<QQ`O'#E[O&>YQ`O'#EzO&>_Q`O'#EgO&>dQ`O'#JRO&>oQ`O'#JPO&>zQ`O,5:vO&?PQ,VO,5aO!O&PO~Ox&SO!W&^O!X&VO!Y&VO'^$dO~O]&TOk&TO!Q&WO'g&QO!S'kP!S'vP~P@dO!O'sX!R'sX!]'sX!c'sX'p'sX~O!{'sX#W#PX!S'sX~PA]O!{&_O!O'uX!R'uX~O!R&`O!O'tX~O!O&cO~O!{#eO~PA]OP&gO!T&dO!o&fO']$bO~Oc&lO!d$ZO']$bO~Ou$oO!d$nO~O!S&mO~P`Ou!{Ov!{Ox!|O!b!yO!d!zO'fQOQ!faZ!faj!fa!R!fa!a!fa!j!fa#[!fa#]!fa#^!fa#_!fa#`!fa#a!fa#b!fa#c!fa#e!fa#g!fa#i!fa#j!fa'p!fa'w!fa'x!fa~O_!fa'W!fa!O!fa!c!fan!fa!T!fa%Q!fa!]!fa~PCfO!c&nO~O!]!wO!{&pO'p&oO!R'rX_'rX'W'rX~O!c'rX~PFOO!R&tO!c'qX~O!c&vO~Ox$uO!T$vO#V&wO']$bO~OQTORTO]cOb!kOc!jOhcOjTOkcOlcOqTOsTOxRO{cO|cO}cO!TSO!_kO!dUO!gTO!hTO!iTO!jTO!kTO!n!iO#t!lO#x^O']9aO'fQO'oYO'|aO~O]#qOh$QOj#rOk#qOl#qOq$ROs9tOx#yO!T#zO!_;eO!d#vO#V9}O#t$VO$_9wO$a9zO$d$WO']&{O'b$PO'f#sO~O#W&}O~O]#qOh$QOj#rOk#qOl#qOq$ROs$SOx#yO!T#zO!_$XO!d#vO#V$YO#t$VO$_$TO$a$UO$d$WO']&{O'b$PO'f#sO~O'a'mP~PJjO!Q'RO!c'nP~P){O'g'TO'oYO~OQ9^OR9^O]cOb;`Oc!jOhcOj9^OkcOlcOq9^Os9^OxRO{cO|cO}cO!T!bO!_9`O!dUO!g9^O!h9^O!i9^O!j9^O!k9^O!n!iO#t!lO#x^O']'cO'fQO'oYO'|;^O~O!d!zO~O!R#bO_$]a'W$]a!c$]a!O$]a!T$]a%Q$]a!]$]a~O#d'jO~PIWO!]'lO!T'yX#w'yX#z'yX$R'yX~Ou'mO~P! YOu'mO!T'yX#w'yX#z'yX$R'yX~O!T'oO#w'sO#z'nO$R'tO~O!Q'wO~PLbO#z#fO$R'zO~OP$eXu$eXx$eX!b$eX'w$eX'x$eX~OPfX!RfX!{fX'afX'a$eX~P!!rOk'|O~OS'}O'U(OO'V(QO~OP(ZOu(SOx(TO'w(VO'x(XO~O'a(RO~P!#{O'a([O~O]#qOh$QOj#rOk#qOl#qOq$ROs9tOx#yO!T#zO!_;eO!d#vO#V9}O#t$VO$_9wO$a9zO$d$WO'b$PO'f#sO~O!Q(`O'](]O!c'}P~P!$jO#W(bO~O!d(cO~O!Q(hO'](eO!O(OP~P!$jOj(uOx(mO!W(sO!X(lO!Y(lO!d(cO!x(tO$w(oO'^$dO'g(jO~O!S(rO~P!&jO!b!yOP'eXu'eXx'eX'w'eX'x'eX!R'eX!{'eX~O'a'eX#m'eX~P!'cOP(xO!{(wO!R'dX'a'dX~O!R(yO'a'cX~O']${O'a'cP~O'](|O~O!d)RO~O']&{O~Ox$uO!Q!rO!T$vO#U!uO#V!rO']$bO!c'qP~O!]!wO#W)VO~OQ#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO#i#YO#j#ZO'fQO'p#[O'w!}O'x#OO~O_!^a!R!^a'W!^a!O!^a!c!^an!^a!T!^a%Q!^a!]!^a~P!)wOP)_O!T&dO!o)^O%Q)]O'b$PO~O!])aO!T'`X_'`X!R'`X'W'`X~O!d$ZO'b$PO~O!d$ZO']$bO'b$PO~O!]!wO#W&}O~O])lO%R)mO'])iO!S(VP~O!R)nO^(UX~O'g'TO~OZ)rO~O^)sO~O!T$lO']$bO'^$dO^(UP~Ox$uO!Q)xO!R&`O!T$vO']$bO!O'tP~O]&ZOk&ZO!Q)yO'g'TO!S'vP~O!R)zO_(RX'W(RX~O!{*OO'b$PO~OP*RO!T#zO'b$PO~O!T*TO~Ou*VO!TSO~O!n*[O~Oc*aO~O'](|O!S(TP~Oc$jO~O%RtO']${O~P8wOZ*gO^*fO~OQTORTO]cObnOcmOhcOjTOkcOlcOqTOsTOxRO{cO|cO}cO!_kO!dUO!gTO!hTO!iTO!jTO!kTO!nlO#x^O%PqO'fQO'oYO'|aO~O!T!bO#t!lO']9aO~P!1_O^*fO_$^O'W$^O~O_*kO#d*mO%T*mO%U*mO~P){O!d%`O~O%t*rO~O!T*tO~O&V*vO&X*wOQ&SaR&SaX&Sa]&Sa_&Sab&Sac&Sah&Saj&Sak&Sal&Saq&Sas&Sax&Sa{&Sa|&Sa}&Sa!T&Sa!_&Sa!d&Sa!g&Sa!h&Sa!i&Sa!j&Sa!k&Sa!n&Sa#d&Sa#t&Sa#x&Sa%P&Sa%R&Sa%T&Sa%U&Sa%X&Sa%Z&Sa%^&Sa%_&Sa%a&Sa%n&Sa%t&Sa%v&Sa%x&Sa%z&Sa%}&Sa&T&Sa&Z&Sa&]&Sa&_&Sa&a&Sa&c&Sa'S&Sa']&Sa'f&Sa'o&Sa'|&Sa!S&Sa%{&Sa`&Sa&Q&Sa~O']*|O~On+PO~O!O&ia!R&ia~P!)wO!Q+TO!O&iX!R&iX~P){O!R%zO!O'ja~O!O'ja~P>aO!R&`O!O'ta~O!RwX!R!ZX!SwX!S!ZX!]wX!]!ZX!d!ZX!{wX'b!ZX~O!]+YO!{+XO!R#TX!R'lX!S#TX!S'lX!]'lX!d'lX'b'lX~O!]+[O!d$ZO'b$PO!R!VX!S!VX~O]&ROk&ROx&SO'g(jO~OQ9^OR9^O]cOb;`Oc!jOhcOj9^OkcOlcOq9^Os9^OxRO{cO|cO}cO!T!bO!_9`O!dUO!g9^O!h9^O!i9^O!j9^O!k9^O!n!iO#t!lO#x^O'fQO'oYO'|;^O~O']:SO~P!;jO!R+`O!S'kX~O!S+bO~O!]+YO!{+XO!R#TX!S#TX~O!R+cO!S'vX~O!S+eO~O]&ROk&ROx&SO'^$dO'g(jO~O!X+fO!Y+fO~P!>hOx$uO!Q+hO!T$vO']$bO!O&nX!R&nX~O_+lO!W+oO!X+kO!Y+kO!r+sO!s+qO!t+rO!u+pO!x+tO'^$dO'g(jO'o+iO~O!S+nO~P!?iOP+yO!T&dO!o+xO~O!{,PO!R'ra!c'ra_'ra'W'ra~O!]!wO~P!@sO!R&tO!c'qa~Ox$uO!Q,SO!T$vO#U,UO#V,SO']$bO!R&pX!c&pX~O_#Oi!R#Oi'W#Oi!O#Oi!c#Oin#Oi!T#Oi%Q#Oi!]#Oi~P!)wOP;tOu(SOx(TO'w(VO'x(XO~O#W!za!R!za!c!za!{!za!T!za_!za'W!za!O!za~P!BpO#W'eXQ'eXZ'eX_'eXj'eXv'eX!a'eX!d'eX!j'eX#['eX#]'eX#^'eX#_'eX#`'eX#a'eX#b'eX#c'eX#e'eX#g'eX#i'eX#j'eX'W'eX'f'eX'p'eX!c'eX!O'eX!T'eXn'eX%Q'eX!]'eX~P!'cO!R,_O'a'mX~P!#{O'a,aO~O!R,bO!c'nX~P!)wO!c,eO~O!O,fO~OQ#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O'fQOZ#Zi_#Zij#Zi!R#Zi!a#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O#[#Zi~P!FfO#[#PO~P!FfOQ#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO'fQOZ#Zi_#Zi!R#Zi!a#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~Oj#Zi~P!IQOj#RO~P!IQOQ#^Oj#ROu!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO'fQO_#Zi!R#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'w#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~OZ#Zi!a#Zi#a#Zi#b#Zi#c#Zi~P!KlOZ#dO!a#TO#a#TO#b#TO#c#TO~P!KlOQ#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO'fQO_#Zi!R#Zi#g#Zi#i#Zi#j#Zi'W#Zi'p#Zi'x#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O'w#Zi~P!NdO'w!}O~P!NdOQ#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO'fQO'w!}O_#Zi!R#Zi#i#Zi#j#Zi'W#Zi'p#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~O'x#Zi~P##OO'x#OO~P##OOQ#^OZ#dOj#ROu!{Ov!{Ox!|O!a#TO!b!yO!d!zO!j#^O#[#PO#]#QO#^#QO#_#QO#`#SO#a#TO#b#TO#c#TO#e#UO#g#WO#i#YO'fQO'w!}O'x#OO~O_#Zi!R#Zi#j#Zi'W#Zi'p#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~P#%jOQ[XZ[Xj[Xu[Xv[Xx[X!a[X!b[X!d[X!j[X!{[X#WdX#[[X#][X#^[X#_[X#`[X#a[X#b[X#c[X#e[X#g[X#i[X#j[X#o[X'f[X'p[X'w[X'x[X!R[X!S[X~O#m[X~P#'}OQ#^OZ9rOj9gOu!{Ov!{Ox!|O!a9iO!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO#`9hO#a9iO#b9iO#c9iO#e9jO#g9lO#i9nO#j9oO'fQO'p#[O'w!}O'x#OO~O#m,hO~P#*XOQ'iXZ'iXj'iXu'iXv'iXx'iX!a'iX!b'iX!d'iX!j'iX#['iX#]'iX#^'iX#_'iX#`'iX#a'iX#b'iX#e'iX#g'iX#i'iX#j'iX'f'iX'p'iX'w'iX'x'iX!R'iX~O!{9sO#o9sO#c'iX#m'iX!S'iX~P#,SO_&sa!R&sa'W&sa!c&san&sa!O&sa!T&sa%Q&sa!]&sa~P!)wOQ#ZiZ#Zi_#Zij#Ziv#Zi!R#Zi!a#Zi!b#Zi!d#Zi!j#Zi#[#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi'W#Zi'f#Zi'p#Zi!O#Zi!c#Zin#Zi!T#Zi%Q#Zi!]#Zi~P!BpO_#ni!R#ni'W#ni!O#ni!c#nin#ni!T#ni%Q#ni!]#ni~P!)wO#z,jO~O#z,kO~O!]'lO!{,lO!T$OX#w$OX#z$OX$R$OX~O!Q,mO~O!T'oO#w,oO#z'nO$R,pO~O!R9pO!S'hX~P#*XO!S,qO~O$R,sO~OS'}O'U(OO'V,vO~O],yOk,yO!O,zO~O!RdX!]dX!cdX!c$eX'pdX~P!!rO!c-QO~P!BpO!R-RO!]!wO'p&oO!c'}X~O!c-WO~O!Q(`O']$bO!c'}P~O#W-YO~O!O$eX!R$eX!]$lX~P!!rO!R-ZO!O(OX~P!BpO!]-]O~O!O-_O~Oj-cO!]!wO!d$ZO'b$PO'p&oO~O!])aO~O_$^O!R-hO'W$^O~O!S-jO~P!&jO!X-kO!Y-kO'^$dO'g(jO~Ox-mO'g(jO~O!x-nO~O']${O!R&xX'a&xX~O!R(yO'a'ca~O'a-sO~Ou-tOv-tOx-uOPra'wra'xra!Rra!{ra~O'ara#mra~P#7pOu(SOx(TOP$^a'w$^a'x$^a!R$^a!{$^a~O'a$^a#m$^a~P#8fOu(SOx(TOP$`a'w$`a'x$`a!R$`a!{$`a~O'a$`a#m$`a~P#9XO]-vO~O#W-wO~O'a$na!R$na!{$na#m$na~P!#{O#W-zO~OP.TO!T&dO!o.SO%Q.RO~O]#qOj#rOk#qOl#qOq$ROs9tOx#yO!T#zO!_;eO!d#vO#V9}O#t$VO$_9wO$a9zO$d$WO'b$PO'f#sO~Oh.VO'].UO~P#:yO!])aO!T'`a_'`a!R'`a'W'`a~O#W.]O~OZ[X!RdX!SdX~O!R.^O!S(VX~O!S.`O~OZ.aO~O].cO'])iO~O!T$lO']$bO^'QX!R'QX~O!R)nO^(Ua~O!c.fO~P!)wO].hO~OZ.iO~O^.jO~OP.TO!T&dO!o.SO%Q.RO'b$PO~O!R)zO_(Ra'W(Ra~O!{.pO~OP.sO!T#zO~O'g'TO!S(SP~OP.}O!T.yO!o.|O%Q.{O'b$PO~OZ/XO!R/VO!S(TX~O!S/YO~O^/[O_$^O'W$^O~O]/]O~O]/^O'](|O~O#c/_O%r/`O~P0zO!{#eO#c/_O%r/`O~O_/aO~P){O_/cO~O%{/gOQ%yiR%yiX%yi]%yi_%yib%yic%yih%yij%yik%yil%yiq%yis%yix%yi{%yi|%yi}%yi!T%yi!_%yi!d%yi!g%yi!h%yi!i%yi!j%yi!k%yi!n%yi#d%yi#t%yi#x%yi%P%yi%R%yi%T%yi%U%yi%X%yi%Z%yi%^%yi%_%yi%a%yi%n%yi%t%yi%v%yi%x%yi%z%yi%}%yi&T%yi&Z%yi&]%yi&_%yi&a%yi&c%yi'S%yi']%yi'f%yi'o%yi'|%yi!S%yi`%yi&Q%yi~O`/mO!S/kO&Q/lO~P`O!TSO!d/oO~O&X*wOQ&SiR&SiX&Si]&Si_&Sib&Sic&Sih&Sij&Sik&Sil&Siq&Sis&Six&Si{&Si|&Si}&Si!T&Si!_&Si!d&Si!g&Si!h&Si!i&Si!j&Si!k&Si!n&Si#d&Si#t&Si#x&Si%P&Si%R&Si%T&Si%U&Si%X&Si%Z&Si%^&Si%_&Si%a&Si%n&Si%t&Si%v&Si%x&Si%z&Si%}&Si&T&Si&Z&Si&]&Si&_&Si&a&Si&c&Si'S&Si']&Si'f&Si'o&Si'|&Si!S&Si%{&Si`&Si&Q&Si~O!R#bOn$]a~O!O&ii!R&ii~P!)wO!R%zO!O'ji~O!R&`O!O'ti~O!O/uO~O!R!Va!S!Va~P#*XO]&ROk&RO!Q/{O'g(jO!R&jX!S&jX~P@dO!R+`O!S'ka~O]&ZOk&ZO!Q)yO'g'TO!R&oX!S&oX~O!R+cO!S'va~O!O'ui!R'ui~P!)wO_$^O!]!wO!d$ZO!j0VO!{0TO'W$^O'b$PO'p&oO~O!S0YO~P!?iO!X0ZO!Y0ZO'^$dO'g(jO'o+iO~O!W0[O~P#MSO!TSO!W0[O!u0^O!x0_O~P#MSO!W0[O!s0aO!t0aO!u0^O!x0_O~P#MSO!T&dO~O!T&dO~P!BpO!R'ri!c'ri_'ri'W'ri~P!)wO!{0jO!R'ri!c'ri_'ri'W'ri~O!R&tO!c'qi~Ox$uO!T$vO#V0lO']$bO~O#WraQraZra_rajra!ara!bra!dra!jra#[ra#]ra#^ra#_ra#`ra#ara#bra#cra#era#gra#ira#jra'Wra'fra'pra!cra!Ora!Tranra%Qra!]ra~P#7pO#W$^aQ$^aZ$^a_$^aj$^av$^a!a$^a!b$^a!d$^a!j$^a#[$^a#]$^a#^$^a#_$^a#`$^a#a$^a#b$^a#c$^a#e$^a#g$^a#i$^a#j$^a'W$^a'f$^a'p$^a!c$^a!O$^a!T$^an$^a%Q$^a!]$^a~P#8fO#W$`aQ$`aZ$`a_$`aj$`av$`a!a$`a!b$`a!d$`a!j$`a#[$`a#]$`a#^$`a#_$`a#`$`a#a$`a#b$`a#c$`a#e$`a#g$`a#i$`a#j$`a'W$`a'f$`a'p$`a!c$`a!O$`a!T$`an$`a%Q$`a!]$`a~P#9XO#W$naQ$naZ$na_$naj$nav$na!R$na!a$na!b$na!d$na!j$na#[$na#]$na#^$na#_$na#`$na#a$na#b$na#c$na#e$na#g$na#i$na#j$na'W$na'f$na'p$na!c$na!O$na!T$na!{$nan$na%Q$na!]$na~P!BpO_#Oq!R#Oq'W#Oq!O#Oq!c#Oqn#Oq!T#Oq%Q#Oq!]#Oq~P!)wO!R&kX'a&kX~PJjO!R,_O'a'ma~O!Q0tO!R&lX!c&lX~P){O!R,bO!c'na~O!R,bO!c'na~P!)wO#m!fa!S!fa~PCfO#m!^a!R!^a!S!^a~P#*XO!T1XO#x^O$P1YO~O!S1^O~On1_O~P!BpO_$Yq!R$Yq'W$Yq!O$Yq!c$Yqn$Yq!T$Yq%Q$Yq!]$Yq~P!)wO!O1`O~O],yOk,yO~Ou(SOx(TO'x(XOP$xi'w$xi!R$xi!{$xi~O'a$xi#m$xi~P$.POu(SOx(TOP$zi'w$zi'x$zi!R$zi!{$zi~O'a$zi#m$zi~P$.rO'p#[O~P!BpO!Q1cO']$bO!R&tX!c&tX~O!R-RO!c'}a~O!R-RO!]!wO!c'}a~O!R-RO!]!wO'p&oO!c'}a~O'a$gi!R$gi!{$gi#m$gi~P!#{O!Q1kO'](eO!O&vX!R&vX~P!$jO!R-ZO!O(Oa~O!R-ZO!O(Oa~P!BpO!]!wO~O!]!wO#c1sO~Oj1vO!]!wO'p&oO~O!R'di'a'di~P!#{O!{1yO!R'di'a'di~P!#{O!c1|O~O_$Zq!R$Zq'W$Zq!O$Zq!c$Zqn$Zq!T$Zq%Q$Zq!]$Zq~P!)wO!R2QO!T(PX~P!BpO!T&dO%Q2TO~O!T&dO%Q2TO~P!BpO!T$eX$u[X_$eX!R$eX'W$eX~P!!rO$u2XOPgXugXxgX!TgX'wgX'xgX_gX!RgX'WgX~O$u2XO~O]2_O%R2`O'])iO!R'PX!S'PX~O!R.^O!S(Va~OZ2dO~O^2eO~O]2hO~OP2jO!T&dO!o2iO%Q2TO~O_$^O'W$^O~P!BpO!T#zO~P!BpO!R2oO!{2qO!S(SX~O!S2rO~Ox;oO!W2{O!X2tO!Y2tO!r2zO!s2yO!t2yO!x2xO'^$dO'g(jO'o+iO~O!S2wO~P$7ZOP3SO!T.yO!o3RO%Q3QO~OP3SO!T.yO!o3RO%Q3QO'b$PO~O'](|O!R'OX!S'OX~O!R/VO!S(Ta~O]3^O'g3]O~O]3_O~O^3aO~O!c3dO~P){O_3fO~O_3fO~P){O#c3hO%r3iO~PFOO`/mO!S3mO&Q/lO~P`O!]3oO~O!R#Ti!S#Ti~P#*XO!{3qO!R#Ti!S#Ti~O!R!Vi!S!Vi~P#*XO_$^O!{3xO'W$^O~O_$^O!]!wO!{3xO'W$^O~O!X3|O!Y3|O'^$dO'g(jO'o+iO~O_$^O!]!wO!d$ZO!j3}O!{3xO'W$^O'b$PO'p&oO~O!W4OO~P$;xO!W4OO!u4RO!x4SO~P$;xO_$^O!]!wO!j3}O!{3xO'W$^O'p&oO~O!R'rq!c'rq_'rq'W'rq~P!)wO!R&tO!c'qq~O#W$xiQ$xiZ$xi_$xij$xiv$xi!a$xi!b$xi!d$xi!j$xi#[$xi#]$xi#^$xi#_$xi#`$xi#a$xi#b$xi#c$xi#e$xi#g$xi#i$xi#j$xi'W$xi'f$xi'p$xi!c$xi!O$xi!T$xin$xi%Q$xi!]$xi~P$.PO#W$ziQ$ziZ$zi_$zij$ziv$zi!a$zi!b$zi!d$zi!j$zi#[$zi#]$zi#^$zi#_$zi#`$zi#a$zi#b$zi#c$zi#e$zi#g$zi#i$zi#j$zi'W$zi'f$zi'p$zi!c$zi!O$zi!T$zin$zi%Q$zi!]$zi~P$.rO#W$giQ$giZ$gi_$gij$giv$gi!R$gi!a$gi!b$gi!d$gi!j$gi#[$gi#]$gi#^$gi#_$gi#`$gi#a$gi#b$gi#c$gi#e$gi#g$gi#i$gi#j$gi'W$gi'f$gi'p$gi!c$gi!O$gi!T$gi!{$gin$gi%Q$gi!]$gi~P!BpO!R&ka'a&ka~P!#{O!R&la!c&la~P!)wO!R,bO!c'ni~O#m#Oi!R#Oi!S#Oi~P#*XOQ#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O'fQOZ#Zij#Zi!a#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~O#[#Zi~P$EiO#[9eO~P$EiOQ#^Ou!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO'fQOZ#Zi!a#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~Oj#Zi~P$GqOj9gO~P$GqOQ#^Oj9gOu!{Ov!{Ox!|O!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO#`9hO'fQO#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'w#Zi'x#Zi!R#Zi!S#Zi~OZ#Zi!a#Zi#a#Zi#b#Zi#c#Zi~P$IyOZ9rO!a9iO#a9iO#b9iO#c9iO~P$IyOQ#^OZ9rOj9gOu!{Ov!{Ox!|O!a9iO!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO#`9hO#a9iO#b9iO#c9iO#e9jO'fQO#g#Zi#i#Zi#j#Zi#m#Zi'p#Zi'x#Zi!R#Zi!S#Zi~O'w#Zi~P$L_O'w!}O~P$L_OQ#^OZ9rOj9gOu!{Ov!{Ox!|O!a9iO!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO#`9hO#a9iO#b9iO#c9iO#e9jO#g9lO'fQO'w!}O#i#Zi#j#Zi#m#Zi'p#Zi!R#Zi!S#Zi~O'x#Zi~P$NgO'x#OO~P$NgOQ#^OZ9rOj9gOu!{Ov!{Ox!|O!a9iO!b!yO!d!zO!j#^O#[9eO#]9fO#^9fO#_9fO#`9hO#a9iO#b9iO#c9iO#e9jO#g9lO#i9nO'fQO'w!}O'x#OO~O#j#Zi#m#Zi'p#Zi!R#Zi!S#Zi~P%!oO_#ky!R#ky'W#ky!O#ky!c#kyn#ky!T#ky%Q#ky!]#ky~P!)wOP;vOu(SOx(TO'w(VO'x(XO~OQ#ZiZ#Zij#Ziv#Zi!a#Zi!b#Zi!d#Zi!j#Zi#[#Zi#]#Zi#^#Zi#_#Zi#`#Zi#a#Zi#b#Zi#c#Zi#e#Zi#g#Zi#i#Zi#j#Zi#m#Zi'f#Zi'p#Zi!R#Zi!S#Zi~P%%aO!b!yOP'eXu'eXx'eX'w'eX'x'eX!S'eX~OQ'eXZ'eXj'eXv'eX!a'eX!d'eX!j'eX#['eX#]'eX#^'eX#_'eX#`'eX#a'eX#b'eX#c'eX#e'eX#g'eX#i'eX#j'eX#m'eX'f'eX'p'eX!R'eX~P%'eO#m#ni!R#ni!S#ni~P#*XO!S4eO~O!R&sa!S&sa~P#*XO!]!wO'p&oO!R&ta!c&ta~O!R-RO!c'}i~O!R-RO!]!wO!c'}i~O'a$gq!R$gq!{$gq#m$gq~P!#{O!O&va!R&va~P!BpO!]4lO~O!R-ZO!O(Oi~P!BpO!R-ZO!O(Oi~O!O4pO~O!]!wO#c4uO~Oj4vO!]!wO'p&oO~O!O4xO~O'a$iq!R$iq!{$iq#m$iq~P!#{O_$Zy!R$Zy'W$Zy!O$Zy!c$Zyn$Zy!T$Zy%Q$Zy!]$Zy~P!)wO!R2QO!T(Pa~O!T&dO%Q4}O~O!T&dO%Q4}O~P!BpO_#Oy!R#Oy'W#Oy!O#Oy!c#Oyn#Oy!T#Oy%Q#Oy!]#Oy~P!)wOZ5QO~O]5SO'])iO~O!R.^O!S(Vi~O]5VO~O^5WO~O'g'TO!R&{X!S&{X~O!R2oO!S(Sa~O!S5eO~P$7ZOx;sO'g(jO'o+iO~O!W5hO!X5gO!Y5gO!x0_O'^$dO'g(jO'o+iO~O!s5iO!t5iO~P%0^O!X5gO!Y5gO'^$dO'g(jO'o+iO~O!T.yO~O!T.yO%Q5kO~O!T.yO%Q5kO~P!BpOP5pO!T.yO!o5oO%Q5kO~OZ5uO!R'Oa!S'Oa~O!R/VO!S(Ti~O]5xO~O!c5yO~O!c5zO~O!c5{O~O!c5{O~P){O_5}O~O!]6QO~O!c6RO~O!R'ui!S'ui~P#*XO_$^O'W$^O~P!)wO_$^O!{6WO'W$^O~O_$^O!]!wO!{6WO'W$^O~O!X6]O!Y6]O'^$dO'g(jO'o+iO~O_$^O!]!wO!j6^O!{6WO'W$^O'p&oO~O!d$ZO'b$PO~P%4xO!W6_O~P%4gO!R'ry!c'ry_'ry'W'ry~P!)wO#W$gqQ$gqZ$gq_$gqj$gqv$gq!R$gq!a$gq!b$gq!d$gq!j$gq#[$gq#]$gq#^$gq#_$gq#`$gq#a$gq#b$gq#c$gq#e$gq#g$gq#i$gq#j$gq'W$gq'f$gq'p$gq!c$gq!O$gq!T$gq!{$gqn$gq%Q$gq!]$gq~P!BpO#W$iqQ$iqZ$iq_$iqj$iqv$iq!R$iq!a$iq!b$iq!d$iq!j$iq#[$iq#]$iq#^$iq#_$iq#`$iq#a$iq#b$iq#c$iq#e$iq#g$iq#i$iq#j$iq'W$iq'f$iq'p$iq!c$iq!O$iq!T$iq!{$iqn$iq%Q$iq!]$iq~P!BpO!R&li!c&li~P!)wO#m#Oq!R#Oq!S#Oq~P#*XOu-tOv-tOx-uOPra'wra'xra!Sra~OQraZrajra!ara!bra!dra!jra#[ra#]ra#^ra#_ra#`ra#ara#bra#cra#era#gra#ira#jra#mra'fra'pra!Rra~P%;OOu(SOx(TOP$^a'w$^a'x$^a!S$^a~OQ$^aZ$^aj$^av$^a!a$^a!b$^a!d$^a!j$^a#[$^a#]$^a#^$^a#_$^a#`$^a#a$^a#b$^a#c$^a#e$^a#g$^a#i$^a#j$^a#m$^a'f$^a'p$^a!R$^a~P%=SOu(SOx(TOP$`a'w$`a'x$`a!S$`a~OQ$`aZ$`aj$`av$`a!a$`a!b$`a!d$`a!j$`a#[$`a#]$`a#^$`a#_$`a#`$`a#a$`a#b$`a#c$`a#e$`a#g$`a#i$`a#j$`a#m$`a'f$`a'p$`a!R$`a~P%?WOQ$naZ$naj$nav$na!a$na!b$na!d$na!j$na#[$na#]$na#^$na#_$na#`$na#a$na#b$na#c$na#e$na#g$na#i$na#j$na#m$na'f$na'p$na!R$na!S$na~P%%aO#m$Yq!R$Yq!S$Yq~P#*XO#m$Zq!R$Zq!S$Zq~P#*XO!S6hO~O#m6iO~P!#{O!]!wO!R&ti!c&ti~O!]!wO'p&oO!R&ti!c&ti~O!R-RO!c'}q~O!O&vi!R&vi~P!BpO!R-ZO!O(Oq~O!O6oO~P!BpO!O6oO~O!R'dy'a'dy~P!#{O!R&ya!T&ya~P!BpO!T$tq_$tq!R$tq'W$tq~P!BpOZ6vO~O!R.^O!S(Vq~O]6yO~O!T&dO%Q6zO~O!T&dO%Q6zO~P!BpO!{6{O!R&{a!S&{a~O!R2oO!S(Si~P#*XO!X7RO!Y7RO'^$dO'g(jO'o+iO~O!W7TO!x4SO~P%GXO!T.yO%Q7WO~O!T.yO%Q7WO~P!BpO]7_O'g7^O~O!R/VO!S(Tq~O!c7aO~O!c7aO~P){O!c7cO~O!c7dO~O!R#Ty!S#Ty~P#*XO_$^O!{7jO'W$^O~O_$^O!]!wO!{7jO'W$^O~O!X7mO!Y7mO'^$dO'g(jO'o+iO~O_$^O!]!wO!j7nO!{7jO'W$^O'p&oO~O#m#ky!R#ky!S#ky~P#*XOQ$giZ$gij$giv$gi!a$gi!b$gi!d$gi!j$gi#[$gi#]$gi#^$gi#_$gi#`$gi#a$gi#b$gi#c$gi#e$gi#g$gi#i$gi#j$gi#m$gi'f$gi'p$gi!R$gi!S$gi~P%%aOu(SOx(TO'x(XOP$xi'w$xi!S$xi~OQ$xiZ$xij$xiv$xi!a$xi!b$xi!d$xi!j$xi#[$xi#]$xi#^$xi#_$xi#`$xi#a$xi#b$xi#c$xi#e$xi#g$xi#i$xi#j$xi#m$xi'f$xi'p$xi!R$xi~P%LjOu(SOx(TOP$zi'w$zi'x$zi!S$zi~OQ$ziZ$zij$ziv$zi!a$zi!b$zi!d$zi!j$zi#[$zi#]$zi#^$zi#_$zi#`$zi#a$zi#b$zi#c$zi#e$zi#g$zi#i$zi#j$zi#m$zi'f$zi'p$zi!R$zi~P%NnO#m$Zy!R$Zy!S$Zy~P#*XO#m#Oy!R#Oy!S#Oy~P#*XO!]!wO!R&tq!c&tq~O!R-RO!c'}y~O!O&vq!R&vq~P!BpO!O7tO~P!BpO!R.^O!S(Vy~O!R2oO!S(Sq~O!X8QO!Y8QO'^$dO'g(jO'o+iO~O!T.yO%Q8TO~O!T.yO%Q8TO~P!BpO!c8WO~O_$^O!{8]O'W$^O~O_$^O!]!wO!{8]O'W$^O~OQ$gqZ$gqj$gqv$gq!a$gq!b$gq!d$gq!j$gq#[$gq#]$gq#^$gq#_$gq#`$gq#a$gq#b$gq#c$gq#e$gq#g$gq#i$gq#j$gq#m$gq'f$gq'p$gq!R$gq!S$gq~P%%aOQ$iqZ$iqj$iqv$iq!a$iq!b$iq!d$iq!j$iq#[$iq#]$iq#^$iq#_$iq#`$iq#a$iq#b$iq#c$iq#e$iq#g$iq#i$iq#j$iq#m$iq'f$iq'p$iq!R$iq!S$iq~P%%aO'a$|!Z!R$|!Z!{$|!Z#m$|!Z~P!#{O!R&{q!S&{q~P#*XO_$^O!{8oO'W$^O~O#W$|!ZQ$|!ZZ$|!Z_$|!Zj$|!Zv$|!Z!R$|!Z!a$|!Z!b$|!Z!d$|!Z!j$|!Z#[$|!Z#]$|!Z#^$|!Z#_$|!Z#`$|!Z#a$|!Z#b$|!Z#c$|!Z#e$|!Z#g$|!Z#i$|!Z#j$|!Z'W$|!Z'f$|!Z'p$|!Z!c$|!Z!O$|!Z!T$|!Z!{$|!Zn$|!Z%Q$|!Z!]$|!Z~P!BpOP;uOu(SOx(TO'w(VO'x(XO~O!S!za!W!za!X!za!Y!za!r!za!s!za!t!za!x!za'^!za'g!za'o!za~P&,_O!W'eX!X'eX!Y'eX!r'eX!s'eX!t'eX!x'eX'^'eX'g'eX'o'eX~P%'eOQ$|!ZZ$|!Zj$|!Zv$|!Z!a$|!Z!b$|!Z!d$|!Z!j$|!Z#[$|!Z#]$|!Z#^$|!Z#_$|!Z#`$|!Z#a$|!Z#b$|!Z#c$|!Z#e$|!Z#g$|!Z#i$|!Z#j$|!Z#m$|!Z'f$|!Z'p$|!Z!R$|!Z!S$|!Z~P%%aO!Wra!Xra!Yra!rra!sra!tra!xra'^ra'gra'ora~P%;OO!W$^a!X$^a!Y$^a!r$^a!s$^a!t$^a!x$^a'^$^a'g$^a'o$^a~P%=SO!W$`a!X$`a!Y$`a!r$`a!s$`a!t$`a!x$`a'^$`a'g$`a'o$`a~P%?WO!S$na!W$na!X$na!Y$na!r$na!s$na!t$na!x$na'^$na'g$na'o$na~P&,_O!W$xi!X$xi!Y$xi!r$xi!s$xi!t$xi!x$xi'^$xi'g$xi'o$xi~P%LjO!W$zi!X$zi!Y$zi!r$zi!s$zi!t$zi!x$zi'^$zi'g$zi'o$zi~P%NnO!S$gi!W$gi!X$gi!Y$gi!r$gi!s$gi!t$gi!x$gi'^$gi'g$gi'o$gi~P&,_O!S$gq!W$gq!X$gq!Y$gq!r$gq!s$gq!t$gq!x$gq'^$gq'g$gq'o$gq~P&,_O!S$iq!W$iq!X$iq!Y$iq!r$iq!s$iq!t$iq!x$iq'^$iq'g$iq'o$iq~P&,_O!S$|!Z!W$|!Z!X$|!Z!Y$|!Z!r$|!Z!s$|!Z!t$|!Z!x$|!Z'^$|!Z'g$|!Z'o$|!Z~P&,_On'hX~P.jOn[X!O[X!c[X%r[X!T[X%Q[X!][X~P$zO!]dX!c[X!cdX'pdX~P;dOQ9^OR9^O]cOb;`Oc!jOhcOj9^OkcOlcOq9^Os9^OxRO{cO|cO}cO!TSO!_9`O!dUO!g9^O!h9^O!i9^O!j9^O!k9^O!n!iO#t!lO#x^O']'cO'fQO'oYO'|;^O~O]#qOh$QOj#rOk#qOl#qOq$ROs9uOx#yO!T#zO!_;fO!d#vO#V:OO#t$VO$_9xO$a9{O$d$WO']&{O'b$PO'f#sO~O!R9pO!S$]a~O]#qOh$QOj#rOk#qOl#qOq$ROs9vOx#yO!T#zO!_;gO!d#vO#V:PO#t$VO$_9yO$a9|O$d$WO']&{O'b$PO'f#sO~O#d'jO~P&]P!AQ!AY!A^!A^P!>YP!Ab!AbP!DVP!DZ?Z?Z!Da!GT8SP8SP8S8SP!HW8S8S!Jf8S!M_8S# g8S8S#!T#$c#$c#$g#$c#$oP#$cP8S#%k8S#'X8S8S-zPPP#(yPP#)c#)cP#)cP#)x#)cPP#*OP#)uP#)u#*b!!X#)u#+P#+V#+Y([#+]([P#+d#+d#+dP([P([P([P([PP([P#+j#+mP#+m([P#+qP#+tP([P([P([P([P([P([([#+z#,U#,[#,b#,p#,v#,|#-W#-^#-m#-s#.R#.X#._#.m#/S#0z#1Y#1`#1f#1l#1r#1|#2S#2Y#2d#2v#2|PPPPPPPP#3SPP#3v#7OPP#8f#8m#8uPP#>a#@t#Fp#Fs#Fv#GR#GUPP#GX#G]#Gz#Hq#Hu#IZPP#I_#Ie#IiP#Il#Ip#Is#Jc#Jy#KO#KR#KU#K[#K_#Kc#KgmhOSj}!n$]%c%f%g%i*o*t/g/jQ$imQ$ppQ%ZyS&V!b+`Q&k!jS(l#z(qQ)g$jQ)t$rQ*`%TQ+f&^S+k&d+mQ+}&lQ-k(sQ/U*aY0Z+o+p+q+r+sS2t.y2vU3|0[0^0aU5g2y2z2{S6]4O4RS7R5h5iQ7m6_R8Q7T$p[ORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8o!j'e#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aQ(}$SQ)l$lQ*b%WQ*i%`Q,X9tQ.W)aQ.c)mQ/^*gQ2_.^Q3Z/VQ4^9vQ5S2`R8{9upeOSjy}!n$]%Y%c%f%g%i*o*t/g/jR*d%[&WVOSTjkn}!S!W!k!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k$]$n%[%_%`%c%e%f%g%i%m%z&S&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;`;a[!cRU!]!`%x&WQ$clQ$hmS$mp$rv$wrs!r!u$Z$u&`&t&w)x)y)z*m+Y+h,S,U/o0lQ%PwQ&h!iQ&j!jS(_#v(cS)f$i$jQ)j$lQ)w$tQ*Z%RQ*_%TS+|&k&lQ-V(`Q.[)gQ.b)mQ.d)nQ.g)rQ/P*[S/T*`*aQ0h+}Q1b-RQ2^.^Q2b.aQ2g.iQ3Y/UQ4i1cQ5R2`Q5U2dQ6u5QR7w6vx#xa!y$T$U$Y(W(Y(b(w(x,_-Y-w1a1y6i;^;i;j;k!Y$fm!j$h$i$j&U&j&k&l(k)f)g+]+j+|+}-d.[0Q0W0]0h1u3{4Q6Z7k8^Q)`$cQ*P$|Q*S$}Q*^%TQ.k)wQ/O*ZU/S*_*`*aQ3T/PS3X/T/UQ5b2sQ5t3YS7P5c5fS8O7Q7SQ8f8PQ8u8g#[;b!w#d#v#y&g'}(Z(h)])_)a*O*R+y-Z-].R.T.p.s.{.}1k1s2Q2T2X2j3Q3S4l4u4}5k5p6z7W8T9w9z9}:U:X:[:a:d:j;l;n;t;u;vd;c9d9x9{:O:V:Y:]:b:e:ke;d9r9y9|:P:W:Z:^:c:f:lW#}a$P(y;^S$|t%YQ$}uQ%OvR)}$z%P#|a!w!y#d#v#y$T$U$Y&g'}(W(Y(Z(b(h(w(x)])_)a*O*R+y,_-Y-Z-]-w.R.T.p.s.{.}1a1k1s1y2Q2T2X2j3Q3S4l4u4}5k5p6i6z7W8T9d9r9w9x9y9z9{9|9}:O:P:U:V:W:X:Y:Z:[:]:^:a:b:c:d:e:f:j:k:l;^;i;j;k;l;n;t;u;vT(O#s(PX)O$S9t9u9vU&Z!b$v+cQ'U!{Q)q$oQ.t*TQ1z-tR5^2o&^cORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;a$]#aZ!_!o$a%w%}&y'Q'W'X'Y'Z'[']'^'_'`'a'b'd'g'k'u)p+R+^+g,O,^,d,g,i,w-x/v/y0i0s0w0x0y0z0{0|0}1O1P1Q1R1S1T1W1]2O2[3s3v4W4[4]4b4c5`6S6V6b6f6g7g7z8Z8m8y9_:|T!XQ!Y&_cORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aQ&X!bR/|+`Y&R!b&V&^+`+fS(k#z(qS+j&d+mS-d(l(sQ-e(mQ-l(tQ.v*VU0W+k+o+pU0]+q+r+sS0b+t2xQ1u-kQ1w-mQ1x-nS2s.y2vU3{0Z0[0^Q4P0_Q4Q0aS5c2t2{S5f2y2zU6Z3|4O4RQ6`4SS7Q5g5hQ7S5iS7k6]6_S8P7R7TQ8^7mQ8g8QQ;h;oR;m;slhOSj}!n$]%c%f%g%i*o*t/g/jQ%k!QS&x!v9cQ)d$gQ*X%PQ*Y%QQ+z&iS,]&}:RS-y)V:_Q.Y)eQ.x*WQ/n*vQ/p*wQ/x+ZQ0`+qQ0f+{S2P-z:gQ2Y.ZS2].]:hQ3r/zQ3u0RQ4U0gQ5P2ZQ6T3tQ6X3zQ6a4VQ7e6RQ7h6YQ8Y7iQ8l8[R8x8n$W#`Z!_!o%w%}&y'Q'W'X'Y'Z'[']'^'_'`'a'b'd'g'k'u)p+R+^+g,O,^,d,g,w-x/v/y0i0s0w0x0y0z0{0|0}1O1P1Q1R1S1T1W1]2O2[3s3v4W4[4]4b4c5`6S6V6b6f6g7g7z8Z8m8y9_:|W(v#{&|1V8qT)Z$a,i$W#_Z!_!o%w%}&y'Q'W'X'Y'Z'[']'^'_'`'a'b'd'g'k'u)p+R+^+g,O,^,d,g,w-x/v/y0i0s0w0x0y0z0{0|0}1O1P1Q1R1S1T1W1]2O2[3s3v4W4[4]4b4c5`6S6V6b6f6g7g7z8Z8m8y9_:|Q'f#`S)Y$a,iR-{)Z&^cORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aQ%f{Q%g|Q%i!OQ%j!PR/f*rQ&e!iQ)[$cQ+w&hS.Q)`)wS0c+u+vW2S-}.O.P.kS4T0d0eU4|2U2V2WU6s4{5Y5ZQ7v6tR8b7yT+l&d+mS+j&d+mU0W+k+o+pU0]+q+r+sS0b+t2xS2s.y2vU3{0Z0[0^Q4P0_Q4Q0aS5c2t2{S5f2y2zU6Z3|4O4RQ6`4SS7Q5g5hQ7S5iS7k6]6_S8P7R7TQ8^7mR8g8QS+l&d+mT2u.y2vS&r!q/dQ-U(_Q-b(kS0V+j2sQ1g-VS1p-c-lU3}0]0b5fQ4h1bS4s1v1xU6^4P4Q7SQ6k4iQ6r4vR7n6`Q!xXS&q!q/dQ)W$[Q)b$eQ)h$kQ,Q&rQ-T(_Q-a(kQ-f(nQ.X)cQ/Q*]S0U+j2sS1f-U-VS1o-b-lQ1r-eQ1t-gQ3V/RW3y0V0]0b5fQ4g1bQ4k1gS4o1p1xQ4t1wQ5r3WW6[3}4P4Q7SS6j4h4iS6n4p:iQ6p4sQ6}5aQ7[5sS7l6^6`Q7r6kS7s6o:mQ7u6rQ7|7OQ8V7]Q8_7nS8a7t:nQ8d7}Q8s8eQ9Q8tQ9X9RQ:u:pQ;T:zQ;U:{Q;V;hR;[;m$rWORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%`%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8oS!xn!k!j:o#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aR:u;`$rXORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%`%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8oQ$[b!Y$em!j$h$i$j&U&j&k&l(k)f)g+]+j+|+}-d.[0Q0W0]0h1u3{4Q6Z7k8^S$kn!kQ)c$fQ*]%TW/R*^*_*`*aU3W/S/T/UQ5a2sS5s3X3YU7O5b5c5fQ7]5tU7}7P7Q7SS8e8O8PS8t8f8gQ9R8u!j:p#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aQ:z;_R:{;`$f]OSTjk}!S!W!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%c%e%f%g%i%m%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8oY!hRU!]!`%xv$wrs!r!u$Z$u&`&t&w)x)y)z*m+Y+h,S,U/o0lQ*j%`!h:q#]#k'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aR:t&WS&[!b$vR0O+c$p[ORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8o!j'e#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aR*i%`$roORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%`%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8oQ'U!{!k:r#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;a!h#VZ!_$a%w%}&y'Q'_'`'a'b'g'k)p+R+g,O,^,d,w-x0i0s1T2O2[3v4W4[6V7g8Z8m8y9_!R9k'd'u+^,i/v/y0w1P1Q1R1S1W1]3s4]4b4c5`6S6b6f6g7z:|!d#XZ!_$a%w%}&y'Q'a'b'g'k)p+R+g,O,^,d,w-x0i0s1T2O2[3v4W4[6V7g8Z8m8y9_}9m'd'u+^,i/v/y0w1R1S1W1]3s4]4b4c5`6S6b6f6g7z:|!`#]Z!_$a%w%}&y'Q'g'k)p+R+g,O,^,d,w-x0i0s1T2O2[3v4W4[6V7g8Z8m8y9_Q1a-Px;a'd'u+^,i/v/y0w1W1]3s4]4b4c5`6S6b6f6g7z:|Q;i;pQ;j;qR;k;r&^cORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aS#l`#mR1Y,l&e_ORSTU`jk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k#m$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,l,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aS#g^#nT'n#i'rT#h^#nT'p#i'r&e`ORSTU`jk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#]#b#e#k#m$]$n%[%_%`%c%e%f%g%i%m%x%z&S&W&_&f&p&}'R'w(R)V)^*k*o*t+T+X+[+x,P,b,h,l,m-u-z.S.].|/_/`/a/c/g/j/l/{0T0j0t1X2i2q3R3f3h3i3q3x5o5}6W6{7j8]8o9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;aT#l`#mQ#o`R'y#m$rbORSTUjk}!S!W!]!`!n!v!z!|#P#Q#R#S#T#U#V#W#X#Y#Z#b#e$]$n%[%_%`%c%e%f%g%i%m%x%z&S&_&f&p&}'R(R)V)^*k*o*t+T+x,P,b,h-u-z.S.].|/_/`/a/c/g/j/l0T0j0t2i3R3f3h3i3x5o5}6W7j8]8o!k;_#]#k&W'w+X+[,m/{1X2q3q6{9^9`9c9e9f9g9h9i9j9k9l9m9n9o9p9s:Q:R:T:_:`:g:h;a#RdOSUj}!S!W!n!|#k$]%[%_%`%c%e%f%g%i%m&S&f'w)^*k*o*t+x,m-u.S.|/_/`/a/c/g/j/l1X2i3R3f3h3i5o5}x#{a!y$T$U$Y(W(Y(b(w(x,_-Y-w1a1y6i;^;i;j;k#[&|!w#d#v#y&g'}(Z(h)])_)a*O*R+y-Z-].R.T.p.s.{.}1k1s2Q2T2X2j3Q3S4l4u4}5k5p6z7W8T9w9z9}:U:X:[:a:d:j;l;n;t;u;vQ)S$WQ,x(Sd1V9r9y9|:P:W:Z:^:c:f:le8q9d9x9{:O:V:Y:]:b:e:kx#wa!y$T$U$Y(W(Y(b(w(x,_-Y-w1a1y6i;^;i;j;kQ(d#xS(n#z(qQ)T$XQ-g(o#[:w!w#d#v#y&g'}(Z(h)])_)a*O*R+y-Z-].R.T.p.s.{.}1k1s2Q2T2X2j3Q3S4l4u4}5k5p6z7W8T9w9z9}:U:X:[:a:d:j;l;n;t;u;vd:x9d9x9{:O:V:Y:]:b:e:kd:y9r9y9|:P:W:Z:^:c:f:lQ:};bQ;O;cQ;P;dQ;Q;eQ;R;fR;S;gx#{a!y$T$U$Y(W(Y(b(w(x,_-Y-w1a1y6i;^;i;j;k#[&|!w#d#v#y&g'}(Z(h)])_)a*O*R+y-Z-].R.T.p.s.{.}1k1s2Q2T2X2j3Q3S4l4u4}5k5p6z7W8T9w9z9}:U:X:[:a:d:j;l;n;t;u;vd1V9r9y9|:P:W:Z:^:c:f:le8q9d9x9{:O:V:Y:]:b:e:klfOSj}!n$]%c%f%g%i*o*t/g/jQ(g#yQ*}%pQ+O%rR1j-Z%O#|a!w!y#d#v#y$T$U$Y&g'}(W(Y(Z(b(h(w(x)])_)a*O*R+y,_-Y-Z-]-w.R.T.p.s.{.}1a1k1s1y2Q2T2X2j3Q3S4l4u4}5k5p6i6z7W8T9d9r9w9x9y9z9{9|9}:O:P:U:V:W:X:Y:Z:[:]:^:a:b:c:d:e:f:j:k:l;^;i;j;k;l;n;t;u;vQ*Q$}Q.r*SQ2m.qR5]2nT(p#z(qS(p#z(qT2u.y2vQ)b$eQ-f(nQ.X)cQ/Q*]Q3V/RQ5r3WQ6}5aQ7[5sQ7|7OQ8V7]Q8d7}Q8s8eQ9Q8tR9X9Rp(W#t'O)U-X-o-p0q1h1}4f4w7q:v;W;X;Y!n:U&z'i(^(f+v,[,t-P-^-|.P.o.q0e0p1i1m2W2l2n3O4Y4Z4m4q4y5O5Z5n6m6q7Y8`;Z;];p;q;r[:V8p9O9V9Y9Z9]]:W1U4a6c7o7p8zr(Y#t'O)U,}-X-o-p0q1h1}4f4w7q:v;W;X;Y!p:X&z'i(^(f+v,[,t-P-^-|.P.o.q0e0n0p1i1m2W2l2n3O4Y4Z4m4q4y5O5Z5n6m6q7Y8`;Z;];p;q;r^:Y8p9O9T9V9Y9Z9]_:Z1U4a6c6d7o7p8zpeOSjy}!n$]%Y%c%f%g%i*o*t/g/jQ%VxR*k%`peOSjy}!n$]%Y%c%f%g%i*o*t/g/jR%VxQ*U%OR.n)}qeOSjy}!n$]%Y%c%f%g%i*o*t/g/jQ.z*ZS3P/O/PW5j2|2}3O3TU7V5l5m5nU8R7U7X7YQ8h8SR8v8iQ%^yR*e%YR3^/XR7_5uS$mp$rR.d)nQ%czR*o%dR*u%jT/h*t/jR*y%kQ*x%kR/q*yQjOQ!nST$`j!nQ(P#sR,u(PQ!YQR%u!YQ!^RU%{!^%|+UQ%|!_R+U%}Q+a&XR/}+aQ,`'OR0r,`Q,c'QS0u,c0vR0v,dQ+m&dR0X+mS!eR$uU&a!e&b+VQ&b!fR+V&OQ+d&[R0P+dQ&u!sQ,R&sU,V&u,R0mR0m,WQ'r#iR,n'rQ#m`R'x#mQ#cZU'h#c+Q9qQ+Q9_R9q'uQ-S(_W1d-S1e4j6lU1e-T-U-VS4j1f1gR6l4k$k(U#t&z'O'i(^(f)P)Q)U+v,Y,Z,[,t,}-O-P-X-^-o-p-|.P.o.q0e0n0o0p0q1U1h1i1m1}2W2l2n3O4Y4Z4_4`4a4f4m4q4w4y5O5Z5n6c6d6e6m6q7Y7o7p7q8`8p8z8|8}9O9T9U9V9Y9Z9]:v;W;X;Y;Z;];p;q;rQ-[(fU1l-[1n4nQ1n-^R4n1mQ(q#zR-i(qQ(z$OR-r(zQ2R-|R4z2RQ){$xR.m){Q2p.tS5_2p6|R6|5`Q*W%PR.w*WQ2v.yR5d2vQ/W*bS3[/W5vR5v3^Q._)jW2a._2c5T6wQ2c.bQ5T2bR6w5UQ)o$mR.e)oQ/j*tR3l/jWiOSj!nQ%h}Q)X$]Q*n%cQ*p%fQ*q%gQ*s%iQ/e*oS/h*t/jR3k/gQ$_gQ%l!RQ%o!TQ%q!UQ%s!VQ)v$sQ)|$yQ*d%^Q*{%nQ-h(pS/Z*e*hQ/r*zQ/s*}Q/t+OS0S+j2sQ2f.hQ2k.oQ3U/QQ3`/]Q3j/fY3w0U0V0]0b5fQ5X2hQ5[2lQ5q3VQ5w3_[6U3v3y3}4P4Q7SQ6x5VQ7Z5rQ7`5xW7f6V6[6^6`Q7x6yQ7{6}Q8U7[U8X7g7l7nQ8c7|Q8j8VS8k8Z8_Q8r8dQ8w8mQ9P8sQ9S8yQ9W9QR9[9XQ$gmQ&i!jU)e$h$i$jQ+Z&UU+{&j&k&lQ-`(kS.Z)f)gQ/z+]Q0R+jS0g+|+}Q1q-dQ2Z.[Q3t0QS3z0W0]Q4V0hQ4r1uS6Y3{4QQ7i6ZQ8[7kR8n8^S#ua;^R({$PU$Oa$P;^R-q(yQ#taS&z!w)aQ'O!yQ'i#dQ(^#vQ(f#yQ)P$TQ)Q$UQ)U$YQ+v&gQ,Y9wQ,Z9zQ,[9}Q,t'}Q,}(WQ-O(YQ-P(ZQ-X(bQ-^(hQ-o(wQ-p(xd-|)].R.{2T3Q4}5k6z7W8TQ.P)_Q.o*OQ.q*RQ0e+yQ0n:UQ0o:XQ0p:[Q0q,_Q1U9rQ1h-YQ1i-ZQ1m-]Q1}-wQ2W.TQ2l.pQ2n.sQ3O.}Q4Y:aQ4Z:dQ4_9yQ4`9|Q4a:PQ4f1aQ4m1kQ4q1sQ4w1yQ4y2QQ5O2XQ5Z2jQ5n3SQ6c:^Q6d:WQ6e:ZQ6m4lQ6q4uQ7Y5pQ7o:cQ7p:fQ7q6iQ8`:jQ8p9dQ8z:lQ8|9xQ8}9{Q9O:OQ9T:VQ9U:YQ9V:]Q9Y:bQ9Z:eQ9]:kQ:v;^Q;W;iQ;X;jQ;Y;kQ;Z;lQ;];nQ;p;tQ;q;uR;r;vlgOSj}!n$]%c%f%g%i*o*t/g/jS!pU%eQ%n!SQ%t!WQ'V!|Q'v#kS*h%[%_Q*l%`Q*z%mQ+W&SQ+u&fQ,r'wQ.O)^Q/b*kQ0d+xQ1[,mQ1{-uQ2V.SQ2}.|Q3b/_Q3c/`Q3e/aQ3g/cQ3n/lQ4d1XQ5Y2iQ5m3RQ5|3fQ6O3hQ6P3iQ7X5oR7b5}!vZOSUj}!S!n!|$]%[%_%`%c%e%f%g%i%m&S&f)^*k*o*t+x-u.S.|/_/`/a/c/g/j/l2i3R3f3h3i5o5}Q!_RQ!oTQ$akS%w!]%zQ%}!`Q&y!vQ'Q!zQ'W#PQ'X#QQ'Y#RQ'Z#SQ'[#TQ']#UQ'^#VQ'_#WQ'`#XQ'a#YQ'b#ZQ'd#]Q'g#bQ'k#eW'u#k'w,m1XQ)p$nS+R%x+TS+^&W/{Q+g&_Q,O&pQ,^&}Q,d'RQ,g9^Q,i9`Q,w(RQ-x)VQ/v+XQ/y+[Q0i,PQ0s,bQ0w9cQ0x9eQ0y9fQ0z9gQ0{9hQ0|9iQ0}9jQ1O9kQ1P9lQ1Q9mQ1R9nQ1S9oQ1T,hQ1W9sQ1]9pQ2O-zQ2[.]Q3s:QQ3v0TQ4W0jQ4[0tQ4]:RQ4b:TQ4c:_Q5`2qQ6S3qQ6V3xQ6b:`Q6f:gQ6g:hQ7g6WQ7z6{Q8Z7jQ8m8]Q8y8oQ9_!WR:|;aR!aRR&Y!bS&U!b+`S+]&V&^R0Q+fR'P!yR'S!zT!tU$ZS!sU$ZU$xrs*mS&s!r!uQ,T&tQ,W&wQ.l)zS0k,S,UR4X0l`!dR!]!`$u%x&`)x+hh!qUrs!r!u$Z&t&w)z,S,U0lQ/d*mQ/w+YQ3p/oT:s&W)yT!gR$uS!fR$uS%y!]&`S&O!`)xS+S%x+hT+_&W)yT&]!b$vQ#i^R'{#nT'q#i'rR1Z,lT(a#v(cR(i#yQ-})]Q2U.RQ2|.{Q4{2TQ5l3QQ6t4}Q7U5kQ7y6zQ8S7WR8i8TlhOSj}!n$]%c%f%g%i*o*t/g/jQ%]yR*d%YV$yrs*mR.u*TR*c%WQ$qpR)u$rR)k$lT%az%dT%bz%dT/i*t/j",nodeNames:"\u26A0 extends ArithOp ArithOp InterpolationStart LineComment BlockComment Script ExportDeclaration export Star as VariableName String from ; default FunctionDeclaration async function VariableDefinition TypeParamList TypeDefinition ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Interpolation null super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression await yield delete LogicOp BitOp ParenthesizedExpression ClassExpression class extends ClassBody MethodDeclaration Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression PrivatePropertyName BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody MethodDeclaration AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement",maxTerm:332,context:Za,nodeProps:[["closedBy",4,"InterpolationEnd",40,"]",51,"}",66,")",132,"JSXSelfCloseEndTag JSXEndTag",146,"JSXEndTag"],["group",-26,8,15,17,58,184,188,191,192,194,197,200,211,213,219,221,223,225,228,234,240,242,244,246,248,250,251,"Statement",-30,12,13,24,27,28,41,43,44,45,47,52,60,68,74,75,91,92,101,103,119,122,124,125,126,127,129,130,148,149,151,"Expression",-22,23,25,29,32,34,152,154,156,157,159,160,161,163,164,165,167,168,169,178,180,182,183,"Type",-3,79,85,90,"ClassItem"],["openedBy",30,"InterpolationStart",46,"[",50,"{",65,"(",131,"JSXStartTag",141,"JSXStartTag JSXStartCloseTag"]],propSources:[qa],skippedNodes:[0,5,6],repeatNodeCount:28,tokenData:"!C}~R!`OX%TXY%cYZ'RZ[%c[]%T]^'R^p%Tpq%cqr'crs(kst0htu2`uv4pvw5ewx6cxyk|}?O}!O>k!O!P?`!P!QCl!Q!R!0[!R![!1q![!]!7s!]!^!8V!^!_!8g!_!`!9d!`!a!:[!a!b!U#R#S2`#S#T!>i#T#o2`#o#p!>y#p#q!?O#q#r!?f#r#s!?x#s$f%T$f$g%c$g#BY2`#BY#BZ!@Y#BZ$IS2`$IS$I_!@Y$I_$I|2`$I|$I}!Bq$I}$JO!Bq$JO$JT2`$JT$JU!@Y$JU$KV2`$KV$KW!@Y$KW&FU2`&FU&FV!@Y&FV?HT2`?HT?HU!@Y?HU~2`W%YR$UWO!^%T!_#o%T#p~%T7Z%jg$UW'Y7ROX%TXY%cYZ%TZ[%c[p%Tpq%cq!^%T!_#o%T#p$f%T$f$g%c$g#BY%T#BY#BZ%c#BZ$IS%T$IS$I_%c$I_$JT%T$JT$JU%c$JU$KV%T$KV$KW%c$KW&FU%T&FU&FV%c&FV?HT%T?HT?HU%c?HU~%T7Z'YR$UW'Z7RO!^%T!_#o%T#p~%T$T'jS$UW!j#{O!^%T!_!`'v!`#o%T#p~%T$O'}S#e#v$UWO!^%T!_!`(Z!`#o%T#p~%T$O(bR#e#v$UWO!^%T!_#o%T#p~%T)X(rZ$UW]#eOY(kYZ)eZr(krs*rs!^(k!^!_+U!_#O(k#O#P-b#P#o(k#o#p+U#p~(k&r)jV$UWOr)ers*Ps!^)e!^!_*a!_#o)e#o#p*a#p~)e&r*WR$P&j$UWO!^%T!_#o%T#p~%T&j*dROr*ars*ms~*a&j*rO$P&j)X*{R$P&j$UW]#eO!^%T!_#o%T#p~%T)P+ZV]#eOY+UYZ*aZr+Urs+ps#O+U#O#P+w#P~+U)P+wO$P&j]#e)P+zROr+Urs,Ts~+U)P,[U$P&j]#eOY,nZr,nrs-Vs#O,n#O#P-[#P~,n#e,sU]#eOY,nZr,nrs-Vs#O,n#O#P-[#P~,n#e-[O]#e#e-_PO~,n)X-gV$UWOr(krs-|s!^(k!^!_+U!_#o(k#o#p+U#p~(k)X.VZ$P&j$UW]#eOY.xYZ%TZr.xrs/rs!^.x!^!_,n!_#O.x#O#P0S#P#o.x#o#p,n#p~.x#m/PZ$UW]#eOY.xYZ%TZr.xrs/rs!^.x!^!_,n!_#O.x#O#P0S#P#o.x#o#p,n#p~.x#m/yR$UW]#eO!^%T!_#o%T#p~%T#m0XT$UWO!^.x!^!_,n!_#o.x#o#p,n#p~.x3]0mZ$UWOt%Ttu1`u!^%T!_!c%T!c!}1`!}#R%T#R#S1`#S#T%T#T#o1`#p$g%T$g~1`3]1g]$UW'o3TOt%Ttu1`u!Q%T!Q![1`![!^%T!_!c%T!c!}1`!}#R%T#R#S1`#S#T%T#T#o1`#p$g%T$g~1`7Z2k_$UW#zS']$y'g3SOt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$g%T$g~2`[3q_$UW#zSOt%Ttu3ju}%T}!O3j!O!Q%T!Q![3j![!^%T!_!c%T!c!}3j!}#R%T#R#S3j#S#T%T#T#o3j#p$g%T$g~3j$O4wS#^#v$UWO!^%T!_!`5T!`#o%T#p~%T$O5[R$UW#o#vO!^%T!_#o%T#p~%T5b5lU'x5Y$UWOv%Tvw6Ow!^%T!_!`5T!`#o%T#p~%T$O6VS$UW#i#vO!^%T!_!`5T!`#o%T#p~%T)X6jZ$UW]#eOY6cYZ7]Zw6cwx*rx!^6c!^!_8T!_#O6c#O#P:T#P#o6c#o#p8T#p~6c&r7bV$UWOw7]wx*Px!^7]!^!_7w!_#o7]#o#p7w#p~7]&j7zROw7wwx*mx~7w)P8YV]#eOY8TYZ7wZw8Twx+px#O8T#O#P8o#P~8T)P8rROw8Twx8{x~8T)P9SU$P&j]#eOY9fZw9fwx-Vx#O9f#O#P9}#P~9f#e9kU]#eOY9fZw9fwx-Vx#O9f#O#P9}#P~9f#e:QPO~9f)X:YV$UWOw6cwx:ox!^6c!^!_8T!_#o6c#o#p8T#p~6c)X:xZ$P&j$UW]#eOY;kYZ%TZw;kwx/rx!^;k!^!_9f!_#O;k#O#PW{!^%T!_!`5T!`#o%T#p~%T$O>_S#[#v$UWO!^%T!_!`5T!`#o%T#p~%T%w>rSj%o$UWO!^%T!_!`5T!`#o%T#p~%T&i?VR!R&a$UWO!^%T!_#o%T#p~%T7Z?gVu5^$UWO!O%T!O!P?|!P!Q%T!Q![@r![!^%T!_#o%T#p~%T!{@RT$UWO!O%T!O!P@b!P!^%T!_#o%T#p~%T!{@iR!Q!s$UWO!^%T!_#o%T#p~%T!{@yZ$UWk!sO!Q%T!Q![@r![!^%T!_!g%T!g!hAl!h#R%T#R#S@r#S#X%T#X#YAl#Y#o%T#p~%T!{AqZ$UWO{%T{|Bd|}%T}!OBd!O!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%T!{BiV$UWO!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%T!{CVV$UWk!sO!Q%T!Q![CO![!^%T!_#R%T#R#SCO#S#o%T#p~%T7ZCs`$UW#]#vOYDuYZ%TZzDuz{Jl{!PDu!P!Q!-e!Q!^Du!^!_Fx!_!`!.^!`!a!/]!a!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~DuXD|[$UW}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~DuXEy_$UW}PO!^%T!_#Z%T#Z#[Er#[#]%T#]#^Er#^#a%T#a#bEr#b#g%T#g#hEr#h#i%T#i#jEr#j#m%T#m#nEr#n#o%T#p~%TPF}V}POYFxZ!PFx!P!QGd!Q!}Fx!}#OG{#O#PHh#P~FxPGiU}P#Z#[Gd#]#^Gd#a#bGd#g#hGd#i#jGd#m#nGdPHOTOYG{Z#OG{#O#PH_#P#QFx#Q~G{PHbQOYG{Z~G{PHkQOYFxZ~FxXHvY$UWOYHqYZ%TZ!^Hq!^!_G{!_#OHq#O#PIf#P#QDu#Q#oHq#o#pG{#p~HqXIkV$UWOYHqYZ%TZ!^Hq!^!_G{!_#oHq#o#pG{#p~HqXJVV$UWOYDuYZ%TZ!^Du!^!_Fx!_#oDu#o#pFx#p~Du7ZJs^$UW}POYJlYZKoZzJlz{NQ{!PJl!P!Q!,R!Q!^Jl!^!_!!]!_!}Jl!}#O!'|#O#P!+a#P#oJl#o#p!!]#p~Jl7ZKtV$UWOzKoz{LZ{!^Ko!^!_M]!_#oKo#o#pM]#p~Ko7ZL`X$UWOzKoz{LZ{!PKo!P!QL{!Q!^Ko!^!_M]!_#oKo#o#pM]#p~Ko7ZMSR$UWU7RO!^%T!_#o%T#p~%T7RM`ROzM]z{Mi{~M]7RMlTOzM]z{Mi{!PM]!P!QM{!Q~M]7RNQOU7R7ZNX^$UW}POYJlYZKoZzJlz{NQ{!PJl!P!Q! T!Q!^Jl!^!_!!]!_!}Jl!}#O!'|#O#P!+a#P#oJl#o#p!!]#p~Jl7Z! ^_$UWU7R}PO!^%T!_#Z%T#Z#[Er#[#]%T#]#^Er#^#a%T#a#bEr#b#g%T#g#hEr#h#i%T#i#jEr#j#m%T#m#nEr#n#o%T#p~%T7R!!bY}POY!!]YZM]Zz!!]z{!#Q{!P!!]!P!Q!&x!Q!}!!]!}#O!$`#O#P!&f#P~!!]7R!#VY}POY!!]YZM]Zz!!]z{!#Q{!P!!]!P!Q!#u!Q!}!!]!}#O!$`#O#P!&f#P~!!]7R!#|UU7R}P#Z#[Gd#]#^Gd#a#bGd#g#hGd#i#jGd#m#nGd7R!$cWOY!$`YZM]Zz!$`z{!${{#O!$`#O#P!&S#P#Q!!]#Q~!$`7R!%OYOY!$`YZM]Zz!$`z{!${{!P!$`!P!Q!%n!Q#O!$`#O#P!&S#P#Q!!]#Q~!$`7R!%sTU7ROYG{Z#OG{#O#PH_#P#QFx#Q~G{7R!&VTOY!$`YZM]Zz!$`z{!${{~!$`7R!&iTOY!!]YZM]Zz!!]z{!#Q{~!!]7R!&}_}POzM]z{Mi{#ZM]#Z#[!&x#[#]M]#]#^!&x#^#aM]#a#b!&x#b#gM]#g#h!&x#h#iM]#i#j!&x#j#mM]#m#n!&x#n~M]7Z!(R[$UWOY!'|YZKoZz!'|z{!(w{!^!'|!^!_!$`!_#O!'|#O#P!*o#P#QJl#Q#o!'|#o#p!$`#p~!'|7Z!(|^$UWOY!'|YZKoZz!'|z{!(w{!P!'|!P!Q!)x!Q!^!'|!^!_!$`!_#O!'|#O#P!*o#P#QJl#Q#o!'|#o#p!$`#p~!'|7Z!*PY$UWU7ROYHqYZ%TZ!^Hq!^!_G{!_#OHq#O#PIf#P#QDu#Q#oHq#o#pG{#p~Hq7Z!*tX$UWOY!'|YZKoZz!'|z{!(w{!^!'|!^!_!$`!_#o!'|#o#p!$`#p~!'|7Z!+fX$UWOYJlYZKoZzJlz{NQ{!^Jl!^!_!!]!_#oJl#o#p!!]#p~Jl7Z!,Yc$UW}POzKoz{LZ{!^Ko!^!_M]!_#ZKo#Z#[!,R#[#]Ko#]#^!,R#^#aKo#a#b!,R#b#gKo#g#h!,R#h#iKo#i#j!,R#j#mKo#m#n!,R#n#oKo#o#pM]#p~Ko7Z!-lV$UWT7ROY!-eYZ%TZ!^!-e!^!_!.R!_#o!-e#o#p!.R#p~!-e7R!.WQT7ROY!.RZ~!.R$P!.g[$UW#o#v}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~Du]!/f[#wS$UW}POYDuYZ%TZ!PDu!P!QEr!Q!^Du!^!_Fx!_!}Du!}#OHq#O#PJQ#P#oDu#o#pFx#p~Du!{!0cd$UWk!sO!O%T!O!P@r!P!Q%T!Q![!1q![!^%T!_!g%T!g!hAl!h#R%T#R#S!1q#S#U%T#U#V!3X#V#X%T#X#YAl#Y#b%T#b#c!2w#c#d!4m#d#l%T#l#m!5{#m#o%T#p~%T!{!1x_$UWk!sO!O%T!O!P@r!P!Q%T!Q![!1q![!^%T!_!g%T!g!hAl!h#R%T#R#S!1q#S#X%T#X#YAl#Y#b%T#b#c!2w#c#o%T#p~%T!{!3OR$UWk!sO!^%T!_#o%T#p~%T!{!3^W$UWO!Q%T!Q!R!3v!R!S!3v!S!^%T!_#R%T#R#S!3v#S#o%T#p~%T!{!3}Y$UWk!sO!Q%T!Q!R!3v!R!S!3v!S!^%T!_#R%T#R#S!3v#S#b%T#b#c!2w#c#o%T#p~%T!{!4rV$UWO!Q%T!Q!Y!5X!Y!^%T!_#R%T#R#S!5X#S#o%T#p~%T!{!5`X$UWk!sO!Q%T!Q!Y!5X!Y!^%T!_#R%T#R#S!5X#S#b%T#b#c!2w#c#o%T#p~%T!{!6QZ$UWO!Q%T!Q![!6s![!^%T!_!c%T!c!i!6s!i#R%T#R#S!6s#S#T%T#T#Z!6s#Z#o%T#p~%T!{!6z]$UWk!sO!Q%T!Q![!6s![!^%T!_!c%T!c!i!6s!i#R%T#R#S!6s#S#T%T#T#Z!6s#Z#b%T#b#c!2w#c#o%T#p~%T$u!7|R!]V$UW#m$fO!^%T!_#o%T#p~%T!q!8^R_!i$UWO!^%T!_#o%T#p~%T5w!8rR'bd!a/n#x&s'|P!P!Q!8{!^!_!9Q!_!`!9_W!9QO$WW#v!9VP#`#v!_!`!9Y#v!9_O#o#v#v!9dO#a#v$u!9kT!{$m$UWO!^%T!_!`'v!`!a!9z!a#o%T#p~%T$P!:RR#W#w$UWO!^%T!_#o%T#p~%T%V!:gT'a!R#a#v$RS$UWO!^%T!_!`!:v!`!a!;W!a#o%T#p~%T$O!:}R#a#v$UWO!^%T!_#o%T#p~%T$O!;_T#`#v$UWO!^%T!_!`5T!`!a!;n!a#o%T#p~%T$O!;uS#`#v$UWO!^%T!_!`5T!`#o%T#p~%T*a!]S#g#v$UWO!^%T!_!`5T!`#o%T#p~%T$a!>pR$UW'f$XO!^%T!_#o%T#p~%T~!?OO!T~5b!?VT'w5Y$UWO!^%T!_!`5T!`#o%T#p#q!=P#q~%T6X!?oR!S5}nQ$UWO!^%T!_#o%T#p~%TX!@PR!kP$UWO!^%T!_#o%T#p~%T7Z!@gr$UW'Y7R#zS']$y'g3SOX%TXY%cYZ%TZ[%c[p%Tpq%cqt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$f%T$f$g%c$g#BY2`#BY#BZ!@Y#BZ$IS2`$IS$I_!@Y$I_$JT2`$JT$JU!@Y$JU$KV2`$KV$KW!@Y$KW&FU2`&FU&FV!@Y&FV?HT2`?HT?HU!@Y?HU~2`7Z!CO_$UW'Z7R#zS']$y'g3SOt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$g%T$g~2`",tokenizers:[va,ja,wa,_a,0,1,2,3,4,5,6,7,8,9,Wa],topRules:{Script:[0,7]},dialects:{jsx:12107,ts:12109},dynamicPrecedences:{149:1,176:1},specialized:[{term:289,get:t=>za[t]||-1},{term:299,get:t=>Ga[t]||-1},{term:63,get:t=>Ca[t]||-1}],tokenPrec:12130}),Ya=[T("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),T("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),T("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),T("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),T("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),T(`try { + \${} +} catch (\${error}) { + \${} +}`,{label:"try",detail:"/ catch block",type:"keyword"}),T("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),T(`if (\${}) { + \${} +} else { + \${} +}`,{label:"if",detail:"/ else block",type:"keyword"}),T(`class \${name} { + constructor(\${params}) { + \${} + } +}`,{label:"class",detail:"definition",type:"keyword"}),T('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),T('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],LO=new Ce,ue=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function _(t){return(O,e)=>{let a=O.node.getChild("VariableDefinition");return a&&e(a,t),!0}}const Va=["FunctionDeclaration"],Ea={FunctionDeclaration:_("function"),ClassDeclaration:_("class"),ClassExpression:()=>!0,EnumDeclaration:_("constant"),TypeAliasDeclaration:_("type"),NamespaceDeclaration:_("namespace"),VariableDefinition(t,O){t.matchContext(Va)||O(t,"variable")},TypeDefinition(t,O){O(t,"type")},__proto__:null};function de(t,O){let e=LO.get(O);if(e)return e;let a=[],i=!0;function r(s,n){let Q=t.sliceString(s.from,s.to);a.push({label:Q,type:n})}return O.cursor(KO.IncludeAnonymous).iterate(s=>{if(i)i=!1;else if(s.name){let n=Ea[s.name];if(n&&n(s,r)||ue.has(s.name))return!1}else if(s.to-s.from>8192){for(let n of de(t,s.node))a.push(n);return!1}}),LO.set(O,a),a}const FO=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,he=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName"];function Ia(t){let O=z(t.state).resolveInner(t.pos,-1);if(he.indexOf(O.name)>-1)return null;let e=O.name=="VariableName"||O.to-O.from<20&&FO.test(t.state.sliceDoc(O.from,O.to));if(!e&&!t.explicit)return null;let a=[];for(let i=O;i;i=i.parent)ue.has(i.name)&&(a=a.concat(de(t.state.doc,i)));return{options:a,from:e?O.from:t.pos,validFor:FO}}const x=cO.define({name:"javascript",parser:Ua.configure({props:[uO.add({IfStatement:V({except:/^\s*({|else\b)/}),TryStatement:V({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:ze,SwitchBody:t=>{let O=t.textAfter,e=/^\s*\}/.test(O),a=/^\s*(case|default)\b/.test(O);return t.baseIndent+(e?0:a?1:2)*t.unit},Block:Ge({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":V({except:/^{/}),JSXElement(t){let O=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(O?0:t.unit)},JSXEscape(t){let O=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(O?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),dO.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression":HO,BlockComment(t){return{from:t.from+2,to:t.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Aa=x.configure({dialect:"ts"},"typescript"),Na=x.configure({dialect:"jsx"}),Da=x.configure({dialect:"jsx ts"},"typescript"),La="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(t=>({label:t,type:"keyword"}));function $e(t={}){let O=t.jsx?t.typescript?Da:Na:t.typescript?Aa:x;return new hO(O,[x.data.of({autocomplete:ve(he,qe(Ya.concat(La)))}),x.data.of({autocomplete:Ia}),t.jsx?Ja:[]])}function JO(t,O,e=t.length){if(!O)return"";let a=O.getChild("JSXIdentifier");return a?t.sliceString(a.from,Math.min(a.to,e)):""}const Fa=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ja=X.inputHandler.of((t,O,e,a)=>{if((Fa?t.composing:t.compositionStarted)||t.state.readOnly||O!=e||a!=">"&&a!="/"||!x.isActiveAt(t.state,O,-1))return!1;let{state:i}=t,r=i.changeByRange(s=>{var n,Q,c;let{head:u}=s,l=z(i).resolveInner(u,-1),h;if(l.name=="JSXStartTag"&&(l=l.parent),a==">"&&l.name=="JSXFragmentTag")return{range:q.cursor(u+1),changes:{from:u,insert:"><>"}};if(a==">"&&l.name=="JSXIdentifier"){if(((Q=(n=l.parent)===null||n===void 0?void 0:n.lastChild)===null||Q===void 0?void 0:Q.name)!="JSXEndTag"&&(h=JO(i.doc,l.parent,u)))return{range:q.cursor(u+1),changes:{from:u,insert:`>`}}}else if(a=="/"&&l.name=="JSXFragmentTag"){let $=l.parent,p=$==null?void 0:$.parent;if($.from==u-1&&((c=p.lastChild)===null||c===void 0?void 0:c.name)!="JSXEndTag"&&(h=JO(i.doc,p==null?void 0:p.firstChild,u))){let P=`/${h}>`;return{range:q.cursor(u+P.length),changes:{from:u,insert:P}}}}return{range:s}});return r.changes.empty?!1:(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)}),v=["_blank","_self","_top","_parent"],aO=["ascii","utf-8","utf-16","latin1","latin1"],iO=["get","post","put","delete"],rO=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],g=["true","false"],d={},Ma={a:{attrs:{href:null,ping:null,type:null,media:null,target:v,hreflang:null}},abbr:d,address:d,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:d,aside:d,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:d,base:{attrs:{href:null,target:v}},bdi:d,bdo:d,blockquote:{attrs:{cite:null}},body:d,br:d,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:rO,formmethod:iO,formnovalidate:["novalidate"],formtarget:v,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:d,center:d,cite:d,code:d,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:d,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:d,div:d,dl:d,dt:d,em:d,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:d,figure:d,footer:d,form:{attrs:{action:null,name:null,"accept-charset":aO,autocomplete:["on","off"],enctype:rO,method:iO,novalidate:["novalidate"],target:v}},h1:d,h2:d,h3:d,h4:d,h5:d,h6:d,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:d,hgroup:d,hr:d,html:{attrs:{manifest:null}},i:d,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:rO,formmethod:iO,formnovalidate:["novalidate"],formtarget:v,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:d,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:d,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:d,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:aO,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:d,noscript:d,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:d,param:{attrs:{name:null,value:null}},pre:d,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:d,rt:d,ruby:d,samp:d,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:aO}},section:d,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:d,source:{attrs:{src:null,type:null,media:null}},span:d,strong:d,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:d,summary:d,sup:d,table:d,tbody:d,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:d,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:d,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:d,time:{attrs:{datetime:null}},title:d,tr:d,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:d,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:d},Ba={accesskey:null,class:null,contenteditable:g,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:g,autocorrect:g,autocapitalize:g,style:null,tabindex:null,title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":g,"aria-autocomplete":["inline","list","both","none"],"aria-busy":g,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":g,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":g,"aria-hidden":g,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":g,"aria-multiselectable":g,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":g,"aria-relevant":null,"aria-required":g,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null};class J{constructor(O,e){this.tags=Object.assign(Object.assign({},Ma),O),this.globalAttrs=Object.assign(Object.assign({},Ba),e),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}J.default=new J;function Z(t,O,e=t.length){if(!O)return"";let a=O.firstChild,i=a&&a.getChild("TagName");return i?t.sliceString(i.from,Math.min(i.to,e)):""}function M(t,O=!1){for(let e=t.parent;e;e=e.parent)if(e.name=="Element")if(O)O=!1;else return e;return null}function pe(t,O,e){let a=e.tags[Z(t,M(O,!0))];return(a==null?void 0:a.children)||e.allTags}function pO(t,O){let e=[];for(let a=O;a=M(a);){let i=Z(t,a);if(i&&a.lastChild.name=="CloseTag")break;i&&e.indexOf(i)<0&&(O.name=="EndTag"||O.from>=a.firstChild.to)&&e.push(i)}return e}const fe=/^[:\-\.\w\u00b7-\uffff]*$/;function MO(t,O,e,a,i){let r=/\s*>/.test(t.sliceDoc(i,i+5))?"":">";return{from:a,to:i,options:pe(t.doc,e,O).map(s=>({label:s,type:"type"})).concat(pO(t.doc,e).map((s,n)=>({label:"/"+s,apply:"/"+s+r,type:"type",boost:99-n}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function BO(t,O,e,a){let i=/\s*>/.test(t.sliceDoc(a,a+5))?"":">";return{from:e,to:a,options:pO(t.doc,O).map((r,s)=>({label:r,apply:r+i,type:"type",boost:99-s})),validFor:fe}}function Ka(t,O,e,a){let i=[],r=0;for(let s of pe(t.doc,e,O))i.push({label:"<"+s,type:"type"});for(let s of pO(t.doc,e))i.push({label:"",type:"type",boost:99-r++});return{from:a,to:a,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Ha(t,O,e,a,i){let r=M(e),s=r?O.tags[Z(t.doc,r)]:null,n=s&&s.attrs?Object.keys(s.attrs).concat(O.globalAttrNames):O.globalAttrNames;return{from:a,to:i,options:n.map(Q=>({label:Q,type:"property"})),validFor:fe}}function Oi(t,O,e,a,i){var r;let s=(r=e.parent)===null||r===void 0?void 0:r.getChild("AttributeName"),n=[],Q;if(s){let c=t.sliceDoc(s.from,s.to),u=O.globalAttrs[c];if(!u){let l=M(e),h=l?O.tags[Z(t.doc,l)]:null;u=(h==null?void 0:h.attrs)&&h.attrs[c]}if(u){let l=t.sliceDoc(a,i).toLowerCase(),h='"',$='"';/^['"]/.test(l)?(Q=l[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",$=t.sliceDoc(i,i+1)==l[0]?"":l[0],l=l.slice(1),a++):Q=/^[^\s<>='"]*$/;for(let p of u)n.push({label:p,apply:h+p+$,type:"constant"})}}return{from:a,to:i,options:n,validFor:Q}}function ei(t,O){let{state:e,pos:a}=O,i=z(e).resolveInner(a),r=i.resolve(a,-1);for(let s=a,n;i==r&&(n=r.childBefore(s));){let Q=n.lastChild;if(!Q||!Q.type.isError||Q.fromei(a,i)}const oO=cO.define({name:"html",parser:Vt.configure({props:[uO.add({Element(t){let O=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+O[0].length?t.continue():t.lineIndent(t.node.from)+(O[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].length"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});function ai(t={}){let O=oO;return t.matchClosingTags===!1&&(O=O.configure({dialect:"noMatch"})),new hO(O,[oO.data.of({autocomplete:ti(t)}),t.autoCloseTags!==!1?ii:[],$e().support,Qa().support])}const ii=X.inputHandler.of((t,O,e,a)=>{if(t.composing||t.state.readOnly||O!=e||a!=">"&&a!="/"||!oO.isActiveAt(t.state,O,-1))return!1;let{state:i}=t,r=i.changeByRange(s=>{var n,Q,c;let{head:u}=s,l=z(i).resolveInner(u,-1),h;if((l.name=="TagName"||l.name=="StartTag")&&(l=l.parent),a==">"&&l.name=="OpenTag"){if(((Q=(n=l.parent)===null||n===void 0?void 0:n.lastChild)===null||Q===void 0?void 0:Q.name)!="CloseTag"&&(h=Z(i.doc,l.parent,u))){let $=t.state.doc.sliceString(u,u+1)===">",p=`${$?"":">"}`;return{range:q.cursor(u+1),changes:{from:u+($?1:0),insert:p}}}}else if(a=="/"&&l.name=="OpenTag"){let $=l.parent,p=$==null?void 0:$.parent;if($.from==u-1&&((c=p.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(h=Z(i.doc,p,u))){let P=t.state.doc.sliceString(u,u+1)===">",W=`/${h}${P?"":">"}`,j=u+W.length+(P?1:0);return{range:q.cursor(j),changes:{from:u,insert:W}}}}return{range:s}});return r.changes.empty?!1:(t.dispatch(r,{userEvent:"input.type",scrollIntoView:!0}),!0)});function ri(t){let O;return{c(){O=be("div"),Pe(O,"class","code-editor"),SO(O,"max-height",t[0]?t[0]+"px":"auto")},m(e,a){Re(e,O,a),t[10](O)},p(e,[a]){a&1&&SO(O,"max-height",e[0]?e[0]+"px":"auto")},i:bO,o:bO,d(e){e&&ke(O),t[10](null)}}}function si(t,O,e){const a=xe();let{id:i=""}=O,{value:r=""}=O,{maxHeight:s=null}=O,{disabled:n=!1}=O,{placeholder:Q=""}=O,{language:c="javascript"}=O,{singleLine:u=!1}=O,l,h,$=new G,p=new G,P=new G,W=new G;function j(){l==null||l.focus()}function fO(){h==null||h.dispatchEvent(new CustomEvent("change",{detail:{value:r},bubbles:!0}))}function gO(){if(!i)return;const f=document.querySelectorAll('[for="'+i+'"]');for(let m of f)m.removeEventListener("click",j)}function mO(){if(!i)return;gO();const f=document.querySelectorAll('[for="'+i+'"]');for(let m of f)m.addEventListener("click",j)}function TO(){return c==="html"?ai():$e()}Xe(()=>{const f={key:"Enter",run:m=>{u&&a("submit",r)}};return mO(),e(9,l=new X({parent:h,state:w.create({doc:r,extensions:[Ue(),Ye(),Ve(),Ee(),Ie(),w.allowMultipleSelections.of(!0),Ae(Ne,{fallback:!0}),De(),Le(),Fe(),Je(),Me.of([f,...Be,...Ke,He.find(m=>m.key==="Mod-d"),...Ot,...et]),X.lineWrapping,tt({icons:!1}),$.of(TO()),W.of(PO(Q)),p.of(X.editable.of(!0)),P.of(w.readOnly.of(!1)),w.transactionFilter.of(m=>u&&m.newDoc.lines>1?[]:m),X.updateListener.of(m=>{!m.docChanged||n||(e(2,r=m.state.doc.toString()),fO())})]})})),()=>{gO(),l==null||l.destroy()}});function ge(f){ye[f?"unshift":"push"](()=>{h=f,e(1,h)})}return t.$$set=f=>{"id"in f&&e(3,i=f.id),"value"in f&&e(2,r=f.value),"maxHeight"in f&&e(0,s=f.maxHeight),"disabled"in f&&e(4,n=f.disabled),"placeholder"in f&&e(5,Q=f.placeholder),"language"in f&&e(6,c=f.language),"singleLine"in f&&e(7,u=f.singleLine)},t.$$.update=()=>{t.$$.dirty&8&&i&&mO(),t.$$.dirty&576&&l&&c&&l.dispatch({effects:[$.reconfigure(TO())]}),t.$$.dirty&528&&l&&typeof n<"u"&&(l.dispatch({effects:[p.reconfigure(X.editable.of(!n)),P.reconfigure(w.readOnly.of(n))]}),fO()),t.$$.dirty&516&&l&&r!=l.state.doc.toString()&&l.dispatch({changes:{from:0,to:l.state.doc.length,insert:r}}),t.$$.dirty&544&&l&&typeof Q<"u"&&l.dispatch({effects:[W.reconfigure(PO(Q))]})},[s,h,r,i,n,Q,c,u,j,l,ge]}class li extends me{constructor(O){super(),Te(this,O,si,ri,Se,{id:3,value:2,maxHeight:0,disabled:4,placeholder:5,language:6,singleLine:7,focus:8})}get focus(){return this.$$.ctx[8]}}export{li as default}; diff --git a/ui/dist/assets/ConfirmEmailChangeDocs.e9bf0cab.js b/ui/dist/assets/ConfirmEmailChangeDocs.e9bf0cab.js new file mode 100644 index 000000000..b18a1f3bc --- /dev/null +++ b/ui/dist/assets/ConfirmEmailChangeDocs.e9bf0cab.js @@ -0,0 +1,94 @@ +import{S as Ge,i as Xe,s as Ze,O as ze,e as s,w as m,b as p,c as be,f as b,g as r,h as l,m as he,x as j,P as Ye,Q as et,k as tt,R as lt,n as ot,t as I,a as J,o as c,d as _e,L as at,C as je,p as st,r as Q,u as nt}from"./index.97f016a1.js";import{S as it}from"./SdkTabs.88269ae0.js";function Ie(i,o,a){const n=i.slice();return n[5]=o[a],n}function Je(i,o,a){const n=i.slice();return n[5]=o[a],n}function Qe(i,o){let a,n=o[5].code+"",k,v,d,u;function h(){return o[4](o[5])}return{key:i,first:null,c(){a=s("button"),k=m(n),v=p(),b(a,"class","tab-item"),Q(a,"active",o[1]===o[5].code),this.first=a},m(C,$){r(C,a,$),l(a,k),l(a,v),d||(u=nt(a,"click",h),d=!0)},p(C,$){o=C,$&4&&n!==(n=o[5].code+"")&&j(k,n),$&6&&Q(a,"active",o[1]===o[5].code)},d(C){C&&c(a),d=!1,u()}}}function xe(i,o){let a,n,k,v;return n=new ze({props:{content:o[5].body}}),{key:i,first:null,c(){a=s("div"),be(n.$$.fragment),k=p(),b(a,"class","tab-item"),Q(a,"active",o[1]===o[5].code),this.first=a},m(d,u){r(d,a,u),he(n,a,null),l(a,k),v=!0},p(d,u){o=d;const h={};u&4&&(h.content=o[5].body),n.$set(h),(!v||u&6)&&Q(a,"active",o[1]===o[5].code)},i(d){v||(I(n.$$.fragment,d),v=!0)},o(d){J(n.$$.fragment,d),v=!1},d(d){d&&c(a),_e(n)}}}function rt(i){var We,He;let o,a,n=i[0].name+"",k,v,d,u,h,C,$,W=i[0].name+"",x,ke,ve,z,G,y,X,D,Z,w,H,Se,L,A,ge,ee,V=i[0].name+"",te,Ce,le,B,oe,q,ae,U,se,O,ne,$e,ie,T,re,ye,ce,we,_,Oe,E,Te,Pe,Re,de,Ee,pe,De,Ae,Be,ue,qe,fe,M,me,P,N,g=[],Ue=new Map,Me,F,S=[],Ne=new Map,R;y=new it({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${i[3]}'); + + ... + + const authData = await pb.collection('${(We=i[0])==null?void 0:We.name}').confirmEmailChange( + 'TOKEN', + 'YOUR_PASSWORD', + ); + + // after the above you can also access the auth data from the authStore + console.log(pb.authStore.isValid); + console.log(pb.authStore.token); + console.log(pb.authStore.model.id); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${i[3]}'); + + ... + + final authData = await pb.collection('${(He=i[0])==null?void 0:He.name}').confirmEmailChange( + 'TOKEN', + 'YOUR_PASSWORD', + ); + + // after the above you can also access the auth data from the authStore + console.log(pb.authStore.isValid); + console.log(pb.authStore.token); + console.log(pb.authStore.model.id); + `}}),E=new ze({props:{content:"?expand=relField1,relField2.subRelField"}});let Y=i[2];const Fe=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eParam + Type + Description +
Required + token
+ String + The token from the change email request email. +
Required + password
+ String + The account password to confirm the email change.`,ae=p(),U=s("div"),U.textContent="Query parameters",se=p(),O=s("table"),ne=s("thead"),ne.innerHTML=`Param + Type + Description`,$e=p(),ie=s("tbody"),T=s("tr"),re=s("td"),re.textContent="expand",ye=p(),ce=s("td"),ce.innerHTML='String',we=p(),_=s("td"),Oe=m(`Auto expand record relations. Ex.: + `),be(E.$$.fragment),Te=m(` + Supports up to 6-levels depth nested relations expansion. `),Pe=s("br"),Re=m(` + The expanded relations will be appended to the record under the + `),de=s("code"),de.textContent="expand",Ee=m(" property (eg. "),pe=s("code"),pe.textContent='"expand": {"relField1": {...}, ...}',De=m(`). + `),Ae=s("br"),Be=m(` + Only the relations to which the account has permissions to `),ue=s("strong"),ue.textContent="view",qe=m(" will be expanded."),fe=p(),M=s("div"),M.textContent="Responses",me=p(),P=s("div"),N=s("div");for(let e=0;ea(1,v=h.code);return i.$$set=h=>{"collection"in h&&a(0,k=h.collection)},i.$$.update=()=>{i.$$.dirty&1&&a(2,d=[{code:200,body:JSON.stringify({token:"JWT_TOKEN",record:je.dummyCollectionRecord(k)},null,2)},{code:400,body:` + { + "code": 400, + "message": "Failed to authenticate.", + "data": { + "token": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `}])},a(3,n=je.getApiExampleUrl(st.baseUrl)),[k,v,d,n,u]}class ut extends Ge{constructor(o){super(),Xe(this,o,ct,rt,Ze,{collection:0})}}export{ut as default}; diff --git a/ui/dist/assets/ConfirmPasswordResetDocs.f1aa1be6.js b/ui/dist/assets/ConfirmPasswordResetDocs.f1aa1be6.js new file mode 100644 index 000000000..3b0a6c623 --- /dev/null +++ b/ui/dist/assets/ConfirmPasswordResetDocs.f1aa1be6.js @@ -0,0 +1,102 @@ +import{S as Xe,i as Ye,s as Ze,O as Ge,e as a,w as b,b as p,c as me,f as m,g as r,h as l,m as he,x as j,P as Ue,Q as et,k as tt,R as lt,n as st,t as J,a as Q,o as d,d as _e,L as ot,C as je,p as at,r as x,u as nt}from"./index.97f016a1.js";import{S as it}from"./SdkTabs.88269ae0.js";function Je(i,s,o){const n=i.slice();return n[5]=s[o],n}function Qe(i,s,o){const n=i.slice();return n[5]=s[o],n}function xe(i,s){let o,n=s[5].code+"",k,S,c,f;function h(){return s[4](s[5])}return{key:i,first:null,c(){o=a("button"),k=b(n),S=p(),m(o,"class","tab-item"),x(o,"active",s[1]===s[5].code),this.first=o},m(P,R){r(P,o,R),l(o,k),l(o,S),c||(f=nt(o,"click",h),c=!0)},p(P,R){s=P,R&4&&n!==(n=s[5].code+"")&&j(k,n),R&6&&x(o,"active",s[1]===s[5].code)},d(P){P&&d(o),c=!1,f()}}}function ze(i,s){let o,n,k,S;return n=new Ge({props:{content:s[5].body}}),{key:i,first:null,c(){o=a("div"),me(n.$$.fragment),k=p(),m(o,"class","tab-item"),x(o,"active",s[1]===s[5].code),this.first=o},m(c,f){r(c,o,f),he(n,o,null),l(o,k),S=!0},p(c,f){s=c;const h={};f&4&&(h.content=s[5].body),n.$set(h),(!S||f&6)&&x(o,"active",s[1]===s[5].code)},i(c){S||(J(n.$$.fragment,c),S=!0)},o(c){Q(n.$$.fragment,c),S=!1},d(c){c&&d(o),_e(n)}}}function rt(i){var Ke,He;let s,o,n=i[0].name+"",k,S,c,f,h,P,R,K=i[0].name+"",z,ke,Se,G,X,g,Y,W,Z,C,H,ve,L,D,we,ee,V=i[0].name+"",te,Pe,le,E,se,A,oe,M,ae,$,ne,Re,ie,y,re,ge,de,Ce,_,$e,T,ye,Oe,Ne,ce,Te,pe,We,De,Ee,fe,Ae,ue,F,be,O,q,w=[],Me=new Map,Fe,B,v=[],qe=new Map,N;g=new it({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${i[3]}'); + + ... + + const authData = await pb.collection('${(Ke=i[0])==null?void 0:Ke.name}').confirmPasswordReset( + 'TOKEN', + 'NEW_PASSWORD', + 'NEW_PASSWORD_CONFIRM', + ); + + // after the above you can also access the refreshed auth data from the authStore + console.log(pb.authStore.isValid); + console.log(pb.authStore.token); + console.log(pb.authStore.model.id); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${i[3]}'); + + ... + + final authData = await pb.collection('${(He=i[0])==null?void 0:He.name}').confirmPasswordReset( + 'TOKEN', + 'NEW_PASSWORD', + 'NEW_PASSWORD_CONFIRM', + ); + + // after the above you can also access the refreshed auth data from the authStore + console.log(pb.authStore.isValid); + console.log(pb.authStore.token); + console.log(pb.authStore.model.id); + `}}),T=new Ge({props:{content:"?expand=relField1,relField2.subRelField"}});let U=i[2];const Be=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eParam + Type + Description +
Required + token
+ String + The token from the password reset request email. +
Required + password
+ String + The new password to set. +
Required + passwordConfirm
+ String + The new password confirmation.`,oe=p(),M=a("div"),M.textContent="Query parameters",ae=p(),$=a("table"),ne=a("thead"),ne.innerHTML=`Param + Type + Description`,Re=p(),ie=a("tbody"),y=a("tr"),re=a("td"),re.textContent="expand",ge=p(),de=a("td"),de.innerHTML='String',Ce=p(),_=a("td"),$e=b(`Auto expand record relations. Ex.: + `),me(T.$$.fragment),ye=b(` + Supports up to 6-levels depth nested relations expansion. `),Oe=a("br"),Ne=b(` + The expanded relations will be appended to the record under the + `),ce=a("code"),ce.textContent="expand",Te=b(" property (eg. "),pe=a("code"),pe.textContent='"expand": {"relField1": {...}, ...}',We=b(`). + `),De=a("br"),Ee=b(` + Only the relations to which the account has permissions to `),fe=a("strong"),fe.textContent="view",Ae=b(" will be expanded."),ue=p(),F=a("div"),F.textContent="Responses",be=p(),O=a("div"),q=a("div");for(let e=0;eo(1,S=h.code);return i.$$set=h=>{"collection"in h&&o(0,k=h.collection)},i.$$.update=()=>{i.$$.dirty&1&&o(2,c=[{code:200,body:JSON.stringify({token:"JWT_TOKEN",record:je.dummyCollectionRecord(k)},null,2)},{code:400,body:` + { + "code": 400, + "message": "Failed to authenticate.", + "data": { + "token": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `}])},o(3,n=je.getApiExampleUrl(at.baseUrl)),[k,S,c,n,f]}class ft extends Xe{constructor(s){super(),Ye(this,s,dt,rt,Ze,{collection:0})}}export{ft as default}; diff --git a/ui/dist/assets/ConfirmVerificationDocs.e35127c6.js b/ui/dist/assets/ConfirmVerificationDocs.e35127c6.js new file mode 100644 index 000000000..504f6493b --- /dev/null +++ b/ui/dist/assets/ConfirmVerificationDocs.e35127c6.js @@ -0,0 +1,78 @@ +import{S as Ye,i as Ze,s as xe,O as Xe,e as a,w as b,b as f,c as me,f as m,g as r,h as l,m as he,x as J,P as Ie,Q as et,k as tt,R as lt,n as ot,t as Q,a as W,o as c,d as _e,L as st,C as Je,p as at,r as z,u as nt}from"./index.97f016a1.js";import{S as it}from"./SdkTabs.88269ae0.js";function Qe(i,o,s){const n=i.slice();return n[5]=o[s],n}function We(i,o,s){const n=i.slice();return n[5]=o[s],n}function ze(i,o){let s,n=o[5].code+"",k,v,d,p;function h(){return o[4](o[5])}return{key:i,first:null,c(){s=a("button"),k=b(n),v=f(),m(s,"class","tab-item"),z(s,"active",o[1]===o[5].code),this.first=s},m(y,g){r(y,s,g),l(s,k),l(s,v),d||(p=nt(s,"click",h),d=!0)},p(y,g){o=y,g&4&&n!==(n=o[5].code+"")&&J(k,n),g&6&&z(s,"active",o[1]===o[5].code)},d(y){y&&c(s),d=!1,p()}}}function Ge(i,o){let s,n,k,v;return n=new Xe({props:{content:o[5].body}}),{key:i,first:null,c(){s=a("div"),me(n.$$.fragment),k=f(),m(s,"class","tab-item"),z(s,"active",o[1]===o[5].code),this.first=s},m(d,p){r(d,s,p),he(n,s,null),l(s,k),v=!0},p(d,p){o=d;const h={};p&4&&(h.content=o[5].body),n.$set(h),(!v||p&6)&&z(s,"active",o[1]===o[5].code)},i(d){v||(Q(n.$$.fragment,d),v=!0)},o(d){W(n.$$.fragment,d),v=!1},d(d){d&&c(s),_e(n)}}}function rt(i){var He,Le;let o,s,n=i[0].name+"",k,v,d,p,h,y,g,H=i[0].name+"",G,ke,ve,X,Y,w,Z,D,x,C,L,Se,U,E,$e,ee,j=i[0].name+"",te,ye,le,q,oe,M,se,N,ae,T,ne,ge,ie,P,re,we,ce,Ce,_,Te,B,Pe,Oe,Ve,de,Be,fe,De,Ee,qe,pe,Me,ue,R,be,O,F,$=[],Ne=new Map,Re,K,S=[],Fe=new Map,V;w=new it({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${i[3]}'); + + ... + + const authData = await pb.collection('${(He=i[0])==null?void 0:He.name}').confirmVerification('TOKEN'); + + // after the above you can also access the auth data from the authStore + console.log(pb.authStore.isValid); + console.log(pb.authStore.token); + console.log(pb.authStore.model.id); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${i[3]}'); + + ... + + final authData = await pb.collection('${(Le=i[0])==null?void 0:Le.name}').confirmVerification('TOKEN'); + + // after the above you can also access the auth data from the authStore + console.log(pb.authStore.isValid); + console.log(pb.authStore.token); + console.log(pb.authStore.model.id); + `}}),B=new Xe({props:{content:"?expand=relField1,relField2.subRelField"}});let I=i[2];const Ke=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eParam + Type + Description +
Required + token
+ String + The token from the verification request email.`,se=f(),N=a("div"),N.textContent="Query parameters",ae=f(),T=a("table"),ne=a("thead"),ne.innerHTML=`Param + Type + Description`,ge=f(),ie=a("tbody"),P=a("tr"),re=a("td"),re.textContent="expand",we=f(),ce=a("td"),ce.innerHTML='String',Ce=f(),_=a("td"),Te=b(`Auto expand record relations. Ex.: + `),me(B.$$.fragment),Pe=b(` + Supports up to 6-levels depth nested relations expansion. `),Oe=a("br"),Ve=b(` + The expanded relations will be appended to the record under the + `),de=a("code"),de.textContent="expand",Be=b(" property (eg. "),fe=a("code"),fe.textContent='"expand": {"relField1": {...}, ...}',De=b(`). + `),Ee=a("br"),qe=b(` + Only the relations to which the account has permissions to `),pe=a("strong"),pe.textContent="view",Me=b(" will be expanded."),ue=f(),R=a("div"),R.textContent="Responses",be=f(),O=a("div"),F=a("div");for(let e=0;e<$.length;e+=1)$[e].c();Re=f(),K=a("div");for(let e=0;es(1,v=h.code);return i.$$set=h=>{"collection"in h&&s(0,k=h.collection)},i.$$.update=()=>{i.$$.dirty&1&&s(2,d=[{code:200,body:JSON.stringify({token:"JWT_TOKEN",record:Je.dummyCollectionRecord(k)},null,2)},{code:400,body:` + { + "code": 400, + "message": "Failed to authenticate.", + "data": { + "token": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `}])},s(3,n=Je.getApiExampleUrl(at.baseUrl)),[k,v,d,n,p]}class pt extends Ye{constructor(o){super(),Ze(this,o,ct,rt,xe,{collection:0})}}export{pt as default}; diff --git a/ui/dist/assets/CreateApiDocs.60f76221.js b/ui/dist/assets/CreateApiDocs.60f76221.js new file mode 100644 index 000000000..1069594d0 --- /dev/null +++ b/ui/dist/assets/CreateApiDocs.60f76221.js @@ -0,0 +1,102 @@ +import{S as Ct,i as St,s as Tt,C as Q,O as wt,e as a,w as k,b,c as Pe,f as h,g as o,h as n,m as Re,x as Z,P as Ae,Q as pt,k as $t,R as Ot,n as Mt,t as fe,a as pe,o as r,d as ge,L as Lt,p as Ht,r as ue,u as qt,y as le}from"./index.97f016a1.js";import{S as At}from"./SdkTabs.88269ae0.js";function ut(d,e,l){const s=d.slice();return s[7]=e[l],s}function bt(d,e,l){const s=d.slice();return s[7]=e[l],s}function mt(d,e,l){const s=d.slice();return s[12]=e[l],s}function _t(d){let e;return{c(){e=a("p"),e.innerHTML="Requires admin Authorization:TOKEN header",h(e,"class","txt-hint txt-sm txt-right")},m(l,s){o(l,e,s)},d(l){l&&r(e)}}}function kt(d){let e,l,s,m,p,c,f,y,$,w,M,F,D,I,A,J,j,g,S,N,O,C,_;function L(u,T){var ee,z;return(z=(ee=u[0])==null?void 0:ee.options)!=null&&z.requireEmail?Rt:Pt}let x=L(d),P=x(d);return{c(){e=a("tr"),e.innerHTML='Auth fields',l=b(),s=a("tr"),s.innerHTML=`
Optional + username
+ String + The username of the auth record. +
+ If not set, it will be auto generated.`,m=b(),p=a("tr"),c=a("td"),f=a("div"),P.c(),y=b(),$=a("span"),$.textContent="email",w=b(),M=a("td"),M.innerHTML='String',F=b(),D=a("td"),D.textContent="Auth record email address.",I=b(),A=a("tr"),A.innerHTML=`
Optional + emailVisibility
+ Boolean + Whether to show/hide the auth record email when fetching the record data.`,J=b(),j=a("tr"),j.innerHTML=`
Required + password
+ String + Auth record password.`,g=b(),S=a("tr"),S.innerHTML=`
Required + passwordConfirm
+ String + Auth record password confirmation.`,N=b(),O=a("tr"),O.innerHTML=`
Optional + verified
+ Boolean + Indicates whether the auth record is verified or not. +
+ This field can be set only by admins or auth records with "Manage" access.`,C=b(),_=a("tr"),_.innerHTML='Schema fields',h(f,"class","inline-flex")},m(u,T){o(u,e,T),o(u,l,T),o(u,s,T),o(u,m,T),o(u,p,T),n(p,c),n(c,f),P.m(f,null),n(f,y),n(f,$),n(p,w),n(p,M),n(p,F),n(p,D),o(u,I,T),o(u,A,T),o(u,J,T),o(u,j,T),o(u,g,T),o(u,S,T),o(u,N,T),o(u,O,T),o(u,C,T),o(u,_,T)},p(u,T){x!==(x=L(u))&&(P.d(1),P=x(u),P&&(P.c(),P.m(f,y)))},d(u){u&&r(e),u&&r(l),u&&r(s),u&&r(m),u&&r(p),P.d(),u&&r(I),u&&r(A),u&&r(J),u&&r(j),u&&r(g),u&&r(S),u&&r(N),u&&r(O),u&&r(C),u&&r(_)}}}function Pt(d){let e;return{c(){e=a("span"),e.textContent="Optional",h(e,"class","label label-warning")},m(l,s){o(l,e,s)},d(l){l&&r(e)}}}function Rt(d){let e;return{c(){e=a("span"),e.textContent="Required",h(e,"class","label label-success")},m(l,s){o(l,e,s)},d(l){l&&r(e)}}}function gt(d){let e;return{c(){e=a("span"),e.textContent="Optional",h(e,"class","label label-warning")},m(l,s){o(l,e,s)},d(l){l&&r(e)}}}function Bt(d){let e;return{c(){e=a("span"),e.textContent="Required",h(e,"class","label label-success")},m(l,s){o(l,e,s)},d(l){l&&r(e)}}}function Ft(d){var p;let e,l=((p=d[12].options)==null?void 0:p.maxSelect)===1?"id":"ids",s,m;return{c(){e=k("Relation record "),s=k(l),m=k(".")},m(c,f){o(c,e,f),o(c,s,f),o(c,m,f)},p(c,f){var y;f&1&&l!==(l=((y=c[12].options)==null?void 0:y.maxSelect)===1?"id":"ids")&&Z(s,l)},d(c){c&&r(e),c&&r(s),c&&r(m)}}}function jt(d){let e,l,s,m,p;return{c(){e=k("File object."),l=a("br"),s=k(` + Set to `),m=a("code"),m.textContent="null",p=k(" to delete already uploaded file(s).")},m(c,f){o(c,e,f),o(c,l,f),o(c,s,f),o(c,m,f),o(c,p,f)},p:le,d(c){c&&r(e),c&&r(l),c&&r(s),c&&r(m),c&&r(p)}}}function Dt(d){let e;return{c(){e=k("URL address.")},m(l,s){o(l,e,s)},p:le,d(l){l&&r(e)}}}function Nt(d){let e;return{c(){e=k("Email address.")},m(l,s){o(l,e,s)},p:le,d(l){l&&r(e)}}}function It(d){let e;return{c(){e=k("JSON array or object.")},m(l,s){o(l,e,s)},p:le,d(l){l&&r(e)}}}function Jt(d){let e;return{c(){e=k("Number value.")},m(l,s){o(l,e,s)},p:le,d(l){l&&r(e)}}}function Et(d){let e;return{c(){e=k("Plain text value.")},m(l,s){o(l,e,s)},p:le,d(l){l&&r(e)}}}function yt(d,e){let l,s,m,p,c,f=e[12].name+"",y,$,w,M,F=Q.getFieldValueType(e[12])+"",D,I,A,J;function j(_,L){return _[12].required?Bt:gt}let g=j(e),S=g(e);function N(_,L){if(_[12].type==="text")return Et;if(_[12].type==="number")return Jt;if(_[12].type==="json")return It;if(_[12].type==="email")return Nt;if(_[12].type==="url")return Dt;if(_[12].type==="file")return jt;if(_[12].type==="relation")return Ft}let O=N(e),C=O&&O(e);return{key:d,first:null,c(){l=a("tr"),s=a("td"),m=a("div"),S.c(),p=b(),c=a("span"),y=k(f),$=b(),w=a("td"),M=a("span"),D=k(F),I=b(),A=a("td"),C&&C.c(),J=b(),h(m,"class","inline-flex"),h(M,"class","label"),this.first=l},m(_,L){o(_,l,L),n(l,s),n(s,m),S.m(m,null),n(m,p),n(m,c),n(c,y),n(l,$),n(l,w),n(w,M),n(M,D),n(l,I),n(l,A),C&&C.m(A,null),n(l,J)},p(_,L){e=_,g!==(g=j(e))&&(S.d(1),S=g(e),S&&(S.c(),S.m(m,p))),L&1&&f!==(f=e[12].name+"")&&Z(y,f),L&1&&F!==(F=Q.getFieldValueType(e[12])+"")&&Z(D,F),O===(O=N(e))&&C?C.p(e,L):(C&&C.d(1),C=O&&O(e),C&&(C.c(),C.m(A,null)))},d(_){_&&r(l),S.d(),C&&C.d()}}}function vt(d,e){let l,s=e[7].code+"",m,p,c,f;function y(){return e[6](e[7])}return{key:d,first:null,c(){l=a("button"),m=k(s),p=b(),h(l,"class","tab-item"),ue(l,"active",e[1]===e[7].code),this.first=l},m($,w){o($,l,w),n(l,m),n(l,p),c||(f=qt(l,"click",y),c=!0)},p($,w){e=$,w&4&&s!==(s=e[7].code+"")&&Z(m,s),w&6&&ue(l,"active",e[1]===e[7].code)},d($){$&&r(l),c=!1,f()}}}function ht(d,e){let l,s,m,p;return s=new wt({props:{content:e[7].body}}),{key:d,first:null,c(){l=a("div"),Pe(s.$$.fragment),m=b(),h(l,"class","tab-item"),ue(l,"active",e[1]===e[7].code),this.first=l},m(c,f){o(c,l,f),Re(s,l,null),n(l,m),p=!0},p(c,f){e=c;const y={};f&4&&(y.content=e[7].body),s.$set(y),(!p||f&6)&&ue(l,"active",e[1]===e[7].code)},i(c){p||(fe(s.$$.fragment,c),p=!0)},o(c){pe(s.$$.fragment,c),p=!1},d(c){c&&r(l),ge(s)}}}function Ut(d){var st,it,at,ot;let e,l,s=d[0].name+"",m,p,c,f,y,$,w,M=d[0].name+"",F,D,I,A,J,j,g,S,N,O,C,_,L,x,P,u,T,ee,z=d[0].name+"",be,Be,Fe,me,ne,_e,K,ke,je,E,ye,De,ve,U=[],Ne=new Map,he,se,we,W,Ce,Ie,Se,Y,Te,Je,$e,Ee,H,Ue,te,Ve,Qe,xe,Oe,ze,Me,Ke,We,Ye,Le,Ge,He,ie,qe,G,ae,V=[],Xe=new Map,Ze,oe,B=[],et=new Map,X;S=new At({props:{js:` +import PocketBase from 'pocketbase'; + +const pb = new PocketBase('${d[4]}'); + +... + +// example create data +const data = ${JSON.stringify(Object.assign({},d[3],Q.dummyCollectionSchemaData(d[0])),null,4)}; + +const record = await pb.collection('${(st=d[0])==null?void 0:st.name}').create(data); + `,dart:` +import 'package:pocketbase/pocketbase.dart'; + +final pb = PocketBase('${d[4]}'); + +... + +// example create body +final body = ${JSON.stringify(Object.assign({},d[3],Q.dummyCollectionSchemaData(d[0])),null,2)}; + +final record = await pb.collection('${(it=d[0])==null?void 0:it.name}').create(body: body); + `}});let R=d[5]&&_t(),q=((at=d[0])==null?void 0:at.isAuth)&&kt(d),de=(ot=d[0])==null?void 0:ot.schema;const tt=t=>t[12].name;for(let t=0;tt[7].code;for(let t=0;tt[7].code;for(let t=0;tapplication/json or + multipart/form-data.`,J=b(),j=a("p"),j.innerHTML=`File upload is supported only via multipart/form-data. +
+ For more info and examples you could check the detailed + Files upload and handling docs + .`,g=b(),Pe(S.$$.fragment),N=b(),O=a("h6"),O.textContent="API details",C=b(),_=a("div"),L=a("strong"),L.textContent="POST",x=b(),P=a("div"),u=a("p"),T=k("/api/collections/"),ee=a("strong"),be=k(z),Be=k("/records"),Fe=b(),R&&R.c(),me=b(),ne=a("div"),ne.textContent="Body Parameters",_e=b(),K=a("table"),ke=a("thead"),ke.innerHTML=`Param + Type + Description`,je=b(),E=a("tbody"),ye=a("tr"),ye.innerHTML=`
Optional + id
+ String + 15 characters string to store as record ID. +
+ If not set, it will be auto generated.`,De=b(),q&&q.c(),ve=b();for(let t=0;tParam + Type + Description`,Ie=b(),Se=a("tbody"),Y=a("tr"),Te=a("td"),Te.textContent="expand",Je=b(),$e=a("td"),$e.innerHTML='String',Ee=b(),H=a("td"),Ue=k(`Auto expand relations when returning the created record. Ex.: + `),Pe(te.$$.fragment),Ve=k(` + Supports up to 6-levels depth nested relations expansion. `),Qe=a("br"),xe=k(` + The expanded relations will be appended to the record under the + `),Oe=a("code"),Oe.textContent="expand",ze=k(" property (eg. "),Me=a("code"),Me.textContent='"expand": {"relField1": {...}, ...}',Ke=k(`). + `),We=a("br"),Ye=k(` + Only the relations to which the account has permissions to `),Le=a("strong"),Le.textContent="view",Ge=k(" will be expanded."),He=b(),ie=a("div"),ie.textContent="Responses",qe=b(),G=a("div"),ae=a("div");for(let t=0;t${JSON.stringify(Object.assign({},t[3],Q.dummyCollectionSchemaData(t[0])),null,2)}; + +final record = await pb.collection('${(dt=t[0])==null?void 0:dt.name}').create(body: body); + `),S.$set(v),(!X||i&1)&&z!==(z=t[0].name+"")&&Z(be,z),t[5]?R||(R=_t(),R.c(),R.m(_,null)):R&&(R.d(1),R=null),(ct=t[0])!=null&&ct.isAuth?q?q.p(t,i):(q=kt(t),q.c(),q.m(E,ve)):q&&(q.d(1),q=null),i&1&&(de=(ft=t[0])==null?void 0:ft.schema,U=Ae(U,i,tt,1,t,de,Ne,E,pt,yt,null,mt)),i&6&&(ce=t[2],V=Ae(V,i,lt,1,t,ce,Xe,ae,pt,vt,null,bt)),i&6&&(re=t[2],$t(),B=Ae(B,i,nt,1,t,re,et,oe,Ot,ht,null,ut),Mt())},i(t){if(!X){fe(S.$$.fragment,t),fe(te.$$.fragment,t);for(let i=0;il(1,c=w.code);return d.$$set=w=>{"collection"in w&&l(0,p=w.collection)},d.$$.update=()=>{var w,M;d.$$.dirty&1&&l(5,s=(p==null?void 0:p.createRule)===null),d.$$.dirty&1&&l(2,f=[{code:200,body:JSON.stringify(Q.dummyCollectionRecord(p),null,2)},{code:400,body:` + { + "code": 400, + "message": "Failed to create record.", + "data": { + "${(M=(w=p==null?void 0:p.schema)==null?void 0:w[0])==null?void 0:M.name}": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `},{code:403,body:` + { + "code": 403, + "message": "You are not allowed to perform this request.", + "data": {} + } + `}]),d.$$.dirty&1&&(p.isAuth?l(3,y={username:"test_username",email:"test@exampe.com",emailVisibility:!0,password:"12345678",passwordConfirm:"12345678"}):l(3,y={}))},l(4,m=Q.getApiExampleUrl(Ht.baseUrl)),[p,c,f,y,m,s,$]}class zt extends Ct{constructor(e){super(),St(this,e,Vt,Ut,Tt,{collection:0})}}export{zt as default}; diff --git a/ui/dist/assets/DeleteApiDocs.06551842.js b/ui/dist/assets/DeleteApiDocs.06551842.js new file mode 100644 index 000000000..528dfa320 --- /dev/null +++ b/ui/dist/assets/DeleteApiDocs.06551842.js @@ -0,0 +1,58 @@ +import{S as Ce,i as Re,s as Pe,e as c,w as D,b as k,c as $e,f as m,g as d,h as n,m as we,x,P as _e,Q as Ee,k as Oe,R as Te,n as Be,t as ee,a as te,o as f,d as ge,L as Ie,C as Ae,p as Me,r as z,u as Se,O as qe}from"./index.97f016a1.js";import{S as Le}from"./SdkTabs.88269ae0.js";function ke(o,l,s){const a=o.slice();return a[6]=l[s],a}function he(o,l,s){const a=o.slice();return a[6]=l[s],a}function ve(o){let l;return{c(){l=c("p"),l.innerHTML="Requires admin Authorization:TOKEN header",m(l,"class","txt-hint txt-sm txt-right")},m(s,a){d(s,l,a)},d(s){s&&f(l)}}}function ye(o,l){let s,a=l[6].code+"",h,i,r,u;function $(){return l[5](l[6])}return{key:o,first:null,c(){s=c("button"),h=D(a),i=k(),m(s,"class","tab-item"),z(s,"active",l[2]===l[6].code),this.first=s},m(b,g){d(b,s,g),n(s,h),n(s,i),r||(u=Se(s,"click",$),r=!0)},p(b,g){l=b,g&20&&z(s,"active",l[2]===l[6].code)},d(b){b&&f(s),r=!1,u()}}}function De(o,l){let s,a,h,i;return a=new qe({props:{content:l[6].body}}),{key:o,first:null,c(){s=c("div"),$e(a.$$.fragment),h=k(),m(s,"class","tab-item"),z(s,"active",l[2]===l[6].code),this.first=s},m(r,u){d(r,s,u),we(a,s,null),n(s,h),i=!0},p(r,u){l=r,(!i||u&20)&&z(s,"active",l[2]===l[6].code)},i(r){i||(ee(a.$$.fragment,r),i=!0)},o(r){te(a.$$.fragment,r),i=!1},d(r){r&&f(s),ge(a)}}}function He(o){var ue,pe;let l,s,a=o[0].name+"",h,i,r,u,$,b,g,q=o[0].name+"",F,le,K,C,N,O,Q,y,L,se,H,E,oe,G,U=o[0].name+"",J,ae,V,ne,W,T,X,B,Y,I,Z,R,A,w=[],ie=new Map,re,M,v=[],ce=new Map,P;C=new Le({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${o[3]}'); + + ... + + await pb.collection('${(ue=o[0])==null?void 0:ue.name}').delete('RECORD_ID'); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${o[3]}'); + + ... + + await pb.collection('${(pe=o[0])==null?void 0:pe.name}').delete('RECORD_ID'); + `}});let _=o[1]&&ve(),j=o[4];const de=e=>e[6].code;for(let e=0;ee[6].code;for(let e=0;eParam + Type + Description + id + String + ID of the record to delete.`,Y=k(),I=c("div"),I.textContent="Responses",Z=k(),R=c("div"),A=c("div");for(let e=0;es(2,r=b.code);return o.$$set=b=>{"collection"in b&&s(0,i=b.collection)},o.$$.update=()=>{o.$$.dirty&1&&s(1,a=(i==null?void 0:i.deleteRule)===null),o.$$.dirty&3&&i!=null&&i.id&&(u.push({code:204,body:` + null + `}),u.push({code:400,body:` + { + "code": 400, + "message": "Failed to delete record. Make sure that the record is not part of a required relation reference.", + "data": {} + } + `}),a&&u.push({code:403,body:` + { + "code": 403, + "message": "Only admins can access this action.", + "data": {} + } + `}),u.push({code:404,body:` + { + "code": 404, + "message": "The requested resource wasn't found.", + "data": {} + } + `}))},s(3,h=Ae.getApiExampleUrl(Me.baseUrl)),[i,a,r,h,u,$]}class Fe extends Ce{constructor(l){super(),Re(this,l,Ue,He,Pe,{collection:0})}}export{Fe as default}; diff --git a/ui/dist/assets/FilterAutocompleteInput.37739e76.js b/ui/dist/assets/FilterAutocompleteInput.37739e76.js deleted file mode 100644 index 922c4b3ee..000000000 --- a/ui/dist/assets/FilterAutocompleteInput.37739e76.js +++ /dev/null @@ -1 +0,0 @@ -import{S as z,i as Q,s as X,e as Y,f as Z,g as j,y as _,o as $,H as ee,I as te,J as ne,K as ie,L as oe,C as L,M as re}from"./index.e13041a6.js";import{C as E,E as w,a as S,h as se,b as le,c as ae,d as ce,e as ue,s as fe,f as de,g as ge,i as he,r as pe,j as ye,k as me,l as be,m as ke,n as xe,o as we,p as Se,q as Ce,t as P,S as Ke}from"./index.a9121ab1.js";function qe(t){G(t,"start");var i={},e=t.languageData||{},d=!1;for(var g in t)if(g!=e&&t.hasOwnProperty(g))for(var p=i[g]=[],s=t[g],o=0;o2&&s.token&&typeof s.token!="string"){e.pending=[];for(var u=2;u-1)return null;var g=e.indent.length-1,p=t[e.state];e:for(;;){for(var s=0;se(12,g=n));const p=ne();let{id:s=""}=i,{value:o=""}=i,{disabled:l=!1}=i,{placeholder:u=""}=i,{baseCollection:y=new ie}=i,{singleLine:C=!1}=i,{extraAutocompleteKeys:I=[]}=i,{disableRequestKeys:k=!1}=i,{disableIndirectCollectionsKeys:K=!1}=i,f,b,A=new E,M=new E,F=new E,O=new E;function v(){f==null||f.focus()}function J(n){let r=n.slice();return L.pushOrReplaceByKey(r,y,"id"),r}function B(){b==null||b.dispatchEvent(new CustomEvent("change",{detail:{value:o},bubbles:!0}))}function W(){if(!s)return;const n=document.querySelectorAll('[for="'+s+'"]');for(let r of n)r.removeEventListener("click",v)}function D(){if(!s)return;W();const n=document.querySelectorAll('[for="'+s+'"]');for(let r of n)r.addEventListener("click",v)}function R(n,r="",a=0){let m=d.find(c=>c.name==n||c.id==n);if(!m||a>=4)return[];let h=[r+"id",r+"created",r+"updated"];for(const c of m.schema){const x=r+c.name;if(c.type==="relation"&&c.options.collectionId){const q=R(c.options.collectionId,x+".",a+1);q.length?h=h.concat(q):h.push(x)}else h.push(x)}return h}function H(n=!0,r=!0){let a=[].concat(I);const m=R(y.name);for(const h of m)a.push(h);if(n&&(a.push("@request.method"),a.push("@request.query."),a.push("@request.data."),a.push("@request.user.id"),a.push("@request.user.email"),a.push("@request.user.verified"),a.push("@request.user.created"),a.push("@request.user.updated")),n||r)for(const h of d){let c="";if(h.name==="profiles"){if(!n)continue;c="@request.user.profile."}else{if(!r)continue;c="@collection."+h.name+"."}const x=R(h.name,c);for(const q of x)a.push(q)}return a.sort(function(h,c){return c.length-h.length}),a}function N(n){let r=n.matchBefore(/[\@\w\.]*/);if(r.from==r.to&&!n.explicit)return null;let a=[{label:"false"},{label:"true"},{label:"@now"}];K||a.push({label:"@collection.*",apply:"@collection."});const m=["@request.user.profile.userId","@request.user.profile.created","@request.user.profile.updated"],h=H(!k,!k&&r.text.startsWith("@c"));for(const c of h)m.includes(c)||a.push({label:c.endsWith(".")?c+"*":c,apply:c});return{from:r.from,options:a}}function T(){const n=[{regex:L.escapeRegExp("@now"),token:"keyword"}],r=H(!k,!K);for(const a of r){let m;a.endsWith(".")?m=L.escapeRegExp(a)+"\\w+[\\w.]*":m=L.escapeRegExp(a),n.push({regex:m,token:"keyword"})}return n}function U(){return Ke.define(qe({start:[{regex:/true|false|null/,token:"atom"},{regex:/"(?:[^\\]|\\.)*?(?:"|$)/,token:"string"},{regex:/'(?:[^\\]|\\.)*?(?:'|$)/,token:"string"},{regex:/0x[a-f\d]+|[-+]?(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i,token:"number"},{regex:/\&\&|\|\||\=|\!\=|\~|\!\~|\>|\<|\>\=|\<\=/,token:"operator"},{regex:/[\{\[\(]/,indent:!0},{regex:/[\}\]\)]/,dedent:!0}].concat(T())}))}oe(()=>{const n={key:"Enter",run:r=>{C&&p("submit",o)}};return D(),e(11,f=new w({parent:b,state:S.create({doc:o,extensions:[se(),le(),ae(),ce(),ue(),S.allowMultipleSelections.of(!0),fe(de,{fallback:!0}),ge(),he(),pe(),ye(),me.of([n,...be,...ke,xe.find(r=>r.key==="Mod-d"),...we,...Se]),w.lineWrapping,Ce({override:[N],icons:!1}),O.of(P(u)),M.of(w.editable.of(!0)),F.of(S.readOnly.of(!1)),A.of(U()),S.transactionFilter.of(r=>C&&r.newDoc.lines>1?[]:r),w.updateListener.of(r=>{!r.docChanged||l||(e(1,o=r.state.doc.toString()),B())})]})})),()=>{W(),f==null||f.destroy()}});function V(n){re[n?"unshift":"push"](()=>{b=n,e(0,b)})}return t.$$set=n=>{"id"in n&&e(2,s=n.id),"value"in n&&e(1,o=n.value),"disabled"in n&&e(3,l=n.disabled),"placeholder"in n&&e(4,u=n.placeholder),"baseCollection"in n&&e(5,y=n.baseCollection),"singleLine"in n&&e(6,C=n.singleLine),"extraAutocompleteKeys"in n&&e(7,I=n.extraAutocompleteKeys),"disableRequestKeys"in n&&e(8,k=n.disableRequestKeys),"disableIndirectCollectionsKeys"in n&&e(9,K=n.disableIndirectCollectionsKeys)},t.$$.update=()=>{t.$$.dirty&4096&&(d=J(g)),t.$$.dirty&4&&s&&D(),t.$$.dirty&2080&&f&&(y==null?void 0:y.schema)&&f.dispatch({effects:[A.reconfigure(U())]}),t.$$.dirty&2056&&f&&typeof l<"u"&&(f.dispatch({effects:[M.reconfigure(w.editable.of(!l)),F.reconfigure(S.readOnly.of(l))]}),B()),t.$$.dirty&2050&&f&&o!=f.state.doc.toString()&&f.dispatch({changes:{from:0,to:f.state.doc.length,insert:o}}),t.$$.dirty&2064&&f&&typeof u<"u"&&f.dispatch({effects:[O.reconfigure(P(u))]})},[b,o,s,l,u,y,C,I,k,K,v,f,g,V]}class Oe extends z{constructor(i){super(),Q(this,i,Ae,_e,X,{id:2,value:1,disabled:3,placeholder:4,baseCollection:5,singleLine:6,extraAutocompleteKeys:7,disableRequestKeys:8,disableIndirectCollectionsKeys:9,focus:10})}get focus(){return this.$$.ctx[10]}}export{Oe as default}; diff --git a/ui/dist/assets/FilterAutocompleteInput.7da1d2a3.js b/ui/dist/assets/FilterAutocompleteInput.7da1d2a3.js new file mode 100644 index 000000000..4771896fd --- /dev/null +++ b/ui/dist/assets/FilterAutocompleteInput.7da1d2a3.js @@ -0,0 +1 @@ +import{S as z,i as Q,s as X,e as Y,f as Z,g as j,y as A,o as $,I as ee,J as te,K as ne,L as ie,M as oe,C as L,N as re}from"./index.97f016a1.js";import{C as E,E as x,a as w,h as se,b as le,c as ae,d as ue,e as ce,s as fe,f as de,g as he,i as ge,r as pe,j as ye,k as me,l as be,m as ke,n as xe,o as we,p as Se,q as Ce,t as U,S as qe}from"./index.9c8b95cd.js";function Ke(t){V(t,"start");var i={},e=t.languageData||{},d=!1;for(var h in t)if(h!=e&&t.hasOwnProperty(h))for(var p=i[h]=[],s=t[h],r=0;r2&&s.token&&typeof s.token!="string"){e.pending=[];for(var c=2;c-1)return null;var h=e.indent.length-1,p=t[e.state];e:for(;;){for(var s=0;se(12,h=n));const p=ne();let{id:s=""}=i,{value:r=""}=i,{disabled:a=!1}=i,{placeholder:c=""}=i,{baseCollection:m=new ie}=i,{singleLine:S=!1}=i,{extraAutocompleteKeys:I=[]}=i,{disableRequestKeys:k=!1}=i,{disableIndirectCollectionsKeys:C=!1}=i,f,b,_=new E,M=new E,O=new E,B=new E;function v(){f==null||f.focus()}function P(n){let o=n.slice();return L.pushOrReplaceByKey(o,m,"id"),o}function F(){b==null||b.dispatchEvent(new CustomEvent("change",{detail:{value:r},bubbles:!0}))}function W(){if(!s)return;const n=document.querySelectorAll('[for="'+s+'"]');for(let o of n)o.removeEventListener("click",v)}function D(){if(!s)return;W();const n=document.querySelectorAll('[for="'+s+'"]');for(let o of n)o.addEventListener("click",v)}function R(n,o="",l=0){let y=d.find(g=>g.name==n||g.id==n);if(!y||l>=4)return[];let u=[o+"id",o+"created",o+"updated"];y.isAuth&&(u.push(o+"username"),u.push(o+"email"),u.push(o+"emailVisibility"),u.push(o+"verified"));for(const g of y.schema){const q=o+g.name;if(u.push(q),g.type==="relation"&&g.options.collectionId){const K=R(g.options.collectionId,q+".",l+1);K.length&&(u=u.concat(K))}}return u}function H(n=!0,o=!0){let l=[].concat(I);const y=R(m.name);for(const u of y)l.push(u);if(n&&(l.push("@request.method"),l.push("@request.query."),l.push("@request.data."),l.push("@request.auth."),l.push("@request.auth.id"),l.push("@request.auth.collectionId"),l.push("@request.auth.collectionName"),l.push("@request.auth.username"),l.push("@request.auth.email"),l.push("@request.auth.emailVisibility"),l.push("@request.auth.verified"),l.push("@request.auth.created"),l.push("@request.auth.updated")),n||o)for(const u of d){let g="";if(!o)continue;g="@collection."+u.name+".";const q=R(u.name,g);for(const K of q)l.push(K)}return l.sort(function(u,g){return g.length-u.length}),l}function G(n){let o=n.matchBefore(/[\'\"\@\w\.]*/);if(o&&o.from==o.to&&!n.explicit)return null;let l=[{label:"false"},{label:"true"},{label:"@now"}];C||l.push({label:"@collection.*",apply:"@collection."});const y=H(!k,!k&&o.text.startsWith("@c"));for(const u of y)l.push({label:u.endsWith(".")?u+"*":u,apply:u});return{from:o.from,options:l}}function J(){const n=[{regex:L.escapeRegExp("@now"),token:"keyword"}],o=H(!k,!C);for(const l of o){let y;l.endsWith(".")?y=L.escapeRegExp(l)+"\\w+[\\w.]*":y=L.escapeRegExp(l),n.push({regex:y,token:"keyword"})}return n}function N(){return qe.define(Ke({start:[{regex:/true|false|null/,token:"atom"},{regex:/"(?:[^\\]|\\.)*?(?:"|$)/,token:"string"},{regex:/'(?:[^\\]|\\.)*?(?:'|$)/,token:"string"},{regex:/0x[a-f\d]+|[-+]?(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i,token:"number"},{regex:/\&\&|\|\||\=|\!\=|\~|\!\~|\>|\<|\>\=|\<\=/,token:"operator"},{regex:/[\{\[\(]/,indent:!0},{regex:/[\}\]\)]/,dedent:!0}].concat(J())}))}oe(()=>{const n={key:"Enter",run:o=>{S&&p("submit",r)}};return D(),e(11,f=new x({parent:b,state:w.create({doc:r,extensions:[se(),le(),ae(),ue(),ce(),w.allowMultipleSelections.of(!0),fe(de,{fallback:!0}),he(),ge(),pe(),ye(),me.of([n,...be,...ke,xe.find(o=>o.key==="Mod-d"),...we,...Se]),x.lineWrapping,Ce({override:[G],icons:!1}),B.of(U(c)),M.of(x.editable.of(!0)),O.of(w.readOnly.of(!1)),_.of(N()),w.transactionFilter.of(o=>S&&o.newDoc.lines>1?[]:o),x.updateListener.of(o=>{!o.docChanged||a||(e(1,r=o.state.doc.toString()),F())})]})})),()=>{W(),f==null||f.destroy()}});function T(n){re[n?"unshift":"push"](()=>{b=n,e(0,b)})}return t.$$set=n=>{"id"in n&&e(2,s=n.id),"value"in n&&e(1,r=n.value),"disabled"in n&&e(3,a=n.disabled),"placeholder"in n&&e(4,c=n.placeholder),"baseCollection"in n&&e(5,m=n.baseCollection),"singleLine"in n&&e(6,S=n.singleLine),"extraAutocompleteKeys"in n&&e(7,I=n.extraAutocompleteKeys),"disableRequestKeys"in n&&e(8,k=n.disableRequestKeys),"disableIndirectCollectionsKeys"in n&&e(9,C=n.disableIndirectCollectionsKeys)},t.$$.update=()=>{t.$$.dirty&4096&&(d=P(h)),t.$$.dirty&4&&s&&D(),t.$$.dirty&2080&&f&&(m==null?void 0:m.schema)&&f.dispatch({effects:[_.reconfigure(N())]}),t.$$.dirty&2056&&f&&typeof a<"u"&&(f.dispatch({effects:[M.reconfigure(x.editable.of(!a)),O.reconfigure(w.readOnly.of(a))]}),F()),t.$$.dirty&2050&&f&&r!=f.state.doc.toString()&&f.dispatch({changes:{from:0,to:f.state.doc.length,insert:r}}),t.$$.dirty&2064&&f&&typeof c<"u"&&f.dispatch({effects:[B.reconfigure(U(c))]})},[b,r,s,a,c,m,S,I,k,C,v,f,h,T]}class Be extends z{constructor(i){super(),Q(this,i,_e,Ae,X,{id:2,value:1,disabled:3,placeholder:4,baseCollection:5,singleLine:6,extraAutocompleteKeys:7,disableRequestKeys:8,disableIndirectCollectionsKeys:9,focus:10})}get focus(){return this.$$.ctx[10]}}export{Be as default}; diff --git a/ui/dist/assets/ListApiDocs.11b26f68.js b/ui/dist/assets/ListApiDocs.11b26f68.js new file mode 100644 index 000000000..bfac75e48 --- /dev/null +++ b/ui/dist/assets/ListApiDocs.11b26f68.js @@ -0,0 +1,140 @@ +import{S as Et,i as Nt,s as Ht,e as l,b as a,E as qt,f as d,g as p,u as Mt,y as xt,o as u,w as k,h as e,O as Ae,c as ge,m as ye,x as Ue,P as Lt,Q as Dt,k as It,R as Bt,n as zt,t as ce,a as de,d as ve,L as Gt,C as je,p as Ut,r as Ee}from"./index.97f016a1.js";import{S as jt}from"./SdkTabs.88269ae0.js";function Qt(r){let s,n,i;return{c(){s=l("span"),s.textContent="Show details",n=a(),i=l("i"),d(s,"class","txt"),d(i,"class","ri-arrow-down-s-line")},m(c,f){p(c,s,f),p(c,n,f),p(c,i,f)},d(c){c&&u(s),c&&u(n),c&&u(i)}}}function Jt(r){let s,n,i;return{c(){s=l("span"),s.textContent="Hide details",n=a(),i=l("i"),d(s,"class","txt"),d(i,"class","ri-arrow-up-s-line")},m(c,f){p(c,s,f),p(c,n,f),p(c,i,f)},d(c){c&&u(s),c&&u(n),c&&u(i)}}}function Tt(r){let s,n,i,c,f,m,_,w,b,$,h,H,W,fe,T,pe,O,G,C,M,Fe,A,E,Ce,U,X,q,Y,xe,j,Q,D,P,ue,Z,v,I,ee,me,te,N,B,le,be,se,x,J,ne,Le,K,he,V;return{c(){s=l("p"),s.innerHTML=`The syntax basically follows the format + OPERAND + OPERATOR + OPERAND, where:`,n=a(),i=l("ul"),c=l("li"),c.innerHTML=`OPERAND - could be any of the above field literal, string (single + or double quoted), number, null, true, false`,f=a(),m=l("li"),_=l("code"),_.textContent="OPERATOR",w=k(` - is one of: + `),b=l("br"),$=a(),h=l("ul"),H=l("li"),W=l("code"),W.textContent="=",fe=a(),T=l("span"),T.textContent="Equal",pe=a(),O=l("li"),G=l("code"),G.textContent="!=",C=a(),M=l("span"),M.textContent="NOT equal",Fe=a(),A=l("li"),E=l("code"),E.textContent=">",Ce=a(),U=l("span"),U.textContent="Greater than",X=a(),q=l("li"),Y=l("code"),Y.textContent=">=",xe=a(),j=l("span"),j.textContent="Greater than or equal",Q=a(),D=l("li"),P=l("code"),P.textContent="<",ue=a(),Z=l("span"),Z.textContent="Less than or equal",v=a(),I=l("li"),ee=l("code"),ee.textContent="<=",me=a(),te=l("span"),te.textContent="Less than or equal",N=a(),B=l("li"),le=l("code"),le.textContent="~",be=a(),se=l("span"),se.textContent=`Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for + wildcard match)`,x=a(),J=l("li"),ne=l("code"),ne.textContent="!~",Le=a(),K=l("span"),K.textContent=`NOT Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for + wildcard match)`,he=a(),V=l("p"),V.innerHTML=`To group and combine several expressions you could use brackets + (...), && (AND) and || (OR) tokens.`,d(_,"class","txt-danger"),d(W,"class","filter-op svelte-1w7s5nw"),d(T,"class","txt-hint"),d(G,"class","filter-op svelte-1w7s5nw"),d(M,"class","txt-hint"),d(E,"class","filter-op svelte-1w7s5nw"),d(U,"class","txt-hint"),d(Y,"class","filter-op svelte-1w7s5nw"),d(j,"class","txt-hint"),d(P,"class","filter-op svelte-1w7s5nw"),d(Z,"class","txt-hint"),d(ee,"class","filter-op svelte-1w7s5nw"),d(te,"class","txt-hint"),d(le,"class","filter-op svelte-1w7s5nw"),d(se,"class","txt-hint"),d(ne,"class","filter-op svelte-1w7s5nw"),d(K,"class","txt-hint")},m(F,R){p(F,s,R),p(F,n,R),p(F,i,R),e(i,c),e(i,f),e(i,m),e(m,_),e(m,w),e(m,b),e(m,$),e(m,h),e(h,H),e(H,W),e(H,fe),e(H,T),e(h,pe),e(h,O),e(O,G),e(O,C),e(O,M),e(h,Fe),e(h,A),e(A,E),e(A,Ce),e(A,U),e(h,X),e(h,q),e(q,Y),e(q,xe),e(q,j),e(h,Q),e(h,D),e(D,P),e(D,ue),e(D,Z),e(h,v),e(h,I),e(I,ee),e(I,me),e(I,te),e(h,N),e(h,B),e(B,le),e(B,be),e(B,se),e(h,x),e(h,J),e(J,ne),e(J,Le),e(J,K),p(F,he,R),p(F,V,R)},d(F){F&&u(s),F&&u(n),F&&u(i),F&&u(he),F&&u(V)}}}function Kt(r){let s,n,i,c,f;function m($,h){return $[0]?Jt:Qt}let _=m(r),w=_(r),b=r[0]&&Tt();return{c(){s=l("button"),w.c(),n=a(),b&&b.c(),i=qt(),d(s,"class","btn btn-sm btn-secondary m-t-5")},m($,h){p($,s,h),w.m(s,null),p($,n,h),b&&b.m($,h),p($,i,h),c||(f=Mt(s,"click",r[1]),c=!0)},p($,[h]){_!==(_=m($))&&(w.d(1),w=_($),w&&(w.c(),w.m(s,null))),$[0]?b||(b=Tt(),b.c(),b.m(i.parentNode,i)):b&&(b.d(1),b=null)},i:xt,o:xt,d($){$&&u(s),w.d(),$&&u(n),b&&b.d($),$&&u(i),c=!1,f()}}}function Vt(r,s,n){let i=!1;function c(){n(0,i=!i)}return[i,c]}class Wt extends Et{constructor(s){super(),Nt(this,s,Vt,Kt,Ht,{})}}function Pt(r,s,n){const i=r.slice();return i[6]=s[n],i}function Rt(r,s,n){const i=r.slice();return i[6]=s[n],i}function St(r){let s;return{c(){s=l("p"),s.innerHTML="Requires admin Authorization:TOKEN header",d(s,"class","txt-hint txt-sm txt-right")},m(n,i){p(n,s,i)},d(n){n&&u(s)}}}function Ot(r,s){let n,i=s[6].code+"",c,f,m,_;function w(){return s[5](s[6])}return{key:r,first:null,c(){n=l("div"),c=k(i),f=a(),d(n,"class","tab-item"),Ee(n,"active",s[2]===s[6].code),this.first=n},m(b,$){p(b,n,$),e(n,c),e(n,f),m||(_=Mt(n,"click",w),m=!0)},p(b,$){s=b,$&20&&Ee(n,"active",s[2]===s[6].code)},d(b){b&&u(n),m=!1,_()}}}function At(r,s){let n,i,c,f;return i=new Ae({props:{content:s[6].body}}),{key:r,first:null,c(){n=l("div"),ge(i.$$.fragment),c=a(),d(n,"class","tab-item"),Ee(n,"active",s[2]===s[6].code),this.first=n},m(m,_){p(m,n,_),ye(i,n,null),e(n,c),f=!0},p(m,_){s=m,(!f||_&20)&&Ee(n,"active",s[2]===s[6].code)},i(m){f||(ce(i.$$.fragment,m),f=!0)},o(m){de(i.$$.fragment,m),f=!1},d(m){m&&u(n),ve(i)}}}function Xt(r){var mt,bt,ht,_t,$t,kt;let s,n,i=r[0].name+"",c,f,m,_,w,b,$,h=r[0].name+"",H,W,fe,T,pe,O,G,C,M,Fe,A,E,Ce,U,X=r[0].name+"",q,Y,xe,j,Q,D,P,ue,Z,v,I,ee,me,te,N,B,le,be,se,x,J,ne,Le,K,he,V,F,R,Qe,ie,Ne,Je,He,Ke,_e,Ve,$e,We,ke,Xe,oe,Me,Ye,qe,Ze,y,et,we,tt,lt,st,De,nt,Ie,it,ot,at,Be,rt,ze,Te,Ge,ae,Pe,z=[],ct=new Map,dt,Re,S=[],ft=new Map,re;T=new jt({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${r[3]}'); + + ... + + // fetch a paginated records list + const resultList = await pb.collection('${(mt=r[0])==null?void 0:mt.name}').getList(1, 50, { + filter: 'created >= "2022-01-01 00:00:00" && someFiled1 != someField2', + }); + + // you can also fetch all records at once via getFullList: + const records = await pb.collection('${(bt=r[0])==null?void 0:bt.name}').getFullList(200 /* batch size */, { + sort: '-created' + }); + + // or fetch only the first record that matches the specified filter + const record = await pb.collection('${(ht=r[0])==null?void 0:ht.name}').getFirstListItem('someField="test"', { + expand: 'relField1,relField2.subRelField', + }); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${r[3]}'); + + ... + + // fetch a paginated records list + final result = await pb.collection('${(_t=r[0])==null?void 0:_t.name}').getList( + page: 1, + perPage: 50, + filter: 'created >= "2022-01-01 00:00:00" && someFiled1 != someField2', + ); + + // alternatively you can also fetch all records at once via getFullList: + final records = await pb.collection('${($t=r[0])==null?void 0:$t.name}').getFullList( + batch: 200, + sort: '-created', + ); + + // or fetch only the first record that matches the specified filter + final record2 = await pb.collection('${(kt=r[0])==null?void 0:kt.name}').getFirstListItem( + 'someField="test"', + expand: 'relField1,relField2.subRelField', + ); + `}});let L=r[1]&&St();R=new Ae({props:{content:` + // DESC by created and ASC by id + ?sort=-created,id + `}}),$e=new Ae({props:{content:` + ?filter=(id='abc' && created>'2022-01-01') + `}}),ke=new Wt({}),we=new Ae({props:{content:"?expand=relField1,relField2.subRelField"}});let Oe=r[4];const pt=t=>t[6].code;for(let t=0;tt[6].code;for(let t=0;tParam + Type + Description`,Z=a(),v=l("tbody"),I=l("tr"),I.innerHTML=`page + Number + The page (aka. offset) of the paginated list (default to 1).`,ee=a(),me=l("tr"),me.innerHTML=`perPage + Number + Specify the max returned records per page (default to 30).`,te=a(),N=l("tr"),B=l("td"),B.textContent="sort",le=a(),be=l("td"),be.innerHTML='String',se=a(),x=l("td"),J=k("Specify the records order attribute(s). "),ne=l("br"),Le=k(` + Add `),K=l("code"),K.textContent="-",he=k(" / "),V=l("code"),V.textContent="+",F=k(` (default) in front of the attribute for DESC / ASC order. + Ex.: + `),ge(R.$$.fragment),Qe=a(),ie=l("tr"),Ne=l("td"),Ne.textContent="filter",Je=a(),He=l("td"),He.innerHTML='String',Ke=a(),_e=l("td"),Ve=k(`Filter the returned records. Ex.: + `),ge($e.$$.fragment),We=a(),ge(ke.$$.fragment),Xe=a(),oe=l("tr"),Me=l("td"),Me.textContent="expand",Ye=a(),qe=l("td"),qe.innerHTML='String',Ze=a(),y=l("td"),et=k(`Auto expand record relations. Ex.: + `),ge(we.$$.fragment),tt=k(` + Supports up to 6-levels depth nested relations expansion. `),lt=l("br"),st=k(` + The expanded relations will be appended to each individual record under the + `),De=l("code"),De.textContent="expand",nt=k(" property (eg. "),Ie=l("code"),Ie.textContent='"expand": {"relField1": {...}, ...}',it=k(`). + `),ot=l("br"),at=k(` + Only the relations to which the account has permissions to `),Be=l("strong"),Be.textContent="view",rt=k(" will be expanded."),ze=a(),Te=l("div"),Te.textContent="Responses",Ge=a(),ae=l("div"),Pe=l("div");for(let t=0;t= "2022-01-01 00:00:00" && someFiled1 != someField2', + }); + + // you can also fetch all records at once via getFullList: + const records = await pb.collection('${(gt=t[0])==null?void 0:gt.name}').getFullList(200 /* batch size */, { + sort: '-created' + }); + + // or fetch only the first record that matches the specified filter + const record = await pb.collection('${(yt=t[0])==null?void 0:yt.name}').getFirstListItem('someField="test"', { + expand: 'relField1,relField2.subRelField', + }); + `),o&9&&(g.dart=` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${t[3]}'); + + ... + + // fetch a paginated records list + final result = await pb.collection('${(vt=t[0])==null?void 0:vt.name}').getList( + page: 1, + perPage: 50, + filter: 'created >= "2022-01-01 00:00:00" && someFiled1 != someField2', + ); + + // alternatively you can also fetch all records at once via getFullList: + final records = await pb.collection('${(Ft=t[0])==null?void 0:Ft.name}').getFullList( + batch: 200, + sort: '-created', + ); + + // or fetch only the first record that matches the specified filter + final record2 = await pb.collection('${(Ct=t[0])==null?void 0:Ct.name}').getFirstListItem( + 'someField="test"', + expand: 'relField1,relField2.subRelField', + ); + `),T.$set(g),(!re||o&1)&&X!==(X=t[0].name+"")&&Ue(q,X),t[1]?L||(L=St(),L.c(),L.m(C,null)):L&&(L.d(1),L=null),o&20&&(Oe=t[4],z=Lt(z,o,pt,1,t,Oe,ct,Pe,Dt,Ot,null,Rt)),o&20&&(Se=t[4],It(),S=Lt(S,o,ut,1,t,Se,ft,Re,Bt,At,null,Pt),zt())},i(t){if(!re){ce(T.$$.fragment,t),ce(R.$$.fragment,t),ce($e.$$.fragment,t),ce(ke.$$.fragment,t),ce(we.$$.fragment,t);for(let o=0;on(2,m=b.code);return r.$$set=b=>{"collection"in b&&n(0,f=b.collection)},r.$$.update=()=>{r.$$.dirty&1&&n(1,i=(f==null?void 0:f.listRule)===null),r.$$.dirty&3&&f!=null&&f.id&&(_.push({code:200,body:JSON.stringify({page:1,perPage:30,totalPages:1,totalItems:2,items:[je.dummyCollectionRecord(f),je.dummyCollectionRecord(f)]},null,2)}),_.push({code:400,body:` + { + "code": 400, + "message": "Something went wrong while processing your request. Invalid filter.", + "data": {} + } + `}),i&&_.push({code:403,body:` + { + "code": 403, + "message": "Only admins can access this action.", + "data": {} + } + `}),_.push({code:404,body:` + { + "code": 404, + "message": "The requested resource wasn't found.", + "data": {} + } + `}))},n(3,c=je.getApiExampleUrl(Ut.baseUrl)),[f,i,m,c,_,w]}class tl extends Et{constructor(s){super(),Nt(this,s,Yt,Xt,Ht,{collection:0})}}export{tl as default}; diff --git a/ui/dist/assets/ListApiDocs.68f52edd.css b/ui/dist/assets/ListApiDocs.68f52edd.css new file mode 100644 index 000000000..b4b419747 --- /dev/null +++ b/ui/dist/assets/ListApiDocs.68f52edd.css @@ -0,0 +1 @@ +.filter-op.svelte-1w7s5nw{display:inline-block;vertical-align:top;margin-right:5px;width:30px;text-align:center;padding-left:0;padding-right:0} diff --git a/ui/dist/assets/ListExternalAuthsDocs.960c39a0.js b/ui/dist/assets/ListExternalAuthsDocs.960c39a0.js new file mode 100644 index 000000000..7e00cdac2 --- /dev/null +++ b/ui/dist/assets/ListExternalAuthsDocs.960c39a0.js @@ -0,0 +1,93 @@ +import{S as Be,i as qe,s as Le,e as n,w as v,b as h,c as Te,f as b,g as r,h as s,m as Ie,x as U,P as ye,Q as Oe,k as Me,R as Re,n as Ve,t as te,a as le,o as d,d as Se,L as ze,C as De,p as He,r as j,u as Ue,O as je}from"./index.97f016a1.js";import{S as Ge}from"./SdkTabs.88269ae0.js";function Ee(a,l,o){const i=a.slice();return i[5]=l[o],i}function Ae(a,l,o){const i=a.slice();return i[5]=l[o],i}function Pe(a,l){let o,i=l[5].code+"",m,_,c,u;function f(){return l[4](l[5])}return{key:a,first:null,c(){o=n("button"),m=v(i),_=h(),b(o,"class","tab-item"),j(o,"active",l[1]===l[5].code),this.first=o},m(g,y){r(g,o,y),s(o,m),s(o,_),c||(u=Ue(o,"click",f),c=!0)},p(g,y){l=g,y&4&&i!==(i=l[5].code+"")&&U(m,i),y&6&&j(o,"active",l[1]===l[5].code)},d(g){g&&d(o),c=!1,u()}}}function Ce(a,l){let o,i,m,_;return i=new je({props:{content:l[5].body}}),{key:a,first:null,c(){o=n("div"),Te(i.$$.fragment),m=h(),b(o,"class","tab-item"),j(o,"active",l[1]===l[5].code),this.first=o},m(c,u){r(c,o,u),Ie(i,o,null),s(o,m),_=!0},p(c,u){l=c;const f={};u&4&&(f.content=l[5].body),i.$set(f),(!_||u&6)&&j(o,"active",l[1]===l[5].code)},i(c){_||(te(i.$$.fragment,c),_=!0)},o(c){le(i.$$.fragment,c),_=!1},d(c){c&&d(o),Se(i)}}}function Ke(a){var be,_e,he,ke;let l,o,i=a[0].name+"",m,_,c,u,f,g,y,M=a[0].name+"",G,oe,se,K,N,E,Q,T,F,w,R,ae,V,A,ie,J,z=a[0].name+"",W,ne,X,ce,re,D,Y,I,Z,S,x,B,ee,P,q,$=[],de=new Map,ue,L,k=[],pe=new Map,C;E=new Ge({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${a[3]}'); + + ... + + await pb.collection('${(be=a[0])==null?void 0:be.name}').authViaEmail('test@example.com', '123456'); + + const result = await pb.collection('${(_e=a[0])==null?void 0:_e.name}').listExternalAuths( + pb.authStore.model.id + ); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${a[3]}'); + + ... + + await pb.collection('${(he=a[0])==null?void 0:he.name}').authViaEmail('test@example.com', '123456'); + + final result = await pb.collection('${(ke=a[0])==null?void 0:ke.name}').listExternalAuths( + pb.authStore.model.id, + ); + `}});let H=a[2];const me=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eAuthorization:TOKEN header",Y=h(),I=n("div"),I.textContent="Path Parameters",Z=h(),S=n("table"),S.innerHTML=`Param + Type + Description + id + String + ID of the auth record.`,x=h(),B=n("div"),B.textContent="Responses",ee=h(),P=n("div"),q=n("div");for(let e=0;e<$.length;e+=1)$[e].c();ue=h(),L=n("div");for(let e=0;eo(1,_=f.code);return a.$$set=f=>{"collection"in f&&o(0,m=f.collection)},a.$$.update=()=>{a.$$.dirty&1&&o(2,c=[{code:200,body:` + [ + { + "id": "8171022dc95a4e8", + "created": "2022-09-01 10:24:18.434", + "updated": "2022-09-01 10:24:18.889", + "recordId": "e22581b6f1d44ea", + "collectionId": "${m.id}", + "provider": "google", + "providerId": "2da15468800514p", + }, + { + "id": "171022dc895a4e8", + "created": "2022-09-01 10:24:18.434", + "updated": "2022-09-01 10:24:18.889", + "recordId": "e22581b6f1d44ea", + "collectionId": "${m.id}", + "provider": "twitter", + "providerId": "720688005140514", + } + ] + `},{code:401,body:` + { + "code": 401, + "message": "The request requires valid record authorization token to be set.", + "data": {} + } + `},{code:403,body:` + { + "code": 403, + "message": "The authorized record model is not allowed to perform this action.", + "data": {} + } + `},{code:404,body:` + { + "code": 404, + "message": "The requested resource wasn't found.", + "data": {} + } + `}])},o(3,i=De.getApiExampleUrl(He.baseUrl)),[m,_,c,i,u]}class Je extends Be{constructor(l){super(),qe(this,l,Ne,Ke,Le,{collection:0})}}export{Je as default}; diff --git a/ui/dist/assets/PageAdminConfirmPasswordReset.8a4af6ed.js b/ui/dist/assets/PageAdminConfirmPasswordReset.19234b2d.js similarity index 98% rename from ui/dist/assets/PageAdminConfirmPasswordReset.8a4af6ed.js rename to ui/dist/assets/PageAdminConfirmPasswordReset.19234b2d.js index dd08317eb..f962b14c0 100644 --- a/ui/dist/assets/PageAdminConfirmPasswordReset.8a4af6ed.js +++ b/ui/dist/assets/PageAdminConfirmPasswordReset.19234b2d.js @@ -1,2 +1,2 @@ -import{S as E,i as G,s as I,F as K,c as A,m as B,t as H,a as N,d as T,C as M,q as J,e as c,w as q,b as C,f as u,r as L,g as b,h as _,u as h,v as O,j as Q,l as U,o as w,A as V,p as W,B as X,D as Y,x as Z,z as S}from"./index.e13041a6.js";function y(f){let e,o,s;return{c(){e=q("for "),o=c("strong"),s=q(f[3]),u(o,"class","txt-nowrap")},m(l,t){b(l,e,t),b(l,o,t),_(o,s)},p(l,t){t&8&&Z(s,l[3])},d(l){l&&w(e),l&&w(o)}}}function x(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password"),l=C(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0,t.autofocus=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[0]),t.focus(),p||(d=h(t,"input",f[6]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&1&&t.value!==n[0]&&S(t,n[0])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function ee(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password confirm"),l=C(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[1]),p||(d=h(t,"input",f[7]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&2&&t.value!==n[1]&&S(t,n[1])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function te(f){let e,o,s,l,t,r,p,d,n,i,g,R,P,v,k,F,j,m=f[3]&&y(f);return r=new J({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),d=new J({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[ee,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),{c(){e=c("form"),o=c("div"),s=c("h4"),l=q(`Reset your admin password +import{S as E,i as G,s as I,F as K,c as A,m as B,t as H,a as N,d as T,C as M,q as J,e as c,w as q,b as C,f as u,r as L,g as b,h as _,u as h,v as O,j as Q,l as U,o as w,A as V,p as W,B as X,D as Y,x as Z,z as S}from"./index.97f016a1.js";function y(f){let e,o,s;return{c(){e=q("for "),o=c("strong"),s=q(f[3]),u(o,"class","txt-nowrap")},m(l,t){b(l,e,t),b(l,o,t),_(o,s)},p(l,t){t&8&&Z(s,l[3])},d(l){l&&w(e),l&&w(o)}}}function x(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password"),l=C(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0,t.autofocus=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[0]),t.focus(),p||(d=h(t,"input",f[6]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&1&&t.value!==n[0]&&S(t,n[0])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function ee(f){let e,o,s,l,t,r,p,d;return{c(){e=c("label"),o=q("New password confirm"),l=C(),t=c("input"),u(e,"for",s=f[8]),u(t,"type","password"),u(t,"id",r=f[8]),t.required=!0},m(n,i){b(n,e,i),_(e,o),b(n,l,i),b(n,t,i),S(t,f[1]),p||(d=h(t,"input",f[7]),p=!0)},p(n,i){i&256&&s!==(s=n[8])&&u(e,"for",s),i&256&&r!==(r=n[8])&&u(t,"id",r),i&2&&t.value!==n[1]&&S(t,n[1])},d(n){n&&w(e),n&&w(l),n&&w(t),p=!1,d()}}}function te(f){let e,o,s,l,t,r,p,d,n,i,g,R,P,v,k,F,j,m=f[3]&&y(f);return r=new J({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),d=new J({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[ee,({uniqueId:a})=>({8:a}),({uniqueId:a})=>a?256:0]},$$scope:{ctx:f}}}),{c(){e=c("form"),o=c("div"),s=c("h4"),l=q(`Reset your admin password `),m&&m.c(),t=C(),A(r.$$.fragment),p=C(),A(d.$$.fragment),n=C(),i=c("button"),g=c("span"),g.textContent="Set new password",R=C(),P=c("div"),v=c("a"),v.textContent="Back to login",u(s,"class","m-b-xs"),u(o,"class","content txt-center m-b-sm"),u(g,"class","txt"),u(i,"type","submit"),u(i,"class","btn btn-lg btn-block"),i.disabled=f[2],L(i,"btn-loading",f[2]),u(e,"class","m-b-base"),u(v,"href","/login"),u(v,"class","link-hint"),u(P,"class","content txt-center")},m(a,$){b(a,e,$),_(e,o),_(o,s),_(s,l),m&&m.m(s,null),_(e,t),B(r,e,null),_(e,p),B(d,e,null),_(e,n),_(e,i),_(i,g),b(a,R,$),b(a,P,$),_(P,v),k=!0,F||(j=[h(e,"submit",O(f[4])),Q(U.call(null,v))],F=!0)},p(a,$){a[3]?m?m.p(a,$):(m=y(a),m.c(),m.m(s,null)):m&&(m.d(1),m=null);const z={};$&769&&(z.$$scope={dirty:$,ctx:a}),r.$set(z);const D={};$&770&&(D.$$scope={dirty:$,ctx:a}),d.$set(D),(!k||$&4)&&(i.disabled=a[2]),(!k||$&4)&&L(i,"btn-loading",a[2])},i(a){k||(H(r.$$.fragment,a),H(d.$$.fragment,a),k=!0)},o(a){N(r.$$.fragment,a),N(d.$$.fragment,a),k=!1},d(a){a&&w(e),m&&m.d(),T(r),T(d),a&&w(R),a&&w(P),F=!1,V(j)}}}function se(f){let e,o;return e=new K({props:{$$slots:{default:[te]},$$scope:{ctx:f}}}),{c(){A(e.$$.fragment)},m(s,l){B(e,s,l),o=!0},p(s,[l]){const t={};l&527&&(t.$$scope={dirty:l,ctx:s}),e.$set(t)},i(s){o||(H(e.$$.fragment,s),o=!0)},o(s){N(e.$$.fragment,s),o=!1},d(s){T(e,s)}}}function le(f,e,o){let s,{params:l}=e,t="",r="",p=!1;async function d(){if(!p){o(2,p=!0);try{await W.admins.confirmPasswordReset(l==null?void 0:l.token,t,r),X("Successfully set a new admin password."),Y("/")}catch(g){W.errorResponseHandler(g)}o(2,p=!1)}}function n(){t=this.value,o(0,t)}function i(){r=this.value,o(1,r)}return f.$$set=g=>{"params"in g&&o(5,l=g.params)},f.$$.update=()=>{f.$$.dirty&32&&o(3,s=M.getJWTPayload(l==null?void 0:l.token).email||"")},[t,r,p,s,d,l,n,i]}class ae extends E{constructor(e){super(),G(this,e,le,se,I,{params:5})}}export{ae as default}; diff --git a/ui/dist/assets/PageAdminRequestPasswordReset.34d90dd1.js b/ui/dist/assets/PageAdminRequestPasswordReset.7514fbab.js similarity index 98% rename from ui/dist/assets/PageAdminRequestPasswordReset.34d90dd1.js rename to ui/dist/assets/PageAdminRequestPasswordReset.7514fbab.js index 32c185936..46c0c4a68 100644 --- a/ui/dist/assets/PageAdminRequestPasswordReset.34d90dd1.js +++ b/ui/dist/assets/PageAdminRequestPasswordReset.7514fbab.js @@ -1,2 +1,2 @@ -import{S as M,i as T,s as j,F as z,c as H,m as L,t as w,a as y,d as S,b as g,e as _,f as p,g as k,h as d,j as A,l as B,k as N,n as D,o as v,p as C,q as G,r as F,u as E,v as I,w as h,x as J,y as P,z as R}from"./index.e13041a6.js";function K(c){let e,s,n,l,t,o,f,m,i,a,b,u;return l=new G({props:{class:"form-field required",name:"email",$$slots:{default:[Q,({uniqueId:r})=>({5:r}),({uniqueId:r})=>r?32:0]},$$scope:{ctx:c}}}),{c(){e=_("form"),s=_("div"),s.innerHTML=`

Forgotten admin password

+import{S as M,i as T,s as j,F as z,c as H,m as L,t as w,a as y,d as S,b as g,e as _,f as p,g as k,h as d,j as A,l as B,k as N,n as D,o as v,p as C,q as G,r as F,u as E,v as I,w as h,x as J,y as P,z as R}from"./index.97f016a1.js";function K(c){let e,s,n,l,t,o,f,m,i,a,b,u;return l=new G({props:{class:"form-field required",name:"email",$$slots:{default:[Q,({uniqueId:r})=>({5:r}),({uniqueId:r})=>r?32:0]},$$scope:{ctx:c}}}),{c(){e=_("form"),s=_("div"),s.innerHTML=`

Forgotten admin password

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]),(!a||$&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/PageRecordConfirmEmailChange.75e01a7f.js b/ui/dist/assets/PageRecordConfirmEmailChange.75e01a7f.js new file mode 100644 index 000000000..a1079d109 --- /dev/null +++ b/ui/dist/assets/PageRecordConfirmEmailChange.75e01a7f.js @@ -0,0 +1,4 @@ +import{S as z,i as G,s as I,F as J,c as T,m as L,t as v,a as y,d as R,C as M,E as N,g as _,k as W,n as Y,o as b,G as j,H as A,p as B,q as D,e as m,w as C,b as h,f as d,r as P,h as k,u as q,v as K,y as E,x as O,z as F}from"./index.97f016a1.js";function Q(r){let e,t,s,l,n,o,c,i,a,u,g,$,p=r[3]&&S(r);return o=new D({props:{class:"form-field required",name:"password",$$slots:{default:[V,({uniqueId:f})=>({8:f}),({uniqueId:f})=>f?256:0]},$$scope:{ctx:r}}}),{c(){e=m("form"),t=m("div"),s=m("h5"),l=C(`Type your password to confirm changing your email address + `),p&&p.c(),n=h(),T(o.$$.fragment),c=h(),i=m("button"),a=m("span"),a.textContent="Confirm new email",d(t,"class","content txt-center m-b-base"),d(a,"class","txt"),d(i,"type","submit"),d(i,"class","btn btn-lg btn-block"),i.disabled=r[1],P(i,"btn-loading",r[1])},m(f,w){_(f,e,w),k(e,t),k(t,s),k(s,l),p&&p.m(s,null),k(e,n),L(o,e,null),k(e,c),k(e,i),k(i,a),u=!0,g||($=q(e,"submit",K(r[4])),g=!0)},p(f,w){f[3]?p?p.p(f,w):(p=S(f),p.c(),p.m(s,null)):p&&(p.d(1),p=null);const H={};w&769&&(H.$$scope={dirty:w,ctx:f}),o.$set(H),(!u||w&2)&&(i.disabled=f[1]),(!u||w&2)&&P(i,"btn-loading",f[1])},i(f){u||(v(o.$$.fragment,f),u=!0)},o(f){y(o.$$.fragment,f),u=!1},d(f){f&&b(e),p&&p.d(),R(o),g=!1,$()}}}function U(r){let e,t,s,l,n;return{c(){e=m("div"),e.innerHTML=`
+

Successfully changed the user email address.

+

You can now sign in with your new email address.

`,t=h(),s=m("button"),s.textContent="Close",d(e,"class","alert alert-success"),d(s,"type","button"),d(s,"class","btn btn-secondary btn-block")},m(o,c){_(o,e,c),_(o,t,c),_(o,s,c),l||(n=q(s,"click",r[6]),l=!0)},p:E,i:E,o:E,d(o){o&&b(e),o&&b(t),o&&b(s),l=!1,n()}}}function S(r){let e,t,s;return{c(){e=C("to "),t=m("strong"),s=C(r[3]),d(t,"class","txt-nowrap")},m(l,n){_(l,e,n),_(l,t,n),k(t,s)},p(l,n){n&8&&O(s,l[3])},d(l){l&&b(e),l&&b(t)}}}function V(r){let e,t,s,l,n,o,c,i;return{c(){e=m("label"),t=C("Password"),l=h(),n=m("input"),d(e,"for",s=r[8]),d(n,"type","password"),d(n,"id",o=r[8]),n.required=!0,n.autofocus=!0},m(a,u){_(a,e,u),k(e,t),_(a,l,u),_(a,n,u),F(n,r[0]),n.focus(),c||(i=q(n,"input",r[7]),c=!0)},p(a,u){u&256&&s!==(s=a[8])&&d(e,"for",s),u&256&&o!==(o=a[8])&&d(n,"id",o),u&1&&n.value!==a[0]&&F(n,a[0])},d(a){a&&b(e),a&&b(l),a&&b(n),c=!1,i()}}}function X(r){let e,t,s,l;const n=[U,Q],o=[];function c(i,a){return i[2]?0:1}return e=c(r),t=o[e]=n[e](r),{c(){t.c(),s=N()},m(i,a){o[e].m(i,a),_(i,s,a),l=!0},p(i,a){let u=e;e=c(i),e===u?o[e].p(i,a):(W(),y(o[u],1,1,()=>{o[u]=null}),Y(),t=o[e],t?t.p(i,a):(t=o[e]=n[e](i),t.c()),v(t,1),t.m(s.parentNode,s))},i(i){l||(v(t),l=!0)},o(i){y(t),l=!1},d(i){o[e].d(i),i&&b(s)}}}function Z(r){let e,t;return e=new J({props:{nobranding:!0,$$slots:{default:[X]},$$scope:{ctx:r}}}),{c(){T(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,[l]){const n={};l&527&&(n.$$scope={dirty:l,ctx:s}),e.$set(n)},i(s){t||(v(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){R(e,s)}}}function x(r,e,t){let s,{params:l}=e,n="",o=!1,c=!1;async function i(){if(o)return;t(1,o=!0);const g=new j("../");try{const $=A(l==null?void 0:l.token);await g.collection($.collectionId).confirmEmailChange(l==null?void 0:l.token,n),t(2,c=!0)}catch($){B.errorResponseHandler($)}t(1,o=!1)}const a=()=>window.close();function u(){n=this.value,t(0,n)}return r.$$set=g=>{"params"in g&&t(5,l=g.params)},r.$$.update=()=>{r.$$.dirty&32&&t(3,s=M.getJWTPayload(l==null?void 0:l.token).newEmail||"")},[n,o,c,s,i,l,a,u]}class te extends z{constructor(e){super(),G(this,e,x,Z,I,{params:5})}}export{te as default}; diff --git a/ui/dist/assets/PageRecordConfirmPasswordReset.d1097e1b.js b/ui/dist/assets/PageRecordConfirmPasswordReset.d1097e1b.js new file mode 100644 index 000000000..6055a3080 --- /dev/null +++ b/ui/dist/assets/PageRecordConfirmPasswordReset.d1097e1b.js @@ -0,0 +1,4 @@ +import{S as J,i as M,s as W,F as Y,c as F,m as N,t as P,a as q,d as E,C as j,E as A,g as _,k as B,n as D,o as m,G as K,H as O,p as Q,q as z,e as b,w as R,b as y,f as p,r as G,h as w,u as H,v as U,y as S,x as V,z as h}from"./index.97f016a1.js";function X(r){let e,l,s,n,t,o,c,u,i,a,v,k,g,C,d=r[4]&&I(r);return o=new z({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:r}}}),u=new z({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[ee,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:r}}}),{c(){e=b("form"),l=b("div"),s=b("h5"),n=R(`Reset your user password + `),d&&d.c(),t=y(),F(o.$$.fragment),c=y(),F(u.$$.fragment),i=y(),a=b("button"),v=b("span"),v.textContent="Set new password",p(l,"class","content txt-center m-b-base"),p(v,"class","txt"),p(a,"type","submit"),p(a,"class","btn btn-lg btn-block"),a.disabled=r[2],G(a,"btn-loading",r[2])},m(f,$){_(f,e,$),w(e,l),w(l,s),w(s,n),d&&d.m(s,null),w(e,t),N(o,e,null),w(e,c),N(u,e,null),w(e,i),w(e,a),w(a,v),k=!0,g||(C=H(e,"submit",U(r[5])),g=!0)},p(f,$){f[4]?d?d.p(f,$):(d=I(f),d.c(),d.m(s,null)):d&&(d.d(1),d=null);const L={};$&3073&&(L.$$scope={dirty:$,ctx:f}),o.$set(L);const T={};$&3074&&(T.$$scope={dirty:$,ctx:f}),u.$set(T),(!k||$&4)&&(a.disabled=f[2]),(!k||$&4)&&G(a,"btn-loading",f[2])},i(f){k||(P(o.$$.fragment,f),P(u.$$.fragment,f),k=!0)},o(f){q(o.$$.fragment,f),q(u.$$.fragment,f),k=!1},d(f){f&&m(e),d&&d.d(),E(o),E(u),g=!1,C()}}}function Z(r){let e,l,s,n,t;return{c(){e=b("div"),e.innerHTML=`
+

Successfully changed the user password.

+

You can now sign in with your new password.

`,l=y(),s=b("button"),s.textContent="Close",p(e,"class","alert alert-success"),p(s,"type","button"),p(s,"class","btn btn-secondary btn-block")},m(o,c){_(o,e,c),_(o,l,c),_(o,s,c),n||(t=H(s,"click",r[7]),n=!0)},p:S,i:S,o:S,d(o){o&&m(e),o&&m(l),o&&m(s),n=!1,t()}}}function I(r){let e,l,s;return{c(){e=R("for "),l=b("strong"),s=R(r[4])},m(n,t){_(n,e,t),_(n,l,t),w(l,s)},p(n,t){t&16&&V(s,n[4])},d(n){n&&m(e),n&&m(l)}}}function x(r){let e,l,s,n,t,o,c,u;return{c(){e=b("label"),l=R("New password"),n=y(),t=b("input"),p(e,"for",s=r[10]),p(t,"type","password"),p(t,"id",o=r[10]),t.required=!0,t.autofocus=!0},m(i,a){_(i,e,a),w(e,l),_(i,n,a),_(i,t,a),h(t,r[0]),t.focus(),c||(u=H(t,"input",r[8]),c=!0)},p(i,a){a&1024&&s!==(s=i[10])&&p(e,"for",s),a&1024&&o!==(o=i[10])&&p(t,"id",o),a&1&&t.value!==i[0]&&h(t,i[0])},d(i){i&&m(e),i&&m(n),i&&m(t),c=!1,u()}}}function ee(r){let e,l,s,n,t,o,c,u;return{c(){e=b("label"),l=R("New password confirm"),n=y(),t=b("input"),p(e,"for",s=r[10]),p(t,"type","password"),p(t,"id",o=r[10]),t.required=!0},m(i,a){_(i,e,a),w(e,l),_(i,n,a),_(i,t,a),h(t,r[1]),c||(u=H(t,"input",r[9]),c=!0)},p(i,a){a&1024&&s!==(s=i[10])&&p(e,"for",s),a&1024&&o!==(o=i[10])&&p(t,"id",o),a&2&&t.value!==i[1]&&h(t,i[1])},d(i){i&&m(e),i&&m(n),i&&m(t),c=!1,u()}}}function te(r){let e,l,s,n;const t=[Z,X],o=[];function c(u,i){return u[3]?0:1}return e=c(r),l=o[e]=t[e](r),{c(){l.c(),s=A()},m(u,i){o[e].m(u,i),_(u,s,i),n=!0},p(u,i){let a=e;e=c(u),e===a?o[e].p(u,i):(B(),q(o[a],1,1,()=>{o[a]=null}),D(),l=o[e],l?l.p(u,i):(l=o[e]=t[e](u),l.c()),P(l,1),l.m(s.parentNode,s))},i(u){n||(P(l),n=!0)},o(u){q(l),n=!1},d(u){o[e].d(u),u&&m(s)}}}function se(r){let e,l;return e=new Y({props:{nobranding:!0,$$slots:{default:[te]},$$scope:{ctx:r}}}),{c(){F(e.$$.fragment)},m(s,n){N(e,s,n),l=!0},p(s,[n]){const t={};n&2079&&(t.$$scope={dirty:n,ctx:s}),e.$set(t)},i(s){l||(P(e.$$.fragment,s),l=!0)},o(s){q(e.$$.fragment,s),l=!1},d(s){E(e,s)}}}function le(r,e,l){let s,{params:n}=e,t="",o="",c=!1,u=!1;async function i(){if(c)return;l(2,c=!0);const g=new K("../");try{const C=O(n==null?void 0:n.token);await g.collection(C.collectionId).confirmPasswordReset(n==null?void 0:n.token,t,o),l(3,u=!0)}catch(C){Q.errorResponseHandler(C)}l(2,c=!1)}const a=()=>window.close();function v(){t=this.value,l(0,t)}function k(){o=this.value,l(1,o)}return r.$$set=g=>{"params"in g&&l(6,n=g.params)},r.$$.update=()=>{r.$$.dirty&64&&l(4,s=j.getJWTPayload(n==null?void 0:n.token).email||"")},[t,o,c,u,s,i,n,a,v,k]}class oe extends J{constructor(e){super(),M(this,e,le,se,W,{params:6})}}export{oe as default}; diff --git a/ui/dist/assets/PageRecordConfirmVerification.cdc4fa83.js b/ui/dist/assets/PageRecordConfirmVerification.cdc4fa83.js new file mode 100644 index 000000000..40ecb6c37 --- /dev/null +++ b/ui/dist/assets/PageRecordConfirmVerification.cdc4fa83.js @@ -0,0 +1,3 @@ +import{S as v,i as y,s as w,F as x,c as C,m as g,t as $,a as H,d as L,G as M,H as P,E as S,g as r,o as a,e as u,b as _,f,u as b,y as p}from"./index.97f016a1.js";function T(o){let t,s,e,n,l;return{c(){t=u("div"),t.innerHTML=`
+

Invalid or expired verification token.

`,s=_(),e=u("button"),e.textContent="Close",f(t,"class","alert alert-danger"),f(e,"type","button"),f(e,"class","btn btn-secondary btn-block")},m(i,c){r(i,t,c),r(i,s,c),r(i,e,c),n||(l=b(e,"click",o[4]),n=!0)},p,d(i){i&&a(t),i&&a(s),i&&a(e),n=!1,l()}}}function E(o){let t,s,e,n,l;return{c(){t=u("div"),t.innerHTML=`
+

Successfully verified email address.

`,s=_(),e=u("button"),e.textContent="Close",f(t,"class","alert alert-success"),f(e,"type","button"),f(e,"class","btn btn-secondary btn-block")},m(i,c){r(i,t,c),r(i,s,c),r(i,e,c),n||(l=b(e,"click",o[3]),n=!0)},p,d(i){i&&a(t),i&&a(s),i&&a(e),n=!1,l()}}}function F(o){let t;return{c(){t=u("div"),t.innerHTML='
Please wait...
',f(t,"class","txt-center")},m(s,e){r(s,t,e)},p,d(s){s&&a(t)}}}function I(o){let t;function s(l,i){return l[1]?F:l[0]?E:T}let e=s(o),n=e(o);return{c(){n.c(),t=S()},m(l,i){n.m(l,i),r(l,t,i)},p(l,i){e===(e=s(l))&&n?n.p(l,i):(n.d(1),n=e(l),n&&(n.c(),n.m(t.parentNode,t)))},d(l){n.d(l),l&&a(t)}}}function V(o){let t,s;return t=new x({props:{nobranding:!0,$$slots:{default:[I]},$$scope:{ctx:o}}}),{c(){C(t.$$.fragment)},m(e,n){g(t,e,n),s=!0},p(e,[n]){const l={};n&67&&(l.$$scope={dirty:n,ctx:e}),t.$set(l)},i(e){s||($(t.$$.fragment,e),s=!0)},o(e){H(t.$$.fragment,e),s=!1},d(e){L(t,e)}}}function q(o,t,s){let{params:e}=t,n=!1,l=!1;i();async function i(){s(1,l=!0);const d=new M("../");try{const m=P(e==null?void 0:e.token);await d.collection(m.collectionId).confirmVerification(e==null?void 0:e.token),s(0,n=!0)}catch{s(0,n=!1)}s(1,l=!1)}const c=()=>window.close(),k=()=>window.close();return o.$$set=d=>{"params"in d&&s(2,e=d.params)},[n,l,e,c,k]}class N extends v{constructor(t){super(),y(this,t,q,V,w,{params:2})}}export{N as default}; diff --git a/ui/dist/assets/PageUserConfirmEmailChange.df55986a.js b/ui/dist/assets/PageUserConfirmEmailChange.df55986a.js deleted file mode 100644 index 838e666bb..000000000 --- a/ui/dist/assets/PageUserConfirmEmailChange.df55986a.js +++ /dev/null @@ -1,4 +0,0 @@ -import{S as G,i as J,s as M,F as N,c as T,m as L,t as v,a as y,d as z,C as R,E as U,g as _,k as W,n as Y,o as b,G as j,p as A,q as B,e as m,w as C,b as h,f as d,r as F,h as k,u as q,v as D,y as E,x as I,z as H}from"./index.e13041a6.js";function K(r){let e,t,s,l,n,o,c,a,i,u,g,$,p=r[3]&&S(r);return o=new B({props:{class:"form-field required",name:"password",$$slots:{default:[Q,({uniqueId:f})=>({8:f}),({uniqueId:f})=>f?256:0]},$$scope:{ctx:r}}}),{c(){e=m("form"),t=m("div"),s=m("h5"),l=C(`Type your password to confirm changing your email address - `),p&&p.c(),n=h(),T(o.$$.fragment),c=h(),a=m("button"),i=m("span"),i.textContent="Confirm new email",d(t,"class","content txt-center m-b-base"),d(i,"class","txt"),d(a,"type","submit"),d(a,"class","btn btn-lg btn-block"),a.disabled=r[1],F(a,"btn-loading",r[1])},m(f,w){_(f,e,w),k(e,t),k(t,s),k(s,l),p&&p.m(s,null),k(e,n),L(o,e,null),k(e,c),k(e,a),k(a,i),u=!0,g||($=q(e,"submit",D(r[4])),g=!0)},p(f,w){f[3]?p?p.p(f,w):(p=S(f),p.c(),p.m(s,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]),(!u||w&2)&&F(a,"btn-loading",f[1])},i(f){u||(v(o.$$.fragment,f),u=!0)},o(f){y(o.$$.fragment,f),u=!1},d(f){f&&b(e),p&&p.d(),z(o),g=!1,$()}}}function O(r){let e,t,s,l,n;return{c(){e=m("div"),e.innerHTML=`
-

Successfully changed the user email address.

-

You can now sign in with your new email address.

`,t=h(),s=m("button"),s.textContent="Close",d(e,"class","alert alert-success"),d(s,"type","button"),d(s,"class","btn btn-secondary btn-block")},m(o,c){_(o,e,c),_(o,t,c),_(o,s,c),l||(n=q(s,"click",r[6]),l=!0)},p:E,i:E,o:E,d(o){o&&b(e),o&&b(t),o&&b(s),l=!1,n()}}}function S(r){let e,t,s;return{c(){e=C("to "),t=m("strong"),s=C(r[3]),d(t,"class","txt-nowrap")},m(l,n){_(l,e,n),_(l,t,n),k(t,s)},p(l,n){n&8&&I(s,l[3])},d(l){l&&b(e),l&&b(t)}}}function Q(r){let e,t,s,l,n,o,c,a;return{c(){e=m("label"),t=C("Password"),l=h(),n=m("input"),d(e,"for",s=r[8]),d(n,"type","password"),d(n,"id",o=r[8]),n.required=!0,n.autofocus=!0},m(i,u){_(i,e,u),k(e,t),_(i,l,u),_(i,n,u),H(n,r[0]),n.focus(),c||(a=q(n,"input",r[7]),c=!0)},p(i,u){u&256&&s!==(s=i[8])&&d(e,"for",s),u&256&&o!==(o=i[8])&&d(n,"id",o),u&1&&n.value!==i[0]&&H(n,i[0])},d(i){i&&b(e),i&&b(l),i&&b(n),c=!1,a()}}}function V(r){let e,t,s,l;const n=[O,K],o=[];function c(a,i){return a[2]?0:1}return e=c(r),t=o[e]=n[e](r),{c(){t.c(),s=U()},m(a,i){o[e].m(a,i),_(a,s,i),l=!0},p(a,i){let u=e;e=c(a),e===u?o[e].p(a,i):(W(),y(o[u],1,1,()=>{o[u]=null}),Y(),t=o[e],t?t.p(a,i):(t=o[e]=n[e](a),t.c()),v(t,1),t.m(s.parentNode,s))},i(a){l||(v(t),l=!0)},o(a){y(t),l=!1},d(a){o[e].d(a),a&&b(s)}}}function X(r){let e,t;return e=new N({props:{nobranding:!0,$$slots:{default:[V]},$$scope:{ctx:r}}}),{c(){T(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,[l]){const n={};l&527&&(n.$$scope={dirty:l,ctx:s}),e.$set(n)},i(s){t||(v(e.$$.fragment,s),t=!0)},o(s){y(e.$$.fragment,s),t=!1},d(s){z(e,s)}}}function Z(r,e,t){let s,{params:l}=e,n="",o=!1,c=!1;async function a(){if(o)return;t(1,o=!0);const g=new j("../");try{await g.users.confirmEmailChange(l==null?void 0:l.token,n),t(2,c=!0)}catch($){A.errorResponseHandler($)}t(1,o=!1)}const i=()=>window.close();function u(){n=this.value,t(0,n)}return r.$$set=g=>{"params"in g&&t(5,l=g.params)},r.$$.update=()=>{r.$$.dirty&32&&t(3,s=R.getJWTPayload(l==null?void 0:l.token).newEmail||"")},[n,o,c,s,a,l,i,u]}class ee extends G{constructor(e){super(),J(this,e,Z,X,M,{params:5})}}export{ee as default}; diff --git a/ui/dist/assets/PageUserConfirmPasswordReset.b3361442.js b/ui/dist/assets/PageUserConfirmPasswordReset.b3361442.js deleted file mode 100644 index f69b31fb9..000000000 --- a/ui/dist/assets/PageUserConfirmPasswordReset.b3361442.js +++ /dev/null @@ -1,4 +0,0 @@ -import{S as M,i as U,s as W,F as Y,c as H,m as N,t as P,a as q,d as L,C as j,E as A,g as _,k as B,n as D,o as m,G as I,p as K,q as E,e as b,w as y,b as C,f as c,r as G,h as w,u as S,v as O,y as F,x as Q,z as R}from"./index.e13041a6.js";function V(i){let e,l,s,n,t,o,p,u,r,a,v,k,g,h,d=i[4]&&J(i);return o=new E({props:{class:"form-field required",name:"password",$$slots:{default:[Z,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:i}}}),u=new E({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[x,({uniqueId:f})=>({10:f}),({uniqueId:f})=>f?1024:0]},$$scope:{ctx:i}}}),{c(){e=b("form"),l=b("div"),s=b("h5"),n=y(`Reset your user password - `),d&&d.c(),t=C(),H(o.$$.fragment),p=C(),H(u.$$.fragment),r=C(),a=b("button"),v=b("span"),v.textContent="Set new password",c(l,"class","content txt-center m-b-base"),c(v,"class","txt"),c(a,"type","submit"),c(a,"class","btn btn-lg btn-block"),a.disabled=i[2],G(a,"btn-loading",i[2])},m(f,$){_(f,e,$),w(e,l),w(l,s),w(s,n),d&&d.m(s,null),w(e,t),N(o,e,null),w(e,p),N(u,e,null),w(e,r),w(e,a),w(a,v),k=!0,g||(h=S(e,"submit",O(i[5])),g=!0)},p(f,$){f[4]?d?d.p(f,$):(d=J(f),d.c(),d.m(s,null)):d&&(d.d(1),d=null);const T={};$&3073&&(T.$$scope={dirty:$,ctx:f}),o.$set(T);const z={};$&3074&&(z.$$scope={dirty:$,ctx:f}),u.$set(z),(!k||$&4)&&(a.disabled=f[2]),(!k||$&4)&&G(a,"btn-loading",f[2])},i(f){k||(P(o.$$.fragment,f),P(u.$$.fragment,f),k=!0)},o(f){q(o.$$.fragment,f),q(u.$$.fragment,f),k=!1},d(f){f&&m(e),d&&d.d(),L(o),L(u),g=!1,h()}}}function X(i){let e,l,s,n,t;return{c(){e=b("div"),e.innerHTML=`
-

Successfully changed the user password.

-

You can now sign in with your new password.

`,l=C(),s=b("button"),s.textContent="Close",c(e,"class","alert alert-success"),c(s,"type","button"),c(s,"class","btn btn-secondary btn-block")},m(o,p){_(o,e,p),_(o,l,p),_(o,s,p),n||(t=S(s,"click",i[7]),n=!0)},p:F,i:F,o:F,d(o){o&&m(e),o&&m(l),o&&m(s),n=!1,t()}}}function J(i){let e,l,s;return{c(){e=y("for "),l=b("strong"),s=y(i[4])},m(n,t){_(n,e,t),_(n,l,t),w(l,s)},p(n,t){t&16&&Q(s,n[4])},d(n){n&&m(e),n&&m(l)}}}function Z(i){let e,l,s,n,t,o,p,u;return{c(){e=b("label"),l=y("New password"),n=C(),t=b("input"),c(e,"for",s=i[10]),c(t,"type","password"),c(t,"id",o=i[10]),t.required=!0,t.autofocus=!0},m(r,a){_(r,e,a),w(e,l),_(r,n,a),_(r,t,a),R(t,i[0]),t.focus(),p||(u=S(t,"input",i[8]),p=!0)},p(r,a){a&1024&&s!==(s=r[10])&&c(e,"for",s),a&1024&&o!==(o=r[10])&&c(t,"id",o),a&1&&t.value!==r[0]&&R(t,r[0])},d(r){r&&m(e),r&&m(n),r&&m(t),p=!1,u()}}}function x(i){let e,l,s,n,t,o,p,u;return{c(){e=b("label"),l=y("New password confirm"),n=C(),t=b("input"),c(e,"for",s=i[10]),c(t,"type","password"),c(t,"id",o=i[10]),t.required=!0},m(r,a){_(r,e,a),w(e,l),_(r,n,a),_(r,t,a),R(t,i[1]),p||(u=S(t,"input",i[9]),p=!0)},p(r,a){a&1024&&s!==(s=r[10])&&c(e,"for",s),a&1024&&o!==(o=r[10])&&c(t,"id",o),a&2&&t.value!==r[1]&&R(t,r[1])},d(r){r&&m(e),r&&m(n),r&&m(t),p=!1,u()}}}function ee(i){let e,l,s,n;const t=[X,V],o=[];function p(u,r){return u[3]?0:1}return e=p(i),l=o[e]=t[e](i),{c(){l.c(),s=A()},m(u,r){o[e].m(u,r),_(u,s,r),n=!0},p(u,r){let a=e;e=p(u),e===a?o[e].p(u,r):(B(),q(o[a],1,1,()=>{o[a]=null}),D(),l=o[e],l?l.p(u,r):(l=o[e]=t[e](u),l.c()),P(l,1),l.m(s.parentNode,s))},i(u){n||(P(l),n=!0)},o(u){q(l),n=!1},d(u){o[e].d(u),u&&m(s)}}}function te(i){let e,l;return e=new Y({props:{nobranding:!0,$$slots:{default:[ee]},$$scope:{ctx:i}}}),{c(){H(e.$$.fragment)},m(s,n){N(e,s,n),l=!0},p(s,[n]){const t={};n&2079&&(t.$$scope={dirty:n,ctx:s}),e.$set(t)},i(s){l||(P(e.$$.fragment,s),l=!0)},o(s){q(e.$$.fragment,s),l=!1},d(s){L(e,s)}}}function se(i,e,l){let s,{params:n}=e,t="",o="",p=!1,u=!1;async function r(){if(p)return;l(2,p=!0);const g=new I("../");try{await g.users.confirmPasswordReset(n==null?void 0:n.token,t,o),l(3,u=!0)}catch(h){K.errorResponseHandler(h)}l(2,p=!1)}const a=()=>window.close();function v(){t=this.value,l(0,t)}function k(){o=this.value,l(1,o)}return i.$$set=g=>{"params"in g&&l(6,n=g.params)},i.$$.update=()=>{i.$$.dirty&64&&l(4,s=j.getJWTPayload(n==null?void 0:n.token).email||"")},[t,o,p,u,s,r,n,a,v,k]}class ne extends M{constructor(e){super(),U(this,e,se,te,W,{params:6})}}export{ne as default}; diff --git a/ui/dist/assets/PageUserConfirmVerification.afbff8ec.js b/ui/dist/assets/PageUserConfirmVerification.afbff8ec.js deleted file mode 100644 index deebaa472..000000000 --- a/ui/dist/assets/PageUserConfirmVerification.afbff8ec.js +++ /dev/null @@ -1,3 +0,0 @@ -import{S as k,i as v,s as y,F as w,c as x,m as C,t as g,a as $,d as L,G as H,E as M,g as r,o as a,e as u,b as m,f,u as _,y as p}from"./index.e13041a6.js";function P(c){let t,s,e,n,i;return{c(){t=u("div"),t.innerHTML=`
-

Invalid or expired verification token.

`,s=m(),e=u("button"),e.textContent="Close",f(t,"class","alert alert-danger"),f(e,"type","button"),f(e,"class","btn btn-secondary btn-block")},m(l,o){r(l,t,o),r(l,s,o),r(l,e,o),n||(i=_(e,"click",c[4]),n=!0)},p,d(l){l&&a(t),l&&a(s),l&&a(e),n=!1,i()}}}function S(c){let t,s,e,n,i;return{c(){t=u("div"),t.innerHTML=`
-

Successfully verified email address.

`,s=m(),e=u("button"),e.textContent="Close",f(t,"class","alert alert-success"),f(e,"type","button"),f(e,"class","btn btn-secondary btn-block")},m(l,o){r(l,t,o),r(l,s,o),r(l,e,o),n||(i=_(e,"click",c[3]),n=!0)},p,d(l){l&&a(t),l&&a(s),l&&a(e),n=!1,i()}}}function T(c){let t;return{c(){t=u("div"),t.innerHTML='
Please wait...
',f(t,"class","txt-center")},m(s,e){r(s,t,e)},p,d(s){s&&a(t)}}}function F(c){let t;function s(i,l){return i[1]?T:i[0]?S:P}let e=s(c),n=e(c);return{c(){n.c(),t=M()},m(i,l){n.m(i,l),r(i,t,l)},p(i,l){e===(e=s(i))&&n?n.p(i,l):(n.d(1),n=e(i),n&&(n.c(),n.m(t.parentNode,t)))},d(i){n.d(i),i&&a(t)}}}function V(c){let t,s;return t=new w({props:{nobranding:!0,$$slots:{default:[F]},$$scope:{ctx:c}}}),{c(){x(t.$$.fragment)},m(e,n){C(t,e,n),s=!0},p(e,[n]){const i={};n&67&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){s||(g(t.$$.fragment,e),s=!0)},o(e){$(t.$$.fragment,e),s=!1},d(e){L(t,e)}}}function q(c,t,s){let{params:e}=t,n=!1,i=!1;l();async function l(){s(1,i=!0);const d=new H("../");try{await d.users.confirmVerification(e==null?void 0:e.token),s(0,n=!0)}catch{s(0,n=!1)}s(1,i=!1)}const o=()=>window.close(),b=()=>window.close();return c.$$set=d=>{"params"in d&&s(2,e=d.params)},[n,i,e,o,b]}class I extends k{constructor(t){super(),v(this,t,q,V,y,{params:2})}}export{I as default}; diff --git a/ui/dist/assets/RealtimeApiDocs.e9e53954.js b/ui/dist/assets/RealtimeApiDocs.e9e53954.js new file mode 100644 index 000000000..54ba1707e --- /dev/null +++ b/ui/dist/assets/RealtimeApiDocs.e9e53954.js @@ -0,0 +1,103 @@ +import{S as ee,i as oe,s as te,O as se,C as I,e as u,w as E,b as a,c as K,f as p,g as s,h as P,m as Q,x as ne,t as X,a as Z,o as n,d as x,L as ie,p as ce}from"./index.97f016a1.js";import{S as re}from"./SdkTabs.88269ae0.js";function le(t){var B,U,W,L,A,H,T,q;let i,m,c=t[0].name+"",b,d,k,f,S,v,w,r,_,$,O,g,y,h,D,l,R;return r=new re({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${t[1]}'); + + ... + + // (Optionally) authenticate + await pb.collection('users').authWithPassword('test@example.com', '123456'); + + // Subscribe to changes in any record from the collection + pb.collection('${(B=t[0])==null?void 0:B.name}').subscribe(function (e) { + console.log(e.record); + }); + + // Subscribe to changes in a single record + pb.collection('${(U=t[0])==null?void 0:U.name}').subscribeOne('RECORD_ID', function (e) { + console.log(e.record); + }); + + // Unsubscribe + pb.collection('${(W=t[0])==null?void 0:W.name}').unsubscribe() // remove all collection subscriptions + pb.collection('${(L=t[0])==null?void 0:L.name}').unsubscribe('RECORD_ID') // remove only the record subscription + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${t[1]}'); + + ... + + // (Optionally) authenticate + await pb.collection('users').authWithPassword('test@example.com', '123456'); + + // Subscribe to changes in any record from the collection + pb.collection('${(A=t[0])==null?void 0:A.name}').subscribe((e) { + print(e.record); + }); + + // Subscribe to changes in a single record + pb.collection('${(H=t[0])==null?void 0:H.name}').subscribeOne('RECORD_ID', (e) { + print(e.record); + }); + + // Unsubscribe + pb.collection('${(T=t[0])==null?void 0:T.name}').unsubscribe() // remove all collection subscriptions + pb.collection('${(q=t[0])==null?void 0:q.name}').unsubscribe('RECORD_ID') // remove only the record subscription + `}}),l=new se({props:{content:JSON.stringify({action:"create",record:I.dummyCollectionRecord(t[0])},null,2).replace('"action": "create"','"action": "create" // create, update or delete')}}),{c(){i=u("h3"),m=E("Realtime ("),b=E(c),d=E(")"),k=a(),f=u("div"),f.innerHTML=`

Subscribe to realtime changes via Server-Sent Events (SSE).

+

Events are sent for create, update + and delete record operations (see "Event data format" section below).

`,S=a(),v=u("div"),v.innerHTML=`
+

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.

`,w=a(),K(r.$$.fragment),_=a(),$=u("h6"),$.textContent="API details",O=a(),g=u("div"),g.innerHTML=`SSE +

/api/realtime

`,y=a(),h=u("div"),h.textContent="Event data format",D=a(),K(l.$$.fragment),p(i,"class","m-b-sm"),p(f,"class","content txt-lg m-b-sm"),p(v,"class","alert alert-info m-t-10 m-b-sm"),p($,"class","m-b-xs"),p(g,"class","alert"),p(h,"class","section-title")},m(e,o){s(e,i,o),P(i,m),P(i,b),P(i,d),s(e,k,o),s(e,f,o),s(e,S,o),s(e,v,o),s(e,w,o),Q(r,e,o),s(e,_,o),s(e,$,o),s(e,O,o),s(e,g,o),s(e,y,o),s(e,h,o),s(e,D,o),Q(l,e,o),R=!0},p(e,[o]){var j,J,N,V,Y,z,F,G;(!R||o&1)&&c!==(c=e[0].name+"")&&ne(b,c);const C={};o&3&&(C.js=` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${e[1]}'); + + ... + + // (Optionally) authenticate + await pb.collection('users').authWithPassword('test@example.com', '123456'); + + // Subscribe to changes in any record from the collection + pb.collection('${(j=e[0])==null?void 0:j.name}').subscribe(function (e) { + console.log(e.record); + }); + + // Subscribe to changes in a single record + pb.collection('${(J=e[0])==null?void 0:J.name}').subscribeOne('RECORD_ID', function (e) { + console.log(e.record); + }); + + // Unsubscribe + pb.collection('${(N=e[0])==null?void 0:N.name}').unsubscribe() // remove all collection subscriptions + pb.collection('${(V=e[0])==null?void 0:V.name}').unsubscribe('RECORD_ID') // remove only the record subscription + `),o&3&&(C.dart=` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${e[1]}'); + + ... + + // (Optionally) authenticate + await pb.collection('users').authWithPassword('test@example.com', '123456'); + + // Subscribe to changes in any record from the collection + pb.collection('${(Y=e[0])==null?void 0:Y.name}').subscribe((e) { + print(e.record); + }); + + // Subscribe to changes in a single record + pb.collection('${(z=e[0])==null?void 0:z.name}').subscribeOne('RECORD_ID', (e) { + print(e.record); + }); + + // Unsubscribe + pb.collection('${(F=e[0])==null?void 0:F.name}').unsubscribe() // remove all collection subscriptions + pb.collection('${(G=e[0])==null?void 0:G.name}').unsubscribe('RECORD_ID') // remove only the record subscription + `),r.$set(C);const M={};o&1&&(M.content=JSON.stringify({action:"create",record:I.dummyCollectionRecord(e[0])},null,2).replace('"action": "create"','"action": "create" // create, update or delete')),l.$set(M)},i(e){R||(X(r.$$.fragment,e),X(l.$$.fragment,e),R=!0)},o(e){Z(r.$$.fragment,e),Z(l.$$.fragment,e),R=!1},d(e){e&&n(i),e&&n(k),e&&n(f),e&&n(S),e&&n(v),e&&n(w),x(r,e),e&&n(_),e&&n($),e&&n(O),e&&n(g),e&&n(y),e&&n(h),e&&n(D),x(l,e)}}}function ae(t,i,m){let c,{collection:b=new ie}=i;return t.$$set=d=>{"collection"in d&&m(0,b=d.collection)},m(1,c=I.getApiExampleUrl(ce.baseUrl)),[b,c]}class pe extends ee{constructor(i){super(),oe(this,i,ae,le,te,{collection:0})}}export{pe as default}; diff --git a/ui/dist/assets/RequestEmailChangeDocs.1fe72b2e.js b/ui/dist/assets/RequestEmailChangeDocs.1fe72b2e.js new file mode 100644 index 000000000..cb2c19eb1 --- /dev/null +++ b/ui/dist/assets/RequestEmailChangeDocs.1fe72b2e.js @@ -0,0 +1,70 @@ +import{S as Pe,i as Te,s as Be,e as c,w as v,b as h,c as Ce,f,g as r,h as n,m as Ee,x as D,P as ve,Q as Se,k as Re,R as Me,n as Ae,t as x,a as ee,o as m,d as ye,L as Ve,C as ze,p as He,r as I,u as Le,O as Oe}from"./index.97f016a1.js";import{S as Ue}from"./SdkTabs.88269ae0.js";function we(o,l,s){const a=o.slice();return a[5]=l[s],a}function ge(o,l,s){const a=o.slice();return a[5]=l[s],a}function $e(o,l){let s,a=l[5].code+"",_,b,i,p;function u(){return l[4](l[5])}return{key:o,first:null,c(){s=c("button"),_=v(a),b=h(),f(s,"class","tab-item"),I(s,"active",l[1]===l[5].code),this.first=s},m($,q){r($,s,q),n(s,_),n(s,b),i||(p=Le(s,"click",u),i=!0)},p($,q){l=$,q&4&&a!==(a=l[5].code+"")&&D(_,a),q&6&&I(s,"active",l[1]===l[5].code)},d($){$&&m(s),i=!1,p()}}}function qe(o,l){let s,a,_,b;return a=new Oe({props:{content:l[5].body}}),{key:o,first:null,c(){s=c("div"),Ce(a.$$.fragment),_=h(),f(s,"class","tab-item"),I(s,"active",l[1]===l[5].code),this.first=s},m(i,p){r(i,s,p),Ee(a,s,null),n(s,_),b=!0},p(i,p){l=i;const u={};p&4&&(u.content=l[5].body),a.$set(u),(!b||p&6)&&I(s,"active",l[1]===l[5].code)},i(i){b||(x(a.$$.fragment,i),b=!0)},o(i){ee(a.$$.fragment,i),b=!1},d(i){i&&m(s),ye(a)}}}function je(o){var de,pe,ue,fe;let l,s,a=o[0].name+"",_,b,i,p,u,$,q,z=o[0].name+"",F,te,K,C,N,P,Q,w,H,le,L,T,se,G,O=o[0].name+"",J,ae,oe,U,W,B,X,S,Y,R,Z,E,M,g=[],ne=new Map,ie,A,k=[],ce=new Map,y;C=new Ue({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${o[3]}'); + + ... + + await pb.collection('${(de=o[0])==null?void 0:de.name}').authViaEmail('test@example.com', '123456'); + + await pb.collection('${(pe=o[0])==null?void 0:pe.name}').requestEmailChange('new@example.com'); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${o[3]}'); + + ... + + await pb.collection('${(ue=o[0])==null?void 0:ue.name}').authViaEmail('test@example.com', '123456'); + + await pb.collection('${(fe=o[0])==null?void 0:fe.name}').requestEmailChange('new@example.com'); + `}});let j=o[2];const re=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eAuthorization:TOKEN header",W=h(),B=c("div"),B.textContent="Body Parameters",X=h(),S=c("table"),S.innerHTML=`Param + Type + Description +
Required + newEmail
+ String + The new email address to send the change email request.`,Y=h(),R=c("div"),R.textContent="Responses",Z=h(),E=c("div"),M=c("div");for(let e=0;es(1,b=u.code);return o.$$set=u=>{"collection"in u&&s(0,_=u.collection)},s(3,a=ze.getApiExampleUrl(He.baseUrl)),s(2,i=[{code:204,body:"null"},{code:400,body:` + { + "code": 400, + "message": "Failed to authenticate.", + "data": { + "newEmail": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `},{code:401,body:` + { + "code": 401, + "message": "The request requires valid record authorization token to be set.", + "data": {} + } + `},{code:403,body:` + { + "code": 403, + "message": "The authorized record model is not allowed to perform this action.", + "data": {} + } + `}]),[_,b,i,a,p]}class Ke extends Pe{constructor(l){super(),Te(this,l,De,je,Be,{collection:0})}}export{Ke as default}; diff --git a/ui/dist/assets/RequestPasswordResetDocs.c8de2eb6.js b/ui/dist/assets/RequestPasswordResetDocs.c8de2eb6.js new file mode 100644 index 000000000..216fa34dd --- /dev/null +++ b/ui/dist/assets/RequestPasswordResetDocs.c8de2eb6.js @@ -0,0 +1,50 @@ +import{S as Pe,i as $e,s as qe,e as c,w,b as v,c as ve,f as b,g as r,h as n,m as we,x as E,P as ue,Q as Re,k as ge,R as ye,n as Be,t as Z,a as x,o as d,d as he,L as Ce,C as Se,p as Te,r as F,u as Me,O as Ae}from"./index.97f016a1.js";import{S as Ue}from"./SdkTabs.88269ae0.js";function me(a,s,l){const o=a.slice();return o[5]=s[l],o}function be(a,s,l){const o=a.slice();return o[5]=s[l],o}function _e(a,s){let l,o=s[5].code+"",_,m,i,p;function u(){return s[4](s[5])}return{key:a,first:null,c(){l=c("button"),_=w(o),m=v(),b(l,"class","tab-item"),F(l,"active",s[1]===s[5].code),this.first=l},m(P,$){r(P,l,$),n(l,_),n(l,m),i||(p=Me(l,"click",u),i=!0)},p(P,$){s=P,$&4&&o!==(o=s[5].code+"")&&E(_,o),$&6&&F(l,"active",s[1]===s[5].code)},d(P){P&&d(l),i=!1,p()}}}function ke(a,s){let l,o,_,m;return o=new Ae({props:{content:s[5].body}}),{key:a,first:null,c(){l=c("div"),ve(o.$$.fragment),_=v(),b(l,"class","tab-item"),F(l,"active",s[1]===s[5].code),this.first=l},m(i,p){r(i,l,p),we(o,l,null),n(l,_),m=!0},p(i,p){s=i;const u={};p&4&&(u.content=s[5].body),o.$set(u),(!m||p&6)&&F(l,"active",s[1]===s[5].code)},i(i){m||(Z(o.$$.fragment,i),m=!0)},o(i){x(o.$$.fragment,i),m=!1},d(i){i&&d(l),he(o)}}}function je(a){var re,de;let s,l,o=a[0].name+"",_,m,i,p,u,P,$,D=a[0].name+"",Q,ee,z,q,G,B,J,R,H,te,I,C,se,K,L=a[0].name+"",N,le,V,S,W,T,X,M,Y,g,A,h=[],oe=new Map,ae,U,k=[],ne=new Map,y;q=new Ue({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${a[3]}'); + + ... + + await pb.collection('${(re=a[0])==null?void 0:re.name}').requestPasswordReset('test@example.com'); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${a[3]}'); + + ... + + await pb.collection('${(de=a[0])==null?void 0:de.name}').requestPasswordReset('test@example.com'); + `}});let O=a[2];const ie=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eParam + Type + Description +
Required + email
+ String + The auth record email address to send the password reset request (if exists).`,X=v(),M=c("div"),M.textContent="Responses",Y=v(),g=c("div"),A=c("div");for(let e=0;el(1,m=u.code);return a.$$set=u=>{"collection"in u&&l(0,_=u.collection)},l(3,o=Se.getApiExampleUrl(Te.baseUrl)),l(2,i=[{code:204,body:"null"},{code:400,body:` + { + "code": 400, + "message": "Failed to authenticate.", + "data": { + "email": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `}]),[_,m,i,o,p]}class Le extends Pe{constructor(s){super(),$e(this,s,De,je,qe,{collection:0})}}export{Le as default}; diff --git a/ui/dist/assets/RequestVerificationDocs.2b01d123.js b/ui/dist/assets/RequestVerificationDocs.2b01d123.js new file mode 100644 index 000000000..13b6b889c --- /dev/null +++ b/ui/dist/assets/RequestVerificationDocs.2b01d123.js @@ -0,0 +1,50 @@ +import{S as we,i as qe,s as Pe,e as c,w as h,b as v,c as ve,f as b,g as r,h as i,m as he,x as O,P as ue,Q as ge,k as ye,R as Be,n as Ce,t as Z,a as x,o as f,d as $e,L as Se,C as Te,p as Re,r as E,u as Ve,O as Me}from"./index.97f016a1.js";import{S as Ae}from"./SdkTabs.88269ae0.js";function me(a,l,s){const o=a.slice();return o[5]=l[s],o}function be(a,l,s){const o=a.slice();return o[5]=l[s],o}function _e(a,l){let s,o=l[5].code+"",_,m,n,p;function u(){return l[4](l[5])}return{key:a,first:null,c(){s=c("button"),_=h(o),m=v(),b(s,"class","tab-item"),E(s,"active",l[1]===l[5].code),this.first=s},m(w,q){r(w,s,q),i(s,_),i(s,m),n||(p=Ve(s,"click",u),n=!0)},p(w,q){l=w,q&4&&o!==(o=l[5].code+"")&&O(_,o),q&6&&E(s,"active",l[1]===l[5].code)},d(w){w&&f(s),n=!1,p()}}}function ke(a,l){let s,o,_,m;return o=new Me({props:{content:l[5].body}}),{key:a,first:null,c(){s=c("div"),ve(o.$$.fragment),_=v(),b(s,"class","tab-item"),E(s,"active",l[1]===l[5].code),this.first=s},m(n,p){r(n,s,p),he(o,s,null),i(s,_),m=!0},p(n,p){l=n;const u={};p&4&&(u.content=l[5].body),o.$set(u),(!m||p&6)&&E(s,"active",l[1]===l[5].code)},i(n){m||(Z(o.$$.fragment,n),m=!0)},o(n){x(o.$$.fragment,n),m=!1},d(n){n&&f(s),$e(o)}}}function Ue(a){var re,fe;let l,s,o=a[0].name+"",_,m,n,p,u,w,q,j=a[0].name+"",F,ee,Q,P,z,C,G,g,D,te,H,S,le,J,I=a[0].name+"",K,se,N,T,W,R,X,V,Y,y,M,$=[],oe=new Map,ae,A,k=[],ie=new Map,B;P=new Ae({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${a[3]}'); + + ... + + await pb.collection('${(re=a[0])==null?void 0:re.name}').requestVerification('test@example.com'); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${a[3]}'); + + ... + + await pb.collection('${(fe=a[0])==null?void 0:fe.name}').requestVerification('test@example.com'); + `}});let L=a[2];const ne=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eParam + Type + Description +
Required + email
+ String + The auth record email address to send the verification request (if exists).`,X=v(),V=c("div"),V.textContent="Responses",Y=v(),y=c("div"),M=c("div");for(let e=0;e<$.length;e+=1)$[e].c();ae=v(),A=c("div");for(let e=0;es(1,m=u.code);return a.$$set=u=>{"collection"in u&&s(0,_=u.collection)},s(3,o=Te.getApiExampleUrl(Re.baseUrl)),s(2,n=[{code:204,body:"null"},{code:400,body:` + { + "code": 400, + "message": "Failed to authenticate.", + "data": { + "email": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `}]),[_,m,n,o,p]}class Ie extends we{constructor(l){super(),qe(this,l,je,Ue,Pe,{collection:0})}}export{Ie as default}; diff --git a/ui/dist/assets/SdkTabs.88269ae0.js b/ui/dist/assets/SdkTabs.88269ae0.js new file mode 100644 index 000000000..c2a81f352 --- /dev/null +++ b/ui/dist/assets/SdkTabs.88269ae0.js @@ -0,0 +1 @@ +import{S as q,i as B,s as F,e as b,b as v,f as h,g as y,h as f,P as w,Q as J,k as N,R as O,n as Q,t as I,a as M,o as E,w as S,r as j,u as Y,x as P,O as z,c as A,m as G,d as H}from"./index.97f016a1.js";function C(o,t,l){const n=o.slice();return n[5]=t[l],n}function D(o,t,l){const n=o.slice();return n[5]=t[l],n}function K(o,t){let l,n,_=t[5].title+"",u,r,s,c;function m(){return t[4](t[5])}return{key:o,first:null,c(){l=b("button"),n=b("div"),u=S(_),r=v(),h(n,"class","txt"),h(l,"class","tab-item svelte-1maocj6"),j(l,"active",t[0]===t[5].language),this.first=l},m(g,d){y(g,l,d),f(l,n),f(n,u),f(l,r),s||(c=Y(l,"click",m),s=!0)},p(g,d){t=g,d&2&&_!==(_=t[5].title+"")&&P(u,_),d&3&&j(l,"active",t[0]===t[5].language)},d(g){g&&E(l),s=!1,c()}}}function R(o,t){let l,n,_,u,r,s,c=t[5].title+"",m,g,d,p,k;return n=new z({props:{language:t[5].language,content:t[5].content}}),{key:o,first:null,c(){l=b("div"),A(n.$$.fragment),_=v(),u=b("div"),r=b("em"),s=b("a"),m=S(c),g=S(" SDK"),p=v(),h(s,"href",d=t[5].url),h(s,"target","_blank"),h(s,"rel","noopener noreferrer"),h(r,"class","txt-sm txt-hint"),h(u,"class","txt-right"),h(l,"class","tab-item svelte-1maocj6"),j(l,"active",t[0]===t[5].language),this.first=l},m(e,a){y(e,l,a),G(n,l,null),f(l,_),f(l,u),f(u,r),f(r,s),f(s,m),f(s,g),f(l,p),k=!0},p(e,a){t=e;const i={};a&2&&(i.language=t[5].language),a&2&&(i.content=t[5].content),n.$set(i),(!k||a&2)&&c!==(c=t[5].title+"")&&P(m,c),(!k||a&2&&d!==(d=t[5].url))&&h(s,"href",d),(!k||a&3)&&j(l,"active",t[0]===t[5].language)},i(e){k||(I(n.$$.fragment,e),k=!0)},o(e){M(n.$$.fragment,e),k=!1},d(e){e&&E(l),H(n)}}}function L(o){let t,l,n=[],_=new Map,u,r,s=[],c=new Map,m,g=o[1];const d=e=>e[5].language;for(let e=0;ee[5].language;for(let e=0;el(0,r=c.language);return o.$$set=c=>{"js"in c&&l(2,_=c.js),"dart"in c&&l(3,u=c.dart)},o.$$.update=()=>{o.$$.dirty&1&&r&&localStorage.setItem(T,r),o.$$.dirty&12&&l(1,n=[{title:"JavaScript",language:"javascript",content:_,url:"https://github.com/pocketbase/js-sdk/tree/rc"},{title:"Dart",language:"dart",content:u,url:"https://github.com/pocketbase/dart-sdk/tree/rc"}])},[r,n,_,u,s]}class W extends q{constructor(t){super(),B(this,t,U,L,F,{js:2,dart:3})}}export{W as S}; diff --git a/ui/dist/assets/SdkTabs.9b0b7a06.css b/ui/dist/assets/SdkTabs.9b0b7a06.css new file mode 100644 index 000000000..64e6ba64f --- /dev/null +++ b/ui/dist/assets/SdkTabs.9b0b7a06.css @@ -0,0 +1 @@ +.sdk-tabs.svelte-1maocj6 .tabs-header .tab-item.svelte-1maocj6{min-width:100px} diff --git a/ui/dist/assets/UnlinkExternalAuthDocs.3445a27c.js b/ui/dist/assets/UnlinkExternalAuthDocs.3445a27c.js new file mode 100644 index 000000000..93593c204 --- /dev/null +++ b/ui/dist/assets/UnlinkExternalAuthDocs.3445a27c.js @@ -0,0 +1,80 @@ +import{S as qe,i as Oe,s as De,e as i,w as v,b as h,c as Se,f,g as r,h as s,m as Be,x as R,P as ye,Q as Le,k as Me,R as Ve,n as ze,t as le,a as oe,o as d,d as Ue,L as He,C as Ie,p as Re,r as j,u as je,O as Ke}from"./index.97f016a1.js";import{S as Ne}from"./SdkTabs.88269ae0.js";function Ae(n,l,o){const a=n.slice();return a[5]=l[o],a}function Ce(n,l,o){const a=n.slice();return a[5]=l[o],a}function Pe(n,l){let o,a=l[5].code+"",_,b,c,u;function p(){return l[4](l[5])}return{key:n,first:null,c(){o=i("button"),_=v(a),b=h(),f(o,"class","tab-item"),j(o,"active",l[1]===l[5].code),this.first=o},m($,E){r($,o,E),s(o,_),s(o,b),c||(u=je(o,"click",p),c=!0)},p($,E){l=$,E&4&&a!==(a=l[5].code+"")&&R(_,a),E&6&&j(o,"active",l[1]===l[5].code)},d($){$&&d(o),c=!1,u()}}}function Te(n,l){let o,a,_,b;return a=new Ke({props:{content:l[5].body}}),{key:n,first:null,c(){o=i("div"),Se(a.$$.fragment),_=h(),f(o,"class","tab-item"),j(o,"active",l[1]===l[5].code),this.first=o},m(c,u){r(c,o,u),Be(a,o,null),s(o,_),b=!0},p(c,u){l=c;const p={};u&4&&(p.content=l[5].body),a.$set(p),(!b||u&6)&&j(o,"active",l[1]===l[5].code)},i(c){b||(le(a.$$.fragment,c),b=!0)},o(c){oe(a.$$.fragment,c),b=!1},d(c){c&&d(o),Ue(a)}}}function Qe(n){var he,_e,ke,ve;let l,o,a=n[0].name+"",_,b,c,u,p,$,E,L=n[0].name+"",K,se,ae,N,Q,A,F,T,G,g,M,ne,V,y,ie,J,z=n[0].name+"",W,ce,X,re,Y,de,H,Z,S,x,B,ee,U,te,C,q,w=[],ue=new Map,me,O,k=[],pe=new Map,P;A=new Ne({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${n[3]}'); + + ... + + await pb.collection('${(he=n[0])==null?void 0:he.name}').authViaEmail('test@example.com', '123456'); + + await pb.collection('${(_e=n[0])==null?void 0:_e.name}').unlinkExternalAuth( + pb.authStore.model.id, + 'google' + ); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${n[3]}'); + + ... + + await pb.collection('${(ke=n[0])==null?void 0:ke.name}').authViaEmail('test@example.com', '123456'); + + await pb.collection('${(ve=n[0])==null?void 0:ve.name}').unlinkExternalAuth( + pb.authStore.model.id, + 'google', + ); + `}});let I=n[2];const fe=e=>e[5].code;for(let e=0;ee[5].code;for(let e=0;eAuthorization:TOKEN header",Z=h(),S=i("div"),S.textContent="Path Parameters",x=h(),B=i("table"),B.innerHTML=`Param + Type + Description + id + String + ID of the auth record. + provider + String + The name of the auth provider to unlink, eg. google, twitter, + github, etc.`,ee=h(),U=i("div"),U.textContent="Responses",te=h(),C=i("div"),q=i("div");for(let e=0;eo(1,b=p.code);return n.$$set=p=>{"collection"in p&&o(0,_=p.collection)},o(3,a=Ie.getApiExampleUrl(Re.baseUrl)),o(2,c=[{code:204,body:"null"},{code:401,body:` + { + "code": 401, + "message": "The request requires valid record authorization token to be set.", + "data": {} + } + `},{code:403,body:` + { + "code": 403, + "message": "The authorized record model is not allowed to perform this action.", + "data": {} + } + `},{code:404,body:` + { + "code": 404, + "message": "The requested resource wasn't found.", + "data": {} + } + `}]),[_,b,c,a,u]}class We extends qe{constructor(l){super(),Oe(this,l,Fe,Qe,De,{collection:0})}}export{We as default}; diff --git a/ui/dist/assets/UpdateApiDocs.f4df7d8c.js b/ui/dist/assets/UpdateApiDocs.f4df7d8c.js new file mode 100644 index 000000000..852593868 --- /dev/null +++ b/ui/dist/assets/UpdateApiDocs.f4df7d8c.js @@ -0,0 +1,118 @@ +import{S as Ct,i as St,s as Ot,C as I,O as Tt,e as r,w as y,b as m,c as Ae,f as T,g as a,h as i,m as Be,x as U,P as Pe,Q as ut,k as Mt,R as $t,n as Rt,t as pe,a as fe,o,d as Fe,L as qt,p as Dt,r as ce,u as Ht,y as G}from"./index.97f016a1.js";import{S as Lt}from"./SdkTabs.88269ae0.js";function bt(p,t,l){const s=p.slice();return s[7]=t[l],s}function mt(p,t,l){const s=p.slice();return s[7]=t[l],s}function _t(p,t,l){const s=p.slice();return s[12]=t[l],s}function yt(p){let t;return{c(){t=r("p"),t.innerHTML="Requires admin Authorization:TOKEN header",T(t,"class","txt-hint txt-sm txt-right")},m(l,s){a(l,t,s)},d(l){l&&o(t)}}}function kt(p){let t,l,s,b,u,d,f,k,C,v,O,D,A,F,M,j,B;return{c(){t=r("tr"),t.innerHTML='Auth fields',l=m(),s=r("tr"),s.innerHTML=`
Optional + username
+ String + The username of the auth record.`,b=m(),u=r("tr"),u.innerHTML=`
Optional + email
+ String + The auth record email address. +
+ This field can be updated only by admins or auth records with "Manage" access. +
+ Regular accounts can update their email by calling "Request email change".`,d=m(),f=r("tr"),f.innerHTML=`
Optional + emailVisibility
+ Boolean + Whether to show/hide the auth record email when fetching the record data.`,k=m(),C=r("tr"),C.innerHTML=`
Optional + oldPassword
+ String + Old auth record password. +
+ This field is required only when changing the record password. Admins and auth records with + "Manage" access can skip this field.`,v=m(),O=r("tr"),O.innerHTML=`
Optional + password
+ String + New auth record password.`,D=m(),A=r("tr"),A.innerHTML=`
Optional + passwordConfirm
+ String + New auth record password confirmation.`,F=m(),M=r("tr"),M.innerHTML=`
Optional + verified
+ Boolean + Indicates whether the auth record is verified or not. +
+ This field can be set only by admins or auth records with "Manage" access.`,j=m(),B=r("tr"),B.innerHTML='Schema fields'},m(c,_){a(c,t,_),a(c,l,_),a(c,s,_),a(c,b,_),a(c,u,_),a(c,d,_),a(c,f,_),a(c,k,_),a(c,C,_),a(c,v,_),a(c,O,_),a(c,D,_),a(c,A,_),a(c,F,_),a(c,M,_),a(c,j,_),a(c,B,_)},d(c){c&&o(t),c&&o(l),c&&o(s),c&&o(b),c&&o(u),c&&o(d),c&&o(f),c&&o(k),c&&o(C),c&&o(v),c&&o(O),c&&o(D),c&&o(A),c&&o(F),c&&o(M),c&&o(j),c&&o(B)}}}function Pt(p){let t;return{c(){t=r("span"),t.textContent="Optional",T(t,"class","label label-warning")},m(l,s){a(l,t,s)},d(l){l&&o(t)}}}function At(p){let t;return{c(){t=r("span"),t.textContent="Required",T(t,"class","label label-success")},m(l,s){a(l,t,s)},d(l){l&&o(t)}}}function Bt(p){var u;let t,l=((u=p[12].options)==null?void 0:u.maxSelect)>1?"ids":"id",s,b;return{c(){t=y("User "),s=y(l),b=y(".")},m(d,f){a(d,t,f),a(d,s,f),a(d,b,f)},p(d,f){var k;f&1&&l!==(l=((k=d[12].options)==null?void 0:k.maxSelect)>1?"ids":"id")&&U(s,l)},d(d){d&&o(t),d&&o(s),d&&o(b)}}}function Ft(p){var u;let t,l=((u=p[12].options)==null?void 0:u.maxSelect)>1?"ids":"id",s,b;return{c(){t=y("Relation record "),s=y(l),b=y(".")},m(d,f){a(d,t,f),a(d,s,f),a(d,b,f)},p(d,f){var k;f&1&&l!==(l=((k=d[12].options)==null?void 0:k.maxSelect)>1?"ids":"id")&&U(s,l)},d(d){d&&o(t),d&&o(s),d&&o(b)}}}function jt(p){let t,l,s,b,u;return{c(){t=y("File object."),l=r("br"),s=y(` + Set to `),b=r("code"),b.textContent="null",u=y(" to delete already uploaded file(s).")},m(d,f){a(d,t,f),a(d,l,f),a(d,s,f),a(d,b,f),a(d,u,f)},p:G,d(d){d&&o(t),d&&o(l),d&&o(s),d&&o(b),d&&o(u)}}}function Nt(p){let t;return{c(){t=y("URL address.")},m(l,s){a(l,t,s)},p:G,d(l){l&&o(t)}}}function Et(p){let t;return{c(){t=y("Email address.")},m(l,s){a(l,t,s)},p:G,d(l){l&&o(t)}}}function It(p){let t;return{c(){t=y("JSON array or object.")},m(l,s){a(l,t,s)},p:G,d(l){l&&o(t)}}}function Ut(p){let t;return{c(){t=y("Number value.")},m(l,s){a(l,t,s)},p:G,d(l){l&&o(t)}}}function gt(p){let t;return{c(){t=y("Plain text value.")},m(l,s){a(l,t,s)},p:G,d(l){l&&o(t)}}}function ht(p,t){let l,s,b,u,d,f=t[12].name+"",k,C,v,O,D=I.getFieldValueType(t[12])+"",A,F,M,j;function B(h,L){return h[12].required?At:Pt}let c=B(t),_=c(t);function K(h,L){if(h[12].type==="text")return gt;if(h[12].type==="number")return Ut;if(h[12].type==="json")return It;if(h[12].type==="email")return Et;if(h[12].type==="url")return Nt;if(h[12].type==="file")return jt;if(h[12].type==="relation")return Ft;if(h[12].type==="user")return Bt}let H=K(t),S=H&&H(t);return{key:p,first:null,c(){l=r("tr"),s=r("td"),b=r("div"),_.c(),u=m(),d=r("span"),k=y(f),C=m(),v=r("td"),O=r("span"),A=y(D),F=m(),M=r("td"),S&&S.c(),j=m(),T(b,"class","inline-flex"),T(O,"class","label"),this.first=l},m(h,L){a(h,l,L),i(l,s),i(s,b),_.m(b,null),i(b,u),i(b,d),i(d,k),i(l,C),i(l,v),i(v,O),i(O,A),i(l,F),i(l,M),S&&S.m(M,null),i(l,j)},p(h,L){t=h,c!==(c=B(t))&&(_.d(1),_=c(t),_&&(_.c(),_.m(b,u))),L&1&&f!==(f=t[12].name+"")&&U(k,f),L&1&&D!==(D=I.getFieldValueType(t[12])+"")&&U(A,D),H===(H=K(t))&&S?S.p(t,L):(S&&S.d(1),S=H&&H(t),S&&(S.c(),S.m(M,null)))},d(h){h&&o(l),_.d(),S&&S.d()}}}function vt(p,t){let l,s=t[7].code+"",b,u,d,f;function k(){return t[6](t[7])}return{key:p,first:null,c(){l=r("button"),b=y(s),u=m(),T(l,"class","tab-item"),ce(l,"active",t[1]===t[7].code),this.first=l},m(C,v){a(C,l,v),i(l,b),i(l,u),d||(f=Ht(l,"click",k),d=!0)},p(C,v){t=C,v&4&&s!==(s=t[7].code+"")&&U(b,s),v&6&&ce(l,"active",t[1]===t[7].code)},d(C){C&&o(l),d=!1,f()}}}function wt(p,t){let l,s,b,u;return s=new Tt({props:{content:t[7].body}}),{key:p,first:null,c(){l=r("div"),Ae(s.$$.fragment),b=m(),T(l,"class","tab-item"),ce(l,"active",t[1]===t[7].code),this.first=l},m(d,f){a(d,l,f),Be(s,l,null),i(l,b),u=!0},p(d,f){t=d;const k={};f&4&&(k.content=t[7].body),s.$set(k),(!u||f&6)&&ce(l,"active",t[1]===t[7].code)},i(d){u||(pe(s.$$.fragment,d),u=!0)},o(d){fe(s.$$.fragment,d),u=!1},d(d){d&&o(l),Fe(s)}}}function Jt(p){var it,at,ot,dt;let t,l,s=p[0].name+"",b,u,d,f,k,C,v,O=p[0].name+"",D,A,F,M,j,B,c,_,K,H,S,h,L,je,ae,W,Ne,ue,oe=p[0].name+"",be,Ee,me,Ie,_e,X,ye,Z,ke,ee,he,g,ve,Ue,J,we,N=[],ge=new Map,Te,te,Ce,V,Se,Je,Oe,x,Me,Ve,$e,xe,$,Qe,Y,ze,Ke,We,Re,Ye,qe,Ge,De,Xe,He,le,Le,Q,se,E=[],Ze=new Map,et,ne,P=[],tt=new Map,z;_=new Lt({props:{js:` +import PocketBase from 'pocketbase'; + +const pb = new PocketBase('${p[4]}'); + +... + +// example update data +const data = ${JSON.stringify(Object.assign({},p[3],I.dummyCollectionSchemaData(p[0])),null,4)}; + +const record = await pb.collection('${(it=p[0])==null?void 0:it.name}').update('RECORD_ID', data); + `,dart:` +import 'package:pocketbase/pocketbase.dart'; + +final pb = PocketBase('${p[4]}'); + +... + +// example update body +final body = ${JSON.stringify(Object.assign({},p[3],I.dummyCollectionSchemaData(p[0])),null,2)}; + +final record = await pb.collection('${(at=p[0])==null?void 0:at.name}').update('RECORD_ID', body: body); + `}});let R=p[5]&&yt(),q=((ot=p[0])==null?void 0:ot.isAuth)&&kt(),de=(dt=p[0])==null?void 0:dt.schema;const lt=e=>e[12].name;for(let e=0;ee[7].code;for(let e=0;ee[7].code;for(let e=0;eapplication/json or + multipart/form-data.`,j=m(),B=r("p"),B.innerHTML=`File upload is supported only via multipart/form-data. +
+ For more info and examples you could check the detailed + Files upload and handling docs + .`,c=m(),Ae(_.$$.fragment),K=m(),H=r("h6"),H.textContent="API details",S=m(),h=r("div"),L=r("strong"),L.textContent="PATCH",je=m(),ae=r("div"),W=r("p"),Ne=y("/api/collections/"),ue=r("strong"),be=y(oe),Ee=y("/records/"),me=r("strong"),me.textContent=":id",Ie=m(),R&&R.c(),_e=m(),X=r("div"),X.textContent="Path parameters",ye=m(),Z=r("table"),Z.innerHTML=`Param + Type + Description + id + String + ID of the record to update.`,ke=m(),ee=r("div"),ee.textContent="Body Parameters",he=m(),g=r("table"),ve=r("thead"),ve.innerHTML=`Param + Type + Description`,Ue=m(),J=r("tbody"),q&&q.c(),we=m();for(let e=0;eParam + Type + Description`,Je=m(),Oe=r("tbody"),x=r("tr"),Me=r("td"),Me.textContent="expand",Ve=m(),$e=r("td"),$e.innerHTML='String',xe=m(),$=r("td"),Qe=y(`Auto expand relations when returning the updated record. Ex.: + `),Ae(Y.$$.fragment),ze=y(` + Supports up to 6-levels depth nested relations expansion. `),Ke=r("br"),We=y(` + The expanded relations will be appended to the record under the + `),Re=r("code"),Re.textContent="expand",Ye=y(" property (eg. "),qe=r("code"),qe.textContent='"expand": {"relField1": {...}, ...}',Ge=y(`). Only + the relations that the user has permissions to `),De=r("strong"),De.textContent="view",Xe=y(" will be expanded."),He=m(),le=r("div"),le.textContent="Responses",Le=m(),Q=r("div"),se=r("div");for(let e=0;e${JSON.stringify(Object.assign({},e[3],I.dummyCollectionSchemaData(e[0])),null,2)}; + +final record = await pb.collection('${(pt=e[0])==null?void 0:pt.name}').update('RECORD_ID', body: body); + `),_.$set(w),(!z||n&1)&&oe!==(oe=e[0].name+"")&&U(be,oe),e[5]?R||(R=yt(),R.c(),R.m(h,null)):R&&(R.d(1),R=null),(ft=e[0])!=null&&ft.isAuth?q||(q=kt(),q.c(),q.m(J,we)):q&&(q.d(1),q=null),n&1&&(de=(ct=e[0])==null?void 0:ct.schema,N=Pe(N,n,lt,1,e,de,ge,J,ut,ht,null,_t)),n&6&&(re=e[2],E=Pe(E,n,st,1,e,re,Ze,se,ut,vt,null,mt)),n&6&&(ie=e[2],Mt(),P=Pe(P,n,nt,1,e,ie,tt,ne,$t,wt,null,bt),Rt())},i(e){if(!z){pe(_.$$.fragment,e),pe(Y.$$.fragment,e);for(let n=0;nl(1,d=v.code);return p.$$set=v=>{"collection"in v&&l(0,u=v.collection)},p.$$.update=()=>{var v,O;p.$$.dirty&1&&l(5,s=(u==null?void 0:u.updateRule)===null),p.$$.dirty&1&&l(2,f=[{code:200,body:JSON.stringify(I.dummyCollectionRecord(u),null,2)},{code:400,body:` + { + "code": 400, + "message": "Failed to update record.", + "data": { + "${(O=(v=u==null?void 0:u.schema)==null?void 0:v[0])==null?void 0:O.name}": { + "code": "validation_required", + "message": "Missing required value." + } + } + } + `},{code:403,body:` + { + "code": 403, + "message": "You are not allowed to perform this request.", + "data": {} + } + `},{code:404,body:` + { + "code": 404, + "message": "The requested resource wasn't found.", + "data": {} + } + `}]),p.$$.dirty&1&&(u.isAuth?l(3,k={username:"test_username_update",emailVisibility:!1,password:"87654321",passwordConfirm:"87654321",oldPassword:"12345678"}):l(3,k={}))},l(4,b=I.getApiExampleUrl(Dt.baseUrl)),[u,d,f,k,b,s,C]}class zt extends Ct{constructor(t){super(),St(this,t,Vt,Jt,Ot,{collection:0})}}export{zt as default}; diff --git a/ui/dist/assets/ViewApiDocs.d6f654f1.js b/ui/dist/assets/ViewApiDocs.d6f654f1.js new file mode 100644 index 000000000..0e529b007 --- /dev/null +++ b/ui/dist/assets/ViewApiDocs.d6f654f1.js @@ -0,0 +1,66 @@ +import{S as Ze,i as et,s as tt,O as Ye,e as o,w as m,b as f,c as _e,f as _,g as r,h as l,m as ke,x as me,P as Ve,Q as lt,k as st,R as nt,n as ot,t as z,a as G,o as d,d as he,L as it,C as ze,p as at,r as J,u as rt}from"./index.97f016a1.js";import{S as dt}from"./SdkTabs.88269ae0.js";function Ge(i,s,n){const a=i.slice();return a[6]=s[n],a}function Je(i,s,n){const a=i.slice();return a[6]=s[n],a}function Ke(i){let s;return{c(){s=o("p"),s.innerHTML="Requires admin Authorization:TOKEN header",_(s,"class","txt-hint txt-sm txt-right")},m(n,a){r(n,s,a)},d(n){n&&d(s)}}}function We(i,s){let n,a=s[6].code+"",w,c,p,u;function C(){return s[5](s[6])}return{key:i,first:null,c(){n=o("button"),w=m(a),c=f(),_(n,"class","tab-item"),J(n,"active",s[2]===s[6].code),this.first=n},m(h,F){r(h,n,F),l(n,w),l(n,c),p||(u=rt(n,"click",C),p=!0)},p(h,F){s=h,F&20&&J(n,"active",s[2]===s[6].code)},d(h){h&&d(n),p=!1,u()}}}function Xe(i,s){let n,a,w,c;return a=new Ye({props:{content:s[6].body}}),{key:i,first:null,c(){n=o("div"),_e(a.$$.fragment),w=f(),_(n,"class","tab-item"),J(n,"active",s[2]===s[6].code),this.first=n},m(p,u){r(p,n,u),ke(a,n,null),l(n,w),c=!0},p(p,u){s=p,(!c||u&20)&&J(n,"active",s[2]===s[6].code)},i(p){c||(z(a.$$.fragment,p),c=!0)},o(p){G(a.$$.fragment,p),c=!1},d(p){p&&d(n),he(a)}}}function ct(i){var Ue,je;let s,n,a=i[0].name+"",w,c,p,u,C,h,F,U=i[0].name+"",K,ve,W,g,X,B,Y,$,j,we,N,E,ye,Z,Q=i[0].name+"",ee,$e,te,Ce,le,I,se,x,ne,A,oe,O,ie,Re,ae,D,re,Fe,de,ge,k,Oe,S,De,Pe,Te,ce,Ee,pe,Se,Be,Ie,fe,xe,ue,M,be,P,H,R=[],Ae=new Map,Me,L,y=[],He=new Map,T;g=new dt({props:{js:` + import PocketBase from 'pocketbase'; + + const pb = new PocketBase('${i[3]}'); + + ... + + const record1 = await pb.collection('${(Ue=i[0])==null?void 0:Ue.name}').getOne('RECORD_ID', { + expand: 'relField1,relField2.subRelField', + }); + `,dart:` + import 'package:pocketbase/pocketbase.dart'; + + final pb = PocketBase('${i[3]}'); + + ... + + final record1 = await pb.collection('${(je=i[0])==null?void 0:je.name}').getOne('RECORD_ID', + 'expand': 'relField1,relField2.subRelField', + ); + `}});let v=i[1]&&Ke();S=new Ye({props:{content:"?expand=relField1,relField2.subRelField"}});let V=i[4];const Le=e=>e[6].code;for(let e=0;ee[6].code;for(let e=0;eParam + Type + Description + id + String + ID of the record to view.`,ne=f(),A=o("div"),A.textContent="Query parameters",oe=f(),O=o("table"),ie=o("thead"),ie.innerHTML=`Param + Type + Description`,Re=f(),ae=o("tbody"),D=o("tr"),re=o("td"),re.textContent="expand",Fe=f(),de=o("td"),de.innerHTML='String',ge=f(),k=o("td"),Oe=m(`Auto expand record relations. Ex.: + `),_e(S.$$.fragment),De=m(` + Supports up to 6-levels depth nested relations expansion. `),Pe=o("br"),Te=m(` + The expanded relations will be appended to the record under the + `),ce=o("code"),ce.textContent="expand",Ee=m(" property (eg. "),pe=o("code"),pe.textContent='"expand": {"relField1": {...}, ...}',Se=m(`). + `),Be=o("br"),Ie=m(` + Only the relations to which the account has permissions to `),fe=o("strong"),fe.textContent="view",xe=m(" will be expanded."),ue=f(),M=o("div"),M.textContent="Responses",be=f(),P=o("div"),H=o("div");for(let e=0;en(2,p=h.code);return i.$$set=h=>{"collection"in h&&n(0,c=h.collection)},i.$$.update=()=>{i.$$.dirty&1&&n(1,a=(c==null?void 0:c.viewRule)===null),i.$$.dirty&3&&c!=null&&c.id&&(u.push({code:200,body:JSON.stringify(ze.dummyCollectionRecord(c),null,2)}),a&&u.push({code:403,body:` + { + "code": 403, + "message": "Only admins can access this action.", + "data": {} + } + `}),u.push({code:404,body:` + { + "code": 404, + "message": "The requested resource wasn't found.", + "data": {} + } + `}))},n(3,w=ze.getApiExampleUrl(at.baseUrl)),[c,a,p,w,u,C]}class bt extends Ze{constructor(s){super(),et(this,s,pt,ct,tt,{collection:0})}}export{bt as default}; diff --git a/ui/dist/assets/index.0a5eb9c8.css b/ui/dist/assets/index.0a5eb9c8.css new file mode 100644 index 000000000..467fb4202 --- /dev/null +++ b/ui/dist/assets/index.0a5eb9c8.css @@ -0,0 +1 @@ +@font-face{font-family:remixicon;src:url(../fonts/remixicon/remixicon.woff2?v=1) format("woff2"),url(../fonts/remixicon/remixicon.woff?v=1) format("woff"),url(../fonts/remixicon/remixicon.ttf?v=1) format("truetype"),url(../fonts/remixicon/remixicon.svg?v=1#remixicon) format("svg");font-display:swap}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:400;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-regular.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-regular.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:400;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-italic.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:600;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:600;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600italic.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:700;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:700;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700italic.woff) format("woff")}@font-face{font-family:JetBrains Mono;font-style:normal;font-weight:400;src:local(""),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-regular.woff2) format("woff2"),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-regular.woff) format("woff")}@font-face{font-family:JetBrains Mono;font-style:normal;font-weight:600;src:local(""),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-600.woff2) format("woff2"),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-600.woff) format("woff")}:root{--baseFontFamily: "Source Sans Pro", sans-serif, emoji;--monospaceFontFamily: "Ubuntu Mono", monospace, emoji;--iconFontFamily: "remixicon";--txtPrimaryColor: #16161a;--txtHintColor: #666f75;--txtDisabledColor: #adb3b8;--primaryColor: #16161a;--bodyColor: #f8f9fa;--baseColor: #ffffff;--baseAlt1Color: #ebeff2;--baseAlt2Color: #dee3e8;--baseAlt3Color: #a9b4bc;--baseAlt4Color: #7c868d;--infoColor: #3da9fc;--infoAltColor: #d8eefe;--successColor: #2cb67d;--successAltColor: #d6f5e8;--dangerColor: #ef4565;--dangerAltColor: #fcdee4;--warningColor: #ff8e3c;--warningAltColor: #ffe7d6;--overlayColor: rgba(65, 80, 105, .25);--tooltipColor: rgba(0, 0, 0, .85);--shadowColor: rgba(0, 0, 0, .06);--baseFontSize: 14.5px;--xsFontSize: 12px;--smFontSize: 13px;--lgFontSize: 15px;--xlFontSize: 16px;--baseLineHeight: 22px;--smLineHeight: 16px;--lgLineHeight: 24px;--inputHeight: 34px;--btnHeight: 40px;--xsBtnHeight: 24px;--smBtnHeight: 30px;--lgBtnHeight: 54px;--baseSpacing: 30px;--xsSpacing: 15px;--smSpacing: 20px;--lgSpacing: 50px;--xlSpacing: 60px;--wrapperWidth: 850px;--smWrapperWidth: 420px;--lgWrapperWidth: 1200px;--appSidebarWidth: 75px;--pageSidebarWidth: 220px;--baseAnimationSpeed: .15s;--activeAnimationSpeed: 70ms;--entranceAnimationSpeed: .25s;--baseRadius: 3px;--lgRadius: 12px;--btnRadius: 3px;accent-color:var(--primaryColor)}html,body,div,span,applet,object,iframe,h1,h2,.breadcrumbs .breadcrumb-item,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}i{font-family:remixicon!important;font-style:normal;font-weight:400;font-size:1.1238rem;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}i:before{vertical-align:top;margin-top:1px;display:inline-block}.ri-24-hours-fill:before{content:"\ea01"}.ri-24-hours-line:before{content:"\ea02"}.ri-4k-fill:before{content:"\ea03"}.ri-4k-line:before{content:"\ea04"}.ri-a-b:before{content:"\ea05"}.ri-account-box-fill:before{content:"\ea06"}.ri-account-box-line:before{content:"\ea07"}.ri-account-circle-fill:before{content:"\ea08"}.ri-account-circle-line:before{content:"\ea09"}.ri-account-pin-box-fill:before{content:"\ea0a"}.ri-account-pin-box-line:before{content:"\ea0b"}.ri-account-pin-circle-fill:before{content:"\ea0c"}.ri-account-pin-circle-line:before{content:"\ea0d"}.ri-add-box-fill:before{content:"\ea0e"}.ri-add-box-line:before{content:"\ea0f"}.ri-add-circle-fill:before{content:"\ea10"}.ri-add-circle-line:before{content:"\ea11"}.ri-add-fill:before{content:"\ea12"}.ri-add-line:before{content:"\ea13"}.ri-admin-fill:before{content:"\ea14"}.ri-admin-line:before{content:"\ea15"}.ri-advertisement-fill:before{content:"\ea16"}.ri-advertisement-line:before{content:"\ea17"}.ri-airplay-fill:before{content:"\ea18"}.ri-airplay-line:before{content:"\ea19"}.ri-alarm-fill:before{content:"\ea1a"}.ri-alarm-line:before{content:"\ea1b"}.ri-alarm-warning-fill:before{content:"\ea1c"}.ri-alarm-warning-line:before{content:"\ea1d"}.ri-album-fill:before{content:"\ea1e"}.ri-album-line:before{content:"\ea1f"}.ri-alert-fill:before{content:"\ea20"}.ri-alert-line:before{content:"\ea21"}.ri-aliens-fill:before{content:"\ea22"}.ri-aliens-line:before{content:"\ea23"}.ri-align-bottom:before{content:"\ea24"}.ri-align-center:before{content:"\ea25"}.ri-align-justify:before{content:"\ea26"}.ri-align-left:before{content:"\ea27"}.ri-align-right:before{content:"\ea28"}.ri-align-top:before{content:"\ea29"}.ri-align-vertically:before{content:"\ea2a"}.ri-alipay-fill:before{content:"\ea2b"}.ri-alipay-line:before{content:"\ea2c"}.ri-amazon-fill:before{content:"\ea2d"}.ri-amazon-line:before{content:"\ea2e"}.ri-anchor-fill:before{content:"\ea2f"}.ri-anchor-line:before{content:"\ea30"}.ri-ancient-gate-fill:before{content:"\ea31"}.ri-ancient-gate-line:before{content:"\ea32"}.ri-ancient-pavilion-fill:before{content:"\ea33"}.ri-ancient-pavilion-line:before{content:"\ea34"}.ri-android-fill:before{content:"\ea35"}.ri-android-line:before{content:"\ea36"}.ri-angularjs-fill:before{content:"\ea37"}.ri-angularjs-line:before{content:"\ea38"}.ri-anticlockwise-2-fill:before{content:"\ea39"}.ri-anticlockwise-2-line:before{content:"\ea3a"}.ri-anticlockwise-fill:before{content:"\ea3b"}.ri-anticlockwise-line:before{content:"\ea3c"}.ri-app-store-fill:before{content:"\ea3d"}.ri-app-store-line:before{content:"\ea3e"}.ri-apple-fill:before{content:"\ea3f"}.ri-apple-line:before{content:"\ea40"}.ri-apps-2-fill:before{content:"\ea41"}.ri-apps-2-line:before{content:"\ea42"}.ri-apps-fill:before{content:"\ea43"}.ri-apps-line:before{content:"\ea44"}.ri-archive-drawer-fill:before{content:"\ea45"}.ri-archive-drawer-line:before{content:"\ea46"}.ri-archive-fill:before{content:"\ea47"}.ri-archive-line:before{content:"\ea48"}.ri-arrow-down-circle-fill:before{content:"\ea49"}.ri-arrow-down-circle-line:before{content:"\ea4a"}.ri-arrow-down-fill:before{content:"\ea4b"}.ri-arrow-down-line:before{content:"\ea4c"}.ri-arrow-down-s-fill:before{content:"\ea4d"}.ri-arrow-down-s-line:before{content:"\ea4e"}.ri-arrow-drop-down-fill:before{content:"\ea4f"}.ri-arrow-drop-down-line:before{content:"\ea50"}.ri-arrow-drop-left-fill:before{content:"\ea51"}.ri-arrow-drop-left-line:before{content:"\ea52"}.ri-arrow-drop-right-fill:before{content:"\ea53"}.ri-arrow-drop-right-line:before{content:"\ea54"}.ri-arrow-drop-up-fill:before{content:"\ea55"}.ri-arrow-drop-up-line:before{content:"\ea56"}.ri-arrow-go-back-fill:before{content:"\ea57"}.ri-arrow-go-back-line:before{content:"\ea58"}.ri-arrow-go-forward-fill:before{content:"\ea59"}.ri-arrow-go-forward-line:before{content:"\ea5a"}.ri-arrow-left-circle-fill:before{content:"\ea5b"}.ri-arrow-left-circle-line:before{content:"\ea5c"}.ri-arrow-left-down-fill:before{content:"\ea5d"}.ri-arrow-left-down-line:before{content:"\ea5e"}.ri-arrow-left-fill:before{content:"\ea5f"}.ri-arrow-left-line:before{content:"\ea60"}.ri-arrow-left-right-fill:before{content:"\ea61"}.ri-arrow-left-right-line:before{content:"\ea62"}.ri-arrow-left-s-fill:before{content:"\ea63"}.ri-arrow-left-s-line:before{content:"\ea64"}.ri-arrow-left-up-fill:before{content:"\ea65"}.ri-arrow-left-up-line:before{content:"\ea66"}.ri-arrow-right-circle-fill:before{content:"\ea67"}.ri-arrow-right-circle-line:before{content:"\ea68"}.ri-arrow-right-down-fill:before{content:"\ea69"}.ri-arrow-right-down-line:before{content:"\ea6a"}.ri-arrow-right-fill:before{content:"\ea6b"}.ri-arrow-right-line:before{content:"\ea6c"}.ri-arrow-right-s-fill:before{content:"\ea6d"}.ri-arrow-right-s-line:before{content:"\ea6e"}.ri-arrow-right-up-fill:before{content:"\ea6f"}.ri-arrow-right-up-line:before{content:"\ea70"}.ri-arrow-up-circle-fill:before{content:"\ea71"}.ri-arrow-up-circle-line:before{content:"\ea72"}.ri-arrow-up-down-fill:before{content:"\ea73"}.ri-arrow-up-down-line:before{content:"\ea74"}.ri-arrow-up-fill:before{content:"\ea75"}.ri-arrow-up-line:before{content:"\ea76"}.ri-arrow-up-s-fill:before{content:"\ea77"}.ri-arrow-up-s-line:before{content:"\ea78"}.ri-artboard-2-fill:before{content:"\ea79"}.ri-artboard-2-line:before{content:"\ea7a"}.ri-artboard-fill:before{content:"\ea7b"}.ri-artboard-line:before{content:"\ea7c"}.ri-article-fill:before{content:"\ea7d"}.ri-article-line:before{content:"\ea7e"}.ri-aspect-ratio-fill:before{content:"\ea7f"}.ri-aspect-ratio-line:before{content:"\ea80"}.ri-asterisk:before{content:"\ea81"}.ri-at-fill:before{content:"\ea82"}.ri-at-line:before{content:"\ea83"}.ri-attachment-2:before{content:"\ea84"}.ri-attachment-fill:before{content:"\ea85"}.ri-attachment-line:before{content:"\ea86"}.ri-auction-fill:before{content:"\ea87"}.ri-auction-line:before{content:"\ea88"}.ri-award-fill:before{content:"\ea89"}.ri-award-line:before{content:"\ea8a"}.ri-baidu-fill:before{content:"\ea8b"}.ri-baidu-line:before{content:"\ea8c"}.ri-ball-pen-fill:before{content:"\ea8d"}.ri-ball-pen-line:before{content:"\ea8e"}.ri-bank-card-2-fill:before{content:"\ea8f"}.ri-bank-card-2-line:before{content:"\ea90"}.ri-bank-card-fill:before{content:"\ea91"}.ri-bank-card-line:before{content:"\ea92"}.ri-bank-fill:before{content:"\ea93"}.ri-bank-line:before{content:"\ea94"}.ri-bar-chart-2-fill:before{content:"\ea95"}.ri-bar-chart-2-line:before{content:"\ea96"}.ri-bar-chart-box-fill:before{content:"\ea97"}.ri-bar-chart-box-line:before{content:"\ea98"}.ri-bar-chart-fill:before{content:"\ea99"}.ri-bar-chart-grouped-fill:before{content:"\ea9a"}.ri-bar-chart-grouped-line:before{content:"\ea9b"}.ri-bar-chart-horizontal-fill:before{content:"\ea9c"}.ri-bar-chart-horizontal-line:before{content:"\ea9d"}.ri-bar-chart-line:before{content:"\ea9e"}.ri-barcode-box-fill:before{content:"\ea9f"}.ri-barcode-box-line:before{content:"\eaa0"}.ri-barcode-fill:before{content:"\eaa1"}.ri-barcode-line:before{content:"\eaa2"}.ri-barricade-fill:before{content:"\eaa3"}.ri-barricade-line:before{content:"\eaa4"}.ri-base-station-fill:before{content:"\eaa5"}.ri-base-station-line:before{content:"\eaa6"}.ri-basketball-fill:before{content:"\eaa7"}.ri-basketball-line:before{content:"\eaa8"}.ri-battery-2-charge-fill:before{content:"\eaa9"}.ri-battery-2-charge-line:before{content:"\eaaa"}.ri-battery-2-fill:before{content:"\eaab"}.ri-battery-2-line:before{content:"\eaac"}.ri-battery-charge-fill:before{content:"\eaad"}.ri-battery-charge-line:before{content:"\eaae"}.ri-battery-fill:before{content:"\eaaf"}.ri-battery-line:before{content:"\eab0"}.ri-battery-low-fill:before{content:"\eab1"}.ri-battery-low-line:before{content:"\eab2"}.ri-battery-saver-fill:before{content:"\eab3"}.ri-battery-saver-line:before{content:"\eab4"}.ri-battery-share-fill:before{content:"\eab5"}.ri-battery-share-line:before{content:"\eab6"}.ri-bear-smile-fill:before{content:"\eab7"}.ri-bear-smile-line:before{content:"\eab8"}.ri-behance-fill:before{content:"\eab9"}.ri-behance-line:before{content:"\eaba"}.ri-bell-fill:before{content:"\eabb"}.ri-bell-line:before{content:"\eabc"}.ri-bike-fill:before{content:"\eabd"}.ri-bike-line:before{content:"\eabe"}.ri-bilibili-fill:before{content:"\eabf"}.ri-bilibili-line:before{content:"\eac0"}.ri-bill-fill:before{content:"\eac1"}.ri-bill-line:before{content:"\eac2"}.ri-billiards-fill:before{content:"\eac3"}.ri-billiards-line:before{content:"\eac4"}.ri-bit-coin-fill:before{content:"\eac5"}.ri-bit-coin-line:before{content:"\eac6"}.ri-blaze-fill:before{content:"\eac7"}.ri-blaze-line:before{content:"\eac8"}.ri-bluetooth-connect-fill:before{content:"\eac9"}.ri-bluetooth-connect-line:before{content:"\eaca"}.ri-bluetooth-fill:before{content:"\eacb"}.ri-bluetooth-line:before{content:"\eacc"}.ri-blur-off-fill:before{content:"\eacd"}.ri-blur-off-line:before{content:"\eace"}.ri-body-scan-fill:before{content:"\eacf"}.ri-body-scan-line:before{content:"\ead0"}.ri-bold:before{content:"\ead1"}.ri-book-2-fill:before{content:"\ead2"}.ri-book-2-line:before{content:"\ead3"}.ri-book-3-fill:before{content:"\ead4"}.ri-book-3-line:before{content:"\ead5"}.ri-book-fill:before{content:"\ead6"}.ri-book-line:before{content:"\ead7"}.ri-book-mark-fill:before{content:"\ead8"}.ri-book-mark-line:before{content:"\ead9"}.ri-book-open-fill:before{content:"\eada"}.ri-book-open-line:before{content:"\eadb"}.ri-book-read-fill:before{content:"\eadc"}.ri-book-read-line:before{content:"\eadd"}.ri-booklet-fill:before{content:"\eade"}.ri-booklet-line:before{content:"\eadf"}.ri-bookmark-2-fill:before{content:"\eae0"}.ri-bookmark-2-line:before{content:"\eae1"}.ri-bookmark-3-fill:before{content:"\eae2"}.ri-bookmark-3-line:before{content:"\eae3"}.ri-bookmark-fill:before{content:"\eae4"}.ri-bookmark-line:before{content:"\eae5"}.ri-boxing-fill:before{content:"\eae6"}.ri-boxing-line:before{content:"\eae7"}.ri-braces-fill:before{content:"\eae8"}.ri-braces-line:before{content:"\eae9"}.ri-brackets-fill:before{content:"\eaea"}.ri-brackets-line:before{content:"\eaeb"}.ri-briefcase-2-fill:before{content:"\eaec"}.ri-briefcase-2-line:before{content:"\eaed"}.ri-briefcase-3-fill:before{content:"\eaee"}.ri-briefcase-3-line:before{content:"\eaef"}.ri-briefcase-4-fill:before{content:"\eaf0"}.ri-briefcase-4-line:before{content:"\eaf1"}.ri-briefcase-5-fill:before{content:"\eaf2"}.ri-briefcase-5-line:before{content:"\eaf3"}.ri-briefcase-fill:before{content:"\eaf4"}.ri-briefcase-line:before{content:"\eaf5"}.ri-bring-forward:before{content:"\eaf6"}.ri-bring-to-front:before{content:"\eaf7"}.ri-broadcast-fill:before{content:"\eaf8"}.ri-broadcast-line:before{content:"\eaf9"}.ri-brush-2-fill:before{content:"\eafa"}.ri-brush-2-line:before{content:"\eafb"}.ri-brush-3-fill:before{content:"\eafc"}.ri-brush-3-line:before{content:"\eafd"}.ri-brush-4-fill:before{content:"\eafe"}.ri-brush-4-line:before{content:"\eaff"}.ri-brush-fill:before{content:"\eb00"}.ri-brush-line:before{content:"\eb01"}.ri-bubble-chart-fill:before{content:"\eb02"}.ri-bubble-chart-line:before{content:"\eb03"}.ri-bug-2-fill:before{content:"\eb04"}.ri-bug-2-line:before{content:"\eb05"}.ri-bug-fill:before{content:"\eb06"}.ri-bug-line:before{content:"\eb07"}.ri-building-2-fill:before{content:"\eb08"}.ri-building-2-line:before{content:"\eb09"}.ri-building-3-fill:before{content:"\eb0a"}.ri-building-3-line:before{content:"\eb0b"}.ri-building-4-fill:before{content:"\eb0c"}.ri-building-4-line:before{content:"\eb0d"}.ri-building-fill:before{content:"\eb0e"}.ri-building-line:before{content:"\eb0f"}.ri-bus-2-fill:before{content:"\eb10"}.ri-bus-2-line:before{content:"\eb11"}.ri-bus-fill:before{content:"\eb12"}.ri-bus-line:before{content:"\eb13"}.ri-bus-wifi-fill:before{content:"\eb14"}.ri-bus-wifi-line:before{content:"\eb15"}.ri-cactus-fill:before{content:"\eb16"}.ri-cactus-line:before{content:"\eb17"}.ri-cake-2-fill:before{content:"\eb18"}.ri-cake-2-line:before{content:"\eb19"}.ri-cake-3-fill:before{content:"\eb1a"}.ri-cake-3-line:before{content:"\eb1b"}.ri-cake-fill:before{content:"\eb1c"}.ri-cake-line:before{content:"\eb1d"}.ri-calculator-fill:before{content:"\eb1e"}.ri-calculator-line:before{content:"\eb1f"}.ri-calendar-2-fill:before{content:"\eb20"}.ri-calendar-2-line:before{content:"\eb21"}.ri-calendar-check-fill:before{content:"\eb22"}.ri-calendar-check-line:before{content:"\eb23"}.ri-calendar-event-fill:before{content:"\eb24"}.ri-calendar-event-line:before{content:"\eb25"}.ri-calendar-fill:before{content:"\eb26"}.ri-calendar-line:before{content:"\eb27"}.ri-calendar-todo-fill:before{content:"\eb28"}.ri-calendar-todo-line:before{content:"\eb29"}.ri-camera-2-fill:before{content:"\eb2a"}.ri-camera-2-line:before{content:"\eb2b"}.ri-camera-3-fill:before{content:"\eb2c"}.ri-camera-3-line:before{content:"\eb2d"}.ri-camera-fill:before{content:"\eb2e"}.ri-camera-lens-fill:before{content:"\eb2f"}.ri-camera-lens-line:before{content:"\eb30"}.ri-camera-line:before{content:"\eb31"}.ri-camera-off-fill:before{content:"\eb32"}.ri-camera-off-line:before{content:"\eb33"}.ri-camera-switch-fill:before{content:"\eb34"}.ri-camera-switch-line:before{content:"\eb35"}.ri-capsule-fill:before{content:"\eb36"}.ri-capsule-line:before{content:"\eb37"}.ri-car-fill:before{content:"\eb38"}.ri-car-line:before{content:"\eb39"}.ri-car-washing-fill:before{content:"\eb3a"}.ri-car-washing-line:before{content:"\eb3b"}.ri-caravan-fill:before{content:"\eb3c"}.ri-caravan-line:before{content:"\eb3d"}.ri-cast-fill:before{content:"\eb3e"}.ri-cast-line:before{content:"\eb3f"}.ri-cellphone-fill:before{content:"\eb40"}.ri-cellphone-line:before{content:"\eb41"}.ri-celsius-fill:before{content:"\eb42"}.ri-celsius-line:before{content:"\eb43"}.ri-centos-fill:before{content:"\eb44"}.ri-centos-line:before{content:"\eb45"}.ri-character-recognition-fill:before{content:"\eb46"}.ri-character-recognition-line:before{content:"\eb47"}.ri-charging-pile-2-fill:before{content:"\eb48"}.ri-charging-pile-2-line:before{content:"\eb49"}.ri-charging-pile-fill:before{content:"\eb4a"}.ri-charging-pile-line:before{content:"\eb4b"}.ri-chat-1-fill:before{content:"\eb4c"}.ri-chat-1-line:before{content:"\eb4d"}.ri-chat-2-fill:before{content:"\eb4e"}.ri-chat-2-line:before{content:"\eb4f"}.ri-chat-3-fill:before{content:"\eb50"}.ri-chat-3-line:before{content:"\eb51"}.ri-chat-4-fill:before{content:"\eb52"}.ri-chat-4-line:before{content:"\eb53"}.ri-chat-check-fill:before{content:"\eb54"}.ri-chat-check-line:before{content:"\eb55"}.ri-chat-delete-fill:before{content:"\eb56"}.ri-chat-delete-line:before{content:"\eb57"}.ri-chat-download-fill:before{content:"\eb58"}.ri-chat-download-line:before{content:"\eb59"}.ri-chat-follow-up-fill:before{content:"\eb5a"}.ri-chat-follow-up-line:before{content:"\eb5b"}.ri-chat-forward-fill:before{content:"\eb5c"}.ri-chat-forward-line:before{content:"\eb5d"}.ri-chat-heart-fill:before{content:"\eb5e"}.ri-chat-heart-line:before{content:"\eb5f"}.ri-chat-history-fill:before{content:"\eb60"}.ri-chat-history-line:before{content:"\eb61"}.ri-chat-new-fill:before{content:"\eb62"}.ri-chat-new-line:before{content:"\eb63"}.ri-chat-off-fill:before{content:"\eb64"}.ri-chat-off-line:before{content:"\eb65"}.ri-chat-poll-fill:before{content:"\eb66"}.ri-chat-poll-line:before{content:"\eb67"}.ri-chat-private-fill:before{content:"\eb68"}.ri-chat-private-line:before{content:"\eb69"}.ri-chat-quote-fill:before{content:"\eb6a"}.ri-chat-quote-line:before{content:"\eb6b"}.ri-chat-settings-fill:before{content:"\eb6c"}.ri-chat-settings-line:before{content:"\eb6d"}.ri-chat-smile-2-fill:before{content:"\eb6e"}.ri-chat-smile-2-line:before{content:"\eb6f"}.ri-chat-smile-3-fill:before{content:"\eb70"}.ri-chat-smile-3-line:before{content:"\eb71"}.ri-chat-smile-fill:before{content:"\eb72"}.ri-chat-smile-line:before{content:"\eb73"}.ri-chat-upload-fill:before{content:"\eb74"}.ri-chat-upload-line:before{content:"\eb75"}.ri-chat-voice-fill:before{content:"\eb76"}.ri-chat-voice-line:before{content:"\eb77"}.ri-check-double-fill:before{content:"\eb78"}.ri-check-double-line:before{content:"\eb79"}.ri-check-fill:before{content:"\eb7a"}.ri-check-line:before{content:"\eb7b"}.ri-checkbox-blank-circle-fill:before{content:"\eb7c"}.ri-checkbox-blank-circle-line:before{content:"\eb7d"}.ri-checkbox-blank-fill:before{content:"\eb7e"}.ri-checkbox-blank-line:before{content:"\eb7f"}.ri-checkbox-circle-fill:before{content:"\eb80"}.ri-checkbox-circle-line:before{content:"\eb81"}.ri-checkbox-fill:before{content:"\eb82"}.ri-checkbox-indeterminate-fill:before{content:"\eb83"}.ri-checkbox-indeterminate-line:before{content:"\eb84"}.ri-checkbox-line:before{content:"\eb85"}.ri-checkbox-multiple-blank-fill:before{content:"\eb86"}.ri-checkbox-multiple-blank-line:before{content:"\eb87"}.ri-checkbox-multiple-fill:before{content:"\eb88"}.ri-checkbox-multiple-line:before{content:"\eb89"}.ri-china-railway-fill:before{content:"\eb8a"}.ri-china-railway-line:before{content:"\eb8b"}.ri-chrome-fill:before{content:"\eb8c"}.ri-chrome-line:before{content:"\eb8d"}.ri-clapperboard-fill:before{content:"\eb8e"}.ri-clapperboard-line:before{content:"\eb8f"}.ri-clipboard-fill:before{content:"\eb90"}.ri-clipboard-line:before{content:"\eb91"}.ri-clockwise-2-fill:before{content:"\eb92"}.ri-clockwise-2-line:before{content:"\eb93"}.ri-clockwise-fill:before{content:"\eb94"}.ri-clockwise-line:before{content:"\eb95"}.ri-close-circle-fill:before{content:"\eb96"}.ri-close-circle-line:before{content:"\eb97"}.ri-close-fill:before{content:"\eb98"}.ri-close-line:before{content:"\eb99"}.ri-closed-captioning-fill:before{content:"\eb9a"}.ri-closed-captioning-line:before{content:"\eb9b"}.ri-cloud-fill:before{content:"\eb9c"}.ri-cloud-line:before{content:"\eb9d"}.ri-cloud-off-fill:before{content:"\eb9e"}.ri-cloud-off-line:before{content:"\eb9f"}.ri-cloud-windy-fill:before{content:"\eba0"}.ri-cloud-windy-line:before{content:"\eba1"}.ri-cloudy-2-fill:before{content:"\eba2"}.ri-cloudy-2-line:before{content:"\eba3"}.ri-cloudy-fill:before{content:"\eba4"}.ri-cloudy-line:before{content:"\eba5"}.ri-code-box-fill:before{content:"\eba6"}.ri-code-box-line:before{content:"\eba7"}.ri-code-fill:before{content:"\eba8"}.ri-code-line:before{content:"\eba9"}.ri-code-s-fill:before{content:"\ebaa"}.ri-code-s-line:before{content:"\ebab"}.ri-code-s-slash-fill:before{content:"\ebac"}.ri-code-s-slash-line:before{content:"\ebad"}.ri-code-view:before{content:"\ebae"}.ri-codepen-fill:before{content:"\ebaf"}.ri-codepen-line:before{content:"\ebb0"}.ri-coin-fill:before{content:"\ebb1"}.ri-coin-line:before{content:"\ebb2"}.ri-coins-fill:before{content:"\ebb3"}.ri-coins-line:before{content:"\ebb4"}.ri-collage-fill:before{content:"\ebb5"}.ri-collage-line:before{content:"\ebb6"}.ri-command-fill:before{content:"\ebb7"}.ri-command-line:before{content:"\ebb8"}.ri-community-fill:before{content:"\ebb9"}.ri-community-line:before{content:"\ebba"}.ri-compass-2-fill:before{content:"\ebbb"}.ri-compass-2-line:before{content:"\ebbc"}.ri-compass-3-fill:before{content:"\ebbd"}.ri-compass-3-line:before{content:"\ebbe"}.ri-compass-4-fill:before{content:"\ebbf"}.ri-compass-4-line:before{content:"\ebc0"}.ri-compass-discover-fill:before{content:"\ebc1"}.ri-compass-discover-line:before{content:"\ebc2"}.ri-compass-fill:before{content:"\ebc3"}.ri-compass-line:before{content:"\ebc4"}.ri-compasses-2-fill:before{content:"\ebc5"}.ri-compasses-2-line:before{content:"\ebc6"}.ri-compasses-fill:before{content:"\ebc7"}.ri-compasses-line:before{content:"\ebc8"}.ri-computer-fill:before{content:"\ebc9"}.ri-computer-line:before{content:"\ebca"}.ri-contacts-book-2-fill:before{content:"\ebcb"}.ri-contacts-book-2-line:before{content:"\ebcc"}.ri-contacts-book-fill:before{content:"\ebcd"}.ri-contacts-book-line:before{content:"\ebce"}.ri-contacts-book-upload-fill:before{content:"\ebcf"}.ri-contacts-book-upload-line:before{content:"\ebd0"}.ri-contacts-fill:before{content:"\ebd1"}.ri-contacts-line:before{content:"\ebd2"}.ri-contrast-2-fill:before{content:"\ebd3"}.ri-contrast-2-line:before{content:"\ebd4"}.ri-contrast-drop-2-fill:before{content:"\ebd5"}.ri-contrast-drop-2-line:before{content:"\ebd6"}.ri-contrast-drop-fill:before{content:"\ebd7"}.ri-contrast-drop-line:before{content:"\ebd8"}.ri-contrast-fill:before{content:"\ebd9"}.ri-contrast-line:before{content:"\ebda"}.ri-copper-coin-fill:before{content:"\ebdb"}.ri-copper-coin-line:before{content:"\ebdc"}.ri-copper-diamond-fill:before{content:"\ebdd"}.ri-copper-diamond-line:before{content:"\ebde"}.ri-copyleft-fill:before{content:"\ebdf"}.ri-copyleft-line:before{content:"\ebe0"}.ri-copyright-fill:before{content:"\ebe1"}.ri-copyright-line:before{content:"\ebe2"}.ri-coreos-fill:before{content:"\ebe3"}.ri-coreos-line:before{content:"\ebe4"}.ri-coupon-2-fill:before{content:"\ebe5"}.ri-coupon-2-line:before{content:"\ebe6"}.ri-coupon-3-fill:before{content:"\ebe7"}.ri-coupon-3-line:before{content:"\ebe8"}.ri-coupon-4-fill:before{content:"\ebe9"}.ri-coupon-4-line:before{content:"\ebea"}.ri-coupon-5-fill:before{content:"\ebeb"}.ri-coupon-5-line:before{content:"\ebec"}.ri-coupon-fill:before{content:"\ebed"}.ri-coupon-line:before{content:"\ebee"}.ri-cpu-fill:before{content:"\ebef"}.ri-cpu-line:before{content:"\ebf0"}.ri-creative-commons-by-fill:before{content:"\ebf1"}.ri-creative-commons-by-line:before{content:"\ebf2"}.ri-creative-commons-fill:before{content:"\ebf3"}.ri-creative-commons-line:before{content:"\ebf4"}.ri-creative-commons-nc-fill:before{content:"\ebf5"}.ri-creative-commons-nc-line:before{content:"\ebf6"}.ri-creative-commons-nd-fill:before{content:"\ebf7"}.ri-creative-commons-nd-line:before{content:"\ebf8"}.ri-creative-commons-sa-fill:before{content:"\ebf9"}.ri-creative-commons-sa-line:before{content:"\ebfa"}.ri-creative-commons-zero-fill:before{content:"\ebfb"}.ri-creative-commons-zero-line:before{content:"\ebfc"}.ri-criminal-fill:before{content:"\ebfd"}.ri-criminal-line:before{content:"\ebfe"}.ri-crop-2-fill:before{content:"\ebff"}.ri-crop-2-line:before{content:"\ec00"}.ri-crop-fill:before{content:"\ec01"}.ri-crop-line:before{content:"\ec02"}.ri-css3-fill:before{content:"\ec03"}.ri-css3-line:before{content:"\ec04"}.ri-cup-fill:before{content:"\ec05"}.ri-cup-line:before{content:"\ec06"}.ri-currency-fill:before{content:"\ec07"}.ri-currency-line:before{content:"\ec08"}.ri-cursor-fill:before{content:"\ec09"}.ri-cursor-line:before{content:"\ec0a"}.ri-customer-service-2-fill:before{content:"\ec0b"}.ri-customer-service-2-line:before{content:"\ec0c"}.ri-customer-service-fill:before{content:"\ec0d"}.ri-customer-service-line:before{content:"\ec0e"}.ri-dashboard-2-fill:before{content:"\ec0f"}.ri-dashboard-2-line:before{content:"\ec10"}.ri-dashboard-3-fill:before{content:"\ec11"}.ri-dashboard-3-line:before{content:"\ec12"}.ri-dashboard-fill:before{content:"\ec13"}.ri-dashboard-line:before{content:"\ec14"}.ri-database-2-fill:before{content:"\ec15"}.ri-database-2-line:before{content:"\ec16"}.ri-database-fill:before{content:"\ec17"}.ri-database-line:before{content:"\ec18"}.ri-delete-back-2-fill:before{content:"\ec19"}.ri-delete-back-2-line:before{content:"\ec1a"}.ri-delete-back-fill:before{content:"\ec1b"}.ri-delete-back-line:before{content:"\ec1c"}.ri-delete-bin-2-fill:before{content:"\ec1d"}.ri-delete-bin-2-line:before{content:"\ec1e"}.ri-delete-bin-3-fill:before{content:"\ec1f"}.ri-delete-bin-3-line:before{content:"\ec20"}.ri-delete-bin-4-fill:before{content:"\ec21"}.ri-delete-bin-4-line:before{content:"\ec22"}.ri-delete-bin-5-fill:before{content:"\ec23"}.ri-delete-bin-5-line:before{content:"\ec24"}.ri-delete-bin-6-fill:before{content:"\ec25"}.ri-delete-bin-6-line:before{content:"\ec26"}.ri-delete-bin-7-fill:before{content:"\ec27"}.ri-delete-bin-7-line:before{content:"\ec28"}.ri-delete-bin-fill:before{content:"\ec29"}.ri-delete-bin-line:before{content:"\ec2a"}.ri-delete-column:before{content:"\ec2b"}.ri-delete-row:before{content:"\ec2c"}.ri-device-fill:before{content:"\ec2d"}.ri-device-line:before{content:"\ec2e"}.ri-device-recover-fill:before{content:"\ec2f"}.ri-device-recover-line:before{content:"\ec30"}.ri-dingding-fill:before{content:"\ec31"}.ri-dingding-line:before{content:"\ec32"}.ri-direction-fill:before{content:"\ec33"}.ri-direction-line:before{content:"\ec34"}.ri-disc-fill:before{content:"\ec35"}.ri-disc-line:before{content:"\ec36"}.ri-discord-fill:before{content:"\ec37"}.ri-discord-line:before{content:"\ec38"}.ri-discuss-fill:before{content:"\ec39"}.ri-discuss-line:before{content:"\ec3a"}.ri-dislike-fill:before{content:"\ec3b"}.ri-dislike-line:before{content:"\ec3c"}.ri-disqus-fill:before{content:"\ec3d"}.ri-disqus-line:before{content:"\ec3e"}.ri-divide-fill:before{content:"\ec3f"}.ri-divide-line:before{content:"\ec40"}.ri-donut-chart-fill:before{content:"\ec41"}.ri-donut-chart-line:before{content:"\ec42"}.ri-door-closed-fill:before{content:"\ec43"}.ri-door-closed-line:before{content:"\ec44"}.ri-door-fill:before{content:"\ec45"}.ri-door-line:before{content:"\ec46"}.ri-door-lock-box-fill:before{content:"\ec47"}.ri-door-lock-box-line:before{content:"\ec48"}.ri-door-lock-fill:before{content:"\ec49"}.ri-door-lock-line:before{content:"\ec4a"}.ri-door-open-fill:before{content:"\ec4b"}.ri-door-open-line:before{content:"\ec4c"}.ri-dossier-fill:before{content:"\ec4d"}.ri-dossier-line:before{content:"\ec4e"}.ri-douban-fill:before{content:"\ec4f"}.ri-douban-line:before{content:"\ec50"}.ri-double-quotes-l:before{content:"\ec51"}.ri-double-quotes-r:before{content:"\ec52"}.ri-download-2-fill:before{content:"\ec53"}.ri-download-2-line:before{content:"\ec54"}.ri-download-cloud-2-fill:before{content:"\ec55"}.ri-download-cloud-2-line:before{content:"\ec56"}.ri-download-cloud-fill:before{content:"\ec57"}.ri-download-cloud-line:before{content:"\ec58"}.ri-download-fill:before{content:"\ec59"}.ri-download-line:before{content:"\ec5a"}.ri-draft-fill:before{content:"\ec5b"}.ri-draft-line:before{content:"\ec5c"}.ri-drag-drop-fill:before{content:"\ec5d"}.ri-drag-drop-line:before{content:"\ec5e"}.ri-drag-move-2-fill:before{content:"\ec5f"}.ri-drag-move-2-line:before{content:"\ec60"}.ri-drag-move-fill:before{content:"\ec61"}.ri-drag-move-line:before{content:"\ec62"}.ri-dribbble-fill:before{content:"\ec63"}.ri-dribbble-line:before{content:"\ec64"}.ri-drive-fill:before{content:"\ec65"}.ri-drive-line:before{content:"\ec66"}.ri-drizzle-fill:before{content:"\ec67"}.ri-drizzle-line:before{content:"\ec68"}.ri-drop-fill:before{content:"\ec69"}.ri-drop-line:before{content:"\ec6a"}.ri-dropbox-fill:before{content:"\ec6b"}.ri-dropbox-line:before{content:"\ec6c"}.ri-dual-sim-1-fill:before{content:"\ec6d"}.ri-dual-sim-1-line:before{content:"\ec6e"}.ri-dual-sim-2-fill:before{content:"\ec6f"}.ri-dual-sim-2-line:before{content:"\ec70"}.ri-dv-fill:before{content:"\ec71"}.ri-dv-line:before{content:"\ec72"}.ri-dvd-fill:before{content:"\ec73"}.ri-dvd-line:before{content:"\ec74"}.ri-e-bike-2-fill:before{content:"\ec75"}.ri-e-bike-2-line:before{content:"\ec76"}.ri-e-bike-fill:before{content:"\ec77"}.ri-e-bike-line:before{content:"\ec78"}.ri-earth-fill:before{content:"\ec79"}.ri-earth-line:before{content:"\ec7a"}.ri-earthquake-fill:before{content:"\ec7b"}.ri-earthquake-line:before{content:"\ec7c"}.ri-edge-fill:before{content:"\ec7d"}.ri-edge-line:before{content:"\ec7e"}.ri-edit-2-fill:before{content:"\ec7f"}.ri-edit-2-line:before{content:"\ec80"}.ri-edit-box-fill:before{content:"\ec81"}.ri-edit-box-line:before{content:"\ec82"}.ri-edit-circle-fill:before{content:"\ec83"}.ri-edit-circle-line:before{content:"\ec84"}.ri-edit-fill:before{content:"\ec85"}.ri-edit-line:before{content:"\ec86"}.ri-eject-fill:before{content:"\ec87"}.ri-eject-line:before{content:"\ec88"}.ri-emotion-2-fill:before{content:"\ec89"}.ri-emotion-2-line:before{content:"\ec8a"}.ri-emotion-fill:before{content:"\ec8b"}.ri-emotion-happy-fill:before{content:"\ec8c"}.ri-emotion-happy-line:before{content:"\ec8d"}.ri-emotion-laugh-fill:before{content:"\ec8e"}.ri-emotion-laugh-line:before{content:"\ec8f"}.ri-emotion-line:before{content:"\ec90"}.ri-emotion-normal-fill:before{content:"\ec91"}.ri-emotion-normal-line:before{content:"\ec92"}.ri-emotion-sad-fill:before{content:"\ec93"}.ri-emotion-sad-line:before{content:"\ec94"}.ri-emotion-unhappy-fill:before{content:"\ec95"}.ri-emotion-unhappy-line:before{content:"\ec96"}.ri-empathize-fill:before{content:"\ec97"}.ri-empathize-line:before{content:"\ec98"}.ri-emphasis-cn:before{content:"\ec99"}.ri-emphasis:before{content:"\ec9a"}.ri-english-input:before{content:"\ec9b"}.ri-equalizer-fill:before{content:"\ec9c"}.ri-equalizer-line:before{content:"\ec9d"}.ri-eraser-fill:before{content:"\ec9e"}.ri-eraser-line:before{content:"\ec9f"}.ri-error-warning-fill:before{content:"\eca0"}.ri-error-warning-line:before{content:"\eca1"}.ri-evernote-fill:before{content:"\eca2"}.ri-evernote-line:before{content:"\eca3"}.ri-exchange-box-fill:before{content:"\eca4"}.ri-exchange-box-line:before{content:"\eca5"}.ri-exchange-cny-fill:before{content:"\eca6"}.ri-exchange-cny-line:before{content:"\eca7"}.ri-exchange-dollar-fill:before{content:"\eca8"}.ri-exchange-dollar-line:before{content:"\eca9"}.ri-exchange-fill:before{content:"\ecaa"}.ri-exchange-funds-fill:before{content:"\ecab"}.ri-exchange-funds-line:before{content:"\ecac"}.ri-exchange-line:before{content:"\ecad"}.ri-external-link-fill:before{content:"\ecae"}.ri-external-link-line:before{content:"\ecaf"}.ri-eye-2-fill:before{content:"\ecb0"}.ri-eye-2-line:before{content:"\ecb1"}.ri-eye-close-fill:before{content:"\ecb2"}.ri-eye-close-line:before{content:"\ecb3"}.ri-eye-fill:before{content:"\ecb4"}.ri-eye-line:before{content:"\ecb5"}.ri-eye-off-fill:before{content:"\ecb6"}.ri-eye-off-line:before{content:"\ecb7"}.ri-facebook-box-fill:before{content:"\ecb8"}.ri-facebook-box-line:before{content:"\ecb9"}.ri-facebook-circle-fill:before{content:"\ecba"}.ri-facebook-circle-line:before{content:"\ecbb"}.ri-facebook-fill:before{content:"\ecbc"}.ri-facebook-line:before{content:"\ecbd"}.ri-fahrenheit-fill:before{content:"\ecbe"}.ri-fahrenheit-line:before{content:"\ecbf"}.ri-feedback-fill:before{content:"\ecc0"}.ri-feedback-line:before{content:"\ecc1"}.ri-file-2-fill:before{content:"\ecc2"}.ri-file-2-line:before{content:"\ecc3"}.ri-file-3-fill:before{content:"\ecc4"}.ri-file-3-line:before{content:"\ecc5"}.ri-file-4-fill:before{content:"\ecc6"}.ri-file-4-line:before{content:"\ecc7"}.ri-file-add-fill:before{content:"\ecc8"}.ri-file-add-line:before{content:"\ecc9"}.ri-file-chart-2-fill:before{content:"\ecca"}.ri-file-chart-2-line:before{content:"\eccb"}.ri-file-chart-fill:before{content:"\eccc"}.ri-file-chart-line:before{content:"\eccd"}.ri-file-cloud-fill:before{content:"\ecce"}.ri-file-cloud-line:before{content:"\eccf"}.ri-file-code-fill:before{content:"\ecd0"}.ri-file-code-line:before{content:"\ecd1"}.ri-file-copy-2-fill:before{content:"\ecd2"}.ri-file-copy-2-line:before{content:"\ecd3"}.ri-file-copy-fill:before{content:"\ecd4"}.ri-file-copy-line:before{content:"\ecd5"}.ri-file-damage-fill:before{content:"\ecd6"}.ri-file-damage-line:before{content:"\ecd7"}.ri-file-download-fill:before{content:"\ecd8"}.ri-file-download-line:before{content:"\ecd9"}.ri-file-edit-fill:before{content:"\ecda"}.ri-file-edit-line:before{content:"\ecdb"}.ri-file-excel-2-fill:before{content:"\ecdc"}.ri-file-excel-2-line:before{content:"\ecdd"}.ri-file-excel-fill:before{content:"\ecde"}.ri-file-excel-line:before{content:"\ecdf"}.ri-file-fill:before{content:"\ece0"}.ri-file-forbid-fill:before{content:"\ece1"}.ri-file-forbid-line:before{content:"\ece2"}.ri-file-gif-fill:before{content:"\ece3"}.ri-file-gif-line:before{content:"\ece4"}.ri-file-history-fill:before{content:"\ece5"}.ri-file-history-line:before{content:"\ece6"}.ri-file-hwp-fill:before{content:"\ece7"}.ri-file-hwp-line:before{content:"\ece8"}.ri-file-info-fill:before{content:"\ece9"}.ri-file-info-line:before{content:"\ecea"}.ri-file-line:before{content:"\eceb"}.ri-file-list-2-fill:before{content:"\ecec"}.ri-file-list-2-line:before{content:"\eced"}.ri-file-list-3-fill:before{content:"\ecee"}.ri-file-list-3-line:before{content:"\ecef"}.ri-file-list-fill:before{content:"\ecf0"}.ri-file-list-line:before{content:"\ecf1"}.ri-file-lock-fill:before{content:"\ecf2"}.ri-file-lock-line:before{content:"\ecf3"}.ri-file-mark-fill:before{content:"\ecf4"}.ri-file-mark-line:before{content:"\ecf5"}.ri-file-music-fill:before{content:"\ecf6"}.ri-file-music-line:before{content:"\ecf7"}.ri-file-paper-2-fill:before{content:"\ecf8"}.ri-file-paper-2-line:before{content:"\ecf9"}.ri-file-paper-fill:before{content:"\ecfa"}.ri-file-paper-line:before{content:"\ecfb"}.ri-file-pdf-fill:before{content:"\ecfc"}.ri-file-pdf-line:before{content:"\ecfd"}.ri-file-ppt-2-fill:before{content:"\ecfe"}.ri-file-ppt-2-line:before{content:"\ecff"}.ri-file-ppt-fill:before{content:"\ed00"}.ri-file-ppt-line:before{content:"\ed01"}.ri-file-reduce-fill:before{content:"\ed02"}.ri-file-reduce-line:before{content:"\ed03"}.ri-file-search-fill:before{content:"\ed04"}.ri-file-search-line:before{content:"\ed05"}.ri-file-settings-fill:before{content:"\ed06"}.ri-file-settings-line:before{content:"\ed07"}.ri-file-shield-2-fill:before{content:"\ed08"}.ri-file-shield-2-line:before{content:"\ed09"}.ri-file-shield-fill:before{content:"\ed0a"}.ri-file-shield-line:before{content:"\ed0b"}.ri-file-shred-fill:before{content:"\ed0c"}.ri-file-shred-line:before{content:"\ed0d"}.ri-file-text-fill:before{content:"\ed0e"}.ri-file-text-line:before{content:"\ed0f"}.ri-file-transfer-fill:before{content:"\ed10"}.ri-file-transfer-line:before{content:"\ed11"}.ri-file-unknow-fill:before{content:"\ed12"}.ri-file-unknow-line:before{content:"\ed13"}.ri-file-upload-fill:before{content:"\ed14"}.ri-file-upload-line:before{content:"\ed15"}.ri-file-user-fill:before{content:"\ed16"}.ri-file-user-line:before{content:"\ed17"}.ri-file-warning-fill:before{content:"\ed18"}.ri-file-warning-line:before{content:"\ed19"}.ri-file-word-2-fill:before{content:"\ed1a"}.ri-file-word-2-line:before{content:"\ed1b"}.ri-file-word-fill:before{content:"\ed1c"}.ri-file-word-line:before{content:"\ed1d"}.ri-file-zip-fill:before{content:"\ed1e"}.ri-file-zip-line:before{content:"\ed1f"}.ri-film-fill:before{content:"\ed20"}.ri-film-line:before{content:"\ed21"}.ri-filter-2-fill:before{content:"\ed22"}.ri-filter-2-line:before{content:"\ed23"}.ri-filter-3-fill:before{content:"\ed24"}.ri-filter-3-line:before{content:"\ed25"}.ri-filter-fill:before{content:"\ed26"}.ri-filter-line:before{content:"\ed27"}.ri-filter-off-fill:before{content:"\ed28"}.ri-filter-off-line:before{content:"\ed29"}.ri-find-replace-fill:before{content:"\ed2a"}.ri-find-replace-line:before{content:"\ed2b"}.ri-finder-fill:before{content:"\ed2c"}.ri-finder-line:before{content:"\ed2d"}.ri-fingerprint-2-fill:before{content:"\ed2e"}.ri-fingerprint-2-line:before{content:"\ed2f"}.ri-fingerprint-fill:before{content:"\ed30"}.ri-fingerprint-line:before{content:"\ed31"}.ri-fire-fill:before{content:"\ed32"}.ri-fire-line:before{content:"\ed33"}.ri-firefox-fill:before{content:"\ed34"}.ri-firefox-line:before{content:"\ed35"}.ri-first-aid-kit-fill:before{content:"\ed36"}.ri-first-aid-kit-line:before{content:"\ed37"}.ri-flag-2-fill:before{content:"\ed38"}.ri-flag-2-line:before{content:"\ed39"}.ri-flag-fill:before{content:"\ed3a"}.ri-flag-line:before{content:"\ed3b"}.ri-flashlight-fill:before{content:"\ed3c"}.ri-flashlight-line:before{content:"\ed3d"}.ri-flask-fill:before{content:"\ed3e"}.ri-flask-line:before{content:"\ed3f"}.ri-flight-land-fill:before{content:"\ed40"}.ri-flight-land-line:before{content:"\ed41"}.ri-flight-takeoff-fill:before{content:"\ed42"}.ri-flight-takeoff-line:before{content:"\ed43"}.ri-flood-fill:before{content:"\ed44"}.ri-flood-line:before{content:"\ed45"}.ri-flow-chart:before{content:"\ed46"}.ri-flutter-fill:before{content:"\ed47"}.ri-flutter-line:before{content:"\ed48"}.ri-focus-2-fill:before{content:"\ed49"}.ri-focus-2-line:before{content:"\ed4a"}.ri-focus-3-fill:before{content:"\ed4b"}.ri-focus-3-line:before{content:"\ed4c"}.ri-focus-fill:before{content:"\ed4d"}.ri-focus-line:before{content:"\ed4e"}.ri-foggy-fill:before{content:"\ed4f"}.ri-foggy-line:before{content:"\ed50"}.ri-folder-2-fill:before{content:"\ed51"}.ri-folder-2-line:before{content:"\ed52"}.ri-folder-3-fill:before{content:"\ed53"}.ri-folder-3-line:before{content:"\ed54"}.ri-folder-4-fill:before{content:"\ed55"}.ri-folder-4-line:before{content:"\ed56"}.ri-folder-5-fill:before{content:"\ed57"}.ri-folder-5-line:before{content:"\ed58"}.ri-folder-add-fill:before{content:"\ed59"}.ri-folder-add-line:before{content:"\ed5a"}.ri-folder-chart-2-fill:before{content:"\ed5b"}.ri-folder-chart-2-line:before{content:"\ed5c"}.ri-folder-chart-fill:before{content:"\ed5d"}.ri-folder-chart-line:before{content:"\ed5e"}.ri-folder-download-fill:before{content:"\ed5f"}.ri-folder-download-line:before{content:"\ed60"}.ri-folder-fill:before{content:"\ed61"}.ri-folder-forbid-fill:before{content:"\ed62"}.ri-folder-forbid-line:before{content:"\ed63"}.ri-folder-history-fill:before{content:"\ed64"}.ri-folder-history-line:before{content:"\ed65"}.ri-folder-info-fill:before{content:"\ed66"}.ri-folder-info-line:before{content:"\ed67"}.ri-folder-keyhole-fill:before{content:"\ed68"}.ri-folder-keyhole-line:before{content:"\ed69"}.ri-folder-line:before{content:"\ed6a"}.ri-folder-lock-fill:before{content:"\ed6b"}.ri-folder-lock-line:before{content:"\ed6c"}.ri-folder-music-fill:before{content:"\ed6d"}.ri-folder-music-line:before{content:"\ed6e"}.ri-folder-open-fill:before{content:"\ed6f"}.ri-folder-open-line:before{content:"\ed70"}.ri-folder-received-fill:before{content:"\ed71"}.ri-folder-received-line:before{content:"\ed72"}.ri-folder-reduce-fill:before{content:"\ed73"}.ri-folder-reduce-line:before{content:"\ed74"}.ri-folder-settings-fill:before{content:"\ed75"}.ri-folder-settings-line:before{content:"\ed76"}.ri-folder-shared-fill:before{content:"\ed77"}.ri-folder-shared-line:before{content:"\ed78"}.ri-folder-shield-2-fill:before{content:"\ed79"}.ri-folder-shield-2-line:before{content:"\ed7a"}.ri-folder-shield-fill:before{content:"\ed7b"}.ri-folder-shield-line:before{content:"\ed7c"}.ri-folder-transfer-fill:before{content:"\ed7d"}.ri-folder-transfer-line:before{content:"\ed7e"}.ri-folder-unknow-fill:before{content:"\ed7f"}.ri-folder-unknow-line:before{content:"\ed80"}.ri-folder-upload-fill:before{content:"\ed81"}.ri-folder-upload-line:before{content:"\ed82"}.ri-folder-user-fill:before{content:"\ed83"}.ri-folder-user-line:before{content:"\ed84"}.ri-folder-warning-fill:before{content:"\ed85"}.ri-folder-warning-line:before{content:"\ed86"}.ri-folder-zip-fill:before{content:"\ed87"}.ri-folder-zip-line:before{content:"\ed88"}.ri-folders-fill:before{content:"\ed89"}.ri-folders-line:before{content:"\ed8a"}.ri-font-color:before{content:"\ed8b"}.ri-font-size-2:before{content:"\ed8c"}.ri-font-size:before{content:"\ed8d"}.ri-football-fill:before{content:"\ed8e"}.ri-football-line:before{content:"\ed8f"}.ri-footprint-fill:before{content:"\ed90"}.ri-footprint-line:before{content:"\ed91"}.ri-forbid-2-fill:before{content:"\ed92"}.ri-forbid-2-line:before{content:"\ed93"}.ri-forbid-fill:before{content:"\ed94"}.ri-forbid-line:before{content:"\ed95"}.ri-format-clear:before{content:"\ed96"}.ri-fridge-fill:before{content:"\ed97"}.ri-fridge-line:before{content:"\ed98"}.ri-fullscreen-exit-fill:before{content:"\ed99"}.ri-fullscreen-exit-line:before{content:"\ed9a"}.ri-fullscreen-fill:before{content:"\ed9b"}.ri-fullscreen-line:before{content:"\ed9c"}.ri-function-fill:before{content:"\ed9d"}.ri-function-line:before{content:"\ed9e"}.ri-functions:before{content:"\ed9f"}.ri-funds-box-fill:before{content:"\eda0"}.ri-funds-box-line:before{content:"\eda1"}.ri-funds-fill:before{content:"\eda2"}.ri-funds-line:before{content:"\eda3"}.ri-gallery-fill:before{content:"\eda4"}.ri-gallery-line:before{content:"\eda5"}.ri-gallery-upload-fill:before{content:"\eda6"}.ri-gallery-upload-line:before{content:"\eda7"}.ri-game-fill:before{content:"\eda8"}.ri-game-line:before{content:"\eda9"}.ri-gamepad-fill:before{content:"\edaa"}.ri-gamepad-line:before{content:"\edab"}.ri-gas-station-fill:before{content:"\edac"}.ri-gas-station-line:before{content:"\edad"}.ri-gatsby-fill:before{content:"\edae"}.ri-gatsby-line:before{content:"\edaf"}.ri-genderless-fill:before{content:"\edb0"}.ri-genderless-line:before{content:"\edb1"}.ri-ghost-2-fill:before{content:"\edb2"}.ri-ghost-2-line:before{content:"\edb3"}.ri-ghost-fill:before{content:"\edb4"}.ri-ghost-line:before{content:"\edb5"}.ri-ghost-smile-fill:before{content:"\edb6"}.ri-ghost-smile-line:before{content:"\edb7"}.ri-gift-2-fill:before{content:"\edb8"}.ri-gift-2-line:before{content:"\edb9"}.ri-gift-fill:before{content:"\edba"}.ri-gift-line:before{content:"\edbb"}.ri-git-branch-fill:before{content:"\edbc"}.ri-git-branch-line:before{content:"\edbd"}.ri-git-commit-fill:before{content:"\edbe"}.ri-git-commit-line:before{content:"\edbf"}.ri-git-merge-fill:before{content:"\edc0"}.ri-git-merge-line:before{content:"\edc1"}.ri-git-pull-request-fill:before{content:"\edc2"}.ri-git-pull-request-line:before{content:"\edc3"}.ri-git-repository-commits-fill:before{content:"\edc4"}.ri-git-repository-commits-line:before{content:"\edc5"}.ri-git-repository-fill:before{content:"\edc6"}.ri-git-repository-line:before{content:"\edc7"}.ri-git-repository-private-fill:before{content:"\edc8"}.ri-git-repository-private-line:before{content:"\edc9"}.ri-github-fill:before{content:"\edca"}.ri-github-line:before{content:"\edcb"}.ri-gitlab-fill:before{content:"\edcc"}.ri-gitlab-line:before{content:"\edcd"}.ri-global-fill:before{content:"\edce"}.ri-global-line:before{content:"\edcf"}.ri-globe-fill:before{content:"\edd0"}.ri-globe-line:before{content:"\edd1"}.ri-goblet-fill:before{content:"\edd2"}.ri-goblet-line:before{content:"\edd3"}.ri-google-fill:before{content:"\edd4"}.ri-google-line:before{content:"\edd5"}.ri-google-play-fill:before{content:"\edd6"}.ri-google-play-line:before{content:"\edd7"}.ri-government-fill:before{content:"\edd8"}.ri-government-line:before{content:"\edd9"}.ri-gps-fill:before{content:"\edda"}.ri-gps-line:before{content:"\eddb"}.ri-gradienter-fill:before{content:"\eddc"}.ri-gradienter-line:before{content:"\eddd"}.ri-grid-fill:before{content:"\edde"}.ri-grid-line:before{content:"\eddf"}.ri-group-2-fill:before{content:"\ede0"}.ri-group-2-line:before{content:"\ede1"}.ri-group-fill:before{content:"\ede2"}.ri-group-line:before{content:"\ede3"}.ri-guide-fill:before{content:"\ede4"}.ri-guide-line:before{content:"\ede5"}.ri-h-1:before{content:"\ede6"}.ri-h-2:before{content:"\ede7"}.ri-h-3:before{content:"\ede8"}.ri-h-4:before{content:"\ede9"}.ri-h-5:before{content:"\edea"}.ri-h-6:before{content:"\edeb"}.ri-hail-fill:before{content:"\edec"}.ri-hail-line:before{content:"\eded"}.ri-hammer-fill:before{content:"\edee"}.ri-hammer-line:before{content:"\edef"}.ri-hand-coin-fill:before{content:"\edf0"}.ri-hand-coin-line:before{content:"\edf1"}.ri-hand-heart-fill:before{content:"\edf2"}.ri-hand-heart-line:before{content:"\edf3"}.ri-hand-sanitizer-fill:before{content:"\edf4"}.ri-hand-sanitizer-line:before{content:"\edf5"}.ri-handbag-fill:before{content:"\edf6"}.ri-handbag-line:before{content:"\edf7"}.ri-hard-drive-2-fill:before{content:"\edf8"}.ri-hard-drive-2-line:before{content:"\edf9"}.ri-hard-drive-fill:before{content:"\edfa"}.ri-hard-drive-line:before{content:"\edfb"}.ri-hashtag:before{content:"\edfc"}.ri-haze-2-fill:before{content:"\edfd"}.ri-haze-2-line:before{content:"\edfe"}.ri-haze-fill:before{content:"\edff"}.ri-haze-line:before{content:"\ee00"}.ri-hd-fill:before{content:"\ee01"}.ri-hd-line:before{content:"\ee02"}.ri-heading:before{content:"\ee03"}.ri-headphone-fill:before{content:"\ee04"}.ri-headphone-line:before{content:"\ee05"}.ri-health-book-fill:before{content:"\ee06"}.ri-health-book-line:before{content:"\ee07"}.ri-heart-2-fill:before{content:"\ee08"}.ri-heart-2-line:before{content:"\ee09"}.ri-heart-3-fill:before{content:"\ee0a"}.ri-heart-3-line:before{content:"\ee0b"}.ri-heart-add-fill:before{content:"\ee0c"}.ri-heart-add-line:before{content:"\ee0d"}.ri-heart-fill:before{content:"\ee0e"}.ri-heart-line:before{content:"\ee0f"}.ri-heart-pulse-fill:before{content:"\ee10"}.ri-heart-pulse-line:before{content:"\ee11"}.ri-hearts-fill:before{content:"\ee12"}.ri-hearts-line:before{content:"\ee13"}.ri-heavy-showers-fill:before{content:"\ee14"}.ri-heavy-showers-line:before{content:"\ee15"}.ri-history-fill:before{content:"\ee16"}.ri-history-line:before{content:"\ee17"}.ri-home-2-fill:before{content:"\ee18"}.ri-home-2-line:before{content:"\ee19"}.ri-home-3-fill:before{content:"\ee1a"}.ri-home-3-line:before{content:"\ee1b"}.ri-home-4-fill:before{content:"\ee1c"}.ri-home-4-line:before{content:"\ee1d"}.ri-home-5-fill:before{content:"\ee1e"}.ri-home-5-line:before{content:"\ee1f"}.ri-home-6-fill:before{content:"\ee20"}.ri-home-6-line:before{content:"\ee21"}.ri-home-7-fill:before{content:"\ee22"}.ri-home-7-line:before{content:"\ee23"}.ri-home-8-fill:before{content:"\ee24"}.ri-home-8-line:before{content:"\ee25"}.ri-home-fill:before{content:"\ee26"}.ri-home-gear-fill:before{content:"\ee27"}.ri-home-gear-line:before{content:"\ee28"}.ri-home-heart-fill:before{content:"\ee29"}.ri-home-heart-line:before{content:"\ee2a"}.ri-home-line:before{content:"\ee2b"}.ri-home-smile-2-fill:before{content:"\ee2c"}.ri-home-smile-2-line:before{content:"\ee2d"}.ri-home-smile-fill:before{content:"\ee2e"}.ri-home-smile-line:before{content:"\ee2f"}.ri-home-wifi-fill:before{content:"\ee30"}.ri-home-wifi-line:before{content:"\ee31"}.ri-honor-of-kings-fill:before{content:"\ee32"}.ri-honor-of-kings-line:before{content:"\ee33"}.ri-honour-fill:before{content:"\ee34"}.ri-honour-line:before{content:"\ee35"}.ri-hospital-fill:before{content:"\ee36"}.ri-hospital-line:before{content:"\ee37"}.ri-hotel-bed-fill:before{content:"\ee38"}.ri-hotel-bed-line:before{content:"\ee39"}.ri-hotel-fill:before{content:"\ee3a"}.ri-hotel-line:before{content:"\ee3b"}.ri-hotspot-fill:before{content:"\ee3c"}.ri-hotspot-line:before{content:"\ee3d"}.ri-hq-fill:before{content:"\ee3e"}.ri-hq-line:before{content:"\ee3f"}.ri-html5-fill:before{content:"\ee40"}.ri-html5-line:before{content:"\ee41"}.ri-ie-fill:before{content:"\ee42"}.ri-ie-line:before{content:"\ee43"}.ri-image-2-fill:before{content:"\ee44"}.ri-image-2-line:before{content:"\ee45"}.ri-image-add-fill:before{content:"\ee46"}.ri-image-add-line:before{content:"\ee47"}.ri-image-edit-fill:before{content:"\ee48"}.ri-image-edit-line:before{content:"\ee49"}.ri-image-fill:before{content:"\ee4a"}.ri-image-line:before{content:"\ee4b"}.ri-inbox-archive-fill:before{content:"\ee4c"}.ri-inbox-archive-line:before{content:"\ee4d"}.ri-inbox-fill:before{content:"\ee4e"}.ri-inbox-line:before{content:"\ee4f"}.ri-inbox-unarchive-fill:before{content:"\ee50"}.ri-inbox-unarchive-line:before{content:"\ee51"}.ri-increase-decrease-fill:before{content:"\ee52"}.ri-increase-decrease-line:before{content:"\ee53"}.ri-indent-decrease:before{content:"\ee54"}.ri-indent-increase:before{content:"\ee55"}.ri-indeterminate-circle-fill:before{content:"\ee56"}.ri-indeterminate-circle-line:before{content:"\ee57"}.ri-information-fill:before{content:"\ee58"}.ri-information-line:before{content:"\ee59"}.ri-infrared-thermometer-fill:before{content:"\ee5a"}.ri-infrared-thermometer-line:before{content:"\ee5b"}.ri-ink-bottle-fill:before{content:"\ee5c"}.ri-ink-bottle-line:before{content:"\ee5d"}.ri-input-cursor-move:before{content:"\ee5e"}.ri-input-method-fill:before{content:"\ee5f"}.ri-input-method-line:before{content:"\ee60"}.ri-insert-column-left:before{content:"\ee61"}.ri-insert-column-right:before{content:"\ee62"}.ri-insert-row-bottom:before{content:"\ee63"}.ri-insert-row-top:before{content:"\ee64"}.ri-instagram-fill:before{content:"\ee65"}.ri-instagram-line:before{content:"\ee66"}.ri-install-fill:before{content:"\ee67"}.ri-install-line:before{content:"\ee68"}.ri-invision-fill:before{content:"\ee69"}.ri-invision-line:before{content:"\ee6a"}.ri-italic:before{content:"\ee6b"}.ri-kakao-talk-fill:before{content:"\ee6c"}.ri-kakao-talk-line:before{content:"\ee6d"}.ri-key-2-fill:before{content:"\ee6e"}.ri-key-2-line:before{content:"\ee6f"}.ri-key-fill:before{content:"\ee70"}.ri-key-line:before{content:"\ee71"}.ri-keyboard-box-fill:before{content:"\ee72"}.ri-keyboard-box-line:before{content:"\ee73"}.ri-keyboard-fill:before{content:"\ee74"}.ri-keyboard-line:before{content:"\ee75"}.ri-keynote-fill:before{content:"\ee76"}.ri-keynote-line:before{content:"\ee77"}.ri-knife-blood-fill:before{content:"\ee78"}.ri-knife-blood-line:before{content:"\ee79"}.ri-knife-fill:before{content:"\ee7a"}.ri-knife-line:before{content:"\ee7b"}.ri-landscape-fill:before{content:"\ee7c"}.ri-landscape-line:before{content:"\ee7d"}.ri-layout-2-fill:before{content:"\ee7e"}.ri-layout-2-line:before{content:"\ee7f"}.ri-layout-3-fill:before{content:"\ee80"}.ri-layout-3-line:before{content:"\ee81"}.ri-layout-4-fill:before{content:"\ee82"}.ri-layout-4-line:before{content:"\ee83"}.ri-layout-5-fill:before{content:"\ee84"}.ri-layout-5-line:before{content:"\ee85"}.ri-layout-6-fill:before{content:"\ee86"}.ri-layout-6-line:before{content:"\ee87"}.ri-layout-bottom-2-fill:before{content:"\ee88"}.ri-layout-bottom-2-line:before{content:"\ee89"}.ri-layout-bottom-fill:before{content:"\ee8a"}.ri-layout-bottom-line:before{content:"\ee8b"}.ri-layout-column-fill:before{content:"\ee8c"}.ri-layout-column-line:before{content:"\ee8d"}.ri-layout-fill:before{content:"\ee8e"}.ri-layout-grid-fill:before{content:"\ee8f"}.ri-layout-grid-line:before{content:"\ee90"}.ri-layout-left-2-fill:before{content:"\ee91"}.ri-layout-left-2-line:before{content:"\ee92"}.ri-layout-left-fill:before{content:"\ee93"}.ri-layout-left-line:before{content:"\ee94"}.ri-layout-line:before{content:"\ee95"}.ri-layout-masonry-fill:before{content:"\ee96"}.ri-layout-masonry-line:before{content:"\ee97"}.ri-layout-right-2-fill:before{content:"\ee98"}.ri-layout-right-2-line:before{content:"\ee99"}.ri-layout-right-fill:before{content:"\ee9a"}.ri-layout-right-line:before{content:"\ee9b"}.ri-layout-row-fill:before{content:"\ee9c"}.ri-layout-row-line:before{content:"\ee9d"}.ri-layout-top-2-fill:before{content:"\ee9e"}.ri-layout-top-2-line:before{content:"\ee9f"}.ri-layout-top-fill:before{content:"\eea0"}.ri-layout-top-line:before{content:"\eea1"}.ri-leaf-fill:before{content:"\eea2"}.ri-leaf-line:before{content:"\eea3"}.ri-lifebuoy-fill:before{content:"\eea4"}.ri-lifebuoy-line:before{content:"\eea5"}.ri-lightbulb-fill:before{content:"\eea6"}.ri-lightbulb-flash-fill:before{content:"\eea7"}.ri-lightbulb-flash-line:before{content:"\eea8"}.ri-lightbulb-line:before{content:"\eea9"}.ri-line-chart-fill:before{content:"\eeaa"}.ri-line-chart-line:before{content:"\eeab"}.ri-line-fill:before{content:"\eeac"}.ri-line-height:before{content:"\eead"}.ri-line-line:before{content:"\eeae"}.ri-link-m:before{content:"\eeaf"}.ri-link-unlink-m:before{content:"\eeb0"}.ri-link-unlink:before{content:"\eeb1"}.ri-link:before{content:"\eeb2"}.ri-linkedin-box-fill:before{content:"\eeb3"}.ri-linkedin-box-line:before{content:"\eeb4"}.ri-linkedin-fill:before{content:"\eeb5"}.ri-linkedin-line:before{content:"\eeb6"}.ri-links-fill:before{content:"\eeb7"}.ri-links-line:before{content:"\eeb8"}.ri-list-check-2:before{content:"\eeb9"}.ri-list-check:before{content:"\eeba"}.ri-list-ordered:before{content:"\eebb"}.ri-list-settings-fill:before{content:"\eebc"}.ri-list-settings-line:before{content:"\eebd"}.ri-list-unordered:before{content:"\eebe"}.ri-live-fill:before{content:"\eebf"}.ri-live-line:before{content:"\eec0"}.ri-loader-2-fill:before{content:"\eec1"}.ri-loader-2-line:before{content:"\eec2"}.ri-loader-3-fill:before{content:"\eec3"}.ri-loader-3-line:before{content:"\eec4"}.ri-loader-4-fill:before{content:"\eec5"}.ri-loader-4-line:before{content:"\eec6"}.ri-loader-5-fill:before{content:"\eec7"}.ri-loader-5-line:before{content:"\eec8"}.ri-loader-fill:before{content:"\eec9"}.ri-loader-line:before{content:"\eeca"}.ri-lock-2-fill:before{content:"\eecb"}.ri-lock-2-line:before{content:"\eecc"}.ri-lock-fill:before{content:"\eecd"}.ri-lock-line:before{content:"\eece"}.ri-lock-password-fill:before{content:"\eecf"}.ri-lock-password-line:before{content:"\eed0"}.ri-lock-unlock-fill:before{content:"\eed1"}.ri-lock-unlock-line:before{content:"\eed2"}.ri-login-box-fill:before{content:"\eed3"}.ri-login-box-line:before{content:"\eed4"}.ri-login-circle-fill:before{content:"\eed5"}.ri-login-circle-line:before{content:"\eed6"}.ri-logout-box-fill:before{content:"\eed7"}.ri-logout-box-line:before{content:"\eed8"}.ri-logout-box-r-fill:before{content:"\eed9"}.ri-logout-box-r-line:before{content:"\eeda"}.ri-logout-circle-fill:before{content:"\eedb"}.ri-logout-circle-line:before{content:"\eedc"}.ri-logout-circle-r-fill:before{content:"\eedd"}.ri-logout-circle-r-line:before{content:"\eede"}.ri-luggage-cart-fill:before{content:"\eedf"}.ri-luggage-cart-line:before{content:"\eee0"}.ri-luggage-deposit-fill:before{content:"\eee1"}.ri-luggage-deposit-line:before{content:"\eee2"}.ri-lungs-fill:before{content:"\eee3"}.ri-lungs-line:before{content:"\eee4"}.ri-mac-fill:before{content:"\eee5"}.ri-mac-line:before{content:"\eee6"}.ri-macbook-fill:before{content:"\eee7"}.ri-macbook-line:before{content:"\eee8"}.ri-magic-fill:before{content:"\eee9"}.ri-magic-line:before{content:"\eeea"}.ri-mail-add-fill:before{content:"\eeeb"}.ri-mail-add-line:before{content:"\eeec"}.ri-mail-check-fill:before{content:"\eeed"}.ri-mail-check-line:before{content:"\eeee"}.ri-mail-close-fill:before{content:"\eeef"}.ri-mail-close-line:before{content:"\eef0"}.ri-mail-download-fill:before{content:"\eef1"}.ri-mail-download-line:before{content:"\eef2"}.ri-mail-fill:before{content:"\eef3"}.ri-mail-forbid-fill:before{content:"\eef4"}.ri-mail-forbid-line:before{content:"\eef5"}.ri-mail-line:before{content:"\eef6"}.ri-mail-lock-fill:before{content:"\eef7"}.ri-mail-lock-line:before{content:"\eef8"}.ri-mail-open-fill:before{content:"\eef9"}.ri-mail-open-line:before{content:"\eefa"}.ri-mail-send-fill:before{content:"\eefb"}.ri-mail-send-line:before{content:"\eefc"}.ri-mail-settings-fill:before{content:"\eefd"}.ri-mail-settings-line:before{content:"\eefe"}.ri-mail-star-fill:before{content:"\eeff"}.ri-mail-star-line:before{content:"\ef00"}.ri-mail-unread-fill:before{content:"\ef01"}.ri-mail-unread-line:before{content:"\ef02"}.ri-mail-volume-fill:before{content:"\ef03"}.ri-mail-volume-line:before{content:"\ef04"}.ri-map-2-fill:before{content:"\ef05"}.ri-map-2-line:before{content:"\ef06"}.ri-map-fill:before{content:"\ef07"}.ri-map-line:before{content:"\ef08"}.ri-map-pin-2-fill:before{content:"\ef09"}.ri-map-pin-2-line:before{content:"\ef0a"}.ri-map-pin-3-fill:before{content:"\ef0b"}.ri-map-pin-3-line:before{content:"\ef0c"}.ri-map-pin-4-fill:before{content:"\ef0d"}.ri-map-pin-4-line:before{content:"\ef0e"}.ri-map-pin-5-fill:before{content:"\ef0f"}.ri-map-pin-5-line:before{content:"\ef10"}.ri-map-pin-add-fill:before{content:"\ef11"}.ri-map-pin-add-line:before{content:"\ef12"}.ri-map-pin-fill:before{content:"\ef13"}.ri-map-pin-line:before{content:"\ef14"}.ri-map-pin-range-fill:before{content:"\ef15"}.ri-map-pin-range-line:before{content:"\ef16"}.ri-map-pin-time-fill:before{content:"\ef17"}.ri-map-pin-time-line:before{content:"\ef18"}.ri-map-pin-user-fill:before{content:"\ef19"}.ri-map-pin-user-line:before{content:"\ef1a"}.ri-mark-pen-fill:before{content:"\ef1b"}.ri-mark-pen-line:before{content:"\ef1c"}.ri-markdown-fill:before{content:"\ef1d"}.ri-markdown-line:before{content:"\ef1e"}.ri-markup-fill:before{content:"\ef1f"}.ri-markup-line:before{content:"\ef20"}.ri-mastercard-fill:before{content:"\ef21"}.ri-mastercard-line:before{content:"\ef22"}.ri-mastodon-fill:before{content:"\ef23"}.ri-mastodon-line:before{content:"\ef24"}.ri-medal-2-fill:before{content:"\ef25"}.ri-medal-2-line:before{content:"\ef26"}.ri-medal-fill:before{content:"\ef27"}.ri-medal-line:before{content:"\ef28"}.ri-medicine-bottle-fill:before{content:"\ef29"}.ri-medicine-bottle-line:before{content:"\ef2a"}.ri-medium-fill:before{content:"\ef2b"}.ri-medium-line:before{content:"\ef2c"}.ri-men-fill:before{content:"\ef2d"}.ri-men-line:before{content:"\ef2e"}.ri-mental-health-fill:before{content:"\ef2f"}.ri-mental-health-line:before{content:"\ef30"}.ri-menu-2-fill:before{content:"\ef31"}.ri-menu-2-line:before{content:"\ef32"}.ri-menu-3-fill:before{content:"\ef33"}.ri-menu-3-line:before{content:"\ef34"}.ri-menu-4-fill:before{content:"\ef35"}.ri-menu-4-line:before{content:"\ef36"}.ri-menu-5-fill:before{content:"\ef37"}.ri-menu-5-line:before{content:"\ef38"}.ri-menu-add-fill:before{content:"\ef39"}.ri-menu-add-line:before{content:"\ef3a"}.ri-menu-fill:before{content:"\ef3b"}.ri-menu-fold-fill:before{content:"\ef3c"}.ri-menu-fold-line:before{content:"\ef3d"}.ri-menu-line:before{content:"\ef3e"}.ri-menu-unfold-fill:before{content:"\ef3f"}.ri-menu-unfold-line:before{content:"\ef40"}.ri-merge-cells-horizontal:before{content:"\ef41"}.ri-merge-cells-vertical:before{content:"\ef42"}.ri-message-2-fill:before{content:"\ef43"}.ri-message-2-line:before{content:"\ef44"}.ri-message-3-fill:before{content:"\ef45"}.ri-message-3-line:before{content:"\ef46"}.ri-message-fill:before{content:"\ef47"}.ri-message-line:before{content:"\ef48"}.ri-messenger-fill:before{content:"\ef49"}.ri-messenger-line:before{content:"\ef4a"}.ri-meteor-fill:before{content:"\ef4b"}.ri-meteor-line:before{content:"\ef4c"}.ri-mic-2-fill:before{content:"\ef4d"}.ri-mic-2-line:before{content:"\ef4e"}.ri-mic-fill:before{content:"\ef4f"}.ri-mic-line:before{content:"\ef50"}.ri-mic-off-fill:before{content:"\ef51"}.ri-mic-off-line:before{content:"\ef52"}.ri-mickey-fill:before{content:"\ef53"}.ri-mickey-line:before{content:"\ef54"}.ri-microscope-fill:before{content:"\ef55"}.ri-microscope-line:before{content:"\ef56"}.ri-microsoft-fill:before{content:"\ef57"}.ri-microsoft-line:before{content:"\ef58"}.ri-mind-map:before{content:"\ef59"}.ri-mini-program-fill:before{content:"\ef5a"}.ri-mini-program-line:before{content:"\ef5b"}.ri-mist-fill:before{content:"\ef5c"}.ri-mist-line:before{content:"\ef5d"}.ri-money-cny-box-fill:before{content:"\ef5e"}.ri-money-cny-box-line:before{content:"\ef5f"}.ri-money-cny-circle-fill:before{content:"\ef60"}.ri-money-cny-circle-line:before{content:"\ef61"}.ri-money-dollar-box-fill:before{content:"\ef62"}.ri-money-dollar-box-line:before{content:"\ef63"}.ri-money-dollar-circle-fill:before{content:"\ef64"}.ri-money-dollar-circle-line:before{content:"\ef65"}.ri-money-euro-box-fill:before{content:"\ef66"}.ri-money-euro-box-line:before{content:"\ef67"}.ri-money-euro-circle-fill:before{content:"\ef68"}.ri-money-euro-circle-line:before{content:"\ef69"}.ri-money-pound-box-fill:before{content:"\ef6a"}.ri-money-pound-box-line:before{content:"\ef6b"}.ri-money-pound-circle-fill:before{content:"\ef6c"}.ri-money-pound-circle-line:before{content:"\ef6d"}.ri-moon-clear-fill:before{content:"\ef6e"}.ri-moon-clear-line:before{content:"\ef6f"}.ri-moon-cloudy-fill:before{content:"\ef70"}.ri-moon-cloudy-line:before{content:"\ef71"}.ri-moon-fill:before{content:"\ef72"}.ri-moon-foggy-fill:before{content:"\ef73"}.ri-moon-foggy-line:before{content:"\ef74"}.ri-moon-line:before{content:"\ef75"}.ri-more-2-fill:before{content:"\ef76"}.ri-more-2-line:before{content:"\ef77"}.ri-more-fill:before{content:"\ef78"}.ri-more-line:before{content:"\ef79"}.ri-motorbike-fill:before{content:"\ef7a"}.ri-motorbike-line:before{content:"\ef7b"}.ri-mouse-fill:before{content:"\ef7c"}.ri-mouse-line:before{content:"\ef7d"}.ri-movie-2-fill:before{content:"\ef7e"}.ri-movie-2-line:before{content:"\ef7f"}.ri-movie-fill:before{content:"\ef80"}.ri-movie-line:before{content:"\ef81"}.ri-music-2-fill:before{content:"\ef82"}.ri-music-2-line:before{content:"\ef83"}.ri-music-fill:before{content:"\ef84"}.ri-music-line:before{content:"\ef85"}.ri-mv-fill:before{content:"\ef86"}.ri-mv-line:before{content:"\ef87"}.ri-navigation-fill:before{content:"\ef88"}.ri-navigation-line:before{content:"\ef89"}.ri-netease-cloud-music-fill:before{content:"\ef8a"}.ri-netease-cloud-music-line:before{content:"\ef8b"}.ri-netflix-fill:before{content:"\ef8c"}.ri-netflix-line:before{content:"\ef8d"}.ri-newspaper-fill:before{content:"\ef8e"}.ri-newspaper-line:before{content:"\ef8f"}.ri-node-tree:before{content:"\ef90"}.ri-notification-2-fill:before{content:"\ef91"}.ri-notification-2-line:before{content:"\ef92"}.ri-notification-3-fill:before{content:"\ef93"}.ri-notification-3-line:before{content:"\ef94"}.ri-notification-4-fill:before{content:"\ef95"}.ri-notification-4-line:before{content:"\ef96"}.ri-notification-badge-fill:before{content:"\ef97"}.ri-notification-badge-line:before{content:"\ef98"}.ri-notification-fill:before{content:"\ef99"}.ri-notification-line:before{content:"\ef9a"}.ri-notification-off-fill:before{content:"\ef9b"}.ri-notification-off-line:before{content:"\ef9c"}.ri-npmjs-fill:before{content:"\ef9d"}.ri-npmjs-line:before{content:"\ef9e"}.ri-number-0:before{content:"\ef9f"}.ri-number-1:before{content:"\efa0"}.ri-number-2:before{content:"\efa1"}.ri-number-3:before{content:"\efa2"}.ri-number-4:before{content:"\efa3"}.ri-number-5:before{content:"\efa4"}.ri-number-6:before{content:"\efa5"}.ri-number-7:before{content:"\efa6"}.ri-number-8:before{content:"\efa7"}.ri-number-9:before{content:"\efa8"}.ri-numbers-fill:before{content:"\efa9"}.ri-numbers-line:before{content:"\efaa"}.ri-nurse-fill:before{content:"\efab"}.ri-nurse-line:before{content:"\efac"}.ri-oil-fill:before{content:"\efad"}.ri-oil-line:before{content:"\efae"}.ri-omega:before{content:"\efaf"}.ri-open-arm-fill:before{content:"\efb0"}.ri-open-arm-line:before{content:"\efb1"}.ri-open-source-fill:before{content:"\efb2"}.ri-open-source-line:before{content:"\efb3"}.ri-opera-fill:before{content:"\efb4"}.ri-opera-line:before{content:"\efb5"}.ri-order-play-fill:before{content:"\efb6"}.ri-order-play-line:before{content:"\efb7"}.ri-organization-chart:before{content:"\efb8"}.ri-outlet-2-fill:before{content:"\efb9"}.ri-outlet-2-line:before{content:"\efba"}.ri-outlet-fill:before{content:"\efbb"}.ri-outlet-line:before{content:"\efbc"}.ri-page-separator:before{content:"\efbd"}.ri-pages-fill:before{content:"\efbe"}.ri-pages-line:before{content:"\efbf"}.ri-paint-brush-fill:before{content:"\efc0"}.ri-paint-brush-line:before{content:"\efc1"}.ri-paint-fill:before{content:"\efc2"}.ri-paint-line:before{content:"\efc3"}.ri-palette-fill:before{content:"\efc4"}.ri-palette-line:before{content:"\efc5"}.ri-pantone-fill:before{content:"\efc6"}.ri-pantone-line:before{content:"\efc7"}.ri-paragraph:before{content:"\efc8"}.ri-parent-fill:before{content:"\efc9"}.ri-parent-line:before{content:"\efca"}.ri-parentheses-fill:before{content:"\efcb"}.ri-parentheses-line:before{content:"\efcc"}.ri-parking-box-fill:before{content:"\efcd"}.ri-parking-box-line:before{content:"\efce"}.ri-parking-fill:before{content:"\efcf"}.ri-parking-line:before{content:"\efd0"}.ri-passport-fill:before{content:"\efd1"}.ri-passport-line:before{content:"\efd2"}.ri-patreon-fill:before{content:"\efd3"}.ri-patreon-line:before{content:"\efd4"}.ri-pause-circle-fill:before{content:"\efd5"}.ri-pause-circle-line:before{content:"\efd6"}.ri-pause-fill:before{content:"\efd7"}.ri-pause-line:before{content:"\efd8"}.ri-pause-mini-fill:before{content:"\efd9"}.ri-pause-mini-line:before{content:"\efda"}.ri-paypal-fill:before{content:"\efdb"}.ri-paypal-line:before{content:"\efdc"}.ri-pen-nib-fill:before{content:"\efdd"}.ri-pen-nib-line:before{content:"\efde"}.ri-pencil-fill:before{content:"\efdf"}.ri-pencil-line:before{content:"\efe0"}.ri-pencil-ruler-2-fill:before{content:"\efe1"}.ri-pencil-ruler-2-line:before{content:"\efe2"}.ri-pencil-ruler-fill:before{content:"\efe3"}.ri-pencil-ruler-line:before{content:"\efe4"}.ri-percent-fill:before{content:"\efe5"}.ri-percent-line:before{content:"\efe6"}.ri-phone-camera-fill:before{content:"\efe7"}.ri-phone-camera-line:before{content:"\efe8"}.ri-phone-fill:before{content:"\efe9"}.ri-phone-find-fill:before{content:"\efea"}.ri-phone-find-line:before{content:"\efeb"}.ri-phone-line:before{content:"\efec"}.ri-phone-lock-fill:before{content:"\efed"}.ri-phone-lock-line:before{content:"\efee"}.ri-picture-in-picture-2-fill:before{content:"\efef"}.ri-picture-in-picture-2-line:before{content:"\eff0"}.ri-picture-in-picture-exit-fill:before{content:"\eff1"}.ri-picture-in-picture-exit-line:before{content:"\eff2"}.ri-picture-in-picture-fill:before{content:"\eff3"}.ri-picture-in-picture-line:before{content:"\eff4"}.ri-pie-chart-2-fill:before{content:"\eff5"}.ri-pie-chart-2-line:before{content:"\eff6"}.ri-pie-chart-box-fill:before{content:"\eff7"}.ri-pie-chart-box-line:before{content:"\eff8"}.ri-pie-chart-fill:before{content:"\eff9"}.ri-pie-chart-line:before{content:"\effa"}.ri-pin-distance-fill:before{content:"\effb"}.ri-pin-distance-line:before{content:"\effc"}.ri-ping-pong-fill:before{content:"\effd"}.ri-ping-pong-line:before{content:"\effe"}.ri-pinterest-fill:before{content:"\efff"}.ri-pinterest-line:before{content:"\f000"}.ri-pinyin-input:before{content:"\f001"}.ri-pixelfed-fill:before{content:"\f002"}.ri-pixelfed-line:before{content:"\f003"}.ri-plane-fill:before{content:"\f004"}.ri-plane-line:before{content:"\f005"}.ri-plant-fill:before{content:"\f006"}.ri-plant-line:before{content:"\f007"}.ri-play-circle-fill:before{content:"\f008"}.ri-play-circle-line:before{content:"\f009"}.ri-play-fill:before{content:"\f00a"}.ri-play-line:before{content:"\f00b"}.ri-play-list-2-fill:before{content:"\f00c"}.ri-play-list-2-line:before{content:"\f00d"}.ri-play-list-add-fill:before{content:"\f00e"}.ri-play-list-add-line:before{content:"\f00f"}.ri-play-list-fill:before{content:"\f010"}.ri-play-list-line:before{content:"\f011"}.ri-play-mini-fill:before{content:"\f012"}.ri-play-mini-line:before{content:"\f013"}.ri-playstation-fill:before{content:"\f014"}.ri-playstation-line:before{content:"\f015"}.ri-plug-2-fill:before{content:"\f016"}.ri-plug-2-line:before{content:"\f017"}.ri-plug-fill:before{content:"\f018"}.ri-plug-line:before{content:"\f019"}.ri-polaroid-2-fill:before{content:"\f01a"}.ri-polaroid-2-line:before{content:"\f01b"}.ri-polaroid-fill:before{content:"\f01c"}.ri-polaroid-line:before{content:"\f01d"}.ri-police-car-fill:before{content:"\f01e"}.ri-police-car-line:before{content:"\f01f"}.ri-price-tag-2-fill:before{content:"\f020"}.ri-price-tag-2-line:before{content:"\f021"}.ri-price-tag-3-fill:before{content:"\f022"}.ri-price-tag-3-line:before{content:"\f023"}.ri-price-tag-fill:before{content:"\f024"}.ri-price-tag-line:before{content:"\f025"}.ri-printer-cloud-fill:before{content:"\f026"}.ri-printer-cloud-line:before{content:"\f027"}.ri-printer-fill:before{content:"\f028"}.ri-printer-line:before{content:"\f029"}.ri-product-hunt-fill:before{content:"\f02a"}.ri-product-hunt-line:before{content:"\f02b"}.ri-profile-fill:before{content:"\f02c"}.ri-profile-line:before{content:"\f02d"}.ri-projector-2-fill:before{content:"\f02e"}.ri-projector-2-line:before{content:"\f02f"}.ri-projector-fill:before{content:"\f030"}.ri-projector-line:before{content:"\f031"}.ri-psychotherapy-fill:before{content:"\f032"}.ri-psychotherapy-line:before{content:"\f033"}.ri-pulse-fill:before{content:"\f034"}.ri-pulse-line:before{content:"\f035"}.ri-pushpin-2-fill:before{content:"\f036"}.ri-pushpin-2-line:before{content:"\f037"}.ri-pushpin-fill:before{content:"\f038"}.ri-pushpin-line:before{content:"\f039"}.ri-qq-fill:before{content:"\f03a"}.ri-qq-line:before{content:"\f03b"}.ri-qr-code-fill:before{content:"\f03c"}.ri-qr-code-line:before{content:"\f03d"}.ri-qr-scan-2-fill:before{content:"\f03e"}.ri-qr-scan-2-line:before{content:"\f03f"}.ri-qr-scan-fill:before{content:"\f040"}.ri-qr-scan-line:before{content:"\f041"}.ri-question-answer-fill:before{content:"\f042"}.ri-question-answer-line:before{content:"\f043"}.ri-question-fill:before{content:"\f044"}.ri-question-line:before{content:"\f045"}.ri-question-mark:before{content:"\f046"}.ri-questionnaire-fill:before{content:"\f047"}.ri-questionnaire-line:before{content:"\f048"}.ri-quill-pen-fill:before{content:"\f049"}.ri-quill-pen-line:before{content:"\f04a"}.ri-radar-fill:before{content:"\f04b"}.ri-radar-line:before{content:"\f04c"}.ri-radio-2-fill:before{content:"\f04d"}.ri-radio-2-line:before{content:"\f04e"}.ri-radio-button-fill:before{content:"\f04f"}.ri-radio-button-line:before{content:"\f050"}.ri-radio-fill:before{content:"\f051"}.ri-radio-line:before{content:"\f052"}.ri-rainbow-fill:before{content:"\f053"}.ri-rainbow-line:before{content:"\f054"}.ri-rainy-fill:before{content:"\f055"}.ri-rainy-line:before{content:"\f056"}.ri-reactjs-fill:before{content:"\f057"}.ri-reactjs-line:before{content:"\f058"}.ri-record-circle-fill:before{content:"\f059"}.ri-record-circle-line:before{content:"\f05a"}.ri-record-mail-fill:before{content:"\f05b"}.ri-record-mail-line:before{content:"\f05c"}.ri-recycle-fill:before{content:"\f05d"}.ri-recycle-line:before{content:"\f05e"}.ri-red-packet-fill:before{content:"\f05f"}.ri-red-packet-line:before{content:"\f060"}.ri-reddit-fill:before{content:"\f061"}.ri-reddit-line:before{content:"\f062"}.ri-refresh-fill:before{content:"\f063"}.ri-refresh-line:before{content:"\f064"}.ri-refund-2-fill:before{content:"\f065"}.ri-refund-2-line:before{content:"\f066"}.ri-refund-fill:before{content:"\f067"}.ri-refund-line:before{content:"\f068"}.ri-registered-fill:before{content:"\f069"}.ri-registered-line:before{content:"\f06a"}.ri-remixicon-fill:before{content:"\f06b"}.ri-remixicon-line:before{content:"\f06c"}.ri-remote-control-2-fill:before{content:"\f06d"}.ri-remote-control-2-line:before{content:"\f06e"}.ri-remote-control-fill:before{content:"\f06f"}.ri-remote-control-line:before{content:"\f070"}.ri-repeat-2-fill:before{content:"\f071"}.ri-repeat-2-line:before{content:"\f072"}.ri-repeat-fill:before{content:"\f073"}.ri-repeat-line:before{content:"\f074"}.ri-repeat-one-fill:before{content:"\f075"}.ri-repeat-one-line:before{content:"\f076"}.ri-reply-all-fill:before{content:"\f077"}.ri-reply-all-line:before{content:"\f078"}.ri-reply-fill:before{content:"\f079"}.ri-reply-line:before{content:"\f07a"}.ri-reserved-fill:before{content:"\f07b"}.ri-reserved-line:before{content:"\f07c"}.ri-rest-time-fill:before{content:"\f07d"}.ri-rest-time-line:before{content:"\f07e"}.ri-restart-fill:before{content:"\f07f"}.ri-restart-line:before{content:"\f080"}.ri-restaurant-2-fill:before{content:"\f081"}.ri-restaurant-2-line:before{content:"\f082"}.ri-restaurant-fill:before{content:"\f083"}.ri-restaurant-line:before{content:"\f084"}.ri-rewind-fill:before{content:"\f085"}.ri-rewind-line:before{content:"\f086"}.ri-rewind-mini-fill:before{content:"\f087"}.ri-rewind-mini-line:before{content:"\f088"}.ri-rhythm-fill:before{content:"\f089"}.ri-rhythm-line:before{content:"\f08a"}.ri-riding-fill:before{content:"\f08b"}.ri-riding-line:before{content:"\f08c"}.ri-road-map-fill:before{content:"\f08d"}.ri-road-map-line:before{content:"\f08e"}.ri-roadster-fill:before{content:"\f08f"}.ri-roadster-line:before{content:"\f090"}.ri-robot-fill:before{content:"\f091"}.ri-robot-line:before{content:"\f092"}.ri-rocket-2-fill:before{content:"\f093"}.ri-rocket-2-line:before{content:"\f094"}.ri-rocket-fill:before{content:"\f095"}.ri-rocket-line:before{content:"\f096"}.ri-rotate-lock-fill:before{content:"\f097"}.ri-rotate-lock-line:before{content:"\f098"}.ri-rounded-corner:before{content:"\f099"}.ri-route-fill:before{content:"\f09a"}.ri-route-line:before{content:"\f09b"}.ri-router-fill:before{content:"\f09c"}.ri-router-line:before{content:"\f09d"}.ri-rss-fill:before{content:"\f09e"}.ri-rss-line:before{content:"\f09f"}.ri-ruler-2-fill:before{content:"\f0a0"}.ri-ruler-2-line:before{content:"\f0a1"}.ri-ruler-fill:before{content:"\f0a2"}.ri-ruler-line:before{content:"\f0a3"}.ri-run-fill:before{content:"\f0a4"}.ri-run-line:before{content:"\f0a5"}.ri-safari-fill:before{content:"\f0a6"}.ri-safari-line:before{content:"\f0a7"}.ri-safe-2-fill:before{content:"\f0a8"}.ri-safe-2-line:before{content:"\f0a9"}.ri-safe-fill:before{content:"\f0aa"}.ri-safe-line:before{content:"\f0ab"}.ri-sailboat-fill:before{content:"\f0ac"}.ri-sailboat-line:before{content:"\f0ad"}.ri-save-2-fill:before{content:"\f0ae"}.ri-save-2-line:before{content:"\f0af"}.ri-save-3-fill:before{content:"\f0b0"}.ri-save-3-line:before{content:"\f0b1"}.ri-save-fill:before{content:"\f0b2"}.ri-save-line:before{content:"\f0b3"}.ri-scales-2-fill:before{content:"\f0b4"}.ri-scales-2-line:before{content:"\f0b5"}.ri-scales-3-fill:before{content:"\f0b6"}.ri-scales-3-line:before{content:"\f0b7"}.ri-scales-fill:before{content:"\f0b8"}.ri-scales-line:before{content:"\f0b9"}.ri-scan-2-fill:before{content:"\f0ba"}.ri-scan-2-line:before{content:"\f0bb"}.ri-scan-fill:before{content:"\f0bc"}.ri-scan-line:before{content:"\f0bd"}.ri-scissors-2-fill:before{content:"\f0be"}.ri-scissors-2-line:before{content:"\f0bf"}.ri-scissors-cut-fill:before{content:"\f0c0"}.ri-scissors-cut-line:before{content:"\f0c1"}.ri-scissors-fill:before{content:"\f0c2"}.ri-scissors-line:before{content:"\f0c3"}.ri-screenshot-2-fill:before{content:"\f0c4"}.ri-screenshot-2-line:before{content:"\f0c5"}.ri-screenshot-fill:before{content:"\f0c6"}.ri-screenshot-line:before{content:"\f0c7"}.ri-sd-card-fill:before{content:"\f0c8"}.ri-sd-card-line:before{content:"\f0c9"}.ri-sd-card-mini-fill:before{content:"\f0ca"}.ri-sd-card-mini-line:before{content:"\f0cb"}.ri-search-2-fill:before{content:"\f0cc"}.ri-search-2-line:before{content:"\f0cd"}.ri-search-eye-fill:before{content:"\f0ce"}.ri-search-eye-line:before{content:"\f0cf"}.ri-search-fill:before{content:"\f0d0"}.ri-search-line:before{content:"\f0d1"}.ri-secure-payment-fill:before{content:"\f0d2"}.ri-secure-payment-line:before{content:"\f0d3"}.ri-seedling-fill:before{content:"\f0d4"}.ri-seedling-line:before{content:"\f0d5"}.ri-send-backward:before{content:"\f0d6"}.ri-send-plane-2-fill:before{content:"\f0d7"}.ri-send-plane-2-line:before{content:"\f0d8"}.ri-send-plane-fill:before{content:"\f0d9"}.ri-send-plane-line:before{content:"\f0da"}.ri-send-to-back:before{content:"\f0db"}.ri-sensor-fill:before{content:"\f0dc"}.ri-sensor-line:before{content:"\f0dd"}.ri-separator:before{content:"\f0de"}.ri-server-fill:before{content:"\f0df"}.ri-server-line:before{content:"\f0e0"}.ri-service-fill:before{content:"\f0e1"}.ri-service-line:before{content:"\f0e2"}.ri-settings-2-fill:before{content:"\f0e3"}.ri-settings-2-line:before{content:"\f0e4"}.ri-settings-3-fill:before{content:"\f0e5"}.ri-settings-3-line:before{content:"\f0e6"}.ri-settings-4-fill:before{content:"\f0e7"}.ri-settings-4-line:before{content:"\f0e8"}.ri-settings-5-fill:before{content:"\f0e9"}.ri-settings-5-line:before{content:"\f0ea"}.ri-settings-6-fill:before{content:"\f0eb"}.ri-settings-6-line:before{content:"\f0ec"}.ri-settings-fill:before{content:"\f0ed"}.ri-settings-line:before{content:"\f0ee"}.ri-shape-2-fill:before{content:"\f0ef"}.ri-shape-2-line:before{content:"\f0f0"}.ri-shape-fill:before{content:"\f0f1"}.ri-shape-line:before{content:"\f0f2"}.ri-share-box-fill:before{content:"\f0f3"}.ri-share-box-line:before{content:"\f0f4"}.ri-share-circle-fill:before{content:"\f0f5"}.ri-share-circle-line:before{content:"\f0f6"}.ri-share-fill:before{content:"\f0f7"}.ri-share-forward-2-fill:before{content:"\f0f8"}.ri-share-forward-2-line:before{content:"\f0f9"}.ri-share-forward-box-fill:before{content:"\f0fa"}.ri-share-forward-box-line:before{content:"\f0fb"}.ri-share-forward-fill:before{content:"\f0fc"}.ri-share-forward-line:before{content:"\f0fd"}.ri-share-line:before{content:"\f0fe"}.ri-shield-check-fill:before{content:"\f0ff"}.ri-shield-check-line:before{content:"\f100"}.ri-shield-cross-fill:before{content:"\f101"}.ri-shield-cross-line:before{content:"\f102"}.ri-shield-fill:before{content:"\f103"}.ri-shield-flash-fill:before{content:"\f104"}.ri-shield-flash-line:before{content:"\f105"}.ri-shield-keyhole-fill:before{content:"\f106"}.ri-shield-keyhole-line:before{content:"\f107"}.ri-shield-line:before{content:"\f108"}.ri-shield-star-fill:before{content:"\f109"}.ri-shield-star-line:before{content:"\f10a"}.ri-shield-user-fill:before{content:"\f10b"}.ri-shield-user-line:before{content:"\f10c"}.ri-ship-2-fill:before{content:"\f10d"}.ri-ship-2-line:before{content:"\f10e"}.ri-ship-fill:before{content:"\f10f"}.ri-ship-line:before{content:"\f110"}.ri-shirt-fill:before{content:"\f111"}.ri-shirt-line:before{content:"\f112"}.ri-shopping-bag-2-fill:before{content:"\f113"}.ri-shopping-bag-2-line:before{content:"\f114"}.ri-shopping-bag-3-fill:before{content:"\f115"}.ri-shopping-bag-3-line:before{content:"\f116"}.ri-shopping-bag-fill:before{content:"\f117"}.ri-shopping-bag-line:before{content:"\f118"}.ri-shopping-basket-2-fill:before{content:"\f119"}.ri-shopping-basket-2-line:before{content:"\f11a"}.ri-shopping-basket-fill:before{content:"\f11b"}.ri-shopping-basket-line:before{content:"\f11c"}.ri-shopping-cart-2-fill:before{content:"\f11d"}.ri-shopping-cart-2-line:before{content:"\f11e"}.ri-shopping-cart-fill:before{content:"\f11f"}.ri-shopping-cart-line:before{content:"\f120"}.ri-showers-fill:before{content:"\f121"}.ri-showers-line:before{content:"\f122"}.ri-shuffle-fill:before{content:"\f123"}.ri-shuffle-line:before{content:"\f124"}.ri-shut-down-fill:before{content:"\f125"}.ri-shut-down-line:before{content:"\f126"}.ri-side-bar-fill:before{content:"\f127"}.ri-side-bar-line:before{content:"\f128"}.ri-signal-tower-fill:before{content:"\f129"}.ri-signal-tower-line:before{content:"\f12a"}.ri-signal-wifi-1-fill:before{content:"\f12b"}.ri-signal-wifi-1-line:before{content:"\f12c"}.ri-signal-wifi-2-fill:before{content:"\f12d"}.ri-signal-wifi-2-line:before{content:"\f12e"}.ri-signal-wifi-3-fill:before{content:"\f12f"}.ri-signal-wifi-3-line:before{content:"\f130"}.ri-signal-wifi-error-fill:before{content:"\f131"}.ri-signal-wifi-error-line:before{content:"\f132"}.ri-signal-wifi-fill:before{content:"\f133"}.ri-signal-wifi-line:before{content:"\f134"}.ri-signal-wifi-off-fill:before{content:"\f135"}.ri-signal-wifi-off-line:before{content:"\f136"}.ri-sim-card-2-fill:before{content:"\f137"}.ri-sim-card-2-line:before{content:"\f138"}.ri-sim-card-fill:before{content:"\f139"}.ri-sim-card-line:before{content:"\f13a"}.ri-single-quotes-l:before{content:"\f13b"}.ri-single-quotes-r:before{content:"\f13c"}.ri-sip-fill:before{content:"\f13d"}.ri-sip-line:before{content:"\f13e"}.ri-skip-back-fill:before{content:"\f13f"}.ri-skip-back-line:before{content:"\f140"}.ri-skip-back-mini-fill:before{content:"\f141"}.ri-skip-back-mini-line:before{content:"\f142"}.ri-skip-forward-fill:before{content:"\f143"}.ri-skip-forward-line:before{content:"\f144"}.ri-skip-forward-mini-fill:before{content:"\f145"}.ri-skip-forward-mini-line:before{content:"\f146"}.ri-skull-2-fill:before{content:"\f147"}.ri-skull-2-line:before{content:"\f148"}.ri-skull-fill:before{content:"\f149"}.ri-skull-line:before{content:"\f14a"}.ri-skype-fill:before{content:"\f14b"}.ri-skype-line:before{content:"\f14c"}.ri-slack-fill:before{content:"\f14d"}.ri-slack-line:before{content:"\f14e"}.ri-slice-fill:before{content:"\f14f"}.ri-slice-line:before{content:"\f150"}.ri-slideshow-2-fill:before{content:"\f151"}.ri-slideshow-2-line:before{content:"\f152"}.ri-slideshow-3-fill:before{content:"\f153"}.ri-slideshow-3-line:before{content:"\f154"}.ri-slideshow-4-fill:before{content:"\f155"}.ri-slideshow-4-line:before{content:"\f156"}.ri-slideshow-fill:before{content:"\f157"}.ri-slideshow-line:before{content:"\f158"}.ri-smartphone-fill:before{content:"\f159"}.ri-smartphone-line:before{content:"\f15a"}.ri-snapchat-fill:before{content:"\f15b"}.ri-snapchat-line:before{content:"\f15c"}.ri-snowy-fill:before{content:"\f15d"}.ri-snowy-line:before{content:"\f15e"}.ri-sort-asc:before{content:"\f15f"}.ri-sort-desc:before{content:"\f160"}.ri-sound-module-fill:before{content:"\f161"}.ri-sound-module-line:before{content:"\f162"}.ri-soundcloud-fill:before{content:"\f163"}.ri-soundcloud-line:before{content:"\f164"}.ri-space-ship-fill:before{content:"\f165"}.ri-space-ship-line:before{content:"\f166"}.ri-space:before{content:"\f167"}.ri-spam-2-fill:before{content:"\f168"}.ri-spam-2-line:before{content:"\f169"}.ri-spam-3-fill:before{content:"\f16a"}.ri-spam-3-line:before{content:"\f16b"}.ri-spam-fill:before{content:"\f16c"}.ri-spam-line:before{content:"\f16d"}.ri-speaker-2-fill:before{content:"\f16e"}.ri-speaker-2-line:before{content:"\f16f"}.ri-speaker-3-fill:before{content:"\f170"}.ri-speaker-3-line:before{content:"\f171"}.ri-speaker-fill:before{content:"\f172"}.ri-speaker-line:before{content:"\f173"}.ri-spectrum-fill:before{content:"\f174"}.ri-spectrum-line:before{content:"\f175"}.ri-speed-fill:before{content:"\f176"}.ri-speed-line:before{content:"\f177"}.ri-speed-mini-fill:before{content:"\f178"}.ri-speed-mini-line:before{content:"\f179"}.ri-split-cells-horizontal:before{content:"\f17a"}.ri-split-cells-vertical:before{content:"\f17b"}.ri-spotify-fill:before{content:"\f17c"}.ri-spotify-line:before{content:"\f17d"}.ri-spy-fill:before{content:"\f17e"}.ri-spy-line:before{content:"\f17f"}.ri-stack-fill:before{content:"\f180"}.ri-stack-line:before{content:"\f181"}.ri-stack-overflow-fill:before{content:"\f182"}.ri-stack-overflow-line:before{content:"\f183"}.ri-stackshare-fill:before{content:"\f184"}.ri-stackshare-line:before{content:"\f185"}.ri-star-fill:before{content:"\f186"}.ri-star-half-fill:before{content:"\f187"}.ri-star-half-line:before{content:"\f188"}.ri-star-half-s-fill:before{content:"\f189"}.ri-star-half-s-line:before{content:"\f18a"}.ri-star-line:before{content:"\f18b"}.ri-star-s-fill:before{content:"\f18c"}.ri-star-s-line:before{content:"\f18d"}.ri-star-smile-fill:before{content:"\f18e"}.ri-star-smile-line:before{content:"\f18f"}.ri-steam-fill:before{content:"\f190"}.ri-steam-line:before{content:"\f191"}.ri-steering-2-fill:before{content:"\f192"}.ri-steering-2-line:before{content:"\f193"}.ri-steering-fill:before{content:"\f194"}.ri-steering-line:before{content:"\f195"}.ri-stethoscope-fill:before{content:"\f196"}.ri-stethoscope-line:before{content:"\f197"}.ri-sticky-note-2-fill:before{content:"\f198"}.ri-sticky-note-2-line:before{content:"\f199"}.ri-sticky-note-fill:before{content:"\f19a"}.ri-sticky-note-line:before{content:"\f19b"}.ri-stock-fill:before{content:"\f19c"}.ri-stock-line:before{content:"\f19d"}.ri-stop-circle-fill:before{content:"\f19e"}.ri-stop-circle-line:before{content:"\f19f"}.ri-stop-fill:before{content:"\f1a0"}.ri-stop-line:before{content:"\f1a1"}.ri-stop-mini-fill:before{content:"\f1a2"}.ri-stop-mini-line:before{content:"\f1a3"}.ri-store-2-fill:before{content:"\f1a4"}.ri-store-2-line:before{content:"\f1a5"}.ri-store-3-fill:before{content:"\f1a6"}.ri-store-3-line:before{content:"\f1a7"}.ri-store-fill:before{content:"\f1a8"}.ri-store-line:before{content:"\f1a9"}.ri-strikethrough-2:before{content:"\f1aa"}.ri-strikethrough:before{content:"\f1ab"}.ri-subscript-2:before{content:"\f1ac"}.ri-subscript:before{content:"\f1ad"}.ri-subtract-fill:before{content:"\f1ae"}.ri-subtract-line:before{content:"\f1af"}.ri-subway-fill:before{content:"\f1b0"}.ri-subway-line:before{content:"\f1b1"}.ri-subway-wifi-fill:before{content:"\f1b2"}.ri-subway-wifi-line:before{content:"\f1b3"}.ri-suitcase-2-fill:before{content:"\f1b4"}.ri-suitcase-2-line:before{content:"\f1b5"}.ri-suitcase-3-fill:before{content:"\f1b6"}.ri-suitcase-3-line:before{content:"\f1b7"}.ri-suitcase-fill:before{content:"\f1b8"}.ri-suitcase-line:before{content:"\f1b9"}.ri-sun-cloudy-fill:before{content:"\f1ba"}.ri-sun-cloudy-line:before{content:"\f1bb"}.ri-sun-fill:before{content:"\f1bc"}.ri-sun-foggy-fill:before{content:"\f1bd"}.ri-sun-foggy-line:before{content:"\f1be"}.ri-sun-line:before{content:"\f1bf"}.ri-superscript-2:before{content:"\f1c0"}.ri-superscript:before{content:"\f1c1"}.ri-surgical-mask-fill:before{content:"\f1c2"}.ri-surgical-mask-line:before{content:"\f1c3"}.ri-surround-sound-fill:before{content:"\f1c4"}.ri-surround-sound-line:before{content:"\f1c5"}.ri-survey-fill:before{content:"\f1c6"}.ri-survey-line:before{content:"\f1c7"}.ri-swap-box-fill:before{content:"\f1c8"}.ri-swap-box-line:before{content:"\f1c9"}.ri-swap-fill:before{content:"\f1ca"}.ri-swap-line:before{content:"\f1cb"}.ri-switch-fill:before{content:"\f1cc"}.ri-switch-line:before{content:"\f1cd"}.ri-sword-fill:before{content:"\f1ce"}.ri-sword-line:before{content:"\f1cf"}.ri-syringe-fill:before{content:"\f1d0"}.ri-syringe-line:before{content:"\f1d1"}.ri-t-box-fill:before{content:"\f1d2"}.ri-t-box-line:before{content:"\f1d3"}.ri-t-shirt-2-fill:before{content:"\f1d4"}.ri-t-shirt-2-line:before{content:"\f1d5"}.ri-t-shirt-air-fill:before{content:"\f1d6"}.ri-t-shirt-air-line:before{content:"\f1d7"}.ri-t-shirt-fill:before{content:"\f1d8"}.ri-t-shirt-line:before{content:"\f1d9"}.ri-table-2:before{content:"\f1da"}.ri-table-alt-fill:before{content:"\f1db"}.ri-table-alt-line:before{content:"\f1dc"}.ri-table-fill:before{content:"\f1dd"}.ri-table-line:before{content:"\f1de"}.ri-tablet-fill:before{content:"\f1df"}.ri-tablet-line:before{content:"\f1e0"}.ri-takeaway-fill:before{content:"\f1e1"}.ri-takeaway-line:before{content:"\f1e2"}.ri-taobao-fill:before{content:"\f1e3"}.ri-taobao-line:before{content:"\f1e4"}.ri-tape-fill:before{content:"\f1e5"}.ri-tape-line:before{content:"\f1e6"}.ri-task-fill:before{content:"\f1e7"}.ri-task-line:before{content:"\f1e8"}.ri-taxi-fill:before{content:"\f1e9"}.ri-taxi-line:before{content:"\f1ea"}.ri-taxi-wifi-fill:before{content:"\f1eb"}.ri-taxi-wifi-line:before{content:"\f1ec"}.ri-team-fill:before{content:"\f1ed"}.ri-team-line:before{content:"\f1ee"}.ri-telegram-fill:before{content:"\f1ef"}.ri-telegram-line:before{content:"\f1f0"}.ri-temp-cold-fill:before{content:"\f1f1"}.ri-temp-cold-line:before{content:"\f1f2"}.ri-temp-hot-fill:before{content:"\f1f3"}.ri-temp-hot-line:before{content:"\f1f4"}.ri-terminal-box-fill:before{content:"\f1f5"}.ri-terminal-box-line:before{content:"\f1f6"}.ri-terminal-fill:before{content:"\f1f7"}.ri-terminal-line:before{content:"\f1f8"}.ri-terminal-window-fill:before{content:"\f1f9"}.ri-terminal-window-line:before{content:"\f1fa"}.ri-test-tube-fill:before{content:"\f1fb"}.ri-test-tube-line:before{content:"\f1fc"}.ri-text-direction-l:before{content:"\f1fd"}.ri-text-direction-r:before{content:"\f1fe"}.ri-text-spacing:before{content:"\f1ff"}.ri-text-wrap:before{content:"\f200"}.ri-text:before{content:"\f201"}.ri-thermometer-fill:before{content:"\f202"}.ri-thermometer-line:before{content:"\f203"}.ri-thumb-down-fill:before{content:"\f204"}.ri-thumb-down-line:before{content:"\f205"}.ri-thumb-up-fill:before{content:"\f206"}.ri-thumb-up-line:before{content:"\f207"}.ri-thunderstorms-fill:before{content:"\f208"}.ri-thunderstorms-line:before{content:"\f209"}.ri-ticket-2-fill:before{content:"\f20a"}.ri-ticket-2-line:before{content:"\f20b"}.ri-ticket-fill:before{content:"\f20c"}.ri-ticket-line:before{content:"\f20d"}.ri-time-fill:before{content:"\f20e"}.ri-time-line:before{content:"\f20f"}.ri-timer-2-fill:before{content:"\f210"}.ri-timer-2-line:before{content:"\f211"}.ri-timer-fill:before{content:"\f212"}.ri-timer-flash-fill:before{content:"\f213"}.ri-timer-flash-line:before{content:"\f214"}.ri-timer-line:before{content:"\f215"}.ri-todo-fill:before{content:"\f216"}.ri-todo-line:before{content:"\f217"}.ri-toggle-fill:before{content:"\f218"}.ri-toggle-line:before{content:"\f219"}.ri-tools-fill:before{content:"\f21a"}.ri-tools-line:before{content:"\f21b"}.ri-tornado-fill:before{content:"\f21c"}.ri-tornado-line:before{content:"\f21d"}.ri-trademark-fill:before{content:"\f21e"}.ri-trademark-line:before{content:"\f21f"}.ri-traffic-light-fill:before{content:"\f220"}.ri-traffic-light-line:before{content:"\f221"}.ri-train-fill:before{content:"\f222"}.ri-train-line:before{content:"\f223"}.ri-train-wifi-fill:before{content:"\f224"}.ri-train-wifi-line:before{content:"\f225"}.ri-translate-2:before{content:"\f226"}.ri-translate:before{content:"\f227"}.ri-travesti-fill:before{content:"\f228"}.ri-travesti-line:before{content:"\f229"}.ri-treasure-map-fill:before{content:"\f22a"}.ri-treasure-map-line:before{content:"\f22b"}.ri-trello-fill:before{content:"\f22c"}.ri-trello-line:before{content:"\f22d"}.ri-trophy-fill:before{content:"\f22e"}.ri-trophy-line:before{content:"\f22f"}.ri-truck-fill:before{content:"\f230"}.ri-truck-line:before{content:"\f231"}.ri-tumblr-fill:before{content:"\f232"}.ri-tumblr-line:before{content:"\f233"}.ri-tv-2-fill:before{content:"\f234"}.ri-tv-2-line:before{content:"\f235"}.ri-tv-fill:before{content:"\f236"}.ri-tv-line:before{content:"\f237"}.ri-twitch-fill:before{content:"\f238"}.ri-twitch-line:before{content:"\f239"}.ri-twitter-fill:before{content:"\f23a"}.ri-twitter-line:before{content:"\f23b"}.ri-typhoon-fill:before{content:"\f23c"}.ri-typhoon-line:before{content:"\f23d"}.ri-u-disk-fill:before{content:"\f23e"}.ri-u-disk-line:before{content:"\f23f"}.ri-ubuntu-fill:before{content:"\f240"}.ri-ubuntu-line:before{content:"\f241"}.ri-umbrella-fill:before{content:"\f242"}.ri-umbrella-line:before{content:"\f243"}.ri-underline:before{content:"\f244"}.ri-uninstall-fill:before{content:"\f245"}.ri-uninstall-line:before{content:"\f246"}.ri-unsplash-fill:before{content:"\f247"}.ri-unsplash-line:before{content:"\f248"}.ri-upload-2-fill:before{content:"\f249"}.ri-upload-2-line:before{content:"\f24a"}.ri-upload-cloud-2-fill:before{content:"\f24b"}.ri-upload-cloud-2-line:before{content:"\f24c"}.ri-upload-cloud-fill:before{content:"\f24d"}.ri-upload-cloud-line:before{content:"\f24e"}.ri-upload-fill:before{content:"\f24f"}.ri-upload-line:before{content:"\f250"}.ri-usb-fill:before{content:"\f251"}.ri-usb-line:before{content:"\f252"}.ri-user-2-fill:before{content:"\f253"}.ri-user-2-line:before{content:"\f254"}.ri-user-3-fill:before{content:"\f255"}.ri-user-3-line:before{content:"\f256"}.ri-user-4-fill:before{content:"\f257"}.ri-user-4-line:before{content:"\f258"}.ri-user-5-fill:before{content:"\f259"}.ri-user-5-line:before{content:"\f25a"}.ri-user-6-fill:before{content:"\f25b"}.ri-user-6-line:before{content:"\f25c"}.ri-user-add-fill:before{content:"\f25d"}.ri-user-add-line:before{content:"\f25e"}.ri-user-fill:before{content:"\f25f"}.ri-user-follow-fill:before{content:"\f260"}.ri-user-follow-line:before{content:"\f261"}.ri-user-heart-fill:before{content:"\f262"}.ri-user-heart-line:before{content:"\f263"}.ri-user-line:before{content:"\f264"}.ri-user-location-fill:before{content:"\f265"}.ri-user-location-line:before{content:"\f266"}.ri-user-received-2-fill:before{content:"\f267"}.ri-user-received-2-line:before{content:"\f268"}.ri-user-received-fill:before{content:"\f269"}.ri-user-received-line:before{content:"\f26a"}.ri-user-search-fill:before{content:"\f26b"}.ri-user-search-line:before{content:"\f26c"}.ri-user-settings-fill:before{content:"\f26d"}.ri-user-settings-line:before{content:"\f26e"}.ri-user-shared-2-fill:before{content:"\f26f"}.ri-user-shared-2-line:before{content:"\f270"}.ri-user-shared-fill:before{content:"\f271"}.ri-user-shared-line:before{content:"\f272"}.ri-user-smile-fill:before{content:"\f273"}.ri-user-smile-line:before{content:"\f274"}.ri-user-star-fill:before{content:"\f275"}.ri-user-star-line:before{content:"\f276"}.ri-user-unfollow-fill:before{content:"\f277"}.ri-user-unfollow-line:before{content:"\f278"}.ri-user-voice-fill:before{content:"\f279"}.ri-user-voice-line:before{content:"\f27a"}.ri-video-add-fill:before{content:"\f27b"}.ri-video-add-line:before{content:"\f27c"}.ri-video-chat-fill:before{content:"\f27d"}.ri-video-chat-line:before{content:"\f27e"}.ri-video-download-fill:before{content:"\f27f"}.ri-video-download-line:before{content:"\f280"}.ri-video-fill:before{content:"\f281"}.ri-video-line:before{content:"\f282"}.ri-video-upload-fill:before{content:"\f283"}.ri-video-upload-line:before{content:"\f284"}.ri-vidicon-2-fill:before{content:"\f285"}.ri-vidicon-2-line:before{content:"\f286"}.ri-vidicon-fill:before{content:"\f287"}.ri-vidicon-line:before{content:"\f288"}.ri-vimeo-fill:before{content:"\f289"}.ri-vimeo-line:before{content:"\f28a"}.ri-vip-crown-2-fill:before{content:"\f28b"}.ri-vip-crown-2-line:before{content:"\f28c"}.ri-vip-crown-fill:before{content:"\f28d"}.ri-vip-crown-line:before{content:"\f28e"}.ri-vip-diamond-fill:before{content:"\f28f"}.ri-vip-diamond-line:before{content:"\f290"}.ri-vip-fill:before{content:"\f291"}.ri-vip-line:before{content:"\f292"}.ri-virus-fill:before{content:"\f293"}.ri-virus-line:before{content:"\f294"}.ri-visa-fill:before{content:"\f295"}.ri-visa-line:before{content:"\f296"}.ri-voice-recognition-fill:before{content:"\f297"}.ri-voice-recognition-line:before{content:"\f298"}.ri-voiceprint-fill:before{content:"\f299"}.ri-voiceprint-line:before{content:"\f29a"}.ri-volume-down-fill:before{content:"\f29b"}.ri-volume-down-line:before{content:"\f29c"}.ri-volume-mute-fill:before{content:"\f29d"}.ri-volume-mute-line:before{content:"\f29e"}.ri-volume-off-vibrate-fill:before{content:"\f29f"}.ri-volume-off-vibrate-line:before{content:"\f2a0"}.ri-volume-up-fill:before{content:"\f2a1"}.ri-volume-up-line:before{content:"\f2a2"}.ri-volume-vibrate-fill:before{content:"\f2a3"}.ri-volume-vibrate-line:before{content:"\f2a4"}.ri-vuejs-fill:before{content:"\f2a5"}.ri-vuejs-line:before{content:"\f2a6"}.ri-walk-fill:before{content:"\f2a7"}.ri-walk-line:before{content:"\f2a8"}.ri-wallet-2-fill:before{content:"\f2a9"}.ri-wallet-2-line:before{content:"\f2aa"}.ri-wallet-3-fill:before{content:"\f2ab"}.ri-wallet-3-line:before{content:"\f2ac"}.ri-wallet-fill:before{content:"\f2ad"}.ri-wallet-line:before{content:"\f2ae"}.ri-water-flash-fill:before{content:"\f2af"}.ri-water-flash-line:before{content:"\f2b0"}.ri-webcam-fill:before{content:"\f2b1"}.ri-webcam-line:before{content:"\f2b2"}.ri-wechat-2-fill:before{content:"\f2b3"}.ri-wechat-2-line:before{content:"\f2b4"}.ri-wechat-fill:before{content:"\f2b5"}.ri-wechat-line:before{content:"\f2b6"}.ri-wechat-pay-fill:before{content:"\f2b7"}.ri-wechat-pay-line:before{content:"\f2b8"}.ri-weibo-fill:before{content:"\f2b9"}.ri-weibo-line:before{content:"\f2ba"}.ri-whatsapp-fill:before{content:"\f2bb"}.ri-whatsapp-line:before{content:"\f2bc"}.ri-wheelchair-fill:before{content:"\f2bd"}.ri-wheelchair-line:before{content:"\f2be"}.ri-wifi-fill:before{content:"\f2bf"}.ri-wifi-line:before{content:"\f2c0"}.ri-wifi-off-fill:before{content:"\f2c1"}.ri-wifi-off-line:before{content:"\f2c2"}.ri-window-2-fill:before{content:"\f2c3"}.ri-window-2-line:before{content:"\f2c4"}.ri-window-fill:before{content:"\f2c5"}.ri-window-line:before{content:"\f2c6"}.ri-windows-fill:before{content:"\f2c7"}.ri-windows-line:before{content:"\f2c8"}.ri-windy-fill:before{content:"\f2c9"}.ri-windy-line:before{content:"\f2ca"}.ri-wireless-charging-fill:before{content:"\f2cb"}.ri-wireless-charging-line:before{content:"\f2cc"}.ri-women-fill:before{content:"\f2cd"}.ri-women-line:before{content:"\f2ce"}.ri-wubi-input:before{content:"\f2cf"}.ri-xbox-fill:before{content:"\f2d0"}.ri-xbox-line:before{content:"\f2d1"}.ri-xing-fill:before{content:"\f2d2"}.ri-xing-line:before{content:"\f2d3"}.ri-youtube-fill:before{content:"\f2d4"}.ri-youtube-line:before{content:"\f2d5"}.ri-zcool-fill:before{content:"\f2d6"}.ri-zcool-line:before{content:"\f2d7"}.ri-zhihu-fill:before{content:"\f2d8"}.ri-zhihu-line:before{content:"\f2d9"}.ri-zoom-in-fill:before{content:"\f2da"}.ri-zoom-in-line:before{content:"\f2db"}.ri-zoom-out-fill:before{content:"\f2dc"}.ri-zoom-out-line:before{content:"\f2dd"}.ri-zzz-fill:before{content:"\f2de"}.ri-zzz-line:before{content:"\f2df"}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes expand{0%{transform:rotateY(90deg)}to{opacity:1;transform:rotateY(0)}}@keyframes slideIn{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes shine{to{background-position-x:-200%}}@keyframes loaderShow{0%{opacity:0;transform:scale(0)}to{opacity:1;transform:scale(1)}}@keyframes entranceLeft{0%{opacity:0;transform:translate(-5px)}to{opacity:1;transform:translate(0)}}@keyframes entranceRight{0%{opacity:0;transform:translate(5px)}to{opacity:1;transform:translate(0)}}@keyframes entranceTop{0%{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:translateY(0)}}@keyframes entranceBottom{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}@media screen and (min-width: 550px){::-webkit-scrollbar{width:8px;height:8px;border-radius:var(--baseRadius)}::-webkit-scrollbar-track{background:transparent;border-radius:var(--baseRadius)}::-webkit-scrollbar-thumb{background-color:var(--baseAlt2Color);border-radius:15px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-thumb:hover,::-webkit-scrollbar-thumb:active{background-color:var(--baseAlt3Color)}html{scrollbar-color:var(--baseAlt2Color) transparent;scrollbar-width:thin;scroll-behavior:smooth}html *{scrollbar-width:inherit}}:focus-visible{outline-color:var(--primaryColor);outline-style:solid}html,body{line-height:var(--baseLineHeight);font-family:var(--baseFontFamily);font-size:var(--baseFontSize);color:var(--txtPrimaryColor);background:var(--bodyColor)}#app{overflow:auto;display:block;width:100%;height:100vh}.flatpickr-inline-container,.accordion .accordion-content,.accordion,.tabs,.tabs-content,.form-field-file .files-list,.select .txt-missing,.form-field .form-field-block,.list,.skeleton-loader,.clearfix,.content,.form-field .help-block,.overlay-panel .panel-content,.sub-panel,.panel,.block,.code-block,blockquote,p{display:block;width:100%}h1,h2,.breadcrumbs .breadcrumb-item,h3,h4,h5,h6{margin:0;font-weight:400}h1{font-size:22px;line-height:28px}h2,.breadcrumbs .breadcrumb-item{font-size:20px;line-height:26px}h3{font-size:19px;line-height:24px}h4{font-size:18px;line-height:24px}h5{font-size:17px;line-height:24px}h6{font-size:16px;line-height:22px}em{font-style:italic}ins{color:var(--txtPrimaryColor);background:var(--successAltColor);text-decoration:none}del{color:var(--txtPrimaryColor);background:var(--dangerAltColor);text-decoration:none}strong{font-weight:600}small{font-size:var(--smFontSize);line-height:var(--smLineHeight)}sub,sup{position:relative;font-size:.75em;line-height:1}sup{vertical-align:top}sub{vertical-align:bottom}p{margin:5px 0}blockquote{position:relative;padding-left:var(--smSpacing);font-style:italic;color:var(--txtHintColor)}blockquote:before{content:"";position:absolute;top:0;left:0;width:2px;height:100%;background:var(--baseColor)}code{display:inline-block;font-family:var(--monospaceFontFamily);font-style:normal;font-size:var(--lgFontSize);line-height:1.379rem;padding:0 4px;white-space:nowrap;color:var(--txtPrimaryColor);background:var(--baseAlt2Color);border-radius:var(--baseRadius)}.code-block{overflow:auto;padding:var(--xsSpacing);white-space:pre-wrap;background:var(--baseAlt1Color)}ol,ul{margin:10px 0;list-style:decimal;padding-left:var(--baseSpacing)}ol li,ul li{margin-top:5px;margin-bottom:5px}ul{list-style:disc}img{max-width:100%;vertical-align:top}hr{display:block;border:0;height:1px;width:100%;background:var(--baseAlt1Color);margin:var(--baseSpacing) 0}hr.dark{background:var(--baseAlt2Color)}a{color:inherit}a:hover{text-decoration:none}a i,a .txt{display:inline-block;vertical-align:top}.txt-mono{font-family:var(--monospaceFontFamily)}.txt-nowrap{white-space:nowrap}.txt-ellipsis{display:inline-block;vertical-align:top;flex-shrink:0;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.txt-base{font-size:var(--baseFontSize)!important}.txt-xs{font-size:var(--xsFontSize)!important;line-height:var(--smLineHeight)}.txt-sm{font-size:var(--smFontSize)!important;line-height:var(--smLineHeight)}.txt-lg{font-size:var(--lgFontSize)!important}.txt-xl{font-size:var(--xlFontSize)!important}.txt-bold{font-weight:600!important}.txt-strikethrough{text-decoration:line-through!important}.txt-break{white-space:pre-wrap!important}.txt-center{text-align:center!important}.txt-justify{text-align:justify!important}.txt-left{text-align:left!important}.txt-right{text-align:right!important}.txt-main{color:var(--txtPrimaryColor)!important}.txt-hint{color:var(--txtHintColor)!important}.txt-disabled{color:var(--txtDisabledColor)!important}.link-hint{user-select:none;cursor:pointer;color:var(--txtHintColor)!important;text-decoration:none;transition:color var(--baseAnimationSpeed)}.link-hint:hover,.link-hint:focus-visible,.link-hint:active{color:var(--txtPrimaryColor)!important}.link-fade{opacity:1;user-select:none;cursor:pointer;text-decoration:none;color:var(--txtPrimaryColor);transition:opacity var(--baseAnimationSpeed)}.link-fade:focus-visible,.link-fade:hover,.link-fade:active{opacity:.8}.txt-primary{color:var(--primaryColor)!important}.bg-primary{background:var(--primaryColor)!important}.link-primary{cursor:pointer;color:var(--primaryColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-primary:focus-visible,.link-primary:hover,.link-primary:active{opacity:.8}.txt-info{color:var(--infoColor)!important}.bg-info{background:var(--infoColor)!important}.link-info{cursor:pointer;color:var(--infoColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-info:focus-visible,.link-info:hover,.link-info:active{opacity:.8}.txt-info-alt{color:var(--infoAltColor)!important}.bg-info-alt{background:var(--infoAltColor)!important}.link-info-alt{cursor:pointer;color:var(--infoAltColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-info-alt:focus-visible,.link-info-alt:hover,.link-info-alt:active{opacity:.8}.txt-success{color:var(--successColor)!important}.bg-success{background:var(--successColor)!important}.link-success{cursor:pointer;color:var(--successColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-success:focus-visible,.link-success:hover,.link-success:active{opacity:.8}.txt-success-alt{color:var(--successAltColor)!important}.bg-success-alt{background:var(--successAltColor)!important}.link-success-alt{cursor:pointer;color:var(--successAltColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-success-alt:focus-visible,.link-success-alt:hover,.link-success-alt:active{opacity:.8}.txt-danger{color:var(--dangerColor)!important}.bg-danger{background:var(--dangerColor)!important}.link-danger{cursor:pointer;color:var(--dangerColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-danger:focus-visible,.link-danger:hover,.link-danger:active{opacity:.8}.txt-danger-alt{color:var(--dangerAltColor)!important}.bg-danger-alt{background:var(--dangerAltColor)!important}.link-danger-alt{cursor:pointer;color:var(--dangerAltColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-danger-alt:focus-visible,.link-danger-alt:hover,.link-danger-alt:active{opacity:.8}.txt-warning{color:var(--warningColor)!important}.bg-warning{background:var(--warningColor)!important}.link-warning{cursor:pointer;color:var(--warningColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-warning:focus-visible,.link-warning:hover,.link-warning:active{opacity:.8}.txt-warning-alt{color:var(--warningAltColor)!important}.bg-warning-alt{background:var(--warningAltColor)!important}.link-warning-alt{cursor:pointer;color:var(--warningAltColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-warning-alt:focus-visible,.link-warning-alt:hover,.link-warning-alt:active{opacity:.8}.fade{opacity:.6}a.fade,.btn.fade,[tabindex].fade,[class*=link-].fade,.handle.fade{transition:all var(--baseAnimationSpeed)}a.fade:hover,.btn.fade:hover,[tabindex].fade:hover,[class*=link-].fade:hover,.handle.fade:hover{opacity:1}.noborder{border:0px!important}.hidden{display:none!important}.hidden-empty:empty{display:none!important}.content>:first-child,.form-field .help-block>:first-child,.overlay-panel .panel-content>:first-child,.sub-panel>:first-child,.panel>:first-child{margin-top:0}.content>:last-child,.form-field .help-block>:last-child,.overlay-panel .panel-content>:last-child,.sub-panel>:last-child,.panel>:last-child{margin-bottom:0}.panel{background:var(--baseColor);border-radius:var(--lgRadius);padding:calc(var(--baseSpacing) - 5px) var(--baseSpacing);box-shadow:0 2px 5px 0 var(--shadowColor)}.sub-panel{background:var(--baseColor);border-radius:var(--baseRadius);padding:calc(var(--smSpacing) - 5px) var(--smSpacing);border:1px solid var(--baseAlt1Color)}.clearfix{clear:both}.clearfix:after{content:"";display:table;clear:both}.flex{position:relative;display:flex;align-items:center;width:100%;gap:var(--smSpacing)}.flex-fill{flex:1 1 auto!important}.flex-wrap{flex-wrap:wrap!important}.flex-nowrap{flex-wrap:nowrap!important}.inline-flex{position:relative;display:inline-flex;align-items:center;flex-wrap:wrap;min-width:0;gap:10px}.flex-order-0{order:0}.flex-order-1{order:1}.flex-order-2{order:2}.flex-order-3{order:3}.flex-order-4{order:4}.flex-order-5{order:5}.flex-order-6{order:6}.flex-gap-base{gap:var(--baseSpacing)!important}.flex-gap-xs{gap:var(--xsSpacing)!important}.flex-gap-sm{gap:var(--smSpacing)!important}.flex-gap-lg{gap:var(--lgSpacing)!important}.flex-gap-xl{gap:var(--xlSpacing)!important}.flex-gap-0{gap:0px!important}.flex-gap-5{gap:5px!important}.flex-gap-10{gap:10px!important}.flex-gap-15{gap:15px!important}.flex-gap-20{gap:20px!important}.flex-gap-25{gap:25px!important}.flex-gap-30{gap:30px!important}.flex-gap-35{gap:35px!important}.flex-gap-40{gap:40px!important}.flex-gap-45{gap:45px!important}.flex-gap-50{gap:50px!important}.flex-gap-55{gap:55px!important}.flex-gap-60{gap:60px!important}.m-base{margin:var(--baseSpacing)!important}.p-base{padding:var(--baseSpacing)!important}.m-xs{margin:var(--xsSpacing)!important}.p-xs{padding:var(--xsSpacing)!important}.m-sm{margin:var(--smSpacing)!important}.p-sm{padding:var(--smSpacing)!important}.m-lg{margin:var(--lgSpacing)!important}.p-lg{padding:var(--lgSpacing)!important}.m-xl{margin:var(--xlSpacing)!important}.p-xl{padding:var(--xlSpacing)!important}.m-t-auto{margin-top:auto!important}.p-t-auto{padding-top:auto!important}.m-t-base{margin-top:var(--baseSpacing)!important}.p-t-base{padding-top:var(--baseSpacing)!important}.m-t-xs{margin-top:var(--xsSpacing)!important}.p-t-xs{padding-top:var(--xsSpacing)!important}.m-t-sm{margin-top:var(--smSpacing)!important}.p-t-sm{padding-top:var(--smSpacing)!important}.m-t-lg{margin-top:var(--lgSpacing)!important}.p-t-lg{padding-top:var(--lgSpacing)!important}.m-t-xl{margin-top:var(--xlSpacing)!important}.p-t-xl{padding-top:var(--xlSpacing)!important}.m-r-auto{margin-right:auto!important}.p-r-auto{padding-right:auto!important}.m-r-base{margin-right:var(--baseSpacing)!important}.p-r-base{padding-right:var(--baseSpacing)!important}.m-r-xs{margin-right:var(--xsSpacing)!important}.p-r-xs{padding-right:var(--xsSpacing)!important}.m-r-sm{margin-right:var(--smSpacing)!important}.p-r-sm{padding-right:var(--smSpacing)!important}.m-r-lg{margin-right:var(--lgSpacing)!important}.p-r-lg{padding-right:var(--lgSpacing)!important}.m-r-xl{margin-right:var(--xlSpacing)!important}.p-r-xl{padding-right:var(--xlSpacing)!important}.m-b-auto{margin-bottom:auto!important}.p-b-auto{padding-bottom:auto!important}.m-b-base{margin-bottom:var(--baseSpacing)!important}.p-b-base{padding-bottom:var(--baseSpacing)!important}.m-b-xs{margin-bottom:var(--xsSpacing)!important}.p-b-xs{padding-bottom:var(--xsSpacing)!important}.m-b-sm{margin-bottom:var(--smSpacing)!important}.p-b-sm{padding-bottom:var(--smSpacing)!important}.m-b-lg{margin-bottom:var(--lgSpacing)!important}.p-b-lg{padding-bottom:var(--lgSpacing)!important}.m-b-xl{margin-bottom:var(--xlSpacing)!important}.p-b-xl{padding-bottom:var(--xlSpacing)!important}.m-l-auto{margin-left:auto!important}.p-l-auto{padding-left:auto!important}.m-l-base{margin-left:var(--baseSpacing)!important}.p-l-base{padding-left:var(--baseSpacing)!important}.m-l-xs{margin-left:var(--xsSpacing)!important}.p-l-xs{padding-left:var(--xsSpacing)!important}.m-l-sm{margin-left:var(--smSpacing)!important}.p-l-sm{padding-left:var(--smSpacing)!important}.m-l-lg{margin-left:var(--lgSpacing)!important}.p-l-lg{padding-left:var(--lgSpacing)!important}.m-l-xl{margin-left:var(--xlSpacing)!important}.p-l-xl{padding-left:var(--xlSpacing)!important}.m-0{margin:0!important}.p-0{padding:0!important}.m-t-0{margin-top:0!important}.p-t-0{padding-top:0!important}.m-r-0{margin-right:0!important}.p-r-0{padding-right:0!important}.m-b-0{margin-bottom:0!important}.p-b-0{padding-bottom:0!important}.m-l-0{margin-left:0!important}.p-l-0{padding-left:0!important}.m-5{margin:5px!important}.p-5{padding:5px!important}.m-t-5{margin-top:5px!important}.p-t-5{padding-top:5px!important}.m-r-5{margin-right:5px!important}.p-r-5{padding-right:5px!important}.m-b-5{margin-bottom:5px!important}.p-b-5{padding-bottom:5px!important}.m-l-5{margin-left:5px!important}.p-l-5{padding-left:5px!important}.m-10{margin:10px!important}.p-10{padding:10px!important}.m-t-10{margin-top:10px!important}.p-t-10{padding-top:10px!important}.m-r-10{margin-right:10px!important}.p-r-10{padding-right:10px!important}.m-b-10{margin-bottom:10px!important}.p-b-10{padding-bottom:10px!important}.m-l-10{margin-left:10px!important}.p-l-10{padding-left:10px!important}.m-15{margin:15px!important}.p-15{padding:15px!important}.m-t-15{margin-top:15px!important}.p-t-15{padding-top:15px!important}.m-r-15{margin-right:15px!important}.p-r-15{padding-right:15px!important}.m-b-15{margin-bottom:15px!important}.p-b-15{padding-bottom:15px!important}.m-l-15{margin-left:15px!important}.p-l-15{padding-left:15px!important}.m-20{margin:20px!important}.p-20{padding:20px!important}.m-t-20{margin-top:20px!important}.p-t-20{padding-top:20px!important}.m-r-20{margin-right:20px!important}.p-r-20{padding-right:20px!important}.m-b-20{margin-bottom:20px!important}.p-b-20{padding-bottom:20px!important}.m-l-20{margin-left:20px!important}.p-l-20{padding-left:20px!important}.m-25{margin:25px!important}.p-25{padding:25px!important}.m-t-25{margin-top:25px!important}.p-t-25{padding-top:25px!important}.m-r-25{margin-right:25px!important}.p-r-25{padding-right:25px!important}.m-b-25{margin-bottom:25px!important}.p-b-25{padding-bottom:25px!important}.m-l-25{margin-left:25px!important}.p-l-25{padding-left:25px!important}.m-30{margin:30px!important}.p-30{padding:30px!important}.m-t-30{margin-top:30px!important}.p-t-30{padding-top:30px!important}.m-r-30{margin-right:30px!important}.p-r-30{padding-right:30px!important}.m-b-30{margin-bottom:30px!important}.p-b-30{padding-bottom:30px!important}.m-l-30{margin-left:30px!important}.p-l-30{padding-left:30px!important}.m-35{margin:35px!important}.p-35{padding:35px!important}.m-t-35{margin-top:35px!important}.p-t-35{padding-top:35px!important}.m-r-35{margin-right:35px!important}.p-r-35{padding-right:35px!important}.m-b-35{margin-bottom:35px!important}.p-b-35{padding-bottom:35px!important}.m-l-35{margin-left:35px!important}.p-l-35{padding-left:35px!important}.m-40{margin:40px!important}.p-40{padding:40px!important}.m-t-40{margin-top:40px!important}.p-t-40{padding-top:40px!important}.m-r-40{margin-right:40px!important}.p-r-40{padding-right:40px!important}.m-b-40{margin-bottom:40px!important}.p-b-40{padding-bottom:40px!important}.m-l-40{margin-left:40px!important}.p-l-40{padding-left:40px!important}.m-45{margin:45px!important}.p-45{padding:45px!important}.m-t-45{margin-top:45px!important}.p-t-45{padding-top:45px!important}.m-r-45{margin-right:45px!important}.p-r-45{padding-right:45px!important}.m-b-45{margin-bottom:45px!important}.p-b-45{padding-bottom:45px!important}.m-l-45{margin-left:45px!important}.p-l-45{padding-left:45px!important}.m-50{margin:50px!important}.p-50{padding:50px!important}.m-t-50{margin-top:50px!important}.p-t-50{padding-top:50px!important}.m-r-50{margin-right:50px!important}.p-r-50{padding-right:50px!important}.m-b-50{margin-bottom:50px!important}.p-b-50{padding-bottom:50px!important}.m-l-50{margin-left:50px!important}.p-l-50{padding-left:50px!important}.m-55{margin:55px!important}.p-55{padding:55px!important}.m-t-55{margin-top:55px!important}.p-t-55{padding-top:55px!important}.m-r-55{margin-right:55px!important}.p-r-55{padding-right:55px!important}.m-b-55{margin-bottom:55px!important}.p-b-55{padding-bottom:55px!important}.m-l-55{margin-left:55px!important}.p-l-55{padding-left:55px!important}.m-60{margin:60px!important}.p-60{padding:60px!important}.m-t-60{margin-top:60px!important}.p-t-60{padding-top:60px!important}.m-r-60{margin-right:60px!important}.p-r-60{padding-right:60px!important}.m-b-60{margin-bottom:60px!important}.p-b-60{padding-bottom:60px!important}.m-l-60{margin-left:60px!important}.p-l-60{padding-left:60px!important}.no-min-width{min-width:0!important}.wrapper{position:relative;width:var(--wrapperWidth);margin:0 auto;max-width:100%}.wrapper.wrapper-sm{width:var(--smWrapperWidth)}.wrapper.wrapper-lg{width:var(--lgWrapperWidth)}.label{display:inline-flex;align-items:center;justify-content:center;gap:5px;line-height:1;padding:3px 8px;min-height:23px;text-align:center;font-size:var(--smFontSize);border-radius:30px;background:var(--baseAlt2Color);color:var(--txtPrimaryColor);white-space:nowrap}.label.label-sm{font-size:var(--xsFontSize);padding:3px 5px;min-height:18px;line-height:1}.label.label-primary{color:var(--baseColor);background:var(--primaryColor)}.label.label-info{background:var(--infoAltColor)}.label.label-success{background:var(--successAltColor)}.label.label-danger{background:var(--dangerAltColor)}.label.label-warning{background:var(--warningAltColor)}.thumb{--thumbSize: 44px;flex-shrink:0;position:relative;display:inline-flex;align-items:center;justify-content:center;line-height:1;width:var(--thumbSize);height:var(--thumbSize);background:var(--baseAlt2Color);border-radius:var(--baseRadius);color:var(--txtPrimaryColor);font-size:1.2rem;box-shadow:0 2px 5px 0 var(--shadowColor)}.thumb i{font-size:inherit}.thumb img{width:100%;height:100%;border-radius:inherit;overflow:hidden}.thumb.thumb-sm{--thumbSize: 32px;font-size:.85rem}.thumb.thumb-lg{--thumbSize: 60px;font-size:1.3rem}.thumb.thumb-xl{--thumbSize: 80px;font-size:1.5rem}.thumb.thumb-circle{border-radius:50%}.thumb.thumb-active{box-shadow:0 0 0 2px var(--primaryColor)}.section-title{display:flex;align-items:center;width:100%;column-gap:10px;row-gap:5px;margin:0 0 var(--xsSpacing);font-weight:600;font-size:var(--smFontSize);line-height:var(--smLineHeight);color:var(--txtHintColor);text-transform:uppercase}.drag-handle{outline:0;cursor:pointer;display:inline-flex;align-items:left;color:var(--txtDisabledColor);transition:color var(--baseAnimationSpeed)}.drag-handle:before,.drag-handle:after{content:"\ef77";font-family:var(--iconFontFamily);font-size:18px;line-height:1;width:7px;text-align:center}.drag-handle:focus-visible,.drag-handle:hover,.drag-handle:active{color:var(--txtPrimaryColor)}.logo{position:relative;vertical-align:top;display:inline-flex;align-items:center;gap:10px;font-size:23px;text-decoration:none;color:inherit;user-select:none}.logo strong{font-weight:700}.logo .version{position:absolute;right:0;top:-5px;line-height:1;font-size:10px;font-weight:400;padding:2px 4px;border-radius:var(--baseRadius);background:var(--dangerAltColor);color:var(--txtPrimaryColor)}.logo.logo-sm{font-size:20px}.loader{--loaderSize: 32px;position:relative;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;row-gap:10px;margin:0;color:var(--txtDisabledColor);text-align:center;font-weight:400}.loader:before{content:"\eec4";display:inline-block;vertical-align:top;clear:both;width:var(--loaderSize);height:var(--loaderSize);line-height:var(--loaderSize);font-size:var(--loaderSize);font-weight:400;font-family:var(--iconFontFamily);color:inherit;text-align:center;animation:loaderShow var(--baseAnimationSpeed),rotate .9s var(--baseAnimationSpeed) infinite linear}.loader.loader-primary{color:var(--primaryColor)}.loader.loader-info{color:var(--infoColor)}.loader.loader-info-alt{color:var(--infoAltColor)}.loader.loader-success{color:var(--successColor)}.loader.loader-success-alt{color:var(--successAltColor)}.loader.loader-danger{color:var(--dangerColor)}.loader.loader-danger-alt{color:var(--dangerAltColor)}.loader.loader-warning{color:var(--warningColor)}.loader.loader-warning-alt{color:var(--warningAltColor)}.loader.loader-sm{--loaderSize: 24px}.loader.loader-lg{--loaderSize: 42px}.skeleton-loader{position:relative;height:12px;margin:5px 0;border-radius:var(--baseRadius);background:var(--baseAlt1Color);animation:fadeIn .4s}.skeleton-loader:before{content:"";width:100%;height:100%;display:block;border-radius:inherit;background:linear-gradient(90deg,var(--baseAlt1Color) 8%,var(--bodyColor) 18%,var(--baseAlt1Color) 33%);background-size:200% 100%;animation:shine 1s linear infinite}.placeholder-section{display:flex;width:100%;align-items:center;justify-content:center;text-align:center;flex-direction:column;gap:var(--smSpacing);color:var(--txtHintColor)}.placeholder-section .icon{font-size:50px;height:50px;line-height:1;opacity:.3}.placeholder-section .icon i{font-size:inherit;vertical-align:top}.list{position:relative;border:1px solid var(--baseAlt2Color);border-radius:var(--baseRadius)}.list .list-item{word-break:break-word;position:relative;display:flex;align-items:center;width:100%;gap:10px;padding:10px;border-bottom:1px solid var(--baseAlt2Color)}.list .list-item:last-child{border-bottom:0}.entrance-top{animation:entranceTop var(--entranceAnimationSpeed)}.entrance-bottom{animation:entranceBottom var(--entranceAnimationSpeed)}.entrance-left{animation:entranceLeft var(--entranceAnimationSpeed)}.entrance-right{animation:entranceRight var(--entranceAnimationSpeed)}.grid{--gridGap: var(--baseSpacing);position:relative;display:flex;flex-grow:1;flex-wrap:wrap;row-gap:var(--gridGap);margin:0 calc(-.5 * var(--gridGap))}.grid.grid-center{align-items:center}.grid.grid-sm{--gridGap: var(--smSpacing)}.grid .form-field{margin-bottom:0}.grid>*{margin:0 calc(.5 * var(--gridGap))}.col-xxl-1,.col-xxl-2,.col-xxl-3,.col-xxl-4,.col-xxl-5,.col-xxl-6,.col-xxl-7,.col-xxl-8,.col-xxl-9,.col-xxl-10,.col-xxl-11,.col-xxl-12,.col-xl-1,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9,.col-xl-10,.col-xl-11,.col-xl-12,.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12,.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12,.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12,.col-1,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-10,.col-11,.col-12{position:relative;width:100%;min-height:1px}.col-auto{flex:0 0 auto;width:auto}.col-12{width:calc(100% - var(--gridGap))}.col-11{width:calc(91.6666666667% - var(--gridGap))}.col-10{width:calc(83.3333333333% - var(--gridGap))}.col-9{width:calc(75% - var(--gridGap))}.col-8{width:calc(66.6666666667% - var(--gridGap))}.col-7{width:calc(58.3333333333% - var(--gridGap))}.col-6{width:calc(50% - var(--gridGap))}.col-5{width:calc(41.6666666667% - var(--gridGap))}.col-4{width:calc(33.3333333333% - var(--gridGap))}.col-3{width:calc(25% - var(--gridGap))}.col-2{width:calc(16.6666666667% - var(--gridGap))}.col-1{width:calc(8.3333333333% - var(--gridGap))}@media (min-width: 576px){.col-sm-auto{flex:0 0 auto;width:auto}.col-sm-12{width:calc(100% - var(--gridGap))}.col-sm-11{width:calc(91.6666666667% - var(--gridGap))}.col-sm-10{width:calc(83.3333333333% - var(--gridGap))}.col-sm-9{width:calc(75% - var(--gridGap))}.col-sm-8{width:calc(66.6666666667% - var(--gridGap))}.col-sm-7{width:calc(58.3333333333% - var(--gridGap))}.col-sm-6{width:calc(50% - var(--gridGap))}.col-sm-5{width:calc(41.6666666667% - var(--gridGap))}.col-sm-4{width:calc(33.3333333333% - var(--gridGap))}.col-sm-3{width:calc(25% - var(--gridGap))}.col-sm-2{width:calc(16.6666666667% - var(--gridGap))}.col-sm-1{width:calc(8.3333333333% - var(--gridGap))}}@media (min-width: 768px){.col-md-auto{flex:0 0 auto;width:auto}.col-md-12{width:calc(100% - var(--gridGap))}.col-md-11{width:calc(91.6666666667% - var(--gridGap))}.col-md-10{width:calc(83.3333333333% - var(--gridGap))}.col-md-9{width:calc(75% - var(--gridGap))}.col-md-8{width:calc(66.6666666667% - var(--gridGap))}.col-md-7{width:calc(58.3333333333% - var(--gridGap))}.col-md-6{width:calc(50% - var(--gridGap))}.col-md-5{width:calc(41.6666666667% - var(--gridGap))}.col-md-4{width:calc(33.3333333333% - var(--gridGap))}.col-md-3{width:calc(25% - var(--gridGap))}.col-md-2{width:calc(16.6666666667% - var(--gridGap))}.col-md-1{width:calc(8.3333333333% - var(--gridGap))}}@media (min-width: 992px){.col-lg-auto{flex:0 0 auto;width:auto}.col-lg-12{width:calc(100% - var(--gridGap))}.col-lg-11{width:calc(91.6666666667% - var(--gridGap))}.col-lg-10{width:calc(83.3333333333% - var(--gridGap))}.col-lg-9{width:calc(75% - var(--gridGap))}.col-lg-8{width:calc(66.6666666667% - var(--gridGap))}.col-lg-7{width:calc(58.3333333333% - var(--gridGap))}.col-lg-6{width:calc(50% - var(--gridGap))}.col-lg-5{width:calc(41.6666666667% - var(--gridGap))}.col-lg-4{width:calc(33.3333333333% - var(--gridGap))}.col-lg-3{width:calc(25% - var(--gridGap))}.col-lg-2{width:calc(16.6666666667% - var(--gridGap))}.col-lg-1{width:calc(8.3333333333% - var(--gridGap))}}@media (min-width: 1200px){.col-xl-auto{flex:0 0 auto;width:auto}.col-xl-12{width:calc(100% - var(--gridGap))}.col-xl-11{width:calc(91.6666666667% - var(--gridGap))}.col-xl-10{width:calc(83.3333333333% - var(--gridGap))}.col-xl-9{width:calc(75% - var(--gridGap))}.col-xl-8{width:calc(66.6666666667% - var(--gridGap))}.col-xl-7{width:calc(58.3333333333% - var(--gridGap))}.col-xl-6{width:calc(50% - var(--gridGap))}.col-xl-5{width:calc(41.6666666667% - var(--gridGap))}.col-xl-4{width:calc(33.3333333333% - var(--gridGap))}.col-xl-3{width:calc(25% - var(--gridGap))}.col-xl-2{width:calc(16.6666666667% - var(--gridGap))}.col-xl-1{width:calc(8.3333333333% - var(--gridGap))}}@media (min-width: 1400px){.col-xxl-auto{flex:0 0 auto;width:auto}.col-xxl-12{width:calc(100% - var(--gridGap))}.col-xxl-11{width:calc(91.6666666667% - var(--gridGap))}.col-xxl-10{width:calc(83.3333333333% - var(--gridGap))}.col-xxl-9{width:calc(75% - var(--gridGap))}.col-xxl-8{width:calc(66.6666666667% - var(--gridGap))}.col-xxl-7{width:calc(58.3333333333% - var(--gridGap))}.col-xxl-6{width:calc(50% - var(--gridGap))}.col-xxl-5{width:calc(41.6666666667% - var(--gridGap))}.col-xxl-4{width:calc(33.3333333333% - var(--gridGap))}.col-xxl-3{width:calc(25% - var(--gridGap))}.col-xxl-2{width:calc(16.6666666667% - var(--gridGap))}.col-xxl-1{width:calc(8.3333333333% - var(--gridGap))}}.app-tooltip{position:fixed;z-index:999999;top:0;left:0;display:inline-block;vertical-align:top;max-width:275px;padding:3px 5px;color:#fff;text-align:center;font-family:var(--baseFontFamily);font-size:var(--smFontSize);line-height:var(--smLineHeight);border-radius:var(--baseRadius);background:var(--tooltipColor);pointer-events:none;user-select:none;transition:opacity var(--baseAnimationSpeed),visibility var(--baseAnimationSpeed),transform var(--baseAnimationSpeed);transform:scale(.98);white-space:pre-line;opacity:0;visibility:hidden}.app-tooltip.code{font-family:monospace;white-space:pre-wrap;text-align:left;min-width:150px;max-width:340px}.app-tooltip.active{transform:scale(1);opacity:1;visibility:visible}.dropdown{position:absolute;z-index:99;right:0;left:auto;top:100%;cursor:default;display:inline-block;vertical-align:top;padding:5px;margin:5px 0 0;width:auto;min-width:140px;max-width:450px;max-height:330px;overflow-x:hidden;overflow-y:auto;background:var(--baseColor);border-radius:var(--baseRadius);border:1px solid var(--baseAlt2Color);box-shadow:0 2px 5px 0 var(--shadowColor)}.dropdown hr{margin:5px 0}.dropdown .dropdown-item{border:0;background:none;position:relative;outline:0;display:flex;align-items:center;column-gap:8px;width:100%;height:auto;min-height:0;text-align:left;padding:8px 10px;margin:0 0 5px;cursor:pointer;color:var(--txtPrimaryColor);font-weight:400;font-size:var(--baseFontSize);font-family:var(--baseFontFamily);line-height:var(--baseLineHeight);border-radius:var(--baseRadius);text-decoration:none;word-break:break-word;user-select:none;transition:background var(--baseAnimationSpeed),color var(--baseAnimationSpeed)}.dropdown .dropdown-item:last-child{margin-bottom:0}.dropdown .dropdown-item:focus,.dropdown .dropdown-item:hover{background:var(--baseAlt1Color)}.dropdown .dropdown-item.selected{background:var(--baseAlt2Color)}.dropdown .dropdown-item:active{transition-duration:var(--activeAnimationSpeed);background:var(--baseAlt2Color)}.dropdown .dropdown-item.disabled{color:var(--txtDisabledColor);background:none;pointer-events:none}.dropdown .dropdown-item.separator{cursor:default;background:none;text-transform:uppercase;padding-top:0;padding-bottom:0;margin-top:15px;color:var(--txtDisabledColor);font-weight:600;font-size:var(--smFontSize)}.dropdown.dropdown-upside{top:auto;bottom:100%;margin:0 0 5px}.dropdown.dropdown-left{right:auto;left:0}.dropdown.dropdown-center{right:auto;left:50%;transform:translate(-50%)}.dropdown.dropdown-sm{margin-top:5px;min-width:100px}.dropdown.dropdown-sm .dropdown-item{column-gap:7px;font-size:var(--smFontSize);margin:0 0 2px;padding:5px 7px}.dropdown.dropdown-sm .dropdown-item:last-child{margin-bottom:0}.dropdown.dropdown-sm.dropdown-upside{margin-top:0;margin-bottom:5px}.dropdown.dropdown-block{width:100%;min-width:130px;max-width:100%}.dropdown.dropdown-nowrap{white-space:nowrap}.overlay-panel{position:relative;z-index:1;display:flex;flex-direction:column;align-self:flex-end;margin-left:auto;background:var(--baseColor);height:100%;width:580px;max-width:100%;word-wrap:break-word;box-shadow:0 2px 5px 0 var(--shadowColor)}.overlay-panel .overlay-panel-section{position:relative;width:100%;margin:0;padding:var(--baseSpacing);transition:box-shadow var(--baseAnimationSpeed)}.overlay-panel .overlay-panel-section:empty{display:none}.overlay-panel .overlay-panel-section:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.overlay-panel .overlay-panel-section:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.overlay-panel .overlay-panel-section .btn{flex-grow:0}.overlay-panel img{max-width:100%}.overlay-panel .panel-header{position:relative;z-index:2;display:flex;flex-wrap:wrap;align-items:center;column-gap:10px;row-gap:var(--baseSpacing);padding:calc(var(--baseSpacing) - 7px) var(--baseSpacing)}.overlay-panel .panel-header>*{margin-top:0;margin-bottom:0}.overlay-panel .panel-header .btn-back{margin-left:-10px}.overlay-panel .panel-header .overlay-close{z-index:3;outline:0;position:absolute;right:100%;top:20px;margin:0;display:inline-flex;align-items:center;justify-content:center;width:35px;height:35px;cursor:pointer;text-align:center;font-size:1.6rem;line-height:1;border-radius:50% 0 0 50%;color:#fff;background:var(--primaryColor);opacity:.5;transition:opacity var(--baseAnimationSpeed);user-select:none}.overlay-panel .panel-header .overlay-close i{font-size:inherit}.overlay-panel .panel-header .overlay-close:hover,.overlay-panel .panel-header .overlay-close:focus-visible,.overlay-panel .panel-header .overlay-close:active{opacity:.7}.overlay-panel .panel-header .overlay-close:active{transition-duration:var(--activeAnimationSpeed);opacity:1}.overlay-panel .panel-header .btn-close{margin-right:-10px}.overlay-panel .panel-header .tabs-header{margin-bottom:-24px}.overlay-panel .panel-content{z-index:auto;flex-grow:1;overflow-x:hidden;overflow-y:auto;overflow-y:overlay}.overlay-panel .panel-header~.panel-content{padding-top:5px}.overlay-panel .panel-footer{z-index:2;column-gap:var(--smSpacing);display:flex;align-items:center;justify-content:flex-end;border-top:1px solid var(--baseAlt2Color);padding:calc(var(--baseSpacing) - 7px) var(--baseSpacing)}.overlay-panel.scrollable .panel-header{box-shadow:0 4px 5px #0000000d}.overlay-panel.scrollable .panel-footer{box-shadow:0 -4px 5px #0000000d}.overlay-panel.scrollable.scroll-top-reached .panel-header,.overlay-panel.scrollable.scroll-bottom-reached .panel-footer{box-shadow:none}.overlay-panel.overlay-panel-xl{width:850px}.overlay-panel.overlay-panel-lg{width:700px}.overlay-panel.overlay-panel-sm{width:460px}.overlay-panel.popup{height:auto;max-height:100%;align-self:center;border-radius:var(--baseRadius);margin:0 auto}.overlay-panel.popup .panel-footer{background:var(--bodyColor)}.overlay-panel.hide-content .panel-content{display:none}.overlay-panel.colored-header .panel-header{background:var(--bodyColor);border-bottom:1px solid var(--baseAlt1Color)}.overlay-panel.colored-header .panel-header .tabs-header{border-bottom:0}.overlay-panel.colored-header .panel-header .tabs-header .tab-item{border:1px solid transparent;border-bottom:0}.overlay-panel.colored-header .panel-header .tabs-header .tab-item:hover,.overlay-panel.colored-header .panel-header .tabs-header .tab-item:focus-visible{background:var(--baseAlt1Color)}.overlay-panel.colored-header .panel-header .tabs-header .tab-item:after{content:none;display:none}.overlay-panel.colored-header .panel-header .tabs-header .tab-item.active{background:var(--baseColor);border-color:var(--baseAlt1Color)}.overlay-panel.colored-header .panel-header~.panel-content{padding-top:calc(var(--baseSpacing) - 5px)}.overlay-panel.compact-header .panel-header{row-gap:var(--smSpacing)}.overlay-panel.full-width-popup{width:100%}.overlay-panel.image-preview{width:auto;min-width:300px;min-height:250px;max-width:70%;max-height:90%}.overlay-panel.image-preview .panel-header{position:absolute;z-index:99;box-shadow:none}.overlay-panel.image-preview .panel-header .overlay-close{left:100%;right:auto;border-radius:0 50% 50% 0}.overlay-panel.image-preview .panel-header .overlay-close i{margin-right:5px}.overlay-panel.image-preview .panel-header,.overlay-panel.image-preview .panel-footer{padding:10px 15px}.overlay-panel.image-preview .panel-content{padding:0;text-align:center;display:flex;align-items:center;justify-content:center}.overlay-panel.image-preview img{max-width:100%;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius)}@media (max-width: 900px){.overlay-panel .overlay-panel-section{padding:var(--smSpacing)}}.overlay-panel-container{display:flex;position:fixed;z-index:1000;flex-direction:row;align-items:center;top:0;left:0;width:100%;height:100%;overflow:hidden;margin:0;padding:0;outline:0}.overlay-panel-container .overlay{position:absolute;z-index:0;left:0;top:0;width:100%;height:100%;user-select:none;background:var(--overlayColor)}.overlay-panel-container.padded{padding:10px}.overlay-panel-wrapper{position:relative;z-index:1000;outline:0}.alert{position:relative;display:flex;column-gap:15px;align-items:center;width:100%;min-height:50px;max-width:100%;word-break:break-word;margin:0 0 var(--baseSpacing);border-radius:var(--baseRadius);padding:12px 15px;background:var(--baseAlt1Color);color:var(--txtAltColor)}.alert .content,.alert .form-field .help-block,.form-field .alert .help-block,.alert .panel,.alert .sub-panel,.alert .overlay-panel .panel-content,.overlay-panel .alert .panel-content{flex-grow:1}.alert .icon,.alert .close{display:inline-flex;align-items:center;justify-content:center;flex-grow:0;flex-shrink:0;text-align:center}.alert .icon{align-self:stretch;font-size:1.2em;padding-right:15px;font-weight:400;border-right:1px solid rgba(0,0,0,.05);color:var(--txtHintColor)}.alert .close{display:inline-flex;margin-right:-5px;width:30px;height:30px;outline:0;cursor:pointer;text-align:center;font-size:var(--smFontSize);line-height:30px;border-radius:30px;text-decoration:none;color:inherit;opacity:.5;transition:opacity var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}.alert .close:hover,.alert .close:focus{opacity:1;background:rgba(255,255,255,.2)}.alert .close:active{opacity:1;background:rgba(255,255,255,.3);transition-duration:var(--activeAnimationSpeed)}.alert code,.alert hr{background:rgba(0,0,0,.1)}.alert.alert-info{background:var(--infoAltColor)}.alert.alert-info .icon{color:var(--infoColor)}.alert.alert-warning{background:var(--warningAltColor)}.alert.alert-warning .icon{color:var(--warningColor)}.alert.alert-success{background:var(--successAltColor)}.alert.alert-success .icon{color:var(--successColor)}.alert.alert-danger{background:var(--dangerAltColor)}.alert.alert-danger .icon{color:var(--dangerColor)}.toasts-wrapper{position:fixed;z-index:999999;bottom:0;left:0;right:0;padding:0 var(--smSpacing);width:auto;display:block;text-align:center;pointer-events:none}.toasts-wrapper .alert{text-align:left;pointer-events:auto;width:var(--smWrapperWidth);margin:var(--baseSpacing) auto;box-shadow:0 2px 5px 0 var(--shadowColor)}.app-sidebar~.app-body .toasts-wrapper{left:var(--appSidebarWidth)}.app-sidebar~.app-body .page-sidebar~.toasts-wrapper{left:calc(var(--appSidebarWidth) + var(--pageSidebarWidth))}button{outline:0;border:0;background:none;padding:0;text-align:left;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit}.btn{position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;outline:0;border:0;margin:0;flex-shrink:0;cursor:pointer;padding:5px 20px;column-gap:7px;user-select:none;min-width:var(--btnHeight);min-height:var(--btnHeight);text-align:center;text-decoration:none;line-height:1;font-weight:600;color:#fff;font-size:var(--baseFontSize);font-family:var(--baseFontFamily);border-radius:var(--btnRadius);background:none;transition:color var(--baseAnimationSpeed)}.btn i{font-size:1.1428em;vertical-align:middle;display:inline-block}.btn:before{content:"";border-radius:inherit;position:absolute;left:0;top:0;z-index:-1;width:100%;height:100%;pointer-events:none;user-select:none;backface-visibility:hidden;background:var(--primaryColor);transition:filter var(--baseAnimationSpeed),opacity var(--baseAnimationSpeed),transform var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}.btn:hover:before,.btn:focus-visible:before{opacity:.9}.btn.active,.btn:active{z-index:999}.btn.active:before,.btn:active:before{opacity:.8;transition-duration:var(--activeAnimationSpeed)}.btn.btn-info:before{background:var(--infoColor)}.btn.btn-info:hover:before,.btn.btn-info:focus-visible:before{opacity:.8}.btn.btn-info:active:before{opacity:.7}.btn.btn-success:before{background:var(--successColor)}.btn.btn-success:hover:before,.btn.btn-success:focus-visible:before{opacity:.8}.btn.btn-success:active:before{opacity:.7}.btn.btn-danger:before{background:var(--dangerColor)}.btn.btn-danger:hover:before,.btn.btn-danger:focus-visible:before{opacity:.8}.btn.btn-danger:active:before{opacity:.7}.btn.btn-warning:before{background:var(--warningColor)}.btn.btn-warning:hover:before,.btn.btn-warning:focus-visible:before{opacity:.8}.btn.btn-warning:active:before{opacity:.7}.btn.btn-hint:before{background:var(--baseAlt4Color)}.btn.btn-hint:hover:before,.btn.btn-hint:focus-visible:before{opacity:.8}.btn.btn-hint:active:before{opacity:.7}.btn.btn-outline{border:2px solid currentColor;background:#fff}.btn.btn-secondary,.btn.btn-outline{box-shadow:none;color:var(--txtPrimaryColor)}.btn.btn-secondary:before,.btn.btn-outline:before{opacity:0;background:var(--baseAlt4Color)}.btn.btn-secondary:focus-visible:before,.btn.btn-secondary:hover:before,.btn.btn-secondary:active:before,.btn.btn-secondary.active:before,.btn.btn-outline:focus-visible:before,.btn.btn-outline:hover:before,.btn.btn-outline:active:before,.btn.btn-outline.active:before{opacity:.11}.btn.btn-secondary.active:before,.btn.btn-secondary:active:before,.btn.btn-outline.active:before,.btn.btn-outline:active:before{opacity:.22}.btn.btn-secondary.btn-info,.btn.btn-outline.btn-info{color:var(--infoColor)}.btn.btn-secondary.btn-info:before,.btn.btn-outline.btn-info:before{background:var(--infoColor)}.btn.btn-secondary.btn-success,.btn.btn-outline.btn-success{color:var(--successColor)}.btn.btn-secondary.btn-success:before,.btn.btn-outline.btn-success:before{background:var(--successColor)}.btn.btn-secondary.btn-danger,.btn.btn-outline.btn-danger{color:var(--dangerColor)}.btn.btn-secondary.btn-danger:before,.btn.btn-outline.btn-danger:before{background:var(--dangerColor)}.btn.btn-secondary.btn-warning,.btn.btn-outline.btn-warning{color:var(--warningColor)}.btn.btn-secondary.btn-warning:before,.btn.btn-outline.btn-warning:before{background:var(--warningColor)}.btn.btn-secondary.btn-hint,.btn.btn-outline.btn-hint{color:var(--baseAlt4Color)}.btn.btn-secondary.btn-hint:before,.btn.btn-outline.btn-hint:before{background:var(--baseAlt4Color)}.btn.btn-secondary.btn-hint,.btn.btn-outline.btn-hint{color:var(--txtHintColor)}.btn.btn-disabled,.btn[disabled]{box-shadow:none;cursor:default;background:var(--baseAlt2Color);color:var(--txtDisabledColor)!important}.btn.btn-disabled:before,.btn[disabled]:before{display:none}.btn.btn-disabled.btn-secondary,.btn[disabled].btn-secondary{background:none}.btn.btn-disabled.btn-outline,.btn[disabled].btn-outline{border-color:var(--baseAlt2Color)}.btn.btn-expanded{min-width:140px}.btn.btn-expanded-sm{min-width:90px}.btn.btn-expanded-lg{min-width:170px}.btn.btn-lg{column-gap:10px;font-size:var(--lgFontSize);min-height:var(--lgBtnHeight);min-width:var(--lgBtnHeight);padding-left:30px;padding-right:30px}.btn.btn-lg i{font-size:1.2666em}.btn.btn-lg.btn-expanded{min-width:240px}.btn.btn-lg.btn-expanded-sm{min-width:160px}.btn.btn-lg.btn-expanded-lg{min-width:300px}.btn.btn-sm,.btn.btn-xs{column-gap:5px;font-size:var(--smFontSize);min-height:var(--smBtnHeight);min-width:var(--smBtnHeight);padding-left:12px;padding-right:12px}.btn.btn-sm i,.btn.btn-xs i{font-size:1rem}.btn.btn-sm.btn-expanded,.btn.btn-xs.btn-expanded{min-width:100px}.btn.btn-sm.btn-expanded-sm,.btn.btn-xs.btn-expanded-sm{min-width:80px}.btn.btn-sm.btn-expanded-lg,.btn.btn-xs.btn-expanded-lg{min-width:130px}.btn.btn-xs{min-width:var(--xsBtnHeight);min-height:var(--xsBtnHeight)}.btn.btn-block{display:flex;width:100%}.btn.btn-circle{border-radius:50%;padding:0;gap:0}.btn.btn-circle i{font-size:1.2857rem;text-align:center;width:24px;height:24px;line-height:24px}.btn.btn-circle i:before{margin:0;display:block}.btn.btn-circle.btn-sm i,.btn.btn-circle.btn-xs i{font-size:1.1rem}.btn.btn-loading{--loaderSize: 24px;cursor:default;pointer-events:none}.btn.btn-loading:after{content:"\eec4";position:absolute;display:inline-block;vertical-align:top;left:50%;top:50%;width:var(--loaderSize);height:var(--loaderSize);line-height:var(--loaderSize);font-size:var(--loaderSize);color:inherit;text-align:center;font-weight:400;margin-left:calc(var(--loaderSize) * -.5);margin-top:calc(var(--loaderSize) * -.5);font-family:var(--iconFontFamily);animation:loaderShow var(--baseAnimationSpeed),rotate .9s var(--baseAnimationSpeed) infinite linear}.btn.btn-loading>*{opacity:0;transform:scale(.9)}.btn.btn-loading.btn-sm,.btn.btn-loading.btn-xs{--loaderSize: 20px}.btn.btn-loading.btn-lg{--loaderSize: 28px}.btn.btn-prev i,.btn.btn-next i{transition:transform var(--baseAnimationSpeed)}.btn.btn-prev:hover i,.btn.btn-prev:focus-within i,.btn.btn-next:hover i,.btn.btn-next:focus-within i{transform:translate(3px)}.btn.btn-prev:hover i,.btn.btn-prev:focus-within i{transform:translate(-3px)}.btns-group{display:inline-flex;align-items:center;gap:var(--xsSpacing)}.code-editor,.select .selected-container,input,select,textarea{display:block;width:100%;outline:0;border:0;margin:0;background:none;padding:5px 10px;line-height:20px;min-width:0;min-height:var(--inputHeight);background:var(--baseAlt1Color);color:var(--txtPrimaryColor);font-size:var(--baseFontSize);font-family:var(--baseFontFamily);font-weight:400;border-radius:var(--baseRadius);overflow:auto;overflow:overlay}.code-editor::placeholder,.select .selected-container::placeholder,input::placeholder,select::placeholder,textarea::placeholder{color:var(--txtDisabledColor)}@media screen and (min-width: 550px){.code-editor:focus,.select .selected-container:focus,input:focus,select:focus,textarea:focus,.code-editor:focus-within,.select .selected-container:focus-within,input:focus-within,select:focus-within,textarea:focus-within{scrollbar-color:var(--baseAlt3Color) transparent;scrollbar-width:thin;scroll-behavior:smooth}.code-editor:focus::-webkit-scrollbar,.select .selected-container:focus::-webkit-scrollbar,input:focus::-webkit-scrollbar,select:focus::-webkit-scrollbar,textarea:focus::-webkit-scrollbar,.code-editor:focus-within::-webkit-scrollbar,.select .selected-container:focus-within::-webkit-scrollbar,input:focus-within::-webkit-scrollbar,select:focus-within::-webkit-scrollbar,textarea:focus-within::-webkit-scrollbar{width:8px;height:8px;border-radius:var(--baseRadius)}.code-editor:focus::-webkit-scrollbar-track,.select .selected-container:focus::-webkit-scrollbar-track,input:focus::-webkit-scrollbar-track,select:focus::-webkit-scrollbar-track,textarea:focus::-webkit-scrollbar-track,.code-editor:focus-within::-webkit-scrollbar-track,.select .selected-container:focus-within::-webkit-scrollbar-track,input:focus-within::-webkit-scrollbar-track,select:focus-within::-webkit-scrollbar-track,textarea:focus-within::-webkit-scrollbar-track{background:transparent;border-radius:var(--baseRadius)}.code-editor:focus::-webkit-scrollbar-thumb,.select .selected-container:focus::-webkit-scrollbar-thumb,input:focus::-webkit-scrollbar-thumb,select:focus::-webkit-scrollbar-thumb,textarea:focus::-webkit-scrollbar-thumb,.code-editor:focus-within::-webkit-scrollbar-thumb,.select .selected-container:focus-within::-webkit-scrollbar-thumb,input:focus-within::-webkit-scrollbar-thumb,select:focus-within::-webkit-scrollbar-thumb,textarea:focus-within::-webkit-scrollbar-thumb{background-color:var(--baseAlt3Color);border-radius:15px;border:2px solid transparent;background-clip:padding-box}.code-editor:focus::-webkit-scrollbar-thumb:hover,.select .selected-container:focus::-webkit-scrollbar-thumb:hover,input:focus::-webkit-scrollbar-thumb:hover,select:focus::-webkit-scrollbar-thumb:hover,textarea:focus::-webkit-scrollbar-thumb:hover,.code-editor:focus::-webkit-scrollbar-thumb:active,.select .selected-container:focus::-webkit-scrollbar-thumb:active,input:focus::-webkit-scrollbar-thumb:active,select:focus::-webkit-scrollbar-thumb:active,textarea:focus::-webkit-scrollbar-thumb:active,.code-editor:focus-within::-webkit-scrollbar-thumb:hover,.select .selected-container:focus-within::-webkit-scrollbar-thumb:hover,input:focus-within::-webkit-scrollbar-thumb:hover,select:focus-within::-webkit-scrollbar-thumb:hover,textarea:focus-within::-webkit-scrollbar-thumb:hover,.code-editor:focus-within::-webkit-scrollbar-thumb:active,.select .selected-container:focus-within::-webkit-scrollbar-thumb:active,input:focus-within::-webkit-scrollbar-thumb:active,select:focus-within::-webkit-scrollbar-thumb:active,textarea:focus-within::-webkit-scrollbar-thumb:active{background-color:var(--baseAlt4Color)}}.code-editor:focus,.select .selected-container:focus,input:focus,select:focus,textarea:focus,.active.code-editor,.select .active.selected-container,input.active,select.active,textarea.active{border-color:var(--primaryColor)}[readonly].code-editor,.select [readonly].selected-container,input[readonly],select[readonly],textarea[readonly],.readonly.code-editor,.select .readonly.selected-container,input.readonly,select.readonly,textarea.readonly{cursor:default;color:var(--txtHintColor)}[disabled].code-editor,.select [disabled].selected-container,input[disabled],select[disabled],textarea[disabled],.disabled.code-editor,.select .disabled.selected-container,input.disabled,select.disabled,textarea.disabled{cursor:default;color:var(--txtDisabledColor);border-color:var(--baseAlt2Color)}.txt-mono.code-editor,.select .txt-mono.selected-container,input.txt-mono,select.txt-mono,textarea.txt-mono{line-height:var(--smLineHeight)}.code.code-editor,.select .code.selected-container,input.code,select.code,textarea.code{font-size:15px;line-height:1.379rem;font-family:var(--monospaceFontFamily)}input{height:var(--inputHeight)}input:-webkit-autofill{-webkit-text-fill-color:var(--txtPrimaryColor);-webkit-box-shadow:inset 0 0 0 50px var(--baseAlt1Color)}.form-field:focus-within input:-webkit-autofill,input:-webkit-autofill:focus{-webkit-box-shadow:inset 0 0 0 50px var(--baseAlt2Color)}input[type=file]{padding:9px}input[type=checkbox],input[type=radio]{width:auto;height:auto;display:inline}input[type=number]{-moz-appearance:textfield;appearance:textfield}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}textarea{min-height:80px;resize:vertical}select{padding-left:8px}.form-field{--hPadding: 15px;position:relative;display:block;width:100%;margin-bottom:var(--baseSpacing)}.form-field .code-editor,.form-field .select .selected-container,.select .form-field .selected-container,.form-field input,.form-field select,.form-field textarea{z-index:0;padding-left:var(--hPadding);padding-right:var(--hPadding)}.form-field select{padding-left:8px}.form-field label{display:flex;width:100%;column-gap:5px;align-items:center;user-select:none;font-weight:600;color:var(--txtHintColor);font-size:var(--xsFontSize);text-transform:uppercase;line-height:1;padding-top:12px;padding-bottom:2px;padding-left:var(--hPadding);padding-right:var(--hPadding);border:0;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius)}.form-field label~.code-editor,.form-field .select label~.selected-container,.select .form-field label~.selected-container,.form-field label~input,.form-field label~select,.form-field label~textarea{border-top:0;padding-top:2px;padding-bottom:8px;border-top-left-radius:0;border-top-right-radius:0}.form-field label i{font-size:.96rem;line-height:1;margin-top:-2px;margin-bottom:-2px}.form-field .code-editor,.form-field .select .selected-container,.select .form-field .selected-container,.form-field input,.form-field select,.form-field textarea,.form-field label{background:var(--baseAlt1Color);transition:color var(--baseAnimationSpeed),background var(--baseAnimationSpeed),box-shadow var(--baseAnimationSpeed)}.form-field:focus-within .code-editor,.form-field:focus-within .select .selected-container,.select .form-field:focus-within .selected-container,.form-field:focus-within input,.form-field:focus-within select,.form-field:focus-within textarea,.form-field:focus-within label{background:var(--baseAlt2Color)}.form-field:focus-within label{color:var(--txtPrimaryColor)}.form-field .form-field-addon{position:absolute;display:inline-flex;align-items:center;z-index:1;top:0px;right:var(--hPadding);min-height:var(--inputHeight);color:var(--txtHintColor)}.form-field .form-field-addon .btn{margin-right:-5px}.form-field .form-field-addon~.code-editor,.form-field .select .form-field-addon~.selected-container,.select .form-field .form-field-addon~.selected-container,.form-field .form-field-addon~input,.form-field .form-field-addon~select,.form-field .form-field-addon~textarea{padding-right:35px}.form-field label~.form-field-addon{min-height:calc(26px + var(--inputHeight))}.form-field .help-block{margin-top:8px;font-size:var(--smFontSize);line-height:var(--smLineHeight);color:var(--txtHintColor);word-break:break-word}.form-field .help-block pre{white-space:pre-wrap}.form-field .help-block-error{color:var(--dangerColor)}.form-field.error>label,.form-field.invalid>label{color:var(--dangerColor)}.form-field.invalid label,.form-field.invalid .code-editor,.form-field.invalid .select .selected-container,.select .form-field.invalid .selected-container,.form-field.invalid input,.form-field.invalid select,.form-field.invalid textarea{background:var(--dangerAltColor)}.form-field.required:not(.form-field-toggle)>label:after{content:"*";color:var(--dangerColor);margin-top:-2px;margin-left:-2px}.form-field.disabled>label{color:var(--txtDisabledColor)}.form-field.disabled label,.form-field.disabled .code-editor,.form-field.disabled .select .selected-container,.select .form-field.disabled .selected-container,.form-field.disabled input,.form-field.disabled select,.form-field.disabled textarea{border-color:var(--baseAlt2Color)}.form-field.disabled.required>label:after{opacity:.5}.form-field input[type=radio],.form-field input[type=checkbox]{position:absolute;z-index:-1;left:0;width:0;height:0;min-height:0;min-width:0;border:0;background:none;user-select:none;pointer-events:none;box-shadow:none;opacity:0}.form-field input[type=radio]~label,.form-field input[type=checkbox]~label{border:0;margin:0;outline:0;background:none;display:inline-flex;vertical-align:top;align-items:center;width:auto;column-gap:5px;user-select:none;padding:0 0 0 27px;line-height:20px;min-height:20px;font-weight:400;font-size:var(--baseFontSize);text-transform:none;color:var(--txtPrimaryColor)}.form-field input[type=radio]~label:before,.form-field input[type=checkbox]~label:before{content:"";display:inline-block;vertical-align:top;position:absolute;z-index:0;left:0;top:0;width:20px;height:20px;line-height:16px;font-family:var(--iconFontFamily);font-size:1.2rem;text-align:center;color:var(--baseColor);cursor:pointer;background:var(--baseColor);border-radius:var(--baseRadius);border:2px solid var(--baseAlt3Color);transition:transform var(--baseAnimationSpeed),border-color var(--baseAnimationSpeed),color var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}.form-field input[type=radio]~label:active:before,.form-field input[type=checkbox]~label:active:before{transform:scale(.9)}.form-field input[type=radio]:focus~label:before,.form-field input[type=radio]~label:hover:before,.form-field input[type=checkbox]:focus~label:before,.form-field input[type=checkbox]~label:hover:before{border-color:var(--baseAlt4Color)}.form-field input[type=radio]:checked~label:before,.form-field input[type=checkbox]:checked~label:before{content:"\eb7a";box-shadow:none;mix-blend-mode:unset;background:var(--successColor);border-color:var(--successColor)}.form-field input[type=radio]:disabled~label,.form-field input[type=checkbox]:disabled~label{pointer-events:none;cursor:not-allowed;color:var(--txtDisabledColor)}.form-field input[type=radio]:disabled~label:before,.form-field input[type=checkbox]:disabled~label:before{opacity:.5}.form-field input[type=radio]~label:before{border-radius:50%;font-size:1rem}.form-field .form-field-block{position:relative;margin:0 0 var(--xsSpacing)}.form-field .form-field-block:last-child{margin-bottom:0}.form-field.form-field-toggle input[type=radio]~label,.form-field.form-field-toggle input[type=checkbox]~label{position:relative}.form-field.form-field-toggle input[type=radio]~label:before,.form-field.form-field-toggle input[type=checkbox]~label:before{content:"";border:0;box-shadow:none;background:var(--baseAlt3Color);transition:background var(--activeAnimationSpeed)}.form-field.form-field-toggle input[type=radio]~label:after,.form-field.form-field-toggle input[type=checkbox]~label:after{content:"";position:absolute;z-index:1;cursor:pointer;background:var(--baseColor);transition:left var(--activeAnimationSpeed),transform var(--activeAnimationSpeed),background var(--activeAnimationSpeed);box-shadow:0 2px 5px 0 var(--shadowColor)}.form-field.form-field-toggle input[type=radio]~label:active:before,.form-field.form-field-toggle input[type=checkbox]~label:active:before{transform:none}.form-field.form-field-toggle input[type=radio]~label:active:after,.form-field.form-field-toggle input[type=checkbox]~label:active:after{transform:scale(.9)}.form-field.form-field-toggle input[type=radio]:focus-visible~label:before,.form-field.form-field-toggle input[type=checkbox]:focus-visible~label:before{box-shadow:0 0 0 2px var(--baseAlt2Color)}.form-field.form-field-toggle input[type=radio]~label:hover:before,.form-field.form-field-toggle input[type=checkbox]~label:hover:before{background:var(--baseAlt4Color)}.form-field.form-field-toggle input[type=radio]:checked~label:before,.form-field.form-field-toggle input[type=checkbox]:checked~label:before{background:var(--successColor)}.form-field.form-field-toggle input[type=radio]:checked~label:after,.form-field.form-field-toggle input[type=checkbox]:checked~label:after{background:var(--baseColor)}.form-field.form-field-toggle input[type=radio]~label,.form-field.form-field-toggle input[type=checkbox]~label{min-height:24px;padding-left:47px}.form-field.form-field-toggle input[type=radio]~label:empty,.form-field.form-field-toggle input[type=checkbox]~label:empty{padding-left:40px}.form-field.form-field-toggle input[type=radio]~label:before,.form-field.form-field-toggle input[type=checkbox]~label:before{width:40px;height:24px;border-radius:24px}.form-field.form-field-toggle input[type=radio]~label:after,.form-field.form-field-toggle input[type=checkbox]~label:after{top:4px;left:4px;width:16px;height:16px;border-radius:16px}.form-field.form-field-toggle input[type=radio]:checked~label:after,.form-field.form-field-toggle input[type=checkbox]:checked~label:after{left:20px}.form-field.form-field-toggle.form-field-sm input[type=radio]~label,.form-field.form-field-toggle.form-field-sm input[type=checkbox]~label{min-height:20px;padding-left:39px}.form-field.form-field-toggle.form-field-sm input[type=radio]~label:empty,.form-field.form-field-toggle.form-field-sm input[type=checkbox]~label:empty{padding-left:32px}.form-field.form-field-toggle.form-field-sm input[type=radio]~label:before,.form-field.form-field-toggle.form-field-sm input[type=checkbox]~label:before{width:32px;height:20px;border-radius:20px}.form-field.form-field-toggle.form-field-sm input[type=radio]~label:after,.form-field.form-field-toggle.form-field-sm input[type=checkbox]~label:after{top:4px;left:4px;width:12px;height:12px;border-radius:12px}.form-field.form-field-toggle.form-field-sm input[type=radio]:checked~label:after,.form-field.form-field-toggle.form-field-sm input[type=checkbox]:checked~label:after{left:16px}.form-field-group{display:flex;width:100%;align-items:center}.form-field-group>.form-field{flex-grow:1;border-left:1px solid var(--baseAlt2Color)}.form-field-group>.form-field:first-child{border-left:0}.form-field-group>.form-field:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.form-field-group>.form-field:not(:first-child)>label{border-top-left-radius:0}.form-field-group>.form-field:not(:first-child)>.code-editor,.select .form-field-group>.form-field:not(:first-child)>.selected-container,.form-field-group>.form-field:not(:first-child)>input,.form-field-group>.form-field:not(:first-child)>select,.form-field-group>.form-field:not(:first-child)>textarea,.form-field-group>.form-field:not(:first-child)>.select .selected-container{border-bottom-left-radius:0}.form-field-group>.form-field:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.form-field-group>.form-field:not(:last-child)>label{border-top-right-radius:0}.form-field-group>.form-field:not(:last-child)>.code-editor,.select .form-field-group>.form-field:not(:last-child)>.selected-container,.form-field-group>.form-field:not(:last-child)>input,.form-field-group>.form-field:not(:last-child)>select,.form-field-group>.form-field:not(:last-child)>textarea,.form-field-group>.form-field:not(:last-child)>.select .selected-container{border-bottom-right-radius:0}.form-field-group .form-field.col-12{width:100%}.form-field-group .form-field.col-11{width:91.6666666667%}.form-field-group .form-field.col-10{width:83.3333333333%}.form-field-group .form-field.col-9{width:75%}.form-field-group .form-field.col-8{width:66.6666666667%}.form-field-group .form-field.col-7{width:58.3333333333%}.form-field-group .form-field.col-6{width:50%}.form-field-group .form-field.col-5{width:41.6666666667%}.form-field-group .form-field.col-4{width:33.3333333333%}.form-field-group .form-field.col-3{width:25%}.form-field-group .form-field.col-2{width:16.6666666667%}.form-field-group .form-field.col-1{width:8.3333333333%}.select{position:relative;display:block;outline:0}.select .option{user-select:none;column-gap:8px}.select .option .icon{min-width:20px;text-align:center;line-height:inherit}.select .option .icon i{vertical-align:middle;line-height:inherit}.select .txt-placeholder{color:var(--txtHintColor)}label~.select .selected-container{border-top:0}.select .selected-container{position:relative;display:flex;flex-wrap:wrap;width:100%;align-items:center;padding-top:0;padding-bottom:0;padding-right:35px!important;user-select:none}.select .selected-container:after{content:"\ea4d";position:absolute;right:5px;top:50%;width:20px;height:20px;line-height:20px;text-align:center;margin-top:-10px;display:inline-block;vertical-align:top;font-size:1rem;font-family:var(--iconFontFamily);align-self:flex-end;color:var(--txtHintColor);transition:color var(--baseAnimationSpeed),transform var(--baseAnimationSpeed)}.select .selected-container:active,.select .selected-container.active{border-bottom-left-radius:0;border-bottom-right-radius:0}.select .selected-container:active:after,.select .selected-container.active:after{color:var(--txtPrimaryColor);transform:rotate(180deg)}.select .selected-container .option{display:flex;width:100%;align-items:center;max-width:100%;user-select:text}.select .selected-container .clear{margin-left:auto;cursor:pointer;color:var(--txtHintColor);transition:color var(--baseAnimationSpeed)}.select .selected-container .clear i{display:inline-block;vertical-align:middle;line-height:1}.select .selected-container .clear:hover{color:var(--txtPrimaryColor)}.select.multiple .selected-container{display:flex;align-items:center;padding-left:2px;row-gap:3px;column-gap:4px}.select.multiple .selected-container .txt-placeholder{margin-left:5px}.select.multiple .selected-container .option{display:inline-flex;width:auto;padding:3px 5px;line-height:1;border-radius:var(--baseRadius);background:var(--baseColor)}.select:not(.multiple) .selected-container .label{margin-left:-2px}.select:not(.multiple) .selected-container .option .txt{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:100%;line-height:normal}.select:not(.multiple) .selected-container:hover{cursor:pointer}.select.disabled{color:var(--txtDisabledColor);pointer-events:none}.select.disabled .txt-placeholder,.select.disabled .selected-container{color:inherit}.select.disabled .selected-container .link-hint{pointer-events:auto}.select.disabled .selected-container *:not(.link-hint){color:inherit!important}.select.disabled .selected-container:after,.select.disabled .selected-container .clear{display:none}.select.disabled .selected-container:hover{cursor:inherit}.select .txt-missing{color:var(--txtHintColor);padding:5px 12px;margin:0}.select .options-dropdown{max-height:none;border:0;overflow:auto;border-top-left-radius:0;border-top-right-radius:0;margin-top:-2px;box-shadow:0 2px 5px 0 var(--shadowColor),inset 0 0 0 2px var(--baseAlt2Color)}.select .options-dropdown .input-group:focus-within{box-shadow:none}.select .options-dropdown .form-field.options-search{margin:0 0 5px;padding:0 0 2px;color:var(--txtHintColor);border-bottom:1px solid var(--baseAlt2Color)}.select .options-dropdown .form-field.options-search .input-group{border-radius:0;padding:0 0 0 10px;margin:0;background:none;column-gap:0;border:0}.select .options-dropdown .form-field.options-search input{border:0;padding-left:9px;padding-right:9px;background:none}.select .options-dropdown .options-list{overflow:auto;max-height:270px;width:auto;margin-left:0;margin-right:-5px;padding-right:5px}.select .options-list:not(:empty)~[slot=afterOptions]:not(:empty){margin:5px -5px -5px}.select .options-list:not(:empty)~[slot=afterOptions]:not(:empty) .btn-block{border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:var(--baseRadius);border-bottom-right-radius:var(--baseRadius)}label~.select .selected-container{padding-bottom:4px;border-top-left-radius:0;border-top-right-radius:0}label~.select.multiple .selected-container{padding-top:3px;padding-bottom:3px;padding-left:10px}.select.block-options.multiple .selected-container .option{width:100%;box-shadow:0 2px 5px 0 var(--shadowColor)}.field-type-select .options-dropdown{padding:2px}.field-type-select .options-dropdown .form-field.options-search{margin:0}.field-type-select .options-dropdown .options-list{max-height:490px;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;margin:0;padding:0}.field-type-select .options-dropdown .dropdown-item{width:50%;flex-grow:1;margin:0;padding-left:12px;border-radius:0;border-bottom:1px solid var(--baseAlt2Color)}.field-type-select .options-dropdown .dropdown-item:nth-child(2n){border-left:1px solid var(--baseAlt2Color)}.field-type-select .options-dropdown .dropdown-item:nth-last-child(-n+2){border-bottom:0}.field-type-select .options-dropdown .dropdown-item.selected{background:var(--baseAlt1Color)}.form-field-file label{border-bottom:0}.form-field-file .filename{align-items:center;max-width:100%;min-width:0;margin-right:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.form-field-file .filename i{text-decoration:none}.form-field-file .files-list{padding-top:5px;background:var(--baseAlt1Color);border:0;border-bottom-left-radius:var(--baseRadius);border-bottom-right-radius:var(--baseRadius);transition:background var(--baseAnimationSpeed)}.form-field-file .files-list .list-item{display:flex;width:100%;align-items:center;row-gap:10px;column-gap:var(--xsSpacing);padding:10px 15px;min-height:44px;border-top:1px solid var(--baseAlt2Color)}.form-field-file .files-list .list-item:last-child{border-radius:inherit;border-bottom:0}.form-field-file .files-list .btn-list-item{padding:5px}.form-field-file:focus-within .files-list,.form-field-file:focus-within label{background:var(--baseAlt1Color)}.form-field label~.code-editor{padding-bottom:6px;padding-top:4px}.code-editor .cm-editor{border:0!important;outline:none!important}.code-editor .cm-editor .cm-line{padding-left:0;padding-right:0}.code-editor .cm-editor .cm-tooltip-autocomplete{box-shadow:0 2px 5px 0 var(--shadowColor);border-radius:var(--baseRadius);background:var(--baseColor);border:0;z-index:9999;padding:0 3px;font-size:.92rem}.code-editor .cm-editor .cm-tooltip-autocomplete ul{margin:0;border-radius:inherit}.code-editor .cm-editor .cm-tooltip-autocomplete ul>:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.code-editor .cm-editor .cm-tooltip-autocomplete ul>:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.code-editor .cm-editor .cm-tooltip-autocomplete ul li[aria-selected]{background:var(--infoColor)}.code-editor .cm-editor .cm-scroller{outline:0!important;font-family:var(--monospaceFontFamily);font-size:var(--baseFontSize);line-height:var(--baseLineHeight)}.code-editor .cm-editor .cm-cursorLayer .cm-cursor{margin-left:0!important}.code-editor .cm-editor .cm-placeholder{color:var(--txtDisabledColor);font-family:var(--monospaceFontFamily);font-size:var(--baseFontSize);line-height:var(--baseLineHeight)}.code-editor .cm-editor .cm-selectionMatch{background:var(--infoAltColor)}.code-editor .cm-editor.cm-focused .cm-matchingBracket{background-color:#328c821a}.main-menu{--menuItemSize: 45px;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;row-gap:var(--smSpacing);font-size:var(--xlFontSize);color:var(--txtPrimaryColor)}.main-menu i{font-size:24px;line-height:1}.main-menu .menu-item{position:relative;outline:0;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;text-align:center;justify-content:center;user-select:none;color:inherit;min-width:var(--menuItemSize);min-height:var(--menuItemSize);border:2px solid transparent;border-radius:var(--lgRadius);transition:background var(--baseAnimationSpeed),border var(--baseAnimationSpeed)}.main-menu .menu-item:focus-visible,.main-menu .menu-item:hover{background:var(--baseAlt1Color)}.main-menu .menu-item:active{background:var(--baseAlt2Color);transition-duration:var(--activeAnimationSpeed)}.main-menu .menu-item.active,.main-menu .menu-item.current-route{background:var(--baseColor);border-color:var(--primaryColor)}.app-sidebar{position:relative;z-index:1;display:flex;flex-grow:0;flex-shrink:0;flex-direction:column;align-items:center;width:var(--appSidebarWidth);padding:var(--smSpacing) 0px var(--smSpacing);background:var(--baseColor);border-right:1px solid var(--baseAlt2Color)}.app-sidebar .main-menu{flex-grow:1;justify-content:flex-start;overflow-x:hidden;overflow-y:auto;overflow-y:overlay;margin-top:34px;margin-bottom:var(--baseSpacing)}.app-layout{display:flex;width:100%;height:100vh}.app-layout .app-body{flex-grow:1;min-width:0;height:100%;display:flex;align-items:stretch}.app-layout .app-sidebar~.app-body{min-width:650px}.page-sidebar{--sidebarListItemMargin: 10px;z-index:0;display:flex;flex-direction:column;width:var(--pageSidebarWidth);flex-shrink:0;flex-grow:0;overflow-x:hidden;overflow-y:auto;background:var(--baseColor);padding:calc(var(--baseSpacing) - 5px) 0 var(--smSpacing);border-right:1px solid var(--baseAlt2Color)}.page-sidebar>*{padding:0 var(--smSpacing)}.page-sidebar .sidebar-content{overflow-x:hidden;overflow-y:auto;overflow-y:overlay}.page-sidebar .sidebar-content>:first-child{margin-top:0}.page-sidebar .sidebar-content>:last-child{margin-bottom:0}.page-sidebar .sidebar-footer{margin-top:var(--smSpacing)}.page-sidebar .search{display:flex;align-items:center;width:auto;column-gap:5px;margin:0 0 var(--xsSpacing);color:var(--txtHintColor);opacity:.7;transition:opacity var(--baseAnimationSpeed),color var(--baseAnimationSpeed)}.page-sidebar .search input{border:0;background:var(--baseColor);transition:box-shadow var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}.page-sidebar .search .btn-clear{margin-right:-8px}.page-sidebar .search:hover,.page-sidebar .search:focus-within,.page-sidebar .search.active{opacity:1;color:var(--txtPrimaryColor)}.page-sidebar .search:hover input,.page-sidebar .search:focus-within input,.page-sidebar .search.active input{background:var(--baseAlt2Color)}.page-sidebar .sidebar-title{display:flex;align-items:center;gap:5px;width:100%;margin:var(--baseSpacing) 0 var(--xsSpacing);font-weight:600;font-size:1rem;line-height:var(--smLineHeight);color:var(--txtHintColor)}.page-sidebar .sidebar-title .label{font-weight:400}.page-sidebar .sidebar-list-item{cursor:pointer;outline:0;text-decoration:none;position:relative;display:flex;width:100%;align-items:center;column-gap:10px;margin:var(--sidebarListItemMargin) 0;padding:3px 10px;font-size:var(--xlFontSize);min-height:var(--btnHeight);min-width:0;color:var(--txtHintColor);border-radius:var(--baseRadius);user-select:none;transition:background var(--baseAnimationSpeed),color var(--baseAnimationSpeed)}.page-sidebar .sidebar-list-item i{font-size:18px}.page-sidebar .sidebar-list-item .txt{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.page-sidebar .sidebar-list-item:focus-visible,.page-sidebar .sidebar-list-item:hover,.page-sidebar .sidebar-list-item:active,.page-sidebar .sidebar-list-item.active{color:var(--txtPrimaryColor);background:var(--baseAlt1Color)}.page-sidebar .sidebar-list-item:active{background:var(--baseAlt2Color);transition-duration:var(--activeAnimationSpeed)}.page-sidebar .sidebar-content-compact .sidebar-list-item{--sidebarListItemMargin: 5px}@media screen and (max-height: 600px){.page-sidebar{--sidebarListItemMargin: 5px}}@media screen and (max-width: 1100px){.page-sidebar{--pageSidebarWidth: 190px}.page-sidebar>*{padding-left:10px;padding-right:10px}}.page-header{display:flex;align-items:center;width:100%;min-height:var(--btnHeight);gap:var(--xsSpacing);margin:0 0 var(--baseSpacing)}.page-header .btns-group{margin-left:auto;justify-content:end}@media screen and (max-width: 1050px){.page-header{flex-wrap:wrap}.page-header .btns-group{width:100%}.page-header .btns-group .btn{flex-grow:1;flex-basis:0}}.page-header-wrapper{background:var(--baseColor);width:auto;margin-top:calc(-1 * (var(--baseSpacing) - 5px));margin-left:calc(-1 * var(--baseSpacing));margin-right:calc(-1 * var(--baseSpacing));margin-bottom:var(--baseSpacing);padding:calc(var(--baseSpacing) - 5px) var(--baseSpacing);border-bottom:1px solid var(--baseAlt2Color)}.breadcrumbs{display:flex;align-items:center;gap:30px;color:var(--txtDisabledColor)}.breadcrumbs .breadcrumb-item{position:relative;margin:0;line-height:1;font-weight:400}.breadcrumbs .breadcrumb-item:after{content:"/";position:absolute;right:-20px;top:0;width:10px;text-align:center;pointer-events:none;opacity:.4}.breadcrumbs .breadcrumb-item:last-child{word-break:break-word;color:var(--txtPrimaryColor)}.breadcrumbs .breadcrumb-item:last-child:after{content:none;display:none}.breadcrumbs a{text-decoration:none;color:inherit;transition:color var(--baseAnimationSpeed)}.breadcrumbs a:hover{color:var(--txtPrimaryColor)}.page-content{position:relative;display:block;width:100%;flex-grow:1;padding:calc(var(--baseSpacing) - 5px) var(--baseSpacing)}.page-footer{display:flex;gap:5px;align-items:center;justify-content:right;text-align:right;padding:0px var(--baseSpacing) 15px;color:var(--txtDisabledColor);font-size:var(--xsFontSize);line-height:var(--smLineHeight)}.page-footer i{font-size:1.2em}.page-footer a{color:inherit;text-decoration:none;transition:color var(--baseAnimationSpeed)}.page-footer a:focus-visible,.page-footer a:hover,.page-footer a:active{color:var(--txtPrimaryColor)}.page-wrapper{display:flex;flex-direction:column;flex-grow:1;width:100%;overflow-x:hidden;overflow-y:auto;overflow-y:overlay}.overlay-active .page-wrapper{overflow-y:hidden}.page-wrapper.full-page{background:var(--baseColor)}.page-wrapper.center-content .page-content{display:flex;align-items:center}@keyframes tabChange{0%{opacity:.5}to{opacity:1}}.tabs-header{display:flex;align-items:stretch;justify-content:flex-start;column-gap:10px;width:100%;min-height:50px;user-select:none;margin:0 0 var(--baseSpacing);border-bottom:1px solid var(--baseAlt2Color)}.tabs-header .tab-item{position:relative;outline:0;border:0;background:none;display:inline-flex;align-items:center;justify-content:center;min-width:70px;gap:5px;padding:10px;margin:0;font-size:var(--lgFontSize);line-height:var(--baseLineHeight);font-family:var(--baseFontFamily);color:var(--txtHintColor);text-align:center;text-decoration:none;cursor:pointer;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius);transition:color var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}.tabs-header .tab-item:after{content:"";position:absolute;display:block;left:0;bottom:-1px;width:100%;height:2px;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius);background:var(--primaryColor);transform:rotateY(90deg);transition:transform .2s}.tabs-header .tab-item .txt,.tabs-header .tab-item i{display:inline-block;vertical-align:top}.tabs-header .tab-item:hover,.tabs-header .tab-item:focus-visible,.tabs-header .tab-item:active{color:var(--txtPrimaryColor)}.tabs-header .tab-item:focus-visible,.tabs-header .tab-item:active{transition-duration:var(--activeAnimationSpeed);background:var(--baseAlt2Color)}.tabs-header .tab-item.active{color:var(--txtPrimaryColor)}.tabs-header .tab-item.active:after{transform:rotateY(0)}.tabs-header .tab-item.disabled{pointer-events:none;color:var(--txtDisabledColor)}.tabs-header .tab-item.disabled:after{display:none}.tabs-header.right{justify-content:flex-end}.tabs-header.center{justify-content:center}.tabs-header.stretched .tab-item{flex-grow:1;flex-basis:0}.tabs-header.compact{min-height:30px;margin-bottom:var(--smSpacing)}.tabs-content{position:relative}.tabs-content>.tab-item{width:100%;display:none}.tabs-content>.tab-item.active{display:block;opacity:0;animation:tabChange .2s forwards}.tabs-content>.tab-item>:first-child{margin-top:0}.tabs-content>.tab-item>:last-child{margin-bottom:0}.tabs{position:relative}.accordion{outline:0;position:relative;border-radius:var(--baseRadius);background:var(--baseColor);border:1px solid var(--baseAlt2Color);transition:box-shadow var(--baseAnimationSpeed),margin var(--baseAnimationSpeed)}.accordion .accordion-header{outline:0;position:relative;display:flex;min-height:52px;align-items:center;row-gap:10px;column-gap:var(--smSpacing);padding:12px 20px 10px;width:100%;user-select:none;color:var(--txtPrimaryColor);border-radius:inherit;transition:background var(--baseAnimationSpeed),box-shadow var(--baseAnimationSpeed)}.accordion .accordion-header .icon{width:18px;text-align:center}.accordion .accordion-header .icon i{display:inline-block;vertical-align:top;font-size:1.1rem}.accordion .accordion-header.interactive{padding-right:50px;cursor:pointer}.accordion .accordion-header.interactive:after{content:"\ea4e";position:absolute;right:15px;top:50%;margin-top:-12.5px;width:25px;height:25px;line-height:25px;color:var(--txtHintColor);font-family:var(--iconFontFamily);font-size:1.3em;text-align:center;transition:color var(--baseAnimationSpeed)}.accordion .accordion-header:hover:after,.accordion .accordion-header.focus:after,.accordion .accordion-header:focus-visible:after{color:var(--txtPrimaryColor)}.accordion .accordion-header:active{transition-duration:var(--activeAnimationSpeed)}.accordion .accordion-content{padding:20px}.accordion:hover,.accordion:focus-visible,.accordion.active{z-index:9}.accordion:hover .accordion-header.interactive,.accordion:focus-visible .accordion-header.interactive,.accordion.active .accordion-header.interactive{background:var(--baseAlt1Color)}.accordion.drag-over .accordion-header{background:var(--bodyColor)}.accordion.active{box-shadow:0 2px 5px 0 var(--shadowColor)}.accordion.active .accordion-header{box-shadow:0 0 0 1px var(--baseAlt2Color);border-bottom-left-radius:0;border-bottom-right-radius:0;background:var(--bodyColor)}.accordion.active .accordion-header.interactive{background:var(--bodyColor)}.accordion.active .accordion-header.interactive:after{color:inherit;content:"\ea78"}.accordion.disabled{z-index:0;border-color:var(--baseAlt1Color)}.accordion.disabled .accordion-header{color:var(--txtDisabledColor)}.accordions .accordion{border-radius:0;margin:-1px 0 0}.accordions>.accordion.active,.accordions>.accordion-wrapper>.accordion.active{margin:var(--smSpacing) 0;border-radius:var(--baseRadius)}.accordions>.accordion:first-child,.accordions>.accordion-wrapper:first-child>.accordion{margin-top:0;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius)}.accordions>.accordion:last-child,.accordions>.accordion-wrapper:last-child>.accordion{margin-bottom:0;border-bottom-left-radius:var(--baseRadius);border-bottom-right-radius:var(--baseRadius)}table{--entranceAnimationSpeed: .3s;border-collapse:separate;min-width:100%;transition:opacity var(--baseAnimationSpeed)}table .form-field{margin:0;line-height:1;text-align:left}table td,table th{outline:0;vertical-align:middle;position:relative;text-align:left;padding:5px 10px;border-bottom:1px solid var(--baseAlt2Color)}table td:first-child,table th:first-child{padding-left:20px}table td:last-child,table th:last-child{padding-right:20px}table th{color:var(--txtHintColor);font-weight:600;font-size:1rem;user-select:none;height:50px;line-height:var(--smLineHeight)}table th i{font-size:inherit}table td{height:60px;word-break:break-word}table .min-width{width:1%!important;white-space:nowrap}table .nowrap{white-space:nowrap}table .col-sort{cursor:pointer;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius);padding-right:30px;transition:color var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}table .col-sort:after{content:"\ea4c";position:absolute;right:10px;top:50%;margin-top:-12.5px;line-height:25px;height:25px;font-family:var(--iconFontFamily);font-weight:400;color:var(--txtHintColor);opacity:0;transition:color var(--baseAnimationSpeed),opacity var(--baseAnimationSpeed)}table .col-sort.sort-desc:after{content:"\ea4c"}table .col-sort.sort-asc:after{content:"\ea76"}table .col-sort.sort-active:after{opacity:1}table .col-sort:hover,table .col-sort:focus-visible{background:var(--baseAlt1Color)}table .col-sort:hover:after,table .col-sort:focus-visible:after{opacity:1}table .col-sort:active{transition-duration:var(--activeAnimationSpeed);background:var(--baseAlt2Color)}table .col-sort.col-sort-disabled{cursor:default;background:none}table .col-sort.col-sort-disabled:after{display:none}table .col-header-content{display:inline-flex;align-items:center;flex-wrap:nowrap;gap:5px}table .col-header-content .txt{max-width:140px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}table .col-field-created,table .col-field-updated,table .col-type-action{width:1%!important;white-space:nowrap}table .col-type-action{white-space:nowrap;text-align:right;color:var(--txtHintColor)}table .col-type-action i{display:inline-block;vertical-align:top;transition:transform var(--baseAnimationSpeed)}table td.col-type-json{font-family:monospace;font-size:var(--smFontSize);line-height:var(--smLineHeight);max-width:300px}table .col-type-text{max-width:300px}table .col-type-select{min-width:150px}table .col-type-email{min-width:120px;white-space:nowrap}table .col-type-file{min-width:100px}table td.col-field-id,table td.col-field-username{width:0;white-space:nowrap}table tr{outline:0;background:var(--bodyColor);transition:background var(--baseAnimationSpeed)}table tr.row-handle{cursor:pointer;user-select:none}table tr.row-handle:focus-visible,table tr.row-handle:hover,table tr.row-handle:active{background:var(--baseAlt1Color)}table tr.row-handle:focus-visible .action-col,table tr.row-handle:hover .action-col,table tr.row-handle:active .action-col{color:var(--txtPrimaryColor)}table tr.row-handle:focus-visible .action-col i,table tr.row-handle:hover .action-col i,table tr.row-handle:active .action-col i{transform:translate(3px)}table tr.row-handle:active{transition-duration:var(--activeAnimationSpeed)}table.table-compact td,table.table-compact th{height:auto}table.table-border{border:1px solid var(--baseAlt2Color)}table.table-border tr{background:var(--baseColor)}table.table-border th{background:var(--baseAlt1Color)}table.table-border>:last-child>:last-child th,table.table-border>:last-child>:last-child td{border-bottom:0}table.table-animate tr{animation:entranceTop var(--entranceAnimationSpeed)}table.table-loading{pointer-events:none;opacity:.7}.table-wrapper{width:auto;padding:0;max-width:calc(100% + 2 * var(--baseSpacing));margin-left:calc(var(--baseSpacing) * -1);margin-right:calc(var(--baseSpacing) * -1)}.table-wrapper .bulk-select-col{min-width:70px}.table-wrapper .bulk-select-col input[type=checkbox]~label{opacity:.7}.table-wrapper .bulk-select-col label:hover,.table-wrapper .bulk-select-col label:focus-within,.table-wrapper .bulk-select-col input[type=checkbox]:checked~label{opacity:1!important}.table-wrapper td,.table-wrapper th{position:relative}.table-wrapper td:first-child,.table-wrapper th:first-child{padding-left:calc(var(--baseSpacing) + 3px)}.table-wrapper td:last-child,.table-wrapper th:last-child{padding-right:calc(var(--baseSpacing) + 3px)}.table-wrapper .bulk-select-col,.table-wrapper .col-type-action{position:sticky;z-index:99;transition:box-shadow var(--baseAnimationSpeed)}.table-wrapper .bulk-select-col{left:0px}.table-wrapper .col-type-action{right:0}.table-wrapper .bulk-select-col,.table-wrapper .col-type-action{background:inherit}.table-wrapper th.bulk-select-col,.table-wrapper th.col-type-action{background:var(--bodyColor)}.table-wrapper.scrollable .bulk-select-col{box-shadow:3px 0 5px 0 var(--shadowColor)}.table-wrapper.scrollable .col-type-action{box-shadow:-3px 0 5px 0 var(--shadowColor)}.table-wrapper.scrollable.scroll-start .bulk-select-col,.table-wrapper.scrollable.scroll-end .col-type-action{box-shadow:none}.searchbar{--searchHeight: 44px;outline:0;display:flex;align-items:center;height:var(--searchHeight);width:100%;flex-grow:1;padding:5px 7px;margin:0 0 var(--smSpacing);white-space:nowrap;color:var(--txtHintColor);background:var(--baseAlt1Color);border-radius:var(--btnHeight);transition:color var(--baseAnimationSpeed),background var(--baseAnimationSpeed),box-shadow var(--baseAnimationSpeed)}.searchbar>:first-child{border-top-left-radius:var(--btnHeight);border-bottom-left-radius:var(--btnHeight)}.searchbar>:last-child{border-top-right-radius:var(--btnHeight);border-bottom-right-radius:var(--btnHeight)}.searchbar .btn{border-radius:var(--btnHeight)}.searchbar .code-editor,.searchbar input,.searchbar input:focus{font-size:var(--baseFontSize);font-family:var(--monospaceFontFamily);border:0;background:none}.searchbar label>i{line-height:inherit}.searchbar .search-options{flex-shrink:0;width:90px}.searchbar .search-options .selected-container{border-radius:inherit;background:none;padding-right:25px!important}.searchbar .search-options:not(:focus-within) .selected-container{color:var(--txtHintColor)}.searchbar:focus-within{color:var(--txtPrimaryColor);background:var(--baseAlt2Color)}.searchbar-wrapper{position:relative;display:flex;align-items:center;width:100%;min-width:var(--btnHeight);min-height:var(--btnHeight)}.searchbar-wrapper .search-toggle{position:absolute;right:0;top:0}.bulkbar{position:sticky;bottom:var(--baseSpacing);z-index:101;gap:10px;display:flex;justify-content:center;align-items:center;width:var(--smWrapperWidth);max-width:100%;margin:var(--smSpacing) auto;padding:10px var(--smSpacing);border-radius:var(--btnHeight);background:var(--baseColor);border:1px solid var(--baseAlt2Color);box-shadow:0 2px 5px 0 var(--shadowColor)}.flatpickr-calendar{opacity:0;display:none;text-align:center;visibility:hidden;padding:0;animation:none;direction:ltr;border:0;font-size:1rem;line-height:24px;position:absolute;width:298px;box-sizing:border-box;user-select:none;color:var(--txtPrimaryColor);background:var(--baseColor);border-radius:var(--baseRadius);box-shadow:0 2px 5px 0 var(--shadowColor),0 0 0 1px var(--baseAlt2Color)}.flatpickr-calendar input,.flatpickr-calendar select{box-shadow:none;min-height:0;height:var(--inputHeight);background:none;border-radius:var(--baseRadius);border:1px solid var(--baseAlt1Color)}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown .3s cubic-bezier(.23,1,.32,1);animation:fpFadeInDown .3s cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:0;width:100%}.flatpickr-calendar.static{position:absolute;top:100%;margin-top:2px;margin-bottom:10px;width:100%}.flatpickr-calendar.static .flatpickr-days{width:100%}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none!important;box-shadow:none!important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 var(--baseAlt2Color),5px 0 0 var(--baseAlt2Color);box-shadow:-2px 0 0 var(--baseAlt2Color),5px 0 0 var(--baseAlt2Color)}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.hasTime .flatpickr-time{height:40px;border-top:1px solid var(--baseAlt2Color)}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:"";height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.arrowRight:before,.flatpickr-calendar.rightMost:after,.flatpickr-calendar.arrowRight:after{left:auto;right:22px}.flatpickr-calendar.arrowCenter:before,.flatpickr-calendar.arrowCenter:after{left:50%;right:50%}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:var(--baseColor)}.flatpickr-calendar.arrowTop:after{border-bottom-color:var(--baseColor)}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:var(--baseColor)}.flatpickr-calendar.arrowBottom:after{border-top-color:var(--baseColor)}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative}.flatpickr-months{display:flex;margin:0 0 4px}.flatpickr-months .flatpickr-month{background:transparent;color:var(--txtPrimaryColor);fill:var(--txtPrimaryColor);height:34px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{text-decoration:none;cursor:pointer;position:absolute;top:0;height:34px;padding:10px;z-index:3;color:var(--txtPrimaryColor);fill:var(--txtPrimaryColor)}.flatpickr-months .flatpickr-prev-month.flatpickr-disabled,.flatpickr-months .flatpickr-next-month.flatpickr-disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{left:0}.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,.flatpickr-months .flatpickr-next-month.flatpickr-next-month{right:0}.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover,.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:var(--txtHintColor)}.flatpickr-months .flatpickr-prev-month svg,.flatpickr-months .flatpickr-next-month svg{width:14px;height:14px}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%}.numInputWrapper input::-ms-clear{display:none}.numInputWrapper input::-webkit-outer-spin-button,.numInputWrapper input::-webkit-inner-spin-button{margin:0;-webkit-appearance:none}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,.15);box-sizing:border-box}.numInputWrapper span:hover{background:rgba(0,0,0,.1)}.numInputWrapper span:active{background:rgba(0,0,0,.2)}.numInputWrapper span:after{display:block;content:"";position:absolute}.numInputWrapper span.arrowUp{top:0;border-bottom:0}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,.6);top:26%}.numInputWrapper span.arrowDown{top:50%}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,.6);top:40%}.numInputWrapper span svg{width:inherit;height:auto}.numInputWrapper span svg path{fill:#00000080}.numInputWrapper:hover{background:var(--baseAlt2Color)}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{line-height:inherit;color:inherit;position:absolute;width:75%;left:12.5%;padding:1px 0;line-height:1;display:flex;align-items:center;justify-content:center;text-align:center}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0}.flatpickr-current-month span.cur-month:hover{background:var(--baseAlt2Color)}.flatpickr-current-month .numInputWrapper{display:inline-flex;align-items:center;justify-content:center;width:63px;margin:0 5px}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:var(--txtPrimaryColor)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:var(--txtPrimaryColor)}.flatpickr-current-month input.cur-year{background:transparent;box-sizing:border-box;color:inherit;cursor:text;margin:0;display:inline-block;font-size:inherit;font-family:inherit;line-height:inherit;vertical-align:initial;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{color:var(--txtDisabledColor);background:transparent;pointer-events:none}.flatpickr-current-month .flatpickr-monthDropdown-months{appearance:menulist;box-sizing:border-box;color:inherit;cursor:pointer;font-size:inherit;line-height:inherit;outline:none;position:relative;vertical-align:initial;-webkit-box-sizing:border-box;-webkit-appearance:menulist;-moz-appearance:menulist;width:auto}.flatpickr-current-month .flatpickr-monthDropdown-months:focus,.flatpickr-current-month .flatpickr-monthDropdown-months:active{outline:none}.flatpickr-current-month .flatpickr-monthDropdown-months:hover{background:var(--baseAlt2Color)}.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month{background-color:transparent;outline:none;padding:0}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px}.flatpickr-weekdays .flatpickr-weekdaycontainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}span.flatpickr-weekday{display:block;flex:1;margin:0;cursor:default;line-height:1;background:transparent;color:var(--txtHintColor);text-align:center;font-weight:bolder;font-size:var(--smFontSize)}.dayContainer,.flatpickr-weeks{padding:1px 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:100%;box-sizing:border-box;display:inline-block;display:flex;flex-wrap:wrap;transform:translateZ(0);opacity:1}.dayContainer+.dayContainer{-webkit-box-shadow:-1px 0 0 var(--baseAlt2Color);box-shadow:-1px 0 0 var(--baseAlt2Color)}.flatpickr-day{background:none;border:1px solid transparent;border-radius:var(--baseRadius);box-sizing:border-box;color:var(--txtPrimaryColor);cursor:pointer;font-weight:400;width:calc(14.2857143% - 2px);flex-basis:calc(14.2857143% - 2px);height:39px;margin:1px;display:inline-flex;align-items:center;justify-content:center;position:relative;text-align:center;flex-direction:column}.flatpickr-day.weekend,.flatpickr-day:nth-child(7n+6),.flatpickr-day:nth-child(7n+7){color:var(--dangerColor)}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:var(--baseAlt2Color);border-color:var(--baseAlt2Color)}.flatpickr-day.today{border-color:var(--baseColor)}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:var(--primaryColor);background:var(--primaryColor);color:var(--baseColor)}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:var(--primaryColor);-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:var(--primaryColor)}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange+.endRange:not(:nth-child(7n+1)),.flatpickr-day.startRange.startRange+.endRange:not(:nth-child(7n+1)),.flatpickr-day.endRange.startRange+.endRange:not(:nth-child(7n+1)){-webkit-box-shadow:-10px 0 0 var(--primaryColor);box-shadow:-10px 0 0 var(--primaryColor)}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;box-shadow:-5px 0 0 var(--baseAlt2Color),5px 0 0 var(--baseAlt2Color)}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:var(--txtDisabledColor);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover{cursor:not-allowed;color:var(--txtDisabledColor);background:var(--baseAlt2Color)}.flatpickr-day.week.selected{border-radius:0;box-shadow:-5px 0 0 var(--primaryColor),5px 0 0 var(--primaryColor)}.flatpickr-day.hidden{visibility:hidden}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{float:left}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 var(--baseAlt2Color);box-shadow:1px 0 0 var(--baseAlt2Color)}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day,.flatpickr-weekwrapper span.flatpickr-day:hover{display:block;width:100%;max-width:none;color:var(--txtHintColor);background:transparent;cursor:default;border:none}.flatpickr-innerContainer{display:flex;box-sizing:border-box;overflow:hidden;padding:5px}.flatpickr-rContainer{display:inline-block;padding:0;width:100%;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:var(--txtPrimaryColor)}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:var(--txtPrimaryColor)}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;box-shadow:none;border:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;color:var(--txtPrimaryColor);font-size:14px;position:relative;box-sizing:border-box;background:var(--baseColor);-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-time input.flatpickr-hour{font-weight:700}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;float:left;line-height:inherit;color:var(--txtPrimaryColor);font-weight:700;width:2%;user-select:none;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400}.flatpickr-time input:hover,.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time input:focus,.flatpickr-time .flatpickr-am-pm:focus{background:var(--baseAlt1Color)}.flatpickr-input[readonly]{cursor:pointer}@keyframes fpFadeInDown{0%{opacity:0;transform:translate3d(0,10px,0)}to{opacity:1;transform:translateZ(0)}}.flatpickr-hide-prev-next-month-days .flatpickr-calendar .prevMonthDay{visibility:hidden}.flatpickr-hide-prev-next-month-days .flatpickr-calendar .nextMonthDay,.flatpickr-inline-container .flatpickr-input{display:none}.flatpickr-inline-container .flatpickr-calendar{margin:0;box-shadow:none;border:1px solid var(--baseAlt2Color)}.docs-sidebar{--itemsSpacing: 10px;--itemsHeight: 40px;position:relative;min-width:180px;max-width:300px;height:100%;flex-shrink:0;overflow-x:hidden;overflow-y:auto;overflow-y:overlay;background:var(--bodyColor);padding:var(--smSpacing) var(--xsSpacing);border-right:1px solid var(--baseAlt1Color)}.docs-sidebar .sidebar-content{display:block;width:100%}.docs-sidebar .sidebar-item{position:relative;outline:0;cursor:pointer;text-decoration:none;display:flex;width:100%;gap:10px;align-items:center;text-align:right;justify-content:start;padding:5px 15px;margin:0 0 var(--itemsSpacing) 0;font-size:var(--lgFontSize);min-height:var(--itemsHeight);border-radius:var(--baseRadius);user-select:none;color:var(--txtHintColor);transition:background var(--baseAnimationSpeed),color var(--baseAnimationSpeed)}.docs-sidebar .sidebar-item:last-child{margin-bottom:0}.docs-sidebar .sidebar-item:focus-visible,.docs-sidebar .sidebar-item:hover,.docs-sidebar .sidebar-item:active,.docs-sidebar .sidebar-item.active{color:var(--txtPrimaryColor);background:var(--baseAlt1Color)}.docs-sidebar .sidebar-item:active{background:var(--baseAlt2Color);transition-duration:var(--activeAnimationSpeed)}.docs-sidebar.compact .sidebar-item{--itemsSpacing: 7px}.docs-content{width:100%;display:block;padding:calc(var(--baseSpacing) - 3px) var(--baseSpacing);overflow:auto}.docs-content-wrapper{display:flex;width:100%;height:100%}.docs-panel{width:960px;height:100%}.docs-panel .overlay-panel-section.panel-header{padding:0;border:0;box-shadow:none}.docs-panel .overlay-panel-section.panel-content{padding:0!important}.docs-panel .overlay-panel-section.panel-footer{display:none}@media screen and (max-width: 1000px){.docs-panel .overlay-panel-section.panel-footer{display:flex}}.panel-wrapper.svelte-lxxzfu{animation:slideIn .2s}@keyframes svelte-1bvelc2-refresh{to{transform:rotate(180deg)}}.btn.refreshing.svelte-1bvelc2 i.svelte-1bvelc2{animation:svelte-1bvelc2-refresh .15s ease-out}.datetime.svelte-zdiknu{width:100%;display:block;line-height:var(--smLineHeight)}.time.svelte-zdiknu{font-size:var(--smFontSize);color:var(--txtHintColor)}.horizontal-scroller.svelte-wc2j9h{width:auto;overflow-x:auto}.horizontal-scroller-wrapper.svelte-wc2j9h{position:relative}.horizontal-scroller-wrapper .columns-dropdown{top:40px;z-index:100;max-height:340px}.chart-wrapper.svelte-vh4sl8.svelte-vh4sl8{position:relative;display:block;width:100%}.chart-wrapper.loading.svelte-vh4sl8 .chart-canvas.svelte-vh4sl8{pointer-events:none;opacity:.5}.chart-loader.svelte-vh4sl8.svelte-vh4sl8{position:absolute;z-index:999;top:50%;left:50%;transform:translate(-50%,-50%)}.prism-light code[class*=language-],.prism-light pre[class*=language-]{color:#111b27;background:0 0;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}.prism-light code[class*=language-] ::-moz-selection,.prism-light code[class*=language-]::-moz-selection,.prism-light pre[class*=language-] ::-moz-selection,.prism-light pre[class*=language-]::-moz-selection{background:#8da1b9}.prism-light code[class*=language-] ::selection,.prism-light code[class*=language-]::selection,.prism-light pre[class*=language-] ::selection,.prism-light pre[class*=language-]::selection{background:#8da1b9}.prism-light pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}.prism-light :not(pre)>code[class*=language-],.prism-light pre[class*=language-]{background:#e3eaf2}.prism-light :not(pre)>code[class*=language-]{padding:.1em .3em;border-radius:.3em;white-space:normal}.prism-light .token.cdata,.prism-light .token.comment,.prism-light .token.doctype,.prism-light .token.prolog{color:#3c526d}.prism-light .token.punctuation{color:#111b27}.prism-light .token.delimiter.important,.prism-light .token.selector .parent,.prism-light .token.tag,.prism-light .token.tag .token.punctuation{color:#006d6d}.prism-light .token.attr-name,.prism-light .token.boolean,.prism-light .token.boolean.important,.prism-light .token.constant,.prism-light .token.number,.prism-light .token.selector .token.attribute{color:#755f00}.prism-light .token.class-name,.prism-light .token.key,.prism-light .token.parameter,.prism-light .token.property,.prism-light .token.property-access,.prism-light .token.variable{color:#005a8e}.prism-light .token.attr-value,.prism-light .token.color,.prism-light .token.inserted,.prism-light .token.selector .token.value,.prism-light .token.string,.prism-light .token.string .token.url-link{color:#116b00}.prism-light .token.builtin,.prism-light .token.keyword-array,.prism-light .token.package,.prism-light .token.regex{color:#af00af}.prism-light .token.function,.prism-light .token.selector .token.class,.prism-light .token.selector .token.id{color:#7c00aa}.prism-light .token.atrule .token.rule,.prism-light .token.combinator,.prism-light .token.keyword,.prism-light .token.operator,.prism-light .token.pseudo-class,.prism-light .token.pseudo-element,.prism-light .token.selector,.prism-light .token.unit{color:#a04900}.prism-light .token.deleted,.prism-light .token.important{color:#c22f2e}.prism-light .token.keyword-this,.prism-light .token.this{color:#005a8e}.prism-light .token.bold,.prism-light .token.important,.prism-light .token.keyword-this,.prism-light .token.this{font-weight:700}.prism-light .token.delimiter.important{font-weight:inherit}.prism-light .token.italic{font-style:italic}.prism-light .token.entity{cursor:help}.prism-light .language-markdown .token.title,.prism-light .language-markdown .token.title .token.punctuation{color:#005a8e;font-weight:700}.prism-light .language-markdown .token.blockquote.punctuation{color:#af00af}.prism-light .language-markdown .token.code{color:#006d6d}.prism-light .language-markdown .token.hr.punctuation{color:#005a8e}.prism-light .language-markdown .token.url>.token.content{color:#116b00}.prism-light .language-markdown .token.url-link{color:#755f00}.prism-light .language-markdown .token.list.punctuation{color:#af00af}.prism-light .language-markdown .token.table-header,.prism-light .language-json .token.operator{color:#111b27}.prism-light .language-scss .token.variable{color:#006d6d}.prism-light .token.token.cr:before,.prism-light .token.token.lf:before,.prism-light .token.token.space:before,.prism-light .token.token.tab:not(:empty):before{color:#3c526d}.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>a,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>button{color:#e3eaf2;background:#005a8e}.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>a:focus,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>a:hover,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>button:focus,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>button:hover{color:#e3eaf2;background:rgba(0,90,142,.8549019608);text-decoration:none}.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>span,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>span:focus,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>span:hover{color:#e3eaf2;background:#3c526d}.prism-light .line-highlight.line-highlight{background:rgba(141,161,185,.1843137255);background:linear-gradient(to right,rgba(141,161,185,.1843137255) 70%,rgba(141,161,185,.1450980392))}.prism-light .line-highlight.line-highlight:before,.prism-light .line-highlight.line-highlight[data-end]:after{background-color:#3c526d;color:#e3eaf2;box-shadow:0 1px #8da1b9}.prism-light pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows>span:hover:before{background-color:#3c526d1f}.prism-light .line-numbers.line-numbers .line-numbers-rows{border-right:1px solid rgba(141,161,185,.4784313725);background:rgba(208,218,231,.4784313725)}.prism-light .line-numbers .line-numbers-rows>span:before{color:#3c526dda}.prism-light .rainbow-braces .token.token.punctuation.brace-level-1,.prism-light .rainbow-braces .token.token.punctuation.brace-level-5,.prism-light .rainbow-braces .token.token.punctuation.brace-level-9{color:#755f00}.prism-light .rainbow-braces .token.token.punctuation.brace-level-10,.prism-light .rainbow-braces .token.token.punctuation.brace-level-2,.prism-light .rainbow-braces .token.token.punctuation.brace-level-6{color:#af00af}.prism-light .rainbow-braces .token.token.punctuation.brace-level-11,.prism-light .rainbow-braces .token.token.punctuation.brace-level-3,.prism-light .rainbow-braces .token.token.punctuation.brace-level-7{color:#005a8e}.prism-light .rainbow-braces .token.token.punctuation.brace-level-12,.prism-light .rainbow-braces .token.token.punctuation.brace-level-4,.prism-light .rainbow-braces .token.token.punctuation.brace-level-8{color:#7c00aa}.prism-light pre.diff-highlight>code .token.token.deleted:not(.prefix),.prism-light pre>code.diff-highlight .token.token.deleted:not(.prefix){background-color:#c22f2e1f}.prism-light pre.diff-highlight>code .token.token.inserted:not(.prefix),.prism-light pre>code.diff-highlight .token.token.inserted:not(.prefix){background-color:#116b001f}.prism-light .command-line .command-line-prompt{border-right:1px solid rgba(141,161,185,.4784313725)}.prism-light .command-line .command-line-prompt>span:before{color:#3c526dda}code.svelte-10s5tkd.svelte-10s5tkd{display:block;width:100%;padding:10px 15px;white-space:pre-wrap;word-break:break-word}.code-wrapper.svelte-10s5tkd.svelte-10s5tkd{display:block;width:100%;max-height:100%;overflow:auto;overflow:overlay}.prism-light.svelte-10s5tkd code.svelte-10s5tkd{color:var(--txtPrimaryColor);background:var(--baseAlt1Color)}.invalid-name-note.svelte-1tpxlm5{position:absolute;right:10px;top:10px;text-transform:none}.title.field-name.svelte-1tpxlm5{max-width:130px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.rule-block.svelte-fjxz7k{display:flex;align-items:flex-start;gap:var(--xsSpacing)}.rule-toggle-btn.svelte-fjxz7k{margin-top:15px}.changes-list.svelte-1ghly2p{word-break:break-all}.tabs-content.svelte-lo1530{z-index:auto}.email-visibility-addon.svelte-1751a4d~input.svelte-1751a4d{padding-right:100px}textarea.svelte-1x1pbts{resize:none;padding-top:4px!important;padding-bottom:5px!important;min-height:var(--inputHeight);height:var(--inputHeight)}.content.svelte-1gjwqyd{flex-shrink:1;flex-grow:0;width:auto;min-width:0}.export-preview.svelte-jm5c4z.svelte-jm5c4z{position:relative;height:500px}.export-preview.svelte-jm5c4z .copy-schema.svelte-jm5c4z{position:absolute;right:15px;top:15px}.collections-diff-table.svelte-lmkr38.svelte-lmkr38{color:var(--txtHintColor);border:2px solid var(--primaryColor)}.collections-diff-table.svelte-lmkr38 tr.svelte-lmkr38{background:none}.collections-diff-table.svelte-lmkr38 th.svelte-lmkr38,.collections-diff-table.svelte-lmkr38 td.svelte-lmkr38{height:auto;padding:2px 15px;border-bottom:1px solid rgba(0,0,0,.07)}.collections-diff-table.svelte-lmkr38 th.svelte-lmkr38{height:35px;padding:4px 15px;color:var(--txtPrimaryColor)}.collections-diff-table.svelte-lmkr38 thead tr.svelte-lmkr38{background:var(--primaryColor)}.collections-diff-table.svelte-lmkr38 thead tr th.svelte-lmkr38{color:var(--baseColor);background:none}.collections-diff-table.svelte-lmkr38 .label.svelte-lmkr38{font-weight:400}.collections-diff-table.svelte-lmkr38 .changed-none-col.svelte-lmkr38{color:var(--txtDisabledColor);background:var(--baseAlt1Color)}.collections-diff-table.svelte-lmkr38 .changed-old-col.svelte-lmkr38{color:var(--txtPrimaryColor);background:var(--dangerAltColor)}.collections-diff-table.svelte-lmkr38 .changed-new-col.svelte-lmkr38{color:var(--txtPrimaryColor);background:var(--successAltColor)}.collections-diff-table.svelte-lmkr38 .field-key-col.svelte-lmkr38{padding-left:30px}.list-label.svelte-1jx20fl{min-width:65px} diff --git a/ui/dist/assets/index.26987507.css b/ui/dist/assets/index.26987507.css deleted file mode 100644 index 581c58613..000000000 --- a/ui/dist/assets/index.26987507.css +++ /dev/null @@ -1 +0,0 @@ -@font-face{font-family:remixicon;src:url(../fonts/remixicon/remixicon.woff2?v=1) format("woff2"),url(../fonts/remixicon/remixicon.woff?v=1) format("woff"),url(../fonts/remixicon/remixicon.ttf?v=1) format("truetype"),url(../fonts/remixicon/remixicon.svg?v=1#remixicon) format("svg");font-display:swap}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:400;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-regular.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-regular.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:400;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-italic.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:600;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:600;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-600italic.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:normal;font-weight:700;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700.woff) format("woff")}@font-face{font-family:Source Sans Pro;font-style:italic;font-weight:700;src:local(""),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700italic.woff2) format("woff2"),url(../fonts/source-sans-pro/source-sans-pro-v18-latin_cyrillic-700italic.woff) format("woff")}@font-face{font-family:JetBrains Mono;font-style:normal;font-weight:400;src:local(""),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-regular.woff2) format("woff2"),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-regular.woff) format("woff")}@font-face{font-family:JetBrains Mono;font-style:normal;font-weight:600;src:local(""),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-600.woff2) format("woff2"),url(../fonts/jetbrains-mono/jetbrains-mono-v12-latin-600.woff) format("woff")}:root{--baseFontFamily: "Source Sans Pro", sans-serif, emoji;--monospaceFontFamily: "Ubuntu Mono", monospace, emoji;--iconFontFamily: "remixicon";--txtPrimaryColor: #16161a;--txtHintColor: #666f75;--txtDisabledColor: #adb3b8;--primaryColor: #16161a;--bodyColor: #f8f9fa;--baseColor: #ffffff;--baseAlt1Color: #ebeff2;--baseAlt2Color: #dee3e8;--baseAlt3Color: #a9b4bc;--baseAlt4Color: #7c868d;--infoColor: #3da9fc;--infoAltColor: #d8eefe;--successColor: #2cb67d;--successAltColor: #d6f5e8;--dangerColor: #ef4565;--dangerAltColor: #fcdee4;--warningColor: #ff8e3c;--warningAltColor: #ffe7d6;--overlayColor: rgba(65, 82, 105, .25);--tooltipColor: rgba(0, 0, 0, .85);--shadowColor: rgba(0, 0, 0, .05);--baseFontSize: 14.5px;--xsFontSize: 12px;--smFontSize: 13px;--lgFontSize: 15px;--xlFontSize: 16px;--baseLineHeight: 22px;--smLineHeight: 16px;--lgLineHeight: 24px;--inputHeight: 34px;--btnHeight: 40px;--xsBtnHeight: 24px;--smBtnHeight: 30px;--lgBtnHeight: 54px;--baseSpacing: 30px;--xsSpacing: 15px;--smSpacing: 20px;--lgSpacing: 50px;--xlSpacing: 60px;--wrapperWidth: 850px;--smWrapperWidth: 420px;--lgWrapperWidth: 1200px;--appSidebarWidth: 75px;--pageSidebarWidth: 220px;--baseAnimationSpeed: .15s;--activeAnimationSpeed: 70ms;--entranceAnimationSpeed: .25s;--baseRadius: 3px;--lgRadius: 12px;--btnRadius: 3px;accent-color:var(--primaryColor)}html,body,div,span,applet,object,iframe,h1,h2,.breadcrumbs .breadcrumb-item,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}i{font-family:remixicon!important;font-style:normal;font-weight:400;font-size:1.1238rem;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}i:before{vertical-align:top;margin-top:1px;display:inline-block}.ri-24-hours-fill:before{content:"\ea01"}.ri-24-hours-line:before{content:"\ea02"}.ri-4k-fill:before{content:"\ea03"}.ri-4k-line:before{content:"\ea04"}.ri-a-b:before{content:"\ea05"}.ri-account-box-fill:before{content:"\ea06"}.ri-account-box-line:before{content:"\ea07"}.ri-account-circle-fill:before{content:"\ea08"}.ri-account-circle-line:before{content:"\ea09"}.ri-account-pin-box-fill:before{content:"\ea0a"}.ri-account-pin-box-line:before{content:"\ea0b"}.ri-account-pin-circle-fill:before{content:"\ea0c"}.ri-account-pin-circle-line:before{content:"\ea0d"}.ri-add-box-fill:before{content:"\ea0e"}.ri-add-box-line:before{content:"\ea0f"}.ri-add-circle-fill:before{content:"\ea10"}.ri-add-circle-line:before{content:"\ea11"}.ri-add-fill:before{content:"\ea12"}.ri-add-line:before{content:"\ea13"}.ri-admin-fill:before{content:"\ea14"}.ri-admin-line:before{content:"\ea15"}.ri-advertisement-fill:before{content:"\ea16"}.ri-advertisement-line:before{content:"\ea17"}.ri-airplay-fill:before{content:"\ea18"}.ri-airplay-line:before{content:"\ea19"}.ri-alarm-fill:before{content:"\ea1a"}.ri-alarm-line:before{content:"\ea1b"}.ri-alarm-warning-fill:before{content:"\ea1c"}.ri-alarm-warning-line:before{content:"\ea1d"}.ri-album-fill:before{content:"\ea1e"}.ri-album-line:before{content:"\ea1f"}.ri-alert-fill:before{content:"\ea20"}.ri-alert-line:before{content:"\ea21"}.ri-aliens-fill:before{content:"\ea22"}.ri-aliens-line:before{content:"\ea23"}.ri-align-bottom:before{content:"\ea24"}.ri-align-center:before{content:"\ea25"}.ri-align-justify:before{content:"\ea26"}.ri-align-left:before{content:"\ea27"}.ri-align-right:before{content:"\ea28"}.ri-align-top:before{content:"\ea29"}.ri-align-vertically:before{content:"\ea2a"}.ri-alipay-fill:before{content:"\ea2b"}.ri-alipay-line:before{content:"\ea2c"}.ri-amazon-fill:before{content:"\ea2d"}.ri-amazon-line:before{content:"\ea2e"}.ri-anchor-fill:before{content:"\ea2f"}.ri-anchor-line:before{content:"\ea30"}.ri-ancient-gate-fill:before{content:"\ea31"}.ri-ancient-gate-line:before{content:"\ea32"}.ri-ancient-pavilion-fill:before{content:"\ea33"}.ri-ancient-pavilion-line:before{content:"\ea34"}.ri-android-fill:before{content:"\ea35"}.ri-android-line:before{content:"\ea36"}.ri-angularjs-fill:before{content:"\ea37"}.ri-angularjs-line:before{content:"\ea38"}.ri-anticlockwise-2-fill:before{content:"\ea39"}.ri-anticlockwise-2-line:before{content:"\ea3a"}.ri-anticlockwise-fill:before{content:"\ea3b"}.ri-anticlockwise-line:before{content:"\ea3c"}.ri-app-store-fill:before{content:"\ea3d"}.ri-app-store-line:before{content:"\ea3e"}.ri-apple-fill:before{content:"\ea3f"}.ri-apple-line:before{content:"\ea40"}.ri-apps-2-fill:before{content:"\ea41"}.ri-apps-2-line:before{content:"\ea42"}.ri-apps-fill:before{content:"\ea43"}.ri-apps-line:before{content:"\ea44"}.ri-archive-drawer-fill:before{content:"\ea45"}.ri-archive-drawer-line:before{content:"\ea46"}.ri-archive-fill:before{content:"\ea47"}.ri-archive-line:before{content:"\ea48"}.ri-arrow-down-circle-fill:before{content:"\ea49"}.ri-arrow-down-circle-line:before{content:"\ea4a"}.ri-arrow-down-fill:before{content:"\ea4b"}.ri-arrow-down-line:before{content:"\ea4c"}.ri-arrow-down-s-fill:before{content:"\ea4d"}.ri-arrow-down-s-line:before{content:"\ea4e"}.ri-arrow-drop-down-fill:before{content:"\ea4f"}.ri-arrow-drop-down-line:before{content:"\ea50"}.ri-arrow-drop-left-fill:before{content:"\ea51"}.ri-arrow-drop-left-line:before{content:"\ea52"}.ri-arrow-drop-right-fill:before{content:"\ea53"}.ri-arrow-drop-right-line:before{content:"\ea54"}.ri-arrow-drop-up-fill:before{content:"\ea55"}.ri-arrow-drop-up-line:before{content:"\ea56"}.ri-arrow-go-back-fill:before{content:"\ea57"}.ri-arrow-go-back-line:before{content:"\ea58"}.ri-arrow-go-forward-fill:before{content:"\ea59"}.ri-arrow-go-forward-line:before{content:"\ea5a"}.ri-arrow-left-circle-fill:before{content:"\ea5b"}.ri-arrow-left-circle-line:before{content:"\ea5c"}.ri-arrow-left-down-fill:before{content:"\ea5d"}.ri-arrow-left-down-line:before{content:"\ea5e"}.ri-arrow-left-fill:before{content:"\ea5f"}.ri-arrow-left-line:before{content:"\ea60"}.ri-arrow-left-right-fill:before{content:"\ea61"}.ri-arrow-left-right-line:before{content:"\ea62"}.ri-arrow-left-s-fill:before{content:"\ea63"}.ri-arrow-left-s-line:before{content:"\ea64"}.ri-arrow-left-up-fill:before{content:"\ea65"}.ri-arrow-left-up-line:before{content:"\ea66"}.ri-arrow-right-circle-fill:before{content:"\ea67"}.ri-arrow-right-circle-line:before{content:"\ea68"}.ri-arrow-right-down-fill:before{content:"\ea69"}.ri-arrow-right-down-line:before{content:"\ea6a"}.ri-arrow-right-fill:before{content:"\ea6b"}.ri-arrow-right-line:before{content:"\ea6c"}.ri-arrow-right-s-fill:before{content:"\ea6d"}.ri-arrow-right-s-line:before{content:"\ea6e"}.ri-arrow-right-up-fill:before{content:"\ea6f"}.ri-arrow-right-up-line:before{content:"\ea70"}.ri-arrow-up-circle-fill:before{content:"\ea71"}.ri-arrow-up-circle-line:before{content:"\ea72"}.ri-arrow-up-down-fill:before{content:"\ea73"}.ri-arrow-up-down-line:before{content:"\ea74"}.ri-arrow-up-fill:before{content:"\ea75"}.ri-arrow-up-line:before{content:"\ea76"}.ri-arrow-up-s-fill:before{content:"\ea77"}.ri-arrow-up-s-line:before{content:"\ea78"}.ri-artboard-2-fill:before{content:"\ea79"}.ri-artboard-2-line:before{content:"\ea7a"}.ri-artboard-fill:before{content:"\ea7b"}.ri-artboard-line:before{content:"\ea7c"}.ri-article-fill:before{content:"\ea7d"}.ri-article-line:before{content:"\ea7e"}.ri-aspect-ratio-fill:before{content:"\ea7f"}.ri-aspect-ratio-line:before{content:"\ea80"}.ri-asterisk:before{content:"\ea81"}.ri-at-fill:before{content:"\ea82"}.ri-at-line:before{content:"\ea83"}.ri-attachment-2:before{content:"\ea84"}.ri-attachment-fill:before{content:"\ea85"}.ri-attachment-line:before{content:"\ea86"}.ri-auction-fill:before{content:"\ea87"}.ri-auction-line:before{content:"\ea88"}.ri-award-fill:before{content:"\ea89"}.ri-award-line:before{content:"\ea8a"}.ri-baidu-fill:before{content:"\ea8b"}.ri-baidu-line:before{content:"\ea8c"}.ri-ball-pen-fill:before{content:"\ea8d"}.ri-ball-pen-line:before{content:"\ea8e"}.ri-bank-card-2-fill:before{content:"\ea8f"}.ri-bank-card-2-line:before{content:"\ea90"}.ri-bank-card-fill:before{content:"\ea91"}.ri-bank-card-line:before{content:"\ea92"}.ri-bank-fill:before{content:"\ea93"}.ri-bank-line:before{content:"\ea94"}.ri-bar-chart-2-fill:before{content:"\ea95"}.ri-bar-chart-2-line:before{content:"\ea96"}.ri-bar-chart-box-fill:before{content:"\ea97"}.ri-bar-chart-box-line:before{content:"\ea98"}.ri-bar-chart-fill:before{content:"\ea99"}.ri-bar-chart-grouped-fill:before{content:"\ea9a"}.ri-bar-chart-grouped-line:before{content:"\ea9b"}.ri-bar-chart-horizontal-fill:before{content:"\ea9c"}.ri-bar-chart-horizontal-line:before{content:"\ea9d"}.ri-bar-chart-line:before{content:"\ea9e"}.ri-barcode-box-fill:before{content:"\ea9f"}.ri-barcode-box-line:before{content:"\eaa0"}.ri-barcode-fill:before{content:"\eaa1"}.ri-barcode-line:before{content:"\eaa2"}.ri-barricade-fill:before{content:"\eaa3"}.ri-barricade-line:before{content:"\eaa4"}.ri-base-station-fill:before{content:"\eaa5"}.ri-base-station-line:before{content:"\eaa6"}.ri-basketball-fill:before{content:"\eaa7"}.ri-basketball-line:before{content:"\eaa8"}.ri-battery-2-charge-fill:before{content:"\eaa9"}.ri-battery-2-charge-line:before{content:"\eaaa"}.ri-battery-2-fill:before{content:"\eaab"}.ri-battery-2-line:before{content:"\eaac"}.ri-battery-charge-fill:before{content:"\eaad"}.ri-battery-charge-line:before{content:"\eaae"}.ri-battery-fill:before{content:"\eaaf"}.ri-battery-line:before{content:"\eab0"}.ri-battery-low-fill:before{content:"\eab1"}.ri-battery-low-line:before{content:"\eab2"}.ri-battery-saver-fill:before{content:"\eab3"}.ri-battery-saver-line:before{content:"\eab4"}.ri-battery-share-fill:before{content:"\eab5"}.ri-battery-share-line:before{content:"\eab6"}.ri-bear-smile-fill:before{content:"\eab7"}.ri-bear-smile-line:before{content:"\eab8"}.ri-behance-fill:before{content:"\eab9"}.ri-behance-line:before{content:"\eaba"}.ri-bell-fill:before{content:"\eabb"}.ri-bell-line:before{content:"\eabc"}.ri-bike-fill:before{content:"\eabd"}.ri-bike-line:before{content:"\eabe"}.ri-bilibili-fill:before{content:"\eabf"}.ri-bilibili-line:before{content:"\eac0"}.ri-bill-fill:before{content:"\eac1"}.ri-bill-line:before{content:"\eac2"}.ri-billiards-fill:before{content:"\eac3"}.ri-billiards-line:before{content:"\eac4"}.ri-bit-coin-fill:before{content:"\eac5"}.ri-bit-coin-line:before{content:"\eac6"}.ri-blaze-fill:before{content:"\eac7"}.ri-blaze-line:before{content:"\eac8"}.ri-bluetooth-connect-fill:before{content:"\eac9"}.ri-bluetooth-connect-line:before{content:"\eaca"}.ri-bluetooth-fill:before{content:"\eacb"}.ri-bluetooth-line:before{content:"\eacc"}.ri-blur-off-fill:before{content:"\eacd"}.ri-blur-off-line:before{content:"\eace"}.ri-body-scan-fill:before{content:"\eacf"}.ri-body-scan-line:before{content:"\ead0"}.ri-bold:before{content:"\ead1"}.ri-book-2-fill:before{content:"\ead2"}.ri-book-2-line:before{content:"\ead3"}.ri-book-3-fill:before{content:"\ead4"}.ri-book-3-line:before{content:"\ead5"}.ri-book-fill:before{content:"\ead6"}.ri-book-line:before{content:"\ead7"}.ri-book-mark-fill:before{content:"\ead8"}.ri-book-mark-line:before{content:"\ead9"}.ri-book-open-fill:before{content:"\eada"}.ri-book-open-line:before{content:"\eadb"}.ri-book-read-fill:before{content:"\eadc"}.ri-book-read-line:before{content:"\eadd"}.ri-booklet-fill:before{content:"\eade"}.ri-booklet-line:before{content:"\eadf"}.ri-bookmark-2-fill:before{content:"\eae0"}.ri-bookmark-2-line:before{content:"\eae1"}.ri-bookmark-3-fill:before{content:"\eae2"}.ri-bookmark-3-line:before{content:"\eae3"}.ri-bookmark-fill:before{content:"\eae4"}.ri-bookmark-line:before{content:"\eae5"}.ri-boxing-fill:before{content:"\eae6"}.ri-boxing-line:before{content:"\eae7"}.ri-braces-fill:before{content:"\eae8"}.ri-braces-line:before{content:"\eae9"}.ri-brackets-fill:before{content:"\eaea"}.ri-brackets-line:before{content:"\eaeb"}.ri-briefcase-2-fill:before{content:"\eaec"}.ri-briefcase-2-line:before{content:"\eaed"}.ri-briefcase-3-fill:before{content:"\eaee"}.ri-briefcase-3-line:before{content:"\eaef"}.ri-briefcase-4-fill:before{content:"\eaf0"}.ri-briefcase-4-line:before{content:"\eaf1"}.ri-briefcase-5-fill:before{content:"\eaf2"}.ri-briefcase-5-line:before{content:"\eaf3"}.ri-briefcase-fill:before{content:"\eaf4"}.ri-briefcase-line:before{content:"\eaf5"}.ri-bring-forward:before{content:"\eaf6"}.ri-bring-to-front:before{content:"\eaf7"}.ri-broadcast-fill:before{content:"\eaf8"}.ri-broadcast-line:before{content:"\eaf9"}.ri-brush-2-fill:before{content:"\eafa"}.ri-brush-2-line:before{content:"\eafb"}.ri-brush-3-fill:before{content:"\eafc"}.ri-brush-3-line:before{content:"\eafd"}.ri-brush-4-fill:before{content:"\eafe"}.ri-brush-4-line:before{content:"\eaff"}.ri-brush-fill:before{content:"\eb00"}.ri-brush-line:before{content:"\eb01"}.ri-bubble-chart-fill:before{content:"\eb02"}.ri-bubble-chart-line:before{content:"\eb03"}.ri-bug-2-fill:before{content:"\eb04"}.ri-bug-2-line:before{content:"\eb05"}.ri-bug-fill:before{content:"\eb06"}.ri-bug-line:before{content:"\eb07"}.ri-building-2-fill:before{content:"\eb08"}.ri-building-2-line:before{content:"\eb09"}.ri-building-3-fill:before{content:"\eb0a"}.ri-building-3-line:before{content:"\eb0b"}.ri-building-4-fill:before{content:"\eb0c"}.ri-building-4-line:before{content:"\eb0d"}.ri-building-fill:before{content:"\eb0e"}.ri-building-line:before{content:"\eb0f"}.ri-bus-2-fill:before{content:"\eb10"}.ri-bus-2-line:before{content:"\eb11"}.ri-bus-fill:before{content:"\eb12"}.ri-bus-line:before{content:"\eb13"}.ri-bus-wifi-fill:before{content:"\eb14"}.ri-bus-wifi-line:before{content:"\eb15"}.ri-cactus-fill:before{content:"\eb16"}.ri-cactus-line:before{content:"\eb17"}.ri-cake-2-fill:before{content:"\eb18"}.ri-cake-2-line:before{content:"\eb19"}.ri-cake-3-fill:before{content:"\eb1a"}.ri-cake-3-line:before{content:"\eb1b"}.ri-cake-fill:before{content:"\eb1c"}.ri-cake-line:before{content:"\eb1d"}.ri-calculator-fill:before{content:"\eb1e"}.ri-calculator-line:before{content:"\eb1f"}.ri-calendar-2-fill:before{content:"\eb20"}.ri-calendar-2-line:before{content:"\eb21"}.ri-calendar-check-fill:before{content:"\eb22"}.ri-calendar-check-line:before{content:"\eb23"}.ri-calendar-event-fill:before{content:"\eb24"}.ri-calendar-event-line:before{content:"\eb25"}.ri-calendar-fill:before{content:"\eb26"}.ri-calendar-line:before{content:"\eb27"}.ri-calendar-todo-fill:before{content:"\eb28"}.ri-calendar-todo-line:before{content:"\eb29"}.ri-camera-2-fill:before{content:"\eb2a"}.ri-camera-2-line:before{content:"\eb2b"}.ri-camera-3-fill:before{content:"\eb2c"}.ri-camera-3-line:before{content:"\eb2d"}.ri-camera-fill:before{content:"\eb2e"}.ri-camera-lens-fill:before{content:"\eb2f"}.ri-camera-lens-line:before{content:"\eb30"}.ri-camera-line:before{content:"\eb31"}.ri-camera-off-fill:before{content:"\eb32"}.ri-camera-off-line:before{content:"\eb33"}.ri-camera-switch-fill:before{content:"\eb34"}.ri-camera-switch-line:before{content:"\eb35"}.ri-capsule-fill:before{content:"\eb36"}.ri-capsule-line:before{content:"\eb37"}.ri-car-fill:before{content:"\eb38"}.ri-car-line:before{content:"\eb39"}.ri-car-washing-fill:before{content:"\eb3a"}.ri-car-washing-line:before{content:"\eb3b"}.ri-caravan-fill:before{content:"\eb3c"}.ri-caravan-line:before{content:"\eb3d"}.ri-cast-fill:before{content:"\eb3e"}.ri-cast-line:before{content:"\eb3f"}.ri-cellphone-fill:before{content:"\eb40"}.ri-cellphone-line:before{content:"\eb41"}.ri-celsius-fill:before{content:"\eb42"}.ri-celsius-line:before{content:"\eb43"}.ri-centos-fill:before{content:"\eb44"}.ri-centos-line:before{content:"\eb45"}.ri-character-recognition-fill:before{content:"\eb46"}.ri-character-recognition-line:before{content:"\eb47"}.ri-charging-pile-2-fill:before{content:"\eb48"}.ri-charging-pile-2-line:before{content:"\eb49"}.ri-charging-pile-fill:before{content:"\eb4a"}.ri-charging-pile-line:before{content:"\eb4b"}.ri-chat-1-fill:before{content:"\eb4c"}.ri-chat-1-line:before{content:"\eb4d"}.ri-chat-2-fill:before{content:"\eb4e"}.ri-chat-2-line:before{content:"\eb4f"}.ri-chat-3-fill:before{content:"\eb50"}.ri-chat-3-line:before{content:"\eb51"}.ri-chat-4-fill:before{content:"\eb52"}.ri-chat-4-line:before{content:"\eb53"}.ri-chat-check-fill:before{content:"\eb54"}.ri-chat-check-line:before{content:"\eb55"}.ri-chat-delete-fill:before{content:"\eb56"}.ri-chat-delete-line:before{content:"\eb57"}.ri-chat-download-fill:before{content:"\eb58"}.ri-chat-download-line:before{content:"\eb59"}.ri-chat-follow-up-fill:before{content:"\eb5a"}.ri-chat-follow-up-line:before{content:"\eb5b"}.ri-chat-forward-fill:before{content:"\eb5c"}.ri-chat-forward-line:before{content:"\eb5d"}.ri-chat-heart-fill:before{content:"\eb5e"}.ri-chat-heart-line:before{content:"\eb5f"}.ri-chat-history-fill:before{content:"\eb60"}.ri-chat-history-line:before{content:"\eb61"}.ri-chat-new-fill:before{content:"\eb62"}.ri-chat-new-line:before{content:"\eb63"}.ri-chat-off-fill:before{content:"\eb64"}.ri-chat-off-line:before{content:"\eb65"}.ri-chat-poll-fill:before{content:"\eb66"}.ri-chat-poll-line:before{content:"\eb67"}.ri-chat-private-fill:before{content:"\eb68"}.ri-chat-private-line:before{content:"\eb69"}.ri-chat-quote-fill:before{content:"\eb6a"}.ri-chat-quote-line:before{content:"\eb6b"}.ri-chat-settings-fill:before{content:"\eb6c"}.ri-chat-settings-line:before{content:"\eb6d"}.ri-chat-smile-2-fill:before{content:"\eb6e"}.ri-chat-smile-2-line:before{content:"\eb6f"}.ri-chat-smile-3-fill:before{content:"\eb70"}.ri-chat-smile-3-line:before{content:"\eb71"}.ri-chat-smile-fill:before{content:"\eb72"}.ri-chat-smile-line:before{content:"\eb73"}.ri-chat-upload-fill:before{content:"\eb74"}.ri-chat-upload-line:before{content:"\eb75"}.ri-chat-voice-fill:before{content:"\eb76"}.ri-chat-voice-line:before{content:"\eb77"}.ri-check-double-fill:before{content:"\eb78"}.ri-check-double-line:before{content:"\eb79"}.ri-check-fill:before{content:"\eb7a"}.ri-check-line:before{content:"\eb7b"}.ri-checkbox-blank-circle-fill:before{content:"\eb7c"}.ri-checkbox-blank-circle-line:before{content:"\eb7d"}.ri-checkbox-blank-fill:before{content:"\eb7e"}.ri-checkbox-blank-line:before{content:"\eb7f"}.ri-checkbox-circle-fill:before{content:"\eb80"}.ri-checkbox-circle-line:before{content:"\eb81"}.ri-checkbox-fill:before{content:"\eb82"}.ri-checkbox-indeterminate-fill:before{content:"\eb83"}.ri-checkbox-indeterminate-line:before{content:"\eb84"}.ri-checkbox-line:before{content:"\eb85"}.ri-checkbox-multiple-blank-fill:before{content:"\eb86"}.ri-checkbox-multiple-blank-line:before{content:"\eb87"}.ri-checkbox-multiple-fill:before{content:"\eb88"}.ri-checkbox-multiple-line:before{content:"\eb89"}.ri-china-railway-fill:before{content:"\eb8a"}.ri-china-railway-line:before{content:"\eb8b"}.ri-chrome-fill:before{content:"\eb8c"}.ri-chrome-line:before{content:"\eb8d"}.ri-clapperboard-fill:before{content:"\eb8e"}.ri-clapperboard-line:before{content:"\eb8f"}.ri-clipboard-fill:before{content:"\eb90"}.ri-clipboard-line:before{content:"\eb91"}.ri-clockwise-2-fill:before{content:"\eb92"}.ri-clockwise-2-line:before{content:"\eb93"}.ri-clockwise-fill:before{content:"\eb94"}.ri-clockwise-line:before{content:"\eb95"}.ri-close-circle-fill:before{content:"\eb96"}.ri-close-circle-line:before{content:"\eb97"}.ri-close-fill:before{content:"\eb98"}.ri-close-line:before{content:"\eb99"}.ri-closed-captioning-fill:before{content:"\eb9a"}.ri-closed-captioning-line:before{content:"\eb9b"}.ri-cloud-fill:before{content:"\eb9c"}.ri-cloud-line:before{content:"\eb9d"}.ri-cloud-off-fill:before{content:"\eb9e"}.ri-cloud-off-line:before{content:"\eb9f"}.ri-cloud-windy-fill:before{content:"\eba0"}.ri-cloud-windy-line:before{content:"\eba1"}.ri-cloudy-2-fill:before{content:"\eba2"}.ri-cloudy-2-line:before{content:"\eba3"}.ri-cloudy-fill:before{content:"\eba4"}.ri-cloudy-line:before{content:"\eba5"}.ri-code-box-fill:before{content:"\eba6"}.ri-code-box-line:before{content:"\eba7"}.ri-code-fill:before{content:"\eba8"}.ri-code-line:before{content:"\eba9"}.ri-code-s-fill:before{content:"\ebaa"}.ri-code-s-line:before{content:"\ebab"}.ri-code-s-slash-fill:before{content:"\ebac"}.ri-code-s-slash-line:before{content:"\ebad"}.ri-code-view:before{content:"\ebae"}.ri-codepen-fill:before{content:"\ebaf"}.ri-codepen-line:before{content:"\ebb0"}.ri-coin-fill:before{content:"\ebb1"}.ri-coin-line:before{content:"\ebb2"}.ri-coins-fill:before{content:"\ebb3"}.ri-coins-line:before{content:"\ebb4"}.ri-collage-fill:before{content:"\ebb5"}.ri-collage-line:before{content:"\ebb6"}.ri-command-fill:before{content:"\ebb7"}.ri-command-line:before{content:"\ebb8"}.ri-community-fill:before{content:"\ebb9"}.ri-community-line:before{content:"\ebba"}.ri-compass-2-fill:before{content:"\ebbb"}.ri-compass-2-line:before{content:"\ebbc"}.ri-compass-3-fill:before{content:"\ebbd"}.ri-compass-3-line:before{content:"\ebbe"}.ri-compass-4-fill:before{content:"\ebbf"}.ri-compass-4-line:before{content:"\ebc0"}.ri-compass-discover-fill:before{content:"\ebc1"}.ri-compass-discover-line:before{content:"\ebc2"}.ri-compass-fill:before{content:"\ebc3"}.ri-compass-line:before{content:"\ebc4"}.ri-compasses-2-fill:before{content:"\ebc5"}.ri-compasses-2-line:before{content:"\ebc6"}.ri-compasses-fill:before{content:"\ebc7"}.ri-compasses-line:before{content:"\ebc8"}.ri-computer-fill:before{content:"\ebc9"}.ri-computer-line:before{content:"\ebca"}.ri-contacts-book-2-fill:before{content:"\ebcb"}.ri-contacts-book-2-line:before{content:"\ebcc"}.ri-contacts-book-fill:before{content:"\ebcd"}.ri-contacts-book-line:before{content:"\ebce"}.ri-contacts-book-upload-fill:before{content:"\ebcf"}.ri-contacts-book-upload-line:before{content:"\ebd0"}.ri-contacts-fill:before{content:"\ebd1"}.ri-contacts-line:before{content:"\ebd2"}.ri-contrast-2-fill:before{content:"\ebd3"}.ri-contrast-2-line:before{content:"\ebd4"}.ri-contrast-drop-2-fill:before{content:"\ebd5"}.ri-contrast-drop-2-line:before{content:"\ebd6"}.ri-contrast-drop-fill:before{content:"\ebd7"}.ri-contrast-drop-line:before{content:"\ebd8"}.ri-contrast-fill:before{content:"\ebd9"}.ri-contrast-line:before{content:"\ebda"}.ri-copper-coin-fill:before{content:"\ebdb"}.ri-copper-coin-line:before{content:"\ebdc"}.ri-copper-diamond-fill:before{content:"\ebdd"}.ri-copper-diamond-line:before{content:"\ebde"}.ri-copyleft-fill:before{content:"\ebdf"}.ri-copyleft-line:before{content:"\ebe0"}.ri-copyright-fill:before{content:"\ebe1"}.ri-copyright-line:before{content:"\ebe2"}.ri-coreos-fill:before{content:"\ebe3"}.ri-coreos-line:before{content:"\ebe4"}.ri-coupon-2-fill:before{content:"\ebe5"}.ri-coupon-2-line:before{content:"\ebe6"}.ri-coupon-3-fill:before{content:"\ebe7"}.ri-coupon-3-line:before{content:"\ebe8"}.ri-coupon-4-fill:before{content:"\ebe9"}.ri-coupon-4-line:before{content:"\ebea"}.ri-coupon-5-fill:before{content:"\ebeb"}.ri-coupon-5-line:before{content:"\ebec"}.ri-coupon-fill:before{content:"\ebed"}.ri-coupon-line:before{content:"\ebee"}.ri-cpu-fill:before{content:"\ebef"}.ri-cpu-line:before{content:"\ebf0"}.ri-creative-commons-by-fill:before{content:"\ebf1"}.ri-creative-commons-by-line:before{content:"\ebf2"}.ri-creative-commons-fill:before{content:"\ebf3"}.ri-creative-commons-line:before{content:"\ebf4"}.ri-creative-commons-nc-fill:before{content:"\ebf5"}.ri-creative-commons-nc-line:before{content:"\ebf6"}.ri-creative-commons-nd-fill:before{content:"\ebf7"}.ri-creative-commons-nd-line:before{content:"\ebf8"}.ri-creative-commons-sa-fill:before{content:"\ebf9"}.ri-creative-commons-sa-line:before{content:"\ebfa"}.ri-creative-commons-zero-fill:before{content:"\ebfb"}.ri-creative-commons-zero-line:before{content:"\ebfc"}.ri-criminal-fill:before{content:"\ebfd"}.ri-criminal-line:before{content:"\ebfe"}.ri-crop-2-fill:before{content:"\ebff"}.ri-crop-2-line:before{content:"\ec00"}.ri-crop-fill:before{content:"\ec01"}.ri-crop-line:before{content:"\ec02"}.ri-css3-fill:before{content:"\ec03"}.ri-css3-line:before{content:"\ec04"}.ri-cup-fill:before{content:"\ec05"}.ri-cup-line:before{content:"\ec06"}.ri-currency-fill:before{content:"\ec07"}.ri-currency-line:before{content:"\ec08"}.ri-cursor-fill:before{content:"\ec09"}.ri-cursor-line:before{content:"\ec0a"}.ri-customer-service-2-fill:before{content:"\ec0b"}.ri-customer-service-2-line:before{content:"\ec0c"}.ri-customer-service-fill:before{content:"\ec0d"}.ri-customer-service-line:before{content:"\ec0e"}.ri-dashboard-2-fill:before{content:"\ec0f"}.ri-dashboard-2-line:before{content:"\ec10"}.ri-dashboard-3-fill:before{content:"\ec11"}.ri-dashboard-3-line:before{content:"\ec12"}.ri-dashboard-fill:before{content:"\ec13"}.ri-dashboard-line:before{content:"\ec14"}.ri-database-2-fill:before{content:"\ec15"}.ri-database-2-line:before{content:"\ec16"}.ri-database-fill:before{content:"\ec17"}.ri-database-line:before{content:"\ec18"}.ri-delete-back-2-fill:before{content:"\ec19"}.ri-delete-back-2-line:before{content:"\ec1a"}.ri-delete-back-fill:before{content:"\ec1b"}.ri-delete-back-line:before{content:"\ec1c"}.ri-delete-bin-2-fill:before{content:"\ec1d"}.ri-delete-bin-2-line:before{content:"\ec1e"}.ri-delete-bin-3-fill:before{content:"\ec1f"}.ri-delete-bin-3-line:before{content:"\ec20"}.ri-delete-bin-4-fill:before{content:"\ec21"}.ri-delete-bin-4-line:before{content:"\ec22"}.ri-delete-bin-5-fill:before{content:"\ec23"}.ri-delete-bin-5-line:before{content:"\ec24"}.ri-delete-bin-6-fill:before{content:"\ec25"}.ri-delete-bin-6-line:before{content:"\ec26"}.ri-delete-bin-7-fill:before{content:"\ec27"}.ri-delete-bin-7-line:before{content:"\ec28"}.ri-delete-bin-fill:before{content:"\ec29"}.ri-delete-bin-line:before{content:"\ec2a"}.ri-delete-column:before{content:"\ec2b"}.ri-delete-row:before{content:"\ec2c"}.ri-device-fill:before{content:"\ec2d"}.ri-device-line:before{content:"\ec2e"}.ri-device-recover-fill:before{content:"\ec2f"}.ri-device-recover-line:before{content:"\ec30"}.ri-dingding-fill:before{content:"\ec31"}.ri-dingding-line:before{content:"\ec32"}.ri-direction-fill:before{content:"\ec33"}.ri-direction-line:before{content:"\ec34"}.ri-disc-fill:before{content:"\ec35"}.ri-disc-line:before{content:"\ec36"}.ri-discord-fill:before{content:"\ec37"}.ri-discord-line:before{content:"\ec38"}.ri-discuss-fill:before{content:"\ec39"}.ri-discuss-line:before{content:"\ec3a"}.ri-dislike-fill:before{content:"\ec3b"}.ri-dislike-line:before{content:"\ec3c"}.ri-disqus-fill:before{content:"\ec3d"}.ri-disqus-line:before{content:"\ec3e"}.ri-divide-fill:before{content:"\ec3f"}.ri-divide-line:before{content:"\ec40"}.ri-donut-chart-fill:before{content:"\ec41"}.ri-donut-chart-line:before{content:"\ec42"}.ri-door-closed-fill:before{content:"\ec43"}.ri-door-closed-line:before{content:"\ec44"}.ri-door-fill:before{content:"\ec45"}.ri-door-line:before{content:"\ec46"}.ri-door-lock-box-fill:before{content:"\ec47"}.ri-door-lock-box-line:before{content:"\ec48"}.ri-door-lock-fill:before{content:"\ec49"}.ri-door-lock-line:before{content:"\ec4a"}.ri-door-open-fill:before{content:"\ec4b"}.ri-door-open-line:before{content:"\ec4c"}.ri-dossier-fill:before{content:"\ec4d"}.ri-dossier-line:before{content:"\ec4e"}.ri-douban-fill:before{content:"\ec4f"}.ri-douban-line:before{content:"\ec50"}.ri-double-quotes-l:before{content:"\ec51"}.ri-double-quotes-r:before{content:"\ec52"}.ri-download-2-fill:before{content:"\ec53"}.ri-download-2-line:before{content:"\ec54"}.ri-download-cloud-2-fill:before{content:"\ec55"}.ri-download-cloud-2-line:before{content:"\ec56"}.ri-download-cloud-fill:before{content:"\ec57"}.ri-download-cloud-line:before{content:"\ec58"}.ri-download-fill:before{content:"\ec59"}.ri-download-line:before{content:"\ec5a"}.ri-draft-fill:before{content:"\ec5b"}.ri-draft-line:before{content:"\ec5c"}.ri-drag-drop-fill:before{content:"\ec5d"}.ri-drag-drop-line:before{content:"\ec5e"}.ri-drag-move-2-fill:before{content:"\ec5f"}.ri-drag-move-2-line:before{content:"\ec60"}.ri-drag-move-fill:before{content:"\ec61"}.ri-drag-move-line:before{content:"\ec62"}.ri-dribbble-fill:before{content:"\ec63"}.ri-dribbble-line:before{content:"\ec64"}.ri-drive-fill:before{content:"\ec65"}.ri-drive-line:before{content:"\ec66"}.ri-drizzle-fill:before{content:"\ec67"}.ri-drizzle-line:before{content:"\ec68"}.ri-drop-fill:before{content:"\ec69"}.ri-drop-line:before{content:"\ec6a"}.ri-dropbox-fill:before{content:"\ec6b"}.ri-dropbox-line:before{content:"\ec6c"}.ri-dual-sim-1-fill:before{content:"\ec6d"}.ri-dual-sim-1-line:before{content:"\ec6e"}.ri-dual-sim-2-fill:before{content:"\ec6f"}.ri-dual-sim-2-line:before{content:"\ec70"}.ri-dv-fill:before{content:"\ec71"}.ri-dv-line:before{content:"\ec72"}.ri-dvd-fill:before{content:"\ec73"}.ri-dvd-line:before{content:"\ec74"}.ri-e-bike-2-fill:before{content:"\ec75"}.ri-e-bike-2-line:before{content:"\ec76"}.ri-e-bike-fill:before{content:"\ec77"}.ri-e-bike-line:before{content:"\ec78"}.ri-earth-fill:before{content:"\ec79"}.ri-earth-line:before{content:"\ec7a"}.ri-earthquake-fill:before{content:"\ec7b"}.ri-earthquake-line:before{content:"\ec7c"}.ri-edge-fill:before{content:"\ec7d"}.ri-edge-line:before{content:"\ec7e"}.ri-edit-2-fill:before{content:"\ec7f"}.ri-edit-2-line:before{content:"\ec80"}.ri-edit-box-fill:before{content:"\ec81"}.ri-edit-box-line:before{content:"\ec82"}.ri-edit-circle-fill:before{content:"\ec83"}.ri-edit-circle-line:before{content:"\ec84"}.ri-edit-fill:before{content:"\ec85"}.ri-edit-line:before{content:"\ec86"}.ri-eject-fill:before{content:"\ec87"}.ri-eject-line:before{content:"\ec88"}.ri-emotion-2-fill:before{content:"\ec89"}.ri-emotion-2-line:before{content:"\ec8a"}.ri-emotion-fill:before{content:"\ec8b"}.ri-emotion-happy-fill:before{content:"\ec8c"}.ri-emotion-happy-line:before{content:"\ec8d"}.ri-emotion-laugh-fill:before{content:"\ec8e"}.ri-emotion-laugh-line:before{content:"\ec8f"}.ri-emotion-line:before{content:"\ec90"}.ri-emotion-normal-fill:before{content:"\ec91"}.ri-emotion-normal-line:before{content:"\ec92"}.ri-emotion-sad-fill:before{content:"\ec93"}.ri-emotion-sad-line:before{content:"\ec94"}.ri-emotion-unhappy-fill:before{content:"\ec95"}.ri-emotion-unhappy-line:before{content:"\ec96"}.ri-empathize-fill:before{content:"\ec97"}.ri-empathize-line:before{content:"\ec98"}.ri-emphasis-cn:before{content:"\ec99"}.ri-emphasis:before{content:"\ec9a"}.ri-english-input:before{content:"\ec9b"}.ri-equalizer-fill:before{content:"\ec9c"}.ri-equalizer-line:before{content:"\ec9d"}.ri-eraser-fill:before{content:"\ec9e"}.ri-eraser-line:before{content:"\ec9f"}.ri-error-warning-fill:before{content:"\eca0"}.ri-error-warning-line:before{content:"\eca1"}.ri-evernote-fill:before{content:"\eca2"}.ri-evernote-line:before{content:"\eca3"}.ri-exchange-box-fill:before{content:"\eca4"}.ri-exchange-box-line:before{content:"\eca5"}.ri-exchange-cny-fill:before{content:"\eca6"}.ri-exchange-cny-line:before{content:"\eca7"}.ri-exchange-dollar-fill:before{content:"\eca8"}.ri-exchange-dollar-line:before{content:"\eca9"}.ri-exchange-fill:before{content:"\ecaa"}.ri-exchange-funds-fill:before{content:"\ecab"}.ri-exchange-funds-line:before{content:"\ecac"}.ri-exchange-line:before{content:"\ecad"}.ri-external-link-fill:before{content:"\ecae"}.ri-external-link-line:before{content:"\ecaf"}.ri-eye-2-fill:before{content:"\ecb0"}.ri-eye-2-line:before{content:"\ecb1"}.ri-eye-close-fill:before{content:"\ecb2"}.ri-eye-close-line:before{content:"\ecb3"}.ri-eye-fill:before{content:"\ecb4"}.ri-eye-line:before{content:"\ecb5"}.ri-eye-off-fill:before{content:"\ecb6"}.ri-eye-off-line:before{content:"\ecb7"}.ri-facebook-box-fill:before{content:"\ecb8"}.ri-facebook-box-line:before{content:"\ecb9"}.ri-facebook-circle-fill:before{content:"\ecba"}.ri-facebook-circle-line:before{content:"\ecbb"}.ri-facebook-fill:before{content:"\ecbc"}.ri-facebook-line:before{content:"\ecbd"}.ri-fahrenheit-fill:before{content:"\ecbe"}.ri-fahrenheit-line:before{content:"\ecbf"}.ri-feedback-fill:before{content:"\ecc0"}.ri-feedback-line:before{content:"\ecc1"}.ri-file-2-fill:before{content:"\ecc2"}.ri-file-2-line:before{content:"\ecc3"}.ri-file-3-fill:before{content:"\ecc4"}.ri-file-3-line:before{content:"\ecc5"}.ri-file-4-fill:before{content:"\ecc6"}.ri-file-4-line:before{content:"\ecc7"}.ri-file-add-fill:before{content:"\ecc8"}.ri-file-add-line:before{content:"\ecc9"}.ri-file-chart-2-fill:before{content:"\ecca"}.ri-file-chart-2-line:before{content:"\eccb"}.ri-file-chart-fill:before{content:"\eccc"}.ri-file-chart-line:before{content:"\eccd"}.ri-file-cloud-fill:before{content:"\ecce"}.ri-file-cloud-line:before{content:"\eccf"}.ri-file-code-fill:before{content:"\ecd0"}.ri-file-code-line:before{content:"\ecd1"}.ri-file-copy-2-fill:before{content:"\ecd2"}.ri-file-copy-2-line:before{content:"\ecd3"}.ri-file-copy-fill:before{content:"\ecd4"}.ri-file-copy-line:before{content:"\ecd5"}.ri-file-damage-fill:before{content:"\ecd6"}.ri-file-damage-line:before{content:"\ecd7"}.ri-file-download-fill:before{content:"\ecd8"}.ri-file-download-line:before{content:"\ecd9"}.ri-file-edit-fill:before{content:"\ecda"}.ri-file-edit-line:before{content:"\ecdb"}.ri-file-excel-2-fill:before{content:"\ecdc"}.ri-file-excel-2-line:before{content:"\ecdd"}.ri-file-excel-fill:before{content:"\ecde"}.ri-file-excel-line:before{content:"\ecdf"}.ri-file-fill:before{content:"\ece0"}.ri-file-forbid-fill:before{content:"\ece1"}.ri-file-forbid-line:before{content:"\ece2"}.ri-file-gif-fill:before{content:"\ece3"}.ri-file-gif-line:before{content:"\ece4"}.ri-file-history-fill:before{content:"\ece5"}.ri-file-history-line:before{content:"\ece6"}.ri-file-hwp-fill:before{content:"\ece7"}.ri-file-hwp-line:before{content:"\ece8"}.ri-file-info-fill:before{content:"\ece9"}.ri-file-info-line:before{content:"\ecea"}.ri-file-line:before{content:"\eceb"}.ri-file-list-2-fill:before{content:"\ecec"}.ri-file-list-2-line:before{content:"\eced"}.ri-file-list-3-fill:before{content:"\ecee"}.ri-file-list-3-line:before{content:"\ecef"}.ri-file-list-fill:before{content:"\ecf0"}.ri-file-list-line:before{content:"\ecf1"}.ri-file-lock-fill:before{content:"\ecf2"}.ri-file-lock-line:before{content:"\ecf3"}.ri-file-mark-fill:before{content:"\ecf4"}.ri-file-mark-line:before{content:"\ecf5"}.ri-file-music-fill:before{content:"\ecf6"}.ri-file-music-line:before{content:"\ecf7"}.ri-file-paper-2-fill:before{content:"\ecf8"}.ri-file-paper-2-line:before{content:"\ecf9"}.ri-file-paper-fill:before{content:"\ecfa"}.ri-file-paper-line:before{content:"\ecfb"}.ri-file-pdf-fill:before{content:"\ecfc"}.ri-file-pdf-line:before{content:"\ecfd"}.ri-file-ppt-2-fill:before{content:"\ecfe"}.ri-file-ppt-2-line:before{content:"\ecff"}.ri-file-ppt-fill:before{content:"\ed00"}.ri-file-ppt-line:before{content:"\ed01"}.ri-file-reduce-fill:before{content:"\ed02"}.ri-file-reduce-line:before{content:"\ed03"}.ri-file-search-fill:before{content:"\ed04"}.ri-file-search-line:before{content:"\ed05"}.ri-file-settings-fill:before{content:"\ed06"}.ri-file-settings-line:before{content:"\ed07"}.ri-file-shield-2-fill:before{content:"\ed08"}.ri-file-shield-2-line:before{content:"\ed09"}.ri-file-shield-fill:before{content:"\ed0a"}.ri-file-shield-line:before{content:"\ed0b"}.ri-file-shred-fill:before{content:"\ed0c"}.ri-file-shred-line:before{content:"\ed0d"}.ri-file-text-fill:before{content:"\ed0e"}.ri-file-text-line:before{content:"\ed0f"}.ri-file-transfer-fill:before{content:"\ed10"}.ri-file-transfer-line:before{content:"\ed11"}.ri-file-unknow-fill:before{content:"\ed12"}.ri-file-unknow-line:before{content:"\ed13"}.ri-file-upload-fill:before{content:"\ed14"}.ri-file-upload-line:before{content:"\ed15"}.ri-file-user-fill:before{content:"\ed16"}.ri-file-user-line:before{content:"\ed17"}.ri-file-warning-fill:before{content:"\ed18"}.ri-file-warning-line:before{content:"\ed19"}.ri-file-word-2-fill:before{content:"\ed1a"}.ri-file-word-2-line:before{content:"\ed1b"}.ri-file-word-fill:before{content:"\ed1c"}.ri-file-word-line:before{content:"\ed1d"}.ri-file-zip-fill:before{content:"\ed1e"}.ri-file-zip-line:before{content:"\ed1f"}.ri-film-fill:before{content:"\ed20"}.ri-film-line:before{content:"\ed21"}.ri-filter-2-fill:before{content:"\ed22"}.ri-filter-2-line:before{content:"\ed23"}.ri-filter-3-fill:before{content:"\ed24"}.ri-filter-3-line:before{content:"\ed25"}.ri-filter-fill:before{content:"\ed26"}.ri-filter-line:before{content:"\ed27"}.ri-filter-off-fill:before{content:"\ed28"}.ri-filter-off-line:before{content:"\ed29"}.ri-find-replace-fill:before{content:"\ed2a"}.ri-find-replace-line:before{content:"\ed2b"}.ri-finder-fill:before{content:"\ed2c"}.ri-finder-line:before{content:"\ed2d"}.ri-fingerprint-2-fill:before{content:"\ed2e"}.ri-fingerprint-2-line:before{content:"\ed2f"}.ri-fingerprint-fill:before{content:"\ed30"}.ri-fingerprint-line:before{content:"\ed31"}.ri-fire-fill:before{content:"\ed32"}.ri-fire-line:before{content:"\ed33"}.ri-firefox-fill:before{content:"\ed34"}.ri-firefox-line:before{content:"\ed35"}.ri-first-aid-kit-fill:before{content:"\ed36"}.ri-first-aid-kit-line:before{content:"\ed37"}.ri-flag-2-fill:before{content:"\ed38"}.ri-flag-2-line:before{content:"\ed39"}.ri-flag-fill:before{content:"\ed3a"}.ri-flag-line:before{content:"\ed3b"}.ri-flashlight-fill:before{content:"\ed3c"}.ri-flashlight-line:before{content:"\ed3d"}.ri-flask-fill:before{content:"\ed3e"}.ri-flask-line:before{content:"\ed3f"}.ri-flight-land-fill:before{content:"\ed40"}.ri-flight-land-line:before{content:"\ed41"}.ri-flight-takeoff-fill:before{content:"\ed42"}.ri-flight-takeoff-line:before{content:"\ed43"}.ri-flood-fill:before{content:"\ed44"}.ri-flood-line:before{content:"\ed45"}.ri-flow-chart:before{content:"\ed46"}.ri-flutter-fill:before{content:"\ed47"}.ri-flutter-line:before{content:"\ed48"}.ri-focus-2-fill:before{content:"\ed49"}.ri-focus-2-line:before{content:"\ed4a"}.ri-focus-3-fill:before{content:"\ed4b"}.ri-focus-3-line:before{content:"\ed4c"}.ri-focus-fill:before{content:"\ed4d"}.ri-focus-line:before{content:"\ed4e"}.ri-foggy-fill:before{content:"\ed4f"}.ri-foggy-line:before{content:"\ed50"}.ri-folder-2-fill:before{content:"\ed51"}.ri-folder-2-line:before{content:"\ed52"}.ri-folder-3-fill:before{content:"\ed53"}.ri-folder-3-line:before{content:"\ed54"}.ri-folder-4-fill:before{content:"\ed55"}.ri-folder-4-line:before{content:"\ed56"}.ri-folder-5-fill:before{content:"\ed57"}.ri-folder-5-line:before{content:"\ed58"}.ri-folder-add-fill:before{content:"\ed59"}.ri-folder-add-line:before{content:"\ed5a"}.ri-folder-chart-2-fill:before{content:"\ed5b"}.ri-folder-chart-2-line:before{content:"\ed5c"}.ri-folder-chart-fill:before{content:"\ed5d"}.ri-folder-chart-line:before{content:"\ed5e"}.ri-folder-download-fill:before{content:"\ed5f"}.ri-folder-download-line:before{content:"\ed60"}.ri-folder-fill:before{content:"\ed61"}.ri-folder-forbid-fill:before{content:"\ed62"}.ri-folder-forbid-line:before{content:"\ed63"}.ri-folder-history-fill:before{content:"\ed64"}.ri-folder-history-line:before{content:"\ed65"}.ri-folder-info-fill:before{content:"\ed66"}.ri-folder-info-line:before{content:"\ed67"}.ri-folder-keyhole-fill:before{content:"\ed68"}.ri-folder-keyhole-line:before{content:"\ed69"}.ri-folder-line:before{content:"\ed6a"}.ri-folder-lock-fill:before{content:"\ed6b"}.ri-folder-lock-line:before{content:"\ed6c"}.ri-folder-music-fill:before{content:"\ed6d"}.ri-folder-music-line:before{content:"\ed6e"}.ri-folder-open-fill:before{content:"\ed6f"}.ri-folder-open-line:before{content:"\ed70"}.ri-folder-received-fill:before{content:"\ed71"}.ri-folder-received-line:before{content:"\ed72"}.ri-folder-reduce-fill:before{content:"\ed73"}.ri-folder-reduce-line:before{content:"\ed74"}.ri-folder-settings-fill:before{content:"\ed75"}.ri-folder-settings-line:before{content:"\ed76"}.ri-folder-shared-fill:before{content:"\ed77"}.ri-folder-shared-line:before{content:"\ed78"}.ri-folder-shield-2-fill:before{content:"\ed79"}.ri-folder-shield-2-line:before{content:"\ed7a"}.ri-folder-shield-fill:before{content:"\ed7b"}.ri-folder-shield-line:before{content:"\ed7c"}.ri-folder-transfer-fill:before{content:"\ed7d"}.ri-folder-transfer-line:before{content:"\ed7e"}.ri-folder-unknow-fill:before{content:"\ed7f"}.ri-folder-unknow-line:before{content:"\ed80"}.ri-folder-upload-fill:before{content:"\ed81"}.ri-folder-upload-line:before{content:"\ed82"}.ri-folder-user-fill:before{content:"\ed83"}.ri-folder-user-line:before{content:"\ed84"}.ri-folder-warning-fill:before{content:"\ed85"}.ri-folder-warning-line:before{content:"\ed86"}.ri-folder-zip-fill:before{content:"\ed87"}.ri-folder-zip-line:before{content:"\ed88"}.ri-folders-fill:before{content:"\ed89"}.ri-folders-line:before{content:"\ed8a"}.ri-font-color:before{content:"\ed8b"}.ri-font-size-2:before{content:"\ed8c"}.ri-font-size:before{content:"\ed8d"}.ri-football-fill:before{content:"\ed8e"}.ri-football-line:before{content:"\ed8f"}.ri-footprint-fill:before{content:"\ed90"}.ri-footprint-line:before{content:"\ed91"}.ri-forbid-2-fill:before{content:"\ed92"}.ri-forbid-2-line:before{content:"\ed93"}.ri-forbid-fill:before{content:"\ed94"}.ri-forbid-line:before{content:"\ed95"}.ri-format-clear:before{content:"\ed96"}.ri-fridge-fill:before{content:"\ed97"}.ri-fridge-line:before{content:"\ed98"}.ri-fullscreen-exit-fill:before{content:"\ed99"}.ri-fullscreen-exit-line:before{content:"\ed9a"}.ri-fullscreen-fill:before{content:"\ed9b"}.ri-fullscreen-line:before{content:"\ed9c"}.ri-function-fill:before{content:"\ed9d"}.ri-function-line:before{content:"\ed9e"}.ri-functions:before{content:"\ed9f"}.ri-funds-box-fill:before{content:"\eda0"}.ri-funds-box-line:before{content:"\eda1"}.ri-funds-fill:before{content:"\eda2"}.ri-funds-line:before{content:"\eda3"}.ri-gallery-fill:before{content:"\eda4"}.ri-gallery-line:before{content:"\eda5"}.ri-gallery-upload-fill:before{content:"\eda6"}.ri-gallery-upload-line:before{content:"\eda7"}.ri-game-fill:before{content:"\eda8"}.ri-game-line:before{content:"\eda9"}.ri-gamepad-fill:before{content:"\edaa"}.ri-gamepad-line:before{content:"\edab"}.ri-gas-station-fill:before{content:"\edac"}.ri-gas-station-line:before{content:"\edad"}.ri-gatsby-fill:before{content:"\edae"}.ri-gatsby-line:before{content:"\edaf"}.ri-genderless-fill:before{content:"\edb0"}.ri-genderless-line:before{content:"\edb1"}.ri-ghost-2-fill:before{content:"\edb2"}.ri-ghost-2-line:before{content:"\edb3"}.ri-ghost-fill:before{content:"\edb4"}.ri-ghost-line:before{content:"\edb5"}.ri-ghost-smile-fill:before{content:"\edb6"}.ri-ghost-smile-line:before{content:"\edb7"}.ri-gift-2-fill:before{content:"\edb8"}.ri-gift-2-line:before{content:"\edb9"}.ri-gift-fill:before{content:"\edba"}.ri-gift-line:before{content:"\edbb"}.ri-git-branch-fill:before{content:"\edbc"}.ri-git-branch-line:before{content:"\edbd"}.ri-git-commit-fill:before{content:"\edbe"}.ri-git-commit-line:before{content:"\edbf"}.ri-git-merge-fill:before{content:"\edc0"}.ri-git-merge-line:before{content:"\edc1"}.ri-git-pull-request-fill:before{content:"\edc2"}.ri-git-pull-request-line:before{content:"\edc3"}.ri-git-repository-commits-fill:before{content:"\edc4"}.ri-git-repository-commits-line:before{content:"\edc5"}.ri-git-repository-fill:before{content:"\edc6"}.ri-git-repository-line:before{content:"\edc7"}.ri-git-repository-private-fill:before{content:"\edc8"}.ri-git-repository-private-line:before{content:"\edc9"}.ri-github-fill:before{content:"\edca"}.ri-github-line:before{content:"\edcb"}.ri-gitlab-fill:before{content:"\edcc"}.ri-gitlab-line:before{content:"\edcd"}.ri-global-fill:before{content:"\edce"}.ri-global-line:before{content:"\edcf"}.ri-globe-fill:before{content:"\edd0"}.ri-globe-line:before{content:"\edd1"}.ri-goblet-fill:before{content:"\edd2"}.ri-goblet-line:before{content:"\edd3"}.ri-google-fill:before{content:"\edd4"}.ri-google-line:before{content:"\edd5"}.ri-google-play-fill:before{content:"\edd6"}.ri-google-play-line:before{content:"\edd7"}.ri-government-fill:before{content:"\edd8"}.ri-government-line:before{content:"\edd9"}.ri-gps-fill:before{content:"\edda"}.ri-gps-line:before{content:"\eddb"}.ri-gradienter-fill:before{content:"\eddc"}.ri-gradienter-line:before{content:"\eddd"}.ri-grid-fill:before{content:"\edde"}.ri-grid-line:before{content:"\eddf"}.ri-group-2-fill:before{content:"\ede0"}.ri-group-2-line:before{content:"\ede1"}.ri-group-fill:before{content:"\ede2"}.ri-group-line:before{content:"\ede3"}.ri-guide-fill:before{content:"\ede4"}.ri-guide-line:before{content:"\ede5"}.ri-h-1:before{content:"\ede6"}.ri-h-2:before{content:"\ede7"}.ri-h-3:before{content:"\ede8"}.ri-h-4:before{content:"\ede9"}.ri-h-5:before{content:"\edea"}.ri-h-6:before{content:"\edeb"}.ri-hail-fill:before{content:"\edec"}.ri-hail-line:before{content:"\eded"}.ri-hammer-fill:before{content:"\edee"}.ri-hammer-line:before{content:"\edef"}.ri-hand-coin-fill:before{content:"\edf0"}.ri-hand-coin-line:before{content:"\edf1"}.ri-hand-heart-fill:before{content:"\edf2"}.ri-hand-heart-line:before{content:"\edf3"}.ri-hand-sanitizer-fill:before{content:"\edf4"}.ri-hand-sanitizer-line:before{content:"\edf5"}.ri-handbag-fill:before{content:"\edf6"}.ri-handbag-line:before{content:"\edf7"}.ri-hard-drive-2-fill:before{content:"\edf8"}.ri-hard-drive-2-line:before{content:"\edf9"}.ri-hard-drive-fill:before{content:"\edfa"}.ri-hard-drive-line:before{content:"\edfb"}.ri-hashtag:before{content:"\edfc"}.ri-haze-2-fill:before{content:"\edfd"}.ri-haze-2-line:before{content:"\edfe"}.ri-haze-fill:before{content:"\edff"}.ri-haze-line:before{content:"\ee00"}.ri-hd-fill:before{content:"\ee01"}.ri-hd-line:before{content:"\ee02"}.ri-heading:before{content:"\ee03"}.ri-headphone-fill:before{content:"\ee04"}.ri-headphone-line:before{content:"\ee05"}.ri-health-book-fill:before{content:"\ee06"}.ri-health-book-line:before{content:"\ee07"}.ri-heart-2-fill:before{content:"\ee08"}.ri-heart-2-line:before{content:"\ee09"}.ri-heart-3-fill:before{content:"\ee0a"}.ri-heart-3-line:before{content:"\ee0b"}.ri-heart-add-fill:before{content:"\ee0c"}.ri-heart-add-line:before{content:"\ee0d"}.ri-heart-fill:before{content:"\ee0e"}.ri-heart-line:before{content:"\ee0f"}.ri-heart-pulse-fill:before{content:"\ee10"}.ri-heart-pulse-line:before{content:"\ee11"}.ri-hearts-fill:before{content:"\ee12"}.ri-hearts-line:before{content:"\ee13"}.ri-heavy-showers-fill:before{content:"\ee14"}.ri-heavy-showers-line:before{content:"\ee15"}.ri-history-fill:before{content:"\ee16"}.ri-history-line:before{content:"\ee17"}.ri-home-2-fill:before{content:"\ee18"}.ri-home-2-line:before{content:"\ee19"}.ri-home-3-fill:before{content:"\ee1a"}.ri-home-3-line:before{content:"\ee1b"}.ri-home-4-fill:before{content:"\ee1c"}.ri-home-4-line:before{content:"\ee1d"}.ri-home-5-fill:before{content:"\ee1e"}.ri-home-5-line:before{content:"\ee1f"}.ri-home-6-fill:before{content:"\ee20"}.ri-home-6-line:before{content:"\ee21"}.ri-home-7-fill:before{content:"\ee22"}.ri-home-7-line:before{content:"\ee23"}.ri-home-8-fill:before{content:"\ee24"}.ri-home-8-line:before{content:"\ee25"}.ri-home-fill:before{content:"\ee26"}.ri-home-gear-fill:before{content:"\ee27"}.ri-home-gear-line:before{content:"\ee28"}.ri-home-heart-fill:before{content:"\ee29"}.ri-home-heart-line:before{content:"\ee2a"}.ri-home-line:before{content:"\ee2b"}.ri-home-smile-2-fill:before{content:"\ee2c"}.ri-home-smile-2-line:before{content:"\ee2d"}.ri-home-smile-fill:before{content:"\ee2e"}.ri-home-smile-line:before{content:"\ee2f"}.ri-home-wifi-fill:before{content:"\ee30"}.ri-home-wifi-line:before{content:"\ee31"}.ri-honor-of-kings-fill:before{content:"\ee32"}.ri-honor-of-kings-line:before{content:"\ee33"}.ri-honour-fill:before{content:"\ee34"}.ri-honour-line:before{content:"\ee35"}.ri-hospital-fill:before{content:"\ee36"}.ri-hospital-line:before{content:"\ee37"}.ri-hotel-bed-fill:before{content:"\ee38"}.ri-hotel-bed-line:before{content:"\ee39"}.ri-hotel-fill:before{content:"\ee3a"}.ri-hotel-line:before{content:"\ee3b"}.ri-hotspot-fill:before{content:"\ee3c"}.ri-hotspot-line:before{content:"\ee3d"}.ri-hq-fill:before{content:"\ee3e"}.ri-hq-line:before{content:"\ee3f"}.ri-html5-fill:before{content:"\ee40"}.ri-html5-line:before{content:"\ee41"}.ri-ie-fill:before{content:"\ee42"}.ri-ie-line:before{content:"\ee43"}.ri-image-2-fill:before{content:"\ee44"}.ri-image-2-line:before{content:"\ee45"}.ri-image-add-fill:before{content:"\ee46"}.ri-image-add-line:before{content:"\ee47"}.ri-image-edit-fill:before{content:"\ee48"}.ri-image-edit-line:before{content:"\ee49"}.ri-image-fill:before{content:"\ee4a"}.ri-image-line:before{content:"\ee4b"}.ri-inbox-archive-fill:before{content:"\ee4c"}.ri-inbox-archive-line:before{content:"\ee4d"}.ri-inbox-fill:before{content:"\ee4e"}.ri-inbox-line:before{content:"\ee4f"}.ri-inbox-unarchive-fill:before{content:"\ee50"}.ri-inbox-unarchive-line:before{content:"\ee51"}.ri-increase-decrease-fill:before{content:"\ee52"}.ri-increase-decrease-line:before{content:"\ee53"}.ri-indent-decrease:before{content:"\ee54"}.ri-indent-increase:before{content:"\ee55"}.ri-indeterminate-circle-fill:before{content:"\ee56"}.ri-indeterminate-circle-line:before{content:"\ee57"}.ri-information-fill:before{content:"\ee58"}.ri-information-line:before{content:"\ee59"}.ri-infrared-thermometer-fill:before{content:"\ee5a"}.ri-infrared-thermometer-line:before{content:"\ee5b"}.ri-ink-bottle-fill:before{content:"\ee5c"}.ri-ink-bottle-line:before{content:"\ee5d"}.ri-input-cursor-move:before{content:"\ee5e"}.ri-input-method-fill:before{content:"\ee5f"}.ri-input-method-line:before{content:"\ee60"}.ri-insert-column-left:before{content:"\ee61"}.ri-insert-column-right:before{content:"\ee62"}.ri-insert-row-bottom:before{content:"\ee63"}.ri-insert-row-top:before{content:"\ee64"}.ri-instagram-fill:before{content:"\ee65"}.ri-instagram-line:before{content:"\ee66"}.ri-install-fill:before{content:"\ee67"}.ri-install-line:before{content:"\ee68"}.ri-invision-fill:before{content:"\ee69"}.ri-invision-line:before{content:"\ee6a"}.ri-italic:before{content:"\ee6b"}.ri-kakao-talk-fill:before{content:"\ee6c"}.ri-kakao-talk-line:before{content:"\ee6d"}.ri-key-2-fill:before{content:"\ee6e"}.ri-key-2-line:before{content:"\ee6f"}.ri-key-fill:before{content:"\ee70"}.ri-key-line:before{content:"\ee71"}.ri-keyboard-box-fill:before{content:"\ee72"}.ri-keyboard-box-line:before{content:"\ee73"}.ri-keyboard-fill:before{content:"\ee74"}.ri-keyboard-line:before{content:"\ee75"}.ri-keynote-fill:before{content:"\ee76"}.ri-keynote-line:before{content:"\ee77"}.ri-knife-blood-fill:before{content:"\ee78"}.ri-knife-blood-line:before{content:"\ee79"}.ri-knife-fill:before{content:"\ee7a"}.ri-knife-line:before{content:"\ee7b"}.ri-landscape-fill:before{content:"\ee7c"}.ri-landscape-line:before{content:"\ee7d"}.ri-layout-2-fill:before{content:"\ee7e"}.ri-layout-2-line:before{content:"\ee7f"}.ri-layout-3-fill:before{content:"\ee80"}.ri-layout-3-line:before{content:"\ee81"}.ri-layout-4-fill:before{content:"\ee82"}.ri-layout-4-line:before{content:"\ee83"}.ri-layout-5-fill:before{content:"\ee84"}.ri-layout-5-line:before{content:"\ee85"}.ri-layout-6-fill:before{content:"\ee86"}.ri-layout-6-line:before{content:"\ee87"}.ri-layout-bottom-2-fill:before{content:"\ee88"}.ri-layout-bottom-2-line:before{content:"\ee89"}.ri-layout-bottom-fill:before{content:"\ee8a"}.ri-layout-bottom-line:before{content:"\ee8b"}.ri-layout-column-fill:before{content:"\ee8c"}.ri-layout-column-line:before{content:"\ee8d"}.ri-layout-fill:before{content:"\ee8e"}.ri-layout-grid-fill:before{content:"\ee8f"}.ri-layout-grid-line:before{content:"\ee90"}.ri-layout-left-2-fill:before{content:"\ee91"}.ri-layout-left-2-line:before{content:"\ee92"}.ri-layout-left-fill:before{content:"\ee93"}.ri-layout-left-line:before{content:"\ee94"}.ri-layout-line:before{content:"\ee95"}.ri-layout-masonry-fill:before{content:"\ee96"}.ri-layout-masonry-line:before{content:"\ee97"}.ri-layout-right-2-fill:before{content:"\ee98"}.ri-layout-right-2-line:before{content:"\ee99"}.ri-layout-right-fill:before{content:"\ee9a"}.ri-layout-right-line:before{content:"\ee9b"}.ri-layout-row-fill:before{content:"\ee9c"}.ri-layout-row-line:before{content:"\ee9d"}.ri-layout-top-2-fill:before{content:"\ee9e"}.ri-layout-top-2-line:before{content:"\ee9f"}.ri-layout-top-fill:before{content:"\eea0"}.ri-layout-top-line:before{content:"\eea1"}.ri-leaf-fill:before{content:"\eea2"}.ri-leaf-line:before{content:"\eea3"}.ri-lifebuoy-fill:before{content:"\eea4"}.ri-lifebuoy-line:before{content:"\eea5"}.ri-lightbulb-fill:before{content:"\eea6"}.ri-lightbulb-flash-fill:before{content:"\eea7"}.ri-lightbulb-flash-line:before{content:"\eea8"}.ri-lightbulb-line:before{content:"\eea9"}.ri-line-chart-fill:before{content:"\eeaa"}.ri-line-chart-line:before{content:"\eeab"}.ri-line-fill:before{content:"\eeac"}.ri-line-height:before{content:"\eead"}.ri-line-line:before{content:"\eeae"}.ri-link-m:before{content:"\eeaf"}.ri-link-unlink-m:before{content:"\eeb0"}.ri-link-unlink:before{content:"\eeb1"}.ri-link:before{content:"\eeb2"}.ri-linkedin-box-fill:before{content:"\eeb3"}.ri-linkedin-box-line:before{content:"\eeb4"}.ri-linkedin-fill:before{content:"\eeb5"}.ri-linkedin-line:before{content:"\eeb6"}.ri-links-fill:before{content:"\eeb7"}.ri-links-line:before{content:"\eeb8"}.ri-list-check-2:before{content:"\eeb9"}.ri-list-check:before{content:"\eeba"}.ri-list-ordered:before{content:"\eebb"}.ri-list-settings-fill:before{content:"\eebc"}.ri-list-settings-line:before{content:"\eebd"}.ri-list-unordered:before{content:"\eebe"}.ri-live-fill:before{content:"\eebf"}.ri-live-line:before{content:"\eec0"}.ri-loader-2-fill:before{content:"\eec1"}.ri-loader-2-line:before{content:"\eec2"}.ri-loader-3-fill:before{content:"\eec3"}.ri-loader-3-line:before{content:"\eec4"}.ri-loader-4-fill:before{content:"\eec5"}.ri-loader-4-line:before{content:"\eec6"}.ri-loader-5-fill:before{content:"\eec7"}.ri-loader-5-line:before{content:"\eec8"}.ri-loader-fill:before{content:"\eec9"}.ri-loader-line:before{content:"\eeca"}.ri-lock-2-fill:before{content:"\eecb"}.ri-lock-2-line:before{content:"\eecc"}.ri-lock-fill:before{content:"\eecd"}.ri-lock-line:before{content:"\eece"}.ri-lock-password-fill:before{content:"\eecf"}.ri-lock-password-line:before{content:"\eed0"}.ri-lock-unlock-fill:before{content:"\eed1"}.ri-lock-unlock-line:before{content:"\eed2"}.ri-login-box-fill:before{content:"\eed3"}.ri-login-box-line:before{content:"\eed4"}.ri-login-circle-fill:before{content:"\eed5"}.ri-login-circle-line:before{content:"\eed6"}.ri-logout-box-fill:before{content:"\eed7"}.ri-logout-box-line:before{content:"\eed8"}.ri-logout-box-r-fill:before{content:"\eed9"}.ri-logout-box-r-line:before{content:"\eeda"}.ri-logout-circle-fill:before{content:"\eedb"}.ri-logout-circle-line:before{content:"\eedc"}.ri-logout-circle-r-fill:before{content:"\eedd"}.ri-logout-circle-r-line:before{content:"\eede"}.ri-luggage-cart-fill:before{content:"\eedf"}.ri-luggage-cart-line:before{content:"\eee0"}.ri-luggage-deposit-fill:before{content:"\eee1"}.ri-luggage-deposit-line:before{content:"\eee2"}.ri-lungs-fill:before{content:"\eee3"}.ri-lungs-line:before{content:"\eee4"}.ri-mac-fill:before{content:"\eee5"}.ri-mac-line:before{content:"\eee6"}.ri-macbook-fill:before{content:"\eee7"}.ri-macbook-line:before{content:"\eee8"}.ri-magic-fill:before{content:"\eee9"}.ri-magic-line:before{content:"\eeea"}.ri-mail-add-fill:before{content:"\eeeb"}.ri-mail-add-line:before{content:"\eeec"}.ri-mail-check-fill:before{content:"\eeed"}.ri-mail-check-line:before{content:"\eeee"}.ri-mail-close-fill:before{content:"\eeef"}.ri-mail-close-line:before{content:"\eef0"}.ri-mail-download-fill:before{content:"\eef1"}.ri-mail-download-line:before{content:"\eef2"}.ri-mail-fill:before{content:"\eef3"}.ri-mail-forbid-fill:before{content:"\eef4"}.ri-mail-forbid-line:before{content:"\eef5"}.ri-mail-line:before{content:"\eef6"}.ri-mail-lock-fill:before{content:"\eef7"}.ri-mail-lock-line:before{content:"\eef8"}.ri-mail-open-fill:before{content:"\eef9"}.ri-mail-open-line:before{content:"\eefa"}.ri-mail-send-fill:before{content:"\eefb"}.ri-mail-send-line:before{content:"\eefc"}.ri-mail-settings-fill:before{content:"\eefd"}.ri-mail-settings-line:before{content:"\eefe"}.ri-mail-star-fill:before{content:"\eeff"}.ri-mail-star-line:before{content:"\ef00"}.ri-mail-unread-fill:before{content:"\ef01"}.ri-mail-unread-line:before{content:"\ef02"}.ri-mail-volume-fill:before{content:"\ef03"}.ri-mail-volume-line:before{content:"\ef04"}.ri-map-2-fill:before{content:"\ef05"}.ri-map-2-line:before{content:"\ef06"}.ri-map-fill:before{content:"\ef07"}.ri-map-line:before{content:"\ef08"}.ri-map-pin-2-fill:before{content:"\ef09"}.ri-map-pin-2-line:before{content:"\ef0a"}.ri-map-pin-3-fill:before{content:"\ef0b"}.ri-map-pin-3-line:before{content:"\ef0c"}.ri-map-pin-4-fill:before{content:"\ef0d"}.ri-map-pin-4-line:before{content:"\ef0e"}.ri-map-pin-5-fill:before{content:"\ef0f"}.ri-map-pin-5-line:before{content:"\ef10"}.ri-map-pin-add-fill:before{content:"\ef11"}.ri-map-pin-add-line:before{content:"\ef12"}.ri-map-pin-fill:before{content:"\ef13"}.ri-map-pin-line:before{content:"\ef14"}.ri-map-pin-range-fill:before{content:"\ef15"}.ri-map-pin-range-line:before{content:"\ef16"}.ri-map-pin-time-fill:before{content:"\ef17"}.ri-map-pin-time-line:before{content:"\ef18"}.ri-map-pin-user-fill:before{content:"\ef19"}.ri-map-pin-user-line:before{content:"\ef1a"}.ri-mark-pen-fill:before{content:"\ef1b"}.ri-mark-pen-line:before{content:"\ef1c"}.ri-markdown-fill:before{content:"\ef1d"}.ri-markdown-line:before{content:"\ef1e"}.ri-markup-fill:before{content:"\ef1f"}.ri-markup-line:before{content:"\ef20"}.ri-mastercard-fill:before{content:"\ef21"}.ri-mastercard-line:before{content:"\ef22"}.ri-mastodon-fill:before{content:"\ef23"}.ri-mastodon-line:before{content:"\ef24"}.ri-medal-2-fill:before{content:"\ef25"}.ri-medal-2-line:before{content:"\ef26"}.ri-medal-fill:before{content:"\ef27"}.ri-medal-line:before{content:"\ef28"}.ri-medicine-bottle-fill:before{content:"\ef29"}.ri-medicine-bottle-line:before{content:"\ef2a"}.ri-medium-fill:before{content:"\ef2b"}.ri-medium-line:before{content:"\ef2c"}.ri-men-fill:before{content:"\ef2d"}.ri-men-line:before{content:"\ef2e"}.ri-mental-health-fill:before{content:"\ef2f"}.ri-mental-health-line:before{content:"\ef30"}.ri-menu-2-fill:before{content:"\ef31"}.ri-menu-2-line:before{content:"\ef32"}.ri-menu-3-fill:before{content:"\ef33"}.ri-menu-3-line:before{content:"\ef34"}.ri-menu-4-fill:before{content:"\ef35"}.ri-menu-4-line:before{content:"\ef36"}.ri-menu-5-fill:before{content:"\ef37"}.ri-menu-5-line:before{content:"\ef38"}.ri-menu-add-fill:before{content:"\ef39"}.ri-menu-add-line:before{content:"\ef3a"}.ri-menu-fill:before{content:"\ef3b"}.ri-menu-fold-fill:before{content:"\ef3c"}.ri-menu-fold-line:before{content:"\ef3d"}.ri-menu-line:before{content:"\ef3e"}.ri-menu-unfold-fill:before{content:"\ef3f"}.ri-menu-unfold-line:before{content:"\ef40"}.ri-merge-cells-horizontal:before{content:"\ef41"}.ri-merge-cells-vertical:before{content:"\ef42"}.ri-message-2-fill:before{content:"\ef43"}.ri-message-2-line:before{content:"\ef44"}.ri-message-3-fill:before{content:"\ef45"}.ri-message-3-line:before{content:"\ef46"}.ri-message-fill:before{content:"\ef47"}.ri-message-line:before{content:"\ef48"}.ri-messenger-fill:before{content:"\ef49"}.ri-messenger-line:before{content:"\ef4a"}.ri-meteor-fill:before{content:"\ef4b"}.ri-meteor-line:before{content:"\ef4c"}.ri-mic-2-fill:before{content:"\ef4d"}.ri-mic-2-line:before{content:"\ef4e"}.ri-mic-fill:before{content:"\ef4f"}.ri-mic-line:before{content:"\ef50"}.ri-mic-off-fill:before{content:"\ef51"}.ri-mic-off-line:before{content:"\ef52"}.ri-mickey-fill:before{content:"\ef53"}.ri-mickey-line:before{content:"\ef54"}.ri-microscope-fill:before{content:"\ef55"}.ri-microscope-line:before{content:"\ef56"}.ri-microsoft-fill:before{content:"\ef57"}.ri-microsoft-line:before{content:"\ef58"}.ri-mind-map:before{content:"\ef59"}.ri-mini-program-fill:before{content:"\ef5a"}.ri-mini-program-line:before{content:"\ef5b"}.ri-mist-fill:before{content:"\ef5c"}.ri-mist-line:before{content:"\ef5d"}.ri-money-cny-box-fill:before{content:"\ef5e"}.ri-money-cny-box-line:before{content:"\ef5f"}.ri-money-cny-circle-fill:before{content:"\ef60"}.ri-money-cny-circle-line:before{content:"\ef61"}.ri-money-dollar-box-fill:before{content:"\ef62"}.ri-money-dollar-box-line:before{content:"\ef63"}.ri-money-dollar-circle-fill:before{content:"\ef64"}.ri-money-dollar-circle-line:before{content:"\ef65"}.ri-money-euro-box-fill:before{content:"\ef66"}.ri-money-euro-box-line:before{content:"\ef67"}.ri-money-euro-circle-fill:before{content:"\ef68"}.ri-money-euro-circle-line:before{content:"\ef69"}.ri-money-pound-box-fill:before{content:"\ef6a"}.ri-money-pound-box-line:before{content:"\ef6b"}.ri-money-pound-circle-fill:before{content:"\ef6c"}.ri-money-pound-circle-line:before{content:"\ef6d"}.ri-moon-clear-fill:before{content:"\ef6e"}.ri-moon-clear-line:before{content:"\ef6f"}.ri-moon-cloudy-fill:before{content:"\ef70"}.ri-moon-cloudy-line:before{content:"\ef71"}.ri-moon-fill:before{content:"\ef72"}.ri-moon-foggy-fill:before{content:"\ef73"}.ri-moon-foggy-line:before{content:"\ef74"}.ri-moon-line:before{content:"\ef75"}.ri-more-2-fill:before{content:"\ef76"}.ri-more-2-line:before{content:"\ef77"}.ri-more-fill:before{content:"\ef78"}.ri-more-line:before{content:"\ef79"}.ri-motorbike-fill:before{content:"\ef7a"}.ri-motorbike-line:before{content:"\ef7b"}.ri-mouse-fill:before{content:"\ef7c"}.ri-mouse-line:before{content:"\ef7d"}.ri-movie-2-fill:before{content:"\ef7e"}.ri-movie-2-line:before{content:"\ef7f"}.ri-movie-fill:before{content:"\ef80"}.ri-movie-line:before{content:"\ef81"}.ri-music-2-fill:before{content:"\ef82"}.ri-music-2-line:before{content:"\ef83"}.ri-music-fill:before{content:"\ef84"}.ri-music-line:before{content:"\ef85"}.ri-mv-fill:before{content:"\ef86"}.ri-mv-line:before{content:"\ef87"}.ri-navigation-fill:before{content:"\ef88"}.ri-navigation-line:before{content:"\ef89"}.ri-netease-cloud-music-fill:before{content:"\ef8a"}.ri-netease-cloud-music-line:before{content:"\ef8b"}.ri-netflix-fill:before{content:"\ef8c"}.ri-netflix-line:before{content:"\ef8d"}.ri-newspaper-fill:before{content:"\ef8e"}.ri-newspaper-line:before{content:"\ef8f"}.ri-node-tree:before{content:"\ef90"}.ri-notification-2-fill:before{content:"\ef91"}.ri-notification-2-line:before{content:"\ef92"}.ri-notification-3-fill:before{content:"\ef93"}.ri-notification-3-line:before{content:"\ef94"}.ri-notification-4-fill:before{content:"\ef95"}.ri-notification-4-line:before{content:"\ef96"}.ri-notification-badge-fill:before{content:"\ef97"}.ri-notification-badge-line:before{content:"\ef98"}.ri-notification-fill:before{content:"\ef99"}.ri-notification-line:before{content:"\ef9a"}.ri-notification-off-fill:before{content:"\ef9b"}.ri-notification-off-line:before{content:"\ef9c"}.ri-npmjs-fill:before{content:"\ef9d"}.ri-npmjs-line:before{content:"\ef9e"}.ri-number-0:before{content:"\ef9f"}.ri-number-1:before{content:"\efa0"}.ri-number-2:before{content:"\efa1"}.ri-number-3:before{content:"\efa2"}.ri-number-4:before{content:"\efa3"}.ri-number-5:before{content:"\efa4"}.ri-number-6:before{content:"\efa5"}.ri-number-7:before{content:"\efa6"}.ri-number-8:before{content:"\efa7"}.ri-number-9:before{content:"\efa8"}.ri-numbers-fill:before{content:"\efa9"}.ri-numbers-line:before{content:"\efaa"}.ri-nurse-fill:before{content:"\efab"}.ri-nurse-line:before{content:"\efac"}.ri-oil-fill:before{content:"\efad"}.ri-oil-line:before{content:"\efae"}.ri-omega:before{content:"\efaf"}.ri-open-arm-fill:before{content:"\efb0"}.ri-open-arm-line:before{content:"\efb1"}.ri-open-source-fill:before{content:"\efb2"}.ri-open-source-line:before{content:"\efb3"}.ri-opera-fill:before{content:"\efb4"}.ri-opera-line:before{content:"\efb5"}.ri-order-play-fill:before{content:"\efb6"}.ri-order-play-line:before{content:"\efb7"}.ri-organization-chart:before{content:"\efb8"}.ri-outlet-2-fill:before{content:"\efb9"}.ri-outlet-2-line:before{content:"\efba"}.ri-outlet-fill:before{content:"\efbb"}.ri-outlet-line:before{content:"\efbc"}.ri-page-separator:before{content:"\efbd"}.ri-pages-fill:before{content:"\efbe"}.ri-pages-line:before{content:"\efbf"}.ri-paint-brush-fill:before{content:"\efc0"}.ri-paint-brush-line:before{content:"\efc1"}.ri-paint-fill:before{content:"\efc2"}.ri-paint-line:before{content:"\efc3"}.ri-palette-fill:before{content:"\efc4"}.ri-palette-line:before{content:"\efc5"}.ri-pantone-fill:before{content:"\efc6"}.ri-pantone-line:before{content:"\efc7"}.ri-paragraph:before{content:"\efc8"}.ri-parent-fill:before{content:"\efc9"}.ri-parent-line:before{content:"\efca"}.ri-parentheses-fill:before{content:"\efcb"}.ri-parentheses-line:before{content:"\efcc"}.ri-parking-box-fill:before{content:"\efcd"}.ri-parking-box-line:before{content:"\efce"}.ri-parking-fill:before{content:"\efcf"}.ri-parking-line:before{content:"\efd0"}.ri-passport-fill:before{content:"\efd1"}.ri-passport-line:before{content:"\efd2"}.ri-patreon-fill:before{content:"\efd3"}.ri-patreon-line:before{content:"\efd4"}.ri-pause-circle-fill:before{content:"\efd5"}.ri-pause-circle-line:before{content:"\efd6"}.ri-pause-fill:before{content:"\efd7"}.ri-pause-line:before{content:"\efd8"}.ri-pause-mini-fill:before{content:"\efd9"}.ri-pause-mini-line:before{content:"\efda"}.ri-paypal-fill:before{content:"\efdb"}.ri-paypal-line:before{content:"\efdc"}.ri-pen-nib-fill:before{content:"\efdd"}.ri-pen-nib-line:before{content:"\efde"}.ri-pencil-fill:before{content:"\efdf"}.ri-pencil-line:before{content:"\efe0"}.ri-pencil-ruler-2-fill:before{content:"\efe1"}.ri-pencil-ruler-2-line:before{content:"\efe2"}.ri-pencil-ruler-fill:before{content:"\efe3"}.ri-pencil-ruler-line:before{content:"\efe4"}.ri-percent-fill:before{content:"\efe5"}.ri-percent-line:before{content:"\efe6"}.ri-phone-camera-fill:before{content:"\efe7"}.ri-phone-camera-line:before{content:"\efe8"}.ri-phone-fill:before{content:"\efe9"}.ri-phone-find-fill:before{content:"\efea"}.ri-phone-find-line:before{content:"\efeb"}.ri-phone-line:before{content:"\efec"}.ri-phone-lock-fill:before{content:"\efed"}.ri-phone-lock-line:before{content:"\efee"}.ri-picture-in-picture-2-fill:before{content:"\efef"}.ri-picture-in-picture-2-line:before{content:"\eff0"}.ri-picture-in-picture-exit-fill:before{content:"\eff1"}.ri-picture-in-picture-exit-line:before{content:"\eff2"}.ri-picture-in-picture-fill:before{content:"\eff3"}.ri-picture-in-picture-line:before{content:"\eff4"}.ri-pie-chart-2-fill:before{content:"\eff5"}.ri-pie-chart-2-line:before{content:"\eff6"}.ri-pie-chart-box-fill:before{content:"\eff7"}.ri-pie-chart-box-line:before{content:"\eff8"}.ri-pie-chart-fill:before{content:"\eff9"}.ri-pie-chart-line:before{content:"\effa"}.ri-pin-distance-fill:before{content:"\effb"}.ri-pin-distance-line:before{content:"\effc"}.ri-ping-pong-fill:before{content:"\effd"}.ri-ping-pong-line:before{content:"\effe"}.ri-pinterest-fill:before{content:"\efff"}.ri-pinterest-line:before{content:"\f000"}.ri-pinyin-input:before{content:"\f001"}.ri-pixelfed-fill:before{content:"\f002"}.ri-pixelfed-line:before{content:"\f003"}.ri-plane-fill:before{content:"\f004"}.ri-plane-line:before{content:"\f005"}.ri-plant-fill:before{content:"\f006"}.ri-plant-line:before{content:"\f007"}.ri-play-circle-fill:before{content:"\f008"}.ri-play-circle-line:before{content:"\f009"}.ri-play-fill:before{content:"\f00a"}.ri-play-line:before{content:"\f00b"}.ri-play-list-2-fill:before{content:"\f00c"}.ri-play-list-2-line:before{content:"\f00d"}.ri-play-list-add-fill:before{content:"\f00e"}.ri-play-list-add-line:before{content:"\f00f"}.ri-play-list-fill:before{content:"\f010"}.ri-play-list-line:before{content:"\f011"}.ri-play-mini-fill:before{content:"\f012"}.ri-play-mini-line:before{content:"\f013"}.ri-playstation-fill:before{content:"\f014"}.ri-playstation-line:before{content:"\f015"}.ri-plug-2-fill:before{content:"\f016"}.ri-plug-2-line:before{content:"\f017"}.ri-plug-fill:before{content:"\f018"}.ri-plug-line:before{content:"\f019"}.ri-polaroid-2-fill:before{content:"\f01a"}.ri-polaroid-2-line:before{content:"\f01b"}.ri-polaroid-fill:before{content:"\f01c"}.ri-polaroid-line:before{content:"\f01d"}.ri-police-car-fill:before{content:"\f01e"}.ri-police-car-line:before{content:"\f01f"}.ri-price-tag-2-fill:before{content:"\f020"}.ri-price-tag-2-line:before{content:"\f021"}.ri-price-tag-3-fill:before{content:"\f022"}.ri-price-tag-3-line:before{content:"\f023"}.ri-price-tag-fill:before{content:"\f024"}.ri-price-tag-line:before{content:"\f025"}.ri-printer-cloud-fill:before{content:"\f026"}.ri-printer-cloud-line:before{content:"\f027"}.ri-printer-fill:before{content:"\f028"}.ri-printer-line:before{content:"\f029"}.ri-product-hunt-fill:before{content:"\f02a"}.ri-product-hunt-line:before{content:"\f02b"}.ri-profile-fill:before{content:"\f02c"}.ri-profile-line:before{content:"\f02d"}.ri-projector-2-fill:before{content:"\f02e"}.ri-projector-2-line:before{content:"\f02f"}.ri-projector-fill:before{content:"\f030"}.ri-projector-line:before{content:"\f031"}.ri-psychotherapy-fill:before{content:"\f032"}.ri-psychotherapy-line:before{content:"\f033"}.ri-pulse-fill:before{content:"\f034"}.ri-pulse-line:before{content:"\f035"}.ri-pushpin-2-fill:before{content:"\f036"}.ri-pushpin-2-line:before{content:"\f037"}.ri-pushpin-fill:before{content:"\f038"}.ri-pushpin-line:before{content:"\f039"}.ri-qq-fill:before{content:"\f03a"}.ri-qq-line:before{content:"\f03b"}.ri-qr-code-fill:before{content:"\f03c"}.ri-qr-code-line:before{content:"\f03d"}.ri-qr-scan-2-fill:before{content:"\f03e"}.ri-qr-scan-2-line:before{content:"\f03f"}.ri-qr-scan-fill:before{content:"\f040"}.ri-qr-scan-line:before{content:"\f041"}.ri-question-answer-fill:before{content:"\f042"}.ri-question-answer-line:before{content:"\f043"}.ri-question-fill:before{content:"\f044"}.ri-question-line:before{content:"\f045"}.ri-question-mark:before{content:"\f046"}.ri-questionnaire-fill:before{content:"\f047"}.ri-questionnaire-line:before{content:"\f048"}.ri-quill-pen-fill:before{content:"\f049"}.ri-quill-pen-line:before{content:"\f04a"}.ri-radar-fill:before{content:"\f04b"}.ri-radar-line:before{content:"\f04c"}.ri-radio-2-fill:before{content:"\f04d"}.ri-radio-2-line:before{content:"\f04e"}.ri-radio-button-fill:before{content:"\f04f"}.ri-radio-button-line:before{content:"\f050"}.ri-radio-fill:before{content:"\f051"}.ri-radio-line:before{content:"\f052"}.ri-rainbow-fill:before{content:"\f053"}.ri-rainbow-line:before{content:"\f054"}.ri-rainy-fill:before{content:"\f055"}.ri-rainy-line:before{content:"\f056"}.ri-reactjs-fill:before{content:"\f057"}.ri-reactjs-line:before{content:"\f058"}.ri-record-circle-fill:before{content:"\f059"}.ri-record-circle-line:before{content:"\f05a"}.ri-record-mail-fill:before{content:"\f05b"}.ri-record-mail-line:before{content:"\f05c"}.ri-recycle-fill:before{content:"\f05d"}.ri-recycle-line:before{content:"\f05e"}.ri-red-packet-fill:before{content:"\f05f"}.ri-red-packet-line:before{content:"\f060"}.ri-reddit-fill:before{content:"\f061"}.ri-reddit-line:before{content:"\f062"}.ri-refresh-fill:before{content:"\f063"}.ri-refresh-line:before{content:"\f064"}.ri-refund-2-fill:before{content:"\f065"}.ri-refund-2-line:before{content:"\f066"}.ri-refund-fill:before{content:"\f067"}.ri-refund-line:before{content:"\f068"}.ri-registered-fill:before{content:"\f069"}.ri-registered-line:before{content:"\f06a"}.ri-remixicon-fill:before{content:"\f06b"}.ri-remixicon-line:before{content:"\f06c"}.ri-remote-control-2-fill:before{content:"\f06d"}.ri-remote-control-2-line:before{content:"\f06e"}.ri-remote-control-fill:before{content:"\f06f"}.ri-remote-control-line:before{content:"\f070"}.ri-repeat-2-fill:before{content:"\f071"}.ri-repeat-2-line:before{content:"\f072"}.ri-repeat-fill:before{content:"\f073"}.ri-repeat-line:before{content:"\f074"}.ri-repeat-one-fill:before{content:"\f075"}.ri-repeat-one-line:before{content:"\f076"}.ri-reply-all-fill:before{content:"\f077"}.ri-reply-all-line:before{content:"\f078"}.ri-reply-fill:before{content:"\f079"}.ri-reply-line:before{content:"\f07a"}.ri-reserved-fill:before{content:"\f07b"}.ri-reserved-line:before{content:"\f07c"}.ri-rest-time-fill:before{content:"\f07d"}.ri-rest-time-line:before{content:"\f07e"}.ri-restart-fill:before{content:"\f07f"}.ri-restart-line:before{content:"\f080"}.ri-restaurant-2-fill:before{content:"\f081"}.ri-restaurant-2-line:before{content:"\f082"}.ri-restaurant-fill:before{content:"\f083"}.ri-restaurant-line:before{content:"\f084"}.ri-rewind-fill:before{content:"\f085"}.ri-rewind-line:before{content:"\f086"}.ri-rewind-mini-fill:before{content:"\f087"}.ri-rewind-mini-line:before{content:"\f088"}.ri-rhythm-fill:before{content:"\f089"}.ri-rhythm-line:before{content:"\f08a"}.ri-riding-fill:before{content:"\f08b"}.ri-riding-line:before{content:"\f08c"}.ri-road-map-fill:before{content:"\f08d"}.ri-road-map-line:before{content:"\f08e"}.ri-roadster-fill:before{content:"\f08f"}.ri-roadster-line:before{content:"\f090"}.ri-robot-fill:before{content:"\f091"}.ri-robot-line:before{content:"\f092"}.ri-rocket-2-fill:before{content:"\f093"}.ri-rocket-2-line:before{content:"\f094"}.ri-rocket-fill:before{content:"\f095"}.ri-rocket-line:before{content:"\f096"}.ri-rotate-lock-fill:before{content:"\f097"}.ri-rotate-lock-line:before{content:"\f098"}.ri-rounded-corner:before{content:"\f099"}.ri-route-fill:before{content:"\f09a"}.ri-route-line:before{content:"\f09b"}.ri-router-fill:before{content:"\f09c"}.ri-router-line:before{content:"\f09d"}.ri-rss-fill:before{content:"\f09e"}.ri-rss-line:before{content:"\f09f"}.ri-ruler-2-fill:before{content:"\f0a0"}.ri-ruler-2-line:before{content:"\f0a1"}.ri-ruler-fill:before{content:"\f0a2"}.ri-ruler-line:before{content:"\f0a3"}.ri-run-fill:before{content:"\f0a4"}.ri-run-line:before{content:"\f0a5"}.ri-safari-fill:before{content:"\f0a6"}.ri-safari-line:before{content:"\f0a7"}.ri-safe-2-fill:before{content:"\f0a8"}.ri-safe-2-line:before{content:"\f0a9"}.ri-safe-fill:before{content:"\f0aa"}.ri-safe-line:before{content:"\f0ab"}.ri-sailboat-fill:before{content:"\f0ac"}.ri-sailboat-line:before{content:"\f0ad"}.ri-save-2-fill:before{content:"\f0ae"}.ri-save-2-line:before{content:"\f0af"}.ri-save-3-fill:before{content:"\f0b0"}.ri-save-3-line:before{content:"\f0b1"}.ri-save-fill:before{content:"\f0b2"}.ri-save-line:before{content:"\f0b3"}.ri-scales-2-fill:before{content:"\f0b4"}.ri-scales-2-line:before{content:"\f0b5"}.ri-scales-3-fill:before{content:"\f0b6"}.ri-scales-3-line:before{content:"\f0b7"}.ri-scales-fill:before{content:"\f0b8"}.ri-scales-line:before{content:"\f0b9"}.ri-scan-2-fill:before{content:"\f0ba"}.ri-scan-2-line:before{content:"\f0bb"}.ri-scan-fill:before{content:"\f0bc"}.ri-scan-line:before{content:"\f0bd"}.ri-scissors-2-fill:before{content:"\f0be"}.ri-scissors-2-line:before{content:"\f0bf"}.ri-scissors-cut-fill:before{content:"\f0c0"}.ri-scissors-cut-line:before{content:"\f0c1"}.ri-scissors-fill:before{content:"\f0c2"}.ri-scissors-line:before{content:"\f0c3"}.ri-screenshot-2-fill:before{content:"\f0c4"}.ri-screenshot-2-line:before{content:"\f0c5"}.ri-screenshot-fill:before{content:"\f0c6"}.ri-screenshot-line:before{content:"\f0c7"}.ri-sd-card-fill:before{content:"\f0c8"}.ri-sd-card-line:before{content:"\f0c9"}.ri-sd-card-mini-fill:before{content:"\f0ca"}.ri-sd-card-mini-line:before{content:"\f0cb"}.ri-search-2-fill:before{content:"\f0cc"}.ri-search-2-line:before{content:"\f0cd"}.ri-search-eye-fill:before{content:"\f0ce"}.ri-search-eye-line:before{content:"\f0cf"}.ri-search-fill:before{content:"\f0d0"}.ri-search-line:before{content:"\f0d1"}.ri-secure-payment-fill:before{content:"\f0d2"}.ri-secure-payment-line:before{content:"\f0d3"}.ri-seedling-fill:before{content:"\f0d4"}.ri-seedling-line:before{content:"\f0d5"}.ri-send-backward:before{content:"\f0d6"}.ri-send-plane-2-fill:before{content:"\f0d7"}.ri-send-plane-2-line:before{content:"\f0d8"}.ri-send-plane-fill:before{content:"\f0d9"}.ri-send-plane-line:before{content:"\f0da"}.ri-send-to-back:before{content:"\f0db"}.ri-sensor-fill:before{content:"\f0dc"}.ri-sensor-line:before{content:"\f0dd"}.ri-separator:before{content:"\f0de"}.ri-server-fill:before{content:"\f0df"}.ri-server-line:before{content:"\f0e0"}.ri-service-fill:before{content:"\f0e1"}.ri-service-line:before{content:"\f0e2"}.ri-settings-2-fill:before{content:"\f0e3"}.ri-settings-2-line:before{content:"\f0e4"}.ri-settings-3-fill:before{content:"\f0e5"}.ri-settings-3-line:before{content:"\f0e6"}.ri-settings-4-fill:before{content:"\f0e7"}.ri-settings-4-line:before{content:"\f0e8"}.ri-settings-5-fill:before{content:"\f0e9"}.ri-settings-5-line:before{content:"\f0ea"}.ri-settings-6-fill:before{content:"\f0eb"}.ri-settings-6-line:before{content:"\f0ec"}.ri-settings-fill:before{content:"\f0ed"}.ri-settings-line:before{content:"\f0ee"}.ri-shape-2-fill:before{content:"\f0ef"}.ri-shape-2-line:before{content:"\f0f0"}.ri-shape-fill:before{content:"\f0f1"}.ri-shape-line:before{content:"\f0f2"}.ri-share-box-fill:before{content:"\f0f3"}.ri-share-box-line:before{content:"\f0f4"}.ri-share-circle-fill:before{content:"\f0f5"}.ri-share-circle-line:before{content:"\f0f6"}.ri-share-fill:before{content:"\f0f7"}.ri-share-forward-2-fill:before{content:"\f0f8"}.ri-share-forward-2-line:before{content:"\f0f9"}.ri-share-forward-box-fill:before{content:"\f0fa"}.ri-share-forward-box-line:before{content:"\f0fb"}.ri-share-forward-fill:before{content:"\f0fc"}.ri-share-forward-line:before{content:"\f0fd"}.ri-share-line:before{content:"\f0fe"}.ri-shield-check-fill:before{content:"\f0ff"}.ri-shield-check-line:before{content:"\f100"}.ri-shield-cross-fill:before{content:"\f101"}.ri-shield-cross-line:before{content:"\f102"}.ri-shield-fill:before{content:"\f103"}.ri-shield-flash-fill:before{content:"\f104"}.ri-shield-flash-line:before{content:"\f105"}.ri-shield-keyhole-fill:before{content:"\f106"}.ri-shield-keyhole-line:before{content:"\f107"}.ri-shield-line:before{content:"\f108"}.ri-shield-star-fill:before{content:"\f109"}.ri-shield-star-line:before{content:"\f10a"}.ri-shield-user-fill:before{content:"\f10b"}.ri-shield-user-line:before{content:"\f10c"}.ri-ship-2-fill:before{content:"\f10d"}.ri-ship-2-line:before{content:"\f10e"}.ri-ship-fill:before{content:"\f10f"}.ri-ship-line:before{content:"\f110"}.ri-shirt-fill:before{content:"\f111"}.ri-shirt-line:before{content:"\f112"}.ri-shopping-bag-2-fill:before{content:"\f113"}.ri-shopping-bag-2-line:before{content:"\f114"}.ri-shopping-bag-3-fill:before{content:"\f115"}.ri-shopping-bag-3-line:before{content:"\f116"}.ri-shopping-bag-fill:before{content:"\f117"}.ri-shopping-bag-line:before{content:"\f118"}.ri-shopping-basket-2-fill:before{content:"\f119"}.ri-shopping-basket-2-line:before{content:"\f11a"}.ri-shopping-basket-fill:before{content:"\f11b"}.ri-shopping-basket-line:before{content:"\f11c"}.ri-shopping-cart-2-fill:before{content:"\f11d"}.ri-shopping-cart-2-line:before{content:"\f11e"}.ri-shopping-cart-fill:before{content:"\f11f"}.ri-shopping-cart-line:before{content:"\f120"}.ri-showers-fill:before{content:"\f121"}.ri-showers-line:before{content:"\f122"}.ri-shuffle-fill:before{content:"\f123"}.ri-shuffle-line:before{content:"\f124"}.ri-shut-down-fill:before{content:"\f125"}.ri-shut-down-line:before{content:"\f126"}.ri-side-bar-fill:before{content:"\f127"}.ri-side-bar-line:before{content:"\f128"}.ri-signal-tower-fill:before{content:"\f129"}.ri-signal-tower-line:before{content:"\f12a"}.ri-signal-wifi-1-fill:before{content:"\f12b"}.ri-signal-wifi-1-line:before{content:"\f12c"}.ri-signal-wifi-2-fill:before{content:"\f12d"}.ri-signal-wifi-2-line:before{content:"\f12e"}.ri-signal-wifi-3-fill:before{content:"\f12f"}.ri-signal-wifi-3-line:before{content:"\f130"}.ri-signal-wifi-error-fill:before{content:"\f131"}.ri-signal-wifi-error-line:before{content:"\f132"}.ri-signal-wifi-fill:before{content:"\f133"}.ri-signal-wifi-line:before{content:"\f134"}.ri-signal-wifi-off-fill:before{content:"\f135"}.ri-signal-wifi-off-line:before{content:"\f136"}.ri-sim-card-2-fill:before{content:"\f137"}.ri-sim-card-2-line:before{content:"\f138"}.ri-sim-card-fill:before{content:"\f139"}.ri-sim-card-line:before{content:"\f13a"}.ri-single-quotes-l:before{content:"\f13b"}.ri-single-quotes-r:before{content:"\f13c"}.ri-sip-fill:before{content:"\f13d"}.ri-sip-line:before{content:"\f13e"}.ri-skip-back-fill:before{content:"\f13f"}.ri-skip-back-line:before{content:"\f140"}.ri-skip-back-mini-fill:before{content:"\f141"}.ri-skip-back-mini-line:before{content:"\f142"}.ri-skip-forward-fill:before{content:"\f143"}.ri-skip-forward-line:before{content:"\f144"}.ri-skip-forward-mini-fill:before{content:"\f145"}.ri-skip-forward-mini-line:before{content:"\f146"}.ri-skull-2-fill:before{content:"\f147"}.ri-skull-2-line:before{content:"\f148"}.ri-skull-fill:before{content:"\f149"}.ri-skull-line:before{content:"\f14a"}.ri-skype-fill:before{content:"\f14b"}.ri-skype-line:before{content:"\f14c"}.ri-slack-fill:before{content:"\f14d"}.ri-slack-line:before{content:"\f14e"}.ri-slice-fill:before{content:"\f14f"}.ri-slice-line:before{content:"\f150"}.ri-slideshow-2-fill:before{content:"\f151"}.ri-slideshow-2-line:before{content:"\f152"}.ri-slideshow-3-fill:before{content:"\f153"}.ri-slideshow-3-line:before{content:"\f154"}.ri-slideshow-4-fill:before{content:"\f155"}.ri-slideshow-4-line:before{content:"\f156"}.ri-slideshow-fill:before{content:"\f157"}.ri-slideshow-line:before{content:"\f158"}.ri-smartphone-fill:before{content:"\f159"}.ri-smartphone-line:before{content:"\f15a"}.ri-snapchat-fill:before{content:"\f15b"}.ri-snapchat-line:before{content:"\f15c"}.ri-snowy-fill:before{content:"\f15d"}.ri-snowy-line:before{content:"\f15e"}.ri-sort-asc:before{content:"\f15f"}.ri-sort-desc:before{content:"\f160"}.ri-sound-module-fill:before{content:"\f161"}.ri-sound-module-line:before{content:"\f162"}.ri-soundcloud-fill:before{content:"\f163"}.ri-soundcloud-line:before{content:"\f164"}.ri-space-ship-fill:before{content:"\f165"}.ri-space-ship-line:before{content:"\f166"}.ri-space:before{content:"\f167"}.ri-spam-2-fill:before{content:"\f168"}.ri-spam-2-line:before{content:"\f169"}.ri-spam-3-fill:before{content:"\f16a"}.ri-spam-3-line:before{content:"\f16b"}.ri-spam-fill:before{content:"\f16c"}.ri-spam-line:before{content:"\f16d"}.ri-speaker-2-fill:before{content:"\f16e"}.ri-speaker-2-line:before{content:"\f16f"}.ri-speaker-3-fill:before{content:"\f170"}.ri-speaker-3-line:before{content:"\f171"}.ri-speaker-fill:before{content:"\f172"}.ri-speaker-line:before{content:"\f173"}.ri-spectrum-fill:before{content:"\f174"}.ri-spectrum-line:before{content:"\f175"}.ri-speed-fill:before{content:"\f176"}.ri-speed-line:before{content:"\f177"}.ri-speed-mini-fill:before{content:"\f178"}.ri-speed-mini-line:before{content:"\f179"}.ri-split-cells-horizontal:before{content:"\f17a"}.ri-split-cells-vertical:before{content:"\f17b"}.ri-spotify-fill:before{content:"\f17c"}.ri-spotify-line:before{content:"\f17d"}.ri-spy-fill:before{content:"\f17e"}.ri-spy-line:before{content:"\f17f"}.ri-stack-fill:before{content:"\f180"}.ri-stack-line:before{content:"\f181"}.ri-stack-overflow-fill:before{content:"\f182"}.ri-stack-overflow-line:before{content:"\f183"}.ri-stackshare-fill:before{content:"\f184"}.ri-stackshare-line:before{content:"\f185"}.ri-star-fill:before{content:"\f186"}.ri-star-half-fill:before{content:"\f187"}.ri-star-half-line:before{content:"\f188"}.ri-star-half-s-fill:before{content:"\f189"}.ri-star-half-s-line:before{content:"\f18a"}.ri-star-line:before{content:"\f18b"}.ri-star-s-fill:before{content:"\f18c"}.ri-star-s-line:before{content:"\f18d"}.ri-star-smile-fill:before{content:"\f18e"}.ri-star-smile-line:before{content:"\f18f"}.ri-steam-fill:before{content:"\f190"}.ri-steam-line:before{content:"\f191"}.ri-steering-2-fill:before{content:"\f192"}.ri-steering-2-line:before{content:"\f193"}.ri-steering-fill:before{content:"\f194"}.ri-steering-line:before{content:"\f195"}.ri-stethoscope-fill:before{content:"\f196"}.ri-stethoscope-line:before{content:"\f197"}.ri-sticky-note-2-fill:before{content:"\f198"}.ri-sticky-note-2-line:before{content:"\f199"}.ri-sticky-note-fill:before{content:"\f19a"}.ri-sticky-note-line:before{content:"\f19b"}.ri-stock-fill:before{content:"\f19c"}.ri-stock-line:before{content:"\f19d"}.ri-stop-circle-fill:before{content:"\f19e"}.ri-stop-circle-line:before{content:"\f19f"}.ri-stop-fill:before{content:"\f1a0"}.ri-stop-line:before{content:"\f1a1"}.ri-stop-mini-fill:before{content:"\f1a2"}.ri-stop-mini-line:before{content:"\f1a3"}.ri-store-2-fill:before{content:"\f1a4"}.ri-store-2-line:before{content:"\f1a5"}.ri-store-3-fill:before{content:"\f1a6"}.ri-store-3-line:before{content:"\f1a7"}.ri-store-fill:before{content:"\f1a8"}.ri-store-line:before{content:"\f1a9"}.ri-strikethrough-2:before{content:"\f1aa"}.ri-strikethrough:before{content:"\f1ab"}.ri-subscript-2:before{content:"\f1ac"}.ri-subscript:before{content:"\f1ad"}.ri-subtract-fill:before{content:"\f1ae"}.ri-subtract-line:before{content:"\f1af"}.ri-subway-fill:before{content:"\f1b0"}.ri-subway-line:before{content:"\f1b1"}.ri-subway-wifi-fill:before{content:"\f1b2"}.ri-subway-wifi-line:before{content:"\f1b3"}.ri-suitcase-2-fill:before{content:"\f1b4"}.ri-suitcase-2-line:before{content:"\f1b5"}.ri-suitcase-3-fill:before{content:"\f1b6"}.ri-suitcase-3-line:before{content:"\f1b7"}.ri-suitcase-fill:before{content:"\f1b8"}.ri-suitcase-line:before{content:"\f1b9"}.ri-sun-cloudy-fill:before{content:"\f1ba"}.ri-sun-cloudy-line:before{content:"\f1bb"}.ri-sun-fill:before{content:"\f1bc"}.ri-sun-foggy-fill:before{content:"\f1bd"}.ri-sun-foggy-line:before{content:"\f1be"}.ri-sun-line:before{content:"\f1bf"}.ri-superscript-2:before{content:"\f1c0"}.ri-superscript:before{content:"\f1c1"}.ri-surgical-mask-fill:before{content:"\f1c2"}.ri-surgical-mask-line:before{content:"\f1c3"}.ri-surround-sound-fill:before{content:"\f1c4"}.ri-surround-sound-line:before{content:"\f1c5"}.ri-survey-fill:before{content:"\f1c6"}.ri-survey-line:before{content:"\f1c7"}.ri-swap-box-fill:before{content:"\f1c8"}.ri-swap-box-line:before{content:"\f1c9"}.ri-swap-fill:before{content:"\f1ca"}.ri-swap-line:before{content:"\f1cb"}.ri-switch-fill:before{content:"\f1cc"}.ri-switch-line:before{content:"\f1cd"}.ri-sword-fill:before{content:"\f1ce"}.ri-sword-line:before{content:"\f1cf"}.ri-syringe-fill:before{content:"\f1d0"}.ri-syringe-line:before{content:"\f1d1"}.ri-t-box-fill:before{content:"\f1d2"}.ri-t-box-line:before{content:"\f1d3"}.ri-t-shirt-2-fill:before{content:"\f1d4"}.ri-t-shirt-2-line:before{content:"\f1d5"}.ri-t-shirt-air-fill:before{content:"\f1d6"}.ri-t-shirt-air-line:before{content:"\f1d7"}.ri-t-shirt-fill:before{content:"\f1d8"}.ri-t-shirt-line:before{content:"\f1d9"}.ri-table-2:before{content:"\f1da"}.ri-table-alt-fill:before{content:"\f1db"}.ri-table-alt-line:before{content:"\f1dc"}.ri-table-fill:before{content:"\f1dd"}.ri-table-line:before{content:"\f1de"}.ri-tablet-fill:before{content:"\f1df"}.ri-tablet-line:before{content:"\f1e0"}.ri-takeaway-fill:before{content:"\f1e1"}.ri-takeaway-line:before{content:"\f1e2"}.ri-taobao-fill:before{content:"\f1e3"}.ri-taobao-line:before{content:"\f1e4"}.ri-tape-fill:before{content:"\f1e5"}.ri-tape-line:before{content:"\f1e6"}.ri-task-fill:before{content:"\f1e7"}.ri-task-line:before{content:"\f1e8"}.ri-taxi-fill:before{content:"\f1e9"}.ri-taxi-line:before{content:"\f1ea"}.ri-taxi-wifi-fill:before{content:"\f1eb"}.ri-taxi-wifi-line:before{content:"\f1ec"}.ri-team-fill:before{content:"\f1ed"}.ri-team-line:before{content:"\f1ee"}.ri-telegram-fill:before{content:"\f1ef"}.ri-telegram-line:before{content:"\f1f0"}.ri-temp-cold-fill:before{content:"\f1f1"}.ri-temp-cold-line:before{content:"\f1f2"}.ri-temp-hot-fill:before{content:"\f1f3"}.ri-temp-hot-line:before{content:"\f1f4"}.ri-terminal-box-fill:before{content:"\f1f5"}.ri-terminal-box-line:before{content:"\f1f6"}.ri-terminal-fill:before{content:"\f1f7"}.ri-terminal-line:before{content:"\f1f8"}.ri-terminal-window-fill:before{content:"\f1f9"}.ri-terminal-window-line:before{content:"\f1fa"}.ri-test-tube-fill:before{content:"\f1fb"}.ri-test-tube-line:before{content:"\f1fc"}.ri-text-direction-l:before{content:"\f1fd"}.ri-text-direction-r:before{content:"\f1fe"}.ri-text-spacing:before{content:"\f1ff"}.ri-text-wrap:before{content:"\f200"}.ri-text:before{content:"\f201"}.ri-thermometer-fill:before{content:"\f202"}.ri-thermometer-line:before{content:"\f203"}.ri-thumb-down-fill:before{content:"\f204"}.ri-thumb-down-line:before{content:"\f205"}.ri-thumb-up-fill:before{content:"\f206"}.ri-thumb-up-line:before{content:"\f207"}.ri-thunderstorms-fill:before{content:"\f208"}.ri-thunderstorms-line:before{content:"\f209"}.ri-ticket-2-fill:before{content:"\f20a"}.ri-ticket-2-line:before{content:"\f20b"}.ri-ticket-fill:before{content:"\f20c"}.ri-ticket-line:before{content:"\f20d"}.ri-time-fill:before{content:"\f20e"}.ri-time-line:before{content:"\f20f"}.ri-timer-2-fill:before{content:"\f210"}.ri-timer-2-line:before{content:"\f211"}.ri-timer-fill:before{content:"\f212"}.ri-timer-flash-fill:before{content:"\f213"}.ri-timer-flash-line:before{content:"\f214"}.ri-timer-line:before{content:"\f215"}.ri-todo-fill:before{content:"\f216"}.ri-todo-line:before{content:"\f217"}.ri-toggle-fill:before{content:"\f218"}.ri-toggle-line:before{content:"\f219"}.ri-tools-fill:before{content:"\f21a"}.ri-tools-line:before{content:"\f21b"}.ri-tornado-fill:before{content:"\f21c"}.ri-tornado-line:before{content:"\f21d"}.ri-trademark-fill:before{content:"\f21e"}.ri-trademark-line:before{content:"\f21f"}.ri-traffic-light-fill:before{content:"\f220"}.ri-traffic-light-line:before{content:"\f221"}.ri-train-fill:before{content:"\f222"}.ri-train-line:before{content:"\f223"}.ri-train-wifi-fill:before{content:"\f224"}.ri-train-wifi-line:before{content:"\f225"}.ri-translate-2:before{content:"\f226"}.ri-translate:before{content:"\f227"}.ri-travesti-fill:before{content:"\f228"}.ri-travesti-line:before{content:"\f229"}.ri-treasure-map-fill:before{content:"\f22a"}.ri-treasure-map-line:before{content:"\f22b"}.ri-trello-fill:before{content:"\f22c"}.ri-trello-line:before{content:"\f22d"}.ri-trophy-fill:before{content:"\f22e"}.ri-trophy-line:before{content:"\f22f"}.ri-truck-fill:before{content:"\f230"}.ri-truck-line:before{content:"\f231"}.ri-tumblr-fill:before{content:"\f232"}.ri-tumblr-line:before{content:"\f233"}.ri-tv-2-fill:before{content:"\f234"}.ri-tv-2-line:before{content:"\f235"}.ri-tv-fill:before{content:"\f236"}.ri-tv-line:before{content:"\f237"}.ri-twitch-fill:before{content:"\f238"}.ri-twitch-line:before{content:"\f239"}.ri-twitter-fill:before{content:"\f23a"}.ri-twitter-line:before{content:"\f23b"}.ri-typhoon-fill:before{content:"\f23c"}.ri-typhoon-line:before{content:"\f23d"}.ri-u-disk-fill:before{content:"\f23e"}.ri-u-disk-line:before{content:"\f23f"}.ri-ubuntu-fill:before{content:"\f240"}.ri-ubuntu-line:before{content:"\f241"}.ri-umbrella-fill:before{content:"\f242"}.ri-umbrella-line:before{content:"\f243"}.ri-underline:before{content:"\f244"}.ri-uninstall-fill:before{content:"\f245"}.ri-uninstall-line:before{content:"\f246"}.ri-unsplash-fill:before{content:"\f247"}.ri-unsplash-line:before{content:"\f248"}.ri-upload-2-fill:before{content:"\f249"}.ri-upload-2-line:before{content:"\f24a"}.ri-upload-cloud-2-fill:before{content:"\f24b"}.ri-upload-cloud-2-line:before{content:"\f24c"}.ri-upload-cloud-fill:before{content:"\f24d"}.ri-upload-cloud-line:before{content:"\f24e"}.ri-upload-fill:before{content:"\f24f"}.ri-upload-line:before{content:"\f250"}.ri-usb-fill:before{content:"\f251"}.ri-usb-line:before{content:"\f252"}.ri-user-2-fill:before{content:"\f253"}.ri-user-2-line:before{content:"\f254"}.ri-user-3-fill:before{content:"\f255"}.ri-user-3-line:before{content:"\f256"}.ri-user-4-fill:before{content:"\f257"}.ri-user-4-line:before{content:"\f258"}.ri-user-5-fill:before{content:"\f259"}.ri-user-5-line:before{content:"\f25a"}.ri-user-6-fill:before{content:"\f25b"}.ri-user-6-line:before{content:"\f25c"}.ri-user-add-fill:before{content:"\f25d"}.ri-user-add-line:before{content:"\f25e"}.ri-user-fill:before{content:"\f25f"}.ri-user-follow-fill:before{content:"\f260"}.ri-user-follow-line:before{content:"\f261"}.ri-user-heart-fill:before{content:"\f262"}.ri-user-heart-line:before{content:"\f263"}.ri-user-line:before{content:"\f264"}.ri-user-location-fill:before{content:"\f265"}.ri-user-location-line:before{content:"\f266"}.ri-user-received-2-fill:before{content:"\f267"}.ri-user-received-2-line:before{content:"\f268"}.ri-user-received-fill:before{content:"\f269"}.ri-user-received-line:before{content:"\f26a"}.ri-user-search-fill:before{content:"\f26b"}.ri-user-search-line:before{content:"\f26c"}.ri-user-settings-fill:before{content:"\f26d"}.ri-user-settings-line:before{content:"\f26e"}.ri-user-shared-2-fill:before{content:"\f26f"}.ri-user-shared-2-line:before{content:"\f270"}.ri-user-shared-fill:before{content:"\f271"}.ri-user-shared-line:before{content:"\f272"}.ri-user-smile-fill:before{content:"\f273"}.ri-user-smile-line:before{content:"\f274"}.ri-user-star-fill:before{content:"\f275"}.ri-user-star-line:before{content:"\f276"}.ri-user-unfollow-fill:before{content:"\f277"}.ri-user-unfollow-line:before{content:"\f278"}.ri-user-voice-fill:before{content:"\f279"}.ri-user-voice-line:before{content:"\f27a"}.ri-video-add-fill:before{content:"\f27b"}.ri-video-add-line:before{content:"\f27c"}.ri-video-chat-fill:before{content:"\f27d"}.ri-video-chat-line:before{content:"\f27e"}.ri-video-download-fill:before{content:"\f27f"}.ri-video-download-line:before{content:"\f280"}.ri-video-fill:before{content:"\f281"}.ri-video-line:before{content:"\f282"}.ri-video-upload-fill:before{content:"\f283"}.ri-video-upload-line:before{content:"\f284"}.ri-vidicon-2-fill:before{content:"\f285"}.ri-vidicon-2-line:before{content:"\f286"}.ri-vidicon-fill:before{content:"\f287"}.ri-vidicon-line:before{content:"\f288"}.ri-vimeo-fill:before{content:"\f289"}.ri-vimeo-line:before{content:"\f28a"}.ri-vip-crown-2-fill:before{content:"\f28b"}.ri-vip-crown-2-line:before{content:"\f28c"}.ri-vip-crown-fill:before{content:"\f28d"}.ri-vip-crown-line:before{content:"\f28e"}.ri-vip-diamond-fill:before{content:"\f28f"}.ri-vip-diamond-line:before{content:"\f290"}.ri-vip-fill:before{content:"\f291"}.ri-vip-line:before{content:"\f292"}.ri-virus-fill:before{content:"\f293"}.ri-virus-line:before{content:"\f294"}.ri-visa-fill:before{content:"\f295"}.ri-visa-line:before{content:"\f296"}.ri-voice-recognition-fill:before{content:"\f297"}.ri-voice-recognition-line:before{content:"\f298"}.ri-voiceprint-fill:before{content:"\f299"}.ri-voiceprint-line:before{content:"\f29a"}.ri-volume-down-fill:before{content:"\f29b"}.ri-volume-down-line:before{content:"\f29c"}.ri-volume-mute-fill:before{content:"\f29d"}.ri-volume-mute-line:before{content:"\f29e"}.ri-volume-off-vibrate-fill:before{content:"\f29f"}.ri-volume-off-vibrate-line:before{content:"\f2a0"}.ri-volume-up-fill:before{content:"\f2a1"}.ri-volume-up-line:before{content:"\f2a2"}.ri-volume-vibrate-fill:before{content:"\f2a3"}.ri-volume-vibrate-line:before{content:"\f2a4"}.ri-vuejs-fill:before{content:"\f2a5"}.ri-vuejs-line:before{content:"\f2a6"}.ri-walk-fill:before{content:"\f2a7"}.ri-walk-line:before{content:"\f2a8"}.ri-wallet-2-fill:before{content:"\f2a9"}.ri-wallet-2-line:before{content:"\f2aa"}.ri-wallet-3-fill:before{content:"\f2ab"}.ri-wallet-3-line:before{content:"\f2ac"}.ri-wallet-fill:before{content:"\f2ad"}.ri-wallet-line:before{content:"\f2ae"}.ri-water-flash-fill:before{content:"\f2af"}.ri-water-flash-line:before{content:"\f2b0"}.ri-webcam-fill:before{content:"\f2b1"}.ri-webcam-line:before{content:"\f2b2"}.ri-wechat-2-fill:before{content:"\f2b3"}.ri-wechat-2-line:before{content:"\f2b4"}.ri-wechat-fill:before{content:"\f2b5"}.ri-wechat-line:before{content:"\f2b6"}.ri-wechat-pay-fill:before{content:"\f2b7"}.ri-wechat-pay-line:before{content:"\f2b8"}.ri-weibo-fill:before{content:"\f2b9"}.ri-weibo-line:before{content:"\f2ba"}.ri-whatsapp-fill:before{content:"\f2bb"}.ri-whatsapp-line:before{content:"\f2bc"}.ri-wheelchair-fill:before{content:"\f2bd"}.ri-wheelchair-line:before{content:"\f2be"}.ri-wifi-fill:before{content:"\f2bf"}.ri-wifi-line:before{content:"\f2c0"}.ri-wifi-off-fill:before{content:"\f2c1"}.ri-wifi-off-line:before{content:"\f2c2"}.ri-window-2-fill:before{content:"\f2c3"}.ri-window-2-line:before{content:"\f2c4"}.ri-window-fill:before{content:"\f2c5"}.ri-window-line:before{content:"\f2c6"}.ri-windows-fill:before{content:"\f2c7"}.ri-windows-line:before{content:"\f2c8"}.ri-windy-fill:before{content:"\f2c9"}.ri-windy-line:before{content:"\f2ca"}.ri-wireless-charging-fill:before{content:"\f2cb"}.ri-wireless-charging-line:before{content:"\f2cc"}.ri-women-fill:before{content:"\f2cd"}.ri-women-line:before{content:"\f2ce"}.ri-wubi-input:before{content:"\f2cf"}.ri-xbox-fill:before{content:"\f2d0"}.ri-xbox-line:before{content:"\f2d1"}.ri-xing-fill:before{content:"\f2d2"}.ri-xing-line:before{content:"\f2d3"}.ri-youtube-fill:before{content:"\f2d4"}.ri-youtube-line:before{content:"\f2d5"}.ri-zcool-fill:before{content:"\f2d6"}.ri-zcool-line:before{content:"\f2d7"}.ri-zhihu-fill:before{content:"\f2d8"}.ri-zhihu-line:before{content:"\f2d9"}.ri-zoom-in-fill:before{content:"\f2da"}.ri-zoom-in-line:before{content:"\f2db"}.ri-zoom-out-fill:before{content:"\f2dc"}.ri-zoom-out-line:before{content:"\f2dd"}.ri-zzz-fill:before{content:"\f2de"}.ri-zzz-line:before{content:"\f2df"}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes expand{0%{transform:rotateY(90deg)}to{opacity:1;transform:rotateY(0)}}@keyframes slideIn{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes shine{to{background-position-x:-200%}}@keyframes loaderShow{0%{opacity:0;transform:scale(0)}to{opacity:1;transform:scale(1)}}@keyframes entranceLeft{0%{opacity:0;transform:translate(-5px)}to{opacity:1;transform:translate(0)}}@keyframes entranceRight{0%{opacity:0;transform:translate(5px)}to{opacity:1;transform:translate(0)}}@keyframes entranceTop{0%{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:translateY(0)}}@keyframes entranceBottom{0%{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}@media screen and (min-width: 550px){::-webkit-scrollbar{width:8px;height:8px;border-radius:var(--baseRadius)}::-webkit-scrollbar-track{background:transparent;border-radius:var(--baseRadius)}::-webkit-scrollbar-thumb{background-color:var(--baseAlt2Color);border-radius:15px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-thumb:hover,::-webkit-scrollbar-thumb:active{background-color:var(--baseAlt3Color)}html{scrollbar-color:var(--baseAlt2Color) transparent;scrollbar-width:thin;scroll-behavior:smooth}html *{scrollbar-width:inherit}}:focus-visible{outline-color:var(--primaryColor);outline-style:solid}html,body{line-height:var(--baseLineHeight);font-family:var(--baseFontFamily);font-size:var(--baseFontSize);color:var(--txtPrimaryColor);background:var(--bodyColor)}#app{overflow:auto;display:block;width:100%;height:100vh}.flatpickr-inline-container,.accordion .accordion-content,.accordion,.tabs,.tabs-content,.form-field-file .files-list,.select .txt-missing,.form-field .form-field-block,.list,.skeleton-loader,.clearfix,.content,.form-field .help-block,.overlay-panel .panel-content,.panel,.block,.code-block,blockquote,p{display:block;width:100%}h1,h2,.breadcrumbs .breadcrumb-item,h3,h4,h5,h6{margin:0;font-weight:400}h1{font-size:22px;line-height:28px}h2,.breadcrumbs .breadcrumb-item{font-size:20px;line-height:26px}h3{font-size:19px;line-height:24px}h4{font-size:18px;line-height:24px}h5{font-size:17px;line-height:24px}h6{font-size:16px;line-height:22px}em{font-style:italic}ins{color:var(--txtPrimaryColor);background:var(--successAltColor);text-decoration:none}del{color:var(--txtPrimaryColor);background:var(--dangerAltColor);text-decoration:none}strong{font-weight:600}small{font-size:var(--smFontSize);line-height:var(--smLineHeight)}sub,sup{position:relative;font-size:.75em;line-height:1}sup{vertical-align:top}sub{vertical-align:bottom}p{margin:5px 0}blockquote{position:relative;padding-left:var(--smSpacing);font-style:italic;color:var(--txtHintColor)}blockquote:before{content:"";position:absolute;top:0;left:0;width:2px;height:100%;background:var(--baseColor)}code{display:inline-block;font-family:var(--monospaceFontFamily);font-size:15px;line-height:1.379rem;padding:0 4px;white-space:nowrap;color:var(--txtPrimaryColor);background:var(--baseAlt2Color);border-radius:var(--baseRadius)}.code-block{overflow:auto;padding:var(--xsSpacing);white-space:pre-wrap;background:var(--baseAlt1Color)}ol,ul{margin:10px 0;list-style:decimal;padding-left:var(--baseSpacing)}ol li,ul li{margin-top:5px;margin-bottom:5px}ul{list-style:disc}img{max-width:100%;vertical-align:top}hr{display:block;border:0;height:1px;width:100%;background:var(--baseAlt1Color);margin:var(--baseSpacing) 0}a{color:inherit}a:hover{text-decoration:none}a i,a .txt{display:inline-block;vertical-align:top}.txt-mono{font-family:var(--monospaceFontFamily)}.txt-nowrap{white-space:nowrap}.txt-ellipsis{display:inline-block;vertical-align:top;flex-shrink:0;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.txt-base{font-size:var(--baseFontSize)!important}.txt-xs{font-size:var(--xsFontSize)!important;line-height:var(--smLineHeight)}.txt-sm{font-size:var(--smFontSize)!important;line-height:var(--smLineHeight)}.txt-lg{font-size:var(--lgFontSize)!important}.txt-xl{font-size:var(--xlFontSize)!important}.txt-bold{font-weight:600!important}.txt-strikethrough{text-decoration:line-through!important}.txt-break{white-space:pre-wrap!important}.txt-center{text-align:center!important}.txt-justify{text-align:justify!important}.txt-left{text-align:left!important}.txt-right{text-align:right!important}.txt-main{color:var(--txtPrimaryColor)!important}.txt-hint{color:var(--txtHintColor)!important}.txt-disabled{color:var(--txtDisabledColor)!important}.link-hint{user-select:none;cursor:pointer;color:var(--txtHintColor)!important;text-decoration:none;transition:color var(--baseAnimationSpeed)}.link-hint:hover,.link-hint:focus-visible,.link-hint:active{color:var(--txtPrimaryColor)!important}.link-fade{opacity:1;user-select:none;cursor:pointer;text-decoration:none;color:var(--txtPrimaryColor);transition:opacity var(--baseAnimationSpeed)}.link-fade:focus-visible,.link-fade:hover,.link-fade:active{opacity:.8}.txt-primary{color:var(--primaryColor)!important}.bg-primary{background:var(--primaryColor)!important}.link-primary{cursor:pointer;color:var(--primaryColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-primary:focus-visible,.link-primary:hover,.link-primary:active{opacity:.8}.txt-info{color:var(--infoColor)!important}.bg-info{background:var(--infoColor)!important}.link-info{cursor:pointer;color:var(--infoColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-info:focus-visible,.link-info:hover,.link-info:active{opacity:.8}.txt-info-alt{color:var(--infoAltColor)!important}.bg-info-alt{background:var(--infoAltColor)!important}.link-info-alt{cursor:pointer;color:var(--infoAltColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-info-alt:focus-visible,.link-info-alt:hover,.link-info-alt:active{opacity:.8}.txt-success{color:var(--successColor)!important}.bg-success{background:var(--successColor)!important}.link-success{cursor:pointer;color:var(--successColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-success:focus-visible,.link-success:hover,.link-success:active{opacity:.8}.txt-success-alt{color:var(--successAltColor)!important}.bg-success-alt{background:var(--successAltColor)!important}.link-success-alt{cursor:pointer;color:var(--successAltColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-success-alt:focus-visible,.link-success-alt:hover,.link-success-alt:active{opacity:.8}.txt-danger{color:var(--dangerColor)!important}.bg-danger{background:var(--dangerColor)!important}.link-danger{cursor:pointer;color:var(--dangerColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-danger:focus-visible,.link-danger:hover,.link-danger:active{opacity:.8}.txt-danger-alt{color:var(--dangerAltColor)!important}.bg-danger-alt{background:var(--dangerAltColor)!important}.link-danger-alt{cursor:pointer;color:var(--dangerAltColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-danger-alt:focus-visible,.link-danger-alt:hover,.link-danger-alt:active{opacity:.8}.txt-warning{color:var(--warningColor)!important}.bg-warning{background:var(--warningColor)!important}.link-warning{cursor:pointer;color:var(--warningColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-warning:focus-visible,.link-warning:hover,.link-warning:active{opacity:.8}.txt-warning-alt{color:var(--warningAltColor)!important}.bg-warning-alt{background:var(--warningAltColor)!important}.link-warning-alt{cursor:pointer;color:var(--warningAltColor)!important;text-decoration:none;user-select:none;transition:opacity var(--baseAnimationSpeed)}.link-warning-alt:focus-visible,.link-warning-alt:hover,.link-warning-alt:active{opacity:.8}.fade{opacity:.6}a.fade,.btn.fade,[tabindex].fade,[class*=link-].fade,.handle.fade{transition:all var(--baseAnimationSpeed)}a.fade:hover,.btn.fade:hover,[tabindex].fade:hover,[class*=link-].fade:hover,.handle.fade:hover{opacity:1}.noborder{border:0px!important}.hidden{display:none!important}.hidden-empty:empty{display:none!important}.content>:first-child,.form-field .help-block>:first-child,.overlay-panel .panel-content>:first-child,.panel>:first-child{margin-top:0}.content>:last-child,.form-field .help-block>:last-child,.overlay-panel .panel-content>:last-child,.panel>:last-child{margin-bottom:0}.panel{background:var(--baseColor);border-radius:var(--lgRadius);padding:calc(var(--baseSpacing) - 5px) var(--baseSpacing);box-shadow:0 2px 5px 0 var(--shadowColor)}.clearfix{clear:both}.clearfix:after{content:"";display:table;clear:both}.flex{position:relative;display:flex;align-items:center;width:100%;gap:var(--smSpacing)}.flex-fill{flex:1 1 auto!important}.flex-wrap{flex-wrap:wrap!important}.flex-nowrap{flex-wrap:nowrap!important}.inline-flex{position:relative;display:inline-flex;align-items:center;flex-wrap:wrap;min-width:0;gap:10px}.flex-order-0{order:0}.flex-order-1{order:1}.flex-order-2{order:2}.flex-order-3{order:3}.flex-order-4{order:4}.flex-order-5{order:5}.flex-order-6{order:6}.flex-gap-base{gap:var(--baseSpacing)!important}.flex-gap-xs{gap:var(--xsSpacing)!important}.flex-gap-sm{gap:var(--smSpacing)!important}.flex-gap-lg{gap:var(--lgSpacing)!important}.flex-gap-xl{gap:var(--xlSpacing)!important}.flex-gap-0{gap:0px!important}.flex-gap-5{gap:5px!important}.flex-gap-10{gap:10px!important}.flex-gap-15{gap:15px!important}.flex-gap-20{gap:20px!important}.flex-gap-25{gap:25px!important}.flex-gap-30{gap:30px!important}.flex-gap-35{gap:35px!important}.flex-gap-40{gap:40px!important}.flex-gap-45{gap:45px!important}.flex-gap-50{gap:50px!important}.flex-gap-55{gap:55px!important}.flex-gap-60{gap:60px!important}.m-base{margin:var(--baseSpacing)!important}.p-base{padding:var(--baseSpacing)!important}.m-xs{margin:var(--xsSpacing)!important}.p-xs{padding:var(--xsSpacing)!important}.m-sm{margin:var(--smSpacing)!important}.p-sm{padding:var(--smSpacing)!important}.m-lg{margin:var(--lgSpacing)!important}.p-lg{padding:var(--lgSpacing)!important}.m-xl{margin:var(--xlSpacing)!important}.p-xl{padding:var(--xlSpacing)!important}.m-t-auto{margin-top:auto!important}.p-t-auto{padding-top:auto!important}.m-t-base{margin-top:var(--baseSpacing)!important}.p-t-base{padding-top:var(--baseSpacing)!important}.m-t-xs{margin-top:var(--xsSpacing)!important}.p-t-xs{padding-top:var(--xsSpacing)!important}.m-t-sm{margin-top:var(--smSpacing)!important}.p-t-sm{padding-top:var(--smSpacing)!important}.m-t-lg{margin-top:var(--lgSpacing)!important}.p-t-lg{padding-top:var(--lgSpacing)!important}.m-t-xl{margin-top:var(--xlSpacing)!important}.p-t-xl{padding-top:var(--xlSpacing)!important}.m-r-auto{margin-right:auto!important}.p-r-auto{padding-right:auto!important}.m-r-base{margin-right:var(--baseSpacing)!important}.p-r-base{padding-right:var(--baseSpacing)!important}.m-r-xs{margin-right:var(--xsSpacing)!important}.p-r-xs{padding-right:var(--xsSpacing)!important}.m-r-sm{margin-right:var(--smSpacing)!important}.p-r-sm{padding-right:var(--smSpacing)!important}.m-r-lg{margin-right:var(--lgSpacing)!important}.p-r-lg{padding-right:var(--lgSpacing)!important}.m-r-xl{margin-right:var(--xlSpacing)!important}.p-r-xl{padding-right:var(--xlSpacing)!important}.m-b-auto{margin-bottom:auto!important}.p-b-auto{padding-bottom:auto!important}.m-b-base{margin-bottom:var(--baseSpacing)!important}.p-b-base{padding-bottom:var(--baseSpacing)!important}.m-b-xs{margin-bottom:var(--xsSpacing)!important}.p-b-xs{padding-bottom:var(--xsSpacing)!important}.m-b-sm{margin-bottom:var(--smSpacing)!important}.p-b-sm{padding-bottom:var(--smSpacing)!important}.m-b-lg{margin-bottom:var(--lgSpacing)!important}.p-b-lg{padding-bottom:var(--lgSpacing)!important}.m-b-xl{margin-bottom:var(--xlSpacing)!important}.p-b-xl{padding-bottom:var(--xlSpacing)!important}.m-l-auto{margin-left:auto!important}.p-l-auto{padding-left:auto!important}.m-l-base{margin-left:var(--baseSpacing)!important}.p-l-base{padding-left:var(--baseSpacing)!important}.m-l-xs{margin-left:var(--xsSpacing)!important}.p-l-xs{padding-left:var(--xsSpacing)!important}.m-l-sm{margin-left:var(--smSpacing)!important}.p-l-sm{padding-left:var(--smSpacing)!important}.m-l-lg{margin-left:var(--lgSpacing)!important}.p-l-lg{padding-left:var(--lgSpacing)!important}.m-l-xl{margin-left:var(--xlSpacing)!important}.p-l-xl{padding-left:var(--xlSpacing)!important}.m-0{margin:0!important}.p-0{padding:0!important}.m-t-0{margin-top:0!important}.p-t-0{padding-top:0!important}.m-r-0{margin-right:0!important}.p-r-0{padding-right:0!important}.m-b-0{margin-bottom:0!important}.p-b-0{padding-bottom:0!important}.m-l-0{margin-left:0!important}.p-l-0{padding-left:0!important}.m-5{margin:5px!important}.p-5{padding:5px!important}.m-t-5{margin-top:5px!important}.p-t-5{padding-top:5px!important}.m-r-5{margin-right:5px!important}.p-r-5{padding-right:5px!important}.m-b-5{margin-bottom:5px!important}.p-b-5{padding-bottom:5px!important}.m-l-5{margin-left:5px!important}.p-l-5{padding-left:5px!important}.m-10{margin:10px!important}.p-10{padding:10px!important}.m-t-10{margin-top:10px!important}.p-t-10{padding-top:10px!important}.m-r-10{margin-right:10px!important}.p-r-10{padding-right:10px!important}.m-b-10{margin-bottom:10px!important}.p-b-10{padding-bottom:10px!important}.m-l-10{margin-left:10px!important}.p-l-10{padding-left:10px!important}.m-15{margin:15px!important}.p-15{padding:15px!important}.m-t-15{margin-top:15px!important}.p-t-15{padding-top:15px!important}.m-r-15{margin-right:15px!important}.p-r-15{padding-right:15px!important}.m-b-15{margin-bottom:15px!important}.p-b-15{padding-bottom:15px!important}.m-l-15{margin-left:15px!important}.p-l-15{padding-left:15px!important}.m-20{margin:20px!important}.p-20{padding:20px!important}.m-t-20{margin-top:20px!important}.p-t-20{padding-top:20px!important}.m-r-20{margin-right:20px!important}.p-r-20{padding-right:20px!important}.m-b-20{margin-bottom:20px!important}.p-b-20{padding-bottom:20px!important}.m-l-20{margin-left:20px!important}.p-l-20{padding-left:20px!important}.m-25{margin:25px!important}.p-25{padding:25px!important}.m-t-25{margin-top:25px!important}.p-t-25{padding-top:25px!important}.m-r-25{margin-right:25px!important}.p-r-25{padding-right:25px!important}.m-b-25{margin-bottom:25px!important}.p-b-25{padding-bottom:25px!important}.m-l-25{margin-left:25px!important}.p-l-25{padding-left:25px!important}.m-30{margin:30px!important}.p-30{padding:30px!important}.m-t-30{margin-top:30px!important}.p-t-30{padding-top:30px!important}.m-r-30{margin-right:30px!important}.p-r-30{padding-right:30px!important}.m-b-30{margin-bottom:30px!important}.p-b-30{padding-bottom:30px!important}.m-l-30{margin-left:30px!important}.p-l-30{padding-left:30px!important}.m-35{margin:35px!important}.p-35{padding:35px!important}.m-t-35{margin-top:35px!important}.p-t-35{padding-top:35px!important}.m-r-35{margin-right:35px!important}.p-r-35{padding-right:35px!important}.m-b-35{margin-bottom:35px!important}.p-b-35{padding-bottom:35px!important}.m-l-35{margin-left:35px!important}.p-l-35{padding-left:35px!important}.m-40{margin:40px!important}.p-40{padding:40px!important}.m-t-40{margin-top:40px!important}.p-t-40{padding-top:40px!important}.m-r-40{margin-right:40px!important}.p-r-40{padding-right:40px!important}.m-b-40{margin-bottom:40px!important}.p-b-40{padding-bottom:40px!important}.m-l-40{margin-left:40px!important}.p-l-40{padding-left:40px!important}.m-45{margin:45px!important}.p-45{padding:45px!important}.m-t-45{margin-top:45px!important}.p-t-45{padding-top:45px!important}.m-r-45{margin-right:45px!important}.p-r-45{padding-right:45px!important}.m-b-45{margin-bottom:45px!important}.p-b-45{padding-bottom:45px!important}.m-l-45{margin-left:45px!important}.p-l-45{padding-left:45px!important}.m-50{margin:50px!important}.p-50{padding:50px!important}.m-t-50{margin-top:50px!important}.p-t-50{padding-top:50px!important}.m-r-50{margin-right:50px!important}.p-r-50{padding-right:50px!important}.m-b-50{margin-bottom:50px!important}.p-b-50{padding-bottom:50px!important}.m-l-50{margin-left:50px!important}.p-l-50{padding-left:50px!important}.m-55{margin:55px!important}.p-55{padding:55px!important}.m-t-55{margin-top:55px!important}.p-t-55{padding-top:55px!important}.m-r-55{margin-right:55px!important}.p-r-55{padding-right:55px!important}.m-b-55{margin-bottom:55px!important}.p-b-55{padding-bottom:55px!important}.m-l-55{margin-left:55px!important}.p-l-55{padding-left:55px!important}.m-60{margin:60px!important}.p-60{padding:60px!important}.m-t-60{margin-top:60px!important}.p-t-60{padding-top:60px!important}.m-r-60{margin-right:60px!important}.p-r-60{padding-right:60px!important}.m-b-60{margin-bottom:60px!important}.p-b-60{padding-bottom:60px!important}.m-l-60{margin-left:60px!important}.p-l-60{padding-left:60px!important}.no-min-width{min-width:0!important}.wrapper{position:relative;width:var(--wrapperWidth);margin:0 auto;max-width:100%}.wrapper.wrapper-sm{width:var(--smWrapperWidth)}.wrapper.wrapper-lg{width:var(--lgWrapperWidth)}.label{display:inline-flex;align-items:center;justify-content:center;gap:5px;line-height:1;padding:3px 8px;min-height:23px;text-align:center;font-size:var(--smFontSize);border-radius:30px;background:var(--baseAlt2Color);color:var(--txtPrimaryColor);white-space:nowrap}.label.label-sm{font-size:var(--xsFontSize);padding:3px 5px;min-height:18px;line-height:1}.label.label-primary{color:var(--baseColor);background:var(--primaryColor)}.label.label-info{background:var(--infoAltColor)}.label.label-success{background:var(--successAltColor)}.label.label-danger{background:var(--dangerAltColor)}.label.label-warning{background:var(--warningAltColor)}.thumb{--thumbSize: 44px;flex-shrink:0;position:relative;display:inline-flex;align-items:center;justify-content:center;line-height:1;width:var(--thumbSize);height:var(--thumbSize);background:var(--baseAlt2Color);border-radius:var(--baseRadius);color:var(--txtPrimaryColor);font-size:1.2rem;box-shadow:0 2px 5px 0 var(--shadowColor)}.thumb i{font-size:inherit}.thumb img{width:100%;height:100%;border-radius:inherit;overflow:hidden}.thumb.thumb-sm{--thumbSize: 32px;font-size:.85rem}.thumb.thumb-lg{--thumbSize: 60px;font-size:1.3rem}.thumb.thumb-xl{--thumbSize: 80px;font-size:1.5rem}.thumb.thumb-circle{border-radius:50%}.thumb.thumb-active{box-shadow:0 0 0 2px var(--primaryColor)}.section-title{display:flex;align-items:center;width:100%;column-gap:10px;row-gap:5px;margin:0 0 var(--xsSpacing);font-weight:600;font-size:var(--smFontSize);line-height:var(--smLineHeight);color:var(--txtHintColor);text-transform:uppercase}.drag-handle{outline:0;cursor:pointer;display:inline-flex;align-items:left;color:var(--txtDisabledColor);transition:color var(--baseAnimationSpeed)}.drag-handle:before,.drag-handle:after{content:"\ef77";font-family:var(--iconFontFamily);font-size:18px;line-height:1;width:7px;text-align:center}.drag-handle:focus-visible,.drag-handle:hover,.drag-handle:active{color:var(--txtPrimaryColor)}.logo{position:relative;vertical-align:top;display:inline-flex;align-items:center;gap:10px;font-size:23px;text-decoration:none;color:inherit;user-select:none}.logo strong{font-weight:700}.logo .version{position:absolute;right:0;top:-5px;line-height:1;font-size:10px;font-weight:400;padding:2px 4px;border-radius:var(--baseRadius);background:var(--dangerAltColor);color:var(--txtPrimaryColor)}.logo.logo-sm{font-size:20px}.loader{--loaderSize: 32px;position:relative;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;row-gap:10px;margin:0;color:var(--txtDisabledColor);text-align:center;font-weight:400}.loader:before{content:"\eec4";display:inline-block;vertical-align:top;clear:both;width:var(--loaderSize);height:var(--loaderSize);line-height:var(--loaderSize);font-size:var(--loaderSize);font-weight:400;font-family:var(--iconFontFamily);color:inherit;text-align:center;animation:loaderShow var(--baseAnimationSpeed),rotate .9s var(--baseAnimationSpeed) infinite linear}.loader.loader-primary{color:var(--primaryColor)}.loader.loader-info{color:var(--infoColor)}.loader.loader-info-alt{color:var(--infoAltColor)}.loader.loader-success{color:var(--successColor)}.loader.loader-success-alt{color:var(--successAltColor)}.loader.loader-danger{color:var(--dangerColor)}.loader.loader-danger-alt{color:var(--dangerAltColor)}.loader.loader-warning{color:var(--warningColor)}.loader.loader-warning-alt{color:var(--warningAltColor)}.loader.loader-sm{--loaderSize: 24px}.loader.loader-lg{--loaderSize: 42px}.skeleton-loader{position:relative;height:12px;margin:5px 0;border-radius:var(--baseRadius);background:var(--baseAlt1Color);animation:fadeIn .4s}.skeleton-loader:before{content:"";width:100%;height:100%;display:block;border-radius:inherit;background:linear-gradient(90deg,var(--baseAlt1Color) 8%,var(--bodyColor) 18%,var(--baseAlt1Color) 33%);background-size:200% 100%;animation:shine 1s linear infinite}.placeholder-section{display:flex;width:100%;align-items:center;justify-content:center;text-align:center;flex-direction:column;gap:var(--smSpacing);color:var(--txtHintColor)}.placeholder-section .icon{font-size:50px;height:50px;line-height:1;opacity:.3}.placeholder-section .icon i{font-size:inherit;vertical-align:top}.list{position:relative;border:1px solid var(--baseAlt1Color);border-radius:var(--baseRadius)}.list .list-item{word-break:break-word;position:relative;display:flex;align-items:center;width:100%;gap:10px;padding:10px;border-bottom:1px solid var(--baseAlt1Color)}.list .list-item:last-child{border-bottom:0}.entrance-top{animation:entranceTop var(--entranceAnimationSpeed)}.entrance-bottom{animation:entranceBottom var(--entranceAnimationSpeed)}.entrance-left{animation:entranceLeft var(--entranceAnimationSpeed)}.entrance-right{animation:entranceRight var(--entranceAnimationSpeed)}.grid{--gridGap: var(--baseSpacing);position:relative;display:flex;flex-grow:1;flex-wrap:wrap;row-gap:var(--gridGap);margin:0 calc(-.5 * var(--gridGap))}.grid.grid-center{align-items:center}.grid.grid-sm{--gridGap: var(--smSpacing)}.grid .form-field{margin-bottom:0}.grid>*{margin:0 calc(.5 * var(--gridGap))}.col-xxl-1,.col-xxl-2,.col-xxl-3,.col-xxl-4,.col-xxl-5,.col-xxl-6,.col-xxl-7,.col-xxl-8,.col-xxl-9,.col-xxl-10,.col-xxl-11,.col-xxl-12,.col-xl-1,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9,.col-xl-10,.col-xl-11,.col-xl-12,.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12,.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12,.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12,.col-1,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-10,.col-11,.col-12{position:relative;width:100%;min-height:1px}.col-auto{flex:0 0 auto;width:auto}.col-12{width:calc(100% - var(--gridGap))}.col-11{width:calc(91.6666666667% - var(--gridGap))}.col-10{width:calc(83.3333333333% - var(--gridGap))}.col-9{width:calc(75% - var(--gridGap))}.col-8{width:calc(66.6666666667% - var(--gridGap))}.col-7{width:calc(58.3333333333% - var(--gridGap))}.col-6{width:calc(50% - var(--gridGap))}.col-5{width:calc(41.6666666667% - var(--gridGap))}.col-4{width:calc(33.3333333333% - var(--gridGap))}.col-3{width:calc(25% - var(--gridGap))}.col-2{width:calc(16.6666666667% - var(--gridGap))}.col-1{width:calc(8.3333333333% - var(--gridGap))}@media (min-width: 576px){.col-sm-auto{flex:0 0 auto;width:auto}.col-sm-12{width:calc(100% - var(--gridGap))}.col-sm-11{width:calc(91.6666666667% - var(--gridGap))}.col-sm-10{width:calc(83.3333333333% - var(--gridGap))}.col-sm-9{width:calc(75% - var(--gridGap))}.col-sm-8{width:calc(66.6666666667% - var(--gridGap))}.col-sm-7{width:calc(58.3333333333% - var(--gridGap))}.col-sm-6{width:calc(50% - var(--gridGap))}.col-sm-5{width:calc(41.6666666667% - var(--gridGap))}.col-sm-4{width:calc(33.3333333333% - var(--gridGap))}.col-sm-3{width:calc(25% - var(--gridGap))}.col-sm-2{width:calc(16.6666666667% - var(--gridGap))}.col-sm-1{width:calc(8.3333333333% - var(--gridGap))}}@media (min-width: 768px){.col-md-auto{flex:0 0 auto;width:auto}.col-md-12{width:calc(100% - var(--gridGap))}.col-md-11{width:calc(91.6666666667% - var(--gridGap))}.col-md-10{width:calc(83.3333333333% - var(--gridGap))}.col-md-9{width:calc(75% - var(--gridGap))}.col-md-8{width:calc(66.6666666667% - var(--gridGap))}.col-md-7{width:calc(58.3333333333% - var(--gridGap))}.col-md-6{width:calc(50% - var(--gridGap))}.col-md-5{width:calc(41.6666666667% - var(--gridGap))}.col-md-4{width:calc(33.3333333333% - var(--gridGap))}.col-md-3{width:calc(25% - var(--gridGap))}.col-md-2{width:calc(16.6666666667% - var(--gridGap))}.col-md-1{width:calc(8.3333333333% - var(--gridGap))}}@media (min-width: 992px){.col-lg-auto{flex:0 0 auto;width:auto}.col-lg-12{width:calc(100% - var(--gridGap))}.col-lg-11{width:calc(91.6666666667% - var(--gridGap))}.col-lg-10{width:calc(83.3333333333% - var(--gridGap))}.col-lg-9{width:calc(75% - var(--gridGap))}.col-lg-8{width:calc(66.6666666667% - var(--gridGap))}.col-lg-7{width:calc(58.3333333333% - var(--gridGap))}.col-lg-6{width:calc(50% - var(--gridGap))}.col-lg-5{width:calc(41.6666666667% - var(--gridGap))}.col-lg-4{width:calc(33.3333333333% - var(--gridGap))}.col-lg-3{width:calc(25% - var(--gridGap))}.col-lg-2{width:calc(16.6666666667% - var(--gridGap))}.col-lg-1{width:calc(8.3333333333% - var(--gridGap))}}@media (min-width: 1200px){.col-xl-auto{flex:0 0 auto;width:auto}.col-xl-12{width:calc(100% - var(--gridGap))}.col-xl-11{width:calc(91.6666666667% - var(--gridGap))}.col-xl-10{width:calc(83.3333333333% - var(--gridGap))}.col-xl-9{width:calc(75% - var(--gridGap))}.col-xl-8{width:calc(66.6666666667% - var(--gridGap))}.col-xl-7{width:calc(58.3333333333% - var(--gridGap))}.col-xl-6{width:calc(50% - var(--gridGap))}.col-xl-5{width:calc(41.6666666667% - var(--gridGap))}.col-xl-4{width:calc(33.3333333333% - var(--gridGap))}.col-xl-3{width:calc(25% - var(--gridGap))}.col-xl-2{width:calc(16.6666666667% - var(--gridGap))}.col-xl-1{width:calc(8.3333333333% - var(--gridGap))}}@media (min-width: 1400px){.col-xxl-auto{flex:0 0 auto;width:auto}.col-xxl-12{width:calc(100% - var(--gridGap))}.col-xxl-11{width:calc(91.6666666667% - var(--gridGap))}.col-xxl-10{width:calc(83.3333333333% - var(--gridGap))}.col-xxl-9{width:calc(75% - var(--gridGap))}.col-xxl-8{width:calc(66.6666666667% - var(--gridGap))}.col-xxl-7{width:calc(58.3333333333% - var(--gridGap))}.col-xxl-6{width:calc(50% - var(--gridGap))}.col-xxl-5{width:calc(41.6666666667% - var(--gridGap))}.col-xxl-4{width:calc(33.3333333333% - var(--gridGap))}.col-xxl-3{width:calc(25% - var(--gridGap))}.col-xxl-2{width:calc(16.6666666667% - var(--gridGap))}.col-xxl-1{width:calc(8.3333333333% - var(--gridGap))}}.app-tooltip{position:fixed;z-index:999999;top:0;left:0;display:inline-block;vertical-align:top;max-width:275px;padding:3px 5px;color:#fff;text-align:center;font-family:var(--baseFontFamily);font-size:var(--smFontSize);line-height:var(--smLineHeight);border-radius:var(--baseRadius);background:var(--tooltipColor);pointer-events:none;user-select:none;transition:opacity var(--baseAnimationSpeed),visibility var(--baseAnimationSpeed),transform var(--baseAnimationSpeed);transform:translateY(2px);white-space:pre-line;opacity:0;visibility:hidden}.app-tooltip.left{transform:translate(2px)}.app-tooltip.right{transform:translate(-2px)}.app-tooltip.code{font-family:monospace;white-space:pre-wrap;text-align:left;min-width:150px;max-width:340px}.app-tooltip.active{transform:scale(1);opacity:1;visibility:visible}.dropdown{position:absolute;z-index:99;right:0;left:auto;top:100%;cursor:default;display:inline-block;vertical-align:top;padding:5px;margin:10px 0 0;width:auto;min-width:140px;max-width:450px;max-height:330px;overflow-x:hidden;overflow-y:auto;background:var(--baseColor);border-radius:var(--baseRadius);border:1px solid var(--baseAlt2Color);box-shadow:0 2px 5px 0 var(--shadowColor)}.dropdown hr{margin:5px 0}.dropdown .dropdown-item{border:0;background:none;position:relative;outline:0;display:flex;align-items:center;column-gap:8px;width:100%;height:auto;min-height:0;text-align:left;padding:8px 10px;margin:0 0 5px;cursor:pointer;color:var(--txtPrimaryColor);font-weight:400;font-size:var(--baseFontSize);font-family:var(--baseFontFamily);line-height:var(--baseLineHeight);border-radius:var(--baseRadius);text-decoration:none;word-break:break-word;user-select:none;transition:background var(--baseAnimationSpeed),color var(--baseAnimationSpeed)}.dropdown .dropdown-item:last-child{margin-bottom:0}.dropdown .dropdown-item:focus,.dropdown .dropdown-item:hover{background:var(--baseAlt1Color)}.dropdown .dropdown-item.selected{background:var(--baseAlt2Color)}.dropdown .dropdown-item:active{transition-duration:var(--activeAnimationSpeed);background:var(--baseAlt2Color)}.dropdown .dropdown-item.disabled{color:var(--txtDisabledColor);background:none;pointer-events:none}.dropdown .dropdown-item.separator{cursor:default;background:none;text-transform:uppercase;padding-top:0;padding-bottom:0;margin-top:15px;color:var(--txtDisabledColor);font-weight:600;font-size:var(--smFontSize)}.dropdown.dropdown-upside{top:auto;bottom:100%;margin:0 0 10px}.dropdown.dropdown-left{right:auto;left:0}.dropdown.dropdown-center{right:auto;left:50%;transform:translate(-50%)}.dropdown.dropdown-sm{margin-top:5px;min-width:100px}.dropdown.dropdown-sm .dropdown-item{column-gap:7px;font-size:var(--smFontSize);margin:0 0 2px;padding:5px 7px}.dropdown.dropdown-sm .dropdown-item:last-child{margin-bottom:0}.dropdown.dropdown-sm.dropdown-upside{margin-top:0;margin-bottom:5px}.dropdown.dropdown-block{width:100%;min-width:130px;max-width:100%}.dropdown.dropdown-nowrap{white-space:nowrap}.overlay-panel{position:relative;z-index:1;display:flex;flex-direction:column;align-self:flex-end;margin-left:auto;background:var(--baseColor);height:100%;width:580px;max-width:100%;word-wrap:break-word;box-shadow:0 2px 5px 0 var(--shadowColor)}.overlay-panel .overlay-panel-section{position:relative;width:100%;margin:0;padding:var(--baseSpacing);transition:box-shadow var(--baseAnimationSpeed)}.overlay-panel .overlay-panel-section:empty{display:none}.overlay-panel .overlay-panel-section:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.overlay-panel .overlay-panel-section:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.overlay-panel .overlay-panel-section .btn{flex-grow:0}.overlay-panel img{max-width:100%}.overlay-panel hr{background:var(--baseAlt2Color)}.overlay-panel .panel-header{position:relative;z-index:2;display:flex;flex-wrap:wrap;align-items:center;column-gap:10px;row-gap:var(--baseSpacing);padding:calc(var(--baseSpacing) - 7px) var(--baseSpacing)}.overlay-panel .panel-header>*{margin-top:0;margin-bottom:0}.overlay-panel .panel-header .btn-back{margin-left:-10px}.overlay-panel .panel-header .overlay-close{z-index:3;outline:0;position:absolute;right:100%;top:20px;margin:0;display:inline-flex;align-items:center;justify-content:center;width:35px;height:35px;cursor:pointer;text-align:center;font-size:1.6rem;line-height:1;border-radius:50% 0 0 50%;color:#fff;background:var(--primaryColor);opacity:.5;transition:opacity var(--baseAnimationSpeed);user-select:none}.overlay-panel .panel-header .overlay-close i{font-size:inherit}.overlay-panel .panel-header .overlay-close:hover,.overlay-panel .panel-header .overlay-close:focus-visible,.overlay-panel .panel-header .overlay-close:active{opacity:.7}.overlay-panel .panel-header .overlay-close:active{transition-duration:var(--activeAnimationSpeed);opacity:1}.overlay-panel .panel-header .btn-close{margin-right:-10px}.overlay-panel .panel-header .tabs-header{margin-bottom:-23px}.overlay-panel .panel-content{z-index:auto;flex-grow:1;overflow-x:hidden;overflow-y:auto;overflow-y:overlay}.overlay-panel .panel-header~.panel-content{padding-top:5px}.overlay-panel .panel-footer{z-index:2;column-gap:var(--smSpacing);display:flex;align-items:center;justify-content:flex-end;border-top:1px solid var(--baseAlt2Color);padding:calc(var(--baseSpacing) - 7px) var(--baseSpacing)}.overlay-panel.scrollable .panel-header{box-shadow:0 4px 5px #0000000d}.overlay-panel.scrollable .panel-footer{box-shadow:0 -4px 5px #0000000d}.overlay-panel.scrollable.scroll-top-reached .panel-header,.overlay-panel.scrollable.scroll-bottom-reached .panel-footer{box-shadow:none}.overlay-panel.overlay-panel-xl{width:850px}.overlay-panel.overlay-panel-lg{width:700px}.overlay-panel.overlay-panel-sm{width:460px}.overlay-panel.popup{height:auto;max-height:100%;align-self:center;border-radius:var(--baseRadius);margin:0 auto}.overlay-panel.popup .panel-footer{background:var(--bodyColor)}.overlay-panel.hide-content .panel-content{display:none}.overlay-panel.colored-header .panel-header{background:var(--bodyColor);border-bottom:1px solid var(--baseAlt1Color)}.overlay-panel.colored-header .panel-header .tabs-header{border-bottom:0}.overlay-panel.colored-header .panel-header~.panel-content{padding-top:calc(var(--baseSpacing) - 5px)}.overlay-panel.compact-header .panel-header{row-gap:var(--smSpacing)}.overlay-panel.full-width-popup{width:100%}.overlay-panel.image-preview{width:auto;min-width:300px;min-height:250px;max-width:70%;max-height:90%}.overlay-panel.image-preview .panel-header{position:absolute;z-index:99;box-shadow:none}.overlay-panel.image-preview .panel-header .overlay-close{left:100%;right:auto;border-radius:0 50% 50% 0}.overlay-panel.image-preview .panel-header .overlay-close i{margin-right:5px}.overlay-panel.image-preview .panel-header,.overlay-panel.image-preview .panel-footer{padding:10px 15px}.overlay-panel.image-preview .panel-content{padding:0;text-align:center;display:flex;align-items:center;justify-content:center}.overlay-panel.image-preview img{max-width:100%;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius)}@media (max-width: 900px){.overlay-panel .overlay-panel-section{padding:var(--smSpacing)}}.overlay-panel-container{display:flex;position:fixed;z-index:1000;flex-direction:row;align-items:center;top:0;left:0;width:100%;height:100%;overflow:hidden;margin:0;padding:0;outline:0}.overlay-panel-container .overlay{position:absolute;z-index:0;left:0;top:0;width:100%;height:100%;user-select:none;background:var(--overlayColor)}.overlay-panel-container.padded{padding:10px}.overlay-panel-wrapper{position:relative;z-index:1000;outline:0}.alert{position:relative;display:flex;column-gap:15px;align-items:center;width:100%;min-height:50px;max-width:100%;word-break:break-word;margin:0 0 var(--baseSpacing);border-radius:var(--baseRadius);padding:12px 15px;background:var(--baseAlt1Color);color:var(--txtAltColor)}.alert .content,.alert .form-field .help-block,.form-field .alert .help-block,.alert .panel,.alert .overlay-panel .panel-content,.overlay-panel .alert .panel-content{flex-grow:1}.alert .icon,.alert .close{display:inline-flex;align-items:center;justify-content:center;flex-grow:0;flex-shrink:0;text-align:center}.alert .icon{align-self:stretch;font-size:1.2em;padding-right:15px;font-weight:400;border-right:1px solid rgba(0,0,0,.05);color:var(--txtHintColor)}.alert .close{display:inline-flex;margin-right:-5px;width:30px;height:30px;outline:0;cursor:pointer;text-align:center;font-size:var(--smFontSize);line-height:30px;border-radius:30px;text-decoration:none;color:inherit;opacity:.5;transition:opacity var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}.alert .close:hover,.alert .close:focus{opacity:1;background:rgba(255,255,255,.2)}.alert .close:active{opacity:1;background:rgba(255,255,255,.3);transition-duration:var(--activeAnimationSpeed)}.alert code,.alert hr{background:rgba(0,0,0,.1)}.alert.alert-info{background:var(--infoAltColor)}.alert.alert-info .icon{color:var(--infoColor)}.alert.alert-warning{background:var(--warningAltColor)}.alert.alert-warning .icon{color:var(--warningColor)}.alert.alert-success{background:var(--successAltColor)}.alert.alert-success .icon{color:var(--successColor)}.alert.alert-danger{background:var(--dangerAltColor)}.alert.alert-danger .icon{color:var(--dangerColor)}.toasts-wrapper{position:fixed;z-index:999999;bottom:0;left:0;right:0;padding:0 var(--smSpacing);width:auto;display:block;text-align:center;pointer-events:none}.toasts-wrapper .alert{text-align:left;pointer-events:auto;width:var(--smWrapperWidth);margin:var(--baseSpacing) auto;box-shadow:0 2px 5px 0 var(--shadowColor)}.app-sidebar~.app-body .toasts-wrapper{left:var(--appSidebarWidth)}.app-sidebar~.app-body .page-sidebar~.toasts-wrapper{left:calc(var(--appSidebarWidth) + var(--pageSidebarWidth))}button{outline:0;border:0;background:none;padding:0;text-align:left;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit}.btn{position:relative;z-index:1;display:inline-flex;align-items:center;justify-content:center;outline:0;border:0;margin:0;flex-shrink:0;cursor:pointer;padding:5px 20px;column-gap:7px;user-select:none;min-width:var(--btnHeight);min-height:var(--btnHeight);text-align:center;text-decoration:none;line-height:1;font-weight:600;color:#fff;font-size:var(--baseFontSize);font-family:var(--baseFontFamily);border-radius:var(--btnRadius);background:none;transition:color var(--baseAnimationSpeed)}.btn i{font-size:1.1428em;vertical-align:middle;display:inline-block}.btn:before{content:"";border-radius:inherit;position:absolute;left:0;top:0;z-index:-1;width:100%;height:100%;pointer-events:none;user-select:none;backface-visibility:hidden;background:var(--primaryColor);transition:filter var(--baseAnimationSpeed),opacity var(--baseAnimationSpeed),transform var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}.btn:hover:before,.btn:focus-visible:before{opacity:.9}.btn.active,.btn:active{z-index:999}.btn.active:before,.btn:active:before{opacity:.8;transition-duration:var(--activeAnimationSpeed)}.btn.btn-info:before{background:var(--infoColor)}.btn.btn-info:hover:before,.btn.btn-info:focus-visible:before{opacity:.8}.btn.btn-info:active:before{opacity:.7}.btn.btn-success:before{background:var(--successColor)}.btn.btn-success:hover:before,.btn.btn-success:focus-visible:before{opacity:.8}.btn.btn-success:active:before{opacity:.7}.btn.btn-danger:before{background:var(--dangerColor)}.btn.btn-danger:hover:before,.btn.btn-danger:focus-visible:before{opacity:.8}.btn.btn-danger:active:before{opacity:.7}.btn.btn-warning:before{background:var(--warningColor)}.btn.btn-warning:hover:before,.btn.btn-warning:focus-visible:before{opacity:.8}.btn.btn-warning:active:before{opacity:.7}.btn.btn-hint:before{background:var(--baseAlt4Color)}.btn.btn-hint:hover:before,.btn.btn-hint:focus-visible:before{opacity:.8}.btn.btn-hint:active:before{opacity:.7}.btn.btn-outline{border:2px solid currentColor;background:#fff}.btn.btn-secondary,.btn.btn-outline{box-shadow:none;color:var(--txtPrimaryColor)}.btn.btn-secondary:before,.btn.btn-outline:before{opacity:0;background:var(--baseAlt4Color)}.btn.btn-secondary:focus-visible:before,.btn.btn-secondary:hover:before,.btn.btn-secondary:active:before,.btn.btn-secondary.active:before,.btn.btn-outline:focus-visible:before,.btn.btn-outline:hover:before,.btn.btn-outline:active:before,.btn.btn-outline.active:before{opacity:.11}.btn.btn-secondary.active:before,.btn.btn-secondary:active:before,.btn.btn-outline.active:before,.btn.btn-outline:active:before{opacity:.22}.btn.btn-secondary.btn-info,.btn.btn-outline.btn-info{color:var(--infoColor)}.btn.btn-secondary.btn-info:before,.btn.btn-outline.btn-info:before{background:var(--infoColor)}.btn.btn-secondary.btn-success,.btn.btn-outline.btn-success{color:var(--successColor)}.btn.btn-secondary.btn-success:before,.btn.btn-outline.btn-success:before{background:var(--successColor)}.btn.btn-secondary.btn-danger,.btn.btn-outline.btn-danger{color:var(--dangerColor)}.btn.btn-secondary.btn-danger:before,.btn.btn-outline.btn-danger:before{background:var(--dangerColor)}.btn.btn-secondary.btn-warning,.btn.btn-outline.btn-warning{color:var(--warningColor)}.btn.btn-secondary.btn-warning:before,.btn.btn-outline.btn-warning:before{background:var(--warningColor)}.btn.btn-secondary.btn-hint,.btn.btn-outline.btn-hint{color:var(--baseAlt4Color)}.btn.btn-secondary.btn-hint:before,.btn.btn-outline.btn-hint:before{background:var(--baseAlt4Color)}.btn.btn-secondary.btn-hint,.btn.btn-outline.btn-hint{color:var(--txtHintColor)}.btn.btn-disabled,.btn[disabled]{box-shadow:none;cursor:default;background:var(--baseAlt2Color);color:var(--txtDisabledColor)!important}.btn.btn-disabled:before,.btn[disabled]:before{display:none}.btn.btn-disabled.btn-secondary,.btn[disabled].btn-secondary{background:none}.btn.btn-disabled.btn-outline,.btn[disabled].btn-outline{border-color:var(--baseAlt2Color)}.btn.btn-expanded{min-width:140px}.btn.btn-expanded-sm{min-width:90px}.btn.btn-expanded-lg{min-width:170px}.btn.btn-lg{column-gap:10px;font-size:var(--lgFontSize);min-height:var(--lgBtnHeight);min-width:var(--lgBtnHeight);padding-left:30px;padding-right:30px}.btn.btn-lg i{font-size:1.2666em}.btn.btn-lg.btn-expanded{min-width:240px}.btn.btn-lg.btn-expanded-sm{min-width:160px}.btn.btn-lg.btn-expanded-lg{min-width:300px}.btn.btn-sm,.btn.btn-xs{column-gap:5px;font-size:var(--smFontSize);min-height:var(--smBtnHeight);min-width:var(--smBtnHeight);padding-left:12px;padding-right:12px}.btn.btn-sm i,.btn.btn-xs i{font-size:1rem}.btn.btn-sm.btn-expanded,.btn.btn-xs.btn-expanded{min-width:100px}.btn.btn-sm.btn-expanded-sm,.btn.btn-xs.btn-expanded-sm{min-width:80px}.btn.btn-sm.btn-expanded-lg,.btn.btn-xs.btn-expanded-lg{min-width:130px}.btn.btn-xs{min-width:var(--xsBtnHeight);min-height:var(--xsBtnHeight)}.btn.btn-block{display:flex;width:100%}.btn.btn-circle{border-radius:50%;padding:0;gap:0}.btn.btn-circle i{font-size:1.2857rem;text-align:center;width:24px;height:24px;line-height:24px}.btn.btn-circle i:before{margin:0;display:block}.btn.btn-circle.btn-sm i,.btn.btn-circle.btn-xs i{font-size:1.1rem}.btn.btn-loading{--loaderSize: 24px;cursor:default;pointer-events:none}.btn.btn-loading:after{content:"\eec4";position:absolute;display:inline-block;vertical-align:top;left:50%;top:50%;width:var(--loaderSize);height:var(--loaderSize);line-height:var(--loaderSize);font-size:var(--loaderSize);color:inherit;text-align:center;font-weight:400;margin-left:calc(var(--loaderSize) * -.5);margin-top:calc(var(--loaderSize) * -.5);font-family:var(--iconFontFamily);animation:loaderShow var(--baseAnimationSpeed),rotate .9s var(--baseAnimationSpeed) infinite linear}.btn.btn-loading>*{opacity:0;transform:scale(.9)}.btn.btn-loading.btn-sm,.btn.btn-loading.btn-xs{--loaderSize: 20px}.btn.btn-loading.btn-lg{--loaderSize: 28px}.btn.btn-prev i,.btn.btn-next i{transition:transform var(--baseAnimationSpeed)}.btn.btn-prev:hover i,.btn.btn-prev:focus-within i,.btn.btn-next:hover i,.btn.btn-next:focus-within i{transform:translate(3px)}.btn.btn-prev:hover i,.btn.btn-prev:focus-within i{transform:translate(-3px)}.btns-group{display:inline-flex;align-items:center;gap:var(--xsSpacing)}.code-editor,.select .selected-container,input,select,textarea{display:block;width:100%;outline:0;border:0;margin:0;background:none;padding:5px 10px;line-height:20px;min-width:0;min-height:var(--inputHeight);background:var(--baseAlt1Color);color:var(--txtPrimaryColor);font-size:var(--baseFontSize);font-family:var(--baseFontFamily);font-weight:400;border-radius:var(--baseRadius);overflow:auto;overflow:overlay}.code-editor::placeholder,.select .selected-container::placeholder,input::placeholder,select::placeholder,textarea::placeholder{color:var(--txtDisabledColor)}@media screen and (min-width: 550px){.code-editor:focus,.select .selected-container:focus,input:focus,select:focus,textarea:focus,.code-editor:focus-within,.select .selected-container:focus-within,input:focus-within,select:focus-within,textarea:focus-within{scrollbar-color:var(--baseAlt3Color) transparent;scrollbar-width:thin;scroll-behavior:smooth}.code-editor:focus::-webkit-scrollbar,.select .selected-container:focus::-webkit-scrollbar,input:focus::-webkit-scrollbar,select:focus::-webkit-scrollbar,textarea:focus::-webkit-scrollbar,.code-editor:focus-within::-webkit-scrollbar,.select .selected-container:focus-within::-webkit-scrollbar,input:focus-within::-webkit-scrollbar,select:focus-within::-webkit-scrollbar,textarea:focus-within::-webkit-scrollbar{width:8px;height:8px;border-radius:var(--baseRadius)}.code-editor:focus::-webkit-scrollbar-track,.select .selected-container:focus::-webkit-scrollbar-track,input:focus::-webkit-scrollbar-track,select:focus::-webkit-scrollbar-track,textarea:focus::-webkit-scrollbar-track,.code-editor:focus-within::-webkit-scrollbar-track,.select .selected-container:focus-within::-webkit-scrollbar-track,input:focus-within::-webkit-scrollbar-track,select:focus-within::-webkit-scrollbar-track,textarea:focus-within::-webkit-scrollbar-track{background:transparent;border-radius:var(--baseRadius)}.code-editor:focus::-webkit-scrollbar-thumb,.select .selected-container:focus::-webkit-scrollbar-thumb,input:focus::-webkit-scrollbar-thumb,select:focus::-webkit-scrollbar-thumb,textarea:focus::-webkit-scrollbar-thumb,.code-editor:focus-within::-webkit-scrollbar-thumb,.select .selected-container:focus-within::-webkit-scrollbar-thumb,input:focus-within::-webkit-scrollbar-thumb,select:focus-within::-webkit-scrollbar-thumb,textarea:focus-within::-webkit-scrollbar-thumb{background-color:var(--baseAlt3Color);border-radius:15px;border:2px solid transparent;background-clip:padding-box}.code-editor:focus::-webkit-scrollbar-thumb:hover,.select .selected-container:focus::-webkit-scrollbar-thumb:hover,input:focus::-webkit-scrollbar-thumb:hover,select:focus::-webkit-scrollbar-thumb:hover,textarea:focus::-webkit-scrollbar-thumb:hover,.code-editor:focus::-webkit-scrollbar-thumb:active,.select .selected-container:focus::-webkit-scrollbar-thumb:active,input:focus::-webkit-scrollbar-thumb:active,select:focus::-webkit-scrollbar-thumb:active,textarea:focus::-webkit-scrollbar-thumb:active,.code-editor:focus-within::-webkit-scrollbar-thumb:hover,.select .selected-container:focus-within::-webkit-scrollbar-thumb:hover,input:focus-within::-webkit-scrollbar-thumb:hover,select:focus-within::-webkit-scrollbar-thumb:hover,textarea:focus-within::-webkit-scrollbar-thumb:hover,.code-editor:focus-within::-webkit-scrollbar-thumb:active,.select .selected-container:focus-within::-webkit-scrollbar-thumb:active,input:focus-within::-webkit-scrollbar-thumb:active,select:focus-within::-webkit-scrollbar-thumb:active,textarea:focus-within::-webkit-scrollbar-thumb:active{background-color:var(--baseAlt4Color)}}.code-editor:focus,.select .selected-container:focus,input:focus,select:focus,textarea:focus,.active.code-editor,.select .active.selected-container,input.active,select.active,textarea.active{border-color:var(--primaryColor)}[readonly].code-editor,.select [readonly].selected-container,input[readonly],select[readonly],textarea[readonly],.readonly.code-editor,.select .readonly.selected-container,input.readonly,select.readonly,textarea.readonly{cursor:default;color:var(--txtHintColor)}[disabled].code-editor,.select [disabled].selected-container,input[disabled],select[disabled],textarea[disabled],.disabled.code-editor,.select .disabled.selected-container,input.disabled,select.disabled,textarea.disabled{cursor:default;color:var(--txtDisabledColor);border-color:var(--baseAlt2Color)}.txt-mono.code-editor,.select .txt-mono.selected-container,input.txt-mono,select.txt-mono,textarea.txt-mono{line-height:var(--smLineHeight)}.code.code-editor,.select .code.selected-container,input.code,select.code,textarea.code{font-size:15px;line-height:1.379rem;font-family:var(--monospaceFontFamily)}input{height:var(--inputHeight)}input:-webkit-autofill{-webkit-text-fill-color:var(--txtPrimaryColor);-webkit-box-shadow:inset 0 0 0 50px var(--baseAlt1Color)}.form-field:focus-within input:-webkit-autofill,input:-webkit-autofill:focus{-webkit-box-shadow:inset 0 0 0 50px var(--baseAlt2Color)}input[type=file]{padding:9px}input[type=checkbox],input[type=radio]{width:auto;height:auto;display:inline}input[type=number]{-moz-appearance:textfield;appearance:textfield}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}textarea{min-height:80px;resize:vertical}select{padding-left:8px}.form-field{--hPadding: 15px;position:relative;display:block;width:100%;margin-bottom:var(--baseSpacing)}.form-field .code-editor,.form-field .select .selected-container,.select .form-field .selected-container,.form-field input,.form-field select,.form-field textarea{z-index:0;padding-left:var(--hPadding);padding-right:var(--hPadding)}.form-field select{padding-left:8px}.form-field label{display:flex;width:100%;column-gap:5px;align-items:center;user-select:none;font-weight:600;color:var(--txtHintColor);font-size:var(--xsFontSize);text-transform:uppercase;line-height:1;padding-top:12px;padding-bottom:2px;padding-left:var(--hPadding);padding-right:var(--hPadding);border:0;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius)}.form-field label~.code-editor,.form-field .select label~.selected-container,.select .form-field label~.selected-container,.form-field label~input,.form-field label~select,.form-field label~textarea{border-top:0;padding-top:2px;padding-bottom:8px;border-top-left-radius:0;border-top-right-radius:0}.form-field label i{font-size:.96rem;line-height:1;margin-top:-2px;margin-bottom:-2px}.form-field .code-editor,.form-field .select .selected-container,.select .form-field .selected-container,.form-field input,.form-field select,.form-field textarea,.form-field label{background:var(--baseAlt1Color);transition:color var(--baseAnimationSpeed),background var(--baseAnimationSpeed),box-shadow var(--baseAnimationSpeed)}.form-field:focus-within .code-editor,.form-field:focus-within .select .selected-container,.select .form-field:focus-within .selected-container,.form-field:focus-within input,.form-field:focus-within select,.form-field:focus-within textarea,.form-field:focus-within label{background:var(--baseAlt2Color)}.form-field:focus-within label{color:var(--txtPrimaryColor)}.form-field .form-field-addon{position:absolute;display:inline-flex;align-items:center;z-index:1;top:0px;right:var(--hPadding);min-height:var(--inputHeight);color:var(--txtHintColor)}.form-field .form-field-addon .btn{margin-right:-5px}.form-field .form-field-addon~.code-editor,.form-field .select .form-field-addon~.selected-container,.select .form-field .form-field-addon~.selected-container,.form-field .form-field-addon~input,.form-field .form-field-addon~select,.form-field .form-field-addon~textarea{padding-right:35px}.form-field label~.form-field-addon{min-height:calc(var(--inputHeight) + var(--baseLineHeight))}.form-field .help-block{margin-top:8px;font-size:var(--smFontSize);line-height:var(--smLineHeight);color:var(--txtHintColor);word-break:break-word}.form-field .help-block pre{white-space:pre-wrap}.form-field .help-block-error{color:var(--dangerColor)}.form-field.error>label,.form-field.invalid>label{color:var(--dangerColor)}.form-field.invalid label,.form-field.invalid .code-editor,.form-field.invalid .select .selected-container,.select .form-field.invalid .selected-container,.form-field.invalid input,.form-field.invalid select,.form-field.invalid textarea{background:var(--dangerAltColor)}.form-field.required:not(.form-field-toggle)>label:after{content:"*";color:var(--dangerColor);margin-top:-2px;margin-left:-2px}.form-field.disabled>label{color:var(--txtDisabledColor)}.form-field.disabled label,.form-field.disabled .code-editor,.form-field.disabled .select .selected-container,.select .form-field.disabled .selected-container,.form-field.disabled input,.form-field.disabled select,.form-field.disabled textarea{border-color:var(--baseAlt2Color)}.form-field.disabled.required>label:after{opacity:.5}.form-field input[type=radio],.form-field input[type=checkbox]{position:absolute;z-index:-1;left:0;width:0;height:0;min-height:0;min-width:0;border:0;background:none;user-select:none;pointer-events:none;box-shadow:none;opacity:0}.form-field input[type=radio]~label,.form-field input[type=checkbox]~label{border:0;margin:0;outline:0;background:none;display:inline-flex;vertical-align:top;align-items:center;width:auto;column-gap:5px;user-select:none;padding:0 0 0 27px;line-height:20px;min-height:20px;font-weight:400;font-size:var(--baseFontSize);text-transform:none;color:var(--txtPrimaryColor)}.form-field input[type=radio]~label:before,.form-field input[type=checkbox]~label:before{content:"";display:inline-block;vertical-align:top;position:absolute;z-index:0;left:0;top:0;width:20px;height:20px;line-height:16px;font-family:var(--iconFontFamily);font-size:1.2rem;text-align:center;color:var(--baseColor);cursor:pointer;background:var(--baseColor);border-radius:var(--baseRadius);border:2px solid var(--baseAlt3Color);transition:transform var(--baseAnimationSpeed),border-color var(--baseAnimationSpeed),color var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}.form-field input[type=radio]~label:active:before,.form-field input[type=checkbox]~label:active:before{transform:scale(.9)}.form-field input[type=radio]:focus~label:before,.form-field input[type=radio]~label:hover:before,.form-field input[type=checkbox]:focus~label:before,.form-field input[type=checkbox]~label:hover:before{border-color:var(--baseAlt4Color)}.form-field input[type=radio]:checked~label:before,.form-field input[type=checkbox]:checked~label:before{content:"\eb7a";box-shadow:none;mix-blend-mode:unset;background:var(--successColor);border-color:var(--successColor)}.form-field input[type=radio]:disabled~label,.form-field input[type=checkbox]:disabled~label{pointer-events:none;cursor:not-allowed;color:var(--txtDisabledColor)}.form-field input[type=radio]:disabled~label:before,.form-field input[type=checkbox]:disabled~label:before{opacity:.5}.form-field input[type=radio]~label:before{border-radius:50%;font-size:1rem}.form-field .form-field-block{position:relative;margin:0 0 var(--xsSpacing)}.form-field .form-field-block:last-child{margin-bottom:0}.form-field.form-field-toggle input[type=radio]~label,.form-field.form-field-toggle input[type=checkbox]~label{min-height:24px;padding-left:47px}.form-field.form-field-toggle input[type=radio]~label:empty,.form-field.form-field-toggle input[type=checkbox]~label:empty{padding-left:40px}.form-field.form-field-toggle input[type=radio]~label:before,.form-field.form-field-toggle input[type=checkbox]~label:before{content:"";width:40px;height:24px;border-radius:24px;border:0;box-shadow:none;background:var(--baseAlt3Color);transition:background var(--activeAnimationSpeed)}.form-field.form-field-toggle input[type=radio]~label:after,.form-field.form-field-toggle input[type=checkbox]~label:after{content:"";position:absolute;z-index:1;top:4px;left:4px;width:16px;height:16px;cursor:pointer;background:var(--baseColor);border-radius:16px;transition:left var(--activeAnimationSpeed),transform var(--activeAnimationSpeed),background var(--activeAnimationSpeed);box-shadow:0 2px 5px 0 var(--shadowColor)}.form-field.form-field-toggle input[type=radio]~label:active:before,.form-field.form-field-toggle input[type=checkbox]~label:active:before{transform:none}.form-field.form-field-toggle input[type=radio]~label:active:after,.form-field.form-field-toggle input[type=checkbox]~label:active:after{transform:scale(.9)}.form-field.form-field-toggle input[type=radio]:focus-visible~label:before,.form-field.form-field-toggle input[type=checkbox]:focus-visible~label:before{box-shadow:0 0 0 2px var(--baseAlt2Color)}.form-field.form-field-toggle input[type=radio]~label:hover:before,.form-field.form-field-toggle input[type=checkbox]~label:hover:before{background:var(--baseAlt4Color)}.form-field.form-field-toggle input[type=radio]:checked~label:before,.form-field.form-field-toggle input[type=checkbox]:checked~label:before{background:var(--successColor)}.form-field.form-field-toggle input[type=radio]:checked~label:after,.form-field.form-field-toggle input[type=checkbox]:checked~label:after{left:20px;background:var(--baseColor)}.select{position:relative;display:block;outline:0}.select .option{user-select:none;column-gap:8px}.select .option .icon{min-width:20px;text-align:center;line-height:inherit}.select .option .icon i{vertical-align:middle;line-height:inherit}.select .txt-placeholder{color:var(--txtHintColor)}label~.select .selected-container{border-top:0}.select .selected-container{position:relative;display:flex;flex-wrap:wrap;width:100%;align-items:center;padding-top:0;padding-bottom:0;padding-right:35px!important;user-select:none}.select .selected-container:after{content:"\ea4d";position:absolute;right:5px;top:50%;width:20px;height:20px;line-height:20px;text-align:center;margin-top:-10px;display:inline-block;vertical-align:top;font-size:1rem;font-family:var(--iconFontFamily);align-self:flex-end;color:var(--txtHintColor);transition:color var(--baseAnimationSpeed),transform var(--baseAnimationSpeed)}.select .selected-container:active,.select .selected-container.active{border-bottom-left-radius:0;border-bottom-right-radius:0}.select .selected-container:active:after,.select .selected-container.active:after{color:var(--txtPrimaryColor);transform:rotate(180deg)}.select .selected-container .option{display:flex;width:100%;align-items:center;max-width:100%;user-select:text}.select .selected-container .clear{margin-left:auto;cursor:pointer;color:var(--txtHintColor);transition:color var(--baseAnimationSpeed)}.select .selected-container .clear i{display:inline-block;vertical-align:middle;line-height:1}.select .selected-container .clear:hover{color:var(--txtPrimaryColor)}.select.multiple .selected-container{display:flex;align-items:center;padding-left:2px;row-gap:3px;column-gap:4px}.select.multiple .selected-container .txt-placeholder{margin-left:5px}.select.multiple .selected-container .option{display:inline-flex;width:auto;padding:3px 5px;line-height:1;border-radius:var(--baseRadius);background:var(--baseColor)}.select:not(.multiple) .selected-container .label{margin-left:-2px}.select:not(.multiple) .selected-container .option .txt{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:100%;line-height:normal}.select:not(.multiple) .selected-container:hover{cursor:pointer}.select.disabled{color:var(--txtDisabledColor);pointer-events:none}.select.disabled .txt-placeholder,.select.disabled .selected-container{color:inherit}.select.disabled .selected-container .link-hint{pointer-events:auto}.select.disabled .selected-container *:not(.link-hint){color:inherit!important}.select.disabled .selected-container:after,.select.disabled .selected-container .clear{display:none}.select.disabled .selected-container:hover{cursor:inherit}.select .txt-missing{color:var(--txtHintColor);padding:5px 12px;margin:0}.select .options-dropdown{max-height:none;border:0;overflow:auto;border-top-left-radius:0;border-top-right-radius:0;margin-top:-2px;box-shadow:0 2px 5px 0 var(--shadowColor),inset 0 0 0 2px var(--baseAlt2Color)}.select .options-dropdown .input-group:focus-within{box-shadow:none}.select .options-dropdown .form-field.options-search{margin:0 0 5px;padding:0 0 2px;color:var(--txtHintColor);border-bottom:1px solid var(--baseAlt2Color)}.select .options-dropdown .form-field.options-search .input-group{border-radius:0;padding:0 0 0 10px;margin:0;background:none;column-gap:0;border:0}.select .options-dropdown .form-field.options-search input{border:0;padding-left:9px;padding-right:9px;background:none}.select .options-dropdown .options-list{overflow:auto;max-height:270px;width:auto;margin-left:0;margin-right:-5px;padding-right:5px}.select .options-list:not(:empty)~[slot=afterOptions]:not(:empty){margin:5px -5px -5px}.select .options-list:not(:empty)~[slot=afterOptions]:not(:empty) .btn-block{border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:var(--baseRadius);border-bottom-right-radius:var(--baseRadius)}label~.select .selected-container{padding-bottom:4px;border-top-left-radius:0;border-top-right-radius:0}label~.select.multiple .selected-container{padding-top:3px;padding-bottom:3px;padding-left:10px}.select.block-options.multiple .selected-container .option{width:100%;box-shadow:0 2px 5px 0 var(--shadowColor)}.field-type-select .options-dropdown .options-list{max-height:490px}.form-field-file label{border-bottom:0}.form-field-file .filename{align-items:center;max-width:100%;min-width:0;margin-right:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.form-field-file .filename i{text-decoration:none}.form-field-file .files-list{padding-top:5px;background:var(--baseAlt1Color);border:0;border-bottom-left-radius:var(--baseRadius);border-bottom-right-radius:var(--baseRadius);transition:background var(--baseAnimationSpeed)}.form-field-file .files-list .list-item{display:flex;width:100%;align-items:center;row-gap:10px;column-gap:var(--xsSpacing);padding:10px 15px;min-height:44px;border-top:1px solid var(--baseAlt2Color)}.form-field-file .files-list .list-item:last-child{border-radius:inherit;border-bottom:0}.form-field-file .files-list .btn-list-item{padding:5px}.form-field-file:focus-within .files-list,.form-field-file:focus-within label{background:var(--baseAlt1Color)}.form-field label~.code-editor{padding-bottom:6px;padding-top:4px}.code-editor .cm-editor{border:0!important;outline:none!important}.code-editor .cm-editor .cm-line{padding-left:0;padding-right:0}.code-editor .cm-editor .cm-tooltip-autocomplete{box-shadow:0 2px 5px 0 var(--shadowColor);border-radius:var(--baseRadius);background:var(--baseColor);border:0;padding:0 3px;font-size:.92rem}.code-editor .cm-editor .cm-tooltip-autocomplete ul{margin:0;border-radius:inherit}.code-editor .cm-editor .cm-tooltip-autocomplete ul>:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.code-editor .cm-editor .cm-tooltip-autocomplete ul>:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.code-editor .cm-editor .cm-tooltip-autocomplete ul li[aria-selected]{background:var(--infoColor)}.code-editor .cm-editor .cm-scroller{outline:0!important;font-family:var(--monospaceFontFamily);font-size:var(--baseFontSize);line-height:var(--baseLineHeight)}.code-editor .cm-editor .cm-cursorLayer .cm-cursor{margin-left:0!important}.code-editor .cm-editor .cm-placeholder{color:var(--txtDisabledColor);font-family:var(--monospaceFontFamily);font-size:var(--baseFontSize);line-height:var(--baseLineHeight)}.code-editor .cm-editor .cm-selectionMatch{background:var(--infoAltColor)}.code-editor .cm-editor.cm-focused .cm-matchingBracket{background-color:#328c821a}.main-menu{--menuItemSize: 45px;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;row-gap:var(--smSpacing);font-size:16px;color:var(--txtPrimaryColor)}.main-menu i{font-size:24px;line-height:1}.main-menu .menu-item{position:relative;outline:0;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;text-align:center;justify-content:center;user-select:none;color:inherit;min-width:var(--menuItemSize);min-height:var(--menuItemSize);border:2px solid transparent;border-radius:var(--lgRadius);transition:background var(--baseAnimationSpeed),border var(--baseAnimationSpeed)}.main-menu .menu-item:focus-visible,.main-menu .menu-item:hover{background:var(--baseAlt1Color)}.main-menu .menu-item:active{background:var(--baseAlt2Color);transition-duration:var(--activeAnimationSpeed)}.main-menu .menu-item.active,.main-menu .menu-item.current-route{background:var(--baseColor);border-color:var(--primaryColor)}.app-sidebar{position:relative;z-index:1;display:flex;flex-grow:0;flex-shrink:0;flex-direction:column;align-items:center;width:var(--appSidebarWidth);padding:var(--smSpacing) 0px var(--smSpacing);background:var(--baseColor);border-right:1px solid var(--baseAlt2Color)}.app-sidebar .main-menu{flex-grow:1;justify-content:flex-start;overflow-x:hidden;overflow-y:auto;overflow-y:overlay;margin-top:34px;margin-bottom:var(--baseSpacing)}.app-layout{display:flex;width:100%;height:100vh;overflow-x:overlay}.app-layout .app-body{flex-grow:1;min-width:0;height:100%;display:flex;align-items:stretch}.app-layout .app-sidebar~.app-body{min-width:650px}.page-sidebar{z-index:0;display:flex;flex-direction:column;width:var(--pageSidebarWidth);flex-shrink:0;flex-grow:0;overflow-x:hidden;overflow-y:auto;background:var(--baseColor);padding:calc(var(--baseSpacing) - 5px) 0 var(--smSpacing);border-right:1px solid var(--baseAlt2Color)}.page-sidebar>*{padding:0 var(--smSpacing)}.page-sidebar .sidebar-content{overflow-x:hidden;overflow-y:auto;overflow-y:overlay}.page-sidebar .sidebar-content>:first-child{margin-top:0}.page-sidebar .sidebar-content>:last-child{margin-bottom:0}.page-sidebar .sidebar-footer{margin-top:var(--smSpacing)}.page-sidebar .search{display:flex;align-items:center;width:auto;column-gap:5px;margin:0 0 var(--xsSpacing);color:var(--txtHintColor);opacity:.7;transition:opacity var(--baseAnimationSpeed),color var(--baseAnimationSpeed)}.page-sidebar .search input{border:0;background:var(--baseColor);transition:box-shadow var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}.page-sidebar .search .btn-clear{margin-right:-8px}.page-sidebar .search:hover,.page-sidebar .search:focus-within,.page-sidebar .search.active{opacity:1;color:var(--txtPrimaryColor)}.page-sidebar .search:hover input,.page-sidebar .search:focus-within input,.page-sidebar .search.active input{background:var(--baseAlt2Color)}.page-sidebar .sidebar-title{display:flex;align-items:center;gap:5px;width:100%;margin:var(--baseSpacing) 0 var(--xsSpacing);font-weight:600;font-size:1rem;line-height:var(--smLineHeight);color:var(--txtHintColor)}.page-sidebar .sidebar-title .label{font-weight:400}.page-sidebar .sidebar-list-item{cursor:pointer;outline:0;text-decoration:none;position:relative;display:flex;align-items:center;column-gap:10px;margin:10px 0;padding:3px 10px;font-size:16px;min-height:var(--btnHeight);min-width:0;color:var(--txtHintColor);border-radius:var(--baseRadius);user-select:none;transition:background var(--baseAnimationSpeed),color var(--baseAnimationSpeed)}.page-sidebar .sidebar-list-item i{font-size:18px}.page-sidebar .sidebar-list-item .txt{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.page-sidebar .sidebar-list-item:focus-visible,.page-sidebar .sidebar-list-item:hover,.page-sidebar .sidebar-list-item:active,.page-sidebar .sidebar-list-item.active{color:var(--txtPrimaryColor);background:var(--baseAlt1Color)}.page-sidebar .sidebar-list-item:active{background:var(--baseAlt2Color);transition-duration:var(--activeAnimationSpeed)}@media screen and (max-width: 1100px){.page-sidebar{--pageSidebarWidth: 190px}.page-sidebar>*{padding-left:10px;padding-right:10px}}.page-header{display:flex;align-items:center;width:100%;min-height:var(--btnHeight);gap:var(--xsSpacing);margin:0 0 var(--baseSpacing)}.page-header .btns-group{margin-left:auto;justify-content:end}@media screen and (max-width: 1050px){.page-header{flex-wrap:wrap}.page-header .btns-group{width:100%}.page-header .btns-group .btn{flex-grow:1;flex-basis:0}}.page-header-wrapper{background:var(--baseColor);width:auto;margin-top:calc(-1 * (var(--baseSpacing) - 5px));margin-left:calc(-1 * var(--baseSpacing));margin-right:calc(-1 * var(--baseSpacing));margin-bottom:var(--baseSpacing);padding:calc(var(--baseSpacing) - 5px) var(--baseSpacing);border-bottom:1px solid var(--baseAlt2Color)}.breadcrumbs{display:flex;align-items:center;gap:30px;color:var(--txtDisabledColor)}.breadcrumbs .breadcrumb-item{position:relative;margin:0;line-height:1;font-weight:400}.breadcrumbs .breadcrumb-item:after{content:"/";position:absolute;right:-20px;top:0;width:10px;text-align:center;pointer-events:none;opacity:.4}.breadcrumbs .breadcrumb-item:last-child{word-break:break-word;color:var(--txtPrimaryColor)}.breadcrumbs .breadcrumb-item:last-child:after{content:none;display:none}.breadcrumbs a{text-decoration:none;color:inherit;transition:color var(--baseAnimationSpeed)}.breadcrumbs a:hover{color:var(--txtPrimaryColor)}.page-content{position:relative;display:block;width:100%;flex-grow:1;padding:calc(var(--baseSpacing) - 5px) var(--baseSpacing)}.page-footer{display:flex;gap:5px;align-items:center;justify-content:right;text-align:right;padding:0px var(--baseSpacing) 15px;color:var(--txtDisabledColor);font-size:var(--xsFontSize);line-height:var(--smLineHeight)}.page-footer i{font-size:1.2em}.page-footer a{color:inherit;text-decoration:none;transition:color var(--baseAnimationSpeed)}.page-footer a:focus-visible,.page-footer a:hover,.page-footer a:active{color:var(--txtPrimaryColor)}.page-wrapper{display:flex;flex-direction:column;flex-grow:1;width:100%;overflow-x:hidden;overflow-y:auto;overflow-y:overlay}.page-wrapper.full-page{background:var(--baseColor)}.page-wrapper.center-content .page-content{display:flex;align-items:center}@keyframes tabChange{0%{opacity:.5}to{opacity:1}}.tabs-header{display:flex;align-items:stretch;justify-content:flex-start;column-gap:10px;width:100%;min-height:50px;user-select:none;margin:0 0 var(--baseSpacing);border-bottom:1px solid var(--baseAlt2Color)}.tabs-header .tab-item{position:relative;outline:0;border:0;background:none;display:inline-flex;align-items:center;justify-content:center;min-width:70px;gap:5px;padding:10px;margin:0;font-size:var(--lgFontSize);line-height:var(--baseLineHeight);font-family:var(--baseFontFamily);color:var(--txtHintColor);text-align:center;text-decoration:none;cursor:pointer;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius);transition:color var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}.tabs-header .tab-item:after{content:"";position:absolute;display:block;left:0;bottom:-1px;width:100%;height:2px;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius);background:var(--primaryColor);transform:rotateY(90deg);transition:transform .25s}.tabs-header .tab-item .txt,.tabs-header .tab-item i{display:inline-block;vertical-align:top}.tabs-header .tab-item:hover,.tabs-header .tab-item:focus-visible,.tabs-header .tab-item:active{color:var(--txtPrimaryColor)}.tabs-header .tab-item:focus-visible,.tabs-header .tab-item:active{transition-duration:var(--activeAnimationSpeed);background:var(--baseAlt2Color)}.tabs-header .tab-item.active{color:var(--txtPrimaryColor)}.tabs-header .tab-item.active:after{transform:rotateY(0)}.tabs-header .tab-item.disabled{pointer-events:none;color:var(--txtDisabledColor)}.tabs-header .tab-item.disabled:after{display:none}.tabs-header.right{justify-content:flex-end}.tabs-header.center{justify-content:center}.tabs-header.stretched .tab-item{flex-grow:1;flex-basis:0}.tabs-header.compact{min-height:30px;margin-bottom:var(--smSpacing)}.tabs-content{position:relative}.tabs-content>.tab-item{width:100%;display:none}.tabs-content>.tab-item.active{display:block;opacity:0;animation:tabChange .3s forwards}.tabs-content>.tab-item>:first-child{margin-top:0}.tabs-content>.tab-item>:last-child{margin-bottom:0}.tabs{position:relative}.accordion{outline:0;position:relative;border-radius:var(--baseRadius);background:var(--baseColor);border:1px solid var(--baseAlt2Color);transition:box-shadow var(--baseAnimationSpeed),margin var(--baseAnimationSpeed)}.accordion .accordion-header{outline:0;position:relative;display:flex;min-height:52px;align-items:center;row-gap:10px;column-gap:var(--smSpacing);padding:12px 20px 10px;width:100%;user-select:none;color:var(--txtPrimaryColor);border-radius:inherit;transition:background var(--baseAnimationSpeed),box-shadow var(--baseAnimationSpeed)}.accordion .accordion-header .icon{width:18px;text-align:center}.accordion .accordion-header .icon i{display:inline-block;vertical-align:top;font-size:1.1rem}.accordion .accordion-header.interactive{padding-right:50px;cursor:pointer}.accordion .accordion-header.interactive:after{content:"\ea4e";position:absolute;right:15px;top:50%;margin-top:-12.5px;width:25px;height:25px;line-height:25px;color:var(--txtHintColor);font-family:var(--iconFontFamily);font-size:1.3em;text-align:center;transition:color var(--baseAnimationSpeed)}.accordion .accordion-header:hover:after,.accordion .accordion-header:focus-visible:after{color:var(--txtPrimaryColor)}.accordion .accordion-header:active{transition-duration:var(--activeAnimationSpeed)}.accordion .accordion-content{padding:20px}.accordion:hover,.accordion:focus-visible,.accordion.active{z-index:9}.accordion:hover .accordion-header.interactive,.accordion:focus-visible .accordion-header.interactive,.accordion.active .accordion-header.interactive{background:var(--baseAlt1Color)}.accordion.active{box-shadow:0 2px 5px 0 var(--shadowColor)}.accordion.active .accordion-header{color:var(--baseColor);box-shadow:0 0 0 1px var(--primaryColor);border-bottom-left-radius:0;border-bottom-right-radius:0;background:var(--primaryColor)}.accordion.active .accordion-header.interactive{background:var(--primaryColor)}.accordion.active .accordion-header.interactive:after{color:inherit;content:"\ea78"}.accordion.disabled{z-index:0;border-color:var(--baseAlt1Color)}.accordion.disabled .accordion-header{color:var(--txtDisabledColor)}.accordions .accordion{border-radius:0;margin:-1px 0 0}.accordions .accordion.active{border-radius:var(--baseRadius);margin:var(--smSpacing) 0}.accordions .accordion.active+.accordion{border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius)}.accordions .accordion:first-child{margin-top:0;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius)}.accordions .accordion:last-child{margin-bottom:0;border-bottom-left-radius:var(--baseRadius);border-bottom-right-radius:var(--baseRadius)}table{border-collapse:separate;min-width:100%;transition:opacity var(--baseAnimationSpeed)}table .form-field{margin:0;line-height:1}table td,table th{outline:0;vertical-align:middle;position:relative;text-align:left;padding:10px;border-bottom:1px solid var(--baseAlt2Color)}table td:first-child,table th:first-child{padding-left:20px}table td:last-child,table th:last-child{padding-right:20px}table th{color:var(--txtHintColor);font-weight:600;font-size:1rem;user-select:none;height:50px;line-height:var(--smLineHeight)}table th i{font-size:inherit}table td{height:60px;word-break:break-word}table .min-width{width:1%!important;white-space:nowrap}table .nowrap{white-space:nowrap}table .col-sort{cursor:pointer;border-top-left-radius:var(--baseRadius);border-top-right-radius:var(--baseRadius);padding-right:30px;transition:color var(--baseAnimationSpeed),background var(--baseAnimationSpeed)}table .col-sort:after{content:"\ea4c";position:absolute;right:10px;top:50%;margin-top:-12.5px;line-height:25px;height:25px;font-family:var(--iconFontFamily);font-weight:400;color:var(--txtHintColor);opacity:0;transition:color var(--baseAnimationSpeed),opacity var(--baseAnimationSpeed)}table .col-sort.sort-desc:after{content:"\ea4c"}table .col-sort.sort-asc:after{content:"\ea76"}table .col-sort.sort-active:after{opacity:1}table .col-sort:hover,table .col-sort:focus-visible{background:var(--baseAlt1Color)}table .col-sort:hover:after,table .col-sort:focus-visible:after{opacity:1}table .col-sort:active{transition-duration:var(--activeAnimationSpeed);background:var(--baseAlt2Color)}table .col-sort.col-sort-disabled{cursor:default;background:none}table .col-sort.col-sort-disabled:after{display:none}table .col-header-content{display:inline-flex;align-items:center;flex-wrap:nowrap;gap:5px}table .col-header-content .txt{max-width:140px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}table .col-field-created,table .col-field-updated,table .col-type-action{width:1%!important;white-space:nowrap}table .col-type-action{white-space:nowrap;text-align:right;color:var(--txtHintColor)}table .col-type-action i{display:inline-block;vertical-align:top;transition:transform var(--baseAnimationSpeed)}table td.col-type-json{font-family:monospace;font-size:var(--smFontSize);line-height:var(--smLineHeight);max-width:300px}table .col-type-text{max-width:300px}table .col-type-select{min-width:150px}table .col-type-email{min-width:120px;white-space:nowrap}table .col-type-file{min-width:100px}table td.col-field-id{width:0;white-space:nowrap}table tr{outline:0;background:var(--bodyColor);transition:background var(--baseAnimationSpeed)}table tr.row-handle{cursor:pointer;user-select:none}table tr.row-handle:focus-visible,table tr.row-handle:hover,table tr.row-handle:active{background:var(--baseAlt1Color)}table tr.row-handle:focus-visible .action-col,table tr.row-handle:hover .action-col,table tr.row-handle:active .action-col{color:var(--txtPrimaryColor)}table tr.row-handle:focus-visible .action-col i,table tr.row-handle:hover .action-col i,table tr.row-handle:active .action-col i{transform:translate(3px)}table tr.row-handle:active{transition-duration:var(--activeAnimationSpeed)}table.table-compact td,table.table-compact th{height:auto}table.table-border{border:1px solid var(--baseAlt2Color)}table.table-border tr{background:var(--baseColor)}table.table-border th{background:var(--baseAlt1Color)}table.table-border>:last-child>:last-child th,table.table-border>:last-child>:last-child td{border-bottom:0}table.table-loading{pointer-events:none;opacity:.7}.table-wrapper{width:auto;padding:0;overflow-x:auto;max-width:calc(100% + 2 * var(--baseSpacing));margin-left:calc(var(--baseSpacing) * -1);margin-right:calc(var(--baseSpacing) * -1)}.table-wrapper .bulk-select-col{min-width:70px}.table-wrapper .bulk-select-col input[type=checkbox]~label{opacity:.7}.table-wrapper .bulk-select-col label:hover,.table-wrapper .bulk-select-col label:focus-within,.table-wrapper .bulk-select-col input[type=checkbox]:checked~label{opacity:1!important}.table-wrapper td:first-child,.table-wrapper th:first-child{padding-left:calc(var(--baseSpacing) + 3px)}.table-wrapper td:last-child,.table-wrapper th:last-child{padding-right:calc(var(--baseSpacing) + 3px)}.table-wrapper .bulk-select-col,.table-wrapper .col-type-action{position:sticky;z-index:99}.table-wrapper .bulk-select-col{left:0px}.table-wrapper .col-type-action{right:0}.table-wrapper .bulk-select-col,.table-wrapper .col-type-action{background:inherit}.table-wrapper th.bulk-select-col,.table-wrapper th.col-type-action{background:var(--bodyColor)}.searchbar{--searchHeight: 44px;outline:0;display:flex;align-items:center;height:var(--searchHeight);width:100%;flex-grow:1;padding:5px 7px;margin:0 0 var(--smSpacing);white-space:nowrap;color:var(--txtHintColor);background:var(--baseAlt1Color);border-radius:var(--btnHeight);transition:color var(--baseAnimationSpeed),background var(--baseAnimationSpeed),box-shadow var(--baseAnimationSpeed)}.searchbar>:first-child{border-top-left-radius:var(--btnHeight);border-bottom-left-radius:var(--btnHeight)}.searchbar>:last-child{border-top-right-radius:var(--btnHeight);border-bottom-right-radius:var(--btnHeight)}.searchbar .btn{border-radius:var(--btnHeight)}.searchbar .code-editor,.searchbar input,.searchbar input:focus{font-size:var(--baseFontSize);font-family:var(--monospaceFontFamily);border:0;background:none}.searchbar label>i{line-height:inherit}.searchbar .search-options{flex-shrink:0;width:90px}.searchbar .search-options .selected-container{border-radius:inherit;background:none;padding-right:25px!important}.searchbar .search-options:not(:focus-within) .selected-container{color:var(--txtHintColor)}.searchbar:focus-within{color:var(--txtPrimaryColor);background:var(--baseAlt2Color)}.searchbar-wrapper{position:relative;display:flex;align-items:center;width:100%;min-width:var(--btnHeight);min-height:var(--btnHeight)}.searchbar-wrapper .search-toggle{position:absolute;right:0;top:0}.bulkbar{position:sticky;bottom:var(--baseSpacing);z-index:101;gap:10px;display:flex;justify-content:center;align-items:center;width:var(--smWrapperWidth);max-width:100%;margin:var(--smSpacing) auto;padding:10px var(--smSpacing);border-radius:var(--btnHeight);background:var(--baseColor);border:1px solid var(--baseAlt2Color);box-shadow:0 2px 5px 0 var(--shadowColor)}.flatpickr-calendar{opacity:0;display:none;text-align:center;visibility:hidden;padding:0;animation:none;direction:ltr;border:0;font-size:1rem;line-height:24px;position:absolute;width:298px;box-sizing:border-box;user-select:none;color:var(--txtPrimaryColor);background:var(--baseColor);border-radius:var(--baseRadius);box-shadow:0 2px 5px 0 var(--shadowColor),0 0 0 1px var(--baseAlt2Color)}.flatpickr-calendar input,.flatpickr-calendar select{box-shadow:none;min-height:0;height:var(--inputHeight);background:none;border-radius:var(--baseRadius);border:1px solid var(--baseAlt1Color)}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown .3s cubic-bezier(.23,1,.32,1);animation:fpFadeInDown .3s cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:0;width:100%}.flatpickr-calendar.static{position:absolute;top:100%;margin-top:2px;margin-bottom:10px;width:100%}.flatpickr-calendar.static .flatpickr-days{width:100%}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none!important;box-shadow:none!important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 var(--baseAlt2Color),5px 0 0 var(--baseAlt2Color);box-shadow:-2px 0 0 var(--baseAlt2Color),5px 0 0 var(--baseAlt2Color)}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.hasTime .flatpickr-time{height:40px;border-top:1px solid var(--baseAlt2Color)}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:"";height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.arrowRight:before,.flatpickr-calendar.rightMost:after,.flatpickr-calendar.arrowRight:after{left:auto;right:22px}.flatpickr-calendar.arrowCenter:before,.flatpickr-calendar.arrowCenter:after{left:50%;right:50%}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:var(--baseColor)}.flatpickr-calendar.arrowTop:after{border-bottom-color:var(--baseColor)}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:var(--baseColor)}.flatpickr-calendar.arrowBottom:after{border-top-color:var(--baseColor)}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative}.flatpickr-months{display:flex;margin:0 0 4px}.flatpickr-months .flatpickr-month{background:transparent;color:var(--txtPrimaryColor);fill:var(--txtPrimaryColor);height:34px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{text-decoration:none;cursor:pointer;position:absolute;top:0;height:34px;padding:10px;z-index:3;color:var(--txtPrimaryColor);fill:var(--txtPrimaryColor)}.flatpickr-months .flatpickr-prev-month.flatpickr-disabled,.flatpickr-months .flatpickr-next-month.flatpickr-disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{left:0}.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,.flatpickr-months .flatpickr-next-month.flatpickr-next-month{right:0}.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover,.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:var(--txtHintColor)}.flatpickr-months .flatpickr-prev-month svg,.flatpickr-months .flatpickr-next-month svg{width:14px;height:14px}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%}.numInputWrapper input::-ms-clear{display:none}.numInputWrapper input::-webkit-outer-spin-button,.numInputWrapper input::-webkit-inner-spin-button{margin:0;-webkit-appearance:none}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,.15);box-sizing:border-box}.numInputWrapper span:hover{background:rgba(0,0,0,.1)}.numInputWrapper span:active{background:rgba(0,0,0,.2)}.numInputWrapper span:after{display:block;content:"";position:absolute}.numInputWrapper span.arrowUp{top:0;border-bottom:0}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,.6);top:26%}.numInputWrapper span.arrowDown{top:50%}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,.6);top:40%}.numInputWrapper span svg{width:inherit;height:auto}.numInputWrapper span svg path{fill:#00000080}.numInputWrapper:hover{background:var(--baseAlt2Color)}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{line-height:inherit;color:inherit;position:absolute;width:75%;left:12.5%;padding:1px 0;line-height:1;display:flex;align-items:center;justify-content:center;text-align:center}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0}.flatpickr-current-month span.cur-month:hover{background:var(--baseAlt2Color)}.flatpickr-current-month .numInputWrapper{display:inline-flex;align-items:center;justify-content:center;width:63px;margin:0 5px}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:var(--txtPrimaryColor)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:var(--txtPrimaryColor)}.flatpickr-current-month input.cur-year{background:transparent;box-sizing:border-box;color:inherit;cursor:text;margin:0;display:inline-block;font-size:inherit;font-family:inherit;line-height:inherit;vertical-align:initial;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{color:var(--txtDisabledColor);background:transparent;pointer-events:none}.flatpickr-current-month .flatpickr-monthDropdown-months{appearance:menulist;box-sizing:border-box;color:inherit;cursor:pointer;font-size:inherit;line-height:inherit;outline:none;position:relative;vertical-align:initial;-webkit-box-sizing:border-box;-webkit-appearance:menulist;-moz-appearance:menulist;width:auto}.flatpickr-current-month .flatpickr-monthDropdown-months:focus,.flatpickr-current-month .flatpickr-monthDropdown-months:active{outline:none}.flatpickr-current-month .flatpickr-monthDropdown-months:hover{background:var(--baseAlt2Color)}.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month{background-color:transparent;outline:none;padding:0}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px}.flatpickr-weekdays .flatpickr-weekdaycontainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}span.flatpickr-weekday{display:block;flex:1;margin:0;cursor:default;line-height:1;background:transparent;color:var(--txtHintColor);text-align:center;font-weight:bolder;font-size:var(--smFontSize)}.dayContainer,.flatpickr-weeks{padding:1px 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:100%;box-sizing:border-box;display:inline-block;display:flex;flex-wrap:wrap;transform:translateZ(0);opacity:1}.dayContainer+.dayContainer{-webkit-box-shadow:-1px 0 0 var(--baseAlt2Color);box-shadow:-1px 0 0 var(--baseAlt2Color)}.flatpickr-day{background:none;border:1px solid transparent;border-radius:var(--baseRadius);box-sizing:border-box;color:var(--txtPrimaryColor);cursor:pointer;font-weight:400;width:calc(14.2857143% - 2px);flex-basis:calc(14.2857143% - 2px);height:39px;margin:1px;display:inline-flex;align-items:center;justify-content:center;position:relative;text-align:center;flex-direction:column}.flatpickr-day.weekend,.flatpickr-day:nth-child(7n+6),.flatpickr-day:nth-child(7n+7){color:var(--dangerColor)}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:var(--baseAlt2Color);border-color:var(--baseAlt2Color)}.flatpickr-day.today{border-color:var(--baseColor)}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:var(--primaryColor);background:var(--primaryColor);color:var(--baseColor)}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:var(--primaryColor);-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:var(--primaryColor)}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange+.endRange:not(:nth-child(7n+1)),.flatpickr-day.startRange.startRange+.endRange:not(:nth-child(7n+1)),.flatpickr-day.endRange.startRange+.endRange:not(:nth-child(7n+1)){-webkit-box-shadow:-10px 0 0 var(--primaryColor);box-shadow:-10px 0 0 var(--primaryColor)}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;box-shadow:-5px 0 0 var(--baseAlt2Color),5px 0 0 var(--baseAlt2Color)}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:var(--txtDisabledColor);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover{cursor:not-allowed;color:var(--txtDisabledColor);background:var(--baseAlt2Color)}.flatpickr-day.week.selected{border-radius:0;box-shadow:-5px 0 0 var(--primaryColor),5px 0 0 var(--primaryColor)}.flatpickr-day.hidden{visibility:hidden}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{float:left}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 var(--baseAlt2Color);box-shadow:1px 0 0 var(--baseAlt2Color)}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day,.flatpickr-weekwrapper span.flatpickr-day:hover{display:block;width:100%;max-width:none;color:var(--txtHintColor);background:transparent;cursor:default;border:none}.flatpickr-innerContainer{display:flex;box-sizing:border-box;overflow:hidden;padding:5px}.flatpickr-rContainer{display:inline-block;padding:0;width:100%;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:var(--txtPrimaryColor)}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:var(--txtPrimaryColor)}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;box-shadow:none;border:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;color:var(--txtPrimaryColor);font-size:14px;position:relative;box-sizing:border-box;background:var(--baseColor);-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-time input.flatpickr-hour{font-weight:700}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;float:left;line-height:inherit;color:var(--txtPrimaryColor);font-weight:700;width:2%;user-select:none;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400}.flatpickr-time input:hover,.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time input:focus,.flatpickr-time .flatpickr-am-pm:focus{background:var(--baseAlt1Color)}.flatpickr-input[readonly]{cursor:pointer}@keyframes fpFadeInDown{0%{opacity:0;transform:translate3d(0,10px,0)}to{opacity:1;transform:translateZ(0)}}.flatpickr-hide-prev-next-month-days .flatpickr-calendar .prevMonthDay{visibility:hidden}.flatpickr-hide-prev-next-month-days .flatpickr-calendar .nextMonthDay,.flatpickr-inline-container .flatpickr-input{display:none}.flatpickr-inline-container .flatpickr-calendar{margin:0;box-shadow:none;border:1px solid var(--baseAlt2Color)}.panel-wrapper.svelte-lxxzfu{animation:slideIn .2s}@keyframes svelte-b7gb6q-refresh{to{transform:rotate(180deg)}}.btn.refreshing.svelte-b7gb6q i.svelte-b7gb6q{animation:svelte-b7gb6q-refresh .2s ease-out}.chart-wrapper.svelte-vh4sl8.svelte-vh4sl8{position:relative;display:block;width:100%}.chart-wrapper.loading.svelte-vh4sl8 .chart-canvas.svelte-vh4sl8{pointer-events:none;opacity:.5}.chart-loader.svelte-vh4sl8.svelte-vh4sl8{position:absolute;z-index:999;top:50%;left:50%;transform:translate(-50%,-50%)}.prism-light code[class*=language-],.prism-light pre[class*=language-]{color:#111b27;background:0 0;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}.prism-light code[class*=language-] ::-moz-selection,.prism-light code[class*=language-]::-moz-selection,.prism-light pre[class*=language-] ::-moz-selection,.prism-light pre[class*=language-]::-moz-selection{background:#8da1b9}.prism-light code[class*=language-] ::selection,.prism-light code[class*=language-]::selection,.prism-light pre[class*=language-] ::selection,.prism-light pre[class*=language-]::selection{background:#8da1b9}.prism-light pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}.prism-light :not(pre)>code[class*=language-],.prism-light pre[class*=language-]{background:#e3eaf2}.prism-light :not(pre)>code[class*=language-]{padding:.1em .3em;border-radius:.3em;white-space:normal}.prism-light .token.cdata,.prism-light .token.comment,.prism-light .token.doctype,.prism-light .token.prolog{color:#3c526d}.prism-light .token.punctuation{color:#111b27}.prism-light .token.delimiter.important,.prism-light .token.selector .parent,.prism-light .token.tag,.prism-light .token.tag .token.punctuation{color:#006d6d}.prism-light .token.attr-name,.prism-light .token.boolean,.prism-light .token.boolean.important,.prism-light .token.constant,.prism-light .token.number,.prism-light .token.selector .token.attribute{color:#755f00}.prism-light .token.class-name,.prism-light .token.key,.prism-light .token.parameter,.prism-light .token.property,.prism-light .token.property-access,.prism-light .token.variable{color:#005a8e}.prism-light .token.attr-value,.prism-light .token.color,.prism-light .token.inserted,.prism-light .token.selector .token.value,.prism-light .token.string,.prism-light .token.string .token.url-link{color:#116b00}.prism-light .token.builtin,.prism-light .token.keyword-array,.prism-light .token.package,.prism-light .token.regex{color:#af00af}.prism-light .token.function,.prism-light .token.selector .token.class,.prism-light .token.selector .token.id{color:#7c00aa}.prism-light .token.atrule .token.rule,.prism-light .token.combinator,.prism-light .token.keyword,.prism-light .token.operator,.prism-light .token.pseudo-class,.prism-light .token.pseudo-element,.prism-light .token.selector,.prism-light .token.unit{color:#a04900}.prism-light .token.deleted,.prism-light .token.important{color:#c22f2e}.prism-light .token.keyword-this,.prism-light .token.this{color:#005a8e}.prism-light .token.bold,.prism-light .token.important,.prism-light .token.keyword-this,.prism-light .token.this{font-weight:700}.prism-light .token.delimiter.important{font-weight:inherit}.prism-light .token.italic{font-style:italic}.prism-light .token.entity{cursor:help}.prism-light .language-markdown .token.title,.prism-light .language-markdown .token.title .token.punctuation{color:#005a8e;font-weight:700}.prism-light .language-markdown .token.blockquote.punctuation{color:#af00af}.prism-light .language-markdown .token.code{color:#006d6d}.prism-light .language-markdown .token.hr.punctuation{color:#005a8e}.prism-light .language-markdown .token.url>.token.content{color:#116b00}.prism-light .language-markdown .token.url-link{color:#755f00}.prism-light .language-markdown .token.list.punctuation{color:#af00af}.prism-light .language-markdown .token.table-header,.prism-light .language-json .token.operator{color:#111b27}.prism-light .language-scss .token.variable{color:#006d6d}.prism-light .token.token.cr:before,.prism-light .token.token.lf:before,.prism-light .token.token.space:before,.prism-light .token.token.tab:not(:empty):before{color:#3c526d}.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>a,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>button{color:#e3eaf2;background:#005a8e}.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>a:focus,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>a:hover,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>button:focus,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>button:hover{color:#e3eaf2;background:rgba(0,90,142,.8549019608);text-decoration:none}.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>span,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>span:focus,.prism-light div.code-toolbar>.toolbar.toolbar>.toolbar-item>span:hover{color:#e3eaf2;background:#3c526d}.prism-light .line-highlight.line-highlight{background:rgba(141,161,185,.1843137255);background:linear-gradient(to right,rgba(141,161,185,.1843137255) 70%,rgba(141,161,185,.1450980392))}.prism-light .line-highlight.line-highlight:before,.prism-light .line-highlight.line-highlight[data-end]:after{background-color:#3c526d;color:#e3eaf2;box-shadow:0 1px #8da1b9}.prism-light pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows>span:hover:before{background-color:#3c526d1f}.prism-light .line-numbers.line-numbers .line-numbers-rows{border-right:1px solid rgba(141,161,185,.4784313725);background:rgba(208,218,231,.4784313725)}.prism-light .line-numbers .line-numbers-rows>span:before{color:#3c526dda}.prism-light .rainbow-braces .token.token.punctuation.brace-level-1,.prism-light .rainbow-braces .token.token.punctuation.brace-level-5,.prism-light .rainbow-braces .token.token.punctuation.brace-level-9{color:#755f00}.prism-light .rainbow-braces .token.token.punctuation.brace-level-10,.prism-light .rainbow-braces .token.token.punctuation.brace-level-2,.prism-light .rainbow-braces .token.token.punctuation.brace-level-6{color:#af00af}.prism-light .rainbow-braces .token.token.punctuation.brace-level-11,.prism-light .rainbow-braces .token.token.punctuation.brace-level-3,.prism-light .rainbow-braces .token.token.punctuation.brace-level-7{color:#005a8e}.prism-light .rainbow-braces .token.token.punctuation.brace-level-12,.prism-light .rainbow-braces .token.token.punctuation.brace-level-4,.prism-light .rainbow-braces .token.token.punctuation.brace-level-8{color:#7c00aa}.prism-light pre.diff-highlight>code .token.token.deleted:not(.prefix),.prism-light pre>code.diff-highlight .token.token.deleted:not(.prefix){background-color:#c22f2e1f}.prism-light pre.diff-highlight>code .token.token.inserted:not(.prefix),.prism-light pre>code.diff-highlight .token.token.inserted:not(.prefix){background-color:#116b001f}.prism-light .command-line .command-line-prompt{border-right:1px solid rgba(141,161,185,.4784313725)}.prism-light .command-line .command-line-prompt>span:before{color:#3c526dda}code.svelte-1ua9m3i.svelte-1ua9m3i{display:block;width:100%;padding:var(--xsSpacing);white-space:pre-wrap;word-break:break-word}.code-wrapper.svelte-1ua9m3i.svelte-1ua9m3i{display:block;width:100%;max-height:100%;overflow:auto;overflow:overlay}.prism-light.svelte-1ua9m3i code.svelte-1ua9m3i{color:var(--txtPrimaryColor);background:var(--baseAlt1Color)}.invalid-name-note.svelte-1tpxlm5{position:absolute;right:10px;top:10px;text-transform:none}.title.field-name.svelte-1tpxlm5{max-width:130px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.rule-block.svelte-fjxz7k{display:flex;align-items:flex-start;gap:var(--xsSpacing)}.rule-toggle-btn.svelte-fjxz7k{margin-top:15px}.changes-list.svelte-1ghly2p{word-break:break-all}.tabs-content.svelte-b10vi{z-index:3}.filter-op.svelte-1w7s5nw{display:inline-block;vertical-align:top;margin-right:5px;width:30px;text-align:center;padding-left:0;padding-right:0}.sdk-tabs.svelte-1maocj6 .tabs-header .tab-item.svelte-1maocj6{min-width:100px}textarea.svelte-1x1pbts{resize:none;padding-top:4px!important;padding-bottom:5px!important;min-height:var(--inputHeight);height:var(--inputHeight)}.content.svelte-1gjwqyd{flex-shrink:1;flex-grow:0;width:auto;min-width:0}.export-preview.svelte-jm5c4z.svelte-jm5c4z{position:relative;height:500px}.export-preview.svelte-jm5c4z .copy-schema.svelte-jm5c4z{position:absolute;right:15px;top:15px}.collections-diff-table.svelte-lmkr38.svelte-lmkr38{color:var(--txtHintColor);border:2px solid var(--primaryColor)}.collections-diff-table.svelte-lmkr38 tr.svelte-lmkr38{background:none}.collections-diff-table.svelte-lmkr38 th.svelte-lmkr38,.collections-diff-table.svelte-lmkr38 td.svelte-lmkr38{height:auto;padding:2px 15px;border-bottom:1px solid rgba(0,0,0,.07)}.collections-diff-table.svelte-lmkr38 th.svelte-lmkr38{height:35px;padding:4px 15px;color:var(--txtPrimaryColor)}.collections-diff-table.svelte-lmkr38 thead tr.svelte-lmkr38{background:var(--primaryColor)}.collections-diff-table.svelte-lmkr38 thead tr th.svelte-lmkr38{color:var(--baseColor);background:none}.collections-diff-table.svelte-lmkr38 .label.svelte-lmkr38{font-weight:400}.collections-diff-table.svelte-lmkr38 .changed-none-col.svelte-lmkr38{color:var(--txtDisabledColor);background:var(--baseAlt1Color)}.collections-diff-table.svelte-lmkr38 .changed-old-col.svelte-lmkr38{color:var(--txtPrimaryColor);background:var(--dangerAltColor)}.collections-diff-table.svelte-lmkr38 .changed-new-col.svelte-lmkr38{color:var(--txtPrimaryColor);background:var(--successAltColor)}.collections-diff-table.svelte-lmkr38 .field-key-col.svelte-lmkr38{padding-left:30px}.list-label.svelte-1jx20fl{min-width:65px} diff --git a/ui/dist/assets/index.97f016a1.js b/ui/dist/assets/index.97f016a1.js new file mode 100644 index 000000000..99e1d026b --- /dev/null +++ b/ui/dist/assets/index.97f016a1.js @@ -0,0 +1,175 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerpolicy&&(l.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?l.credentials="include":s.crossorigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(s){if(s.ep)return;s.ep=!0;const l=t(s);fetch(s.href,l)}})();function x(){}const bl=n=>n;function Ye(n,e){for(const t in e)n[t]=e[t];return n}function j_(n){return n&&typeof n=="object"&&typeof n.then=="function"}function tm(n){return n()}function Xa(){return Object.create(null)}function Re(n){n.forEach(tm)}function Wt(n){return typeof n=="function"}function we(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let Pl;function Ln(n,e){return Pl||(Pl=document.createElement("a")),Pl.href=e,n===Pl.href}function q_(n){return Object.keys(n).length===0}function nm(n,...e){if(n==null)return x;const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function Je(n,e,t){n.$$.on_destroy.push(nm(e,t))}function Ot(n,e,t,i){if(n){const s=im(n,e,t,i);return n[0](s)}}function im(n,e,t,i){return n[1]&&i?Ye(t.ctx.slice(),n[1](i(e))):t.ctx}function Dt(n,e,t,i){if(n[2]&&i){const s=n[2](i(t));if(e.dirty===void 0)return s;if(typeof s=="object"){const l=[],o=Math.max(e.dirty.length,s.length);for(let r=0;r32){const e=[],t=n.ctx.length/32;for(let i=0;iwindow.performance.now():()=>Date.now(),sa=sm?n=>requestAnimationFrame(n):x;const hs=new Set;function lm(n){hs.forEach(e=>{e.c(n)||(hs.delete(e),e.f())}),hs.size!==0&&sa(lm)}function Po(n){let e;return hs.size===0&&sa(lm),{promise:new Promise(t=>{hs.add(e={c:n,f:t})}),abort(){hs.delete(e)}}}function _(n,e){n.appendChild(e)}function om(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function V_(n){const e=v("style");return z_(om(n),e),e.sheet}function z_(n,e){return _(n.head||n,e),e.sheet}function $(n,e,t){n.insertBefore(e,t||null)}function S(n){n.parentNode.removeChild(n)}function Tt(n,e){for(let t=0;tn.removeEventListener(e,t,i)}function ut(n){return function(e){return e.preventDefault(),n.call(this,e)}}function Yn(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function B_(n){return function(e){e.target===this&&n.call(this,e)}}function p(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function Wn(n,e){const t=Object.getOwnPropertyDescriptors(n.__proto__);for(const i in e)e[i]==null?n.removeAttribute(i):i==="style"?n.style.cssText=e[i]:i==="__value"?n.value=n[i]=e[i]:t[i]&&t[i].set?n[i]=e[i]:p(n,i,e[i])}function rt(n){return n===""?null:+n}function W_(n){return Array.from(n.childNodes)}function ue(n,e){e=""+e,n.wholeText!==e&&(n.data=e)}function he(n,e){n.value=e==null?"":e}function Qa(n,e,t,i){t===null?n.style.removeProperty(e):n.style.setProperty(e,t,i?"important":"")}function ee(n,e,t){n.classList[t?"add":"remove"](e)}function rm(n,e,{bubbles:t=!1,cancelable:i=!1}={}){const s=document.createEvent("CustomEvent");return s.initCustomEvent(n,t,i,e),s}function Qt(n,e){return new n(e)}const fo=new Map;let co=0;function U_(n){let e=5381,t=n.length;for(;t--;)e=(e<<5)-e^n.charCodeAt(t);return e>>>0}function Y_(n,e){const t={stylesheet:V_(e),rules:{}};return fo.set(n,t),t}function sl(n,e,t,i,s,l,o,r=0){const a=16.666/i;let u=`{ +`;for(let g=0;g<=1;g+=a){const y=e+(t-e)*l(g);u+=g*100+`%{${o(y,1-y)}} +`}const f=u+`100% {${o(t,1-t)}} +}`,c=`__svelte_${U_(f)}_${r}`,d=om(n),{stylesheet:h,rules:m}=fo.get(d)||Y_(d,n);m[c]||(m[c]=!0,h.insertRule(`@keyframes ${c} ${f}`,h.cssRules.length));const b=n.style.animation||"";return n.style.animation=`${b?`${b}, `:""}${c} ${i}ms linear ${s}ms 1 both`,co+=1,c}function ll(n,e){const t=(n.style.animation||"").split(", "),i=t.filter(e?l=>l.indexOf(e)<0:l=>l.indexOf("__svelte")===-1),s=t.length-i.length;s&&(n.style.animation=i.join(", "),co-=s,co||K_())}function K_(){sa(()=>{co||(fo.forEach(n=>{const{ownerNode:e}=n.stylesheet;e&&S(e)}),fo.clear())})}function J_(n,e,t,i){if(!e)return x;const s=n.getBoundingClientRect();if(e.left===s.left&&e.right===s.right&&e.top===s.top&&e.bottom===s.bottom)return x;const{delay:l=0,duration:o=300,easing:r=bl,start:a=Io()+l,end:u=a+o,tick:f=x,css:c}=t(n,{from:e,to:s},i);let d=!0,h=!1,m;function b(){c&&(m=sl(n,0,1,o,l,r,c)),l||(h=!0)}function g(){c&&ll(n,m),d=!1}return Po(y=>{if(!h&&y>=a&&(h=!0),h&&y>=u&&(f(1,0),g()),!d)return!1;if(h){const k=y-a,w=0+1*r(k/o);f(w,1-w)}return!0}),b(),f(0,1),g}function Z_(n){const e=getComputedStyle(n);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:t,height:i}=e,s=n.getBoundingClientRect();n.style.position="absolute",n.style.width=t,n.style.height=i,am(n,s)}}function am(n,e){const t=n.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){const i=getComputedStyle(n),s=i.transform==="none"?"":i.transform;n.style.transform=`${s} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}let ol;function ni(n){ol=n}function vl(){if(!ol)throw new Error("Function called outside component initialization");return ol}function un(n){vl().$$.on_mount.push(n)}function G_(n){vl().$$.after_update.push(n)}function X_(n){vl().$$.on_destroy.push(n)}function It(){const n=vl();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const l=rm(e,t,{cancelable:i});return s.slice().forEach(o=>{o.call(n,l)}),!l.defaultPrevented}return!0}}function Ve(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const Us=[],le=[],io=[],Mr=[],um=Promise.resolve();let Tr=!1;function fm(){Tr||(Tr=!0,um.then(la))}function $n(){return fm(),um}function Qe(n){io.push(n)}function $e(n){Mr.push(n)}const Zo=new Set;let Ll=0;function la(){const n=ol;do{for(;Ll{Ps=null})),Ps}function Vi(n,e,t){n.dispatchEvent(rm(`${e?"intro":"outro"}${t}`))}const so=new Set;let qn;function be(){qn={r:0,c:[],p:qn}}function ve(){qn.r||Re(qn.c),qn=qn.p}function E(n,e){n&&n.i&&(so.delete(n),n.i(e))}function I(n,e,t,i){if(n&&n.o){if(so.has(n))return;so.add(n),qn.c.push(()=>{so.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const ra={duration:0};function cm(n,e,t){let i=e(n,t),s=!1,l,o,r=0;function a(){l&&ll(n,l)}function u(){const{delay:c=0,duration:d=300,easing:h=bl,tick:m=x,css:b}=i||ra;b&&(l=sl(n,0,1,d,c,h,b,r++)),m(0,1);const g=Io()+c,y=g+d;o&&o.abort(),s=!0,Qe(()=>Vi(n,!0,"start")),o=Po(k=>{if(s){if(k>=y)return m(1,0),Vi(n,!0,"end"),a(),s=!1;if(k>=g){const w=h((k-g)/d);m(w,1-w)}}return s})}let f=!1;return{start(){f||(f=!0,ll(n),Wt(i)?(i=i(),oa().then(u)):u())},invalidate(){f=!1},end(){s&&(a(),s=!1)}}}function dm(n,e,t){let i=e(n,t),s=!0,l;const o=qn;o.r+=1;function r(){const{delay:a=0,duration:u=300,easing:f=bl,tick:c=x,css:d}=i||ra;d&&(l=sl(n,1,0,u,a,f,d));const h=Io()+a,m=h+u;Qe(()=>Vi(n,!1,"start")),Po(b=>{if(s){if(b>=m)return c(0,1),Vi(n,!1,"end"),--o.r||Re(o.c),!1;if(b>=h){const g=f((b-h)/u);c(1-g,g)}}return s})}return Wt(i)?oa().then(()=>{i=i(),r()}):r(),{end(a){a&&i.tick&&i.tick(1,0),s&&(l&&ll(n,l),s=!1)}}}function je(n,e,t,i){let s=e(n,t),l=i?0:1,o=null,r=null,a=null;function u(){a&&ll(n,a)}function f(d,h){const m=d.b-l;return h*=Math.abs(m),{a:l,b:d.b,d:m,duration:h,start:d.start,end:d.start+h,group:d.group}}function c(d){const{delay:h=0,duration:m=300,easing:b=bl,tick:g=x,css:y}=s||ra,k={start:Io()+h,b:d};d||(k.group=qn,qn.r+=1),o||r?r=k:(y&&(u(),a=sl(n,l,d,m,h,b,y)),d&&g(0,1),o=f(k,m),Qe(()=>Vi(n,d,"start")),Po(w=>{if(r&&w>r.start&&(o=f(r,m),r=null,Vi(n,o.b,"start"),y&&(u(),a=sl(n,l,o.b,o.duration,0,b,s.css))),o){if(w>=o.end)g(l=o.b,1-l),Vi(n,o.b,"end"),r||(o.b?u():--o.group.r||Re(o.group.c)),o=null;else if(w>=o.start){const C=w-o.start;l=o.a+o.d*b(C/o.duration),g(l,1-l)}}return!!(o||r)}))}return{run(d){Wt(s)?oa().then(()=>{s=s(),c(d)}):c(d)},end(){u(),o=r=null}}}function xa(n,e){const t=e.token={};function i(s,l,o,r){if(e.token!==t)return;e.resolved=r;let a=e.ctx;o!==void 0&&(a=a.slice(),a[o]=r);const u=s&&(e.current=s)(a);let f=!1;e.block&&(e.blocks?e.blocks.forEach((c,d)=>{d!==l&&c&&(be(),I(c,1,1,()=>{e.blocks[d]===c&&(e.blocks[d]=null)}),ve())}):e.block.d(1),u.c(),E(u,1),u.m(e.mount(),e.anchor),f=!0),e.block=u,e.blocks&&(e.blocks[l]=u),f&&la()}if(j_(n)){const s=vl();if(n.then(l=>{ni(s),i(e.then,1,e.value,l),ni(null)},l=>{if(ni(s),i(e.catch,2,e.error,l),ni(null),!e.hasCatch)throw l}),e.current!==e.pending)return i(e.pending,0),!0}else{if(e.current!==e.then)return i(e.then,1,e.value,n),!0;e.resolved=n}}function x_(n,e,t){const i=e.slice(),{resolved:s}=n;n.current===n.then&&(i[n.value]=s),n.current===n.catch&&(i[n.error]=s),n.block.p(i,t)}function Gi(n,e){n.d(1),e.delete(n.key)}function xt(n,e){I(n,1,1,()=>{e.delete(n.key)})}function e0(n,e){n.f(),xt(n,e)}function bt(n,e,t,i,s,l,o,r,a,u,f,c){let d=n.length,h=l.length,m=d;const b={};for(;m--;)b[n[m].key]=m;const g=[],y=new Map,k=new Map;for(m=h;m--;){const T=c(s,l,m),D=t(T);let A=o.get(D);A?i&&A.p(T,e):(A=u(D,T),A.c()),y.set(D,g[m]=A),D in b&&k.set(D,Math.abs(m-b[D]))}const w=new Set,C=new Set;function M(T){E(T,1),T.m(r,f),o.set(T.key,T),f=T.first,h--}for(;d&&h;){const T=g[h-1],D=n[d-1],A=T.key,P=D.key;T===D?(f=T.first,d--,h--):y.has(P)?!o.has(A)||w.has(A)?M(T):C.has(P)?d--:k.get(A)>k.get(P)?(C.add(A),M(T)):(w.add(P),d--):(a(D,o),d--)}for(;d--;){const T=n[d];y.has(T.key)||a(T,o)}for(;h;)M(g[h-1]);return g}function Ut(n,e){const t={},i={},s={$$scope:1};let l=n.length;for(;l--;){const o=n[l],r=e[l];if(r){for(const a in o)a in r||(i[a]=1);for(const a in r)s[a]||(t[a]=r[a],s[a]=1);n[l]=r}else for(const a in o)s[a]=1}for(const o in i)o in t||(t[o]=void 0);return t}function Kn(n){return typeof n=="object"&&n!==null?n:{}}function ke(n,e,t){const i=n.$$.props[e];i!==void 0&&(n.$$.bound[i]=t,t(n.$$.ctx[i]))}function j(n){n&&n.c()}function R(n,e,t,i){const{fragment:s,after_update:l}=n.$$;s&&s.m(e,t),i||Qe(()=>{const o=n.$$.on_mount.map(tm).filter(Wt);n.$$.on_destroy?n.$$.on_destroy.push(...o):Re(o),n.$$.on_mount=[]}),l.forEach(Qe)}function H(n,e){const t=n.$$;t.fragment!==null&&(Re(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function t0(n,e){n.$$.dirty[0]===-1&&(Us.push(n),fm(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<{const m=h.length?h[0]:d;return u.ctx&&s(u.ctx[c],u.ctx[c]=m)&&(!u.skip_bound&&u.bound[c]&&u.bound[c](m),f&&t0(n,c)),d}):[],u.update(),f=!0,Re(u.before_update),u.fragment=i?i(u.ctx):!1,e.target){if(e.hydrate){const c=W_(e.target);u.fragment&&u.fragment.l(c),c.forEach(S)}else u.fragment&&u.fragment.c();e.intro&&E(n.$$.fragment),R(n,e.target,e.anchor,e.customElement),la()}ni(a)}class Me{$destroy(){H(this,1),this.$destroy=x}$on(e,t){if(!Wt(t))return x;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}$set(e){this.$$set&&!q_(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function vt(n){if(!n)throw Error("Parameter args is required");if(!n.component==!n.asyncComponent)throw Error("One and only one of component and asyncComponent is required");if(n.component&&(n.asyncComponent=()=>Promise.resolve(n.component)),typeof n.asyncComponent!="function")throw Error("Parameter asyncComponent must be a function");if(n.conditions){Array.isArray(n.conditions)||(n.conditions=[n.conditions]);for(let t=0;t{i.delete(u),i.size===0&&(t(),t=null)}}return{set:s,update:l,subscribe:o}}function hm(n,e,t){const i=!Array.isArray(n),s=i?[n]:n,l=e.length<2;return pm(t,o=>{let r=!1;const a=[];let u=0,f=x;const c=()=>{if(u)return;f();const h=e(i?a[0]:a,o);l?o(h):f=Wt(h)?h:x},d=s.map((h,m)=>nm(h,b=>{a[m]=b,u&=~(1<{u|=1<{H(f,1)}),ve()}l?(e=Qt(l,o()),e.$on("routeEvent",r[7]),j(e.$$.fragment),E(e.$$.fragment,1),R(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&E(e.$$.fragment,r),i=!0)},o(r){e&&I(e.$$.fragment,r),i=!1},d(r){r&&S(t),e&&H(e,r)}}}function i0(n){let e,t,i;const s=[{params:n[1]},n[2]];var l=n[0];function o(r){let a={};for(let u=0;u{H(f,1)}),ve()}l?(e=Qt(l,o()),e.$on("routeEvent",r[6]),j(e.$$.fragment),E(e.$$.fragment,1),R(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&E(e.$$.fragment,r),i=!0)},o(r){e&&I(e.$$.fragment,r),i=!1},d(r){r&&S(t),e&&H(e,r)}}}function s0(n){let e,t,i,s;const l=[i0,n0],o=[];function r(a,u){return a[1]?0:1}return e=r(n),t=o[e]=l[e](n),{c(){t.c(),i=Fe()},m(a,u){o[e].m(a,u),$(a,i,u),s=!0},p(a,[u]){let f=e;e=r(a),e===f?o[e].p(a,u):(be(),I(o[f],1,1,()=>{o[f]=null}),ve(),t=o[e],t?t.p(a,u):(t=o[e]=l[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){s||(E(t),s=!0)},o(a){I(t),s=!1},d(a){o[e].d(a),a&&S(i)}}}function eu(){const n=window.location.href.indexOf("#/");let e=n>-1?window.location.href.substr(n+1):"/";const t=e.indexOf("?");let i="";return t>-1&&(i=e.substr(t+1),e=e.substr(0,t)),{location:e,querystring:i}}const Lo=pm(null,function(e){e(eu());const t=()=>{e(eu())};return window.addEventListener("hashchange",t,!1),function(){window.removeEventListener("hashchange",t,!1)}});hm(Lo,n=>n.location);const aa=hm(Lo,n=>n.querystring),tu=Cn(void 0);async function ki(n){if(!n||n.length<1||n.charAt(0)!="/"&&n.indexOf("#/")!==0)throw Error("Invalid parameter location");await $n();const e=(n.charAt(0)=="#"?"":"#")+n;try{const t={...history.state};delete t.__svelte_spa_router_scrollX,delete t.__svelte_spa_router_scrollY,window.history.replaceState(t,void 0,e)}catch{console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}function Vt(n,e){if(e=iu(e),!n||!n.tagName||n.tagName.toLowerCase()!="a")throw Error('Action "link" can only be used with tags');return nu(n,e),{update(t){t=iu(t),nu(n,t)}}}function l0(n){n?window.scrollTo(n.__svelte_spa_router_scrollX,n.__svelte_spa_router_scrollY):window.scrollTo(0,0)}function nu(n,e){let t=e.href||n.getAttribute("href");if(t&&t.charAt(0)=="/")t="#"+t;else if(!t||t.length<2||t.slice(0,2)!="#/")throw Error('Invalid value for "href" attribute: '+t);n.setAttribute("href",t),n.addEventListener("click",i=>{i.preventDefault(),e.disabled||o0(i.currentTarget.getAttribute("href"))})}function iu(n){return n&&typeof n=="string"?{href:n}:n||{}}function o0(n){history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},void 0),window.location.hash=n}function r0(n,e,t){let{routes:i={}}=e,{prefix:s=""}=e,{restoreScrollState:l=!1}=e;class o{constructor(M,T){if(!T||typeof T!="function"&&(typeof T!="object"||T._sveltesparouter!==!0))throw Error("Invalid component object");if(!M||typeof M=="string"&&(M.length<1||M.charAt(0)!="/"&&M.charAt(0)!="*")||typeof M=="object"&&!(M instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:D,keys:A}=mm(M);this.path=M,typeof T=="object"&&T._sveltesparouter===!0?(this.component=T.component,this.conditions=T.conditions||[],this.userData=T.userData,this.props=T.props||{}):(this.component=()=>Promise.resolve(T),this.conditions=[],this.props={}),this._pattern=D,this._keys=A}match(M){if(s){if(typeof s=="string")if(M.startsWith(s))M=M.substr(s.length)||"/";else return null;else if(s instanceof RegExp){const P=M.match(s);if(P&&P[0])M=M.substr(P[0].length)||"/";else return null}}const T=this._pattern.exec(M);if(T===null)return null;if(this._keys===!1)return T;const D={};let A=0;for(;A{r.push(new o(M,C))}):Object.keys(i).forEach(C=>{r.push(new o(C,i[C]))});let a=null,u=null,f={};const c=It();async function d(C,M){await $n(),c(C,M)}let h=null,m=null;l&&(m=C=>{C.state&&(C.state.__svelte_spa_router_scrollY||C.state.__svelte_spa_router_scrollX)?h=C.state:h=null},window.addEventListener("popstate",m),G_(()=>{l0(h)}));let b=null,g=null;const y=Lo.subscribe(async C=>{b=C;let M=0;for(;M{tu.set(u)});return}t(0,a=null),g=null,tu.set(void 0)});X_(()=>{y(),m&&window.removeEventListener("popstate",m)});function k(C){Ve.call(this,n,C)}function w(C){Ve.call(this,n,C)}return n.$$set=C=>{"routes"in C&&t(3,i=C.routes),"prefix"in C&&t(4,s=C.prefix),"restoreScrollState"in C&&t(5,l=C.restoreScrollState)},n.$$.update=()=>{n.$$.dirty&32&&(history.scrollRestoration=l?"manual":"auto")},[a,u,f,i,s,l,k,w]}class a0 extends Me{constructor(e){super(),Ce(this,e,r0,s0,we,{routes:3,prefix:4,restoreScrollState:5})}}const lo=[];let gm;function _m(n){const e=n.pattern.test(gm);su(n,n.className,e),su(n,n.inactiveClassName,!e)}function su(n,e,t){(e||"").split(" ").forEach(i=>{!i||(n.node.classList.remove(i),t&&n.node.classList.add(i))})}Lo.subscribe(n=>{gm=n.location+(n.querystring?"?"+n.querystring:""),lo.map(_m)});function On(n,e){if(e&&(typeof e=="string"||typeof e=="object"&&e instanceof RegExp)?e={path:e}:e=e||{},!e.path&&n.hasAttribute("href")&&(e.path=n.getAttribute("href"),e.path&&e.path.length>1&&e.path.charAt(0)=="#"&&(e.path=e.path.substring(1))),e.className||(e.className="active"),!e.path||typeof e.path=="string"&&(e.path.length<1||e.path.charAt(0)!="/"&&e.path.charAt(0)!="*"))throw Error('Invalid value for "path" argument');const{pattern:t}=typeof e.path=="string"?mm(e.path):{pattern:e.path},i={node:n,className:e.className,inactiveClassName:e.inactiveClassName,pattern:t};return lo.push(i),_m(i),{destroy(){lo.splice(lo.indexOf(i),1)}}}const u0="modulepreload",f0=function(n,e){return new URL(n,e).href},lu={},st=function(e,t,i){if(!t||t.length===0)return e();const s=document.getElementsByTagName("link");return Promise.all(t.map(l=>{if(l=f0(l,i),l in lu)return;lu[l]=!0;const o=l.endsWith(".css"),r=o?'[rel="stylesheet"]':"";if(!!i)for(let f=s.length-1;f>=0;f--){const c=s[f];if(c.href===l&&(!o||c.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${r}`))return;const u=document.createElement("link");if(u.rel=o?"stylesheet":u0,o||(u.as="script",u.crossOrigin=""),u.href=l,document.head.appendChild(u),o)return new Promise((f,c)=>{u.addEventListener("load",f),u.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${l}`)))})})).then(()=>e())};var Or=function(n,e){return Or=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])},Or(n,e)};function Bt(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}Or(n,e),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Dr=function(){return Dr=Object.assign||function(n){for(var e,t=1,i=arguments.length;t0&&s[s.length-1])||f[0]!==6&&f[0]!==2)){o=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]>(-2*s&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};var yl=function(){function n(e){e===void 0&&(e={}),this.load(e||{})}return n.prototype.load=function(e){for(var t=0,i=Object.entries(e);t0&&(!i.exp||i.exp-t>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),n.prototype.save=function(e,t){this.baseToken=e||"",this.baseModel=t!==null&&typeof t=="object"?t.collectionId!==void 0?new Ui(t):new Yi(t):null,this.triggerChange()},n.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},n.prototype.loadFromCookie=function(e,t){t===void 0&&(t="pb_auth");var i=function(l,o){var r={};if(typeof l!="string")return r;for(var a=Object.assign({},o||{}).decode||c0,u=0;u4096&&(a.model={id:(s=a==null?void 0:a.model)===null||s===void 0?void 0:s.id,email:(l=a==null?void 0:a.model)===null||l===void 0?void 0:l.email},this.model instanceof Ui&&(a.model.username=this.model.username,a.model.verified=this.model.verified,a.model.collectionId=this.model.collectionId),u=ou(t,JSON.stringify(a),e)),u},n.prototype.onChange=function(e,t){var i=this;return t===void 0&&(t=!1),this._onChangeCallbacks.push(e),t&&e(this.token,this.model),function(){for(var s=i._onChangeCallbacks.length-1;s>=0;s--)if(i._onChangeCallbacks[s]==e)return delete i._onChangeCallbacks[s],void i._onChangeCallbacks.splice(s,1)}},n.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?n:1,this.perPage=e>=0?e:0,this.totalItems=t>=0?t:0,this.totalPages=i>=0?i:0,this.items=s||[]},ua=function(n){function e(){return n!==null&&n.apply(this,arguments)||this}return Bt(e,n),e.prototype.getFullList=function(t,i){return t===void 0&&(t=200),i===void 0&&(i={}),this._getFullList(this.baseCrudPath,t,i)},e.prototype.getList=function(t,i,s){return t===void 0&&(t=1),i===void 0&&(i=30),s===void 0&&(s={}),this._getList(this.baseCrudPath,t,i,s)},e.prototype.getFirstListItem=function(t,i){return i===void 0&&(i={}),this._getFirstListItem(this.baseCrudPath,t,i)},e.prototype.getOne=function(t,i){return i===void 0&&(i={}),this._getOne(this.baseCrudPath,t,i)},e.prototype.create=function(t,i){return t===void 0&&(t={}),i===void 0&&(i={}),this._create(this.baseCrudPath,t,i)},e.prototype.update=function(t,i,s){return i===void 0&&(i={}),s===void 0&&(s={}),this._update(this.baseCrudPath,t,i,s)},e.prototype.delete=function(t,i){return i===void 0&&(i={}),this._delete(this.baseCrudPath,t,i)},e}(function(n){function e(){return n!==null&&n.apply(this,arguments)||this}return Bt(e,n),e.prototype._getFullList=function(t,i,s){var l=this;i===void 0&&(i=100),s===void 0&&(s={});var o=[],r=function(a){return Dn(l,void 0,void 0,function(){return En(this,function(u){return[2,this._getList(t,a,i,s).then(function(f){var c=f,d=c.items,h=c.totalItems;return o=o.concat(d),d.length&&h>o.length?r(a+1):o})]})})};return r(1)},e.prototype._getList=function(t,i,s,l){var o=this;return i===void 0&&(i=1),s===void 0&&(s=30),l===void 0&&(l={}),l=Object.assign({page:i,perPage:s},l),this.client.send(t,{method:"GET",params:l}).then(function(r){var a=[];if(r!=null&&r.items){r.items=r.items||[];for(var u=0,f=r.items;u=400)throw new Er({url:k.url,status:k.status,data:w});return[2,w]}})})}).catch(function(k){throw new Er(k)})]})})},n.prototype.getFileUrl=function(e,t,i){i===void 0&&(i={});var s=[];s.push("api"),s.push("files"),s.push(encodeURIComponent(e.collectionId||e.collectionName)),s.push(encodeURIComponent(e.id)),s.push(encodeURIComponent(t));var l=this.buildUrl(s.join("/"));if(Object.keys(i).length){var o=new URLSearchParams(i);l+=(l.includes("?")?"&":"?")+o}return l},n.prototype.buildUrl=function(e){var t=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return e&&(t+=e.startsWith("/")?e.substring(1):e),t},n.prototype.serializeQueryParams=function(e){var t=[];for(var i in e)if(e[i]!==null){var s=e[i],l=encodeURIComponent(i);if(Array.isArray(s))for(var o=0,r=s;o"u"}function zi(n){return typeof n=="number"}function Fo(n){return typeof n=="number"&&n%1===0}function M0(n){return typeof n=="string"}function T0(n){return Object.prototype.toString.call(n)==="[object Date]"}function Vm(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function O0(n){return Array.isArray(n)?n:[n]}function au(n,e,t){if(n.length!==0)return n.reduce((i,s)=>{const l=[e(s),s];return i&&t(i[0],l[0])===i[0]?i:l},null)[1]}function D0(n,e){return e.reduce((t,i)=>(t[i]=n[i],t),{})}function ys(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function ii(n,e,t){return Fo(n)&&n>=e&&n<=t}function E0(n,e){return n-e*Math.floor(n/e)}function yt(n,e=2){const t=n<0;let i;return t?i="-"+(""+-n).padStart(e,"0"):i=(""+n).padStart(e,"0"),i}function di(n){if(!(Ze(n)||n===null||n===""))return parseInt(n,10)}function Ei(n){if(!(Ze(n)||n===null||n===""))return parseFloat(n)}function ca(n){if(!(Ze(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function da(n,e,t=!1){const i=10**e;return(t?Math.trunc:Math.round)(n*i)/i}function kl(n){return n%4===0&&(n%100!==0||n%400===0)}function Gs(n){return kl(n)?366:365}function po(n,e){const t=E0(e-1,12)+1,i=n+(e-t)/12;return t===2?kl(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function pa(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(e.getUTCFullYear()-1900)),+e}function ho(n){const e=(n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400))%7,t=n-1,i=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7;return e===4||i===3?53:52}function Pr(n){return n>99?n:n>60?1900+n:2e3+n}function zm(n,e,t,i=null){const s=new Date(n),l={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};i&&(l.timeZone=i);const o={timeZoneName:e,...l},r=new Intl.DateTimeFormat(t,o).formatToParts(s).find(a=>a.type.toLowerCase()==="timezonename");return r?r.value:null}function Ro(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const i=parseInt(e,10)||0,s=t<0||Object.is(t,-0)?-i:i;return t*60+s}function Bm(n){const e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new _n(`Invalid unit value ${n}`);return e}function mo(n,e){const t={};for(const i in n)if(ys(n,i)){const s=n[i];if(s==null)continue;t[e(i)]=Bm(s)}return t}function Xs(n,e){const t=Math.trunc(Math.abs(n/60)),i=Math.trunc(Math.abs(n%60)),s=n>=0?"+":"-";switch(e){case"short":return`${s}${yt(t,2)}:${yt(i,2)}`;case"narrow":return`${s}${t}${i>0?`:${i}`:""}`;case"techie":return`${s}${yt(t,2)}${yt(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Ho(n){return D0(n,["hour","minute","second","millisecond"])}const Wm=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/,A0=["January","February","March","April","May","June","July","August","September","October","November","December"],Um=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],I0=["J","F","M","A","M","J","J","A","S","O","N","D"];function Ym(n){switch(n){case"narrow":return[...I0];case"short":return[...Um];case"long":return[...A0];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Km=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Jm=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],P0=["M","T","W","T","F","S","S"];function Zm(n){switch(n){case"narrow":return[...P0];case"short":return[...Jm];case"long":return[...Km];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Gm=["AM","PM"],L0=["Before Christ","Anno Domini"],N0=["BC","AD"],F0=["B","A"];function Xm(n){switch(n){case"narrow":return[...F0];case"short":return[...N0];case"long":return[...L0];default:return null}}function R0(n){return Gm[n.hour<12?0:1]}function H0(n,e){return Zm(e)[n.weekday-1]}function j0(n,e){return Ym(e)[n.month-1]}function q0(n,e){return Xm(e)[n.year<0?0:1]}function V0(n,e,t="always",i=!1){const s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},l=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&l){const c=n==="days";switch(e){case 1:return c?"tomorrow":`next ${s[n][0]}`;case-1:return c?"yesterday":`last ${s[n][0]}`;case 0:return c?"today":`this ${s[n][0]}`}}const o=Object.is(e,-0)||e<0,r=Math.abs(e),a=r===1,u=s[n],f=i?a?u[1]:u[2]||u[1]:a?s[n][0]:n;return o?`${r} ${f} ago`:`in ${r} ${f}`}function uu(n,e){let t="";for(const i of n)i.literal?t+=i.val:t+=e(i.val);return t}const z0={D:Ir,DD:wm,DDD:Sm,DDDD:$m,t:Cm,tt:Mm,ttt:Tm,tttt:Om,T:Dm,TT:Em,TTT:Am,TTTT:Im,f:Pm,ff:Nm,fff:Rm,ffff:jm,F:Lm,FF:Fm,FFF:Hm,FFFF:qm};class Xt{static create(e,t={}){return new Xt(e,t)}static parseFormat(e){let t=null,i="",s=!1;const l=[];for(let o=0;o0&&l.push({literal:s,val:i}),t=null,i="",s=!s):s||r===t?i+=r:(i.length>0&&l.push({literal:!1,val:i}),i=r,t=r)}return i.length>0&&l.push({literal:s,val:i}),l}static macroTokenToFormatOpts(e){return z0[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}formatDateTime(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t}).format()}formatDateTimeParts(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t}).formatToParts()}resolvedOptions(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t}).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return yt(e,t);const i={...this.opts};return t>0&&(i.padTo=t),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){const i=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",l=(h,m)=>this.loc.extract(e,h,m),o=h=>e.isOffsetFixed&&e.offset===0&&h.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,h.format):"",r=()=>i?R0(e):l({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(h,m)=>i?j0(e,h):l(m?{month:h}:{month:h,day:"numeric"},"month"),u=(h,m)=>i?H0(e,h):l(m?{weekday:h}:{weekday:h,month:"long",day:"numeric"},"weekday"),f=h=>{const m=Xt.macroTokenToFormatOpts(h);return m?this.formatWithSystemDefault(e,m):h},c=h=>i?q0(e,h):l({era:h},"era"),d=h=>{switch(h){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return r();case"d":return s?l({day:"numeric"},"day"):this.num(e.day);case"dd":return s?l({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return s?l({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?l({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return s?l({month:"numeric"},"month"):this.num(e.month);case"MM":return s?l({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return s?l({year:"numeric"},"year"):this.num(e.year);case"yy":return s?l({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?l({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?l({year:"numeric"},"year"):this.num(e.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return f(h)}};return uu(Xt.parseFormat(t),d)}formatDurationFromString(e,t){const i=a=>{switch(a[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},s=a=>u=>{const f=i(u);return f?this.num(a.get(f),u.length):u},l=Xt.parseFormat(t),o=l.reduce((a,{literal:u,val:f})=>u?a:a.concat(f),[]),r=e.shiftTo(...o.map(i).filter(a=>a));return uu(l,s(r))}}class An{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}class wl{get type(){throw new fi}get name(){throw new fi}get ianaName(){return this.name}get isUniversal(){throw new fi}offsetName(e,t){throw new fi}formatOffset(e,t){throw new fi}offset(e){throw new fi}equals(e){throw new fi}get isValid(){throw new fi}}let Go=null;class ha extends wl{static get instance(){return Go===null&&(Go=new ha),Go}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:i}){return zm(e,t,i)}formatOffset(e,t){return Xs(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let oo={};function B0(n){return oo[n]||(oo[n]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),oo[n]}const W0={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function U0(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,l,o,r,a,u,f]=i;return[o,s,l,r,a,u,f]}function Y0(n,e){const t=n.formatToParts(e),i=[];for(let s=0;s=0?m:1e3+m,(d-h)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Xo=null;class zt extends wl{static get utcInstance(){return Xo===null&&(Xo=new zt(0)),Xo}static instance(e){return e===0?zt.utcInstance:new zt(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new zt(Ro(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Xs(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Xs(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Xs(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class K0 extends wl{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function pi(n,e){if(Ze(n)||n===null)return e;if(n instanceof wl)return n;if(M0(n)){const t=n.toLowerCase();return t==="local"||t==="system"?e:t==="utc"||t==="gmt"?zt.utcInstance:zt.parseSpecifier(t)||si.create(n)}else return zi(n)?zt.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new K0(n)}let fu=()=>Date.now(),cu="system",du=null,pu=null,hu=null,mu;class Mt{static get now(){return fu}static set now(e){fu=e}static set defaultZone(e){cu=e}static get defaultZone(){return pi(cu,ha.instance)}static get defaultLocale(){return du}static set defaultLocale(e){du=e}static get defaultNumberingSystem(){return pu}static set defaultNumberingSystem(e){pu=e}static get defaultOutputCalendar(){return hu}static set defaultOutputCalendar(e){hu=e}static get throwOnInvalid(){return mu}static set throwOnInvalid(e){mu=e}static resetCaches(){ct.resetCache(),si.resetCache()}}let gu={};function J0(n,e={}){const t=JSON.stringify([n,e]);let i=gu[t];return i||(i=new Intl.ListFormat(n,e),gu[t]=i),i}let Lr={};function Nr(n,e={}){const t=JSON.stringify([n,e]);let i=Lr[t];return i||(i=new Intl.DateTimeFormat(n,e),Lr[t]=i),i}let Fr={};function Z0(n,e={}){const t=JSON.stringify([n,e]);let i=Fr[t];return i||(i=new Intl.NumberFormat(n,e),Fr[t]=i),i}let Rr={};function G0(n,e={}){const{base:t,...i}=e,s=JSON.stringify([n,i]);let l=Rr[s];return l||(l=new Intl.RelativeTimeFormat(n,e),Rr[s]=l),l}let Ks=null;function X0(){return Ks||(Ks=new Intl.DateTimeFormat().resolvedOptions().locale,Ks)}function Q0(n){const e=n.indexOf("-u-");if(e===-1)return[n];{let t;const i=n.substring(0,e);try{t=Nr(n).resolvedOptions()}catch{t=Nr(i).resolvedOptions()}const{numberingSystem:s,calendar:l}=t;return[i,s,l]}}function x0(n,e,t){return(t||e)&&(n+="-u",t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function eb(n){const e=[];for(let t=1;t<=12;t++){const i=He.utc(2016,t,1);e.push(n(i))}return e}function tb(n){const e=[];for(let t=1;t<=7;t++){const i=He.utc(2016,11,13+t);e.push(n(i))}return e}function Rl(n,e,t,i,s){const l=n.listingMode(t);return l==="error"?null:l==="en"?i(e):s(e)}function nb(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||new Intl.DateTimeFormat(n.intl).resolvedOptions().numberingSystem==="latn"}class ib{constructor(e,t,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:s,floor:l,...o}=i;if(!t||Object.keys(o).length>0){const r={useGrouping:!1,...i};i.padTo>0&&(r.minimumIntegerDigits=i.padTo),this.inf=Z0(e,r)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):da(e,3);return yt(t,this.padTo)}}}class sb{constructor(e,t,i){this.opts=i;let s;if(e.zone.isUniversal){const o=-1*(e.offset/60),r=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&si.create(r).valid?(s=r,this.dt=e):(s="UTC",i.timeZoneName?this.dt=e:this.dt=e.offset===0?e:He.fromMillis(e.ts+e.offset*60*1e3))}else e.zone.type==="system"?this.dt=e:(this.dt=e,s=e.zone.name);const l={...this.opts};s&&(l.timeZone=s),this.dtf=Nr(t,l)}format(){return this.dtf.format(this.dt.toJSDate())}formatToParts(){return this.dtf.formatToParts(this.dt.toJSDate())}resolvedOptions(){return this.dtf.resolvedOptions()}}class lb{constructor(e,t,i){this.opts={style:"long",...i},!t&&Vm()&&(this.rtf=G0(e,i))}format(e,t){return this.rtf?this.rtf.format(e,t):V0(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}class ct{static fromOpts(e){return ct.create(e.locale,e.numberingSystem,e.outputCalendar,e.defaultToEN)}static create(e,t,i,s=!1){const l=e||Mt.defaultLocale,o=l||(s?"en-US":X0()),r=t||Mt.defaultNumberingSystem,a=i||Mt.defaultOutputCalendar;return new ct(o,r,a,l)}static resetCache(){Ks=null,Lr={},Fr={},Rr={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:i}={}){return ct.create(e,t,i)}constructor(e,t,i,s){const[l,o,r]=Q0(e);this.locale=l,this.numberingSystem=t||o||null,this.outputCalendar=i||r||null,this.intl=x0(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=nb(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:ct.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1,i=!0){return Rl(this,e,i,Ym,()=>{const s=t?{month:e,day:"numeric"}:{month:e},l=t?"format":"standalone";return this.monthsCache[l][e]||(this.monthsCache[l][e]=eb(o=>this.extract(o,s,"month"))),this.monthsCache[l][e]})}weekdays(e,t=!1,i=!0){return Rl(this,e,i,Zm,()=>{const s=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},l=t?"format":"standalone";return this.weekdaysCache[l][e]||(this.weekdaysCache[l][e]=tb(o=>this.extract(o,s,"weekday"))),this.weekdaysCache[l][e]})}meridiems(e=!0){return Rl(this,void 0,e,()=>Gm,()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[He.utc(2016,11,13,9),He.utc(2016,11,13,19)].map(i=>this.extract(i,t,"dayperiod"))}return this.meridiemCache})}eras(e,t=!0){return Rl(this,e,t,Xm,()=>{const i={era:e};return this.eraCache[e]||(this.eraCache[e]=[He.utc(-40,1,1),He.utc(2017,1,1)].map(s=>this.extract(s,i,"era"))),this.eraCache[e]})}extract(e,t,i){const s=this.dtFormatter(e,t),l=s.formatToParts(),o=l.find(r=>r.type.toLowerCase()===i);return o?o.value:null}numberFormatter(e={}){return new ib(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new sb(e,this.intl,t)}relFormatter(e={}){return new lb(this.intl,this.isEnglish(),e)}listFormatter(e={}){return J0(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}function Ms(...n){const e=n.reduce((t,i)=>t+i.source,"");return RegExp(`^${e}$`)}function Ts(...n){return e=>n.reduce(([t,i,s],l)=>{const[o,r,a]=l(e,s);return[{...t,...o},r||i,a]},[{},null,1]).slice(0,2)}function Os(n,...e){if(n==null)return[null,null];for(const[t,i]of e){const s=t.exec(n);if(s)return i(s)}return[null,null]}function Qm(...n){return(e,t)=>{const i={};let s;for(s=0;sh!==void 0&&(m||h&&f)?-h:h;return[{years:d(Ei(t)),months:d(Ei(i)),weeks:d(Ei(s)),days:d(Ei(l)),hours:d(Ei(o)),minutes:d(Ei(r)),seconds:d(Ei(a),a==="-0"),milliseconds:d(ca(u),c)}]}const bb={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function _a(n,e,t,i,s,l,o){const r={year:e.length===2?Pr(di(e)):di(e),month:Um.indexOf(t)+1,day:di(i),hour:di(s),minute:di(l)};return o&&(r.second=di(o)),n&&(r.weekday=n.length>3?Km.indexOf(n)+1:Jm.indexOf(n)+1),r}const vb=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function yb(n){const[,e,t,i,s,l,o,r,a,u,f,c]=n,d=_a(e,s,i,t,l,o,r);let h;return a?h=bb[a]:u?h=0:h=Ro(f,c),[d,new zt(h)]}function kb(n){return n.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const wb=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Sb=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,$b=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function _u(n){const[,e,t,i,s,l,o,r]=n;return[_a(e,s,i,t,l,o,r),zt.utcInstance]}function Cb(n){const[,e,t,i,s,l,o,r]=n;return[_a(e,r,t,i,s,l,o),zt.utcInstance]}const Mb=Ms(rb,ga),Tb=Ms(ab,ga),Ob=Ms(ub,ga),Db=Ms(eg),ng=Ts(hb,Ds,Sl,$l),Eb=Ts(fb,Ds,Sl,$l),Ab=Ts(cb,Ds,Sl,$l),Ib=Ts(Ds,Sl,$l);function Pb(n){return Os(n,[Mb,ng],[Tb,Eb],[Ob,Ab],[Db,Ib])}function Lb(n){return Os(kb(n),[vb,yb])}function Nb(n){return Os(n,[wb,_u],[Sb,_u],[$b,Cb])}function Fb(n){return Os(n,[gb,_b])}const Rb=Ts(Ds);function Hb(n){return Os(n,[mb,Rb])}const jb=Ms(db,pb),qb=Ms(tg),Vb=Ts(Ds,Sl,$l);function zb(n){return Os(n,[jb,ng],[qb,Vb])}const Bb="Invalid Duration",ig={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},Wb={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...ig},dn=146097/400,as=146097/4800,Ub={years:{quarters:4,months:12,weeks:dn/7,days:dn,hours:dn*24,minutes:dn*24*60,seconds:dn*24*60*60,milliseconds:dn*24*60*60*1e3},quarters:{months:3,weeks:dn/28,days:dn/4,hours:dn*24/4,minutes:dn*24*60/4,seconds:dn*24*60*60/4,milliseconds:dn*24*60*60*1e3/4},months:{weeks:as/7,days:as,hours:as*24,minutes:as*24*60,seconds:as*24*60*60,milliseconds:as*24*60*60*1e3},...ig},Fi=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Yb=Fi.slice(0).reverse();function Ai(n,e,t=!1){const i={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy};return new xe(i)}function Kb(n){return n<0?Math.floor(n):Math.ceil(n)}function sg(n,e,t,i,s){const l=n[s][t],o=e[t]/l,r=Math.sign(o)===Math.sign(i[s]),a=!r&&i[s]!==0&&Math.abs(o)<=1?Kb(o):Math.trunc(o);i[s]+=a,e[t]-=a*l}function Jb(n,e){Yb.reduce((t,i)=>Ze(e[i])?t:(t&&sg(n,e,t,e,i),i),null)}class xe{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;this.values=e.values,this.loc=e.loc||ct.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=t?Ub:Wb,this.isLuxonDuration=!0}static fromMillis(e,t){return xe.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new _n(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new xe({values:mo(e,xe.normalizeUnit),loc:ct.fromObject(t),conversionAccuracy:t.conversionAccuracy})}static fromDurationLike(e){if(zi(e))return xe.fromMillis(e);if(xe.isDuration(e))return e;if(typeof e=="object")return xe.fromObject(e);throw new _n(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[i]=Fb(e);return i?xe.fromObject(i,t):xe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[i]=Hb(e);return i?xe.fromObject(i,t):xe.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new _n("need to specify a reason the Duration is invalid");const i=e instanceof An?e:new An(e,t);if(Mt.throwOnInvalid)throw new S0(i);return new xe({invalid:i})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new km(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const i={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?Xt.create(this.loc,i).formatDurationFromString(this,e):Bb}toHuman(e={}){const t=Fi.map(i=>{const s=this.values[i];return Ze(s)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(s)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=da(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();if(t<0||t>=864e5)return null;e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e};const i=this.shiftTo("hours","minutes","seconds","milliseconds");let s=e.format==="basic"?"hhmm":"hh:mm";(!e.suppressSeconds||i.seconds!==0||i.milliseconds!==0)&&(s+=e.format==="basic"?"ss":":ss",(!e.suppressMilliseconds||i.milliseconds!==0)&&(s+=".SSS"));let l=i.toFormat(s);return e.includePrefix&&(l="T"+l),l}toJSON(){return this.toISO()}toString(){return this.toISO()}toMillis(){return this.as("milliseconds")}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=xe.fromDurationLike(e),i={};for(const s of Fi)(ys(t.values,s)||ys(this.values,s))&&(i[s]=t.get(s)+this.get(s));return Ai(this,{values:i},!0)}minus(e){if(!this.isValid)return this;const t=xe.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const i of Object.keys(this.values))t[i]=Bm(e(this.values[i],i));return Ai(this,{values:t},!0)}get(e){return this[xe.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...mo(e,xe.normalizeUnit)};return Ai(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:i}={}){const s=this.loc.clone({locale:e,numberingSystem:t}),l={loc:s};return i&&(l.conversionAccuracy=i),Ai(this,l)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Jb(this.matrix,e),Ai(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>xe.normalizeUnit(o));const t={},i={},s=this.toObject();let l;for(const o of Fi)if(e.indexOf(o)>=0){l=o;let r=0;for(const u in i)r+=this.matrix[u][o]*i[u],i[u]=0;zi(s[o])&&(r+=s[o]);const a=Math.trunc(r);t[o]=a,i[o]=(r*1e3-a*1e3)/1e3;for(const u in s)Fi.indexOf(u)>Fi.indexOf(o)&&sg(this.matrix,s,u,t,o)}else zi(s[o])&&(i[o]=s[o]);for(const o in i)i[o]!==0&&(t[l]+=o===l?i[o]:i[o]/this.matrix[l][o]);return Ai(this,{values:t},!0).normalize()}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Ai(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(i,s){return i===void 0||i===0?s===void 0||s===0:i===s}for(const i of Fi)if(!t(this.values[i],e.values[i]))return!1;return!0}}const Ls="Invalid Interval";function Zb(n,e){return!n||!n.isValid?dt.invalid("missing or invalid start"):!e||!e.isValid?dt.invalid("missing or invalid end"):ee:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?dt.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Rs).filter(o=>this.contains(o)).sort(),i=[];let{s}=this,l=0;for(;s+this.e?this.e:o;i.push(dt.fromDateTimes(s,r)),s=r,l+=1}return i}splitBy(e){const t=xe.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:i}=this,s=1,l;const o=[];for(;ia*s));l=+r>+this.e?this.e:r,o.push(dt.fromDateTimes(i,l)),i=l,s+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,i=this.e=i?null:dt.fromDateTimes(t,i)}union(e){if(!this.isValid)return this;const t=this.se.e?this.e:e.e;return dt.fromDateTimes(t,i)}static merge(e){const[t,i]=e.sort((s,l)=>s.s-l.s).reduce(([s,l],o)=>l?l.overlaps(o)||l.abutsStart(o)?[s,l.union(o)]:[s.concat([l]),o]:[s,o],[[],null]);return i&&t.push(i),t}static xor(e){let t=null,i=0;const s=[],l=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...l),r=o.sort((a,u)=>a.time-u.time);for(const a of r)i+=a.type==="s"?1:-1,i===1?t=a.time:(t&&+t!=+a.time&&s.push(dt.fromDateTimes(t,a.time)),t=null);return dt.merge(s)}difference(...e){return dt.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Ls}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Ls}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Ls}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Ls}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Ls}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):xe.invalid(this.invalidReason)}mapEndpoints(e){return dt.fromDateTimes(e(this.s),e(this.e))}}class Hl{static hasDST(e=Mt.defaultZone){const t=He.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return si.isValidZone(e)}static normalizeZone(e){return pi(e,Mt.defaultZone)}static months(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null,outputCalendar:l="gregory"}={}){return(s||ct.create(t,i,l)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null,outputCalendar:l="gregory"}={}){return(s||ct.create(t,i,l)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null}={}){return(s||ct.create(t,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null}={}){return(s||ct.create(t,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return ct.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return ct.create(t,null,"gregory").eras(e)}static features(){return{relative:Vm()}}}function bu(n,e){const t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=t(e)-t(n);return Math.floor(xe.fromMillis(i).as("days"))}function Gb(n,e,t){const i=[["years",(r,a)=>a.year-r.year],["quarters",(r,a)=>a.quarter-r.quarter],["months",(r,a)=>a.month-r.month+(a.year-r.year)*12],["weeks",(r,a)=>{const u=bu(r,a);return(u-u%7)/7}],["days",bu]],s={};let l,o;for(const[r,a]of i)if(t.indexOf(r)>=0){l=r;let u=a(n,e);o=n.plus({[r]:u}),o>e?(n=n.plus({[r]:u-1}),u-=1):n=o,s[r]=u}return[n,s,o,l]}function Xb(n,e,t,i){let[s,l,o,r]=Gb(n,e,t);const a=e-s,u=t.filter(c=>["hours","minutes","seconds","milliseconds"].indexOf(c)>=0);u.length===0&&(o0?xe.fromMillis(a,i).shiftTo(...u).plus(f):f}const ba={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},vu={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},Qb=ba.hanidec.replace(/[\[|\]]/g,"").split("");function xb(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t=l&&i<=o&&(e+=i-l)}}return parseInt(e,10)}else return e}function Mn({numberingSystem:n},e=""){return new RegExp(`${ba[n||"latn"]}${e}`)}const e1="missing Intl.DateTimeFormat.formatToParts support";function et(n,e=t=>t){return{regex:n,deser:([t])=>e(xb(t))}}const t1=String.fromCharCode(160),lg=`[ ${t1}]`,og=new RegExp(lg,"g");function n1(n){return n.replace(/\./g,"\\.?").replace(og,lg)}function yu(n){return n.replace(/\./g,"").replace(og," ").toLowerCase()}function Tn(n,e){return n===null?null:{regex:RegExp(n.map(n1).join("|")),deser:([t])=>n.findIndex(i=>yu(t)===yu(i))+e}}function ku(n,e){return{regex:n,deser:([,t,i])=>Ro(t,i),groups:e}}function Qo(n){return{regex:n,deser:([e])=>e}}function i1(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function s1(n,e){const t=Mn(e),i=Mn(e,"{2}"),s=Mn(e,"{3}"),l=Mn(e,"{4}"),o=Mn(e,"{6}"),r=Mn(e,"{1,2}"),a=Mn(e,"{1,3}"),u=Mn(e,"{1,6}"),f=Mn(e,"{1,9}"),c=Mn(e,"{2,4}"),d=Mn(e,"{4,6}"),h=g=>({regex:RegExp(i1(g.val)),deser:([y])=>y,literal:!0}),b=(g=>{if(n.literal)return h(g);switch(g.val){case"G":return Tn(e.eras("short",!1),0);case"GG":return Tn(e.eras("long",!1),0);case"y":return et(u);case"yy":return et(c,Pr);case"yyyy":return et(l);case"yyyyy":return et(d);case"yyyyyy":return et(o);case"M":return et(r);case"MM":return et(i);case"MMM":return Tn(e.months("short",!0,!1),1);case"MMMM":return Tn(e.months("long",!0,!1),1);case"L":return et(r);case"LL":return et(i);case"LLL":return Tn(e.months("short",!1,!1),1);case"LLLL":return Tn(e.months("long",!1,!1),1);case"d":return et(r);case"dd":return et(i);case"o":return et(a);case"ooo":return et(s);case"HH":return et(i);case"H":return et(r);case"hh":return et(i);case"h":return et(r);case"mm":return et(i);case"m":return et(r);case"q":return et(r);case"qq":return et(i);case"s":return et(r);case"ss":return et(i);case"S":return et(a);case"SSS":return et(s);case"u":return Qo(f);case"uu":return Qo(r);case"uuu":return et(t);case"a":return Tn(e.meridiems(),0);case"kkkk":return et(l);case"kk":return et(c,Pr);case"W":return et(r);case"WW":return et(i);case"E":case"c":return et(t);case"EEE":return Tn(e.weekdays("short",!1,!1),1);case"EEEE":return Tn(e.weekdays("long",!1,!1),1);case"ccc":return Tn(e.weekdays("short",!0,!1),1);case"cccc":return Tn(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return ku(new RegExp(`([+-]${r.source})(?::(${i.source}))?`),2);case"ZZZ":return ku(new RegExp(`([+-]${r.source})(${i.source})?`),2);case"z":return Qo(/[a-z_+-/]{1,256}?/i);default:return h(g)}})(n)||{invalidReason:e1};return b.token=n,b}const l1={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour:{numeric:"h","2-digit":"hh"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"}};function o1(n,e,t){const{type:i,value:s}=n;if(i==="literal")return{literal:!0,val:s};const l=t[i];let o=l1[i];if(typeof o=="object"&&(o=o[l]),o)return{literal:!1,val:o}}function r1(n){return[`^${n.map(t=>t.regex).reduce((t,i)=>`${t}(${i.source})`,"")}$`,n]}function a1(n,e,t){const i=n.match(e);if(i){const s={};let l=1;for(const o in t)if(ys(t,o)){const r=t[o],a=r.groups?r.groups+1:1;!r.literal&&r.token&&(s[r.token.val[0]]=r.deser(i.slice(l,l+a))),l+=a}return[i,s]}else return[i,{}]}function u1(n){const e=l=>{switch(l){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,i;return Ze(n.z)||(t=si.create(n.z)),Ze(n.Z)||(t||(t=new zt(n.Z)),i=n.Z),Ze(n.q)||(n.M=(n.q-1)*3+1),Ze(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),Ze(n.u)||(n.S=ca(n.u)),[Object.keys(n).reduce((l,o)=>{const r=e(o);return r&&(l[r]=n[o]),l},{}),t,i]}let xo=null;function f1(){return xo||(xo=He.fromMillis(1555555555555)),xo}function c1(n,e){if(n.literal)return n;const t=Xt.macroTokenToFormatOpts(n.val);if(!t)return n;const l=Xt.create(e,t).formatDateTimeParts(f1()).map(o=>o1(o,e,t));return l.includes(void 0)?n:l}function d1(n,e){return Array.prototype.concat(...n.map(t=>c1(t,e)))}function rg(n,e,t){const i=d1(Xt.parseFormat(t),n),s=i.map(o=>s1(o,n)),l=s.find(o=>o.invalidReason);if(l)return{input:e,tokens:i,invalidReason:l.invalidReason};{const[o,r]=r1(s),a=RegExp(o,"i"),[u,f]=a1(e,a,r),[c,d,h]=f?u1(f):[null,null,void 0];if(ys(f,"a")&&ys(f,"H"))throw new Ys("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:i,regex:a,rawMatches:u,matches:f,result:c,zone:d,specificOffset:h}}}function p1(n,e,t){const{result:i,zone:s,specificOffset:l,invalidReason:o}=rg(n,e,t);return[i,s,l,o]}const ag=[0,31,59,90,120,151,181,212,243,273,304,334],ug=[0,31,60,91,121,152,182,213,244,274,305,335];function vn(n,e){return new An("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function fg(n,e,t){const i=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&i.setUTCFullYear(i.getUTCFullYear()-1900);const s=i.getUTCDay();return s===0?7:s}function cg(n,e,t){return t+(kl(n)?ug:ag)[e-1]}function dg(n,e){const t=kl(n)?ug:ag,i=t.findIndex(l=>lho(e)?(r=e+1,o=1):r=e,{weekYear:r,weekNumber:o,weekday:l,...Ho(n)}}function wu(n){const{weekYear:e,weekNumber:t,weekday:i}=n,s=fg(e,1,4),l=Gs(e);let o=t*7+i-s-3,r;o<1?(r=e-1,o+=Gs(r)):o>l?(r=e+1,o-=Gs(e)):r=e;const{month:a,day:u}=dg(r,o);return{year:r,month:a,day:u,...Ho(n)}}function er(n){const{year:e,month:t,day:i}=n,s=cg(e,t,i);return{year:e,ordinal:s,...Ho(n)}}function Su(n){const{year:e,ordinal:t}=n,{month:i,day:s}=dg(e,t);return{year:e,month:i,day:s,...Ho(n)}}function h1(n){const e=Fo(n.weekYear),t=ii(n.weekNumber,1,ho(n.weekYear)),i=ii(n.weekday,1,7);return e?t?i?!1:vn("weekday",n.weekday):vn("week",n.week):vn("weekYear",n.weekYear)}function m1(n){const e=Fo(n.year),t=ii(n.ordinal,1,Gs(n.year));return e?t?!1:vn("ordinal",n.ordinal):vn("year",n.year)}function pg(n){const e=Fo(n.year),t=ii(n.month,1,12),i=ii(n.day,1,po(n.year,n.month));return e?t?i?!1:vn("day",n.day):vn("month",n.month):vn("year",n.year)}function hg(n){const{hour:e,minute:t,second:i,millisecond:s}=n,l=ii(e,0,23)||e===24&&t===0&&i===0&&s===0,o=ii(t,0,59),r=ii(i,0,59),a=ii(s,0,999);return l?o?r?a?!1:vn("millisecond",s):vn("second",i):vn("minute",t):vn("hour",e)}const tr="Invalid DateTime",$u=864e13;function jl(n){return new An("unsupported zone",`the zone "${n.name}" is not supported`)}function nr(n){return n.weekData===null&&(n.weekData=Hr(n.c)),n.weekData}function Ns(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new He({...t,...e,old:t})}function mg(n,e,t){let i=n-e*60*1e3;const s=t.offset(i);if(e===s)return[i,e];i-=(s-e)*60*1e3;const l=t.offset(i);return s===l?[i,s]:[n-Math.min(s,l)*60*1e3,Math.max(s,l)]}function Cu(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function ro(n,e,t){return mg(pa(n),e,t)}function Mu(n,e){const t=n.o,i=n.c.year+Math.trunc(e.years),s=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,l={...n.c,year:i,month:s,day:Math.min(n.c.day,po(i,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=xe.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),r=pa(l);let[a,u]=mg(r,t,n.zone);return o!==0&&(a+=o,u=n.zone.offset(a)),{ts:a,o:u}}function Fs(n,e,t,i,s,l){const{setZone:o,zone:r}=t;if(n&&Object.keys(n).length!==0){const a=e||r,u=He.fromObject(n,{...t,zone:a,specificOffset:l});return o?u:u.setZone(r)}else return He.invalid(new An("unparsable",`the input "${s}" can't be parsed as ${i}`))}function ql(n,e,t=!0){return n.isValid?Xt.create(ct.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function ir(n,e){const t=n.c.year>9999||n.c.year<0;let i="";return t&&n.c.year>=0&&(i+="+"),i+=yt(n.c.year,t?6:4),e?(i+="-",i+=yt(n.c.month),i+="-",i+=yt(n.c.day)):(i+=yt(n.c.month),i+=yt(n.c.day)),i}function Tu(n,e,t,i,s,l){let o=yt(n.c.hour);return e?(o+=":",o+=yt(n.c.minute),(n.c.second!==0||!t)&&(o+=":")):o+=yt(n.c.minute),(n.c.second!==0||!t)&&(o+=yt(n.c.second),(n.c.millisecond!==0||!i)&&(o+=".",o+=yt(n.c.millisecond,3))),s&&(n.isOffsetFixed&&n.offset===0&&!l?o+="Z":n.o<0?(o+="-",o+=yt(Math.trunc(-n.o/60)),o+=":",o+=yt(Math.trunc(-n.o%60))):(o+="+",o+=yt(Math.trunc(n.o/60)),o+=":",o+=yt(Math.trunc(n.o%60)))),l&&(o+="["+n.zone.ianaName+"]"),o}const gg={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},g1={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},_1={ordinal:1,hour:0,minute:0,second:0,millisecond:0},_g=["year","month","day","hour","minute","second","millisecond"],b1=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],v1=["year","ordinal","hour","minute","second","millisecond"];function Ou(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new km(n);return e}function Du(n,e){const t=pi(e.zone,Mt.defaultZone),i=ct.fromObject(e),s=Mt.now();let l,o;if(Ze(n.year))l=s;else{for(const u of _g)Ze(n[u])&&(n[u]=gg[u]);const r=pg(n)||hg(n);if(r)return He.invalid(r);const a=t.offset(s);[l,o]=ro(n,a,t)}return new He({ts:l,zone:t,loc:i,o})}function Eu(n,e,t){const i=Ze(t.round)?!0:t.round,s=(o,r)=>(o=da(o,i||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(o,r)),l=o=>t.calendary?e.hasSame(n,o)?0:e.startOf(o).diff(n.startOf(o),o).get(o):e.diff(n,o).get(o);if(t.unit)return s(l(t.unit),t.unit);for(const o of t.units){const r=l(o);if(Math.abs(r)>=1)return s(r,o)}return s(n>e?-0:0,t.units[t.units.length-1])}function Au(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}class He{constructor(e){const t=e.zone||Mt.defaultZone;let i=e.invalid||(Number.isNaN(e.ts)?new An("invalid input"):null)||(t.isValid?null:jl(t));this.ts=Ze(e.ts)?Mt.now():e.ts;let s=null,l=null;if(!i)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[s,l]=[e.old.c,e.old.o];else{const r=t.offset(this.ts);s=Cu(this.ts,r),i=Number.isNaN(s.year)?new An("invalid input"):null,s=i?null:s,l=i?null:r}this._zone=t,this.loc=e.loc||ct.create(),this.invalid=i,this.weekData=null,this.c=s,this.o=l,this.isLuxonDateTime=!0}static now(){return new He({})}static local(){const[e,t]=Au(arguments),[i,s,l,o,r,a,u]=t;return Du({year:i,month:s,day:l,hour:o,minute:r,second:a,millisecond:u},e)}static utc(){const[e,t]=Au(arguments),[i,s,l,o,r,a,u]=t;return e.zone=zt.utcInstance,Du({year:i,month:s,day:l,hour:o,minute:r,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const i=T0(e)?e.valueOf():NaN;if(Number.isNaN(i))return He.invalid("invalid input");const s=pi(t.zone,Mt.defaultZone);return s.isValid?new He({ts:i,zone:s,loc:ct.fromObject(t)}):He.invalid(jl(s))}static fromMillis(e,t={}){if(zi(e))return e<-$u||e>$u?He.invalid("Timestamp out of range"):new He({ts:e,zone:pi(t.zone,Mt.defaultZone),loc:ct.fromObject(t)});throw new _n(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(zi(e))return new He({ts:e*1e3,zone:pi(t.zone,Mt.defaultZone),loc:ct.fromObject(t)});throw new _n("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const i=pi(t.zone,Mt.defaultZone);if(!i.isValid)return He.invalid(jl(i));const s=Mt.now(),l=Ze(t.specificOffset)?i.offset(s):t.specificOffset,o=mo(e,Ou),r=!Ze(o.ordinal),a=!Ze(o.year),u=!Ze(o.month)||!Ze(o.day),f=a||u,c=o.weekYear||o.weekNumber,d=ct.fromObject(t);if((f||r)&&c)throw new Ys("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&r)throw new Ys("Can't mix ordinal dates with month/day");const h=c||o.weekday&&!f;let m,b,g=Cu(s,l);h?(m=b1,b=g1,g=Hr(g)):r?(m=v1,b=_1,g=er(g)):(m=_g,b=gg);let y=!1;for(const A of m){const P=o[A];Ze(P)?y?o[A]=b[A]:o[A]=g[A]:y=!0}const k=h?h1(o):r?m1(o):pg(o),w=k||hg(o);if(w)return He.invalid(w);const C=h?wu(o):r?Su(o):o,[M,T]=ro(C,l,i),D=new He({ts:M,zone:i,o:T,loc:d});return o.weekday&&f&&e.weekday!==D.weekday?He.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${D.toISO()}`):D}static fromISO(e,t={}){const[i,s]=Pb(e);return Fs(i,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[i,s]=Lb(e);return Fs(i,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[i,s]=Nb(e);return Fs(i,s,t,"HTTP",t)}static fromFormat(e,t,i={}){if(Ze(e)||Ze(t))throw new _n("fromFormat requires an input string and a format");const{locale:s=null,numberingSystem:l=null}=i,o=ct.fromOpts({locale:s,numberingSystem:l,defaultToEN:!0}),[r,a,u,f]=p1(o,e,t);return f?He.invalid(f):Fs(r,a,i,`format ${t}`,e,u)}static fromString(e,t,i={}){return He.fromFormat(e,t,i)}static fromSQL(e,t={}){const[i,s]=zb(e);return Fs(i,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new _n("need to specify a reason the DateTime is invalid");const i=e instanceof An?e:new An(e,t);if(Mt.throwOnInvalid)throw new k0(i);return new He({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?nr(this).weekYear:NaN}get weekNumber(){return this.isValid?nr(this).weekNumber:NaN}get weekday(){return this.isValid?nr(this).weekday:NaN}get ordinal(){return this.isValid?er(this.c).ordinal:NaN}get monthShort(){return this.isValid?Hl.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Hl.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Hl.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Hl.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}get isInLeapYear(){return kl(this.year)}get daysInMonth(){return po(this.year,this.month)}get daysInYear(){return this.isValid?Gs(this.year):NaN}get weeksInWeekYear(){return this.isValid?ho(this.weekYear):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:i,calendar:s}=Xt.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:i,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(zt.instance(e),t)}toLocal(){return this.setZone(Mt.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:i=!1}={}){if(e=pi(e,Mt.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||i){const l=e.offset(this.ts),o=this.toObject();[s]=ro(o,l,e)}return Ns(this,{ts:s,zone:e})}else return He.invalid(jl(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:i}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:i});return Ns(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=mo(e,Ou),i=!Ze(t.weekYear)||!Ze(t.weekNumber)||!Ze(t.weekday),s=!Ze(t.ordinal),l=!Ze(t.year),o=!Ze(t.month)||!Ze(t.day),r=l||o,a=t.weekYear||t.weekNumber;if((r||s)&&a)throw new Ys("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(o&&s)throw new Ys("Can't mix ordinal dates with month/day");let u;i?u=wu({...Hr(this.c),...t}):Ze(t.ordinal)?(u={...this.toObject(),...t},Ze(t.day)&&(u.day=Math.min(po(u.year,u.month),u.day))):u=Su({...er(this.c),...t});const[f,c]=ro(u,this.o,this.zone);return Ns(this,{ts:f,o:c})}plus(e){if(!this.isValid)return this;const t=xe.fromDurationLike(e);return Ns(this,Mu(this,t))}minus(e){if(!this.isValid)return this;const t=xe.fromDurationLike(e).negate();return Ns(this,Mu(this,t))}startOf(e){if(!this.isValid)return this;const t={},i=xe.normalizeUnit(e);switch(i){case"years":t.month=1;case"quarters":case"months":t.day=1;case"weeks":case"days":t.hour=0;case"hours":t.minute=0;case"minutes":t.second=0;case"seconds":t.millisecond=0;break}if(i==="weeks"&&(t.weekday=1),i==="quarters"){const s=Math.ceil(this.month/3);t.month=(s-1)*3+1}return this.set(t)}endOf(e){return this.isValid?this.plus({[e]:1}).startOf(e).minus(1):this}toFormat(e,t={}){return this.isValid?Xt.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):tr}toLocaleString(e=Ir,t={}){return this.isValid?Xt.create(this.loc.clone(t),e).formatDateTime(this):tr}toLocaleParts(e={}){return this.isValid?Xt.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:i=!1,includeOffset:s=!0,extendedZone:l=!1}={}){if(!this.isValid)return null;const o=e==="extended";let r=ir(this,o);return r+="T",r+=Tu(this,o,t,i,s,l),r}toISODate({format:e="extended"}={}){return this.isValid?ir(this,e==="extended"):null}toISOWeekDate(){return ql(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:i=!0,includePrefix:s=!1,extendedZone:l=!1,format:o="extended"}={}){return this.isValid?(s?"T":"")+Tu(this,o==="extended",t,e,i,l):null}toRFC2822(){return ql(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return ql(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ir(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:i=!0}={}){let s="HH:mm:ss.SSS";return(t||e)&&(i&&(s+=" "),t?s+="z":e&&(s+="ZZ")),ql(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():tr}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",i={}){if(!this.isValid||!e.isValid)return xe.invalid("created by diffing an invalid DateTime");const s={locale:this.locale,numberingSystem:this.numberingSystem,...i},l=O0(t).map(xe.normalizeUnit),o=e.valueOf()>this.valueOf(),r=o?this:e,a=o?e:this,u=Xb(r,a,l,s);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(He.now(),e,t)}until(e){return this.isValid?dt.fromDateTimes(this,e):this}hasSame(e,t){if(!this.isValid)return!1;const i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t)<=i&&i<=s.endOf(t)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||He.fromObject({},{zone:this.zone}),i=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(He.isDateTime))throw new _n("max requires all arguments be DateTimes");return au(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,i={}){const{locale:s=null,numberingSystem:l=null}=i,o=ct.fromOpts({locale:s,numberingSystem:l,defaultToEN:!0});return rg(o,e,t)}static fromStringExplain(e,t,i={}){return He.fromFormatExplain(e,t,i)}static get DATE_SHORT(){return Ir}static get DATE_MED(){return wm}static get DATE_MED_WITH_WEEKDAY(){return $0}static get DATE_FULL(){return Sm}static get DATE_HUGE(){return $m}static get TIME_SIMPLE(){return Cm}static get TIME_WITH_SECONDS(){return Mm}static get TIME_WITH_SHORT_OFFSET(){return Tm}static get TIME_WITH_LONG_OFFSET(){return Om}static get TIME_24_SIMPLE(){return Dm}static get TIME_24_WITH_SECONDS(){return Em}static get TIME_24_WITH_SHORT_OFFSET(){return Am}static get TIME_24_WITH_LONG_OFFSET(){return Im}static get DATETIME_SHORT(){return Pm}static get DATETIME_SHORT_WITH_SECONDS(){return Lm}static get DATETIME_MED(){return Nm}static get DATETIME_MED_WITH_SECONDS(){return Fm}static get DATETIME_MED_WITH_WEEKDAY(){return C0}static get DATETIME_FULL(){return Rm}static get DATETIME_FULL_WITH_SECONDS(){return Hm}static get DATETIME_HUGE(){return jm}static get DATETIME_HUGE_WITH_SECONDS(){return qm}}function Rs(n){if(He.isDateTime(n))return n;if(n&&n.valueOf&&zi(n.valueOf()))return He.fromJSDate(n);if(n&&typeof n=="object")return He.fromObject(n);throw new _n(`Unknown datetime argument: ${n}, of type ${typeof n}`)}class B{static isObject(e){return e!==null&&typeof e=="object"&&e.constructor===Object}static isEmpty(e){return e===""||e===null||e==="00000000-0000-0000-0000-000000000000"||e==="0001-01-01 00:00:00.000Z"||e==="0001-01-01"||typeof e>"u"||Array.isArray(e)&&e.length===0||B.isObject(e)&&Object.keys(e).length===0}static isInput(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return t==="input"||t==="select"||t==="textarea"||e.isContentEditable}static isFocusable(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return B.isInput(e)||t==="button"||t==="a"||t==="details"||e.tabIndex>=0}static hasNonEmptyProps(e){for(let t in e)if(!B.isEmpty(e[t]))return!0;return!1}static toArray(e,t=!1){return Array.isArray(e)?e:(t||!B.isEmpty(e))&&typeof e<"u"?[e]:[]}static inArray(e,t){e=Array.isArray(e)?e:[];for(let i=e.length-1;i>=0;i--)if(e[i]==t)return!0;return!1}static removeByValue(e,t){e=Array.isArray(e)?e:[];for(let i=e.length-1;i>=0;i--)if(e[i]==t){e.splice(i,1);break}}static pushUnique(e,t){B.inArray(e,t)||e.push(t)}static findByKey(e,t,i){e=Array.isArray(e)?e:[];for(let s in e)if(e[s][t]==i)return e[s];return null}static groupByKey(e,t){e=Array.isArray(e)?e:[];const i={};for(let s in e)i[e[s][t]]=i[e[s][t]]||[],i[e[s][t]].push(e[s]);return i}static removeByKey(e,t,i){for(let s in e)if(e[s][t]==i){e.splice(s,1);break}}static pushOrReplaceByKey(e,t,i="id"){for(let s=e.length-1;s>=0;s--)if(e[s][i]==t[i]){e[s]=t;return}e.push(t)}static filterDuplicatesByKey(e,t="id"){e=Array.isArray(e)?e:[];const i={};for(const s of e)i[s[t]]=s;return Object.values(i)}static filterRedactedProps(e,t="******"){const i=JSON.parse(JSON.stringify(e||{}));for(let s in i)typeof i[s]=="object"&&i[s]!==null?i[s]=B.filterRedactedProps(i[s],t):i[s]===t&&delete i[s];return i}static getNestedVal(e,t,i=null,s="."){let l=e||{},o=(t||"").split(s);for(const r of o){if(!B.isObject(l)&&!Array.isArray(l)||typeof l[r]>"u")return i;l=l[r]}return l}static setByPath(e,t,i,s="."){if(e===null||typeof e!="object"){console.warn("setByPath: data not an object or array.");return}let l=e,o=t.split(s),r=o.pop();for(const a of o)(!B.isObject(l)&&!Array.isArray(l)||!B.isObject(l[a])&&!Array.isArray(l[a]))&&(l[a]={}),l=l[a];l[r]=i}static deleteByPath(e,t,i="."){let s=e||{},l=(t||"").split(i),o=l.pop();for(const r of l)(!B.isObject(s)&&!Array.isArray(s)||!B.isObject(s[r])&&!Array.isArray(s[r]))&&(s[r]={}),s=s[r];Array.isArray(s)?s.splice(o,1):B.isObject(s)&&delete s[o],l.length>0&&(Array.isArray(s)&&!s.length||B.isObject(s)&&!Object.keys(s).length)&&(Array.isArray(e)&&e.length>0||B.isObject(e)&&Object.keys(e).length>0)&&B.deleteByPath(e,l.join(i),i)}static randomString(e){e=e||10;let t="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let s=0;s{console.warn("Failed to copy.",i)})}static downloadJson(e,t){const i="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e,null,2)),s=document.createElement("a");s.setAttribute("href",i),s.setAttribute("download",t+".json"),s.click(),s.remove()}static getJWTPayload(e){const t=(e||"").split(".")[1]||"";if(t==="")return{};try{const i=decodeURIComponent(atob(t));return JSON.parse(i)||{}}catch(i){console.warn("Failed to parse JWT payload data.",i)}return{}}static hasImageExtension(e){return/\.jpg|\.jpeg|\.png|\.svg|\.gif|\.webp|\.avif$/.test(e)}static generateThumb(e,t=100,i=100){return new Promise(s=>{let l=new FileReader;l.onload=function(o){let r=new Image;r.onload=function(){let a=document.createElement("canvas"),u=a.getContext("2d"),f=r.width,c=r.height;return a.width=t,a.height=i,u.drawImage(r,f>c?(f-c)/2:0,0,f>c?c:f,f>c?c:f,0,0,t,i),s(a.toDataURL(e.type))},r.src=o.target.result},l.readAsDataURL(e)})}static addValueToFormData(e,t,i){if(!(typeof i>"u"))if(B.isEmpty(i))e.append(t,"");else if(Array.isArray(i))for(const s of i)B.addValueToFormData(e,t,s);else i instanceof File?e.append(t,i):i instanceof Date?e.append(t,i.toISOString()):B.isObject(i)?e.append(t,JSON.stringify(i)):e.append(t,""+i)}static defaultFlatpickrOptions(){return{dateFormat:"Y-m-d H:i:S",disableMobile:!0,allowInput:!0,enableTime:!0,time_24hr:!0,locale:{firstDayOfWeek:1}}}static dummyCollectionRecord(e){var s,l,o,r,a;const t=(e==null?void 0:e.schema)||[],i={id:"RECORD_ID",collectionId:e==null?void 0:e.id,collectionName:e==null?void 0:e.name,created:"2022-01-01 01:00:00Z",updated:"2022-01-01 23:59:59Z"};e!=null&&e.isAuth&&(i.username="username123",i.verified=!1,i.emailVisibility=!0,i.email="test@example.com");for(const u of t){let f=null;u.type==="number"?f=123:u.type==="date"?f="2022-01-01 10:00:00.123Z":u.type==="bool"?f=!0:u.type==="email"?f="test@example.com":u.type==="url"?f="https://example.com":u.type==="json"?f="JSON":u.type==="file"?(f="filename.jpg",((s=u.options)==null?void 0:s.maxSelect)!==1&&(f=[f])):u.type==="select"?(f=(o=(l=u.options)==null?void 0:l.values)==null?void 0:o[0],((r=u.options)==null?void 0:r.maxSelect)!==1&&(f=[f])):u.type==="relation"?(f="RELATION_RECORD_ID",((a=u.options)==null?void 0:a.maxSelect)!==1&&(f=[f])):f="test",i[u.name]=f}return i}static dummyCollectionSchemaData(e){var s,l,o,r;const t=(e==null?void 0:e.schema)||[],i={};for(const a of t){let u=null;if(a.type==="number")u=123;else if(a.type==="date")u="2022-01-01 10:00:00.123Z";else if(a.type==="bool")u=!0;else if(a.type==="email")u="test@example.com";else if(a.type==="url")u="https://example.com";else if(a.type==="json")u="JSON";else{if(a.type==="file")continue;a.type==="select"?(u=(l=(s=a.options)==null?void 0:s.values)==null?void 0:l[0],((o=a.options)==null?void 0:o.maxSelect)!==1&&(u=[u])):a.type==="relation"?(u="RELATION_RECORD_ID",((r=a.options)==null?void 0:r.maxSelect)!==1&&(u=[u])):u="test"}i[a.name]=u}return i}static getCollectionTypeIcon(e){switch(e==null?void 0:e.toLowerCase()){case"auth":return"ri-group-line";case"single":return"ri-file-list-2-line";default:return"ri-folder-2-line"}}static getFieldTypeIcon(e){switch(e==null?void 0:e.toLowerCase()){case"primary":return"ri-key-line";case"text":return"ri-text";case"number":return"ri-hashtag";case"date":return"ri-calendar-line";case"bool":return"ri-toggle-line";case"email":return"ri-mail-line";case"url":return"ri-link";case"select":return"ri-list-check";case"json":return"ri-braces-line";case"file":return"ri-image-line";case"relation":return"ri-mind-map";case"user":return"ri-user-line";default:return"ri-star-s-line"}}static getFieldValueType(e){var t;switch(e==null?void 0:e.type){case"bool":return"Boolean";case"number":return"Number";case"file":return"File";case"select":case"relation":return((t=e==null?void 0:e.options)==null?void 0:t.maxSelect)===1?"String":"Array";default:return"String"}}static zeroDefaultStr(e){var t;return(e==null?void 0:e.type)==="number"?"0":["select","relation","file"].includes(e==null?void 0:e.type)&&((t=e==null?void 0:e.options)==null?void 0:t.maxSelect)!=1?"[]":'""'}static getApiExampleUrl(e){return(window.location.href.substring(0,window.location.href.indexOf("/_"))||e||"/").replace("//localhost","//127.0.0.1")}static hasCollectionChanges(e,t,i=!1){if(e=e||{},t=t||{},e.id!=t.id)return!0;for(let u in e)if(u!=="schema"&&JSON.stringify(e[u])!==JSON.stringify(t[u]))return!0;const s=Array.isArray(e.schema)?e.schema:[],l=Array.isArray(t.schema)?t.schema:[],o=s.filter(u=>(u==null?void 0:u.id)&&!B.findByKey(l,"id",u.id)),r=l.filter(u=>(u==null?void 0:u.id)&&!B.findByKey(s,"id",u.id)),a=l.filter(u=>{const f=B.isObject(u)&&B.findByKey(s,"id",u.id);if(!f)return!1;for(let c in f)if(JSON.stringify(u[c])!=JSON.stringify(f[c]))return!0;return!1});return!!(r.length||a.length||i&&o.length)}static sortCollections(e=[]){const t=[],i=[],s=[];for(const l of e)l.type=="auth"?t.push(l):l.type=="single"?i.push(l):s.push(l);return[].concat(t,i,s)}static yieldToMain(){return new Promise(e=>{setTimeout(e,0)})}}const jo=Cn([]);function bg(n,e=4e3){return qo(n,"info",e)}function Lt(n,e=3e3){return qo(n,"success",e)}function rl(n,e=4500){return qo(n,"error",e)}function y1(n,e=4500){return qo(n,"warning",e)}function qo(n,e,t){t=t||4e3;const i={message:n,type:e,duration:t,timeout:setTimeout(()=>{vg(i)},t)};jo.update(s=>(va(s,i.message),B.pushOrReplaceByKey(s,i,"message"),s))}function vg(n){jo.update(e=>(va(e,n),e))}function yg(){jo.update(n=>{for(let e of n)va(n,e);return[]})}function va(n,e){let t;typeof e=="string"?t=B.findByKey(n,"message",e):t=e,t&&(clearTimeout(t.timeout),B.removeByKey(n,"message",t.message))}const wi=Cn({});function Fn(n){wi.set(n||{})}function al(n){wi.update(e=>(B.deleteByPath(e,n),e))}const ya=Cn({});function jr(n){ya.set(n||{})}fa.prototype.logout=function(n=!0){this.authStore.clear(),n&&ki("/login")};fa.prototype.errorResponseHandler=function(n,e=!0,t=""){if(!n||!(n instanceof Error)||n.isAbort)return;const i=(n==null?void 0:n.status)<<0||400,s=(n==null?void 0:n.data)||{};if(e&&i!==404){let l=s.message||n.message||t;l&&rl(l)}if(B.isEmpty(s.data)||Fn(s.data),i===401)return this.cancelAllRequests(),this.logout();if(i===403)return this.cancelAllRequests(),ki("/")};class k1 extends vm{save(e,t){super.save(e,t),t instanceof Yi&&jr(t)}clear(){super.clear(),jr(null)}}const me=new fa("../",new k1("pb_admin_auth"));me.authStore.model instanceof Yi&&jr(me.authStore.model);function w1(n){let e,t,i,s,l,o,r,a;const u=n[3].default,f=Ot(u,n,n[2],null);return{c(){e=v("div"),t=v("main"),f&&f.c(),i=O(),s=v("footer"),l=v("a"),o=v("span"),o.textContent="PocketBase v0.8.0-rc1",p(t,"class","page-content"),p(o,"class","txt"),p(l,"href","https://github.com/pocketbase/pocketbase/releases"),p(l,"class","inline-flex flex-gap-5"),p(l,"target","_blank"),p(l,"rel","noopener noreferrer"),p(l,"title","Releases"),p(s,"class","page-footer"),p(e,"class",r="page-wrapper "+n[1]),ee(e,"center-content",n[0])},m(c,d){$(c,e,d),_(e,t),f&&f.m(t,null),_(e,i),_(e,s),_(s,l),_(l,o),a=!0},p(c,[d]){f&&f.p&&(!a||d&4)&&Et(f,u,c,c[2],a?Dt(u,c[2],d,null):At(c[2]),null),(!a||d&2&&r!==(r="page-wrapper "+c[1]))&&p(e,"class",r),(!a||d&3)&&ee(e,"center-content",c[0])},i(c){a||(E(f,c),a=!0)},o(c){I(f,c),a=!1},d(c){c&&S(e),f&&f.d(c)}}}function S1(n,e,t){let{$$slots:i={},$$scope:s}=e,{center:l=!1}=e,{class:o=""}=e;return n.$$set=r=>{"center"in r&&t(0,l=r.center),"class"in r&&t(1,o=r.class),"$$scope"in r&&t(2,s=r.$$scope)},[l,o,s,i]}class cn extends Me{constructor(e){super(),Ce(this,e,S1,w1,we,{center:0,class:1})}}function Iu(n){let e,t,i;return{c(){e=v("div"),e.innerHTML=``,t=O(),i=v("div"),p(e,"class","block txt-center m-b-lg"),p(i,"class","clearfix")},m(s,l){$(s,e,l),$(s,t,l),$(s,i,l)},d(s){s&&S(e),s&&S(t),s&&S(i)}}}function $1(n){let e,t,i,s=!n[0]&&Iu();const l=n[1].default,o=Ot(l,n,n[2],null);return{c(){e=v("div"),s&&s.c(),t=O(),o&&o.c(),p(e,"class","wrapper wrapper-sm m-b-xl panel-wrapper svelte-lxxzfu")},m(r,a){$(r,e,a),s&&s.m(e,null),_(e,t),o&&o.m(e,null),i=!0},p(r,a){r[0]?s&&(s.d(1),s=null):s||(s=Iu(),s.c(),s.m(e,t)),o&&o.p&&(!i||a&4)&&Et(o,l,r,r[2],i?Dt(l,r[2],a,null):At(r[2]),null)},i(r){i||(E(o,r),i=!0)},o(r){I(o,r),i=!1},d(r){r&&S(e),s&&s.d(),o&&o.d(r)}}}function C1(n){let e,t;return e=new cn({props:{class:"full-page",center:!0,$$slots:{default:[$1]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&5&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function M1(n,e,t){let{$$slots:i={},$$scope:s}=e,{nobranding:l=!1}=e;return n.$$set=o=>{"nobranding"in o&&t(0,l=o.nobranding),"$$scope"in o&&t(2,s=o.$$scope)},[l,i,s]}class kg extends Me{constructor(e){super(),Ce(this,e,M1,C1,we,{nobranding:0})}}function Pu(n,e,t){const i=n.slice();return i[11]=e[t],i}const T1=n=>({}),Lu=n=>({uniqueId:n[3]});function O1(n){let e=(n[11]||go)+"",t;return{c(){t=z(e)},m(i,s){$(i,t,s)},p(i,s){s&4&&e!==(e=(i[11]||go)+"")&&ue(t,e)},d(i){i&&S(t)}}}function D1(n){var s,l;let e,t=(((s=n[11])==null?void 0:s.message)||((l=n[11])==null?void 0:l.code)||go)+"",i;return{c(){e=v("pre"),i=z(t)},m(o,r){$(o,e,r),_(e,i)},p(o,r){var a,u;r&4&&t!==(t=(((a=o[11])==null?void 0:a.message)||((u=o[11])==null?void 0:u.code)||go)+"")&&ue(i,t)},d(o){o&&S(e)}}}function Nu(n){let e,t;function i(o,r){return typeof o[11]=="object"?D1:O1}let s=i(n),l=s(n);return{c(){e=v("div"),l.c(),t=O(),p(e,"class","help-block help-block-error")},m(o,r){$(o,e,r),l.m(e,null),_(e,t)},p(o,r){s===(s=i(o))&&l?l.p(o,r):(l.d(1),l=s(o),l&&(l.c(),l.m(e,t)))},d(o){o&&S(e),l.d()}}}function E1(n){let e,t,i,s,l;const o=n[7].default,r=Ot(o,n,n[6],Lu);let a=n[2],u=[];for(let f=0;ft(5,i=m));let{$$slots:s={},$$scope:l}=e;const o="field_"+B.randomString(7);let{name:r=""}=e,{class:a=void 0}=e,u,f=[];function c(){al(r)}un(()=>(u.addEventListener("input",c),u.addEventListener("change",c),()=>{u.removeEventListener("input",c),u.removeEventListener("change",c)}));function d(m){Ve.call(this,n,m)}function h(m){le[m?"unshift":"push"](()=>{u=m,t(1,u)})}return n.$$set=m=>{"name"in m&&t(4,r=m.name),"class"in m&&t(0,a=m.class),"$$scope"in m&&t(6,l=m.$$scope)},n.$$.update=()=>{n.$$.dirty&48&&t(2,f=B.toArray(B.getNestedVal(i,r)))},[a,u,f,o,r,i,l,s,d,h]}class _e extends Me{constructor(e){super(),Ce(this,e,A1,E1,we,{name:4,class:0})}}function I1(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Email"),s=O(),l=v("input"),p(e,"for",i=n[9]),p(l,"type","email"),p(l,"autocomplete","off"),p(l,"id",o=n[9]),l.required=!0,l.autofocus=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0]),l.focus(),r||(a=U(l,"input",n[5]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&p(e,"for",i),f&512&&o!==(o=u[9])&&p(l,"id",o),f&1&&l.value!==u[0]&&he(l,u[0])},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function P1(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("label"),t=z("Password"),s=O(),l=v("input"),r=O(),a=v("div"),a.textContent="Minimum 10 characters.",p(e,"for",i=n[9]),p(l,"type","password"),p(l,"autocomplete","new-password"),p(l,"minlength","10"),p(l,"id",o=n[9]),l.required=!0,p(a,"class","help-block")},m(c,d){$(c,e,d),_(e,t),$(c,s,d),$(c,l,d),he(l,n[1]),$(c,r,d),$(c,a,d),u||(f=U(l,"input",n[6]),u=!0)},p(c,d){d&512&&i!==(i=c[9])&&p(e,"for",i),d&512&&o!==(o=c[9])&&p(l,"id",o),d&2&&l.value!==c[1]&&he(l,c[1])},d(c){c&&S(e),c&&S(s),c&&S(l),c&&S(r),c&&S(a),u=!1,f()}}}function L1(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Password confirm"),s=O(),l=v("input"),p(e,"for",i=n[9]),p(l,"type","password"),p(l,"minlength","10"),p(l,"id",o=n[9]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[2]),r||(a=U(l,"input",n[7]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&p(e,"for",i),f&512&&o!==(o=u[9])&&p(l,"id",o),f&4&&l.value!==u[2]&&he(l,u[2])},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function N1(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;return s=new _e({props:{class:"form-field required",name:"email",$$slots:{default:[I1,({uniqueId:m})=>({9:m}),({uniqueId:m})=>m?512:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field required",name:"password",$$slots:{default:[P1,({uniqueId:m})=>({9:m}),({uniqueId:m})=>m?512:0]},$$scope:{ctx:n}}}),a=new _e({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[L1,({uniqueId:m})=>({9:m}),({uniqueId:m})=>m?512:0]},$$scope:{ctx:n}}}),{c(){e=v("form"),t=v("div"),t.innerHTML="

Create your first admin account in order to continue

",i=O(),j(s.$$.fragment),l=O(),j(o.$$.fragment),r=O(),j(a.$$.fragment),u=O(),f=v("button"),f.innerHTML=`Create and login + `,p(t,"class","content txt-center m-b-base"),p(f,"type","submit"),p(f,"class","btn btn-lg btn-block btn-next"),ee(f,"btn-disabled",n[3]),ee(f,"btn-loading",n[3]),p(e,"class","block"),p(e,"autocomplete","off")},m(m,b){$(m,e,b),_(e,t),_(e,i),R(s,e,null),_(e,l),R(o,e,null),_(e,r),R(a,e,null),_(e,u),_(e,f),c=!0,d||(h=U(e,"submit",ut(n[4])),d=!0)},p(m,[b]){const g={};b&1537&&(g.$$scope={dirty:b,ctx:m}),s.$set(g);const y={};b&1538&&(y.$$scope={dirty:b,ctx:m}),o.$set(y);const k={};b&1540&&(k.$$scope={dirty:b,ctx:m}),a.$set(k),(!c||b&8)&&ee(f,"btn-disabled",m[3]),(!c||b&8)&&ee(f,"btn-loading",m[3])},i(m){c||(E(s.$$.fragment,m),E(o.$$.fragment,m),E(a.$$.fragment,m),c=!0)},o(m){I(s.$$.fragment,m),I(o.$$.fragment,m),I(a.$$.fragment,m),c=!1},d(m){m&&S(e),H(s),H(o),H(a),d=!1,h()}}}function F1(n,e,t){const i=It();let s="",l="",o="",r=!1;async function a(){if(!r){t(3,r=!0);try{await me.admins.create({email:s,password:l,passwordConfirm:o}),await me.admins.authWithPassword(s,l),i("submit")}catch(d){me.errorResponseHandler(d)}t(3,r=!1)}}function u(){s=this.value,t(0,s)}function f(){l=this.value,t(1,l)}function c(){o=this.value,t(2,o)}return[s,l,o,r,a,u,f,c]}class R1 extends Me{constructor(e){super(),Ce(this,e,F1,N1,we,{})}}function Fu(n){let e,t;return e=new kg({props:{$$slots:{default:[H1]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function H1(n){let e,t;return e=new R1({}),e.$on("submit",n[1]),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p:x,i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function j1(n){let e,t,i=n[0]&&Fu(n);return{c(){i&&i.c(),e=Fe()},m(s,l){i&&i.m(s,l),$(s,e,l),t=!0},p(s,[l]){s[0]?i?(i.p(s,l),l&1&&E(i,1)):(i=Fu(s),i.c(),E(i,1),i.m(e.parentNode,e)):i&&(be(),I(i,1,1,()=>{i=null}),ve())},i(s){t||(E(i),t=!0)},o(s){I(i),t=!1},d(s){i&&i.d(s),s&&S(e)}}}function q1(n,e,t){let i=!1;s();function s(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("installer")){me.logout(!1),t(0,i=!0);return}me.authStore.isValid?ki("/collections"):me.logout()}return[i,async()=>{t(0,i=!1),await $n(),window.location.search=""}]}class V1 extends Me{constructor(e){super(),Ce(this,e,q1,j1,we,{})}}const mt=Cn(""),_o=Cn(""),ks=Cn(!1);function Vo(n){const e=n-1;return e*e*e+1}function bo(n,{delay:e=0,duration:t=400,easing:i=bl}={}){const s=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:l=>`opacity: ${l*s}`}}function kn(n,{delay:e=0,duration:t=400,easing:i=Vo,x:s=0,y:l=0,opacity:o=0}={}){const r=getComputedStyle(n),a=+r.opacity,u=r.transform==="none"?"":r.transform,f=a*(1-o);return{delay:e,duration:t,easing:i,css:(c,d)=>` + transform: ${u} translate(${(1-c)*s}px, ${(1-c)*l}px); + opacity: ${a-f*d}`}}function St(n,{delay:e=0,duration:t=400,easing:i=Vo}={}){const s=getComputedStyle(n),l=+s.opacity,o=parseFloat(s.height),r=parseFloat(s.paddingTop),a=parseFloat(s.paddingBottom),u=parseFloat(s.marginTop),f=parseFloat(s.marginBottom),c=parseFloat(s.borderTopWidth),d=parseFloat(s.borderBottomWidth);return{delay:e,duration:t,easing:i,css:h=>`overflow: hidden;opacity: ${Math.min(h*20,1)*l};height: ${h*o}px;padding-top: ${h*r}px;padding-bottom: ${h*a}px;margin-top: ${h*u}px;margin-bottom: ${h*f}px;border-top-width: ${h*c}px;border-bottom-width: ${h*d}px;`}}function $t(n,{delay:e=0,duration:t=400,easing:i=Vo,start:s=0,opacity:l=0}={}){const o=getComputedStyle(n),r=+o.opacity,a=o.transform==="none"?"":o.transform,u=1-s,f=r*(1-l);return{delay:e,duration:t,easing:i,css:(c,d)=>` + transform: ${a} scale(${1-u*d}); + opacity: ${r-f*d} + `}}function z1(n){let e,t,i,s;return{c(){e=v("input"),p(e,"type","text"),p(e,"id",n[8]),p(e,"placeholder",t=n[0]||n[1])},m(l,o){$(l,e,o),n[13](e),he(e,n[7]),i||(s=U(e,"input",n[14]),i=!0)},p(l,o){o&3&&t!==(t=l[0]||l[1])&&p(e,"placeholder",t),o&128&&e.value!==l[7]&&he(e,l[7])},i:x,o:x,d(l){l&&S(e),n[13](null),i=!1,s()}}}function B1(n){let e,t,i,s;function l(a){n[12](a)}var o=n[4];function r(a){let u={id:a[8],singleLine:!0,disableRequestKeys:!0,disableIndirectCollectionsKeys:!0,extraAutocompleteKeys:a[3],baseCollection:a[2],placeholder:a[0]||a[1]};return a[7]!==void 0&&(u.value=a[7]),{props:u}}return o&&(e=Qt(o,r(n)),le.push(()=>ke(e,"value",l)),e.$on("submit",n[10])),{c(){e&&j(e.$$.fragment),i=Fe()},m(a,u){e&&R(e,a,u),$(a,i,u),s=!0},p(a,u){const f={};if(u&8&&(f.extraAutocompleteKeys=a[3]),u&4&&(f.baseCollection=a[2]),u&3&&(f.placeholder=a[0]||a[1]),!t&&u&128&&(t=!0,f.value=a[7],$e(()=>t=!1)),o!==(o=a[4])){if(e){be();const c=e;I(c.$$.fragment,1,0,()=>{H(c,1)}),ve()}o?(e=Qt(o,r(a)),le.push(()=>ke(e,"value",l)),e.$on("submit",a[10]),j(e.$$.fragment),E(e.$$.fragment,1),R(e,i.parentNode,i)):e=null}else o&&e.$set(f)},i(a){s||(e&&E(e.$$.fragment,a),s=!0)},o(a){e&&I(e.$$.fragment,a),s=!1},d(a){a&&S(i),e&&H(e,a)}}}function Ru(n){let e,t,i,s,l,o,r=n[7]!==n[0]&&Hu();return{c(){r&&r.c(),e=O(),t=v("button"),t.innerHTML='Clear',p(t,"type","button"),p(t,"class","btn btn-secondary btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(a,u){r&&r.m(a,u),$(a,e,u),$(a,t,u),s=!0,l||(o=U(t,"click",n[15]),l=!0)},p(a,u){a[7]!==a[0]?r?u&129&&E(r,1):(r=Hu(),r.c(),E(r,1),r.m(e.parentNode,e)):r&&(be(),I(r,1,1,()=>{r=null}),ve())},i(a){s||(E(r),a&&Qe(()=>{i||(i=je(t,kn,{duration:150,x:5},!0)),i.run(1)}),s=!0)},o(a){I(r),a&&(i||(i=je(t,kn,{duration:150,x:5},!1)),i.run(0)),s=!1},d(a){r&&r.d(a),a&&S(e),a&&S(t),a&&i&&i.end(),l=!1,o()}}}function Hu(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='Search',p(e,"type","submit"),p(e,"class","btn btn-expanded btn-sm btn-warning")},m(s,l){$(s,e,l),i=!0},i(s){i||(s&&Qe(()=>{t||(t=je(e,kn,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){s&&(t||(t=je(e,kn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(s){s&&S(e),s&&t&&t.end()}}}function W1(n){let e,t,i,s,l,o,r,a,u,f,c;const d=[B1,z1],h=[];function m(g,y){return g[4]&&!g[5]?0:1}o=m(n),r=h[o]=d[o](n);let b=(n[0].length||n[7].length)&&Ru(n);return{c(){e=v("div"),t=v("form"),i=v("label"),s=v("i"),l=O(),r.c(),a=O(),b&&b.c(),p(s,"class","ri-search-line"),p(i,"for",n[8]),p(i,"class","m-l-10 txt-xl"),p(t,"class","searchbar"),p(e,"class","searchbar-wrapper")},m(g,y){$(g,e,y),_(e,t),_(t,i),_(i,s),_(t,l),h[o].m(t,null),_(t,a),b&&b.m(t,null),u=!0,f||(c=[U(t,"click",Yn(n[11])),U(t,"submit",ut(n[10]))],f=!0)},p(g,[y]){let k=o;o=m(g),o===k?h[o].p(g,y):(be(),I(h[k],1,1,()=>{h[k]=null}),ve(),r=h[o],r?r.p(g,y):(r=h[o]=d[o](g),r.c()),E(r,1),r.m(t,a)),g[0].length||g[7].length?b?(b.p(g,y),y&129&&E(b,1)):(b=Ru(g),b.c(),E(b,1),b.m(t,null)):b&&(be(),I(b,1,1,()=>{b=null}),ve())},i(g){u||(E(r),E(b),u=!0)},o(g){I(r),I(b),u=!1},d(g){g&&S(e),h[o].d(),b&&b.d(),f=!1,Re(c)}}}function U1(n,e,t){const i=It(),s="search_"+B.randomString(7);let{value:l=""}=e,{placeholder:o='Search filter, ex. created > "2022-01-01"...'}=e,{autocompleteCollection:r=new Pn}=e,{extraAutocompleteKeys:a=[]}=e,u,f=!1,c,d="";function h(M=!0){t(7,d=""),M&&(c==null||c.focus()),i("clear")}function m(){t(0,l=d),i("submit",l)}async function b(){u||f||(t(5,f=!0),t(4,u=(await st(()=>import("./FilterAutocompleteInput.7da1d2a3.js"),["./FilterAutocompleteInput.7da1d2a3.js","./index.9c8b95cd.js"],import.meta.url)).default),t(5,f=!1))}un(()=>{b()});function g(M){Ve.call(this,n,M)}function y(M){d=M,t(7,d),t(0,l)}function k(M){le[M?"unshift":"push"](()=>{c=M,t(6,c)})}function w(){d=this.value,t(7,d),t(0,l)}const C=()=>{h(!1),m()};return n.$$set=M=>{"value"in M&&t(0,l=M.value),"placeholder"in M&&t(1,o=M.placeholder),"autocompleteCollection"in M&&t(2,r=M.autocompleteCollection),"extraAutocompleteKeys"in M&&t(3,a=M.extraAutocompleteKeys)},n.$$.update=()=>{n.$$.dirty&1&&typeof l=="string"&&t(7,d=l)},[l,o,r,a,u,f,c,d,s,h,m,g,y,k,w,C]}class ka extends Me{constructor(e){super(),Ce(this,e,U1,W1,we,{value:0,placeholder:1,autocompleteCollection:2,extraAutocompleteKeys:3})}}let qr,Ii;const Vr="app-tooltip";function ju(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function _i(){return Ii=Ii||document.querySelector("."+Vr),Ii||(Ii=document.createElement("div"),Ii.classList.add(Vr),document.body.appendChild(Ii)),Ii}function wg(n,e){let t=_i();if(!t.classList.contains("active")||!(e!=null&&e.text)){zr();return}t.textContent=e.text,t.className=Vr+" active",e.class&&t.classList.add(e.class),e.position&&t.classList.add(e.position),t.style.top="0px",t.style.left="0px";let i=t.offsetHeight,s=t.offsetWidth,l=n.getBoundingClientRect(),o=0,r=0,a=5;e.position=="left"?(o=l.top+l.height/2-i/2,r=l.left-s-a):e.position=="right"?(o=l.top+l.height/2-i/2,r=l.right+a):e.position=="top"?(o=l.top-i-a,r=l.left+l.width/2-s/2):e.position=="top-left"?(o=l.top-i-a,r=l.left):e.position=="top-right"?(o=l.top-i-a,r=l.right-s):e.position=="bottom-left"?(o=l.top+l.height+a,r=l.left):e.position=="bottom-right"?(o=l.top+l.height+a,r=l.right-s):(o=l.top+l.height+a,r=l.left+l.width/2-s/2),r+s>document.documentElement.clientWidth&&(r=document.documentElement.clientWidth-s),r=r>=0?r:0,o+i>document.documentElement.clientHeight&&(o=document.documentElement.clientHeight-i),o=o>=0?o:0,t.style.top=o+"px",t.style.left=r+"px"}function zr(){clearTimeout(qr),_i().classList.remove("active"),_i().activeNode=void 0}function Y1(n,e){_i().activeNode=n,clearTimeout(qr),qr=setTimeout(()=>{_i().classList.add("active"),wg(n,e)},isNaN(e.delay)?0:e.delay)}function Be(n,e){let t=ju(e);function i(){Y1(n,t)}function s(){zr()}return n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",s),n.addEventListener("blur",s),(t.hideOnClick===!0||t.hideOnClick===null&&B.isFocusable(n))&&n.addEventListener("click",s),_i(),{update(l){var o,r;t=ju(l),(r=(o=_i())==null?void 0:o.activeNode)!=null&&r.contains(n)&&wg(n,t)},destroy(){var l,o;(o=(l=_i())==null?void 0:l.activeNode)!=null&&o.contains(n)&&zr(),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",s),n.removeEventListener("blur",s),n.removeEventListener("click",s)}}}function K1(n){let e,t,i,s;return{c(){e=v("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-secondary btn-circle svelte-1bvelc2"),ee(e,"refreshing",n[1])},m(l,o){$(l,e,o),i||(s=[Le(t=Be.call(null,e,n[0])),U(e,"click",n[2])],i=!0)},p(l,[o]){t&&Wt(t.update)&&o&1&&t.update.call(null,l[0]),o&2&&ee(e,"refreshing",l[1])},i:x,o:x,d(l){l&&S(e),i=!1,Re(s)}}}function J1(n,e,t){const i=It();let{tooltip:s={text:"Refresh",position:"right"}}=e,l=null;function o(){i("refresh");const r=s;t(0,s=null),clearTimeout(l),t(1,l=setTimeout(()=>{t(1,l=null),t(0,s=r)},150))}return un(()=>()=>clearTimeout(l)),n.$$set=r=>{"tooltip"in r&&t(0,s=r.tooltip)},[s,l,o]}class wa extends Me{constructor(e){super(),Ce(this,e,J1,K1,we,{tooltip:0})}}function Z1(n){let e,t,i,s,l;const o=n[6].default,r=Ot(o,n,n[5],null);return{c(){e=v("th"),r&&r.c(),p(e,"tabindex","0"),p(e,"class",t="col-sort "+n[1]),ee(e,"col-sort-disabled",n[3]),ee(e,"sort-active",n[0]==="-"+n[2]||n[0]==="+"+n[2]),ee(e,"sort-desc",n[0]==="-"+n[2]),ee(e,"sort-asc",n[0]==="+"+n[2])},m(a,u){$(a,e,u),r&&r.m(e,null),i=!0,s||(l=[U(e,"click",n[7]),U(e,"keydown",n[8])],s=!0)},p(a,[u]){r&&r.p&&(!i||u&32)&&Et(r,o,a,a[5],i?Dt(o,a[5],u,null):At(a[5]),null),(!i||u&2&&t!==(t="col-sort "+a[1]))&&p(e,"class",t),(!i||u&10)&&ee(e,"col-sort-disabled",a[3]),(!i||u&7)&&ee(e,"sort-active",a[0]==="-"+a[2]||a[0]==="+"+a[2]),(!i||u&7)&&ee(e,"sort-desc",a[0]==="-"+a[2]),(!i||u&7)&&ee(e,"sort-asc",a[0]==="+"+a[2])},i(a){i||(E(r,a),i=!0)},o(a){I(r,a),i=!1},d(a){a&&S(e),r&&r.d(a),s=!1,Re(l)}}}function G1(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,{name:o}=e,{sort:r=""}=e,{disable:a=!1}=e;function u(){a||("-"+o===r?t(0,r="+"+o):t(0,r="-"+o))}const f=()=>u(),c=d=>{(d.code==="Enter"||d.code==="Space")&&(d.preventDefault(),u())};return n.$$set=d=>{"class"in d&&t(1,l=d.class),"name"in d&&t(2,o=d.name),"sort"in d&&t(0,r=d.sort),"disable"in d&&t(3,a=d.disable),"$$scope"in d&&t(5,s=d.$$scope)},[r,l,o,a,u,s,i,f,c]}class Ft extends Me{constructor(e){super(),Ce(this,e,G1,Z1,we,{class:1,name:2,sort:0,disable:3})}}function X1(n){let e;return{c(){e=v("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function Q1(n){let e,t,i,s,l,o,r;return{c(){e=v("div"),t=v("div"),i=z(n[2]),s=O(),l=v("div"),o=z(n[1]),r=z(" UTC"),p(t,"class","date"),p(l,"class","time svelte-zdiknu"),p(e,"class","datetime svelte-zdiknu")},m(a,u){$(a,e,u),_(e,t),_(t,i),_(e,s),_(e,l),_(l,o),_(l,r)},p(a,u){u&4&&ue(i,a[2]),u&2&&ue(o,a[1])},d(a){a&&S(e)}}}function x1(n){let e;function t(l,o){return l[0]?Q1:X1}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:x,o:x,d(l){s.d(l),l&&S(e)}}}function ev(n,e,t){let i,s,{date:l=""}=e;return n.$$set=o=>{"date"in o&&t(0,l=o.date)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=l?l.substring(0,10):null),n.$$.dirty&1&&t(1,s=l?l.substring(10,19):null)},[l,s,i]}class Ki extends Me{constructor(e){super(),Ce(this,e,ev,x1,we,{date:0})}}const tv=n=>({}),qu=n=>({}),nv=n=>({}),Vu=n=>({});function iv(n){let e,t,i,s,l,o,r,a;const u=n[5].before,f=Ot(u,n,n[4],Vu),c=n[5].default,d=Ot(c,n,n[4],null),h=n[5].after,m=Ot(h,n,n[4],qu);return{c(){e=v("div"),f&&f.c(),t=O(),i=v("div"),d&&d.c(),l=O(),m&&m.c(),p(i,"class",s="horizontal-scroller "+n[0]+" "+n[3]+" svelte-wc2j9h"),p(e,"class","horizontal-scroller-wrapper svelte-wc2j9h")},m(b,g){$(b,e,g),f&&f.m(e,null),_(e,t),_(e,i),d&&d.m(i,null),n[6](i),_(e,l),m&&m.m(e,null),o=!0,r||(a=[U(window,"resize",n[1]),U(i,"scroll",n[1])],r=!0)},p(b,[g]){f&&f.p&&(!o||g&16)&&Et(f,u,b,b[4],o?Dt(u,b[4],g,nv):At(b[4]),Vu),d&&d.p&&(!o||g&16)&&Et(d,c,b,b[4],o?Dt(c,b[4],g,null):At(b[4]),null),(!o||g&9&&s!==(s="horizontal-scroller "+b[0]+" "+b[3]+" svelte-wc2j9h"))&&p(i,"class",s),m&&m.p&&(!o||g&16)&&Et(m,h,b,b[4],o?Dt(h,b[4],g,tv):At(b[4]),qu)},i(b){o||(E(f,b),E(d,b),E(m,b),o=!0)},o(b){I(f,b),I(d,b),I(m,b),o=!1},d(b){b&&S(e),f&&f.d(b),d&&d.d(b),n[6](null),m&&m.d(b),r=!1,Re(a)}}}function sv(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,o=null,r="",a=null,u;function f(){!o||(clearTimeout(a),a=setTimeout(()=>{const d=o.offsetWidth,h=o.scrollWidth;h-d?(t(3,r="scrollable"),o.scrollLeft===0?t(3,r+=" scroll-start"):o.scrollLeft+d==h&&t(3,r+=" scroll-end")):t(3,r="")},100))}un(()=>(f(),u=new MutationObserver(()=>{f()}),u.observe(o,{attributeFilter:["width"],childList:!0,subtree:!0}),()=>{u==null||u.disconnect(),clearTimeout(a)}));function c(d){le[d?"unshift":"push"](()=>{o=d,t(2,o)})}return n.$$set=d=>{"class"in d&&t(0,l=d.class),"$$scope"in d&&t(4,s=d.$$scope)},[l,f,o,r,s,i,c]}class Sa extends Me{constructor(e){super(),Ce(this,e,sv,iv,we,{class:0,refresh:1})}get refresh(){return this.$$.ctx[1]}}function zu(n,e,t){const i=n.slice();return i[23]=e[t],i}function lv(n){let e;return{c(){e=v("div"),e.innerHTML=` + method`,p(e,"class","col-header-content")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function ov(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="url",p(t,"class",B.getFieldTypeIcon("url")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function rv(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="referer",p(t,"class",B.getFieldTypeIcon("url")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function av(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="User IP",p(t,"class",B.getFieldTypeIcon("number")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function uv(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="status",p(t,"class",B.getFieldTypeIcon("number")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function fv(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="created",p(t,"class",B.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function Bu(n){let e;function t(l,o){return l[6]?dv:cv}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&S(e)}}}function cv(n){var r;let e,t,i,s,l,o=((r=n[0])==null?void 0:r.length)&&Wu(n);return{c(){e=v("tr"),t=v("td"),i=v("h6"),i.textContent="No logs found.",s=O(),o&&o.c(),l=O(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){$(a,e,u),_(e,t),_(t,i),_(t,s),o&&o.m(t,null),_(e,l)},p(a,u){var f;(f=a[0])!=null&&f.length?o?o.p(a,u):(o=Wu(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&S(e),o&&o.d()}}}function dv(n){let e;return{c(){e=v("tr"),e.innerHTML=` + `},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function Wu(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[19]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function Uu(n){let e;return{c(){e=v("i"),p(e,"class","ri-error-warning-line txt-danger m-l-5 m-r-5"),p(e,"title","Error")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function Yu(n,e){var Se,ye,We;let t,i,s,l=((Se=e[23].method)==null?void 0:Se.toUpperCase())+"",o,r,a,u,f,c=e[23].url+"",d,h,m,b,g,y,k=(e[23].referer||"N/A")+"",w,C,M,T,D,A=(e[23].userIp||"N/A")+"",P,L,V,F,W,G=e[23].status+"",K,X,Z,ie,J,fe,Y,re,Oe,ge,ae=(((ye=e[23].meta)==null?void 0:ye.errorMessage)||((We=e[23].meta)==null?void 0:We.errorData))&&Uu();ie=new Ki({props:{date:e[23].created}});function pe(){return e[17](e[23])}function de(...ce){return e[18](e[23],...ce)}return{key:n,first:null,c(){t=v("tr"),i=v("td"),s=v("span"),o=z(l),a=O(),u=v("td"),f=v("span"),d=z(c),m=O(),ae&&ae.c(),b=O(),g=v("td"),y=v("span"),w=z(k),M=O(),T=v("td"),D=v("span"),P=z(A),V=O(),F=v("td"),W=v("span"),K=z(G),X=O(),Z=v("td"),j(ie.$$.fragment),J=O(),fe=v("td"),fe.innerHTML='',Y=O(),p(s,"class",r="label txt-uppercase "+e[9][e[23].method.toLowerCase()]),p(i,"class","col-type-text col-field-method min-width"),p(f,"class","txt txt-ellipsis"),p(f,"title",h=e[23].url),p(u,"class","col-type-text col-field-url"),p(y,"class","txt txt-ellipsis"),p(y,"title",C=e[23].referer),ee(y,"txt-hint",!e[23].referer),p(g,"class","col-type-text col-field-referer"),p(D,"class","txt txt-ellipsis"),p(D,"title",L=e[23].userIp),ee(D,"txt-hint",!e[23].userIp),p(T,"class","col-type-number col-field-userIp"),p(W,"class","label"),ee(W,"label-danger",e[23].status>=400),p(F,"class","col-type-number col-field-status"),p(Z,"class","col-type-date col-field-created"),p(fe,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(ce,se){$(ce,t,se),_(t,i),_(i,s),_(s,o),_(t,a),_(t,u),_(u,f),_(f,d),_(u,m),ae&&ae.m(u,null),_(t,b),_(t,g),_(g,y),_(y,w),_(t,M),_(t,T),_(T,D),_(D,P),_(t,V),_(t,F),_(F,W),_(W,K),_(t,X),_(t,Z),R(ie,Z,null),_(t,J),_(t,fe),_(t,Y),re=!0,Oe||(ge=[U(t,"click",pe),U(t,"keydown",de)],Oe=!0)},p(ce,se){var ne,Ee,it;e=ce,(!re||se&8)&&l!==(l=((ne=e[23].method)==null?void 0:ne.toUpperCase())+"")&&ue(o,l),(!re||se&8&&r!==(r="label txt-uppercase "+e[9][e[23].method.toLowerCase()]))&&p(s,"class",r),(!re||se&8)&&c!==(c=e[23].url+"")&&ue(d,c),(!re||se&8&&h!==(h=e[23].url))&&p(f,"title",h),((Ee=e[23].meta)==null?void 0:Ee.errorMessage)||((it=e[23].meta)==null?void 0:it.errorData)?ae||(ae=Uu(),ae.c(),ae.m(u,null)):ae&&(ae.d(1),ae=null),(!re||se&8)&&k!==(k=(e[23].referer||"N/A")+"")&&ue(w,k),(!re||se&8&&C!==(C=e[23].referer))&&p(y,"title",C),(!re||se&8)&&ee(y,"txt-hint",!e[23].referer),(!re||se&8)&&A!==(A=(e[23].userIp||"N/A")+"")&&ue(P,A),(!re||se&8&&L!==(L=e[23].userIp))&&p(D,"title",L),(!re||se&8)&&ee(D,"txt-hint",!e[23].userIp),(!re||se&8)&&G!==(G=e[23].status+"")&&ue(K,G),(!re||se&8)&&ee(W,"label-danger",e[23].status>=400);const te={};se&8&&(te.date=e[23].created),ie.$set(te)},i(ce){re||(E(ie.$$.fragment,ce),re=!0)},o(ce){I(ie.$$.fragment,ce),re=!1},d(ce){ce&&S(t),ae&&ae.d(),H(ie),Oe=!1,Re(ge)}}}function pv(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M,T,D,A,P=[],L=new Map,V;function F(de){n[11](de)}let W={disable:!0,class:"col-field-method",name:"method",$$slots:{default:[lv]},$$scope:{ctx:n}};n[1]!==void 0&&(W.sort=n[1]),s=new Ft({props:W}),le.push(()=>ke(s,"sort",F));function G(de){n[12](de)}let K={disable:!0,class:"col-type-text col-field-url",name:"url",$$slots:{default:[ov]},$$scope:{ctx:n}};n[1]!==void 0&&(K.sort=n[1]),r=new Ft({props:K}),le.push(()=>ke(r,"sort",G));function X(de){n[13](de)}let Z={disable:!0,class:"col-type-text col-field-referer",name:"referer",$$slots:{default:[rv]},$$scope:{ctx:n}};n[1]!==void 0&&(Z.sort=n[1]),f=new Ft({props:Z}),le.push(()=>ke(f,"sort",X));function ie(de){n[14](de)}let J={disable:!0,class:"col-type-number col-field-userIp",name:"userIp",$$slots:{default:[av]},$$scope:{ctx:n}};n[1]!==void 0&&(J.sort=n[1]),h=new Ft({props:J}),le.push(()=>ke(h,"sort",ie));function fe(de){n[15](de)}let Y={disable:!0,class:"col-type-number col-field-status",name:"status",$$slots:{default:[uv]},$$scope:{ctx:n}};n[1]!==void 0&&(Y.sort=n[1]),g=new Ft({props:Y}),le.push(()=>ke(g,"sort",fe));function re(de){n[16](de)}let Oe={disable:!0,class:"col-type-date col-field-created",name:"created",$$slots:{default:[fv]},$$scope:{ctx:n}};n[1]!==void 0&&(Oe.sort=n[1]),w=new Ft({props:Oe}),le.push(()=>ke(w,"sort",re));let ge=n[3];const ae=de=>de[23].id;for(let de=0;del=!1)),s.$set(ye);const We={};Se&67108864&&(We.$$scope={dirty:Se,ctx:de}),!a&&Se&2&&(a=!0,We.sort=de[1],$e(()=>a=!1)),r.$set(We);const ce={};Se&67108864&&(ce.$$scope={dirty:Se,ctx:de}),!c&&Se&2&&(c=!0,ce.sort=de[1],$e(()=>c=!1)),f.$set(ce);const se={};Se&67108864&&(se.$$scope={dirty:Se,ctx:de}),!m&&Se&2&&(m=!0,se.sort=de[1],$e(()=>m=!1)),h.$set(se);const te={};Se&67108864&&(te.$$scope={dirty:Se,ctx:de}),!y&&Se&2&&(y=!0,te.sort=de[1],$e(()=>y=!1)),g.$set(te);const ne={};Se&67108864&&(ne.$$scope={dirty:Se,ctx:de}),!C&&Se&2&&(C=!0,ne.sort=de[1],$e(()=>C=!1)),w.$set(ne),Se&841&&(ge=de[3],be(),P=bt(P,Se,ae,1,de,ge,L,A,xt,Yu,null,zu),ve(),!ge.length&&pe?pe.p(de,Se):ge.length?pe&&(pe.d(1),pe=null):(pe=Bu(de),pe.c(),pe.m(A,null))),(!V||Se&64)&&ee(e,"table-loading",de[6])},i(de){if(!V){E(s.$$.fragment,de),E(r.$$.fragment,de),E(f.$$.fragment,de),E(h.$$.fragment,de),E(g.$$.fragment,de),E(w.$$.fragment,de);for(let Se=0;Se{if(L<=1&&b(),t(6,d=!1),t(5,f=F.page),t(4,c=F.totalItems),s("load",u.concat(F.items)),V){const W=++h;for(;F.items.length&&h==W;)t(3,u=u.concat(F.items.splice(0,10))),await B.yieldToMain()}else t(3,u=u.concat(F.items))}).catch(F=>{F!=null&&F.isAbort||(t(6,d=!1),console.warn(F),b(),me.errorResponseHandler(F,!1))})}function b(){t(3,u=[]),t(5,f=1),t(4,c=0)}function g(L){a=L,t(1,a)}function y(L){a=L,t(1,a)}function k(L){a=L,t(1,a)}function w(L){a=L,t(1,a)}function C(L){a=L,t(1,a)}function M(L){a=L,t(1,a)}const T=L=>s("select",L),D=(L,V)=>{V.code==="Enter"&&(V.preventDefault(),s("select",L))},A=()=>t(0,o=""),P=()=>m(f+1);return n.$$set=L=>{"filter"in L&&t(0,o=L.filter),"presets"in L&&t(10,r=L.presets),"sort"in L&&t(1,a=L.sort)},n.$$.update=()=>{n.$$.dirty&1027&&(typeof a<"u"||typeof o<"u"||typeof r<"u")&&(b(),m(1)),n.$$.dirty&24&&t(7,i=c>u.length)},[o,a,m,u,c,f,d,i,s,l,r,g,y,k,w,C,M,T,D,A,P]}class gv extends Me{constructor(e){super(),Ce(this,e,mv,hv,we,{filter:0,presets:10,sort:1,load:2})}get load(){return this.$$.ctx[2]}}/*! + * Chart.js v3.9.1 + * https://www.chartjs.org + * (c) 2022 Chart.js Contributors + * Released under the MIT License + */function Qn(){}const _v=function(){let n=0;return function(){return n++}}();function nt(n){return n===null||typeof n>"u"}function ft(n){if(Array.isArray&&Array.isArray(n))return!0;const e=Object.prototype.toString.call(n);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function Ue(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const _t=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function hn(n,e){return _t(n)?n:e}function Ge(n,e){return typeof n>"u"?e:n}const bv=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/e,Sg=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function pt(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function lt(n,e,t,i){let s,l,o;if(ft(n))if(l=n.length,i)for(s=l-1;s>=0;s--)e.call(t,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function vi(n,e){return(Zu[e]||(Zu[e]=kv(e)))(n)}function kv(n){const e=wv(n);return t=>{for(const i of e){if(i==="")break;t=t&&t[i]}return t}}function wv(n){const e=n.split("."),t=[];let i="";for(const s of e)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(t.push(i),i="");return t}function $a(n){return n.charAt(0).toUpperCase()+n.slice(1)}const wn=n=>typeof n<"u",yi=n=>typeof n=="function",Gu=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function Sv(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const gt=Math.PI,ot=2*gt,$v=ot+gt,ko=Number.POSITIVE_INFINITY,Cv=gt/180,ht=gt/2,Hs=gt/4,Xu=gt*2/3,bn=Math.log10,zn=Math.sign;function Qu(n){const e=Math.round(n);n=xs(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(bn(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function Mv(n){const e=[],t=Math.sqrt(n);let i;for(i=1;is-l).pop(),e}function ws(n){return!isNaN(parseFloat(n))&&isFinite(n)}function xs(n,e,t){return Math.abs(n-e)=n}function Cg(n,e,t){let i,s,l;for(i=0,s=n.length;ia&&u=Math.min(e,t)-i&&n<=Math.max(e,t)+i}function Ma(n,e,t){t=t||(o=>n[o]1;)l=s+i>>1,t(l)?s=l:i=l;return{lo:s,hi:i}}const qi=(n,e,t,i)=>Ma(n,t,i?s=>n[s][e]<=t:s=>n[s][e]Ma(n,t,i=>n[i][e]>=t);function Av(n,e,t){let i=0,s=n.length;for(;ii&&n[s-1]>t;)s--;return i>0||s{const i="_onData"+$a(t),s=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...l){const o=s.apply(this,l);return n._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...l)}),o}})})}function ef(n,e){const t=n._chartjs;if(!t)return;const i=t.listeners,s=i.indexOf(e);s!==-1&&i.splice(s,1),!(i.length>0)&&(Tg.forEach(l=>{delete n[l]}),delete n._chartjs)}function Og(n){const e=new Set;let t,i;for(t=0,i=n.length;t"u"?function(n){return n()}:window.requestAnimationFrame}();function Eg(n,e,t){const i=t||(o=>Array.prototype.slice.call(o));let s=!1,l=[];return function(...o){l=i(o),s||(s=!0,Dg.call(window,()=>{s=!1,n.apply(e,l)}))}}function Pv(n,e){let t;return function(...i){return e?(clearTimeout(t),t=setTimeout(n,e,i)):n.apply(this,i),e}}const Lv=n=>n==="start"?"left":n==="end"?"right":"center",tf=(n,e,t)=>n==="start"?e:n==="end"?t:(e+t)/2;function Ag(n,e,t){const i=e.length;let s=0,l=i;if(n._sorted){const{iScale:o,_parsed:r}=n,a=o.axis,{min:u,max:f,minDefined:c,maxDefined:d}=o.getUserBounds();c&&(s=Rt(Math.min(qi(r,o.axis,u).lo,t?i:qi(e,a,o.getPixelForValue(u)).lo),0,i-1)),d?l=Rt(Math.max(qi(r,o.axis,f,!0).hi+1,t?0:qi(e,a,o.getPixelForValue(f),!0).hi+1),s,i)-s:l=i-s}return{start:s,count:l}}function Ig(n){const{xScale:e,yScale:t,_scaleRanges:i}=n,s={xmin:e.min,xmax:e.max,ymin:t.min,ymax:t.max};if(!i)return n._scaleRanges=s,!0;const l=i.xmin!==e.min||i.xmax!==e.max||i.ymin!==t.min||i.ymax!==t.max;return Object.assign(i,s),l}const Vl=n=>n===0||n===1,nf=(n,e,t)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-e)*ot/t)),sf=(n,e,t)=>Math.pow(2,-10*n)*Math.sin((n-e)*ot/t)+1,el={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*ht)+1,easeOutSine:n=>Math.sin(n*ht),easeInOutSine:n=>-.5*(Math.cos(gt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Vl(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Vl(n)?n:nf(n,.075,.3),easeOutElastic:n=>Vl(n)?n:sf(n,.075,.3),easeInOutElastic(n){return Vl(n)?n:n<.5?.5*nf(n*2,.1125,.45):.5+.5*sf(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let e=1.70158;return(n/=.5)<1?.5*(n*n*(((e*=1.525)+1)*n-e)):.5*((n-=2)*n*(((e*=1.525)+1)*n+e)+2)},easeInBounce:n=>1-el.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?el.easeInBounce(n*2)*.5:el.easeOutBounce(n*2-1)*.5+.5};/*! + * @kurkle/color v0.2.1 + * https://github.com/kurkle/color#readme + * (c) 2022 Jukka Kurkela + * Released under the MIT License + */function Cl(n){return n+.5|0}const hi=(n,e,t)=>Math.max(Math.min(n,t),e);function Js(n){return hi(Cl(n*2.55),0,255)}function bi(n){return hi(Cl(n*255),0,255)}function ti(n){return hi(Cl(n/2.55)/100,0,1)}function lf(n){return hi(Cl(n*100),0,100)}const pn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Wr=[..."0123456789ABCDEF"],Nv=n=>Wr[n&15],Fv=n=>Wr[(n&240)>>4]+Wr[n&15],zl=n=>(n&240)>>4===(n&15),Rv=n=>zl(n.r)&&zl(n.g)&&zl(n.b)&&zl(n.a);function Hv(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&pn[n[1]]*17,g:255&pn[n[2]]*17,b:255&pn[n[3]]*17,a:e===5?pn[n[4]]*17:255}:(e===7||e===9)&&(t={r:pn[n[1]]<<4|pn[n[2]],g:pn[n[3]]<<4|pn[n[4]],b:pn[n[5]]<<4|pn[n[6]],a:e===9?pn[n[7]]<<4|pn[n[8]]:255})),t}const jv=(n,e)=>n<255?e(n):"";function qv(n){var e=Rv(n)?Nv:Fv;return n?"#"+e(n.r)+e(n.g)+e(n.b)+jv(n.a,e):void 0}const Vv=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Pg(n,e,t){const i=e*Math.min(t,1-t),s=(l,o=(l+n/30)%12)=>t-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function zv(n,e,t){const i=(s,l=(s+n/60)%6)=>t-t*e*Math.max(Math.min(l,4-l,1),0);return[i(5),i(3),i(1)]}function Bv(n,e,t){const i=Pg(n,1,.5);let s;for(e+t>1&&(s=1/(e+t),e*=s,t*=s),s=0;s<3;s++)i[s]*=1-e-t,i[s]+=e;return i}function Wv(n,e,t,i,s){return n===s?(e-t)/i+(e.5?f/(2-l-o):f/(l+o),a=Wv(t,i,s,f,l),a=a*60+.5),[a|0,u||0,r]}function Oa(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(bi)}function Da(n,e,t){return Oa(Pg,n,e,t)}function Uv(n,e,t){return Oa(Bv,n,e,t)}function Yv(n,e,t){return Oa(zv,n,e,t)}function Lg(n){return(n%360+360)%360}function Kv(n){const e=Vv.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?Js(+e[5]):bi(+e[5]));const s=Lg(+e[2]),l=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=Uv(s,l,o):e[1]==="hsv"?i=Yv(s,l,o):i=Da(s,l,o),{r:i[0],g:i[1],b:i[2],a:t}}function Jv(n,e){var t=Ta(n);t[0]=Lg(t[0]+e),t=Da(t),n.r=t[0],n.g=t[1],n.b=t[2]}function Zv(n){if(!n)return;const e=Ta(n),t=e[0],i=lf(e[1]),s=lf(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${s}%, ${ti(n.a)})`:`hsl(${t}, ${i}%, ${s}%)`}const of={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},rf={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function Gv(){const n={},e=Object.keys(rf),t=Object.keys(of);let i,s,l,o,r;for(i=0;i>16&255,l>>8&255,l&255]}return n}let Bl;function Xv(n){Bl||(Bl=Gv(),Bl.transparent=[0,0,0,0]);const e=Bl[n.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const Qv=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function xv(n){const e=Qv.exec(n);let t=255,i,s,l;if(!!e){if(e[7]!==i){const o=+e[7];t=e[8]?Js(o):hi(o*255,0,255)}return i=+e[1],s=+e[3],l=+e[5],i=255&(e[2]?Js(i):hi(i,0,255)),s=255&(e[4]?Js(s):hi(s,0,255)),l=255&(e[6]?Js(l):hi(l,0,255)),{r:i,g:s,b:l,a:t}}}function ey(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${ti(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const sr=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,us=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function ty(n,e,t){const i=us(ti(n.r)),s=us(ti(n.g)),l=us(ti(n.b));return{r:bi(sr(i+t*(us(ti(e.r))-i))),g:bi(sr(s+t*(us(ti(e.g))-s))),b:bi(sr(l+t*(us(ti(e.b))-l))),a:n.a+t*(e.a-n.a)}}function Wl(n,e,t){if(n){let i=Ta(n);i[e]=Math.max(0,Math.min(i[e]+i[e]*t,e===0?360:1)),i=Da(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Ng(n,e){return n&&Object.assign(e||{},n)}function af(n){var e={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(e={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(e.a=bi(n[3]))):(e=Ng(n,{r:0,g:0,b:0,a:1}),e.a=bi(e.a)),e}function ny(n){return n.charAt(0)==="r"?xv(n):Kv(n)}class wo{constructor(e){if(e instanceof wo)return e;const t=typeof e;let i;t==="object"?i=af(e):t==="string"&&(i=Hv(e)||Xv(e)||ny(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=Ng(this._rgb);return e&&(e.a=ti(e.a)),e}set rgb(e){this._rgb=af(e)}rgbString(){return this._valid?ey(this._rgb):void 0}hexString(){return this._valid?qv(this._rgb):void 0}hslString(){return this._valid?Zv(this._rgb):void 0}mix(e,t){if(e){const i=this.rgb,s=e.rgb;let l;const o=t===l?.5:t,r=2*o-1,a=i.a-s.a,u=((r*a===-1?r:(r+a)/(1+r*a))+1)/2;l=1-u,i.r=255&u*i.r+l*s.r+.5,i.g=255&u*i.g+l*s.g+.5,i.b=255&u*i.b+l*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(e,t){return e&&(this._rgb=ty(this._rgb,e._rgb,t)),this}clone(){return new wo(this.rgb)}alpha(e){return this._rgb.a=bi(e),this}clearer(e){const t=this._rgb;return t.a*=1-e,this}greyscale(){const e=this._rgb,t=Cl(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=t,this}opaquer(e){const t=this._rgb;return t.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Wl(this._rgb,2,e),this}darken(e){return Wl(this._rgb,2,-e),this}saturate(e){return Wl(this._rgb,1,e),this}desaturate(e){return Wl(this._rgb,1,-e),this}rotate(e){return Jv(this._rgb,e),this}}function Fg(n){return new wo(n)}function Rg(n){if(n&&typeof n=="object"){const e=n.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function uf(n){return Rg(n)?n:Fg(n)}function lr(n){return Rg(n)?n:Fg(n).saturate(.5).darken(.1).hexString()}const Ji=Object.create(null),Ur=Object.create(null);function tl(n,e){if(!e)return n;const t=e.split(".");for(let i=0,s=t.length;it.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,i)=>lr(i.backgroundColor),this.hoverBorderColor=(t,i)=>lr(i.borderColor),this.hoverColor=(t,i)=>lr(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e)}set(e,t){return or(this,e,t)}get(e){return tl(this,e)}describe(e,t){return or(Ur,e,t)}override(e,t){return or(Ji,e,t)}route(e,t,i,s){const l=tl(this,e),o=tl(this,i),r="_"+t;Object.defineProperties(l,{[r]:{value:l[t],writable:!0},[t]:{enumerable:!0,get(){const a=this[r],u=o[s];return Ue(a)?Object.assign({},u,a):Ge(a,u)},set(a){this[r]=a}}})}}var Xe=new iy({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function sy(n){return!n||nt(n.size)||nt(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function So(n,e,t,i,s){let l=e[s];return l||(l=e[s]=n.measureText(s).width,t.push(s)),l>i&&(i=l),i}function ly(n,e,t,i){i=i||{};let s=i.data=i.data||{},l=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(s=i.data={},l=i.garbageCollect=[],i.font=e),n.save(),n.font=e;let o=0;const r=t.length;let a,u,f,c,d;for(a=0;at.length){for(a=0;a0&&n.stroke()}}function dl(n,e,t){return t=t||.5,!e||n&&n.x>e.left-t&&n.xe.top-t&&n.y0&&l.strokeColor!=="";let a,u;for(n.save(),n.font=s.string,uy(n,l),a=0;a+n||0;function Ia(n,e){const t={},i=Ue(e),s=i?Object.keys(e):e,l=Ue(n)?i?o=>Ge(n[o],n[e[o]]):o=>n[o]:()=>n;for(const o of s)t[o]=hy(l(o));return t}function Hg(n){return Ia(n,{top:"y",right:"x",bottom:"y",left:"x"})}function gs(n){return Ia(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Sn(n){const e=Hg(n);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function rn(n,e){n=n||{},e=e||Xe.font;let t=Ge(n.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let i=Ge(n.style,e.style);i&&!(""+i).match(dy)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");const s={family:Ge(n.family,e.family),lineHeight:py(Ge(n.lineHeight,e.lineHeight),t),size:t,style:i,weight:Ge(n.weight,e.weight),string:""};return s.string=sy(s),s}function Ul(n,e,t,i){let s=!0,l,o,r;for(l=0,o=n.length;lt&&r===0?0:r+a;return{min:o(i,-Math.abs(l)),max:o(s,l)}}function Si(n,e){return Object.assign(Object.create(n),e)}function Pa(n,e=[""],t=n,i,s=()=>n[0]){wn(i)||(i=zg("_fallback",n));const l={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:t,_fallback:i,_getTarget:s,override:o=>Pa([o,...n],e,t,i)};return new Proxy(l,{deleteProperty(o,r){return delete o[r],delete o._keys,delete n[0][r],!0},get(o,r){return qg(o,r,()=>Sy(r,e,n,o))},getOwnPropertyDescriptor(o,r){return Reflect.getOwnPropertyDescriptor(o._scopes[0],r)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(o,r){return df(o).includes(r)},ownKeys(o){return df(o)},set(o,r,a){const u=o._storage||(o._storage=s());return o[r]=u[r]=a,delete o._keys,!0}})}function Ss(n,e,t,i){const s={_cacheable:!1,_proxy:n,_context:e,_subProxy:t,_stack:new Set,_descriptors:jg(n,i),setContext:l=>Ss(n,l,t,i),override:l=>Ss(n.override(l),e,t,i)};return new Proxy(s,{deleteProperty(l,o){return delete l[o],delete n[o],!0},get(l,o,r){return qg(l,o,()=>_y(l,o,r))},getOwnPropertyDescriptor(l,o){return l._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(l,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(l,o,r){return n[o]=r,delete l[o],!0}})}function jg(n,e={scriptable:!0,indexable:!0}){const{_scriptable:t=e.scriptable,_indexable:i=e.indexable,_allKeys:s=e.allKeys}=n;return{allKeys:s,scriptable:t,indexable:i,isScriptable:yi(t)?t:()=>t,isIndexable:yi(i)?i:()=>i}}const gy=(n,e)=>n?n+$a(e):e,La=(n,e)=>Ue(e)&&n!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function qg(n,e,t){if(Object.prototype.hasOwnProperty.call(n,e))return n[e];const i=t();return n[e]=i,i}function _y(n,e,t){const{_proxy:i,_context:s,_subProxy:l,_descriptors:o}=n;let r=i[e];return yi(r)&&o.isScriptable(e)&&(r=by(e,r,n,t)),ft(r)&&r.length&&(r=vy(e,r,n,o.isIndexable)),La(e,r)&&(r=Ss(r,s,l&&l[e],o)),r}function by(n,e,t,i){const{_proxy:s,_context:l,_subProxy:o,_stack:r}=t;if(r.has(n))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+n);return r.add(n),e=e(l,o||i),r.delete(n),La(n,e)&&(e=Na(s._scopes,s,n,e)),e}function vy(n,e,t,i){const{_proxy:s,_context:l,_subProxy:o,_descriptors:r}=t;if(wn(l.index)&&i(n))e=e[l.index%e.length];else if(Ue(e[0])){const a=e,u=s._scopes.filter(f=>f!==a);e=[];for(const f of a){const c=Na(u,s,n,f);e.push(Ss(c,l,o&&o[n],r))}}return e}function Vg(n,e,t){return yi(n)?n(e,t):n}const yy=(n,e)=>n===!0?e:typeof n=="string"?vi(e,n):void 0;function ky(n,e,t,i,s){for(const l of e){const o=yy(t,l);if(o){n.add(o);const r=Vg(o._fallback,t,s);if(wn(r)&&r!==t&&r!==i)return r}else if(o===!1&&wn(i)&&t!==i)return null}return!1}function Na(n,e,t,i){const s=e._rootScopes,l=Vg(e._fallback,t,i),o=[...n,...s],r=new Set;r.add(i);let a=cf(r,o,t,l||t,i);return a===null||wn(l)&&l!==t&&(a=cf(r,o,l,a,i),a===null)?!1:Pa(Array.from(r),[""],s,l,()=>wy(e,t,i))}function cf(n,e,t,i,s){for(;t;)t=ky(n,e,t,i,s);return t}function wy(n,e,t){const i=n._getTarget();e in i||(i[e]={});const s=i[e];return ft(s)&&Ue(t)?t:s}function Sy(n,e,t,i){let s;for(const l of e)if(s=zg(gy(l,n),t),wn(s))return La(n,s)?Na(t,i,n,s):s}function zg(n,e){for(const t of e){if(!t)continue;const i=t[n];if(wn(i))return i}}function df(n){let e=n._keys;return e||(e=n._keys=$y(n._scopes)),e}function $y(n){const e=new Set;for(const t of n)for(const i of Object.keys(t).filter(s=>!s.startsWith("_")))e.add(i);return Array.from(e)}function Bg(n,e,t,i){const{iScale:s}=n,{key:l="r"}=this._parsing,o=new Array(i);let r,a,u,f;for(r=0,a=i;ren==="x"?"y":"x";function My(n,e,t,i){const s=n.skip?e:n,l=e,o=t.skip?e:t,r=Br(l,s),a=Br(o,l);let u=r/(r+a),f=a/(r+a);u=isNaN(u)?0:u,f=isNaN(f)?0:f;const c=i*u,d=i*f;return{previous:{x:l.x-c*(o.x-s.x),y:l.y-c*(o.y-s.y)},next:{x:l.x+d*(o.x-s.x),y:l.y+d*(o.y-s.y)}}}function Ty(n,e,t){const i=n.length;let s,l,o,r,a,u=$s(n,0);for(let f=0;f!u.skip)),e.cubicInterpolationMode==="monotone")Dy(n,s);else{let u=i?n[n.length-1]:n[0];for(l=0,o=n.length;lwindow.getComputedStyle(n,null);function Iy(n,e){return zo(n).getPropertyValue(e)}const Py=["top","right","bottom","left"];function Bi(n,e,t){const i={};t=t?"-"+t:"";for(let s=0;s<4;s++){const l=Py[s];i[l]=parseFloat(n[e+"-"+l+t])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Ly=(n,e,t)=>(n>0||e>0)&&(!t||!t.shadowRoot);function Ny(n,e){const t=n.touches,i=t&&t.length?t[0]:n,{offsetX:s,offsetY:l}=i;let o=!1,r,a;if(Ly(s,l,n.target))r=s,a=l;else{const u=e.getBoundingClientRect();r=i.clientX-u.left,a=i.clientY-u.top,o=!0}return{x:r,y:a,box:o}}function Ri(n,e){if("native"in n)return n;const{canvas:t,currentDevicePixelRatio:i}=e,s=zo(t),l=s.boxSizing==="border-box",o=Bi(s,"padding"),r=Bi(s,"border","width"),{x:a,y:u,box:f}=Ny(n,t),c=o.left+(f&&r.left),d=o.top+(f&&r.top);let{width:h,height:m}=e;return l&&(h-=o.width+r.width,m-=o.height+r.height),{x:Math.round((a-c)/h*t.width/i),y:Math.round((u-d)/m*t.height/i)}}function Fy(n,e,t){let i,s;if(e===void 0||t===void 0){const l=Fa(n);if(!l)e=n.clientWidth,t=n.clientHeight;else{const o=l.getBoundingClientRect(),r=zo(l),a=Bi(r,"border","width"),u=Bi(r,"padding");e=o.width-u.width-a.width,t=o.height-u.height-a.height,i=Mo(r.maxWidth,l,"clientWidth"),s=Mo(r.maxHeight,l,"clientHeight")}}return{width:e,height:t,maxWidth:i||ko,maxHeight:s||ko}}const rr=n=>Math.round(n*10)/10;function Ry(n,e,t,i){const s=zo(n),l=Bi(s,"margin"),o=Mo(s.maxWidth,n,"clientWidth")||ko,r=Mo(s.maxHeight,n,"clientHeight")||ko,a=Fy(n,e,t);let{width:u,height:f}=a;if(s.boxSizing==="content-box"){const c=Bi(s,"border","width"),d=Bi(s,"padding");u-=d.width+c.width,f-=d.height+c.height}return u=Math.max(0,u-l.width),f=Math.max(0,i?Math.floor(u/i):f-l.height),u=rr(Math.min(u,o,a.maxWidth)),f=rr(Math.min(f,r,a.maxHeight)),u&&!f&&(f=rr(u/2)),{width:u,height:f}}function pf(n,e,t){const i=e||1,s=Math.floor(n.height*i),l=Math.floor(n.width*i);n.height=s/i,n.width=l/i;const o=n.canvas;return o.style&&(t||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==l?(n.currentDevicePixelRatio=i,o.height=s,o.width=l,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const Hy=function(){let n=!1;try{const e={get passive(){return n=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch{}return n}();function hf(n,e){const t=Iy(n,e),i=t&&t.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Hi(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:n.y+t*(e.y-n.y)}}function jy(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:i==="middle"?t<.5?n.y:e.y:i==="after"?t<1?n.y:e.y:t>0?e.y:n.y}}function qy(n,e,t,i){const s={x:n.cp2x,y:n.cp2y},l={x:e.cp1x,y:e.cp1y},o=Hi(n,s,t),r=Hi(s,l,t),a=Hi(l,e,t),u=Hi(o,r,t),f=Hi(r,a,t);return Hi(u,f,t)}const mf=new Map;function Vy(n,e){e=e||{};const t=n+JSON.stringify(e);let i=mf.get(t);return i||(i=new Intl.NumberFormat(n,e),mf.set(t,i)),i}function Ml(n,e,t){return Vy(e,t).format(n)}const zy=function(n,e){return{x(t){return n+n+e-t},setWidth(t){e=t},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,i){return t-i},leftForLtr(t,i){return t-i}}},By=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,e){return n+e},leftForLtr(n,e){return n}}};function ar(n,e,t){return n?zy(e,t):By()}function Wy(n,e){let t,i;(e==="ltr"||e==="rtl")&&(t=n.canvas.style,i=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",e,"important"),n.prevTextDirection=i)}function Uy(n,e){e!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",e[0],e[1]))}function Yg(n){return n==="angle"?{between:fl,compare:Ov,normalize:on}:{between:cl,compare:(e,t)=>e-t,normalize:e=>e}}function gf({start:n,end:e,count:t,loop:i,style:s}){return{start:n%t,end:e%t,loop:i&&(e-n+1)%t===0,style:s}}function Yy(n,e,t){const{property:i,start:s,end:l}=t,{between:o,normalize:r}=Yg(i),a=e.length;let{start:u,end:f,loop:c}=n,d,h;if(c){for(u+=a,f+=a,d=0,h=a;da(s,w,y)&&r(s,w)!==0,M=()=>r(l,y)===0||a(l,w,y),T=()=>b||C(),D=()=>!b||M();for(let A=f,P=f;A<=c;++A)k=e[A%o],!k.skip&&(y=u(k[i]),y!==w&&(b=a(y,s,l),g===null&&T()&&(g=r(y,s)===0?A:P),g!==null&&D()&&(m.push(gf({start:g,end:A,loop:d,count:o,style:h})),g=null),P=A,w=y));return g!==null&&m.push(gf({start:g,end:c,loop:d,count:o,style:h})),m}function Jg(n,e){const t=[],i=n.segments;for(let s=0;ss&&n[l%e].skip;)l--;return l%=e,{start:s,end:l}}function Jy(n,e,t,i){const s=n.length,l=[];let o=e,r=n[e],a;for(a=e+1;a<=t;++a){const u=n[a%s];u.skip||u.stop?r.skip||(i=!1,l.push({start:e%s,end:(a-1)%s,loop:i}),e=o=u.stop?a:null):(o=a,r.skip&&(e=a)),r=u}return o!==null&&l.push({start:e%s,end:o%s,loop:i}),l}function Zy(n,e){const t=n.points,i=n.options.spanGaps,s=t.length;if(!s)return[];const l=!!n._loop,{start:o,end:r}=Ky(t,s,l,i);if(i===!0)return _f(n,[{start:o,end:r,loop:l}],t,e);const a=rr({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(i-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=Dg.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const l=i.items;let o=l.length-1,r=!1,a;for(;o>=0;--o)a=l[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(e),r=!0):(l[o]=l[l.length-1],l.pop());r&&(s.draw(),this._notify(s,i,e,"progress")),l.length||(i.running=!1,this._notify(s,i,e,"complete"),i.initial=!1),t+=l.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);!t||(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const i=t.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var xn=new Qy;const vf="transparent",xy={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=uf(n||vf),s=i.valid&&uf(e||vf);return s&&s.valid?s.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class e2{constructor(e,t,i,s){const l=t[i];s=Ul([e.to,s,l,e.from]);const o=Ul([e.from,l,s]);this._active=!0,this._fn=e.fn||xy[e.type||typeof o],this._easing=el[e.easing]||el.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const s=this._target[this._prop],l=i-this._start,o=this._duration-l;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=l,this._loop=!!e.loop,this._to=Ul([e.to,t,s,e.from]),this._from=Ul([e.from,s,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,s=this._prop,l=this._from,o=this._loop,r=this._to;let a;if(this._active=l!==r&&(o||t1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[s]=this._fn(l,r,a)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){const t=e?"res":"rej",i=this._promises||[];for(let s=0;sn!=="onProgress"&&n!=="onComplete"&&n!=="fn"});Xe.set("animations",{colors:{type:"color",properties:n2},numbers:{type:"number",properties:t2}});Xe.describe("animations",{_fallback:"animation"});Xe.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:n=>n|0}}}});class Zg{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!Ue(e))return;const t=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!Ue(s))return;const l={};for(const o of i2)l[o]=s[o];(ft(s.properties)&&s.properties||[i]).forEach(o=>{(o===i||!t.has(o))&&t.set(o,l)})})}_animateOptions(e,t){const i=t.options,s=l2(e,i);if(!s)return[];const l=this._createAnimations(s,i);return i.$shared&&s2(e.options.$animations,i).then(()=>{e.options=i},()=>{}),l}_createAnimations(e,t){const i=this._properties,s=[],l=e.$animations||(e.$animations={}),o=Object.keys(t),r=Date.now();let a;for(a=o.length-1;a>=0;--a){const u=o[a];if(u.charAt(0)==="$")continue;if(u==="options"){s.push(...this._animateOptions(e,t));continue}const f=t[u];let c=l[u];const d=i.get(u);if(c)if(d&&c.active()){c.update(d,f,r);continue}else c.cancel();if(!d||!d.duration){e[u]=f;continue}l[u]=c=new e2(d,e,u,f),s.push(c)}return s}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}const i=this._createAnimations(e,t);if(i.length)return xn.add(this._chart,i),!0}}function s2(n,e){const t=[],i=Object.keys(e);for(let s=0;s0||!t&&l<0)return s.index}return null}function $f(n,e){const{chart:t,_cachedMeta:i}=n,s=t._stacks||(t._stacks={}),{iScale:l,vScale:o,index:r}=i,a=l.axis,u=o.axis,f=u2(l,o,i),c=e.length;let d;for(let h=0;ht[i].axis===e).shift()}function d2(n,e){return Si(n,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function p2(n,e,t){return Si(n,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function js(n,e){const t=n.controller.index,i=n.vScale&&n.vScale.axis;if(!!i){e=e||n._parsed;for(const s of e){const l=s._stacks;if(!l||l[i]===void 0||l[i][t]===void 0)return;delete l[i][t]}}}const fr=n=>n==="reset"||n==="none",Cf=(n,e)=>e?n:Object.assign({},n),h2=(n,e,t)=>n&&!e.hidden&&e._stacked&&{keys:Gg(t,!0),values:null};class Rn{constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=wf(e.vScale,e),this.addElements()}updateIndex(e){this.index!==e&&js(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,i=this.getDataset(),s=(c,d,h,m)=>c==="x"?d:c==="r"?m:h,l=t.xAxisID=Ge(i.xAxisID,ur(e,"x")),o=t.yAxisID=Ge(i.yAxisID,ur(e,"y")),r=t.rAxisID=Ge(i.rAxisID,ur(e,"r")),a=t.indexAxis,u=t.iAxisID=s(a,l,o,r),f=t.vAxisID=s(a,o,l,r);t.xScale=this.getScaleForId(l),t.yScale=this.getScaleForId(o),t.rScale=this.getScaleForId(r),t.iScale=this.getScaleForId(u),t.vScale=this.getScaleForId(f)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&ef(this._data,this),e._stacked&&js(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),i=this._data;if(Ue(t))this._data=a2(t);else if(i!==t){if(i){ef(i,this);const s=this._cachedMeta;js(s),s._parsed=[]}t&&Object.isExtensible(t)&&Iv(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const l=t._stacked;t._stacked=wf(t.vScale,t),t.stack!==i.stack&&(s=!0,js(t),t.stack=i.stack),this._resyncElements(e),(s||l!==t._stacked)&&$f(this,t._parsed)}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:i,_data:s}=this,{iScale:l,_stacked:o}=i,r=l.axis;let a=e===0&&t===s.length?!0:i._sorted,u=e>0&&i._parsed[e-1],f,c,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{ft(s[e])?d=this.parseArrayData(i,s,e,t):Ue(s[e])?d=this.parseObjectData(i,s,e,t):d=this.parsePrimitiveData(i,s,e,t);const h=()=>c[r]===null||u&&c[r]b||c=0;--d)if(!m()){this.updateRangeFromParsed(u,e,h,a);break}}return u}getAllParsedValues(e){const t=this._cachedMeta._parsed,i=[];let s,l,o;for(s=0,l=t.length;s=0&&ethis.getContext(i,s),b=u.resolveNamedOptions(d,h,m,c);return b.$shared&&(b.$shared=a,l[o]=Object.freeze(Cf(b,a))),b}_resolveAnimations(e,t,i){const s=this.chart,l=this._cachedDataOpts,o=`animation-${t}`,r=l[o];if(r)return r;let a;if(s.options.animation!==!1){const f=this.chart.config,c=f.datasetAnimationScopeKeys(this._type,t),d=f.getOptionScopes(this.getDataset(),c);a=f.createResolver(d,this.getContext(e,i,t))}const u=new Zg(s,a&&a.animations);return a&&a._cacheable&&(l[o]=Object.freeze(u)),u}getSharedOptions(e){if(!!e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||fr(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const i=this.resolveDataElementOptions(e,t),s=this._sharedOptions,l=this.getSharedOptions(i),o=this.includeOptions(t,l)||l!==s;return this.updateSharedOptions(l,t,i),{sharedOptions:l,includeOptions:o}}updateElement(e,t,i,s){fr(s)?Object.assign(e,i):this._resolveAnimations(t,s).update(e,i)}updateSharedOptions(e,t,i){e&&!fr(t)&&this._resolveAnimations(void 0,t).update(e,i)}_setStyle(e,t,i,s){e.active=s;const l=this.getStyle(t,s);this._resolveAnimations(t,i,s).update(e,{options:!s&&this.getSharedOptions(l)||l})}removeHoverStyle(e,t,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,t,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,i=this._cachedMeta.data;for(const[r,a,u]of this._syncList)this[r](a,u);this._syncList=[];const s=i.length,l=t.length,o=Math.min(l,s);o&&this.parse(0,o),l>s?this._insertElements(s,l-s,e):l{for(u.length+=t,r=u.length-1;r>=o;r--)u[r]=u[r-t]};for(a(l),r=e;rs-l))}return n._cache.$bar}function g2(n){const e=n.iScale,t=m2(e,n.type);let i=e._length,s,l,o,r;const a=()=>{o===32767||o===-32768||(wn(r)&&(i=Math.min(i,Math.abs(o-r)||i)),r=o)};for(s=0,l=t.length;s0?s[n-1]:null,r=nMath.abs(r)&&(a=r,u=o),e[t.axis]=u,e._custom={barStart:a,barEnd:u,start:s,end:l,min:o,max:r}}function Xg(n,e,t,i){return ft(n)?v2(n,e,t,i):e[t.axis]=t.parse(n,i),e}function Mf(n,e,t,i){const s=n.iScale,l=n.vScale,o=s.getLabels(),r=s===l,a=[];let u,f,c,d;for(u=t,f=t+i;u=t?1:-1)}function k2(n){let e,t,i,s,l;return n.horizontal?(e=n.base>n.x,t="left",i="right"):(e=n.basea.controller.options.grouped),l=i.options.stacked,o=[],r=a=>{const u=a.controller.getParsed(t),f=u&&u[a.vScale.axis];if(nt(f)||isNaN(f))return!0};for(const a of s)if(!(t!==void 0&&r(a))&&((l===!1||o.indexOf(a.stack)===-1||l===void 0&&a.stack===void 0)&&o.push(a.stack),a.index===e))break;return o.length||o.push(void 0),o}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,t,i){const s=this._getStacks(e,i),l=t!==void 0?s.indexOf(t):-1;return l===-1?s.length-1:l}_getRuler(){const e=this.options,t=this._cachedMeta,i=t.iScale,s=[];let l,o;for(l=0,o=t.data.length;l=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}getLabelAndValue(e){const t=this._cachedMeta,{xScale:i,yScale:s}=t,l=this.getParsed(e),o=i.getLabelForValue(l.x),r=s.getLabelForValue(l.y),a=l._custom;return{label:t.label,value:"("+o+", "+r+(a?", "+a:"")+")"}}update(e){const t=this._cachedMeta.data;this.updateElements(t,0,t.length,e)}updateElements(e,t,i,s){const l=s==="reset",{iScale:o,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:u}=this._getSharedOptions(t,s),f=o.axis,c=r.axis;for(let d=t;dfl(w,r,a,!0)?1:Math.max(C,C*t,M,M*t),m=(w,C,M)=>fl(w,r,a,!0)?-1:Math.min(C,C*t,M,M*t),b=h(0,u,c),g=h(ht,f,d),y=m(gt,u,c),k=m(gt+ht,f,d);i=(b-y)/2,s=(g-k)/2,l=-(b+y)/2,o=-(g+k)/2}return{ratioX:i,ratioY:s,offsetX:l,offsetY:o}}class Tl extends Rn{constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let l=a=>+i[a];if(Ue(i[e])){const{key:a="value"}=this._parsing;l=u=>+vi(i[u],a)}let o,r;for(o=e,r=e+t;o0&&!isNaN(e)?ot*(Math.abs(e)/t):0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,s=i.data.labels||[],l=Ml(t._parsed[e],i.options.locale);return{label:s[e]||"",value:l}}getMaxBorderWidth(e){let t=0;const i=this.chart;let s,l,o,r,a;if(!e){for(s=0,l=i.data.datasets.length;sn!=="spacing",_indexable:n=>n!=="spacing"};Tl.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const e=n.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:t}}=n.legend.options;return e.labels.map((i,s)=>{const o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:t,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,e,t){t.chart.toggleDataVisibility(e.index),t.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){let e=n.label;const t=": "+n.formattedValue;return ft(e)?(e=e.slice(),e[0]+=t):e+=t,e}}}}};class Bo extends Rn{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:i,data:s=[],_dataset:l}=t,o=this.chart._animationsDisabled;let{start:r,count:a}=Ag(t,s,o);this._drawStart=r,this._drawCount=a,Ig(t)&&(r=0,a=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!l._decimated,i.points=s;const u=this.resolveDatasetElementOptions(e);this.options.showLine||(u.borderWidth=0),u.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:u},e),this.updateElements(s,r,a,e)}updateElements(e,t,i,s){const l=s==="reset",{iScale:o,vScale:r,_stacked:a,_dataset:u}=this._cachedMeta,{sharedOptions:f,includeOptions:c}=this._getSharedOptions(t,s),d=o.axis,h=r.axis,{spanGaps:m,segment:b}=this.options,g=ws(m)?m:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||l||s==="none";let k=t>0&&this.getParsed(t-1);for(let w=t;w0&&Math.abs(M[d]-k[d])>g,b&&(T.parsed=M,T.raw=u.data[w]),c&&(T.options=f||this.resolveDataElementOptions(w,C.active?"active":s)),y||this.updateElement(C,w,T,s),k=M}}getMaxOverflow(){const e=this._cachedMeta,t=e.dataset,i=t.options&&t.options.borderWidth||0,s=e.data||[];if(!s.length)return i;const l=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,l,o)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}Bo.id="line";Bo.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};Bo.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class ja extends Rn{constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,s=i.data.labels||[],l=Ml(t._parsed[e].r,i.options.locale);return{label:s[e]||"",value:l}}parseObjectData(e,t,i,s){return Bg.bind(this)(e,t,i,s)}update(e){const t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){const e=this._cachedMeta,t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return e.data.forEach((i,s)=>{const l=this.getParsed(s).r;!isNaN(l)&&this.chart.getDataVisibility(s)&&(lt.max&&(t.max=l))}),t}_updateRadius(){const e=this.chart,t=e.chartArea,i=e.options,s=Math.min(t.right-t.left,t.bottom-t.top),l=Math.max(s/2,0),o=Math.max(i.cutoutPercentage?l/100*i.cutoutPercentage:1,0),r=(l-o)/e.getVisibleDatasetCount();this.outerRadius=l-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(e,t,i,s){const l=s==="reset",o=this.chart,a=o.options.animation,u=this._cachedMeta.rScale,f=u.xCenter,c=u.yCenter,d=u.getIndexAngle(0)-.5*gt;let h=d,m;const b=360/this.countVisibleElements();for(m=0;m{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&t++}),t}_computeAngle(e,t,i){return this.chart.getDataVisibility(e)?In(this.resolveDataElementOptions(e,t).angle||i):0}}ja.id="polarArea";ja.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};ja.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const e=n.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:t}}=n.legend.options;return e.labels.map((i,s)=>{const o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:t,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,e,t){t.chart.toggleDataVisibility(e.index),t.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){return n.chart.data.labels[n.dataIndex]+": "+n.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class Qg extends Tl{}Qg.id="pie";Qg.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class qa extends Rn{getLabelAndValue(e){const t=this._cachedMeta.vScale,i=this.getParsed(e);return{label:t.getLabels()[e],value:""+t.getLabelForValue(i[t.axis])}}parseObjectData(e,t,i,s){return Bg.bind(this)(e,t,i,s)}update(e){const t=this._cachedMeta,i=t.dataset,s=t.data||[],l=t.iScale.getLabels();if(i.points=s,e!=="resize"){const o=this.resolveDatasetElementOptions(e);this.options.showLine||(o.borderWidth=0);const r={_loop:!0,_fullLoop:l.length===s.length,options:o};this.updateElement(i,void 0,r,e)}this.updateElements(s,0,s.length,e)}updateElements(e,t,i,s){const l=this._cachedMeta.rScale,o=s==="reset";for(let r=t;r{s[l]=i[l]&&i[l].active()?i[l]._to:this[l]}),s}}li.defaults={};li.defaultRoutes=void 0;const xg={values(n){return ft(n)?n:""+n},numeric(n,e,t){if(n===0)return"0";const i=this.chart.options.locale;let s,l=n;if(t.length>1){const u=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(u<1e-4||u>1e15)&&(s="scientific"),l=M2(n,t)}const o=bn(Math.abs(l)),r=Math.max(Math.min(-1*Math.floor(o),20),0),a={notation:s,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(a,this.options.ticks.format),Ml(n,i,a)},logarithmic(n,e,t){if(n===0)return"0";const i=n/Math.pow(10,Math.floor(bn(n)));return i===1||i===2||i===5?xg.numeric.call(this,n,e,t):""}};function M2(n,e){let t=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(t)>=1&&n!==Math.floor(n)&&(t=n-Math.floor(n)),t}var Wo={formatters:xg};Xe.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(n,e)=>e.lineWidth,tickColor:(n,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Wo.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});Xe.route("scale.ticks","color","","color");Xe.route("scale.grid","color","","borderColor");Xe.route("scale.grid","borderColor","","borderColor");Xe.route("scale.title","color","","color");Xe.describe("scale",{_fallback:!1,_scriptable:n=>!n.startsWith("before")&&!n.startsWith("after")&&n!=="callback"&&n!=="parser",_indexable:n=>n!=="borderDash"&&n!=="tickBorderDash"});Xe.describe("scales",{_fallback:"scale"});Xe.describe("scale.ticks",{_scriptable:n=>n!=="backdropPadding"&&n!=="callback",_indexable:n=>n!=="backdropPadding"});function T2(n,e){const t=n.options.ticks,i=t.maxTicksLimit||O2(n),s=t.major.enabled?E2(e):[],l=s.length,o=s[0],r=s[l-1],a=[];if(l>i)return A2(e,a,s,l/i),a;const u=D2(s,e,i);if(l>0){let f,c;const d=l>1?Math.round((r-o)/(l-1)):null;for(Kl(e,a,u,nt(d)?0:o-d,o),f=0,c=l-1;fs)return a}return Math.max(s,1)}function E2(n){const e=[];let t,i;for(t=0,i=n.length;tn==="left"?"right":n==="right"?"left":n,Df=(n,e,t)=>e==="top"||e==="left"?n[e]+t:n[e]-t;function Ef(n,e){const t=[],i=n.length/e,s=n.length;let l=0;for(;lo+r)))return a}function N2(n,e){lt(n,t=>{const i=t.gc,s=i.length/2;let l;if(s>e){for(l=0;li?i:t,i=s&&t>i?t:i,{min:hn(t,hn(i,t)),max:hn(i,hn(t,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){pt(this.options.beforeUpdate,[this])}update(e,t,i){const{beginAtZero:s,grace:l,ticks:o}=this.options,r=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=my(this,l,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r=l||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const f=this._getLabelSizes(),c=f.widest.width,d=f.highest.height,h=Rt(this.chart.width-c,0,this.maxWidth);r=e.offset?this.maxWidth/i:h/(i-1),c+6>r&&(r=h/(i-(e.offset?.5:1)),a=this.maxHeight-qs(e.grid)-t.padding-Af(e.title,this.chart.options.font),u=Math.sqrt(c*c+d*d),o=Ca(Math.min(Math.asin(Rt((f.highest.height+6)/r,-1,1)),Math.asin(Rt(a/u,-1,1))-Math.asin(Rt(d/u,-1,1)))),o=Math.max(s,Math.min(l,o))),this.labelRotation=o}afterCalculateLabelRotation(){pt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){pt(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:i,title:s,grid:l}}=this,o=this._isVisible(),r=this.isHorizontal();if(o){const a=Af(s,t.options.font);if(r?(e.width=this.maxWidth,e.height=qs(l)+a):(e.height=this.maxHeight,e.width=qs(l)+a),i.display&&this.ticks.length){const{first:u,last:f,widest:c,highest:d}=this._getLabelSizes(),h=i.padding*2,m=In(this.labelRotation),b=Math.cos(m),g=Math.sin(m);if(r){const y=i.mirror?0:g*c.width+b*d.height;e.height=Math.min(this.maxHeight,e.height+y+h)}else{const y=i.mirror?0:b*c.width+g*d.height;e.width=Math.min(this.maxWidth,e.width+y+h)}this._calculatePadding(u,f,g,b)}}this._handleMargins(),r?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,i,s){const{ticks:{align:l,padding:o},position:r}=this.options,a=this.labelRotation!==0,u=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const f=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,h=0;a?u?(d=s*e.width,h=i*t.height):(d=i*e.height,h=s*t.width):l==="start"?h=t.width:l==="end"?d=e.width:l!=="inner"&&(d=e.width/2,h=t.width/2),this.paddingLeft=Math.max((d-f+o)*this.width/(this.width-f),0),this.paddingRight=Math.max((h-c+o)*this.width/(this.width-c),0)}else{let f=t.height/2,c=e.height/2;l==="start"?(f=0,c=e.height):l==="end"&&(f=t.height,c=0),this.paddingTop=f+o,this.paddingBottom=c+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){pt(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return t==="top"||t==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,i;for(t=0,i=e.length;t({width:l[D]||0,height:o[D]||0});return{first:T(0),last:T(t-1),widest:T(C),highest:T(M),widths:l,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return Dv(this._alignToPixels?Pi(this.chart,t,0):t)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&er*s?r/i:a/s:a*s0}_computeGridLineItems(e){const t=this.axis,i=this.chart,s=this.options,{grid:l,position:o}=s,r=l.offset,a=this.isHorizontal(),f=this.ticks.length+(r?1:0),c=qs(l),d=[],h=l.setContext(this.getContext()),m=h.drawBorder?h.borderWidth:0,b=m/2,g=function(K){return Pi(i,K,m)};let y,k,w,C,M,T,D,A,P,L,V,F;if(o==="top")y=g(this.bottom),T=this.bottom-c,A=y-b,L=g(e.top)+b,F=e.bottom;else if(o==="bottom")y=g(this.top),L=e.top,F=g(e.bottom)-b,T=y+b,A=this.top+c;else if(o==="left")y=g(this.right),M=this.right-c,D=y-b,P=g(e.left)+b,V=e.right;else if(o==="right")y=g(this.left),P=e.left,V=g(e.right)-b,M=y+b,D=this.left+c;else if(t==="x"){if(o==="center")y=g((e.top+e.bottom)/2+.5);else if(Ue(o)){const K=Object.keys(o)[0],X=o[K];y=g(this.chart.scales[K].getPixelForValue(X))}L=e.top,F=e.bottom,T=y+b,A=T+c}else if(t==="y"){if(o==="center")y=g((e.left+e.right)/2);else if(Ue(o)){const K=Object.keys(o)[0],X=o[K];y=g(this.chart.scales[K].getPixelForValue(X))}M=y-b,D=M-c,P=e.left,V=e.right}const W=Ge(s.ticks.maxTicksLimit,f),G=Math.max(1,Math.ceil(f/W));for(k=0;kl.value===e);return s>=0?t.setContext(this.getContext(s)).lineWidth:0}drawGrid(e){const t=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let l,o;const r=(a,u,f)=>{!f.width||!f.color||(i.save(),i.lineWidth=f.width,i.strokeStyle=f.color,i.setLineDash(f.borderDash||[]),i.lineDashOffset=f.borderDashOffset,i.beginPath(),i.moveTo(a.x,a.y),i.lineTo(u.x,u.y),i.stroke(),i.restore())};if(t.display)for(l=0,o=s.length;l{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:t,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let l,o;for(l=0,o=t.length;l{const i=t.split("."),s=i.pop(),l=[n].concat(i).join("."),o=e[t].split("."),r=o.pop(),a=o.join(".");Xe.route(l,s,a,r)})}function z2(n){return"id"in n&&"defaults"in n}class B2{constructor(){this.controllers=new Jl(Rn,"datasets",!0),this.elements=new Jl(li,"elements"),this.plugins=new Jl(Object,"plugins"),this.scales=new Jl(Qi,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,i){[...t].forEach(s=>{const l=i||this._getRegistryForType(s);i||l.isForType(s)||l===this.plugins&&s.id?this._exec(e,l,s):lt(s,o=>{const r=i||this._getRegistryForType(o);this._exec(e,r,o)})})}_exec(e,t,i){const s=$a(e);pt(i["before"+s],[],i),t[e](i),pt(i["after"+s],[],i)}_getRegistryForType(e){for(let t=0;t0&&this.getParsed(t-1);for(let C=t;C0&&Math.abs(T[h]-w[h])>y,g&&(D.parsed=T,D.raw=u.data[C]),d&&(D.options=c||this.resolveDataElementOptions(C,M.active?"active":s)),k||this.updateElement(M,C,D,s),w=T}this.updateSharedOptions(c,s,f)}getMaxOverflow(){const e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let r=0;for(let a=t.length-1;a>=0;--a)r=Math.max(r,t[a].size(this.resolveDataElementOptions(a))/2);return r>0&&r}const i=e.dataset,s=i.options&&i.options.borderWidth||0;if(!t.length)return s;const l=t[0].size(this.resolveDataElementOptions(0)),o=t[t.length-1].size(this.resolveDataElementOptions(t.length-1));return Math.max(s,l,o)/2}}Va.id="scatter";Va.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};Va.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(n){return"("+n.label+", "+n.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};function Li(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Kr{constructor(e){this.options=e||{}}init(e){}formats(){return Li()}parse(e,t){return Li()}format(e,t){return Li()}add(e,t,i){return Li()}diff(e,t,i){return Li()}startOf(e,t,i){return Li()}endOf(e,t){return Li()}}Kr.override=function(n){Object.assign(Kr.prototype,n)};var e_={_date:Kr};function W2(n,e,t,i){const{controller:s,data:l,_sorted:o}=n,r=s._cachedMeta.iScale;if(r&&e===r.axis&&e!=="r"&&o&&l.length){const a=r._reversePixels?Ev:qi;if(i){if(s._sharedOptions){const u=l[0],f=typeof u.getRange=="function"&&u.getRange(e);if(f){const c=a(l,e,t-f),d=a(l,e,t+f);return{lo:c.lo,hi:d.hi}}}}else return a(l,e,t)}return{lo:0,hi:l.length-1}}function Ol(n,e,t,i,s){const l=n.getSortedVisibleDatasetMetas(),o=t[e];for(let r=0,a=l.length;r{a[o](e[t],s)&&(l.push({element:a,datasetIndex:u,index:f}),r=r||a.inRange(e.x,e.y,s))}),i&&!r?[]:l}var J2={evaluateInteractionItems:Ol,modes:{index(n,e,t,i){const s=Ri(e,n),l=t.axis||"x",o=t.includeInvisible||!1,r=t.intersect?dr(n,s,l,i,o):pr(n,s,l,!1,i,o),a=[];return r.length?(n.getSortedVisibleDatasetMetas().forEach(u=>{const f=r[0].index,c=u.data[f];c&&!c.skip&&a.push({element:c,datasetIndex:u.index,index:f})}),a):[]},dataset(n,e,t,i){const s=Ri(e,n),l=t.axis||"xy",o=t.includeInvisible||!1;let r=t.intersect?dr(n,s,l,i,o):pr(n,s,l,!1,i,o);if(r.length>0){const a=r[0].datasetIndex,u=n.getDatasetMeta(a).data;r=[];for(let f=0;ft.pos===e)}function Pf(n,e){return n.filter(t=>t_.indexOf(t.pos)===-1&&t.box.axis===e)}function zs(n,e){return n.sort((t,i)=>{const s=e?i:t,l=e?t:i;return s.weight===l.weight?s.index-l.index:s.weight-l.weight})}function Z2(n){const e=[];let t,i,s,l,o,r;for(t=0,i=(n||[]).length;tu.box.fullSize),!0),i=zs(Vs(e,"left"),!0),s=zs(Vs(e,"right")),l=zs(Vs(e,"top"),!0),o=zs(Vs(e,"bottom")),r=Pf(e,"x"),a=Pf(e,"y");return{fullSize:t,leftAndTop:i.concat(l),rightAndBottom:s.concat(a).concat(o).concat(r),chartArea:Vs(e,"chartArea"),vertical:i.concat(s).concat(a),horizontal:l.concat(o).concat(r)}}function Lf(n,e,t,i){return Math.max(n[t],e[t])+Math.max(n[i],e[i])}function n_(n,e){n.top=Math.max(n.top,e.top),n.left=Math.max(n.left,e.left),n.bottom=Math.max(n.bottom,e.bottom),n.right=Math.max(n.right,e.right)}function x2(n,e,t,i){const{pos:s,box:l}=t,o=n.maxPadding;if(!Ue(s)){t.size&&(n[s]-=t.size);const c=i[t.stack]||{size:0,count:1};c.size=Math.max(c.size,t.horizontal?l.height:l.width),t.size=c.size/c.count,n[s]+=t.size}l.getPadding&&n_(o,l.getPadding());const r=Math.max(0,e.outerWidth-Lf(o,n,"left","right")),a=Math.max(0,e.outerHeight-Lf(o,n,"top","bottom")),u=r!==n.w,f=a!==n.h;return n.w=r,n.h=a,t.horizontal?{same:u,other:f}:{same:f,other:u}}function ek(n){const e=n.maxPadding;function t(i){const s=Math.max(e[i]-n[i],0);return n[i]+=s,s}n.y+=t("top"),n.x+=t("left"),t("right"),t("bottom")}function tk(n,e){const t=e.maxPadding;function i(s){const l={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{l[o]=Math.max(e[o],t[o])}),l}return i(n?["left","right"]:["top","bottom"])}function Zs(n,e,t,i){const s=[];let l,o,r,a,u,f;for(l=0,o=n.length,u=0;l{typeof b.beforeLayout=="function"&&b.beforeLayout()});const f=a.reduce((b,g)=>g.box.options&&g.box.options.display===!1?b:b+1,0)||1,c=Object.freeze({outerWidth:e,outerHeight:t,padding:s,availableWidth:l,availableHeight:o,vBoxMaxWidth:l/2/f,hBoxMaxHeight:o/2}),d=Object.assign({},s);n_(d,Sn(i));const h=Object.assign({maxPadding:d,w:l,h:o,x:s.left,y:s.top},s),m=X2(a.concat(u),c);Zs(r.fullSize,h,c,m),Zs(a,h,c,m),Zs(u,h,c,m)&&Zs(a,h,c,m),ek(h),Nf(r.leftAndTop,h,c,m),h.x+=h.w,h.y+=h.h,Nf(r.rightAndBottom,h,c,m),n.chartArea={left:h.left,top:h.top,right:h.left+h.w,bottom:h.top+h.h,height:h.h,width:h.w},lt(r.chartArea,b=>{const g=b.box;Object.assign(g,n.chartArea),g.update(h.w,h.h,{left:0,top:0,right:0,bottom:0})})}};class i_{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,i){}removeEventListener(e,t,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,i,s){return t=Math.max(0,t||e.width),i=i||e.height,{width:t,height:Math.max(0,s?Math.floor(t/s):i)}}isAttached(e){return!0}updateConfig(e){}}class nk extends i_{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const ao="$chartjs",ik={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ff=n=>n===null||n==="";function sk(n,e){const t=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[ao]={initial:{height:i,width:s,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",Ff(s)){const l=hf(n,"width");l!==void 0&&(n.width=l)}if(Ff(i))if(n.style.height==="")n.height=n.width/(e||2);else{const l=hf(n,"height");l!==void 0&&(n.height=l)}return n}const s_=Hy?{passive:!0}:!1;function lk(n,e,t){n.addEventListener(e,t,s_)}function ok(n,e,t){n.canvas.removeEventListener(e,t,s_)}function rk(n,e){const t=ik[n.type]||n.type,{x:i,y:s}=Ri(n,e);return{type:t,chart:e,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function To(n,e){for(const t of n)if(t===e||t.contains(e))return!0}function ak(n,e,t){const i=n.canvas,s=new MutationObserver(l=>{let o=!1;for(const r of l)o=o||To(r.addedNodes,i),o=o&&!To(r.removedNodes,i);o&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}function uk(n,e,t){const i=n.canvas,s=new MutationObserver(l=>{let o=!1;for(const r of l)o=o||To(r.removedNodes,i),o=o&&!To(r.addedNodes,i);o&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}const pl=new Map;let Rf=0;function l_(){const n=window.devicePixelRatio;n!==Rf&&(Rf=n,pl.forEach((e,t)=>{t.currentDevicePixelRatio!==n&&e()}))}function fk(n,e){pl.size||window.addEventListener("resize",l_),pl.set(n,e)}function ck(n){pl.delete(n),pl.size||window.removeEventListener("resize",l_)}function dk(n,e,t){const i=n.canvas,s=i&&Fa(i);if(!s)return;const l=Eg((r,a)=>{const u=s.clientWidth;t(r,a),u{const a=r[0],u=a.contentRect.width,f=a.contentRect.height;u===0&&f===0||l(u,f)});return o.observe(s),fk(n,l),o}function hr(n,e,t){t&&t.disconnect(),e==="resize"&&ck(n)}function pk(n,e,t){const i=n.canvas,s=Eg(l=>{n.ctx!==null&&t(rk(l,n))},n,l=>{const o=l[0];return[o,o.offsetX,o.offsetY]});return lk(i,e,s),s}class hk extends i_{acquireContext(e,t){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(sk(e,t),i):null}releaseContext(e){const t=e.canvas;if(!t[ao])return!1;const i=t[ao].initial;["height","width"].forEach(l=>{const o=i[l];nt(o)?t.removeAttribute(l):t.setAttribute(l,o)});const s=i.style||{};return Object.keys(s).forEach(l=>{t.style[l]=s[l]}),t.width=t.width,delete t[ao],!0}addEventListener(e,t,i){this.removeEventListener(e,t);const s=e.$proxies||(e.$proxies={}),o={attach:ak,detach:uk,resize:dk}[t]||pk;s[t]=o(e,t,i)}removeEventListener(e,t){const i=e.$proxies||(e.$proxies={}),s=i[t];if(!s)return;({attach:hr,detach:hr,resize:hr}[t]||ok)(e,t,s),i[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,i,s){return Ry(e,t,i,s)}isAttached(e){const t=Fa(e);return!!(t&&t.isConnected)}}function mk(n){return!Ug()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?nk:hk}class gk{constructor(){this._init=[]}notify(e,t,i,s){t==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const l=s?this._descriptors(e).filter(s):this._descriptors(e),o=this._notify(l,e,t,i);return t==="afterDestroy"&&(this._notify(l,e,"stop"),this._notify(this._init,e,"uninstall")),o}_notify(e,t,i,s){s=s||{};for(const l of e){const o=l.plugin,r=o[i],a=[t,s,l.options];if(pt(r,a,o)===!1&&s.cancelable)return!1}return!0}invalidate(){nt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){const i=e&&e.config,s=Ge(i.options&&i.options.plugins,{}),l=_k(i);return s===!1&&!t?[]:vk(e,l,s,t)}_notifyStateChanges(e){const t=this._oldCache||[],i=this._cache,s=(l,o)=>l.filter(r=>!o.some(a=>r.plugin.id===a.plugin.id));this._notify(s(t,i),e,"stop"),this._notify(s(i,t),e,"start")}}function _k(n){const e={},t=[],i=Object.keys(Vn.plugins.items);for(let l=0;l{const a=i[r];if(!Ue(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const u=Zr(r,a),f=wk(u,s),c=t.scales||{};l[u]=l[u]||r,o[r]=Qs(Object.create(null),[{axis:u},a,c[u],c[f]])}),n.data.datasets.forEach(r=>{const a=r.type||n.type,u=r.indexAxis||Jr(a,e),c=(Ji[a]||{}).scales||{};Object.keys(c).forEach(d=>{const h=kk(d,u),m=r[h+"AxisID"]||l[h]||h;o[m]=o[m]||Object.create(null),Qs(o[m],[{axis:h},i[m],c[d]])})}),Object.keys(o).forEach(r=>{const a=o[r];Qs(a,[Xe.scales[a.type],Xe.scale])}),o}function o_(n){const e=n.options||(n.options={});e.plugins=Ge(e.plugins,{}),e.scales=$k(n,e)}function r_(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function Ck(n){return n=n||{},n.data=r_(n.data),o_(n),n}const Hf=new Map,a_=new Set;function Xl(n,e){let t=Hf.get(n);return t||(t=e(),Hf.set(n,t),a_.add(t)),t}const Bs=(n,e,t)=>{const i=vi(e,t);i!==void 0&&n.add(i)};class Mk{constructor(e){this._config=Ck(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=r_(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),o_(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Xl(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return Xl(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return Xl(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,i=this.type;return Xl(`${i}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){const i=this._scopeCache;let s=i.get(e);return(!s||t)&&(s=new Map,i.set(e,s)),s}getOptionScopes(e,t,i){const{options:s,type:l}=this,o=this._cachedScopes(e,i),r=o.get(t);if(r)return r;const a=new Set;t.forEach(f=>{e&&(a.add(e),f.forEach(c=>Bs(a,e,c))),f.forEach(c=>Bs(a,s,c)),f.forEach(c=>Bs(a,Ji[l]||{},c)),f.forEach(c=>Bs(a,Xe,c)),f.forEach(c=>Bs(a,Ur,c))});const u=Array.from(a);return u.length===0&&u.push(Object.create(null)),a_.has(t)&&o.set(t,u),u}chartOptionScopes(){const{options:e,type:t}=this;return[e,Ji[t]||{},Xe.datasets[t]||{},{type:t},Xe,Ur]}resolveNamedOptions(e,t,i,s=[""]){const l={$shared:!0},{resolver:o,subPrefixes:r}=jf(this._resolverCache,e,s);let a=o;if(Ok(o,t)){l.$shared=!1,i=yi(i)?i():i;const u=this.createResolver(e,i,r);a=Ss(o,i,u)}for(const u of t)l[u]=a[u];return l}createResolver(e,t,i=[""],s){const{resolver:l}=jf(this._resolverCache,e,i);return Ue(t)?Ss(l,t,void 0,s):l}}function jf(n,e,t){let i=n.get(e);i||(i=new Map,n.set(e,i));const s=t.join();let l=i.get(s);return l||(l={resolver:Pa(e,t),subPrefixes:t.filter(r=>!r.toLowerCase().includes("hover"))},i.set(s,l)),l}const Tk=n=>Ue(n)&&Object.getOwnPropertyNames(n).reduce((e,t)=>e||yi(n[t]),!1);function Ok(n,e){const{isScriptable:t,isIndexable:i}=jg(n);for(const s of e){const l=t(s),o=i(s),r=(o||l)&&n[s];if(l&&(yi(r)||Tk(r))||o&&ft(r))return!0}return!1}var Dk="3.9.1";const Ek=["top","bottom","left","right","chartArea"];function qf(n,e){return n==="top"||n==="bottom"||Ek.indexOf(n)===-1&&e==="x"}function Vf(n,e){return function(t,i){return t[n]===i[n]?t[e]-i[e]:t[n]-i[n]}}function zf(n){const e=n.chart,t=e.options.animation;e.notifyPlugins("afterRender"),pt(t&&t.onComplete,[n],e)}function Ak(n){const e=n.chart,t=e.options.animation;pt(t&&t.onProgress,[n],e)}function u_(n){return Ug()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const Oo={},f_=n=>{const e=u_(n);return Object.values(Oo).filter(t=>t.canvas===e).pop()};function Ik(n,e,t){const i=Object.keys(n);for(const s of i){const l=+s;if(l>=e){const o=n[s];delete n[s],(t>0||l>e)&&(n[l+t]=o)}}}function Pk(n,e,t,i){return!t||n.type==="mouseout"?null:i?e:n}class Do{constructor(e,t){const i=this.config=new Mk(t),s=u_(e),l=f_(s);if(l)throw new Error("Canvas is already in use. Chart with ID '"+l.id+"' must be destroyed before the canvas with ID '"+l.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||mk(s)),this.platform.updateConfig(i);const r=this.platform.acquireContext(s,o.aspectRatio),a=r&&r.canvas,u=a&&a.height,f=a&&a.width;if(this.id=_v(),this.ctx=r,this.canvas=a,this.width=f,this.height=u,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new gk,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Pv(c=>this.update(c),o.resizeDelay||0),this._dataChanges=[],Oo[this.id]=this,!r||!a){console.error("Failed to create chart: can't acquire context from the given item");return}xn.listen(this,"complete",zf),xn.listen(this,"progress",Ak),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:s,_aspectRatio:l}=this;return nt(e)?t&&l?l:s?i/s:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():pf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ff(this.canvas,this.ctx),this}stop(){return xn.stop(this),this}resize(e,t){xn.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const i=this.options,s=this.canvas,l=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,e,t,l),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,pf(this,r,!0)&&(this.notifyPlugins("resize",{size:o}),pt(i.onResize,[this,o],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};lt(t,(i,s)=>{i.id=s})}buildOrUpdateScales(){const e=this.options,t=e.scales,i=this.scales,s=Object.keys(i).reduce((o,r)=>(o[r]=!1,o),{});let l=[];t&&(l=l.concat(Object.keys(t).map(o=>{const r=t[o],a=Zr(o,r),u=a==="r",f=a==="x";return{options:r,dposition:u?"chartArea":f?"bottom":"left",dtype:u?"radialLinear":f?"category":"linear"}}))),lt(l,o=>{const r=o.options,a=r.id,u=Zr(a,r),f=Ge(r.type,o.dtype);(r.position===void 0||qf(r.position,u)!==qf(o.dposition))&&(r.position=o.dposition),s[a]=!0;let c=null;if(a in i&&i[a].type===f)c=i[a];else{const d=Vn.getScale(f);c=new d({id:a,type:f,ctx:this.ctx,chart:this}),i[c.id]=c}c.init(r,e)}),lt(s,(o,r)=>{o||delete i[r]}),lt(i,o=>{Gl.configure(this,o,o.options),Gl.addBox(this,o)})}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,i=e.length;if(e.sort((s,l)=>s.index-l.index),i>t){for(let s=t;st.length&&delete this._stacks,e.forEach((i,s)=>{t.filter(l=>l===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=t.length;i{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const i=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const l=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let u=0,f=this.data.datasets.length;u{u.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Vf("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){lt(this.scales,e=>{Gl.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!Gu(t,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:l}of t){const o=i==="_removeElements"?-l:l;Ik(e,s,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,i=l=>new Set(e.filter(o=>o[0]===l).map((o,r)=>r+","+o.splice(1).join(","))),s=i(0);for(let l=1;ll.split(",")).map(l=>({method:l[1],start:+l[2],count:+l[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Gl.update(this,this.width,this.height,e);const t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],lt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,l)=>{s._idx=l}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let t=0,i=this.data.datasets.length;t=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,i=e._clip,s=!i.disabled,l=this.chartArea,o={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&Ea(t,{left:i.left===!1?0:l.left-i.left,right:i.right===!1?this.width:l.right+i.right,top:i.top===!1?0:l.top-i.top,bottom:i.bottom===!1?this.height:l.bottom+i.bottom}),e.controller.draw(),s&&Aa(t),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(e){return dl(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,s){const l=J2.modes[t];return typeof l=="function"?l(this,e,i,s):[]}getDatasetMeta(e){const t=this.data.datasets[e],i=this._metasets;let s=i.filter(l=>l&&l._dataset===t).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Si(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!t.hidden}setDatasetVisibility(e,t){const i=this.getDatasetMeta(e);i.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,i){const s=i?"show":"hide",l=this.getDatasetMeta(e),o=l.controller._resolveAnimations(void 0,s);wn(t)?(l.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),o.update(l,{visible:i}),this.update(r=>r.datasetIndex===e?s:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),xn.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,l,o),e[l]=o},s=(l,o,r)=>{l.offsetX=o,l.offsetY=r,this._eventHandler(l)};lt(this.options.events,l=>i(l,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,i=(a,u)=>{t.addEventListener(this,a,u),e[a]=u},s=(a,u)=>{e[a]&&(t.removeEventListener(this,a,u),delete e[a])},l=(a,u)=>{this.canvas&&this.resize(a,u)};let o;const r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",l),i("detach",o)};o=()=>{this.attached=!1,s("resize",l),this._stop(),this._resize(0,0),i("attach",r)},t.isAttached(this.canvas)?r():o()}unbindEvents(){lt(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},lt(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,i){const s=i?"set":"remove";let l,o,r,a;for(t==="dataset"&&(l=this.getDatasetMeta(e[0].datasetIndex),l.controller["_"+s+"DatasetHoverStyle"]()),r=0,a=e.length;r{const r=this.getDatasetMeta(l);if(!r)throw new Error("No dataset found at index "+l);return{datasetIndex:l,element:r.data[o],index:o}});!vo(i,t)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,t))}notifyPlugins(e,t,i){return this._plugins.notify(this,e,t,i)}_updateHoverStyles(e,t,i){const s=this.options.hover,l=(a,u)=>a.filter(f=>!u.some(c=>f.datasetIndex===c.datasetIndex&&f.index===c.index)),o=l(t,e),r=i?e:l(e,t);o.length&&this.updateHoverStyle(o,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},s=o=>(o.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const l=this._handleEvent(e,t,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(l||i.changed)&&this.render(),this}_handleEvent(e,t,i){const{_active:s=[],options:l}=this,o=t,r=this._getActiveElements(e,s,i,o),a=Sv(e),u=Pk(e,this._lastEvent,i,a);i&&(this._lastEvent=null,pt(l.onHover,[e,r,this],this),a&&pt(l.onClick,[e,r,this],this));const f=!vo(r,s);return(f||t)&&(this._active=r,this._updateHoverStyles(r,s,t)),this._lastEvent=u,f}_getActiveElements(e,t,i,s){if(e.type==="mouseout")return[];if(!i)return t;const l=this.options.hover;return this.getElementsAtEventForMode(e,l.mode,l,s)}}const Bf=()=>lt(Do.instances,n=>n._plugins.invalidate()),ci=!0;Object.defineProperties(Do,{defaults:{enumerable:ci,value:Xe},instances:{enumerable:ci,value:Oo},overrides:{enumerable:ci,value:Ji},registry:{enumerable:ci,value:Vn},version:{enumerable:ci,value:Dk},getChart:{enumerable:ci,value:f_},register:{enumerable:ci,value:(...n)=>{Vn.add(...n),Bf()}},unregister:{enumerable:ci,value:(...n)=>{Vn.remove(...n),Bf()}}});function c_(n,e,t){const{startAngle:i,pixelMargin:s,x:l,y:o,outerRadius:r,innerRadius:a}=e;let u=s/r;n.beginPath(),n.arc(l,o,r,i-u,t+u),a>s?(u=s/a,n.arc(l,o,a,t+u,i-u,!0)):n.arc(l,o,s,t+ht,i-ht),n.closePath(),n.clip()}function Lk(n){return Ia(n,["outerStart","outerEnd","innerStart","innerEnd"])}function Nk(n,e,t,i){const s=Lk(n.options.borderRadius),l=(t-e)/2,o=Math.min(l,i*e/2),r=a=>{const u=(t-Math.min(l,a))*i/2;return Rt(a,0,Math.min(l,u))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:Rt(s.innerStart,0,o),innerEnd:Rt(s.innerEnd,0,o)}}function fs(n,e,t,i){return{x:t+n*Math.cos(e),y:i+n*Math.sin(e)}}function Gr(n,e,t,i,s,l){const{x:o,y:r,startAngle:a,pixelMargin:u,innerRadius:f}=e,c=Math.max(e.outerRadius+i+t-u,0),d=f>0?f+i+t+u:0;let h=0;const m=s-a;if(i){const K=f>0?f-i:0,X=c>0?c-i:0,Z=(K+X)/2,ie=Z!==0?m*Z/(Z+i):m;h=(m-ie)/2}const b=Math.max(.001,m*c-t/gt)/c,g=(m-b)/2,y=a+g+h,k=s-g-h,{outerStart:w,outerEnd:C,innerStart:M,innerEnd:T}=Nk(e,d,c,k-y),D=c-w,A=c-C,P=y+w/D,L=k-C/A,V=d+M,F=d+T,W=y+M/V,G=k-T/F;if(n.beginPath(),l){if(n.arc(o,r,c,P,L),C>0){const Z=fs(A,L,o,r);n.arc(Z.x,Z.y,C,L,k+ht)}const K=fs(F,k,o,r);if(n.lineTo(K.x,K.y),T>0){const Z=fs(F,G,o,r);n.arc(Z.x,Z.y,T,k+ht,G+Math.PI)}if(n.arc(o,r,d,k-T/d,y+M/d,!0),M>0){const Z=fs(V,W,o,r);n.arc(Z.x,Z.y,M,W+Math.PI,y-ht)}const X=fs(D,y,o,r);if(n.lineTo(X.x,X.y),w>0){const Z=fs(D,P,o,r);n.arc(Z.x,Z.y,w,y-ht,P)}}else{n.moveTo(o,r);const K=Math.cos(P)*c+o,X=Math.sin(P)*c+r;n.lineTo(K,X);const Z=Math.cos(L)*c+o,ie=Math.sin(L)*c+r;n.lineTo(Z,ie)}n.closePath()}function Fk(n,e,t,i,s){const{fullCircles:l,startAngle:o,circumference:r}=e;let a=e.endAngle;if(l){Gr(n,e,t,i,o+ot,s);for(let u=0;u=ot||fl(l,r,a),b=cl(o,u+d,f+d);return m&&b}getCenterPoint(e){const{x:t,y:i,startAngle:s,endAngle:l,innerRadius:o,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],e),{offset:a,spacing:u}=this.options,f=(s+l)/2,c=(o+r+u+a)/2;return{x:t+Math.cos(f)*c,y:i+Math.sin(f)*c}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:t,circumference:i}=this,s=(t.offset||0)/2,l=(t.spacing||0)/2,o=t.circular;if(this.pixelMargin=t.borderAlign==="inner"?.33:0,this.fullCircles=i>ot?Math.floor(i/ot):0,i===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let r=0;if(s){r=s/2;const u=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(u)*r,Math.sin(u)*r),this.circumference>=gt&&(r=s)}e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor;const a=Fk(e,this,r,l,o);Hk(e,this,r,l,a,o),e.restore()}}za.id="arc";za.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};za.defaultRoutes={backgroundColor:"backgroundColor"};function d_(n,e,t=e){n.lineCap=Ge(t.borderCapStyle,e.borderCapStyle),n.setLineDash(Ge(t.borderDash,e.borderDash)),n.lineDashOffset=Ge(t.borderDashOffset,e.borderDashOffset),n.lineJoin=Ge(t.borderJoinStyle,e.borderJoinStyle),n.lineWidth=Ge(t.borderWidth,e.borderWidth),n.strokeStyle=Ge(t.borderColor,e.borderColor)}function jk(n,e,t){n.lineTo(t.x,t.y)}function qk(n){return n.stepped?ry:n.tension||n.cubicInterpolationMode==="monotone"?ay:jk}function p_(n,e,t={}){const i=n.length,{start:s=0,end:l=i-1}=t,{start:o,end:r}=e,a=Math.max(s,o),u=Math.min(l,r),f=sr&&l>r;return{count:i,start:a,loop:e.loop,ilen:u(o+(u?r-C:C))%l,w=()=>{b!==g&&(n.lineTo(f,g),n.lineTo(f,b),n.lineTo(f,y))};for(a&&(h=s[k(0)],n.moveTo(h.x,h.y)),d=0;d<=r;++d){if(h=s[k(d)],h.skip)continue;const C=h.x,M=h.y,T=C|0;T===m?(Mg&&(g=M),f=(c*f+C)/++c):(w(),n.lineTo(C,M),m=T,c=0,b=g=M),y=M}w()}function Xr(n){const e=n.options,t=e.borderDash&&e.borderDash.length;return!n._decimated&&!n._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?zk:Vk}function Bk(n){return n.stepped?jy:n.tension||n.cubicInterpolationMode==="monotone"?qy:Hi}function Wk(n,e,t,i){let s=e._path;s||(s=e._path=new Path2D,e.path(s,t,i)&&s.closePath()),d_(n,e.options),n.stroke(s)}function Uk(n,e,t,i){const{segments:s,options:l}=e,o=Xr(e);for(const r of s)d_(n,l,r.style),n.beginPath(),o(n,e,r,{start:t,end:t+i-1})&&n.closePath(),n.stroke()}const Yk=typeof Path2D=="function";function Kk(n,e,t,i){Yk&&!e.options.segment?Wk(n,e,t,i):Uk(n,e,t,i)}class $i extends li{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Ay(this._points,i,e,s,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Zy(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,i=e.length;return i&&t[e[i-1].end]}interpolate(e,t){const i=this.options,s=e[t],l=this.points,o=Jg(this,{property:t,start:s,end:s});if(!o.length)return;const r=[],a=Bk(i);let u,f;for(u=0,f=o.length;un!=="borderDash"&&n!=="fill"};function Wf(n,e,t,i){const s=n.options,{[t]:l}=n.getProps([t],i);return Math.abs(e-l){r=Wa(o,r,s);const a=s[o],u=s[r];i!==null?(l.push({x:a.x,y:i}),l.push({x:u.x,y:i})):t!==null&&(l.push({x:t,y:a.y}),l.push({x:t,y:u.y}))}),l}function Wa(n,e,t){for(;e>n;e--){const i=t[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function Uf(n,e,t,i){return n&&e?i(n[t],e[t]):n?n[t]:e?e[t]:0}function m_(n,e){let t=[],i=!1;return ft(n)?(i=!0,t=n):t=ew(n,e),t.length?new $i({points:t,options:{tension:0},_loop:i,_fullLoop:i}):null}function Yf(n){return n&&n.fill!==!1}function tw(n,e,t){let s=n[e].fill;const l=[e];let o;if(!t)return s;for(;s!==!1&&l.indexOf(s)===-1;){if(!_t(s))return s;if(o=n[s],!o)return!1;if(o.visible)return s;l.push(s),s=o.fill}return!1}function nw(n,e,t){const i=ow(n);if(Ue(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return _t(s)&&Math.floor(s)===s?iw(i[0],e,s,t):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function iw(n,e,t,i){return(n==="-"||n==="+")&&(t=e+t),t===e||t<0||t>=i?!1:t}function sw(n,e){let t=null;return n==="start"?t=e.bottom:n==="end"?t=e.top:Ue(n)?t=e.getPixelForValue(n.value):e.getBasePixel&&(t=e.getBasePixel()),t}function lw(n,e,t){let i;return n==="start"?i=t:n==="end"?i=e.options.reverse?e.min:e.max:Ue(n)?i=n.value:i=e.getBaseValue(),i}function ow(n){const e=n.options,t=e.fill;let i=Ge(t&&t.target,t);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function rw(n){const{scale:e,index:t,line:i}=n,s=[],l=i.segments,o=i.points,r=aw(e,t);r.push(m_({x:null,y:e.bottom},i));for(let a=0;a=0;--o){const r=s[o].$filler;!r||(r.line.updateControlPoints(l,r.axis),i&&r.fill&&_r(n.ctx,r,l))}},beforeDatasetsDraw(n,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const l=i[s].$filler;Yf(l)&&_r(n.ctx,l,n.chartArea)}},beforeDatasetDraw(n,e,t){const i=e.meta.$filler;!Yf(i)||t.drawTime!=="beforeDatasetDraw"||_r(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const nl={average(n){if(!n.length)return!1;let e,t,i=0,s=0,l=0;for(e=0,t=n.length;e-1?n.split(` +`):n}function vw(n,e){const{element:t,datasetIndex:i,index:s}=e,l=n.getDatasetMeta(i).controller,{label:o,value:r}=l.getLabelAndValue(s);return{chart:n,label:o,parsed:l.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:r,dataset:l.getDataset(),dataIndex:s,datasetIndex:i,element:t}}function Gf(n,e){const t=n.chart.ctx,{body:i,footer:s,title:l}=n,{boxWidth:o,boxHeight:r}=e,a=rn(e.bodyFont),u=rn(e.titleFont),f=rn(e.footerFont),c=l.length,d=s.length,h=i.length,m=Sn(e.padding);let b=m.height,g=0,y=i.reduce((C,M)=>C+M.before.length+M.lines.length+M.after.length,0);if(y+=n.beforeBody.length+n.afterBody.length,c&&(b+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),y){const C=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;b+=h*C+(y-h)*a.lineHeight+(y-1)*e.bodySpacing}d&&(b+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let k=0;const w=function(C){g=Math.max(g,t.measureText(C).width+k)};return t.save(),t.font=u.string,lt(n.title,w),t.font=a.string,lt(n.beforeBody.concat(n.afterBody),w),k=e.displayColors?o+2+e.boxPadding:0,lt(i,C=>{lt(C.before,w),lt(C.lines,w),lt(C.after,w)}),k=0,t.font=f.string,lt(n.footer,w),t.restore(),g+=m.width,{width:g,height:b}}function yw(n,e){const{y:t,height:i}=e;return tn.height-i/2?"bottom":"center"}function kw(n,e,t,i){const{x:s,width:l}=i,o=t.caretSize+t.caretPadding;if(n==="left"&&s+l+o>e.width||n==="right"&&s-l-o<0)return!0}function ww(n,e,t,i){const{x:s,width:l}=t,{width:o,chartArea:{left:r,right:a}}=n;let u="center";return i==="center"?u=s<=(r+a)/2?"left":"right":s<=l/2?u="left":s>=o-l/2&&(u="right"),kw(u,n,e,t)&&(u="center"),u}function Xf(n,e,t){const i=t.yAlign||e.yAlign||yw(n,t);return{xAlign:t.xAlign||e.xAlign||ww(n,e,t,i),yAlign:i}}function Sw(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function $w(n,e,t){let{y:i,height:s}=n;return e==="top"?i+=t:e==="bottom"?i-=s+t:i-=s/2,i}function Qf(n,e,t,i){const{caretSize:s,caretPadding:l,cornerRadius:o}=n,{xAlign:r,yAlign:a}=t,u=s+l,{topLeft:f,topRight:c,bottomLeft:d,bottomRight:h}=gs(o);let m=Sw(e,r);const b=$w(e,a,u);return a==="center"?r==="left"?m+=u:r==="right"&&(m-=u):r==="left"?m-=Math.max(f,d)+s:r==="right"&&(m+=Math.max(c,h)+s),{x:Rt(m,0,i.width-e.width),y:Rt(b,0,i.height-e.height)}}function Ql(n,e,t){const i=Sn(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function xf(n){return jn([],ei(n))}function Cw(n,e,t){return Si(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function ec(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}class xr extends li{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart||e._chart,this._chart=this.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&t.options.animation&&i.animations,l=new Zg(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(l)),l}getContext(){return this.$context||(this.$context=Cw(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,s=i.beforeTitle.apply(this,[e]),l=i.title.apply(this,[e]),o=i.afterTitle.apply(this,[e]);let r=[];return r=jn(r,ei(s)),r=jn(r,ei(l)),r=jn(r,ei(o)),r}getBeforeBody(e,t){return xf(t.callbacks.beforeBody.apply(this,[e]))}getBody(e,t){const{callbacks:i}=t,s=[];return lt(e,l=>{const o={before:[],lines:[],after:[]},r=ec(i,l);jn(o.before,ei(r.beforeLabel.call(this,l))),jn(o.lines,r.label.call(this,l)),jn(o.after,ei(r.afterLabel.call(this,l))),s.push(o)}),s}getAfterBody(e,t){return xf(t.callbacks.afterBody.apply(this,[e]))}getFooter(e,t){const{callbacks:i}=t,s=i.beforeFooter.apply(this,[e]),l=i.footer.apply(this,[e]),o=i.afterFooter.apply(this,[e]);let r=[];return r=jn(r,ei(s)),r=jn(r,ei(l)),r=jn(r,ei(o)),r}_createItems(e){const t=this._active,i=this.chart.data,s=[],l=[],o=[];let r=[],a,u;for(a=0,u=t.length;ae.filter(f,c,d,i))),e.itemSort&&(r=r.sort((f,c)=>e.itemSort(f,c,i))),lt(r,f=>{const c=ec(e.callbacks,f);s.push(c.labelColor.call(this,f)),l.push(c.labelPointStyle.call(this,f)),o.push(c.labelTextColor.call(this,f))}),this.labelColors=s,this.labelPointStyles=l,this.labelTextColors=o,this.dataPoints=r,r}update(e,t){const i=this.options.setContext(this.getContext()),s=this._active;let l,o=[];if(!s.length)this.opacity!==0&&(l={opacity:0});else{const r=nl[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const a=this._size=Gf(this,i),u=Object.assign({},r,a),f=Xf(this.chart,i,u),c=Qf(i,u,f,this.chart);this.xAlign=f.xAlign,this.yAlign=f.yAlign,l={opacity:1,x:c.x,y:c.y,width:a.width,height:a.height,caretX:r.x,caretY:r.y}}this._tooltipItems=o,this.$context=void 0,l&&this._resolveAnimations().update(this,l),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,i,s){const l=this.getCaretPosition(e,i,s);t.lineTo(l.x1,l.y1),t.lineTo(l.x2,l.y2),t.lineTo(l.x3,l.y3)}getCaretPosition(e,t,i){const{xAlign:s,yAlign:l}=this,{caretSize:o,cornerRadius:r}=i,{topLeft:a,topRight:u,bottomLeft:f,bottomRight:c}=gs(r),{x:d,y:h}=e,{width:m,height:b}=t;let g,y,k,w,C,M;return l==="center"?(C=h+b/2,s==="left"?(g=d,y=g-o,w=C+o,M=C-o):(g=d+m,y=g+o,w=C-o,M=C+o),k=g):(s==="left"?y=d+Math.max(a,f)+o:s==="right"?y=d+m-Math.max(u,c)-o:y=this.caretX,l==="top"?(w=h,C=w-o,g=y-o,k=y+o):(w=h+b,C=w+o,g=y+o,k=y-o),M=w),{x1:g,x2:y,x3:k,y1:w,y2:C,y3:M}}drawTitle(e,t,i){const s=this.title,l=s.length;let o,r,a;if(l){const u=ar(i.rtl,this.x,this.width);for(e.x=Ql(this,i.titleAlign,i),t.textAlign=u.textAlign(i.titleAlign),t.textBaseline="middle",o=rn(i.titleFont),r=i.titleSpacing,t.fillStyle=i.titleColor,t.font=o.string,a=0;aw!==0)?(e.beginPath(),e.fillStyle=l.multiKeyBackground,Co(e,{x:g,y:b,w:u,h:a,radius:k}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Co(e,{x:y,y:b+1,w:u-2,h:a-2,radius:k}),e.fill()):(e.fillStyle=l.multiKeyBackground,e.fillRect(g,b,u,a),e.strokeRect(g,b,u,a),e.fillStyle=o.backgroundColor,e.fillRect(y,b+1,u-2,a-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:s}=this,{bodySpacing:l,bodyAlign:o,displayColors:r,boxHeight:a,boxWidth:u,boxPadding:f}=i,c=rn(i.bodyFont);let d=c.lineHeight,h=0;const m=ar(i.rtl,this.x,this.width),b=function(A){t.fillText(A,m.x(e.x+h),e.y+d/2),e.y+=d+l},g=m.textAlign(o);let y,k,w,C,M,T,D;for(t.textAlign=o,t.textBaseline="middle",t.font=c.string,e.x=Ql(this,g,i),t.fillStyle=i.bodyColor,lt(this.beforeBody,b),h=r&&g!=="right"?o==="center"?u/2+f:u+2+f:0,C=0,T=s.length;C0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,s=i&&i.x,l=i&&i.y;if(s||l){const o=nl[e.position].call(this,this._active,this._eventPosition);if(!o)return;const r=this._size=Gf(this,e),a=Object.assign({},o,this._size),u=Xf(t,e,a),f=Qf(e,a,u,t);(s._to!==f.x||l._to!==f.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=r.width,this.height=r.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,f))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(t);const s={width:this.width,height:this.height},l={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=Sn(t.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&r&&(e.save(),e.globalAlpha=i,this.drawBackground(l,e,s,t),Wy(e,t.textDirection),l.y+=o.top,this.drawTitle(l,e,t),this.drawBody(l,e,t),this.drawFooter(l,e,t),Uy(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,s=e.map(({datasetIndex:r,index:a})=>{const u=this.chart.getDatasetMeta(r);if(!u)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:u.data[a],index:a}}),l=!vo(i,s),o=this._positionChanged(s,t);(l||o)&&(this._active=s,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,i=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,l=this._active||[],o=this._getActiveElements(e,l,t,i),r=this._positionChanged(o,e),a=t||!vo(o,l)||r;return a&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),a}_getActiveElements(e,t,i,s){const l=this.options;if(e.type==="mouseout")return[];if(!s)return t;const o=this.chart.getElementsAtEventForMode(e,l.mode,l,i);return l.reverse&&o.reverse(),o}_positionChanged(e,t){const{caretX:i,caretY:s,options:l}=this,o=nl[l.position].call(this,e,t);return o!==!1&&(i!==o.x||s!==o.y)}}xr.positioners=nl;var Mw={id:"tooltip",_element:xr,positioners:nl,afterInit(n,e,t){t&&(n.tooltip=new xr({chart:n,options:t}))},beforeUpdate(n,e,t){n.tooltip&&n.tooltip.initialize(t)},reset(n,e,t){n.tooltip&&n.tooltip.initialize(t)},afterDraw(n){const e=n.tooltip;if(e&&e._willRender()){const t={tooltip:e};if(n.notifyPlugins("beforeTooltipDraw",t)===!1)return;e.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",t)}},afterEvent(n,e){if(n.tooltip){const t=e.replay;n.tooltip.handleEvent(e.event,t,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,e)=>e.bodyFont.size,boxWidth:(n,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:Qn,title(n){if(n.length>0){const e=n[0],t=e.chart.data.labels,i=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndexn!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Tw=(n,e,t,i)=>(typeof e=="string"?(t=n.push(e)-1,i.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function Ow(n,e,t,i){const s=n.indexOf(e);if(s===-1)return Tw(n,e,t,i);const l=n.lastIndexOf(e);return s!==l?t:s}const Dw=(n,e)=>n===null?null:Rt(Math.round(n),0,e);class ea extends Qi{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const t=this._addedLabels;if(t.length){const i=this.getLabels();for(const{index:s,label:l}of t)i[s]===l&&i.splice(s,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(nt(e))return null;const i=this.getLabels();return t=isFinite(t)&&i[t]===e?t:Ow(i,e,Ge(t,e),this._addedLabels),Dw(t,i.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(i=0),t||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const e=this.min,t=this.max,i=this.options.offset,s=[];let l=this.getLabels();l=e===0&&t===l.length-1?l:l.slice(e,t+1),this._valueRange=Math.max(l.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let o=e;o<=t;o++)s.push({value:o});return s}getLabelForValue(e){const t=this.getLabels();return e>=0&&et.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}ea.id="category";ea.defaults={ticks:{callback:ea.prototype.getLabelForValue}};function Ew(n,e){const t=[],{bounds:s,step:l,min:o,max:r,precision:a,count:u,maxTicks:f,maxDigits:c,includeBounds:d}=n,h=l||1,m=f-1,{min:b,max:g}=e,y=!nt(o),k=!nt(r),w=!nt(u),C=(g-b)/(c+1);let M=Qu((g-b)/m/h)*h,T,D,A,P;if(M<1e-14&&!y&&!k)return[{value:b},{value:g}];P=Math.ceil(g/M)-Math.floor(b/M),P>m&&(M=Qu(P*M/m/h)*h),nt(a)||(T=Math.pow(10,a),M=Math.ceil(M*T)/T),s==="ticks"?(D=Math.floor(b/M)*M,A=Math.ceil(g/M)*M):(D=b,A=g),y&&k&&l&&Tv((r-o)/l,M/1e3)?(P=Math.round(Math.min((r-o)/M,f)),M=(r-o)/P,D=o,A=r):w?(D=y?o:D,A=k?r:A,P=u-1,M=(A-D)/P):(P=(A-D)/M,xs(P,Math.round(P),M/1e3)?P=Math.round(P):P=Math.ceil(P));const L=Math.max(xu(M),xu(D));T=Math.pow(10,nt(a)?L:a),D=Math.round(D*T)/T,A=Math.round(A*T)/T;let V=0;for(y&&(d&&D!==o?(t.push({value:o}),Ds=t?s:a,r=a=>l=i?l:a;if(e){const a=zn(s),u=zn(l);a<0&&u<0?r(0):a>0&&u>0&&o(0)}if(s===l){let a=1;(l>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(a=Math.abs(l*.05)),r(l+a),e||o(s-a)}this.min=s,this.max=l}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:t,stepSize:i}=e,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),t=t||11),t&&(s=Math.min(t,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},l=this._range||this,o=Ew(s,l);return e.bounds==="ticks"&&Cg(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let t=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const s=(i-t)/Math.max(e.length-1,1)/2;t-=s,i+=s}this._startValue=t,this._endValue=i,this._valueRange=i-t}getLabelForValue(e){return Ml(e,this.chart.options.locale,this.options.ticks.format)}}class Ua extends Eo{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=_t(e)?e:0,this.max=_t(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=In(this.options.ticks.minRotation),s=(e?Math.sin(i):Math.cos(i))||.001,l=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,l.lineHeight/s))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}Ua.id="linear";Ua.defaults={ticks:{callback:Wo.formatters.numeric}};function nc(n){return n/Math.pow(10,Math.floor(bn(n)))===1}function Aw(n,e){const t=Math.floor(bn(e.max)),i=Math.ceil(e.max/Math.pow(10,t)),s=[];let l=hn(n.min,Math.pow(10,Math.floor(bn(e.min)))),o=Math.floor(bn(l)),r=Math.floor(l/Math.pow(10,o)),a=o<0?Math.pow(10,Math.abs(o)):1;do s.push({value:l,major:nc(l)}),++r,r===10&&(r=1,++o,a=o>=0?1:a),l=Math.round(r*Math.pow(10,o)*a)/a;while(o0?i:null}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=_t(e)?Math.max(0,e):null,this.max=_t(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let i=this.min,s=this.max;const l=a=>i=e?i:a,o=a=>s=t?s:a,r=(a,u)=>Math.pow(10,Math.floor(bn(a))+u);i===s&&(i<=0?(l(1),o(10)):(l(r(i,-1)),o(r(s,1)))),i<=0&&l(r(s,-1)),s<=0&&o(r(i,1)),this._zero&&this.min!==this._suggestedMin&&i===r(this.min,0)&&l(r(i,-1)),this.min=i,this.max=s}buildTicks(){const e=this.options,t={min:this._userMin,max:this._userMax},i=Aw(t,this);return e.bounds==="ticks"&&Cg(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(e){return e===void 0?"0":Ml(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=bn(e),this._valueRange=bn(this.max)-bn(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(bn(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}__.id="logarithmic";__.defaults={ticks:{callback:Wo.formatters.logarithmic,major:{enabled:!0}}};function ta(n){const e=n.ticks;if(e.display&&n.display){const t=Sn(e.backdropPadding);return Ge(e.font&&e.font.size,Xe.font.size)+t.height}return 0}function Iw(n,e,t){return t=ft(t)?t:[t],{w:ly(n,e.string,t),h:t.length*e.lineHeight}}function ic(n,e,t,i,s){return n===i||n===s?{start:e-t/2,end:e+t/2}:ns?{start:e-t,end:e}:{start:e,end:e+t}}function Pw(n){const e={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},t=Object.assign({},e),i=[],s=[],l=n._pointLabels.length,o=n.options.pointLabels,r=o.centerPointLabels?gt/l:0;for(let a=0;ae.r&&(r=(i.end-e.r)/l,n.r=Math.max(n.r,e.r+r)),s.starte.b&&(a=(s.end-e.b)/o,n.b=Math.max(n.b,e.b+a))}function Nw(n,e,t){const i=[],s=n._pointLabels.length,l=n.options,o=ta(l)/2,r=n.drawingArea,a=l.pointLabels.centerPointLabels?gt/s:0;for(let u=0;u270||t<90)&&(n-=e),n}function jw(n,e){const{ctx:t,options:{pointLabels:i}}=n;for(let s=e-1;s>=0;s--){const l=i.setContext(n.getPointLabelContext(s)),o=rn(l.font),{x:r,y:a,textAlign:u,left:f,top:c,right:d,bottom:h}=n._pointLabelItems[s],{backdropColor:m}=l;if(!nt(m)){const b=gs(l.borderRadius),g=Sn(l.backdropPadding);t.fillStyle=m;const y=f-g.left,k=c-g.top,w=d-f+g.width,C=h-c+g.height;Object.values(b).some(M=>M!==0)?(t.beginPath(),Co(t,{x:y,y:k,w,h:C,radius:b}),t.fill()):t.fillRect(y,k,w,C)}$o(t,n._pointLabels[s],r,a+o.lineHeight/2,o,{color:l.color,textAlign:u,textBaseline:"middle"})}}function b_(n,e,t,i){const{ctx:s}=n;if(t)s.arc(n.xCenter,n.yCenter,e,0,ot);else{let l=n.getPointPosition(0,e);s.moveTo(l.x,l.y);for(let o=1;o{const s=pt(this.options.pointLabels.callback,[t,i],this);return s||s===0?s:""}).filter((t,i)=>this.chart.getDataVisibility(i))}fit(){const e=this.options;e.display&&e.pointLabels.display?Pw(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,i,s){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,i,s))}getIndexAngle(e){const t=ot/(this._pointLabels.length||1),i=this.options.startAngle||0;return on(e*t+In(i))}getDistanceFromCenterForValue(e){if(nt(e))return NaN;const t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(nt(e))return NaN;const t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){const t=this._pointLabels||[];if(e>=0&&e{if(f!==0){r=this.getDistanceFromCenterForValue(u.value);const c=s.setContext(this.getContext(f-1));qw(this,c,r,l)}}),i.display){for(e.save(),o=l-1;o>=0;o--){const u=i.setContext(this.getPointLabelContext(o)),{color:f,lineWidth:c}=u;!c||!f||(e.lineWidth=c,e.strokeStyle=f,e.setLineDash(u.borderDash),e.lineDashOffset=u.borderDashOffset,r=this.getDistanceFromCenterForValue(t.ticks.reverse?this.min:this.max),a=this.getPointPosition(o,r),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(a.x,a.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,t=this.options,i=t.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let l,o;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(s),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((r,a)=>{if(a===0&&!t.reverse)return;const u=i.setContext(this.getContext(a)),f=rn(u.font);if(l=this.getDistanceFromCenterForValue(this.ticks[a].value),u.showLabelBackdrop){e.font=f.string,o=e.measureText(r.label).width,e.fillStyle=u.backdropColor;const c=Sn(u.backdropPadding);e.fillRect(-o/2-c.left,-l-f.size/2-c.top,o+c.width,f.size+c.height)}$o(e,r.label,0,-l,f,{color:u.color})}),e.restore()}drawTitle(){}}Yo.id="radialLinear";Yo.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Wo.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(n){return n},padding:5,centerPointLabels:!1}};Yo.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};Yo.descriptors={angleLines:{_fallback:"grid"}};const Ko={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Gt=Object.keys(Ko);function zw(n,e){return n-e}function sc(n,e){if(nt(e))return null;const t=n._adapter,{parser:i,round:s,isoWeekday:l}=n._parseOpts;let o=e;return typeof i=="function"&&(o=i(o)),_t(o)||(o=typeof i=="string"?t.parse(o,i):t.parse(o)),o===null?null:(s&&(o=s==="week"&&(ws(l)||l===!0)?t.startOf(o,"isoWeek",l):t.startOf(o,s)),+o)}function lc(n,e,t,i){const s=Gt.length;for(let l=Gt.indexOf(n);l=Gt.indexOf(t);l--){const o=Gt[l];if(Ko[o].common&&n._adapter.diff(s,i,o)>=e-1)return o}return Gt[t?Gt.indexOf(t):0]}function Ww(n){for(let e=Gt.indexOf(n)+1,t=Gt.length;e=e?t[i]:t[s];n[l]=!0}}function Uw(n,e,t,i){const s=n._adapter,l=+s.startOf(e[0].value,i),o=e[e.length-1].value;let r,a;for(r=l;r<=o;r=+s.add(r,1,i))a=t[r],a>=0&&(e[a].major=!0);return e}function rc(n,e,t){const i=[],s={},l=e.length;let o,r;for(o=0;o+e.value))}initOffsets(e){let t=0,i=0,s,l;this.options.offset&&e.length&&(s=this.getDecimalForValue(e[0]),e.length===1?t=1-s:t=(this.getDecimalForValue(e[1])-s)/2,l=this.getDecimalForValue(e[e.length-1]),e.length===1?i=l:i=(l-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;t=Rt(t,0,o),i=Rt(i,0,o),this._offsets={start:t,end:i,factor:1/(t+1+i)}}_generate(){const e=this._adapter,t=this.min,i=this.max,s=this.options,l=s.time,o=l.unit||lc(l.minUnit,t,i,this._getLabelCapacity(t)),r=Ge(l.stepSize,1),a=o==="week"?l.isoWeekday:!1,u=ws(a)||a===!0,f={};let c=t,d,h;if(u&&(c=+e.startOf(c,"isoWeek",a)),c=+e.startOf(c,u?"day":o),e.diff(i,t,o)>1e5*r)throw new Error(t+" and "+i+" are too far apart with stepSize of "+r+" "+o);const m=s.ticks.source==="data"&&this.getDataTimestamps();for(d=c,h=0;db-g).map(b=>+b)}getLabelForValue(e){const t=this._adapter,i=this.options.time;return i.tooltipFormat?t.format(e,i.tooltipFormat):t.format(e,i.displayFormats.datetime)}_tickFormatFunction(e,t,i,s){const l=this.options,o=l.time.displayFormats,r=this._unit,a=this._majorUnit,u=r&&o[r],f=a&&o[a],c=i[t],d=a&&f&&c&&c.major,h=this._adapter.format(e,s||(d?f:u)),m=l.ticks.callback;return m?pt(m,[h,t,i],this):h}generateTickLabels(e){let t,i,s;for(t=0,i=e.length;t0?r:1}getDataTimestamps(){let e=this._cache.data||[],t,i;if(e.length)return e;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,i=s.length;t=n[i].pos&&e<=n[s].pos&&({lo:i,hi:s}=qi(n,"pos",e)),{pos:l,time:r}=n[i],{pos:o,time:a}=n[s]):(e>=n[i].time&&e<=n[s].time&&({lo:i,hi:s}=qi(n,"time",e)),{time:l,pos:r}=n[i],{time:o,pos:a}=n[s]);const u=o-l;return u?r+(a-r)*(e-l)/u:r}class v_ extends Dl{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=xl(t,this.min),this._tableRange=xl(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,s=[],l=[];let o,r,a,u,f;for(o=0,r=e.length;o=t&&u<=i&&s.push(u);if(s.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(o=0,r=s.length;o{t||(t=je(e,$t,{duration:150},!0)),t.run(1)}),i=!0)},o(s){s&&(t||(t=je(e,$t,{duration:150},!1)),t.run(0)),i=!1},d(s){s&&S(e),s&&t&&t.end()}}}function Kw(n){let e,t,i=n[1]===1?"log":"logs",s;return{c(){e=z(n[1]),t=O(),s=z(i)},m(l,o){$(l,e,o),$(l,t,o),$(l,s,o)},p(l,o){o&2&&ue(e,l[1]),o&2&&i!==(i=l[1]===1?"log":"logs")&&ue(s,i)},d(l){l&&S(e),l&&S(t),l&&S(s)}}}function Jw(n){let e;return{c(){e=z("Loading...")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function Zw(n){let e,t,i,s,l,o=n[2]&&ac();function r(f,c){return f[2]?Jw:Kw}let a=r(n),u=a(n);return{c(){e=v("div"),o&&o.c(),t=O(),i=v("canvas"),s=O(),l=v("div"),u.c(),p(i,"class","chart-canvas svelte-vh4sl8"),Qa(i,"height","250px"),Qa(i,"width","100%"),p(e,"class","chart-wrapper svelte-vh4sl8"),ee(e,"loading",n[2]),p(l,"class","txt-hint m-t-xs txt-right")},m(f,c){$(f,e,c),o&&o.m(e,null),_(e,t),_(e,i),n[8](i),$(f,s,c),$(f,l,c),u.m(l,null)},p(f,[c]){f[2]?o?c&4&&E(o,1):(o=ac(),o.c(),E(o,1),o.m(e,t)):o&&(be(),I(o,1,1,()=>{o=null}),ve()),c&4&&ee(e,"loading",f[2]),a===(a=r(f))&&u?u.p(f,c):(u.d(1),u=a(f),u&&(u.c(),u.m(l,null)))},i(f){E(o)},o(f){I(o)},d(f){f&&S(e),o&&o.d(),n[8](null),f&&S(s),f&&S(l),u.d()}}}function Gw(n,e,t){let{filter:i=""}=e,{presets:s=""}=e,l,o,r=[],a=0,u=!1;async function f(){return t(2,u=!0),me.logs.getRequestsStats({filter:[s,i].filter(Boolean).join("&&")}).then(h=>{c();for(let m of h)r.push({x:new Date(m.date),y:m.total}),t(1,a+=m.total);r.push({x:new Date,y:void 0})}).catch(h=>{h!=null&&h.isAbort||(c(),console.warn(h),me.errorResponseHandler(h,!1))}).finally(()=>{t(2,u=!1)})}function c(){t(1,a=0),t(7,r=[])}un(()=>(Do.register($i,Uo,Bo,Ua,Dl,bw,Mw),t(6,o=new Do(l,{type:"line",data:{datasets:[{label:"Total requests",data:r,borderColor:"#ef4565",pointBackgroundColor:"#ef4565",backgroundColor:"rgb(239,69,101,0.05)",borderWidth:2,pointRadius:1,pointBorderWidth:0,fill:!0}]},options:{animation:!1,interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,grid:{color:"#edf0f3",borderColor:"#dee3e8"},ticks:{precision:0,maxTicksLimit:6,autoSkip:!0,color:"#666f75"}},x:{type:"time",time:{unit:"hour",tooltipFormat:"DD h a"},grid:{borderColor:"#dee3e8",color:h=>h.tick.major?"#edf0f3":""},ticks:{maxTicksLimit:15,autoSkip:!0,maxRotation:0,major:{enabled:!0},color:h=>h.tick.major?"#16161a":"#666f75"}}},plugins:{legend:{display:!1}}}})),()=>o==null?void 0:o.destroy()));function d(h){le[h?"unshift":"push"](()=>{l=h,t(0,l)})}return n.$$set=h=>{"filter"in h&&t(3,i=h.filter),"presets"in h&&t(4,s=h.presets)},n.$$.update=()=>{n.$$.dirty&24&&(typeof i<"u"||typeof s<"u")&&f(),n.$$.dirty&192&&typeof r<"u"&&o&&(t(6,o.data.datasets[0].data=r,o),o.update())},[l,a,u,i,s,f,o,r,d]}class Xw extends Me{constructor(e){super(),Ce(this,e,Gw,Zw,we,{filter:3,presets:4,load:5})}get load(){return this.$$.ctx[5]}}var uc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},y_={exports:{}};(function(n){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** + * Prism: Lightweight, robust, elegant syntax highlighting + * + * @license MIT + * @author Lea Verou + * @namespace + * @public + */var t=function(i){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,o={},r={manual:i.Prism&&i.Prism.manual,disableWorkerMessageHandler:i.Prism&&i.Prism.disableWorkerMessageHandler,util:{encode:function k(w){return w instanceof a?new a(w.type,k(w.content),w.alias):Array.isArray(w)?w.map(k):w.replace(/&/g,"&").replace(/"u")return null;if("currentScript"in document&&1<2)return document.currentScript;try{throw new Error}catch(M){var k=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(M.stack)||[])[1];if(k){var w=document.getElementsByTagName("script");for(var C in w)if(w[C].src==k)return w[C]}return null}},isActive:function(k,w,C){for(var M="no-"+w;k;){var T=k.classList;if(T.contains(w))return!0;if(T.contains(M))return!1;k=k.parentElement}return!!C}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(k,w){var C=r.util.clone(r.languages[k]);for(var M in w)C[M]=w[M];return C},insertBefore:function(k,w,C,M){M=M||r.languages;var T=M[k],D={};for(var A in T)if(T.hasOwnProperty(A)){if(A==w)for(var P in C)C.hasOwnProperty(P)&&(D[P]=C[P]);C.hasOwnProperty(A)||(D[A]=T[A])}var L=M[k];return M[k]=D,r.languages.DFS(r.languages,function(V,F){F===L&&V!=k&&(this[V]=D)}),D},DFS:function k(w,C,M,T){T=T||{};var D=r.util.objId;for(var A in w)if(w.hasOwnProperty(A)){C.call(w,A,w[A],M||A);var P=w[A],L=r.util.type(P);L==="Object"&&!T[D(P)]?(T[D(P)]=!0,k(P,C,null,T)):L==="Array"&&!T[D(P)]&&(T[D(P)]=!0,k(P,C,A,T))}}},plugins:{},highlightAll:function(k,w){r.highlightAllUnder(document,k,w)},highlightAllUnder:function(k,w,C){var M={callback:C,container:k,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",M),M.elements=Array.prototype.slice.apply(M.container.querySelectorAll(M.selector)),r.hooks.run("before-all-elements-highlight",M);for(var T=0,D;D=M.elements[T++];)r.highlightElement(D,w===!0,M.callback)},highlightElement:function(k,w,C){var M=r.util.getLanguage(k),T=r.languages[M];r.util.setLanguage(k,M);var D=k.parentElement;D&&D.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(D,M);var A=k.textContent,P={element:k,language:M,grammar:T,code:A};function L(F){P.highlightedCode=F,r.hooks.run("before-insert",P),P.element.innerHTML=P.highlightedCode,r.hooks.run("after-highlight",P),r.hooks.run("complete",P),C&&C.call(P.element)}if(r.hooks.run("before-sanity-check",P),D=P.element.parentElement,D&&D.nodeName.toLowerCase()==="pre"&&!D.hasAttribute("tabindex")&&D.setAttribute("tabindex","0"),!P.code){r.hooks.run("complete",P),C&&C.call(P.element);return}if(r.hooks.run("before-highlight",P),!P.grammar){L(r.util.encode(P.code));return}if(w&&i.Worker){var V=new Worker(r.filename);V.onmessage=function(F){L(F.data)},V.postMessage(JSON.stringify({language:P.language,code:P.code,immediateClose:!0}))}else L(r.highlight(P.code,P.grammar,P.language))},highlight:function(k,w,C){var M={code:k,grammar:w,language:C};if(r.hooks.run("before-tokenize",M),!M.grammar)throw new Error('The language "'+M.language+'" has no grammar.');return M.tokens=r.tokenize(M.code,M.grammar),r.hooks.run("after-tokenize",M),a.stringify(r.util.encode(M.tokens),M.language)},tokenize:function(k,w){var C=w.rest;if(C){for(var M in C)w[M]=C[M];delete w.rest}var T=new c;return d(T,T.head,k),f(k,T,w,T.head,0),m(T)},hooks:{all:{},add:function(k,w){var C=r.hooks.all;C[k]=C[k]||[],C[k].push(w)},run:function(k,w){var C=r.hooks.all[k];if(!(!C||!C.length))for(var M=0,T;T=C[M++];)T(w)}},Token:a};i.Prism=r;function a(k,w,C,M){this.type=k,this.content=w,this.alias=C,this.length=(M||"").length|0}a.stringify=function k(w,C){if(typeof w=="string")return w;if(Array.isArray(w)){var M="";return w.forEach(function(L){M+=k(L,C)}),M}var T={type:w.type,content:k(w.content,C),tag:"span",classes:["token",w.type],attributes:{},language:C},D=w.alias;D&&(Array.isArray(D)?Array.prototype.push.apply(T.classes,D):T.classes.push(D)),r.hooks.run("wrap",T);var A="";for(var P in T.attributes)A+=" "+P+'="'+(T.attributes[P]||"").replace(/"/g,""")+'"';return"<"+T.tag+' class="'+T.classes.join(" ")+'"'+A+">"+T.content+""};function u(k,w,C,M){k.lastIndex=w;var T=k.exec(C);if(T&&M&&T[1]){var D=T[1].length;T.index+=D,T[0]=T[0].slice(D)}return T}function f(k,w,C,M,T,D){for(var A in C)if(!(!C.hasOwnProperty(A)||!C[A])){var P=C[A];P=Array.isArray(P)?P:[P];for(var L=0;L=D.reach);J+=ie.value.length,ie=ie.next){var fe=ie.value;if(w.length>k.length)return;if(!(fe instanceof a)){var Y=1,re;if(G){if(re=u(Z,J,k,W),!re||re.index>=k.length)break;var pe=re.index,Oe=re.index+re[0].length,ge=J;for(ge+=ie.value.length;pe>=ge;)ie=ie.next,ge+=ie.value.length;if(ge-=ie.value.length,J=ge,ie.value instanceof a)continue;for(var ae=ie;ae!==w.tail&&(geD.reach&&(D.reach=We);var ce=ie.prev;Se&&(ce=d(w,ce,Se),J+=Se.length),h(w,ce,Y);var se=new a(A,F?r.tokenize(de,F):de,K,de);if(ie=d(w,ce,se),ye&&d(w,ie,ye),Y>1){var te={cause:A+","+L,reach:We};f(k,w,C,ie.prev,J,te),D&&te.reach>D.reach&&(D.reach=te.reach)}}}}}}function c(){var k={value:null,prev:null,next:null},w={value:null,prev:k,next:null};k.next=w,this.head=k,this.tail=w,this.length=0}function d(k,w,C){var M=w.next,T={value:C,prev:w,next:M};return w.next=T,M.prev=T,k.length++,T}function h(k,w,C){for(var M=w.next,T=0;T/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},t.languages.markup.tag.inside["attr-value"].inside.entity=t.languages.markup.entity,t.languages.markup.doctype.inside["internal-subset"].inside=t.languages.markup,t.hooks.add("wrap",function(i){i.type==="entity"&&(i.attributes.title=i.content.replace(/&/,"&"))}),Object.defineProperty(t.languages.markup.tag,"addInlined",{value:function(s,l){var o={};o["language-"+l]={pattern:/(^$)/i,lookbehind:!0,inside:t.languages[l]},o.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:o}};r["language-"+l]={pattern:/[\s\S]+/,inside:t.languages[l]};var a={};a[s]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return s}),"i"),lookbehind:!0,greedy:!0,inside:r},t.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(t.languages.markup.tag,"addAttribute",{value:function(i,s){t.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+i+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:t.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),t.languages.html=t.languages.markup,t.languages.mathml=t.languages.markup,t.languages.svg=t.languages.markup,t.languages.xml=t.languages.extend("markup",{}),t.languages.ssml=t.languages.xml,t.languages.atom=t.languages.xml,t.languages.rss=t.languages.xml,function(i){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;i.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},i.languages.css.atrule.inside.rest=i.languages.css;var l=i.languages.markup;l&&(l.tag.addInlined("style","css"),l.tag.addAttribute("style","css"))}(t),t.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},t.languages.javascript=t.languages.extend("clike",{"class-name":[t.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),t.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,t.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:t.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:t.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:t.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:t.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:t.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),t.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:t.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),t.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),t.languages.markup&&(t.languages.markup.tag.addInlined("script","javascript"),t.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),t.languages.js=t.languages.javascript,function(){if(typeof t>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var i="Loading\u2026",s=function(b,g){return"\u2716 Error "+b+" while fetching file: "+g},l="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",a="loading",u="loaded",f="failed",c="pre[data-src]:not(["+r+'="'+u+'"]):not(['+r+'="'+a+'"])';function d(b,g,y){var k=new XMLHttpRequest;k.open("GET",b,!0),k.onreadystatechange=function(){k.readyState==4&&(k.status<400&&k.responseText?g(k.responseText):k.status>=400?y(s(k.status,k.statusText)):y(l))},k.send(null)}function h(b){var g=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(b||"");if(g){var y=Number(g[1]),k=g[2],w=g[3];return k?w?[y,Number(w)]:[y,void 0]:[y,y]}}t.hooks.add("before-highlightall",function(b){b.selector+=", "+c}),t.hooks.add("before-sanity-check",function(b){var g=b.element;if(g.matches(c)){b.code="",g.setAttribute(r,a);var y=g.appendChild(document.createElement("CODE"));y.textContent=i;var k=g.getAttribute("data-src"),w=b.language;if(w==="none"){var C=(/\.(\w+)$/.exec(k)||[,"none"])[1];w=o[C]||C}t.util.setLanguage(y,w),t.util.setLanguage(g,w);var M=t.plugins.autoloader;M&&M.loadLanguages(w),d(k,function(T){g.setAttribute(r,u);var D=h(g.getAttribute("data-range"));if(D){var A=T.split(/\r\n?|\n/g),P=D[0],L=D[1]==null?A.length:D[1];P<0&&(P+=A.length),P=Math.max(0,Math.min(P-1,A.length)),L<0&&(L+=A.length),L=Math.max(0,Math.min(L,A.length)),T=A.slice(P,L).join(` +`),g.hasAttribute("data-start")||g.setAttribute("data-start",String(P+1))}y.textContent=T,t.highlightElement(y)},function(T){g.setAttribute(r,f),y.textContent=T})}}),t.plugins.fileHighlight={highlight:function(g){for(var y=(g||document).querySelectorAll(c),k=0,w;w=y[k++];)t.highlightElement(w)}};var m=!1;t.fileHighlight=function(){m||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),m=!0),t.plugins.fileHighlight.highlight.apply(this,arguments)}}()})(y_);const Ws=y_.exports;var Qw={exports:{}};(function(n){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(o,r){for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);return o};function t(o){this.defaults=e({},o)}function i(o){return o.replace(/-(\w)/g,function(r,a){return a.toUpperCase()})}function s(o){for(var r=0,a=0;ar&&(f[d]=` +`+f[d],c=h)}a[u]=f.join("")}return a.join(` +`)}},n.exports&&(n.exports=t),Prism.plugins.NormalizeWhitespace=new t({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var r=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&!!Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=r.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in l)if(Object.hasOwnProperty.call(l,u)){var f=l[u];if(a.hasAttribute("data-"+u))try{var c=JSON.parse(a.getAttribute("data-"+u)||"true");typeof c===f&&(o.settings[u]=c)}catch{}}for(var d=a.childNodes,h="",m="",b=!1,g=0;g>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),n.languages.insertBefore("dart","string",{"string-literal":{pattern:/r?(?:("""|''')[\s\S]*?\1|(["'])(?:\\.|(?!\2)[^\\\r\n])*\2(?!\2))/,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,lookbehind:!0,inside:{punctuation:/^\$\{?|\}$/,expression:{pattern:/[\s\S]+/,inside:n.languages.dart}}},string:/[\s\S]+/}},string:void 0}),n.languages.insertBefore("dart","class-name",{metadata:{pattern:/@\w+/,alias:"function"}}),n.languages.insertBefore("dart","class-name",{generics:{pattern:/<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,inside:{"class-name":i,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}}})})(Prism);function xw(n){let e,t,i;return{c(){e=v("div"),t=v("code"),p(t,"class","svelte-10s5tkd"),p(e,"class",i="code-wrapper prism-light "+n[0]+" svelte-10s5tkd")},m(s,l){$(s,e,l),_(e,t),t.innerHTML=n[1]},p(s,[l]){l&2&&(t.innerHTML=s[1]),l&1&&i!==(i="code-wrapper prism-light "+s[0]+" svelte-10s5tkd")&&p(e,"class",i)},i:x,o:x,d(s){s&&S(e)}}}function eS(n,e,t){let{class:i=""}=e,{content:s=""}=e,{language:l="javascript"}=e,o="";function r(a){return a=typeof a=="string"?a:"",a=Ws.plugins.NormalizeWhitespace.normalize(a,{"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Ws.highlight(a,Ws.languages[l]||Ws.languages.javascript,l)}return n.$$set=a=>{"class"in a&&t(0,i=a.class),"content"in a&&t(2,s=a.content),"language"in a&&t(3,l=a.language)},n.$$.update=()=>{n.$$.dirty&4&&typeof Ws<"u"&&s&&t(1,o=r(s))},[i,o,s,l]}class k_ extends Me{constructor(e){super(),Ce(this,e,eS,xw,we,{class:0,content:2,language:3})}}const tS=n=>({}),fc=n=>({}),nS=n=>({}),cc=n=>({});function dc(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w=n[4]&&!n[2]&&pc(n);const C=n[18].header,M=Ot(C,n,n[17],cc);let T=n[4]&&n[2]&&hc(n);const D=n[18].default,A=Ot(D,n,n[17],null),P=n[18].footer,L=Ot(P,n,n[17],fc);return{c(){e=v("div"),t=v("div"),s=O(),l=v("div"),o=v("div"),w&&w.c(),r=O(),M&&M.c(),a=O(),T&&T.c(),u=O(),f=v("div"),A&&A.c(),c=O(),d=v("div"),L&&L.c(),p(t,"class","overlay"),p(o,"class","overlay-panel-section panel-header"),p(f,"class","overlay-panel-section panel-content"),p(d,"class","overlay-panel-section panel-footer"),p(l,"class",h="overlay-panel "+n[1]+" "+n[8]),ee(l,"popup",n[2]),p(e,"class","overlay-panel-container"),ee(e,"padded",n[2]),ee(e,"active",n[0])},m(V,F){$(V,e,F),_(e,t),_(e,s),_(e,l),_(l,o),w&&w.m(o,null),_(o,r),M&&M.m(o,null),_(o,a),T&&T.m(o,null),_(l,u),_(l,f),A&&A.m(f,null),n[20](f),_(l,c),_(l,d),L&&L.m(d,null),g=!0,y||(k=[U(t,"click",ut(n[19])),U(f,"scroll",n[21])],y=!0)},p(V,F){n=V,n[4]&&!n[2]?w?w.p(n,F):(w=pc(n),w.c(),w.m(o,r)):w&&(w.d(1),w=null),M&&M.p&&(!g||F&131072)&&Et(M,C,n,n[17],g?Dt(C,n[17],F,nS):At(n[17]),cc),n[4]&&n[2]?T?T.p(n,F):(T=hc(n),T.c(),T.m(o,null)):T&&(T.d(1),T=null),A&&A.p&&(!g||F&131072)&&Et(A,D,n,n[17],g?Dt(D,n[17],F,null):At(n[17]),null),L&&L.p&&(!g||F&131072)&&Et(L,P,n,n[17],g?Dt(P,n[17],F,tS):At(n[17]),fc),(!g||F&258&&h!==(h="overlay-panel "+n[1]+" "+n[8]))&&p(l,"class",h),(!g||F&262)&&ee(l,"popup",n[2]),(!g||F&4)&&ee(e,"padded",n[2]),(!g||F&1)&&ee(e,"active",n[0])},i(V){g||(Qe(()=>{i||(i=je(t,bo,{duration:cs,opacity:0},!0)),i.run(1)}),E(M,V),E(A,V),E(L,V),Qe(()=>{b&&b.end(1),m=cm(l,kn,n[2]?{duration:cs,y:-10}:{duration:cs,x:50}),m.start()}),g=!0)},o(V){i||(i=je(t,bo,{duration:cs,opacity:0},!1)),i.run(0),I(M,V),I(A,V),I(L,V),m&&m.invalidate(),b=dm(l,kn,n[2]?{duration:cs,y:10}:{duration:cs,x:50}),g=!1},d(V){V&&S(e),V&&i&&i.end(),w&&w.d(),M&&M.d(V),T&&T.d(),A&&A.d(V),n[20](null),L&&L.d(V),V&&b&&b.end(),y=!1,Re(k)}}}function pc(n){let e,t,i;return{c(){e=v("div"),e.innerHTML='',p(e,"class","overlay-close")},m(s,l){$(s,e,l),t||(i=U(e,"click",ut(n[5])),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function hc(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-secondary btn-close m-l-auto")},m(s,l){$(s,e,l),t||(i=U(e,"click",ut(n[5])),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function iS(n){let e,t,i,s,l=n[0]&&dc(n);return{c(){e=v("div"),l&&l.c(),p(e,"class","overlay-panel-wrapper")},m(o,r){$(o,e,r),l&&l.m(e,null),n[22](e),t=!0,i||(s=[U(window,"resize",n[10]),U(window,"keydown",n[9])],i=!0)},p(o,[r]){o[0]?l?(l.p(o,r),r&1&&E(l,1)):(l=dc(o),l.c(),E(l,1),l.m(e,null)):l&&(be(),I(l,1,1,()=>{l=null}),ve())},i(o){t||(E(l),t=!0)},o(o){I(l),t=!1},d(o){o&&S(e),l&&l.d(),n[22](null),i=!1,Re(s)}}}let Ni;function w_(){return Ni=Ni||document.querySelector(".overlays"),Ni||(Ni=document.createElement("div"),Ni.classList.add("overlays"),document.body.appendChild(Ni)),Ni}let cs=150;function mc(){return 1e3+w_().querySelectorAll(".overlay-panel-container.active").length}function sS(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,{active:o=!1}=e,{popup:r=!1}=e,{overlayClose:a=!0}=e,{btnClose:u=!0}=e,{escClose:f=!0}=e,{beforeOpen:c=void 0}=e,{beforeHide:d=void 0}=e;const h=It();let m,b,g,y,k="";function w(){typeof c=="function"&&c()===!1||t(0,o=!0)}function C(){typeof d=="function"&&d()===!1||t(0,o=!1)}function M(){return o}async function T(K){K?(g=document.activeElement,m==null||m.focus(),h("show"),document.body.classList.add("overlay-active")):(clearTimeout(y),g==null||g.focus(),h("hide"),document.body.classList.remove("overlay-active")),await $n(),D()}function D(){!m||(o?t(6,m.style.zIndex=mc(),m):t(6,m.style="",m))}function A(K){o&&f&&K.code=="Escape"&&!B.isInput(K.target)&&m&&m.style.zIndex==mc()&&(K.preventDefault(),C())}function P(K){o&&L(b)}function L(K,X){X&&t(8,k=""),K&&(y||(y=setTimeout(()=>{if(clearTimeout(y),y=null,!K)return;if(K.scrollHeight-K.offsetHeight>0)t(8,k="scrollable");else{t(8,k="");return}K.scrollTop==0?t(8,k+=" scroll-top-reached"):K.scrollTop+K.offsetHeight==K.scrollHeight&&t(8,k+=" scroll-bottom-reached")},100)))}un(()=>(w_().appendChild(m),()=>{var K;clearTimeout(y),(K=m==null?void 0:m.classList)==null||K.add("hidden"),setTimeout(()=>{m==null||m.remove()},0)}));const V=()=>a?C():!0;function F(K){le[K?"unshift":"push"](()=>{b=K,t(7,b)})}const W=K=>L(K.target);function G(K){le[K?"unshift":"push"](()=>{m=K,t(6,m)})}return n.$$set=K=>{"class"in K&&t(1,l=K.class),"active"in K&&t(0,o=K.active),"popup"in K&&t(2,r=K.popup),"overlayClose"in K&&t(3,a=K.overlayClose),"btnClose"in K&&t(4,u=K.btnClose),"escClose"in K&&t(12,f=K.escClose),"beforeOpen"in K&&t(13,c=K.beforeOpen),"beforeHide"in K&&t(14,d=K.beforeHide),"$$scope"in K&&t(17,s=K.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&T(o),n.$$.dirty&128&&L(b,!0),n.$$.dirty&64&&m&&D()},[o,l,r,a,u,C,m,b,k,A,P,L,f,c,d,w,M,s,i,V,F,W,G]}class Jn extends Me{constructor(e){super(),Ce(this,e,sS,iS,we,{class:1,active:0,popup:2,overlayClose:3,btnClose:4,escClose:12,beforeOpen:13,beforeHide:14,show:15,hide:5,isActive:16})}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[5]}get isActive(){return this.$$.ctx[16]}}function lS(n){let e;return{c(){e=v("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function oS(n){let e,t=n[2].referer+"",i,s;return{c(){e=v("a"),i=z(t),p(e,"href",s=n[2].referer),p(e,"target","_blank"),p(e,"rel","noopener noreferrer")},m(l,o){$(l,e,o),_(e,i)},p(l,o){o&4&&t!==(t=l[2].referer+"")&&ue(i,t),o&4&&s!==(s=l[2].referer)&&p(e,"href",s)},d(l){l&&S(e)}}}function rS(n){let e;return{c(){e=v("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){$(t,e,i)},p:x,i:x,o:x,d(t){t&&S(e)}}}function aS(n){let e,t;return e=new k_({props:{content:JSON.stringify(n[2].meta,null,2)}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s&4&&(l.content=JSON.stringify(i[2].meta,null,2)),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function uS(n){var Ie;let e,t,i,s,l,o,r=n[2].id+"",a,u,f,c,d,h,m,b=n[2].status+"",g,y,k,w,C,M,T=((Ie=n[2].method)==null?void 0:Ie.toUpperCase())+"",D,A,P,L,V,F,W=n[2].auth+"",G,K,X,Z,ie,J,fe=n[2].url+"",Y,re,Oe,ge,ae,pe,de,Se,ye,We,ce,se=n[2].remoteIp+"",te,ne,Ee,it,en,Yt,tn=n[2].userIp+"",Gn,Mi,oi,ri,As,ai,es=n[2].userAgent+"",ts,El,ui,ns,Al,Ti,is,Kt,Ke,ss,Xn,ls,Oi,Di,Pt,jt;function Il(Pe,De){return Pe[2].referer?oS:lS}let N=Il(n),q=N(n);const Q=[aS,rS],oe=[];function Te(Pe,De){return De&4&&(is=null),is==null&&(is=!B.isEmpty(Pe[2].meta)),is?0:1}return Kt=Te(n,-1),Ke=oe[Kt]=Q[Kt](n),Pt=new Ki({props:{date:n[2].created}}),{c(){e=v("table"),t=v("tbody"),i=v("tr"),s=v("td"),s.textContent="ID",l=O(),o=v("td"),a=z(r),u=O(),f=v("tr"),c=v("td"),c.textContent="Status",d=O(),h=v("td"),m=v("span"),g=z(b),y=O(),k=v("tr"),w=v("td"),w.textContent="Method",C=O(),M=v("td"),D=z(T),A=O(),P=v("tr"),L=v("td"),L.textContent="Auth",V=O(),F=v("td"),G=z(W),K=O(),X=v("tr"),Z=v("td"),Z.textContent="URL",ie=O(),J=v("td"),Y=z(fe),re=O(),Oe=v("tr"),ge=v("td"),ge.textContent="Referer",ae=O(),pe=v("td"),q.c(),de=O(),Se=v("tr"),ye=v("td"),ye.textContent="Remote IP",We=O(),ce=v("td"),te=z(se),ne=O(),Ee=v("tr"),it=v("td"),it.textContent="User IP",en=O(),Yt=v("td"),Gn=z(tn),Mi=O(),oi=v("tr"),ri=v("td"),ri.textContent="UserAgent",As=O(),ai=v("td"),ts=z(es),El=O(),ui=v("tr"),ns=v("td"),ns.textContent="Meta",Al=O(),Ti=v("td"),Ke.c(),ss=O(),Xn=v("tr"),ls=v("td"),ls.textContent="Created",Oi=O(),Di=v("td"),j(Pt.$$.fragment),p(s,"class","min-width txt-hint txt-bold"),p(c,"class","min-width txt-hint txt-bold"),p(m,"class","label"),ee(m,"label-danger",n[2].status>=400),p(w,"class","min-width txt-hint txt-bold"),p(L,"class","min-width txt-hint txt-bold"),p(Z,"class","min-width txt-hint txt-bold"),p(ge,"class","min-width txt-hint txt-bold"),p(ye,"class","min-width txt-hint txt-bold"),p(it,"class","min-width txt-hint txt-bold"),p(ri,"class","min-width txt-hint txt-bold"),p(ns,"class","min-width txt-hint txt-bold"),p(ls,"class","min-width txt-hint txt-bold"),p(e,"class","table-compact table-border")},m(Pe,De){$(Pe,e,De),_(e,t),_(t,i),_(i,s),_(i,l),_(i,o),_(o,a),_(t,u),_(t,f),_(f,c),_(f,d),_(f,h),_(h,m),_(m,g),_(t,y),_(t,k),_(k,w),_(k,C),_(k,M),_(M,D),_(t,A),_(t,P),_(P,L),_(P,V),_(P,F),_(F,G),_(t,K),_(t,X),_(X,Z),_(X,ie),_(X,J),_(J,Y),_(t,re),_(t,Oe),_(Oe,ge),_(Oe,ae),_(Oe,pe),q.m(pe,null),_(t,de),_(t,Se),_(Se,ye),_(Se,We),_(Se,ce),_(ce,te),_(t,ne),_(t,Ee),_(Ee,it),_(Ee,en),_(Ee,Yt),_(Yt,Gn),_(t,Mi),_(t,oi),_(oi,ri),_(oi,As),_(oi,ai),_(ai,ts),_(t,El),_(t,ui),_(ui,ns),_(ui,Al),_(ui,Ti),oe[Kt].m(Ti,null),_(t,ss),_(t,Xn),_(Xn,ls),_(Xn,Oi),_(Xn,Di),R(Pt,Di,null),jt=!0},p(Pe,De){var qe;(!jt||De&4)&&r!==(r=Pe[2].id+"")&&ue(a,r),(!jt||De&4)&&b!==(b=Pe[2].status+"")&&ue(g,b),(!jt||De&4)&&ee(m,"label-danger",Pe[2].status>=400),(!jt||De&4)&&T!==(T=((qe=Pe[2].method)==null?void 0:qe.toUpperCase())+"")&&ue(D,T),(!jt||De&4)&&W!==(W=Pe[2].auth+"")&&ue(G,W),(!jt||De&4)&&fe!==(fe=Pe[2].url+"")&&ue(Y,fe),N===(N=Il(Pe))&&q?q.p(Pe,De):(q.d(1),q=N(Pe),q&&(q.c(),q.m(pe,null))),(!jt||De&4)&&se!==(se=Pe[2].remoteIp+"")&&ue(te,se),(!jt||De&4)&&tn!==(tn=Pe[2].userIp+"")&&ue(Gn,tn),(!jt||De&4)&&es!==(es=Pe[2].userAgent+"")&&ue(ts,es);let ze=Kt;Kt=Te(Pe,De),Kt===ze?oe[Kt].p(Pe,De):(be(),I(oe[ze],1,1,()=>{oe[ze]=null}),ve(),Ke=oe[Kt],Ke?Ke.p(Pe,De):(Ke=oe[Kt]=Q[Kt](Pe),Ke.c()),E(Ke,1),Ke.m(Ti,null));const Ne={};De&4&&(Ne.date=Pe[2].created),Pt.$set(Ne)},i(Pe){jt||(E(Ke),E(Pt.$$.fragment,Pe),jt=!0)},o(Pe){I(Ke),I(Pt.$$.fragment,Pe),jt=!1},d(Pe){Pe&&S(e),q.d(),oe[Kt].d(),H(Pt)}}}function fS(n){let e;return{c(){e=v("h4"),e.textContent="Request log"},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function cS(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='Close',p(e,"type","button"),p(e,"class","btn btn-secondary")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[4]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function dS(n){let e,t,i={class:"overlay-panel-lg log-panel",$$slots:{footer:[cS],header:[fS],default:[uS]},$$scope:{ctx:n}};return e=new Jn({props:i}),n[5](e),e.$on("hide",n[6]),e.$on("show",n[7]),{c(){j(e.$$.fragment)},m(s,l){R(e,s,l),t=!0},p(s,[l]){const o={};l&260&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){I(e.$$.fragment,s),t=!1},d(s){n[5](null),H(e,s)}}}function pS(n,e,t){let i,s=new Ar;function l(c){return t(2,s=c),i==null?void 0:i.show()}function o(){return i==null?void 0:i.hide()}const r=()=>o();function a(c){le[c?"unshift":"push"](()=>{i=c,t(1,i)})}function u(c){Ve.call(this,n,c)}function f(c){Ve.call(this,n,c)}return[o,i,s,l,r,a,u,f]}class hS extends Me{constructor(e){super(),Ce(this,e,pS,dS,we,{show:3,hide:0})}get show(){return this.$$.ctx[3]}get hide(){return this.$$.ctx[0]}}function mS(n){let e,t,i,s,l,o,r,a;return{c(){e=v("input"),i=O(),s=v("label"),l=z("Include requests by admins"),p(e,"type","checkbox"),p(e,"id",t=n[14]),p(s,"for",o=n[14])},m(u,f){$(u,e,f),e.checked=n[0],$(u,i,f),$(u,s,f),_(s,l),r||(a=U(e,"change",n[8]),r=!0)},p(u,f){f&16384&&t!==(t=u[14])&&p(e,"id",t),f&1&&(e.checked=u[0]),f&16384&&o!==(o=u[14])&&p(s,"for",o)},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,a()}}}function gc(n){let e,t,i;function s(o){n[10](o)}let l={presets:n[4]};return n[2]!==void 0&&(l.filter=n[2]),e=new Xw({props:l}),le.push(()=>ke(e,"filter",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r&16&&(a.presets=o[4]),!t&&r&4&&(t=!0,a.filter=o[2],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function _c(n){let e,t,i;function s(o){n[11](o)}let l={presets:n[4]};return n[2]!==void 0&&(l.filter=n[2]),e=new gv({props:l}),le.push(()=>ke(e,"filter",s)),e.$on("select",n[12]),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r&16&&(a.presets=o[4]),!t&&r&4&&(t=!0,a.filter=o[2],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function gS(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k=n[3],w,C=n[3],M,T;r=new wa({}),r.$on("refresh",n[7]),d=new _e({props:{class:"form-field form-field-toggle m-0",$$slots:{default:[mS,({uniqueId:P})=>({14:P}),({uniqueId:P})=>P?16384:0]},$$scope:{ctx:n}}}),m=new ka({props:{value:n[2],placeholder:"Search logs, ex. status > 200",extraAutocompleteKeys:["method","url","remoteIp","userIp","referer","status","auth","userAgent"]}}),m.$on("submit",n[9]);let D=gc(n),A=_c(n);return{c(){e=v("div"),t=v("header"),i=v("nav"),s=v("div"),l=z(n[5]),o=O(),j(r.$$.fragment),a=O(),u=v("div"),f=O(),c=v("div"),j(d.$$.fragment),h=O(),j(m.$$.fragment),b=O(),g=v("div"),y=O(),D.c(),w=O(),A.c(),M=Fe(),p(s,"class","breadcrumb-item"),p(i,"class","breadcrumbs"),p(u,"class","flex-fill"),p(c,"class","inline-flex"),p(t,"class","page-header"),p(g,"class","clearfix m-b-xs"),p(e,"class","page-header-wrapper m-b-0")},m(P,L){$(P,e,L),_(e,t),_(t,i),_(i,s),_(s,l),_(t,o),R(r,t,null),_(t,a),_(t,u),_(t,f),_(t,c),R(d,c,null),_(e,h),R(m,e,null),_(e,b),_(e,g),_(e,y),D.m(e,null),$(P,w,L),A.m(P,L),$(P,M,L),T=!0},p(P,L){(!T||L&32)&&ue(l,P[5]);const V={};L&49153&&(V.$$scope={dirty:L,ctx:P}),d.$set(V);const F={};L&4&&(F.value=P[2]),m.$set(F),L&8&&we(k,k=P[3])?(be(),I(D,1,1,x),ve(),D=gc(P),D.c(),E(D,1),D.m(e,null)):D.p(P,L),L&8&&we(C,C=P[3])?(be(),I(A,1,1,x),ve(),A=_c(P),A.c(),E(A,1),A.m(M.parentNode,M)):A.p(P,L)},i(P){T||(E(r.$$.fragment,P),E(d.$$.fragment,P),E(m.$$.fragment,P),E(D),E(A),T=!0)},o(P){I(r.$$.fragment,P),I(d.$$.fragment,P),I(m.$$.fragment,P),I(D),I(A),T=!1},d(P){P&&S(e),H(r),H(d),H(m),D.d(P),P&&S(w),P&&S(M),A.d(P)}}}function _S(n){let e,t,i,s;e=new cn({props:{$$slots:{default:[gS]},$$scope:{ctx:n}}});let l={};return i=new hS({props:l}),n[13](i),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment)},m(o,r){R(e,o,r),$(o,t,r),R(i,o,r),s=!0},p(o,[r]){const a={};r&32831&&(a.$$scope={dirty:r,ctx:o}),e.$set(a);const u={};i.$set(u)},i(o){s||(E(e.$$.fragment,o),E(i.$$.fragment,o),s=!0)},o(o){I(e.$$.fragment,o),I(i.$$.fragment,o),s=!1},d(o){H(e,o),o&&S(t),n[13](null),H(i,o)}}}const bc="includeAdminLogs";function bS(n,e,t){var y;let i,s;Je(n,mt,k=>t(5,s=k)),Ht(mt,s="Request logs",s);let l,o="",r=((y=window.localStorage)==null?void 0:y.getItem(bc))<<0,a=1;function u(){t(3,a++,a)}const f=()=>u();function c(){r=this.checked,t(0,r)}const d=k=>t(2,o=k.detail);function h(k){o=k,t(2,o)}function m(k){o=k,t(2,o)}const b=k=>l==null?void 0:l.show(k==null?void 0:k.detail);function g(k){le[k?"unshift":"push"](()=>{l=k,t(1,l)})}return n.$$.update=()=>{n.$$.dirty&1&&t(4,i=r?"":'auth!="admin"'),n.$$.dirty&1&&typeof r<"u"&&window.localStorage&&window.localStorage.setItem(bc,r<<0)},[r,l,o,a,i,s,u,f,c,d,h,m,b,g]}class vS extends Me{constructor(e){super(),Ce(this,e,bS,_S,we,{})}}const Zi=Cn([]),Bn=Cn({}),na=Cn(!1);function yS(n){Zi.update(e=>{const t=B.findByKey(e,"id",n);return t?Bn.set(t):e.length&&Bn.set(e[0]),e})}function kS(n){Bn.update(e=>B.isEmpty(e==null?void 0:e.id)||e.id===n.id?n:e),Zi.update(e=>(B.pushOrReplaceByKey(e,n,"id"),B.sortCollections(e)))}function wS(n){Zi.update(e=>(B.removeByKey(e,"id",n.id),Bn.update(t=>t.id===n.id?e[0]:t),e))}async function SS(n=null){return na.set(!0),Bn.set({}),Zi.set([]),me.collections.getFullList(200,{sort:"+created"}).then(e=>{Zi.set(B.sortCollections(e));const t=n&&B.findByKey(e,"id",n);t?Bn.set(t):e.length&&Bn.set(e[0])}).catch(e=>{me.errorResponseHandler(e)}).finally(()=>{na.set(!1)})}const Ya=Cn({});function yn(n,e,t){Ya.set({text:n,yesCallback:e,noCallback:t})}function S_(){Ya.set({})}function vc(n){let e,t,i,s;const l=n[14].default,o=Ot(l,n,n[13],null);return{c(){e=v("div"),o&&o.c(),p(e,"class",n[1]),ee(e,"active",n[0])},m(r,a){$(r,e,a),o&&o.m(e,null),s=!0},p(r,a){o&&o.p&&(!s||a&8192)&&Et(o,l,r,r[13],s?Dt(l,r[13],a,null):At(r[13]),null),(!s||a&2)&&p(e,"class",r[1]),(!s||a&3)&&ee(e,"active",r[0])},i(r){s||(E(o,r),r&&Qe(()=>{i&&i.end(1),t=cm(e,kn,{duration:150,y:-5}),t.start()}),s=!0)},o(r){I(o,r),t&&t.invalidate(),r&&(i=dm(e,kn,{duration:150,y:2})),s=!1},d(r){r&&S(e),o&&o.d(r),r&&i&&i.end()}}}function $S(n){let e,t,i,s,l=n[0]&&vc(n);return{c(){e=v("div"),l&&l.c(),p(e,"class","toggler-container")},m(o,r){$(o,e,r),l&&l.m(e,null),n[15](e),t=!0,i||(s=[U(window,"click",n[3]),U(window,"keydown",n[4]),U(window,"focusin",n[5])],i=!0)},p(o,[r]){o[0]?l?(l.p(o,r),r&1&&E(l,1)):(l=vc(o),l.c(),E(l,1),l.m(e,null)):l&&(be(),I(l,1,1,()=>{l=null}),ve())},i(o){t||(E(l),t=!0)},o(o){I(l),t=!1},d(o){o&&S(e),l&&l.d(),n[15](null),i=!1,Re(s)}}}function CS(n,e,t){let{$$slots:i={},$$scope:s}=e,{trigger:l=void 0}=e,{active:o=!1}=e,{escClose:r=!0}=e,{closableClass:a="closable"}=e,{class:u=""}=e,f,c;const d=It();function h(){t(0,o=!1)}function m(){t(0,o=!0)}function b(){o?h():m()}function g(P){return!f||P.classList.contains(a)||(c==null?void 0:c.contains(P))&&!f.contains(P)||f.contains(P)&&P.closest&&P.closest("."+a)}function y(P){(!o||g(P.target))&&(P.preventDefault(),P.stopPropagation(),b())}function k(P){(P.code==="Enter"||P.code==="Space")&&(!o||g(P.target))&&(P.preventDefault(),P.stopPropagation(),b())}function w(P){o&&!(f!=null&&f.contains(P.target))&&!(c!=null&&c.contains(P.target))&&h()}function C(P){o&&r&&P.code==="Escape"&&(P.preventDefault(),h())}function M(P){return w(P)}function T(P){D(),t(12,c=P||(f==null?void 0:f.parentNode)),c&&(f==null||f.addEventListener("click",y),c.addEventListener("click",y),c.addEventListener("keydown",k))}function D(){!c||(f==null||f.removeEventListener("click",y),c.removeEventListener("click",y),c.removeEventListener("keydown",k))}un(()=>(T(),()=>D()));function A(P){le[P?"unshift":"push"](()=>{f=P,t(2,f)})}return n.$$set=P=>{"trigger"in P&&t(6,l=P.trigger),"active"in P&&t(0,o=P.active),"escClose"in P&&t(7,r=P.escClose),"closableClass"in P&&t(8,a=P.closableClass),"class"in P&&t(1,u=P.class),"$$scope"in P&&t(13,s=P.$$scope)},n.$$.update=()=>{var P,L;n.$$.dirty&68&&f&&T(l),n.$$.dirty&4097&&(o?((P=c==null?void 0:c.classList)==null||P.add("active"),d("show")):((L=c==null?void 0:c.classList)==null||L.remove("active"),d("hide")))},[o,u,f,w,C,M,l,r,a,h,m,b,c,s,i,A]}class Zn extends Me{constructor(e){super(),Ce(this,e,CS,$S,we,{trigger:6,active:0,escClose:7,closableClass:8,class:1,hide:9,show:10,toggle:11})}get hide(){return this.$$.ctx[9]}get show(){return this.$$.ctx[10]}get toggle(){return this.$$.ctx[11]}}const MS=n=>({active:n&1}),yc=n=>({active:n[0]});function kc(n){let e,t,i;const s=n[15].default,l=Ot(s,n,n[14],null);return{c(){e=v("div"),l&&l.c(),p(e,"class","accordion-content")},m(o,r){$(o,e,r),l&&l.m(e,null),i=!0},p(o,r){l&&l.p&&(!i||r&16384)&&Et(l,s,o,o[14],i?Dt(s,o[14],r,null):At(o[14]),null)},i(o){i||(E(l,o),o&&Qe(()=>{t||(t=je(e,St,{duration:150},!0)),t.run(1)}),i=!0)},o(o){I(l,o),o&&(t||(t=je(e,St,{duration:150},!1)),t.run(0)),i=!1},d(o){o&&S(e),l&&l.d(o),o&&t&&t.end()}}}function TS(n){let e,t,i,s,l,o,r,a;const u=n[15].header,f=Ot(u,n,n[14],yc);let c=n[0]&&kc(n);return{c(){e=v("div"),t=v("header"),f&&f.c(),i=O(),c&&c.c(),p(t,"class","accordion-header"),p(t,"draggable",n[2]),ee(t,"interactive",n[3]),p(e,"tabindex",s=n[3]?0:-1),p(e,"class",l="accordion "+(n[7]?"drag-over":"")+" "+n[1]),ee(e,"active",n[0])},m(d,h){$(d,e,h),_(e,t),f&&f.m(t,null),_(e,i),c&&c.m(e,null),n[22](e),o=!0,r||(a=[U(t,"click",ut(n[17])),U(t,"drop",ut(n[18])),U(t,"dragstart",n[19]),U(t,"dragenter",n[20]),U(t,"dragleave",n[21]),U(t,"dragover",ut(n[16])),U(e,"keydown",B_(n[9]))],r=!0)},p(d,[h]){f&&f.p&&(!o||h&16385)&&Et(f,u,d,d[14],o?Dt(u,d[14],h,MS):At(d[14]),yc),(!o||h&4)&&p(t,"draggable",d[2]),(!o||h&8)&&ee(t,"interactive",d[3]),d[0]?c?(c.p(d,h),h&1&&E(c,1)):(c=kc(d),c.c(),E(c,1),c.m(e,null)):c&&(be(),I(c,1,1,()=>{c=null}),ve()),(!o||h&8&&s!==(s=d[3]?0:-1))&&p(e,"tabindex",s),(!o||h&130&&l!==(l="accordion "+(d[7]?"drag-over":"")+" "+d[1]))&&p(e,"class",l),(!o||h&131)&&ee(e,"active",d[0])},i(d){o||(E(f,d),E(c),o=!0)},o(d){I(f,d),I(c),o=!1},d(d){d&&S(e),f&&f.d(d),c&&c.d(),n[22](null),r=!1,Re(a)}}}function OS(n,e,t){let{$$slots:i={},$$scope:s}=e;const l=It();let o,r,{class:a=""}=e,{draggable:u=!1}=e,{active:f=!1}=e,{interactive:c=!0}=e,{single:d=!1}=e,h=!1;function m(){y(),t(0,f=!0),l("expand")}function b(){t(0,f=!1),clearTimeout(r),l("collapse")}function g(){l("toggle"),f?b():m()}function y(){if(d&&o.closest(".accordions")){const L=o.closest(".accordions").querySelectorAll(".accordion.active .accordion-header.interactive");for(const V of L)V.click()}}function k(L){!c||(L.code==="Enter"||L.code==="Space")&&(L.preventDefault(),g())}un(()=>()=>clearTimeout(r));function w(L){Ve.call(this,n,L)}const C=()=>c&&g(),M=L=>{u&&(t(7,h=!1),y(),l("drop",L))},T=L=>u&&l("dragstart",L),D=L=>{u&&(t(7,h=!0),l("dragenter",L))},A=L=>{u&&(t(7,h=!1),l("dragleave",L))};function P(L){le[L?"unshift":"push"](()=>{o=L,t(6,o)})}return n.$$set=L=>{"class"in L&&t(1,a=L.class),"draggable"in L&&t(2,u=L.draggable),"active"in L&&t(0,f=L.active),"interactive"in L&&t(3,c=L.interactive),"single"in L&&t(10,d=L.single),"$$scope"in L&&t(14,s=L.$$scope)},n.$$.update=()=>{n.$$.dirty&8257&&f&&(clearTimeout(r),t(13,r=setTimeout(()=>{o!=null&&o.scrollIntoView&&o.scrollIntoView({behavior:"smooth",block:"nearest"})},250)))},[f,a,u,c,g,y,o,h,l,k,d,m,b,r,s,i,w,C,M,T,D,A,P]}class _s extends Me{constructor(e){super(),Ce(this,e,OS,TS,we,{class:1,draggable:2,active:0,interactive:3,single:10,expand:11,collapse:12,toggle:4,collapseSiblings:5})}get expand(){return this.$$.ctx[11]}get collapse(){return this.$$.ctx[12]}get toggle(){return this.$$.ctx[4]}get collapseSiblings(){return this.$$.ctx[5]}}const DS=n=>({}),wc=n=>({});function Sc(n,e,t){const i=n.slice();return i[45]=e[t],i}const ES=n=>({}),$c=n=>({});function Cc(n,e,t){const i=n.slice();return i[45]=e[t],i}function Mc(n){let e,t,i;return{c(){e=v("div"),t=z(n[2]),i=O(),p(e,"class","block txt-placeholder"),ee(e,"link-hint",!n[5])},m(s,l){$(s,e,l),_(e,t),_(e,i)},p(s,l){l[0]&4&&ue(t,s[2]),l[0]&32&&ee(e,"link-hint",!s[5])},d(s){s&&S(e)}}}function AS(n){let e,t=n[45]+"",i;return{c(){e=v("span"),i=z(t),p(e,"class","txt")},m(s,l){$(s,e,l),_(e,i)},p(s,l){l[0]&1&&t!==(t=s[45]+"")&&ue(i,t)},i:x,o:x,d(s){s&&S(e)}}}function IS(n){let e,t,i;const s=[{item:n[45]},n[8]];var l=n[7];function o(r){let a={};for(let u=0;u{H(f,1)}),ve()}l?(e=Qt(l,o()),j(e.$$.fragment),E(e.$$.fragment,1),R(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&E(e.$$.fragment,r),i=!0)},o(r){e&&I(e.$$.fragment,r),i=!1},d(r){r&&S(t),e&&H(e,r)}}}function Tc(n){let e,t,i;function s(){return n[33](n[45])}return{c(){e=v("span"),e.innerHTML='',p(e,"class","clear")},m(l,o){$(l,e,o),t||(i=[Le(Be.call(null,e,"Clear")),U(e,"click",Yn(ut(s)))],t=!0)},p(l,o){n=l},d(l){l&&S(e),t=!1,Re(i)}}}function Oc(n){let e,t,i,s,l,o;const r=[IS,AS],a=[];function u(c,d){return c[7]?0:1}t=u(n),i=a[t]=r[t](n);let f=(n[4]||n[6])&&Tc(n);return{c(){e=v("div"),i.c(),s=O(),f&&f.c(),l=O(),p(e,"class","option")},m(c,d){$(c,e,d),a[t].m(e,null),_(e,s),f&&f.m(e,null),_(e,l),o=!0},p(c,d){let h=t;t=u(c),t===h?a[t].p(c,d):(be(),I(a[h],1,1,()=>{a[h]=null}),ve(),i=a[t],i?i.p(c,d):(i=a[t]=r[t](c),i.c()),E(i,1),i.m(e,s)),c[4]||c[6]?f?f.p(c,d):(f=Tc(c),f.c(),f.m(e,l)):f&&(f.d(1),f=null)},i(c){o||(E(i),o=!0)},o(c){I(i),o=!1},d(c){c&&S(e),a[t].d(),f&&f.d()}}}function Dc(n){let e,t,i={class:"dropdown dropdown-block options-dropdown dropdown-left",trigger:n[17],$$slots:{default:[NS]},$$scope:{ctx:n}};return e=new Zn({props:i}),n[38](e),e.$on("show",n[23]),e.$on("hide",n[39]),{c(){j(e.$$.fragment)},m(s,l){R(e,s,l),t=!0},p(s,l){const o={};l[0]&131072&&(o.trigger=s[17]),l[0]&806410|l[1]&1024&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){I(e.$$.fragment,s),t=!1},d(s){n[38](null),H(e,s)}}}function Ec(n){let e,t,i,s,l,o,r,a,u=n[14].length&&Ac(n);return{c(){e=v("div"),t=v("label"),i=v("div"),i.innerHTML='',s=O(),l=v("input"),o=O(),u&&u.c(),p(i,"class","addon p-r-0"),l.autofocus=!0,p(l,"type","text"),p(l,"placeholder",n[3]),p(t,"class","input-group"),p(e,"class","form-field form-field-sm options-search")},m(f,c){$(f,e,c),_(e,t),_(t,i),_(t,s),_(t,l),he(l,n[14]),_(t,o),u&&u.m(t,null),l.focus(),r||(a=U(l,"input",n[35]),r=!0)},p(f,c){c[0]&8&&p(l,"placeholder",f[3]),c[0]&16384&&l.value!==f[14]&&he(l,f[14]),f[14].length?u?u.p(f,c):(u=Ac(f),u.c(),u.m(t,null)):u&&(u.d(1),u=null)},d(f){f&&S(e),u&&u.d(),r=!1,a()}}}function Ac(n){let e,t,i,s;return{c(){e=v("div"),t=v("button"),t.innerHTML='',p(t,"type","button"),p(t,"class","btn btn-sm btn-circle btn-secondary clear"),p(e,"class","addon suffix p-r-5")},m(l,o){$(l,e,o),_(e,t),i||(s=U(t,"click",Yn(ut(n[20]))),i=!0)},p:x,d(l){l&&S(e),i=!1,s()}}}function Ic(n){let e,t=n[1]&&Pc(n);return{c(){t&&t.c(),e=Fe()},m(i,s){t&&t.m(i,s),$(i,e,s)},p(i,s){i[1]?t?t.p(i,s):(t=Pc(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&S(e)}}}function Pc(n){let e,t;return{c(){e=v("div"),t=z(n[1]),p(e,"class","txt-missing")},m(i,s){$(i,e,s),_(e,t)},p(i,s){s[0]&2&&ue(t,i[1])},d(i){i&&S(e)}}}function PS(n){let e=n[45]+"",t;return{c(){t=z(e)},m(i,s){$(i,t,s)},p(i,s){s[0]&524288&&e!==(e=i[45]+"")&&ue(t,e)},i:x,o:x,d(i){i&&S(t)}}}function LS(n){let e,t,i;const s=[{item:n[45]},n[10]];var l=n[9];function o(r){let a={};for(let u=0;u{H(f,1)}),ve()}l?(e=Qt(l,o()),j(e.$$.fragment),E(e.$$.fragment,1),R(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&E(e.$$.fragment,r),i=!0)},o(r){e&&I(e.$$.fragment,r),i=!1},d(r){r&&S(t),e&&H(e,r)}}}function Lc(n){let e,t,i,s,l,o,r;const a=[LS,PS],u=[];function f(h,m){return h[9]?0:1}t=f(n),i=u[t]=a[t](n);function c(...h){return n[36](n[45],...h)}function d(...h){return n[37](n[45],...h)}return{c(){e=v("div"),i.c(),s=O(),p(e,"tabindex","0"),p(e,"class","dropdown-item option closable"),ee(e,"selected",n[18](n[45]))},m(h,m){$(h,e,m),u[t].m(e,null),_(e,s),l=!0,o||(r=[U(e,"click",c),U(e,"keydown",d)],o=!0)},p(h,m){n=h;let b=t;t=f(n),t===b?u[t].p(n,m):(be(),I(u[b],1,1,()=>{u[b]=null}),ve(),i=u[t],i?i.p(n,m):(i=u[t]=a[t](n),i.c()),E(i,1),i.m(e,s)),(!l||m[0]&786432)&&ee(e,"selected",n[18](n[45]))},i(h){l||(E(i),l=!0)},o(h){I(i),l=!1},d(h){h&&S(e),u[t].d(),o=!1,Re(r)}}}function NS(n){let e,t,i,s,l,o=n[11]&&Ec(n);const r=n[32].beforeOptions,a=Ot(r,n,n[41],$c);let u=n[19],f=[];for(let b=0;bI(f[b],1,1,()=>{f[b]=null});let d=null;u.length||(d=Ic(n));const h=n[32].afterOptions,m=Ot(h,n,n[41],wc);return{c(){o&&o.c(),e=O(),a&&a.c(),t=O(),i=v("div");for(let b=0;bI(a[d],1,1,()=>{a[d]=null});let f=null;r.length||(f=Mc(n));let c=!n[5]&&Dc(n);return{c(){e=v("div"),t=v("div");for(let d=0;d{c=null}),ve()):c?(c.p(d,h),h[0]&32&&E(c,1)):(c=Dc(d),c.c(),E(c,1),c.m(e,null)),(!o||h[0]&4096&&l!==(l="select "+d[12]))&&p(e,"class",l),(!o||h[0]&4112)&&ee(e,"multiple",d[4]),(!o||h[0]&4128)&&ee(e,"disabled",d[5])},i(d){if(!o){for(let h=0;hne(Ee,te))||[]}function fe(se,te){se.preventDefault(),b&&d?W(te):F(te)}function Y(se,te){(se.code==="Enter"||se.code==="Space")&&fe(se,te)}function re(){ie(),setTimeout(()=>{const se=P==null?void 0:P.querySelector(".dropdown-item.option.selected");se&&(se.focus(),se.scrollIntoView({block:"nearest"}))},0)}function Oe(se){se.stopPropagation(),!h&&(D==null||D.toggle())}un(()=>{const se=document.querySelectorAll(`label[for="${r}"]`);for(const te of se)te.addEventListener("click",Oe);return()=>{for(const te of se)te.removeEventListener("click",Oe)}});const ge=se=>V(se);function ae(se){le[se?"unshift":"push"](()=>{L=se,t(17,L)})}function pe(){A=this.value,t(14,A)}const de=(se,te)=>fe(te,se),Se=(se,te)=>Y(te,se);function ye(se){le[se?"unshift":"push"](()=>{D=se,t(15,D)})}function We(se){Ve.call(this,n,se)}function ce(se){le[se?"unshift":"push"](()=>{P=se,t(16,P)})}return n.$$set=se=>{"id"in se&&t(24,r=se.id),"noOptionsText"in se&&t(1,a=se.noOptionsText),"selectPlaceholder"in se&&t(2,u=se.selectPlaceholder),"searchPlaceholder"in se&&t(3,f=se.searchPlaceholder),"items"in se&&t(25,c=se.items),"multiple"in se&&t(4,d=se.multiple),"disabled"in se&&t(5,h=se.disabled),"selected"in se&&t(0,m=se.selected),"toggle"in se&&t(6,b=se.toggle),"labelComponent"in se&&t(7,g=se.labelComponent),"labelComponentProps"in se&&t(8,y=se.labelComponentProps),"optionComponent"in se&&t(9,k=se.optionComponent),"optionComponentProps"in se&&t(10,w=se.optionComponentProps),"searchable"in se&&t(11,C=se.searchable),"searchFunc"in se&&t(26,M=se.searchFunc),"class"in se&&t(12,T=se.class),"$$scope"in se&&t(41,o=se.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&33554432&&c&&(Z(),ie()),n.$$.dirty[0]&33570816&&t(19,i=J(c,A)),n.$$.dirty[0]&1&&t(18,s=function(se){const te=B.toArray(m);return B.inArray(te,se)})},[m,a,u,f,d,h,b,g,y,k,w,C,T,V,A,D,P,L,s,i,ie,fe,Y,re,r,c,M,F,W,G,K,X,l,ge,ae,pe,de,Se,ye,We,ce,o]}class $_ extends Me{constructor(e){super(),Ce(this,e,HS,FS,we,{id:24,noOptionsText:1,selectPlaceholder:2,searchPlaceholder:3,items:25,multiple:4,disabled:5,selected:0,toggle:6,labelComponent:7,labelComponentProps:8,optionComponent:9,optionComponentProps:10,searchable:11,searchFunc:26,class:12,deselectItem:13,selectItem:27,toggleItem:28,reset:29,showDropdown:30,hideDropdown:31},null,[-1,-1])}get deselectItem(){return this.$$.ctx[13]}get selectItem(){return this.$$.ctx[27]}get toggleItem(){return this.$$.ctx[28]}get reset(){return this.$$.ctx[29]}get showDropdown(){return this.$$.ctx[30]}get hideDropdown(){return this.$$.ctx[31]}}function Nc(n){let e,t;return{c(){e=v("i"),p(e,"class",t="icon "+n[0].icon)},m(i,s){$(i,e,s)},p(i,s){s&1&&t!==(t="icon "+i[0].icon)&&p(e,"class",t)},d(i){i&&S(e)}}}function jS(n){let e,t,i=(n[0].label||n[0].name||n[0].title||n[0].id||n[0].value)+"",s,l=n[0].icon&&Nc(n);return{c(){l&&l.c(),e=O(),t=v("span"),s=z(i),p(t,"class","txt")},m(o,r){l&&l.m(o,r),$(o,e,r),$(o,t,r),_(t,s)},p(o,[r]){o[0].icon?l?l.p(o,r):(l=Nc(o),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null),r&1&&i!==(i=(o[0].label||o[0].name||o[0].title||o[0].id||o[0].value)+"")&&ue(s,i)},i:x,o:x,d(o){l&&l.d(o),o&&S(e),o&&S(t)}}}function qS(n,e,t){let{item:i={}}=e;return n.$$set=s=>{"item"in s&&t(0,i=s.item)},[i]}class Fc extends Me{constructor(e){super(),Ce(this,e,qS,jS,we,{item:0})}}const VS=n=>({}),Rc=n=>({});function zS(n){let e;const t=n[8].afterOptions,i=Ot(t,n,n[12],Rc);return{c(){i&&i.c()},m(s,l){i&&i.m(s,l),e=!0},p(s,l){i&&i.p&&(!e||l&4096)&&Et(i,t,s,s[12],e?Dt(t,s[12],l,VS):At(s[12]),Rc)},i(s){e||(E(i,s),e=!0)},o(s){I(i,s),e=!1},d(s){i&&i.d(s)}}}function BS(n){let e,t,i;const s=[{items:n[1]},{multiple:n[2]},{labelComponent:n[3]},{optionComponent:n[4]},n[5]];function l(r){n[9](r)}let o={$$slots:{afterOptions:[zS]},$$scope:{ctx:n}};for(let r=0;rke(e,"selected",l)),e.$on("show",n[10]),e.$on("hide",n[11]),{c(){j(e.$$.fragment)},m(r,a){R(e,r,a),i=!0},p(r,[a]){const u=a&62?Ut(s,[a&2&&{items:r[1]},a&4&&{multiple:r[2]},a&8&&{labelComponent:r[3]},a&16&&{optionComponent:r[4]},a&32&&Kn(r[5])]):{};a&4096&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.selected=r[0],$e(()=>t=!1)),e.$set(u)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){I(e.$$.fragment,r),i=!1},d(r){H(e,r)}}}function WS(n,e,t){const i=["items","multiple","selected","labelComponent","optionComponent","selectionKey","keyOfSelected"];let s=wt(e,i),{$$slots:l={},$$scope:o}=e,{items:r=[]}=e,{multiple:a=!1}=e,{selected:u=a?[]:void 0}=e,{labelComponent:f=Fc}=e,{optionComponent:c=Fc}=e,{selectionKey:d="value"}=e,{keyOfSelected:h=a?[]:void 0}=e;function m(w){w=B.toArray(w,!0);let C=[];for(let M of w){const T=B.findByKey(r,d,M);T&&C.push(T)}w.length&&!C.length||t(0,u=a?C:C[0])}async function b(w){let C=B.toArray(w,!0).map(M=>M[d]);!r.length||t(6,h=a?C:C[0])}function g(w){u=w,t(0,u)}function y(w){Ve.call(this,n,w)}function k(w){Ve.call(this,n,w)}return n.$$set=w=>{e=Ye(Ye({},e),Un(w)),t(5,s=wt(e,i)),"items"in w&&t(1,r=w.items),"multiple"in w&&t(2,a=w.multiple),"selected"in w&&t(0,u=w.selected),"labelComponent"in w&&t(3,f=w.labelComponent),"optionComponent"in w&&t(4,c=w.optionComponent),"selectionKey"in w&&t(7,d=w.selectionKey),"keyOfSelected"in w&&t(6,h=w.keyOfSelected),"$$scope"in w&&t(12,o=w.$$scope)},n.$$.update=()=>{n.$$.dirty&66&&r&&m(h),n.$$.dirty&1&&b(u)},[u,r,a,f,c,s,h,d,l,g,y,k,o]}class Es extends Me{constructor(e){super(),Ce(this,e,WS,BS,we,{items:1,multiple:2,selected:0,labelComponent:3,optionComponent:4,selectionKey:7,keyOfSelected:6})}}function US(n){let e,t,i;const s=[{class:"field-type-select "+n[1]},{items:n[2]},n[3]];function l(r){n[4](r)}let o={};for(let r=0;rke(e,"keyOfSelected",l)),{c(){j(e.$$.fragment)},m(r,a){R(e,r,a),i=!0},p(r,[a]){const u=a&14?Ut(s,[a&2&&{class:"field-type-select "+r[1]},a&4&&{items:r[2]},a&8&&Kn(r[3])]):{};!t&&a&1&&(t=!0,u.keyOfSelected=r[0],$e(()=>t=!1)),e.$set(u)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){I(e.$$.fragment,r),i=!1},d(r){H(e,r)}}}function YS(n,e,t){const i=["value","class"];let s=wt(e,i),{value:l="text"}=e,{class:o=""}=e;const r=[{label:"Text",value:"text",icon:B.getFieldTypeIcon("text")},{label:"Number",value:"number",icon:B.getFieldTypeIcon("number")},{label:"Bool",value:"bool",icon:B.getFieldTypeIcon("bool")},{label:"Email",value:"email",icon:B.getFieldTypeIcon("email")},{label:"Url",value:"url",icon:B.getFieldTypeIcon("url")},{label:"DateTime",value:"date",icon:B.getFieldTypeIcon("date")},{label:"Select",value:"select",icon:B.getFieldTypeIcon("select")},{label:"JSON",value:"json",icon:B.getFieldTypeIcon("json")},{label:"File",value:"file",icon:B.getFieldTypeIcon("file")},{label:"Relation",value:"relation",icon:B.getFieldTypeIcon("relation")}];function a(u){l=u,t(0,l)}return n.$$set=u=>{e=Ye(Ye({},e),Un(u)),t(3,s=wt(e,i)),"value"in u&&t(0,l=u.value),"class"in u&&t(1,o=u.class)},[l,o,r,s,a]}class KS extends Me{constructor(e){super(),Ce(this,e,YS,US,we,{value:0,class:1})}}function JS(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Min length"),s=O(),l=v("input"),p(e,"for",i=n[5]),p(l,"type","number"),p(l,"id",o=n[5]),p(l,"step","1"),p(l,"min","0")},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].min),r||(a=U(l,"input",n[2]),r=!0)},p(u,f){f&32&&i!==(i=u[5])&&p(e,"for",i),f&32&&o!==(o=u[5])&&p(l,"id",o),f&1&&rt(l.value)!==u[0].min&&he(l,u[0].min)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function ZS(n){let e,t,i,s,l,o,r,a,u;return{c(){e=v("label"),t=z("Max length"),s=O(),l=v("input"),p(e,"for",i=n[5]),p(l,"type","number"),p(l,"id",o=n[5]),p(l,"step","1"),p(l,"min",r=n[0].min||0)},m(f,c){$(f,e,c),_(e,t),$(f,s,c),$(f,l,c),he(l,n[0].max),a||(u=U(l,"input",n[3]),a=!0)},p(f,c){c&32&&i!==(i=f[5])&&p(e,"for",i),c&32&&o!==(o=f[5])&&p(l,"id",o),c&1&&r!==(r=f[0].min||0)&&p(l,"min",r),c&1&&rt(l.value)!==f[0].max&&he(l,f[0].max)},d(f){f&&S(e),f&&S(s),f&&S(l),a=!1,u()}}}function GS(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("label"),t=z("Regex pattern"),s=O(),l=v("input"),r=O(),a=v("div"),a.innerHTML="Valid Go regular expression, eg. ^\\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){$(c,e,d),_(e,t),$(c,s,d),$(c,l,d),he(l,n[0].pattern),$(c,r,d),$(c,a,d),u||(f=U(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&&he(l,c[0].pattern)},d(c){c&&S(e),c&&S(s),c&&S(l),c&&S(r),c&&S(a),u=!1,f()}}}function XS(n){let e,t,i,s,l,o,r,a,u,f;return i=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[JS,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[ZS,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),u=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.pattern",$$slots:{default:[GS,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),r=O(),a=v("div"),j(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){$(c,e,d),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),_(e,r),_(e,a),R(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 b={};d&2&&(b.name="schema."+c[1]+".options.pattern"),d&97&&(b.$$scope={dirty:d,ctx:c}),u.$set(b)},i(c){f||(E(i.$$.fragment,c),E(o.$$.fragment,c),E(u.$$.fragment,c),f=!0)},o(c){I(i.$$.fragment,c),I(o.$$.fragment,c),I(u.$$.fragment,c),f=!1},d(c){c&&S(e),H(i),H(o),H(u)}}}function QS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=rt(this.value),t(0,s)}function o(){s.max=rt(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 xS extends Me{constructor(e){super(),Ce(this,e,QS,XS,we,{key:1,options:0})}}function e$(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Min"),s=O(),l=v("input"),p(e,"for",i=n[4]),p(l,"type","number"),p(l,"id",o=n[4])},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].min),r||(a=U(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&&rt(l.value)!==u[0].min&&he(l,u[0].min)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function t$(n){let e,t,i,s,l,o,r,a,u;return{c(){e=v("label"),t=z("Max"),s=O(),l=v("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){$(f,e,c),_(e,t),$(f,s,c),$(f,l,c),he(l,n[0].max),a||(u=U(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&&rt(l.value)!==f[0].max&&he(l,f[0].max)},d(f){f&&S(e),f&&S(s),f&&S(l),a=!1,u()}}}function n$(n){let e,t,i,s,l,o,r;return i=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[e$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[t$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid")},m(a,u){$(a,e,u),_(e,t),R(i,t,null),_(e,s),_(e,l),R(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){I(i.$$.fragment,a),I(o.$$.fragment,a),r=!1},d(a){a&&S(e),H(i),H(o)}}}function i$(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=rt(this.value),t(0,s)}function o(){s.max=rt(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 s$ extends Me{constructor(e){super(),Ce(this,e,i$,n$,we,{key:1,options:0})}}function l$(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 o$ extends Me{constructor(e){super(),Ce(this,e,l$,null,we,{key:0,options:1})}}function r$(n){let e,t,i,s,l=[{type:t=n[3].type||"text"},{value:n[2]},n[3]],o={};for(let r=0;r{t(0,o=B.splitNonEmpty(u.target.value,r))};return n.$$set=u=>{e=Ye(Ye({},e),Un(u)),t(3,l=wt(e,s)),"value"in u&&t(0,o=u.value),"separator"in u&&t(1,r=u.separator)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=(o||[]).join(", "))},[o,r,i,l,a]}class xi extends Me{constructor(e){super(),Ce(this,e,a$,r$,we,{value:0,separator:1})}}function u$(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function m(g){n[2](g)}let b={id:n[4],disabled:!B.isEmpty(n[0].onlyDomains)};return n[0].exceptDomains!==void 0&&(b.value=n[0].exceptDomains),r=new xi({props:b}),le.push(()=>ke(r,"value",m)),{c(){e=v("label"),t=v("span"),t.textContent="Except domains",i=O(),s=v("i"),o=O(),j(r.$$.fragment),u=O(),f=v("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[4]),p(f,"class","help-block")},m(g,y){$(g,e,y),_(e,t),_(e,i),_(e,s),$(g,o,y),R(r,g,y),$(g,u,y),$(g,f,y),c=!0,d||(h=Le(Be.call(null,s,{text:`List of domains that are NOT allowed. + This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(g,y){(!c||y&16&&l!==(l=g[4]))&&p(e,"for",l);const k={};y&16&&(k.id=g[4]),y&1&&(k.disabled=!B.isEmpty(g[0].onlyDomains)),!a&&y&1&&(a=!0,k.value=g[0].exceptDomains,$e(()=>a=!1)),r.$set(k)},i(g){c||(E(r.$$.fragment,g),c=!0)},o(g){I(r.$$.fragment,g),c=!1},d(g){g&&S(e),g&&S(o),H(r,g),g&&S(u),g&&S(f),d=!1,h()}}}function f$(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function m(g){n[3](g)}let b={id:n[4]+".options.onlyDomains",disabled:!B.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(b.value=n[0].onlyDomains),r=new xi({props:b}),le.push(()=>ke(r,"value",m)),{c(){e=v("label"),t=v("span"),t.textContent="Only domains",i=O(),s=v("i"),o=O(),j(r.$$.fragment),u=O(),f=v("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[4]+".options.onlyDomains"),p(f,"class","help-block")},m(g,y){$(g,e,y),_(e,t),_(e,i),_(e,s),$(g,o,y),R(r,g,y),$(g,u,y),$(g,f,y),c=!0,d||(h=Le(Be.call(null,s,{text:`List of domains that are ONLY allowed. + This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(g,y){(!c||y&16&&l!==(l=g[4]+".options.onlyDomains"))&&p(e,"for",l);const k={};y&16&&(k.id=g[4]+".options.onlyDomains"),y&1&&(k.disabled=!B.isEmpty(g[0].exceptDomains)),!a&&y&1&&(a=!0,k.value=g[0].onlyDomains,$e(()=>a=!1)),r.$set(k)},i(g){c||(E(r.$$.fragment,g),c=!0)},o(g){I(r.$$.fragment,g),c=!1},d(g){g&&S(e),g&&S(o),H(r,g),g&&S(u),g&&S(f),d=!1,h()}}}function c$(n){let e,t,i,s,l,o,r;return i=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.exceptDomains",$$slots:{default:[u$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.onlyDomains",$$slots:{default:[f$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid")},m(a,u){$(a,e,u),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),r=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.exceptDomains"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.onlyDomains"),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){I(i.$$.fragment,a),I(o.$$.fragment,a),r=!1},d(a){a&&S(e),H(i),H(o)}}}function d$(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.exceptDomains,r)&&(s.exceptDomains=r,t(0,s))}function o(r){n.$$.not_equal(s.onlyDomains,r)&&(s.onlyDomains=r,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 C_ extends Me{constructor(e){super(),Ce(this,e,d$,c$,we,{key:1,options:0})}}function p$(n){let e,t,i,s;function l(a){n[2](a)}function o(a){n[3](a)}let r={};return n[0]!==void 0&&(r.key=n[0]),n[1]!==void 0&&(r.options=n[1]),e=new C_({props:r}),le.push(()=>ke(e,"key",l)),le.push(()=>ke(e,"options",o)),{c(){j(e.$$.fragment)},m(a,u){R(e,a,u),s=!0},p(a,[u]){const f={};!t&&u&1&&(t=!0,f.key=a[0],$e(()=>t=!1)),!i&&u&2&&(i=!0,f.options=a[1],$e(()=>i=!1)),e.$set(f)},i(a){s||(E(e.$$.fragment,a),s=!0)},o(a){I(e.$$.fragment,a),s=!1},d(a){H(e,a)}}}function h$(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){i=r,t(0,i)}function o(r){s=r,t(1,s)}return n.$$set=r=>{"key"in r&&t(0,i=r.key),"options"in r&&t(1,s=r.options)},[i,s,l,o]}class m$ extends Me{constructor(e){super(),Ce(this,e,h$,p$,we,{key:0,options:1})}}var br=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],bs={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(n){return typeof console<"u"&&console.warn(n)},getWeek:function(n){var e=new Date(n.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var t=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},hl={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(n){var e=n%100;if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},Jt=function(n,e){return e===void 0&&(e=2),("000"+n).slice(e*-1)},mn=function(n){return n===!0?1:0};function Hc(n,e){var t;return function(){var i=this,s=arguments;clearTimeout(t),t=setTimeout(function(){return n.apply(i,s)},e)}}var vr=function(n){return n instanceof Array?n:[n]};function qt(n,e,t){if(t===!0)return n.classList.add(e);n.classList.remove(e)}function tt(n,e,t){var i=window.document.createElement(n);return e=e||"",t=t||"",i.className=e,t!==void 0&&(i.textContent=t),i}function eo(n){for(;n.firstChild;)n.removeChild(n.firstChild)}function M_(n,e){if(e(n))return n;if(n.parentNode)return M_(n.parentNode,e)}function to(n,e){var t=tt("div","numInputWrapper"),i=tt("input","numInput "+n),s=tt("span","arrowUp"),l=tt("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?i.type="number":(i.type="text",i.pattern="\\d*"),e!==void 0)for(var o in e)i.setAttribute(o,e[o]);return t.appendChild(i),t.appendChild(s),t.appendChild(l),t}function sn(n){try{if(typeof n.composedPath=="function"){var e=n.composedPath();return e[0]}return n.target}catch{return n.target}}var yr=function(){},Ao=function(n,e,t){return t.months[e?"shorthand":"longhand"][n]},g$={D:yr,F:function(n,e,t){n.setMonth(t.months.longhand.indexOf(e))},G:function(n,e){n.setHours((n.getHours()>=12?12:0)+parseFloat(e))},H:function(n,e){n.setHours(parseFloat(e))},J:function(n,e){n.setDate(parseFloat(e))},K:function(n,e,t){n.setHours(n.getHours()%12+12*mn(new RegExp(t.amPM[1],"i").test(e)))},M:function(n,e,t){n.setMonth(t.months.shorthand.indexOf(e))},S:function(n,e){n.setSeconds(parseFloat(e))},U:function(n,e){return new Date(parseFloat(e)*1e3)},W:function(n,e,t){var i=parseInt(e),s=new Date(n.getFullYear(),0,2+(i-1)*7,0,0,0,0);return s.setDate(s.getDate()-s.getDay()+t.firstDayOfWeek),s},Y:function(n,e){n.setFullYear(parseFloat(e))},Z:function(n,e){return new Date(e)},d:function(n,e){n.setDate(parseFloat(e))},h:function(n,e){n.setHours((n.getHours()>=12?12:0)+parseFloat(e))},i:function(n,e){n.setMinutes(parseFloat(e))},j:function(n,e){n.setDate(parseFloat(e))},l:yr,m:function(n,e){n.setMonth(parseFloat(e)-1)},n:function(n,e){n.setMonth(parseFloat(e)-1)},s:function(n,e){n.setSeconds(parseFloat(e))},u:function(n,e){return new Date(parseFloat(e))},w:yr,y:function(n,e){n.setFullYear(2e3+parseFloat(e))}},ji={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},il={Z:function(n){return n.toISOString()},D:function(n,e,t){return e.weekdays.shorthand[il.w(n,e,t)]},F:function(n,e,t){return Ao(il.n(n,e,t)-1,!1,e)},G:function(n,e,t){return Jt(il.h(n,e,t))},H:function(n){return Jt(n.getHours())},J:function(n,e){return e.ordinal!==void 0?n.getDate()+e.ordinal(n.getDate()):n.getDate()},K:function(n,e){return e.amPM[mn(n.getHours()>11)]},M:function(n,e){return Ao(n.getMonth(),!0,e)},S:function(n){return Jt(n.getSeconds())},U:function(n){return n.getTime()/1e3},W:function(n,e,t){return t.getWeek(n)},Y:function(n){return Jt(n.getFullYear(),4)},d:function(n){return Jt(n.getDate())},h:function(n){return n.getHours()%12?n.getHours()%12:12},i:function(n){return Jt(n.getMinutes())},j:function(n){return n.getDate()},l:function(n,e){return e.weekdays.longhand[n.getDay()]},m:function(n){return Jt(n.getMonth()+1)},n:function(n){return n.getMonth()+1},s:function(n){return n.getSeconds()},u:function(n){return n.getTime()},w:function(n){return n.getDay()},y:function(n){return String(n.getFullYear()).substring(2)}},T_=function(n){var e=n.config,t=e===void 0?bs:e,i=n.l10n,s=i===void 0?hl:i,l=n.isMobile,o=l===void 0?!1:l;return function(r,a,u){var f=u||s;return t.formatDate!==void 0&&!o?t.formatDate(r,a,f):a.split("").map(function(c,d,h){return il[c]&&h[d-1]!=="\\"?il[c](r,f,t):c!=="\\"?c:""}).join("")}},ia=function(n){var e=n.config,t=e===void 0?bs:e,i=n.l10n,s=i===void 0?hl:i;return function(l,o,r,a){if(!(l!==0&&!l)){var u=a||s,f,c=l;if(l instanceof Date)f=new Date(l.getTime());else if(typeof l!="string"&&l.toFixed!==void 0)f=new Date(l);else if(typeof l=="string"){var d=o||(t||bs).dateFormat,h=String(l).trim();if(h==="today")f=new Date,r=!0;else if(t&&t.parseDate)f=t.parseDate(l,d);else if(/Z$/.test(h)||/GMT$/.test(h))f=new Date(l);else{for(var m=void 0,b=[],g=0,y=0,k="";gMath.min(e,t)&&n=0?new Date:new Date(t.config.minDate.getTime()),Q=wr(t.config);q.setHours(Q.hours,Q.minutes,Q.seconds,q.getMilliseconds()),t.selectedDates=[q],t.latestSelectedDateObj=q}N!==void 0&&N.type!=="blur"&&Il(N);var oe=t._input.value;c(),Pt(),t._input.value!==oe&&t._debouncedChange()}function u(N,q){return N%12+12*mn(q===t.l10n.amPM[1])}function f(N){switch(N%24){case 0:case 12:return 12;default:return N%12}}function c(){if(!(t.hourElement===void 0||t.minuteElement===void 0)){var N=(parseInt(t.hourElement.value.slice(-2),10)||0)%24,q=(parseInt(t.minuteElement.value,10)||0)%60,Q=t.secondElement!==void 0?(parseInt(t.secondElement.value,10)||0)%60:0;t.amPM!==void 0&&(N=u(N,t.amPM.textContent));var oe=t.config.minTime!==void 0||t.config.minDate&&t.minDateHasTime&&t.latestSelectedDateObj&&ln(t.latestSelectedDateObj,t.config.minDate,!0)===0,Te=t.config.maxTime!==void 0||t.config.maxDate&&t.maxDateHasTime&&t.latestSelectedDateObj&&ln(t.latestSelectedDateObj,t.config.maxDate,!0)===0;if(t.config.maxTime!==void 0&&t.config.minTime!==void 0&&t.config.minTime>t.config.maxTime){var Ie=kr(t.config.minTime.getHours(),t.config.minTime.getMinutes(),t.config.minTime.getSeconds()),Pe=kr(t.config.maxTime.getHours(),t.config.maxTime.getMinutes(),t.config.maxTime.getSeconds()),De=kr(N,q,Q);if(De>Pe&&De=12)]),t.secondElement!==void 0&&(t.secondElement.value=Jt(Q)))}function m(N){var q=sn(N),Q=parseInt(q.value)+(N.delta||0);(Q/1e3>1||N.key==="Enter"&&!/[^\d]/.test(Q.toString()))&&de(Q)}function b(N,q,Q,oe){if(q instanceof Array)return q.forEach(function(Te){return b(N,Te,Q,oe)});if(N instanceof Array)return N.forEach(function(Te){return b(Te,q,Q,oe)});N.addEventListener(q,Q,oe),t._handlers.push({remove:function(){return N.removeEventListener(q,Q,oe)}})}function g(){Ke("onChange")}function y(){if(t.config.wrap&&["open","close","toggle","clear"].forEach(function(Q){Array.prototype.forEach.call(t.element.querySelectorAll("[data-"+Q+"]"),function(oe){return b(oe,"click",t[Q])})}),t.isMobile){is();return}var N=Hc(te,50);if(t._debouncedChange=Hc(g,y$),t.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&b(t.daysContainer,"mouseover",function(Q){t.config.mode==="range"&&se(sn(Q))}),b(t._input,"keydown",ce),t.calendarContainer!==void 0&&b(t.calendarContainer,"keydown",ce),!t.config.inline&&!t.config.static&&b(window,"resize",N),window.ontouchstart!==void 0?b(window.document,"touchstart",pe):b(window.document,"mousedown",pe),b(window.document,"focus",pe,{capture:!0}),t.config.clickOpens===!0&&(b(t._input,"focus",t.open),b(t._input,"click",t.open)),t.daysContainer!==void 0&&(b(t.monthNav,"click",jt),b(t.monthNav,["keyup","increment"],m),b(t.daysContainer,"click",As)),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0){var q=function(Q){return sn(Q).select()};b(t.timeContainer,["increment"],a),b(t.timeContainer,"blur",a,{capture:!0}),b(t.timeContainer,"click",w),b([t.hourElement,t.minuteElement],["focus","click"],q),t.secondElement!==void 0&&b(t.secondElement,"focus",function(){return t.secondElement&&t.secondElement.select()}),t.amPM!==void 0&&b(t.amPM,"click",function(Q){a(Q)})}t.config.allowInput&&b(t._input,"blur",We)}function k(N,q){var Q=N!==void 0?t.parseDate(N):t.latestSelectedDateObj||(t.config.minDate&&t.config.minDate>t.now?t.config.minDate:t.config.maxDate&&t.config.maxDate1),t.calendarContainer.appendChild(N);var Te=t.config.appendTo!==void 0&&t.config.appendTo.nodeType!==void 0;if((t.config.inline||t.config.static)&&(t.calendarContainer.classList.add(t.config.inline?"inline":"static"),t.config.inline&&(!Te&&t.element.parentNode?t.element.parentNode.insertBefore(t.calendarContainer,t._input.nextSibling):t.config.appendTo!==void 0&&t.config.appendTo.appendChild(t.calendarContainer)),t.config.static)){var Ie=tt("div","flatpickr-wrapper");t.element.parentNode&&t.element.parentNode.insertBefore(Ie,t.element),Ie.appendChild(t.element),t.altInput&&Ie.appendChild(t.altInput),Ie.appendChild(t.calendarContainer)}!t.config.static&&!t.config.inline&&(t.config.appendTo!==void 0?t.config.appendTo:window.document.body).appendChild(t.calendarContainer)}function T(N,q,Q,oe){var Te=Se(q,!0),Ie=tt("span",N,q.getDate().toString());return Ie.dateObj=q,Ie.$i=oe,Ie.setAttribute("aria-label",t.formatDate(q,t.config.ariaDateFormat)),N.indexOf("hidden")===-1&&ln(q,t.now)===0&&(t.todayDateElem=Ie,Ie.classList.add("today"),Ie.setAttribute("aria-current","date")),Te?(Ie.tabIndex=-1,Xn(q)&&(Ie.classList.add("selected"),t.selectedDateElem=Ie,t.config.mode==="range"&&(qt(Ie,"startRange",t.selectedDates[0]&&ln(q,t.selectedDates[0],!0)===0),qt(Ie,"endRange",t.selectedDates[1]&&ln(q,t.selectedDates[1],!0)===0),N==="nextMonthDay"&&Ie.classList.add("inRange")))):Ie.classList.add("flatpickr-disabled"),t.config.mode==="range"&&ls(q)&&!Xn(q)&&Ie.classList.add("inRange"),t.weekNumbers&&t.config.showMonths===1&&N!=="prevMonthDay"&&oe%7===6&&t.weekNumbers.insertAdjacentHTML("beforeend",""+t.config.getWeek(q)+""),Ke("onDayCreate",Ie),Ie}function D(N){N.focus(),t.config.mode==="range"&&se(N)}function A(N){for(var q=N>0?0:t.config.showMonths-1,Q=N>0?t.config.showMonths:-1,oe=q;oe!=Q;oe+=N)for(var Te=t.daysContainer.children[oe],Ie=N>0?0:Te.children.length-1,Pe=N>0?Te.children.length:-1,De=Ie;De!=Pe;De+=N){var ze=Te.children[De];if(ze.className.indexOf("hidden")===-1&&Se(ze.dateObj))return ze}}function P(N,q){for(var Q=N.className.indexOf("Month")===-1?N.dateObj.getMonth():t.currentMonth,oe=q>0?t.config.showMonths:-1,Te=q>0?1:-1,Ie=Q-t.currentMonth;Ie!=oe;Ie+=Te)for(var Pe=t.daysContainer.children[Ie],De=Q-t.currentMonth===Ie?N.$i+q:q<0?Pe.children.length-1:0,ze=Pe.children.length,Ne=De;Ne>=0&&Ne0?ze:-1);Ne+=Te){var qe=Pe.children[Ne];if(qe.className.indexOf("hidden")===-1&&Se(qe.dateObj)&&Math.abs(N.$i-Ne)>=Math.abs(q))return D(qe)}t.changeMonth(Te),L(A(Te),0)}function L(N,q){var Q=l(),oe=ye(Q||document.body),Te=N!==void 0?N:oe?Q:t.selectedDateElem!==void 0&&ye(t.selectedDateElem)?t.selectedDateElem:t.todayDateElem!==void 0&&ye(t.todayDateElem)?t.todayDateElem:A(q>0?1:-1);Te===void 0?t._input.focus():oe?P(Te,q):D(Te)}function V(N,q){for(var Q=(new Date(N,q,1).getDay()-t.l10n.firstDayOfWeek+7)%7,oe=t.utils.getDaysInMonth((q-1+12)%12,N),Te=t.utils.getDaysInMonth(q,N),Ie=window.document.createDocumentFragment(),Pe=t.config.showMonths>1,De=Pe?"prevMonthDay hidden":"prevMonthDay",ze=Pe?"nextMonthDay hidden":"nextMonthDay",Ne=oe+1-Q,qe=0;Ne<=oe;Ne++,qe++)Ie.appendChild(T("flatpickr-day "+De,new Date(N,q-1,Ne),Ne,qe));for(Ne=1;Ne<=Te;Ne++,qe++)Ie.appendChild(T("flatpickr-day",new Date(N,q,Ne),Ne,qe));for(var at=Te+1;at<=42-Q&&(t.config.showMonths===1||qe%7!==0);at++,qe++)Ie.appendChild(T("flatpickr-day "+ze,new Date(N,q+1,at%Te),at,qe));var Hn=tt("div","dayContainer");return Hn.appendChild(Ie),Hn}function F(){if(t.daysContainer!==void 0){eo(t.daysContainer),t.weekNumbers&&eo(t.weekNumbers);for(var N=document.createDocumentFragment(),q=0;q1||t.config.monthSelectorType!=="dropdown")){var N=function(oe){return t.config.minDate!==void 0&&t.currentYear===t.config.minDate.getFullYear()&&oet.config.maxDate.getMonth())};t.monthsDropdownContainer.tabIndex=-1,t.monthsDropdownContainer.innerHTML="";for(var q=0;q<12;q++)if(!!N(q)){var Q=tt("option","flatpickr-monthDropdown-month");Q.value=new Date(t.currentYear,q).getMonth().toString(),Q.textContent=Ao(q,t.config.shorthandCurrentMonth,t.l10n),Q.tabIndex=-1,t.currentMonth===q&&(Q.selected=!0),t.monthsDropdownContainer.appendChild(Q)}}}function G(){var N=tt("div","flatpickr-month"),q=window.document.createDocumentFragment(),Q;t.config.showMonths>1||t.config.monthSelectorType==="static"?Q=tt("span","cur-month"):(t.monthsDropdownContainer=tt("select","flatpickr-monthDropdown-months"),t.monthsDropdownContainer.setAttribute("aria-label",t.l10n.monthAriaLabel),b(t.monthsDropdownContainer,"change",function(Pe){var De=sn(Pe),ze=parseInt(De.value,10);t.changeMonth(ze-t.currentMonth),Ke("onMonthChange")}),W(),Q=t.monthsDropdownContainer);var oe=to("cur-year",{tabindex:"-1"}),Te=oe.getElementsByTagName("input")[0];Te.setAttribute("aria-label",t.l10n.yearAriaLabel),t.config.minDate&&Te.setAttribute("min",t.config.minDate.getFullYear().toString()),t.config.maxDate&&(Te.setAttribute("max",t.config.maxDate.getFullYear().toString()),Te.disabled=!!t.config.minDate&&t.config.minDate.getFullYear()===t.config.maxDate.getFullYear());var Ie=tt("div","flatpickr-current-month");return Ie.appendChild(Q),Ie.appendChild(oe),q.appendChild(Ie),N.appendChild(q),{container:N,yearElement:Te,monthElement:Q}}function K(){eo(t.monthNav),t.monthNav.appendChild(t.prevMonthNav),t.config.showMonths&&(t.yearElements=[],t.monthElements=[]);for(var N=t.config.showMonths;N--;){var q=G();t.yearElements.push(q.yearElement),t.monthElements.push(q.monthElement),t.monthNav.appendChild(q.container)}t.monthNav.appendChild(t.nextMonthNav)}function X(){return t.monthNav=tt("div","flatpickr-months"),t.yearElements=[],t.monthElements=[],t.prevMonthNav=tt("span","flatpickr-prev-month"),t.prevMonthNav.innerHTML=t.config.prevArrow,t.nextMonthNav=tt("span","flatpickr-next-month"),t.nextMonthNav.innerHTML=t.config.nextArrow,K(),Object.defineProperty(t,"_hidePrevMonthArrow",{get:function(){return t.__hidePrevMonthArrow},set:function(N){t.__hidePrevMonthArrow!==N&&(qt(t.prevMonthNav,"flatpickr-disabled",N),t.__hidePrevMonthArrow=N)}}),Object.defineProperty(t,"_hideNextMonthArrow",{get:function(){return t.__hideNextMonthArrow},set:function(N){t.__hideNextMonthArrow!==N&&(qt(t.nextMonthNav,"flatpickr-disabled",N),t.__hideNextMonthArrow=N)}}),t.currentYearElement=t.yearElements[0],Oi(),t.monthNav}function Z(){t.calendarContainer.classList.add("hasTime"),t.config.noCalendar&&t.calendarContainer.classList.add("noCalendar");var N=wr(t.config);t.timeContainer=tt("div","flatpickr-time"),t.timeContainer.tabIndex=-1;var q=tt("span","flatpickr-time-separator",":"),Q=to("flatpickr-hour",{"aria-label":t.l10n.hourAriaLabel});t.hourElement=Q.getElementsByTagName("input")[0];var oe=to("flatpickr-minute",{"aria-label":t.l10n.minuteAriaLabel});if(t.minuteElement=oe.getElementsByTagName("input")[0],t.hourElement.tabIndex=t.minuteElement.tabIndex=-1,t.hourElement.value=Jt(t.latestSelectedDateObj?t.latestSelectedDateObj.getHours():t.config.time_24hr?N.hours:f(N.hours)),t.minuteElement.value=Jt(t.latestSelectedDateObj?t.latestSelectedDateObj.getMinutes():N.minutes),t.hourElement.setAttribute("step",t.config.hourIncrement.toString()),t.minuteElement.setAttribute("step",t.config.minuteIncrement.toString()),t.hourElement.setAttribute("min",t.config.time_24hr?"0":"1"),t.hourElement.setAttribute("max",t.config.time_24hr?"23":"12"),t.hourElement.setAttribute("maxlength","2"),t.minuteElement.setAttribute("min","0"),t.minuteElement.setAttribute("max","59"),t.minuteElement.setAttribute("maxlength","2"),t.timeContainer.appendChild(Q),t.timeContainer.appendChild(q),t.timeContainer.appendChild(oe),t.config.time_24hr&&t.timeContainer.classList.add("time24hr"),t.config.enableSeconds){t.timeContainer.classList.add("hasSeconds");var Te=to("flatpickr-second");t.secondElement=Te.getElementsByTagName("input")[0],t.secondElement.value=Jt(t.latestSelectedDateObj?t.latestSelectedDateObj.getSeconds():N.seconds),t.secondElement.setAttribute("step",t.minuteElement.getAttribute("step")),t.secondElement.setAttribute("min","0"),t.secondElement.setAttribute("max","59"),t.secondElement.setAttribute("maxlength","2"),t.timeContainer.appendChild(tt("span","flatpickr-time-separator",":")),t.timeContainer.appendChild(Te)}return t.config.time_24hr||(t.amPM=tt("span","flatpickr-am-pm",t.l10n.amPM[mn((t.latestSelectedDateObj?t.hourElement.value:t.config.defaultHour)>11)]),t.amPM.title=t.l10n.toggleTitle,t.amPM.tabIndex=-1,t.timeContainer.appendChild(t.amPM)),t.timeContainer}function ie(){t.weekdayContainer?eo(t.weekdayContainer):t.weekdayContainer=tt("div","flatpickr-weekdays");for(var N=t.config.showMonths;N--;){var q=tt("div","flatpickr-weekdaycontainer");t.weekdayContainer.appendChild(q)}return J(),t.weekdayContainer}function J(){if(!!t.weekdayContainer){var N=t.l10n.firstDayOfWeek,q=jc(t.l10n.weekdays.shorthand);N>0&&N + `+q.join("")+` + + `}}function fe(){t.calendarContainer.classList.add("hasWeeks");var N=tt("div","flatpickr-weekwrapper");N.appendChild(tt("span","flatpickr-weekday",t.l10n.weekAbbreviation));var q=tt("div","flatpickr-weeks");return N.appendChild(q),{weekWrapper:N,weekNumbers:q}}function Y(N,q){q===void 0&&(q=!0);var Q=q?N:N-t.currentMonth;Q<0&&t._hidePrevMonthArrow===!0||Q>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=Q,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,Ke("onYearChange"),W()),F(),Ke("onMonthChange"),Oi())}function re(N,q){if(N===void 0&&(N=!0),q===void 0&&(q=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,q===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var Q=wr(t.config),oe=Q.hours,Te=Q.minutes,Ie=Q.seconds;h(oe,Te,Ie)}t.redraw(),N&&Ke("onChange")}function Oe(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),Ke("onClose")}function ge(){t.config!==void 0&&Ke("onDestroy");for(var N=t._handlers.length;N--;)t._handlers[N].remove();if(t._handlers=[],t.mobileInput)t.mobileInput.parentNode&&t.mobileInput.parentNode.removeChild(t.mobileInput),t.mobileInput=void 0;else if(t.calendarContainer&&t.calendarContainer.parentNode)if(t.config.static&&t.calendarContainer.parentNode){var q=t.calendarContainer.parentNode;if(q.lastChild&&q.removeChild(q.lastChild),q.parentNode){for(;q.firstChild;)q.parentNode.insertBefore(q.firstChild,q);q.parentNode.removeChild(q)}}else t.calendarContainer.parentNode.removeChild(t.calendarContainer);t.altInput&&(t.input.type="text",t.altInput.parentNode&&t.altInput.parentNode.removeChild(t.altInput),delete t.altInput),t.input&&(t.input.type=t.input._type,t.input.classList.remove("flatpickr-input"),t.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(Q){try{delete t[Q]}catch{}})}function ae(N){return t.calendarContainer.contains(N)}function pe(N){if(t.isOpen&&!t.config.inline){var q=sn(N),Q=ae(q),oe=q===t.input||q===t.altInput||t.element.contains(q)||N.path&&N.path.indexOf&&(~N.path.indexOf(t.input)||~N.path.indexOf(t.altInput)),Te=!oe&&!Q&&!ae(N.relatedTarget),Ie=!t.config.ignoredFocusElements.some(function(Pe){return Pe.contains(q)});Te&&Ie&&(t.config.allowInput&&t.setDate(t._input.value,!1,t.config.altInput?t.config.altFormat:t.config.dateFormat),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0&&t.input.value!==""&&t.input.value!==void 0&&a(),t.close(),t.config&&t.config.mode==="range"&&t.selectedDates.length===1&&t.clear(!1))}}function de(N){if(!(!N||t.config.minDate&&Nt.config.maxDate.getFullYear())){var q=N,Q=t.currentYear!==q;t.currentYear=q||t.currentYear,t.config.maxDate&&t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth=Math.min(t.config.maxDate.getMonth(),t.currentMonth):t.config.minDate&&t.currentYear===t.config.minDate.getFullYear()&&(t.currentMonth=Math.max(t.config.minDate.getMonth(),t.currentMonth)),Q&&(t.redraw(),Ke("onYearChange"),W())}}function Se(N,q){var Q;q===void 0&&(q=!0);var oe=t.parseDate(N,void 0,q);if(t.config.minDate&&oe&&ln(oe,t.config.minDate,q!==void 0?q:!t.minDateHasTime)<0||t.config.maxDate&&oe&&ln(oe,t.config.maxDate,q!==void 0?q:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(oe===void 0)return!1;for(var Te=!!t.config.enable,Ie=(Q=t.config.enable)!==null&&Q!==void 0?Q:t.config.disable,Pe=0,De=void 0;Pe=De.from.getTime()&&oe.getTime()<=De.to.getTime())return Te}return!Te}function ye(N){return t.daysContainer!==void 0?N.className.indexOf("hidden")===-1&&N.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(N):!1}function We(N){var q=N.target===t._input,Q=t._input.value.trimEnd()!==Di();q&&Q&&!(N.relatedTarget&&ae(N.relatedTarget))&&t.setDate(t._input.value,!0,N.target===t.altInput?t.config.altFormat:t.config.dateFormat)}function ce(N){var q=sn(N),Q=t.config.wrap?n.contains(q):q===t._input,oe=t.config.allowInput,Te=t.isOpen&&(!oe||!Q),Ie=t.config.inline&&Q&&!oe;if(N.keyCode===13&&Q){if(oe)return t.setDate(t._input.value,!0,q===t.altInput?t.config.altFormat:t.config.dateFormat),t.close(),q.blur();t.open()}else if(ae(q)||Te||Ie){var Pe=!!t.timeContainer&&t.timeContainer.contains(q);switch(N.keyCode){case 13:Pe?(N.preventDefault(),a(),ri()):As(N);break;case 27:N.preventDefault(),ri();break;case 8:case 46:Q&&!t.config.allowInput&&(N.preventDefault(),t.clear());break;case 37:case 39:if(!Pe&&!Q){N.preventDefault();var De=l();if(t.daysContainer!==void 0&&(oe===!1||De&&ye(De))){var ze=N.keyCode===39?1:-1;N.ctrlKey?(N.stopPropagation(),Y(ze),L(A(1),0)):L(void 0,ze)}}else t.hourElement&&t.hourElement.focus();break;case 38:case 40:N.preventDefault();var Ne=N.keyCode===40?1:-1;t.daysContainer&&q.$i!==void 0||q===t.input||q===t.altInput?N.ctrlKey?(N.stopPropagation(),de(t.currentYear-Ne),L(A(1),0)):Pe||L(void 0,Ne*7):q===t.currentYearElement?de(t.currentYear-Ne):t.config.enableTime&&(!Pe&&t.hourElement&&t.hourElement.focus(),a(N),t._debouncedChange());break;case 9:if(Pe){var qe=[t.hourElement,t.minuteElement,t.secondElement,t.amPM].concat(t.pluginElements).filter(function(nn){return nn}),at=qe.indexOf(q);if(at!==-1){var Hn=qe[at+(N.shiftKey?-1:1)];N.preventDefault(),(Hn||t._input).focus()}}else!t.config.noCalendar&&t.daysContainer&&t.daysContainer.contains(q)&&N.shiftKey&&(N.preventDefault(),t._input.focus());break}}if(t.amPM!==void 0&&q===t.amPM)switch(N.key){case t.l10n.amPM[0].charAt(0):case t.l10n.amPM[0].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[0],c(),Pt();break;case t.l10n.amPM[1].charAt(0):case t.l10n.amPM[1].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[1],c(),Pt();break}(Q||ae(q))&&Ke("onKeyDown",N)}function se(N,q){if(q===void 0&&(q="flatpickr-day"),!(t.selectedDates.length!==1||N&&(!N.classList.contains(q)||N.classList.contains("flatpickr-disabled")))){for(var Q=N?N.dateObj.getTime():t.days.firstElementChild.dateObj.getTime(),oe=t.parseDate(t.selectedDates[0],void 0,!0).getTime(),Te=Math.min(Q,t.selectedDates[0].getTime()),Ie=Math.max(Q,t.selectedDates[0].getTime()),Pe=!1,De=0,ze=0,Ne=Te;NeTe&&NeDe)?De=Ne:Ne>oe&&(!ze||Ne ."+q));qe.forEach(function(at){var Hn=at.dateObj,nn=Hn.getTime(),Is=De>0&&nn0&&nn>ze;if(Is){at.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(os){at.classList.remove(os)});return}else if(Pe&&!Is)return;["startRange","inRange","endRange","notAllowed"].forEach(function(os){at.classList.remove(os)}),N!==void 0&&(N.classList.add(Q<=t.selectedDates[0].getTime()?"startRange":"endRange"),oeQ&&nn===oe&&at.classList.add("endRange"),nn>=De&&(ze===0||nn<=ze)&&_$(nn,oe,Q)&&at.classList.add("inRange"))})}}function te(){t.isOpen&&!t.config.static&&!t.config.inline&&tn()}function ne(N,q){if(q===void 0&&(q=t._positionElement),t.isMobile===!0){if(N){N.preventDefault();var Q=sn(N);Q&&Q.blur()}t.mobileInput!==void 0&&(t.mobileInput.focus(),t.mobileInput.click()),Ke("onOpen");return}else if(t._input.disabled||t.config.inline)return;var oe=t.isOpen;t.isOpen=!0,oe||(t.calendarContainer.classList.add("open"),t._input.classList.add("active"),Ke("onOpen"),tn(q)),t.config.enableTime===!0&&t.config.noCalendar===!0&&t.config.allowInput===!1&&(N===void 0||!t.timeContainer.contains(N.relatedTarget))&&setTimeout(function(){return t.hourElement.select()},50)}function Ee(N){return function(q){var Q=t.config["_"+N+"Date"]=t.parseDate(q,t.config.dateFormat),oe=t.config["_"+(N==="min"?"max":"min")+"Date"];Q!==void 0&&(t[N==="min"?"minDateHasTime":"maxDateHasTime"]=Q.getHours()>0||Q.getMinutes()>0||Q.getSeconds()>0),t.selectedDates&&(t.selectedDates=t.selectedDates.filter(function(Te){return Se(Te)}),!t.selectedDates.length&&N==="min"&&d(Q),Pt()),t.daysContainer&&(oi(),Q!==void 0?t.currentYearElement[N]=Q.getFullYear().toString():t.currentYearElement.removeAttribute(N),t.currentYearElement.disabled=!!oe&&Q!==void 0&&oe.getFullYear()===Q.getFullYear())}}function it(){var N=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],q=Nt(Nt({},JSON.parse(JSON.stringify(n.dataset||{}))),e),Q={};t.config.parseDate=q.parseDate,t.config.formatDate=q.formatDate,Object.defineProperty(t.config,"enable",{get:function(){return t.config._enable},set:function(qe){t.config._enable=ui(qe)}}),Object.defineProperty(t.config,"disable",{get:function(){return t.config._disable},set:function(qe){t.config._disable=ui(qe)}});var oe=q.mode==="time";if(!q.dateFormat&&(q.enableTime||oe)){var Te=kt.defaultConfig.dateFormat||bs.dateFormat;Q.dateFormat=q.noCalendar||oe?"H:i"+(q.enableSeconds?":S":""):Te+" H:i"+(q.enableSeconds?":S":"")}if(q.altInput&&(q.enableTime||oe)&&!q.altFormat){var Ie=kt.defaultConfig.altFormat||bs.altFormat;Q.altFormat=q.noCalendar||oe?"h:i"+(q.enableSeconds?":S K":" K"):Ie+(" h:i"+(q.enableSeconds?":S":"")+" K")}Object.defineProperty(t.config,"minDate",{get:function(){return t.config._minDate},set:Ee("min")}),Object.defineProperty(t.config,"maxDate",{get:function(){return t.config._maxDate},set:Ee("max")});var Pe=function(qe){return function(at){t.config[qe==="min"?"_minTime":"_maxTime"]=t.parseDate(at,"H:i:S")}};Object.defineProperty(t.config,"minTime",{get:function(){return t.config._minTime},set:Pe("min")}),Object.defineProperty(t.config,"maxTime",{get:function(){return t.config._maxTime},set:Pe("max")}),q.mode==="time"&&(t.config.noCalendar=!0,t.config.enableTime=!0),Object.assign(t.config,Q,q);for(var De=0;De-1?t.config[Ne]=vr(ze[Ne]).map(o).concat(t.config[Ne]):typeof q[Ne]>"u"&&(t.config[Ne]=ze[Ne])}q.altInputClass||(t.config.altInputClass=en().className+" "+t.config.altInputClass),Ke("onParseConfig")}function en(){return t.config.wrap?n.querySelector("[data-input]"):n}function Yt(){typeof t.config.locale!="object"&&typeof kt.l10ns[t.config.locale]>"u"&&t.config.errorHandler(new Error("flatpickr: invalid locale "+t.config.locale)),t.l10n=Nt(Nt({},kt.l10ns.default),typeof t.config.locale=="object"?t.config.locale:t.config.locale!=="default"?kt.l10ns[t.config.locale]:void 0),ji.D="("+t.l10n.weekdays.shorthand.join("|")+")",ji.l="("+t.l10n.weekdays.longhand.join("|")+")",ji.M="("+t.l10n.months.shorthand.join("|")+")",ji.F="("+t.l10n.months.longhand.join("|")+")",ji.K="("+t.l10n.amPM[0]+"|"+t.l10n.amPM[1]+"|"+t.l10n.amPM[0].toLowerCase()+"|"+t.l10n.amPM[1].toLowerCase()+")";var N=Nt(Nt({},e),JSON.parse(JSON.stringify(n.dataset||{})));N.time_24hr===void 0&&kt.defaultConfig.time_24hr===void 0&&(t.config.time_24hr=t.l10n.time_24hr),t.formatDate=T_(t),t.parseDate=ia({config:t.config,l10n:t.l10n})}function tn(N){if(typeof t.config.position=="function")return void t.config.position(t,N);if(t.calendarContainer!==void 0){Ke("onPreCalendarPosition");var q=N||t._positionElement,Q=Array.prototype.reduce.call(t.calendarContainer.children,function(R_,H_){return R_+H_.offsetHeight},0),oe=t.calendarContainer.offsetWidth,Te=t.config.position.split(" "),Ie=Te[0],Pe=Te.length>1?Te[1]:null,De=q.getBoundingClientRect(),ze=window.innerHeight-De.bottom,Ne=Ie==="above"||Ie!=="below"&&zeQ,qe=window.pageYOffset+De.top+(Ne?-Q-2:q.offsetHeight+2);if(qt(t.calendarContainer,"arrowTop",!Ne),qt(t.calendarContainer,"arrowBottom",Ne),!t.config.inline){var at=window.pageXOffset+De.left,Hn=!1,nn=!1;Pe==="center"?(at-=(oe-De.width)/2,Hn=!0):Pe==="right"&&(at-=oe-De.width,nn=!0),qt(t.calendarContainer,"arrowLeft",!Hn&&!nn),qt(t.calendarContainer,"arrowCenter",Hn),qt(t.calendarContainer,"arrowRight",nn);var Is=window.document.body.offsetWidth-(window.pageXOffset+De.right),os=at+oe>window.document.body.offsetWidth,E_=Is+oe>window.document.body.offsetWidth;if(qt(t.calendarContainer,"rightMost",os),!t.config.static)if(t.calendarContainer.style.top=qe+"px",!os)t.calendarContainer.style.left=at+"px",t.calendarContainer.style.right="auto";else if(!E_)t.calendarContainer.style.left="auto",t.calendarContainer.style.right=Is+"px";else{var Jo=Gn();if(Jo===void 0)return;var A_=window.document.body.offsetWidth,I_=Math.max(0,A_/2-oe/2),P_=".flatpickr-calendar.centerMost:before",L_=".flatpickr-calendar.centerMost:after",N_=Jo.cssRules.length,F_="{left:"+De.left+"px;right:auto;}";qt(t.calendarContainer,"rightMost",!1),qt(t.calendarContainer,"centerMost",!0),Jo.insertRule(P_+","+L_+F_,N_),t.calendarContainer.style.left=I_+"px",t.calendarContainer.style.right="auto"}}}}function Gn(){for(var N=null,q=0;qt.currentMonth+t.config.showMonths-1)&&t.config.mode!=="range";if(t.selectedDateElem=oe,t.config.mode==="single")t.selectedDates=[Te];else if(t.config.mode==="multiple"){var Pe=Xn(Te);Pe?t.selectedDates.splice(parseInt(Pe),1):t.selectedDates.push(Te)}else t.config.mode==="range"&&(t.selectedDates.length===2&&t.clear(!1,!1),t.latestSelectedDateObj=Te,t.selectedDates.push(Te),ln(Te,t.selectedDates[0],!0)!==0&&t.selectedDates.sort(function(qe,at){return qe.getTime()-at.getTime()}));if(c(),Ie){var De=t.currentYear!==Te.getFullYear();t.currentYear=Te.getFullYear(),t.currentMonth=Te.getMonth(),De&&(Ke("onYearChange"),W()),Ke("onMonthChange")}if(Oi(),F(),Pt(),!Ie&&t.config.mode!=="range"&&t.config.showMonths===1?D(oe):t.selectedDateElem!==void 0&&t.hourElement===void 0&&t.selectedDateElem&&t.selectedDateElem.focus(),t.hourElement!==void 0&&t.hourElement!==void 0&&t.hourElement.focus(),t.config.closeOnSelect){var ze=t.config.mode==="single"&&!t.config.enableTime,Ne=t.config.mode==="range"&&t.selectedDates.length===2&&!t.config.enableTime;(ze||Ne)&&ri()}g()}}var ai={locale:[Yt,J],showMonths:[K,r,ie],minDate:[k],maxDate:[k],positionElement:[Ti],clickOpens:[function(){t.config.clickOpens===!0?(b(t._input,"focus",t.open),b(t._input,"click",t.open)):(t._input.removeEventListener("focus",t.open),t._input.removeEventListener("click",t.open))}]};function es(N,q){if(N!==null&&typeof N=="object"){Object.assign(t.config,N);for(var Q in N)ai[Q]!==void 0&&ai[Q].forEach(function(oe){return oe()})}else t.config[N]=q,ai[N]!==void 0?ai[N].forEach(function(oe){return oe()}):br.indexOf(N)>-1&&(t.config[N]=vr(q));t.redraw(),Pt(!0)}function ts(N,q){var Q=[];if(N instanceof Array)Q=N.map(function(oe){return t.parseDate(oe,q)});else if(N instanceof Date||typeof N=="number")Q=[t.parseDate(N,q)];else if(typeof N=="string")switch(t.config.mode){case"single":case"time":Q=[t.parseDate(N,q)];break;case"multiple":Q=N.split(t.config.conjunction).map(function(oe){return t.parseDate(oe,q)});break;case"range":Q=N.split(t.l10n.rangeSeparator).map(function(oe){return t.parseDate(oe,q)});break}else t.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(N)));t.selectedDates=t.config.allowInvalidPreload?Q:Q.filter(function(oe){return oe instanceof Date&&Se(oe,!1)}),t.config.mode==="range"&&t.selectedDates.sort(function(oe,Te){return oe.getTime()-Te.getTime()})}function El(N,q,Q){if(q===void 0&&(q=!1),Q===void 0&&(Q=t.config.dateFormat),N!==0&&!N||N instanceof Array&&N.length===0)return t.clear(q);ts(N,Q),t.latestSelectedDateObj=t.selectedDates[t.selectedDates.length-1],t.redraw(),k(void 0,q),d(),t.selectedDates.length===0&&t.clear(!1),Pt(q),q&&Ke("onChange")}function ui(N){return N.slice().map(function(q){return typeof q=="string"||typeof q=="number"||q instanceof Date?t.parseDate(q,void 0,!0):q&&typeof q=="object"&&q.from&&q.to?{from:t.parseDate(q.from,void 0),to:t.parseDate(q.to,void 0)}:q}).filter(function(q){return q})}function ns(){t.selectedDates=[],t.now=t.parseDate(t.config.now)||new Date;var N=t.config.defaultDate||((t.input.nodeName==="INPUT"||t.input.nodeName==="TEXTAREA")&&t.input.placeholder&&t.input.value===t.input.placeholder?null:t.input.value);N&&ts(N,t.config.dateFormat),t._initialDate=t.selectedDates.length>0?t.selectedDates[0]:t.config.minDate&&t.config.minDate.getTime()>t.now.getTime()?t.config.minDate:t.config.maxDate&&t.config.maxDate.getTime()0&&(t.latestSelectedDateObj=t.selectedDates[0]),t.config.minTime!==void 0&&(t.config.minTime=t.parseDate(t.config.minTime,"H:i")),t.config.maxTime!==void 0&&(t.config.maxTime=t.parseDate(t.config.maxTime,"H:i")),t.minDateHasTime=!!t.config.minDate&&(t.config.minDate.getHours()>0||t.config.minDate.getMinutes()>0||t.config.minDate.getSeconds()>0),t.maxDateHasTime=!!t.config.maxDate&&(t.config.maxDate.getHours()>0||t.config.maxDate.getMinutes()>0||t.config.maxDate.getSeconds()>0)}function Al(){if(t.input=en(),!t.input){t.config.errorHandler(new Error("Invalid input element specified"));return}t.input._type=t.input.type,t.input.type="text",t.input.classList.add("flatpickr-input"),t._input=t.input,t.config.altInput&&(t.altInput=tt(t.input.nodeName,t.config.altInputClass),t._input=t.altInput,t.altInput.placeholder=t.input.placeholder,t.altInput.disabled=t.input.disabled,t.altInput.required=t.input.required,t.altInput.tabIndex=t.input.tabIndex,t.altInput.type="text",t.input.setAttribute("type","hidden"),!t.config.static&&t.input.parentNode&&t.input.parentNode.insertBefore(t.altInput,t.input.nextSibling)),t.config.allowInput||t._input.setAttribute("readonly","readonly"),Ti()}function Ti(){t._positionElement=t.config.positionElement||t._input}function is(){var N=t.config.enableTime?t.config.noCalendar?"time":"datetime-local":"date";t.mobileInput=tt("input",t.input.className+" flatpickr-mobile"),t.mobileInput.tabIndex=1,t.mobileInput.type=N,t.mobileInput.disabled=t.input.disabled,t.mobileInput.required=t.input.required,t.mobileInput.placeholder=t.input.placeholder,t.mobileFormatStr=N==="datetime-local"?"Y-m-d\\TH:i:S":N==="date"?"Y-m-d":"H:i:S",t.selectedDates.length>0&&(t.mobileInput.defaultValue=t.mobileInput.value=t.formatDate(t.selectedDates[0],t.mobileFormatStr)),t.config.minDate&&(t.mobileInput.min=t.formatDate(t.config.minDate,"Y-m-d")),t.config.maxDate&&(t.mobileInput.max=t.formatDate(t.config.maxDate,"Y-m-d")),t.input.getAttribute("step")&&(t.mobileInput.step=String(t.input.getAttribute("step"))),t.input.type="hidden",t.altInput!==void 0&&(t.altInput.type="hidden");try{t.input.parentNode&&t.input.parentNode.insertBefore(t.mobileInput,t.input.nextSibling)}catch{}b(t.mobileInput,"change",function(q){t.setDate(sn(q).value,!1,t.mobileFormatStr),Ke("onChange"),Ke("onClose")})}function Kt(N){if(t.isOpen===!0)return t.close();t.open(N)}function Ke(N,q){if(t.config!==void 0){var Q=t.config[N];if(Q!==void 0&&Q.length>0)for(var oe=0;Q[oe]&&oe=0&&ln(N,t.selectedDates[1])<=0}function Oi(){t.config.noCalendar||t.isMobile||!t.monthNav||(t.yearElements.forEach(function(N,q){var Q=new Date(t.currentYear,t.currentMonth,1);Q.setMonth(t.currentMonth+q),t.config.showMonths>1||t.config.monthSelectorType==="static"?t.monthElements[q].textContent=Ao(Q.getMonth(),t.config.shorthandCurrentMonth,t.l10n)+" ":t.monthsDropdownContainer.value=Q.getMonth().toString(),N.value=Q.getFullYear().toString()}),t._hidePrevMonthArrow=t.config.minDate!==void 0&&(t.currentYear===t.config.minDate.getFullYear()?t.currentMonth<=t.config.minDate.getMonth():t.currentYeart.config.maxDate.getMonth():t.currentYear>t.config.maxDate.getFullYear()))}function Di(N){var q=N||(t.config.altInput?t.config.altFormat:t.config.dateFormat);return t.selectedDates.map(function(Q){return t.formatDate(Q,q)}).filter(function(Q,oe,Te){return t.config.mode!=="range"||t.config.enableTime||Te.indexOf(Q)===oe}).join(t.config.mode!=="range"?t.config.conjunction:t.l10n.rangeSeparator)}function Pt(N){N===void 0&&(N=!0),t.mobileInput!==void 0&&t.mobileFormatStr&&(t.mobileInput.value=t.latestSelectedDateObj!==void 0?t.formatDate(t.latestSelectedDateObj,t.mobileFormatStr):""),t.input.value=Di(t.config.dateFormat),t.altInput!==void 0&&(t.altInput.value=Di(t.config.altFormat)),N!==!1&&Ke("onValueUpdate")}function jt(N){var q=sn(N),Q=t.prevMonthNav.contains(q),oe=t.nextMonthNav.contains(q);Q||oe?Y(Q?-1:1):t.yearElements.indexOf(q)>=0?q.select():q.classList.contains("arrowUp")?t.changeYear(t.currentYear+1):q.classList.contains("arrowDown")&&t.changeYear(t.currentYear-1)}function Il(N){N.preventDefault();var q=N.type==="keydown",Q=sn(N),oe=Q;t.amPM!==void 0&&Q===t.amPM&&(t.amPM.textContent=t.l10n.amPM[mn(t.amPM.textContent===t.l10n.amPM[0])]);var Te=parseFloat(oe.getAttribute("min")),Ie=parseFloat(oe.getAttribute("max")),Pe=parseFloat(oe.getAttribute("step")),De=parseInt(oe.value,10),ze=N.delta||(q?N.which===38?1:-1:0),Ne=De+Pe*ze;if(typeof oe.value<"u"&&oe.value.length===2){var qe=oe===t.hourElement,at=oe===t.minuteElement;NeIe&&(Ne=oe===t.hourElement?Ne-Ie-mn(!t.amPM):Te,at&&C(void 0,1,t.hourElement)),t.amPM&&qe&&(Pe===1?Ne+De===23:Math.abs(Ne-De)>Pe)&&(t.amPM.textContent=t.l10n.amPM[mn(t.amPM.textContent===t.l10n.amPM[0])]),oe.value=Jt(Ne)}}return s(),t}function vs(n,e){for(var t=Array.prototype.slice.call(n).filter(function(o){return o instanceof HTMLElement}),i=[],s=0;s{const C=f||m,M=y(d);return M.onReady.push(()=>{t(8,h=!0)}),t(3,b=kt(C,Object.assign(M,f?{wrap:!0}:{}))),()=>{b.destroy()}});const g=It();function y(C={}){C=Object.assign({},C);for(const M of r){const T=(D,A,P)=>{g($$(M),[D,A,P])};M in C?(Array.isArray(C[M])||(C[M]=[C[M]]),C[M].push(T)):C[M]=[T]}return C.onChange&&!C.onChange.includes(k)&&C.onChange.push(k),C}function k(C,M,T){var A,P;const D=(P=(A=T==null?void 0:T.config)==null?void 0:A.mode)!=null?P:"single";t(2,a=D==="single"?C[0]:C),t(4,u=M)}function w(C){le[C?"unshift":"push"](()=>{m=C,t(0,m)})}return n.$$set=C=>{e=Ye(Ye({},e),Un(C)),t(1,s=wt(e,i)),"value"in C&&t(2,a=C.value),"formattedValue"in C&&t(4,u=C.formattedValue),"element"in C&&t(5,f=C.element),"dateFormat"in C&&t(6,c=C.dateFormat),"options"in C&&t(7,d=C.options),"input"in C&&t(0,m=C.input),"flatpickr"in C&&t(3,b=C.flatpickr),"$$scope"in C&&t(9,o=C.$$scope)},n.$$.update=()=>{if(n.$$.dirty&332&&b&&h&&b.setDate(a,!1,c),n.$$.dirty&392&&b&&h)for(const[C,M]of Object.entries(y(d)))b.set(C,M)},[m,s,a,b,u,f,c,d,h,o,l,w]}class Ka extends Me{constructor(e){super(),Ce(this,e,C$,S$,we,{value:2,formattedValue:4,element:5,dateFormat:6,options:7,input:0,flatpickr:3})}}function M$(n){let e,t,i,s,l,o,r;function a(f){n[2](f)}let u={id:n[4],options:B.defaultFlatpickrOptions(),value:n[0].min};return n[0].min!==void 0&&(u.formattedValue=n[0].min),l=new Ka({props:u}),le.push(()=>ke(l,"formattedValue",a)),{c(){e=v("label"),t=z("Min date (UTC)"),s=O(),j(l.$$.fragment),p(e,"for",i=n[4])},m(f,c){$(f,e,c),_(e,t),$(f,s,c),R(l,f,c),r=!0},p(f,c){(!r||c&16&&i!==(i=f[4]))&&p(e,"for",i);const d={};c&16&&(d.id=f[4]),c&1&&(d.value=f[0].min),!o&&c&1&&(o=!0,d.formattedValue=f[0].min,$e(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){I(l.$$.fragment,f),r=!1},d(f){f&&S(e),f&&S(s),H(l,f)}}}function T$(n){let e,t,i,s,l,o,r;function a(f){n[3](f)}let u={id:n[4],options:B.defaultFlatpickrOptions(),value:n[0].max};return n[0].max!==void 0&&(u.formattedValue=n[0].max),l=new Ka({props:u}),le.push(()=>ke(l,"formattedValue",a)),{c(){e=v("label"),t=z("Max date (UTC)"),s=O(),j(l.$$.fragment),p(e,"for",i=n[4])},m(f,c){$(f,e,c),_(e,t),$(f,s,c),R(l,f,c),r=!0},p(f,c){(!r||c&16&&i!==(i=f[4]))&&p(e,"for",i);const d={};c&16&&(d.id=f[4]),c&1&&(d.value=f[0].max),!o&&c&1&&(o=!0,d.formattedValue=f[0].max,$e(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){I(l.$$.fragment,f),r=!1},d(f){f&&S(e),f&&S(s),H(l,f)}}}function O$(n){let e,t,i,s,l,o,r;return i=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[M$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[T$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid")},m(a,u){$(a,e,u),_(e,t),R(i,t,null),_(e,s),_(e,l),R(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){I(i.$$.fragment,a),I(o.$$.fragment,a),r=!1},d(a){a&&S(e),H(i),H(o)}}}function D$(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.min,r)&&(s.min=r,t(0,s))}function o(r){n.$$.not_equal(s.max,r)&&(s.max=r,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 E$ extends Me{constructor(e){super(),Ce(this,e,D$,O$,we,{key:1,options:0})}}function A$(n){let e,t,i,s,l,o,r,a,u;function f(d){n[2](d)}let c={id:n[4],placeholder:"eg. optionA, optionB",required:!0};return n[0].values!==void 0&&(c.value=n[0].values),l=new xi({props:c}),le.push(()=>ke(l,"value",f)),{c(){e=v("label"),t=z("Choices"),s=O(),j(l.$$.fragment),r=O(),a=v("div"),a.textContent="Use comma as separator.",p(e,"for",i=n[4]),p(a,"class","help-block")},m(d,h){$(d,e,h),_(e,t),$(d,s,h),R(l,d,h),$(d,r,h),$(d,a,h),u=!0},p(d,h){(!u||h&16&&i!==(i=d[4]))&&p(e,"for",i);const m={};h&16&&(m.id=d[4]),!o&&h&1&&(o=!0,m.value=d[0].values,$e(()=>o=!1)),l.$set(m)},i(d){u||(E(l.$$.fragment,d),u=!0)},o(d){I(l.$$.fragment,d),u=!1},d(d){d&&S(e),d&&S(s),H(l,d),d&&S(r),d&&S(a)}}}function I$(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Max select"),s=O(),l=v("input"),p(e,"for",i=n[4]),p(l,"type","number"),p(l,"id",o=n[4]),p(l,"step","1"),p(l,"min","1"),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].maxSelect),r||(a=U(l,"input",n[3]),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&&rt(l.value)!==u[0].maxSelect&&he(l,u[0].maxSelect)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function P$(n){let e,t,i,s,l,o,r;return i=new _e({props:{class:"form-field required",name:"schema."+n[1]+".options.values",$$slots:{default:[A$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[I$,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),p(t,"class","col-sm-9"),p(l,"class","col-sm-3"),p(e,"class","grid")},m(a,u){$(a,e,u),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),r=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.values"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.maxSelect"),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){I(i.$$.fragment,a),I(o.$$.fragment,a),r=!1},d(a){a&&S(e),H(i),H(o)}}}function L$(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.values,r)&&(s.values=r,t(0,s))}function o(){s.maxSelect=rt(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)},n.$$.update=()=>{n.$$.dirty&1&&B.isEmpty(s)&&t(0,s={maxSelect:1,values:[]})},[s,i,l,o]}class N$ extends Me{constructor(e){super(),Ce(this,e,L$,P$,we,{key:1,options:0})}}function F$(n,e,t){return["",{}]}class R$ extends Me{constructor(e){super(),Ce(this,e,F$,null,we,{key:0,options:1})}get key(){return this.$$.ctx[0]}get options(){return this.$$.ctx[1]}}function H$(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Max file size (bytes)"),s=O(),l=v("input"),p(e,"for",i=n[10]),p(l,"type","number"),p(l,"id",o=n[10]),p(l,"step","1"),p(l,"min","0")},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].maxSize),r||(a=U(l,"input",n[2]),r=!0)},p(u,f){f&1024&&i!==(i=u[10])&&p(e,"for",i),f&1024&&o!==(o=u[10])&&p(l,"id",o),f&1&&rt(l.value)!==u[0].maxSize&&he(l,u[0].maxSize)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function j$(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Max files"),s=O(),l=v("input"),p(e,"for",i=n[10]),p(l,"type","number"),p(l,"id",o=n[10]),p(l,"step","1"),p(l,"min",""),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].maxSelect),r||(a=U(l,"input",n[3]),r=!0)},p(u,f){f&1024&&i!==(i=u[10])&&p(e,"for",i),f&1024&&o!==(o=u[10])&&p(l,"id",o),f&1&&rt(l.value)!==u[0].maxSelect&&he(l,u[0].maxSelect)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function q$(n){let e,t,i,s,l,o,r,a,u;return{c(){e=v("div"),e.innerHTML='Documents (pdf, doc/docx, xls/xlsx)',t=O(),i=v("div"),i.innerHTML='Images (jpg, png, svg, gif)',s=O(),l=v("div"),l.innerHTML='Videos (mp4, avi, mov, 3gp)',o=O(),r=v("div"),r.innerHTML='Archives (zip, 7zip, rar)',p(e,"tabindex","0"),p(e,"class","dropdown-item closable"),p(i,"tabindex","0"),p(i,"class","dropdown-item closable"),p(l,"tabindex","0"),p(l,"class","dropdown-item closable"),p(r,"tabindex","0"),p(r,"class","dropdown-item closable")},m(f,c){$(f,e,c),$(f,t,c),$(f,i,c),$(f,s,c),$(f,l,c),$(f,o,c),$(f,r,c),a||(u=[U(e,"click",n[5]),U(i,"click",n[6]),U(l,"click",n[7]),U(r,"click",n[8])],a=!0)},p:x,d(f){f&&S(e),f&&S(t),f&&S(i),f&&S(s),f&&S(l),f&&S(o),f&&S(r),a=!1,Re(u)}}}function V$(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M;function T(A){n[4](A)}let D={id:n[10],placeholder:"eg. image/png, application/pdf..."};return n[0].mimeTypes!==void 0&&(D.value=n[0].mimeTypes),r=new xi({props:D}),le.push(()=>ke(r,"value",T)),k=new Zn({props:{class:"dropdown dropdown-sm dropdown-nowrap",$$slots:{default:[q$]},$$scope:{ctx:n}}}),{c(){e=v("label"),t=v("span"),t.textContent="Mime types",i=O(),s=v("i"),o=O(),j(r.$$.fragment),u=O(),f=v("div"),c=v("span"),c.textContent="Use comma as separator.",d=O(),h=v("button"),m=v("span"),m.textContent="Choose presets",b=O(),g=v("i"),y=O(),j(k.$$.fragment),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[10]),p(c,"class","txt"),p(m,"class","txt link-primary"),p(g,"class","ri-arrow-drop-down-fill"),p(h,"type","button"),p(h,"class","inline-flex flex-gap-0"),p(f,"class","help-block")},m(A,P){$(A,e,P),_(e,t),_(e,i),_(e,s),$(A,o,P),R(r,A,P),$(A,u,P),$(A,f,P),_(f,c),_(f,d),_(f,h),_(h,m),_(h,b),_(h,g),_(h,y),R(k,h,null),w=!0,C||(M=Le(Be.call(null,s,{text:`Allow files ONLY with the listed mime types. + Leave empty for no restriction.`,position:"top"})),C=!0)},p(A,P){(!w||P&1024&&l!==(l=A[10]))&&p(e,"for",l);const L={};P&1024&&(L.id=A[10]),!a&&P&1&&(a=!0,L.value=A[0].mimeTypes,$e(()=>a=!1)),r.$set(L);const V={};P&2049&&(V.$$scope={dirty:P,ctx:A}),k.$set(V)},i(A){w||(E(r.$$.fragment,A),E(k.$$.fragment,A),w=!0)},o(A){I(r.$$.fragment,A),I(k.$$.fragment,A),w=!1},d(A){A&&S(e),A&&S(o),H(r,A),A&&S(u),A&&S(f),H(k),C=!1,M()}}}function z$(n){let e;return{c(){e=v("ul"),e.innerHTML=`
  • WxH + (eg. 100x50) - crop to WxH viewbox (from center)
  • +
  • WxHt + (eg. 100x50t) - crop to WxH viewbox (from top)
  • +
  • WxHb + (eg. 100x50b) - crop to WxH viewbox (from bottom)
  • +
  • WxHf + (eg. 100x50f) - fit inside a WxH viewbox (without cropping)
  • +
  • 0xH + (eg. 0x50) - resize to H height preserving the aspect ratio
  • +
  • Wx0 + (eg. 100x0) - resize to W width preserving the aspect ratio
  • `,p(e,"class","m-0")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function B$(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M;function T(A){n[9](A)}let D={id:n[10],placeholder:"eg. 50x50, 480x720"};return n[0].thumbs!==void 0&&(D.value=n[0].thumbs),r=new xi({props:D}),le.push(()=>ke(r,"value",T)),k=new Zn({props:{class:"dropdown dropdown-sm dropdown-center dropdown-nowrap p-r-10",$$slots:{default:[z$]},$$scope:{ctx:n}}}),{c(){e=v("label"),t=v("span"),t.textContent="Thumb sizes",i=O(),s=v("i"),o=O(),j(r.$$.fragment),u=O(),f=v("div"),c=v("span"),c.textContent="Use comma as separator.",d=O(),h=v("button"),m=v("span"),m.textContent="Supported formats",b=O(),g=v("i"),y=O(),j(k.$$.fragment),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[10]),p(c,"class","txt"),p(m,"class","txt link-primary"),p(g,"class","ri-arrow-drop-down-fill"),p(h,"type","button"),p(h,"class","inline-flex flex-gap-0"),p(f,"class","help-block")},m(A,P){$(A,e,P),_(e,t),_(e,i),_(e,s),$(A,o,P),R(r,A,P),$(A,u,P),$(A,f,P),_(f,c),_(f,d),_(f,h),_(h,m),_(h,b),_(h,g),_(h,y),R(k,h,null),w=!0,C||(M=Le(Be.call(null,s,{text:"List of additional thumb sizes for image files, along with the default thumb size of 100x100. The thumbs are generated lazily on first access.",position:"top"})),C=!0)},p(A,P){(!w||P&1024&&l!==(l=A[10]))&&p(e,"for",l);const L={};P&1024&&(L.id=A[10]),!a&&P&1&&(a=!0,L.value=A[0].thumbs,$e(()=>a=!1)),r.$set(L);const V={};P&2048&&(V.$$scope={dirty:P,ctx:A}),k.$set(V)},i(A){w||(E(r.$$.fragment,A),E(k.$$.fragment,A),w=!0)},o(A){I(r.$$.fragment,A),I(k.$$.fragment,A),w=!1},d(A){A&&S(e),A&&S(o),H(r,A),A&&S(u),A&&S(f),H(k),C=!1,M()}}}function W$(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;return i=new _e({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSize",$$slots:{default:[H$,({uniqueId:m})=>({10:m}),({uniqueId:m})=>m?1024:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[j$,({uniqueId:m})=>({10:m}),({uniqueId:m})=>m?1024:0]},$$scope:{ctx:n}}}),u=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.mimeTypes",$$slots:{default:[V$,({uniqueId:m})=>({10:m}),({uniqueId:m})=>m?1024:0]},$$scope:{ctx:n}}}),d=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.thumbs",$$slots:{default:[B$,({uniqueId:m})=>({10:m}),({uniqueId:m})=>m?1024:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),r=O(),a=v("div"),j(u.$$.fragment),f=O(),c=v("div"),j(d.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(a,"class","col-sm-12"),p(c,"class","col-sm-12"),p(e,"class","grid")},m(m,b){$(m,e,b),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),_(e,r),_(e,a),R(u,a,null),_(e,f),_(e,c),R(d,c,null),h=!0},p(m,[b]){const g={};b&2&&(g.name="schema."+m[1]+".options.maxSize"),b&3073&&(g.$$scope={dirty:b,ctx:m}),i.$set(g);const y={};b&2&&(y.name="schema."+m[1]+".options.maxSelect"),b&3073&&(y.$$scope={dirty:b,ctx:m}),o.$set(y);const k={};b&2&&(k.name="schema."+m[1]+".options.mimeTypes"),b&3073&&(k.$$scope={dirty:b,ctx:m}),u.$set(k);const w={};b&2&&(w.name="schema."+m[1]+".options.thumbs"),b&3073&&(w.$$scope={dirty:b,ctx:m}),d.$set(w)},i(m){h||(E(i.$$.fragment,m),E(o.$$.fragment,m),E(u.$$.fragment,m),E(d.$$.fragment,m),h=!0)},o(m){I(i.$$.fragment,m),I(o.$$.fragment,m),I(u.$$.fragment,m),I(d.$$.fragment,m),h=!1},d(m){m&&S(e),H(i),H(o),H(u),H(d)}}}function U$(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.maxSize=rt(this.value),t(0,s)}function o(){s.maxSelect=rt(this.value),t(0,s)}function r(h){n.$$.not_equal(s.mimeTypes,h)&&(s.mimeTypes=h,t(0,s))}const a=()=>{t(0,s.mimeTypes=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],s)},u=()=>{t(0,s.mimeTypes=["image/jpg","image/jpeg","image/png","image/svg+xml","image/gif"],s)},f=()=>{t(0,s.mimeTypes=["video/mp4","video/x-ms-wmv","video/quicktime","video/3gpp"],s)},c=()=>{t(0,s.mimeTypes=["application/zip","application/x-7z-compressed","application/x-rar-compressed"],s)};function d(h){n.$$.not_equal(s.thumbs,h)&&(s.thumbs=h,t(0,s))}return n.$$set=h=>{"key"in h&&t(1,i=h.key),"options"in h&&t(0,s=h.options)},n.$$.update=()=>{n.$$.dirty&1&&B.isEmpty(s)&&t(0,s={maxSelect:1,maxSize:5242880,thumbs:[],mimeTypes:[]})},[s,i,l,o,r,a,u,f,c,d]}class Y$ extends Me{constructor(e){super(),Ce(this,e,U$,W$,we,{key:1,options:0})}}function K$(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='New collection',p(e,"type","button"),p(e,"class","btn btn-warning btn-block btn-sm m-t-5")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[7]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function J$(n){let e,t,i,s,l,o,r;function a(f){n[8](f)}let u={searchable:n[3].length>5,selectPlaceholder:n[2]?"Loading...":"Select collection",noOptionsText:"No collections found",selectionKey:"id",items:n[3],$$slots:{afterOptions:[K$]},$$scope:{ctx:n}};return n[0].collectionId!==void 0&&(u.keyOfSelected=n[0].collectionId),l=new Es({props:u}),le.push(()=>ke(l,"keyOfSelected",a)),{c(){e=v("label"),t=z("Collection"),s=O(),j(l.$$.fragment),p(e,"for",i=n[13])},m(f,c){$(f,e,c),_(e,t),$(f,s,c),R(l,f,c),r=!0},p(f,c){(!r||c&8192&&i!==(i=f[13]))&&p(e,"for",i);const d={};c&8&&(d.searchable=f[3].length>5),c&4&&(d.selectPlaceholder=f[2]?"Loading...":"Select collection"),c&8&&(d.items=f[3]),c&16400&&(d.$$scope={dirty:c,ctx:f}),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].collectionId,$e(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){I(l.$$.fragment,f),r=!1},d(f){f&&S(e),f&&S(s),H(l,f)}}}function Z$(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("label"),t=v("span"),t.textContent="Max select",i=O(),s=v("i"),o=O(),r=v("input"),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[13]),p(r,"type","number"),p(r,"id",a=n[13]),p(r,"step","1"),p(r,"min","1")},m(c,d){$(c,e,d),_(e,t),_(e,i),_(e,s),$(c,o,d),$(c,r,d),he(r,n[0].maxSelect),u||(f=[Le(Be.call(null,s,{text:"Leave empty for no limit.",position:"top"})),U(r,"input",n[9])],u=!0)},p(c,d){d&8192&&l!==(l=c[13])&&p(e,"for",l),d&8192&&a!==(a=c[13])&&p(r,"id",a),d&1&&rt(r.value)!==c[0].maxSelect&&he(r,c[0].maxSelect)},d(c){c&&S(e),c&&S(o),c&&S(r),u=!1,Re(f)}}}function G$(n){let e,t,i,s,l,o,r;function a(f){n[10](f)}let u={id:n[13],items:n[5]};return n[0].cascadeDelete!==void 0&&(u.keyOfSelected=n[0].cascadeDelete),l=new Es({props:u}),le.push(()=>ke(l,"keyOfSelected",a)),{c(){e=v("label"),t=z("Delete record on relation delete"),s=O(),j(l.$$.fragment),p(e,"for",i=n[13])},m(f,c){$(f,e,c),_(e,t),$(f,s,c),R(l,f,c),r=!0},p(f,c){(!r||c&8192&&i!==(i=f[13]))&&p(e,"for",i);const d={};c&8192&&(d.id=f[13]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].cascadeDelete,$e(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){I(l.$$.fragment,f),r=!1},d(f){f&&S(e),f&&S(s),H(l,f)}}}function X$(n){let e,t,i,s,l,o,r,a,u,f,c,d;i=new _e({props:{class:"form-field required",name:"schema."+n[1]+".options.collectionId",$$slots:{default:[J$,({uniqueId:m})=>({13:m}),({uniqueId:m})=>m?8192:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[Z$,({uniqueId:m})=>({13:m}),({uniqueId:m})=>m?8192:0]},$$scope:{ctx:n}}}),u=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[G$,({uniqueId:m})=>({13:m}),({uniqueId:m})=>m?8192:0]},$$scope:{ctx:n}}});let h={};return c=new Ja({props:h}),n[11](c),c.$on("save",n[12]),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),r=O(),a=v("div"),j(u.$$.fragment),f=O(),j(c.$$.fragment),p(t,"class","col-sm-9"),p(l,"class","col-sm-3"),p(a,"class","col-sm-12"),p(e,"class","grid")},m(m,b){$(m,e,b),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),_(e,r),_(e,a),R(u,a,null),$(m,f,b),R(c,m,b),d=!0},p(m,[b]){const g={};b&2&&(g.name="schema."+m[1]+".options.collectionId"),b&24605&&(g.$$scope={dirty:b,ctx:m}),i.$set(g);const y={};b&2&&(y.name="schema."+m[1]+".options.maxSelect"),b&24577&&(y.$$scope={dirty:b,ctx:m}),o.$set(y);const k={};b&2&&(k.name="schema."+m[1]+".options.cascadeDelete"),b&24577&&(k.$$scope={dirty:b,ctx:m}),u.$set(k);const w={};c.$set(w)},i(m){d||(E(i.$$.fragment,m),E(o.$$.fragment,m),E(u.$$.fragment,m),E(c.$$.fragment,m),d=!0)},o(m){I(i.$$.fragment,m),I(o.$$.fragment,m),I(u.$$.fragment,m),I(c.$$.fragment,m),d=!1},d(m){m&&S(e),H(i),H(o),H(u),m&&S(f),n[11](null),H(c,m)}}}function Q$(n,e,t){let{key:i=""}=e,{options:s={}}=e;const l=[{label:"False",value:!1},{label:"True",value:!0}];let o=!1,r=[],a=null;u();async function u(){t(2,o=!0);try{const g=await me.collections.getFullList(200,{sort:"created"});t(3,r=B.sortCollections(g))}catch(g){me.errorResponseHandler(g)}t(2,o=!1)}const f=()=>a==null?void 0:a.show();function c(g){n.$$.not_equal(s.collectionId,g)&&(s.collectionId=g,t(0,s))}function d(){s.maxSelect=rt(this.value),t(0,s)}function h(g){n.$$.not_equal(s.cascadeDelete,g)&&(s.cascadeDelete=g,t(0,s))}function m(g){le[g?"unshift":"push"](()=>{a=g,t(4,a)})}const b=g=>{var y,k;(k=(y=g==null?void 0:g.detail)==null?void 0:y.collection)!=null&&k.id&&t(0,s.collectionId=g.detail.collection.id,s),u()};return n.$$set=g=>{"key"in g&&t(1,i=g.key),"options"in g&&t(0,s=g.options)},n.$$.update=()=>{n.$$.dirty&1&&B.isEmpty(s)&&t(0,s={maxSelect:1,collectionId:null,cascadeDelete:!1})},[s,i,o,r,a,l,u,f,c,d,h,m,b]}class x$ extends Me{constructor(e){super(),Ce(this,e,Q$,X$,we,{key:1,options:0})}}function e4(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Max select"),s=O(),l=v("input"),p(e,"for",i=n[5]),p(l,"type","number"),p(l,"id",o=n[5]),p(l,"step","1"),p(l,"min","1"),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].maxSelect),r||(a=U(l,"input",n[3]),r=!0)},p(u,f){f&32&&i!==(i=u[5])&&p(e,"for",i),f&32&&o!==(o=u[5])&&p(l,"id",o),f&1&&rt(l.value)!==u[0].maxSelect&&he(l,u[0].maxSelect)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function t4(n){let e,t,i,s,l,o,r;function a(f){n[4](f)}let u={id:n[5],items:n[2]};return n[0].cascadeDelete!==void 0&&(u.keyOfSelected=n[0].cascadeDelete),l=new Es({props:u}),le.push(()=>ke(l,"keyOfSelected",a)),{c(){e=v("label"),t=z("Delete record on user delete"),s=O(),j(l.$$.fragment),p(e,"for",i=n[5])},m(f,c){$(f,e,c),_(e,t),$(f,s,c),R(l,f,c),r=!0},p(f,c){(!r||c&32&&i!==(i=f[5]))&&p(e,"for",i);const d={};c&32&&(d.id=f[5]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].cascadeDelete,$e(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){I(l.$$.fragment,f),r=!1},d(f){f&&S(e),f&&S(s),H(l,f)}}}function n4(n){let e,t,i,s,l,o,r;return i=new _e({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[e4,({uniqueId:a})=>({5:a}),({uniqueId:a})=>a?32:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[t4,({uniqueId:a})=>({5:a}),({uniqueId:a})=>a?32:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(e,"class","grid")},m(a,u){$(a,e,u),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),r=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.maxSelect"),u&97&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.cascadeDelete"),u&97&&(c.$$scope={dirty:u,ctx:a}),o.$set(c)},i(a){r||(E(i.$$.fragment,a),E(o.$$.fragment,a),r=!0)},o(a){I(i.$$.fragment,a),I(o.$$.fragment,a),r=!1},d(a){a&&S(e),H(i),H(o)}}}function i4(n,e,t){const i=[{label:"False",value:!1},{label:"True",value:!0}];let{key:s=""}=e,{options:l={}}=e;function o(){l.maxSelect=rt(this.value),t(0,l)}function r(a){n.$$.not_equal(l.cascadeDelete,a)&&(l.cascadeDelete=a,t(0,l))}return n.$$set=a=>{"key"in a&&t(1,s=a.key),"options"in a&&t(0,l=a.options)},n.$$.update=()=>{n.$$.dirty&1&&B.isEmpty(l)&&t(0,l={maxSelect:1,cascadeDelete:!1})},[l,s,i,o,r]}class s4 extends Me{constructor(e){super(),Ce(this,e,i4,n4,we,{key:1,options:0})}}function l4(n){let e,t,i,s,l,o,r;function a(f){n[17](f)}let u={id:n[43],disabled:n[0].id};return n[0].type!==void 0&&(u.value=n[0].type),l=new KS({props:u}),le.push(()=>ke(l,"value",a)),{c(){e=v("label"),t=z("Type"),s=O(),j(l.$$.fragment),p(e,"for",i=n[43])},m(f,c){$(f,e,c),_(e,t),$(f,s,c),R(l,f,c),r=!0},p(f,c){(!r||c[1]&4096&&i!==(i=f[43]))&&p(e,"for",i);const d={};c[1]&4096&&(d.id=f[43]),c[0]&1&&(d.disabled=f[0].id),!o&&c[0]&1&&(o=!0,d.value=f[0].type,$e(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){I(l.$$.fragment,f),r=!1},d(f){f&&S(e),f&&S(s),H(l,f)}}}function qc(n){let e,t,i;return{c(){e=v("span"),e.textContent="Duplicated or invalid name",p(e,"class","txt invalid-name-note svelte-1tpxlm5")},m(s,l){$(s,e,l),i=!0},i(s){i||(Qe(()=>{t||(t=je(e,kn,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){t||(t=je(e,kn,{duration:150,x:5},!1)),t.run(0),i=!1},d(s){s&&S(e),s&&t&&t.end()}}}function o4(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m=!n[5]&&qc();return{c(){e=v("label"),t=v("span"),t.textContent="Name",i=O(),m&&m.c(),l=O(),o=v("input"),p(t,"class","txt"),p(e,"for",s=n[43]),p(o,"type","text"),p(o,"id",r=n[43]),o.required=!0,o.disabled=a=n[0].id&&n[0].system,p(o,"spellcheck","false"),o.autofocus=u=!n[0].id,o.value=f=n[0].name},m(b,g){$(b,e,g),_(e,t),_(e,i),m&&m.m(e,null),$(b,l,g),$(b,o,g),c=!0,n[0].id||o.focus(),d||(h=U(o,"input",n[18]),d=!0)},p(b,g){b[5]?m&&(be(),I(m,1,1,()=>{m=null}),ve()):m?g[0]&32&&E(m,1):(m=qc(),m.c(),E(m,1),m.m(e,null)),(!c||g[1]&4096&&s!==(s=b[43]))&&p(e,"for",s),(!c||g[1]&4096&&r!==(r=b[43]))&&p(o,"id",r),(!c||g[0]&1&&a!==(a=b[0].id&&b[0].system))&&(o.disabled=a),(!c||g[0]&1&&u!==(u=!b[0].id))&&(o.autofocus=u),(!c||g[0]&1&&f!==(f=b[0].name)&&o.value!==f)&&(o.value=f)},i(b){c||(E(m),c=!0)},o(b){I(m),c=!1},d(b){b&&S(e),m&&m.d(),b&&S(l),b&&S(o),d=!1,h()}}}function r4(n){let e,t,i;function s(o){n[29](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new s4({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function a4(n){let e,t,i;function s(o){n[28](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new x$({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function u4(n){let e,t,i;function s(o){n[27](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new Y$({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function f4(n){let e,t,i;function s(o){n[26](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new R$({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function c4(n){let e,t,i;function s(o){n[25](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new N$({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function d4(n){let e,t,i;function s(o){n[24](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new E$({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function p4(n){let e,t,i;function s(o){n[23](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new m$({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function h4(n){let e,t,i;function s(o){n[22](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new C_({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function m4(n){let e,t,i;function s(o){n[21](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new o$({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function g4(n){let e,t,i;function s(o){n[20](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new s$({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function _4(n){let e,t,i;function s(o){n[19](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new xS({props:l}),le.push(()=>ke(e,"options",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function b4(n){let e,t,i,s,l,o,r,a,u,f,c;return{c(){e=v("input"),i=O(),s=v("label"),l=v("span"),l.textContent="Nonempty",o=O(),r=v("i"),p(e,"type","checkbox"),p(e,"id",t=n[43]),p(l,"class","txt"),p(r,"class","ri-information-line link-hint"),p(s,"for",u=n[43])},m(d,h){$(d,e,h),e.checked=n[0].required,$(d,i,h),$(d,s,h),_(s,l),_(s,o),_(s,r),f||(c=[U(e,"change",n[30]),Le(a=Be.call(null,r,{text:`Requires the field value to be nonempty +(aka. not ${B.zeroDefaultStr(n[0])}).`,position:"right"}))],f=!0)},p(d,h){h[1]&4096&&t!==(t=d[43])&&p(e,"id",t),h[0]&1&&(e.checked=d[0].required),a&&Wt(a.update)&&h[0]&1&&a.update.call(null,{text:`Requires the field value to be nonempty +(aka. not ${B.zeroDefaultStr(d[0])}).`,position:"right"}),h[1]&4096&&u!==(u=d[43])&&p(s,"for",u)},d(d){d&&S(e),d&&S(i),d&&S(s),f=!1,Re(c)}}}function Vc(n){let e,t;return e=new _e({props:{class:"form-field form-field-toggle m-0",name:"unique",$$slots:{default:[v4,({uniqueId:i})=>({43:i}),({uniqueId:i})=>[0,i?4096:0]]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s[0]&1|s[1]&12288&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function v4(n){let e,t,i,s,l,o,r,a;return{c(){e=v("input"),i=O(),s=v("label"),l=z("Unique"),p(e,"type","checkbox"),p(e,"id",t=n[43]),p(s,"for",o=n[43])},m(u,f){$(u,e,f),e.checked=n[0].unique,$(u,i,f),$(u,s,f),_(s,l),r||(a=U(e,"change",n[31]),r=!0)},p(u,f){f[1]&4096&&t!==(t=u[43])&&p(e,"id",t),f[0]&1&&(e.checked=u[0].unique),f[1]&4096&&o!==(o=u[43])&&p(s,"for",o)},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,a()}}}function zc(n){let e,t,i,s,l,o,r,a,u,f;a=new Zn({props:{class:"dropdown dropdown-sm dropdown-upside dropdown-right dropdown-nowrap no-min-width",$$slots:{default:[y4]},$$scope:{ctx:n}}});let c=n[8]&&Bc(n);return{c(){e=v("div"),t=v("div"),i=O(),s=v("div"),l=v("button"),o=v("i"),r=O(),j(a.$$.fragment),u=O(),c&&c.c(),p(t,"class","flex-fill"),p(o,"class","ri-more-line"),p(l,"type","button"),p(l,"class","btn btn-circle btn-sm btn-secondary"),p(s,"class","inline-flex flex-gap-sm flex-nowrap"),p(e,"class","col-sm-4 txt-right")},m(d,h){$(d,e,h),_(e,t),_(e,i),_(e,s),_(s,l),_(l,o),_(l,r),R(a,l,null),_(s,u),c&&c.m(s,null),f=!0},p(d,h){const m={};h[1]&8192&&(m.$$scope={dirty:h,ctx:d}),a.$set(m),d[8]?c?c.p(d,h):(c=Bc(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i(d){f||(E(a.$$.fragment,d),f=!0)},o(d){I(a.$$.fragment,d),f=!1},d(d){d&&S(e),H(a),c&&c.d()}}}function y4(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='Remove',p(e,"type","button"),p(e,"class","dropdown-item txt-right")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[9]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function Bc(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='Done',p(e,"type","button"),p(e,"class","btn btn-sm btn-outline btn-expanded-sm")},m(s,l){$(s,e,l),t||(i=U(e,"click",Yn(n[3])),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function k4(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M,T;s=new _e({props:{class:"form-field required "+(n[0].id?"disabled":""),name:"schema."+n[1]+".type",$$slots:{default:[l4,({uniqueId:F})=>({43:F}),({uniqueId:F})=>[0,F?4096:0]]},$$scope:{ctx:n}}}),r=new _e({props:{class:` + form-field + required + `+(n[5]?"":"invalid")+` + `+(n[0].id&&n[0].system?"disabled":"")+` + `,name:"schema."+n[1]+".name",$$slots:{default:[o4,({uniqueId:F})=>({43:F}),({uniqueId:F})=>[0,F?4096:0]]},$$scope:{ctx:n}}});const D=[_4,g4,m4,h4,p4,d4,c4,f4,u4,a4,r4],A=[];function P(F,W){return F[0].type==="text"?0:F[0].type==="number"?1:F[0].type==="bool"?2:F[0].type==="email"?3:F[0].type==="url"?4:F[0].type==="date"?5:F[0].type==="select"?6:F[0].type==="json"?7:F[0].type==="file"?8:F[0].type==="relation"?9:F[0].type==="user"?10:-1}~(f=P(n))&&(c=A[f]=D[f](n)),m=new _e({props:{class:"form-field form-field-toggle m-0",name:"requried",$$slots:{default:[b4,({uniqueId:F})=>({43:F}),({uniqueId:F})=>[0,F?4096:0]]},$$scope:{ctx:n}}});let L=n[0].type!=="file"&&Vc(n),V=!n[0].toDelete&&zc(n);return{c(){e=v("form"),t=v("div"),i=v("div"),j(s.$$.fragment),l=O(),o=v("div"),j(r.$$.fragment),a=O(),u=v("div"),c&&c.c(),d=O(),h=v("div"),j(m.$$.fragment),b=O(),g=v("div"),L&&L.c(),y=O(),V&&V.c(),k=O(),w=v("input"),p(i,"class","col-sm-6"),p(o,"class","col-sm-6"),p(u,"class","col-sm-12 hidden-empty"),p(h,"class","col-sm-4 flex"),p(g,"class","col-sm-4 flex"),p(t,"class","grid"),p(w,"type","submit"),p(w,"class","hidden"),p(w,"tabindex","-1"),p(e,"class","field-form")},m(F,W){$(F,e,W),_(e,t),_(t,i),R(s,i,null),_(t,l),_(t,o),R(r,o,null),_(t,a),_(t,u),~f&&A[f].m(u,null),_(t,d),_(t,h),R(m,h,null),_(t,b),_(t,g),L&&L.m(g,null),_(t,y),V&&V.m(t,null),_(e,k),_(e,w),C=!0,M||(T=[U(e,"dragstart",$4),U(e,"submit",ut(n[32]))],M=!0)},p(F,W){const G={};W[0]&1&&(G.class="form-field required "+(F[0].id?"disabled":"")),W[0]&2&&(G.name="schema."+F[1]+".type"),W[0]&1|W[1]&12288&&(G.$$scope={dirty:W,ctx:F}),s.$set(G);const K={};W[0]&33&&(K.class=` + form-field + required + `+(F[5]?"":"invalid")+` + `+(F[0].id&&F[0].system?"disabled":"")+` + `),W[0]&2&&(K.name="schema."+F[1]+".name"),W[0]&33|W[1]&12288&&(K.$$scope={dirty:W,ctx:F}),r.$set(K);let X=f;f=P(F),f===X?~f&&A[f].p(F,W):(c&&(be(),I(A[X],1,1,()=>{A[X]=null}),ve()),~f?(c=A[f],c?c.p(F,W):(c=A[f]=D[f](F),c.c()),E(c,1),c.m(u,null)):c=null);const Z={};W[0]&1|W[1]&12288&&(Z.$$scope={dirty:W,ctx:F}),m.$set(Z),F[0].type!=="file"?L?(L.p(F,W),W[0]&1&&E(L,1)):(L=Vc(F),L.c(),E(L,1),L.m(g,null)):L&&(be(),I(L,1,1,()=>{L=null}),ve()),F[0].toDelete?V&&(be(),I(V,1,1,()=>{V=null}),ve()):V?(V.p(F,W),W[0]&1&&E(V,1)):(V=zc(F),V.c(),E(V,1),V.m(t,null))},i(F){C||(E(s.$$.fragment,F),E(r.$$.fragment,F),E(c),E(m.$$.fragment,F),E(L),E(V),C=!0)},o(F){I(s.$$.fragment,F),I(r.$$.fragment,F),I(c),I(m.$$.fragment,F),I(L),I(V),C=!1},d(F){F&&S(e),H(s),H(r),~f&&A[f].d(),H(m),L&&L.d(),V&&V.d(),M=!1,Re(T)}}}function Wc(n){let e,t,i,s,l=n[0].system&&Uc(),o=!n[0].id&&Yc(n),r=n[0].required&&Kc(),a=n[0].unique&&Jc();return{c(){e=v("div"),l&&l.c(),t=O(),o&&o.c(),i=O(),r&&r.c(),s=O(),a&&a.c(),p(e,"class","inline-flex")},m(u,f){$(u,e,f),l&&l.m(e,null),_(e,t),o&&o.m(e,null),_(e,i),r&&r.m(e,null),_(e,s),a&&a.m(e,null)},p(u,f){u[0].system?l||(l=Uc(),l.c(),l.m(e,t)):l&&(l.d(1),l=null),u[0].id?o&&(o.d(1),o=null):o?o.p(u,f):(o=Yc(u),o.c(),o.m(e,i)),u[0].required?r||(r=Kc(),r.c(),r.m(e,s)):r&&(r.d(1),r=null),u[0].unique?a||(a=Jc(),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},d(u){u&&S(e),l&&l.d(),o&&o.d(),r&&r.d(),a&&a.d()}}}function Uc(n){let e;return{c(){e=v("span"),e.textContent="System",p(e,"class","label label-danger")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function Yc(n){let e;return{c(){e=v("span"),e.textContent="New",p(e,"class","label"),ee(e,"label-warning",n[8]&&!n[0].toDelete)},m(t,i){$(t,e,i)},p(t,i){i[0]&257&&ee(e,"label-warning",t[8]&&!t[0].toDelete)},d(t){t&&S(e)}}}function Kc(n){let e;return{c(){e=v("span"),e.textContent="Nonempty",p(e,"class","label label-success")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function Jc(n){let e;return{c(){e=v("span"),e.textContent="Unique",p(e,"class","label label-success")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function Zc(n){let e,t,i,s,l;return{c(){e=v("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){$(o,e,r),i=!0,s||(l=Le(Be.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Qe(()=>{t||(t=je(e,$t,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=je(e,$t,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&S(e),o&&t&&t.end(),s=!1,l()}}}function Gc(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='Restore',p(e,"type","button"),p(e,"class","btn btn-sm btn-danger btn-secondary")},m(s,l){$(s,e,l),t||(i=U(e,"click",Yn(n[16])),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function w4(n){let e,t,i,s,l,o,r=(n[0].name||"-")+"",a,u,f,c,d,h,m,b,g,y=!n[0].toDelete&&Wc(n),k=n[7]&&!n[0].system&&Zc(),w=n[0].toDelete&&Gc(n);return{c(){e=v("div"),t=v("span"),i=v("i"),l=O(),o=v("strong"),a=z(r),f=O(),y&&y.c(),c=O(),d=v("div"),h=O(),k&&k.c(),m=O(),w&&w.c(),b=Fe(),p(i,"class",s=uo(B.getFieldTypeIcon(n[0].type))+" svelte-1tpxlm5"),p(t,"class","icon field-type"),p(o,"class","title field-name svelte-1tpxlm5"),p(o,"title",u=n[0].name),ee(o,"txt-strikethrough",n[0].toDelete),p(e,"class","inline-flex"),p(d,"class","flex-fill")},m(C,M){$(C,e,M),_(e,t),_(t,i),_(e,l),_(e,o),_(o,a),$(C,f,M),y&&y.m(C,M),$(C,c,M),$(C,d,M),$(C,h,M),k&&k.m(C,M),$(C,m,M),w&&w.m(C,M),$(C,b,M),g=!0},p(C,M){(!g||M[0]&1&&s!==(s=uo(B.getFieldTypeIcon(C[0].type))+" svelte-1tpxlm5"))&&p(i,"class",s),(!g||M[0]&1)&&r!==(r=(C[0].name||"-")+"")&&ue(a,r),(!g||M[0]&1&&u!==(u=C[0].name))&&p(o,"title",u),(!g||M[0]&1)&&ee(o,"txt-strikethrough",C[0].toDelete),C[0].toDelete?y&&(y.d(1),y=null):y?y.p(C,M):(y=Wc(C),y.c(),y.m(c.parentNode,c)),C[7]&&!C[0].system?k?M[0]&129&&E(k,1):(k=Zc(),k.c(),E(k,1),k.m(m.parentNode,m)):k&&(be(),I(k,1,1,()=>{k=null}),ve()),C[0].toDelete?w?w.p(C,M):(w=Gc(C),w.c(),w.m(b.parentNode,b)):w&&(w.d(1),w=null)},i(C){g||(E(k),g=!0)},o(C){I(k),g=!1},d(C){C&&S(e),C&&S(f),y&&y.d(C),C&&S(c),C&&S(d),C&&S(h),k&&k.d(C),C&&S(m),w&&w.d(C),C&&S(b)}}}function S4(n){let e,t;const i=[{draggable:!0},{single:!0},{interactive:n[8]},{class:n[2]||n[0].toDelete||n[0].system?"field-accordion disabled":"field-accordion"},n[11]];let s={$$slots:{header:[w4],default:[k4]},$$scope:{ctx:n}};for(let l=0;l{n.stopPropagation(),n.preventDefault(),n.stopImmediatePropagation()};function C4(n,e,t){let i,s,l,o;const r=["key","field","disabled","excludeNames","expand","collapse"];let a=wt(e,r),u;Je(n,wi,ce=>t(15,u=ce));const f=It();let{key:c="0"}=e,{field:d=new fn}=e,{disabled:h=!1}=e,{excludeNames:m=[]}=e,b,g=d.type;function y(){b==null||b.expand()}function k(){b==null||b.collapse()}function w(){d.id?t(0,d.toDelete=!0,d):(k(),f("remove"))}function C(ce){if(ce=(""+ce).toLowerCase(),!ce)return!1;for(const se of m)if(se.toLowerCase()===ce)return!1;return!0}function M(ce){return B.slugify(ce)}un(()=>{d.id||y()});const T=()=>{t(0,d.toDelete=!1,d)};function D(ce){n.$$.not_equal(d.type,ce)&&(d.type=ce,t(0,d),t(14,g),t(4,b))}const A=ce=>{t(0,d.name=M(ce.target.value),d),ce.target.value=d.name};function P(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function L(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function V(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function F(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function W(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function G(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function K(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function X(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function Z(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function ie(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function J(ce){n.$$.not_equal(d.options,ce)&&(d.options=ce,t(0,d),t(14,g),t(4,b))}function fe(){d.required=this.checked,t(0,d),t(14,g),t(4,b)}function Y(){d.unique=this.checked,t(0,d),t(14,g),t(4,b)}const re=()=>{i&&k()};function Oe(ce){le[ce?"unshift":"push"](()=>{b=ce,t(4,b)})}function ge(ce){Ve.call(this,n,ce)}function ae(ce){Ve.call(this,n,ce)}function pe(ce){Ve.call(this,n,ce)}function de(ce){Ve.call(this,n,ce)}function Se(ce){Ve.call(this,n,ce)}function ye(ce){Ve.call(this,n,ce)}function We(ce){Ve.call(this,n,ce)}return n.$$set=ce=>{e=Ye(Ye({},e),Un(ce)),t(11,a=wt(e,r)),"key"in ce&&t(1,c=ce.key),"field"in ce&&t(0,d=ce.field),"disabled"in ce&&t(2,h=ce.disabled),"excludeNames"in ce&&t(12,m=ce.excludeNames)},n.$$.update=()=>{n.$$.dirty[0]&16385&&g!=d.type&&(t(14,g=d.type),t(0,d.options={},d),t(0,d.unique=!1,d)),n.$$.dirty[0]&17&&d.toDelete&&(b&&k(),d.originalName&&d.name!==d.originalName&&t(0,d.name=d.originalName,d)),n.$$.dirty[0]&1&&!d.originalName&&d.name&&t(0,d.originalName=d.name,d),n.$$.dirty[0]&1&&typeof d.toDelete>"u"&&t(0,d.toDelete=!1,d),n.$$.dirty[0]&1&&d.required&&t(0,d.nullable=!1,d),n.$$.dirty[0]&1&&t(6,i=!B.isEmpty(d.name)&&d.type),n.$$.dirty[0]&80&&(i||b&&y()),n.$$.dirty[0]&69&&t(8,s=!h&&!d.system&&!d.toDelete&&i),n.$$.dirty[0]&1&&t(5,l=C(d.name)),n.$$.dirty[0]&32802&&t(7,o=!l||!B.isEmpty(B.getNestedVal(u,`schema.${c}`)))},[d,c,h,k,b,l,i,o,s,w,M,a,m,y,g,u,T,D,A,P,L,V,F,W,G,K,X,Z,ie,J,fe,Y,re,Oe,ge,ae,pe,de,Se,ye,We]}class M4 extends Me{constructor(e){super(),Ce(this,e,C4,S4,we,{key:1,field:0,disabled:2,excludeNames:12,expand:13,collapse:3},null,[-1,-1])}get expand(){return this.$$.ctx[13]}get collapse(){return this.$$.ctx[3]}}function Xc(n,e,t){const i=n.slice();return i[13]=e[t],i[14]=e,i[15]=t,i}function Qc(n){let e,t,i,s,l,o,r,a;return{c(){e=z(`, + `),t=v("code"),t.textContent="username",i=z(` , + `),s=v("code"),s.textContent="email",l=z(` , + `),o=v("code"),o.textContent="emailVisibility",r=z(` , + `),a=v("code"),a.textContent="verified",p(t,"class","txt-sm"),p(s,"class","txt-sm"),p(o,"class","txt-sm"),p(a,"class","txt-sm")},m(u,f){$(u,e,f),$(u,t,f),$(u,i,f),$(u,s,f),$(u,l,f),$(u,o,f),$(u,r,f),$(u,a,f)},d(u){u&&S(e),u&&S(t),u&&S(i),u&&S(s),u&&S(l),u&&S(o),u&&S(r),u&&S(a)}}}function xc(n,e){let t,i,s,l;function o(c){e[6](c,e[13],e[14],e[15])}function r(){return e[7](e[15])}function a(...c){return e[8](e[15],...c)}function u(...c){return e[9](e[15],...c)}let f={key:e[15],excludeNames:e[1].concat(e[4](e[13]))};return e[13]!==void 0&&(f.field=e[13]),i=new M4({props:f}),le.push(()=>ke(i,"field",o)),i.$on("remove",r),i.$on("dragstart",a),i.$on("drop",u),{key:n,first:null,c(){t=Fe(),j(i.$$.fragment),this.first=t},m(c,d){$(c,t,d),R(i,c,d),l=!0},p(c,d){e=c;const h={};d&1&&(h.key=e[15]),d&3&&(h.excludeNames=e[1].concat(e[4](e[13]))),!s&&d&1&&(s=!0,h.field=e[13],$e(()=>s=!1)),i.$set(h)},i(c){l||(E(i.$$.fragment,c),l=!0)},o(c){I(i.$$.fragment,c),l=!1},d(c){c&&S(t),H(i,c)}}}function T4(n){let e,t,i,s,l,o,r,a,u,f,c,d,h=[],m=new Map,b,g,y,k,w,C,M,T,D,A,P,L=n[0].isAuth&&Qc(),V=n[0].schema;const F=W=>W[15]+W[13].id;for(let W=0;Wy.name===g)}function f(g){let y=[];if(g.toDelete)return y;for(let k of i.schema)k===g||k.toDelete||y.push(k.name);return y}function c(g,y){if(!g)return;g.dataTransfer.dropEffect="move";const k=parseInt(g.dataTransfer.getData("text/plain")),w=i.schema;ko(g),m=(g,y)=>O4(y==null?void 0:y.detail,g),b=(g,y)=>c(y==null?void 0:y.detail,g);return n.$$set=g=>{"collection"in g&&t(0,i=g.collection)},n.$$.update=()=>{n.$$.dirty&1&&typeof(i==null?void 0:i.schema)>"u"&&(t(0,i=i||{}),t(0,i.schema=[],i)),n.$$.dirty&1&&(i.isAuth?t(1,l=s.concat(["username","email","emailVisibility","verified","tokenKey","passwordHash","lastResetSentAt","lastVerificationSentAt","password","passwordConfirm","oldPassword"])):t(1,l=s.slice(0)))},[i,l,o,r,f,c,d,h,m,b]}class E4 extends Me{constructor(e){super(),Ce(this,e,D4,T4,we,{collection:0})}}const A4=n=>({isAdminOnly:n&512}),ed=n=>({isAdminOnly:n[9]});function I4(n){let e,t,i,s;function l(a,u){return a[9]?N4:L4}let o=l(n),r=o(n);return i=new _e({props:{class:"form-field rule-field m-0 "+(n[4]?"requied":"")+" "+(n[9]?"disabled":""),name:n[3],$$slots:{default:[j4,({uniqueId:a})=>({17:a}),({uniqueId:a})=>a?131072:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),r.c(),t=O(),j(i.$$.fragment),p(e,"class","rule-block svelte-fjxz7k")},m(a,u){$(a,e,u),r.m(e,null),_(e,t),R(i,e,null),s=!0},p(a,u){o===(o=l(a))&&r?r.p(a,u):(r.d(1),r=o(a),r&&(r.c(),r.m(e,t)));const f={};u&528&&(f.class="form-field rule-field m-0 "+(a[4]?"requied":"")+" "+(a[9]?"disabled":"")),u&8&&(f.name=a[3]),u&164519&&(f.$$scope={dirty:u,ctx:a}),i.$set(f)},i(a){s||(E(i.$$.fragment,a),s=!0)},o(a){I(i.$$.fragment,a),s=!1},d(a){a&&S(e),r.d(),H(i)}}}function P4(n){let e;return{c(){e=v("div"),e.innerHTML='',p(e,"class","txt-center")},m(t,i){$(t,e,i)},p:x,i:x,o:x,d(t){t&&S(e)}}}function L4(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","rule-toggle-btn btn btn-circle btn-outline svelte-fjxz7k")},m(s,l){$(s,e,l),t||(i=[Le(Be.call(null,e,{text:"Lock and set to Admins only",position:"left"})),U(e,"click",n[12])],t=!0)},p:x,d(s){s&&S(e),t=!1,Re(i)}}}function N4(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","rule-toggle-btn btn btn-circle btn-outline btn-success svelte-fjxz7k")},m(s,l){$(s,e,l),t||(i=[Le(Be.call(null,e,{text:"Unlock and set custom rule",position:"left"})),U(e,"click",n[11])],t=!0)},p:x,d(s){s&&S(e),t=!1,Re(i)}}}function F4(n){let e;return{c(){e=z("Leave empty to grant everyone access")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function R4(n){let e;return{c(){e=z("Only admins will be able to perform this action (unlock to change)")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function H4(n){let e;function t(l,o){return l[9]?R4:F4}let i=t(n),s=i(n);return{c(){e=v("p"),s.c()},m(l,o){$(l,e,o),s.m(e,null)},p(l,o){i!==(i=t(l))&&(s.d(1),s=i(l),s&&(s.c(),s.m(e,null)))},d(l){l&&S(e),s.d()}}}function j4(n){let e,t,i,s=n[9]?"Admins only":"Custom rule",l,o,r,a,u,f,c,d;function h(w){n[14](w)}var m=n[7];function b(w){let C={id:w[17],baseCollection:w[1],disabled:w[9]};return w[0]!==void 0&&(C.value=w[0]),{props:C}}m&&(a=Qt(m,b(n)),n[13](a),le.push(()=>ke(a,"value",h)));const g=n[10].default,y=Ot(g,n,n[15],ed),k=y||H4(n);return{c(){e=v("label"),t=z(n[2]),i=z(" - "),l=z(s),r=O(),a&&j(a.$$.fragment),f=O(),c=v("div"),k&&k.c(),p(e,"for",o=n[17]),p(c,"class","help-block")},m(w,C){$(w,e,C),_(e,t),_(e,i),_(e,l),$(w,r,C),a&&R(a,w,C),$(w,f,C),$(w,c,C),k&&k.m(c,null),d=!0},p(w,C){(!d||C&4)&&ue(t,w[2]),(!d||C&512)&&s!==(s=w[9]?"Admins only":"Custom rule")&&ue(l,s),(!d||C&131072&&o!==(o=w[17]))&&p(e,"for",o);const M={};if(C&131072&&(M.id=w[17]),C&2&&(M.baseCollection=w[1]),C&512&&(M.disabled=w[9]),!u&&C&1&&(u=!0,M.value=w[0],$e(()=>u=!1)),m!==(m=w[7])){if(a){be();const T=a;I(T.$$.fragment,1,0,()=>{H(T,1)}),ve()}m?(a=Qt(m,b(w)),w[13](a),le.push(()=>ke(a,"value",h)),j(a.$$.fragment),E(a.$$.fragment,1),R(a,f.parentNode,f)):a=null}else m&&a.$set(M);y?y.p&&(!d||C&33280)&&Et(y,g,w,w[15],d?Dt(g,w[15],C,A4):At(w[15]),ed):k&&k.p&&(!d||C&512)&&k.p(w,d?C:-1)},i(w){d||(a&&E(a.$$.fragment,w),E(k,w),d=!0)},o(w){a&&I(a.$$.fragment,w),I(k,w),d=!1},d(w){w&&S(e),w&&S(r),n[13](null),a&&H(a,w),w&&S(f),w&&S(c),k&&k.d(w)}}}function q4(n){let e,t,i,s;const l=[P4,I4],o=[];function r(a,u){return a[8]?0:1}return e=r(n),t=o[e]=l[e](n),{c(){t.c(),i=Fe()},m(a,u){o[e].m(a,u),$(a,i,u),s=!0},p(a,[u]){let f=e;e=r(a),e===f?o[e].p(a,u):(be(),I(o[f],1,1,()=>{o[f]=null}),ve(),t=o[e],t?t.p(a,u):(t=o[e]=l[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){s||(E(t),s=!0)},o(a){I(t),s=!1},d(a){o[e].d(a),a&&S(i)}}}let td;function V4(n,e,t){let i,{$$slots:s={},$$scope:l}=e,{collection:o=null}=e,{rule:r=null}=e,{label:a="Rule"}=e,{formKey:u="rule"}=e,{required:f=!1}=e,c=null,d=null,h=td,m=!1;async function b(){h||m||(t(8,m=!0),t(7,h=(await st(()=>import("./FilterAutocompleteInput.7da1d2a3.js"),["./FilterAutocompleteInput.7da1d2a3.js","./index.9c8b95cd.js"],import.meta.url)).default),td=h,t(8,m=!1))}b();const g=async()=>{t(0,r=d||""),await $n(),c==null||c.focus()},y=()=>{t(6,d=r),t(0,r=null)};function k(C){le[C?"unshift":"push"](()=>{c=C,t(5,c)})}function w(C){r=C,t(0,r)}return n.$$set=C=>{"collection"in C&&t(1,o=C.collection),"rule"in C&&t(0,r=C.rule),"label"in C&&t(2,a=C.label),"formKey"in C&&t(3,u=C.formKey),"required"in C&&t(4,f=C.required),"$$scope"in C&&t(15,l=C.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&t(9,i=r===null)},[r,o,a,u,f,c,d,h,m,i,s,g,y,k,w,l]}class ds extends Me{constructor(e){super(),Ce(this,e,V4,q4,we,{collection:1,rule:0,label:2,formKey:3,required:4})}}function nd(n,e,t){const i=n.slice();return i[9]=e[t],i}function id(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M,T,D,A,P,L,V,F,W,G,K=n[0].schema,X=[];for(let Z=0;Z@request filter:",y=O(),k=v("div"),k.innerHTML=`@request.method + @request.query.* + @request.data.* + @request.auth.*`,w=O(),C=v("hr"),M=O(),T=v("p"),T.innerHTML="You could also add constraints and query other collections using the @collection filter:",D=O(),A=v("div"),A.innerHTML="@collection.ANY_COLLECTION_NAME.*",P=O(),L=v("hr"),V=O(),F=v("p"),F.innerHTML=`Example rule: +
    + @request.auth.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(g,"class","m-b-0"),p(k,"class","inline-flex flex-gap-5"),p(C,"class","m-t-10 m-b-5"),p(T,"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(Z,ie){$(Z,e,ie),_(e,t),_(t,i),_(i,s),_(i,l),_(i,o),_(o,r),_(o,a),_(o,u),_(o,f),_(o,c),_(o,d);for(let J=0;J{W||(W=je(e,St,{duration:150},!0)),W.run(1)}),G=!0)},o(Z){Z&&(W||(W=je(e,St,{duration:150},!1)),W.run(0)),G=!1},d(Z){Z&&S(e),Tt(X,Z),Z&&W&&W.end()}}}function z4(n){let e,t=n[9].name+"",i;return{c(){e=v("code"),i=z(t)},m(s,l){$(s,e,l),_(e,i)},p(s,l){l&1&&t!==(t=s[9].name+"")&&ue(i,t)},d(s){s&&S(e)}}}function B4(n){let e,t=n[9].name+"",i,s;return{c(){e=v("code"),i=z(t),s=z(".*")},m(l,o){$(l,e,o),_(e,i),_(e,s)},p(l,o){o&1&&t!==(t=l[9].name+"")&&ue(i,t)},d(l){l&&S(e)}}}function sd(n){let e;function t(l,o){return l[9].type==="relation"||l[9].type==="user"?B4:z4}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&S(e)}}}function ld(n){let e,t,i,s,l;function o(a){n[8](a)}let r={label:"Manage action",formKey:"options.manageRule",collection:n[0],$$slots:{default:[W4]},$$scope:{ctx:n}};return n[0].options.manageRule!==void 0&&(r.rule=n[0].options.manageRule),i=new ds({props:r}),le.push(()=>ke(i,"rule",o)),{c(){e=v("hr"),t=O(),j(i.$$.fragment),p(e,"class","m-t-sm m-b-sm")},m(a,u){$(a,e,u),$(a,t,u),R(i,a,u),l=!0},p(a,u){const f={};u&1&&(f.collection=a[0]),u&4096&&(f.$$scope={dirty:u,ctx:a}),!s&&u&1&&(s=!0,f.rule=a[0].options.manageRule,$e(()=>s=!1)),i.$set(f)},i(a){l||(E(i.$$.fragment,a),l=!0)},o(a){I(i.$$.fragment,a),l=!1},d(a){a&&S(e),a&&S(t),H(i,a)}}}function W4(n){let e,t,i;return{c(){e=v("p"),e.textContent=`This API rule gives admin-like permissions to allow fully managing the auth record(s), eg. + changing the password without requiring to enter the old one, directly updating the verified + state or email, etc.`,t=O(),i=v("p"),i.innerHTML="This rule is executed in addition to the create and update API rules."},m(s,l){$(s,e,l),$(s,t,l),$(s,i,l)},p:x,d(s){s&&S(e),s&&S(t),s&&S(i)}}}function U4(n){var te;let e,t,i,s,l,o=n[1]?"Hide available fields":"Show available fields",r,a,u,f,c,d,h,m,b,g,y,k,w,C,M,T,D,A,P,L,V,F,W,G,K,X,Z,ie,J,fe,Y=n[1]&&id(n);function re(ne){n[3](ne)}let Oe={label:"List/Search action",formKey:"listRule",collection:n[0]};n[0].listRule!==void 0&&(Oe.rule=n[0].listRule),f=new ds({props:Oe}),le.push(()=>ke(f,"rule",re));function ge(ne){n[4](ne)}let ae={label:"View action",formKey:"viewRule",collection:n[0]};n[0].viewRule!==void 0&&(ae.rule=n[0].viewRule),b=new ds({props:ae}),le.push(()=>ke(b,"rule",ge));function pe(ne){n[5](ne)}let de={label:"Create action",formKey:"createRule",collection:n[0]};n[0].createRule!==void 0&&(de.rule=n[0].createRule),C=new ds({props:de}),le.push(()=>ke(C,"rule",pe));function Se(ne){n[6](ne)}let ye={label:"Update action",formKey:"updateRule",collection:n[0]};n[0].updateRule!==void 0&&(ye.rule=n[0].updateRule),P=new ds({props:ye}),le.push(()=>ke(P,"rule",Se));function We(ne){n[7](ne)}let ce={label:"Delete action",formKey:"deleteRule",collection:n[0]};n[0].deleteRule!==void 0&&(ce.rule=n[0].deleteRule),G=new ds({props:ce}),le.push(()=>ke(G,"rule",We));let se=((te=n[0])==null?void 0:te.isAuth)&&ld(n);return{c(){e=v("div"),t=v("div"),i=v("p"),i.innerHTML=`All rules follow the +
    PocketBase filter syntax and operators + .`,s=O(),l=v("span"),r=z(o),a=O(),Y&&Y.c(),u=O(),j(f.$$.fragment),d=O(),h=v("hr"),m=O(),j(b.$$.fragment),y=O(),k=v("hr"),w=O(),j(C.$$.fragment),T=O(),D=v("hr"),A=O(),j(P.$$.fragment),V=O(),F=v("hr"),W=O(),j(G.$$.fragment),X=O(),se&&se.c(),Z=Fe(),p(l,"class","expand-handle txt-sm txt-bold txt-nowrap link-hint"),p(t,"class","flex txt-sm m-b-5"),p(e,"class","block m-b-base"),p(h,"class","m-t-sm m-b-sm"),p(k,"class","m-t-sm m-b-sm"),p(D,"class","m-t-sm m-b-sm"),p(F,"class","m-t-sm m-b-sm")},m(ne,Ee){$(ne,e,Ee),_(e,t),_(t,i),_(t,s),_(t,l),_(l,r),_(e,a),Y&&Y.m(e,null),$(ne,u,Ee),R(f,ne,Ee),$(ne,d,Ee),$(ne,h,Ee),$(ne,m,Ee),R(b,ne,Ee),$(ne,y,Ee),$(ne,k,Ee),$(ne,w,Ee),R(C,ne,Ee),$(ne,T,Ee),$(ne,D,Ee),$(ne,A,Ee),R(P,ne,Ee),$(ne,V,Ee),$(ne,F,Ee),$(ne,W,Ee),R(G,ne,Ee),$(ne,X,Ee),se&&se.m(ne,Ee),$(ne,Z,Ee),ie=!0,J||(fe=U(l,"click",n[2]),J=!0)},p(ne,[Ee]){var Mi;(!ie||Ee&2)&&o!==(o=ne[1]?"Hide available fields":"Show available fields")&&ue(r,o),ne[1]?Y?(Y.p(ne,Ee),Ee&2&&E(Y,1)):(Y=id(ne),Y.c(),E(Y,1),Y.m(e,null)):Y&&(be(),I(Y,1,1,()=>{Y=null}),ve());const it={};Ee&1&&(it.collection=ne[0]),!c&&Ee&1&&(c=!0,it.rule=ne[0].listRule,$e(()=>c=!1)),f.$set(it);const en={};Ee&1&&(en.collection=ne[0]),!g&&Ee&1&&(g=!0,en.rule=ne[0].viewRule,$e(()=>g=!1)),b.$set(en);const Yt={};Ee&1&&(Yt.collection=ne[0]),!M&&Ee&1&&(M=!0,Yt.rule=ne[0].createRule,$e(()=>M=!1)),C.$set(Yt);const tn={};Ee&1&&(tn.collection=ne[0]),!L&&Ee&1&&(L=!0,tn.rule=ne[0].updateRule,$e(()=>L=!1)),P.$set(tn);const Gn={};Ee&1&&(Gn.collection=ne[0]),!K&&Ee&1&&(K=!0,Gn.rule=ne[0].deleteRule,$e(()=>K=!1)),G.$set(Gn),(Mi=ne[0])!=null&&Mi.isAuth?se?(se.p(ne,Ee),Ee&1&&E(se,1)):(se=ld(ne),se.c(),E(se,1),se.m(Z.parentNode,Z)):se&&(be(),I(se,1,1,()=>{se=null}),ve())},i(ne){ie||(E(Y),E(f.$$.fragment,ne),E(b.$$.fragment,ne),E(C.$$.fragment,ne),E(P.$$.fragment,ne),E(G.$$.fragment,ne),E(se),ie=!0)},o(ne){I(Y),I(f.$$.fragment,ne),I(b.$$.fragment,ne),I(C.$$.fragment,ne),I(P.$$.fragment,ne),I(G.$$.fragment,ne),I(se),ie=!1},d(ne){ne&&S(e),Y&&Y.d(),ne&&S(u),H(f,ne),ne&&S(d),ne&&S(h),ne&&S(m),H(b,ne),ne&&S(y),ne&&S(k),ne&&S(w),H(C,ne),ne&&S(T),ne&&S(D),ne&&S(A),H(P,ne),ne&&S(V),ne&&S(F),ne&&S(W),H(G,ne),ne&&S(X),se&&se.d(ne),ne&&S(Z),J=!1,fe()}}}function Y4(n,e,t){let{collection:i=new Pn}=e,s=!1;const l=()=>t(1,s=!s);function o(d){n.$$.not_equal(i.listRule,d)&&(i.listRule=d,t(0,i))}function r(d){n.$$.not_equal(i.viewRule,d)&&(i.viewRule=d,t(0,i))}function a(d){n.$$.not_equal(i.createRule,d)&&(i.createRule=d,t(0,i))}function u(d){n.$$.not_equal(i.updateRule,d)&&(i.updateRule=d,t(0,i))}function f(d){n.$$.not_equal(i.deleteRule,d)&&(i.deleteRule=d,t(0,i))}function c(d){n.$$.not_equal(i.options.manageRule,d)&&(i.options.manageRule=d,t(0,i))}return n.$$set=d=>{"collection"in d&&t(0,i=d.collection)},[i,s,l,o,r,a,u,f,c]}class K4 extends Me{constructor(e){super(),Ce(this,e,Y4,U4,we,{collection:0})}}function J4(n){let e,t,i,s,l,o,r,a;return{c(){e=v("input"),i=O(),s=v("label"),l=z("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[12]),p(s,"for",o=n[12])},m(u,f){$(u,e,f),e.checked=n[0].options.allowUsernameAuth,$(u,i,f),$(u,s,f),_(s,l),r||(a=U(e,"change",n[5]),r=!0)},p(u,f){f&4096&&t!==(t=u[12])&&p(e,"id",t),f&1&&(e.checked=u[0].options.allowUsernameAuth),f&4096&&o!==(o=u[12])&&p(s,"for",o)},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,a()}}}function Z4(n){let e,t;return e=new _e({props:{class:"form-field form-field-toggle m-b-0",name:"options.allowUsernameAuth",$$slots:{default:[J4,({uniqueId:i})=>({12:i}),({uniqueId:i})=>i?4096:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s&12289&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function G4(n){let e;return{c(){e=v("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function X4(n){let e;return{c(){e=v("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function od(n){let e,t,i,s,l;return{c(){e=v("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){$(o,e,r),i=!0,s||(l=Le(Be.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Qe(()=>{t||(t=je(e,$t,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=je(e,$t,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&S(e),o&&t&&t.end(),s=!1,l()}}}function Q4(n){let e,t,i,s,l,o,r;function a(d,h){return d[0].options.allowUsernameAuth?X4:G4}let u=a(n),f=u(n),c=n[3]&&od();return{c(){e=v("div"),e.innerHTML=` + Username/Password`,t=O(),i=v("div"),s=O(),f.c(),l=O(),c&&c.c(),o=Fe(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(d,h){$(d,e,h),$(d,t,h),$(d,i,h),$(d,s,h),f.m(d,h),$(d,l,h),c&&c.m(d,h),$(d,o,h),r=!0},p(d,h){u!==(u=a(d))&&(f.d(1),f=u(d),f&&(f.c(),f.m(l.parentNode,l))),d[3]?c?h&8&&E(c,1):(c=od(),c.c(),E(c,1),c.m(o.parentNode,o)):c&&(be(),I(c,1,1,()=>{c=null}),ve())},i(d){r||(E(c),r=!0)},o(d){I(c),r=!1},d(d){d&&S(e),d&&S(t),d&&S(i),d&&S(s),f.d(d),d&&S(l),c&&c.d(d),d&&S(o)}}}function x4(n){let e,t,i,s,l,o,r,a;return{c(){e=v("input"),i=O(),s=v("label"),l=z("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[12]),p(s,"for",o=n[12])},m(u,f){$(u,e,f),e.checked=n[0].options.allowEmailAuth,$(u,i,f),$(u,s,f),_(s,l),r||(a=U(e,"change",n[6]),r=!0)},p(u,f){f&4096&&t!==(t=u[12])&&p(e,"id",t),f&1&&(e.checked=u[0].options.allowEmailAuth),f&4096&&o!==(o=u[12])&&p(s,"for",o)},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,a()}}}function rd(n){let e,t,i,s,l,o,r,a;return i=new _e({props:{class:"form-field "+(B.isEmpty(n[0].options.onlyEmailDomains)?"":"disabled"),name:"options.exceptEmailDomains",$$slots:{default:[eC,({uniqueId:u})=>({12:u}),({uniqueId:u})=>u?4096:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field "+(B.isEmpty(n[0].options.exceptEmailDomains)?"":"disabled"),name:"options.onlyEmailDomains",$$slots:{default:[tC,({uniqueId:u})=>({12:u}),({uniqueId:u})=>u?4096:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),p(t,"class","col-lg-6"),p(l,"class","col-lg-6"),p(e,"class","grid grid-sm p-t-sm")},m(u,f){$(u,e,f),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),a=!0},p(u,f){const c={};f&1&&(c.class="form-field "+(B.isEmpty(u[0].options.onlyEmailDomains)?"":"disabled")),f&12289&&(c.$$scope={dirty:f,ctx:u}),i.$set(c);const d={};f&1&&(d.class="form-field "+(B.isEmpty(u[0].options.exceptEmailDomains)?"":"disabled")),f&12289&&(d.$$scope={dirty:f,ctx:u}),o.$set(d)},i(u){a||(E(i.$$.fragment,u),E(o.$$.fragment,u),u&&Qe(()=>{r||(r=je(e,St,{duration:150},!0)),r.run(1)}),a=!0)},o(u){I(i.$$.fragment,u),I(o.$$.fragment,u),u&&(r||(r=je(e,St,{duration:150},!1)),r.run(0)),a=!1},d(u){u&&S(e),H(i),H(o),u&&r&&r.end()}}}function eC(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function m(g){n[7](g)}let b={id:n[12],disabled:!B.isEmpty(n[0].options.onlyEmailDomains)};return n[0].options.exceptEmailDomains!==void 0&&(b.value=n[0].options.exceptEmailDomains),r=new xi({props:b}),le.push(()=>ke(r,"value",m)),{c(){e=v("label"),t=v("span"),t.textContent="Except domains",i=O(),s=v("i"),o=O(),j(r.$$.fragment),u=O(),f=v("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[12]),p(f,"class","help-block")},m(g,y){$(g,e,y),_(e,t),_(e,i),_(e,s),$(g,o,y),R(r,g,y),$(g,u,y),$(g,f,y),c=!0,d||(h=Le(Be.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(g,y){(!c||y&4096&&l!==(l=g[12]))&&p(e,"for",l);const k={};y&4096&&(k.id=g[12]),y&1&&(k.disabled=!B.isEmpty(g[0].options.onlyEmailDomains)),!a&&y&1&&(a=!0,k.value=g[0].options.exceptEmailDomains,$e(()=>a=!1)),r.$set(k)},i(g){c||(E(r.$$.fragment,g),c=!0)},o(g){I(r.$$.fragment,g),c=!1},d(g){g&&S(e),g&&S(o),H(r,g),g&&S(u),g&&S(f),d=!1,h()}}}function tC(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function m(g){n[8](g)}let b={id:n[12],disabled:!B.isEmpty(n[0].options.exceptEmailDomains)};return n[0].options.onlyEmailDomains!==void 0&&(b.value=n[0].options.onlyEmailDomains),r=new xi({props:b}),le.push(()=>ke(r,"value",m)),{c(){e=v("label"),t=v("span"),t.textContent="Only domains",i=O(),s=v("i"),o=O(),j(r.$$.fragment),u=O(),f=v("div"),f.textContent="Use comma as separator.",p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[12]),p(f,"class","help-block")},m(g,y){$(g,e,y),_(e,t),_(e,i),_(e,s),$(g,o,y),R(r,g,y),$(g,u,y),$(g,f,y),c=!0,d||(h=Le(Be.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(g,y){(!c||y&4096&&l!==(l=g[12]))&&p(e,"for",l);const k={};y&4096&&(k.id=g[12]),y&1&&(k.disabled=!B.isEmpty(g[0].options.exceptEmailDomains)),!a&&y&1&&(a=!0,k.value=g[0].options.onlyEmailDomains,$e(()=>a=!1)),r.$set(k)},i(g){c||(E(r.$$.fragment,g),c=!0)},o(g){I(r.$$.fragment,g),c=!1},d(g){g&&S(e),g&&S(o),H(r,g),g&&S(u),g&&S(f),d=!1,h()}}}function nC(n){let e,t,i,s;e=new _e({props:{class:"form-field form-field-toggle m-0",name:"options.allowEmailAuth",$$slots:{default:[x4,({uniqueId:o})=>({12:o}),({uniqueId:o})=>o?4096:0]},$$scope:{ctx:n}}});let l=n[0].options.allowEmailAuth&&rd(n);return{c(){j(e.$$.fragment),t=O(),l&&l.c(),i=Fe()},m(o,r){R(e,o,r),$(o,t,r),l&&l.m(o,r),$(o,i,r),s=!0},p(o,r){const a={};r&12289&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].options.allowEmailAuth?l?(l.p(o,r),r&1&&E(l,1)):(l=rd(o),l.c(),E(l,1),l.m(i.parentNode,i)):l&&(be(),I(l,1,1,()=>{l=null}),ve())},i(o){s||(E(e.$$.fragment,o),E(l),s=!0)},o(o){I(e.$$.fragment,o),I(l),s=!1},d(o){H(e,o),o&&S(t),l&&l.d(o),o&&S(i)}}}function iC(n){let e;return{c(){e=v("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function sC(n){let e;return{c(){e=v("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function ad(n){let e,t,i,s,l;return{c(){e=v("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){$(o,e,r),i=!0,s||(l=Le(Be.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Qe(()=>{t||(t=je(e,$t,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=je(e,$t,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&S(e),o&&t&&t.end(),s=!1,l()}}}function lC(n){let e,t,i,s,l,o,r;function a(d,h){return d[0].options.allowEmailAuth?sC:iC}let u=a(n),f=u(n),c=n[2]&&ad();return{c(){e=v("div"),e.innerHTML=` + Email/Password`,t=O(),i=v("div"),s=O(),f.c(),l=O(),c&&c.c(),o=Fe(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(d,h){$(d,e,h),$(d,t,h),$(d,i,h),$(d,s,h),f.m(d,h),$(d,l,h),c&&c.m(d,h),$(d,o,h),r=!0},p(d,h){u!==(u=a(d))&&(f.d(1),f=u(d),f&&(f.c(),f.m(l.parentNode,l))),d[2]?c?h&4&&E(c,1):(c=ad(),c.c(),E(c,1),c.m(o.parentNode,o)):c&&(be(),I(c,1,1,()=>{c=null}),ve())},i(d){r||(E(c),r=!0)},o(d){I(c),r=!1},d(d){d&&S(e),d&&S(t),d&&S(i),d&&S(s),f.d(d),d&&S(l),c&&c.d(d),d&&S(o)}}}function oC(n){let e,t,i,s,l,o,r,a;return{c(){e=v("input"),i=O(),s=v("label"),l=z("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[12]),p(s,"for",o=n[12])},m(u,f){$(u,e,f),e.checked=n[0].options.allowOAuth2Auth,$(u,i,f),$(u,s,f),_(s,l),r||(a=U(e,"change",n[9]),r=!0)},p(u,f){f&4096&&t!==(t=u[12])&&p(e,"id",t),f&1&&(e.checked=u[0].options.allowOAuth2Auth),f&4096&&o!==(o=u[12])&&p(s,"for",o)},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,a()}}}function ud(n){let e,t,i;return{c(){e=v("div"),e.innerHTML='',p(e,"class","block")},m(s,l){$(s,e,l),i=!0},i(s){i||(s&&Qe(()=>{t||(t=je(e,St,{duration:150},!0)),t.run(1)}),i=!0)},o(s){s&&(t||(t=je(e,St,{duration:150},!1)),t.run(0)),i=!1},d(s){s&&S(e),s&&t&&t.end()}}}function rC(n){let e,t,i,s;e=new _e({props:{class:"form-field form-field-toggle m-b-0",name:"options.allowOAuth2Auth",$$slots:{default:[oC,({uniqueId:o})=>({12:o}),({uniqueId:o})=>o?4096:0]},$$scope:{ctx:n}}});let l=n[0].options.allowOAuth2Auth&&ud();return{c(){j(e.$$.fragment),t=O(),l&&l.c(),i=Fe()},m(o,r){R(e,o,r),$(o,t,r),l&&l.m(o,r),$(o,i,r),s=!0},p(o,r){const a={};r&12289&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].options.allowOAuth2Auth?l?r&1&&E(l,1):(l=ud(),l.c(),E(l,1),l.m(i.parentNode,i)):l&&(be(),I(l,1,1,()=>{l=null}),ve())},i(o){s||(E(e.$$.fragment,o),E(l),s=!0)},o(o){I(e.$$.fragment,o),I(l),s=!1},d(o){H(e,o),o&&S(t),l&&l.d(o),o&&S(i)}}}function aC(n){let e;return{c(){e=v("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function uC(n){let e;return{c(){e=v("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function fd(n){let e,t,i,s,l;return{c(){e=v("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){$(o,e,r),i=!0,s||(l=Le(Be.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Qe(()=>{t||(t=je(e,$t,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=je(e,$t,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&S(e),o&&t&&t.end(),s=!1,l()}}}function fC(n){let e,t,i,s,l,o,r;function a(d,h){return d[0].options.allowOAuth2Auth?uC:aC}let u=a(n),f=u(n),c=n[1]&&fd();return{c(){e=v("div"),e.innerHTML=` + OAuth2`,t=O(),i=v("div"),s=O(),f.c(),l=O(),c&&c.c(),o=Fe(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(d,h){$(d,e,h),$(d,t,h),$(d,i,h),$(d,s,h),f.m(d,h),$(d,l,h),c&&c.m(d,h),$(d,o,h),r=!0},p(d,h){u!==(u=a(d))&&(f.d(1),f=u(d),f&&(f.c(),f.m(l.parentNode,l))),d[1]?c?h&2&&E(c,1):(c=fd(),c.c(),E(c,1),c.m(o.parentNode,o)):c&&(be(),I(c,1,1,()=>{c=null}),ve())},i(d){r||(E(c),r=!0)},o(d){I(c),r=!1},d(d){d&&S(e),d&&S(t),d&&S(i),d&&S(s),f.d(d),d&&S(l),c&&c.d(d),d&&S(o)}}}function cC(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Minimum password length"),s=O(),l=v("input"),p(e,"for",i=n[12]),p(l,"type","number"),p(l,"id",o=n[12]),l.required=!0,p(l,"min","6"),p(l,"max","72")},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].options.minPasswordLength),r||(a=U(l,"input",n[10]),r=!0)},p(u,f){f&4096&&i!==(i=u[12])&&p(e,"for",i),f&4096&&o!==(o=u[12])&&p(l,"id",o),f&1&&rt(l.value)!==u[0].options.minPasswordLength&&he(l,u[0].options.minPasswordLength)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function dC(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("input"),i=O(),s=v("label"),l=v("span"),l.textContent="Always require email",o=O(),r=v("i"),p(e,"type","checkbox"),p(e,"id",t=n[12]),p(l,"class","txt"),p(r,"class","ri-information-line txt-sm link-hint"),p(s,"for",a=n[12])},m(c,d){$(c,e,d),e.checked=n[0].options.requireEmail,$(c,i,d),$(c,s,d),_(s,l),_(s,o),_(s,r),u||(f=[U(e,"change",n[11]),Le(Be.call(null,r,{text:`The constraint is applied only for new records. +Also note that some OAuth2 providers (like Twitter), don't return an email and the authentication may fail if the email field is required.`,position:"right"}))],u=!0)},p(c,d){d&4096&&t!==(t=c[12])&&p(e,"id",t),d&1&&(e.checked=c[0].options.requireEmail),d&4096&&a!==(a=c[12])&&p(s,"for",a)},d(c){c&&S(e),c&&S(i),c&&S(s),u=!1,Re(f)}}}function pC(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y;return s=new _s({props:{single:!0,$$slots:{header:[Q4],default:[Z4]},$$scope:{ctx:n}}}),o=new _s({props:{single:!0,$$slots:{header:[lC],default:[nC]},$$scope:{ctx:n}}}),a=new _s({props:{single:!0,$$slots:{header:[fC],default:[rC]},$$scope:{ctx:n}}}),m=new _e({props:{class:"form-field required",name:"options.minPasswordLength",$$slots:{default:[cC,({uniqueId:k})=>({12:k}),({uniqueId:k})=>k?4096:0]},$$scope:{ctx:n}}}),g=new _e({props:{class:"form-field form-field-toggle m-b-sm",name:"options.requireEmail",$$slots:{default:[dC,({uniqueId:k})=>({12:k}),({uniqueId:k})=>k?4096:0]},$$scope:{ctx:n}}}),{c(){e=v("h4"),e.textContent="Auth methods",t=O(),i=v("div"),j(s.$$.fragment),l=O(),j(o.$$.fragment),r=O(),j(a.$$.fragment),u=O(),f=v("hr"),c=O(),d=v("h4"),d.textContent="General",h=O(),j(m.$$.fragment),b=O(),j(g.$$.fragment),p(e,"class","section-title"),p(i,"class","accordions"),p(d,"class","section-title")},m(k,w){$(k,e,w),$(k,t,w),$(k,i,w),R(s,i,null),_(i,l),R(o,i,null),_(i,r),R(a,i,null),$(k,u,w),$(k,f,w),$(k,c,w),$(k,d,w),$(k,h,w),R(m,k,w),$(k,b,w),R(g,k,w),y=!0},p(k,[w]){const C={};w&8201&&(C.$$scope={dirty:w,ctx:k}),s.$set(C);const M={};w&8197&&(M.$$scope={dirty:w,ctx:k}),o.$set(M);const T={};w&8195&&(T.$$scope={dirty:w,ctx:k}),a.$set(T);const D={};w&12289&&(D.$$scope={dirty:w,ctx:k}),m.$set(D);const A={};w&12289&&(A.$$scope={dirty:w,ctx:k}),g.$set(A)},i(k){y||(E(s.$$.fragment,k),E(o.$$.fragment,k),E(a.$$.fragment,k),E(m.$$.fragment,k),E(g.$$.fragment,k),y=!0)},o(k){I(s.$$.fragment,k),I(o.$$.fragment,k),I(a.$$.fragment,k),I(m.$$.fragment,k),I(g.$$.fragment,k),y=!1},d(k){k&&S(e),k&&S(t),k&&S(i),H(s),H(o),H(a),k&&S(u),k&&S(f),k&&S(c),k&&S(d),k&&S(h),H(m,k),k&&S(b),H(g,k)}}}function hC(n,e,t){let i,s,l,o;Je(n,wi,b=>t(4,o=b));let{collection:r=new Pn}=e;function a(){r.options.allowUsernameAuth=this.checked,t(0,r)}function u(){r.options.allowEmailAuth=this.checked,t(0,r)}function f(b){n.$$.not_equal(r.options.exceptEmailDomains,b)&&(r.options.exceptEmailDomains=b,t(0,r))}function c(b){n.$$.not_equal(r.options.onlyEmailDomains,b)&&(r.options.onlyEmailDomains=b,t(0,r))}function d(){r.options.allowOAuth2Auth=this.checked,t(0,r)}function h(){r.options.minPasswordLength=rt(this.value),t(0,r)}function m(){r.options.requireEmail=this.checked,t(0,r)}return n.$$set=b=>{"collection"in b&&t(0,r=b.collection)},n.$$.update=()=>{var b,g,y,k;n.$$.dirty&1&&r.isAuth&&B.isEmpty(r.options)&&t(0,r.options={allowEmailAuth:!0,allowUsernameAuth:!0,allowOAuth2Auth:!0,minPasswordLength:8},r),n.$$.dirty&16&&t(2,s=!B.isEmpty((b=o==null?void 0:o.options)==null?void 0:b.allowEmailAuth)||!B.isEmpty((g=o==null?void 0:o.options)==null?void 0:g.onlyEmailDomains)||!B.isEmpty((y=o==null?void 0:o.options)==null?void 0:y.exceptEmailDomains)),n.$$.dirty&16&&t(1,l=!B.isEmpty((k=o==null?void 0:o.options)==null?void 0:k.allowOAuth2Auth))},t(3,i=!1),[r,l,s,i,o,a,u,f,c,d,h,m]}class mC extends Me{constructor(e){super(),Ce(this,e,hC,pC,we,{collection:0})}}function cd(n,e,t){const i=n.slice();return i[14]=e[t],i}function dd(n,e,t){const i=n.slice();return i[14]=e[t],i}function pd(n){let e;return{c(){e=v("p"),e.textContent="All data associated with the removed fields will be permanently deleted!"},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function hd(n){let e,t,i,s,l=n[1].originalName+"",o,r,a,u,f,c=n[1].name+"",d;return{c(){e=v("li"),t=v("div"),i=z(`Renamed collection + `),s=v("strong"),o=z(l),r=O(),a=v("i"),u=O(),f=v("strong"),d=z(c),p(s,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(f,"class","txt"),p(t,"class","inline-flex")},m(h,m){$(h,e,m),_(e,t),_(t,i),_(t,s),_(s,o),_(t,r),_(t,a),_(t,u),_(t,f),_(f,d)},p(h,m){m&2&&l!==(l=h[1].originalName+"")&&ue(o,l),m&2&&c!==(c=h[1].name+"")&&ue(d,c)},d(h){h&&S(e)}}}function md(n){let e,t,i,s,l=n[14].originalName+"",o,r,a,u,f,c=n[14].name+"",d;return{c(){e=v("li"),t=v("div"),i=z(`Renamed field + `),s=v("strong"),o=z(l),r=O(),a=v("i"),u=O(),f=v("strong"),d=z(c),p(s,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(f,"class","txt"),p(t,"class","inline-flex")},m(h,m){$(h,e,m),_(e,t),_(t,i),_(t,s),_(s,o),_(t,r),_(t,a),_(t,u),_(t,f),_(f,d)},p(h,m){m&16&&l!==(l=h[14].originalName+"")&&ue(o,l),m&16&&c!==(c=h[14].name+"")&&ue(d,c)},d(h){h&&S(e)}}}function gd(n){let e,t,i,s=n[14].name+"",l,o;return{c(){e=v("li"),t=z("Removed field "),i=v("span"),l=z(s),o=O(),p(i,"class","txt-bold"),p(e,"class","txt-danger")},m(r,a){$(r,e,a),_(e,t),_(e,i),_(i,l),_(e,o)},p(r,a){a&8&&s!==(s=r[14].name+"")&&ue(l,s)},d(r){r&&S(e)}}}function gC(n){let e,t,i,s,l,o,r,a,u,f,c,d,h=n[3].length&&pd(),m=n[5]&&hd(n),b=n[4],g=[];for(let w=0;w',i=O(),s=v("div"),l=v("p"),l.textContent=`If any of the following changes is part of another collection rule or filter, you'll have to + update it manually!`,o=O(),h&&h.c(),r=O(),a=v("h6"),a.textContent="Changes:",u=O(),f=v("ul"),m&&m.c(),c=O();for(let w=0;wCancel',t=O(),i=v("button"),i.innerHTML='Confirm',e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-secondary"),p(i,"type","button"),p(i,"class","btn btn-expanded")},m(o,r){$(o,e,r),$(o,t,r),$(o,i,r),e.focus(),s||(l=[U(e,"click",n[8]),U(i,"click",n[9])],s=!0)},p:x,d(o){o&&S(e),o&&S(t),o&&S(i),s=!1,Re(l)}}}function vC(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[bC],header:[_C],default:[gC]},$$scope:{ctx:n}};return e=new Jn({props:i}),n[10](e),e.$on("hide",n[11]),e.$on("show",n[12]),{c(){j(e.$$.fragment)},m(s,l){R(e,s,l),t=!0},p(s,[l]){const o={};l&524346&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){I(e.$$.fragment,s),t=!1},d(s){n[10](null),H(e,s)}}}function yC(n,e,t){let i,s,l;const o=It();let r,a;async function u(y){t(1,a=y),await $n(),!i&&!s.length&&!l.length?c():r==null||r.show()}function f(){r==null||r.hide()}function c(){f(),o("confirm")}const d=()=>f(),h=()=>c();function m(y){le[y?"unshift":"push"](()=>{r=y,t(2,r)})}function b(y){Ve.call(this,n,y)}function g(y){Ve.call(this,n,y)}return n.$$.update=()=>{n.$$.dirty&2&&t(5,i=(a==null?void 0:a.originalName)!=(a==null?void 0:a.name)),n.$$.dirty&2&&t(4,s=(a==null?void 0:a.schema.filter(y=>y.id&&!y.toDelete&&y.originalName!=y.name))||[]),n.$$.dirty&2&&t(3,l=(a==null?void 0:a.schema.filter(y=>y.id&&y.toDelete))||[])},[f,a,r,l,s,i,c,u,d,h,m,b,g]}class kC extends Me{constructor(e){super(),Ce(this,e,yC,vC,we,{show:7,hide:0})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}}function _d(n,e,t){const i=n.slice();return i[43]=e[t][0],i[44]=e[t][1],i}function bd(n){let e,t,i,s;function l(r){n[30](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new K4({props:o}),le.push(()=>ke(t,"collection",l)),{c(){e=v("div"),j(t.$$.fragment),p(e,"class","tab-item active")},m(r,a){$(r,e,a),R(t,e,null),s=!0},p(r,a){const u={};!i&&a[0]&4&&(i=!0,u.collection=r[2],$e(()=>i=!1)),t.$set(u)},i(r){s||(E(t.$$.fragment,r),s=!0)},o(r){I(t.$$.fragment,r),s=!1},d(r){r&&S(e),H(t)}}}function vd(n){let e,t,i,s;function l(r){n[31](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new mC({props:o}),le.push(()=>ke(t,"collection",l)),{c(){e=v("div"),j(t.$$.fragment),p(e,"class","tab-item"),ee(e,"active",n[3]===Cs)},m(r,a){$(r,e,a),R(t,e,null),s=!0},p(r,a){const u={};!i&&a[0]&4&&(i=!0,u.collection=r[2],$e(()=>i=!1)),t.$set(u),(!s||a[0]&8)&&ee(e,"active",r[3]===Cs)},i(r){s||(E(t.$$.fragment,r),s=!0)},o(r){I(t.$$.fragment,r),s=!1},d(r){r&&S(e),H(t)}}}function wC(n){let e,t,i,s,l,o,r;function a(d){n[29](d)}let u={};n[2]!==void 0&&(u.collection=n[2]),i=new E4({props:u}),le.push(()=>ke(i,"collection",a));let f=n[3]===ml&&bd(n),c=n[2].isAuth&&vd(n);return{c(){e=v("div"),t=v("div"),j(i.$$.fragment),l=O(),f&&f.c(),o=O(),c&&c.c(),p(t,"class","tab-item"),ee(t,"active",n[3]===gi),p(e,"class","tabs-content svelte-lo1530")},m(d,h){$(d,e,h),_(e,t),R(i,t,null),_(e,l),f&&f.m(e,null),_(e,o),c&&c.m(e,null),r=!0},p(d,h){const m={};!s&&h[0]&4&&(s=!0,m.collection=d[2],$e(()=>s=!1)),i.$set(m),(!r||h[0]&8)&&ee(t,"active",d[3]===gi),d[3]===ml?f?(f.p(d,h),h[0]&8&&E(f,1)):(f=bd(d),f.c(),E(f,1),f.m(e,o)):f&&(be(),I(f,1,1,()=>{f=null}),ve()),d[2].isAuth?c?(c.p(d,h),h[0]&4&&E(c,1)):(c=vd(d),c.c(),E(c,1),c.m(e,null)):c&&(be(),I(c,1,1,()=>{c=null}),ve())},i(d){r||(E(i.$$.fragment,d),E(f),E(c),r=!0)},o(d){I(i.$$.fragment,d),I(f),I(c),r=!1},d(d){d&&S(e),H(i),f&&f.d(),c&&c.d()}}}function yd(n){let e,t,i,s,l,o,r;return o=new Zn({props:{class:"dropdown dropdown-right m-t-5",$$slots:{default:[SC]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=O(),i=v("button"),s=v("i"),l=O(),j(o.$$.fragment),p(e,"class","flex-fill"),p(s,"class","ri-more-line"),p(i,"type","button"),p(i,"class","btn btn-sm btn-circle btn-secondary flex-gap-0")},m(a,u){$(a,e,u),$(a,t,u),$(a,i,u),_(i,s),_(i,l),R(o,i,null),r=!0},p(a,u){const f={};u[1]&65536&&(f.$$scope={dirty:u,ctx:a}),o.$set(f)},i(a){r||(E(o.$$.fragment,a),r=!0)},o(a){I(o.$$.fragment,a),r=!1},d(a){a&&S(e),a&&S(t),a&&S(i),H(o)}}}function SC(n){let e,t,i;return{c(){e=v("button"),e.innerHTML=` + Delete`,p(e,"type","button"),p(e,"class","dropdown-item txt-danger closable")},m(s,l){$(s,e,l),t||(i=U(e,"click",Yn(ut(n[22]))),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function kd(n){let e,t,i,s;return i=new Zn({props:{class:"dropdown dropdown-right dropdown-nowrap m-t-5",$$slots:{default:[$C]},$$scope:{ctx:n}}}),{c(){e=v("i"),t=O(),j(i.$$.fragment),p(e,"class","ri-arrow-down-s-fill")},m(l,o){$(l,e,o),$(l,t,o),R(i,l,o),s=!0},p(l,o){const r={};o[0]&68|o[1]&65536&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(i.$$.fragment,l),s=!0)},o(l){I(i.$$.fragment,l),s=!1},d(l){l&&S(e),l&&S(t),H(i,l)}}}function wd(n){let e,t,i,s,l,o=n[44]+"",r,a,u,f,c;function d(){return n[24](n[43])}return{c(){e=v("button"),t=v("i"),s=O(),l=v("span"),r=z(o),a=z(" collection"),u=O(),p(t,"class",i=uo(B.getCollectionTypeIcon(n[43]))+" svelte-lo1530"),p(l,"class","txt"),p(e,"type","button"),p(e,"class","dropdown-item closable"),ee(e,"selected",n[43]==n[2].type)},m(h,m){$(h,e,m),_(e,t),_(e,s),_(e,l),_(l,r),_(l,a),_(e,u),f||(c=U(e,"click",d),f=!0)},p(h,m){n=h,m[0]&64&&i!==(i=uo(B.getCollectionTypeIcon(n[43]))+" svelte-lo1530")&&p(t,"class",i),m[0]&64&&o!==(o=n[44]+"")&&ue(r,o),m[0]&68&&ee(e,"selected",n[43]==n[2].type)},d(h){h&&S(e),f=!1,c()}}}function $C(n){let e,t=Object.entries(n[6]),i=[];for(let s=0;s{L=null}),ve()),(!D||W[0]&4&&w!==(w="btn btn-sm p-r-10 p-l-10 "+(F[2].isNew?"btn-hint":"btn-secondary")))&&p(c,"class",w),(!D||W[0]&4&&C!==(C=!F[2].isNew))&&(c.disabled=C),F[2].system?V||(V=Sd(),V.c(),V.m(T.parentNode,T)):V&&(V.d(1),V=null)},i(F){D||(E(L),D=!0)},o(F){I(L),D=!1},d(F){F&&S(e),F&&S(s),F&&S(l),F&&S(u),F&&S(f),L&&L.d(),F&&S(M),V&&V.d(F),F&&S(T),A=!1,P()}}}function $d(n){let e,t,i,s,l,o;return{c(){e=v("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(r,a){$(r,e,a),s=!0,l||(o=Le(t=Be.call(null,e,n[13])),l=!0)},p(r,a){t&&Wt(t.update)&&a[0]&8192&&t.update.call(null,r[13])},i(r){s||(r&&Qe(()=>{i||(i=je(e,$t,{duration:150,start:.7},!0)),i.run(1)}),s=!0)},o(r){r&&(i||(i=je(e,$t,{duration:150,start:.7},!1)),i.run(0)),s=!1},d(r){r&&S(e),r&&i&&i.end(),l=!1,o()}}}function Cd(n){let e,t,i,s,l;return{c(){e=v("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){$(o,e,r),i=!0,s||(l=Le(Be.call(null,e,"Has errors")),s=!0)},i(o){i||(o&&Qe(()=>{t||(t=je(e,$t,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){o&&(t||(t=je(e,$t,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&S(e),o&&t&&t.end(),s=!1,l()}}}function Md(n){var a,u,f;let e,t,i,s=!B.isEmpty((a=n[5])==null?void 0:a.options)&&!((f=(u=n[5])==null?void 0:u.options)!=null&&f.manageRule),l,o,r=s&&Td();return{c(){e=v("button"),t=v("span"),t.textContent="Options",i=O(),r&&r.c(),p(t,"class","txt"),p(e,"type","button"),p(e,"class","tab-item"),ee(e,"active",n[3]===Cs)},m(c,d){$(c,e,d),_(e,t),_(e,i),r&&r.m(e,null),l||(o=U(e,"click",n[28]),l=!0)},p(c,d){var h,m,b;d[0]&32&&(s=!B.isEmpty((h=c[5])==null?void 0:h.options)&&!((b=(m=c[5])==null?void 0:m.options)!=null&&b.manageRule)),s?r?d[0]&32&&E(r,1):(r=Td(),r.c(),E(r,1),r.m(e,null)):r&&(be(),I(r,1,1,()=>{r=null}),ve()),d[0]&8&&ee(e,"active",c[3]===Cs)},d(c){c&&S(e),r&&r.d(),l=!1,o()}}}function Td(n){let e,t,i,s,l;return{c(){e=v("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){$(o,e,r),i=!0,s||(l=Le(Be.call(null,e,"Has errors")),s=!0)},i(o){i||(o&&Qe(()=>{t||(t=je(e,$t,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){o&&(t||(t=je(e,$t,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&S(e),o&&t&&t.end(),s=!1,l()}}}function MC(n){var W,G,K,X,Z,ie,J,fe;let e,t=n[2].isNew?"New collection":"Edit collection",i,s,l,o,r,a,u,f,c,d,h,m,b=!B.isEmpty((W=n[5])==null?void 0:W.schema),g,y,k,w,C=!B.isEmpty((G=n[5])==null?void 0:G.listRule)||!B.isEmpty((K=n[5])==null?void 0:K.viewRule)||!B.isEmpty((X=n[5])==null?void 0:X.createRule)||!B.isEmpty((Z=n[5])==null?void 0:Z.updateRule)||!B.isEmpty((ie=n[5])==null?void 0:ie.deleteRule)||!B.isEmpty((fe=(J=n[5])==null?void 0:J.options)==null?void 0:fe.manageRule),M,T,D,A,P=!n[2].isNew&&!n[2].system&&yd(n);r=new _e({props:{class:"form-field collection-field-name required m-b-0 "+(n[12]?"disabled":""),name:"name",$$slots:{default:[CC,({uniqueId:Y})=>({42:Y}),({uniqueId:Y})=>[0,Y?2048:0]]},$$scope:{ctx:n}}});let L=b&&$d(n),V=C&&Cd(),F=n[2].isAuth&&Md(n);return{c(){e=v("h4"),i=z(t),s=O(),P&&P.c(),l=O(),o=v("form"),j(r.$$.fragment),a=O(),u=v("input"),f=O(),c=v("div"),d=v("button"),h=v("span"),h.textContent="Fields",m=O(),L&&L.c(),g=O(),y=v("button"),k=v("span"),k.textContent="API Rules",w=O(),V&&V.c(),M=O(),F&&F.c(),p(u,"type","submit"),p(u,"class","hidden"),p(u,"tabindex","-1"),p(o,"class","block"),p(h,"class","txt"),p(d,"type","button"),p(d,"class","tab-item"),ee(d,"active",n[3]===gi),p(k,"class","txt"),p(y,"type","button"),p(y,"class","tab-item"),ee(y,"active",n[3]===ml),p(c,"class","tabs-header stretched")},m(Y,re){$(Y,e,re),_(e,i),$(Y,s,re),P&&P.m(Y,re),$(Y,l,re),$(Y,o,re),R(r,o,null),_(o,a),_(o,u),$(Y,f,re),$(Y,c,re),_(c,d),_(d,h),_(d,m),L&&L.m(d,null),_(c,g),_(c,y),_(y,k),_(y,w),V&&V.m(y,null),_(c,M),F&&F.m(c,null),T=!0,D||(A=[U(o,"submit",ut(n[25])),U(d,"click",n[26]),U(y,"click",n[27])],D=!0)},p(Y,re){var ge,ae,pe,de,Se,ye,We,ce;(!T||re[0]&4)&&t!==(t=Y[2].isNew?"New collection":"Edit collection")&&ue(i,t),!Y[2].isNew&&!Y[2].system?P?(P.p(Y,re),re[0]&4&&E(P,1)):(P=yd(Y),P.c(),E(P,1),P.m(l.parentNode,l)):P&&(be(),I(P,1,1,()=>{P=null}),ve());const Oe={};re[0]&4096&&(Oe.class="form-field collection-field-name required m-b-0 "+(Y[12]?"disabled":"")),re[0]&4164|re[1]&67584&&(Oe.$$scope={dirty:re,ctx:Y}),r.$set(Oe),re[0]&32&&(b=!B.isEmpty((ge=Y[5])==null?void 0:ge.schema)),b?L?(L.p(Y,re),re[0]&32&&E(L,1)):(L=$d(Y),L.c(),E(L,1),L.m(d,null)):L&&(be(),I(L,1,1,()=>{L=null}),ve()),(!T||re[0]&8)&&ee(d,"active",Y[3]===gi),re[0]&32&&(C=!B.isEmpty((ae=Y[5])==null?void 0:ae.listRule)||!B.isEmpty((pe=Y[5])==null?void 0:pe.viewRule)||!B.isEmpty((de=Y[5])==null?void 0:de.createRule)||!B.isEmpty((Se=Y[5])==null?void 0:Se.updateRule)||!B.isEmpty((ye=Y[5])==null?void 0:ye.deleteRule)||!B.isEmpty((ce=(We=Y[5])==null?void 0:We.options)==null?void 0:ce.manageRule)),C?V?re[0]&32&&E(V,1):(V=Cd(),V.c(),E(V,1),V.m(y,null)):V&&(be(),I(V,1,1,()=>{V=null}),ve()),(!T||re[0]&8)&&ee(y,"active",Y[3]===ml),Y[2].isAuth?F?F.p(Y,re):(F=Md(Y),F.c(),F.m(c,null)):F&&(F.d(1),F=null)},i(Y){T||(E(P),E(r.$$.fragment,Y),E(L),E(V),T=!0)},o(Y){I(P),I(r.$$.fragment,Y),I(L),I(V),T=!1},d(Y){Y&&S(e),Y&&S(s),P&&P.d(Y),Y&&S(l),Y&&S(o),H(r),Y&&S(f),Y&&S(c),L&&L.d(),V&&V.d(),F&&F.d(),D=!1,Re(A)}}}function TC(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=v("button"),t=v("span"),t.textContent="Cancel",i=O(),s=v("button"),l=v("span"),r=z(o),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[9],p(l,"class","txt"),p(s,"type","button"),p(s,"class","btn btn-expanded"),s.disabled=a=!n[11]||n[9],ee(s,"btn-loading",n[9])},m(c,d){$(c,e,d),_(e,t),$(c,i,d),$(c,s,d),_(s,l),_(l,r),u||(f=[U(e,"click",n[20]),U(s,"click",n[21])],u=!0)},p(c,d){d[0]&512&&(e.disabled=c[9]),d[0]&4&&o!==(o=c[2].isNew?"Create":"Save changes")&&ue(r,o),d[0]&2560&&a!==(a=!c[11]||c[9])&&(s.disabled=a),d[0]&512&&ee(s,"btn-loading",c[9])},d(c){c&&S(e),c&&S(i),c&&S(s),u=!1,Re(f)}}}function OC(n){let e,t,i,s,l={class:"overlay-panel-lg colored-header collection-panel",beforeHide:n[32],$$slots:{footer:[TC],header:[MC],default:[wC]},$$scope:{ctx:n}};e=new Jn({props:l}),n[33](e),e.$on("hide",n[34]),e.$on("show",n[35]);let o={};return i=new kC({props:o}),n[36](i),i.$on("confirm",n[37]),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment)},m(r,a){R(e,r,a),$(r,t,a),R(i,r,a),s=!0},p(r,a){const u={};a[0]&1040&&(u.beforeHide=r[32]),a[0]&14956|a[1]&65536&&(u.$$scope={dirty:a,ctx:r}),e.$set(u);const f={};i.$set(f)},i(r){s||(E(e.$$.fragment,r),E(i.$$.fragment,r),s=!0)},o(r){I(e.$$.fragment,r),I(i.$$.fragment,r),s=!1},d(r){n[33](null),H(e,r),r&&S(t),n[36](null),H(i,r)}}}const gi="fields",ml="api_rules",Cs="options",DC="base",Od="auth";function Sr(n){return JSON.stringify(n)}function EC(n,e,t){let i,s,l,o,r;Je(n,wi,ye=>t(5,r=ye));const a={};a[DC]="Base",a[Od]="Auth";const u=It();let f,c,d=null,h=new Pn,m=!1,b=!1,g=gi,y=Sr(h);function k(ye){t(3,g=ye)}function w(ye){return M(ye),t(10,b=!0),k(gi),f==null?void 0:f.show()}function C(){return f==null?void 0:f.hide()}async function M(ye){Fn({}),typeof ye<"u"?(d=ye,t(2,h=ye==null?void 0:ye.clone())):(d=null,t(2,h=new Pn)),t(2,h.schema=h.schema||[],h),t(2,h.originalName=h.name||"",h),await $n(),t(19,y=Sr(h))}function T(){if(h.isNew)return D();c==null||c.show(h)}function D(){if(m)return;t(9,m=!0);const ye=A();let We;h.isNew?We=me.collections.create(ye):We=me.collections.update(h.id,ye),We.then(ce=>{t(10,b=!1),C(),Lt(h.isNew?"Successfully created collection.":"Successfully updated collection."),kS(ce),u("save",{isNew:h.isNew,collection:ce})}).catch(ce=>{me.errorResponseHandler(ce)}).finally(()=>{t(9,m=!1)})}function A(){const ye=h.export();ye.schema=ye.schema.slice(0);for(let We=ye.schema.length-1;We>=0;We--)ye.schema[We].toDelete&&ye.schema.splice(We,1);return ye}function P(){!(d!=null&&d.id)||yn(`Do you really want to delete collection "${d==null?void 0:d.name}" and all its records?`,()=>me.collections.delete(d==null?void 0:d.id).then(()=>{C(),Lt(`Successfully deleted collection "${d==null?void 0:d.name}".`),u("delete",d),wS(d)}).catch(ye=>{me.errorResponseHandler(ye)}))}function L(ye){t(2,h.type=ye,h)}const V=()=>C(),F=()=>T(),W=()=>P(),G=ye=>{t(2,h.name=B.slugify(ye.target.value),h),ye.target.value=h.name},K=ye=>L(ye),X=()=>{o&&T()},Z=()=>k(gi),ie=()=>k(ml),J=()=>k(Cs);function fe(ye){h=ye,t(2,h)}function Y(ye){h=ye,t(2,h)}function re(ye){h=ye,t(2,h)}const Oe=()=>l&&b?(yn("You have unsaved changes. Do you really want to close the panel?",()=>{t(10,b=!1),C()}),!1):!0;function ge(ye){le[ye?"unshift":"push"](()=>{f=ye,t(7,f)})}function ae(ye){Ve.call(this,n,ye)}function pe(ye){Ve.call(this,n,ye)}function de(ye){le[ye?"unshift":"push"](()=>{c=ye,t(8,c)})}const Se=()=>D();return n.$$.update=()=>{n.$$.dirty[0]&32&&t(13,i=typeof B.getNestedVal(r,"schema.message",null)=="string"?B.getNestedVal(r,"schema.message"):"Has errors"),n.$$.dirty[0]&4&&t(12,s=!h.isNew&&h.system),n.$$.dirty[0]&524292&&t(4,l=y!=Sr(h)),n.$$.dirty[0]&20&&t(11,o=h.isNew||l),n.$$.dirty[0]&12&&g===Cs&&h.type!==Od&&k(gi)},[k,C,h,g,l,r,a,f,c,m,b,o,s,i,T,D,P,L,w,y,V,F,W,G,K,X,Z,ie,J,fe,Y,re,Oe,ge,ae,pe,de,Se]}class Ja extends Me{constructor(e){super(),Ce(this,e,EC,OC,we,{changeTab:0,show:18,hide:1},null,[-1,-1])}get changeTab(){return this.$$.ctx[0]}get show(){return this.$$.ctx[18]}get hide(){return this.$$.ctx[1]}}function Dd(n,e,t){const i=n.slice();return i[14]=e[t],i}function Ed(n){let e,t=n[1].length&&Ad();return{c(){t&&t.c(),e=Fe()},m(i,s){t&&t.m(i,s),$(i,e,s)},p(i,s){i[1].length?t||(t=Ad(),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&S(e)}}}function Ad(n){let e;return{c(){e=v("p"),e.textContent="No collections found.",p(e,"class","txt-hint m-t-10 m-b-10 txt-center")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function Id(n,e){let t,i,s,l,o,r=e[14].name+"",a,u,f,c,d;return{key:n,first:null,c(){var h;t=v("a"),i=v("i"),l=O(),o=v("span"),a=z(r),u=O(),p(i,"class",s=B.getCollectionTypeIcon(e[14].type)),p(o,"class","txt"),p(t,"href",f="/collections?collectionId="+e[14].id),p(t,"class","sidebar-list-item"),ee(t,"active",((h=e[5])==null?void 0:h.id)===e[14].id),this.first=t},m(h,m){$(h,t,m),_(t,i),_(t,l),_(t,o),_(o,a),_(t,u),c||(d=Le(Vt.call(null,t)),c=!0)},p(h,m){var b;e=h,m&8&&s!==(s=B.getCollectionTypeIcon(e[14].type))&&p(i,"class",s),m&8&&r!==(r=e[14].name+"")&&ue(a,r),m&8&&f!==(f="/collections?collectionId="+e[14].id)&&p(t,"href",f),m&40&&ee(t,"active",((b=e[5])==null?void 0:b.id)===e[14].id)},d(h){h&&S(t),c=!1,d()}}}function Pd(n){let e,t,i,s;return{c(){e=v("footer"),t=v("button"),t.innerHTML=` + New collection`,p(t,"type","button"),p(t,"class","btn btn-block btn-outline"),p(e,"class","sidebar-footer")},m(l,o){$(l,e,o),_(e,t),i||(s=U(t,"click",n[11]),i=!0)},p:x,d(l){l&&S(e),i=!1,s()}}}function AC(n){let e,t,i,s,l,o,r,a,u,f,c,d=[],h=new Map,m,b,g,y,k,w,C=n[3];const M=P=>P[14].id;for(let P=0;P',o=O(),r=v("input"),a=O(),u=v("hr"),f=O(),c=v("div");for(let P=0;P20),p(e,"class","page-sidebar collection-sidebar")},m(P,L){$(P,e,L),_(e,t),_(t,i),_(i,s),_(s,l),_(i,o),_(i,r),he(r,n[0]),_(e,a),_(e,u),_(e,f),_(e,c);for(let V=0;V20),P[6]?D&&(D.d(1),D=null):D?D.p(P,L):(D=Pd(P),D.c(),D.m(e,null));const V={};g.$set(V)},i(P){y||(E(g.$$.fragment,P),y=!0)},o(P){I(g.$$.fragment,P),y=!1},d(P){P&&S(e);for(let L=0;L{const n=document.querySelector(".collection-sidebar .sidebar-list-item.active");n&&(n==null||n.scrollIntoView({block:"nearest"}))},0)}function PC(n,e,t){let i,s,l,o,r,a;Je(n,Bn,y=>t(5,o=y)),Je(n,Zi,y=>t(8,r=y)),Je(n,ks,y=>t(6,a=y));let u,f="";function c(y){Ht(Bn,o=y,o)}const d=()=>t(0,f="");function h(){f=this.value,t(0,f)}const m=()=>u==null?void 0:u.show();function b(y){le[y?"unshift":"push"](()=>{u=y,t(2,u)})}const g=y=>{var k;((k=y.detail)==null?void 0:k.isNew)&&y.detail.collection&&c(y.detail.collection)};return n.$$.update=()=>{n.$$.dirty&1&&t(1,i=f.replace(/\s+/g,"").toLowerCase()),n.$$.dirty&1&&t(4,s=f!==""),n.$$.dirty&259&&t(3,l=r.filter(y=>y.id==f||y.name.replace(/\s+/g,"").toLowerCase().includes(i))),n.$$.dirty&256&&r&&IC()},[f,i,u,l,s,o,a,c,r,d,h,m,b,g]}class LC extends Me{constructor(e){super(),Ce(this,e,PC,AC,we,{})}}function Ld(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i}function Nd(n){n[18]=n[19].default}function Fd(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i}function Rd(n,e){let t,i=e[15].label+"",s,l,o,r;function a(){return e[8](e[14])}return{key:n,first:null,c(){t=v("button"),s=z(i),l=O(),p(t,"type","button"),p(t,"class","sidebar-item"),ee(t,"active",e[5]===e[14]),this.first=t},m(u,f){$(u,t,f),_(t,s),_(t,l),o||(r=U(t,"click",a),o=!0)},p(u,f){e=u,f&8&&i!==(i=e[15].label+"")&&ue(s,i),f&40&&ee(t,"active",e[5]===e[14])},d(u){u&&S(t),o=!1,r()}}}function Hd(n){let e,t,i,s={ctx:n,current:null,token:null,hasCatch:!1,pending:RC,then:FC,catch:NC,value:19,blocks:[,,,]};return xa(t=n[15].component,s),{c(){e=Fe(),s.block.c()},m(l,o){$(l,e,o),s.block.m(l,s.anchor=o),s.mount=()=>e.parentNode,s.anchor=e,i=!0},p(l,o){n=l,s.ctx=n,o&8&&t!==(t=n[15].component)&&xa(t,s)||x_(s,n,o)},i(l){i||(E(s.block),i=!0)},o(l){for(let o=0;o<3;o+=1){const r=s.blocks[o];I(r)}i=!1},d(l){l&&S(e),s.block.d(l),s.token=null,s=null}}}function NC(n){return{c:x,m:x,p:x,i:x,o:x,d:x}}function FC(n){Nd(n);let e,t,i;return e=new n[18]({props:{collection:n[2]}}),{c(){j(e.$$.fragment),t=O()},m(s,l){R(e,s,l),$(s,t,l),i=!0},p(s,l){Nd(s);const o={};l&4&&(o.collection=s[2]),e.$set(o)},i(s){i||(E(e.$$.fragment,s),i=!0)},o(s){I(e.$$.fragment,s),i=!1},d(s){H(e,s),s&&S(t)}}}function RC(n){return{c:x,m:x,p:x,i:x,o:x,d:x}}function jd(n,e){let t,i,s,l=e[5]===e[14]&&Hd(e);return{key:n,first:null,c(){t=Fe(),l&&l.c(),i=Fe(),this.first=t},m(o,r){$(o,t,r),l&&l.m(o,r),$(o,i,r),s=!0},p(o,r){e=o,e[5]===e[14]?l?(l.p(e,r),r&40&&E(l,1)):(l=Hd(e),l.c(),E(l,1),l.m(i.parentNode,i)):l&&(be(),I(l,1,1,()=>{l=null}),ve())},i(o){s||(E(l),s=!0)},o(o){I(l),s=!1},d(o){o&&S(t),l&&l.d(o),o&&S(i)}}}function HC(n){let e,t,i,s=[],l=new Map,o,r,a=[],u=new Map,f,c=Object.entries(n[3]);const d=b=>b[14];for(let b=0;bb[14];for(let b=0;bClose',p(e,"type","button"),p(e,"class","btn btn-secondary")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[7]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function qC(n){let e,t,i={class:"docs-panel",$$slots:{footer:[jC],default:[HC]},$$scope:{ctx:n}};return e=new Jn({props:i}),n[9](e),e.$on("hide",n[10]),e.$on("show",n[11]),{c(){j(e.$$.fragment)},m(s,l){R(e,s,l),t=!0},p(s,[l]){const o={};l&4194348&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){I(e.$$.fragment,s),t=!1},d(s){n[9](null),H(e,s)}}}function VC(n,e,t){const i={list:{label:"List/Search",component:st(()=>import("./ListApiDocs.11b26f68.js"),["./ListApiDocs.11b26f68.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css","./ListApiDocs.68f52edd.css"],import.meta.url)},view:{label:"View",component:st(()=>import("./ViewApiDocs.d6f654f1.js"),["./ViewApiDocs.d6f654f1.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},create:{label:"Create",component:st(()=>import("./CreateApiDocs.60f76221.js"),["./CreateApiDocs.60f76221.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},update:{label:"Update",component:st(()=>import("./UpdateApiDocs.f4df7d8c.js"),["./UpdateApiDocs.f4df7d8c.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},delete:{label:"Delete",component:st(()=>import("./DeleteApiDocs.06551842.js"),["./DeleteApiDocs.06551842.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},realtime:{label:"Realtime",component:st(()=>import("./RealtimeApiDocs.e9e53954.js"),["./RealtimeApiDocs.e9e53954.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)}},s={"auth-with-password":{label:"Auth with password",component:st(()=>import("./AuthWithPasswordDocs.f656a4b9.js"),["./AuthWithPasswordDocs.f656a4b9.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},"auth-with-oauth2":{label:"Auth with OAuth2",component:st(()=>import("./AuthWithOAuth2Docs.169fa55a.js"),["./AuthWithOAuth2Docs.169fa55a.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},refresh:{label:"Auth refresh",component:st(()=>import("./AuthRefreshDocs.1d6e4e08.js"),["./AuthRefreshDocs.1d6e4e08.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},"request-verification":{label:"Request verification",component:st(()=>import("./RequestVerificationDocs.2b01d123.js"),["./RequestVerificationDocs.2b01d123.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},"confirm-verification":{label:"Confirm verification",component:st(()=>import("./ConfirmVerificationDocs.e35127c6.js"),["./ConfirmVerificationDocs.e35127c6.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},"request-password-reset":{label:"Request password reset",component:st(()=>import("./RequestPasswordResetDocs.c8de2eb6.js"),["./RequestPasswordResetDocs.c8de2eb6.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},"confirm-password-reset":{label:"Confirm password reset",component:st(()=>import("./ConfirmPasswordResetDocs.f1aa1be6.js"),["./ConfirmPasswordResetDocs.f1aa1be6.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},"request-email-change":{label:"Request email change",component:st(()=>import("./RequestEmailChangeDocs.1fe72b2e.js"),["./RequestEmailChangeDocs.1fe72b2e.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},"confirm-email-change":{label:"Confirm email change",component:st(()=>import("./ConfirmEmailChangeDocs.e9bf0cab.js"),["./ConfirmEmailChangeDocs.e9bf0cab.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},"list-auth-methods":{label:"List auth methods",component:st(()=>import("./AuthMethodsDocs.6da908f0.js"),["./AuthMethodsDocs.6da908f0.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},"list-linked-accounts":{label:"List OAuth2 accounts",component:st(()=>import("./ListExternalAuthsDocs.960c39a0.js"),["./ListExternalAuthsDocs.960c39a0.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)},"unlink-account":{label:"Unlink OAuth2 account",component:st(()=>import("./UnlinkExternalAuthDocs.3445a27c.js"),["./UnlinkExternalAuthDocs.3445a27c.js","./SdkTabs.88269ae0.js","./SdkTabs.9b0b7a06.css"],import.meta.url)}};let l,o=new Pn,r,a=[];a.length&&(r=Object.keys(a)[0]);function u(y){return t(2,o=y),c(Object.keys(a)[0]),l==null?void 0:l.show()}function f(){return l==null?void 0:l.hide()}function c(y){t(5,r=y)}const d=()=>f(),h=y=>c(y);function m(y){le[y?"unshift":"push"](()=>{l=y,t(4,l)})}function b(y){Ve.call(this,n,y)}function g(y){Ve.call(this,n,y)}return n.$$.update=()=>{n.$$.dirty&12&&(o.isAuth?(t(3,a=Object.assign({},i,s)),!(o!=null&&o.options.allowUsernameAuth)&&!(o!=null&&o.options.allowEmailAuth)&&delete a["auth-with-password"],o!=null&&o.options.allowOAuth2Auth||delete a["auth-with-oauth2"]):t(3,a=Object.assign({},i)))},[f,c,o,a,l,r,u,d,h,m,b,g]}class zC extends Me{constructor(e){super(),Ce(this,e,VC,qC,we,{show:6,hide:0,changeTab:1})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}get changeTab(){return this.$$.ctx[1]}}function BC(n){let e,t,i,s,l,o,r,a,u,f,c,d;return{c(){e=v("label"),t=v("i"),i=O(),s=v("span"),s.textContent="Username",o=O(),r=v("input"),p(t,"class",B.getFieldTypeIcon("user")),p(s,"class","txt"),p(e,"for",l=n[12]),p(r,"type","text"),p(r,"requried",a=!n[0].isNew),p(r,"placeholder",u=n[0].isNew?"Leave empty to auto generate...":n[3]),p(r,"id",f=n[12])},m(h,m){$(h,e,m),_(e,t),_(e,i),_(e,s),$(h,o,m),$(h,r,m),he(r,n[0].username),c||(d=U(r,"input",n[4]),c=!0)},p(h,m){m&4096&&l!==(l=h[12])&&p(e,"for",l),m&1&&a!==(a=!h[0].isNew)&&p(r,"requried",a),m&1&&u!==(u=h[0].isNew?"Leave empty to auto generate...":h[3])&&p(r,"placeholder",u),m&4096&&f!==(f=h[12])&&p(r,"id",f),m&1&&r.value!==h[0].username&&he(r,h[0].username)},d(h){h&&S(e),h&&S(o),h&&S(r),c=!1,d()}}}function WC(n){let e,t,i,s,l,o,r,a,u,f,c=n[0].emailVisibility?"On":"Off",d,h,m,b,g,y,k,w,C;return{c(){var M;e=v("label"),t=v("i"),i=O(),s=v("span"),s.textContent="Email",o=O(),r=v("div"),a=v("button"),u=v("span"),f=z("Public: "),d=z(c),m=O(),b=v("input"),p(t,"class",B.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"for",l=n[12]),p(u,"class","txt"),p(a,"type","button"),p(a,"class",h="btn btn-sm btn-secondary "+(n[0].emailVisibility?"btn-success":"btn-hint")),p(r,"class","form-field-addon email-visibility-addon svelte-1751a4d"),p(b,"type","email"),b.autofocus=g=n[0].isNew,p(b,"autocomplete","off"),p(b,"id",y=n[12]),b.required=k=(M=n[1].options)==null?void 0:M.requireEmail,p(b,"class","svelte-1751a4d")},m(M,T){$(M,e,T),_(e,t),_(e,i),_(e,s),$(M,o,T),$(M,r,T),_(r,a),_(a,u),_(u,f),_(u,d),$(M,m,T),$(M,b,T),he(b,n[0].email),n[0].isNew&&b.focus(),w||(C=[Le(Be.call(null,a,{text:"Make email public or private",position:"top-right"})),U(a,"click",n[5]),U(b,"input",n[6])],w=!0)},p(M,T){var D;T&4096&&l!==(l=M[12])&&p(e,"for",l),T&1&&c!==(c=M[0].emailVisibility?"On":"Off")&&ue(d,c),T&1&&h!==(h="btn btn-sm btn-secondary "+(M[0].emailVisibility?"btn-success":"btn-hint"))&&p(a,"class",h),T&1&&g!==(g=M[0].isNew)&&(b.autofocus=g),T&4096&&y!==(y=M[12])&&p(b,"id",y),T&2&&k!==(k=(D=M[1].options)==null?void 0:D.requireEmail)&&(b.required=k),T&1&&b.value!==M[0].email&&he(b,M[0].email)},d(M){M&&S(e),M&&S(o),M&&S(r),M&&S(m),M&&S(b),w=!1,Re(C)}}}function qd(n){let e,t;return e=new _e({props:{class:"form-field form-field-toggle",name:"verified",$$slots:{default:[UC,({uniqueId:i})=>({12:i}),({uniqueId:i})=>i?4096:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s&12292&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function UC(n){let e,t,i,s,l,o,r,a;return{c(){e=v("input"),i=O(),s=v("label"),l=z("Change password"),p(e,"type","checkbox"),p(e,"id",t=n[12]),p(s,"for",o=n[12])},m(u,f){$(u,e,f),e.checked=n[2],$(u,i,f),$(u,s,f),_(s,l),r||(a=U(e,"change",n[7]),r=!0)},p(u,f){f&4096&&t!==(t=u[12])&&p(e,"id",t),f&4&&(e.checked=u[2]),f&4096&&o!==(o=u[12])&&p(s,"for",o)},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,a()}}}function Vd(n){let e,t,i,s,l,o,r,a,u;return s=new _e({props:{class:"form-field required",name:"password",$$slots:{default:[YC,({uniqueId:f})=>({12:f}),({uniqueId:f})=>f?4096:0]},$$scope:{ctx:n}}}),r=new _e({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[KC,({uniqueId:f})=>({12:f}),({uniqueId:f})=>f?4096:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),i=v("div"),j(s.$$.fragment),l=O(),o=v("div"),j(r.$$.fragment),p(i,"class","col-sm-6"),p(o,"class","col-sm-6"),p(t,"class","grid"),ee(t,"p-t-xs",n[2]),p(e,"class","block")},m(f,c){$(f,e,c),_(e,t),_(t,i),R(s,i,null),_(t,l),_(t,o),R(r,o,null),u=!0},p(f,c){const d={};c&12289&&(d.$$scope={dirty:c,ctx:f}),s.$set(d);const h={};c&12289&&(h.$$scope={dirty:c,ctx:f}),r.$set(h),(!u||c&4)&&ee(t,"p-t-xs",f[2])},i(f){u||(E(s.$$.fragment,f),E(r.$$.fragment,f),f&&Qe(()=>{a||(a=je(e,St,{duration:150},!0)),a.run(1)}),u=!0)},o(f){I(s.$$.fragment,f),I(r.$$.fragment,f),f&&(a||(a=je(e,St,{duration:150},!1)),a.run(0)),u=!1},d(f){f&&S(e),H(s),H(r),f&&a&&a.end()}}}function YC(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("label"),t=v("i"),i=O(),s=v("span"),s.textContent="Password",o=O(),r=v("input"),p(t,"class","ri-lock-line"),p(s,"class","txt"),p(e,"for",l=n[12]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[12]),r.required=!0},m(c,d){$(c,e,d),_(e,t),_(e,i),_(e,s),$(c,o,d),$(c,r,d),he(r,n[0].password),u||(f=U(r,"input",n[8]),u=!0)},p(c,d){d&4096&&l!==(l=c[12])&&p(e,"for",l),d&4096&&a!==(a=c[12])&&p(r,"id",a),d&1&&r.value!==c[0].password&&he(r,c[0].password)},d(c){c&&S(e),c&&S(o),c&&S(r),u=!1,f()}}}function KC(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("label"),t=v("i"),i=O(),s=v("span"),s.textContent="Password confirm",o=O(),r=v("input"),p(t,"class","ri-lock-line"),p(s,"class","txt"),p(e,"for",l=n[12]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[12]),r.required=!0},m(c,d){$(c,e,d),_(e,t),_(e,i),_(e,s),$(c,o,d),$(c,r,d),he(r,n[0].passwordConfirm),u||(f=U(r,"input",n[9]),u=!0)},p(c,d){d&4096&&l!==(l=c[12])&&p(e,"for",l),d&4096&&a!==(a=c[12])&&p(r,"id",a),d&1&&r.value!==c[0].passwordConfirm&&he(r,c[0].passwordConfirm)},d(c){c&&S(e),c&&S(o),c&&S(r),u=!1,f()}}}function JC(n){let e,t,i,s,l,o,r,a;return{c(){e=v("input"),i=O(),s=v("label"),l=z("Verified"),p(e,"type","checkbox"),p(e,"id",t=n[12]),p(s,"for",o=n[12])},m(u,f){$(u,e,f),e.checked=n[0].verified,$(u,i,f),$(u,s,f),_(s,l),r||(a=[U(e,"change",n[10]),U(e,"change",ut(n[11]))],r=!0)},p(u,f){f&4096&&t!==(t=u[12])&&p(e,"id",t),f&1&&(e.checked=u[0].verified),f&4096&&o!==(o=u[12])&&p(s,"for",o)},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,Re(a)}}}function ZC(n){var g;let e,t,i,s,l,o,r,a,u,f,c,d,h;i=new _e({props:{class:"form-field "+(n[0].isNew?"":"required"),name:"username",$$slots:{default:[BC,({uniqueId:y})=>({12:y}),({uniqueId:y})=>y?4096:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field "+((g=n[1].options)!=null&&g.requireEmail?"required":""),name:"email",$$slots:{default:[WC,({uniqueId:y})=>({12:y}),({uniqueId:y})=>y?4096:0]},$$scope:{ctx:n}}});let m=!n[0].isNew&&qd(n),b=(n[0].isNew||n[2])&&Vd(n);return d=new _e({props:{class:"form-field form-field-toggle",name:"verified",$$slots:{default:[JC,({uniqueId:y})=>({12:y}),({uniqueId:y})=>y?4096:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),r=O(),a=v("div"),m&&m.c(),u=O(),b&&b.c(),f=O(),c=v("div"),j(d.$$.fragment),p(t,"class","col-lg-6"),p(l,"class","col-lg-6"),p(a,"class","col-lg-12"),p(c,"class","col-lg-12"),p(e,"class","grid m-b-base")},m(y,k){$(y,e,k),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),_(e,r),_(e,a),m&&m.m(a,null),_(a,u),b&&b.m(a,null),_(e,f),_(e,c),R(d,c,null),h=!0},p(y,[k]){var T;const w={};k&1&&(w.class="form-field "+(y[0].isNew?"":"required")),k&12289&&(w.$$scope={dirty:k,ctx:y}),i.$set(w);const C={};k&2&&(C.class="form-field "+((T=y[1].options)!=null&&T.requireEmail?"required":"")),k&12291&&(C.$$scope={dirty:k,ctx:y}),o.$set(C),y[0].isNew?m&&(be(),I(m,1,1,()=>{m=null}),ve()):m?(m.p(y,k),k&1&&E(m,1)):(m=qd(y),m.c(),E(m,1),m.m(a,u)),y[0].isNew||y[2]?b?(b.p(y,k),k&5&&E(b,1)):(b=Vd(y),b.c(),E(b,1),b.m(a,null)):b&&(be(),I(b,1,1,()=>{b=null}),ve());const M={};k&12289&&(M.$$scope={dirty:k,ctx:y}),d.$set(M)},i(y){h||(E(i.$$.fragment,y),E(o.$$.fragment,y),E(m),E(b),E(d.$$.fragment,y),h=!0)},o(y){I(i.$$.fragment,y),I(o.$$.fragment,y),I(m),I(b),I(d.$$.fragment,y),h=!1},d(y){y&&S(e),H(i),H(o),m&&m.d(),b&&b.d(),H(d)}}}function GC(n,e,t){let{collection:i=new Pn}=e,{record:s=new Ui}=e,l=s.username||null,o=!1;function r(){s.username=this.value,t(0,s),t(2,o)}const a=()=>t(0,s.emailVisibility=!s.emailVisibility,s);function u(){s.email=this.value,t(0,s),t(2,o)}function f(){o=this.checked,t(2,o)}function c(){s.password=this.value,t(0,s),t(2,o)}function d(){s.passwordConfirm=this.value,t(0,s),t(2,o)}function h(){s.verified=this.checked,t(0,s),t(2,o)}const m=b=>{s.isNew||yn("Do you really want to manually change the verified account state?",()=>{},()=>{t(0,s.verified=!b.target.checked,s)})};return n.$$set=b=>{"collection"in b&&t(1,i=b.collection),"record"in b&&t(0,s=b.record)},n.$$.update=()=>{n.$$.dirty&1&&!s.username&&s.username!==null&&t(0,s.username=null,s),n.$$.dirty&4&&(o||(t(0,s.password=null,s),t(0,s.passwordConfirm=null,s),al("password"),al("passwordConfirm")))},[s,i,o,l,r,a,u,f,c,d,h,m]}class XC extends Me{constructor(e){super(),Ce(this,e,GC,ZC,we,{collection:1,record:0})}}function QC(n){let e,t,i,s=[n[3]],l={};for(let o=0;o{r&&(t(1,r.style.height="",r),t(1,r.style.height=Math.min(r.scrollHeight+2,o)+"px",r))},0)}function f(h){if((h==null?void 0:h.code)==="Enter"&&!(h!=null&&h.shiftKey)){h.preventDefault();const m=r.closest("form");m!=null&&m.requestSubmit&&m.requestSubmit()}}un(()=>(u(),()=>clearTimeout(a)));function c(h){le[h?"unshift":"push"](()=>{r=h,t(1,r)})}function d(){l=this.value,t(0,l)}return n.$$set=h=>{e=Ye(Ye({},e),Un(h)),t(3,s=wt(e,i)),"value"in h&&t(0,l=h.value),"maxHeight"in h&&t(4,o=h.maxHeight)},n.$$.update=()=>{n.$$.dirty&1&&typeof l!==void 0&&u()},[l,r,f,s,o,c,d]}class e3 extends Me{constructor(e){super(),Ce(this,e,xC,QC,we,{value:0,maxHeight:4})}}function t3(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d;function h(b){n[2](b)}let m={id:n[3],required:n[1].required};return n[0]!==void 0&&(m.value=n[0]),f=new e3({props:m}),le.push(()=>ke(f,"value",h)),{c(){e=v("label"),t=v("i"),s=O(),l=v("span"),r=z(o),u=O(),j(f.$$.fragment),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3])},m(b,g){$(b,e,g),_(e,t),_(e,s),_(e,l),_(l,r),$(b,u,g),R(f,b,g),d=!0},p(b,g){(!d||g&2&&i!==(i=B.getFieldTypeIcon(b[1].type)))&&p(t,"class",i),(!d||g&2)&&o!==(o=b[1].name+"")&&ue(r,o),(!d||g&8&&a!==(a=b[3]))&&p(e,"for",a);const y={};g&8&&(y.id=b[3]),g&2&&(y.required=b[1].required),!c&&g&1&&(c=!0,y.value=b[0],$e(()=>c=!1)),f.$set(y)},i(b){d||(E(f.$$.fragment,b),d=!0)},o(b){I(f.$$.fragment,b),d=!1},d(b){b&&S(e),b&&S(u),H(f,b)}}}function n3(n){let e,t;return e=new _e({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[t3,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function i3(n,e,t){let{field:i=new fn}=e,{value:s=void 0}=e;function l(o){s=o,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class s3 extends Me{constructor(e){super(),Ce(this,e,i3,n3,we,{field:1,value:0})}}function l3(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,m,b,g;return{c(){var y,k;e=v("label"),t=v("i"),s=O(),l=v("span"),r=z(o),u=O(),f=v("input"),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"type","number"),p(f,"id",c=n[3]),f.required=d=n[1].required,p(f,"min",h=(y=n[1].options)==null?void 0:y.min),p(f,"max",m=(k=n[1].options)==null?void 0:k.max),p(f,"step","any")},m(y,k){$(y,e,k),_(e,t),_(e,s),_(e,l),_(l,r),$(y,u,k),$(y,f,k),he(f,n[0]),b||(g=U(f,"input",n[2]),b=!0)},p(y,k){var w,C;k&2&&i!==(i=B.getFieldTypeIcon(y[1].type))&&p(t,"class",i),k&2&&o!==(o=y[1].name+"")&&ue(r,o),k&8&&a!==(a=y[3])&&p(e,"for",a),k&8&&c!==(c=y[3])&&p(f,"id",c),k&2&&d!==(d=y[1].required)&&(f.required=d),k&2&&h!==(h=(w=y[1].options)==null?void 0:w.min)&&p(f,"min",h),k&2&&m!==(m=(C=y[1].options)==null?void 0:C.max)&&p(f,"max",m),k&1&&rt(f.value)!==y[0]&&he(f,y[0])},d(y){y&&S(e),y&&S(u),y&&S(f),b=!1,g()}}}function o3(n){let e,t;return e=new _e({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[l3,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function r3(n,e,t){let{field:i=new fn}=e,{value:s=void 0}=e;function l(){s=rt(this.value),t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class a3 extends Me{constructor(e){super(),Ce(this,e,r3,o3,we,{field:1,value:0})}}function u3(n){let e,t,i,s,l=n[1].name+"",o,r,a,u;return{c(){e=v("input"),i=O(),s=v("label"),o=z(l),p(e,"type","checkbox"),p(e,"id",t=n[3]),p(s,"for",r=n[3])},m(f,c){$(f,e,c),e.checked=n[0],$(f,i,c),$(f,s,c),_(s,o),a||(u=U(e,"change",n[2]),a=!0)},p(f,c){c&8&&t!==(t=f[3])&&p(e,"id",t),c&1&&(e.checked=f[0]),c&2&&l!==(l=f[1].name+"")&&ue(o,l),c&8&&r!==(r=f[3])&&p(s,"for",r)},d(f){f&&S(e),f&&S(i),f&&S(s),a=!1,u()}}}function f3(n){let e,t;return e=new _e({props:{class:"form-field form-field-toggle "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[u3,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field form-field-toggle "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function c3(n,e,t){let{field:i=new fn}=e,{value:s=!1}=e;function l(){s=this.checked,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class d3 extends Me{constructor(e){super(),Ce(this,e,c3,f3,we,{field:1,value:0})}}function p3(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,m;return{c(){e=v("label"),t=v("i"),s=O(),l=v("span"),r=z(o),u=O(),f=v("input"),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"type","email"),p(f,"id",c=n[3]),f.required=d=n[1].required},m(b,g){$(b,e,g),_(e,t),_(e,s),_(e,l),_(l,r),$(b,u,g),$(b,f,g),he(f,n[0]),h||(m=U(f,"input",n[2]),h=!0)},p(b,g){g&2&&i!==(i=B.getFieldTypeIcon(b[1].type))&&p(t,"class",i),g&2&&o!==(o=b[1].name+"")&&ue(r,o),g&8&&a!==(a=b[3])&&p(e,"for",a),g&8&&c!==(c=b[3])&&p(f,"id",c),g&2&&d!==(d=b[1].required)&&(f.required=d),g&1&&f.value!==b[0]&&he(f,b[0])},d(b){b&&S(e),b&&S(u),b&&S(f),h=!1,m()}}}function h3(n){let e,t;return e=new _e({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[p3,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function m3(n,e,t){let{field:i=new fn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class g3 extends Me{constructor(e){super(),Ce(this,e,m3,h3,we,{field:1,value:0})}}function _3(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,m;return{c(){e=v("label"),t=v("i"),s=O(),l=v("span"),r=z(o),u=O(),f=v("input"),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"type","url"),p(f,"id",c=n[3]),f.required=d=n[1].required},m(b,g){$(b,e,g),_(e,t),_(e,s),_(e,l),_(l,r),$(b,u,g),$(b,f,g),he(f,n[0]),h||(m=U(f,"input",n[2]),h=!0)},p(b,g){g&2&&i!==(i=B.getFieldTypeIcon(b[1].type))&&p(t,"class",i),g&2&&o!==(o=b[1].name+"")&&ue(r,o),g&8&&a!==(a=b[3])&&p(e,"for",a),g&8&&c!==(c=b[3])&&p(f,"id",c),g&2&&d!==(d=b[1].required)&&(f.required=d),g&1&&he(f,b[0])},d(b){b&&S(e),b&&S(u),b&&S(f),h=!1,m()}}}function b3(n){let e,t;return e=new _e({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[_3,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function v3(n,e,t){let{field:i=new fn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class y3 extends Me{constructor(e){super(),Ce(this,e,v3,b3,we,{field:1,value:0})}}function k3(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h;function m(g){n[2](g)}let b={id:n[3],options:B.defaultFlatpickrOptions(),value:n[0]};return n[0]!==void 0&&(b.formattedValue=n[0]),c=new Ka({props:b}),le.push(()=>ke(c,"formattedValue",m)),{c(){e=v("label"),t=v("i"),s=O(),l=v("span"),r=z(o),a=z(" (UTC)"),f=O(),j(c.$$.fragment),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",u=n[3])},m(g,y){$(g,e,y),_(e,t),_(e,s),_(e,l),_(l,r),_(l,a),$(g,f,y),R(c,g,y),h=!0},p(g,y){(!h||y&2&&i!==(i=B.getFieldTypeIcon(g[1].type)))&&p(t,"class",i),(!h||y&2)&&o!==(o=g[1].name+"")&&ue(r,o),(!h||y&8&&u!==(u=g[3]))&&p(e,"for",u);const k={};y&8&&(k.id=g[3]),y&1&&(k.value=g[0]),!d&&y&1&&(d=!0,k.formattedValue=g[0],$e(()=>d=!1)),c.$set(k)},i(g){h||(E(c.$$.fragment,g),h=!0)},o(g){I(c.$$.fragment,g),h=!1},d(g){g&&S(e),g&&S(f),H(c,g)}}}function w3(n){let e,t;return e=new _e({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[k3,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function S3(n,e,t){let{field:i=new fn}=e,{value:s=void 0}=e;function l(o){s=o,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},n.$$.update=()=>{n.$$.dirty&1&&s&&s.length>19&&t(0,s=s.substring(0,19))},[s,i,l]}class $3 extends Me{constructor(e){super(),Ce(this,e,S3,w3,we,{field:1,value:0})}}function zd(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=v("div"),t=z("Select up to "),s=z(i),l=z(" items."),p(e,"class","help-block")},m(o,r){$(o,e,r),_(e,t),_(e,s),_(e,l)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&ue(s,i)},d(o){o&&S(e)}}}function C3(n){var k,w,C;let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,m;function b(M){n[3](M)}let g={id:n[4],toggle:!n[1].required||n[2],multiple:n[2],items:(k=n[1].options)==null?void 0:k.values,searchable:((w=n[1].options)==null?void 0:w.values)>5};n[0]!==void 0&&(g.selected=n[0]),f=new $_({props:g}),le.push(()=>ke(f,"selected",b));let y=((C=n[1].options)==null?void 0:C.maxSelect)>1&&zd(n);return{c(){e=v("label"),t=v("i"),s=O(),l=v("span"),r=z(o),u=O(),j(f.$$.fragment),d=O(),y&&y.c(),h=Fe(),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[4])},m(M,T){$(M,e,T),_(e,t),_(e,s),_(e,l),_(l,r),$(M,u,T),R(f,M,T),$(M,d,T),y&&y.m(M,T),$(M,h,T),m=!0},p(M,T){var A,P,L;(!m||T&2&&i!==(i=B.getFieldTypeIcon(M[1].type)))&&p(t,"class",i),(!m||T&2)&&o!==(o=M[1].name+"")&&ue(r,o),(!m||T&16&&a!==(a=M[4]))&&p(e,"for",a);const D={};T&16&&(D.id=M[4]),T&6&&(D.toggle=!M[1].required||M[2]),T&4&&(D.multiple=M[2]),T&2&&(D.items=(A=M[1].options)==null?void 0:A.values),T&2&&(D.searchable=((P=M[1].options)==null?void 0:P.values)>5),!c&&T&1&&(c=!0,D.selected=M[0],$e(()=>c=!1)),f.$set(D),((L=M[1].options)==null?void 0:L.maxSelect)>1?y?y.p(M,T):(y=zd(M),y.c(),y.m(h.parentNode,h)):y&&(y.d(1),y=null)},i(M){m||(E(f.$$.fragment,M),m=!0)},o(M){I(f.$$.fragment,M),m=!1},d(M){M&&S(e),M&&S(u),H(f,M),M&&S(d),y&&y.d(M),M&&S(h)}}}function M3(n){let e,t;return e=new _e({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[C3,({uniqueId:i})=>({4:i}),({uniqueId:i})=>i?16:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&55&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function T3(n,e,t){let i,{field:s=new fn}=e,{value:l=void 0}=e;function o(r){l=r,t(0,l),t(2,i),t(1,s)}return n.$$set=r=>{"field"in r&&t(1,s=r.field),"value"in r&&t(0,l=r.value)},n.$$.update=()=>{var r;n.$$.dirty&2&&t(2,i=((r=s.options)==null?void 0:r.maxSelect)>1),n.$$.dirty&5&&typeof l>"u"&&t(0,l=i?[]:""),n.$$.dirty&7&&i&&Array.isArray(l)&&l.length>s.options.maxSelect&&t(0,l=l.slice(l.length-s.options.maxSelect))},[l,s,i,o]}class O3 extends Me{constructor(e){super(),Ce(this,e,T3,M3,we,{field:1,value:0})}}function D3(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,m;return{c(){e=v("label"),t=v("i"),s=O(),l=v("span"),r=z(o),u=O(),f=v("textarea"),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"id",c=n[3]),f.required=d=n[1].required,p(f,"class","txt-mono")},m(b,g){$(b,e,g),_(e,t),_(e,s),_(e,l),_(l,r),$(b,u,g),$(b,f,g),he(f,n[0]),h||(m=U(f,"input",n[2]),h=!0)},p(b,g){g&2&&i!==(i=B.getFieldTypeIcon(b[1].type))&&p(t,"class",i),g&2&&o!==(o=b[1].name+"")&&ue(r,o),g&8&&a!==(a=b[3])&&p(e,"for",a),g&8&&c!==(c=b[3])&&p(f,"id",c),g&2&&d!==(d=b[1].required)&&(f.required=d),g&1&&he(f,b[0])},d(b){b&&S(e),b&&S(u),b&&S(f),h=!1,m()}}}function E3(n){let e,t;return e=new _e({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[D3,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function A3(n,e,t){let{field:i=new fn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},n.$$.update=()=>{n.$$.dirty&1&&typeof s<"u"&&typeof s!="string"&&s!==null&&t(0,s=JSON.stringify(s,null,2))},[s,i,l]}class I3 extends Me{constructor(e){super(),Ce(this,e,A3,E3,we,{field:1,value:0})}}function P3(n){let e,t;return{c(){e=v("i"),p(e,"class","ri-file-line"),p(e,"alt",t=n[0].name)},m(i,s){$(i,e,s)},p(i,s){s&1&&t!==(t=i[0].name)&&p(e,"alt",t)},d(i){i&&S(e)}}}function L3(n){let e,t,i;return{c(){e=v("img"),Ln(e.src,t=n[2])||p(e,"src",t),p(e,"width",n[1]),p(e,"height",n[1]),p(e,"alt",i=n[0].name)},m(s,l){$(s,e,l)},p(s,l){l&4&&!Ln(e.src,t=s[2])&&p(e,"src",t),l&2&&p(e,"width",s[1]),l&2&&p(e,"height",s[1]),l&1&&i!==(i=s[0].name)&&p(e,"alt",i)},d(s){s&&S(e)}}}function N3(n){let e;function t(l,o){return l[2]?L3:P3}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:x,o:x,d(l){s.d(l),l&&S(e)}}}function F3(n,e,t){let i,{file:s}=e,{size:l=50}=e;function o(){t(2,i=""),B.hasImageExtension(s==null?void 0:s.name)&&B.generateThumb(s,l,l).then(r=>{t(2,i=r)}).catch(r=>{console.warn("Unable to generate thumb: ",r)})}return n.$$set=r=>{"file"in r&&t(0,s=r.file),"size"in r&&t(1,l=r.size)},n.$$.update=()=>{n.$$.dirty&1&&typeof s<"u"&&o()},t(2,i=""),[s,l,i]}class R3 extends Me{constructor(e){super(),Ce(this,e,F3,N3,we,{file:0,size:1})}}function H3(n){let e,t,i;return{c(){e=v("img"),Ln(e.src,t=n[2])||p(e,"src",t),p(e,"alt",i="Preview "+n[2])},m(s,l){$(s,e,l)},p(s,l){l&4&&!Ln(e.src,t=s[2])&&p(e,"src",t),l&4&&i!==(i="Preview "+s[2])&&p(e,"alt",i)},d(s){s&&S(e)}}}function j3(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","overlay-close")},m(s,l){$(s,e,l),t||(i=U(e,"click",ut(n[0])),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function q3(n){let e,t=n[2].substring(n[2].lastIndexOf("/")+1)+"",i,s,l,o,r,a,u;return{c(){e=v("a"),i=z(t),s=O(),l=v("div"),o=O(),r=v("button"),r.textContent="Close",p(e,"href",n[2]),p(e,"title","Download"),p(e,"target","_blank"),p(e,"rel","noreferrer noopener"),p(e,"class","link-hint txt-ellipsis"),p(l,"class","flex-fill"),p(r,"type","button"),p(r,"class","btn btn-secondary")},m(f,c){$(f,e,c),_(e,i),$(f,s,c),$(f,l,c),$(f,o,c),$(f,r,c),a||(u=U(r,"click",n[0]),a=!0)},p(f,c){c&4&&t!==(t=f[2].substring(f[2].lastIndexOf("/")+1)+"")&&ue(i,t),c&4&&p(e,"href",f[2])},d(f){f&&S(e),f&&S(s),f&&S(l),f&&S(o),f&&S(r),a=!1,u()}}}function V3(n){let e,t,i={class:"image-preview",btnClose:!1,popup:!0,$$slots:{footer:[q3],header:[j3],default:[H3]},$$scope:{ctx:n}};return e=new Jn({props:i}),n[4](e),e.$on("show",n[5]),e.$on("hide",n[6]),{c(){j(e.$$.fragment)},m(s,l){R(e,s,l),t=!0},p(s,[l]){const o={};l&132&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){I(e.$$.fragment,s),t=!1},d(s){n[4](null),H(e,s)}}}function z3(n,e,t){let i,s="";function l(f){f!==""&&(t(2,s=f),i==null||i.show())}function o(){return i==null?void 0:i.hide()}function r(f){le[f?"unshift":"push"](()=>{i=f,t(1,i)})}function a(f){Ve.call(this,n,f)}function u(f){Ve.call(this,n,f)}return[o,i,s,l,r,a,u]}class B3 extends Me{constructor(e){super(),Ce(this,e,z3,V3,we,{show:3,hide:0})}get show(){return this.$$.ctx[3]}get hide(){return this.$$.ctx[0]}}function W3(n){let e;return{c(){e=v("i"),p(e,"class","ri-file-line")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function U3(n){let e,t,i,s,l;return{c(){e=v("img"),Ln(e.src,t=n[4])||p(e,"src",t),p(e,"alt",n[0]),p(e,"title",i="Preview "+n[0]),ee(e,"link-fade",n[2])},m(o,r){$(o,e,r),s||(l=[U(e,"click",n[7]),U(e,"error",n[5])],s=!0)},p(o,r){r&16&&!Ln(e.src,t=o[4])&&p(e,"src",t),r&1&&p(e,"alt",o[0]),r&1&&i!==(i="Preview "+o[0])&&p(e,"title",i),r&4&&ee(e,"link-fade",o[2])},d(o){o&&S(e),s=!1,Re(l)}}}function Y3(n){let e,t,i;function s(a,u){return a[2]?U3:W3}let l=s(n),o=l(n),r={};return t=new B3({props:r}),n[8](t),{c(){o.c(),e=O(),j(t.$$.fragment)},m(a,u){o.m(a,u),$(a,e,u),R(t,a,u),i=!0},p(a,[u]){l===(l=s(a))&&o?o.p(a,u):(o.d(1),o=l(a),o&&(o.c(),o.m(e.parentNode,e)));const f={};t.$set(f)},i(a){i||(E(t.$$.fragment,a),i=!0)},o(a){I(t.$$.fragment,a),i=!1},d(a){o.d(a),a&&S(e),n[8](null),H(t,a)}}}function K3(n,e,t){let i,{record:s}=e,{filename:l}=e,o,r="",a="";function u(){t(4,r="")}const f=d=>{d.stopPropagation(),o==null||o.show(a)};function c(d){le[d?"unshift":"push"](()=>{o=d,t(3,o)})}return n.$$set=d=>{"record"in d&&t(6,s=d.record),"filename"in d&&t(0,l=d.filename)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=B.hasImageExtension(l)),n.$$.dirty&69&&i&&t(1,a=me.getFileUrl(s,`${l}`)),n.$$.dirty&2&&t(4,r=a?a+"?thumb=100x100":"")},[l,a,i,o,r,u,s,f,c]}class O_ extends Me{constructor(e){super(),Ce(this,e,K3,Y3,we,{record:6,filename:0})}}function Bd(n,e,t){const i=n.slice();return i[22]=e[t],i[24]=t,i}function Wd(n,e,t){const i=n.slice();return i[25]=e[t],i[24]=t,i}function J3(n){let e,t,i;function s(){return n[14](n[24])}return{c(){e=v("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-secondary btn-sm btn-circle btn-remove txt-hint")},m(l,o){$(l,e,o),t||(i=[Le(Be.call(null,e,"Remove file")),U(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&S(e),t=!1,Re(i)}}}function Z3(n){let e,t,i;function s(){return n[13](n[24])}return{c(){e=v("button"),e.innerHTML='Restore',p(e,"type","button"),p(e,"class","btn btn-sm btn-danger btn-secondary")},m(l,o){$(l,e,o),t||(i=U(e,"click",s),t=!0)},p(l,o){n=l},d(l){l&&S(e),t=!1,i()}}}function Ud(n,e){let t,i,s,l,o,r=e[25]+"",a,u,f,c,d,h,m;s=new O_({props:{record:e[2],filename:e[25]}});function b(k,w){return w&18&&(c=null),c==null&&(c=!!k[1].includes(k[24])),c?Z3:J3}let g=b(e,-1),y=g(e);return{key:n,first:null,c(){t=v("div"),i=v("figure"),j(s.$$.fragment),l=O(),o=v("a"),a=z(r),f=O(),y.c(),p(i,"class","thumb"),ee(i,"fade",e[1].includes(e[24])),p(o,"href",u=me.getFileUrl(e[2],e[25])),p(o,"class","filename link-hint"),p(o,"target","_blank"),p(o,"rel","noopener noreferrer"),ee(o,"txt-strikethrough",e[1].includes(e[24])),p(t,"class","list-item"),this.first=t},m(k,w){$(k,t,w),_(t,i),R(s,i,null),_(t,l),_(t,o),_(o,a),_(t,f),y.m(t,null),d=!0,h||(m=Le(Be.call(null,o,{position:"right",text:"Download"})),h=!0)},p(k,w){e=k;const C={};w&4&&(C.record=e[2]),w&16&&(C.filename=e[25]),s.$set(C),(!d||w&18)&&ee(i,"fade",e[1].includes(e[24])),(!d||w&16)&&r!==(r=e[25]+"")&&ue(a,r),(!d||w&20&&u!==(u=me.getFileUrl(e[2],e[25])))&&p(o,"href",u),(!d||w&18)&&ee(o,"txt-strikethrough",e[1].includes(e[24])),g===(g=b(e,w))&&y?y.p(e,w):(y.d(1),y=g(e),y&&(y.c(),y.m(t,null)))},i(k){d||(E(s.$$.fragment,k),d=!0)},o(k){I(s.$$.fragment,k),d=!1},d(k){k&&S(t),H(s),y.d(),h=!1,m()}}}function Yd(n){let e,t,i,s,l,o,r,a,u=n[22].name+"",f,c,d,h,m,b,g;i=new R3({props:{file:n[22]}});function y(){return n[15](n[24])}return{c(){e=v("div"),t=v("figure"),j(i.$$.fragment),s=O(),l=v("div"),o=v("small"),o.textContent="New",r=O(),a=v("span"),f=z(u),d=O(),h=v("button"),h.innerHTML='',p(t,"class","thumb"),p(o,"class","label label-success m-r-5"),p(a,"class","txt"),p(l,"class","filename"),p(l,"title",c=n[22].name),p(h,"type","button"),p(h,"class","btn btn-secondary btn-sm btn-circle btn-remove"),p(e,"class","list-item")},m(k,w){$(k,e,w),_(e,t),R(i,t,null),_(e,s),_(e,l),_(l,o),_(l,r),_(l,a),_(a,f),_(e,d),_(e,h),m=!0,b||(g=[Le(Be.call(null,h,"Remove file")),U(h,"click",y)],b=!0)},p(k,w){n=k;const C={};w&1&&(C.file=n[22]),i.$set(C),(!m||w&1)&&u!==(u=n[22].name+"")&&ue(f,u),(!m||w&1&&c!==(c=n[22].name))&&p(l,"title",c)},i(k){m||(E(i.$$.fragment,k),m=!0)},o(k){I(i.$$.fragment,k),m=!1},d(k){k&&S(e),H(i),b=!1,Re(g)}}}function Kd(n){let e,t,i,s,l,o;return{c(){e=v("div"),t=v("input"),i=O(),s=v("button"),s.innerHTML=` + Upload new file`,p(t,"type","file"),p(t,"class","hidden"),t.multiple=n[5],p(s,"type","button"),p(s,"class","btn btn-secondary btn-sm btn-block"),p(e,"class","list-item btn-list-item")},m(r,a){$(r,e,a),_(e,t),n[16](t),_(e,i),_(e,s),l||(o=[U(t,"change",n[17]),U(s,"click",n[18])],l=!0)},p(r,a){a&32&&(t.multiple=r[5])},d(r){r&&S(e),n[16](null),l=!1,Re(o)}}}function G3(n){let e,t,i,s,l,o=n[3].name+"",r,a,u,f,c=[],d=new Map,h,m,b,g=n[4];const y=T=>T[25];for(let T=0;TI(w[T],1,1,()=>{w[T]=null});let M=!n[8]&&Kd(n);return{c(){e=v("label"),t=v("i"),s=O(),l=v("span"),r=z(o),u=O(),f=v("div");for(let T=0;T({21:i}),({uniqueId:i})=>i?2097152:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&8&&(l.class="form-field form-field-file "+(i[3].required?"required":"")),s&8&&(l.name=i[3].name),s&136315391&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function Q3(n,e,t){let i,s,l,{record:o}=e,{value:r=""}=e,{uploadedFiles:a=[]}=e,{deletedFileIndexes:u=[]}=e,{field:f=new fn}=e,c,d;function h(A){B.removeByValue(u,A),t(1,u)}function m(A){B.pushUnique(u,A),t(1,u)}function b(A){B.isEmpty(a[A])||a.splice(A,1),t(0,a)}function g(){d==null||d.dispatchEvent(new CustomEvent("change",{detail:{value:r,uploadedFiles:a,deletedFileIndexes:u},bubbles:!0}))}const y=A=>h(A),k=A=>m(A),w=A=>b(A);function C(A){le[A?"unshift":"push"](()=>{c=A,t(6,c)})}const M=()=>{for(let A of c.files)a.push(A);t(0,a),t(6,c.value=null,c)},T=()=>c==null?void 0:c.click();function D(A){le[A?"unshift":"push"](()=>{d=A,t(7,d)})}return n.$$set=A=>{"record"in A&&t(2,o=A.record),"value"in A&&t(12,r=A.value),"uploadedFiles"in A&&t(0,a=A.uploadedFiles),"deletedFileIndexes"in A&&t(1,u=A.deletedFileIndexes),"field"in A&&t(3,f=A.field)},n.$$.update=()=>{var A,P;n.$$.dirty&1&&(Array.isArray(a)||t(0,a=B.toArray(a))),n.$$.dirty&2&&(Array.isArray(u)||t(1,u=B.toArray(u))),n.$$.dirty&8&&t(5,i=((A=f.options)==null?void 0:A.maxSelect)>1),n.$$.dirty&4128&&B.isEmpty(r)&&t(12,r=i?[]:""),n.$$.dirty&4096&&t(4,s=B.toArray(r)),n.$$.dirty&27&&t(8,l=(s.length||a.length)&&((P=f.options)==null?void 0:P.maxSelect)<=s.length+a.length-u.length),n.$$.dirty&3&&(a!==-1||u!==-1)&&g()},[a,u,o,f,s,i,c,d,l,h,m,b,r,y,k,w,C,M,T,D]}class x3 extends Me{constructor(e){super(),Ce(this,e,Q3,X3,we,{record:2,value:12,uploadedFiles:0,deletedFileIndexes:1,field:3})}}function Jd(n){let e,t;return{c(){e=v("small"),t=z(n[1]),p(e,"class","block txt-hint txt-ellipsis")},m(i,s){$(i,e,s),_(e,t)},p(i,s){s&2&&ue(t,i[1])},d(i){i&&S(e)}}}function eM(n){let e,t,i,s,l,o=n[0].id+"",r,a,u,f,c=n[1]!==""&&n[1]!==n[0].id&&Jd(n);return{c(){e=v("i"),i=O(),s=v("div"),l=v("div"),r=z(o),a=O(),c&&c.c(),p(e,"class","ri-information-line link-hint"),p(l,"class","block txt-ellipsis"),p(s,"class","content svelte-1gjwqyd")},m(d,h){$(d,e,h),$(d,i,h),$(d,s,h),_(s,l),_(l,r),_(s,a),c&&c.m(s,null),u||(f=Le(t=Be.call(null,e,{text:JSON.stringify(n[0],null,2),position:"left",class:"code"})),u=!0)},p(d,[h]){t&&Wt(t.update)&&h&1&&t.update.call(null,{text:JSON.stringify(d[0],null,2),position:"left",class:"code"}),h&1&&o!==(o=d[0].id+"")&&ue(r,o),d[1]!==""&&d[1]!==d[0].id?c?c.p(d,h):(c=Jd(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i:x,o:x,d(d){d&&S(e),d&&S(i),d&&S(s),c&&c.d(),u=!1,f()}}}function tM(n,e,t){let i;const s=["id","created","updated","@collectionId","@collectionName"];let{item:l={}}=e;function o(r){r=r||{};const a=["title","name","email","username","label","key","heading","content","description",...Object.keys(r)];for(const u of a)if(typeof r[u]=="string"&&!B.isEmpty(r[u])&&!s.includes(u))return u+": "+r[u];return""}return n.$$set=r=>{"item"in r&&t(0,l=r.item)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=o(l))},[l,i]}class nM extends Me{constructor(e){super(),Ce(this,e,tM,eM,we,{item:0})}}function Zd(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='New record',p(e,"type","button"),p(e,"class","btn btn-warning btn-block btn-sm m-t-5")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[17]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function Gd(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='Load more',p(e,"type","button"),p(e,"class","btn btn-block btn-sm m-t-5"),ee(e,"btn-loading",n[6]),ee(e,"btn-disabled",n[6])},m(s,l){$(s,e,l),t||(i=U(e,"click",Yn(n[18])),t=!0)},p(s,l){l&64&&ee(e,"btn-loading",s[6]),l&64&&ee(e,"btn-disabled",s[6])},d(s){s&&S(e),t=!1,i()}}}function iM(n){let e,t,i=!n[7]&&n[8]&&Zd(n),s=n[10]&&Gd(n);return{c(){i&&i.c(),e=O(),s&&s.c(),t=Fe()},m(l,o){i&&i.m(l,o),$(l,e,o),s&&s.m(l,o),$(l,t,o)},p(l,o){!l[7]&&l[8]?i?i.p(l,o):(i=Zd(l),i.c(),i.m(e.parentNode,e)):i&&(i.d(1),i=null),l[10]?s?s.p(l,o):(s=Gd(l),s.c(),s.m(t.parentNode,t)):s&&(s.d(1),s=null)},d(l){i&&i.d(l),l&&S(e),s&&s.d(l),l&&S(t)}}}function sM(n){let e,t,i,s,l,o;const r=[{selectPlaceholder:n[11]?"Loading...":n[3]},{items:n[5]},{searchable:n[5].length>5},{selectionKey:"id"},{labelComponent:n[4]},{disabled:n[11]},{optionComponent:n[4]},{multiple:n[2]},{class:"records-select block-options"},n[13]];function a(d){n[19](d)}function u(d){n[20](d)}let f={$$slots:{afterOptions:[iM]},$$scope:{ctx:n}};for(let d=0;dke(e,"keyOfSelected",a)),le.push(()=>ke(e,"selected",u)),e.$on("show",n[21]),e.$on("hide",n[22]);let c={collection:n[8]};return l=new D_({props:c}),n[23](l),l.$on("save",n[24]),{c(){j(e.$$.fragment),s=O(),j(l.$$.fragment)},m(d,h){R(e,d,h),$(d,s,h),R(l,d,h),o=!0},p(d,[h]){const m=h&10300?Ut(r,[h&2056&&{selectPlaceholder:d[11]?"Loading...":d[3]},h&32&&{items:d[5]},h&32&&{searchable:d[5].length>5},r[3],h&16&&{labelComponent:d[4]},h&2048&&{disabled:d[11]},h&16&&{optionComponent:d[4]},h&4&&{multiple:d[2]},r[8],h&8192&&Kn(d[13])]):{};h&536872896&&(m.$$scope={dirty:h,ctx:d}),!t&&h&2&&(t=!0,m.keyOfSelected=d[1],$e(()=>t=!1)),!i&&h&1&&(i=!0,m.selected=d[0],$e(()=>i=!1)),e.$set(m);const b={};h&256&&(b.collection=d[8]),l.$set(b)},i(d){o||(E(e.$$.fragment,d),E(l.$$.fragment,d),o=!0)},o(d){I(e.$$.fragment,d),I(l.$$.fragment,d),o=!1},d(d){H(e,d),d&&S(s),n[23](null),H(l,d)}}}function lM(n,e,t){let i,s;const l=["multiple","selected","keyOfSelected","selectPlaceholder","optionComponent","collectionId"];let o=wt(e,l);const r="select_"+B.randomString(5);let{multiple:a=!1}=e,{selected:u=[]}=e,{keyOfSelected:f=a?[]:void 0}=e,{selectPlaceholder:c="- Select -"}=e,{optionComponent:d=nM}=e,{collectionId:h}=e,m=[],b=1,g=0,y=!1,k=!1,w=!1,C=null,M;async function T(){if(!h){t(8,C=null),t(7,w=!1);return}t(7,w=!0);try{t(8,C=await me.collections.getOne(h,{$cancelKey:"collection_"+r}))}catch(Z){me.errorResponseHandler(Z)}t(7,w=!1)}async function D(){const Z=B.toArray(f);if(!h||!Z.length)return;t(16,k=!0);let ie=[];const J=Z.slice(),fe=[];for(;J.length>0;){const Y=[];for(const re of J.splice(0,50))Y.push(`id="${re}"`);fe.push(me.collection(h).getFullList(200,{filter:Y.join("||"),$autoCancel:!1}))}try{await Promise.all(fe).then(Y=>{ie=ie.concat(...Y)}),t(0,u=[]);for(const Y of Z){const re=B.findByKey(ie,"id",Y);re&&u.push(re)}t(5,m=B.filterDuplicatesByKey(u.concat(m)))}catch(Y){me.errorResponseHandler(Y)}t(16,k=!1)}async function A(Z=!1){if(!!h){t(6,y=!0);try{const ie=Z?1:b+1,J=await me.collection(h).getList(ie,200,{sort:"-created",$cancelKey:r+"loadList"});Z&&t(5,m=B.toArray(u).slice()),t(5,m=B.filterDuplicatesByKey(m.concat(J.items,B.toArray(u)))),b=J.page,t(15,g=J.totalItems)}catch(ie){me.errorResponseHandler(ie)}t(6,y=!1)}}const P=()=>M==null?void 0:M.show(),L=()=>A();function V(Z){f=Z,t(1,f)}function F(Z){u=Z,t(0,u)}function W(Z){Ve.call(this,n,Z)}function G(Z){Ve.call(this,n,Z)}function K(Z){le[Z?"unshift":"push"](()=>{M=Z,t(9,M)})}const X=Z=>{var ie;(ie=Z==null?void 0:Z.detail)!=null&&ie.id&&t(1,f=B.toArray(f).concat(Z.detail.id)),A(!0)};return n.$$set=Z=>{e=Ye(Ye({},e),Un(Z)),t(13,o=wt(e,l)),"multiple"in Z&&t(2,a=Z.multiple),"selected"in Z&&t(0,u=Z.selected),"keyOfSelected"in Z&&t(1,f=Z.keyOfSelected),"selectPlaceholder"in Z&&t(3,c=Z.selectPlaceholder),"optionComponent"in Z&&t(4,d=Z.optionComponent),"collectionId"in Z&&t(14,h=Z.collectionId)},n.$$.update=()=>{n.$$.dirty&16384&&h&&(T(),D().then(()=>{A(!0)})),n.$$.dirty&65600&&t(11,i=y||k),n.$$.dirty&32800&&t(10,s=g>m.length)},[u,f,a,c,d,m,y,w,C,M,s,i,A,o,h,g,k,P,L,V,F,W,G,K,X]}class oM extends Me{constructor(e){super(),Ce(this,e,lM,sM,we,{multiple:2,selected:0,keyOfSelected:1,selectPlaceholder:3,optionComponent:4,collectionId:14})}}function Xd(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=v("div"),t=z("Select up to "),s=z(i),l=z(" items."),p(e,"class","help-block")},m(o,r){$(o,e,r),_(e,t),_(e,s),_(e,l)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&ue(s,i)},d(o){o&&S(e)}}}function rM(n){var k,w;let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,m;function b(C){n[3](C)}let g={toggle:!0,id:n[4],multiple:n[2],collectionId:(k=n[1].options)==null?void 0:k.collectionId};n[0]!==void 0&&(g.keyOfSelected=n[0]),f=new oM({props:g}),le.push(()=>ke(f,"keyOfSelected",b));let y=((w=n[1].options)==null?void 0:w.maxSelect)>1&&Xd(n);return{c(){e=v("label"),t=v("i"),s=O(),l=v("span"),r=z(o),u=O(),j(f.$$.fragment),d=O(),y&&y.c(),h=Fe(),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[4])},m(C,M){$(C,e,M),_(e,t),_(e,s),_(e,l),_(l,r),$(C,u,M),R(f,C,M),$(C,d,M),y&&y.m(C,M),$(C,h,M),m=!0},p(C,M){var D,A;(!m||M&2&&i!==(i=B.getFieldTypeIcon(C[1].type)))&&p(t,"class",i),(!m||M&2)&&o!==(o=C[1].name+"")&&ue(r,o),(!m||M&16&&a!==(a=C[4]))&&p(e,"for",a);const T={};M&16&&(T.id=C[4]),M&4&&(T.multiple=C[2]),M&2&&(T.collectionId=(D=C[1].options)==null?void 0:D.collectionId),!c&&M&1&&(c=!0,T.keyOfSelected=C[0],$e(()=>c=!1)),f.$set(T),((A=C[1].options)==null?void 0:A.maxSelect)>1?y?y.p(C,M):(y=Xd(C),y.c(),y.m(h.parentNode,h)):y&&(y.d(1),y=null)},i(C){m||(E(f.$$.fragment,C),m=!0)},o(C){I(f.$$.fragment,C),m=!1},d(C){C&&S(e),C&&S(u),H(f,C),C&&S(d),y&&y.d(C),C&&S(h)}}}function aM(n){let e,t;return e=new _e({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[rM,({uniqueId:i})=>({4:i}),({uniqueId:i})=>i?16:0]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&55&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function uM(n,e,t){let i,{field:s=new fn}=e,{value:l=void 0}=e;function o(r){l=r,t(0,l),t(2,i),t(1,s)}return n.$$set=r=>{"field"in r&&t(1,s=r.field),"value"in r&&t(0,l=r.value)},n.$$.update=()=>{var r,a;n.$$.dirty&2&&t(2,i=((r=s.options)==null?void 0:r.maxSelect)!=1),n.$$.dirty&7&&i&&Array.isArray(l)&&((a=s.options)==null?void 0:a.maxSelect)&&l.length>s.options.maxSelect&&t(0,l=l.slice(s.options.maxSelect-1))},[l,s,i,o]}class fM extends Me{constructor(e){super(),Ce(this,e,uM,aM,we,{field:1,value:0})}}const gl={googleAuth:{title:"Google",icon:"ri-google-fill"},facebookAuth:{title:"Facebook",icon:"ri-facebook-fill"},twitterAuth:{title:"Twitter",icon:"ri-twitter-fill"},githubAuth:{title:"GitHub",icon:"ri-github-fill"},gitlabAuth:{title:"GitLab",icon:"ri-gitlab-fill",selfHosted:!0},discordAuth:{title:"Discord",icon:"ri-discord-fill"}};function Qd(n,e,t){const i=n.slice();return i[9]=e[t],i}function cM(n){let e;return{c(){e=v("p"),e.textContent="No linked OAuth2 providers.",p(e,"class","txt-hint txt-center")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function dM(n){let e,t=n[1],i=[];for(let s=0;s',p(e,"class","block txt-center")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function xd(n){let e,t,i,s,l,o=n[3](n[9].provider)+"",r,a,u,f,c=n[9].providerId+"",d,h,m,b,g,y;function k(){return n[6](n[9])}return{c(){e=v("div"),t=v("i"),s=O(),l=v("span"),r=z(o),a=O(),u=v("div"),f=z("ID: "),d=z(c),h=O(),m=v("button"),m.innerHTML='',b=O(),p(t,"class",i=n[4](n[9].provider)),p(l,"class","txt"),p(u,"class","txt-hint"),p(m,"type","button"),p(m,"class","btn btn-secondary link-hint btn-circle btn-sm m-l-auto"),p(e,"class","list-item")},m(w,C){$(w,e,C),_(e,t),_(e,s),_(e,l),_(l,r),_(e,a),_(e,u),_(u,f),_(u,d),_(e,h),_(e,m),_(e,b),g||(y=U(m,"click",k),g=!0)},p(w,C){n=w,C&2&&i!==(i=n[4](n[9].provider))&&p(t,"class",i),C&2&&o!==(o=n[3](n[9].provider)+"")&&ue(r,o),C&2&&c!==(c=n[9].providerId+"")&&ue(d,c)},d(w){w&&S(e),g=!1,y()}}}function hM(n){let e;function t(l,o){var r;return l[2]?pM:((r=l[0])==null?void 0:r.id)&&l[1].length?dM:cM}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:x,o:x,d(l){s.d(l),l&&S(e)}}}function mM(n,e,t){const i=It();let{record:s}=e,l=[],o=!1;function r(d){var h;return((h=gl[d+"Auth"])==null?void 0:h.title)||B.sentenize(auth.provider,!1)}function a(d){var h;return((h=gl[d+"Auth"])==null?void 0:h.icon)||`ri-${d}-line`}async function u(){if(!(s!=null&&s.id)){t(1,l=[]),t(2,o=!1);return}t(2,o=!0);try{t(1,l=await me.collection(s.collectionId).listExternalAuths(s.id))}catch(d){me.errorResponseHandler(d)}t(2,o=!1)}function f(d){!(s!=null&&s.id)||!d||yn(`Do you really want to unlink the ${r(d)} provider?`,()=>me.collection(s.collectionId).unlinkExternalAuth(s.id,d).then(()=>{Lt(`Successfully unlinked the ${r(d)} provider.`),i("unlink",d),u()}).catch(h=>{me.errorResponseHandler(h)}))}u();const c=d=>f(d.provider);return n.$$set=d=>{"record"in d&&t(0,s=d.record)},[s,l,o,r,a,f,c]}class gM extends Me{constructor(e){super(),Ce(this,e,mM,hM,we,{record:0})}}function ep(n,e,t){const i=n.slice();return i[46]=e[t],i[47]=e,i[48]=t,i}function tp(n){let e,t;return e=new _e({props:{class:"form-field disabled",name:"id",$$slots:{default:[_M,({uniqueId:i})=>({49:i}),({uniqueId:i})=>[0,i?262144:0]]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s[0]&4|s[1]&786432&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function _M(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y;return{c(){e=v("label"),t=v("i"),i=O(),s=v("span"),s.textContent="id",l=O(),o=v("span"),a=O(),u=v("div"),f=v("i"),d=O(),h=v("input"),p(t,"class",B.getFieldTypeIcon("primary")),p(s,"class","txt"),p(o,"class","flex-fill"),p(e,"for",r=n[49]),p(f,"class","ri-calendar-event-line txt-disabled"),p(u,"class","form-field-addon"),p(h,"type","text"),p(h,"id",m=n[49]),h.value=b=n[2].id,h.readOnly=!0},m(k,w){$(k,e,w),_(e,t),_(e,i),_(e,s),_(e,l),_(e,o),$(k,a,w),$(k,u,w),_(u,f),$(k,d,w),$(k,h,w),g||(y=Le(c=Be.call(null,f,{text:`Created: ${n[2].created} +Updated: ${n[2].updated}`,position:"left"})),g=!0)},p(k,w){w[1]&262144&&r!==(r=k[49])&&p(e,"for",r),c&&Wt(c.update)&&w[0]&4&&c.update.call(null,{text:`Created: ${k[2].created} +Updated: ${k[2].updated}`,position:"left"}),w[1]&262144&&m!==(m=k[49])&&p(h,"id",m),w[0]&4&&b!==(b=k[2].id)&&h.value!==b&&(h.value=b)},d(k){k&&S(e),k&&S(a),k&&S(u),k&&S(d),k&&S(h),g=!1,y()}}}function np(n){let e,t,i,s,l;function o(a){n[26](a)}let r={collection:n[0]};return n[2]!==void 0&&(r.record=n[2]),e=new XC({props:r}),le.push(()=>ke(e,"record",o)),{c(){j(e.$$.fragment),i=O(),s=v("hr")},m(a,u){R(e,a,u),$(a,i,u),$(a,s,u),l=!0},p(a,u){const f={};u[0]&1&&(f.collection=a[0]),!t&&u[0]&4&&(t=!0,f.record=a[2],$e(()=>t=!1)),e.$set(f)},i(a){l||(E(e.$$.fragment,a),l=!0)},o(a){I(e.$$.fragment,a),l=!1},d(a){H(e,a),a&&S(i),a&&S(s)}}}function ip(n){let e;return{c(){e=v("div"),e.innerHTML=`
    No custom fields to be set
    + `,p(e,"class","block txt-center txt-disabled")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function bM(n){let e,t,i;function s(o){n[38](o,n[46])}let l={field:n[46]};return n[2][n[46].name]!==void 0&&(l.value=n[2][n[46].name]),e=new fM({props:l}),le.push(()=>ke(e,"value",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[46]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[46].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function vM(n){let e,t,i,s,l;function o(f){n[35](f,n[46])}function r(f){n[36](f,n[46])}function a(f){n[37](f,n[46])}let u={field:n[46],record:n[2]};return n[2][n[46].name]!==void 0&&(u.value=n[2][n[46].name]),n[3][n[46].name]!==void 0&&(u.uploadedFiles=n[3][n[46].name]),n[4][n[46].name]!==void 0&&(u.deletedFileIndexes=n[4][n[46].name]),e=new x3({props:u}),le.push(()=>ke(e,"value",o)),le.push(()=>ke(e,"uploadedFiles",r)),le.push(()=>ke(e,"deletedFileIndexes",a)),{c(){j(e.$$.fragment)},m(f,c){R(e,f,c),l=!0},p(f,c){n=f;const d={};c[0]&1&&(d.field=n[46]),c[0]&4&&(d.record=n[2]),!t&&c[0]&5&&(t=!0,d.value=n[2][n[46].name],$e(()=>t=!1)),!i&&c[0]&9&&(i=!0,d.uploadedFiles=n[3][n[46].name],$e(()=>i=!1)),!s&&c[0]&17&&(s=!0,d.deletedFileIndexes=n[4][n[46].name],$e(()=>s=!1)),e.$set(d)},i(f){l||(E(e.$$.fragment,f),l=!0)},o(f){I(e.$$.fragment,f),l=!1},d(f){H(e,f)}}}function yM(n){let e,t,i;function s(o){n[34](o,n[46])}let l={field:n[46]};return n[2][n[46].name]!==void 0&&(l.value=n[2][n[46].name]),e=new I3({props:l}),le.push(()=>ke(e,"value",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[46]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[46].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function kM(n){let e,t,i;function s(o){n[33](o,n[46])}let l={field:n[46]};return n[2][n[46].name]!==void 0&&(l.value=n[2][n[46].name]),e=new O3({props:l}),le.push(()=>ke(e,"value",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[46]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[46].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function wM(n){let e,t,i;function s(o){n[32](o,n[46])}let l={field:n[46]};return n[2][n[46].name]!==void 0&&(l.value=n[2][n[46].name]),e=new $3({props:l}),le.push(()=>ke(e,"value",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[46]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[46].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function SM(n){let e,t,i;function s(o){n[31](o,n[46])}let l={field:n[46]};return n[2][n[46].name]!==void 0&&(l.value=n[2][n[46].name]),e=new y3({props:l}),le.push(()=>ke(e,"value",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[46]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[46].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function $M(n){let e,t,i;function s(o){n[30](o,n[46])}let l={field:n[46]};return n[2][n[46].name]!==void 0&&(l.value=n[2][n[46].name]),e=new g3({props:l}),le.push(()=>ke(e,"value",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[46]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[46].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function CM(n){let e,t,i;function s(o){n[29](o,n[46])}let l={field:n[46]};return n[2][n[46].name]!==void 0&&(l.value=n[2][n[46].name]),e=new d3({props:l}),le.push(()=>ke(e,"value",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[46]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[46].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function MM(n){let e,t,i;function s(o){n[28](o,n[46])}let l={field:n[46]};return n[2][n[46].name]!==void 0&&(l.value=n[2][n[46].name]),e=new a3({props:l}),le.push(()=>ke(e,"value",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[46]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[46].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function TM(n){let e,t,i;function s(o){n[27](o,n[46])}let l={field:n[46]};return n[2][n[46].name]!==void 0&&(l.value=n[2][n[46].name]),e=new s3({props:l}),le.push(()=>ke(e,"value",s)),{c(){j(e.$$.fragment)},m(o,r){R(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[46]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[46].name],$e(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){I(e.$$.fragment,o),i=!1},d(o){H(e,o)}}}function sp(n,e){let t,i,s,l,o;const r=[TM,MM,CM,$M,SM,wM,kM,yM,vM,bM],a=[];function u(f,c){return f[46].type==="text"?0:f[46].type==="number"?1:f[46].type==="bool"?2:f[46].type==="email"?3:f[46].type==="url"?4:f[46].type==="date"?5:f[46].type==="select"?6:f[46].type==="json"?7:f[46].type==="file"?8:f[46].type==="relation"?9:-1}return~(i=u(e))&&(s=a[i]=r[i](e)),{key:n,first:null,c(){t=Fe(),s&&s.c(),l=Fe(),this.first=t},m(f,c){$(f,t,c),~i&&a[i].m(f,c),$(f,l,c),o=!0},p(f,c){e=f;let d=i;i=u(e),i===d?~i&&a[i].p(e,c):(s&&(be(),I(a[d],1,1,()=>{a[d]=null}),ve()),~i?(s=a[i],s?s.p(e,c):(s=a[i]=r[i](e),s.c()),E(s,1),s.m(l.parentNode,l)):s=null)},i(f){o||(E(s),o=!0)},o(f){I(s),o=!1},d(f){f&&S(t),~i&&a[i].d(f),f&&S(l)}}}function lp(n){let e,t,i;return t=new gM({props:{record:n[2]}}),{c(){e=v("div"),j(t.$$.fragment),p(e,"class","tab-item"),ee(e,"active",n[10]===_l)},m(s,l){$(s,e,l),R(t,e,null),i=!0},p(s,l){const o={};l[0]&4&&(o.record=s[2]),t.$set(o),(!i||l[0]&1024)&&ee(e,"active",s[10]===_l)},i(s){i||(E(t.$$.fragment,s),i=!0)},o(s){I(t.$$.fragment,s),i=!1},d(s){s&&S(e),H(t)}}}function OM(n){var y,k;let e,t,i,s,l=[],o=new Map,r,a,u,f,c=!n[2].isNew&&tp(n),d=((y=n[0])==null?void 0:y.isAuth)&&np(n),h=((k=n[0])==null?void 0:k.schema)||[];const m=w=>w[46].name;for(let w=0;w{c=null}),ve()):c?(c.p(w,C),C[0]&4&&E(c,1)):(c=tp(w),c.c(),E(c,1),c.m(t,i)),(M=w[0])!=null&&M.isAuth?d?(d.p(w,C),C[0]&1&&E(d,1)):(d=np(w),d.c(),E(d,1),d.m(t,s)):d&&(be(),I(d,1,1,()=>{d=null}),ve()),C[0]&29&&(h=((T=w[0])==null?void 0:T.schema)||[],be(),l=bt(l,C,m,1,w,h,o,t,xt,sp,null,ep),ve(),!h.length&&b?b.p(w,C):h.length?b&&(b.d(1),b=null):(b=ip(),b.c(),b.m(t,null))),(!a||C[0]&1024)&&ee(t,"active",w[10]===Wi),w[0].isAuth&&!w[2].isNew?g?(g.p(w,C),C[0]&5&&E(g,1)):(g=lp(w),g.c(),E(g,1),g.m(e,null)):g&&(be(),I(g,1,1,()=>{g=null}),ve())},i(w){if(!a){E(c),E(d);for(let C=0;C + Send verification email`,p(e,"type","button"),p(e,"class","dropdown-item closable")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[21]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function ap(n){let e,t,i;return{c(){e=v("button"),e.innerHTML=` + Send password reset email`,p(e,"type","button"),p(e,"class","dropdown-item closable")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[22]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function DM(n){let e,t,i,s,l,o=n[0].isAuth&&!n[7].verified&&n[7].email&&rp(n),r=n[0].isAuth&&n[7].email&&ap(n);return{c(){o&&o.c(),e=O(),r&&r.c(),t=O(),i=v("button"),i.innerHTML=` + Delete`,p(i,"type","button"),p(i,"class","dropdown-item txt-danger closable")},m(a,u){o&&o.m(a,u),$(a,e,u),r&&r.m(a,u),$(a,t,u),$(a,i,u),s||(l=U(i,"click",Yn(ut(n[23]))),s=!0)},p(a,u){a[0].isAuth&&!a[7].verified&&a[7].email?o?o.p(a,u):(o=rp(a),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null),a[0].isAuth&&a[7].email?r?r.p(a,u):(r=ap(a),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(a){o&&o.d(a),a&&S(e),r&&r.d(a),a&&S(t),a&&S(i),s=!1,l()}}}function up(n){let e,t,i,s,l,o;return{c(){e=v("div"),t=v("button"),t.textContent="Account",i=O(),s=v("button"),s.textContent="Authorized providers",p(t,"type","button"),p(t,"class","tab-item"),ee(t,"active",n[10]===Wi),p(s,"type","button"),p(s,"class","tab-item"),ee(s,"active",n[10]===_l),p(e,"class","tabs-header stretched")},m(r,a){$(r,e,a),_(e,t),_(e,i),_(e,s),l||(o=[U(t,"click",n[24]),U(s,"click",n[25])],l=!0)},p(r,a){a[0]&1024&&ee(t,"active",r[10]===Wi),a[0]&1024&&ee(s,"active",r[10]===_l)},d(r){r&&S(e),l=!1,Re(o)}}}function EM(n){var b;let e,t=n[2].isNew?"New":"Edit",i,s,l,o=((b=n[0])==null?void 0:b.name)+"",r,a,u,f,c,d,h=!n[2].isNew&&op(n),m=n[0].isAuth&&!n[2].isNew&&up(n);return{c(){e=v("h4"),i=z(t),s=O(),l=v("strong"),r=z(o),a=z(" record"),u=O(),h&&h.c(),f=O(),m&&m.c(),c=Fe()},m(g,y){$(g,e,y),_(e,i),_(e,s),_(e,l),_(l,r),_(e,a),$(g,u,y),h&&h.m(g,y),$(g,f,y),m&&m.m(g,y),$(g,c,y),d=!0},p(g,y){var k;(!d||y[0]&4)&&t!==(t=g[2].isNew?"New":"Edit")&&ue(i,t),(!d||y[0]&1)&&o!==(o=((k=g[0])==null?void 0:k.name)+"")&&ue(r,o),g[2].isNew?h&&(be(),I(h,1,1,()=>{h=null}),ve()):h?(h.p(g,y),y[0]&4&&E(h,1)):(h=op(g),h.c(),E(h,1),h.m(f.parentNode,f)),g[0].isAuth&&!g[2].isNew?m?m.p(g,y):(m=up(g),m.c(),m.m(c.parentNode,c)):m&&(m.d(1),m=null)},i(g){d||(E(h),d=!0)},o(g){I(h),d=!1},d(g){g&&S(e),g&&S(u),h&&h.d(g),g&&S(f),m&&m.d(g),g&&S(c)}}}function AM(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=v("button"),t=v("span"),t.textContent="Cancel",i=O(),s=v("button"),l=v("span"),r=z(o),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[8],p(l,"class","txt"),p(s,"type","submit"),p(s,"form",n[12]),p(s,"class","btn btn-expanded"),s.disabled=a=!n[11]||n[8],ee(s,"btn-loading",n[8])},m(c,d){$(c,e,d),_(e,t),$(c,i,d),$(c,s,d),_(s,l),_(l,r),u||(f=U(e,"click",n[20]),u=!0)},p(c,d){d[0]&256&&(e.disabled=c[8]),d[0]&4&&o!==(o=c[2].isNew?"Create":"Save changes")&&ue(r,o),d[0]&2304&&a!==(a=!c[11]||c[8])&&(s.disabled=a),d[0]&256&&ee(s,"btn-loading",c[8])},d(c){c&&S(e),c&&S(i),c&&S(s),u=!1,f()}}}function IM(n){var s;let e,t,i={class:"overlay-panel-lg record-panel "+(((s=n[0])==null?void 0:s.isAuth)&&!n[2].isNew?"colored-header":""),beforeHide:n[39],$$slots:{footer:[AM],header:[EM],default:[OM]},$$scope:{ctx:n}};return e=new Jn({props:i}),n[40](e),e.$on("hide",n[41]),e.$on("show",n[42]),{c(){j(e.$$.fragment)},m(l,o){R(e,l,o),t=!0},p(l,o){var a;const r={};o[0]&5&&(r.class="overlay-panel-lg record-panel "+(((a=l[0])==null?void 0:a.isAuth)&&!l[2].isNew?"colored-header":"")),o[0]&544&&(r.beforeHide=l[39]),o[0]&3485|o[1]&524288&&(r.$$scope={dirty:o,ctx:l}),e.$set(r)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){I(e.$$.fragment,l),t=!1},d(l){n[40](null),H(e,l)}}}const Wi="form",_l="providers";function fp(n){return JSON.stringify(n)}function PM(n,e,t){let i,s,l;const o=It(),r="record_"+B.randomString(5);let{collection:a}=e,u,f=null,c=new Ui,d=!1,h=!1,m={},b={},g="",y=Wi;function k(te){return C(te),t(9,h=!0),t(10,y=Wi),u==null?void 0:u.show()}function w(){return u==null?void 0:u.hide()}async function C(te){Fn({}),t(7,f=te||{}),te!=null&&te.clone?t(2,c=te.clone()):t(2,c=new Ui),t(3,m={}),t(4,b={}),await $n(),t(18,g=fp(c))}function M(){if(d||!l||!(a!=null&&a.id))return;t(8,d=!0);const te=D();let ne;c.isNew?ne=me.collection(a.id).create(te):ne=me.collection(a.id).update(c.id,te),ne.then(Ee=>{Lt(c.isNew?"Successfully created record.":"Successfully updated record."),t(9,h=!1),w(),o("save",Ee)}).catch(Ee=>{me.errorResponseHandler(Ee)}).finally(()=>{t(8,d=!1)})}function T(){!(f!=null&&f.id)||yn("Do you really want to delete the selected record?",()=>me.collection(f.collectionId).delete(f.id).then(()=>{w(),Lt("Successfully deleted record."),o("delete",f)}).catch(te=>{me.errorResponseHandler(te)}))}function D(){const te=(c==null?void 0:c.export())||{},ne=new FormData,Ee={};for(const it of(a==null?void 0:a.schema)||[])Ee[it.name]=!0;a!=null&&a.isAuth&&(Ee.username=!0,Ee.email=!0,Ee.emailVisibility=!0,Ee.password=!0,Ee.passwordConfirm=!0,Ee.verified=!0);for(const it in te)!Ee[it]||(typeof te[it]>"u"&&(te[it]=null),B.addValueToFormData(ne,it,te[it]));for(const it in m){const en=B.toArray(m[it]);for(const Yt of en)ne.append(it,Yt)}for(const it in b){const en=B.toArray(b[it]);for(const Yt of en)ne.append(it+"."+Yt,"")}return ne}function A(){!(a!=null&&a.id)||!(f!=null&&f.email)||yn(`Do you really want to sent verification email to ${f.email}?`,()=>me.collection(a.id).requestVerification(f.email).then(()=>{Lt(`Successfully sent verification email to ${f.email}.`)}).catch(te=>{me.errorResponseHandler(te)}))}function P(){!(a!=null&&a.id)||!(f!=null&&f.email)||yn(`Do you really want to sent password reset email to ${f.email}?`,()=>me.collection(a.id).requestPasswordReset(f.email).then(()=>{Lt(`Successfully sent password reset email to ${f.email}.`)}).catch(te=>{me.errorResponseHandler(te)}))}const L=()=>w(),V=()=>A(),F=()=>P(),W=()=>T(),G=()=>t(10,y=Wi),K=()=>t(10,y=_l);function X(te){c=te,t(2,c)}function Z(te,ne){n.$$.not_equal(c[ne.name],te)&&(c[ne.name]=te,t(2,c))}function ie(te,ne){n.$$.not_equal(c[ne.name],te)&&(c[ne.name]=te,t(2,c))}function J(te,ne){n.$$.not_equal(c[ne.name],te)&&(c[ne.name]=te,t(2,c))}function fe(te,ne){n.$$.not_equal(c[ne.name],te)&&(c[ne.name]=te,t(2,c))}function Y(te,ne){n.$$.not_equal(c[ne.name],te)&&(c[ne.name]=te,t(2,c))}function re(te,ne){n.$$.not_equal(c[ne.name],te)&&(c[ne.name]=te,t(2,c))}function Oe(te,ne){n.$$.not_equal(c[ne.name],te)&&(c[ne.name]=te,t(2,c))}function ge(te,ne){n.$$.not_equal(c[ne.name],te)&&(c[ne.name]=te,t(2,c))}function ae(te,ne){n.$$.not_equal(c[ne.name],te)&&(c[ne.name]=te,t(2,c))}function pe(te,ne){n.$$.not_equal(m[ne.name],te)&&(m[ne.name]=te,t(3,m))}function de(te,ne){n.$$.not_equal(b[ne.name],te)&&(b[ne.name]=te,t(4,b))}function Se(te,ne){n.$$.not_equal(c[ne.name],te)&&(c[ne.name]=te,t(2,c))}const ye=()=>s&&h?(yn("You have unsaved changes. Do you really want to close the panel?",()=>{t(9,h=!1),w()}),!1):(Fn({}),!0);function We(te){le[te?"unshift":"push"](()=>{u=te,t(6,u)})}function ce(te){Ve.call(this,n,te)}function se(te){Ve.call(this,n,te)}return n.$$set=te=>{"collection"in te&&t(0,a=te.collection)},n.$$.update=()=>{n.$$.dirty[0]&24&&t(19,i=B.hasNonEmptyProps(m)||B.hasNonEmptyProps(b)),n.$$.dirty[0]&786436&&t(5,s=i||g!=fp(c)),n.$$.dirty[0]&36&&t(11,l=c.isNew||s)},[a,w,c,m,b,s,u,f,d,h,y,l,r,M,T,A,P,k,g,i,L,V,F,W,G,K,X,Z,ie,J,fe,Y,re,Oe,ge,ae,pe,de,Se,ye,We,ce,se]}class D_ extends Me{constructor(e){super(),Ce(this,e,PM,IM,we,{collection:0,show:17,hide:1},null,[-1,-1])}get show(){return this.$$.ctx[17]}get hide(){return this.$$.ctx[1]}}function LM(n){let e;return{c(){e=v("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function NM(n){let e,t;return{c(){e=v("span"),t=z(n[1]),p(e,"class","label txt-base txt-mono"),p(e,"title",n[0])},m(i,s){$(i,e,s),_(e,t)},p(i,s){s&2&&ue(t,i[1]),s&1&&p(e,"title",i[0])},d(i){i&&S(e)}}}function FM(n){let e;function t(l,o){return l[0]?NM:LM}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:x,o:x,d(l){s.d(l),l&&S(e)}}}function RM(n,e,t){let{id:i=""}=e,s=i;return n.$$set=l=>{"id"in l&&t(0,i=l.id)},n.$$.update=()=>{n.$$.dirty&1&&typeof i=="string"&&i.length>27&&t(1,s=i.substring(0,5)+"..."+i.substring(i.length-10))},[i,s]}class Za extends Me{constructor(e){super(),Ce(this,e,RM,FM,we,{id:0})}}function cp(n,e,t){const i=n.slice();return i[7]=e[t],i[5]=t,i}function dp(n,e,t){const i=n.slice();return i[3]=e[t],i[5]=t,i}function pp(n,e,t){const i=n.slice();return i[3]=e[t],i[5]=t,i}function HM(n){let e,t=ps(n[0][n[1].name])+"",i,s;return{c(){e=v("span"),i=z(t),p(e,"class","txt txt-ellipsis"),p(e,"title",s=ps(n[0][n[1].name]))},m(l,o){$(l,e,o),_(e,i)},p(l,o){o&3&&t!==(t=ps(l[0][l[1].name])+"")&&ue(i,t),o&3&&s!==(s=ps(l[0][l[1].name]))&&p(e,"title",s)},i:x,o:x,d(l){l&&S(e)}}}function jM(n){let e,t=[],i=new Map,s,l=B.toArray(n[0][n[1].name]);const o=r=>r[5]+r[7];for(let r=0;r20,o,r=B.toArray(n[0][n[1].name]).slice(0,20);const a=f=>f[5]+f[3];for(let f=0;f20),l?u||(u=gp(),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i(f){if(!o){for(let c=0;co[5]+o[3];for(let o=0;o{a[d]=null}),ve(),s=a[i],s?s.p(f,c):(s=a[i]=r[i](f),s.c()),E(s,1),s.m(e,null)),(!o||c&2&&l!==(l="col-type-"+f[1].type+" col-field-"+f[1].name))&&p(e,"class",l)},i(f){o||(E(s),o=!0)},o(f){I(s),o=!1},d(f){f&&S(e),a[i].d()}}}function ps(n){return n=n||"",n.length>200?n.substring(0,200):n}function JM(n,e,t){let{record:i}=e,{field:s}=e;function l(o){Ve.call(this,n,o)}return n.$$set=o=>{"record"in o&&t(0,i=o.record),"field"in o&&t(1,s=o.field)},[i,s,l]}class ZM extends Me{constructor(e){super(),Ce(this,e,JM,KM,we,{record:0,field:1})}}function bp(n,e,t){const i=n.slice();return i[50]=e[t],i}function vp(n,e,t){const i=n.slice();return i[46]=e[t],i}function yp(n,e,t){const i=n.slice();return i[46]=e[t],i}function kp(n,e,t){const i=n.slice();return i[46]=e[t],i}function GM(n){let e,t,i,s,l,o,r;return{c(){e=v("div"),t=v("input"),s=O(),l=v("label"),p(t,"type","checkbox"),p(t,"id","checkbox_0"),t.disabled=i=!n[4].length,t.checked=n[14],p(l,"for","checkbox_0"),p(e,"class","form-field")},m(a,u){$(a,e,u),_(e,t),_(e,s),_(e,l),o||(r=U(t,"change",n[25]),o=!0)},p(a,u){u[0]&16&&i!==(i=!a[4].length)&&(t.disabled=i),u[0]&16384&&(t.checked=a[14])},d(a){a&&S(e),o=!1,r()}}}function XM(n){let e;return{c(){e=v("span"),p(e,"class","loader loader-sm")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function QM(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="id",p(t,"class",B.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function wp(n){let e,t,i,s,l,o;function r(c){n[27](c)}let a={class:"col-type-text col-field-id",name:"username",$$slots:{default:[xM]},$$scope:{ctx:n}};n[0]!==void 0&&(a.sort=n[0]),e=new Ft({props:a}),le.push(()=>ke(e,"sort",r));function u(c){n[28](c)}let f={class:"col-type-email col-field-email",name:"email",$$slots:{default:[eT]},$$scope:{ctx:n}};return n[0]!==void 0&&(f.sort=n[0]),s=new Ft({props:f}),le.push(()=>ke(s,"sort",u)),{c(){j(e.$$.fragment),i=O(),j(s.$$.fragment)},m(c,d){R(e,c,d),$(c,i,d),R(s,c,d),o=!0},p(c,d){const h={};d[1]&67108864&&(h.$$scope={dirty:d,ctx:c}),!t&&d[0]&1&&(t=!0,h.sort=c[0],$e(()=>t=!1)),e.$set(h);const m={};d[1]&67108864&&(m.$$scope={dirty:d,ctx:c}),!l&&d[0]&1&&(l=!0,m.sort=c[0],$e(()=>l=!1)),s.$set(m)},i(c){o||(E(e.$$.fragment,c),E(s.$$.fragment,c),o=!0)},o(c){I(e.$$.fragment,c),I(s.$$.fragment,c),o=!1},d(c){H(e,c),c&&S(i),H(s,c)}}}function xM(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="username",p(t,"class",B.getFieldTypeIcon("user")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function eT(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="email",p(t,"class",B.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function tT(n){let e,t,i,s,l,o=n[46].name+"",r;return{c(){e=v("div"),t=v("i"),s=O(),l=v("span"),r=z(o),p(t,"class",i=B.getFieldTypeIcon(n[46].type)),p(l,"class","txt"),p(e,"class","col-header-content")},m(a,u){$(a,e,u),_(e,t),_(e,s),_(e,l),_(l,r)},p(a,u){u[0]&65536&&i!==(i=B.getFieldTypeIcon(a[46].type))&&p(t,"class",i),u[0]&65536&&o!==(o=a[46].name+"")&&ue(r,o)},d(a){a&&S(e)}}}function Sp(n,e){let t,i,s,l;function o(a){e[29](a)}let r={class:"col-type-"+e[46].type+" col-field-"+e[46].name,name:e[46].name,$$slots:{default:[tT]},$$scope:{ctx:e}};return e[0]!==void 0&&(r.sort=e[0]),i=new Ft({props:r}),le.push(()=>ke(i,"sort",o)),{key:n,first:null,c(){t=Fe(),j(i.$$.fragment),this.first=t},m(a,u){$(a,t,u),R(i,a,u),l=!0},p(a,u){e=a;const f={};u[0]&65536&&(f.class="col-type-"+e[46].type+" col-field-"+e[46].name),u[0]&65536&&(f.name=e[46].name),u[0]&65536|u[1]&67108864&&(f.$$scope={dirty:u,ctx:e}),!s&&u[0]&1&&(s=!0,f.sort=e[0],$e(()=>s=!1)),i.$set(f)},i(a){l||(E(i.$$.fragment,a),l=!0)},o(a){I(i.$$.fragment,a),l=!1},d(a){a&&S(t),H(i,a)}}}function nT(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="created",p(t,"class",B.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function iT(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="updated",p(t,"class",B.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function $p(n){let e;function t(l,o){return l[11]?lT:sT}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&S(e)}}}function sT(n){var r;let e,t,i,s,l,o=((r=n[1])==null?void 0:r.length)&&Cp(n);return{c(){e=v("tr"),t=v("td"),i=v("h6"),i.textContent="No records found.",s=O(),o&&o.c(),l=O(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){$(a,e,u),_(e,t),_(t,i),_(t,s),o&&o.m(t,null),_(e,l)},p(a,u){var f;(f=a[1])!=null&&f.length?o?o.p(a,u):(o=Cp(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&S(e),o&&o.d()}}}function lT(n){let e;return{c(){e=v("tr"),e.innerHTML=` + `},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function Cp(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[36]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function Mp(n){let e;function t(l,o){return l[50].verified?rT:oT}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,o){i!==(i=t(l))&&(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&S(e)}}}function oT(n){let e,t,i;return{c(){e=v("i"),p(e,"class","ri-error-warning-fill txt-sm txt-hint")},m(s,l){$(s,e,l),t||(i=Le(Be.call(null,e,"Unverified")),t=!0)},d(s){s&&S(e),t=!1,i()}}}function rT(n){let e,t,i;return{c(){e=v("i"),p(e,"class","ri-checkbox-circle-fill txt-sm txt-success")},m(s,l){$(s,e,l),t||(i=Le(Be.call(null,e,"Verified")),t=!0)},d(s){s&&S(e),t=!1,i()}}}function Tp(n){let e,t,i,s,l;function o(d,h){return h[0]&16&&(t=null),t==null&&(t=!!B.isEmpty(d[50].username)),t?uT:aT}let r=o(n,[-1,-1]),a=r(n);function u(d,h){return h[0]&16&&(l=null),l==null&&(l=!!B.isEmpty(d[50].email)),l?cT:fT}let f=u(n,[-1,-1]),c=f(n);return{c(){e=v("td"),a.c(),i=O(),s=v("td"),c.c(),p(e,"class","col-type-text col-field-username"),p(s,"class","col-type-text col-field-email")},m(d,h){$(d,e,h),a.m(e,null),$(d,i,h),$(d,s,h),c.m(s,null)},p(d,h){r===(r=o(d,h))&&a?a.p(d,h):(a.d(1),a=r(d),a&&(a.c(),a.m(e,null))),f===(f=u(d,h))&&c?c.p(d,h):(c.d(1),c=f(d),c&&(c.c(),c.m(s,null)))},d(d){d&&S(e),a.d(),d&&S(i),d&&S(s),c.d()}}}function aT(n){let e,t=n[50].username+"",i,s;return{c(){e=v("span"),i=z(t),p(e,"class","txt txt-ellipsis"),p(e,"title",s=n[50].username)},m(l,o){$(l,e,o),_(e,i)},p(l,o){o[0]&16&&t!==(t=l[50].username+"")&&ue(i,t),o[0]&16&&s!==(s=l[50].username)&&p(e,"title",s)},d(l){l&&S(e)}}}function uT(n){let e;return{c(){e=v("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function fT(n){let e,t=n[50].email+"",i,s;return{c(){e=v("span"),i=z(t),p(e,"class","txt txt-ellipsis"),p(e,"title",s=n[50].email)},m(l,o){$(l,e,o),_(e,i)},p(l,o){o[0]&16&&t!==(t=l[50].email+"")&&ue(i,t),o[0]&16&&s!==(s=l[50].email)&&p(e,"title",s)},d(l){l&&S(e)}}}function cT(n){let e;return{c(){e=v("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function Op(n,e){let t,i,s;return i=new ZM({props:{record:e[50],field:e[46]}}),{key:n,first:null,c(){t=Fe(),j(i.$$.fragment),this.first=t},m(l,o){$(l,t,o),R(i,l,o),s=!0},p(l,o){e=l;const r={};o[0]&16&&(r.record=e[50]),o[0]&65536&&(r.field=e[46]),i.$set(r)},i(l){s||(E(i.$$.fragment,l),s=!0)},o(l){I(i.$$.fragment,l),s=!1},d(l){l&&S(t),H(i,l)}}}function Dp(n,e){let t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k=[],w=new Map,C,M,T,D,A,P,L,V,F,W,G,K;function X(){return e[33](e[50])}m=new Za({props:{id:e[50].id}});let Z=e[2].isAuth&&Mp(e),ie=e[2].isAuth&&Tp(e),J=e[16];const fe=Oe=>Oe[46].name;for(let Oe=0;Oe',F=O(),p(l,"type","checkbox"),p(l,"id",o="checkbox_"+e[50].id),l.checked=r=e[6][e[50].id],p(u,"for",f="checkbox_"+e[50].id),p(s,"class","form-field"),p(i,"class","bulk-select-col min-width"),p(h,"class","flex flex-gap-5"),p(d,"class","col-type-text col-field-id"),p(M,"class","col-type-date col-field-created"),p(A,"class","col-type-date col-field-updated"),p(V,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(Oe,ge){$(Oe,t,ge),_(t,i),_(i,s),_(s,l),_(s,a),_(s,u),_(t,c),_(t,d),_(d,h),R(m,h,null),_(h,b),Z&&Z.m(h,null),_(t,g),ie&&ie.m(t,null),_(t,y);for(let ae=0;aeke(o,"sort",W));let K=n[2].isAuth&&wp(n),X=n[16];const Z=ae=>ae[46].name;for(let ae=0;aeke(h,"sort",ie));function fe(ae){n[31](ae)}let Y={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[iT]},$$scope:{ctx:n}};n[0]!==void 0&&(Y.sort=n[0]),g=new Ft({props:Y}),le.push(()=>ke(g,"sort",fe));let re=n[4];const Oe=ae=>ae[50].id;for(let ae=0;ae',M=O(),T=v("tbody");for(let ae=0;aer=!1)),o.$set(de),ae[2].isAuth?K?(K.p(ae,pe),pe[0]&4&&E(K,1)):(K=wp(ae),K.c(),E(K,1),K.m(i,u)):K&&(be(),I(K,1,1,()=>{K=null}),ve()),pe[0]&65537&&(X=ae[16],be(),f=bt(f,pe,Z,1,ae,X,c,i,xt,Sp,d,yp),ve());const Se={};pe[1]&67108864&&(Se.$$scope={dirty:pe,ctx:ae}),!m&&pe[0]&1&&(m=!0,Se.sort=ae[0],$e(()=>m=!1)),h.$set(Se);const ye={};pe[1]&67108864&&(ye.$$scope={dirty:pe,ctx:ae}),!y&&pe[0]&1&&(y=!0,ye.sort=ae[0],$e(()=>y=!1)),g.$set(ye),pe[0]&1247318&&(re=ae[4],be(),D=bt(D,pe,Oe,1,ae,re,A,T,xt,Dp,null,bp),ve(),!re.length&&ge?ge.p(ae,pe):re.length?ge&&(ge.d(1),ge=null):(ge=$p(ae),ge.c(),ge.m(T,null))),(!P||pe[0]&2048)&&ee(e,"table-loading",ae[11])},i(ae){if(!P){E(o.$$.fragment,ae),E(K);for(let pe=0;pe({49:l}),({uniqueId:l})=>[0,l?262144:0]]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=Fe(),j(i.$$.fragment),this.first=t},m(l,o){$(l,t,o),R(i,l,o),s=!0},p(l,o){e=l;const r={};o[0]&640|o[1]&67371008&&(r.$$scope={dirty:o,ctx:e}),i.$set(r)},i(l){s||(E(i.$$.fragment,l),s=!0)},o(l){I(i.$$.fragment,l),s=!1},d(l){l&&S(t),H(i,l)}}}function hT(n){let e,t,i=[],s=new Map,l,o,r=n[9];const a=u=>u[46].id+u[46].name;for(let u=0;uReset',c=O(),d=v("div"),h=O(),m=v("button"),m.innerHTML='Delete selected',p(t,"class","txt"),p(f,"type","button"),p(f,"class","btn btn-xs btn-secondary btn-outline p-l-5 p-r-5"),ee(f,"btn-disabled",n[12]),p(d,"class","flex-fill"),p(m,"type","button"),p(m,"class","btn btn-sm btn-secondary btn-danger"),ee(m,"btn-loading",n[12]),ee(m,"btn-disabled",n[12]),p(e,"class","bulkbar")},m(w,C){$(w,e,C),_(e,t),_(t,i),_(t,s),_(s,l),_(t,o),_(t,a),_(e,u),_(e,f),_(e,c),_(e,d),_(e,h),_(e,m),g=!0,y||(k=[U(f,"click",n[38]),U(m,"click",n[39])],y=!0)},p(w,C){(!g||C[0]&256)&&ue(l,w[8]),(!g||C[0]&256)&&r!==(r=w[8]===1?"record":"records")&&ue(a,r),(!g||C[0]&4096)&&ee(f,"btn-disabled",w[12]),(!g||C[0]&4096)&&ee(m,"btn-loading",w[12]),(!g||C[0]&4096)&&ee(m,"btn-disabled",w[12])},i(w){g||(w&&Qe(()=>{b||(b=je(e,kn,{duration:150,y:5},!0)),b.run(1)}),g=!0)},o(w){w&&(b||(b=je(e,kn,{duration:150,y:5},!1)),b.run(0)),g=!1},d(w){w&&S(e),w&&b&&b.end(),y=!1,Re(k)}}}function gT(n){let e,t,i,s,l,o;e=new Sa({props:{class:"table-wrapper",$$slots:{before:[mT],default:[dT]},$$scope:{ctx:n}}});let r=n[4].length&&Ap(n),a=n[4].length&&n[15]&&Ip(n),u=n[8]&&Pp(n);return{c(){j(e.$$.fragment),t=O(),r&&r.c(),i=O(),a&&a.c(),s=O(),u&&u.c(),l=Fe()},m(f,c){R(e,f,c),$(f,t,c),r&&r.m(f,c),$(f,i,c),a&&a.m(f,c),$(f,s,c),u&&u.m(f,c),$(f,l,c),o=!0},p(f,c){const d={};c[0]&92887|c[1]&67108864&&(d.$$scope={dirty:c,ctx:f}),e.$set(d),f[4].length?r?r.p(f,c):(r=Ap(f),r.c(),r.m(i.parentNode,i)):r&&(r.d(1),r=null),f[4].length&&f[15]?a?a.p(f,c):(a=Ip(f),a.c(),a.m(s.parentNode,s)):a&&(a.d(1),a=null),f[8]?u?(u.p(f,c),c[0]&256&&E(u,1)):(u=Pp(f),u.c(),E(u,1),u.m(l.parentNode,l)):u&&(be(),I(u,1,1,()=>{u=null}),ve())},i(f){o||(E(e.$$.fragment,f),E(u),o=!0)},o(f){I(e.$$.fragment,f),I(u),o=!1},d(f){H(e,f),f&&S(t),r&&r.d(f),f&&S(i),a&&a.d(f),f&&S(s),u&&u.d(f),f&&S(l)}}}function _T(n,e,t){let i,s,l,o,r;const a=It();let{collection:u}=e,{sort:f=""}=e,{filter:c=""}=e,d=[],h=1,m=0,b={},g=!0,y=!1,k=0,w=[],C;function M(){!(u!=null&&u.id)||localStorage.setItem((u==null?void 0:u.id)+"@hiddenCollumns",JSON.stringify(w))}function T(){if(t(7,w=[]),!!(u!=null&&u.id))try{const te=localStorage.getItem(u.id+"@hiddenCollumns");te&&t(7,w=JSON.parse(te)||[])}catch{}}async function D(){const te=h;for(let ne=1;ne<=te;ne++)(ne===1||i)&&await A(ne,!1)}async function A(te=1,ne=!0){if(!!(u!=null&&u.id))return t(11,g=!0),me.collection(u.id).getList(te,30,{sort:f,filter:c}).then(async Ee=>{if(te<=1&&P(),t(11,g=!1),t(10,h=Ee.page),t(5,m=Ee.totalItems),a("load",d.concat(Ee.items)),ne){const it=++k;for(;Ee.items.length&&k==it;)t(4,d=d.concat(Ee.items.splice(0,15))),await B.yieldToMain()}else t(4,d=d.concat(Ee.items))}).catch(Ee=>{Ee!=null&&Ee.isAbort||(t(11,g=!1),console.warn(Ee),P(),me.errorResponseHandler(Ee,!1))})}function P(){t(4,d=[]),t(10,h=1),t(5,m=0),t(6,b={})}function L(){r?V():F()}function V(){t(6,b={})}function F(){for(const te of d)t(6,b[te.id]=te,b);t(6,b)}function W(te){b[te.id]?delete b[te.id]:t(6,b[te.id]=te,b),t(6,b)}function G(){yn(`Do you really want to delete the selected ${o===1?"record":"records"}?`,K)}async function K(){if(y||!o||!(u!=null&&u.id))return;let te=[];for(const ne of Object.keys(b))te.push(me.collection(u.id).delete(ne));return t(12,y=!0),Promise.all(te).then(()=>{Lt(`Successfully deleted the selected ${o===1?"record":"records"}.`),V()}).catch(ne=>{me.errorResponseHandler(ne)}).finally(()=>(t(12,y=!1),D()))}function X(te){Ve.call(this,n,te)}const Z=(te,ne)=>{ne.target.checked?B.removeByValue(w,te.id):B.pushUnique(w,te.id),t(7,w)},ie=()=>L();function J(te){f=te,t(0,f)}function fe(te){f=te,t(0,f)}function Y(te){f=te,t(0,f)}function re(te){f=te,t(0,f)}function Oe(te){f=te,t(0,f)}function ge(te){f=te,t(0,f)}function ae(te){le[te?"unshift":"push"](()=>{C=te,t(13,C)})}const pe=te=>W(te),de=te=>a("select",te),Se=(te,ne)=>{ne.code==="Enter"&&(ne.preventDefault(),a("select",te))},ye=()=>t(1,c=""),We=()=>A(h+1),ce=()=>V(),se=()=>G();return n.$$set=te=>{"collection"in te&&t(2,u=te.collection),"sort"in te&&t(0,f=te.sort),"filter"in te&&t(1,c=te.filter)},n.$$.update=()=>{n.$$.dirty[0]&4&&u!=null&&u.id&&(T(),P()),n.$$.dirty[0]&7&&(u==null?void 0:u.id)&&f!==-1&&c!==-1&&A(1),n.$$.dirty[0]&48&&t(15,i=m>d.length),n.$$.dirty[0]&4&&t(9,s=(u==null?void 0:u.schema)||[]),n.$$.dirty[0]&640&&t(16,l=s.filter(te=>!w.includes(te.id))),n.$$.dirty[0]&64&&t(8,o=Object.keys(b).length),n.$$.dirty[0]&272&&t(14,r=d.length&&o===d.length),n.$$.dirty[0]&128&&w!==-1&&M()},[f,c,u,A,d,m,b,w,o,s,h,g,y,C,r,i,l,a,L,V,W,G,D,X,Z,ie,J,fe,Y,re,Oe,ge,ae,pe,de,Se,ye,We,ce,se]}class bT extends Me{constructor(e){super(),Ce(this,e,_T,gT,we,{collection:2,sort:0,filter:1,reloadLoadedPages:22,load:3},null,[-1,-1])}get reloadLoadedPages(){return this.$$.ctx[22]}get load(){return this.$$.ctx[3]}}function vT(n){let e,t,i,s;return e=new LC({}),i=new cn({props:{$$slots:{default:[wT]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment)},m(l,o){R(e,l,o),$(l,t,o),R(i,l,o),s=!0},p(l,o){const r={};o[0]&759|o[1]&1&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){I(e.$$.fragment,l),I(i.$$.fragment,l),s=!1},d(l){H(e,l),l&&S(t),H(i,l)}}}function yT(n){let e,t;return e=new cn({props:{center:!0,$$slots:{default:[CT]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s[0]&528|s[1]&1&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function kT(n){let e,t;return e=new cn({props:{center:!0,$$slots:{default:[MT]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s[1]&1&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function Lp(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-secondary btn-circle")},m(s,l){$(s,e,l),t||(i=[Le(Be.call(null,e,{text:"Edit collection",position:"right"})),U(e,"click",n[14])],t=!0)},p:x,d(s){s&&S(e),t=!1,Re(i)}}}function wT(n){let e,t,i,s,l,o=n[2].name+"",r,a,u,f,c,d,h,m,b,g,y,k,w,C,M,T,D,A,P,L=!n[9]&&Lp(n);c=new wa({}),c.$on("refresh",n[15]),k=new ka({props:{value:n[0],autocompleteCollection:n[2]}}),k.$on("submit",n[18]);function V(G){n[20](G)}function F(G){n[21](G)}let W={collection:n[2]};return n[0]!==void 0&&(W.filter=n[0]),n[1]!==void 0&&(W.sort=n[1]),C=new bT({props:W}),n[19](C),le.push(()=>ke(C,"filter",V)),le.push(()=>ke(C,"sort",F)),C.$on("select",n[22]),{c(){e=v("header"),t=v("nav"),i=v("div"),i.textContent="Collections",s=O(),l=v("div"),r=z(o),a=O(),u=v("div"),L&&L.c(),f=O(),j(c.$$.fragment),d=O(),h=v("div"),m=v("button"),m.innerHTML=` + API Preview`,b=O(),g=v("button"),g.innerHTML=` + New record`,y=O(),j(k.$$.fragment),w=O(),j(C.$$.fragment),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(u,"class","inline-flex gap-5"),p(m,"type","button"),p(m,"class","btn btn-outline"),p(g,"type","button"),p(g,"class","btn btn-expanded"),p(h,"class","btns-group"),p(e,"class","page-header")},m(G,K){$(G,e,K),_(e,t),_(t,i),_(t,s),_(t,l),_(l,r),_(e,a),_(e,u),L&&L.m(u,null),_(u,f),R(c,u,null),_(e,d),_(e,h),_(h,m),_(h,b),_(h,g),$(G,y,K),R(k,G,K),$(G,w,K),R(C,G,K),D=!0,A||(P=[U(m,"click",n[16]),U(g,"click",n[17])],A=!0)},p(G,K){(!D||K[0]&4)&&o!==(o=G[2].name+"")&&ue(r,o),G[9]?L&&(L.d(1),L=null):L?L.p(G,K):(L=Lp(G),L.c(),L.m(u,f));const X={};K[0]&1&&(X.value=G[0]),K[0]&4&&(X.autocompleteCollection=G[2]),k.$set(X);const Z={};K[0]&4&&(Z.collection=G[2]),!M&&K[0]&1&&(M=!0,Z.filter=G[0],$e(()=>M=!1)),!T&&K[0]&2&&(T=!0,Z.sort=G[1],$e(()=>T=!1)),C.$set(Z)},i(G){D||(E(c.$$.fragment,G),E(k.$$.fragment,G),E(C.$$.fragment,G),D=!0)},o(G){I(c.$$.fragment,G),I(k.$$.fragment,G),I(C.$$.fragment,G),D=!1},d(G){G&&S(e),L&&L.d(),H(c),G&&S(y),H(k,G),G&&S(w),n[19](null),H(C,G),A=!1,Re(P)}}}function ST(n){let e,t,i,s,l;return{c(){e=v("h1"),e.textContent="Create your first collection to add records!",t=O(),i=v("button"),i.innerHTML=` + Create new collection`,p(e,"class","m-b-10"),p(i,"type","button"),p(i,"class","btn btn-expanded-lg btn-lg")},m(o,r){$(o,e,r),$(o,t,r),$(o,i,r),s||(l=U(i,"click",n[13]),s=!0)},p:x,d(o){o&&S(e),o&&S(t),o&&S(i),s=!1,l()}}}function $T(n){let e;return{c(){e=v("h1"),e.textContent="You don't have any collections yet.",p(e,"class","m-b-10")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function CT(n){let e,t,i;function s(r,a){return r[9]?$T:ST}let l=s(n),o=l(n);return{c(){e=v("div"),t=v("div"),t.innerHTML='',i=O(),o.c(),p(t,"class","icon"),p(e,"class","placeholder-section m-b-base")},m(r,a){$(r,e,a),_(e,t),_(e,i),o.m(e,null)},p(r,a){l===(l=s(r))&&o?o.p(r,a):(o.d(1),o=l(r),o&&(o.c(),o.m(e,null)))},d(r){r&&S(e),o.d()}}}function MT(n){let e;return{c(){e=v("div"),e.innerHTML=` +

    Loading collections...

    `,p(e,"class","placeholder-section m-b-base")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function TT(n){let e,t,i,s,l,o,r,a,u;const f=[kT,yT,vT],c=[];function d(g,y){return g[3]?0:g[8].length?2:1}e=d(n),t=c[e]=f[e](n);let h={};s=new Ja({props:h}),n[23](s);let m={};o=new zC({props:m}),n[24](o);let b={collection:n[2]};return a=new D_({props:b}),n[25](a),a.$on("save",n[26]),a.$on("delete",n[27]),{c(){t.c(),i=O(),j(s.$$.fragment),l=O(),j(o.$$.fragment),r=O(),j(a.$$.fragment)},m(g,y){c[e].m(g,y),$(g,i,y),R(s,g,y),$(g,l,y),R(o,g,y),$(g,r,y),R(a,g,y),u=!0},p(g,y){let k=e;e=d(g),e===k?c[e].p(g,y):(be(),I(c[k],1,1,()=>{c[k]=null}),ve(),t=c[e],t?t.p(g,y):(t=c[e]=f[e](g),t.c()),E(t,1),t.m(i.parentNode,i));const w={};s.$set(w);const C={};o.$set(C);const M={};y[0]&4&&(M.collection=g[2]),a.$set(M)},i(g){u||(E(t),E(s.$$.fragment,g),E(o.$$.fragment,g),E(a.$$.fragment,g),u=!0)},o(g){I(t),I(s.$$.fragment,g),I(o.$$.fragment,g),I(a.$$.fragment,g),u=!1},d(g){c[e].d(g),g&&S(i),n[23](null),H(s,g),g&&S(l),n[24](null),H(o,g),g&&S(r),n[25](null),H(a,g)}}}function OT(n,e,t){let i,s,l,o,r,a,u;Je(n,Bn,ie=>t(2,s=ie)),Je(n,na,ie=>t(3,l=ie)),Je(n,aa,ie=>t(12,o=ie)),Je(n,mt,ie=>t(28,r=ie)),Je(n,Zi,ie=>t(8,a=ie)),Je(n,ks,ie=>t(9,u=ie)),Ht(mt,r="Collections",r);const f=new URLSearchParams(o);let c,d,h,m,b=f.get("filter")||"",g=f.get("sort")||"-created",y=f.get("collectionId")||"";function k(){t(10,y=s.id),t(1,g="-created"),t(0,b="")}SS(y);const w=()=>c==null?void 0:c.show(),C=()=>c==null?void 0:c.show(s),M=()=>m==null?void 0:m.load(),T=()=>d==null?void 0:d.show(s),D=()=>h==null?void 0:h.show(),A=ie=>t(0,b=ie.detail);function P(ie){le[ie?"unshift":"push"](()=>{m=ie,t(7,m)})}function L(ie){b=ie,t(0,b)}function V(ie){g=ie,t(1,g)}const F=ie=>h==null?void 0:h.show(ie==null?void 0:ie.detail);function W(ie){le[ie?"unshift":"push"](()=>{c=ie,t(4,c)})}function G(ie){le[ie?"unshift":"push"](()=>{d=ie,t(5,d)})}function K(ie){le[ie?"unshift":"push"](()=>{h=ie,t(6,h)})}const X=()=>m==null?void 0:m.reloadLoadedPages(),Z=()=>m==null?void 0:m.reloadLoadedPages();return n.$$.update=()=>{if(n.$$.dirty[0]&4096&&t(11,i=new URLSearchParams(o)),n.$$.dirty[0]&3080&&!l&&i.has("collectionId")&&i.get("collectionId")!=y&&yS(i.get("collectionId")),n.$$.dirty[0]&1028&&(s==null?void 0:s.id)&&y!=s.id&&k(),n.$$.dirty[0]&7&&(g||b||(s==null?void 0:s.id))){const ie=new URLSearchParams({collectionId:(s==null?void 0:s.id)||"",filter:b,sort:g}).toString();ki("/collections?"+ie)}},[b,g,s,l,c,d,h,m,a,u,y,i,o,w,C,M,T,D,A,P,L,V,F,W,G,K,X,Z]}class DT extends Me{constructor(e){super(),Ce(this,e,OT,TT,we,{},null,[-1,-1])}}function ET(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M,T,D,A,P;return{c(){e=v("aside"),t=v("div"),i=v("div"),i.textContent="System",s=O(),l=v("a"),l.innerHTML=` + Application`,o=O(),r=v("a"),r.innerHTML=` + Mail settings`,a=O(),u=v("a"),u.innerHTML=` + Files storage`,f=O(),c=v("div"),c.innerHTML=`Sync + Experimental`,d=O(),h=v("a"),h.innerHTML=` + Export collections`,m=O(),b=v("a"),b.innerHTML=` + Import collections`,g=O(),y=v("div"),y.textContent="Authentication",k=O(),w=v("a"),w.innerHTML=` + Auth providers`,C=O(),M=v("a"),M.innerHTML=` + Token options`,T=O(),D=v("a"),D.innerHTML=` + Admins`,p(i,"class","sidebar-title"),p(l,"href","/settings"),p(l,"class","sidebar-list-item"),p(r,"href","/settings/mail"),p(r,"class","sidebar-list-item"),p(u,"href","/settings/storage"),p(u,"class","sidebar-list-item"),p(c,"class","sidebar-title"),p(h,"href","/settings/export-collections"),p(h,"class","sidebar-list-item"),p(b,"href","/settings/import-collections"),p(b,"class","sidebar-list-item"),p(y,"class","sidebar-title"),p(w,"href","/settings/auth-providers"),p(w,"class","sidebar-list-item"),p(M,"href","/settings/tokens"),p(M,"class","sidebar-list-item"),p(D,"href","/settings/admins"),p(D,"class","sidebar-list-item"),p(t,"class","sidebar-content"),p(e,"class","page-sidebar settings-sidebar")},m(L,V){$(L,e,V),_(e,t),_(t,i),_(t,s),_(t,l),_(t,o),_(t,r),_(t,a),_(t,u),_(t,f),_(t,c),_(t,d),_(t,h),_(t,m),_(t,b),_(t,g),_(t,y),_(t,k),_(t,w),_(t,C),_(t,M),_(t,T),_(t,D),A||(P=[Le(On.call(null,l,{path:"/settings"})),Le(Vt.call(null,l)),Le(On.call(null,r,{path:"/settings/mail/?.*"})),Le(Vt.call(null,r)),Le(On.call(null,u,{path:"/settings/storage/?.*"})),Le(Vt.call(null,u)),Le(On.call(null,h,{path:"/settings/export-collections/?.*"})),Le(Vt.call(null,h)),Le(On.call(null,b,{path:"/settings/import-collections/?.*"})),Le(Vt.call(null,b)),Le(On.call(null,w,{path:"/settings/auth-providers/?.*"})),Le(Vt.call(null,w)),Le(On.call(null,M,{path:"/settings/tokens/?.*"})),Le(Vt.call(null,M)),Le(On.call(null,D,{path:"/settings/admins/?.*"})),Le(Vt.call(null,D))],A=!0)},p:x,i:x,o:x,d(L){L&&S(e),A=!1,Re(P)}}}class Ci extends Me{constructor(e){super(),Ce(this,e,null,ET,we,{})}}function Np(n,e,t){const i=n.slice();return i[30]=e[t],i}function Fp(n){let e,t;return e=new _e({props:{class:"form-field disabled",name:"id",$$slots:{default:[AT,({uniqueId:i})=>({29:i}),({uniqueId:i})=>[i?536870912:0]]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s[0]&536870914|s[1]&4&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function AT(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b;return{c(){e=v("label"),t=v("i"),i=O(),s=v("span"),s.textContent="ID",o=O(),r=v("div"),a=v("i"),f=O(),c=v("input"),p(t,"class",B.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"for",l=n[29]),p(a,"class","ri-calendar-event-line txt-disabled"),p(r,"class","form-field-addon"),p(c,"type","text"),p(c,"id",d=n[29]),c.value=h=n[1].id,c.disabled=!0},m(g,y){$(g,e,y),_(e,t),_(e,i),_(e,s),$(g,o,y),$(g,r,y),_(r,a),$(g,f,y),$(g,c,y),m||(b=Le(u=Be.call(null,a,{text:`Created: ${n[1].created} +Updated: ${n[1].updated}`,position:"left"})),m=!0)},p(g,y){y[0]&536870912&&l!==(l=g[29])&&p(e,"for",l),u&&Wt(u.update)&&y[0]&2&&u.update.call(null,{text:`Created: ${g[1].created} +Updated: ${g[1].updated}`,position:"left"}),y[0]&536870912&&d!==(d=g[29])&&p(c,"id",d),y[0]&2&&h!==(h=g[1].id)&&c.value!==h&&(c.value=h)},d(g){g&&S(e),g&&S(o),g&&S(r),g&&S(f),g&&S(c),m=!1,b()}}}function Rp(n){let e,t,i,s,l,o,r;function a(){return n[17](n[30])}return{c(){e=v("button"),t=v("img"),s=O(),Ln(t.src,i="./images/avatars/avatar"+n[30]+".svg")||p(t,"src",i),p(t,"alt","Avatar "+n[30]),p(e,"type","button"),p(e,"class",l="link-fade thumb thumb-circle "+(n[30]==n[2]?"thumb-active":"thumb-sm"))},m(u,f){$(u,e,f),_(e,t),_(e,s),o||(r=U(e,"click",a),o=!0)},p(u,f){n=u,f[0]&4&&l!==(l="link-fade thumb thumb-circle "+(n[30]==n[2]?"thumb-active":"thumb-sm"))&&p(e,"class",l)},d(u){u&&S(e),o=!1,r()}}}function IT(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("label"),t=v("i"),i=O(),s=v("span"),s.textContent="Email",o=O(),r=v("input"),p(t,"class",B.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"for",l=n[29]),p(r,"type","email"),p(r,"autocomplete","off"),p(r,"id",a=n[29]),r.required=!0},m(c,d){$(c,e,d),_(e,t),_(e,i),_(e,s),$(c,o,d),$(c,r,d),he(r,n[3]),u||(f=U(r,"input",n[18]),u=!0)},p(c,d){d[0]&536870912&&l!==(l=c[29])&&p(e,"for",l),d[0]&536870912&&a!==(a=c[29])&&p(r,"id",a),d[0]&8&&r.value!==c[3]&&he(r,c[3])},d(c){c&&S(e),c&&S(o),c&&S(r),u=!1,f()}}}function Hp(n){let e,t;return e=new _e({props:{class:"form-field form-field-toggle",$$slots:{default:[PT,({uniqueId:i})=>({29:i}),({uniqueId:i})=>[i?536870912:0]]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s[0]&536870928|s[1]&4&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function PT(n){let e,t,i,s,l,o,r,a;return{c(){e=v("input"),i=O(),s=v("label"),l=z("Change password"),p(e,"type","checkbox"),p(e,"id",t=n[29]),p(s,"for",o=n[29])},m(u,f){$(u,e,f),e.checked=n[4],$(u,i,f),$(u,s,f),_(s,l),r||(a=U(e,"change",n[19]),r=!0)},p(u,f){f[0]&536870912&&t!==(t=u[29])&&p(e,"id",t),f[0]&16&&(e.checked=u[4]),f[0]&536870912&&o!==(o=u[29])&&p(s,"for",o)},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,a()}}}function jp(n){let e,t,i,s,l,o,r,a,u;return s=new _e({props:{class:"form-field required",name:"password",$$slots:{default:[LT,({uniqueId:f})=>({29:f}),({uniqueId:f})=>[f?536870912:0]]},$$scope:{ctx:n}}}),r=new _e({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[NT,({uniqueId:f})=>({29:f}),({uniqueId:f})=>[f?536870912:0]]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),i=v("div"),j(s.$$.fragment),l=O(),o=v("div"),j(r.$$.fragment),p(i,"class","col-sm-6"),p(o,"class","col-sm-6"),p(t,"class","grid"),p(e,"class","col-12")},m(f,c){$(f,e,c),_(e,t),_(t,i),R(s,i,null),_(t,l),_(t,o),R(r,o,null),u=!0},p(f,c){const d={};c[0]&536871168|c[1]&4&&(d.$$scope={dirty:c,ctx:f}),s.$set(d);const h={};c[0]&536871424|c[1]&4&&(h.$$scope={dirty:c,ctx:f}),r.$set(h)},i(f){u||(E(s.$$.fragment,f),E(r.$$.fragment,f),f&&Qe(()=>{a||(a=je(t,St,{duration:150},!0)),a.run(1)}),u=!0)},o(f){I(s.$$.fragment,f),I(r.$$.fragment,f),f&&(a||(a=je(t,St,{duration:150},!1)),a.run(0)),u=!1},d(f){f&&S(e),H(s),H(r),f&&a&&a.end()}}}function LT(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("label"),t=v("i"),i=O(),s=v("span"),s.textContent="Password",o=O(),r=v("input"),p(t,"class","ri-lock-line"),p(s,"class","txt"),p(e,"for",l=n[29]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[29]),r.required=!0},m(c,d){$(c,e,d),_(e,t),_(e,i),_(e,s),$(c,o,d),$(c,r,d),he(r,n[8]),u||(f=U(r,"input",n[20]),u=!0)},p(c,d){d[0]&536870912&&l!==(l=c[29])&&p(e,"for",l),d[0]&536870912&&a!==(a=c[29])&&p(r,"id",a),d[0]&256&&r.value!==c[8]&&he(r,c[8])},d(c){c&&S(e),c&&S(o),c&&S(r),u=!1,f()}}}function NT(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("label"),t=v("i"),i=O(),s=v("span"),s.textContent="Password confirm",o=O(),r=v("input"),p(t,"class","ri-lock-line"),p(s,"class","txt"),p(e,"for",l=n[29]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[29]),r.required=!0},m(c,d){$(c,e,d),_(e,t),_(e,i),_(e,s),$(c,o,d),$(c,r,d),he(r,n[9]),u||(f=U(r,"input",n[21]),u=!0)},p(c,d){d[0]&536870912&&l!==(l=c[29])&&p(e,"for",l),d[0]&536870912&&a!==(a=c[29])&&p(r,"id",a),d[0]&512&&r.value!==c[9]&&he(r,c[9])},d(c){c&&S(e),c&&S(o),c&&S(r),u=!1,f()}}}function FT(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m=!n[1].isNew&&Fp(n),b=[0,1,2,3,4,5,6,7,8,9],g=[];for(let w=0;w<10;w+=1)g[w]=Rp(Np(n,b,w));a=new _e({props:{class:"form-field required",name:"email",$$slots:{default:[IT,({uniqueId:w})=>({29:w}),({uniqueId:w})=>[w?536870912:0]]},$$scope:{ctx:n}}});let y=!n[1].isNew&&Hp(n),k=(n[1].isNew||n[4])&&jp(n);return{c(){e=v("form"),m&&m.c(),t=O(),i=v("div"),s=v("p"),s.textContent="Avatar",l=O(),o=v("div");for(let w=0;w<10;w+=1)g[w].c();r=O(),j(a.$$.fragment),u=O(),y&&y.c(),f=O(),k&&k.c(),p(s,"class","section-title"),p(o,"class","flex flex-gap-xs flex-wrap"),p(i,"class","content"),p(e,"id",n[11]),p(e,"class","grid"),p(e,"autocomplete","off")},m(w,C){$(w,e,C),m&&m.m(e,null),_(e,t),_(e,i),_(i,s),_(i,l),_(i,o);for(let M=0;M<10;M+=1)g[M].m(o,null);_(e,r),R(a,e,null),_(e,u),y&&y.m(e,null),_(e,f),k&&k.m(e,null),c=!0,d||(h=U(e,"submit",ut(n[12])),d=!0)},p(w,C){if(w[1].isNew?m&&(be(),I(m,1,1,()=>{m=null}),ve()):m?(m.p(w,C),C[0]&2&&E(m,1)):(m=Fp(w),m.c(),E(m,1),m.m(e,t)),C[0]&4){b=[0,1,2,3,4,5,6,7,8,9];let T;for(T=0;T<10;T+=1){const D=Np(w,b,T);g[T]?g[T].p(D,C):(g[T]=Rp(D),g[T].c(),g[T].m(o,null))}for(;T<10;T+=1)g[T].d(1)}const M={};C[0]&536870920|C[1]&4&&(M.$$scope={dirty:C,ctx:w}),a.$set(M),w[1].isNew?y&&(be(),I(y,1,1,()=>{y=null}),ve()):y?(y.p(w,C),C[0]&2&&E(y,1)):(y=Hp(w),y.c(),E(y,1),y.m(e,f)),w[1].isNew||w[4]?k?(k.p(w,C),C[0]&18&&E(k,1)):(k=jp(w),k.c(),E(k,1),k.m(e,null)):k&&(be(),I(k,1,1,()=>{k=null}),ve())},i(w){c||(E(m),E(a.$$.fragment,w),E(y),E(k),c=!0)},o(w){I(m),I(a.$$.fragment,w),I(y),I(k),c=!1},d(w){w&&S(e),m&&m.d(),Tt(g,w),H(a),y&&y.d(),k&&k.d(),d=!1,h()}}}function RT(n){let e,t=n[1].isNew?"New admin":"Edit admin",i;return{c(){e=v("h4"),i=z(t)},m(s,l){$(s,e,l),_(e,i)},p(s,l){l[0]&2&&t!==(t=s[1].isNew?"New admin":"Edit admin")&&ue(i,t)},d(s){s&&S(e)}}}function qp(n){let e,t,i,s,l,o,r,a,u;return o=new Zn({props:{class:"dropdown dropdown-upside dropdown-left dropdown-nowrap",$$slots:{default:[HT]},$$scope:{ctx:n}}}),{c(){e=v("button"),t=v("span"),i=O(),s=v("i"),l=O(),j(o.$$.fragment),r=O(),a=v("div"),p(s,"class","ri-more-line"),p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-secondary"),p(a,"class","flex-fill")},m(f,c){$(f,e,c),_(e,t),_(e,i),_(e,s),_(e,l),R(o,e,null),$(f,r,c),$(f,a,c),u=!0},p(f,c){const d={};c[1]&4&&(d.$$scope={dirty:c,ctx:f}),o.$set(d)},i(f){u||(E(o.$$.fragment,f),u=!0)},o(f){I(o.$$.fragment,f),u=!1},d(f){f&&S(e),H(o),f&&S(r),f&&S(a)}}}function HT(n){let e,t,i;return{c(){e=v("button"),e.innerHTML=` + Delete`,p(e,"type","button"),p(e,"class","dropdown-item txt-danger")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[15]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function jT(n){let e,t,i,s,l,o,r=n[1].isNew?"Create":"Save changes",a,u,f,c,d,h=!n[1].isNew&&qp(n);return{c(){h&&h.c(),e=O(),t=v("button"),i=v("span"),i.textContent="Cancel",s=O(),l=v("button"),o=v("span"),a=z(r),p(i,"class","txt"),p(t,"type","button"),p(t,"class","btn btn-secondary"),t.disabled=n[6],p(o,"class","txt"),p(l,"type","submit"),p(l,"form",n[11]),p(l,"class","btn btn-expanded"),l.disabled=u=!n[10]||n[6],ee(l,"btn-loading",n[6])},m(m,b){h&&h.m(m,b),$(m,e,b),$(m,t,b),_(t,i),$(m,s,b),$(m,l,b),_(l,o),_(o,a),f=!0,c||(d=U(t,"click",n[16]),c=!0)},p(m,b){m[1].isNew?h&&(be(),I(h,1,1,()=>{h=null}),ve()):h?(h.p(m,b),b[0]&2&&E(h,1)):(h=qp(m),h.c(),E(h,1),h.m(e.parentNode,e)),(!f||b[0]&64)&&(t.disabled=m[6]),(!f||b[0]&2)&&r!==(r=m[1].isNew?"Create":"Save changes")&&ue(a,r),(!f||b[0]&1088&&u!==(u=!m[10]||m[6]))&&(l.disabled=u),(!f||b[0]&64)&&ee(l,"btn-loading",m[6])},i(m){f||(E(h),f=!0)},o(m){I(h),f=!1},d(m){h&&h.d(m),m&&S(e),m&&S(t),m&&S(s),m&&S(l),c=!1,d()}}}function qT(n){let e,t,i={popup:!0,class:"admin-panel",beforeHide:n[22],$$slots:{footer:[jT],header:[RT],default:[FT]},$$scope:{ctx:n}};return e=new Jn({props:i}),n[23](e),e.$on("hide",n[24]),e.$on("show",n[25]),{c(){j(e.$$.fragment)},m(s,l){R(e,s,l),t=!0},p(s,l){const o={};l[0]&1152&&(o.beforeHide=s[22]),l[0]&1886|l[1]&4&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){I(e.$$.fragment,s),t=!1},d(s){n[23](null),H(e,s)}}}function VT(n,e,t){let i;const s=It(),l="admin_"+B.randomString(5);let o,r=new Yi,a=!1,u=!1,f=0,c="",d="",h="",m=!1;function b(X){return y(X),t(7,u=!0),o==null?void 0:o.show()}function g(){return o==null?void 0:o.hide()}function y(X){t(1,r=X!=null&&X.clone?X.clone():new Yi),k()}function k(){t(4,m=!1),t(3,c=(r==null?void 0:r.email)||""),t(2,f=(r==null?void 0:r.avatar)||0),t(8,d=""),t(9,h=""),Fn({})}function w(){if(a||!i)return;t(6,a=!0);const X={email:c,avatar:f};(r.isNew||m)&&(X.password=d,X.passwordConfirm=h);let Z;r.isNew?Z=me.admins.create(X):Z=me.admins.update(r.id,X),Z.then(async ie=>{var J;t(7,u=!1),g(),Lt(r.isNew?"Successfully created admin.":"Successfully updated admin."),s("save",ie),((J=me.authStore.model)==null?void 0:J.id)===ie.id&&me.authStore.save(me.authStore.token,ie)}).catch(ie=>{me.errorResponseHandler(ie)}).finally(()=>{t(6,a=!1)})}function C(){!(r!=null&&r.id)||yn("Do you really want to delete the selected admin?",()=>me.admins.delete(r.id).then(()=>{t(7,u=!1),g(),Lt("Successfully deleted admin."),s("delete",r)}).catch(X=>{me.errorResponseHandler(X)}))}const M=()=>C(),T=()=>g(),D=X=>t(2,f=X);function A(){c=this.value,t(3,c)}function P(){m=this.checked,t(4,m)}function L(){d=this.value,t(8,d)}function V(){h=this.value,t(9,h)}const F=()=>i&&u?(yn("You have unsaved changes. Do you really want to close the panel?",()=>{t(7,u=!1),g()}),!1):!0;function W(X){le[X?"unshift":"push"](()=>{o=X,t(5,o)})}function G(X){Ve.call(this,n,X)}function K(X){Ve.call(this,n,X)}return n.$$.update=()=>{n.$$.dirty[0]&30&&t(10,i=r.isNew&&c!=""||m||c!==r.email||f!==r.avatar)},[g,r,f,c,m,o,a,u,d,h,i,l,w,C,b,M,T,D,A,P,L,V,F,W,G,K]}class zT extends Me{constructor(e){super(),Ce(this,e,VT,qT,we,{show:14,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[14]}get hide(){return this.$$.ctx[0]}}function Vp(n,e,t){const i=n.slice();return i[24]=e[t],i}function BT(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="id",p(t,"class",B.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function WT(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="email",p(t,"class",B.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function UT(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="created",p(t,"class",B.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function YT(n){let e,t,i,s;return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),s.textContent="updated",p(t,"class",B.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){$(l,e,o),_(e,t),_(e,i),_(e,s)},p:x,d(l){l&&S(e)}}}function zp(n){let e;function t(l,o){return l[5]?JT:KT}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&S(e)}}}function KT(n){var r;let e,t,i,s,l,o=((r=n[1])==null?void 0:r.length)&&Bp(n);return{c(){e=v("tr"),t=v("td"),i=v("h6"),i.textContent="No admins found.",s=O(),o&&o.c(),l=O(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){$(a,e,u),_(e,t),_(t,i),_(t,s),o&&o.m(t,null),_(e,l)},p(a,u){var f;(f=a[1])!=null&&f.length?o?o.p(a,u):(o=Bp(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&S(e),o&&o.d()}}}function JT(n){let e;return{c(){e=v("tr"),e.innerHTML=` + `},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function Bp(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[17]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function Wp(n){let e;return{c(){e=v("span"),e.textContent="You",p(e,"class","label label-warning m-l-5")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function Up(n,e){let t,i,s,l,o,r,a,u,f,c,d,h,m=e[24].email+"",b,g,y,k,w,C,M,T,D,A,P,L,V,F;u=new Za({props:{id:e[24].id}});let W=e[24].id===e[7].id&&Wp();w=new Ki({props:{date:e[24].created}}),T=new Ki({props:{date:e[24].updated}});function G(){return e[15](e[24])}function K(...X){return e[16](e[24],...X)}return{key:n,first:null,c(){t=v("tr"),i=v("td"),s=v("figure"),l=v("img"),r=O(),a=v("td"),j(u.$$.fragment),f=O(),W&&W.c(),c=O(),d=v("td"),h=v("span"),b=z(m),y=O(),k=v("td"),j(w.$$.fragment),C=O(),M=v("td"),j(T.$$.fragment),D=O(),A=v("td"),A.innerHTML='',P=O(),Ln(l.src,o="./images/avatars/avatar"+(e[24].avatar||0)+".svg")||p(l,"src",o),p(l,"alt","Admin avatar"),p(s,"class","thumb thumb-sm thumb-circle"),p(i,"class","min-width"),p(a,"class","col-type-text col-field-id"),p(h,"class","txt txt-ellipsis"),p(h,"title",g=e[24].email),p(d,"class","col-type-email col-field-email"),p(k,"class","col-type-date col-field-created"),p(M,"class","col-type-date col-field-updated"),p(A,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(X,Z){$(X,t,Z),_(t,i),_(i,s),_(s,l),_(t,r),_(t,a),R(u,a,null),_(a,f),W&&W.m(a,null),_(t,c),_(t,d),_(d,h),_(h,b),_(t,y),_(t,k),R(w,k,null),_(t,C),_(t,M),R(T,M,null),_(t,D),_(t,A),_(t,P),L=!0,V||(F=[U(t,"click",G),U(t,"keydown",K)],V=!0)},p(X,Z){e=X,(!L||Z&16&&!Ln(l.src,o="./images/avatars/avatar"+(e[24].avatar||0)+".svg"))&&p(l,"src",o);const ie={};Z&16&&(ie.id=e[24].id),u.$set(ie),e[24].id===e[7].id?W||(W=Wp(),W.c(),W.m(a,null)):W&&(W.d(1),W=null),(!L||Z&16)&&m!==(m=e[24].email+"")&&ue(b,m),(!L||Z&16&&g!==(g=e[24].email))&&p(h,"title",g);const J={};Z&16&&(J.date=e[24].created),w.$set(J);const fe={};Z&16&&(fe.date=e[24].updated),T.$set(fe)},i(X){L||(E(u.$$.fragment,X),E(w.$$.fragment,X),E(T.$$.fragment,X),L=!0)},o(X){I(u.$$.fragment,X),I(w.$$.fragment,X),I(T.$$.fragment,X),L=!1},d(X){X&&S(t),H(u),W&&W.d(),H(w),H(T),V=!1,Re(F)}}}function ZT(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M=[],T=new Map,D;function A(J){n[11](J)}let P={class:"col-type-text",name:"id",$$slots:{default:[BT]},$$scope:{ctx:n}};n[2]!==void 0&&(P.sort=n[2]),o=new Ft({props:P}),le.push(()=>ke(o,"sort",A));function L(J){n[12](J)}let V={class:"col-type-email col-field-email",name:"email",$$slots:{default:[WT]},$$scope:{ctx:n}};n[2]!==void 0&&(V.sort=n[2]),u=new Ft({props:V}),le.push(()=>ke(u,"sort",L));function F(J){n[13](J)}let W={class:"col-type-date col-field-created",name:"created",$$slots:{default:[UT]},$$scope:{ctx:n}};n[2]!==void 0&&(W.sort=n[2]),d=new Ft({props:W}),le.push(()=>ke(d,"sort",F));function G(J){n[14](J)}let K={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[YT]},$$scope:{ctx:n}};n[2]!==void 0&&(K.sort=n[2]),b=new Ft({props:K}),le.push(()=>ke(b,"sort",G));let X=n[4];const Z=J=>J[24].id;for(let J=0;Jr=!1)),o.$set(Y);const re={};fe&134217728&&(re.$$scope={dirty:fe,ctx:J}),!f&&fe&4&&(f=!0,re.sort=J[2],$e(()=>f=!1)),u.$set(re);const Oe={};fe&134217728&&(Oe.$$scope={dirty:fe,ctx:J}),!h&&fe&4&&(h=!0,Oe.sort=J[2],$e(()=>h=!1)),d.$set(Oe);const ge={};fe&134217728&&(ge.$$scope={dirty:fe,ctx:J}),!g&&fe&4&&(g=!0,ge.sort=J[2],$e(()=>g=!1)),b.$set(ge),fe&186&&(X=J[4],be(),M=bt(M,fe,Z,1,J,X,T,C,xt,Up,null,Vp),ve(),!X.length&&ie?ie.p(J,fe):X.length?ie&&(ie.d(1),ie=null):(ie=zp(J),ie.c(),ie.m(C,null))),(!D||fe&32)&&ee(e,"table-loading",J[5])},i(J){if(!D){E(o.$$.fragment,J),E(u.$$.fragment,J),E(d.$$.fragment,J),E(b.$$.fragment,J);for(let fe=0;fe + New admin`,h=O(),j(m.$$.fragment),b=O(),j(g.$$.fragment),y=O(),T&&T.c(),k=Fe(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(f,"class","flex-fill"),p(d,"type","button"),p(d,"class","btn btn-expanded"),p(e,"class","page-header")},m(D,A){$(D,e,A),_(e,t),_(t,i),_(t,s),_(t,l),_(l,o),_(e,r),R(a,e,null),_(e,u),_(e,f),_(e,c),_(e,d),$(D,h,A),R(m,D,A),$(D,b,A),R(g,D,A),$(D,y,A),T&&T.m(D,A),$(D,k,A),w=!0,C||(M=U(d,"click",n[9]),C=!0)},p(D,A){(!w||A&64)&&ue(o,D[6]);const P={};A&2&&(P.value=D[1]),m.$set(P);const L={};A&134217918&&(L.$$scope={dirty:A,ctx:D}),g.$set(L),D[4].length?T?T.p(D,A):(T=Yp(D),T.c(),T.m(k.parentNode,k)):T&&(T.d(1),T=null)},i(D){w||(E(a.$$.fragment,D),E(m.$$.fragment,D),E(g.$$.fragment,D),w=!0)},o(D){I(a.$$.fragment,D),I(m.$$.fragment,D),I(g.$$.fragment,D),w=!1},d(D){D&&S(e),H(a),D&&S(h),H(m,D),D&&S(b),H(g,D),D&&S(y),T&&T.d(D),D&&S(k),C=!1,M()}}}function XT(n){let e,t,i,s,l,o;e=new Ci({}),i=new cn({props:{$$slots:{default:[GT]},$$scope:{ctx:n}}});let r={};return l=new zT({props:r}),n[18](l),l.$on("save",n[19]),l.$on("delete",n[20]),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment),s=O(),j(l.$$.fragment)},m(a,u){R(e,a,u),$(a,t,u),R(i,a,u),$(a,s,u),R(l,a,u),o=!0},p(a,[u]){const f={};u&134217982&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};l.$set(c)},i(a){o||(E(e.$$.fragment,a),E(i.$$.fragment,a),E(l.$$.fragment,a),o=!0)},o(a){I(e.$$.fragment,a),I(i.$$.fragment,a),I(l.$$.fragment,a),o=!1},d(a){H(e,a),a&&S(t),H(i,a),a&&S(s),n[18](null),H(l,a)}}}function QT(n,e,t){let i,s,l;Je(n,aa,V=>t(21,i=V)),Je(n,mt,V=>t(6,s=V)),Je(n,ya,V=>t(7,l=V)),Ht(mt,s="Admins",s);const o=new URLSearchParams(i);let r,a=[],u=!1,f=o.get("filter")||"",c=o.get("sort")||"-created";function d(){return t(5,u=!0),t(4,a=[]),me.admins.getFullList(100,{sort:c||"-created",filter:f}).then(V=>{t(4,a=V),t(5,u=!1)}).catch(V=>{V!=null&&V.isAbort||(t(5,u=!1),console.warn(V),h(),me.errorResponseHandler(V,!1))})}function h(){t(4,a=[])}const m=()=>d(),b=()=>r==null?void 0:r.show(),g=V=>t(1,f=V.detail);function y(V){c=V,t(2,c)}function k(V){c=V,t(2,c)}function w(V){c=V,t(2,c)}function C(V){c=V,t(2,c)}const M=V=>r==null?void 0:r.show(V),T=(V,F)=>{(F.code==="Enter"||F.code==="Space")&&(F.preventDefault(),r==null||r.show(V))},D=()=>t(1,f="");function A(V){le[V?"unshift":"push"](()=>{r=V,t(3,r)})}const P=()=>d(),L=()=>d();return n.$$.update=()=>{if(n.$$.dirty&6&&c!==-1&&f!==-1){const V=new URLSearchParams({filter:f,sort:c}).toString();ki("/settings/admins?"+V),d()}},[d,f,c,r,a,u,s,l,m,b,g,y,k,w,C,M,T,D,A,P,L]}class xT extends Me{constructor(e){super(),Ce(this,e,QT,XT,we,{loadAdmins:0})}get loadAdmins(){return this.$$.ctx[0]}}function eO(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Email"),s=O(),l=v("input"),p(e,"for",i=n[8]),p(l,"type","email"),p(l,"id",o=n[8]),l.required=!0,l.autofocus=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0]),l.focus(),r||(a=U(l,"input",n[4]),r=!0)},p(u,f){f&256&&i!==(i=u[8])&&p(e,"for",i),f&256&&o!==(o=u[8])&&p(l,"id",o),f&1&&l.value!==u[0]&&he(l,u[0])},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function tO(n){let e,t,i,s,l,o,r,a,u,f,c;return{c(){e=v("label"),t=z("Password"),s=O(),l=v("input"),r=O(),a=v("div"),u=v("a"),u.textContent="Forgotten password?",p(e,"for",i=n[8]),p(l,"type","password"),p(l,"id",o=n[8]),l.required=!0,p(u,"href","/request-password-reset"),p(u,"class","link-hint"),p(a,"class","help-block")},m(d,h){$(d,e,h),_(e,t),$(d,s,h),$(d,l,h),he(l,n[1]),$(d,r,h),$(d,a,h),_(a,u),f||(c=[U(l,"input",n[5]),Le(Vt.call(null,u))],f=!0)},p(d,h){h&256&&i!==(i=d[8])&&p(e,"for",i),h&256&&o!==(o=d[8])&&p(l,"id",o),h&2&&l.value!==d[1]&&he(l,d[1])},d(d){d&&S(e),d&&S(s),d&&S(l),d&&S(r),d&&S(a),f=!1,Re(c)}}}function nO(n){let e,t,i,s,l,o,r,a,u,f,c;return s=new _e({props:{class:"form-field required",name:"identity",$$slots:{default:[eO,({uniqueId:d})=>({8:d}),({uniqueId:d})=>d?256:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field required",name:"password",$$slots:{default:[tO,({uniqueId:d})=>({8:d}),({uniqueId:d})=>d?256:0]},$$scope:{ctx:n}}}),{c(){e=v("form"),t=v("div"),t.innerHTML="

    Admin sign in

    ",i=O(),j(s.$$.fragment),l=O(),j(o.$$.fragment),r=O(),a=v("button"),a.innerHTML=`Login + `,p(t,"class","content txt-center m-b-base"),p(a,"type","submit"),p(a,"class","btn btn-lg btn-block btn-next"),ee(a,"btn-disabled",n[2]),ee(a,"btn-loading",n[2]),p(e,"class","block")},m(d,h){$(d,e,h),_(e,t),_(e,i),R(s,e,null),_(e,l),R(o,e,null),_(e,r),_(e,a),u=!0,f||(c=U(e,"submit",ut(n[3])),f=!0)},p(d,h){const m={};h&769&&(m.$$scope={dirty:h,ctx:d}),s.$set(m);const b={};h&770&&(b.$$scope={dirty:h,ctx:d}),o.$set(b),(!u||h&4)&&ee(a,"btn-disabled",d[2]),(!u||h&4)&&ee(a,"btn-loading",d[2])},i(d){u||(E(s.$$.fragment,d),E(o.$$.fragment,d),u=!0)},o(d){I(s.$$.fragment,d),I(o.$$.fragment,d),u=!1},d(d){d&&S(e),H(s),H(o),f=!1,c()}}}function iO(n){let e,t;return e=new kg({props:{$$slots:{default:[nO]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,[s]){const l={};s&519&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function sO(n,e,t){let i;Je(n,aa,c=>t(6,i=c));const s=new URLSearchParams(i);let l=s.get("demoEmail")||"",o=s.get("demoPassword")||"",r=!1;function a(){if(!r)return t(2,r=!0),me.admins.authWithPassword(l,o).then(()=>{yg(),ki("/")}).catch(()=>{rl("Invalid login credentials.")}).finally(()=>{t(2,r=!1)})}function u(){l=this.value,t(0,l)}function f(){o=this.value,t(1,o)}return[l,o,r,a,u,f]}class lO extends Me{constructor(e){super(),Ce(this,e,sO,iO,we,{})}}function oO(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M;i=new _e({props:{class:"form-field required",name:"meta.appName",$$slots:{default:[aO,({uniqueId:D})=>({19:D}),({uniqueId:D})=>D?524288:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field required",name:"meta.appUrl",$$slots:{default:[uO,({uniqueId:D})=>({19:D}),({uniqueId:D})=>D?524288:0]},$$scope:{ctx:n}}}),a=new _e({props:{class:"form-field required",name:"logs.maxDays",$$slots:{default:[fO,({uniqueId:D})=>({19:D}),({uniqueId:D})=>D?524288:0]},$$scope:{ctx:n}}}),f=new _e({props:{class:"form-field form-field-toggle",name:"meta.hideControls",$$slots:{default:[cO,({uniqueId:D})=>({19:D}),({uniqueId:D})=>D?524288:0]},$$scope:{ctx:n}}});let T=n[3]&&Kp(n);return{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),r=O(),j(a.$$.fragment),u=O(),j(f.$$.fragment),c=O(),d=v("div"),h=v("div"),m=O(),T&&T.c(),b=O(),g=v("button"),y=v("span"),y.textContent="Save changes",p(t,"class","col-lg-6"),p(l,"class","col-lg-6"),p(h,"class","flex-fill"),p(y,"class","txt"),p(g,"type","submit"),p(g,"class","btn btn-expanded"),g.disabled=k=!n[3]||n[2],ee(g,"btn-loading",n[2]),p(d,"class","col-lg-12 flex"),p(e,"class","grid")},m(D,A){$(D,e,A),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),_(e,r),R(a,e,null),_(e,u),R(f,e,null),_(e,c),_(e,d),_(d,h),_(d,m),T&&T.m(d,null),_(d,b),_(d,g),_(g,y),w=!0,C||(M=U(g,"click",n[13]),C=!0)},p(D,A){const P={};A&1572865&&(P.$$scope={dirty:A,ctx:D}),i.$set(P);const L={};A&1572865&&(L.$$scope={dirty:A,ctx:D}),o.$set(L);const V={};A&1572865&&(V.$$scope={dirty:A,ctx:D}),a.$set(V);const F={};A&1572865&&(F.$$scope={dirty:A,ctx:D}),f.$set(F),D[3]?T?T.p(D,A):(T=Kp(D),T.c(),T.m(d,b)):T&&(T.d(1),T=null),(!w||A&12&&k!==(k=!D[3]||D[2]))&&(g.disabled=k),(!w||A&4)&&ee(g,"btn-loading",D[2])},i(D){w||(E(i.$$.fragment,D),E(o.$$.fragment,D),E(a.$$.fragment,D),E(f.$$.fragment,D),w=!0)},o(D){I(i.$$.fragment,D),I(o.$$.fragment,D),I(a.$$.fragment,D),I(f.$$.fragment,D),w=!1},d(D){D&&S(e),H(i),H(o),H(a),H(f),T&&T.d(),C=!1,M()}}}function rO(n){let e;return{c(){e=v("div"),p(e,"class","loader")},m(t,i){$(t,e,i)},p:x,i:x,o:x,d(t){t&&S(e)}}}function aO(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Application name"),s=O(),l=v("input"),p(e,"for",i=n[19]),p(l,"type","text"),p(l,"id",o=n[19]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].meta.appName),r||(a=U(l,"input",n[8]),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].meta.appName&&he(l,u[0].meta.appName)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function uO(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Application url"),s=O(),l=v("input"),p(e,"for",i=n[19]),p(l,"type","text"),p(l,"id",o=n[19]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].meta.appUrl),r||(a=U(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].meta.appUrl&&he(l,u[0].meta.appUrl)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function fO(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Logs max days retention"),s=O(),l=v("input"),p(e,"for",i=n[19]),p(l,"type","number"),p(l,"id",o=n[19]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].logs.maxDays),r||(a=U(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&&rt(l.value)!==u[0].logs.maxDays&&he(l,u[0].logs.maxDays)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function cO(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("input"),i=O(),s=v("label"),l=v("span"),l.textContent="Hide collection create and edit controls",o=O(),r=v("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){$(c,e,d),e.checked=n[0].meta.hideControls,$(c,i,d),$(c,s,d),_(s,l),_(s,o),_(s,r),u||(f=[U(e,"change",n[11]),Le(Be.call(null,r,{text:"This could prevent making accidental schema changes when in production environment.",position:"right"}))],u=!0)},p(c,d){d&524288&&t!==(t=c[19])&&p(e,"id",t),d&1&&(e.checked=c[0].meta.hideControls),d&524288&&a!==(a=c[19])&&p(s,"for",a)},d(c){c&&S(e),c&&S(i),c&&S(s),u=!1,Re(f)}}}function Kp(n){let e,t,i,s;return{c(){e=v("button"),t=v("span"),t.textContent="Cancel",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary btn-hint"),e.disabled=n[2]},m(l,o){$(l,e,o),_(e,t),i||(s=U(e,"click",n[12]),i=!0)},p(l,o){o&4&&(e.disabled=l[2])},d(l){l&&S(e),i=!1,s()}}}function dO(n){let e,t,i,s,l,o,r,a,u;const f=[rO,oO],c=[];function d(h,m){return h[1]?0:1}return l=d(n),o=c[l]=f[l](n),{c(){e=v("header"),e.innerHTML=``,t=O(),i=v("div"),s=v("form"),o.c(),p(e,"class","page-header"),p(s,"class","panel"),p(s,"autocomplete","off"),p(i,"class","wrapper")},m(h,m){$(h,e,m),$(h,t,m),$(h,i,m),_(i,s),c[l].m(s,null),r=!0,a||(u=U(s,"submit",ut(n[4])),a=!0)},p(h,m){let b=l;l=d(h),l===b?c[l].p(h,m):(be(),I(c[b],1,1,()=>{c[b]=null}),ve(),o=c[l],o?o.p(h,m):(o=c[l]=f[l](h),o.c()),E(o,1),o.m(s,null))},i(h){r||(E(o),r=!0)},o(h){I(o),r=!1},d(h){h&&S(e),h&&S(t),h&&S(i),c[l].d(),a=!1,u()}}}function pO(n){let e,t,i,s;return e=new Ci({}),i=new cn({props:{$$slots:{default:[dO]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment)},m(l,o){R(e,l,o),$(l,t,o),R(i,l,o),s=!0},p(l,[o]){const r={};o&1048591&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){I(e.$$.fragment,l),I(i.$$.fragment,l),s=!1},d(l){H(e,l),l&&S(t),H(i,l)}}}function hO(n,e,t){let i,s,l,o;Je(n,ks,T=>t(14,s=T)),Je(n,_o,T=>t(15,l=T)),Je(n,mt,T=>t(16,o=T)),Ht(mt,o="Application settings",o);let r={},a={},u=!1,f=!1,c="";d();async function d(){t(1,u=!0);try{const T=await me.settings.getAll()||{};m(T)}catch(T){me.errorResponseHandler(T)}t(1,u=!1)}async function h(){if(!(f||!i)){t(2,f=!0);try{const T=await me.settings.update(B.filterRedactedProps(a));m(T),Lt("Successfully saved application settings.")}catch(T){me.errorResponseHandler(T)}t(2,f=!1)}}function m(T={}){var D,A;Ht(_o,l=(D=T==null?void 0:T.meta)==null?void 0:D.appName,l),Ht(ks,s=!!((A=T==null?void 0:T.meta)!=null&&A.hideControls),s),t(0,a={meta:(T==null?void 0:T.meta)||{},logs:(T==null?void 0:T.logs)||{}}),t(6,r=JSON.parse(JSON.stringify(a)))}function b(){t(0,a=JSON.parse(JSON.stringify(r||{})))}function g(){a.meta.appName=this.value,t(0,a)}function y(){a.meta.appUrl=this.value,t(0,a)}function k(){a.logs.maxDays=rt(this.value),t(0,a)}function w(){a.meta.hideControls=this.checked,t(0,a)}const C=()=>b(),M=()=>h();return n.$$.update=()=>{n.$$.dirty&64&&t(7,c=JSON.stringify(r)),n.$$.dirty&129&&t(3,i=c!=JSON.stringify(a))},[a,u,f,i,h,b,r,c,g,y,k,w,C,M]}class mO extends Me{constructor(e){super(),Ce(this,e,hO,pO,we,{})}}function gO(n){let e,t,i,s=[{type:"password"},{autocomplete:"new-password"},n[5]],l={};for(let o=0;o',i=O(),s=v("input"),p(t,"type","button"),p(t,"class","btn btn-secondary btn-circle"),p(e,"class","form-field-addon"),Wn(s,a)},m(u,f){$(u,e,f),_(e,t),$(u,i,f),$(u,s,f),s.autofocus&&s.focus(),l||(o=[Le(Be.call(null,t,{position:"left",text:"Set new value"})),U(t,"click",n[6])],l=!0)},p(u,f){Wn(s,a=Ut(r,[{readOnly:!0},{type:"text"},f&2&&{placeholder:u[1]},f&32&&u[5]]))},d(u){u&&S(e),u&&S(i),u&&S(s),l=!1,Re(o)}}}function bO(n){let e;function t(l,o){return l[3]?_O:gO}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:x,o:x,d(l){s.d(l),l&&S(e)}}}function vO(n,e,t){const i=["value","mask"];let s=wt(e,i),{value:l=""}=e,{mask:o="******"}=e,r,a=!1;async function u(){t(0,l=""),t(3,a=!1),await $n(),r==null||r.focus()}const f=()=>u();function c(h){le[h?"unshift":"push"](()=>{r=h,t(2,r)})}function d(){l=this.value,t(0,l)}return n.$$set=h=>{e=Ye(Ye({},e),Un(h)),t(5,s=wt(e,i)),"value"in h&&t(0,l=h.value),"mask"in h&&t(1,o=h.mask)},n.$$.update=()=>{n.$$.dirty&3&&l===o&&t(3,a=!0)},[l,o,r,a,u,s,f,c,d]}class Ga extends Me{constructor(e){super(),Ce(this,e,vO,bO,we,{value:0,mask:1})}}function yO(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b;return{c(){e=v("label"),t=z("Subject"),s=O(),l=v("input"),r=O(),a=v("div"),u=z(`Available placeholder parameters: + `),f=v("span"),f.textContent=`{APP_NAME} + `,c=z(`, + `),d=v("span"),d.textContent=`{APP_URL} + `,h=z("."),p(e,"for",i=n[31]),p(l,"type","text"),p(l,"id",o=n[31]),p(l,"spellcheck","false"),l.required=!0,p(f,"class","label label-sm link-primary txt-mono"),p(d,"class","label label-sm link-primary txt-mono"),p(a,"class","help-block")},m(g,y){$(g,e,y),_(e,t),$(g,s,y),$(g,l,y),he(l,n[0].subject),$(g,r,y),$(g,a,y),_(a,u),_(a,f),_(a,c),_(a,d),_(a,h),m||(b=[U(l,"input",n[13]),U(f,"click",n[14]),U(d,"click",n[15])],m=!0)},p(g,y){y[1]&1&&i!==(i=g[31])&&p(e,"for",i),y[1]&1&&o!==(o=g[31])&&p(l,"id",o),y[0]&1&&l.value!==g[0].subject&&he(l,g[0].subject)},d(g){g&&S(e),g&&S(s),g&&S(l),g&&S(r),g&&S(a),m=!1,Re(b)}}}function kO(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y;return{c(){e=v("label"),t=z("Action URL"),s=O(),l=v("input"),r=O(),a=v("div"),u=z(`Available placeholder parameters: + `),f=v("span"),f.textContent=`{APP_NAME} + `,c=z(`, + `),d=v("span"),d.textContent=`{APP_URL} + `,h=z(`, + `),m=v("span"),m.textContent="{TOKEN}",b=z("."),p(e,"for",i=n[31]),p(l,"type","text"),p(l,"id",o=n[31]),p(l,"spellcheck","false"),l.required=!0,p(f,"class","label label-sm link-primary txt-mono"),p(d,"class","label label-sm link-primary txt-mono"),p(m,"class","label label-sm link-primary txt-mono"),p(m,"title","Required parameter"),p(a,"class","help-block")},m(k,w){$(k,e,w),_(e,t),$(k,s,w),$(k,l,w),he(l,n[0].actionUrl),$(k,r,w),$(k,a,w),_(a,u),_(a,f),_(a,c),_(a,d),_(a,h),_(a,m),_(a,b),g||(y=[U(l,"input",n[16]),U(f,"click",n[17]),U(d,"click",n[18]),U(m,"click",n[19])],g=!0)},p(k,w){w[1]&1&&i!==(i=k[31])&&p(e,"for",i),w[1]&1&&o!==(o=k[31])&&p(l,"id",o),w[0]&1&&l.value!==k[0].actionUrl&&he(l,k[0].actionUrl)},d(k){k&&S(e),k&&S(s),k&&S(l),k&&S(r),k&&S(a),g=!1,Re(y)}}}function wO(n){let e,t,i,s;return{c(){e=v("textarea"),p(e,"id",t=n[31]),p(e,"class","txt-mono"),p(e,"spellcheck","false"),p(e,"rows","14"),e.required=!0},m(l,o){$(l,e,o),he(e,n[0].body),i||(s=U(e,"input",n[21]),i=!0)},p(l,o){o[1]&1&&t!==(t=l[31])&&p(e,"id",t),o[0]&1&&he(e,l[0].body)},i:x,o:x,d(l){l&&S(e),i=!1,s()}}}function SO(n){let e,t,i,s;function l(a){n[20](a)}var o=n[4];function r(a){let u={id:a[31],language:"html"};return a[0].body!==void 0&&(u.value=a[0].body),{props:u}}return o&&(e=Qt(o,r(n)),le.push(()=>ke(e,"value",l))),{c(){e&&j(e.$$.fragment),i=Fe()},m(a,u){e&&R(e,a,u),$(a,i,u),s=!0},p(a,u){const f={};if(u[1]&1&&(f.id=a[31]),!t&&u[0]&1&&(t=!0,f.value=a[0].body,$e(()=>t=!1)),o!==(o=a[4])){if(e){be();const c=e;I(c.$$.fragment,1,0,()=>{H(c,1)}),ve()}o?(e=Qt(o,r(a)),le.push(()=>ke(e,"value",l)),j(e.$$.fragment),E(e.$$.fragment,1),R(e,i.parentNode,i)):e=null}else o&&e.$set(f)},i(a){s||(e&&E(e.$$.fragment,a),s=!0)},o(a){e&&I(e.$$.fragment,a),s=!1},d(a){a&&S(i),e&&H(e,a)}}}function $O(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C;const M=[SO,wO],T=[];function D(A,P){return A[4]&&!A[5]?0:1}return l=D(n),o=T[l]=M[l](n),{c(){e=v("label"),t=z("Body (HTML)"),s=O(),o.c(),r=O(),a=v("div"),u=z(`Available placeholder parameters: + `),f=v("span"),f.textContent=`{APP_NAME} + `,c=z(`, + `),d=v("span"),d.textContent=`{APP_URL} + `,h=z(`, + `),m=v("span"),m.textContent=`{TOKEN} + `,b=z(`, + `),g=v("span"),g.textContent=`{ACTION_URL} + `,y=z("."),p(e,"for",i=n[31]),p(f,"class","label label-sm link-primary txt-mono"),p(d,"class","label label-sm link-primary txt-mono"),p(m,"class","label label-sm link-primary txt-mono"),p(g,"class","label label-sm link-primary txt-mono"),p(g,"title","Required parameter"),p(a,"class","help-block")},m(A,P){$(A,e,P),_(e,t),$(A,s,P),T[l].m(A,P),$(A,r,P),$(A,a,P),_(a,u),_(a,f),_(a,c),_(a,d),_(a,h),_(a,m),_(a,b),_(a,g),_(a,y),k=!0,w||(C=[U(f,"click",n[22]),U(d,"click",n[23]),U(m,"click",n[24]),U(g,"click",n[25])],w=!0)},p(A,P){(!k||P[1]&1&&i!==(i=A[31]))&&p(e,"for",i);let L=l;l=D(A),l===L?T[l].p(A,P):(be(),I(T[L],1,1,()=>{T[L]=null}),ve(),o=T[l],o?o.p(A,P):(o=T[l]=M[l](A),o.c()),E(o,1),o.m(r.parentNode,r))},i(A){k||(E(o),k=!0)},o(A){I(o),k=!1},d(A){A&&S(e),A&&S(s),T[l].d(A),A&&S(r),A&&S(a),w=!1,Re(C)}}}function CO(n){let e,t,i,s,l,o;return e=new _e({props:{class:"form-field required",name:n[1]+".subject",$$slots:{default:[yO,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),i=new _e({props:{class:"form-field required",name:n[1]+".actionUrl",$$slots:{default:[kO,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),l=new _e({props:{class:"form-field m-0 required",name:n[1]+".body",$$slots:{default:[$O,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment),s=O(),j(l.$$.fragment)},m(r,a){R(e,r,a),$(r,t,a),R(i,r,a),$(r,s,a),R(l,r,a),o=!0},p(r,a){const u={};a[0]&2&&(u.name=r[1]+".subject"),a[0]&1|a[1]&3&&(u.$$scope={dirty:a,ctx:r}),e.$set(u);const f={};a[0]&2&&(f.name=r[1]+".actionUrl"),a[0]&1|a[1]&3&&(f.$$scope={dirty:a,ctx:r}),i.$set(f);const c={};a[0]&2&&(c.name=r[1]+".body"),a[0]&49|a[1]&3&&(c.$$scope={dirty:a,ctx:r}),l.$set(c)},i(r){o||(E(e.$$.fragment,r),E(i.$$.fragment,r),E(l.$$.fragment,r),o=!0)},o(r){I(e.$$.fragment,r),I(i.$$.fragment,r),I(l.$$.fragment,r),o=!1},d(r){H(e,r),r&&S(t),H(i,r),r&&S(s),H(l,r)}}}function Jp(n){let e,t,i,s,l;return{c(){e=v("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){$(o,e,r),i=!0,s||(l=Le(Be.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Qe(()=>{t||(t=je(e,$t,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=je(e,$t,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&S(e),o&&t&&t.end(),s=!1,l()}}}function MO(n){let e,t,i,s,l,o,r,a,u,f,c=n[6]&&Jp();return{c(){e=v("div"),t=v("i"),i=O(),s=v("span"),l=z(n[2]),o=O(),r=v("div"),a=O(),c&&c.c(),u=Fe(),p(t,"class","ri-draft-line"),p(s,"class","txt"),p(e,"class","inline-flex"),p(r,"class","flex-fill")},m(d,h){$(d,e,h),_(e,t),_(e,i),_(e,s),_(s,l),$(d,o,h),$(d,r,h),$(d,a,h),c&&c.m(d,h),$(d,u,h),f=!0},p(d,h){(!f||h[0]&4)&&ue(l,d[2]),d[6]?c?h[0]&64&&E(c,1):(c=Jp(),c.c(),E(c,1),c.m(u.parentNode,u)):c&&(be(),I(c,1,1,()=>{c=null}),ve())},i(d){f||(E(c),f=!0)},o(d){I(c),f=!1},d(d){d&&S(e),d&&S(o),d&&S(r),d&&S(a),c&&c.d(d),d&&S(u)}}}function TO(n){let e,t;const i=[n[8]];let s={$$slots:{header:[MO],default:[CO]},$$scope:{ctx:n}};for(let l=0;lt(12,o=J));let{key:r}=e,{title:a}=e,{config:u={}}=e,f,c=Zp,d=!1;function h(){f==null||f.expand()}function m(){f==null||f.collapse()}function b(){f==null||f.collapseSiblings()}async function g(){c||d||(t(5,d=!0),t(4,c=(await st(()=>import("./CodeEditor.45f24efe.js"),["./CodeEditor.45f24efe.js","./index.9c8b95cd.js"],import.meta.url)).default),Zp=c,t(5,d=!1))}function y(J){B.copyToClipboard(J),bg(`Copied ${J} to clipboard`,2e3)}g();function k(){u.subject=this.value,t(0,u)}const w=()=>y("{APP_NAME}"),C=()=>y("{APP_URL}");function M(){u.actionUrl=this.value,t(0,u)}const T=()=>y("{APP_NAME}"),D=()=>y("{APP_URL}"),A=()=>y("{TOKEN}");function P(J){n.$$.not_equal(u.body,J)&&(u.body=J,t(0,u))}function L(){u.body=this.value,t(0,u)}const V=()=>y("{APP_NAME}"),F=()=>y("{APP_URL}"),W=()=>y("{TOKEN}"),G=()=>y("{ACTION_URL}");function K(J){le[J?"unshift":"push"](()=>{f=J,t(3,f)})}function X(J){Ve.call(this,n,J)}function Z(J){Ve.call(this,n,J)}function ie(J){Ve.call(this,n,J)}return n.$$set=J=>{e=Ye(Ye({},e),Un(J)),t(8,l=wt(e,s)),"key"in J&&t(1,r=J.key),"title"in J&&t(2,a=J.title),"config"in J&&t(0,u=J.config)},n.$$.update=()=>{n.$$.dirty[0]&4098&&t(6,i=!B.isEmpty(B.getNestedVal(o,r))),n.$$.dirty[0]&3&&(u.enabled||al(r))},[u,r,a,f,c,d,i,y,l,h,m,b,o,k,w,C,M,T,D,A,P,L,V,F,W,G,K,X,Z,ie]}class $r extends Me{constructor(e){super(),Ce(this,e,OO,TO,we,{key:1,title:2,config:0,expand:9,collapse:10,collapseSiblings:11},null,[-1,-1])}get expand(){return this.$$.ctx[9]}get collapse(){return this.$$.ctx[10]}get collapseSiblings(){return this.$$.ctx[11]}}function Gp(n,e,t){const i=n.slice();return i[22]=e[t],i}function Xp(n,e){let t,i,s,l,o,r=e[22].label+"",a,u,f,c,d;return{key:n,first:null,c(){t=v("div"),i=v("input"),l=O(),o=v("label"),a=z(r),f=O(),p(i,"type","radio"),p(i,"name","template"),p(i,"id",s=e[21]+e[22].value),i.__value=e[22].value,i.value=i.__value,e[12][0].push(i),p(o,"for",u=e[21]+e[22].value),p(t,"class","form-field-block"),this.first=t},m(h,m){$(h,t,m),_(t,i),i.checked=i.__value===e[2],_(t,l),_(t,o),_(o,a),_(t,f),c||(d=U(i,"change",e[11]),c=!0)},p(h,m){e=h,m&2097152&&s!==(s=e[21]+e[22].value)&&p(i,"id",s),m&4&&(i.checked=i.__value===e[2]),m&2097152&&u!==(u=e[21]+e[22].value)&&p(o,"for",u)},d(h){h&&S(t),e[12][0].splice(e[12][0].indexOf(i),1),c=!1,d()}}}function DO(n){let e=[],t=new Map,i,s=n[7];const l=o=>o[22].value;for(let o=0;o({21:a}),({uniqueId:a})=>a?2097152:0]},$$scope:{ctx:n}}}),s=new _e({props:{class:"form-field required m-0",name:"email",$$slots:{default:[EO,({uniqueId:a})=>({21:a}),({uniqueId:a})=>a?2097152:0]},$$scope:{ctx:n}}}),{c(){e=v("form"),j(t.$$.fragment),i=O(),j(s.$$.fragment),p(e,"id",n[6]),p(e,"autocomplete","off")},m(a,u){$(a,e,u),R(t,e,null),_(e,i),R(s,e,null),l=!0,o||(r=U(e,"submit",ut(n[14])),o=!0)},p(a,u){const f={};u&35651588&&(f.$$scope={dirty:u,ctx:a}),t.$set(f);const c={};u&35651586&&(c.$$scope={dirty:u,ctx:a}),s.$set(c)},i(a){l||(E(t.$$.fragment,a),E(s.$$.fragment,a),l=!0)},o(a){I(t.$$.fragment,a),I(s.$$.fragment,a),l=!1},d(a){a&&S(e),H(t),H(s),o=!1,r()}}}function IO(n){let e;return{c(){e=v("h4"),e.textContent="Send test email",p(e,"class","center txt-break")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function PO(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("button"),t=z("Close"),i=O(),s=v("button"),l=v("i"),o=O(),r=v("span"),r.textContent="Send",p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[4],p(l,"class","ri-mail-send-line"),p(r,"class","txt"),p(s,"type","submit"),p(s,"form",n[6]),p(s,"class","btn btn-expanded"),s.disabled=a=!n[5]||n[4],ee(s,"btn-loading",n[4])},m(c,d){$(c,e,d),_(e,t),$(c,i,d),$(c,s,d),_(s,l),_(s,o),_(s,r),u||(f=[U(e,"click",n[0]),U(s,"click",n[10])],u=!0)},p(c,d){d&16&&(e.disabled=c[4]),d&48&&a!==(a=!c[5]||c[4])&&(s.disabled=a),d&16&&ee(s,"btn-loading",c[4])},d(c){c&&S(e),c&&S(i),c&&S(s),u=!1,Re(f)}}}function LO(n){let e,t,i={class:"overlay-panel-sm email-test-popup",overlayClose:!n[4],escClose:!n[4],beforeHide:n[15],popup:!0,$$slots:{footer:[PO],header:[IO],default:[AO]},$$scope:{ctx:n}};return e=new Jn({props:i}),n[16](e),e.$on("show",n[17]),e.$on("hide",n[18]),{c(){j(e.$$.fragment)},m(s,l){R(e,s,l),t=!0},p(s,[l]){const o={};l&16&&(o.overlayClose=!s[4]),l&16&&(o.escClose=!s[4]),l&16&&(o.beforeHide=s[15]),l&33554486&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){I(e.$$.fragment,s),t=!1},d(s){n[16](null),H(e,s)}}}const Cr="last_email_test",Qp="email_test_request";function NO(n,e,t){let i;const s=It(),l="email_test_"+B.randomString(5),o=[{label:'"Verification" template',value:"verification"},{label:'"Password reset" template',value:"password-reset"},{label:'"Confirm email change" template',value:"email-change"}];let r,a=localStorage.getItem(Cr),u=o[0].value,f=!1,c=null;function d(A="",P=""){t(1,a=A||localStorage.getItem(Cr)),t(2,u=P||o[0].value),Fn({}),r==null||r.show()}function h(){return clearTimeout(c),r==null?void 0:r.hide()}async function m(){if(!(!i||f)){t(4,f=!0),localStorage==null||localStorage.setItem(Cr,a),clearTimeout(c),c=setTimeout(()=>{me.cancelRequest(Qp),rl("Test email send timeout.")},3e4);try{await me.settings.testEmail(a,u,{$cancelKey:Qp}),Lt("Successfully sent test email."),s("submit"),t(4,f=!1),await $n(),h()}catch(A){t(4,f=!1),me.errorResponseHandler(A)}clearTimeout(c)}}const b=[[]],g=()=>m();function y(){u=this.__value,t(2,u)}function k(){a=this.value,t(1,a)}const w=()=>m(),C=()=>!f;function M(A){le[A?"unshift":"push"](()=>{r=A,t(3,r)})}function T(A){Ve.call(this,n,A)}function D(A){Ve.call(this,n,A)}return n.$$.update=()=>{n.$$.dirty&6&&t(5,i=!!a&&!!u)},[h,a,u,r,f,i,l,o,m,d,g,y,b,k,w,C,M,T,D]}class FO extends Me{constructor(e){super(),Ce(this,e,NO,LO,we,{show:9,hide:0})}get show(){return this.$$.ctx[9]}get hide(){return this.$$.ctx[0]}}function RO(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M,T,D,A,P,L;i=new _e({props:{class:"form-field required",name:"meta.senderName",$$slots:{default:[jO,({uniqueId:Y})=>({29:Y}),({uniqueId:Y})=>Y?536870912:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field required",name:"meta.senderAddress",$$slots:{default:[qO,({uniqueId:Y})=>({29:Y}),({uniqueId:Y})=>Y?536870912:0]},$$scope:{ctx:n}}});function V(Y){n[13](Y)}let F={single:!0,key:"meta.verificationTemplate",title:'Default "Verification" email template'};n[0].meta.verificationTemplate!==void 0&&(F.config=n[0].meta.verificationTemplate),u=new $r({props:F}),le.push(()=>ke(u,"config",V));function W(Y){n[14](Y)}let G={single:!0,key:"meta.resetPasswordTemplate",title:'Default "Password reset" email template'};n[0].meta.resetPasswordTemplate!==void 0&&(G.config=n[0].meta.resetPasswordTemplate),d=new $r({props:G}),le.push(()=>ke(d,"config",W));function K(Y){n[15](Y)}let X={single:!0,key:"meta.confirmEmailChangeTemplate",title:'Default "Confirm email change" email template'};n[0].meta.confirmEmailChangeTemplate!==void 0&&(X.config=n[0].meta.confirmEmailChangeTemplate),b=new $r({props:X}),le.push(()=>ke(b,"config",K)),C=new _e({props:{class:"form-field form-field-toggle m-b-sm",$$slots:{default:[VO,({uniqueId:Y})=>({29:Y}),({uniqueId:Y})=>Y?536870912:0]},$$scope:{ctx:n}}});let Z=n[0].smtp.enabled&&xp(n);function ie(Y,re){return Y[4]?JO:KO}let J=ie(n),fe=J(n);return{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),r=O(),a=v("div"),j(u.$$.fragment),c=O(),j(d.$$.fragment),m=O(),j(b.$$.fragment),y=O(),k=v("hr"),w=O(),j(C.$$.fragment),M=O(),Z&&Z.c(),T=O(),D=v("div"),A=v("div"),P=O(),fe.c(),p(t,"class","col-lg-6"),p(l,"class","col-lg-6"),p(e,"class","grid m-b-base"),p(a,"class","accordions"),p(A,"class","flex-fill"),p(D,"class","flex")},m(Y,re){$(Y,e,re),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),$(Y,r,re),$(Y,a,re),R(u,a,null),_(a,c),R(d,a,null),_(a,m),R(b,a,null),$(Y,y,re),$(Y,k,re),$(Y,w,re),R(C,Y,re),$(Y,M,re),Z&&Z.m(Y,re),$(Y,T,re),$(Y,D,re),_(D,A),_(D,P),fe.m(D,null),L=!0},p(Y,re){const Oe={};re&1610612737&&(Oe.$$scope={dirty:re,ctx:Y}),i.$set(Oe);const ge={};re&1610612737&&(ge.$$scope={dirty:re,ctx:Y}),o.$set(ge);const ae={};!f&&re&1&&(f=!0,ae.config=Y[0].meta.verificationTemplate,$e(()=>f=!1)),u.$set(ae);const pe={};!h&&re&1&&(h=!0,pe.config=Y[0].meta.resetPasswordTemplate,$e(()=>h=!1)),d.$set(pe);const de={};!g&&re&1&&(g=!0,de.config=Y[0].meta.confirmEmailChangeTemplate,$e(()=>g=!1)),b.$set(de);const Se={};re&1610612737&&(Se.$$scope={dirty:re,ctx:Y}),C.$set(Se),Y[0].smtp.enabled?Z?(Z.p(Y,re),re&1&&E(Z,1)):(Z=xp(Y),Z.c(),E(Z,1),Z.m(T.parentNode,T)):Z&&(be(),I(Z,1,1,()=>{Z=null}),ve()),J===(J=ie(Y))&&fe?fe.p(Y,re):(fe.d(1),fe=J(Y),fe&&(fe.c(),fe.m(D,null)))},i(Y){L||(E(i.$$.fragment,Y),E(o.$$.fragment,Y),E(u.$$.fragment,Y),E(d.$$.fragment,Y),E(b.$$.fragment,Y),E(C.$$.fragment,Y),E(Z),L=!0)},o(Y){I(i.$$.fragment,Y),I(o.$$.fragment,Y),I(u.$$.fragment,Y),I(d.$$.fragment,Y),I(b.$$.fragment,Y),I(C.$$.fragment,Y),I(Z),L=!1},d(Y){Y&&S(e),H(i),H(o),Y&&S(r),Y&&S(a),H(u),H(d),H(b),Y&&S(y),Y&&S(k),Y&&S(w),H(C,Y),Y&&S(M),Z&&Z.d(Y),Y&&S(T),Y&&S(D),fe.d()}}}function HO(n){let e;return{c(){e=v("div"),p(e,"class","loader")},m(t,i){$(t,e,i)},p:x,i:x,o:x,d(t){t&&S(e)}}}function jO(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Sender name"),s=O(),l=v("input"),p(e,"for",i=n[29]),p(l,"type","text"),p(l,"id",o=n[29]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].meta.senderName),r||(a=U(l,"input",n[11]),r=!0)},p(u,f){f&536870912&&i!==(i=u[29])&&p(e,"for",i),f&536870912&&o!==(o=u[29])&&p(l,"id",o),f&1&&l.value!==u[0].meta.senderName&&he(l,u[0].meta.senderName)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function qO(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Sender address"),s=O(),l=v("input"),p(e,"for",i=n[29]),p(l,"type","email"),p(l,"id",o=n[29]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].meta.senderAddress),r||(a=U(l,"input",n[12]),r=!0)},p(u,f){f&536870912&&i!==(i=u[29])&&p(e,"for",i),f&536870912&&o!==(o=u[29])&&p(l,"id",o),f&1&&l.value!==u[0].meta.senderAddress&&he(l,u[0].meta.senderAddress)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function VO(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("input"),i=O(),s=v("label"),l=v("span"),l.innerHTML="Use SMTP mail server (recommended)",o=O(),r=v("i"),p(e,"type","checkbox"),p(e,"id",t=n[29]),e.required=!0,p(l,"class","txt"),p(r,"class","ri-information-line link-hint"),p(s,"for",a=n[29])},m(c,d){$(c,e,d),e.checked=n[0].smtp.enabled,$(c,i,d),$(c,s,d),_(s,l),_(s,o),_(s,r),u||(f=[U(e,"change",n[16]),Le(Be.call(null,r,{text:'By default PocketBase uses the unix "sendmail" command for sending emails. For better emails deliverability it is recommended to use a SMTP mail server.',position:"top"}))],u=!0)},p(c,d){d&536870912&&t!==(t=c[29])&&p(e,"id",t),d&1&&(e.checked=c[0].smtp.enabled),d&536870912&&a!==(a=c[29])&&p(s,"for",a)},d(c){c&&S(e),c&&S(i),c&&S(s),u=!1,Re(f)}}}function xp(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w;return i=new _e({props:{class:"form-field required",name:"smtp.host",$$slots:{default:[zO,({uniqueId:C})=>({29:C}),({uniqueId:C})=>C?536870912:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field required",name:"smtp.port",$$slots:{default:[BO,({uniqueId:C})=>({29:C}),({uniqueId:C})=>C?536870912:0]},$$scope:{ctx:n}}}),u=new _e({props:{class:"form-field required",name:"smtp.tls",$$slots:{default:[WO,({uniqueId:C})=>({29:C}),({uniqueId:C})=>C?536870912:0]},$$scope:{ctx:n}}}),d=new _e({props:{class:"form-field",name:"smtp.username",$$slots:{default:[UO,({uniqueId:C})=>({29:C}),({uniqueId:C})=>C?536870912:0]},$$scope:{ctx:n}}}),b=new _e({props:{class:"form-field",name:"smtp.password",$$slots:{default:[YO,({uniqueId:C})=>({29:C}),({uniqueId:C})=>C?536870912:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),r=O(),a=v("div"),j(u.$$.fragment),f=O(),c=v("div"),j(d.$$.fragment),h=O(),m=v("div"),j(b.$$.fragment),g=O(),y=v("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(C,M){$(C,e,M),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),_(e,r),_(e,a),R(u,a,null),_(e,f),_(e,c),R(d,c,null),_(e,h),_(e,m),R(b,m,null),_(e,g),_(e,y),w=!0},p(C,M){const T={};M&1610612737&&(T.$$scope={dirty:M,ctx:C}),i.$set(T);const D={};M&1610612737&&(D.$$scope={dirty:M,ctx:C}),o.$set(D);const A={};M&1610612737&&(A.$$scope={dirty:M,ctx:C}),u.$set(A);const P={};M&1610612737&&(P.$$scope={dirty:M,ctx:C}),d.$set(P);const L={};M&1610612737&&(L.$$scope={dirty:M,ctx:C}),b.$set(L)},i(C){w||(E(i.$$.fragment,C),E(o.$$.fragment,C),E(u.$$.fragment,C),E(d.$$.fragment,C),E(b.$$.fragment,C),C&&Qe(()=>{k||(k=je(e,St,{duration:150},!0)),k.run(1)}),w=!0)},o(C){I(i.$$.fragment,C),I(o.$$.fragment,C),I(u.$$.fragment,C),I(d.$$.fragment,C),I(b.$$.fragment,C),C&&(k||(k=je(e,St,{duration:150},!1)),k.run(0)),w=!1},d(C){C&&S(e),H(i),H(o),H(u),H(d),H(b),C&&k&&k.end()}}}function zO(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("SMTP server host"),s=O(),l=v("input"),p(e,"for",i=n[29]),p(l,"type","text"),p(l,"id",o=n[29]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].smtp.host),r||(a=U(l,"input",n[17]),r=!0)},p(u,f){f&536870912&&i!==(i=u[29])&&p(e,"for",i),f&536870912&&o!==(o=u[29])&&p(l,"id",o),f&1&&l.value!==u[0].smtp.host&&he(l,u[0].smtp.host)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function BO(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Port"),s=O(),l=v("input"),p(e,"for",i=n[29]),p(l,"type","number"),p(l,"id",o=n[29]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].smtp.port),r||(a=U(l,"input",n[18]),r=!0)},p(u,f){f&536870912&&i!==(i=u[29])&&p(e,"for",i),f&536870912&&o!==(o=u[29])&&p(l,"id",o),f&1&&rt(l.value)!==u[0].smtp.port&&he(l,u[0].smtp.port)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function WO(n){let e,t,i,s,l,o,r;function a(f){n[19](f)}let u={id:n[29],items:n[6]};return n[0].smtp.tls!==void 0&&(u.keyOfSelected=n[0].smtp.tls),l=new Es({props:u}),le.push(()=>ke(l,"keyOfSelected",a)),{c(){e=v("label"),t=z("TLS Encryption"),s=O(),j(l.$$.fragment),p(e,"for",i=n[29])},m(f,c){$(f,e,c),_(e,t),$(f,s,c),R(l,f,c),r=!0},p(f,c){(!r||c&536870912&&i!==(i=f[29]))&&p(e,"for",i);const d={};c&536870912&&(d.id=f[29]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].smtp.tls,$e(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){I(l.$$.fragment,f),r=!1},d(f){f&&S(e),f&&S(s),H(l,f)}}}function UO(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Username"),s=O(),l=v("input"),p(e,"for",i=n[29]),p(l,"type","text"),p(l,"id",o=n[29])},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].smtp.username),r||(a=U(l,"input",n[20]),r=!0)},p(u,f){f&536870912&&i!==(i=u[29])&&p(e,"for",i),f&536870912&&o!==(o=u[29])&&p(l,"id",o),f&1&&l.value!==u[0].smtp.username&&he(l,u[0].smtp.username)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function YO(n){let e,t,i,s,l,o,r;function a(f){n[21](f)}let u={id:n[29]};return n[0].smtp.password!==void 0&&(u.value=n[0].smtp.password),l=new Ga({props:u}),le.push(()=>ke(l,"value",a)),{c(){e=v("label"),t=z("Password"),s=O(),j(l.$$.fragment),p(e,"for",i=n[29])},m(f,c){$(f,e,c),_(e,t),$(f,s,c),R(l,f,c),r=!0},p(f,c){(!r||c&536870912&&i!==(i=f[29]))&&p(e,"for",i);const d={};c&536870912&&(d.id=f[29]),!o&&c&1&&(o=!0,d.value=f[0].smtp.password,$e(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){I(l.$$.fragment,f),r=!1},d(f){f&&S(e),f&&S(s),H(l,f)}}}function KO(n){let e,t,i;return{c(){e=v("button"),e.innerHTML=` + Send test email`,p(e,"type","button"),p(e,"class","btn btn-expanded btn-outline")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[24]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function JO(n){let e,t,i,s,l,o,r,a;return{c(){e=v("button"),t=v("span"),t.textContent="Cancel",i=O(),s=v("button"),l=v("span"),l.textContent="Save changes",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary btn-hint"),e.disabled=n[3],p(l,"class","txt"),p(s,"type","submit"),p(s,"class","btn btn-expanded"),s.disabled=o=!n[4]||n[3],ee(s,"btn-loading",n[3])},m(u,f){$(u,e,f),_(e,t),$(u,i,f),$(u,s,f),_(s,l),r||(a=[U(e,"click",n[22]),U(s,"click",n[23])],r=!0)},p(u,f){f&8&&(e.disabled=u[3]),f&24&&o!==(o=!u[4]||u[3])&&(s.disabled=o),f&8&&ee(s,"btn-loading",u[3])},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,Re(a)}}}function ZO(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g;const y=[HO,RO],k=[];function w(C,M){return C[2]?0:1}return d=w(n),h=k[d]=y[d](n),{c(){e=v("header"),t=v("nav"),i=v("div"),i.textContent="Settings",s=O(),l=v("div"),o=z(n[5]),r=O(),a=v("div"),u=v("form"),f=v("div"),f.innerHTML="

    Configure common settings for sending emails.

    ",c=O(),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(C,M){$(C,e,M),_(e,t),_(t,i),_(t,s),_(t,l),_(l,o),$(C,r,M),$(C,a,M),_(a,u),_(u,f),_(u,c),k[d].m(u,null),m=!0,b||(g=U(u,"submit",ut(n[25])),b=!0)},p(C,M){(!m||M&32)&&ue(o,C[5]);let T=d;d=w(C),d===T?k[d].p(C,M):(be(),I(k[T],1,1,()=>{k[T]=null}),ve(),h=k[d],h?h.p(C,M):(h=k[d]=y[d](C),h.c()),E(h,1),h.m(u,null))},i(C){m||(E(h),m=!0)},o(C){I(h),m=!1},d(C){C&&S(e),C&&S(r),C&&S(a),k[d].d(),b=!1,g()}}}function GO(n){let e,t,i,s,l,o;e=new Ci({}),i=new cn({props:{$$slots:{default:[ZO]},$$scope:{ctx:n}}});let r={};return l=new FO({props:r}),n[26](l),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment),s=O(),j(l.$$.fragment)},m(a,u){R(e,a,u),$(a,t,u),R(i,a,u),$(a,s,u),R(l,a,u),o=!0},p(a,[u]){const f={};u&1073741887&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};l.$set(c)},i(a){o||(E(e.$$.fragment,a),E(i.$$.fragment,a),E(l.$$.fragment,a),o=!0)},o(a){I(e.$$.fragment,a),I(i.$$.fragment,a),I(l.$$.fragment,a),o=!1},d(a){H(e,a),a&&S(t),H(i,a),a&&S(s),n[26](null),H(l,a)}}}function XO(n,e,t){let i,s,l;Je(n,mt,X=>t(5,l=X));const o=[{label:"Auto (StartTLS)",value:!1},{label:"Always",value:!0}];Ht(mt,l="Mail settings",l);let r,a={},u={},f=!1,c=!1;d();async function d(){t(2,f=!0);try{const X=await me.settings.getAll()||{};m(X)}catch(X){me.errorResponseHandler(X)}t(2,f=!1)}async function h(){if(!(c||!s)){t(3,c=!0);try{const X=await me.settings.update(B.filterRedactedProps(u));m(X),Fn({}),Lt("Successfully saved mail settings.")}catch(X){me.errorResponseHandler(X)}t(3,c=!1)}}function m(X={}){t(0,u={meta:(X==null?void 0:X.meta)||{},smtp:(X==null?void 0:X.smtp)||{}}),t(9,a=JSON.parse(JSON.stringify(u)))}function b(){t(0,u=JSON.parse(JSON.stringify(a||{})))}function g(){u.meta.senderName=this.value,t(0,u)}function y(){u.meta.senderAddress=this.value,t(0,u)}function k(X){n.$$.not_equal(u.meta.verificationTemplate,X)&&(u.meta.verificationTemplate=X,t(0,u))}function w(X){n.$$.not_equal(u.meta.resetPasswordTemplate,X)&&(u.meta.resetPasswordTemplate=X,t(0,u))}function C(X){n.$$.not_equal(u.meta.confirmEmailChangeTemplate,X)&&(u.meta.confirmEmailChangeTemplate=X,t(0,u))}function M(){u.smtp.enabled=this.checked,t(0,u)}function T(){u.smtp.host=this.value,t(0,u)}function D(){u.smtp.port=rt(this.value),t(0,u)}function A(X){n.$$.not_equal(u.smtp.tls,X)&&(u.smtp.tls=X,t(0,u))}function P(){u.smtp.username=this.value,t(0,u)}function L(X){n.$$.not_equal(u.smtp.password,X)&&(u.smtp.password=X,t(0,u))}const V=()=>b(),F=()=>h(),W=()=>r==null?void 0:r.show(),G=()=>h();function K(X){le[X?"unshift":"push"](()=>{r=X,t(1,r)})}return n.$$.update=()=>{n.$$.dirty&512&&t(10,i=JSON.stringify(a)),n.$$.dirty&1025&&t(4,s=i!=JSON.stringify(u))},[u,r,f,c,s,l,o,h,b,a,i,g,y,k,w,C,M,T,D,A,P,L,V,F,W,G,K]}class QO extends Me{constructor(e){super(),Ce(this,e,XO,GO,we,{})}}function xO(n){var C,M;let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b;e=new _e({props:{class:"form-field form-field-toggle",$$slots:{default:[tD,({uniqueId:T})=>({25:T}),({uniqueId:T})=>T?33554432:0]},$$scope:{ctx:n}}});let g=((C=n[0].s3)==null?void 0:C.enabled)!=n[1].s3.enabled&&eh(n),y=n[1].s3.enabled&&th(n),k=((M=n[1].s3)==null?void 0:M.enabled)&&!n[6]&&!n[3]&&nh(n),w=n[6]&&ih(n);return{c(){j(e.$$.fragment),t=O(),g&&g.c(),i=O(),y&&y.c(),s=O(),l=v("div"),o=v("div"),r=O(),k&&k.c(),a=O(),w&&w.c(),u=O(),f=v("button"),c=v("span"),c.textContent="Save changes",p(o,"class","flex-fill"),p(c,"class","txt"),p(f,"type","submit"),p(f,"class","btn btn-expanded"),f.disabled=d=!n[6]||n[3],ee(f,"btn-loading",n[3]),p(l,"class","flex")},m(T,D){R(e,T,D),$(T,t,D),g&&g.m(T,D),$(T,i,D),y&&y.m(T,D),$(T,s,D),$(T,l,D),_(l,o),_(l,r),k&&k.m(l,null),_(l,a),w&&w.m(l,null),_(l,u),_(l,f),_(f,c),h=!0,m||(b=U(f,"click",n[19]),m=!0)},p(T,D){var P,L;const A={};D&100663298&&(A.$$scope={dirty:D,ctx:T}),e.$set(A),((P=T[0].s3)==null?void 0:P.enabled)!=T[1].s3.enabled?g?(g.p(T,D),D&3&&E(g,1)):(g=eh(T),g.c(),E(g,1),g.m(i.parentNode,i)):g&&(be(),I(g,1,1,()=>{g=null}),ve()),T[1].s3.enabled?y?(y.p(T,D),D&2&&E(y,1)):(y=th(T),y.c(),E(y,1),y.m(s.parentNode,s)):y&&(be(),I(y,1,1,()=>{y=null}),ve()),((L=T[1].s3)==null?void 0:L.enabled)&&!T[6]&&!T[3]?k?k.p(T,D):(k=nh(T),k.c(),k.m(l,a)):k&&(k.d(1),k=null),T[6]?w?w.p(T,D):(w=ih(T),w.c(),w.m(l,u)):w&&(w.d(1),w=null),(!h||D&72&&d!==(d=!T[6]||T[3]))&&(f.disabled=d),(!h||D&8)&&ee(f,"btn-loading",T[3])},i(T){h||(E(e.$$.fragment,T),E(g),E(y),h=!0)},o(T){I(e.$$.fragment,T),I(g),I(y),h=!1},d(T){H(e,T),T&&S(t),g&&g.d(T),T&&S(i),y&&y.d(T),T&&S(s),T&&S(l),k&&k.d(),w&&w.d(),m=!1,b()}}}function eD(n){let e;return{c(){e=v("div"),p(e,"class","loader")},m(t,i){$(t,e,i)},p:x,i:x,o:x,d(t){t&&S(e)}}}function tD(n){let e,t,i,s,l,o,r,a;return{c(){e=v("input"),i=O(),s=v("label"),l=z("Use S3 storage"),p(e,"type","checkbox"),p(e,"id",t=n[25]),e.required=!0,p(s,"for",o=n[25])},m(u,f){$(u,e,f),e.checked=n[1].s3.enabled,$(u,i,f),$(u,s,f),_(s,l),r||(a=U(e,"change",n[11]),r=!0)},p(u,f){f&33554432&&t!==(t=u[25])&&p(e,"id",t),f&2&&(e.checked=u[1].s3.enabled),f&33554432&&o!==(o=u[25])&&p(s,"for",o)},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,a()}}}function eh(n){var P;let e,t,i,s,l,o,r,a=(P=n[0].s3)!=null&&P.enabled?"S3 storage":"local file system",u,f,c,d=n[1].s3.enabled?"S3 storage":"local file system",h,m,b,g,y,k,w,C,M,T,D,A;return{c(){e=v("div"),t=v("div"),i=v("div"),i.innerHTML='',s=O(),l=v("div"),o=z(`If you have existing uploaded files, you'll have to migrate them manually from + the + `),r=v("strong"),u=z(a),f=z(` + to the + `),c=v("strong"),h=z(d),m=z(`. + `),b=v("br"),g=z(` + There are numerous command line tools that can help you, such as: + `),y=v("a"),y.textContent=`rclone + `,k=z(`, + `),w=v("a"),w.textContent=`s5cmd + `,C=z(", etc."),M=O(),T=v("div"),p(i,"class","icon"),p(y,"href","https://github.com/rclone/rclone"),p(y,"target","_blank"),p(y,"rel","noopener noreferrer"),p(y,"class","txt-bold"),p(w,"href","https://github.com/peak/s5cmd"),p(w,"target","_blank"),p(w,"rel","noopener noreferrer"),p(w,"class","txt-bold"),p(l,"class","content"),p(t,"class","alert alert-warning m-0"),p(T,"class","clearfix m-t-base")},m(L,V){$(L,e,V),_(e,t),_(t,i),_(t,s),_(t,l),_(l,o),_(l,r),_(r,u),_(l,f),_(l,c),_(c,h),_(l,m),_(l,b),_(l,g),_(l,y),_(l,k),_(l,w),_(l,C),_(e,M),_(e,T),A=!0},p(L,V){var F;(!A||V&1)&&a!==(a=(F=L[0].s3)!=null&&F.enabled?"S3 storage":"local file system")&&ue(u,a),(!A||V&2)&&d!==(d=L[1].s3.enabled?"S3 storage":"local file system")&&ue(h,d)},i(L){A||(L&&Qe(()=>{D||(D=je(e,St,{duration:150},!0)),D.run(1)}),A=!0)},o(L){L&&(D||(D=je(e,St,{duration:150},!1)),D.run(0)),A=!1},d(L){L&&S(e),L&&D&&D.end()}}}function th(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M,T;return i=new _e({props:{class:"form-field required",name:"s3.endpoint",$$slots:{default:[nD,({uniqueId:D})=>({25:D}),({uniqueId:D})=>D?33554432:0]},$$scope:{ctx:n}}}),o=new _e({props:{class:"form-field required",name:"s3.bucket",$$slots:{default:[iD,({uniqueId:D})=>({25:D}),({uniqueId:D})=>D?33554432:0]},$$scope:{ctx:n}}}),u=new _e({props:{class:"form-field required",name:"s3.region",$$slots:{default:[sD,({uniqueId:D})=>({25:D}),({uniqueId:D})=>D?33554432:0]},$$scope:{ctx:n}}}),d=new _e({props:{class:"form-field required",name:"s3.accessKey",$$slots:{default:[lD,({uniqueId:D})=>({25:D}),({uniqueId:D})=>D?33554432:0]},$$scope:{ctx:n}}}),b=new _e({props:{class:"form-field required",name:"s3.secret",$$slots:{default:[oD,({uniqueId:D})=>({25:D}),({uniqueId:D})=>D?33554432:0]},$$scope:{ctx:n}}}),k=new _e({props:{class:"form-field",name:"s3.forcePathStyle",$$slots:{default:[rD,({uniqueId:D})=>({25:D}),({uniqueId:D})=>D?33554432:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),j(i.$$.fragment),s=O(),l=v("div"),j(o.$$.fragment),r=O(),a=v("div"),j(u.$$.fragment),f=O(),c=v("div"),j(d.$$.fragment),h=O(),m=v("div"),j(b.$$.fragment),g=O(),y=v("div"),j(k.$$.fragment),w=O(),C=v("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(C,"class","col-lg-12"),p(e,"class","grid")},m(D,A){$(D,e,A),_(e,t),R(i,t,null),_(e,s),_(e,l),R(o,l,null),_(e,r),_(e,a),R(u,a,null),_(e,f),_(e,c),R(d,c,null),_(e,h),_(e,m),R(b,m,null),_(e,g),_(e,y),R(k,y,null),_(e,w),_(e,C),T=!0},p(D,A){const P={};A&100663298&&(P.$$scope={dirty:A,ctx:D}),i.$set(P);const L={};A&100663298&&(L.$$scope={dirty:A,ctx:D}),o.$set(L);const V={};A&100663298&&(V.$$scope={dirty:A,ctx:D}),u.$set(V);const F={};A&100663298&&(F.$$scope={dirty:A,ctx:D}),d.$set(F);const W={};A&100663298&&(W.$$scope={dirty:A,ctx:D}),b.$set(W);const G={};A&100663298&&(G.$$scope={dirty:A,ctx:D}),k.$set(G)},i(D){T||(E(i.$$.fragment,D),E(o.$$.fragment,D),E(u.$$.fragment,D),E(d.$$.fragment,D),E(b.$$.fragment,D),E(k.$$.fragment,D),D&&Qe(()=>{M||(M=je(e,St,{duration:150},!0)),M.run(1)}),T=!0)},o(D){I(i.$$.fragment,D),I(o.$$.fragment,D),I(u.$$.fragment,D),I(d.$$.fragment,D),I(b.$$.fragment,D),I(k.$$.fragment,D),D&&(M||(M=je(e,St,{duration:150},!1)),M.run(0)),T=!1},d(D){D&&S(e),H(i),H(o),H(u),H(d),H(b),H(k),D&&M&&M.end()}}}function nD(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Endpoint"),s=O(),l=v("input"),p(e,"for",i=n[25]),p(l,"type","text"),p(l,"id",o=n[25]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[1].s3.endpoint),r||(a=U(l,"input",n[12]),r=!0)},p(u,f){f&33554432&&i!==(i=u[25])&&p(e,"for",i),f&33554432&&o!==(o=u[25])&&p(l,"id",o),f&2&&l.value!==u[1].s3.endpoint&&he(l,u[1].s3.endpoint)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function iD(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Bucket"),s=O(),l=v("input"),p(e,"for",i=n[25]),p(l,"type","text"),p(l,"id",o=n[25]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[1].s3.bucket),r||(a=U(l,"input",n[13]),r=!0)},p(u,f){f&33554432&&i!==(i=u[25])&&p(e,"for",i),f&33554432&&o!==(o=u[25])&&p(l,"id",o),f&2&&l.value!==u[1].s3.bucket&&he(l,u[1].s3.bucket)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function sD(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Region"),s=O(),l=v("input"),p(e,"for",i=n[25]),p(l,"type","text"),p(l,"id",o=n[25]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[1].s3.region),r||(a=U(l,"input",n[14]),r=!0)},p(u,f){f&33554432&&i!==(i=u[25])&&p(e,"for",i),f&33554432&&o!==(o=u[25])&&p(l,"id",o),f&2&&l.value!==u[1].s3.region&&he(l,u[1].s3.region)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function lD(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Access key"),s=O(),l=v("input"),p(e,"for",i=n[25]),p(l,"type","text"),p(l,"id",o=n[25]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[1].s3.accessKey),r||(a=U(l,"input",n[15]),r=!0)},p(u,f){f&33554432&&i!==(i=u[25])&&p(e,"for",i),f&33554432&&o!==(o=u[25])&&p(l,"id",o),f&2&&l.value!==u[1].s3.accessKey&&he(l,u[1].s3.accessKey)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function oD(n){let e,t,i,s,l,o,r;function a(f){n[16](f)}let u={id:n[25],required:!0};return n[1].s3.secret!==void 0&&(u.value=n[1].s3.secret),l=new Ga({props:u}),le.push(()=>ke(l,"value",a)),{c(){e=v("label"),t=z("Secret"),s=O(),j(l.$$.fragment),p(e,"for",i=n[25])},m(f,c){$(f,e,c),_(e,t),$(f,s,c),R(l,f,c),r=!0},p(f,c){(!r||c&33554432&&i!==(i=f[25]))&&p(e,"for",i);const d={};c&33554432&&(d.id=f[25]),!o&&c&2&&(o=!0,d.value=f[1].s3.secret,$e(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){I(l.$$.fragment,f),r=!1},d(f){f&&S(e),f&&S(s),H(l,f)}}}function rD(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=v("input"),i=O(),s=v("label"),l=v("span"),l.textContent="Force path-style addressing",o=O(),r=v("i"),p(e,"type","checkbox"),p(e,"id",t=n[25]),p(l,"class","txt"),p(r,"class","ri-information-line link-hint"),p(s,"for",a=n[25])},m(c,d){$(c,e,d),e.checked=n[1].s3.forcePathStyle,$(c,i,d),$(c,s,d),_(s,l),_(s,o),_(s,r),u||(f=[U(e,"change",n[17]),Le(Be.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&33554432&&t!==(t=c[25])&&p(e,"id",t),d&2&&(e.checked=c[1].s3.forcePathStyle),d&33554432&&a!==(a=c[25])&&p(s,"for",a)},d(c){c&&S(e),c&&S(i),c&&S(s),u=!1,Re(f)}}}function nh(n){let e;function t(l,o){return l[4]?fD:l[5]?uD:aD}let i=t(n),s=i(n);return{c(){s.c(),e=Fe()},m(l,o){s.m(l,o),$(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&S(e)}}}function aD(n){let e;return{c(){e=v("div"),e.innerHTML=` + S3 connected successfully`,p(e,"class","label label-sm label-success entrance-right")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function uD(n){let e,t,i,s;return{c(){e=v("div"),e.innerHTML=` + Failed to establish S3 connection`,p(e,"class","label label-sm label-warning entrance-right")},m(l,o){var r;$(l,e,o),i||(s=Le(t=Be.call(null,e,(r=n[5].data)==null?void 0:r.message)),i=!0)},p(l,o){var r;t&&Wt(t.update)&&o&32&&t.update.call(null,(r=l[5].data)==null?void 0:r.message)},d(l){l&&S(e),i=!1,s()}}}function fD(n){let e;return{c(){e=v("span"),p(e,"class","loader loader-sm")},m(t,i){$(t,e,i)},p:x,d(t){t&&S(e)}}}function ih(n){let e,t,i,s;return{c(){e=v("button"),t=v("span"),t.textContent="Cancel",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary btn-hint"),e.disabled=n[3]},m(l,o){$(l,e,o),_(e,t),i||(s=U(e,"click",n[18]),i=!0)},p(l,o){o&8&&(e.disabled=l[3])},d(l){l&&S(e),i=!1,s()}}}function cD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g;const y=[eD,xO],k=[];function w(C,M){return C[2]?0:1}return d=w(n),h=k[d]=y[d](n),{c(){e=v("header"),t=v("nav"),i=v("div"),i.textContent="Settings",s=O(),l=v("div"),o=z(n[7]),r=O(),a=v("div"),u=v("form"),f=v("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=O(),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(C,M){$(C,e,M),_(e,t),_(t,i),_(t,s),_(t,l),_(l,o),$(C,r,M),$(C,a,M),_(a,u),_(u,f),_(u,c),k[d].m(u,null),m=!0,b||(g=U(u,"submit",ut(n[20])),b=!0)},p(C,M){(!m||M&128)&&ue(o,C[7]);let T=d;d=w(C),d===T?k[d].p(C,M):(be(),I(k[T],1,1,()=>{k[T]=null}),ve(),h=k[d],h?h.p(C,M):(h=k[d]=y[d](C),h.c()),E(h,1),h.m(u,null))},i(C){m||(E(h),m=!0)},o(C){I(h),m=!1},d(C){C&&S(e),C&&S(r),C&&S(a),k[d].d(),b=!1,g()}}}function dD(n){let e,t,i,s;return e=new Ci({}),i=new cn({props:{$$slots:{default:[cD]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment)},m(l,o){R(e,l,o),$(l,t,o),R(i,l,o),s=!0},p(l,[o]){const r={};o&67109119&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){I(e.$$.fragment,l),I(i.$$.fragment,l),s=!1},d(l){H(e,l),l&&S(t),H(i,l)}}}const no="s3_test_request";function pD(n,e,t){let i,s,l;Je(n,mt,F=>t(7,l=F)),Ht(mt,l="Files storage",l);let o={},r={},a=!1,u=!1,f=!1,c=null,d=null;h();async function h(){t(2,a=!0);try{const F=await me.settings.getAll()||{};b(F)}catch(F){me.errorResponseHandler(F)}t(2,a=!1)}async function m(){if(!(u||!s)){t(3,u=!0);try{me.cancelRequest(no);const F=await me.settings.update(B.filterRedactedProps(r));Fn({}),await b(F),yg(),c?y1("Successfully saved but failed to establish S3 connection."):Lt("Successfully saved files storage settings.")}catch(F){me.errorResponseHandler(F)}t(3,u=!1)}}async function b(F={}){t(1,r={s3:(F==null?void 0:F.s3)||{}}),t(0,o=JSON.parse(JSON.stringify(r))),await y()}async function g(){t(1,r=JSON.parse(JSON.stringify(o||{}))),await y()}async function y(){if(t(5,c=null),!!r.s3.enabled){me.cancelRequest(no),clearTimeout(d),d=setTimeout(()=>{me.cancelRequest(no),addErrorToast("S3 test connection timeout.")},3e4),t(4,f=!0);try{await me.settings.testS3({$cancelKey:no})}catch(F){t(5,c=F)}t(4,f=!1),clearTimeout(d)}}un(()=>()=>{clearTimeout(d)});function k(){r.s3.enabled=this.checked,t(1,r)}function w(){r.s3.endpoint=this.value,t(1,r)}function C(){r.s3.bucket=this.value,t(1,r)}function M(){r.s3.region=this.value,t(1,r)}function T(){r.s3.accessKey=this.value,t(1,r)}function D(F){n.$$.not_equal(r.s3.secret,F)&&(r.s3.secret=F,t(1,r))}function A(){r.s3.forcePathStyle=this.checked,t(1,r)}const P=()=>g(),L=()=>m(),V=()=>m();return n.$$.update=()=>{n.$$.dirty&1&&t(10,i=JSON.stringify(o)),n.$$.dirty&1026&&t(6,s=i!=JSON.stringify(r))},[o,r,a,u,f,c,s,l,m,g,i,k,w,C,M,T,D,A,P,L,V]}class hD extends Me{constructor(e){super(),Ce(this,e,pD,dD,we,{})}}function mD(n){let e,t,i,s,l,o,r,a;return{c(){e=v("input"),i=O(),s=v("label"),l=z("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[22]),p(s,"for",o=n[22])},m(u,f){$(u,e,f),e.checked=n[0].enabled,$(u,i,f),$(u,s,f),_(s,l),r||(a=U(e,"change",n[12]),r=!0)},p(u,f){f&4194304&&t!==(t=u[22])&&p(e,"id",t),f&1&&(e.checked=u[0].enabled),f&4194304&&o!==(o=u[22])&&p(s,"for",o)},d(u){u&&S(e),u&&S(i),u&&S(s),r=!1,a()}}}function sh(n){let e,t,i,s,l,o,r,a,u,f,c;l=new _e({props:{class:"form-field required",name:n[1]+".clientId",$$slots:{default:[gD,({uniqueId:h})=>({22:h}),({uniqueId:h})=>h?4194304:0]},$$scope:{ctx:n}}}),a=new _e({props:{class:"form-field required",name:n[1]+".clientSecret",$$slots:{default:[_D,({uniqueId:h})=>({22:h}),({uniqueId:h})=>h?4194304:0]},$$scope:{ctx:n}}});let d=n[4]&&lh(n);return{c(){e=v("div"),t=v("div"),i=O(),s=v("div"),j(l.$$.fragment),o=O(),r=v("div"),j(a.$$.fragment),u=O(),d&&d.c(),p(t,"class","col-12 spacing"),p(s,"class","col-lg-6"),p(r,"class","col-lg-6"),p(e,"class","grid")},m(h,m){$(h,e,m),_(e,t),_(e,i),_(e,s),R(l,s,null),_(e,o),_(e,r),R(a,r,null),_(e,u),d&&d.m(e,null),c=!0},p(h,m){const b={};m&2&&(b.name=h[1]+".clientId"),m&12582913&&(b.$$scope={dirty:m,ctx:h}),l.$set(b);const g={};m&2&&(g.name=h[1]+".clientSecret"),m&12582913&&(g.$$scope={dirty:m,ctx:h}),a.$set(g),h[4]?d?(d.p(h,m),m&16&&E(d,1)):(d=lh(h),d.c(),E(d,1),d.m(e,null)):d&&(be(),I(d,1,1,()=>{d=null}),ve())},i(h){c||(E(l.$$.fragment,h),E(a.$$.fragment,h),E(d),h&&Qe(()=>{f||(f=je(e,St,{duration:200},!0)),f.run(1)}),c=!0)},o(h){I(l.$$.fragment,h),I(a.$$.fragment,h),I(d),h&&(f||(f=je(e,St,{duration:200},!1)),f.run(0)),c=!1},d(h){h&&S(e),H(l),H(a),d&&d.d(),h&&f&&f.end()}}}function gD(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Client ID"),s=O(),l=v("input"),p(e,"for",i=n[22]),p(l,"type","text"),p(l,"id",o=n[22]),l.required=!0},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].clientId),r||(a=U(l,"input",n[13]),r=!0)},p(u,f){f&4194304&&i!==(i=u[22])&&p(e,"for",i),f&4194304&&o!==(o=u[22])&&p(l,"id",o),f&1&&l.value!==u[0].clientId&&he(l,u[0].clientId)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function _D(n){let e,t,i,s,l,o,r;function a(f){n[14](f)}let u={id:n[22],required:!0};return n[0].clientSecret!==void 0&&(u.value=n[0].clientSecret),l=new Ga({props:u}),le.push(()=>ke(l,"value",a)),{c(){e=v("label"),t=z("Client Secret"),s=O(),j(l.$$.fragment),p(e,"for",i=n[22])},m(f,c){$(f,e,c),_(e,t),$(f,s,c),R(l,f,c),r=!0},p(f,c){(!r||c&4194304&&i!==(i=f[22]))&&p(e,"for",i);const d={};c&4194304&&(d.id=f[22]),!o&&c&1&&(o=!0,d.value=f[0].clientSecret,$e(()=>o=!1)),l.$set(d)},i(f){r||(E(l.$$.fragment,f),r=!0)},o(f){I(l.$$.fragment,f),r=!1},d(f){f&&S(e),f&&S(s),H(l,f)}}}function lh(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;return o=new _e({props:{class:"form-field",name:n[1]+".authUrl",$$slots:{default:[bD,({uniqueId:m})=>({22:m}),({uniqueId:m})=>m?4194304:0]},$$scope:{ctx:n}}}),u=new _e({props:{class:"form-field",name:n[1]+".tokenUrl",$$slots:{default:[vD,({uniqueId:m})=>({22:m}),({uniqueId:m})=>m?4194304:0]},$$scope:{ctx:n}}}),d=new _e({props:{class:"form-field",name:n[1]+".userApiUrl",$$slots:{default:[yD,({uniqueId:m})=>({22:m}),({uniqueId:m})=>m?4194304:0]},$$scope:{ctx:n}}}),{c(){e=v("div"),t=v("div"),t.textContent="Optional endpoints (if you self host the OAUTH2 service)",i=O(),s=v("div"),l=v("div"),j(o.$$.fragment),r=O(),a=v("div"),j(u.$$.fragment),f=O(),c=v("div"),j(d.$$.fragment),p(t,"class","section-title"),p(l,"class","col-lg-4"),p(a,"class","col-lg-4"),p(c,"class","col-lg-4"),p(s,"class","grid"),p(e,"class","col-lg-12")},m(m,b){$(m,e,b),_(e,t),_(e,i),_(e,s),_(s,l),R(o,l,null),_(s,r),_(s,a),R(u,a,null),_(s,f),_(s,c),R(d,c,null),h=!0},p(m,b){const g={};b&2&&(g.name=m[1]+".authUrl"),b&12582913&&(g.$$scope={dirty:b,ctx:m}),o.$set(g);const y={};b&2&&(y.name=m[1]+".tokenUrl"),b&12582913&&(y.$$scope={dirty:b,ctx:m}),u.$set(y);const k={};b&2&&(k.name=m[1]+".userApiUrl"),b&12582913&&(k.$$scope={dirty:b,ctx:m}),d.$set(k)},i(m){h||(E(o.$$.fragment,m),E(u.$$.fragment,m),E(d.$$.fragment,m),h=!0)},o(m){I(o.$$.fragment,m),I(u.$$.fragment,m),I(d.$$.fragment,m),h=!1},d(m){m&&S(e),H(o),H(u),H(d)}}}function bD(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Custom Auth URL"),s=O(),l=v("input"),p(e,"for",i=n[22]),p(l,"type","url"),p(l,"id",o=n[22])},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].authUrl),r||(a=U(l,"input",n[15]),r=!0)},p(u,f){f&4194304&&i!==(i=u[22])&&p(e,"for",i),f&4194304&&o!==(o=u[22])&&p(l,"id",o),f&1&&he(l,u[0].authUrl)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function vD(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Custom Token URL"),s=O(),l=v("input"),p(e,"for",i=n[22]),p(l,"type","text"),p(l,"id",o=n[22])},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].tokenUrl),r||(a=U(l,"input",n[16]),r=!0)},p(u,f){f&4194304&&i!==(i=u[22])&&p(e,"for",i),f&4194304&&o!==(o=u[22])&&p(l,"id",o),f&1&&l.value!==u[0].tokenUrl&&he(l,u[0].tokenUrl)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function yD(n){let e,t,i,s,l,o,r,a;return{c(){e=v("label"),t=z("Custom User API URL"),s=O(),l=v("input"),p(e,"for",i=n[22]),p(l,"type","text"),p(l,"id",o=n[22])},m(u,f){$(u,e,f),_(e,t),$(u,s,f),$(u,l,f),he(l,n[0].userApiUrl),r||(a=U(l,"input",n[17]),r=!0)},p(u,f){f&4194304&&i!==(i=u[22])&&p(e,"for",i),f&4194304&&o!==(o=u[22])&&p(l,"id",o),f&1&&l.value!==u[0].userApiUrl&&he(l,u[0].userApiUrl)},d(u){u&&S(e),u&&S(s),u&&S(l),r=!1,a()}}}function kD(n){let e,t,i,s;e=new _e({props:{class:"form-field form-field-toggle m-b-0",name:n[1]+".enabled",$$slots:{default:[mD,({uniqueId:o})=>({22:o}),({uniqueId:o})=>o?4194304:0]},$$scope:{ctx:n}}});let l=n[0].enabled&&sh(n);return{c(){j(e.$$.fragment),t=O(),l&&l.c(),i=Fe()},m(o,r){R(e,o,r),$(o,t,r),l&&l.m(o,r),$(o,i,r),s=!0},p(o,r){const a={};r&2&&(a.name=o[1]+".enabled"),r&12582913&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].enabled?l?(l.p(o,r),r&1&&E(l,1)):(l=sh(o),l.c(),E(l,1),l.m(i.parentNode,i)):l&&(be(),I(l,1,1,()=>{l=null}),ve())},i(o){s||(E(e.$$.fragment,o),E(l),s=!0)},o(o){I(e.$$.fragment,o),I(l),s=!1},d(o){H(e,o),o&&S(t),l&&l.d(o),o&&S(i)}}}function oh(n){let e;return{c(){e=v("i"),p(e,"class",n[3])},m(t,i){$(t,e,i)},p(t,i){i&8&&p(e,"class",t[3])},d(t){t&&S(e)}}}function wD(n){let e;return{c(){e=v("span"),e.textContent="Disabled",p(e,"class","label label-hint")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function SD(n){let e;return{c(){e=v("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function rh(n){let e,t,i,s,l;return{c(){e=v("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){$(o,e,r),i=!0,s||(l=Le(Be.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Qe(()=>{t||(t=je(e,$t,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=je(e,$t,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&S(e),o&&t&&t.end(),s=!1,l()}}}function $D(n){let e,t,i,s,l,o,r,a,u,f,c=n[3]&&oh(n);function d(g,y){return g[0].enabled?SD:wD}let h=d(n),m=h(n),b=n[6]&&rh();return{c(){e=v("div"),c&&c.c(),t=O(),i=v("span"),s=z(n[2]),l=O(),m.c(),o=O(),r=v("div"),a=O(),b&&b.c(),u=Fe(),p(i,"class","txt"),p(e,"class","inline-flex"),p(r,"class","flex-fill")},m(g,y){$(g,e,y),c&&c.m(e,null),_(e,t),_(e,i),_(i,s),$(g,l,y),m.m(g,y),$(g,o,y),$(g,r,y),$(g,a,y),b&&b.m(g,y),$(g,u,y),f=!0},p(g,y){g[3]?c?c.p(g,y):(c=oh(g),c.c(),c.m(e,t)):c&&(c.d(1),c=null),(!f||y&4)&&ue(s,g[2]),h!==(h=d(g))&&(m.d(1),m=h(g),m&&(m.c(),m.m(o.parentNode,o))),g[6]?b?y&64&&E(b,1):(b=rh(),b.c(),E(b,1),b.m(u.parentNode,u)):b&&(be(),I(b,1,1,()=>{b=null}),ve())},i(g){f||(E(b),f=!0)},o(g){I(b),f=!1},d(g){g&&S(e),c&&c.d(),g&&S(l),m.d(g),g&&S(o),g&&S(r),g&&S(a),b&&b.d(g),g&&S(u)}}}function CD(n){let e,t;const i=[n[7]];let s={$$slots:{header:[$D],default:[kD]},$$scope:{ctx:n}};for(let l=0;lt(11,o=L));let{key:r}=e,{title:a}=e,{icon:u=""}=e,{config:f={}}=e,{showSelfHostedFields:c=!1}=e,d;function h(){d==null||d.expand()}function m(){d==null||d.collapse()}function b(){d==null||d.collapseSiblings()}function g(){f.enabled=this.checked,t(0,f)}function y(){f.clientId=this.value,t(0,f)}function k(L){n.$$.not_equal(f.clientSecret,L)&&(f.clientSecret=L,t(0,f))}function w(){f.authUrl=this.value,t(0,f)}function C(){f.tokenUrl=this.value,t(0,f)}function M(){f.userApiUrl=this.value,t(0,f)}function T(L){le[L?"unshift":"push"](()=>{d=L,t(5,d)})}function D(L){Ve.call(this,n,L)}function A(L){Ve.call(this,n,L)}function P(L){Ve.call(this,n,L)}return n.$$set=L=>{e=Ye(Ye({},e),Un(L)),t(7,l=wt(e,s)),"key"in L&&t(1,r=L.key),"title"in L&&t(2,a=L.title),"icon"in L&&t(3,u=L.icon),"config"in L&&t(0,f=L.config),"showSelfHostedFields"in L&&t(4,c=L.showSelfHostedFields)},n.$$.update=()=>{n.$$.dirty&2050&&t(6,i=!B.isEmpty(B.getNestedVal(o,r))),n.$$.dirty&3&&(f.enabled||al(r))},[f,r,a,u,c,d,i,l,h,m,b,o,g,y,k,w,C,M,T,D,A,P]}class TD extends Me{constructor(e){super(),Ce(this,e,MD,CD,we,{key:1,title:2,icon:3,config:0,showSelfHostedFields:4,expand:8,collapse:9,collapseSiblings:10})}get expand(){return this.$$.ctx[8]}get collapse(){return this.$$.ctx[9]}get collapseSiblings(){return this.$$.ctx[10]}}function ah(n,e,t){const i=n.slice();return i[16]=e[t][0],i[17]=e[t][1],i[18]=e,i[19]=t,i}function OD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h=Object.entries(gl),m=[];for(let y=0;yI(m[y],1,1,()=>{m[y]=null});let g=n[4]&&fh(n);return{c(){e=v("div");for(let y=0;yn[10](e,t),o=()=>n[10](null,t);function r(u){n[11](u,n[16])}let a={single:!0,key:n[16],title:n[17].title,icon:n[17].icon||"ri-fingerprint-line",showSelfHostedFields:n[17].selfHosted};return n[0][n[16]]!==void 0&&(a.config=n[0][n[16]]),e=new TD({props:a}),l(),le.push(()=>ke(e,"config",r)),{c(){j(e.$$.fragment)},m(u,f){R(e,u,f),s=!0},p(u,f){n=u,t!==n[16]&&(o(),t=n[16],l());const c={};!i&&f&1&&(i=!0,c.config=n[0][n[16]],$e(()=>i=!1)),e.$set(c)},i(u){s||(E(e.$$.fragment,u),s=!0)},o(u){I(e.$$.fragment,u),s=!1},d(u){o(),H(e,u)}}}function fh(n){let e,t,i,s;return{c(){e=v("button"),t=v("span"),t.textContent="Cancel",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary btn-hint"),e.disabled=n[3]},m(l,o){$(l,e,o),_(e,t),i||(s=U(e,"click",n[12]),i=!0)},p(l,o){o&8&&(e.disabled=l[3])},d(l){l&&S(e),i=!1,s()}}}function ED(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g;const y=[DD,OD],k=[];function w(C,M){return C[2]?0:1}return d=w(n),h=k[d]=y[d](n),{c(){e=v("header"),t=v("nav"),i=v("div"),i.textContent="Settings",s=O(),l=v("div"),o=z(n[5]),r=O(),a=v("div"),u=v("form"),f=v("h6"),f.textContent="Manage the allowed users sign-in/sign-up methods.",c=O(),h.c(),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(f,"class","m-b-base"),p(u,"class","panel"),p(u,"autocomplete","off"),p(a,"class","wrapper")},m(C,M){$(C,e,M),_(e,t),_(t,i),_(t,s),_(t,l),_(l,o),$(C,r,M),$(C,a,M),_(a,u),_(u,f),_(u,c),k[d].m(u,null),m=!0,b||(g=U(u,"submit",ut(n[6])),b=!0)},p(C,M){(!m||M&32)&&ue(o,C[5]);let T=d;d=w(C),d===T?k[d].p(C,M):(be(),I(k[T],1,1,()=>{k[T]=null}),ve(),h=k[d],h?h.p(C,M):(h=k[d]=y[d](C),h.c()),E(h,1),h.m(u,null))},i(C){m||(E(h),m=!0)},o(C){I(h),m=!1},d(C){C&&S(e),C&&S(r),C&&S(a),k[d].d(),b=!1,g()}}}function AD(n){let e,t,i,s;return e=new Ci({}),i=new cn({props:{$$slots:{default:[ED]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment)},m(l,o){R(e,l,o),$(l,t,o),R(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){I(e.$$.fragment,l),I(i.$$.fragment,l),s=!1},d(l){H(e,l),l&&S(t),H(i,l)}}}function ID(n,e,t){let i,s,l;Je(n,mt,w=>t(5,l=w)),Ht(mt,l="Auth providers",l);let o={},r={},a={},u=!1,f=!1;c();async function c(){t(2,u=!0);try{const w=await me.settings.getAll()||{};h(w)}catch(w){me.errorResponseHandler(w)}t(2,u=!1)}async function d(){var w;if(!(f||!s)){t(3,f=!0);try{const C=await me.settings.update(B.filterRedactedProps(a));h(C),Fn({}),(w=o[Object.keys(o)[0]])==null||w.collapseSiblings(),Lt("Successfully updated auth providers.")}catch(C){me.errorResponseHandler(C)}t(3,f=!1)}}function h(w){w=w||{},t(0,a={});for(const C in gl)t(0,a[C]=Object.assign({enabled:!1},w[C]),a);t(8,r=JSON.parse(JSON.stringify(a)))}function m(){t(0,a=JSON.parse(JSON.stringify(r||{})))}function b(w,C){le[w?"unshift":"push"](()=>{o[C]=w,t(1,o)})}function g(w,C){n.$$.not_equal(a[C],w)&&(a[C]=w,t(0,a))}const y=()=>m(),k=()=>d();return n.$$.update=()=>{n.$$.dirty&256&&t(9,i=JSON.stringify(r)),n.$$.dirty&513&&t(4,s=i!=JSON.stringify(a))},[a,o,u,f,s,l,d,m,r,i,b,g,y,k]}class PD extends Me{constructor(e){super(),Ce(this,e,ID,AD,we,{})}}function ch(n,e,t){const i=n.slice();return i[16]=e[t],i[17]=e,i[18]=t,i}function LD(n){let e=[],t=new Map,i,s,l,o,r,a,u,f,c,d,h,m=n[5];const b=y=>y[16].key;for(let y=0;y({19:l}),({uniqueId:l})=>l?524288:0]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=Fe(),j(i.$$.fragment),this.first=t},m(l,o){$(l,t,o),R(i,l,o),s=!0},p(l,o){e=l;const r={};o&1572865&&(r.$$scope={dirty:o,ctx:e}),i.$set(r)},i(l){s||(E(i.$$.fragment,l),s=!0)},o(l){I(i.$$.fragment,l),s=!1},d(l){l&&S(t),H(i,l)}}}function ph(n){let e,t,i,s;return{c(){e=v("button"),t=v("span"),t.textContent="Cancel",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary btn-hint"),e.disabled=n[2]},m(l,o){$(l,e,o),_(e,t),i||(s=U(e,"click",n[12]),i=!0)},p(l,o){o&4&&(e.disabled=l[2])},d(l){l&&S(e),i=!1,s()}}}function RD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g;const y=[ND,LD],k=[];function w(C,M){return C[1]?0:1}return d=w(n),h=k[d]=y[d](n),{c(){e=v("header"),t=v("nav"),i=v("div"),i.textContent="Settings",s=O(),l=v("div"),o=z(n[4]),r=O(),a=v("div"),u=v("form"),f=v("div"),f.innerHTML="

    Adjust common token options.

    ",c=O(),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(C,M){$(C,e,M),_(e,t),_(t,i),_(t,s),_(t,l),_(l,o),$(C,r,M),$(C,a,M),_(a,u),_(u,f),_(u,c),k[d].m(u,null),m=!0,b||(g=U(u,"submit",ut(n[6])),b=!0)},p(C,M){(!m||M&16)&&ue(o,C[4]);let T=d;d=w(C),d===T?k[d].p(C,M):(be(),I(k[T],1,1,()=>{k[T]=null}),ve(),h=k[d],h?h.p(C,M):(h=k[d]=y[d](C),h.c()),E(h,1),h.m(u,null))},i(C){m||(E(h),m=!0)},o(C){I(h),m=!1},d(C){C&&S(e),C&&S(r),C&&S(a),k[d].d(),b=!1,g()}}}function HD(n){let e,t,i,s;return e=new Ci({}),i=new cn({props:{$$slots:{default:[RD]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment)},m(l,o){R(e,l,o),$(l,t,o),R(i,l,o),s=!0},p(l,[o]){const r={};o&1048607&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(E(e.$$.fragment,l),E(i.$$.fragment,l),s=!0)},o(l){I(e.$$.fragment,l),I(i.$$.fragment,l),s=!1},d(l){H(e,l),l&&S(t),H(i,l)}}}function jD(n,e,t){let i,s,l;Je(n,mt,w=>t(4,l=w));const o=[{key:"recordAuthToken",label:"Auth record authentication token"},{key:"recordVerificationToken",label:"Auth record email verification token"},{key:"recordPasswordResetToken",label:"Auth record password reset token"},{key:"recordEmailChangeToken",label:"Auth record email change token"},{key:"adminAuthToken",label:"Admins auth token"},{key:"adminPasswordResetToken",label:"Admins password reset token"}];Ht(mt,l="Token options",l);let r={},a={},u=!1,f=!1;c();async function c(){t(1,u=!0);try{const w=await me.settings.getAll()||{};h(w)}catch(w){me.errorResponseHandler(w)}t(1,u=!1)}async function d(){if(!(f||!s)){t(2,f=!0);try{const w=await me.settings.update(B.filterRedactedProps(a));h(w),Lt("Successfully saved tokens options.")}catch(w){me.errorResponseHandler(w)}t(2,f=!1)}}function h(w){var C;w=w||{},t(0,a={});for(const M of o)t(0,a[M.key]={duration:((C=w[M.key])==null?void 0:C.duration)||0},a);t(8,r=JSON.parse(JSON.stringify(a)))}function m(){t(0,a=JSON.parse(JSON.stringify(r||{})))}function b(w){a[w.key].duration=rt(this.value),t(0,a)}const g=w=>{a[w.key].secret?(delete a[w.key].secret,t(0,a)):t(0,a[w.key].secret=B.randomString(50),a)},y=()=>m(),k=()=>d();return n.$$.update=()=>{n.$$.dirty&256&&t(9,i=JSON.stringify(r)),n.$$.dirty&513&&t(3,s=i!=JSON.stringify(a))},[a,u,f,s,l,o,d,m,r,i,b,g,y,k]}class qD extends Me{constructor(e){super(),Ce(this,e,jD,HD,we,{})}}function VD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m;return o=new k_({props:{content:n[2]}}),{c(){e=v("div"),e.innerHTML=`

    Below you'll find your current collections configuration that you could import in + another PocketBase environment.

    `,t=O(),i=v("div"),s=v("button"),s.innerHTML='Copy',l=O(),j(o.$$.fragment),r=O(),a=v("div"),u=v("div"),f=O(),c=v("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(b,g){$(b,e,g),$(b,t,g),$(b,i,g),_(i,s),_(i,l),R(o,i,null),n[8](i),$(b,r,g),$(b,a,g),_(a,u),_(a,f),_(a,c),d=!0,h||(m=[U(s,"click",n[7]),U(i,"keydown",n[9]),U(c,"click",n[10])],h=!0)},p(b,g){const y={};g&4&&(y.content=b[2]),o.$set(y)},i(b){d||(E(o.$$.fragment,b),d=!0)},o(b){I(o.$$.fragment,b),d=!1},d(b){b&&S(e),b&&S(t),b&&S(i),H(o),n[8](null),b&&S(r),b&&S(a),h=!1,Re(m)}}}function zD(n){let e;return{c(){e=v("div"),p(e,"class","loader")},m(t,i){$(t,e,i)},p:x,i:x,o:x,d(t){t&&S(e)}}}function BD(n){let e,t,i,s,l,o,r,a,u,f,c,d;const h=[zD,VD],m=[];function b(g,y){return g[1]?0:1}return f=b(n),c=m[f]=h[f](n),{c(){e=v("header"),t=v("nav"),i=v("div"),i.textContent="Settings",s=O(),l=v("div"),o=z(n[3]),r=O(),a=v("div"),u=v("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(g,y){$(g,e,y),_(e,t),_(t,i),_(t,s),_(t,l),_(l,o),$(g,r,y),$(g,a,y),_(a,u),m[f].m(u,null),d=!0},p(g,y){(!d||y&8)&&ue(o,g[3]);let k=f;f=b(g),f===k?m[f].p(g,y):(be(),I(m[k],1,1,()=>{m[k]=null}),ve(),c=m[f],c?c.p(g,y):(c=m[f]=h[f](g),c.c()),E(c,1),c.m(u,null))},i(g){d||(E(c),d=!0)},o(g){I(c),d=!1},d(g){g&&S(e),g&&S(r),g&&S(a),m[f].d()}}}function WD(n){let e,t,i,s;return e=new Ci({}),i=new cn({props:{$$slots:{default:[BD]},$$scope:{ctx:n}}}),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment)},m(l,o){R(e,l,o),$(l,t,o),R(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){I(e.$$.fragment,l),I(i.$$.fragment,l),s=!1},d(l){H(e,l),l&&S(t),H(i,l)}}}function UD(n,e,t){let i,s;Je(n,mt,g=>t(3,s=g)),Ht(mt,s="Export collections",s);const l="export_"+B.randomString(5);let o,r=[],a=!1;u();async function u(){t(1,a=!0);try{t(6,r=await me.collections.getFullList(100,{$cancelKey:l}));for(let g of r)delete g.created,delete g.updated}catch(g){me.errorResponseHandler(g)}t(1,a=!1)}function f(){B.downloadJson(r,"pb_schema")}function c(){B.copyToClipboard(i),bg("The configuration was copied to your clipboard!",3e3)}const d=()=>c();function h(g){le[g?"unshift":"push"](()=>{o=g,t(0,o)})}const m=g=>{if(g.ctrlKey&&g.code==="KeyA"){g.preventDefault();const y=window.getSelection(),k=document.createRange();k.selectNodeContents(o),y.removeAllRanges(),y.addRange(k)}},b=()=>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,b]}class YD extends Me{constructor(e){super(),Ce(this,e,UD,WD,we,{})}}function hh(n,e,t){const i=n.slice();return i[14]=e[t],i}function mh(n,e,t){const i=n.slice();return i[17]=e[t][0],i[18]=e[t][1],i}function gh(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[23]=e[t][1],i}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[30]=e[t],i}function KD(n){let e,t,i,s,l=n[1].name+"",o,r=n[9]&&kh(),a=n[0].name!==n[1].name&&wh(n);return{c(){e=v("div"),r&&r.c(),t=O(),a&&a.c(),i=O(),s=v("strong"),o=z(l),p(s,"class","txt"),p(e,"class","inline-flex fleg-gap-5")},m(u,f){$(u,e,f),r&&r.m(e,null),_(e,t),a&&a.m(e,null),_(e,i),_(e,s),_(s,o)},p(u,f){u[9]?r||(r=kh(),r.c(),r.m(e,t)):r&&(r.d(1),r=null),u[0].name!==u[1].name?a?a.p(u,f):(a=wh(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&&S(e),r&&r.d(),a&&a.d()}}}function JD(n){var o;let e,t,i,s=((o=n[0])==null?void 0:o.name)+"",l;return{c(){e=v("span"),e.textContent="Deleted",t=O(),i=v("strong"),l=z(s),p(e,"class","label label-danger")},m(r,a){$(r,e,a),$(r,t,a),$(r,i,a),_(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&&S(e),r&&S(t),r&&S(i)}}}function ZD(n){var o;let e,t,i,s=((o=n[1])==null?void 0:o.name)+"",l;return{c(){e=v("span"),e.textContent="Added",t=O(),i=v("strong"),l=z(s),p(e,"class","label label-success")},m(r,a){$(r,e,a),$(r,t,a),$(r,i,a),_(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&&S(e),r&&S(t),r&&S(i)}}}function kh(n){let e;return{c(){e=v("span"),e.textContent="Changed",p(e,"class","label label-warning")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function wh(n){let e,t=n[0].name+"",i,s,l;return{c(){e=v("strong"),i=z(t),s=O(),l=v("i"),p(e,"class","txt-strikethrough txt-hint"),p(l,"class","ri-arrow-right-line txt-sm")},m(o,r){$(o,e,r),_(e,i),$(o,s,r),$(o,l,r)},p(o,r){r[0]&1&&t!==(t=o[0].name+"")&&ue(i,t)},d(o){o&&S(e),o&&S(s),o&&S(l)}}}function Sh(n){var g,y;let e,t,i,s=n[30]+"",l,o,r,a,u=n[12]((g=n[0])==null?void 0:g[n[30]])+"",f,c,d,h,m=n[12]((y=n[1])==null?void 0:y[n[30]])+"",b;return{c(){var k,w,C,M,T,D;e=v("tr"),t=v("td"),i=v("span"),l=z(s),o=O(),r=v("td"),a=v("pre"),f=z(u),c=O(),d=v("td"),h=v("pre"),b=z(m),p(t,"class","min-width svelte-lmkr38"),p(a,"class","txt"),p(r,"class","svelte-lmkr38"),ee(r,"changed-old-col",!n[10]&&Zt((k=n[0])==null?void 0:k[n[30]],(w=n[1])==null?void 0:w[n[30]])),ee(r,"changed-none-col",n[10]),p(h,"class","txt"),p(d,"class","svelte-lmkr38"),ee(d,"changed-new-col",!n[5]&&Zt((C=n[0])==null?void 0:C[n[30]],(M=n[1])==null?void 0:M[n[30]])),ee(d,"changed-none-col",n[5]),p(e,"class","svelte-lmkr38"),ee(e,"txt-primary",Zt((T=n[0])==null?void 0:T[n[30]],(D=n[1])==null?void 0:D[n[30]]))},m(k,w){$(k,e,w),_(e,t),_(t,i),_(i,l),_(e,o),_(e,r),_(r,a),_(a,f),_(e,c),_(e,d),_(d,h),_(h,b)},p(k,w){var C,M,T,D,A,P,L,V;w[0]&1&&u!==(u=k[12]((C=k[0])==null?void 0:C[k[30]])+"")&&ue(f,u),w[0]&3075&&ee(r,"changed-old-col",!k[10]&&Zt((M=k[0])==null?void 0:M[k[30]],(T=k[1])==null?void 0:T[k[30]])),w[0]&1024&&ee(r,"changed-none-col",k[10]),w[0]&2&&m!==(m=k[12]((D=k[1])==null?void 0:D[k[30]])+"")&&ue(b,m),w[0]&2083&&ee(d,"changed-new-col",!k[5]&&Zt((A=k[0])==null?void 0:A[k[30]],(P=k[1])==null?void 0:P[k[30]])),w[0]&32&&ee(d,"changed-none-col",k[5]),w[0]&2051&&ee(e,"txt-primary",Zt((L=k[0])==null?void 0:L[k[30]],(V=k[1])==null?void 0:V[k[30]]))},d(k){k&&S(e)}}}function $h(n){let e,t=n[6],i=[];for(let s=0;sProps + Old + New`,l=O(),o=v("tbody");for(let C=0;C!["schema","created","updated"].includes(y));function b(){t(4,f=Array.isArray(r==null?void 0:r.schema)?r==null?void 0:r.schema.concat():[]),a||t(4,f=f.concat(u.filter(y=>!f.find(k=>y.id==k.id))))}function g(y){return typeof y>"u"?"":B.isObject(y)?JSON.stringify(y,null,4):y}return n.$$set=y=>{"collectionA"in y&&t(0,o=y.collectionA),"collectionB"in y&&t(1,r=y.collectionB),"deleteMissing"in y&&t(2,a=y.deleteMissing)},n.$$.update=()=>{n.$$.dirty[0]&2&&t(5,i=!(r!=null&&r.id)&&!(r!=null&&r.name)),n.$$.dirty[0]&33&&t(10,s=!i&&!(o!=null&&o.id)),n.$$.dirty[0]&1&&t(3,u=Array.isArray(o==null?void 0:o.schema)?o==null?void 0:o.schema.concat():[]),n.$$.dirty[0]&7&&(typeof(o==null?void 0:o.schema)<"u"||typeof(r==null?void 0:r.schema)<"u"||typeof a<"u")&&b(),n.$$.dirty[0]&24&&t(6,c=u.filter(y=>!f.find(k=>y.id==k.id))),n.$$.dirty[0]&24&&t(7,d=f.filter(y=>u.find(k=>k.id==y.id))),n.$$.dirty[0]&24&&t(8,h=f.filter(y=>!u.find(k=>k.id==y.id))),n.$$.dirty[0]&7&&t(9,l=B.hasCollectionChanges(o,r,a))},[o,r,a,u,f,i,c,d,h,l,s,m,g]}class QD extends Me{constructor(e){super(),Ce(this,e,XD,GD,we,{collectionA:0,collectionB:1,deleteMissing:2},null,[-1,-1])}}function Ih(n,e,t){const i=n.slice();return i[17]=e[t],i}function Ph(n){let e,t;return e=new QD({props:{collectionA:n[17].old,collectionB:n[17].new,deleteMissing:n[3]}}),{c(){j(e.$$.fragment)},m(i,s){R(e,i,s),t=!0},p(i,s){const l={};s&4&&(l.collectionA=i[17].old),s&4&&(l.collectionB=i[17].new),s&8&&(l.deleteMissing=i[3]),e.$set(l)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){I(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function xD(n){let e,t,i=n[2],s=[];for(let o=0;oI(s[o],1,1,()=>{s[o]=null});return{c(){for(let o=0;o{m()}):m()}async function m(){if(!u){t(4,u=!0);try{await me.collections.import(o,a),Lt("Successfully imported collections configuration."),i("submit")}catch(C){me.errorResponseHandler(C)}t(4,u=!1),c()}}const b=()=>h(),g=()=>!u;function y(C){le[C?"unshift":"push"](()=>{s=C,t(1,s)})}function k(C){Ve.call(this,n,C)}function w(C){Ve.call(this,n,C)}return n.$$.update=()=>{n.$$.dirty&384&&Array.isArray(l)&&Array.isArray(o)&&d()},[c,s,r,a,u,h,f,l,o,b,g,y,k,w]}class sE extends Me{constructor(e){super(),Ce(this,e,iE,nE,we,{show:6,hide:0})}get show(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[0]}}function Lh(n,e,t){const i=n.slice();return i[32]=e[t],i}function Nh(n,e,t){const i=n.slice();return i[35]=e[t],i}function Fh(n,e,t){const i=n.slice();return i[32]=e[t],i}function lE(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k,w,C,M,T,D;a=new _e({props:{class:"form-field "+(n[6]?"":"field-error"),name:"collections",$$slots:{default:[rE,({uniqueId:W})=>({40:W}),({uniqueId:W})=>[0,W?512:0]]},$$scope:{ctx:n}}});let A=!1,P=n[6]&&n[1].length&&!n[7]&&Hh(),L=n[6]&&n[1].length&&n[7]&&jh(n),V=n[13].length&&Gh(n),F=!!n[0]&&Xh(n);return{c(){e=v("input"),t=O(),i=v("div"),s=v("p"),l=z(`Paste below the collections configuration you want to import or + `),o=v("button"),o.innerHTML='Load from JSON file',r=O(),j(a.$$.fragment),u=O(),f=O(),P&&P.c(),c=O(),L&&L.c(),d=O(),V&&V.c(),h=O(),m=v("div"),F&&F.c(),b=O(),g=v("div"),y=O(),k=v("button"),w=v("span"),w.textContent="Review",p(e,"type","file"),p(e,"class","hidden"),p(e,"accept",".json"),p(o,"class","btn btn-outline btn-sm m-l-5"),ee(o,"btn-loading",n[12]),p(i,"class","content txt-xl m-b-base"),p(g,"class","flex-fill"),p(w,"class","txt"),p(k,"type","button"),p(k,"class","btn btn-expanded btn-warning m-l-auto"),k.disabled=C=!n[14],p(m,"class","flex m-t-base")},m(W,G){$(W,e,G),n[19](e),$(W,t,G),$(W,i,G),_(i,s),_(s,l),_(s,o),$(W,r,G),R(a,W,G),$(W,u,G),$(W,f,G),P&&P.m(W,G),$(W,c,G),L&&L.m(W,G),$(W,d,G),V&&V.m(W,G),$(W,h,G),$(W,m,G),F&&F.m(m,null),_(m,b),_(m,g),_(m,y),_(m,k),_(k,w),M=!0,T||(D=[U(e,"change",n[20]),U(o,"click",n[21]),U(k,"click",n[26])],T=!0)},p(W,G){(!M||G[0]&4096)&&ee(o,"btn-loading",W[12]);const K={};G[0]&64&&(K.class="form-field "+(W[6]?"":"field-error")),G[0]&65|G[1]&1536&&(K.$$scope={dirty:G,ctx:W}),a.$set(K),W[6]&&W[1].length&&!W[7]?P||(P=Hh(),P.c(),P.m(c.parentNode,c)):P&&(P.d(1),P=null),W[6]&&W[1].length&&W[7]?L?L.p(W,G):(L=jh(W),L.c(),L.m(d.parentNode,d)):L&&(L.d(1),L=null),W[13].length?V?V.p(W,G):(V=Gh(W),V.c(),V.m(h.parentNode,h)):V&&(V.d(1),V=null),W[0]?F?F.p(W,G):(F=Xh(W),F.c(),F.m(m,b)):F&&(F.d(1),F=null),(!M||G[0]&16384&&C!==(C=!W[14]))&&(k.disabled=C)},i(W){M||(E(a.$$.fragment,W),E(A),M=!0)},o(W){I(a.$$.fragment,W),I(A),M=!1},d(W){W&&S(e),n[19](null),W&&S(t),W&&S(i),W&&S(r),H(a,W),W&&S(u),W&&S(f),P&&P.d(W),W&&S(c),L&&L.d(W),W&&S(d),V&&V.d(W),W&&S(h),W&&S(m),F&&F.d(),T=!1,Re(D)}}}function oE(n){let e;return{c(){e=v("div"),p(e,"class","loader")},m(t,i){$(t,e,i)},p:x,i:x,o:x,d(t){t&&S(e)}}}function Rh(n){let e;return{c(){e=v("div"),e.textContent="Invalid collections configuration.",p(e,"class","help-block help-block-error")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function rE(n){let e,t,i,s,l,o,r,a,u,f,c=!!n[0]&&!n[6]&&Rh();return{c(){e=v("label"),t=z("Collections"),s=O(),l=v("textarea"),r=O(),c&&c.c(),a=Fe(),p(e,"for",i=n[40]),p(e,"class","p-b-10"),p(l,"id",o=n[40]),p(l,"class","code"),p(l,"spellcheck","false"),p(l,"rows","15"),l.required=!0},m(d,h){$(d,e,h),_(e,t),$(d,s,h),$(d,l,h),he(l,n[0]),$(d,r,h),c&&c.m(d,h),$(d,a,h),u||(f=U(l,"input",n[22]),u=!0)},p(d,h){h[1]&512&&i!==(i=d[40])&&p(e,"for",i),h[1]&512&&o!==(o=d[40])&&p(l,"id",o),h[0]&1&&he(l,d[0]),!!d[0]&&!d[6]?c||(c=Rh(),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(d){d&&S(e),d&&S(s),d&&S(l),d&&S(r),c&&c.d(d),d&&S(a),u=!1,f()}}}function Hh(n){let e;return{c(){e=v("div"),e.innerHTML=`
    +
    Your collections configuration is already up-to-date!
    `,p(e,"class","alert alert-info")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function jh(n){let e,t,i,s,l,o=n[9].length&&qh(n),r=n[4].length&&Bh(n),a=n[8].length&&Kh(n);return{c(){e=v("h5"),e.textContent="Detected changes",t=O(),i=v("div"),o&&o.c(),s=O(),r&&r.c(),l=O(),a&&a.c(),p(e,"class","section-title"),p(i,"class","list")},m(u,f){$(u,e,f),$(u,t,f),$(u,i,f),o&&o.m(i,null),_(i,s),r&&r.m(i,null),_(i,l),a&&a.m(i,null)},p(u,f){u[9].length?o?o.p(u,f):(o=qh(u),o.c(),o.m(i,s)):o&&(o.d(1),o=null),u[4].length?r?r.p(u,f):(r=Bh(u),r.c(),r.m(i,l)):r&&(r.d(1),r=null),u[8].length?a?a.p(u,f):(a=Kh(u),a.c(),a.m(i,null)):a&&(a.d(1),a=null)},d(u){u&&S(e),u&&S(t),u&&S(i),o&&o.d(),r&&r.d(),a&&a.d()}}}function qh(n){let e=[],t=new Map,i,s=n[9];const l=o=>o[32].id;for(let o=0;oo[35].old.id+o[35].new.id;for(let o=0;oo[32].id;for(let o=0;o',i=O(),s=v("div"),s.innerHTML=`Some of the imported collections shares the same name and/or fields but are + imported with different IDs. You can replace them in the import if you want + to.`,l=O(),o=v("button"),o.innerHTML='Replace with original ids',p(t,"class","icon"),p(s,"class","content"),p(o,"type","button"),p(o,"class","btn btn-warning btn-sm btn-outline"),p(e,"class","alert alert-warning m-t-base")},m(u,f){$(u,e,f),_(e,t),_(e,i),_(e,s),_(e,l),_(e,o),r||(a=U(o,"click",n[24]),r=!0)},p:x,d(u){u&&S(e),r=!1,a()}}}function Xh(n){let e,t,i;return{c(){e=v("button"),e.innerHTML='Clear',p(e,"type","button"),p(e,"class","btn btn-secondary link-hint")},m(s,l){$(s,e,l),t||(i=U(e,"click",n[25]),t=!0)},p:x,d(s){s&&S(e),t=!1,i()}}}function aE(n){let e,t,i,s,l,o,r,a,u,f,c,d;const h=[oE,lE],m=[];function b(g,y){return g[5]?0:1}return f=b(n),c=m[f]=h[f](n),{c(){e=v("header"),t=v("nav"),i=v("div"),i.textContent="Settings",s=O(),l=v("div"),o=z(n[15]),r=O(),a=v("div"),u=v("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(g,y){$(g,e,y),_(e,t),_(t,i),_(t,s),_(t,l),_(l,o),$(g,r,y),$(g,a,y),_(a,u),m[f].m(u,null),d=!0},p(g,y){(!d||y[0]&32768)&&ue(o,g[15]);let k=f;f=b(g),f===k?m[f].p(g,y):(be(),I(m[k],1,1,()=>{m[k]=null}),ve(),c=m[f],c?c.p(g,y):(c=m[f]=h[f](g),c.c()),E(c,1),c.m(u,null))},i(g){d||(E(c),d=!0)},o(g){I(c),d=!1},d(g){g&&S(e),g&&S(r),g&&S(a),m[f].d()}}}function uE(n){let e,t,i,s,l,o;e=new Ci({}),i=new cn({props:{$$slots:{default:[aE]},$$scope:{ctx:n}}});let r={};return l=new sE({props:r}),n[27](l),l.$on("submit",n[28]),{c(){j(e.$$.fragment),t=O(),j(i.$$.fragment),s=O(),j(l.$$.fragment)},m(a,u){R(e,a,u),$(a,t,u),R(i,a,u),$(a,s,u),R(l,a,u),o=!0},p(a,u){const f={};u[0]&65535|u[1]&1024&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};l.$set(c)},i(a){o||(E(e.$$.fragment,a),E(i.$$.fragment,a),E(l.$$.fragment,a),o=!0)},o(a){I(e.$$.fragment,a),I(i.$$.fragment,a),I(l.$$.fragment,a),o=!1},d(a){H(e,a),a&&S(t),H(i,a),a&&S(s),n[27](null),H(l,a)}}}function fE(n,e,t){let i,s,l,o,r,a,u;Je(n,mt,J=>t(15,u=J)),Ht(mt,u="Import collections",u);let f,c,d="",h=!1,m=[],b=[],g=!0,y=[],k=!1;w();async function w(){t(5,k=!0);try{t(2,b=await me.collections.getFullList(200));for(let J of b)delete J.created,delete J.updated}catch(J){me.errorResponseHandler(J)}t(5,k=!1)}function C(){if(t(4,y=[]),!!i)for(let J of m){const fe=B.findByKey(b,"id",J.id);!(fe!=null&&fe.id)||!B.hasCollectionChanges(fe,J,g)||y.push({new:J,old:fe})}}function M(){t(1,m=[]);try{t(1,m=JSON.parse(d))}catch{}Array.isArray(m)?t(1,m=B.filterDuplicatesByKey(m)):t(1,m=[]);for(let J of m)delete J.created,delete J.updated,J.schema=B.filterDuplicatesByKey(J.schema)}function T(){var J,fe;for(let Y of m){const re=B.findByKey(b,"name",Y.name)||B.findByKey(b,"id",Y.id);if(!re)continue;const Oe=Y.id,ge=re.id;Y.id=ge;const ae=Array.isArray(re.schema)?re.schema:[],pe=Array.isArray(Y.schema)?Y.schema:[];for(const de of pe){const Se=B.findByKey(ae,"name",de.name);Se&&Se.id&&(de.id=Se.id)}for(let de of m)if(!!Array.isArray(de.schema))for(let Se of de.schema)((J=Se.options)==null?void 0:J.collectionId)&&((fe=Se.options)==null?void 0:fe.collectionId)===Oe&&(Se.options.collectionId=ge)}t(0,d=JSON.stringify(m,null,4))}function D(J){t(12,h=!0);const fe=new FileReader;fe.onload=async Y=>{t(12,h=!1),t(10,f.value="",f),t(0,d=Y.target.result),await $n(),m.length||(rl("Invalid collections configuration."),A())},fe.onerror=Y=>{console.warn(Y),rl("Failed to load the imported JSON."),t(12,h=!1),t(10,f.value="",f)},fe.readAsText(J)}function A(){t(0,d=""),t(10,f.value="",f),Fn({})}function P(J){le[J?"unshift":"push"](()=>{f=J,t(10,f)})}const L=()=>{f.files.length&&D(f.files[0])},V=()=>{f.click()};function F(){d=this.value,t(0,d)}function W(){g=this.checked,t(3,g)}const G=()=>T(),K=()=>A(),X=()=>c==null?void 0:c.show(b,m,g);function Z(J){le[J?"unshift":"push"](()=>{c=J,t(11,c)})}const ie=()=>A();return n.$$.update=()=>{n.$$.dirty[0]&1&&typeof d<"u"&&M(),n.$$.dirty[0]&3&&t(6,i=!!d&&m.length&&m.length===m.filter(J=>!!J.id&&!!J.name).length),n.$$.dirty[0]&78&&t(9,s=b.filter(J=>i&&g&&!B.findByKey(m,"id",J.id))),n.$$.dirty[0]&70&&t(8,l=m.filter(J=>i&&!B.findByKey(b,"id",J.id))),n.$$.dirty[0]&10&&(typeof m<"u"||typeof g<"u")&&C(),n.$$.dirty[0]&785&&t(7,o=!!d&&(s.length||l.length||y.length)),n.$$.dirty[0]&224&&t(14,r=!k&&i&&o),n.$$.dirty[0]&6&&t(13,a=m.filter(J=>{let fe=B.findByKey(b,"name",J.name)||B.findByKey(b,"id",J.id);if(!fe)return!1;if(fe.id!=J.id)return!0;const Y=Array.isArray(fe.schema)?fe.schema:[],re=Array.isArray(J.schema)?J.schema:[];for(const Oe of re){if(B.findByKey(Y,"id",Oe.id))continue;const ae=B.findByKey(Y,"name",Oe.name);if(ae&&Oe.id!=ae.id)return!0}return!1}))},[d,m,b,g,y,k,i,o,l,s,f,c,h,a,r,u,T,D,A,P,L,V,F,W,G,K,X,Z,ie]}class cE extends Me{constructor(e){super(),Ce(this,e,fE,uE,we,{},null,[-1,-1])}}const Ct=[async n=>{const e=new URLSearchParams(window.location.search);return n.location!=="/"&&e.has("installer")?ki("/"):!0}],dE={"/login":vt({component:lO,conditions:Ct.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/request-password-reset":vt({asyncComponent:()=>st(()=>import("./PageAdminRequestPasswordReset.7514fbab.js"),[],import.meta.url),conditions:Ct.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/confirm-password-reset/:token":vt({asyncComponent:()=>st(()=>import("./PageAdminConfirmPasswordReset.19234b2d.js"),[],import.meta.url),conditions:Ct.concat([n=>!me.authStore.isValid]),userData:{showAppSidebar:!1}}),"/collections":vt({component:DT,conditions:Ct.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/logs":vt({component:vS,conditions:Ct.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings":vt({component:mO,conditions:Ct.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/admins":vt({component:xT,conditions:Ct.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/mail":vt({component:QO,conditions:Ct.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/storage":vt({component:hD,conditions:Ct.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/auth-providers":vt({component:PD,conditions:Ct.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/tokens":vt({component:qD,conditions:Ct.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/export-collections":vt({component:YD,conditions:Ct.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/import-collections":vt({component:cE,conditions:Ct.concat([n=>me.authStore.isValid]),userData:{showAppSidebar:!0}}),"/users/confirm-password-reset/:token":vt({asyncComponent:()=>st(()=>import("./PageRecordConfirmPasswordReset.d1097e1b.js"),[],import.meta.url),conditions:Ct,userData:{showAppSidebar:!1}}),"/auth/confirm-password-reset/:token":vt({asyncComponent:()=>st(()=>import("./PageRecordConfirmPasswordReset.d1097e1b.js"),[],import.meta.url),conditions:Ct,userData:{showAppSidebar:!1}}),"/users/confirm-verification/:token":vt({asyncComponent:()=>st(()=>import("./PageRecordConfirmVerification.cdc4fa83.js"),[],import.meta.url),conditions:Ct,userData:{showAppSidebar:!1}}),"/auth/confirm-verification/:token":vt({asyncComponent:()=>st(()=>import("./PageRecordConfirmVerification.cdc4fa83.js"),[],import.meta.url),conditions:Ct,userData:{showAppSidebar:!1}}),"/users/confirm-email-change/:token":vt({asyncComponent:()=>st(()=>import("./PageRecordConfirmEmailChange.75e01a7f.js"),[],import.meta.url),conditions:Ct,userData:{showAppSidebar:!1}}),"/auth/confirm-email-change/:token":vt({asyncComponent:()=>st(()=>import("./PageRecordConfirmEmailChange.75e01a7f.js"),[],import.meta.url),conditions:Ct,userData:{showAppSidebar:!1}}),"*":vt({component:V1,userData:{showAppSidebar:!1}})};function pE(n,{from:e,to:t},i={}){const s=getComputedStyle(n),l=s.transform==="none"?"":s.transform,[o,r]=s.transformOrigin.split(" ").map(parseFloat),a=e.left+e.width*o/t.width-(t.left+o),u=e.top+e.height*r/t.height-(t.top+r),{delay:f=0,duration:c=h=>Math.sqrt(h)*120,easing:d=Vo}=i;return{delay:f,duration:Wt(c)?c(Math.sqrt(a*a+u*u)):c,easing:d,css:(h,m)=>{const b=m*a,g=m*u,y=h+m*e.width/t.width,k=h+m*e.height/t.height;return`transform: ${l} translate(${b}px, ${g}px) scale(${y}, ${k});`}}}function Qh(n,e,t){const i=n.slice();return i[2]=e[t],i}function hE(n){let e;return{c(){e=v("i"),p(e,"class","ri-alert-line")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function mE(n){let e;return{c(){e=v("i"),p(e,"class","ri-error-warning-line")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function gE(n){let e;return{c(){e=v("i"),p(e,"class","ri-checkbox-circle-line")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function _E(n){let e;return{c(){e=v("i"),p(e,"class","ri-information-line")},m(t,i){$(t,e,i)},d(t){t&&S(e)}}}function xh(n,e){let t,i,s,l,o=e[2].message+"",r,a,u,f,c,d,h=x,m,b,g;function y(M,T){return M[2].type==="info"?_E:M[2].type==="success"?gE:M[2].type==="warning"?mE:hE}let k=y(e),w=k(e);function C(){return e[1](e[2])}return{key:n,first:null,c(){t=v("div"),i=v("div"),w.c(),s=O(),l=v("div"),r=z(o),a=O(),u=v("button"),u.innerHTML='',f=O(),p(i,"class","icon"),p(l,"class","content"),p(u,"type","button"),p(u,"class","close"),p(t,"class","alert txt-break"),ee(t,"alert-info",e[2].type=="info"),ee(t,"alert-success",e[2].type=="success"),ee(t,"alert-danger",e[2].type=="error"),ee(t,"alert-warning",e[2].type=="warning"),this.first=t},m(M,T){$(M,t,T),_(t,i),w.m(i,null),_(t,s),_(t,l),_(l,r),_(t,a),_(t,u),_(t,f),m=!0,b||(g=U(u,"click",ut(C)),b=!0)},p(M,T){e=M,k!==(k=y(e))&&(w.d(1),w=k(e),w&&(w.c(),w.m(i,null))),(!m||T&1)&&o!==(o=e[2].message+"")&&ue(r,o),(!m||T&1)&&ee(t,"alert-info",e[2].type=="info"),(!m||T&1)&&ee(t,"alert-success",e[2].type=="success"),(!m||T&1)&&ee(t,"alert-danger",e[2].type=="error"),(!m||T&1)&&ee(t,"alert-warning",e[2].type=="warning")},r(){d=t.getBoundingClientRect()},f(){Z_(t),h(),am(t,d)},a(){h(),h=J_(t,d,pE,{duration:150})},i(M){m||(Qe(()=>{c||(c=je(t,bo,{duration:150},!0)),c.run(1)}),m=!0)},o(M){c||(c=je(t,bo,{duration:150},!1)),c.run(0),m=!1},d(M){M&&S(t),w.d(),M&&c&&c.end(),b=!1,g()}}}function bE(n){let e,t=[],i=new Map,s,l=n[0];const o=r=>r[2].message;for(let r=0;rt(0,i=l)),[i,l=>vg(l)]}class yE extends Me{constructor(e){super(),Ce(this,e,vE,bE,we,{})}}function kE(n){var s;let e,t=((s=n[1])==null?void 0:s.text)+"",i;return{c(){e=v("h4"),i=z(t),p(e,"class","block center txt-break"),p(e,"slot","header")},m(l,o){$(l,e,o),_(e,i)},p(l,o){var r;o&2&&t!==(t=((r=l[1])==null?void 0:r.text)+"")&&ue(i,t)},d(l){l&&S(e)}}}function wE(n){let e,t,i,s,l,o,r;return{c(){e=v("button"),t=v("span"),t.textContent="No",i=O(),s=v("button"),l=v("span"),l.textContent="Yes",p(t,"class","txt"),e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-secondary btn-expanded-sm"),e.disabled=n[2],p(l,"class","txt"),p(s,"type","button"),p(s,"class","btn btn-danger btn-expanded"),s.disabled=n[2],ee(s,"btn-loading",n[2])},m(a,u){$(a,e,u),_(e,t),$(a,i,u),$(a,s,u),_(s,l),e.focus(),o||(r=[U(e,"click",n[4]),U(s,"click",n[5])],o=!0)},p(a,u){u&4&&(e.disabled=a[2]),u&4&&(s.disabled=a[2]),u&4&&ee(s,"btn-loading",a[2])},d(a){a&&S(e),a&&S(i),a&&S(s),o=!1,Re(r)}}}function SE(n){let e,t,i={class:"confirm-popup hide-content overlay-panel-sm",overlayClose:!n[2],escClose:!n[2],btnClose:!1,popup:!0,$$slots:{footer:[wE],header:[kE]},$$scope:{ctx:n}};return e=new Jn({props:i}),n[6](e),e.$on("hide",n[7]),{c(){j(e.$$.fragment)},m(s,l){R(e,s,l),t=!0},p(s,[l]){const o={};l&4&&(o.overlayClose=!s[2]),l&4&&(o.escClose=!s[2]),l&271&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(E(e.$$.fragment,s),t=!0)},o(s){I(e.$$.fragment,s),t=!1},d(s){n[6](null),H(e,s)}}}function $E(n,e,t){let i;Je(n,Ya,c=>t(1,i=c));let s,l=!1,o=!1;const r=()=>{t(3,o=!1),s==null||s.hide()},a=async()=>{i!=null&&i.yesCallback&&(t(2,l=!0),await Promise.resolve(i.yesCallback()),t(2,l=!1)),t(3,o=!0),s==null||s.hide()};function u(c){le[c?"unshift":"push"](()=>{s=c,t(0,s)})}const f=async()=>{!o&&(i==null?void 0:i.noCallback)&&i.noCallback(),await $n(),t(3,o=!1),S_()};return n.$$.update=()=>{n.$$.dirty&3&&i!=null&&i.text&&(t(3,o=!1),s==null||s.show())},[s,i,l,o,r,a,u,f]}class CE extends Me{constructor(e){super(),Ce(this,e,$E,SE,we,{})}}function em(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,m,b,g,y,k;return b=new Zn({props:{class:"dropdown dropdown-nowrap dropdown-upside dropdown-left",$$slots:{default:[ME]},$$scope:{ctx:n}}}),{c(){var w;e=v("aside"),t=v("a"),t.innerHTML='PocketBase logo',i=O(),s=v("nav"),l=v("a"),l.innerHTML='',o=O(),r=v("a"),r.innerHTML='',a=O(),u=v("a"),u.innerHTML='',f=O(),c=v("figure"),d=v("img"),m=O(),j(b.$$.fragment),p(t,"href","/"),p(t,"class","logo logo-sm"),p(l,"href","/collections"),p(l,"class","menu-item"),p(l,"aria-label","Collections"),p(r,"href","/logs"),p(r,"class","menu-item"),p(r,"aria-label","Logs"),p(u,"href","/settings"),p(u,"class","menu-item"),p(u,"aria-label","Settings"),p(s,"class","main-menu"),Ln(d.src,h="./images/avatars/avatar"+(((w=n[0])==null?void 0:w.avatar)||0)+".svg")||p(d,"src",h),p(d,"alt","Avatar"),p(c,"class","thumb thumb-circle link-hint closable"),p(e,"class","app-sidebar")},m(w,C){$(w,e,C),_(e,t),_(e,i),_(e,s),_(s,l),_(s,o),_(s,r),_(s,a),_(s,u),_(e,f),_(e,c),_(c,d),_(c,m),R(b,c,null),g=!0,y||(k=[Le(Vt.call(null,t)),Le(Vt.call(null,l)),Le(On.call(null,l,{path:"/collections/?.*",className:"current-route"})),Le(Be.call(null,l,{text:"Collections",position:"right"})),Le(Vt.call(null,r)),Le(On.call(null,r,{path:"/logs/?.*",className:"current-route"})),Le(Be.call(null,r,{text:"Logs",position:"right"})),Le(Vt.call(null,u)),Le(On.call(null,u,{path:"/settings/?.*",className:"current-route"})),Le(Be.call(null,u,{text:"Settings",position:"right"}))],y=!0)},p(w,C){var T;(!g||C&1&&!Ln(d.src,h="./images/avatars/avatar"+(((T=w[0])==null?void 0:T.avatar)||0)+".svg"))&&p(d,"src",h);const M={};C&1024&&(M.$$scope={dirty:C,ctx:w}),b.$set(M)},i(w){g||(E(b.$$.fragment,w),g=!0)},o(w){I(b.$$.fragment,w),g=!1},d(w){w&&S(e),H(b),y=!1,Re(k)}}}function ME(n){let e,t,i,s,l,o,r;return{c(){e=v("a"),e.innerHTML=` + Manage admins`,t=O(),i=v("hr"),s=O(),l=v("button"),l.innerHTML=` + Logout`,p(e,"href","/settings/admins"),p(e,"class","dropdown-item closable"),p(l,"type","button"),p(l,"class","dropdown-item closable")},m(a,u){$(a,e,u),$(a,t,u),$(a,i,u),$(a,s,u),$(a,l,u),o||(r=[Le(Vt.call(null,e)),U(l,"click",n[6])],o=!0)},p:x,d(a){a&&S(e),a&&S(t),a&&S(i),a&&S(s),a&&S(l),o=!1,Re(r)}}}function TE(n){var h;let e,t,i,s,l,o,r,a,u,f,c;document.title=e=B.joinNonEmpty([n[3],n[2],"PocketBase"]," - ");let d=((h=n[0])==null?void 0:h.id)&&n[1]&&em(n);return o=new a0({props:{routes:dE}}),o.$on("routeLoading",n[4]),o.$on("conditionsFailed",n[5]),a=new yE({}),f=new CE({}),{c(){t=O(),i=v("div"),d&&d.c(),s=O(),l=v("div"),j(o.$$.fragment),r=O(),j(a.$$.fragment),u=O(),j(f.$$.fragment),p(l,"class","app-body"),p(i,"class","app-layout")},m(m,b){$(m,t,b),$(m,i,b),d&&d.m(i,null),_(i,s),_(i,l),R(o,l,null),_(l,r),R(a,l,null),$(m,u,b),R(f,m,b),c=!0},p(m,[b]){var g;(!c||b&12)&&e!==(e=B.joinNonEmpty([m[3],m[2],"PocketBase"]," - "))&&(document.title=e),((g=m[0])==null?void 0:g.id)&&m[1]?d?(d.p(m,b),b&3&&E(d,1)):(d=em(m),d.c(),E(d,1),d.m(i,s)):d&&(be(),I(d,1,1,()=>{d=null}),ve())},i(m){c||(E(d),E(o.$$.fragment,m),E(a.$$.fragment,m),E(f.$$.fragment,m),c=!0)},o(m){I(d),I(o.$$.fragment,m),I(a.$$.fragment,m),I(f.$$.fragment,m),c=!1},d(m){m&&S(t),m&&S(i),d&&d.d(),H(o),H(a),m&&S(u),H(f,m)}}}function OE(n,e,t){let i,s,l,o;Je(n,ks,h=>t(8,i=h)),Je(n,_o,h=>t(2,s=h)),Je(n,ya,h=>t(0,l=h)),Je(n,mt,h=>t(3,o=h));let r,a=!1;function u(h){var m,b,g,y;((m=h==null?void 0:h.detail)==null?void 0:m.location)!==r&&(t(1,a=!!((g=(b=h==null?void 0:h.detail)==null?void 0:b.userData)!=null&&g.showAppSidebar)),r=(y=h==null?void 0:h.detail)==null?void 0:y.location,Ht(mt,o="",o),Fn({}),S_())}function f(){ki("/")}async function c(){var h,m;if(!!(l!=null&&l.id))try{const b=await me.settings.getAll({$cancelKey:"initialAppSettings"});Ht(_o,s=((h=b==null?void 0:b.meta)==null?void 0:h.appName)||"",s),Ht(ks,i=!!((m=b==null?void 0:b.meta)!=null&&m.hideControls),i)}catch(b){console.warn("Failed to load app settings.",b)}}function d(){me.logout()}return n.$$.update=()=>{n.$$.dirty&1&&l!=null&&l.id&&c()},[l,a,s,o,u,f,d]}class DE extends Me{constructor(e){super(),Ce(this,e,OE,TE,we,{})}}new DE({target:document.getElementById("app")});export{Re as A,Lt as B,B as C,ki as D,Fe as E,kg as F,fa as G,ru as H,Je as I,Zi as J,It as K,Pn as L,un as M,le as N,k_ as O,bt as P,Gi as Q,xt as R,Me as S,Qa as T,I as a,O as b,j as c,H as d,v as e,p as f,$ as g,_ as h,Ce as i,Le as j,be as k,Vt as l,R as m,ve as n,S as o,me as p,_e as q,ee as r,we as s,E as t,U as u,ut as v,z as w,ue as x,x as y,he as z}; diff --git a/ui/dist/assets/index.9c8b95cd.js b/ui/dist/assets/index.9c8b95cd.js new file mode 100644 index 000000000..4a89b58f9 --- /dev/null +++ b/ui/dist/assets/index.9c8b95cd.js @@ -0,0 +1,13 @@ +class I{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),ze.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),ze.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new ii(this),r=new ii(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new ii(this,e)}iterRange(e,t=this.length){return new Xo(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Yo(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?I.empty:e.length<=32?new J(e):ze.from(J.split(e,[]))}}class J extends I{constructor(e,t=Ra(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new La(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new J(br(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=zi(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new J(l,o.length+r.length));else{let h=l.length>>1;i.push(new J(l.slice(0,h)),new J(l.slice(h)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof J))return super.replace(e,t,i);let s=zi(this.text,zi(i.text,br(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new J(s,r):ze.from(J.split(s,[]),r)}sliceString(e,t=this.length,i=` +`){let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=h+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new J(i,s)),i=[],s=-1);return s>-1&&t.push(new J(i,s)),t}}class ze extends I{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,h=i+o.lines-1;if((t?h:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=h+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let a=s&((o<=e?1:0)|(h>=t?2:0));o>=e&&h<=t&&!a?i.push(l):l.decompose(e-o,t-o,i,a)}o=h+1}}replace(e,t,i){if(i.lines=r&&t<=l){let h=o.replace(e-r,t-r,i),a=this.lines-o.lines+h.lines;if(h.lines>5-1&&h.lines>a>>5+1){let c=this.children.slice();return c[s]=h,new ze(c,this.length-(t-e)+i.length)}return super.replace(r,l,h)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` +`){let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=h+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ze))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let h=this.children[s],a=e.children[r];if(h!=a)return i+h.scanIdentical(a,t);i+=h.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new J(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],h=0,a=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof ze)for(let m of d.children)f(m);else d.lines>o&&(h>o||!h)?(u(),l.push(d)):d instanceof J&&h&&(p=c[c.length-1])instanceof J&&d.lines+p.lines<=32?(h+=d.lines,a+=d.length+1,c[c.length-1]=new J(p.text.concat(d.text),p.length+1+d.length)):(h+d.lines>s&&u(),h+=d.lines,a+=d.length+1,c.push(d))}function u(){h!=0&&(l.push(c.length==1?c[0]:ze.from(c,a)),a=-1,h=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new ze(l,t)}}I.empty=new J([""],0);function Ra(n){let e=-1;for(let t of n)e+=t.length+1;return e}function zi(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(h>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof J?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof J?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof J){let h=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,h.length>Math.max(0,e))return this.value=e==0?h:t>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=s.children[o+(t<0?-1:0)];e>h.length?(e-=h.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(h),this.offsets.push(t>0?1:(h instanceof J?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Xo{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new ii(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Yo{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(I.prototype[Symbol.iterator]=function(){return this.iter()},ii.prototype[Symbol.iterator]=Xo.prototype[Symbol.iterator]=Yo.prototype[Symbol.iterator]=function(){return this});class La{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let Bt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;nn)return Bt[e-1]<=n;return!1}function wr(n){return n>=127462&&n<=127487}const xr=8205;function fe(n,e,t=!0,i=!0){return(t?Qo:Ia)(n,e,i)}function Qo(n,e,t){if(e==n.length)return e;e&&Zo(n.charCodeAt(e))&&el(n.charCodeAt(e-1))&&e--;let i=ie(n,e);for(e+=Se(i);e=0&&wr(ie(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Ia(n,e,t){for(;e>0;){let i=Qo(n,e-2,t);if(i=56320&&n<57344}function el(n){return n>=55296&&n<56320}function ie(n,e){let t=n.charCodeAt(e);if(!el(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Zo(i)?(t-55296<<10)+(i-56320)+65536:t}function Hs(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Se(n){return n<65536?1:2}const Yn=/\r\n?|\n/;var le=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(le||(le={}));class je{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=le.Simple&&a>=e&&(i==le.TrackDel&&se||i==le.TrackBefore&&se))return null;if(a>e||a==e&&t<0&&!l)return e==s||t<0?r:r+h;r+=h}s=a}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new je(e)}static create(e){return new je(e)}}class Y extends je{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Qn(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return Zn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let h=s>>1;for(;i.length0&&et(i,t,r.text),r.forward(c),l+=c}let a=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function h(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?I.of(d.split(i||Yn)):d:I.empty,m=p.length;if(f==u&&m==0)return;fo&&oe(s,f-o,-1),oe(s,u-f,m),et(r,s,p),o=u}}return a(e),h(!l),l}static empty(e){return new Y(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function et(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],h=n.sections[o++];e(s,a,r,c,f),s=a,r=c}}}function Zn(n,e,t,i=!1){let s=[],r=i?[]:null,o=new oi(n),l=new oi(e);for(let h=-1;;)if(o.ins==-1&&l.ins==-1){let a=Math.min(o.len,l.len);oe(s,a,-1),o.forward(a),l.forward(a)}else if(l.ins>=0&&(o.ins<0||h==o.i||o.off==0&&(l.len=0&&h=0){let a=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);a+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lenh||o.ins>=0&&o.len>h)&&(l||i.length>a),r.forward2(h),o.forward(h)}}}}class oi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?I.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?I.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class pt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new pt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new pt(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;te.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>pt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?4:0))}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?b.range(h,l):b.range(l,h))}}return new b(e,t)}}function il(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let zs=0;class D{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=zs++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}static define(e={}){return new D(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:qs),!!e.static,e.enables)}of(e){return new qi([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qi(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qi(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function qs(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class qi{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=zs++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,h=!1,a=!1,c=[];for(let f of this.dependencies)f=="doc"?h=!0:f=="selection"?a=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(h&&u.docChanged||a&&(u.docChanged||u.selection)||es(f,c)){let d=i(f);if(l?!vr(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d=i(f),p=u.config.address[r];if(p!=null){let m=Ji(u,p);if(this.dependencies.every(g=>g instanceof D?u.facet(g)===f.facet(g):g instanceof me?u.field(g,!1)==f.field(g,!1):!0)||(l?vr(d,m,s):s(d,m)))return f.values[o]=m,0}return f.values[o]=d,1}}}}function vr(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[h.id]),s=t.map(h=>h.type),r=i.filter(h=>!(h&1)),o=n[e.id]>>1;function l(h){let a=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(kr).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,kr.of({field:this,create:e})]}get extension(){return this}}const dt={lowest:4,low:3,default:2,high:1,highest:0};function Ut(n){return e=>new nl(e,n)}const kt={highest:Ut(dt.highest),high:Ut(dt.high),default:Ut(dt.default),low:Ut(dt.low),lowest:Ut(dt.lowest)};class nl{constructor(e,t){this.inner=e,this.prec=t}}class bn{of(e){return new ts(this,e)}reconfigure(e){return bn.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ts{constructor(e,t){this.compartment=e,this.inner=t}}class Gi{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Va(e,t,o))u instanceof me?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),h=[],a=[];for(let u of s)l[u.id]=a.length<<1,a.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=h.length<<1|1,qs(m,d))h.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));h.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=h.length<<1|1,h.push(g.value)):(l[g.id]=a.length<<1,a.push(y=>g.dynamicSlot(y)));l[p.id]=a.length<<1,a.push(g=>Na(g,p,d))}}let f=a.map(u=>u(l));return new Gi(e,o,f,l,h,r)}}function Va(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let h=s.get(o);if(h!=null){if(h<=l)return;let a=i[h].indexOf(o);a>-1&&i[h].splice(a,1),o instanceof ts&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let a of o)r(a,l);else if(o instanceof ts){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let a=e.get(o.compartment)||o.inner;t.set(o.compartment,a),r(a,l)}else if(o instanceof nl)r(o.inner,o.prec);else if(o instanceof me)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof qi)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,dt.default);else{let a=o.extension;if(!a)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(a,l)}}return r(n,dt.default),i.reduce((o,l)=>o.concat(l))}function ni(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Ji(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const sl=D.define(),rl=D.define({combine:n=>n.some(e=>e),static:!0}),ol=D.define({combine:n=>n.length?n[0]:void 0,static:!0}),ll=D.define(),hl=D.define(),al=D.define(),cl=D.define({combine:n=>n.length?n[0]:!1});class St{constructor(e,t){this.type=e,this.value=t}static define(){return new Fa}}class Fa{of(e){return new St(this,e)}}class Wa{constructor(e){this.map=e}of(e){return new L(this,e)}}class L{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new L(this.type,t)}is(e){return this.type==e}static define(e={}){return new Wa(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}L.reconfigure=L.define();L.appendConfig=L.define();class Q{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&il(i,t.newLength),r.some(l=>l.type==Q.time)||(this.annotations=r.concat(Q.time.of(Date.now())))}static create(e,t,i,s,r,o){return new Q(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Q.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Q.time=St.define();Q.userEvent=St.define();Q.addToHistory=St.define();Q.remote=St.define();function Ha(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof Q?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Q?n=r[0]:n=ul(e,Pt(r),!1)}return n}function qa(n){let e=n.startState,t=e.facet(al),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=fl(i,is(e,r,n.changes.newLength),!0))}return i==n?n:Q.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const $a=[];function Pt(n){return n==null?$a:Array.isArray(n)?n:[n]}var z=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(z||(z={}));const Ka=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ns;try{ns=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ja(n){if(ns)return ns.test(n);for(let e=0;e"\x80"&&(t.toUpperCase()!=t.toLowerCase()||Ka.test(t)))return!0}return!1}function Ua(n){return e=>{if(!/\S/.test(e))return z.Space;if(ja(e))return z.Word;for(let t=0;t-1)return z.Word;return z.Other}}class N{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,l)),t=null),s.set(o.value.compartment,o.value.extension)):o.is(L.reconfigure)?(t=null,i=o.value):o.is(L.appendConfig)&&(t=null,i=Pt(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=Gi.resolve(i,s,this),r=new N(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,h)=>h.reconfigure(l,this),null).values),new N(t,e.newDoc,e.newSelection,r,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Pt(i.effects);for(let l=1;lo.spec.fromJSON(l,h)))}}return N.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Gi.resolve(e.extensions||[],new Map),i=e.doc instanceof I?e.doc:I.of((e.doc||"").split(t.staticFacet(N.lineSeparator)||Yn)),s=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return il(s,i.length),t.staticFacet(rl)||(s=s.asSingle()),new N(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(N.tabSize)}get lineBreak(){return this.facet(N.lineSeparator)||` +`}get readOnly(){return this.facet(cl)}phrase(e,...t){for(let i of this.facet(N.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(sl))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return Ua(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let h=fe(t,o,!1);if(r(t.slice(h,o))!=z.Word)break;o=h}for(;ln.length?n[0]:4});N.lineSeparator=ol;N.readOnly=cl;N.phrases=D.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});N.languageData=sl;N.changeFilter=ll;N.transactionFilter=hl;N.transactionExtender=al;bn.reconfigure=L.define();function Ct(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class yt{eq(e){return this==e}range(e,t=e){return li.create(e,t,this)}}yt.prototype.startSide=yt.prototype.endSide=0;yt.prototype.point=!1;yt.prototype.mapMode=le.TrackDel;class li{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new li(e,t,i)}}function ss(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class $s{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let h=o+l>>1,a=r[h]-e||(i?this.value[h].endSide:this.value[h].startSide)-t;if(h==o)return a>=0?o:l;a>=0?l=h:o=h+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&a.startSide>0&&a.endSide<=0)continue;(d-u||a.endSide-a.startSide)<0||(o<0&&(o=u),a.point&&(l=Math.max(l,d-u)),i.push(a),s.push(u-o),r.push(d-o))}return{mapped:i.length?new $s(s,r,i,l):null,pos:o}}}class K{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new K(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(ss)),this.isEmpty)return t.length?K.of(t):this;let l=new dl(this,null,-1).goto(0),h=0,a=[],c=new bt;for(;l.value||h=0){let f=t[h++];c.addInner(f.from,f.to,f.value)||a.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return hi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return hi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),h=Sr(o,l,i),a=new Gt(o,h,r),c=new Gt(l,h,r);i.iterGaps((f,u,d)=>Cr(a,f,c,u,d,s)),i.empty&&i.length==0&&Cr(a,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=1e9);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=Sr(r,o),h=new Gt(r,l,0).goto(i),a=new Gt(o,l,0).goto(i);for(;;){if(h.to!=a.to||!rs(h.active,a.active)||h.point&&(!a.point||!h.point.eq(a.point)))return!1;if(h.to>s)return!0;h.next(),a.next()}}static spans(e,t,i,s,r=-1){let o=new Gt(e,null,r).goto(t),l=t,h=o.openStart;for(;;){let a=Math.min(o.to,i);if(o.point?(s.point(l,a,o.point,o.activeForPoint(o.to),h,o.pointRank),h=o.openEnd(a)+(o.to>a?1:0)):a>l&&(s.span(l,a,o.active,h),h=o.openEnd(a)),o.to>i)break;l=o.to,o.next()}return h}static of(e,t=!1){let i=new bt;for(let s of e instanceof li?[e]:t?Ga(e):e)i.add(s.from,s.to,s.value);return i.finish()}}K.empty=new K([],[],null,-1);function Ga(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(ss);e=i}return n}K.empty.nextLayer=K.empty;class bt{constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}finishChunk(e){this.chunks.push(new $s(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new bt)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(K.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=K.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Sr(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new dl(o,t,i,r));return s.length==1?s[0]:new hi(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Pn(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Pn(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Pn(this.heap,0)}}}function Pn(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class Gt{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=hi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Si(this.active,e),Si(this.activeTo,e),Si(this.activeRank,e),this.minActive=Ar(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&Si(i,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.frome&&s++,this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function Cr(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,h=i-e;for(;;){let a=n.to+h-t.to||n.endSide-t.endSide,c=a<0?n.to+h:t.to,f=Math.min(c,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&rs(n.activeForPoint(n.to+h),t.activeForPoint(t.to))||r.comparePoint(l,f,n.point,t.point):f>l&&!rs(n.active,t.active)&&r.compareRange(l,f,n.active,t.active),c>o)break;l=c,a<=0&&n.next(),a>=0&&t.next()}}function rs(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function Ar(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=fe(n,s)}return i===!0?-1:n.length}const ls="\u037C",Mr=typeof Symbol>"u"?"__"+ls:Symbol.for(ls),hs=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Dr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ot{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,h,a){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return h.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,h);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&h.push((i&&!f&&!a?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=Dr[Mr]||1;return Dr[Mr]=e+1,ls+e.toString(36)}static mount(e,t){(e[hs]||new Ja(e)).mount(Array.isArray(t)?t:[t])}}let Ai=null;class Ja{constructor(e){if(!e.head&&e.adoptedStyleSheets&&typeof CSSStyleSheet<"u"){if(Ai)return e.adoptedStyleSheets=[Ai.sheet].concat(e.adoptedStyleSheets),e[hs]=Ai;this.sheet=new CSSStyleSheet,e.adoptedStyleSheets=[this.sheet].concat(e.adoptedStyleSheets),Ai=this}else{this.styleTag=(e.ownerDocument||e).createElement("style");let t=e.head||e;t.insertBefore(this.styleTag,t.firstChild)}this.modules=[],e[hs]=this}mount(e){let t=this.sheet,i=0,s=0;for(let r=0;r-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),t)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Or=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent);typeof navigator<"u"&&/Gecko\/\d+/.test(navigator.userAgent);var _a=typeof navigator<"u"&&/Mac/.test(navigator.platform),Xa=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ya=_a||Or&&+Or[1]<57;for(var ne=0;ne<10;ne++)lt[48+ne]=lt[96+ne]=String(ne);for(var ne=1;ne<=24;ne++)lt[ne+111]="F"+ne;for(var ne=65;ne<=90;ne++)lt[ne]=String.fromCharCode(ne+32),ai[ne]=String.fromCharCode(ne);for(var Rn in lt)ai.hasOwnProperty(Rn)||(ai[Rn]=lt[Rn]);function Qa(n){var e=Ya&&(n.ctrlKey||n.altKey||n.metaKey)||Xa&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ai:lt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function _i(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function It(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Za(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function $i(n,e){if(!e.anchorNode)return!1;try{return It(n,e.anchorNode)}catch{return!1}}function ci(n){return n.nodeType==3?Nt(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Xi(n,e,t,i){return t?Tr(n,e,t,i,-1)||Tr(n,e,t,i,1):!1}function Yi(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function Tr(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:fi(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=Yi(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?fi(n):0}else return!1}}function fi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}const pl={left:0,right:0,top:0,bottom:0};function Ks(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function ec(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function tc(n,e,t,i,s,r,o,l){let h=n.ownerDocument,a=h.defaultView||window;for(let c=n;c;)if(c.nodeType==1){let f,u=c==h.body;if(u)f=ec(a);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let m=c.getBoundingClientRect();f={left:m.left,right:m.left+c.clientWidth,top:m.top,bottom:m.top+c.clientHeight}}let d=0,p=0;if(s=="nearest")e.top0&&e.bottom>f.bottom+p&&(p=e.bottom-f.bottom+p+o)):e.bottom>f.bottom&&(p=e.bottom-f.bottom+o,t<0&&e.top-p0&&e.right>f.right+d&&(d=e.right-f.right+d+r)):e.right>f.right&&(d=e.right-f.right+r,t<0&&e.leftt)return f.domBoundsAround(e,t,a);if(u>=e&&s==-1&&(s=h,r=a),a>t&&f.dom.parentNode==this.dom){o=h,l=c;break}c=u,a=u+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.dirty|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.dirty|=2),t.dirty&1)return;t.dirty|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.dirty&&this.markParentsDirty(!0))}setDOM(e){this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=js){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function bl(n,e,t,i,s,r,o,l,h){let{children:a}=n,c=a.length?a[e]:null,f=r.length?r[r.length-1]:null,u=f?f.breakAfter:o;if(!(e==i&&c&&!o&&!u&&r.length<2&&c.merge(t,s,r.length?f:null,t==0,l,h))){if(i0&&(!o&&r.length&&c.merge(t,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(t2);var C={mac:Er||/Mac/.test(Ce.platform),windows:/Win/.test(Ce.platform),linux:/Linux|X11/.test(Ce.platform),ie:wn,ie_version:xl?as.documentMode||6:fs?+fs[1]:cs?+cs[1]:0,gecko:Rr,gecko_version:Rr?+(/Firefox\/(\d+)/.exec(Ce.userAgent)||[0,0])[1]:0,chrome:!!Ln,chrome_version:Ln?+Ln[1]:0,ios:Er,android:/Android\b/.test(Ce.userAgent),webkit:Lr,safari:vl,webkit_version:Lr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:as.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const rc=256;class ht extends H{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return i&&(!(i instanceof ht)||this.length-(t-e)+i.length>rc)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new ht(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new he(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return us(this.dom,e,t)}}class Ue extends H{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let s of t)s.setParent(this)}setAttrs(e){if(ml(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.dirty|=6)}sync(e){this.dom?this.dirty&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e)}merge(e,t,i,s,r,o){return i&&(!(i instanceof Ue&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(s=r),i=h,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Ue(this.mark,t,o)}domAtPos(e){return Cl(this,e)}coordsAt(e,t){return Ml(this,e,t)}}function us(n,e,t){let i=n.nodeValue.length;e>i&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?C.chrome||C.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return C.safari&&!o&&h.width==0&&(h=Array.prototype.find.call(l,a=>a.width)||h),o?Ks(h,o<0):h||null}class tt extends H{constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}static create(e,t,i){return new(e.customView||tt)(e,t,i)}split(e){let t=tt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(){(!this.dom||!this.widget.updateDOM(this.dom))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,i,s,r,o){return i&&(!(i instanceof tt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0?i.length-1:0;s=i[r],!(e>0?r==0:r==i.length-1||s.top0?-1:1);return Ks(s,this.side>0)}get isEditable(){return!1}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class kl extends tt{domAtPos(e){let{topView:t,text:i}=this.widget;return t?ds(e,0,t,i,(s,r)=>s.domAtPos(r),s=>new he(i,Math.min(s,i.nodeValue.length))):new he(i,Math.min(e,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(e,t){let{topView:i,text:s}=this.widget;return i?Sl(e,t,i,s):Math.min(t,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(e,t){let{topView:i,text:s}=this.widget;return i?ds(e,t,i,s,(r,o,l)=>r.coordsAt(o,l),(r,o)=>us(s,r,o)):us(s,e,t)}destroy(){var e;super.destroy(),(e=this.widget.topView)===null||e===void 0||e.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ds(n,e,t,i,s,r){if(t instanceof Ue){for(let o=t.dom.firstChild;o;o=o.nextSibling){let l=H.get(o);if(!l)return r(n,e);let h=It(o,i),a=l.length+(h?i.nodeValue.length:0);if(n0?-1:1);return i&&i.topt.top?{left:t.left,right:t.right,top:i.top,bottom:i.bottom}:t}get overrideDOMText(){return I.empty}}ht.prototype.children=tt.prototype.children=Vt.prototype.children=js;function oc(n,e){let t=n.parent,i=t?t.children.indexOf(n):-1;for(;t&&i>=0;)if(e<0?i>0:ir&&e0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r0&&e instanceof Ue&&s.length&&(i=s[s.length-1])instanceof Ue&&i.mark.eq(e.mark)?Al(i,e.children[0],t-1):(s.push(e),e.setParent(n)),n.length+=e.length}function Ml(n,e,t){let i=null,s=-1,r=null,o=-1;function l(a,c){for(let f=0,u=0;f=c&&(d.children.length?l(d,c-u):!r&&(p>c||u==p&&d.getSide()>0)?(r=d,o=c-u):(u0?3e8:-4e8:t>0?1e8:-1e8,new wt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=Dl(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new wt(e,i,s,t,e.widget||null,!0)}static line(e){return new wi(e)}static set(e,t=!1){return K.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}T.none=K.empty;class xn extends T{constructor(e){let{start:t,end:i}=Dl(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){return this==e||e instanceof xn&&this.tagName==e.tagName&&this.class==e.class&&Us(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}xn.prototype.point=!1;class wi extends T{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof wi&&Us(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}wi.prototype.mapMode=le.TrackBefore;wi.prototype.point=!0;class wt extends T{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?le.TrackBefore:le.TrackAfter:le.TrackDel}get type(){return this.startSide=5}eq(e){return e instanceof wt&&hc(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}wt.prototype.point=!0;function Dl(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t!=null?t:e,end:i!=null?i:e}}function hc(n,e){return n==e||!!(n&&e&&n.compare(e))}function ms(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class ue extends H{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,r,o){if(i){if(!(i instanceof ue))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),wl(this,e,t,i?i.children:[],r,o),!0}split(e){let t=new ue;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){!this.dom||(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Us(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Al(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=ps(t,this.attrs||{})),i&&(this.attrs=ps({class:i},this.attrs||{}))}domAtPos(e){return Cl(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.dirty|=6)}sync(e){var t;this.dom?this.dirty&4&&(ml(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(gs(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e);let i=this.dom.lastChild;for(;i&&H.get(i)instanceof Ue;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((t=H.get(i))===null||t===void 0?void 0:t.isEditable)==!1&&(!C.ios||!this.children.some(s=>s instanceof ht))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0;for(let t of this.children){if(!(t instanceof ht)||/[^ -~]/.test(t.text))return null;let i=ci(t.dom);if(i.length!=1)return null;e+=i[0].width}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length}:null}coordsAt(e,t){return Ml(this,e,t)}become(e){return!1}get type(){return q.Text}static find(e,t){for(let i=0,s=0;i=t){if(r instanceof ue)return r;if(o>t)break}s=o+r.breakAfter}return null}}class mt extends H{constructor(e,t,i){super(),this.widget=e,this.length=t,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,s,r,o){return i&&(!(i instanceof mt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0;){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer([]),this.curLine=null,e--;continue}else this.text=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(0,i)),this.getLine().append(Mi(new ht(this.text.slice(this.textOff,this.textOff+s)),t),i),this.atCursorPos=!0,this.textOff+=s,e-=s,i=0}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof wt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(i instanceof wt)if(i.block){let{type:h}=i;h==q.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new mt(i.widget||new Ir("div"),l,h))}else{let h=tt.create(i.widget||new Ir("span"),l,l?0:i.startSide),a=this.atCursorPos&&!h.isEditable&&r<=s.length&&(e0),c=!h.isEditable&&(en.some(e=>e)});class Qi{constructor(e,t="nearest",i="nearest",s=5,r=5){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r}map(e){return e.empty?this:new Qi(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const Nr=L.define({map:(n,e)=>n.map(e)});function Ee(n,e,t){let i=n.facet(Pl);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const vn=D.define({combine:n=>n.length?n[0]:!0});let ac=0;const Yt=D.define();class de{constructor(e,t,i,s){this.id=e,this.create=t,this.domEventHandlers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:i,provide:s,decorations:r}=t||{};return new de(ac++,e,i,o=>{let l=[Yt.of(o)];return r&&l.push(ui.of(h=>{let a=h.plugin(o);return a?r(a):T.none})),s&&l.push(s(o)),l})}static fromClass(e,t){return de.define(i=>new e(i),t)}}class En{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Ee(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){Ee(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Ee(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const El=D.define(),Il=D.define(),ui=D.define(),Nl=D.define(),Vl=D.define(),Qt=D.define();class _e{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new _e(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAc)break;r+=2}if(!h)return i;new _e(h.fromA,h.toA,h.fromB,h.toB).addToSet(i),o=h.toA,l=h.toB}}}class Zi{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=Y.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let s=[];this.changes.iterChangedRanges((o,l,h,a)=>s.push(new _e(o,l,h,a))),this.changedRanges=s;let r=e.hasFocus;r!=e.inputState.notifiedFocused&&(e.inputState.notifiedFocused=r,this.flags|=1)}static create(e,t,i){return new Zi(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}var _=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(_||(_={}));const bs=_.LTR,cc=_.RTL;function Fl(n){let e=[];for(let t=0;t=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}const $=[];function gc(n,e){let t=n.length,i=e==bs?1:2,s=e==bs?2:1;if(!n||i==1&&!pc.test(n))return Wl(t);for(let o=0,l=i,h=i;o=0;u-=3)if(Ne[u+1]==-c){let d=Ne[u+2],p=d&2?i:d&4?d&1?s:i:0;p&&($[o]=$[Ne[u]]=p),l=u;break}}else{if(Ne.length==189)break;Ne[l++]=o,Ne[l++]=a,Ne[l++]=h}else if((f=$[o])==2||f==1){let u=f==i;h=u?0:1;for(let d=l-3;d>=0;d-=3){let p=Ne[d+2];if(p&2)break;if(u)Ne[d+2]|=2;else{if(p&4)break;Ne[d+2]|=4}}}for(let o=0;ol;){let c=a,f=$[--a]!=2;for(;a>l&&f==($[a-1]!=2);)a--;r.push(new Lt(a,c,f?2:1))}else r.push(new Lt(l,o,0))}else for(let o=0;o1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=H.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+Math.min(t,i.offset))}}function Vr(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}class Fr{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Wr extends H{constructor(e){super(),this.view=e,this.compositionDeco=T.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ue],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new _e(0,0,0,e.state.doc.length)],0)}get editorView(){return this.view}get length(){return this.view.state.doc.length}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:o,toA:l})=>lthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=T.none:(e.transactions.length||this.dirty)&&(this.compositionDeco=bc(this.view,e.changes)),(C.ie||C.chrome)&&!this.compositionDeco.size&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,s=this.updateDeco(),r=kc(i,s,e.changes);return t=_e.extendWithRanges(t,r),this.dirty==0&&t.length==0?!1:(this.updateInner(t,e.startState.doc.length),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=C.chrome||C.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(r),this.dirty=0,r&&(r.written||i.selectionRange.focusNode!=r.node)&&(this.forceSelection=!0),this.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to=0?e[s]:null;if(!r)break;let{fromA:o,toA:l,fromB:h,toB:a}=r,{content:c,breakAtStart:f,openStart:u,openEnd:d}=Gs.build(this.view.state.doc,h,a,this.decorations,this.dynamicDecorationMap),{i:p,off:m}=i.findPos(l,1),{i:g,off:y}=i.findPos(o,-1);bl(this,g,y,p,m,c,f,u,d)}}updateSelection(e=!1,t=!1){if((e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange(),!(t||this.mayControlSelection()))return;let i=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,r=this.domAtPos(s.anchor),o=s.empty?r:this.domAtPos(s.head);if(C.gecko&&s.empty&&yc(r)){let h=document.createTextNode("");this.view.observer.ignore(()=>r.node.insertBefore(h,r.node.childNodes[r.offset]||null)),r=o=new he(h,0),i=!0}let l=this.view.observer.selectionRange;(i||!l.focusNode||!Xi(r.node,r.offset,l.anchorNode,l.anchorOffset)||!Xi(o.node,o.offset,l.focusNode,l.focusOffset))&&(this.view.observer.ignore(()=>{C.android&&C.chrome&&this.dom.contains(l.focusNode)&&Sc(l.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=_i(this.view.root);if(h)if(s.empty){if(C.gecko){let a=xc(r.node,r.offset);if(a&&a!=3){let c=$l(r.node,r.offset,a==1?1:-1);c&&(r=new he(c,a==1?0:c.nodeValue.length))}}h.collapse(r.node,r.offset),s.bidiLevel!=null&&l.cursorBidiLevel!=null&&(l.cursorBidiLevel=s.bidiLevel)}else if(h.extend){h.collapse(r.node,r.offset);try{h.extend(o.node,o.offset)}catch{}}else{let a=document.createRange();s.anchor>s.head&&([r,o]=[o,r]),a.setEnd(o.node,o.offset),a.setStart(r.node,r.offset),h.removeAllRanges(),h.addRange(a)}}),this.view.observer.setSelectionRange(r,o)),this.impreciseAnchor=r.precise?null:new he(l.anchorNode,l.anchorOffset),this.impreciseHead=o.precise?null:new he(l.focusNode,l.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let e=this.view.state.selection.main,t=_i(this.view.root);if(!t||!e.empty||!e.assoc||!t.modify)return;let i=ue.find(this,e.head);if(!i)return;let s=i.posAtStart;if(e.head==s||e.head==s+i.length)return;let r=this.coordsAt(e.head,-1),o=this.coordsAt(e.head,1);if(!r||!o||r.bottom>o.top)return;let l=this.domAtPos(e.head+e.assoc);t.collapse(l.node,l.offset),t.modify("move",e.assoc<0?"forward":"backward","lineboundary")}mayControlSelection(){let e=this.view.root.activeElement;return e==this.dom||$i(this.dom,this.view.observer.selectionRange)&&!(e&&this.dom.contains(e))}nearest(e){for(let t=e;t;){let i=H.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;to||e==o&&r.type!=q.WidgetBefore&&r.type!=q.WidgetAfter&&(!s||t==2||this.children[s-1].breakAfter||this.children[s-1].type==q.WidgetBefore&&t>-2))return r.coordsAt(e-o,t);i=o}}measureVisibleLineHeights(e){let t=[],{from:i,to:s}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,h=this.view.textDirection==_.LTR;for(let a=0,c=0;cs)break;if(a>=i){let d=f.dom.getBoundingClientRect();if(t.push(d.height),o){let p=f.dom.lastChild,m=p?ci(p):[];if(m.length){let g=m[m.length-1],y=h?g.right-d.left:d.right-g.left;y>l&&(l=y,this.minWidth=r,this.minWidthFrom=a,this.minWidthTo=u)}}}a=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?_.RTL:_.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ue){let r=s.measureTextSize();if(r)return r}let e=document.createElement("div"),t,i;return e.className="cm-line",e.style.width="99999px",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=ci(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,e.remove()}),{lineHeight:t,charWidth:i}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new yl(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>i){let l=t.lineBlockAt(o).bottom-t.lineBlockAt(i).top;e.push(T.replace({widget:new Hr(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return T.set(e)}updateDeco(){let e=this.view.state.facet(ui).map((t,i)=>(this.dynamicDecorationMap[i]=typeof t=="function")?t(this.view):t);for(let t=e.length;tt.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=0,o=0,l=0,h=0;for(let c of this.view.state.facet(Vl).map(f=>f(this.view)))if(c){let{left:f,right:u,top:d,bottom:p}=c;f!=null&&(r=Math.max(r,f)),u!=null&&(o=Math.max(o,u)),d!=null&&(l=Math.max(l,d)),p!=null&&(h=Math.max(h,p))}let a={left:i.left-r,top:i.top-l,right:i.right+o,bottom:i.bottom+h};tc(this.view.scrollDOM,a,t.head0&&t<=0)n=n.childNodes[e-1],e=fi(n);else if(n.nodeType==1&&e=0)n=n.childNodes[e],e=0;else return null}}function xc(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e0;){let a=fe(s.text,o,!1);if(i(s.text.slice(a,o))!=h)break;o=a}for(;ln?e.left-n:Math.max(0,n-e.right)}function Mc(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function In(n,e){return n.tope.top+1}function zr(n,e){return en.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function xs(n,e,t){let i,s,r,o,l=!1,h,a,c,f;for(let p=n.firstChild;p;p=p.nextSibling){let m=ci(p);for(let g=0;gk||o==k&&r>v)&&(i=p,s=y,r=v,o=k,l=!v||(v>0?g0)),v==0?t>y.bottom&&(!c||c.bottomy.top)&&(a=p,f=y):c&&In(c,y)?c=qr(c,y.bottom):f&&In(f,y)&&(f=zr(f,y.top))}}if(c&&c.bottom>=t?(i=h,s=c):f&&f.top<=t&&(i=a,s=f),!i)return{node:n,offset:0};let u=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return $r(i,u,t);if(l&&i.contentEditable!="false")return xs(i,u,t);let d=Array.prototype.indexOf.call(n.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:n,offset:d}}function $r(n,e,t){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;lt?c.top-t:t-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=u;if((C.chrome||C.gecko)&&Nt(n,l).getBoundingClientRect().left==c.right&&(d=!u),f<=0)return{node:n,offset:l+(d?1:0)};s=l+(d?1:0),r=f}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function Kl(n,{x:e,y:t},i,s=-1){var r;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,h,{docHeight:a}=n.viewState,c=t-l;if(c<0)return 0;if(c>a)return n.state.doc.length;for(let y=n.defaultLineHeight/2,v=!1;h=n.elementAtHeight(c),h.type!=q.Text;)for(;c=s>0?h.bottom+y:h.top-y,!(c>=0&&c<=a);){if(v)return i?null:0;v=!0,s=-s}t=l+c;let f=h.from;if(fn.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:i?null:Kr(n,o,h,e,t);let u=n.dom.ownerDocument,d=n.root.elementFromPoint?n.root:u,p=d.elementFromPoint(e,t);p&&!n.contentDOM.contains(p)&&(p=null),p||(e=Math.max(o.left+1,Math.min(o.right-1,e)),p=d.elementFromPoint(e,t),p&&!n.contentDOM.contains(p)&&(p=null));let m,g=-1;if(p&&((r=n.docView.nearest(p))===null||r===void 0?void 0:r.isEditable)!=!1){if(u.caretPositionFromPoint){let y=u.caretPositionFromPoint(e,t);y&&({offsetNode:m,offset:g}=y)}else if(u.caretRangeFromPoint){let y=u.caretRangeFromPoint(e,t);y&&({startContainer:m,startOffset:g}=y,(!n.contentDOM.contains(m)||C.safari&&Dc(m,g,e)||C.chrome&&Oc(m,g,e))&&(m=void 0))}}if(!m||!n.docView.dom.contains(m)){let y=ue.find(n.docView,f);if(!y)return c>h.top+h.height/2?h.to:h.from;({node:m,offset:g}=xs(y.dom,e,t))}return n.docView.posFromDOM(m,g)}function Kr(n,e,t,i,s){let r=Math.round((i-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let l=Math.floor((s-t.top)/n.defaultLineHeight);r+=l*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+os(o,r,n.state.tabSize)}function Dc(n,e,t){let i;if(n.nodeType!=3||e!=(i=n.nodeValue.length))return!1;for(let s=n.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return Nt(n,i-1,i).getBoundingClientRect().left>t}function Oc(n,e,t){if(e!=0)return!1;for(let s=n;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let i=n.nodeType==1?n.getBoundingClientRect():Nt(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Tc(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=!i||!n.lineWrapping?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let h=n.dom.getBoundingClientRect(),a=n.textDirectionAt(s.from),c=n.posAtCoords({x:t==(a==_.LTR)?h.right-1:h.left+1,y:(r.top+r.bottom)/2});if(c!=null)return b.cursor(c,t?-1:1)}let o=ue.find(n.docView,e.head),l=o?t?o.posAtEnd:o.posAtStart:t?s.to:s.from;return b.cursor(l,t?-1:1)}function jr(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,h=null;;){let a=mc(s,r,o,l,t),c=Hl;if(!a){if(s.number==(t?n.state.doc.lines:1))return l;c=` +`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),a=b.cursor(t?s.from:s.to)}if(h){if(!h(c))return l}else{if(!i)return a;h=i(c)}l=a}}function Bc(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==z.Space&&(s=o),s==o}}function Pc(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return b.cursor(s,e.assoc);let o=e.goalColumn,l,h=n.contentDOM.getBoundingClientRect(),a=n.coordsAtPos(s),c=n.documentTop;if(a)o==null&&(o=a.left-h.left),l=r<0?a.top:a.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(h.right-h.left,n.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+c}let f=h.left+o,u=i!=null?i:n.defaultLineHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,m=Kl(n,{x:f,y:p},!1,r);if(ph.bottom||(r<0?ms))return b.cursor(m,e.assoc,void 0,o)}}function Nn(n,e,t){let i=n.state.facet(Nl).map(s=>s(n));for(;;){let s=!1;for(let r of i)r.between(t.from-1,t.from+1,(o,l,h)=>{t.from>o&&t.fromt.from?b.cursor(o,1):b.cursor(l,-1),s=!0)});if(!s)return t}}class Rc{constructor(e){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.mouseSelection=null;for(let t in Z){let i=Z[t];e.contentDOM.addEventListener(t,s=>{!Ur(e,s)||this.ignoreDuringComposition(s)||t=="keydown"&&this.keydown(e,s)||(this.mustFlushObserver(s)&&e.observer.forceFlush(),this.runCustomHandlers(t,e,s)?s.preventDefault():i(e,s))},vs[t]),this.registeredEvents.push(t)}C.chrome&&C.chrome_version==102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,C.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,t){var i;let s;this.customHandlers=[];for(let r of t)if(s=(i=r.update(e).spec)===null||i===void 0?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:s});for(let o in s)this.registeredEvents.indexOf(o)<0&&o!="scroll"&&(this.registeredEvents.push(o),e.contentDOM.addEventListener(o,l=>{!Ur(e,l)||this.runCustomHandlers(o,e,l)&&l.preventDefault()}))}}runCustomHandlers(e,t,i){for(let s of this.customHandlers){let r=s.handlers[e];if(r)try{if(r.call(s.plugin,i,t)||i.defaultPrevented)return!0}catch(o){Ee(t.state,o)}}return!1}runScrollHandlers(e,t){this.lastScrollTop=e.scrollDOM.scrollTop,this.lastScrollLeft=e.scrollDOM.scrollLeft;for(let i of this.customHandlers){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,t,e)}catch(r){Ee(e.state,r)}}}keydown(e,t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()s.keyCode==t.keyCode))&&!t.ctrlKey||Lc.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=i||t,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,Rt(e.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:C.safari&&!C.ios&&Date.now()-this.compositionEndedAt<100?(this.compositionEndedAt=0,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const jl=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Lc="dthko",Ul=[16,17,18,20,91,92,224,225];class Ec{constructor(e,t,i,s){this.view=e,this.style=i,this.mustSelect=s,this.lastEvent=t;let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(N.allowMultipleSelections)&&Ic(e,t),this.dragMove=Nc(e,t),this.dragging=Vc(e,t)&&Xl(t)==1?null:!1,this.dragging===!1&&(t.preventDefault(),this.select(t))}move(e){if(e.buttons==0)return this.destroy();this.dragging===!1&&this.select(this.lastEvent=e)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}select(e){let t=this.style.get(e,this.extend,this.multiple);(this.mustSelect||!t.eq(this.view.state.selection)||t.main.assoc!=this.view.state.selection.main.assoc)&&this.view.dispatch({selection:t,userEvent:"select.pointer",scrollIntoView:!0}),this.mustSelect=!1}update(e){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Ic(n,e){let t=n.state.facet(Ol);return t.length?t[0](e):C.mac?e.metaKey:e.ctrlKey}function Nc(n,e){let t=n.state.facet(Tl);return t.length?t[0](e):C.mac?!e.altKey:!e.ctrlKey}function Vc(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=_i(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Ur(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=H.get(t))&&i.ignoreEvent(e))return!1;return!0}const Z=Object.create(null),vs=Object.create(null),Gl=C.ie&&C.ie_version<15||C.ios&&C.webkit_version<604;function Fc(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Jl(n,t.value)},50)}function Jl(n,e){let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(ks!=null&&t.selection.ranges.every(h=>h.empty)&&ks==r.toString()){let h=-1;i=t.changeByRange(a=>{let c=t.doc.lineAt(a.from);if(c.from==h)return{range:a};h=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:b.cursor(a.from+f.length)}})}else o?i=t.changeByRange(h=>{let a=r.line(s++);return{changes:{from:h.from,to:h.to,insert:a.text},range:b.cursor(h.from+a.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Z.keydown=(n,e)=>{n.inputState.setSelectionOrigin("select"),e.keyCode==27?n.inputState.lastEscPress=Date.now():Ul.indexOf(e.keyCode)<0&&(n.inputState.lastEscPress=0)};Z.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};Z.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};vs.touchstart=vs.touchmove={passive:!0};Z.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return;let t=null;for(let i of n.state.facet(Bl))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=zc(n,e)),t){let i=n.root.activeElement!=n.contentDOM;i&&n.observer.ignore(()=>gl(n.contentDOM)),n.inputState.startMouseSelection(new Ec(n,e,t,i))}};function Gr(n,e,t,i){if(i==1)return b.cursor(e,t);if(i==2)return Cc(n.state,e,t);{let s=ue.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return ln>=e.top&&n<=e.bottom,Jr=(n,e,t)=>_l(e,t)&&n>=t.left&&n<=t.right;function Wc(n,e,t,i){let s=ue.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Jr(t,i,o))return-1;let l=s.coordsAt(r,1);return l&&Jr(t,i,l)?1:o&&_l(i,o)?-1:1}function _r(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Wc(n,t,e.clientX,e.clientY)}}const Hc=C.ie&&C.ie_version<=11;let Xr=null,Yr=0,Qr=0;function Xl(n){if(!Hc)return n.detail;let e=Xr,t=Qr;return Xr=n,Qr=Date.now(),Yr=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(Yr+1)%3:1}function zc(n,e){let t=_r(n,e),i=Xl(e),s=n.state.selection,r=t,o=e;return{update(l){l.docChanged&&(t.pos=l.changes.mapPos(t.pos),s=s.map(l.changes),o=null)},get(l,h,a){let c;o&&l.clientX==o.clientX&&l.clientY==o.clientY?c=r:(c=r=_r(n,l),o=l);let f=Gr(n,c.pos,c.bias,i);if(t.pos!=c.pos&&!h){let u=Gr(n,t.pos,t.bias,i),d=Math.min(u.from,f.from),p=Math.max(u.to,f.to);f=d1&&s.ranges.some(u=>u.eq(f))?qc(s,f):a?s.addRange(f):b.create([f])}}}function qc(n,e){for(let t=0;;t++)if(n.ranges[t].eq(e))return b.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}Z.dragstart=(n,e)=>{let{selection:{main:t}}=n.state,{mouseSelection:i}=n.inputState;i&&(i.dragging=t),e.dataTransfer&&(e.dataTransfer.setData("Text",n.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove")};function Zr(n,e,t,i){if(!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:r}=n.inputState,o=i&&r&&r.dragging&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,l={from:s,insert:t},h=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:h,selection:{anchor:h.mapPos(s,-1),head:h.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Z.drop=(n,e)=>{if(!e.dataTransfer)return;if(n.state.readOnly)return e.preventDefault();let t=e.dataTransfer.files;if(t&&t.length){e.preventDefault();let i=Array(t.length),s=0,r=()=>{++s==t.length&&Zr(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}}else Zr(n,e,e.dataTransfer.getData("Text"),!0)};Z.paste=(n,e)=>{if(n.state.readOnly)return e.preventDefault();n.observer.flush();let t=Gl?null:e.clipboardData;t?(Jl(n,t.getData("text/plain")),e.preventDefault()):Fc(n)};function $c(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function Kc(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:e.join(n.lineBreak),ranges:t,linewise:i}}let ks=null;Z.copy=Z.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=Kc(n.state);if(!t&&!s)return;ks=s?t:null;let r=Gl?null:e.clipboardData;r?(e.preventDefault(),r.clearData(),r.setData("text/plain",t)):$c(n,t),e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"})};function Yl(n){setTimeout(()=>{n.hasFocus!=n.inputState.notifiedFocused&&n.update([])},10)}Z.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),Yl(n)};Z.blur=n=>{n.observer.clearSelectionRange(),Yl(n)};Z.compositionstart=Z.compositionupdate=n=>{n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0)};Z.compositionend=n=>{n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionFirstChange=null,C.chrome&&C.android&&n.observer.flushSoon(),setTimeout(()=>{n.inputState.composing<0&&n.docView.compositionDeco.size&&n.update([])},50)};Z.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Z.beforeinput=(n,e)=>{var t;let i;if(C.chrome&&C.android&&(i=jl.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var r;(((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}};const eo=["pre-wrap","normal","pre-line","break-spaces"];class jc{constructor(){this.doc=I.empty,this.lineWrapping=!1,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength)),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return eo.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=i,this.lineLength=s,l){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>Ki&&(e.heightChanged=!0),this.height=t)}replace(e,t,i){return we.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this;for(let o=s.length-1;o>=0;o--){let{fromA:l,toA:h,fromB:a,toB:c}=s[o],f=r.lineAt(l,W.ByPosNoHeight,t,0,0),u=f.to>=h?f:r.lineAt(h,W.ByPosNoHeight,t,0,0);for(c+=u.to-h,h=u.to;o>0&&f.from<=s[o-1].toA;)l=s[o-1].fromA,a=s[o-1].fromB,o--,lr*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(e,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ke extends Ql{constructor(e,t){super(e,t,q.Text),this.collapsed=0,this.widgetHeight=0}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof ke||s instanceof te&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof te?s=new ke(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):we.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(e,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class te extends we{constructor(e){super(e,0)}lines(e,t){let i=e.lineAt(t).number,s=e.lineAt(t+this.length).number;return{firstLine:i,lastLine:s,lineHeight:this.height/(s-i+1)}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,lineHeight:l}=this.lines(t,s),h=Math.max(0,Math.min(o-r,Math.floor((e-i)/l))),{from:a,length:c}=t.line(r+h);return new nt(a,c,i+l*h,l,q.Text)}lineAt(e,t,i,s,r){if(t==W.ByHeight)return this.blockAt(e,i,s,r);if(t==W.ByPosNoHeight){let{from:f,to:u}=i.lineAt(e);return new nt(f,u-f,0,0,q.Text)}let{firstLine:o,lineHeight:l}=this.lines(i,r),{from:h,length:a,number:c}=i.lineAt(e);return new nt(h,a,s+l*(c-o),l,q.Text)}forEachLine(e,t,i,s,r,o){let{firstLine:l,lineHeight:h}=this.lines(i,r);for(let a=Math.max(e,r),c=Math.min(r+this.length,t);a<=c;){let f=i.lineAt(a);a==e&&(s+=h*(f.number-l)),o(new nt(f.from,f.length,s,h,q.Text)),s+=h,a=f.to+1}}replace(e,t,i){let s=this.length-t;if(s>0){let r=i[i.length-1];r instanceof te?i[i.length-1]=new te(r.length+s):i.push(null,new te(s-1))}if(e>0){let r=i[0];r instanceof te?i[0]=new te(e+r.length):i.unshift(new te(e-1),null)}return we.of(i)}decomposeLeft(e,t){t.push(new te(e-1),null)}decomposeRight(e,t){t.push(null,new te(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),h=-1,a=e.heightChanged;for(s.from>t&&o.push(new te(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let f=e.doc.lineAt(l).length;o.length&&o.push(null);let u=s.heights[s.index++];h==-1?h=u:Math.abs(u-h)>=Ki&&(h=-2);let d=new ke(f,u);d.outdated=!1,o.push(d),l+=f+1}l<=r&&o.push(null,new te(r-l).updateHeight(e,l));let c=we.of(o);return e.heightChanged=a||h<0||Math.abs(c.height-this.height)>=Ki||Math.abs(h-this.lines(e.doc,t).lineHeight)>=Ki,c}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Gc extends we{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return a;let c=t==W.ByPosNoHeight?W.ByPosNoHeight:W.ByPos;return h?a.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(a)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,h=r+this.left.length+this.break;if(this.break)e=h&&this.right.forEachLine(e,t,i,l,h,o);else{let a=this.lineAt(h,W.ByPos,i,s,r);e=e&&a.from<=t&&o(a),t>a.to&&this.right.forEachLine(a.to+1,t,i,l,h,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&to(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?we.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,h=null;return s&&s.from<=t+r.length&&s.more?h=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?h=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),h?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function to(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof te&&(i=n[e+1])instanceof te&&n.splice(e-1,3,new te(t.length+1+i.length))}const Jc=5;class Js{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof ke?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new ke(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=Jc)&&this.addLineDeco(s,r)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new ke(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new te(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ke)return e;let t=new ke(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine(),e.type==q.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,e.type!=q.WidgetBefore&&(this.covering=e)}addLineDeco(e,t){let i=this.ensureLine();i.length+=t,i.collapsed+=t,i.widgetHeight=Math.max(i.widgetHeight,e),this.writtenTo=this.pos=this.pos+t}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof ke)&&!this.isCovered?this.nodes.push(new ke(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),h=a==n.parentNode?u.bottom:Math.min(h,u.bottom)}a=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(a.nodeType==11)a=a.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,h)-(t.top+e)}}function Qc(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Vn{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof t!="function"),this.heightMap=we.empty().applyChanges(this.stateDeco,I.empty,this.heightOracle.setDoc(e.doc),[new _e(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=T.set(this.lineGaps.map(t=>t.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new Di(r,o))}}this.viewports=e.sort((i,s)=>i.from-s.from),this.scaler=this.heightMap.height<=7e6?no:new nf(this.heightOracle.doc,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.state.doc,0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:Zt(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(ui).filter(a=>typeof a!="function");let s=e.changedRanges,r=_e.extendWithRanges(s,_c(i,this.stateDeco,e?e.changes:Y.empty(this.state.doc.length))),o=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(e.flags|=2);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let h=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?_.RTL:_.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=o||this.mustMeasureContent||this.contentDOMHeight!=t.clientHeight;this.contentDOMHeight=t.clientHeight,this.mustMeasureContent=!1;let h=0,a=0,c=parseInt(i.paddingTop)||0,f=parseInt(i.paddingBottom)||0;(this.paddingTop!=c||this.paddingBottom!=f)&&(this.paddingTop=c,this.paddingBottom=f,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let u=(this.printing?Qc:Yc)(t,this.paddingTop),d=u.top-this.pixelViewport.top,p=u.bottom-this.pixelViewport.bottom;this.pixelViewport=u;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let g=t.clientWidth;if((this.contentDOMWidth!=g||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=g,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let v=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(v)&&(o=!0),o||s.lineWrapping&&Math.abs(g-this.contentDOMWidth)>s.charWidth){let{lineHeight:k,charWidth:S}=e.docView.measureTextSize();o=k>0&&s.refresh(r,k,S,g/S,v),o&&(e.docView.minWidth=0,h|=8)}d>0&&p>0?a=Math.max(d,p):d<0&&p<0&&(a=Math.min(d,p)),s.heightChanged=!1;for(let k of this.viewports){let S=k.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(k);this.heightMap=this.heightMap.updateHeight(s,0,o,new Uc(k.from,S))}s.heightChanged&&(h|=2)}let y=!this.viewportIsAppropriate(this.viewport,a)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return y&&(this.viewport=this.getViewport(a,this.scrollTarget)),this.updateForViewport(),(h&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.state.doc,{visibleTop:o,visibleBottom:l}=this,h=new Di(s.lineAt(o-i*1e3,W.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,W.ByHeight,r,0,0).to);if(t){let{head:a}=t.range;if(ah.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(a,W.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&a=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=_.LTR&&!i)return[];let l=[],h=(a,c,f,u)=>{if(c-aa&&gg.from>=f.from&&g.to<=f.to&&Math.abs(g.from-a)g.fromy));if(!m){if(cg.from<=c&&g.to>=c)){let g=t.moveToLineBoundary(b.cursor(c),!1,!0).head;g>a&&(c=g)}m=new Vn(a,c,this.gapSize(f,a,c,u))}l.push(m)};for(let a of this.viewportLines){if(a.lengtha.from&&h(a.from,u,a,c),dt.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];K.spans(e,this.viewport.from,this.viewport.to,{span(s,r){t.push({from:s,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=t[r].from||s.to!=t[r].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Zt(this.heightMap.lineAt(e,W.ByPos,this.state.doc,0,0),this.scaler)}lineBlockAtHeight(e){return Zt(this.heightMap.lineAt(this.scaler.fromDOM(e),W.ByHeight,this.state.doc,0,0),this.scaler)}elementAtHeight(e){return Zt(this.heightMap.blockAt(this.scaler.fromDOM(e),this.state.doc,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Di{constructor(e,t){this.from=e,this.to=t}}function ef(n,e,t){let i=[],s=n,r=0;return K.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function Ti(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function tf(n,e){for(let t of n)if(e(t))return t}const no={toDOM(n){return n},fromDOM(n){return n},scale:1};class nf{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:h})=>{let a=t.lineAt(l,W.ByPos,e,0,0).top,c=t.lineAt(h,W.ByPos,e,0,0).bottom;return s+=c-a,{from:l,to:h,top:a,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tZt(s,e)):n.type)}const Bi=D.define({combine:n=>n.join(" ")}),Ss=D.define({combine:n=>n.indexOf(!0)>-1}),Cs=ot.newName(),Zl=ot.newName(),eh=ot.newName(),th={"&light":"."+Zl,"&dark":"."+eh};function As(n,e,t){return new ot(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const sf=As("."+Cs,{"&.cm-editor":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,minHeight:"100%",display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 4px"},".cm-selectionLayer":{zIndex:-1,contain:"size style"},".cm-selectionBackground":{position:"absolute"},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{zIndex:100,contain:"size style",pointerEvents:"none"},"&.cm-focused .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{position:"absolute",borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},"&.cm-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},th);class rf{constructor(e,t,i,s){this.typeOver=s,this.bounds=null,this.text="";let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(t>-1&&!e.state.readOnly&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let l=r||o?[]:lf(e),h=new zl(l,e.state);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=hf(l,this.bounds.from)}else{let l=e.observer.selectionRange,h=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!It(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),a=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!It(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset);this.newSel=b.single(a,h)}}}function ih(n,e){let t,{newSel:i}=e,s=n.state.selection.main;if(e.bounds){let{from:r,to:o}=e.bounds,l=s.from,h=null;(n.inputState.lastKeyCode===8&&n.inputState.lastKeyTime>Date.now()-100||C.android&&e.text.length=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4?t={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,s.to))}:(C.mac||C.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())?(i&&t.insert.length==2&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:I.of([" "])}):C.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` + `&&n.lineWrapping&&(i&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:I.of([" "])}),t){let r=n.state;if(C.ios&&n.inputState.flushIOSKey(n)||C.android&&(t.from==s.from&&t.to==s.to&&t.insert.length==1&&t.insert.lines==2&&Rt(n.contentDOM,"Enter",13)||t.from==s.from-1&&t.to==s.to&&t.insert.length==0&&Rt(n.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&Rt(n.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();if(n.state.facet(Rl).some(a=>a(n,t.from,t.to,o)))return!0;n.inputState.composing>=0&&n.inputState.composing++;let l;if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!i||i.main.empty&&i.main.from==t.from+t.insert.length)&&n.inputState.composing<0){let a=s.fromt.to?r.sliceDoc(t.to,s.to):"";l=r.replaceSelection(n.state.toText(a+t.insert.sliceString(0,void 0,n.state.lineBreak)+c))}else{let a=r.changes(t),c=i&&!r.selection.main.eq(i.main)&&i.main.to<=a.newLength?i.main:void 0;if(r.selection.ranges.length>1&&n.inputState.composing>=0&&t.to<=s.to&&t.to>=s.to-10){let f=n.state.sliceDoc(t.from,t.to),u=ql(n)||n.state.doc.lineAt(s.head),d=s.to-t.to,p=s.to-s.from;l=r.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:a,range:c||m.map(a)};let g=m.to-d,y=g-f.length;if(m.to-m.from!=p||n.state.sliceDoc(y,g)!=f||u&&m.to>=u.from&&m.from<=u.to)return{range:m};let v=r.changes({from:y,to:g,insert:t.insert}),k=m.to-s.to;return{changes:v,range:c?b.range(Math.max(0,c.anchor+k),Math.max(0,c.head+k)):m.map(v)}})}else l={changes:a,selection:c&&r.selection.replaceRange(c)}}let h="input.type";return n.composing&&(h+=".compose",n.inputState.compositionFirstChange&&(h+=".start",n.inputState.compositionFirstChange=!1)),n.dispatch(l,{scrollIntoView:!0,userEvent:h}),!0}else if(i&&!i.main.eq(s)){let r=!1,o="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(r=!0),o=n.inputState.lastSelectionOrigin),n.dispatch({selection:i,scrollIntoView:r,userEvent:o}),!0}else return!1}function of(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let h=Math.max(0,r-Math.min(o,l));t-=o+h-r}if(o=o?r-t:0;r-=h,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=h,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function lf(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new Fr(t,i)),(s!=t||r!=i)&&e.push(new Fr(s,r))),e}function hf(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?b.single(t+e,i+e):null}const af={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Fn=C.ie&&C.ie_version<=11;class cf{constructor(e){this.view=e,this.active=!1,this.selectionRange=new ic,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resize=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(C.ie&&C.ie_version<=11||C.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Fn&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resize=new ResizeObserver(()=>{this.view.docView.lastUpdate{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runScrollHandlers(this.view,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(vn)?i.root.activeElement!=this.dom:!$i(i.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(C.ie&&C.ie_version<=11||C.android&&C.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Xi(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=C.safari&&e.root.nodeType==11&&Za(this.dom.ownerDocument)==this.dom&&ff(this.view)||_i(e.root);if(!t||this.selectionRange.eq(t))return!1;let i=$i(this.dom,t);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),!this.flush()&&r.force&&Rt(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}processRecords(){let e=this.queue;for(let r of this.observer.takeRecords())e.push(r);e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);!o||(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&$i(this.dom,this.selectionRange);return e<0&&!s?null:(e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new rf(this.view,e,t,i))}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return!1;let i=this.view.state,s=ih(this.view,t);return this.view.state==i&&this.view.update([]),s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.dirty|=4),e.type=="childList"){let i=so(t,e.previousSibling||e.target.previousSibling,-1),s=so(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resize)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function so(n,e,t){for(;e;){let i=H.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function ff(n){let e=null;function t(h){h.preventDefault(),h.stopImmediatePropagation(),e=h.getTargetRanges()[0]}if(n.contentDOM.addEventListener("beforeinput",t,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let i=e.startContainer,s=e.startOffset,r=e.endContainer,o=e.endOffset,l=n.docView.domAtPos(n.state.selection.main.anchor);return Xi(l.node,l.offset,r,o)&&([i,s,r,o]=[r,o,i,s]),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:o}}class O{constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: absolute; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=e.dispatch||(t=>this.update([t])),this.dispatch=this.dispatch.bind(this),this._root=e.root||nc(e.parent)||document,this.viewState=new io(e.state||N.create(e)),this.plugins=this.state.facet(Yt).map(t=>new En(t));for(let t of this.plugins)t.update(this);this.observer=new cf(this),this.inputState=new Rc(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Wr(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...e){this._dispatch(e.length==1&&e[0]instanceof Q?e[0]:this.state.update(...e))}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let a of e){if(a.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=a.state}if(this.destroyed){this.viewState.state=r;return}let o=this.observer.delayedAndroidKey,l=null;if(o?(this.observer.clearDelayedAndroidKey(),l=this.observer.readChange(),(l&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(l=null)):this.observer.clear(),r.facet(N.phrases)!=this.state.facet(N.phrases))return this.setState(r);s=Zi.create(this,r,e);let h=this.viewState.scrollTarget;try{this.updateState=2;for(let a of e){if(h&&(h=h.map(a.changes)),a.scrollIntoView){let{main:c}=a.state.selection;h=new Qi(c.empty?c:b.cursor(c.head,c.head>c.anchor?-1:1))}for(let c of a.effects)c.is(Nr)&&(h=c.value)}this.viewState.update(s,h),this.bidiCache=en.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Qt)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(a=>a.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Bi)!=s.state.facet(Bi)&&(this.viewState.mustMeasureContent=!0),(t||i||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!s.empty)for(let a of this.state.facet(ys))a(s);l&&!ih(this,l)&&o.force&&Rt(this.contentDOM,o.key,o.keyCode)}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new io(e),this.plugins=e.facet(Yt).map(i=>new En(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView=new Wr(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Yt),i=e.state.facet(Yt);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new En(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,{scrollHeight:i,scrollTop:s,clientHeight:r}=this.scrollDOM,o=s>i-r-4?i:s;try{for(let l=0;;l++){this.updateState=1;let h=this.viewport,a=this.viewState.lineBlockAtHeight(o),c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let f=[];c&4||([this.measureRequests,f]=[f,this.measureRequests]);let u=f.map(g=>{try{return g.read(this)}catch(y){return Ee(this.state,y),ro}}),d=Zi.create(this,this.state,[]),p=!1,m=!1;d.flags|=c,t?t.flags|=c:t=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),p=this.docView.update(d));for(let g=0;g1||g<-1)&&(this.scrollDOM.scrollTop+=g,m=!0)}if(p&&this.docView.updateSelection(!0),this.viewport.from==h.from&&this.viewport.to==h.to&&!m&&this.measureRequests.length==0)break}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(ys))l(t)}get themeClasses(){return Cs+" "+(this.state.facet(Ss)?eh:Zl)+" "+this.state.facet(Bi)}updateAttrs(){let e=oo(this,El,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(vn)?"true":"false",class:"cm-content",style:`${C.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),oo(this,Il,t);let i=this.observer.ignore(()=>{let s=gs(this.contentDOM,this.contentAttrs,t),r=gs(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(O.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Qt),ot.mount(this.root,this.styleModules.concat(sf).reverse())}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(e.key!=null){for(let t=0;ti.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Nn(this,e,jr(this,e,t,i))}moveByGroup(e,t){return Nn(this,e,jr(this,e,t,i=>Bc(this,e.head,i)))}moveToLineBoundary(e,t,i=!0){return Tc(this,e,t,i)}moveVertically(e,t,i){return Nn(this,e,Pc(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Kl(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[Lt.find(r,e-s.from,-1,t)];return Ks(i,o.dir==_.LTR==t>0)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Ll)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>uf)return Wl(e.length);let t=this.textDirectionAt(e.from);for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t)return s.order;let i=gc(e.text,t);return this.bidiCache.push(new en(e.from,e.to,t,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||C.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{gl(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Nr.of(new Qi(typeof e=="number"?b.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return de.define(()=>({}),{eventHandlers:e})}static theme(e,t){let i=ot.newName(),s=[Bi.of(i),Qt.of(As(`.${i}`,e))];return t&&t.dark&&s.push(Ss.of(!0)),s}static baseTheme(e){return kt.lowest(Qt.of(As("."+Cs,e,th)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&H.get(i)||H.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}O.styleModule=Qt;O.inputHandler=Rl;O.perLineTextDirection=Ll;O.exceptionSink=Pl;O.updateListener=ys;O.editable=vn;O.mouseSelectionStyle=Bl;O.dragMovesSelection=Tl;O.clickAddsSelectionRange=Ol;O.decorations=ui;O.atomicRanges=Nl;O.scrollMargins=Vl;O.darkTheme=Ss;O.contentAttributes=Il;O.editorAttributes=El;O.lineWrapping=O.contentAttributes.of({class:"cm-lineWrapping"});O.announce=L.define();const uf=4096,ro={};class en{constructor(e,t,i,s){this.from=e,this.to=t,this.dir=i,this.order=s}static update(e,t){if(t.empty)return e;let i=[],s=e.length?e[e.length-1].dir:_.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&ps(o,t)}return t}const df=C.mac?"mac":C.windows?"win":C.linux?"linux":"key";function pf(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let h=0;hi.concat(s),[]))),t}function mf(n,e,t){return sh(nh(n.state),e,n,t)}let Ze=null;const yf=4e3;function bf(n,e=df){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let h=i[o];if(h==null)i[o]=l;else if(h!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,h,a)=>{var c,f;let u=t[o]||(t[o]=Object.create(null)),d=l.split(/ (?!$)/).map(g=>pf(g,e));for(let g=1;g{let k=Ze={view:v,prefix:y,scope:o};return setTimeout(()=>{Ze==k&&(Ze=null)},yf),!0}]})}let p=d.join(" ");s(p,!1);let m=u[p]||(u[p]={preventDefault:!1,run:((f=(c=u._any)===null||c===void 0?void 0:c.run)===null||f===void 0?void 0:f.slice())||[]});h&&m.run.push(h),a&&(m.preventDefault=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let a of l){let c=t[a]||(t[a]=Object.create(null));c._any||(c._any={preventDefault:!1,run:[]});for(let f in c)c[f].run.push(o.any)}let h=o[e]||o.key;if(!!h)for(let a of l)r(a,h,o.run,o.preventDefault),o.shift&&r(a,"Shift-"+h,o.shift,o.preventDefault)}return t}function sh(n,e,t,i){let s=Qa(e),r=ie(s,0),o=Se(r)==s.length&&s!=" ",l="",h=!1;Ze&&Ze.view==t&&Ze.scope==i&&(l=Ze.prefix+" ",(h=Ul.indexOf(e.keyCode)<0)&&(Ze=null));let a=new Set,c=p=>{if(p){for(let m of p.run)if(!a.has(m)&&(a.add(m),m(t,e)))return!0;p.preventDefault&&(h=!0)}return!1},f=n[i],u,d;if(f){if(c(f[l+Pi(s,e,!o)]))return!0;if(o&&(e.shiftKey||e.altKey||e.metaKey||r>127)&&(u=lt[e.keyCode])&&u!=s){if(c(f[l+Pi(u,e,!0)]))return!0;if(e.shiftKey&&(d=ai[e.keyCode])!=s&&d!=u&&c(f[l+Pi(d,e,!1)]))return!0}else if(o&&e.shiftKey&&c(f[l+Pi(s,e,!0)]))return!0;if(c(f._any))return!0}return h}const rh=!C.ios,ei=D.define({combine(n){return Ct(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function ag(n={}){return[ei.of(n),wf,xf]}class oh{constructor(e,t,i,s,r){this.left=e,this.top=t,this.width=i,this.height=s,this.className=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width>=0&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}}const wf=de.fromClass(class{constructor(n){this.view=n,this.rangePieces=[],this.cursors=[],this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.selectionLayer=n.scrollDOM.appendChild(document.createElement("div")),this.selectionLayer.className="cm-selectionLayer",this.selectionLayer.setAttribute("aria-hidden","true"),this.cursorLayer=n.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),n.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){this.cursorLayer.style.animationDuration=this.view.state.facet(ei).cursorBlinkRate+"ms"}update(n){let e=n.startState.facet(ei)!=n.state.facet(ei);(e||n.selectionSet||n.geometryChanged||n.viewportChanged)&&this.view.requestMeasure(this.measureReq),n.transactions.some(t=>t.scrollIntoView)&&(this.cursorLayer.style.animationName=this.cursorLayer.style.animationName=="cm-blink"?"cm-blink2":"cm-blink"),e&&this.setBlinkRate()}readPos(){let{state:n}=this.view,e=n.facet(ei),t=n.selection.ranges.map(s=>s.empty?[]:vf(this.view,s)).reduce((s,r)=>s.concat(r)),i=[];for(let s of n.selection.ranges){let r=s==n.selection.main;if(s.empty?!r||rh:e.drawRangeCursor){let o=kf(this.view,s,r);o&&i.push(o)}}return{rangePieces:t,cursors:i}}drawSel({rangePieces:n,cursors:e}){if(n.length!=this.rangePieces.length||n.some((t,i)=>!t.eq(this.rangePieces[i]))){this.selectionLayer.textContent="";for(let t of n)this.selectionLayer.appendChild(t.draw());this.rangePieces=n}if(e.length!=this.cursors.length||e.some((t,i)=>!t.eq(this.cursors[i]))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent="";for(const i of e)this.cursorLayer.appendChild(i.draw())}else e.forEach((i,s)=>i.adjust(t[s]));this.cursors=e}}destroy(){this.selectionLayer.remove(),this.cursorLayer.remove()}}),lh={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};rh&&(lh[".cm-line"].caretColor="transparent !important");const xf=kt.highest(O.theme(lh));function hh(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==_.LTR?e.left:e.right-n.scrollDOM.clientWidth)-n.scrollDOM.scrollLeft,top:e.top-n.scrollDOM.scrollTop}}function ho(n,e,t){let i=b.cursor(e);return{from:Math.max(t.from,n.moveToLineBoundary(i,!1,!0).from),to:Math.min(t.to,n.moveToLineBoundary(i,!0,!0).from),type:q.Text}}function ao(n,e){let t=n.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==q.Text))return i}return t}function vf(n,e){if(e.to<=n.viewport.from||e.from>=n.viewport.to)return[];let t=Math.max(e.from,n.viewport.from),i=Math.min(e.to,n.viewport.to),s=n.textDirection==_.LTR,r=n.contentDOM,o=r.getBoundingClientRect(),l=hh(n),h=window.getComputedStyle(r.firstChild),a=o.left+parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)),c=o.right-parseInt(h.paddingRight),f=ao(n,t),u=ao(n,i),d=f.type==q.Text?f:null,p=u.type==q.Text?u:null;if(n.lineWrapping&&(d&&(d=ho(n,t,d)),p&&(p=ho(n,i,p))),d&&p&&d.from==p.from)return g(y(e.from,e.to,d));{let k=d?y(e.from,null,d):v(f,!1),S=p?y(null,e.to,p):v(u,!0),A=[];return(d||f).to<(p||u).from-1?A.push(m(a,k.bottom,c,S.top)):k.bottomP&&U.from=xe)break;ee>X&&E(Math.max(Re,X),k==null&&Re<=P,Math.min(ee,xe),S==null&&ee>=V,ce.dir)}if(X=se.to+1,X>=xe)break}return j.length==0&&E(P,k==null,V,S==null,n.textDirection),{top:M,bottom:B,horizontal:j}}function v(k,S){let A=o.top+(S?k.top:k.bottom);return{top:A,bottom:A,horizontal:[]}}}function kf(n,e,t){let i=n.coordsAtPos(e.head,e.assoc||1);if(!i)return null;let s=hh(n);return new oh(i.left-s.left,i.top-s.top,-1,i.bottom-i.top,t?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary")}const ah=L.define({map(n,e){return n==null?null:e.mapPos(n)}}),ti=me.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(ah)?i.value:t,n)}}),Sf=de.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(ti);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(ti)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let n=this.view.state.field(ti),e=n!=null&&this.view.coordsAtPos(n);if(!e)return null;let t=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-t.left+this.view.scrollDOM.scrollLeft,top:e.top-t.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(ti)!=n&&this.view.dispatch({effects:ah.of(n)})}},{eventHandlers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function cg(){return[ti,Sf]}function co(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function Cf(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class Af{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,h,a,c)=>s(c,a,a+l[0].length,l,h);else if(typeof i=="function")this.addMatch=(l,h,a,c)=>{let f=i(l,h,a);f&&c(a,a+l[0].length,f)};else if(i)this.addMatch=(l,h,a,c)=>c(a,a+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new bt,i=t.add.bind(t);for(let{from:s,to:r}of Cf(e,this.maxLength))co(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,h)=>{h>e.view.viewport.from&&l1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>o){let h=e.state.doc.lineAt(o),a=h.toh.from;o--)if(this.boundary.test(h.text[o-1-h.from])){c=o;break}for(;lu.push(y.range(m,g));if(h==a)for(this.regexp.lastIndex=c-h.from;(d=this.regexp.exec(h.text))&&d.indexthis.addMatch(g,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:u})}}return t}}const Ms=/x/.unicode!=null?"gu":"g",Mf=new RegExp(`[\0-\b +-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,Ms),Df={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Wn=null;function Of(){var n;if(Wn==null&&typeof document<"u"&&document.body){let e=document.body.style;Wn=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Wn||!1}const ji=D.define({combine(n){let e=Ct(n,{render:null,specialChars:Mf,addSpecialChars:null});return(e.replaceTabs=!Of())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Ms)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Ms)),e}});function fg(n={}){return[ji.of(n),Tf()]}let fo=null;function Tf(){return fo||(fo=de.fromClass(class{constructor(n){this.view=n,this.decorations=T.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(ji)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Af({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=ie(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,h=bi(o.text,l,i-o.from);return T.replace({widget:new Lf((l-h%l)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=T.replace({widget:new Rf(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(ji);n.startState.facet(ji)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Bf="\u2022";function Pf(n){return n>=32?Bf:n==10?"\u2424":String.fromCharCode(9216+n)}class Rf extends at{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Pf(this.code),i=e.state.phrase("Control character")+" "+(Df[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Lf extends at{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}class Ef extends at{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}ignoreEvent(){return!1}}function ug(n){return de.fromClass(class{constructor(e){this.view=e,this.placeholder=T.set([T.widget({widget:new Ef(n),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?T.none:this.placeholder}},{decorations:e=>e.decorations})}const Ds=2e3;function If(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Ds||t.off>Ds||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let h=i;h<=s;h++){let a=n.doc.line(h);a.length<=l&&r.push(b.range(a.from+o,a.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let h=i;h<=s;h++){let a=n.doc.line(h),c=os(a.text,o,n.tabSize,!0);if(c<0)r.push(b.cursor(a.to));else{let f=os(a.text,l,n.tabSize);r.push(b.range(a.from+c,a.from+f))}}}return r}function Nf(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function uo(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>Ds?-1:s==i.length?Nf(n,e.clientX):bi(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function Vf(n,e){let t=uo(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=uo(n,s);if(!l)return i;let h=If(n.state,t,l);return h.length?o?b.create(h.concat(i.ranges)):b.create(h):i}}:null}function dg(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return O.mouseSelectionStyle.of((t,i)=>e(i)?Vf(t,i):null)}const Hn="-10000px";class Ff{constructor(e,t,i){this.facet=t,this.createTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(s=>s),this.tooltipViews=this.tooltips.map(i)}update(e){var t;let i=e.state.facet(this.facet),s=i.filter(o=>o);if(i===this.input){for(let o of this.tooltipViews)o.update&&o.update(e);return!1}let r=[];for(let o=0;o{var e,t,i;return{position:C.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Wf}}}),ch=de.fromClass(class{constructor(n){this.view=n,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(zn);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Ff(n,fh,t=>this.createTooltip(t)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(zn);if(i.position!=this.position){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n){let e=n.create(this.view);if(e.dom.classList.add("cm-tooltip"),n.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Hn,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var n,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(n=t.destroy)===null||n===void 0||n.call(t);(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=this.view.dom.getBoundingClientRect();return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map((e,t)=>{let i=this.manager.tooltipViews[t];return i.getCoords?i.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(zn).tooltipSpace(this.view)}}writeMeasure(n){let{editor:e,space:t}=n,i=[];for(let s=0;s=Math.min(e.bottom,t.bottom)||h.rightMath.min(e.right,t.right)+.1){l.style.top=Hn;continue}let c=r.arrow?o.dom.querySelector(".cm-tooltip-arrow"):null,f=c?7:0,u=a.right-a.left,d=a.bottom-a.top,p=o.offset||zf,m=this.view.textDirection==_.LTR,g=a.width>t.right-t.left?m?t.left:t.right-a.width:m?Math.min(h.left-(c?14:0)+p.x,t.right-u):Math.max(t.left,h.left-u+(c?14:0)-p.x),y=!!r.above;!r.strictSide&&(y?h.top-(a.bottom-a.top)-p.yt.bottom)&&y==t.bottom-h.bottom>h.top-t.top&&(y=!y);let v=y?h.top-d-f-p.y:h.bottom+f+p.y,k=g+u;if(o.overlap!==!0)for(let S of i)S.leftg&&S.topv&&(v=y?S.top-d-2-f:S.bottom+f+2);this.position=="absolute"?(l.style.top=v-n.parent.top+"px",l.style.left=g-n.parent.left+"px"):(l.style.top=v+"px",l.style.left=g+"px"),c&&(c.style.left=`${h.left+(m?p.x:-p.x)-(g+14-7)}px`),o.overlap!==!0&&i.push({left:g,top:v,right:k,bottom:v+d}),l.classList.toggle("cm-tooltip-above",y),l.classList.toggle("cm-tooltip-below",!y),o.positioned&&o.positioned()}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Hn}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Hf=O.baseTheme({".cm-tooltip":{zIndex:100},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:`${7}px`,width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:`${7}px solid transparent`,borderRight:`${7}px solid transparent`},".cm-tooltip-above &":{bottom:`-${7}px`,"&:before":{borderTop:`${7}px solid #bbb`},"&:after":{borderTop:`${7}px solid #f5f5f5`,bottom:"1px"}},".cm-tooltip-below &":{top:`-${7}px`,"&:before":{borderBottom:`${7}px solid #bbb`},"&:after":{borderBottom:`${7}px solid #f5f5f5`,top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),zf={x:0,y:0},fh=D.define({enables:[ch,Hf]});function qf(n,e){let t=n.plugin(ch);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const po=D.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function tn(n,e){let t=n.plugin(uh),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const uh=de.fromClass(class{constructor(n){this.input=n.state.facet(nn),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(po);this.top=new Ri(n,!0,e.topContainer),this.bottom=new Ri(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(po);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ri(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ri(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(nn);if(t!=this.input){let i=t.filter(h=>h),s=[],r=[],o=[],l=[];for(let h of i){let a=this.specs.indexOf(h),c;a<0?(c=h(n.view),l.push(c)):(c=this.panels[a],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let h of l)h.dom.classList.add("cm-panel"),h.mount&&h.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>O.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Ri{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=go(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=go(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function go(n){let e=n.nextSibling;return n.remove(),e}const nn=D.define({enables:uh});class xt extends yt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}xt.prototype.elementClass="";xt.prototype.toDOM=void 0;xt.prototype.mapMode=le.TrackBefore;xt.prototype.startSide=xt.prototype.endSide=-1;xt.prototype.point=!0;const $f=D.define(),Kf=new class extends xt{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},jf=$f.compute(["selection"],n=>{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(Kf.range(s)))}return K.of(e)});function pg(){return jf}const Uf=1024;let Gf=0;class Me{constructor(e,t){this.from=e,this.to=t}}class R{constructor(e={}){this.id=Gf++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=pe.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}R.closedBy=new R({deserialize:n=>n.split(" ")});R.openedBy=new R({deserialize:n=>n.split(" ")});R.group=new R({deserialize:n=>n.split(" ")});R.contextHash=new R({perNode:!0});R.lookAhead=new R({perNode:!0});R.mounted=new R({perNode:!0});class Jf{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}}const _f=Object.create(null);class pe{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):_f,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new pe(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(R.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(R.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}pe.none=new pe("",Object.create(null),0,8);class Xs{constructor(e){this.types=e;for(let t=0;t=s&&(o.type.isAnonymous||t(o)!==!1)){if(o.firstChild())continue;l=!0}for(;l&&i&&!o.type.isAnonymous&&i(o),!o.nextSibling();){if(!o.parent())return;l=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Zs(pe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new F(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new F(pe.none,t,i,s)))}static build(e){return Yf(e)}}F.empty=new F(pe.none,[],[],0);class Ys{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Ys(this.buffer,this.index)}}class At{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return pe.none}toString(){let e=[];for(let t=0;t0));h=o[h+3]);return l}slice(e,t,i,s){let r=this.buffer,o=new Uint16Array(t-e);for(let l=e,h=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function ph(n,e){let t=n.childBefore(e);for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}function Ft(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=a;e+=t){let c=l[e],f=h[e]+o.from;if(!!dh(s,i,f,f+c.length)){if(c instanceof At){if(r&G.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,s);if(u>-1)return new qe(new Xf(o,c,e,f),null,u)}else if(r&G.IncludeAnonymous||!c.type.isAnonymous||Qs(c)){let u;if(!(r&G.IgnoreMounts)&&c.props&&(u=c.prop(R.mounted))&&!u.overlay)return new Te(u.tree,f,e,o);let d=new Te(c,f,e,o);return r&G.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,s)}}}if(r&G.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let s;if(!(i&G.IgnoreOverlays)&&(s=this._tree.prop(R.mounted))&&s.overlay){let r=e-this.from;for(let{from:o,to:l}of s.overlay)if((t>0?o<=r:o=r:l>r))return new Te(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new di(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return Ft(this,e,t,!1)}resolveInner(e,t=0){return Ft(this,e,t,!0)}enterUnfinishedNodesBefore(e){return ph(this,e)}getChild(e,t=null,i=null){let s=sn(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return sn(this,e,t,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return rn(this,e)}}function sn(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(;!s.type.is(t);)if(!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function rn(n,e,t=e.length-1){for(let i=n.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Xf{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class qe{constructor(e,t,i){this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new qe(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&G.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new qe(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new qe(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new qe(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new di(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1],l=i.buffer[this.index+2];e.push(i.slice(s,r,o,l)),t.push(0)}return new F(this.type,e,t,this.to-this.from)}resolve(e,t=0){return Ft(this,e,t,!1)}resolveInner(e,t=0){return Ft(this,e,t,!0)}enterUnfinishedNodesBefore(e){return ph(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,i=null){let s=sn(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return sn(this,e,t,i)}get node(){return this}matchContext(e){return rn(this,e)}}class di{constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Te)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}get name(){return this.type.name}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof Te?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&G.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&G.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&G.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&G.IncludeAnonymous||l instanceof At||!l.type.isAnonymous||Qs(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}}for(let s=i;s=0;r--){if(r<0)return rn(this.node,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function Qs(n){return n.children.some(e=>e instanceof At||!e.type.isAnonymous||Qs(e))}function Yf(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Uf,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new Ys(t,t.length):t,h=i.types,a=0,c=0;function f(S,A,M,B,j){let{id:E,start:P,end:V,size:U}=l,X=c;for(;U<0;)if(l.next(),U==-1){let ee=r[E];M.push(ee),B.push(P-S);return}else if(U==-3){a=E;return}else if(U==-4){c=E;return}else throw new RangeError(`Unrecognized record size: ${U}`);let xe=h[E],se,ce,Re=P-S;if(V-P<=s&&(ce=m(l.pos-A,j))){let ee=new Uint16Array(ce.size-ce.skip),Le=l.pos-ce.size,Je=ee.length;for(;l.pos>Le;)Je=g(ce.start,ee,Je);se=new At(ee,V-ce.start,i),Re=ce.start-S}else{let ee=l.pos-U;l.next();let Le=[],Je=[],ft=E>=o?E:-1,Mt=0,ki=V;for(;l.pos>ee;)ft>=0&&l.id==ft&&l.size>=0?(l.end<=ki-s&&(d(Le,Je,P,Mt,l.end,ki,ft,X),Mt=Le.length,ki=l.end),l.next()):f(P,ee,Le,Je,ft);if(ft>=0&&Mt>0&&Mt-1&&Mt>0){let yr=u(xe);se=Zs(xe,Le,Je,0,Le.length,0,V-P,yr,yr)}else se=p(xe,Le,Je,V-P,X-V)}M.push(se),B.push(Re)}function u(S){return(A,M,B)=>{let j=0,E=A.length-1,P,V;if(E>=0&&(P=A[E])instanceof F){if(!E&&P.type==S&&P.length==B)return P;(V=P.prop(R.lookAhead))&&(j=M[E]+P.length+V)}return p(S,A,M,B,j)}}function d(S,A,M,B,j,E,P,V){let U=[],X=[];for(;S.length>B;)U.push(S.pop()),X.push(A.pop()+M-j);S.push(p(i.types[P],U,X,E-j,V-E)),A.push(j-M)}function p(S,A,M,B,j=0,E){if(a){let P=[R.contextHash,a];E=E?[P].concat(E):[P]}if(j>25){let P=[R.lookAhead,j];E=E?[P].concat(E):[P]}return new F(S,A,M,B,E)}function m(S,A){let M=l.fork(),B=0,j=0,E=0,P=M.end-s,V={size:0,start:0,skip:0};e:for(let U=M.pos-S;M.pos>U;){let X=M.size;if(M.id==A&&X>=0){V.size=B,V.start=j,V.skip=E,E+=4,B+=4,M.next();continue}let xe=M.pos-X;if(X<0||xe=o?4:0,ce=M.start;for(M.next();M.pos>xe;){if(M.size<0)if(M.size==-3)se+=4;else break e;else M.id>=o&&(se+=4);M.next()}j=ce,B+=X,E+=se}return(A<0||B==S)&&(V.size=B,V.start=j,V.skip=E),V.size>4?V:void 0}function g(S,A,M){let{id:B,start:j,end:E,size:P}=l;if(l.next(),P>=0&&B4){let U=l.pos-(P-4);for(;l.pos>U;)M=g(S,A,M)}A[--M]=V,A[--M]=E-S,A[--M]=j-S,A[--M]=B}else P==-3?a=B:P==-4&&(c=B);return M}let y=[],v=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,y,v,-1);let k=(e=n.length)!==null&&e!==void 0?e:y.length?v[0]+y[0].length:0;return new F(h[n.topID],y.reverse(),v.reverse(),k)}const yo=new WeakMap;function Ui(n,e){if(!n.isAnonymous||e instanceof At||e.type!=n)return 1;let t=yo.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof F)){t=1;break}t+=Ui(n,i)}yo.set(e,t)}return t}function Zs(n,e,t,i,s,r,o,l,h){let a=0;for(let p=i;p=c)break;M+=B}if(k==S+1){if(M>c){let B=p[S];d(B.children,B.positions,0,B.children.length,m[S]+v);continue}f.push(p[S])}else{let B=m[k-1]+p[k-1].length-A;f.push(Zs(n,p,m,S,k,A,B,null,h))}u.push(A+v-r)}}return d(e,t,i,s,0),(l||h)(f,u,o)}class gg{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof qe?this.setBuffer(e.context.buffer,e.index,t):e instanceof Te&&this.map.set(e.tree,t)}get(e){return e instanceof qe?this.getBuffer(e.context.buffer,e.index):e instanceof Te?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xe{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new Xe(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,h=0,a=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||a){let d=Math.max(u.from,h)-a,p=Math.min(u.to,f)-a;u=d>=p?null:new Xe(d,p,u.tree,u.offset+a,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew Me(s.from,s.to)):[new Me(0,0)]:[new Me(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class Qf{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function mg(n){return(e,t,i,s)=>new eu(e,n,t,i,s)}class bo{constructor(e,t,i,s,r){this.parser=e,this.parse=t,this.overlay=i,this.target=s,this.ranges=r}}class Zf{constructor(e,t,i,s,r,o,l){this.parser=e,this.predicate=t,this.mounts=i,this.index=s,this.start=r,this.target=o,this.prev=l,this.depth=0,this.ranges=[]}}const Os=new R({perNode:!0});class eu{constructor(e,t,i,s,r){this.nest=t,this.input=i,this.fragments=s,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let s of this.inner)s.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new F(i.type,i.children,i.positions,i.length,i.propValues.concat([[Os,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[R.mounted.id]=new Jf(t,e.overlay,e.parser),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;tc.frag.from<=s.from&&c.frag.to>=s.to&&c.mount.overlay);if(a)for(let c of a.mount.overlay){let f=c.from+a.pos,u=c.to+a.pos;f>=s.from&&u<=s.to&&!t.ranges.some(d=>d.fromf)&&t.ranges.push({from:f,to:u})}}l=!1}else if(i&&(o=tu(i.ranges,s.from,s.to)))l=o!=2;else if(!s.type.isAnonymous&&s.fromnew Me(f.from-s.from,f.to-s.from)):null,s.tree,c)),r.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else t&&(h=t.predicate(s))&&(h===!0&&(h=new Me(s.from,s.to)),h.fromnew Me(c.from-t.start,c.to-t.start)),t.target,a)),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function tu(n,e,t){for(let i of n){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function wo(n,e,t,i,s,r){if(e=e.to);i++);let o=s.children[i],l=o.buffer;function h(a,c,f,u,d){let p=a;for(;l[p+2]+r<=e.from;)p=l[p+3];let m=[],g=[];wo(o,a,p,m,g,u);let y=l[p+1],v=l[p+2],k=y+r==e.from&&v+r==e.to&&l[p]==e.type.id;return m.push(k?e.toTree():h(p+4,l[p+3],o.set.types[l[p]],y,v-y)),g.push(y-u),wo(o,l[p+3],c,m,g,u),new F(f,m,g,d)}s.children[i]=h(0,l.length,pe.none,0,o.length);for(let a=0;a<=t;a++)n.childAfter(e.from)}class xo{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(G.IncludeAnonymous|G.IgnoreMounts)}moveTo(e){let{cursor:t}=this,i=e-this.offset;for(;!this.done&&t.from=e&&t.enter(i,1,G.IgnoreOverlays|G.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof F)t=t.children[0];else break}return!1}}class nu{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(Os))!==null&&t!==void 0?t:i.to,this.inner=new xo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Os))!==null&&e!==void 0?e:t.to,this.inner=new xo(t.tree,-t.offset)}}findMounts(e,t){var i;let s=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let r=this.inner.cursor.node;r;r=r.parent){let o=(i=r.tree)===null||i===void 0?void 0:i.prop(R.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=r.to)break;h.tree==this.curFrag.tree&&s.push({frag:h,pos:r.from-h.offset,mount:o})}}}return s}}function vo(n,e){let t=null,i=e;for(let s=1,r=0;s=l)break;h.to<=o||(t||(i=t=e.slice()),h.froml&&t.splice(r+1,0,new Me(l,h.to))):h.to>l?t[r--]=new Me(l,h.to):t.splice(r--,1))}}return i}function su(n,e,t,i){let s=0,r=0,o=!1,l=!1,h=-1e9,a=[];for(;;){let c=s==n.length?1e9:o?n[s].to:n[s].from,f=r==e.length?1e9:l?e[r].to:e[r].from;if(o!=l){let u=Math.max(h,t),d=Math.min(c,f,i);unew Me(u.from+i,u.to+i)),f=su(e,c,h,a);for(let u=0,d=h;;u++){let p=u==f.length,m=p?a:f[u].from;if(m>d&&t.push(new Xe(d,m,s.tree,-o,r.from>=d||r.openStart,r.to<=m||r.openEnd)),p)break;d=f[u].to}}else t.push(new Xe(h,a,s.tree,-o,r.from>=o||r.openStart,r.to<=l||r.openEnd))}return t}let ru=0;class He{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=ru++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new He([],null,[]);if(t.set.push(t),e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new on;return t=>t.modified.indexOf(e)>-1?t:on.get(t.base||t,t.modified.concat(e).sort((i,s)=>i.id-s.id))}}let ou=0;class on{constructor(){this.instances=[],this.id=ou++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&lu(t,l.modified));if(i)return i;let s=[],r=new He(s,e,t);for(let l of t)l.instances.push(r);let o=hu(t);for(let l of e.set)if(!l.modified.length)for(let h of o)s.push(on.get(l,h));return r}}function lu(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function hu(n){let e=[[]];for(let t=0;ti.length-t.length)}function au(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let h=r.length-1,a=r[h];if(!a)throw new RangeError("Invalid path: "+s);let c=new ln(i,o,h>0?r.slice(0,h):null);e[a]=c.sort(e[a])}}return mh.add(e)}const mh=new R;class ln{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let h of l.set){let a=t[h.id];if(a){o=o?o+" "+a:a;break}}return o},scope:i}}function cu(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function fu(n,e,t,i=0,s=n.length){let r=new uu(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class uu{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:h}=e;if(l>=i||h<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let a=s,c=du(e)||ln.empty,f=cu(r,c.tags);if(f&&(a&&(a+=" "),a+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(e.from,a),c.opaque)return;let u=e.tree&&e.tree.prop(R.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),m=e.firstChild();for(let g=0,y=l;;g++){let v=g=k||!e.nextSibling())););if(!v||k>i)break;y=v.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,v.from+l),Math.min(i,y),s,p),this.startSpan(y,a))}m&&e.parent()}else if(e.firstChild()){do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),a)}while(e.nextSibling());e.parent()}}}function du(n){let e=n.type.prop(mh);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const w=He.define,Ei=w(),Ye=w(),So=w(Ye),Co=w(Ye),Qe=w(),Ii=w(Qe),qn=w(Qe),We=w(),ut=w(We),Ve=w(),Fe=w(),Ts=w(),Jt=w(Ts),Ni=w(),x={comment:Ei,lineComment:w(Ei),blockComment:w(Ei),docComment:w(Ei),name:Ye,variableName:w(Ye),typeName:So,tagName:w(So),propertyName:Co,attributeName:w(Co),className:w(Ye),labelName:w(Ye),namespace:w(Ye),macroName:w(Ye),literal:Qe,string:Ii,docString:w(Ii),character:w(Ii),attributeValue:w(Ii),number:qn,integer:w(qn),float:w(qn),bool:w(Qe),regexp:w(Qe),escape:w(Qe),color:w(Qe),url:w(Qe),keyword:Ve,self:w(Ve),null:w(Ve),atom:w(Ve),unit:w(Ve),modifier:w(Ve),operatorKeyword:w(Ve),controlKeyword:w(Ve),definitionKeyword:w(Ve),moduleKeyword:w(Ve),operator:Fe,derefOperator:w(Fe),arithmeticOperator:w(Fe),logicOperator:w(Fe),bitwiseOperator:w(Fe),compareOperator:w(Fe),updateOperator:w(Fe),definitionOperator:w(Fe),typeOperator:w(Fe),controlOperator:w(Fe),punctuation:Ts,separator:w(Ts),bracket:Jt,angleBracket:w(Jt),squareBracket:w(Jt),paren:w(Jt),brace:w(Jt),content:We,heading:ut,heading1:w(ut),heading2:w(ut),heading3:w(ut),heading4:w(ut),heading5:w(ut),heading6:w(ut),contentSeparator:w(We),list:w(We),quote:w(We),emphasis:w(We),strong:w(We),link:w(We),monospace:w(We),strikethrough:w(We),inserted:w(),deleted:w(),changed:w(),invalid:w(),meta:Ni,documentMeta:w(Ni),annotation:w(Ni),processingInstruction:w(Ni),definition:He.defineModifier(),constant:He.defineModifier(),function:He.defineModifier(),standard:He.defineModifier(),local:He.defineModifier(),special:He.defineModifier()};yh([{tag:x.link,class:"tok-link"},{tag:x.heading,class:"tok-heading"},{tag:x.emphasis,class:"tok-emphasis"},{tag:x.strong,class:"tok-strong"},{tag:x.keyword,class:"tok-keyword"},{tag:x.atom,class:"tok-atom"},{tag:x.bool,class:"tok-bool"},{tag:x.url,class:"tok-url"},{tag:x.labelName,class:"tok-labelName"},{tag:x.inserted,class:"tok-inserted"},{tag:x.deleted,class:"tok-deleted"},{tag:x.literal,class:"tok-literal"},{tag:x.string,class:"tok-string"},{tag:x.number,class:"tok-number"},{tag:[x.regexp,x.escape,x.special(x.string)],class:"tok-string2"},{tag:x.variableName,class:"tok-variableName"},{tag:x.local(x.variableName),class:"tok-variableName tok-local"},{tag:x.definition(x.variableName),class:"tok-variableName tok-definition"},{tag:x.special(x.variableName),class:"tok-variableName2"},{tag:x.definition(x.propertyName),class:"tok-propertyName tok-definition"},{tag:x.typeName,class:"tok-typeName"},{tag:x.namespace,class:"tok-namespace"},{tag:x.className,class:"tok-className"},{tag:x.macroName,class:"tok-macroName"},{tag:x.propertyName,class:"tok-propertyName"},{tag:x.operator,class:"tok-operator"},{tag:x.comment,class:"tok-comment"},{tag:x.meta,class:"tok-meta"},{tag:x.invalid,class:"tok-invalid"},{tag:x.punctuation,class:"tok-punctuation"}]);var $n;const Wt=new R;function bh(n){return D.define({combine:n?e=>e.concat(n):void 0})}class De{constructor(e,t,i=[],s=""){this.data=e,this.name=s,N.prototype.hasOwnProperty("tree")||Object.defineProperty(N.prototype,"tree",{get(){return ge(this)}}),this.parser=t,this.extension=[qt.of(this),N.languageData.of((r,o,l)=>r.facet(Ao(r,o,l)))].concat(i)}isActiveAt(e,t,i=-1){return Ao(e,t,i)==this.data}findRegions(e){let t=e.facet(qt);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(Wt)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(R.mounted);if(l){if(l.tree.prop(Wt)==this.data){if(l.overlay)for(let h of l.overlay)i.push({from:h.from+o,to:h.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let h=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>h)return}}for(let h=0;hi.isTop?t:void 0)]}),e.name)}configure(e,t){return new Bs(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ge(n){let e=n.field(De.state,!1);return e?e.tree:F.empty}class pu{constructor(e,t=e.length){this.doc=e,this.length=t,this.cursorPos=0,this.string="",this.cursor=e.iter()}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let _t=null;class Ht{constructor(e,t,i=[],s,r,o,l,h){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Ht(e,t,[],F.empty,0,i,[],null)}startParse(){return this.parser.startParse(new pu(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=F.empty&&this.isDone(t!=null?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Xe.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=_t;_t=this;try{return e()}finally{_t=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Mo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let h=[];if(e.iterChangedRanges((a,c,f,u)=>h.push({fromA:a,toA:c,fromB:f,toB:u})),i=Xe.applyChanges(i,h),s=F.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let a of this.skipped){let c=e.mapPos(a.from,1),f=e.mapPos(a.to,-1);ce.from&&(this.fragments=Mo(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends gh{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let h=_t;if(h){for(let a of s)h.tempSkipped.push(a);e&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,e]):e)}return this.parsedPos=o,new F(pe.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return _t}}function Mo(n,e,t){return Xe.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class zt{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new zt(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Ht.create(e.facet(qt).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new zt(i)}}De.state=me.define({create:zt.init,update(n,e){for(let t of e.effects)if(t.is(De.setState))return t.value;return e.startState.facet(qt)!=e.state.facet(qt)?zt.init(e.state):n.apply(e)}});let wh=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(wh=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Kn=typeof navigator<"u"&&(($n=navigator.scheduling)===null||$n===void 0?void 0:$n.isInputPending)?()=>navigator.scheduling.isInputPending():null,gu=de.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(De.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(De.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=wh(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,h=r.context.work(()=>Kn&&Kn()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(h||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:De.setState.of(new zt(r.context))})),this.chunkBudget>0&&!(h&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ee(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),qt=D.define({combine(n){return n.length?n[0]:null},enables:n=>[De.state,gu,O.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class bg{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const xh=D.define(),kn=D.define({combine:n=>{if(!n.length)return" ";if(!/^(?: +|\t+)$/.test(n[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return n[0]}});function vt(n){let e=n.facet(kn);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function hn(n,e){let t="",i=n.tabSize;if(n.facet(kn).charCodeAt(0)==9)for(;e>=i;)t+=" ",e-=i;for(let s=0;s=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return bi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const mu=new R;function yu(n,e,t){return kh(e.resolveInner(t).enterUnfinishedNodesBefore(t),t,n)}function bu(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function wu(n){let e=n.type.prop(mu);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(R.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>Sh(o,!0,1,void 0,r&&!bu(o)?s.from:void 0)}return n.parent==null?xu:null}function kh(n,e,t){for(;n;n=n.parent){let i=wu(n);if(i)return i(er.create(t,e,n))}return null}function xu(){return 0}class er extends Sn{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.node=i}static create(e,t,i){return new er(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let e=this.state.doc.lineAt(this.node.from);for(;;){let t=this.node.resolve(e.from);for(;t.parent&&t.parent.from==t.from;)t=t.parent;if(vu(t,this.node))break;e=this.state.doc.lineAt(t.from)}return this.lineIndent(e.from)}continue(){let e=this.node.parent;return e?kh(e,this.pos,this.base):0}}function vu(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function ku(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let h=e.childAfter(l);if(!h||h==i)return null;if(!h.type.isSkipped)return h.fromSh(i,e,t,n)}function Sh(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,h=e?ku(n):null;return h?l?n.column(h.from):n.column(h.to):n.baseIndent+(l?0:n.unit*t)}const xg=n=>n.baseIndent;function vg({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const kg=new R;function Sg(n){let e=n.firstChild,t=n.lastChild;return e&&e.tol.prop(Wt)==o.data:o?l=>l==o:void 0,this.style=yh(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new ot(i):null,this.themeType=t.themeType}static define(e,t){return new Cn(e,t||{})}}const Ps=D.define(),Ch=D.define({combine(n){return n.length?[n[0]]:null}});function jn(n){let e=n.facet(Ps);return e.length?e:n.facet(Ch)}function Cg(n,e){let t=[Cu],i;return n instanceof Cn&&(n.module&&t.push(O.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(Ch.of(n)):i?t.push(Ps.computeN([O.darkTheme],s=>s.facet(O.darkTheme)==(i=="dark")?[n]:[])):t.push(Ps.of(n)),t}class Su{constructor(e){this.markCache=Object.create(null),this.tree=ge(e.state),this.decorations=this.buildDeco(e,jn(e.state))}update(e){let t=ge(e.state),i=jn(e.state),s=i!=jn(e.startState);t.length{i.add(o,l,this.markCache[h]||(this.markCache[h]=T.mark({class:h})))},s,r);return i.finish()}}const Cu=kt.high(de.fromClass(Su,{decorations:n=>n.decorations})),Ag=Cn.define([{tag:x.meta,color:"#7a757a"},{tag:x.link,textDecoration:"underline"},{tag:x.heading,textDecoration:"underline",fontWeight:"bold"},{tag:x.emphasis,fontStyle:"italic"},{tag:x.strong,fontWeight:"bold"},{tag:x.strikethrough,textDecoration:"line-through"},{tag:x.keyword,color:"#708"},{tag:[x.atom,x.bool,x.url,x.contentSeparator,x.labelName],color:"#219"},{tag:[x.literal,x.inserted],color:"#164"},{tag:[x.string,x.deleted],color:"#a11"},{tag:[x.regexp,x.escape,x.special(x.string)],color:"#e40"},{tag:x.definition(x.variableName),color:"#00f"},{tag:x.local(x.variableName),color:"#30a"},{tag:[x.typeName,x.namespace],color:"#085"},{tag:x.className,color:"#167"},{tag:[x.special(x.variableName),x.macroName],color:"#256"},{tag:x.definition(x.propertyName),color:"#00c"},{tag:x.comment,color:"#940"},{tag:x.invalid,color:"#f00"}]),Au=O.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Ah=1e4,Mh="()[]{}",Dh=D.define({combine(n){return Ct(n,{afterCursor:!0,brackets:Mh,maxScanDistance:Ah,renderMatch:Ou})}}),Mu=T.mark({class:"cm-matchingBracket"}),Du=T.mark({class:"cm-nonmatchingBracket"});function Ou(n){let e=[],t=n.matched?Mu:Du;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const Tu=me.define({create(){return T.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(Dh);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=$e(e.state,s.head,-1,i)||s.head>0&&$e(e.state,s.head-1,1,i)||i.afterCursor&&($e(e.state,s.head,1,i)||s.headO.decorations.from(n)}),Bu=[Tu,Au];function Mg(n={}){return[Dh.of(n),Bu]}function Rs(n,e,t){let i=n.prop(e<0?R.openedBy:R.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function $e(n,e,t,i={}){let s=i.maxScanDistance||Ah,r=i.brackets||Mh,o=ge(n),l=o.resolveInner(e,t);for(let h=l;h;h=h.parent){let a=Rs(h.type,t,r);if(a&&h.from=i.to){if(h==0&&s.indexOf(a.type.name)>-1&&a.from0)return null;let a={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let m=t>0?0:d.length-1,g=t>0?d.length:-1;m!=g;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:a,end:{from:p+m,to:p+m+1},matched:y>>1==h>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:a,matched:!1}:null}function Do(n,e,t,i=0,s=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=s;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosi?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Lu(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||Eu,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||ir}}function Eu(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}class Th extends De{constructor(e){let t=bh(e.languageData),i=Lu(e),s,r=new class extends gh{createParse(o,l,h){return new Nu(s,o,l,h)}};super(t,r,[xh.of((o,l)=>this.getIndent(o,l))],e.name),this.topNode=Wu(t),s=this,this.streamParser=i,this.stateAfter=new R({perNode:!0}),this.tokenTable=e.tokenTable?new Lh(i.tokenTable):Fu}static define(e){return new Th(e)}getIndent(e,t){let i=ge(e.state),s=i.resolve(t);for(;s&&s.type!=this.topNode;)s=s.parent;if(!s)return null;let r=tr(this,i,0,s.from,t),o,l;if(r?(l=r.state,o=r.pos+1):(l=this.streamParser.startState(e.unit),o=0),t-o>1e4)return null;for(;o=i&&t+e.length<=s&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],h=t+e.positions[o],a=l instanceof F&&h=e.length)return e;!s&&e.type==n.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],h;if(ot&&tr(n,s.tree,0-s.offset,t,o),h;if(l&&(h=Bh(n,s.tree,t+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:h}}return{state:n.streamParser.startState(i?vt(i):4),tree:F.empty}}class Nu{constructor(e,t,i,s){this.lang=e,this.input=t,this.fragments=i,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=Ht.get(),o=s[0].from,{state:l,tree:h}=Iu(e,i,o,r==null?void 0:r.state);this.state=l,this.parsedPos=this.chunkStart=o+h.length;for(let a=0;a=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` +`&&(t="");else{let i=t.indexOf(` +`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){r=this.skipGapsTo(t,r,1),t+=r;let o=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-o}return this.chunk.push(e,t,i,s),r}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new Oh(t,e?e.state.tabSize:4,e?vt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=Ph(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,4,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const ir=Object.create(null),pi=[pe.none],Vu=new Xs(pi),Oo=[],Rh=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Rh[n]=Eh(ir,e);class Lh{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Rh)}resolve(e){return e?this.table[e]||(this.table[e]=Eh(this.extra,e)):0}}const Fu=new Lh(ir);function Un(n,e){Oo.indexOf(n)>-1||(Oo.push(n),console.warn(e))}function Eh(n,e){let t=null;for(let r of e.split(".")){let o=n[r]||x[r];o?typeof o=="function"?t?t=o(t):Un(r,`Modifier ${r} used at start of tag`):t?Un(r,`Tag ${r} used as modifier`):t=o:Un(r,`Unknown highlighting tag ${r}`)}if(!t)return 0;let i=e.replace(/ /g,"_"),s=pe.define({id:pi.length,name:i,props:[au({[i]:t})]});return pi.push(s),s.id}function Wu(n){let e=pe.define({id:pi.length,name:"Document",props:[Wt.add(()=>n)]});return pi.push(e),e}const Hu=n=>{let e=sr(n.state);return e.line?zu(n):e.block?$u(n):!1};function nr(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const zu=nr(Uu,0),qu=nr(Ih,0),$u=nr((n,e)=>Ih(n,e,ju(e)),0);function sr(n,e=n.selection.main.head){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const Xt=50;function Ku(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-Xt,i),o=n.sliceDoc(s,s+Xt),l=/\s*$/.exec(r)[0].length,h=/^\s*/.exec(o)[0].length,a=r.length-l;if(r.slice(a-e.length,a)==e&&o.slice(h,h+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+h,margin:h&&1}};let c,f;s-i<=2*Xt?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+Xt),f=n.sliceDoc(s-Xt,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function ju(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from,to:s.to})}return e}function Ih(n,e,t=e.selection.ranges){let i=t.map(r=>sr(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>Ku(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>c.from)){s=c.from;let f=sr(e,a).line;if(!f)continue;let u=/^\s*/.exec(c.text)[0].length,d=u==c.length,p=c.text.slice(u,u+f.length)==f?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:h,indent:a,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+a,insert:h+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:h}of i)if(l>=0){let a=o.from+l,c=a+h.length;o.text[c-o.from]==" "&&c++,r.push({from:a,to:c})}return{changes:r}}return null}const Ls=St.define(),Gu=St.define(),Ju=D.define(),Nh=D.define({combine(n){return Ct(n,{minDepth:100,newGroupDelay:500},{minDepth:Math.max,newGroupDelay:Math.min})}});function _u(n){let e=0;return n.iterChangedRanges((t,i)=>e=i),e}const Vh=me.define({create(){return Ke.empty},update(n,e){let t=e.state.facet(Nh),i=e.annotation(Ls);if(i){let h=e.docChanged?b.single(_u(e.changes)):void 0,a=be.fromTransaction(e,h),c=i.side,f=c==0?n.undone:n.done;return a?f=an(f,f.length,t.minDepth,a):f=Hh(f,e.startState.selection),new Ke(c==0?i.rest:f,c==0?f:i.rest)}let s=e.annotation(Gu);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(Q.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=be.fromTransaction(e),o=e.annotation(Q.time),l=e.annotation(Q.userEvent);return r?n=n.addChanges(r,o,l,t.newGroupDelay,t.minDepth):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Ke(n.done.map(be.fromJSON),n.undone.map(be.fromJSON))}});function Dg(n={}){return[Vh,Nh.of(n),O.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Fh:e.inputType=="historyRedo"?Es:null;return i?(e.preventDefault(),i(t)):!1}})]}function An(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(Vh,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const Fh=An(0,!1),Es=An(1,!1),Xu=An(0,!0),Yu=An(1,!0);class be{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new be(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new be(e.changes&&Y.fromJSON(e.changes),[],e.mapped&&je.fromJSON(e.mapped),e.startSelection&&b.fromJSON(e.startSelection),e.selectionsAfter.map(b.fromJSON))}static fromTransaction(e,t){let i=Oe;for(let s of e.startState.facet(Ju)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new be(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Oe)}static selection(e){return new be(void 0,Oe,void 0,void 0,e)}}function an(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function Qu(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let h=0;h=a&&o<=c&&(i=!0)}}),i}function Zu(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Wh(n,e){return n.length?e.length?n.concat(e):n:e}const Oe=[],ed=200;function Hh(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-ed));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),an(n,n.length-1,1e9,t.setSelAfter(i)))}else return[be.selection([e])]}function td(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Gn(n,e){if(!n.length)return n;let t=n.length,i=Oe;for(;t;){let s=id(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[be.selection(i)]:Oe}function id(n,e,t){let i=Wh(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Oe,t);if(!n.changes)return be.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new be(s,L.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const nd=/^(input\.type|delete)($|\.)/;class Ke{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new Ke(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||nd.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):Mn(t,e))}function ae(n){return n.textDirectionAt(n.state.selection.main.head)==_.LTR}const qh=n=>zh(n,!ae(n)),$h=n=>zh(n,ae(n));function Kh(n,e){return Ie(n,t=>t.empty?n.moveByGroup(t,e):Mn(t,e))}const sd=n=>Kh(n,!ae(n)),rd=n=>Kh(n,ae(n));function od(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Dn(n,e,t){let i=ge(n).resolveInner(e.head),s=t?R.closedBy:R.openedBy;for(let h=e.head;;){let a=t?i.childAfter(h):i.childBefore(h);if(!a)break;od(n,a,s)?i=a:h=t?a.to:a.from}let r=i.type.prop(s),o,l;return r&&(o=t?$e(n,i.from,1):$e(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,b.cursor(l,t?-1:1)}const ld=n=>Ie(n,e=>Dn(n.state,e,!ae(n))),hd=n=>Ie(n,e=>Dn(n.state,e,ae(n)));function jh(n,e){return Ie(n,t=>{if(!t.empty)return Mn(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const Uh=n=>jh(n,!1),Gh=n=>jh(n,!0);function Jh(n){return Math.max(n.defaultLineHeight,Math.min(n.dom.clientHeight,innerHeight)-5)}function _h(n,e){let{state:t}=n,i=Kt(t.selection,l=>l.empty?n.moveVertically(l,e,Jh(n)):Mn(l,e));if(i.eq(t.selection))return!1;let s=n.coordsAtPos(t.selection.main.head),r=n.scrollDOM.getBoundingClientRect(),o;return s&&s.top>r.top&&s.bottom_h(n,!1),Is=n=>_h(n,!0);function ct(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=b.cursor(i.from+r))}return s}const ad=n=>Ie(n,e=>ct(n,e,!0)),cd=n=>Ie(n,e=>ct(n,e,!1)),fd=n=>Ie(n,e=>ct(n,e,!ae(n))),ud=n=>Ie(n,e=>ct(n,e,ae(n))),dd=n=>Ie(n,e=>b.cursor(n.lineBlockAt(e.head).from,1)),pd=n=>Ie(n,e=>b.cursor(n.lineBlockAt(e.head).to,-1));function gd(n,e,t){let i=!1,s=Kt(n.selection,r=>{let o=$e(n,r.head,-1)||$e(n,r.head,1)||r.head>0&&$e(n,r.head-1,1)||r.headgd(n,e,!1);function Pe(n,e){let t=Kt(n.state.selection,i=>{let s=e(i);return b.range(i.anchor,s.head,s.goalColumn)});return t.eq(n.state.selection)?!1:(n.dispatch(Ge(n.state,t)),!0)}function Xh(n,e){return Pe(n,t=>n.moveByChar(t,e))}const Yh=n=>Xh(n,!ae(n)),Qh=n=>Xh(n,ae(n));function Zh(n,e){return Pe(n,t=>n.moveByGroup(t,e))}const yd=n=>Zh(n,!ae(n)),bd=n=>Zh(n,ae(n)),wd=n=>Pe(n,e=>Dn(n.state,e,!ae(n))),xd=n=>Pe(n,e=>Dn(n.state,e,ae(n)));function ea(n,e){return Pe(n,t=>n.moveVertically(t,e))}const ta=n=>ea(n,!1),ia=n=>ea(n,!0);function na(n,e){return Pe(n,t=>n.moveVertically(t,e,Jh(n)))}const Bo=n=>na(n,!1),Po=n=>na(n,!0),vd=n=>Pe(n,e=>ct(n,e,!0)),kd=n=>Pe(n,e=>ct(n,e,!1)),Sd=n=>Pe(n,e=>ct(n,e,!ae(n))),Cd=n=>Pe(n,e=>ct(n,e,ae(n))),Ad=n=>Pe(n,e=>b.cursor(n.lineBlockAt(e.head).from)),Md=n=>Pe(n,e=>b.cursor(n.lineBlockAt(e.head).to)),Ro=({state:n,dispatch:e})=>(e(Ge(n,{anchor:0})),!0),Lo=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.doc.length})),!0),Eo=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.selection.main.anchor,head:0})),!0),Io=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Dd=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Od=({state:n,dispatch:e})=>{let t=Tn(n).map(({from:i,to:s})=>b.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:b.create(t),userEvent:"select"})),!0},Td=({state:n,dispatch:e})=>{let t=Kt(n.selection,i=>{var s;let r=ge(n).resolveInner(i.head,1);for(;!(r.from=i.to||r.to>i.to&&r.from<=i.from||!(!((s=r.parent)===null||s===void 0)&&s.parent));)r=r.parent;return b.range(r.to,r.from)});return e(Ge(n,t)),!0},Bd=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=b.create([t.main]):t.main.empty||(i=b.create([b.cursor(t.main.head)])),i?(e(Ge(n,i)),!0):!1};function On(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let h=e(o);ho&&(t="delete.forward",h=Vi(n,h,!0)),o=Math.min(o,h),l=Math.max(l,h)}else o=Vi(n,o,!1),l=Vi(n,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:b.cursor(o)}});return s.changes.empty?!1:(n.dispatch(i.update(s,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?O.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Vi(n,e,t){if(n instanceof O)for(let i of n.state.facet(O.atomicRanges).map(s=>s(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const sa=(n,e)=>On(n,t=>{let{state:i}=n,s=i.doc.lineAt(t),r,o;if(!e&&t>s.from&&tsa(n,!1),ra=n=>sa(n,!0),oa=(n,e)=>On(n,t=>{let i=t,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let h=fe(r.text,i-r.from,e)+r.from,a=r.text.slice(Math.min(i,h)-r.from,Math.max(i,h)-r.from),c=o(a);if(l!=null&&c!=l)break;(a!=" "||i!=t)&&(l=c),i=h}return i}),la=n=>oa(n,!1),Pd=n=>oa(n,!0),ha=n=>On(n,e=>{let t=n.lineBlockAt(e).to;return eOn(n,e=>{let t=n.lineBlockAt(e).from;return e>t?t:Math.max(0,e-1)}),Ld=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:I.of(["",""])},range:b.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Ed=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:fe(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:fe(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:b.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Tn(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function aa(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of Tn(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let h of r.ranges)s.push(b.range(Math.min(n.doc.length,h.anchor+l),Math.min(n.doc.length,h.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let h of r.ranges)s.push(b.range(h.anchor-l,h.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:b.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Id=({state:n,dispatch:e})=>aa(n,e,!1),Nd=({state:n,dispatch:e})=>aa(n,e,!0);function ca(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of Tn(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});return e(n.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Vd=({state:n,dispatch:e})=>ca(n,e,!1),Fd=({state:n,dispatch:e})=>ca(n,e,!0),Wd=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Tn(e).map(({from:s,to:r})=>(s>0?s--:rn.moveVertically(s,!0)).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Hd(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=ge(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(R.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from?{from:i.to,to:s.from}:null}const zd=fa(!1),qd=fa(!0);function fa(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),h=!n&&r==o&&Hd(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let a=new Sn(e,{simulateBreak:r,simulateDoubleBreak:!!h}),c=vh(a,r);for(c==null&&(c=/^\s*/.exec(e.doc.lineAt(r).text)[0].length);ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:b.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const $d=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new Sn(n,{overrideIndentation:r=>{let o=t[r];return o==null?-1:o}}),s=rr(n,(r,o,l)=>{let h=vh(i,r.from);if(h==null)return;/\S/.test(r.text)||(h=0);let a=/^\s*/.exec(r.text)[0],c=hn(n,h);(a!=c||l.fromn.readOnly?!1:(e(n.update(rr(n,(t,i)=>{i.push({from:t.from,insert:n.facet(kn)})}),{userEvent:"input.indent"})),!0),jd=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(rr(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=bi(s,n.tabSize),o=0,l=hn(n,Math.max(0,r-vt(n)));for(;o({mac:n.key,run:n.run,shift:n.shift}))),Tg=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:ld,shift:wd},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:hd,shift:xd},{key:"Alt-ArrowUp",run:Id},{key:"Shift-Alt-ArrowUp",run:Vd},{key:"Alt-ArrowDown",run:Nd},{key:"Shift-Alt-ArrowDown",run:Fd},{key:"Escape",run:Bd},{key:"Mod-Enter",run:qd},{key:"Alt-l",mac:"Ctrl-l",run:Od},{key:"Mod-i",run:Td,preventDefault:!0},{key:"Mod-[",run:jd},{key:"Mod-]",run:Kd},{key:"Mod-Alt-\\",run:$d},{key:"Shift-Mod-k",run:Wd},{key:"Shift-Mod-\\",run:md},{key:"Mod-/",run:Hu},{key:"Alt-A",run:qu}].concat(Gd);function re(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;en.normalize("NFKD"):n=>n;class $t{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(No(l)):No,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ie(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Hs(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Se(e);let s=this.normalize(t);for(let r=0,o=i;;r++){let l=s.charCodeAt(r),h=this.match(l,o);if(h)return this.value=h,this;if(r==s.length-1)break;o==i&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=cn(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new Et(t,e.sliceString(t,i));return Jn.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this.matchPos=cn(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Et.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(pa.prototype[Symbol.iterator]=ga.prototype[Symbol.iterator]=function(){return this});function Jd(n){try{return new RegExp(n,or),!0}catch{return!1}}function cn(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function Vs(n){let e=re("input",{class:"cm-textfield",name:"line"}),t=re("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:fn.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},re("label",n.state.phrase("Go to line"),": ",e)," ",re("button",{class:"cm-button",type:"submit"},n.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:r}=n,o=r.doc.lineAt(r.selection.main.head),[,l,h,a,c]=s,f=a?+a.slice(1):0,u=h?+h:o.number;if(h&&c){let p=u/100;l&&(p=p*(l=="-"?-1:1)+o.number/r.doc.lines),u=Math.round(r.doc.lines*p)}else h&&l&&(u=u*(l=="-"?-1:1)+o.number);let d=r.doc.line(Math.max(1,Math.min(r.doc.lines,u)));n.dispatch({effects:fn.of(!1),selection:b.cursor(d.from+Math.max(0,Math.min(f,d.length))),scrollIntoView:!0}),n.focus()}return{dom:t}}const fn=L.define(),Vo=me.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(fn)&&(n=t.value);return n},provide:n=>nn.from(n,e=>e?Vs:null)}),_d=n=>{let e=tn(n,Vs);if(!e){let t=[fn.of(!0)];n.state.field(Vo,!1)==null&&t.push(L.appendConfig.of([Vo,Xd])),n.dispatch({effects:t}),e=tn(n,Vs)}return e&&e.dom.querySelector("input").focus(),!0},Xd=O.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Yd={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ma=D.define({combine(n){return Ct(n,Yd,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Bg(n){let e=[ip,tp];return n&&e.push(ma.of(n)),e}const Qd=T.mark({class:"cm-selectionMatch"}),Zd=T.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Fo(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=z.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=z.Word)}function ep(n,e,t,i){return n(e.sliceDoc(t,t+1))==z.Word&&n(e.sliceDoc(i-1,i))==z.Word}const tp=de.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(ma),{state:t}=n,i=t.selection;if(i.ranges.length>1)return T.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return T.none;let h=t.wordAt(s.head);if(!h)return T.none;o=t.charCategorizer(s.head),r=t.sliceDoc(h.from,h.to)}else{let h=s.to-s.from;if(h200)return T.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Fo(o,t,s.from,s.to)&&ep(o,t,s.from,s.to)))return T.none}else if(r=t.sliceDoc(s.from,s.to).trim(),!r)return T.none}let l=[];for(let h of n.visibleRanges){let a=new $t(t.doc,r,h.from,h.to);for(;!a.next().done;){let{from:c,to:f}=a.value;if((!o||Fo(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(Zd.range(c,f)):(c>=s.to||f<=s.from)&&l.push(Qd.range(c,f)),l.length>e.maxMatches))return T.none}}return T.set(l)}},{decorations:n=>n.decorations}),ip=O.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),np=({state:n,dispatch:e})=>{let{selection:t}=n,i=b.create(t.ranges.map(s=>n.wordAt(s.head)||b.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function sp(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new $t(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new $t(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(h=>h.from==l.value.from))continue;if(r){let h=n.wordAt(l.value.from);if(!h||h.from!=l.value.from||h.to!=l.value.to)continue}return l.value}}const rp=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return np({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=sp(n,i);return s?(e(n.update({selection:n.selection.addRange(b.range(s.from,s.to),!1),effects:O.scrollIntoView(s.to)})),!0):!1},lr=D.define({combine(n){return Ct(n,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:e=>new mp(e)})}});class ya{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Jd(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new ap(this):new lp(this)}getCursor(e,t=0,i){let s=e.doc?e:N.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?Tt(this,s,t,i):Ot(this,s,t,i)}}class ba{constructor(e){this.spec=e}}function Ot(n,e,t,i){return new $t(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),n.wholeWord?op(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function op(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Ot(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Tt(n,e,t,i){return new pa(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?hp(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function un(n,e){return n.slice(fe(n,e,!1),e)}function dn(n,e){return n.slice(e,fe(n,e))}function hp(n){return(e,t,i)=>!i[0].length||(n(un(i.input,i.index))!=z.Word||n(dn(i.input,i.index))!=z.Word)&&(n(dn(i.input,i.index+i[0].length))!=z.Word||n(un(i.input,i.index+i[0].length))!=z.Word)}class ap extends ba{nextMatch(e,t,i){let s=Tt(this.spec,e,i,e.doc.length).next();return s.done&&(s=Tt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Tt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(t,i)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Tt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const gi=L.define(),hr=L.define(),st=me.define({create(n){return new _n(Fs(n).create(),null)},update(n,e){for(let t of e.effects)t.is(gi)?n=new _n(t.value.create(),n.panel):t.is(hr)&&(n=new _n(n.query,t.value?ar:null));return n},provide:n=>nn.from(n,e=>e.panel)});class _n{constructor(e,t){this.query=e,this.panel=t}}const cp=T.mark({class:"cm-searchMatch"}),fp=T.mark({class:"cm-searchMatch cm-searchMatch-selected"}),up=de.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(st))}update(n){let e=n.state.field(st);(e!=n.startState.field(st)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return T.none;let{view:t}=this,i=new bt;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-2*250;)h=r[++s].to;n.highlight(t.state,l,h,(a,c)=>{let f=t.state.selection.ranges.some(u=>u.from==a&&u.to==c);i.add(a,c,f?fp:cp)})}return i.finish()}},{decorations:n=>n.decorations});function xi(n){return e=>{let t=e.state.field(st,!1);return t&&t.query.spec.valid?n(e,t):wa(e)}}const pn=xi((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);return i?(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:cr(n,i),userEvent:"select.search"}),!0):!1}),gn=xi((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);return s?(n.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:cr(n,s),userEvent:"select.search"}),!0):!1}),dp=xi((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:b.create(t.map(i=>b.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),pp=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new $t(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(b.range(l.value.from,l.value.to))}return e(n.update({selection:b.create(r,o),userEvent:"select.search.matches"})),!0},Wo=xi((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=[],l,h,a=[];if(r.from==i&&r.to==s&&(h=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:h}),r=e.nextMatch(t,r.from,r.to),a.push(O.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))),r){let c=o.length==0||o[0].from>=r.to?0:r.to-r.from-h.length;l={anchor:r.from-c,head:r.to-c},a.push(cr(n,r))}return n.dispatch({changes:o,selection:l,scrollIntoView:!!l,effects:a,userEvent:"input.replace"}),!0}),gp=xi((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:O.announce.of(i),userEvent:"input.replace.all"}),!0});function ar(n){return n.state.facet(lr).createPanel(n)}function Fs(n,e){var t,i,s,r;let o=n.selection.main,l=o.empty||o.to>o.from+100?"":n.sliceDoc(o.from,o.to);if(e&&!l)return e;let h=n.facet(lr);return new ya({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:h.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:h.literal,wholeWord:(r=e==null?void 0:e.wholeWord)!==null&&r!==void 0?r:h.wholeWord})}const wa=n=>{let e=n.state.field(st,!1);if(e&&e.panel){let t=tn(n,ar);if(!t)return!1;let i=t.dom.querySelector("[main-field]");if(i&&i!=n.root.activeElement){let s=Fs(n.state,e.query.spec);s.valid&&n.dispatch({effects:gi.of(s)}),i.focus(),i.select()}}else n.dispatch({effects:[hr.of(!0),e?gi.of(Fs(n.state,e.query.spec)):L.appendConfig.of(bp)]});return!0},xa=n=>{let e=n.state.field(st,!1);if(!e||!e.panel)return!1;let t=tn(n,ar);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:hr.of(!1)}),!0},Pg=[{key:"Mod-f",run:wa,scope:"editor search-panel"},{key:"F3",run:pn,shift:gn,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:pn,shift:gn,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:xa,scope:"editor search-panel"},{key:"Mod-Shift-l",run:pp},{key:"Alt-g",run:_d},{key:"Mod-d",run:rp,preventDefault:!0}];class mp{constructor(e){this.view=e;let t=this.query=e.state.field(st).query.spec;this.commit=this.commit.bind(this),this.searchField=re("input",{value:t.search,placeholder:ve(e,"Find"),"aria-label":ve(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=re("input",{value:t.replace,placeholder:ve(e,"Replace"),"aria-label":ve(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=re("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=re("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=re("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return re("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=re("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>pn(e),[ve(e,"next")]),i("prev",()=>gn(e),[ve(e,"previous")]),i("select",()=>dp(e),[ve(e,"all")]),re("label",null,[this.caseField,ve(e,"match case")]),re("label",null,[this.reField,ve(e,"regexp")]),re("label",null,[this.wordField,ve(e,"by word")]),...e.state.readOnly?[]:[re("br"),this.replaceField,i("replace",()=>Wo(e),[ve(e,"replace")]),i("replaceAll",()=>gp(e),[ve(e,"replace all")]),re("button",{name:"close",onclick:()=>xa(e),"aria-label":ve(e,"close"),type:"button"},["\xD7"])]])}commit(){let e=new ya({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:gi.of(e)}))}keydown(e){mf(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?gn:pn)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Wo(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(gi)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(lr).top}}function ve(n,e){return n.state.phrase(e)}const Fi=30,Wi=/[\s\.,:;?!]/;function cr(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Fi),o=Math.min(s,t+Fi),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let h=0;hl.length-Fi;h--)if(!Wi.test(l[h-1])&&Wi.test(l[h])){l=l.slice(0,h);break}}return O.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const yp=O.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),bp=[st,kt.lowest(up),yp];class va{constructor(e,t,i){this.state=e,this.pos=t,this.explicit=i,this.abortListeners=[]}tokenBefore(e){let t=ge(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(ka(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function Ho(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function wp(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:wp(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function Rg(n,e){return t=>{for(let i=ge(t.state).resolveInner(t.pos,-1);i;i=i.parent)if(n.indexOf(i.name)>-1)return null;return e(t)}}class zo{constructor(e,t,i){this.completion=e,this.source=t,this.match=i}}function rt(n){return n.selection.main.head}function ka(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}function vp(n,e,t,i){return Object.assign(Object.assign({},n.changeByRange(s=>{if(s==n.selection.main)return{changes:{from:t,to:i,insert:e},range:b.cursor(t+e.length)};let r=i-t;return!s.empty||r&&n.sliceDoc(s.from-r,s.from)!=n.sliceDoc(t,i)?{range:s}:{changes:{from:s.from-r,to:s.from,insert:e},range:b.cursor(s.from-r+e.length)}})),{userEvent:"input.complete"})}function Sa(n,e){const t=e.completion.apply||e.completion.label;let i=e.source;typeof t=="string"?n.dispatch(vp(n.state,t,i.from,i.to)):t(n,e.completion,i.from,i.to)}const qo=new WeakMap;function kp(n){if(!Array.isArray(n))return n;let e=qo.get(n);return e||qo.set(n,e=xp(n)),e}class Sp{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let t=0;t=48&&A<=57||A>=97&&A<=122?2:A>=65&&A<=90?1:0:(M=Hs(A))!=M.toLowerCase()?1:M!=M.toUpperCase()?2:0;(!v||B==1&&g||S==0&&B!=0)&&(t[f]==A||i[f]==A&&(u=!0)?o[f++]=v:o.length&&(y=!1)),S=B,v+=Se(A)}return f==h&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==h&&p==0?[-200-e.length,0,m]:l>-1?[-700-e.length,l,l+this.pattern.length]:d==h?[-200+-700-e.length,p,m]:f==h?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[e-i.length],r=1;for(let o of t){let l=o+(this.astral?Se(ie(i,o)):1);r>1&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return s}}const Be=D.define({combine(n){return Ct(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,optionClass:(e,t)=>i=>Cp(e(i),t(i)),addToOptions:(e,t)=>e.concat(t)})}});function Cp(n,e){return n?e?n+" "+e:n:e}function Ap(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s){let r=document.createElement("span");r.className="cm-completionLabel";let{label:o}=t,l=0;for(let h=1;hl&&r.appendChild(document.createTextNode(o.slice(l,a)));let f=r.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(o.slice(a,c))),f.className="cm-completionMatchedText",l=c}return lt.position-i.position).map(t=>t.render)}function $o(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class Mp{constructor(e,t){this.view=e,this.stateField=t,this.info=null,this.placeInfo={read:()=>this.measureInfo(),write:l=>this.positionInfo(l),key:this};let i=e.state.field(t),{options:s,selected:r}=i.open,o=e.state.facet(Be);this.optionContent=Ap(o),this.optionClass=o.optionClass,this.range=$o(s.length,r,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.dom.addEventListener("mousedown",l=>{for(let h=l.target,a;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(a=/-(\d+)$/.exec(h.id))&&+a[1]{this.info&&this.view.requestMeasure(this.placeInfo)})}mount(){this.updateSel()}update(e){e.state.field(this.stateField)!=e.startState.field(this.stateField)&&this.updateSel()}positioned(){this.info&&this.view.requestMeasure(this.placeInfo)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=$o(t.options.length,t.selected,this.view.state.facet(Be).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t.options,e.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfo)})),this.updateSelectedOption(t.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let r=typeof s=="string"?document.createTextNode(s):s(i);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o)}).catch(o=>Ee(this.view.state,o,"completion info")):this.addInfoPane(r)}}addInfoPane(e){let t=this.info=document.createElement("div");t.className="cm-tooltip cm-completionInfo",t.appendChild(e),this.dom.appendChild(t),this.view.requestMeasure(this.placeInfo)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return t&&Op(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.ownerDocument.defaultView||window,i=this.dom.getBoundingClientRect(),s=this.info.getBoundingClientRect(),r=e.getBoundingClientRect();if(r.top>Math.min(t.innerHeight,i.bottom)-10||r.bottom=s.height||p>i.top?c=r.bottom-i.top+"px":f=i.bottom-r.top+"px"}return{top:c,bottom:f,maxWidth:a,class:h?o?"left-narrow":"right-narrow":l?"left":"right"}}positionInfo(e){this.info&&(e?(this.info.style.top=e.top,this.info.style.bottom=e.bottom,this.info.style.maxWidth=e.maxWidth,this.info.className="cm-tooltip cm-completionInfo cm-completionInfo-"+e.class):this.info.style.top="-1e6px")}createListBox(e,t,i){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions"));for(let r=i.from;rnew Mp(e,n)}function Op(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect();i.topt.bottom&&(n.scrollTop+=i.bottom-t.bottom)}function Ko(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function Tp(n,e){let t=[],i=0;for(let l of n)if(l.hasResult())if(l.result.filter===!1){let h=l.result.getMatch;for(let a of l.result.options){let c=[1e9-i++];if(h)for(let f of h(a))c.push(f);t.push(new zo(a,l,c))}}else{let h=new Sp(e.sliceDoc(l.from,l.to)),a;for(let c of l.result.options)(a=h.match(c.label))&&(c.boost!=null&&(a[0]+=c.boost),t.push(new zo(c,l,a)))}let s=[],r=null,o=e.facet(Be).compareCompletions;for(let l of t.sort((h,a)=>a.match[0]-h.match[0]||o(h.completion,a.completion)))!r||r.label!=l.completion.label||r.detail!=l.completion.detail||r.type!=null&&l.completion.type!=null&&r.type!=l.completion.type||r.apply!=l.completion.apply?s.push(l):Ko(l.completion)>Ko(r)&&(s[s.length-1]=l),r=l.completion;return s}class si{constructor(e,t,i,s,r){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new si(this.options,jo(t,e),this.tooltip,this.timestamp,e)}static build(e,t,i,s,r){let o=Tp(e,t);if(!o.length)return null;let l=t.facet(Be).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let h=s.options[s.selected].completion;for(let a=0;aa.hasResult()?Math.min(h,a.from):h,1e8),create:Dp(Ae),above:r.aboveCursor},s?s.timestamp:Date.now(),l)}map(e){return new si(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected)}}class mn{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new mn(Rp,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(Be),r=(i.override||t.languageDataAt("autocomplete",rt(t)).map(kp)).map(l=>(this.active.find(a=>a.source==l)||new ye(l,this.active.some(a=>a.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((l,h)=>l==this.active[h])&&(r=this.active);let o=e.selection||r.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Bp(r,this.active)?si.build(r,t,this.id,this.open,i):this.open&&e.docChanged?this.open.map(e.changes):this.open;!o&&r.every(l=>l.state!=1)&&r.some(l=>l.hasResult())&&(r=r.map(l=>l.hasResult()?new ye(l.source,0):l));for(let l of e.effects)l.is(Aa)&&(o=o&&o.setSelected(l.value,this.id));return r==this.active&&o==this.open?this:new mn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:Pp}}function Bp(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const Rp=[];function Ws(n){return n.isUserEvent("input.type")?"input":n.isUserEvent("delete.backward")?"delete":null}class ye{constructor(e,t,i=-1){this.source=e,this.state=t,this.explicitPos=i}hasResult(){return!1}update(e,t){let i=Ws(e),s=this;i?s=s.handleUserEvent(e,i,t):e.docChanged?s=s.handleChange(e):e.selection&&s.state!=0&&(s=new ye(s.source,0));for(let r of e.effects)if(r.is(fr))s=new ye(s.source,1,r.value?rt(e.state):-1);else if(r.is(yn))s=new ye(s.source,0);else if(r.is(Ca))for(let o of r.value)o.source==s.source&&(s=o);return s}handleUserEvent(e,t,i){return t=="delete"||!i.activateOnTyping?this.map(e.changes):new ye(this.source,1)}handleChange(e){return e.changes.touchesRange(rt(e.startState))?new ye(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ye(this.source,this.state,e.mapPos(this.explicitPos))}}class ri extends ye{constructor(e,t,i,s,r){super(e,2,t),this.result=i,this.from=s,this.to=r}hasResult(){return!0}handleUserEvent(e,t,i){var s;let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=rt(e.state);if((this.explicitPos<0?l<=r:lo||t=="delete"&&rt(e.startState)==this.from)return new ye(this.source,t=="input"&&i.activateOnTyping?1:0);let h=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),a;return Lp(this.result.validFor,e.state,r,o)?new ri(this.source,h,this.result,r,o):this.result.update&&(a=this.result.update(this.result,r,o,new va(e.state,l,h>=0)))?new ri(this.source,h,a,a.from,(s=a.to)!==null&&s!==void 0?s:rt(e.state)):new ye(this.source,1,h)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new ye(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new ri(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function Lp(n,e,t,i){if(!n)return!1;let s=e.sliceDoc(t,i);return typeof n=="function"?n(s,t,i,e):ka(n,!0).test(s)}const fr=L.define(),yn=L.define(),Ca=L.define({map(n,e){return n.map(t=>t.map(e))}}),Aa=L.define(),Ae=me.define({create(){return mn.start()},update(n,e){return n.update(e)},provide:n=>[fh.from(n,e=>e.tooltip),O.contentAttributes.from(n,e=>e.attrs)]});function Hi(n,e="option"){return t=>{let i=t.state.field(Ae,!1);if(!i||!i.open||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:Aa.of(l)}),!0}}const Ep=n=>{let e=n.state.field(Ae,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestampn.state.field(Ae,!1)?(n.dispatch({effects:fr.of(!0)}),!0):!1,Np=n=>{let e=n.state.field(Ae,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:yn.of(null)}),!0)};class Vp{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Uo=50,Fp=50,Wp=1e3,Hp=de.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of n.state.field(Ae).active)e.state==1&&this.startQuery(e)}update(n){let e=n.state.field(Ae);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Ae)==e)return;let t=n.transactions.some(i=>(i.selection||i.docChanged)&&!Ws(i));for(let i=0;iFp&&Date.now()-s.time>Wp){for(let r of s.context.abortListeners)try{r()}catch(o){Ee(this.view.state,o)}s.context.abortListeners=null,this.running.splice(i--,1)}else s.updates.push(...n.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(i=>i.state==1&&!this.running.some(s=>s.active.source==i.source))?setTimeout(()=>this.startUpdate(),Uo):-1,this.composing!=0)for(let i of n.transactions)Ws(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:n}=this.view,e=n.field(Ae);for(let t of e.active)t.state==1&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t)}startQuery(n){let{state:e}=this.view,t=rt(e),i=new va(e,t,n.explicitPos==t),s=new Vp(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:yn.of(null)}),Ee(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),Uo))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Be);for(let i=0;io.source==s.active.source);if(r&&r.state==1)if(s.done==null){let o=new ye(s.active.source,0);for(let l of s.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:Ca.of(e)})}},{eventHandlers:{blur(){let n=this.view.state.field(Ae,!1);n&&n.tooltip&&this.view.state.facet(Be).closeOnBlur&&this.view.dispatch({effects:yn.of(null)})},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:fr.of(!1)}),20),this.composing=0}}}),Ma=O.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",listStyle:"none",margin:0,padding:0,"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:`${400}px`,boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`${30}px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`${30}px`},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class zp{constructor(e,t,i,s){this.field=e,this.line=t,this.from=i,this.to=s}}class ur{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,le.TrackDel),i=e.mapPos(this.to,1,le.TrackDel);return t==null||i==null?null:new ur(this.field,t,i)}}class dr{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let h of this.lines){if(i.length){let a=o,c=/^\t*/.exec(h)[0].length;for(let f=0;fnew ur(h.field,s[h.line]+h.from,s[h.line]+h.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let l=r[1]?+r[1]:null,h=r[2]||r[3]||"",a=-1;for(let c=0;c=a&&f.field++}s.push(new zp(a,i.length,r.index,r.index+h.length)),o=o.slice(0,r.index)+h+o.slice(r.index+r[0].length)}for(let l;l=/([$#])\\{/.exec(o);){o=o.slice(0,l.index)+l[1]+"{"+o.slice(l.index+l[0].length);for(let h of s)h.line==i.length&&h.from>l.index&&(h.from--,h.to--)}i.push(o)}return new dr(i,s)}}let qp=T.widget({widget:new class extends at{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),$p=T.mark({class:"cm-snippetField"});class jt{constructor(e,t){this.ranges=e,this.active=t,this.deco=T.set(e.map(i=>(i.from==i.to?qp:$p).range(i.from,i.to)))}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new jt(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const vi=L.define({map(n,e){return n&&n.map(e)}}),Kp=L.define(),mi=me.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(vi))return t.value;if(t.is(Kp)&&n)return new jt(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>O.decorations.from(n,e=>e?e.deco:T.none)});function pr(n,e){return b.create(n.filter(t=>t.field==e).map(t=>b.range(t.from,t.to)))}function jp(n){let e=dr.parse(n);return(t,i,s,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,s),h={changes:{from:s,to:r,insert:I.of(o)},scrollIntoView:!0};if(l.length&&(h.selection=pr(l,0)),l.length>1){let a=new jt(l,0),c=h.effects=[vi.of(a)];t.state.field(mi,!1)===void 0&&c.push(L.appendConfig.of([mi,Xp,Yp,Ma]))}t.dispatch(t.state.update(h))}}function Da(n){return({state:e,dispatch:t})=>{let i=e.field(mi,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return t(e.update({selection:pr(i.ranges,s),effects:vi.of(r?null:new jt(i.ranges,s))})),!0}}const Up=({state:n,dispatch:e})=>n.field(mi,!1)?(e(n.update({effects:vi.of(null)})),!0):!1,Gp=Da(1),Jp=Da(-1),_p=[{key:"Tab",run:Gp,shift:Jp},{key:"Escape",run:Up}],Go=D.define({combine(n){return n.length?n[0]:_p}}),Xp=kt.highest(_s.compute([Go],n=>n.facet(Go)));function Lg(n,e){return Object.assign(Object.assign({},e),{apply:jp(n)})}const Yp=O.domEventHandlers({mousedown(n,e){let t=e.state.field(mi,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==t.active?!1:(e.dispatch({selection:pr(t.ranges,s.field),effects:vi.of(t.ranges.some(r=>r.field>s.field)?new jt(t.ranges,s.field):null)}),!0)}}),yi={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},gt=L.define({map(n,e){let t=e.mapPos(n,-1,le.TrackAfter);return t==null?void 0:t}}),gr=L.define({map(n,e){return e.mapPos(n)}}),mr=new class extends yt{};mr.startSide=1;mr.endSide=-1;const Oa=me.define({create(){return K.empty},update(n,e){if(e.selection){let t=e.state.doc.lineAt(e.selection.main.head).from,i=e.startState.doc.lineAt(e.startState.selection.main.head).from;t!=e.changes.mapPos(i,-1)&&(n=K.empty)}n=n.map(e.changes);for(let t of e.effects)t.is(gt)?n=n.update({add:[mr.range(t.value,t.value+1)]}):t.is(gr)&&(n=n.update({filter:i=>i!=t.value}));return n}});function Eg(){return[Zp,Oa]}const Xn="()[]{}<>";function Ta(n){for(let e=0;e{if((Qp?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&Se(ie(i,0))==1||e!=s.from||t!=s.to)return!1;let r=tg(n.state,i);return r?(n.dispatch(r),!0):!1}),eg=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=Ba(n,n.selection.main.head).brackets||yi.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=ig(n.doc,o.head);for(let h of i)if(h==l&&Bn(n.doc,o.head)==Ta(ie(h,0)))return{changes:{from:o.head-h.length,to:o.head+h.length},range:b.cursor(o.head-h.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Ig=[{key:"Backspace",run:eg}];function tg(n,e){let t=Ba(n,n.selection.main.head),i=t.brackets||yi.brackets;for(let s of i){let r=Ta(ie(s,0));if(e==s)return r==s?rg(n,s,i.indexOf(s+s+s)>-1,t):ng(n,s,r,t.before||yi.before);if(e==r&&Pa(n,n.selection.main.from))return sg(n,s,r)}return null}function Pa(n,e){let t=!1;return n.field(Oa).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Bn(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Se(ie(t,0)))}function ig(n,e){let t=n.sliceString(e-2,e);return Se(ie(t,0))==t.length?t:t.slice(1)}function ng(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:gt.of(o.to+e.length),range:b.range(o.anchor+e.length,o.head+e.length)};let l=Bn(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:gt.of(o.head+e.length),range:b.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function sg(n,e,t){let i=null,s=n.selection.ranges.map(r=>r.empty&&Bn(n.doc,r.head)==t?b.cursor(r.head+t.length):i=r);return i?null:n.update({selection:b.create(s,n.selection.mainIndex),scrollIntoView:!0,effects:n.selection.ranges.map(({from:r})=>gr.of(r))})}function rg(n,e,t,i){let s=i.stringPrefixes||yi.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:gt.of(l.to+e.length),range:b.range(l.anchor+e.length,l.head+e.length)};let h=l.head,a=Bn(n.doc,h),c;if(a==e){if(Jo(n,h))return{changes:{insert:e+e,from:h},effects:gt.of(h+e.length),range:b.cursor(h+e.length)};if(Pa(n,h)){let f=t&&n.sliceDoc(h,h+e.length*3)==e+e+e;return{range:b.cursor(h+e.length*(f?3:1)),effects:gr.of(h)}}}else{if(t&&n.sliceDoc(h-2*e.length,h)==e+e&&(c=_o(n,h-2*e.length,s))>-1&&Jo(n,c))return{changes:{insert:e+e+e+e,from:h},effects:gt.of(h+e.length),range:b.cursor(h+e.length)};if(n.charCategorizer(h)(a)!=z.Word&&_o(n,h,s)>-1&&!og(n,h,e,s))return{changes:{insert:e+e,from:h},effects:gt.of(h+e.length),range:b.cursor(h+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Jo(n,e){let t=ge(n).resolveInner(e+1);return t.parent&&t.from==e}function og(n,e,t,i){let s=ge(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),h=l.indexOf(t);if(!h||h>-1&&i.indexOf(l.slice(0,h))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+h;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let a=s.to==e&&s.parent;if(!a)break;s=a}return!1}function _o(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=z.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=z.Word)return r}return-1}function Ng(n={}){return[Ae,Be.of(n),Hp,hg,Ma]}const lg=[{key:"Ctrl-Space",run:Ip},{key:"Escape",run:Np},{key:"ArrowDown",run:Hi(!0)},{key:"ArrowUp",run:Hi(!1)},{key:"PageDown",run:Hi(!0,"page")},{key:"PageUp",run:Hi(!1,"page")},{key:"Enter",run:Ep}],hg=kt.highest(_s.computeN([Be],n=>n.facet(Be).defaultKeymap?[lg]:[]));export{vg as A,kg as B,bn as C,Uf as D,O as E,Sg as F,bg as G,ge as H,G as I,Rg as J,xp as K,Bs as L,b as M,Xs as N,xg as O,gh as P,wg as Q,Lg as R,Th as S,F as T,gg as U,N as a,fg as b,Dg as c,ag as d,cg as e,Ag as f,Mg as g,pg as h,Eg as i,Bg as j,_s as k,Ig as l,Tg as m,Pg as n,Og as o,lg as p,Ng as q,dg as r,Cg as s,ug as t,pe as u,R as v,au as w,x,mg as y,mu as z}; diff --git a/ui/dist/assets/index.a9121ab1.js b/ui/dist/assets/index.a9121ab1.js deleted file mode 100644 index 83d5008a2..000000000 --- a/ui/dist/assets/index.a9121ab1.js +++ /dev/null @@ -1,12 +0,0 @@ -class N{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),ze.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),ze.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new ti(this),r=new ti(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new ti(this,e)}iterRange(e,t=this.length){return new Xo(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Yo(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?N.empty:e.length<=32?new J(e):ze.from(J.split(e,[]))}}class J extends N{constructor(e,t=Ra(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new La(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new J(yr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Hi(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new J(l,o.length+r.length));else{let h=l.length>>1;i.push(new J(l.slice(0,h)),new J(l.slice(h)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof J))return super.replace(e,t,i);let s=Hi(this.text,Hi(i.text,yr(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new J(s,r):ze.from(J.split(s,[]),r)}sliceString(e,t=this.length,i=` -`){let s="";for(let r=0,o=0;r<=t&&oe&&o&&(s+=i),er&&(s+=l.slice(Math.max(0,e-r),t-r)),r=h+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new J(i,s)),i=[],s=-1);return s>-1&&t.push(new J(i,s)),t}}class ze extends N{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,h=i+o.lines-1;if((t?h:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=h+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let a=s&((o<=e?1:0)|(h>=t?2:0));o>=e&&h<=t&&!a?i.push(l):l.decompose(e-o,t-o,i,a)}o=h+1}}replace(e,t,i){if(i.lines=r&&t<=l){let h=o.replace(e-r,t-r,i),a=this.lines-o.lines+h.lines;if(h.lines>5-1&&h.lines>a>>5+1){let c=this.children.slice();return c[s]=h,new ze(c,this.length-(t-e)+i.length)}return super.replace(r,l,h)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` -`){let s="";for(let r=0,o=0;re&&r&&(s+=i),eo&&(s+=l.sliceString(e-o,t-o,i)),o=h+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ze))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let h=this.children[s],a=e.children[r];if(h!=a)return i+h.scanIdentical(a,t);i+=h.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new J(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],h=0,a=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof ze)for(let m of d.children)f(m);else d.lines>o&&(h>o||!h)?(u(),l.push(d)):d instanceof J&&h&&(p=c[c.length-1])instanceof J&&d.lines+p.lines<=32?(h+=d.lines,a+=d.length+1,c[c.length-1]=new J(p.text.concat(d.text),p.length+1+d.length)):(h+d.lines>s&&u(),h+=d.lines,a+=d.length+1,c.push(d))}function u(){h!=0&&(l.push(c.length==1?c[0]:ze.from(c,a)),a=-1,h=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new ze(l,t)}}N.empty=new J([""],0);function Ra(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Hi(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r=t&&(h>i&&(l=l.slice(0,i-s)),s0?1:(e instanceof J?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof J?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(s instanceof J){let h=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,h.length>Math.max(0,e))return this.value=e==0?h:t>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=s.children[o+(t<0?-1:0)];e>h.length?(e-=h.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(h),this.offsets.push(t>0?1:(h instanceof J?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Xo{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new ti(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Yo{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(N.prototype[Symbol.iterator]=function(){return this.iter()},ti.prototype[Symbol.iterator]=Xo.prototype[Symbol.iterator]=Yo.prototype[Symbol.iterator]=function(){return this});class La{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let Bt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;nn)return Bt[e-1]<=n;return!1}function br(n){return n>=127462&&n<=127487}const wr=8205;function fe(n,e,t=!0,i=!0){return(t?Qo:Ia)(n,e,i)}function Qo(n,e,t){if(e==n.length)return e;e&&Zo(n.charCodeAt(e))&&el(n.charCodeAt(e-1))&&e--;let i=ie(n,e);for(e+=Se(i);e=0&&br(ie(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Ia(n,e,t){for(;e>0;){let i=Qo(n,e-2,t);if(i=56320&&n<57344}function el(n){return n>=55296&&n<56320}function ie(n,e){let t=n.charCodeAt(e);if(!el(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Zo(i)?(t-55296<<10)+(i-56320)+65536:t}function Hs(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Se(n){return n<65536?1:2}const Yn=/\r\n?|\n/;var le=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(le||(le={}));class Ke{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=le.Simple&&a>=e&&(i==le.TrackDel&&se||i==le.TrackBefore&&se))return null;if(a>e||a==e&&t<0&&!l)return e==s||t<0?r:r+h;r+=h}s=a}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ke(e)}static create(e){return new Ke(e)}}class Y extends Ke{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Qn(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return Zn(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l,t[s+1]=o;let h=s>>1;for(;i.length0&&et(i,t,r.text),r.forward(c),l+=c}let a=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function h(c=!1){if(!c&&!s.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?N.of(d.split(i||Yn)):d:N.empty,m=p.length;if(f==u&&m==0)return;fo&&oe(s,f-o,-1),oe(s,u-f,m),et(r,s,p),o=u}}return a(e),h(!l),l}static empty(e){return new Y(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function et(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],h=n.sections[o++];e(s,a,r,c,f),s=a,r=c}}}function Zn(n,e,t,i=!1){let s=[],r=i?[]:null,o=new oi(n),l=new oi(e);for(let h=-1;;)if(o.ins==-1&&l.ins==-1){let a=Math.min(o.len,l.len);oe(s,a,-1),o.forward(a),l.forward(a)}else if(l.ins>=0&&(o.ins<0||h==o.i||o.off==0&&(l.len=0&&h=0){let a=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);a+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lenh||o.ins>=0&&o.len>h)&&(l||i.length>a),r.forward2(h),o.forward(h)}}}}class oi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?N.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?N.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class pt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new pt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new pt(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;te.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>pt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?4:0))}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;sr.head?b.range(h,l):b.range(l,h))}}return new b(e,t)}}function il(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let zs=0;class D{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=zs++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}static define(e={}){return new D(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:qs),!!e.static,e.enables)}of(e){return new zi([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new zi(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new zi(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function qs(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class zi{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=zs++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,h=!1,a=!1,c=[];for(let f of this.dependencies)f=="doc"?h=!0:f=="selection"?a=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(h&&u.docChanged||a&&(u.docChanged||u.selection)||es(f,c)){let d=i(f);if(l?!xr(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d=i(f),p=u.config.address[r];if(p!=null){let m=Gi(u,p);if(this.dependencies.every(g=>g instanceof D?u.facet(g)===f.facet(g):g instanceof me?u.field(g,!1)==f.field(g,!1):!0)||(l?xr(d,m,s):s(d,m)))return f.values[o]=m,0}return f.values[o]=d,1}}}}function xr(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[h.id]),s=t.map(h=>h.type),r=i.filter(h=>!(h&1)),o=n[e.id]>>1;function l(h){let a=[];for(let c=0;ci===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(kr).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,kr.of({field:this,create:e})]}get extension(){return this}}const dt={lowest:4,low:3,default:2,high:1,highest:0};function Kt(n){return e=>new nl(e,n)}const vt={highest:Kt(dt.highest),high:Kt(dt.high),default:Kt(dt.default),low:Kt(dt.low),lowest:Kt(dt.lowest)};class nl{constructor(e,t){this.inner=e,this.prec=t}}class yn{of(e){return new ts(this,e)}reconfigure(e){return yn.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ts{constructor(e,t){this.compartment=e,this.inner=t}}class Ui{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Va(e,t,o))u instanceof me?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),h=[],a=[];for(let u of s)l[u.id]=a.length<<1,a.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=h.length<<1|1,qs(m,d))h.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));h.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=h.length<<1|1,h.push(g.value)):(l[g.id]=a.length<<1,a.push(y=>g.dynamicSlot(y)));l[p.id]=a.length<<1,a.push(g=>Na(g,p,d))}}let f=a.map(u=>u(l));return new Ui(e,o,f,l,h,r)}}function Va(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let h=s.get(o);if(h!=null){if(h<=l)return;let a=i[h].indexOf(o);a>-1&&i[h].splice(a,1),o instanceof ts&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let a of o)r(a,l);else if(o instanceof ts){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let a=e.get(o.compartment)||o.inner;t.set(o.compartment,a),r(a,l)}else if(o instanceof nl)r(o.inner,o.prec);else if(o instanceof me)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof zi)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,dt.default);else{let a=o.extension;if(!a)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(a,l)}}return r(n,dt.default),i.reduce((o,l)=>o.concat(l))}function ii(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Gi(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const sl=D.define(),rl=D.define({combine:n=>n.some(e=>e),static:!0}),ol=D.define({combine:n=>n.length?n[0]:void 0,static:!0}),ll=D.define(),hl=D.define(),al=D.define(),cl=D.define({combine:n=>n.length?n[0]:!1});class St{constructor(e,t){this.type=e,this.value=t}static define(){return new Fa}}class Fa{of(e){return new St(this,e)}}class Wa{constructor(e){this.map=e}of(e){return new L(this,e)}}class L{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new L(this.type,t)}is(e){return this.type==e}static define(e={}){return new Wa(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}L.reconfigure=L.define();L.appendConfig=L.define();class Q{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&il(i,t.newLength),r.some(l=>l.type==Q.time)||(this.annotations=r.concat(Q.time.of(Date.now())))}static create(e,t,i,s,r,o){return new Q(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Q.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Q.time=St.define();Q.userEvent=St.define();Q.addToHistory=St.define();Q.remote=St.define();function Ha(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i]))r=n[i++],o=n[i++];else if(s=0;s--){let r=i[s](n);r instanceof Q?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Q?n=r[0]:n=ul(e,Pt(r),!1)}return n}function qa(n){let e=n.startState,t=e.facet(al),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=fl(i,is(e,r,n.changes.newLength),!0))}return i==n?n:Q.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const $a=[];function Pt(n){return n==null?$a:Array.isArray(n)?n:[n]}var z=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(z||(z={}));const ja=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ns;try{ns=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Ka(n){if(ns)return ns.test(n);for(let e=0;e"\x80"&&(t.toUpperCase()!=t.toLowerCase()||ja.test(t)))return!0}return!1}function Ua(n){return e=>{if(!/\S/.test(e))return z.Space;if(Ka(e))return z.Word;for(let t=0;t-1)return z.Word;return z.Other}}class I{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ls.set(h,l)),t=null),s.set(o.value.compartment,o.value.extension)):o.is(L.reconfigure)?(t=null,i=o.value):o.is(L.appendConfig)&&(t=null,i=Pt(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=Ui.resolve(i,s,this),r=new I(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,h)=>h.reconfigure(l,this),null).values),new I(t,e.newDoc,e.newSelection,r,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Pt(i.effects);for(let l=1;lo.spec.fromJSON(l,h)))}}return I.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Ui.resolve(e.extensions||[],new Map),i=e.doc instanceof N?e.doc:N.of((e.doc||"").split(t.staticFacet(I.lineSeparator)||Yn)),s=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return il(s,i.length),t.staticFacet(rl)||(s=s.asSingle()),new I(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(I.tabSize)}get lineBreak(){return this.facet(I.lineSeparator)||` -`}get readOnly(){return this.facet(cl)}phrase(e,...t){for(let i of this.facet(I.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(sl))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return Ua(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let h=fe(t,o,!1);if(r(t.slice(h,o))!=z.Word)break;o=h}for(;ln.length?n[0]:4});I.lineSeparator=ol;I.readOnly=cl;I.phrases=D.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});I.languageData=sl;I.changeFilter=ll;I.transactionFilter=hl;I.transactionExtender=al;yn.reconfigure=L.define();function Ct(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class yt{eq(e){return this==e}range(e,t=e){return li.create(e,t,this)}}yt.prototype.startSide=yt.prototype.endSide=0;yt.prototype.point=!1;yt.prototype.mapMode=le.TrackDel;class li{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new li(e,t,i)}}function ss(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class $s{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let h=o+l>>1,a=r[h]-e||(i?this.value[h].endSide:this.value[h].startSide)-t;if(h==o)return a>=0?o:l;a>=0?l=h:o=h+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&a.startSide>0&&a.endSide<=0)continue;(d-u||a.endSide-a.startSide)<0||(o<0&&(o=u),a.point&&(l=Math.max(l,d-u)),i.push(a),s.push(u-o),r.push(d-o))}return{mapped:i.length?new $s(s,r,i,l):null,pos:o}}}class j{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new j(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(ss)),this.isEmpty)return t.length?j.of(t):this;let l=new dl(this,null,-1).goto(0),h=0,a=[],c=new bt;for(;l.value||h=0){let f=t[h++];c.addInner(f.from,f.to,f.value)||a.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return hi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return hi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),h=vr(o,l,i),a=new Ut(o,h,r),c=new Ut(l,h,r);i.iterGaps((f,u,d)=>Sr(a,f,c,u,d,s)),i.empty&&i.length==0&&Sr(a,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=1e9);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=vr(r,o),h=new Ut(r,l,0).goto(i),a=new Ut(o,l,0).goto(i);for(;;){if(h.to!=a.to||!rs(h.active,a.active)||h.point&&(!a.point||!h.point.eq(a.point)))return!1;if(h.to>s)return!0;h.next(),a.next()}}static spans(e,t,i,s,r=-1){let o=new Ut(e,null,r).goto(t),l=t,h=o.openStart;for(;;){let a=Math.min(o.to,i);if(o.point?(s.point(l,a,o.point,o.activeForPoint(o.to),h,o.pointRank),h=o.openEnd(a)+(o.to>a?1:0)):a>l&&(s.span(l,a,o.active,h),h=o.openEnd(a)),o.to>i)break;l=o.to,o.next()}return h}static of(e,t=!1){let i=new bt;for(let s of e instanceof li?[e]:t?Ga(e):e)i.add(s.from,s.to,s.value);return i.finish()}}j.empty=new j([],[],null,-1);function Ga(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(ss);e=i}return n}j.empty.nextLayer=j.empty;class bt{constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}finishChunk(e){this.chunks.push(new $s(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new bt)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(j.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=j.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function vr(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&s.push(new dl(o,t,i,r));return s.length==1?s[0]:new hi(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Pn(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Pn(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Pn(this.heap,0)}}}function Pn(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0&&(s=n[i+1],i++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class Ut{constructor(e,t,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=hi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Si(this.active,e),Si(this.activeTo,e),Si(this.activeRank,e),this.minActive=Cr(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&Si(i,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.frome&&s++,this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function Sr(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,h=i-e;for(;;){let a=n.to+h-t.to||n.endSide-t.endSide,c=a<0?n.to+h:t.to,f=Math.min(c,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&rs(n.activeForPoint(n.to+h),t.activeForPoint(t.to))||r.comparePoint(l,f,n.point,t.point):f>l&&!rs(n.active,t.active)&&r.compareRange(l,f,n.active,t.active),c>o)break;l=c,a<=0&&n.next(),a>=0&&t.next()}}function rs(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function Cr(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=fe(n,s)}return i===!0?-1:n.length}const ls="\u037C",Ar=typeof Symbol>"u"?"__"+ls:Symbol.for(ls),hs=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Mr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ot{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,h,a){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return h.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,h);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&h.push((i&&!f&&!a?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=Mr[Ar]||1;return Mr[Ar]=e+1,ls+e.toString(36)}static mount(e,t){(e[hs]||new Ja(e)).mount(Array.isArray(t)?t:[t])}}let Ai=null;class Ja{constructor(e){if(!e.head&&e.adoptedStyleSheets&&typeof CSSStyleSheet<"u"){if(Ai)return e.adoptedStyleSheets=[Ai.sheet].concat(e.adoptedStyleSheets),e[hs]=Ai;this.sheet=new CSSStyleSheet,e.adoptedStyleSheets=[this.sheet].concat(e.adoptedStyleSheets),Ai=this}else{this.styleTag=(e.ownerDocument||e).createElement("style");let t=e.head||e;t.insertBefore(this.styleTag,t.firstChild)}this.modules=[],e[hs]=this}mount(e){let t=this.sheet,i=0,s=0;for(let r=0;r-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),t)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Dr=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent);typeof navigator<"u"&&/Gecko\/\d+/.test(navigator.userAgent);var _a=typeof navigator<"u"&&/Mac/.test(navigator.platform),Xa=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ya=_a||Dr&&+Dr[1]<57;for(var ne=0;ne<10;ne++)lt[48+ne]=lt[96+ne]=String(ne);for(var ne=1;ne<=24;ne++)lt[ne+111]="F"+ne;for(var ne=65;ne<=90;ne++)lt[ne]=String.fromCharCode(ne+32),ai[ne]=String.fromCharCode(ne);for(var Rn in lt)ai.hasOwnProperty(Rn)||(ai[Rn]=lt[Rn]);function Qa(n){var e=Ya&&(n.ctrlKey||n.altKey||n.metaKey)||Xa&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ai:lt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Ji(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Et(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Za(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function qi(n,e){if(!e.anchorNode)return!1;try{return Et(n,e.anchorNode)}catch{return!1}}function ci(n){return n.nodeType==3?It(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function _i(n,e,t,i){return t?Or(n,e,t,i,-1)||Or(n,e,t,i,1):!1}function Xi(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function Or(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:fi(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=Xi(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?fi(n):0}else return!1}}function fi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}const pl={left:0,right:0,top:0,bottom:0};function bn(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function ec(n){return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function tc(n,e,t,i,s,r,o,l){let h=n.ownerDocument,a=h.defaultView||window;for(let c=n;c;)if(c.nodeType==1){let f,u=c==h.body;if(u)f=ec(a);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let m=c.getBoundingClientRect();f={left:m.left,right:m.left+c.clientWidth,top:m.top,bottom:m.top+c.clientHeight}}let d=0,p=0;if(s=="nearest")e.top0&&e.bottom>f.bottom+p&&(p=e.bottom-f.bottom+p+o)):e.bottom>f.bottom&&(p=e.bottom-f.bottom+o,t<0&&e.top-p0&&e.right>f.right+d&&(d=e.right-f.right+d+r)):e.right>f.right&&(d=e.right-f.right+r,t<0&&e.leftt)return f.domBoundsAround(e,t,a);if(u>=e&&s==-1&&(s=h,r=a),a>t&&f.dom.parentNode==this.dom){o=h,l=c;break}c=u,a=u+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.dirty|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.dirty|=2),t.dirty&1)return;t.dirty|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.dirty&&this.markParentsDirty(!0))}setDOM(e){this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=js){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function bl(n,e,t,i,s,r,o,l,h){let{children:a}=n,c=a.length?a[e]:null,f=r.length?r[r.length-1]:null,u=f?f.breakAfter:o;if(!(e==i&&c&&!o&&!u&&r.length<2&&c.merge(t,s,r.length?f:null,t==0,l,h))){if(i0&&(!o&&r.length&&c.merge(t,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(t2);var A={mac:Lr||/Mac/.test(Ce.platform),windows:/Win/.test(Ce.platform),linux:/Linux|X11/.test(Ce.platform),ie:wn,ie_version:xl?as.documentMode||6:fs?+fs[1]:cs?+cs[1]:0,gecko:Pr,gecko_version:Pr?+(/Firefox\/(\d+)/.exec(Ce.userAgent)||[0,0])[1]:0,chrome:!!Ln,chrome_version:Ln?+Ln[1]:0,ios:Lr,android:/Android\b/.test(Ce.userAgent),webkit:Rr,safari:kl,webkit_version:Rr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:as.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const rc=256;class ht extends H{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return i&&(!(i instanceof ht)||this.length-(t-e)+i.length>rc)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new ht(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new he(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return us(this.dom,e,t)}}class Ue extends H{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let s of t)s.setParent(this)}setAttrs(e){if(ml(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.dirty|=6)}sync(e){this.dom?this.dirty&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e)}merge(e,t,i,s,r,o){return i&&(!(i instanceof Ue&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(s=r),i=h,r++}let o=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new Ue(this.mark,t,o)}domAtPos(e){return Cl(this,e)}coordsAt(e,t){return Ml(this,e,t)}}function us(n,e,t){let i=n.nodeValue.length;e>i&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?A.chrome||A.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return A.safari&&!o&&h.width==0&&(h=Array.prototype.find.call(l,a=>a.width)||h),o?bn(h,o<0):h||null}class tt extends H{constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}static create(e,t,i){return new(e.customView||tt)(e,t,i)}split(e){let t=tt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(){(!this.dom||!this.widget.updateDOM(this.dom))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,i,s,r,o){return i&&(!(i instanceof tt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0?i.length-1:0;s=i[r],!(e>0?r==0:r==i.length-1||s.top0?-1:1);return e==0&&t>0||e==this.length&&t<=0?s:bn(s,e==0)}get isEditable(){return!1}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class vl extends tt{domAtPos(e){let{topView:t,text:i}=this.widget;return t?ds(e,0,t,i,(s,r)=>s.domAtPos(r),s=>new he(i,Math.min(s,i.nodeValue.length))):new he(i,Math.min(e,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(e,t){let{topView:i,text:s}=this.widget;return i?Sl(e,t,i,s):Math.min(t,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(e,t){let{topView:i,text:s}=this.widget;return i?ds(e,t,i,s,(r,o,l)=>r.coordsAt(o,l),(r,o)=>us(s,r,o)):us(s,e,t)}destroy(){var e;super.destroy(),(e=this.widget.topView)===null||e===void 0||e.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function ds(n,e,t,i,s,r){if(t instanceof Ue){for(let o=t.dom.firstChild;o;o=o.nextSibling){let l=H.get(o);if(!l)return r(n,e);let h=Et(o,i),a=l.length+(h?i.nodeValue.length:0);if(n0?-1:1);return i&&i.topt.top?{left:t.left,right:t.right,top:i.top,bottom:i.bottom}:t}get overrideDOMText(){return N.empty}}ht.prototype.children=tt.prototype.children=Nt.prototype.children=js;function oc(n,e){let t=n.parent,i=t?t.children.indexOf(n):-1;for(;t&&i>=0;)if(e<0?i>0:ir&&e0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r0&&e instanceof Ue&&s.length&&(i=s[s.length-1])instanceof Ue&&i.mark.eq(e.mark)?Al(i,e.children[0],t-1):(s.push(e),e.setParent(n)),n.length+=e.length}function Ml(n,e,t){for(let r=0,o=0;o0?h>=e:h>e)&&(e0)){let c=0;if(h==r){if(l.getSide()<=0)continue;c=t=-l.getSide()}let f=l.coordsAt(Math.max(0,e-r),t);return c&&f?bn(f,t<0):f}r=h}let i=n.dom.lastChild;if(!i)return n.dom.getBoundingClientRect();let s=ci(i);return s[s.length-1]||null}function ps(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}function Ks(n,e){if(n==e)return!0;if(!n||!e)return!1;let t=Object.keys(n),i=Object.keys(e);if(t.length!=i.length)return!1;for(let s of t)if(i.indexOf(s)==-1||n[s]!==e[s])return!1;return!0}function gs(n,e,t){let i=null;if(e)for(let s in e)t&&s in t||n.removeAttribute(i=s);if(t)for(let s in t)e&&e[s]==t[s]||n.setAttribute(i=s,t[s]);return!!i}class at{eq(e){return!1}updateDOM(e){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}ignoreEvent(e){return!0}get customView(){return null}destroy(e){}}var q=function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n}(q||(q={}));class T extends yt{constructor(e,t,i,s){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(e){return new xn(e)}static widget(e){let t=e.side||0,i=!!e.block;return t+=i?t>0?3e8:-4e8:t>0?1e8:-1e8,new wt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=Dl(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new wt(e,i,s,t,e.widget||null,!0)}static line(e){return new wi(e)}static set(e,t=!1){return j.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}T.none=j.empty;class xn extends T{constructor(e){let{start:t,end:i}=Dl(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){return this==e||e instanceof xn&&this.tagName==e.tagName&&this.class==e.class&&Ks(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}xn.prototype.point=!1;class wi extends T{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof wi&&Ks(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}wi.prototype.mapMode=le.TrackBefore;wi.prototype.point=!0;class wt extends T{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?le.TrackBefore:le.TrackAfter:le.TrackDel}get type(){return this.startSide=5}eq(e){return e instanceof wt&&lc(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}wt.prototype.point=!0;function Dl(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t!=null?t:e,end:i!=null?i:e}}function lc(n,e){return n==e||!!(n&&e&&n.compare(e))}function ms(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class ue extends H{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,i,s,r,o){if(i){if(!(i instanceof ue))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),wl(this,e,t,i?i.children:[],r,o),!0}split(e){let t=new ue;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i,off:s}=this.childPos(e);s&&(t.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let r=i;r0&&this.children[i-1].length==0;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=e,t}transferDOM(e){!this.dom||(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Ks(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Al(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=ps(t,this.attrs||{})),i&&(this.attrs=ps({class:i},this.attrs||{}))}domAtPos(e){return Cl(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.dirty|=6)}sync(e){var t;this.dom?this.dirty&4&&(ml(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(gs(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e);let i=this.dom.lastChild;for(;i&&H.get(i)instanceof Ue;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((t=H.get(i))===null||t===void 0?void 0:t.isEditable)==!1&&(!A.ios||!this.children.some(s=>s instanceof ht))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0;for(let t of this.children){if(!(t instanceof ht)||/[^ -~]/.test(t.text))return null;let i=ci(t.dom);if(i.length!=1)return null;e+=i[0].width}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length}:null}coordsAt(e,t){return Ml(this,e,t)}become(e){return!1}get type(){return q.Text}static find(e,t){for(let i=0,s=0;i=t){if(r instanceof ue)return r;if(o>t)break}s=o+r.breakAfter}return null}}class mt extends H{constructor(e,t,i){super(),this.widget=e,this.length=t,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,s,r,o){return i&&(!(i instanceof mt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0;){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer([]),this.curLine=null,e--;continue}else this.text=r,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(0,i)),this.getLine().append(Mi(new ht(this.text.slice(this.textOff,this.textOff+s)),t),i),this.atCursorPos=!0,this.textOff+=s,e-=s,i=0}}span(e,t,i,s){this.buildText(t-e,i,s),this.pos=t,this.openStart<0&&(this.openStart=s)}point(e,t,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof wt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(i instanceof wt)if(i.block){let{type:h}=i;h==q.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new mt(i.widget||new Er("div"),l,h))}else{let h=tt.create(i.widget||new Er("span"),l,i.startSide),a=this.atCursorPos&&!h.isEditable&&r<=s.length&&(e0),c=!h.isEditable&&(en.some(e=>e)});class Yi{constructor(e,t="nearest",i="nearest",s=5,r=5){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r}map(e){return e.empty?this:new Yi(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const Ir=L.define({map:(n,e)=>n.map(e)});function Ee(n,e,t){let i=n.facet(Pl);i.length?i[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const kn=D.define({combine:n=>n.length?n[0]:!0});let hc=0;const Xt=D.define();class de{constructor(e,t,i,s){this.id=e,this.create=t,this.domEventHandlers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:i,provide:s,decorations:r}=t||{};return new de(hc++,e,i,o=>{let l=[Xt.of(o)];return r&&l.push(ui.of(h=>{let a=h.plugin(o);return a?r(a):T.none})),s&&l.push(s(o)),l})}static fromClass(e,t){return de.define(i=>new e(i),t)}}class En{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(Ee(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){Ee(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){Ee(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const El=D.define(),Il=D.define(),ui=D.define(),Nl=D.define(),Vl=D.define(),Yt=D.define();class _e{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new _e(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toAc)break;r+=2}if(!h)return i;new _e(h.fromA,h.toA,h.fromB,h.toB).addToSet(i),o=h.toA,l=h.toB}}}class Qi{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=Y.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let s=[];this.changes.iterChangedRanges((o,l,h,a)=>s.push(new _e(o,l,h,a))),this.changedRanges=s;let r=e.hasFocus;r!=e.inputState.notifiedFocused&&(e.inputState.notifiedFocused=r,this.flags|=1)}static create(e,t,i){return new Qi(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}var _=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(_||(_={}));const bs=_.LTR,ac=_.RTL;function Fl(n){let e=[];for(let t=0;t=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}const $=[];function pc(n,e){let t=n.length,i=e==bs?1:2,s=e==bs?2:1;if(!n||i==1&&!dc.test(n))return Wl(t);for(let o=0,l=i,h=i;o=0;u-=3)if(Ne[u+1]==-c){let d=Ne[u+2],p=d&2?i:d&4?d&1?s:i:0;p&&($[o]=$[Ne[u]]=p),l=u;break}}else{if(Ne.length==189)break;Ne[l++]=o,Ne[l++]=a,Ne[l++]=h}else if((f=$[o])==2||f==1){let u=f==i;h=u?0:1;for(let d=l-3;d>=0;d-=3){let p=Ne[d+2];if(p&2)break;if(u)Ne[d+2]|=2;else{if(p&4)break;Ne[d+2]|=4}}}for(let o=0;ol;){let c=a,f=$[--a]!=2;for(;a>l&&f==($[a-1]!=2);)a--;r.push(new Rt(a,c,f?2:1))}else r.push(new Rt(l,o,0))}else for(let o=0;o1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=H.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+Math.min(t,i.offset))}}function Nr(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}class Vr{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Fr extends H{constructor(e){super(),this.view=e,this.compositionDeco=T.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ue],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new _e(0,0,0,e.state.doc.length)],0)}get editorView(){return this.view}get length(){return this.view.state.doc.length}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:o,toA:l})=>lthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=T.none:(e.transactions.length||this.dirty)&&(this.compositionDeco=yc(this.view,e.changes)),(A.ie||A.chrome)&&!this.compositionDeco.size&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,s=this.updateDeco(),r=kc(i,s,e.changes);return t=_e.extendWithRanges(t,r),this.dirty==0&&t.length==0?!1:(this.updateInner(t,e.startState.doc.length),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=A.chrome||A.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(r),this.dirty=0,r&&(r.written||i.selectionRange.focusNode!=r.node)&&(this.forceSelection=!0),this.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to=0?e[s]:null;if(!r)break;let{fromA:o,toA:l,fromB:h,toB:a}=r,{content:c,breakAtStart:f,openStart:u,openEnd:d}=Us.build(this.view.state.doc,h,a,this.decorations,this.dynamicDecorationMap),{i:p,off:m}=i.findPos(l,1),{i:g,off:y}=i.findPos(o,-1);bl(this,g,y,p,m,c,f,u,d)}}updateSelection(e=!1,t=!1){if((e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange(),!(t||this.mayControlSelection()))return;let i=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,r=this.domAtPos(s.anchor),o=s.empty?r:this.domAtPos(s.head);if(A.gecko&&s.empty&&mc(r)){let h=document.createTextNode("");this.view.observer.ignore(()=>r.node.insertBefore(h,r.node.childNodes[r.offset]||null)),r=o=new he(h,0),i=!0}let l=this.view.observer.selectionRange;(i||!l.focusNode||!_i(r.node,r.offset,l.anchorNode,l.anchorOffset)||!_i(o.node,o.offset,l.focusNode,l.focusOffset))&&(this.view.observer.ignore(()=>{A.android&&A.chrome&&this.dom.contains(l.focusNode)&&vc(l.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Ji(this.view.root);if(h)if(s.empty){if(A.gecko){let a=wc(r.node,r.offset);if(a&&a!=3){let c=$l(r.node,r.offset,a==1?1:-1);c&&(r=new he(c,a==1?0:c.nodeValue.length))}}h.collapse(r.node,r.offset),s.bidiLevel!=null&&l.cursorBidiLevel!=null&&(l.cursorBidiLevel=s.bidiLevel)}else if(h.extend){h.collapse(r.node,r.offset);try{h.extend(o.node,o.offset)}catch{}}else{let a=document.createRange();s.anchor>s.head&&([r,o]=[o,r]),a.setEnd(o.node,o.offset),a.setStart(r.node,r.offset),h.removeAllRanges(),h.addRange(a)}}),this.view.observer.setSelectionRange(r,o)),this.impreciseAnchor=r.precise?null:new he(l.anchorNode,l.anchorOffset),this.impreciseHead=o.precise?null:new he(l.focusNode,l.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let e=this.view.state.selection.main,t=Ji(this.view.root);if(!t||!e.empty||!e.assoc||!t.modify)return;let i=ue.find(this,e.head);if(!i)return;let s=i.posAtStart;if(e.head==s||e.head==s+i.length)return;let r=this.coordsAt(e.head,-1),o=this.coordsAt(e.head,1);if(!r||!o||r.bottom>o.top)return;let l=this.domAtPos(e.head+e.assoc);t.collapse(l.node,l.offset),t.modify("move",e.assoc<0?"forward":"backward","lineboundary")}mayControlSelection(){let e=this.view.root.activeElement;return e==this.dom||qi(this.dom,this.view.observer.selectionRange)&&!(e&&this.dom.contains(e))}nearest(e){for(let t=e;t;){let i=H.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;to||e==o&&r.type!=q.WidgetBefore&&r.type!=q.WidgetAfter&&(!s||t==2||this.children[s-1].breakAfter||this.children[s-1].type==q.WidgetBefore&&t>-2))return r.coordsAt(e-o,t);i=o}}measureVisibleLineHeights(e){let t=[],{from:i,to:s}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,h=this.view.textDirection==_.LTR;for(let a=0,c=0;cs)break;if(a>=i){let d=f.dom.getBoundingClientRect();if(t.push(d.height),o){let p=f.dom.lastChild,m=p?ci(p):[];if(m.length){let g=m[m.length-1],y=h?g.right-d.left:d.right-g.left;y>l&&(l=y,this.minWidth=r,this.minWidthFrom=a,this.minWidthTo=u)}}}a=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?_.RTL:_.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ue){let r=s.measureTextSize();if(r)return r}let e=document.createElement("div"),t,i;return e.className="cm-line",e.style.width="99999px",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=ci(e.firstChild)[0];t=e.getBoundingClientRect().height,i=s?s.width/27:7,e.remove()}),{lineHeight:t,charWidth:i}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new yl(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.length;if(o>i){let l=t.lineBlockAt(o).bottom-t.lineBlockAt(i).top;e.push(T.replace({widget:new Wr(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return T.set(e)}updateDeco(){let e=this.view.state.facet(ui).map((t,i)=>(this.dynamicDecorationMap[i]=typeof t=="function")?t(this.view):t);for(let t=e.length;tt.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=0,o=0,l=0,h=0;for(let c of this.view.state.facet(Vl).map(f=>f(this.view)))if(c){let{left:f,right:u,top:d,bottom:p}=c;f!=null&&(r=Math.max(r,f)),u!=null&&(o=Math.max(o,u)),d!=null&&(l=Math.max(l,d)),p!=null&&(h=Math.max(h,p))}let a={left:i.left-r,top:i.top-l,right:i.right+o,bottom:i.bottom+h};tc(this.view.scrollDOM,a,t.head0&&t<=0)n=n.childNodes[e-1],e=fi(n);else if(n.nodeType==1&&e=0)n=n.childNodes[e],e=0;else return null}}function wc(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e0;){let a=fe(s.text,o,!1);if(i(s.text.slice(a,o))!=h)break;o=a}for(;ln?e.left-n:Math.max(0,n-e.right)}function Ac(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function In(n,e){return n.tope.top+1}function Hr(n,e){return en.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function xs(n,e,t){let i,s,r,o,l=!1,h,a,c,f;for(let p=n.firstChild;p;p=p.nextSibling){let m=ci(p);for(let g=0;gS||o==S&&r>v)&&(i=p,s=y,r=v,o=S,l=!v||(v>0?g0)),v==0?t>y.bottom&&(!c||c.bottomy.top)&&(a=p,f=y):c&&In(c,y)?c=zr(c,y.bottom):f&&In(f,y)&&(f=Hr(f,y.top))}}if(c&&c.bottom>=t?(i=h,s=c):f&&f.top<=t&&(i=a,s=f),!i)return{node:n,offset:0};let u=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return qr(i,u,t);if(l&&i.contentEditable!="false")return xs(i,u,t);let d=Array.prototype.indexOf.call(n.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:n,offset:d}}function qr(n,e,t){let i=n.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;lt?c.top-t:t-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=u;if((A.chrome||A.gecko)&&It(n,l).getBoundingClientRect().left==c.right&&(d=!u),f<=0)return{node:n,offset:l+(d?1:0)};s=l+(d?1:0),r=f}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function jl(n,{x:e,y:t},i,s=-1){var r;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,h,{docHeight:a}=n.viewState,c=t-l;if(c<0)return 0;if(c>a)return n.state.doc.length;for(let y=n.defaultLineHeight/2,v=!1;h=n.elementAtHeight(c),h.type!=q.Text;)for(;c=s>0?h.bottom+y:h.top-y,!(c>=0&&c<=a);){if(v)return i?null:0;v=!0,s=-s}t=l+c;let f=h.from;if(fn.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:i?null:$r(n,o,h,e,t);let u=n.dom.ownerDocument,d=n.root.elementFromPoint?n.root:u,p=d.elementFromPoint(e,t);p&&!n.contentDOM.contains(p)&&(p=null),p||(e=Math.max(o.left+1,Math.min(o.right-1,e)),p=d.elementFromPoint(e,t),p&&!n.contentDOM.contains(p)&&(p=null));let m,g=-1;if(p&&((r=n.docView.nearest(p))===null||r===void 0?void 0:r.isEditable)!=!1){if(u.caretPositionFromPoint){let y=u.caretPositionFromPoint(e,t);y&&({offsetNode:m,offset:g}=y)}else if(u.caretRangeFromPoint){let y=u.caretRangeFromPoint(e,t);y&&({startContainer:m,startOffset:g}=y,(!n.contentDOM.contains(m)||A.safari&&Mc(m,g,e)||A.chrome&&Dc(m,g,e))&&(m=void 0))}}if(!m||!n.docView.dom.contains(m)){let y=ue.find(n.docView,f);if(!y)return c>h.top+h.height/2?h.to:h.from;({node:m,offset:g}=xs(y.dom,e,t))}return n.docView.posFromDOM(m,g)}function $r(n,e,t,i,s){let r=Math.round((i-e.left)*n.defaultCharacterWidth);n.lineWrapping&&t.height>n.defaultLineHeight*1.5&&(r+=Math.floor((s-t.top)/n.defaultLineHeight)*n.viewState.heightOracle.lineLength);let o=n.state.sliceDoc(t.from,t.to);return t.from+os(o,r,n.state.tabSize)}function Mc(n,e,t){let i;if(n.nodeType!=3||e!=(i=n.nodeValue.length))return!1;for(let s=n.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return!1;return It(n,i-1,i).getBoundingClientRect().left>t}function Dc(n,e,t){if(e!=0)return!1;for(let s=n;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return!1;if(r.classList.contains("cm-line"))break;s=r}let i=n.nodeType==1?n.getBoundingClientRect():It(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Oc(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=!i||!n.lineWrapping?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let h=n.dom.getBoundingClientRect(),a=n.textDirectionAt(s.from),c=n.posAtCoords({x:t==(a==_.LTR)?h.right-1:h.left+1,y:(r.top+r.bottom)/2});if(c!=null)return b.cursor(c,t?-1:1)}let o=ue.find(n.docView,e.head),l=o?t?o.posAtEnd:o.posAtStart:t?s.to:s.from;return b.cursor(l,t?-1:1)}function jr(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,h=null;;){let a=gc(s,r,o,l,t),c=Hl;if(!a){if(s.number==(t?n.state.doc.lines:1))return l;c=` -`,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),a=b.cursor(t?s.from:s.to)}if(h){if(!h(c))return l}else{if(!i)return a;h=i(c)}l=a}}function Tc(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==z.Space&&(s=o),s==o}}function Bc(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return b.cursor(s,e.assoc);let o=e.goalColumn,l,h=n.contentDOM.getBoundingClientRect(),a=n.coordsAtPos(s),c=n.documentTop;if(a)o==null&&(o=a.left-h.left),l=r<0?a.top:a.bottom;else{let d=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(h.right-h.left,n.defaultCharacterWidth*(s-d.from))),l=(r<0?d.top:d.bottom)+c}let f=h.left+o,u=i!=null?i:n.defaultLineHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,m=jl(n,{x:f,y:p},!1,r);if(ph.bottom||(r<0?ms))return b.cursor(m,e.assoc,void 0,o)}}function Nn(n,e,t){let i=n.state.facet(Nl).map(s=>s(n));for(;;){let s=!1;for(let r of i)r.between(t.from-1,t.from+1,(o,l,h)=>{t.from>o&&t.fromt.from?b.cursor(o,1):b.cursor(l,-1),s=!0)});if(!s)return t}}class Pc{constructor(e){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.mouseSelection=null;for(let t in Z){let i=Z[t];e.contentDOM.addEventListener(t,s=>{!Kr(e,s)||this.ignoreDuringComposition(s)||t=="keydown"&&this.keydown(e,s)||(this.mustFlushObserver(s)&&e.observer.forceFlush(),this.runCustomHandlers(t,e,s)?s.preventDefault():i(e,s))},ks[t]),this.registeredEvents.push(t)}A.chrome&&A.chrome_version==102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,A.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,t){var i;let s;this.customHandlers=[];for(let r of t)if(s=(i=r.update(e).spec)===null||i===void 0?void 0:i.domEventHandlers){this.customHandlers.push({plugin:r.value,handlers:s});for(let o in s)this.registeredEvents.indexOf(o)<0&&o!="scroll"&&(this.registeredEvents.push(o),e.contentDOM.addEventListener(o,l=>{!Kr(e,l)||this.runCustomHandlers(o,e,l)&&l.preventDefault()}))}}runCustomHandlers(e,t,i){for(let s of this.customHandlers){let r=s.handlers[e];if(r)try{if(r.call(s.plugin,i,t)||i.defaultPrevented)return!0}catch(o){Ee(t.state,o)}}return!1}runScrollHandlers(e,t){this.lastScrollTop=e.scrollDOM.scrollTop,this.lastScrollLeft=e.scrollDOM.scrollLeft;for(let i of this.customHandlers){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,t,e)}catch(r){Ee(e.state,r)}}}keydown(e,t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()s.keyCode==t.keyCode))&&!t.ctrlKey||Rc.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=i||t,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,ni(e.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:A.safari&&!A.ios&&Date.now()-this.compositionEndedAt<100?(this.compositionEndedAt=0,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const Kl=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Rc="dthko",Ul=[16,17,18,20,91,92,224,225];class Lc{constructor(e,t,i,s){this.view=e,this.style=i,this.mustSelect=s,this.lastEvent=t;let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(I.allowMultipleSelections)&&Ec(e,t),this.dragMove=Ic(e,t),this.dragging=Nc(e,t)&&Xl(t)==1?null:!1,this.dragging===!1&&(t.preventDefault(),this.select(t))}move(e){if(e.buttons==0)return this.destroy();this.dragging===!1&&this.select(this.lastEvent=e)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}select(e){let t=this.style.get(e,this.extend,this.multiple);(this.mustSelect||!t.eq(this.view.state.selection)||t.main.assoc!=this.view.state.selection.main.assoc)&&this.view.dispatch({selection:t,userEvent:"select.pointer",scrollIntoView:!0}),this.mustSelect=!1}update(e){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Ec(n,e){let t=n.state.facet(Ol);return t.length?t[0](e):A.mac?e.metaKey:e.ctrlKey}function Ic(n,e){let t=n.state.facet(Tl);return t.length?t[0](e):A.mac?!e.altKey:!e.ctrlKey}function Nc(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Ji(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Kr(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=H.get(t))&&i.ignoreEvent(e))return!1;return!0}const Z=Object.create(null),ks=Object.create(null),Gl=A.ie&&A.ie_version<15||A.ios&&A.webkit_version<604;function Vc(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Jl(n,t.value)},50)}function Jl(n,e){let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(vs!=null&&t.selection.ranges.every(h=>h.empty)&&vs==r.toString()){let h=-1;i=t.changeByRange(a=>{let c=t.doc.lineAt(a.from);if(c.from==h)return{range:a};h=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:b.cursor(a.from+f.length)}})}else o?i=t.changeByRange(h=>{let a=r.line(s++);return{changes:{from:h.from,to:h.to,insert:a.text},range:b.cursor(h.from+a.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Z.keydown=(n,e)=>{n.inputState.setSelectionOrigin("select"),e.keyCode==27?n.inputState.lastEscPress=Date.now():Ul.indexOf(e.keyCode)<0&&(n.inputState.lastEscPress=0)};Z.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};Z.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};ks.touchstart=ks.touchmove={passive:!0};Z.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return;let t=null;for(let i of n.state.facet(Bl))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=Hc(n,e)),t){let i=n.root.activeElement!=n.contentDOM;i&&n.observer.ignore(()=>gl(n.contentDOM)),n.inputState.startMouseSelection(new Lc(n,e,t,i))}};function Ur(n,e,t,i){if(i==1)return b.cursor(e,t);if(i==2)return Sc(n.state,e,t);{let s=ue.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return ln>=e.top&&n<=e.bottom,Gr=(n,e,t)=>_l(e,t)&&n>=t.left&&n<=t.right;function Fc(n,e,t,i){let s=ue.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Gr(t,i,o))return-1;let l=s.coordsAt(r,1);return l&&Gr(t,i,l)?1:o&&_l(i,o)?-1:1}function Jr(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Fc(n,t,e.clientX,e.clientY)}}const Wc=A.ie&&A.ie_version<=11;let _r=null,Xr=0,Yr=0;function Xl(n){if(!Wc)return n.detail;let e=_r,t=Yr;return _r=n,Yr=Date.now(),Xr=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(Xr+1)%3:1}function Hc(n,e){let t=Jr(n,e),i=Xl(e),s=n.state.selection,r=t,o=e;return{update(l){l.docChanged&&(t.pos=l.changes.mapPos(t.pos),s=s.map(l.changes),o=null)},get(l,h,a){let c;o&&l.clientX==o.clientX&&l.clientY==o.clientY?c=r:(c=r=Jr(n,l),o=l);let f=Ur(n,c.pos,c.bias,i);if(t.pos!=c.pos&&!h){let u=Ur(n,t.pos,t.bias,i),d=Math.min(u.from,f.from),p=Math.max(u.to,f.to);f=d1&&s.ranges.some(u=>u.eq(f))?zc(s,f):a?s.addRange(f):b.create([f])}}}function zc(n,e){for(let t=0;;t++)if(n.ranges[t].eq(e))return b.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}Z.dragstart=(n,e)=>{let{selection:{main:t}}=n.state,{mouseSelection:i}=n.inputState;i&&(i.dragging=t),e.dataTransfer&&(e.dataTransfer.setData("Text",n.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove")};function Qr(n,e,t,i){if(!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:r}=n.inputState,o=i&&r&&r.dragging&&r.dragMove?{from:r.dragging.from,to:r.dragging.to}:null,l={from:s,insert:t},h=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:h,selection:{anchor:h.mapPos(s,-1),head:h.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}Z.drop=(n,e)=>{if(!e.dataTransfer)return;if(n.state.readOnly)return e.preventDefault();let t=e.dataTransfer.files;if(t&&t.length){e.preventDefault();let i=Array(t.length),s=0,r=()=>{++s==t.length&&Qr(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}}else Qr(n,e,e.dataTransfer.getData("Text"),!0)};Z.paste=(n,e)=>{if(n.state.readOnly)return e.preventDefault();n.observer.flush();let t=Gl?null:e.clipboardData;t?(Jl(n,t.getData("text/plain")),e.preventDefault()):Vc(n)};function qc(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function $c(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:e.join(n.lineBreak),ranges:t,linewise:i}}let vs=null;Z.copy=Z.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=$c(n.state);if(!t&&!s)return;vs=s?t:null;let r=Gl?null:e.clipboardData;r?(e.preventDefault(),r.clearData(),r.setData("text/plain",t)):qc(n,t),e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"})};function Yl(n){setTimeout(()=>{n.hasFocus!=n.inputState.notifiedFocused&&n.update([])},10)}Z.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),Yl(n)};Z.blur=n=>{n.observer.clearSelectionRange(),Yl(n)};Z.compositionstart=Z.compositionupdate=n=>{n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0)};Z.compositionend=n=>{n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionFirstChange=null,A.chrome&&A.android&&n.observer.flushSoon(),setTimeout(()=>{n.inputState.composing<0&&n.docView.compositionDeco.size&&n.update([])},50)};Z.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Z.beforeinput=(n,e)=>{var t;let i;if(A.chrome&&A.android&&(i=Kl.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var r;(((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}};const Zr=["pre-wrap","normal","pre-line","break-spaces"];class jc{constructor(){this.doc=N.empty,this.lineWrapping=!1,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength)),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Zr.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=i,this.lineLength=s,l){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>$i&&(e.heightChanged=!0),this.height=t)}replace(e,t,i){return we.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this;for(let o=s.length-1;o>=0;o--){let{fromA:l,toA:h,fromB:a,toB:c}=s[o],f=r.lineAt(l,W.ByPosNoHeight,t,0,0),u=f.to>=h?f:r.lineAt(h,W.ByPosNoHeight,t,0,0);for(c+=u.to-h,h=u.to;o>0&&f.from<=s[o-1].toA;)l=s[o-1].fromA,a=s[o-1].fromB,o--,lr*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setHeight(e,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ve extends Ql{constructor(e,t){super(e,t,q.Text),this.collapsed=0,this.widgetHeight=0}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof ve||s instanceof te&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof te?s=new ve(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):we.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setHeight(e,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class te extends we{constructor(e){super(e,0)}lines(e,t){let i=e.lineAt(t).number,s=e.lineAt(t+this.length).number;return{firstLine:i,lastLine:s,lineHeight:this.height/(s-i+1)}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,lineHeight:l}=this.lines(t,s),h=Math.max(0,Math.min(o-r,Math.floor((e-i)/l))),{from:a,length:c}=t.line(r+h);return new nt(a,c,i+l*h,l,q.Text)}lineAt(e,t,i,s,r){if(t==W.ByHeight)return this.blockAt(e,i,s,r);if(t==W.ByPosNoHeight){let{from:f,to:u}=i.lineAt(e);return new nt(f,u-f,0,0,q.Text)}let{firstLine:o,lineHeight:l}=this.lines(i,r),{from:h,length:a,number:c}=i.lineAt(e);return new nt(h,a,s+l*(c-o),l,q.Text)}forEachLine(e,t,i,s,r,o){let{firstLine:l,lineHeight:h}=this.lines(i,r);for(let a=Math.max(e,r),c=Math.min(r+this.length,t);a<=c;){let f=i.lineAt(a);a==e&&(s+=h*(f.number-l)),o(new nt(f.from,f.length,s,h,q.Text)),s+=h,a=f.to+1}}replace(e,t,i){let s=this.length-t;if(s>0){let r=i[i.length-1];r instanceof te?i[i.length-1]=new te(r.length+s):i.push(null,new te(s-1))}if(e>0){let r=i[0];r instanceof te?i[0]=new te(e+r.length):i.unshift(new te(e-1),null)}return we.of(i)}decomposeLeft(e,t){t.push(new te(e-1),null)}decomposeRight(e,t){t.push(null,new te(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),h=-1,a=e.heightChanged;for(s.from>t&&o.push(new te(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let f=e.doc.lineAt(l).length;o.length&&o.push(null);let u=s.heights[s.index++];h==-1?h=u:Math.abs(u-h)>=$i&&(h=-2);let d=new ve(f,u);d.outdated=!1,o.push(d),l+=f+1}l<=r&&o.push(null,new te(r-l).updateHeight(e,l));let c=we.of(o);return e.heightChanged=a||h<0||Math.abs(c.height-this.height)>=$i||Math.abs(h-this.lines(e.doc,t).lineHeight)>=$i,c}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Uc extends we{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return a;let c=t==W.ByPosNoHeight?W.ByPosNoHeight:W.ByPos;return h?a.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(a)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,h=r+this.left.length+this.break;if(this.break)e=h&&this.right.forEachLine(e,t,i,l,h,o);else{let a=this.lineAt(h,W.ByPos,i,s,r);e=e&&a.from<=t&&o(a),t>a.to&&this.right.forEachLine(a.to+1,t,i,l,h,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&eo(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?we.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,h=null;return s&&s.from<=t+r.length&&s.more?h=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?h=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),h?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function eo(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof te&&(i=n[e+1])instanceof te&&n.splice(e-1,3,new te(t.length+1+i.length))}const Gc=5;class Gs{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof ve?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new ve(i-this.pos,-1)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=Gc)&&this.addLineDeco(s,r)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new ve(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new te(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ve)return e;let t=new ve(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine(),e.type==q.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,e.type!=q.WidgetBefore&&(this.covering=e)}addLineDeco(e,t){let i=this.ensureLine();i.length+=t,i.collapsed+=t,i.widgetHeight=Math.max(i.widgetHeight,e),this.writtenTo=this.pos=this.pos+t}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof ve)&&!this.isCovered?this.nodes.push(new ve(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),h=a==n.parentNode?u.bottom:Math.min(h,u.bottom)}a=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(a.nodeType==11)a=a.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,h)-(t.top+e)}}function Yc(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Vn{constructor(e,t,i){this.from=e,this.to=t,this.size=i}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof t!="function"),this.heightMap=we.empty().applyChanges(this.stateDeco,N.empty,this.heightOracle.setDoc(e.doc),[new _e(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=T.set(this.lineGaps.map(t=>t.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new Di(r,o))}}this.viewports=e.sort((i,s)=>i.from-s.from),this.scaler=this.heightMap.height<=7e6?no:new tf(this.heightOracle.doc,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.state.doc,0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:Qt(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(ui).filter(a=>typeof a!="function");let s=e.changedRanges,r=_e.extendWithRanges(s,Jc(i,this.stateDeco,e?e.changes:Y.empty(this.state.doc.length))),o=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(e.flags|=2);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let h=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?_.RTL:_.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=o||this.mustMeasureContent||this.contentDOMHeight!=t.clientHeight;this.contentDOMHeight=t.clientHeight,this.mustMeasureContent=!1;let h=0,a=0,c=parseInt(i.paddingTop)||0,f=parseInt(i.paddingBottom)||0;(this.paddingTop!=c||this.paddingBottom!=f)&&(this.paddingTop=c,this.paddingBottom=f,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let u=(this.printing?Yc:Xc)(t,this.paddingTop),d=u.top-this.pixelViewport.top,p=u.bottom-this.pixelViewport.bottom;this.pixelViewport=u;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let g=t.clientWidth;if((this.contentDOMWidth!=g||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=g,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let v=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(v)&&(o=!0),o||s.lineWrapping&&Math.abs(g-this.contentDOMWidth)>s.charWidth){let{lineHeight:S,charWidth:k}=e.docView.measureTextSize();o=s.refresh(r,S,k,g/k,v),o&&(e.docView.minWidth=0,h|=8)}d>0&&p>0?a=Math.max(d,p):d<0&&p<0&&(a=Math.min(d,p)),s.heightChanged=!1;for(let S of this.viewports){let k=S.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(S);this.heightMap=this.heightMap.updateHeight(s,0,o,new Kc(S.from,k))}s.heightChanged&&(h|=2)}let y=!this.viewportIsAppropriate(this.viewport,a)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return y&&(this.viewport=this.getViewport(a,this.scrollTarget)),this.updateForViewport(),(h&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.state.doc,{visibleTop:o,visibleBottom:l}=this,h=new Di(s.lineAt(o-i*1e3,W.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,W.ByHeight,r,0,0).to);if(t){let{head:a}=t.range;if(ah.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(a,W.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&a=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=_.LTR&&!i)return[];let l=[],h=(a,c,f,u)=>{if(c-aa&&gg.from>=f.from&&g.to<=f.to&&Math.abs(g.from-a)g.fromy));if(!m){if(cg.from<=c&&g.to>=c)){let g=t.moveToLineBoundary(b.cursor(c),!1,!0).head;g>a&&(c=g)}m=new Vn(a,c,this.gapSize(f,a,c,u))}l.push(m)};for(let a of this.viewportLines){if(a.lengtha.from&&h(a.from,u,a,c),dt.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];j.spans(e,this.viewport.from,this.viewport.to,{span(s,r){t.push({from:s,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=t[r].from||s.to!=t[r].to);return this.visibleRanges=t,i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Qt(this.heightMap.lineAt(e,W.ByPos,this.state.doc,0,0),this.scaler)}lineBlockAtHeight(e){return Qt(this.heightMap.lineAt(this.scaler.fromDOM(e),W.ByHeight,this.state.doc,0,0),this.scaler)}elementAtHeight(e){return Qt(this.heightMap.blockAt(this.scaler.fromDOM(e),this.state.doc,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Di{constructor(e,t){this.from=e,this.to=t}}function Zc(n,e,t){let i=[],s=n,r=0;return j.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function io(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function ef(n,e){for(let t of n)if(e(t))return t}const no={toDOM(n){return n},fromDOM(n){return n},scale:1};class tf{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:h})=>{let a=t.lineAt(l,W.ByPos,e,0,0).top,c=t.lineAt(h,W.ByPos,e,0,0).bottom;return s+=c-a,{from:l,to:h,top:a,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tQt(s,e)):n.type)}const Ti=D.define({combine:n=>n.join(" ")}),Ss=D.define({combine:n=>n.indexOf(!0)>-1}),Cs=ot.newName(),Zl=ot.newName(),eh=ot.newName(),th={"&light":"."+Zl,"&dark":"."+eh};function As(n,e,t){return new ot(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const nf=As("."+Cs,{"&.cm-editor":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,minHeight:"100%",display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 4px"},".cm-selectionLayer":{zIndex:-1,contain:"size style"},".cm-selectionBackground":{position:"absolute"},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{zIndex:100,contain:"size style",pointerEvents:"none"},"&.cm-focused .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{position:"absolute",borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},"&.cm-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},th),sf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Fn=A.ie&&A.ie_version<=11;class rf{constructor(e,t,i){this.view=e,this.onChange=t,this.onScrollChanged=i,this.active=!1,this.selectionRange=new ic,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resize=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(s=>{for(let r of s)this.queue.push(r);(A.ie&&A.ie_version<=11||A.ios&&e.composing)&&s.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Fn&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resize=new ResizeObserver(()=>{this.view.docView.lastUpdate{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),s.length>0&&s[s.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(s=>{s.length>0&&s[s.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(kn)?i.root.activeElement!=this.dom:!qi(i.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(A.ie&&A.ie_version<=11||A.android&&A.chrome)&&!i.state.selection.main.empty&&s.focusNode&&_i(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=A.safari&&e.root.nodeType==11&&Za(this.dom.ownerDocument)==this.dom&&of(this.view)||Ji(e.root);if(!t||this.selectionRange.eq(t))return!1;let i=qi(this.dom,t);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let s=this.delayedAndroidKey;this.delayedAndroidKey=null,this.delayedFlush=-1,!this.flush()&&s.force&&ni(this.dom,s.key,s.keyCode)}),(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}processRecords(){let e=this.queue;for(let r of this.observer.takeRecords())e.push(r);e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);!o||(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let{from:t,to:i,typeOver:s}=this.processRecords(),r=this.selectionChanged&&qi(this.dom,this.selectionRange);if(t<0&&!r)return!1;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=this.view.state,l=this.onChange(t,i,s);return this.view.state==o&&this.view.update([]),l}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.dirty|=4),e.type=="childList"){let i=so(t,e.previousSibling||e.target.previousSibling,-1),s=so(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resize)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout)}}function so(n,e,t){for(;e;){let i=H.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function of(n){let e=null;function t(h){h.preventDefault(),h.stopImmediatePropagation(),e=h.getTargetRanges()[0]}if(n.contentDOM.addEventListener("beforeinput",t,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let i=e.startContainer,s=e.startOffset,r=e.endContainer,o=e.endOffset,l=n.docView.domAtPos(n.state.selection.main.anchor);return _i(l.node,l.offset,r,o)&&([i,s,r,o]=[r,o,i,s]),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:o}}function lf(n,e,t,i){let s,r,o=n.state.selection.main;if(e>-1){let l=n.docView.domBoundsAround(e,t,0);if(!l||n.state.readOnly)return!1;let{from:h,to:a}=l,c=n.docView.impreciseHead||n.docView.impreciseAnchor?[]:af(n),f=new zl(c,n.state);f.readRange(l.startDOM,l.endDOM);let u=o.from,d=null;(n.inputState.lastKeyCode===8&&n.inputState.lastKeyTime>Date.now()-100||A.android&&f.text.length=o.from&&s.to<=o.to&&(s.from!=o.from||s.to!=o.to)&&o.to-o.from-(s.to-s.from)<=4?s={from:o.from,to:o.to,insert:n.state.doc.slice(o.from,s.from).append(s.insert).append(n.state.doc.slice(s.to,o.to))}:(A.mac||A.android)&&s&&s.from==s.to&&s.from==o.head-1&&/^\. ?$/.test(s.insert.toString())&&(r&&s.insert.length==2&&(r=b.single(r.main.anchor-1,r.main.head-1)),s={from:o.from,to:o.to,insert:N.of([" "])}),s){let l=n.state;if(A.ios&&n.inputState.flushIOSKey(n)||A.android&&(s.from==o.from&&s.to==o.to&&s.insert.length==1&&s.insert.lines==2&&ni(n.contentDOM,"Enter",13)||s.from==o.from-1&&s.to==o.to&&s.insert.length==0&&ni(n.contentDOM,"Backspace",8)||s.from==o.from&&s.to==o.to+1&&s.insert.length==0&&ni(n.contentDOM,"Delete",46)))return!0;let h=s.insert.toString();if(n.state.facet(Rl).some(f=>f(n,s.from,s.to,h)))return!0;n.inputState.composing>=0&&n.inputState.composing++;let a;if(s.from>=o.from&&s.to<=o.to&&s.to-s.from>=(o.to-o.from)/3&&(!r||r.main.empty&&r.main.from==s.from+s.insert.length)&&n.inputState.composing<0){let f=o.froms.to?l.sliceDoc(s.to,o.to):"";a=l.replaceSelection(n.state.toText(f+s.insert.sliceString(0,void 0,n.state.lineBreak)+u))}else{let f=l.changes(s),u=r&&!l.selection.main.eq(r.main)&&r.main.to<=f.newLength?r.main:void 0;if(l.selection.ranges.length>1&&n.inputState.composing>=0&&s.to<=o.to&&s.to>=o.to-10){let d=n.state.sliceDoc(s.from,s.to),p=ql(n)||n.state.doc.lineAt(o.head),m=o.to-s.to,g=o.to-o.from;a=l.changeByRange(y=>{if(y.from==o.from&&y.to==o.to)return{changes:f,range:u||y.map(f)};let v=y.to-m,S=v-d.length;if(y.to-y.from!=g||n.state.sliceDoc(S,v)!=d||p&&y.to>=p.from&&y.from<=p.to)return{range:y};let k=l.changes({from:S,to:v,insert:s.insert}),C=y.to-o.to;return{changes:k,range:u?b.range(Math.max(0,u.anchor+C),Math.max(0,u.head+C)):y.map(k)}})}else a={changes:f,selection:u&&l.selection.replaceRange(u)}}let c="input.type";return n.composing&&(c+=".compose",n.inputState.compositionFirstChange&&(c+=".start",n.inputState.compositionFirstChange=!1)),n.dispatch(a,{scrollIntoView:!0,userEvent:c}),!0}else if(r&&!r.main.eq(o)){let l=!1,h="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),h=n.inputState.lastSelectionOrigin),n.dispatch({selection:r,scrollIntoView:l,userEvent:h}),!0}else return!1}function hf(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let h=Math.max(0,r-Math.min(o,l));t-=o+h-r}return o=o?r-t:0,l=r+(l-o),o=r):l=l?r-t:0,o=r+(o-l),l=r),{from:r,toA:o,toB:l}}function af(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new Vr(t,i)),(s!=t||r!=i)&&e.push(new Vr(s,r))),e}function cf(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?b.single(t+e,i+e):null}class O{constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: absolute; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=e.dispatch||(t=>this.update([t])),this.dispatch=this.dispatch.bind(this),this._root=e.root||nc(e.parent)||document,this.viewState=new to(e.state||I.create(e)),this.plugins=this.state.facet(Xt).map(t=>new En(t));for(let t of this.plugins)t.update(this);this.observer=new rf(this,(t,i,s)=>lf(this,t,i,s),t=>{this.inputState.runScrollHandlers(this,t),this.observer.intersecting&&this.measure()}),this.inputState=new Pc(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Fr(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...e){this._dispatch(e.length==1&&e[0]instanceof Q?e[0]:this.state.update(...e))}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let l of e){if(l.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=l.state}if(this.destroyed){this.viewState.state=r;return}if(this.observer.clear(),r.facet(I.phrases)!=this.state.facet(I.phrases))return this.setState(r);s=Qi.create(this,r,e);let o=this.viewState.scrollTarget;try{this.updateState=2;for(let l of e){if(o&&(o=o.map(l.changes)),l.scrollIntoView){let{main:h}=l.state.selection;o=new Yi(h.empty?h:b.cursor(h.head,h.head>h.anchor?-1:1))}for(let h of l.effects)h.is(Ir)&&(o=h.value)}this.viewState.update(s,o),this.bidiCache=Zi.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Yt)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(l=>l.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Ti)!=s.state.facet(Ti)&&(this.viewState.mustMeasureContent=!0),(t||i||o||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!s.empty)for(let l of this.state.facet(ys))l(s)}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new to(e),this.plugins=e.facet(Xt).map(i=>new En(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView=new Fr(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Xt),i=e.state.facet(Xt);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new En(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,{scrollHeight:i,scrollTop:s,clientHeight:r}=this.scrollDOM,o=s>i-r-4?i:s;try{for(let l=0;;l++){this.updateState=1;let h=this.viewport,a=this.viewState.lineBlockAtHeight(o),c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let f=[];c&4||([this.measureRequests,f]=[f,this.measureRequests]);let u=f.map(g=>{try{return g.read(this)}catch(y){return Ee(this.state,y),ro}}),d=Qi.create(this,this.state,[]),p=!1,m=!1;d.flags|=c,t?t.flags|=c:t=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),p=this.docView.update(d));for(let g=0;g1||g<-1)&&(this.scrollDOM.scrollTop+=g,m=!0)}if(p&&this.docView.updateSelection(!0),this.viewport.from==h.from&&this.viewport.to==h.to&&!m&&this.measureRequests.length==0)break}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(ys))l(t)}get themeClasses(){return Cs+" "+(this.state.facet(Ss)?eh:Zl)+" "+this.state.facet(Ti)}updateAttrs(){let e=oo(this,El,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(kn)?"true":"false",class:"cm-content",style:`${A.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),oo(this,Il,t);let i=this.observer.ignore(()=>{let s=gs(this.contentDOM,this.contentAttrs,t),r=gs(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(O.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Yt),ot.mount(this.root,this.styleModules.concat(nf).reverse())}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(e.key!=null){for(let t=0;ti.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Nn(this,e,jr(this,e,t,i))}moveByGroup(e,t){return Nn(this,e,jr(this,e,t,i=>Tc(this,e.head,i)))}moveToLineBoundary(e,t,i=!0){return Oc(this,e,t,i)}moveVertically(e,t,i){return Nn(this,e,Bc(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),jl(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[Rt.find(r,e-s.from,-1,t)];return bn(i,o.dir==_.LTR==t>0)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Ll)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>ff)return Wl(e.length);let t=this.textDirectionAt(e.from);for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t)return s.order;let i=pc(e.text,t);return this.bidiCache.push(new Zi(e.from,e.to,t,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||A.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{gl(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Ir.of(new Yi(typeof e=="number"?b.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return de.define(()=>({}),{eventHandlers:e})}static theme(e,t){let i=ot.newName(),s=[Ti.of(i),Yt.of(As(`.${i}`,e))];return t&&t.dark&&s.push(Ss.of(!0)),s}static baseTheme(e){return vt.lowest(Yt.of(As("."+Cs,e,th)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&H.get(i)||H.get(e);return((t=s==null?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}O.styleModule=Yt;O.inputHandler=Rl;O.perLineTextDirection=Ll;O.exceptionSink=Pl;O.updateListener=ys;O.editable=kn;O.mouseSelectionStyle=Bl;O.dragMovesSelection=Tl;O.clickAddsSelectionRange=Ol;O.decorations=ui;O.atomicRanges=Nl;O.scrollMargins=Vl;O.darkTheme=Ss;O.contentAttributes=Il;O.editorAttributes=El;O.lineWrapping=O.contentAttributes.of({class:"cm-lineWrapping"});O.announce=L.define();const ff=4096,ro={};class Zi{constructor(e,t,i,s){this.from=e,this.to=t,this.dir=i,this.order=s}static update(e,t){if(t.empty)return e;let i=[],s=e.length?e[e.length-1].dir:_.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&ps(o,t)}return t}const uf=A.mac?"mac":A.windows?"win":A.linux?"linux":"key";function df(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let h=0;hi.concat(s),[]))),t}function gf(n,e,t){return nh(ih(n.state),e,n,t)}let Ze=null;const mf=4e3;function yf(n,e=uf){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let h=i[o];if(h==null)i[o]=l;else if(h!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,h,a)=>{var c,f;let u=t[o]||(t[o]=Object.create(null)),d=l.split(/ (?!$)/).map(g=>df(g,e));for(let g=1;g{let S=Ze={view:v,prefix:y,scope:o};return setTimeout(()=>{Ze==S&&(Ze=null)},mf),!0}]})}let p=d.join(" ");s(p,!1);let m=u[p]||(u[p]={preventDefault:!1,run:((f=(c=u._any)===null||c===void 0?void 0:c.run)===null||f===void 0?void 0:f.slice())||[]});h&&m.run.push(h),a&&(m.preventDefault=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let a of l){let c=t[a]||(t[a]=Object.create(null));c._any||(c._any={preventDefault:!1,run:[]});for(let f in c)c[f].run.push(o.any)}let h=o[e]||o.key;if(!!h)for(let a of l)r(a,h,o.run,o.preventDefault),o.shift&&r(a,"Shift-"+h,o.shift,o.preventDefault)}return t}function nh(n,e,t,i){let s=Qa(e),r=ie(s,0),o=Se(r)==s.length&&s!=" ",l="",h=!1;Ze&&Ze.view==t&&Ze.scope==i&&(l=Ze.prefix+" ",(h=Ul.indexOf(e.keyCode)<0)&&(Ze=null));let a=new Set,c=p=>{if(p){for(let m of p.run)if(!a.has(m)&&(a.add(m),m(t,e)))return!0;p.preventDefault&&(h=!0)}return!1},f=n[i],u,d;if(f){if(c(f[l+Bi(s,e,!o)]))return!0;if(o&&(e.shiftKey||e.altKey||e.metaKey||r>127)&&(u=lt[e.keyCode])&&u!=s){if(c(f[l+Bi(u,e,!0)]))return!0;if(e.shiftKey&&(d=ai[e.keyCode])!=s&&d!=u&&c(f[l+Bi(d,e,!1)]))return!0}else if(o&&e.shiftKey&&c(f[l+Bi(s,e,!0)]))return!0;if(c(f._any))return!0}return h}const sh=!A.ios,Zt=D.define({combine(n){return Ct(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function lg(n={}){return[Zt.of(n),bf,wf]}class rh{constructor(e,t,i,s,r){this.left=e,this.top=t,this.width=i,this.height=s,this.className=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width>=0&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}}const bf=de.fromClass(class{constructor(n){this.view=n,this.rangePieces=[],this.cursors=[],this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.selectionLayer=n.scrollDOM.appendChild(document.createElement("div")),this.selectionLayer.className="cm-selectionLayer",this.selectionLayer.setAttribute("aria-hidden","true"),this.cursorLayer=n.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),n.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){this.cursorLayer.style.animationDuration=this.view.state.facet(Zt).cursorBlinkRate+"ms"}update(n){let e=n.startState.facet(Zt)!=n.state.facet(Zt);(e||n.selectionSet||n.geometryChanged||n.viewportChanged)&&this.view.requestMeasure(this.measureReq),n.transactions.some(t=>t.scrollIntoView)&&(this.cursorLayer.style.animationName=this.cursorLayer.style.animationName=="cm-blink"?"cm-blink2":"cm-blink"),e&&this.setBlinkRate()}readPos(){let{state:n}=this.view,e=n.facet(Zt),t=n.selection.ranges.map(s=>s.empty?[]:xf(this.view,s)).reduce((s,r)=>s.concat(r)),i=[];for(let s of n.selection.ranges){let r=s==n.selection.main;if(s.empty?!r||sh:e.drawRangeCursor){let o=kf(this.view,s,r);o&&i.push(o)}}return{rangePieces:t,cursors:i}}drawSel({rangePieces:n,cursors:e}){if(n.length!=this.rangePieces.length||n.some((t,i)=>!t.eq(this.rangePieces[i]))){this.selectionLayer.textContent="";for(let t of n)this.selectionLayer.appendChild(t.draw());this.rangePieces=n}if(e.length!=this.cursors.length||e.some((t,i)=>!t.eq(this.cursors[i]))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent="";for(const i of e)this.cursorLayer.appendChild(i.draw())}else e.forEach((i,s)=>i.adjust(t[s]));this.cursors=e}}destroy(){this.selectionLayer.remove(),this.cursorLayer.remove()}}),oh={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};sh&&(oh[".cm-line"].caretColor="transparent !important");const wf=vt.highest(O.theme(oh));function lh(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==_.LTR?e.left:e.right-n.scrollDOM.clientWidth)-n.scrollDOM.scrollLeft,top:e.top-n.scrollDOM.scrollTop}}function ho(n,e,t){let i=b.cursor(e);return{from:Math.max(t.from,n.moveToLineBoundary(i,!1,!0).from),to:Math.min(t.to,n.moveToLineBoundary(i,!0,!0).from),type:q.Text}}function ao(n,e){let t=n.lineBlockAt(e);if(Array.isArray(t.type)){for(let i of t.type)if(i.to>e||i.to==e&&(i.to==t.to||i.type==q.Text))return i}return t}function xf(n,e){if(e.to<=n.viewport.from||e.from>=n.viewport.to)return[];let t=Math.max(e.from,n.viewport.from),i=Math.min(e.to,n.viewport.to),s=n.textDirection==_.LTR,r=n.contentDOM,o=r.getBoundingClientRect(),l=lh(n),h=window.getComputedStyle(r.firstChild),a=o.left+parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)),c=o.right-parseInt(h.paddingRight),f=ao(n,t),u=ao(n,i),d=f.type==q.Text?f:null,p=u.type==q.Text?u:null;if(n.lineWrapping&&(d&&(d=ho(n,t,d)),p&&(p=ho(n,i,p))),d&&p&&d.from==p.from)return g(y(e.from,e.to,d));{let S=d?y(e.from,null,d):v(f,!1),k=p?y(null,e.to,p):v(u,!0),C=[];return(d||f).to<(p||u).from-1?C.push(m(a,S.bottom,c,k.top)):S.bottomP&&U.from=xe)break;ee>X&&E(Math.max(Re,X),S==null&&Re<=P,Math.min(ee,xe),k==null&&ee>=V,ce.dir)}if(X=se.to+1,X>=xe)break}return K.length==0&&E(P,S==null,V,k==null,n.textDirection),{top:M,bottom:B,horizontal:K}}function v(S,k){let C=o.top+(k?S.top:S.bottom);return{top:C,bottom:C,horizontal:[]}}}function kf(n,e,t){let i=n.coordsAtPos(e.head,e.assoc||1);if(!i)return null;let s=lh(n);return new rh(i.left-s.left,i.top-s.top,-1,i.bottom-i.top,t?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary")}const hh=L.define({map(n,e){return n==null?null:e.mapPos(n)}}),ei=me.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(hh)?i.value:t,n)}}),vf=de.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(ei);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(ei)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let n=this.view.state.field(ei),e=n!=null&&this.view.coordsAtPos(n);if(!e)return null;let t=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-t.left+this.view.scrollDOM.scrollLeft,top:e.top-t.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(ei)!=n&&this.view.dispatch({effects:hh.of(n)})}},{eventHandlers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function hg(){return[ei,vf]}function co(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function Sf(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class Cf{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,h,a,c)=>s(c,a,a+l[0].length,l,h);else if(typeof i=="function")this.addMatch=(l,h,a,c)=>{let f=i(l,h,a);f&&c(a,a+l[0].length,f)};else if(i)this.addMatch=(l,h,a,c)=>c(a,a+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new bt,i=t.add.bind(t);for(let{from:s,to:r}of Sf(e,this.maxLength))co(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,h)=>{h>e.view.viewport.from&&l1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>o){let h=e.state.doc.lineAt(o),a=h.toh.from;o--)if(this.boundary.test(h.text[o-1-h.from])){c=o;break}for(;lu.push(y.range(m,g));if(h==a)for(this.regexp.lastIndex=c-h.from;(d=this.regexp.exec(h.text))&&d.indexthis.addMatch(g,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:u})}}return t}}const Ms=/x/.unicode!=null?"gu":"g",Af=new RegExp(`[\0-\b --\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,Ms),Mf={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Wn=null;function Df(){var n;if(Wn==null&&typeof document<"u"&&document.body){let e=document.body.style;Wn=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Wn||!1}const ji=D.define({combine(n){let e=Ct(n,{render:null,specialChars:Af,addSpecialChars:null});return(e.replaceTabs=!Df())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Ms)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Ms)),e}});function ag(n={}){return[ji.of(n),Of()]}let fo=null;function Of(){return fo||(fo=de.fromClass(class{constructor(n){this.view=n,this.decorations=T.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(ji)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Cf({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=ie(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,h=bi(o.text,l,i-o.from);return T.replace({widget:new Rf((l-h%l)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=T.replace({widget:new Pf(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(ji);n.startState.facet(ji)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Tf="\u2022";function Bf(n){return n>=32?Tf:n==10?"\u2424":String.fromCharCode(9216+n)}class Pf extends at{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Bf(this.code),i=e.state.phrase("Control character")+" "+(Mf[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class Rf extends at{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}class Lf extends at{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}ignoreEvent(){return!1}}function cg(n){return de.fromClass(class{constructor(e){this.view=e,this.placeholder=T.set([T.widget({widget:new Lf(n),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?T.none:this.placeholder}},{decorations:e=>e.decorations})}const Ds=2e3;function Ef(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>Ds||t.off>Ds||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let h=i;h<=s;h++){let a=n.doc.line(h);a.length<=l&&r.push(b.range(a.from+o,a.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let h=i;h<=s;h++){let a=n.doc.line(h),c=os(a.text,o,n.tabSize,!0);if(c>-1){let f=os(a.text,l,n.tabSize);r.push(b.range(a.from+c,a.from+f))}}}return r}function If(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function uo(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>Ds?-1:s==i.length?If(n,e.clientX):bi(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function Nf(n,e){let t=uo(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=uo(n,s);if(!l)return i;let h=Ef(n.state,t,l);return h.length?o?b.create(h.concat(i.ranges)):b.create(h):i}}:null}function fg(n){let e=(n==null?void 0:n.eventFilter)||(t=>t.altKey&&t.button==0);return O.mouseSelectionStyle.of((t,i)=>e(i)?Nf(t,i):null)}const Hn="-10000px";class Vf{constructor(e,t,i){this.facet=t,this.createTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(s=>s),this.tooltipViews=this.tooltips.map(i)}update(e){let t=e.state.facet(this.facet),i=t.filter(r=>r);if(t===this.input){for(let r of this.tooltipViews)r.update&&r.update(e);return!1}let s=[];for(let r=0;r{var e,t,i;return{position:A.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Ff}}}),ah=de.fromClass(class{constructor(n){this.view=n,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(zn);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Vf(n,ch,t=>this.createTooltip(t)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(zn);if(i.position!=this.position){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n){let e=n.create(this.view);if(e.dom.classList.add("cm-tooltip"),n.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=Hn,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var n;this.view.win.removeEventListener("resize",this.measureSoon);for(let{dom:e}of this.manager.tooltipViews)e.remove();(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=this.view.dom.getBoundingClientRect();return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map((e,t)=>{let i=this.manager.tooltipViews[t];return i.getCoords?i.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(zn).tooltipSpace(this.view)}}writeMeasure(n){let{editor:e,space:t}=n,i=[];for(let s=0;s=Math.min(e.bottom,t.bottom)||h.rightMath.min(e.right,t.right)+.1){l.style.top=Hn;continue}let c=r.arrow?o.dom.querySelector(".cm-tooltip-arrow"):null,f=c?7:0,u=a.right-a.left,d=a.bottom-a.top,p=o.offset||Hf,m=this.view.textDirection==_.LTR,g=a.width>t.right-t.left?m?t.left:t.right-a.width:m?Math.min(h.left-(c?14:0)+p.x,t.right-u):Math.max(t.left,h.left-u+(c?14:0)-p.x),y=!!r.above;!r.strictSide&&(y?h.top-(a.bottom-a.top)-p.yt.bottom)&&y==t.bottom-h.bottom>h.top-t.top&&(y=!y);let v=y?h.top-d-f-p.y:h.bottom+f+p.y,S=g+u;if(o.overlap!==!0)for(let k of i)k.leftg&&k.topv&&(v=y?k.top-d-2-f:k.bottom+f+2);this.position=="absolute"?(l.style.top=v-n.parent.top+"px",l.style.left=g-n.parent.left+"px"):(l.style.top=v+"px",l.style.left=g+"px"),c&&(c.style.left=`${h.left+(m?p.x:-p.x)-(g+14-7)}px`),o.overlap!==!0&&i.push({left:g,top:v,right:S,bottom:v+d}),l.classList.toggle("cm-tooltip-above",y),l.classList.toggle("cm-tooltip-below",!y),o.positioned&&o.positioned()}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Hn}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),Wf=O.baseTheme({".cm-tooltip":{zIndex:100},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:`${7}px`,width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:`${7}px solid transparent`,borderRight:`${7}px solid transparent`},".cm-tooltip-above &":{bottom:`-${7}px`,"&:before":{borderTop:`${7}px solid #bbb`},"&:after":{borderTop:`${7}px solid #f5f5f5`,bottom:"1px"}},".cm-tooltip-below &":{top:`-${7}px`,"&:before":{borderBottom:`${7}px solid #bbb`},"&:after":{borderBottom:`${7}px solid #f5f5f5`,top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Hf={x:0,y:0},ch=D.define({enables:[ah,Wf]});function zf(n,e){let t=n.plugin(ah);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const po=D.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function en(n,e){let t=n.plugin(fh),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const fh=de.fromClass(class{constructor(n){this.input=n.state.facet(tn),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(po);this.top=new Pi(n,!0,e.topContainer),this.bottom=new Pi(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(po);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Pi(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Pi(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(tn);if(t!=this.input){let i=t.filter(h=>h),s=[],r=[],o=[],l=[];for(let h of i){let a=this.specs.indexOf(h),c;a<0?(c=h(n.view),l.push(c)):(c=this.panels[a],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let h of l)h.dom.classList.add("cm-panel"),h.mount&&h.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>O.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Pi{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=go(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=go(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function go(n){let e=n.nextSibling;return n.remove(),e}const tn=D.define({enables:fh});class xt extends yt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}xt.prototype.elementClass="";xt.prototype.toDOM=void 0;xt.prototype.mapMode=le.TrackBefore;xt.prototype.startSide=xt.prototype.endSide=-1;xt.prototype.point=!0;const qf=D.define(),$f=new class extends xt{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},jf=qf.compute(["selection"],n=>{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push($f.range(s)))}return j.of(e)});function ug(){return jf}const Kf=1024;let Uf=0;class Me{constructor(e,t){this.from=e,this.to=t}}class R{constructor(e={}){this.id=Uf++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=pe.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}R.closedBy=new R({deserialize:n=>n.split(" ")});R.openedBy=new R({deserialize:n=>n.split(" ")});R.group=new R({deserialize:n=>n.split(" ")});R.contextHash=new R({perNode:!0});R.lookAhead=new R({perNode:!0});R.mounted=new R({perNode:!0});class Gf{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}}const Jf=Object.create(null);class pe{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Jf,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new pe(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(R.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(R.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}pe.none=new pe("",Object.create(null),0,8);class _s{constructor(e){this.types=e;for(let t=0;t=s&&(o.type.isAnonymous||t(o)!==!1)){if(o.firstChild())continue;l=!0}for(;l&&i&&!o.type.isAnonymous&&i(o),!o.nextSibling();){if(!o.parent())return;l=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Qs(pe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new F(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new F(pe.none,t,i,s)))}static build(e){return Xf(e)}}F.empty=new F(pe.none,[],[],0);class Xs{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Xs(this.buffer,this.index)}}class At{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return pe.none}toString(){let e=[];for(let t=0;t0));h=o[h+3]);return l}slice(e,t,i,s){let r=this.buffer,o=new Uint16Array(t-e);for(let l=e,h=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function dh(n,e){let t=n.childBefore(e);for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}function Vt(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=a;e+=t){let c=l[e],f=h[e]+o.from;if(!!uh(s,i,f,f+c.length)){if(c instanceof At){if(r&G.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,s);if(u>-1)return new qe(new _f(o,c,e,f),null,u)}else if(r&G.IncludeAnonymous||!c.type.isAnonymous||Ys(c)){let u;if(!(r&G.IgnoreMounts)&&c.props&&(u=c.prop(R.mounted))&&!u.overlay)return new Te(u.tree,f,e,o);let d=new Te(c,f,e,o);return r&G.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,s)}}}if(r&G.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,i=0){let s;if(!(i&G.IgnoreOverlays)&&(s=this._tree.prop(R.mounted))&&s.overlay){let r=e-this.from;for(let{from:o,to:l}of s.overlay)if((t>0?o<=r:o=r:l>r))return new Te(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new di(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,t=0){return Vt(this,e,t,!1)}resolveInner(e,t=0){return Vt(this,e,t,!0)}enterUnfinishedNodesBefore(e){return dh(this,e)}getChild(e,t=null,i=null){let s=nn(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return nn(this,e,t,i)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return sn(this,e)}}function nn(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(;!s.type.is(t);)if(!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function sn(n,e,t=e.length-1){for(let i=n.parent;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class _f{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class qe{constructor(e,t,i){this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new qe(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,i=0){if(i&G.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new qe(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new qe(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new qe(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}cursor(e=0){return new di(this,e)}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1],l=i.buffer[this.index+2];e.push(i.slice(s,r,o,l)),t.push(0)}return new F(this.type,e,t,this.to-this.from)}resolve(e,t=0){return Vt(this,e,t,!1)}resolveInner(e,t=0){return Vt(this,e,t,!0)}enterUnfinishedNodesBefore(e){return dh(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,t=null,i=null){let s=nn(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return nn(this,e,t,i)}get node(){return this}matchContext(e){return sn(this,e)}}class di{constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Te)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}get name(){return this.type.name}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof Te?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&G.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&G.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&G.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&G.IncludeAnonymous||l instanceof At||!l.type.isAnonymous||Ys(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}}for(let s=i;s=0;r--){if(r<0)return sn(this.node,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function Ys(n){return n.children.some(e=>e instanceof At||!e.type.isAnonymous||Ys(e))}function Xf(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Kf,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new Xs(t,t.length):t,h=i.types,a=0,c=0;function f(k,C,M,B,K){let{id:E,start:P,end:V,size:U}=l,X=c;for(;U<0;)if(l.next(),U==-1){let ee=r[E];M.push(ee),B.push(P-k);return}else if(U==-3){a=E;return}else if(U==-4){c=E;return}else throw new RangeError(`Unrecognized record size: ${U}`);let xe=h[E],se,ce,Re=P-k;if(V-P<=s&&(ce=m(l.pos-C,K))){let ee=new Uint16Array(ce.size-ce.skip),Le=l.pos-ce.size,Je=ee.length;for(;l.pos>Le;)Je=g(ce.start,ee,Je);se=new At(ee,V-ce.start,i),Re=ce.start-k}else{let ee=l.pos-U;l.next();let Le=[],Je=[],ft=E>=o?E:-1,Mt=0,vi=V;for(;l.pos>ee;)ft>=0&&l.id==ft&&l.size>=0?(l.end<=vi-s&&(d(Le,Je,P,Mt,l.end,vi,ft,X),Mt=Le.length,vi=l.end),l.next()):f(P,ee,Le,Je,ft);if(ft>=0&&Mt>0&&Mt-1&&Mt>0){let mr=u(xe);se=Qs(xe,Le,Je,0,Le.length,0,V-P,mr,mr)}else se=p(xe,Le,Je,V-P,X-V)}M.push(se),B.push(Re)}function u(k){return(C,M,B)=>{let K=0,E=C.length-1,P,V;if(E>=0&&(P=C[E])instanceof F){if(!E&&P.type==k&&P.length==B)return P;(V=P.prop(R.lookAhead))&&(K=M[E]+P.length+V)}return p(k,C,M,B,K)}}function d(k,C,M,B,K,E,P,V){let U=[],X=[];for(;k.length>B;)U.push(k.pop()),X.push(C.pop()+M-K);k.push(p(i.types[P],U,X,E-K,V-E)),C.push(K-M)}function p(k,C,M,B,K=0,E){if(a){let P=[R.contextHash,a];E=E?[P].concat(E):[P]}if(K>25){let P=[R.lookAhead,K];E=E?[P].concat(E):[P]}return new F(k,C,M,B,E)}function m(k,C){let M=l.fork(),B=0,K=0,E=0,P=M.end-s,V={size:0,start:0,skip:0};e:for(let U=M.pos-k;M.pos>U;){let X=M.size;if(M.id==C&&X>=0){V.size=B,V.start=K,V.skip=E,E+=4,B+=4,M.next();continue}let xe=M.pos-X;if(X<0||xe=o?4:0,ce=M.start;for(M.next();M.pos>xe;){if(M.size<0)if(M.size==-3)se+=4;else break e;else M.id>=o&&(se+=4);M.next()}K=ce,B+=X,E+=se}return(C<0||B==k)&&(V.size=B,V.start=K,V.skip=E),V.size>4?V:void 0}function g(k,C,M){let{id:B,start:K,end:E,size:P}=l;if(l.next(),P>=0&&B4){let U=l.pos-(P-4);for(;l.pos>U;)M=g(k,C,M)}C[--M]=V,C[--M]=E-k,C[--M]=K-k,C[--M]=B}else P==-3?a=B:P==-4&&(c=B);return M}let y=[],v=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,y,v,-1);let S=(e=n.length)!==null&&e!==void 0?e:y.length?v[0]+y[0].length:0;return new F(h[n.topID],y.reverse(),v.reverse(),S)}const yo=new WeakMap;function Ki(n,e){if(!n.isAnonymous||e instanceof At||e.type!=n)return 1;let t=yo.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof F)){t=1;break}t+=Ki(n,i)}yo.set(e,t)}return t}function Qs(n,e,t,i,s,r,o,l,h){let a=0;for(let p=i;p=c)break;M+=B}if(S==k+1){if(M>c){let B=p[k];d(B.children,B.positions,0,B.children.length,m[k]+v);continue}f.push(p[k])}else{let B=m[S-1]+p[S-1].length-C;f.push(Qs(n,p,m,k,S,C,B,null,h))}u.push(C+v-r)}}return d(e,t,i,s,0),(l||h)(f,u,o)}class dg{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof qe?this.setBuffer(e.context.buffer,e.index,t):e instanceof Te&&this.map.set(e.tree,t)}get(e){return e instanceof qe?this.getBuffer(e.context.buffer,e.index):e instanceof Te?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xe{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new Xe(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,h=0,a=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||a){let d=Math.max(u.from,h)-a,p=Math.min(u.to,f)-a;u=d>=p?null:new Xe(d,p,u.tree,u.offset+a,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew Me(s.from,s.to)):[new Me(0,0)]:[new Me(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class Yf{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function pg(n){return(e,t,i,s)=>new Zf(e,n,t,i,s)}class bo{constructor(e,t,i,s,r){this.parser=e,this.parse=t,this.overlay=i,this.target=s,this.ranges=r}}class Qf{constructor(e,t,i,s,r,o,l){this.parser=e,this.predicate=t,this.mounts=i,this.index=s,this.start=r,this.target=o,this.prev=l,this.depth=0,this.ranges=[]}}const Os=new R({perNode:!0});class Zf{constructor(e,t,i,s,r){this.nest=t,this.input=i,this.fragments=s,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let s of this.inner)s.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new F(i.type,i.children,i.positions,i.length,i.propValues.concat([[Os,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[R.mounted.id]=new Gf(t,e.overlay,e.parser),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;tc.frag.from<=s.from&&c.frag.to>=s.to&&c.mount.overlay);if(a)for(let c of a.mount.overlay){let f=c.from+a.pos,u=c.to+a.pos;f>=s.from&&u<=s.to&&!t.ranges.some(d=>d.fromf)&&t.ranges.push({from:f,to:u})}}l=!1}else if(i&&(o=eu(i.ranges,s.from,s.to)))l=o!=2;else if(!s.type.isAnonymous&&s.fromnew Me(f.from-s.from,f.to-s.from)):null,s.tree,c)),r.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else t&&(h=t.predicate(s))&&(h===!0&&(h=new Me(s.from,s.to)),h.fromnew Me(c.from-t.start,c.to-t.start)),t.target,a)),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function eu(n,e,t){for(let i of n){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function wo(n,e,t,i,s,r){if(e=e.to);i++);let o=s.children[i],l=o.buffer;function h(a,c,f,u,d){let p=a;for(;l[p+2]+r<=e.from;)p=l[p+3];let m=[],g=[];wo(o,a,p,m,g,u);let y=l[p+1],v=l[p+2],S=y+r==e.from&&v+r==e.to&&l[p]==e.type.id;return m.push(S?e.toTree():h(p+4,l[p+3],o.set.types[l[p]],y,v-y)),g.push(y-u),wo(o,l[p+3],c,m,g,u),new F(f,m,g,d)}s.children[i]=h(0,l.length,pe.none,0,o.length);for(let a=0;a<=t;a++)n.childAfter(e.from)}class xo{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(G.IncludeAnonymous|G.IgnoreMounts)}moveTo(e){let{cursor:t}=this,i=e-this.offset;for(;!this.done&&t.from=e&&t.enter(i,1,G.IgnoreOverlays|G.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof F)t=t.children[0];else break}return!1}}class iu{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(Os))!==null&&t!==void 0?t:i.to,this.inner=new xo(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Os))!==null&&e!==void 0?e:t.to,this.inner=new xo(t.tree,-t.offset)}}findMounts(e,t){var i;let s=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let r=this.inner.cursor.node;r;r=r.parent){let o=(i=r.tree)===null||i===void 0?void 0:i.prop(R.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=r.to)break;h.tree==this.curFrag.tree&&s.push({frag:h,pos:r.from-h.offset,mount:o})}}}return s}}function ko(n,e){let t=null,i=e;for(let s=1,r=0;s=l)break;h.to<=o||(t||(i=t=e.slice()),h.froml&&t.splice(r+1,0,new Me(l,h.to))):h.to>l?t[r--]=new Me(l,h.to):t.splice(r--,1))}}return i}function nu(n,e,t,i){let s=0,r=0,o=!1,l=!1,h=-1e9,a=[];for(;;){let c=s==n.length?1e9:o?n[s].to:n[s].from,f=r==e.length?1e9:l?e[r].to:e[r].from;if(o!=l){let u=Math.max(h,t),d=Math.min(c,f,i);unew Me(u.from+i,u.to+i)),f=nu(e,c,h,a);for(let u=0,d=h;;u++){let p=u==f.length,m=p?a:f[u].from;if(m>d&&t.push(new Xe(d,m,s.tree,-o,r.from>=d||r.openStart,r.to<=m||r.openEnd)),p)break;d=f[u].to}}else t.push(new Xe(h,a,s.tree,-o,r.from>=o||r.openStart,r.to<=l||r.openEnd))}return t}let su=0;class He{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=su++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new He([],null,[]);if(t.set.push(t),e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new rn;return t=>t.modified.indexOf(e)>-1?t:rn.get(t.base||t,t.modified.concat(e).sort((i,s)=>i.id-s.id))}}let ru=0;class rn{constructor(){this.instances=[],this.id=ru++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&ou(t,l.modified));if(i)return i;let s=[],r=new He(s,e,t);for(let l of t)l.instances.push(r);let o=gh(t);for(let l of e.set)for(let h of o)s.push(rn.get(l,h));return r}}function ou(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function gh(n){let e=[n];for(let t=0;t0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let h=r.length-1,a=r[h];if(!a)throw new RangeError("Invalid path: "+s);let c=new on(i,o,h>0?r.slice(0,h):null);e[a]=c.sort(e[a])}}return mh.add(e)}const mh=new R;class on{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let h of l.set){let a=t[h.id];if(a){o=o?o+" "+a:a;break}}return o},scope:i}}function hu(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function au(n,e,t,i=0,s=n.length){let r=new cu(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class cu{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:h}=e;if(l>=i||h<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let a=s,c=fu(e)||on.empty,f=hu(r,c.tags);if(f&&(a&&(a+=" "),a+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(e.from,a),c.opaque)return;let u=e.tree&&e.tree.prop(R.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),m=e.firstChild();for(let g=0,y=l;;g++){let v=g=S||!e.nextSibling())););if(!v||S>i)break;y=v.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,v.from+l),Math.min(i,y),s,p),this.startSpan(y,a))}m&&e.parent()}else if(e.firstChild()){do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),a)}while(e.nextSibling());e.parent()}}}function fu(n){let e=n.type.prop(mh);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const w=He.define,Li=w(),Ye=w(),So=w(Ye),Co=w(Ye),Qe=w(),Ei=w(Qe),qn=w(Qe),We=w(),ut=w(We),Ve=w(),Fe=w(),Ts=w(),Gt=w(Ts),Ii=w(),x={comment:Li,lineComment:w(Li),blockComment:w(Li),docComment:w(Li),name:Ye,variableName:w(Ye),typeName:So,tagName:w(So),propertyName:Co,attributeName:w(Co),className:w(Ye),labelName:w(Ye),namespace:w(Ye),macroName:w(Ye),literal:Qe,string:Ei,docString:w(Ei),character:w(Ei),attributeValue:w(Ei),number:qn,integer:w(qn),float:w(qn),bool:w(Qe),regexp:w(Qe),escape:w(Qe),color:w(Qe),url:w(Qe),keyword:Ve,self:w(Ve),null:w(Ve),atom:w(Ve),unit:w(Ve),modifier:w(Ve),operatorKeyword:w(Ve),controlKeyword:w(Ve),definitionKeyword:w(Ve),moduleKeyword:w(Ve),operator:Fe,derefOperator:w(Fe),arithmeticOperator:w(Fe),logicOperator:w(Fe),bitwiseOperator:w(Fe),compareOperator:w(Fe),updateOperator:w(Fe),definitionOperator:w(Fe),typeOperator:w(Fe),controlOperator:w(Fe),punctuation:Ts,separator:w(Ts),bracket:Gt,angleBracket:w(Gt),squareBracket:w(Gt),paren:w(Gt),brace:w(Gt),content:We,heading:ut,heading1:w(ut),heading2:w(ut),heading3:w(ut),heading4:w(ut),heading5:w(ut),heading6:w(ut),contentSeparator:w(We),list:w(We),quote:w(We),emphasis:w(We),strong:w(We),link:w(We),monospace:w(We),strikethrough:w(We),inserted:w(),deleted:w(),changed:w(),invalid:w(),meta:Ii,documentMeta:w(Ii),annotation:w(Ii),processingInstruction:w(Ii),definition:He.defineModifier(),constant:He.defineModifier(),function:He.defineModifier(),standard:He.defineModifier(),local:He.defineModifier(),special:He.defineModifier()};yh([{tag:x.link,class:"tok-link"},{tag:x.heading,class:"tok-heading"},{tag:x.emphasis,class:"tok-emphasis"},{tag:x.strong,class:"tok-strong"},{tag:x.keyword,class:"tok-keyword"},{tag:x.atom,class:"tok-atom"},{tag:x.bool,class:"tok-bool"},{tag:x.url,class:"tok-url"},{tag:x.labelName,class:"tok-labelName"},{tag:x.inserted,class:"tok-inserted"},{tag:x.deleted,class:"tok-deleted"},{tag:x.literal,class:"tok-literal"},{tag:x.string,class:"tok-string"},{tag:x.number,class:"tok-number"},{tag:[x.regexp,x.escape,x.special(x.string)],class:"tok-string2"},{tag:x.variableName,class:"tok-variableName"},{tag:x.local(x.variableName),class:"tok-variableName tok-local"},{tag:x.definition(x.variableName),class:"tok-variableName tok-definition"},{tag:x.special(x.variableName),class:"tok-variableName2"},{tag:x.definition(x.propertyName),class:"tok-propertyName tok-definition"},{tag:x.typeName,class:"tok-typeName"},{tag:x.namespace,class:"tok-namespace"},{tag:x.className,class:"tok-className"},{tag:x.macroName,class:"tok-macroName"},{tag:x.propertyName,class:"tok-propertyName"},{tag:x.operator,class:"tok-operator"},{tag:x.comment,class:"tok-comment"},{tag:x.meta,class:"tok-meta"},{tag:x.invalid,class:"tok-invalid"},{tag:x.punctuation,class:"tok-punctuation"}]);var $n;const Ft=new R;function bh(n){return D.define({combine:n?e=>e.concat(n):void 0})}class De{constructor(e,t,i=[]){this.data=e,I.prototype.hasOwnProperty("tree")||Object.defineProperty(I.prototype,"tree",{get(){return ge(this)}}),this.parser=t,this.extension=[zt.of(this),I.languageData.of((s,r,o)=>s.facet(Ao(s,r,o)))].concat(i)}isActiveAt(e,t,i=-1){return Ao(e,t,i)==this.data}findRegions(e){let t=e.facet(zt);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(Ft)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(R.mounted);if(l){if(l.tree.prop(Ft)==this.data){if(l.overlay)for(let h of l.overlay)i.push({from:h.from+o,to:h.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let h=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>h)return}}for(let h=0;hi.isTop?t:void 0)]}))}configure(e){return new Bs(this.data,this.parser.configure(e))}get allowsNesting(){return this.parser.hasWrappers()}}function ge(n){let e=n.field(De.state,!1);return e?e.tree:F.empty}class uu{constructor(e,t=e.length){this.doc=e,this.length=t,this.cursorPos=0,this.string="",this.cursor=e.iter()}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Jt=null;class Wt{constructor(e,t,i=[],s,r,o,l,h){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Wt(e,t,[],F.empty,0,i,[],null)}startParse(){return this.parser.startParse(new uu(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=F.empty&&this.isDone(t!=null?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Xe.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Jt;Jt=this;try{return e()}finally{Jt=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Mo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let h=[];if(e.iterChangedRanges((a,c,f,u)=>h.push({fromA:a,toA:c,fromB:f,toB:u})),i=Xe.applyChanges(i,h),s=F.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let a of this.skipped){let c=e.mapPos(a.from,1),f=e.mapPos(a.to,-1);ce.from&&(this.fragments=Mo(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends ph{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let h=Jt;if(h){for(let a of s)h.tempSkipped.push(a);e&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,e]):e)}return this.parsedPos=o,new F(pe.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Jt}}function Mo(n,e,t){return Xe.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ht{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Ht(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Wt.create(e.facet(zt).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Ht(i)}}De.state=me.define({create:Ht.init,update(n,e){for(let t of e.effects)if(t.is(De.setState))return t.value;return e.startState.facet(zt)!=e.state.facet(zt)?Ht.init(e.state):n.apply(e)}});let wh=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(wh=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const jn=typeof navigator<"u"&&(($n=navigator.scheduling)===null||$n===void 0?void 0:$n.isInputPending)?()=>navigator.scheduling.isInputPending():null,du=de.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(De.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(De.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=wh(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,h=r.context.work(()=>jn&&jn()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(h||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:De.setState.of(new Ht(r.context))})),this.chunkBudget>0&&!(h&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ee(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),zt=D.define({combine(n){return n.length?n[0]:null},enables:[De.state,du]});class mg{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const xh=D.define(),vn=D.define({combine:n=>{if(!n.length)return" ";if(!/^(?: +|\t+)$/.test(n[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return n[0]}});function kt(n){let e=n.facet(vn);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function ln(n,e){let t="",i=n.tabSize;if(n.facet(vn).charCodeAt(0)==9)for(;e>=i;)t+=" ",e-=i;for(let s=0;s=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return bi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const pu=new R;function gu(n,e,t){return vh(e.resolveInner(t).enterUnfinishedNodesBefore(t),t,n)}function mu(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function yu(n){let e=n.type.prop(pu);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(R.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>Sh(o,!0,1,void 0,r&&!mu(o)?s.from:void 0)}return n.parent==null?bu:null}function vh(n,e,t){for(;n;n=n.parent){let i=yu(n);if(i)return i(Zs.create(t,e,n))}return null}function bu(){return 0}class Zs extends Sn{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.node=i}static create(e,t,i){return new Zs(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){let e=this.state.doc.lineAt(this.node.from);for(;;){let t=this.node.resolve(e.from);for(;t.parent&&t.parent.from==t.from;)t=t.parent;if(wu(t,this.node))break;e=this.state.doc.lineAt(t.from)}return this.lineIndent(e.from)}continue(){let e=this.node.parent;return e?vh(e,this.pos,this.base):0}}function wu(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function xu(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let h=e.childAfter(l);if(!h||h==i)return null;if(!h.type.isSkipped)return h.fromSh(i,e,t,n)}function Sh(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,h=e?xu(n):null;return h?l?n.column(h.from):n.column(h.to):n.baseIndent+(l?0:n.unit*t)}const bg=n=>n.baseIndent;function wg({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const xg=new R;function kg(n){let e=n.firstChild,t=n.lastChild;return e&&e.tol.prop(Ft)==o.data:o?l=>l==o:void 0,this.style=yh(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new ot(i):null,this.themeType=t.themeType}static define(e,t){return new Cn(e,t||{})}}const Ps=D.define(),Ch=D.define({combine(n){return n.length?[n[0]]:null}});function Kn(n){let e=n.facet(Ps);return e.length?e:n.facet(Ch)}function vg(n,e){let t=[vu],i;return n instanceof Cn&&(n.module&&t.push(O.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(Ch.of(n)):i?t.push(Ps.computeN([O.darkTheme],s=>s.facet(O.darkTheme)==(i=="dark")?[n]:[])):t.push(Ps.of(n)),t}class ku{constructor(e){this.markCache=Object.create(null),this.tree=ge(e.state),this.decorations=this.buildDeco(e,Kn(e.state))}update(e){let t=ge(e.state),i=Kn(e.state),s=i!=Kn(e.startState);t.length{i.add(o,l,this.markCache[h]||(this.markCache[h]=T.mark({class:h})))},s,r);return i.finish()}}const vu=vt.high(de.fromClass(ku,{decorations:n=>n.decorations})),Sg=Cn.define([{tag:x.meta,color:"#7a757a"},{tag:x.link,textDecoration:"underline"},{tag:x.heading,textDecoration:"underline",fontWeight:"bold"},{tag:x.emphasis,fontStyle:"italic"},{tag:x.strong,fontWeight:"bold"},{tag:x.strikethrough,textDecoration:"line-through"},{tag:x.keyword,color:"#708"},{tag:[x.atom,x.bool,x.url,x.contentSeparator,x.labelName],color:"#219"},{tag:[x.literal,x.inserted],color:"#164"},{tag:[x.string,x.deleted],color:"#a11"},{tag:[x.regexp,x.escape,x.special(x.string)],color:"#e40"},{tag:x.definition(x.variableName),color:"#00f"},{tag:x.local(x.variableName),color:"#30a"},{tag:[x.typeName,x.namespace],color:"#085"},{tag:x.className,color:"#167"},{tag:[x.special(x.variableName),x.macroName],color:"#256"},{tag:x.definition(x.propertyName),color:"#00c"},{tag:x.comment,color:"#940"},{tag:x.invalid,color:"#f00"}]),Su=O.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Ah=1e4,Mh="()[]{}",Dh=D.define({combine(n){return Ct(n,{afterCursor:!0,brackets:Mh,maxScanDistance:Ah,renderMatch:Mu})}}),Cu=T.mark({class:"cm-matchingBracket"}),Au=T.mark({class:"cm-nonmatchingBracket"});function Mu(n){let e=[],t=n.matched?Cu:Au;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const Du=me.define({create(){return T.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],i=e.state.facet(Dh);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=$e(e.state,s.head,-1,i)||s.head>0&&$e(e.state,s.head-1,1,i)||i.afterCursor&&($e(e.state,s.head,1,i)||s.headO.decorations.from(n)}),Ou=[Du,Su];function Cg(n={}){return[Dh.of(n),Ou]}function Rs(n,e,t){let i=n.prop(e<0?R.openedBy:R.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function $e(n,e,t,i={}){let s=i.maxScanDistance||Ah,r=i.brackets||Mh,o=ge(n),l=o.resolveInner(e,t);for(let h=l;h;h=h.parent){let a=Rs(h.type,t,r);if(a&&h.from=i.to){if(h==0&&s.indexOf(a.type.name)>-1&&a.from0)return null;let a={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let m=t>0?0:d.length-1,g=t>0?d.length:-1;m!=g;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:a,end:{from:p+m,to:p+m+1},matched:y>>1==h>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:a,matched:!1}:null}function Do(n,e,t,i=0,s=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let r=s;for(let o=i;o=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosi?o.toLowerCase():o,r=this.string.substr(this.pos,e.length);return s(r)==s(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&t!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Pu(n){return{token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||Ru,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||tr}}function Ru(n){if(typeof n!="object")return n;let e={};for(let t in n){let i=n[t];e[t]=i instanceof Array?i.slice():i}return e}class Th extends De{constructor(e){let t=bh(e.languageData),i=Pu(e),s,r=new class extends ph{createParse(o,l,h){return new Eu(s,o,l,h)}};super(t,r,[xh.of((o,l)=>this.getIndent(o,l))]),this.topNode=Vu(t),s=this,this.streamParser=i,this.stateAfter=new R({perNode:!0}),this.tokenTable=e.tokenTable?new Lh(i.tokenTable):Nu}static define(e){return new Th(e)}getIndent(e,t){let i=ge(e.state),s=i.resolve(t);for(;s&&s.type!=this.topNode;)s=s.parent;if(!s)return null;let r=er(this,i,0,s.from,t),o,l;if(r?(l=r.state,o=r.pos+1):(l=this.streamParser.startState(e.unit),o=0),t-o>1e4)return null;for(;o=i&&t+e.length<=s&&e.prop(n.stateAfter);if(r)return{state:n.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],h=t+e.positions[o],a=l instanceof F&&h=e.length)return e;!s&&e.type==n.topNode&&(s=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],h;if(ot&&er(n,s.tree,0-s.offset,t,o),h;if(l&&(h=Bh(n,s.tree,t+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:h}}return{state:n.streamParser.startState(i?kt(i):4),tree:F.empty}}class Eu{constructor(e,t,i,s){this.lang=e,this.input=t,this.fragments=i,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let r=Wt.get(),o=s[0].from,{state:l,tree:h}=Lu(e,i,o,r==null?void 0:r.state);this.state=l,this.parsedPos=this.chunkStart=o+h.length;for(let a=0;a=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==` -`&&(t="");else{let i=t.indexOf(` -`);i>-1&&(t=t.slice(0,i))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),i=e+t.length;for(let s=this.rangeIndex;;){let r=this.ranges[s].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),s++,s==this.ranges.length))break;let o=this.ranges[s].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let s=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?s>r:s>=r)break;t+=this.ranges[++this.rangeIndex].from-s}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){r=this.skipGapsTo(t,r,1),t+=r;let o=this.chunk.length;r=this.skipGapsTo(i,r,-1),i+=r,s+=this.chunk.length-o}return this.chunk.push(e,t,i,s),r}parseLine(e){let{line:t,end:i}=this.nextLine(),s=0,{streamParser:r}=this.lang,o=new Oh(t,e?e.state.tabSize:4,e?kt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=Ph(r.token,o,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,4,s)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const tr=Object.create(null),pi=[pe.none],Iu=new _s(pi),Oo=[],Rh=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Rh[n]=Eh(tr,e);class Lh{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Rh)}resolve(e){return e?this.table[e]||(this.table[e]=Eh(this.extra,e)):0}}const Nu=new Lh(tr);function Un(n,e){Oo.indexOf(n)>-1||(Oo.push(n),console.warn(e))}function Eh(n,e){let t=null;for(let r of e.split(".")){let o=n[r]||x[r];o?typeof o=="function"?t?t=o(t):Un(r,`Modifier ${r} used at start of tag`):t?Un(r,`Tag ${r} used as modifier`):t=o:Un(r,`Unknown highlighting tag ${r}`)}if(!t)return 0;let i=e.replace(/ /g,"_"),s=pe.define({id:pi.length,name:i,props:[lu({[i]:t})]});return pi.push(s),s.id}function Vu(n){let e=pe.define({id:pi.length,name:"Document",props:[Ft.add(()=>n)]});return pi.push(e),e}const Fu=n=>{let e=nr(n.state);return e.line?Wu(n):e.block?zu(n):!1};function ir(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const Wu=ir(ju,0),Hu=ir(Ih,0),zu=ir((n,e)=>Ih(n,e,$u(e)),0);function nr(n,e=n.selection.main.head){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const _t=50;function qu(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-_t,i),o=n.sliceDoc(s,s+_t),l=/\s*$/.exec(r)[0].length,h=/^\s*/.exec(o)[0].length,a=r.length-l;if(r.slice(a-e.length,a)==e&&o.slice(h,h+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+h,margin:h&&1}};let c,f;s-i<=2*_t?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+_t),f=n.sliceDoc(s-_t,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function $u(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from,to:s.to})}return e}function Ih(n,e,t=e.selection.ranges){let i=t.map(r=>nr(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>qu(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>c.from)){s=c.from;let f=nr(e,a).line;if(!f)continue;let u=/^\s*/.exec(c.text)[0].length,d=u==c.length,p=c.text.slice(u,u+f.length)==f?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:h,indent:a,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+a,insert:h+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:h}of i)if(l>=0){let a=o.from+l,c=a+h.length;o.text[c-o.from]==" "&&c++,r.push({from:a,to:c})}return{changes:r}}return null}const Ls=St.define(),Ku=St.define(),Uu=D.define(),Nh=D.define({combine(n){return Ct(n,{minDepth:100,newGroupDelay:500},{minDepth:Math.max,newGroupDelay:Math.min})}});function Gu(n){let e=0;return n.iterChangedRanges((t,i)=>e=i),e}const Vh=me.define({create(){return je.empty},update(n,e){let t=e.state.facet(Nh),i=e.annotation(Ls);if(i){let h=e.docChanged?b.single(Gu(e.changes)):void 0,a=be.fromTransaction(e,h),c=i.side,f=c==0?n.undone:n.done;return a?f=hn(f,f.length,t.minDepth,a):f=Hh(f,e.startState.selection),new je(c==0?i.rest:f,c==0?f:i.rest)}let s=e.annotation(Ku);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(Q.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=be.fromTransaction(e),o=e.annotation(Q.time),l=e.annotation(Q.userEvent);return r?n=n.addChanges(r,o,l,t.newGroupDelay,t.minDepth):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new je(n.done.map(be.fromJSON),n.undone.map(be.fromJSON))}});function Ag(n={}){return[Vh,Nh.of(n),O.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Fh:e.inputType=="historyRedo"?Es:null;return i?(e.preventDefault(),i(t)):!1}})]}function An(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(Vh,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const Fh=An(0,!1),Es=An(1,!1),Ju=An(0,!0),_u=An(1,!0);class be{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new be(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new be(e.changes&&Y.fromJSON(e.changes),[],e.mapped&&Ke.fromJSON(e.mapped),e.startSelection&&b.fromJSON(e.startSelection),e.selectionsAfter.map(b.fromJSON))}static fromTransaction(e,t){let i=Oe;for(let s of e.startState.facet(Uu)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new be(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Oe)}static selection(e){return new be(void 0,Oe,void 0,void 0,e)}}function hn(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function Xu(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let h=0;h=a&&o<=c&&(i=!0)}}),i}function Yu(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Wh(n,e){return n.length?e.length?n.concat(e):n:e}const Oe=[],Qu=200;function Hh(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-Qu));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),hn(n,n.length-1,1e9,t.setSelAfter(i)))}else return[be.selection([e])]}function Zu(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Gn(n,e){if(!n.length)return n;let t=n.length,i=Oe;for(;t;){let s=ed(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[be.selection(i)]:Oe}function ed(n,e,t){let i=Wh(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Oe,t);if(!n.changes)return be.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new be(s,L.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const td=/^(input\.type|delete)($|\.)/;class je{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new je(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||td.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):Mn(t,e))}function ae(n){return n.textDirectionAt(n.state.selection.main.head)==_.LTR}const qh=n=>zh(n,!ae(n)),$h=n=>zh(n,ae(n));function jh(n,e){return Ie(n,t=>t.empty?n.moveByGroup(t,e):Mn(t,e))}const id=n=>jh(n,!ae(n)),nd=n=>jh(n,ae(n));function sd(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Dn(n,e,t){let i=ge(n).resolveInner(e.head),s=t?R.closedBy:R.openedBy;for(let h=e.head;;){let a=t?i.childAfter(h):i.childBefore(h);if(!a)break;sd(n,a,s)?i=a:h=t?a.to:a.from}let r=i.type.prop(s),o,l;return r&&(o=t?$e(n,i.from,1):$e(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,b.cursor(l,t?-1:1)}const rd=n=>Ie(n,e=>Dn(n.state,e,!ae(n))),od=n=>Ie(n,e=>Dn(n.state,e,ae(n)));function Kh(n,e){return Ie(n,t=>{if(!t.empty)return Mn(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const Uh=n=>Kh(n,!1),Gh=n=>Kh(n,!0);function Jh(n){return Math.max(n.defaultLineHeight,Math.min(n.dom.clientHeight,innerHeight)-5)}function _h(n,e){let{state:t}=n,i=$t(t.selection,l=>l.empty?n.moveVertically(l,e,Jh(n)):Mn(l,e));if(i.eq(t.selection))return!1;let s=n.coordsAtPos(t.selection.main.head),r=n.scrollDOM.getBoundingClientRect(),o;return s&&s.top>r.top&&s.bottom_h(n,!1),Is=n=>_h(n,!0);function ct(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=b.cursor(i.from+r))}return s}const ld=n=>Ie(n,e=>ct(n,e,!0)),hd=n=>Ie(n,e=>ct(n,e,!1)),ad=n=>Ie(n,e=>ct(n,e,!ae(n))),cd=n=>Ie(n,e=>ct(n,e,ae(n))),fd=n=>Ie(n,e=>b.cursor(n.lineBlockAt(e.head).from,1)),ud=n=>Ie(n,e=>b.cursor(n.lineBlockAt(e.head).to,-1));function dd(n,e,t){let i=!1,s=$t(n.selection,r=>{let o=$e(n,r.head,-1)||$e(n,r.head,1)||r.head>0&&$e(n,r.head-1,1)||r.headdd(n,e,!1);function Pe(n,e){let t=$t(n.state.selection,i=>{let s=e(i);return b.range(i.anchor,s.head,s.goalColumn)});return t.eq(n.state.selection)?!1:(n.dispatch(Ge(n.state,t)),!0)}function Xh(n,e){return Pe(n,t=>n.moveByChar(t,e))}const Yh=n=>Xh(n,!ae(n)),Qh=n=>Xh(n,ae(n));function Zh(n,e){return Pe(n,t=>n.moveByGroup(t,e))}const gd=n=>Zh(n,!ae(n)),md=n=>Zh(n,ae(n)),yd=n=>Pe(n,e=>Dn(n.state,e,!ae(n))),bd=n=>Pe(n,e=>Dn(n.state,e,ae(n)));function ea(n,e){return Pe(n,t=>n.moveVertically(t,e))}const ta=n=>ea(n,!1),ia=n=>ea(n,!0);function na(n,e){return Pe(n,t=>n.moveVertically(t,e,Jh(n)))}const Bo=n=>na(n,!1),Po=n=>na(n,!0),wd=n=>Pe(n,e=>ct(n,e,!0)),xd=n=>Pe(n,e=>ct(n,e,!1)),kd=n=>Pe(n,e=>ct(n,e,!ae(n))),vd=n=>Pe(n,e=>ct(n,e,ae(n))),Sd=n=>Pe(n,e=>b.cursor(n.lineBlockAt(e.head).from)),Cd=n=>Pe(n,e=>b.cursor(n.lineBlockAt(e.head).to)),Ro=({state:n,dispatch:e})=>(e(Ge(n,{anchor:0})),!0),Lo=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.doc.length})),!0),Eo=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.selection.main.anchor,head:0})),!0),Io=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Ad=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Md=({state:n,dispatch:e})=>{let t=Tn(n).map(({from:i,to:s})=>b.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:b.create(t),userEvent:"select"})),!0},Dd=({state:n,dispatch:e})=>{let t=$t(n.selection,i=>{var s;let r=ge(n).resolveInner(i.head,1);for(;!(r.from=i.to||r.to>i.to&&r.from<=i.from||!(!((s=r.parent)===null||s===void 0)&&s.parent));)r=r.parent;return b.range(r.to,r.from)});return e(Ge(n,t)),!0},Od=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=b.create([t.main]):t.main.empty||(i=b.create([b.cursor(t.main.head)])),i?(e(Ge(n,i)),!0):!1};function On(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let h=e(o);ho&&(t="delete.forward",h=Ni(n,h,!0)),o=Math.min(o,h),l=Math.max(l,h)}else o=Ni(n,o,!1),l=Ni(n,o,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:b.cursor(o)}});return s.changes.empty?!1:(n.dispatch(i.update(s,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?O.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Ni(n,e,t){if(n instanceof O)for(let i of n.state.facet(O.atomicRanges).map(s=>s(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const sa=(n,e)=>On(n,t=>{let{state:i}=n,s=i.doc.lineAt(t),r,o;if(!e&&t>s.from&&tsa(n,!1),ra=n=>sa(n,!0),oa=(n,e)=>On(n,t=>{let i=t,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let h=fe(r.text,i-r.from,e)+r.from,a=r.text.slice(Math.min(i,h)-r.from,Math.max(i,h)-r.from),c=o(a);if(l!=null&&c!=l)break;(a!=" "||i!=t)&&(l=c),i=h}return i}),la=n=>oa(n,!1),Td=n=>oa(n,!0),ha=n=>On(n,e=>{let t=n.lineBlockAt(e).to;return eOn(n,e=>{let t=n.lineBlockAt(e).from;return e>t?t:Math.max(0,e-1)}),Pd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:N.of(["",""])},range:b.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Rd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:fe(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:fe(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:b.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Tn(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function aa(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of Tn(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let h of r.ranges)s.push(b.range(Math.min(n.doc.length,h.anchor+l),Math.min(n.doc.length,h.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let h of r.ranges)s.push(b.range(h.anchor-l,h.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:b.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Ld=({state:n,dispatch:e})=>aa(n,e,!1),Ed=({state:n,dispatch:e})=>aa(n,e,!0);function ca(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of Tn(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});return e(n.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Id=({state:n,dispatch:e})=>ca(n,e,!1),Nd=({state:n,dispatch:e})=>ca(n,e,!0),Vd=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Tn(e).map(({from:s,to:r})=>(s>0?s--:rn.moveVertically(s,!0)).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Fd(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=ge(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(R.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from?{from:i.to,to:s.from}:null}const Wd=fa(!1),Hd=fa(!0);function fa(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),h=!n&&r==o&&Fd(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let a=new Sn(e,{simulateBreak:r,simulateDoubleBreak:!!h}),c=kh(a,r);for(c==null&&(c=/^\s*/.exec(e.doc.lineAt(r).text)[0].length);ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:b.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const zd=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new Sn(n,{overrideIndentation:r=>{let o=t[r];return o==null?-1:o}}),s=sr(n,(r,o,l)=>{let h=kh(i,r.from);if(h==null)return;/\S/.test(r.text)||(h=0);let a=/^\s*/.exec(r.text)[0],c=ln(n,h);(a!=c||l.fromn.readOnly?!1:(e(n.update(sr(n,(t,i)=>{i.push({from:t.from,insert:n.facet(vn)})}),{userEvent:"input.indent"})),!0),$d=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(sr(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=bi(s,n.tabSize),o=0,l=ln(n,Math.max(0,r-kt(n)));for(;o({mac:n.key,run:n.run,shift:n.shift}))),Dg=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:rd,shift:yd},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:od,shift:bd},{key:"Alt-ArrowUp",run:Ld},{key:"Shift-Alt-ArrowUp",run:Id},{key:"Alt-ArrowDown",run:Ed},{key:"Shift-Alt-ArrowDown",run:Nd},{key:"Escape",run:Od},{key:"Mod-Enter",run:Hd},{key:"Alt-l",mac:"Ctrl-l",run:Md},{key:"Mod-i",run:Dd,preventDefault:!0},{key:"Mod-[",run:$d},{key:"Mod-]",run:qd},{key:"Mod-Alt-\\",run:zd},{key:"Shift-Mod-k",run:Vd},{key:"Shift-Mod-\\",run:pd},{key:"Mod-/",run:Fu},{key:"Alt-A",run:Hu}].concat(Kd);function re(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;en.normalize("NFKD"):n=>n;class qt{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(No(l)):No,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ie(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Hs(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Se(e);let s=this.normalize(t);for(let r=0,o=i;;r++){let l=s.charCodeAt(r),h=this.match(l,o);if(h)return this.value=h,this;if(r==s.length-1)break;o==i&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=an(this.text,s+(i==s?1:0)),i==this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new Lt(t,e.sliceString(t,i));return Jn.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this.matchPos=an(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Lt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(pa.prototype[Symbol.iterator]=ga.prototype[Symbol.iterator]=function(){return this});function Ud(n){try{return new RegExp(n,rr),!0}catch{return!1}}function an(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function Vs(n){let e=re("input",{class:"cm-textfield",name:"line"}),t=re("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:cn.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},re("label",n.state.phrase("Go to line"),": ",e)," ",re("button",{class:"cm-button",type:"submit"},n.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:r}=n,o=r.doc.lineAt(r.selection.main.head),[,l,h,a,c]=s,f=a?+a.slice(1):0,u=h?+h:o.number;if(h&&c){let p=u/100;l&&(p=p*(l=="-"?-1:1)+o.number/r.doc.lines),u=Math.round(r.doc.lines*p)}else h&&l&&(u=u*(l=="-"?-1:1)+o.number);let d=r.doc.line(Math.max(1,Math.min(r.doc.lines,u)));n.dispatch({effects:cn.of(!1),selection:b.cursor(d.from+Math.max(0,Math.min(f,d.length))),scrollIntoView:!0}),n.focus()}return{dom:t}}const cn=L.define(),Vo=me.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(cn)&&(n=t.value);return n},provide:n=>tn.from(n,e=>e?Vs:null)}),Gd=n=>{let e=en(n,Vs);if(!e){let t=[cn.of(!0)];n.state.field(Vo,!1)==null&&t.push(L.appendConfig.of([Vo,Jd])),n.dispatch({effects:t}),e=en(n,Vs)}return e&&e.dom.querySelector("input").focus(),!0},Jd=O.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),_d={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ma=D.define({combine(n){return Ct(n,_d,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Og(n){let e=[ep,Zd];return n&&e.push(ma.of(n)),e}const Xd=T.mark({class:"cm-selectionMatch"}),Yd=T.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Fo(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=z.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=z.Word)}function Qd(n,e,t,i){return n(e.sliceDoc(t,t+1))==z.Word&&n(e.sliceDoc(i-1,i))==z.Word}const Zd=de.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(ma),{state:t}=n,i=t.selection;if(i.ranges.length>1)return T.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return T.none;let h=t.wordAt(s.head);if(!h)return T.none;o=t.charCategorizer(s.head),r=t.sliceDoc(h.from,h.to)}else{let h=s.to-s.from;if(h200)return T.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Fo(o,t,s.from,s.to)&&Qd(o,t,s.from,s.to)))return T.none}else if(r=t.sliceDoc(s.from,s.to).trim(),!r)return T.none}let l=[];for(let h of n.visibleRanges){let a=new qt(t.doc,r,h.from,h.to);for(;!a.next().done;){let{from:c,to:f}=a.value;if((!o||Fo(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(Yd.range(c,f)):(c>=s.to||f<=s.from)&&l.push(Xd.range(c,f)),l.length>e.maxMatches))return T.none}}return T.set(l)}},{decorations:n=>n.decorations}),ep=O.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),tp=({state:n,dispatch:e})=>{let{selection:t}=n,i=b.create(t.ranges.map(s=>n.wordAt(s.head)||b.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function ip(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new qt(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new qt(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(h=>h.from==l.value.from))continue;if(r){let h=n.wordAt(l.value.from);if(!h||h.from!=l.value.from||h.to!=l.value.to)continue}return l.value}}const np=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return tp({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=ip(n,i);return s?(e(n.update({selection:n.selection.addRange(b.range(s.from,s.to),!1),effects:O.scrollIntoView(s.to)})),!0):!1},or=D.define({combine(n){return Ct(n,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:e=>new pp(e)})}});class ya{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Ud(this.search)),this.unquoted=this.literal?this.search:this.search.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` -`:i=="r"?"\r":i=="t"?" ":"\\"),this.wholeWord=!!e.wholeWord}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new lp(this):new rp(this)}getCursor(e,t=0,i){let s=e.doc?e:I.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?Tt(this,s,t,i):Ot(this,s,t,i)}}class ba{constructor(e){this.spec=e}}function Ot(n,e,t,i){return new qt(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),n.wholeWord?sp(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function sp(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Ot(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Tt(n,e,t,i){return new pa(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?op(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function fn(n,e){return n.slice(fe(n,e,!1),e)}function un(n,e){return n.slice(e,fe(n,e))}function op(n){return(e,t,i)=>!i[0].length||(n(fn(i.input,i.index))!=z.Word||n(un(i.input,i.index))!=z.Word)&&(n(un(i.input,i.index+i[0].length))!=z.Word||n(fn(i.input,i.index+i[0].length))!=z.Word)}class lp extends ba{nextMatch(e,t,i){let s=Tt(this.spec,e,i,e.doc.length).next();return s.done&&(s=Tt(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=Tt(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.replace.replace(/\$([$&\d+])/g,(t,i)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Tt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const gi=L.define(),lr=L.define(),st=me.define({create(n){return new _n(Fs(n).create(),null)},update(n,e){for(let t of e.effects)t.is(gi)?n=new _n(t.value.create(),n.panel):t.is(lr)&&(n=new _n(n.query,t.value?hr:null));return n},provide:n=>tn.from(n,e=>e.panel)});class _n{constructor(e,t){this.query=e,this.panel=t}}const hp=T.mark({class:"cm-searchMatch"}),ap=T.mark({class:"cm-searchMatch cm-searchMatch-selected"}),cp=de.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(st))}update(n){let e=n.state.field(st);(e!=n.startState.field(st)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return T.none;let{view:t}=this,i=new bt;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-2*250;)h=r[++s].to;n.highlight(t.state,l,h,(a,c)=>{let f=t.state.selection.ranges.some(u=>u.from==a&&u.to==c);i.add(a,c,f?ap:hp)})}return i.finish()}},{decorations:n=>n.decorations});function xi(n){return e=>{let t=e.state.field(st,!1);return t&&t.query.spec.valid?n(e,t):wa(e)}}const dn=xi((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);return i?(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:ar(n,i),userEvent:"select.search"}),!0):!1}),pn=xi((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);return s?(n.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0,effects:ar(n,s),userEvent:"select.search"}),!0):!1}),fp=xi((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:b.create(t.map(i=>b.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),up=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new qt(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(b.range(l.value.from,l.value.to))}return e(n.update({selection:b.create(r,o),userEvent:"select.search.matches"})),!0},Wo=xi((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=[],l,h,a=[];if(r.from==i&&r.to==s&&(h=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:h}),r=e.nextMatch(t,r.from,r.to),a.push(O.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))),r){let c=o.length==0||o[0].from>=r.to?0:r.to-r.from-h.length;l={anchor:r.from-c,head:r.to-c},a.push(ar(n,r))}return n.dispatch({changes:o,selection:l,scrollIntoView:!!l,effects:a,userEvent:"input.replace"}),!0}),dp=xi((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:O.announce.of(i),userEvent:"input.replace.all"}),!0});function hr(n){return n.state.facet(or).createPanel(n)}function Fs(n,e){var t,i,s,r;let o=n.selection.main,l=o.empty||o.to>o.from+100?"":n.sliceDoc(o.from,o.to);if(e&&!l)return e;let h=n.facet(or);return new ya({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:h.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:h.literal,wholeWord:(r=e==null?void 0:e.wholeWord)!==null&&r!==void 0?r:h.wholeWord})}const wa=n=>{let e=n.state.field(st,!1);if(e&&e.panel){let t=en(n,hr);if(!t)return!1;let i=t.dom.querySelector("[main-field]");if(i&&i!=n.root.activeElement){let s=Fs(n.state,e.query.spec);s.valid&&n.dispatch({effects:gi.of(s)}),i.focus(),i.select()}}else n.dispatch({effects:[lr.of(!0),e?gi.of(Fs(n.state,e.query.spec)):L.appendConfig.of(mp)]});return!0},xa=n=>{let e=n.state.field(st,!1);if(!e||!e.panel)return!1;let t=en(n,hr);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:lr.of(!1)}),!0},Tg=[{key:"Mod-f",run:wa,scope:"editor search-panel"},{key:"F3",run:dn,shift:pn,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:dn,shift:pn,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:xa,scope:"editor search-panel"},{key:"Mod-Shift-l",run:up},{key:"Alt-g",run:Gd},{key:"Mod-d",run:np,preventDefault:!0}];class pp{constructor(e){this.view=e;let t=this.query=e.state.field(st).query.spec;this.commit=this.commit.bind(this),this.searchField=re("input",{value:t.search,placeholder:ke(e,"Find"),"aria-label":ke(e,"Find"),class:"cm-textfield",name:"search","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=re("input",{value:t.replace,placeholder:ke(e,"Replace"),"aria-label":ke(e,"Replace"),class:"cm-textfield",name:"replace",onchange:this.commit,onkeyup:this.commit}),this.caseField=re("input",{type:"checkbox",name:"case",checked:t.caseSensitive,onchange:this.commit}),this.reField=re("input",{type:"checkbox",name:"re",checked:t.regexp,onchange:this.commit}),this.wordField=re("input",{type:"checkbox",name:"word",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return re("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=re("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>dn(e),[ke(e,"next")]),i("prev",()=>pn(e),[ke(e,"previous")]),i("select",()=>fp(e),[ke(e,"all")]),re("label",null,[this.caseField,ke(e,"match case")]),re("label",null,[this.reField,ke(e,"regexp")]),re("label",null,[this.wordField,ke(e,"by word")]),...e.state.readOnly?[]:[re("br"),this.replaceField,i("replace",()=>Wo(e),[ke(e,"replace")]),i("replaceAll",()=>dp(e),[ke(e,"replace all")]),re("button",{name:"close",onclick:()=>xa(e),"aria-label":ke(e,"close"),type:"button"},["\xD7"])]])}commit(){let e=new ya({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:gi.of(e)}))}keydown(e){gf(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?pn:dn)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Wo(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(gi)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(or).top}}function ke(n,e){return n.state.phrase(e)}const Vi=30,Fi=/[\s\.,:;?!]/;function ar(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Vi),o=Math.min(s,t+Vi),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let h=0;hl.length-Vi;h--)if(!Fi.test(l[h-1])&&Fi.test(l[h])){l=l.slice(0,h);break}}return O.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const gp=O.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),mp=[st,vt.lowest(cp),gp];class ka{constructor(e,t,i){this.state=e,this.pos=t,this.explicit=i,this.abortListeners=[]}tokenBefore(e){let t=ge(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(va(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function Ho(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function yp(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:yp(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function Bg(n,e){return t=>{for(let i=ge(t.state).resolveInner(t.pos,-1);i;i=i.parent)if(n.indexOf(i.name)>-1)return null;return e(t)}}class zo{constructor(e,t,i){this.completion=e,this.source=t,this.match=i}}function rt(n){return n.selection.main.head}function va(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}function wp(n,e,t,i){return Object.assign(Object.assign({},n.changeByRange(s=>{if(s==n.selection.main)return{changes:{from:t,to:i,insert:e},range:b.cursor(t+e.length)};let r=i-t;return!s.empty||r&&n.sliceDoc(s.from-r,s.from)!=n.sliceDoc(t,i)?{range:s}:{changes:{from:s.from-r,to:s.from,insert:e},range:b.cursor(s.from-r+e.length)}})),{userEvent:"input.complete"})}function Sa(n,e){const t=e.completion.apply||e.completion.label;let i=e.source;typeof t=="string"?n.dispatch(wp(n.state,t,i.from,i.to)):t(n,e.completion,i.from,i.to)}const qo=new WeakMap;function xp(n){if(!Array.isArray(n))return n;let e=qo.get(n);return e||qo.set(n,e=bp(n)),e}class kp{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let t=0;t=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(M=Hs(C))!=M.toLowerCase()?1:M!=M.toUpperCase()?2:0;(!v||B==1&&g||k==0&&B!=0)&&(t[f]==C||i[f]==C&&(u=!0)?o[f++]=v:o.length&&(y=!1)),k=B,v+=Se(C)}return f==h&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==h&&p==0?[-200-e.length,0,m]:l>-1?[-700-e.length,l,l+this.pattern.length]:d==h?[-200+-700-e.length,p,m]:f==h?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[e-i.length],r=1;for(let o of t){let l=o+(this.astral?Se(ie(i,o)):1);r>1&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return s}}const Be=D.define({combine(n){return Ct(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,optionClass:(e,t)=>i=>vp(e(i),t(i)),addToOptions:(e,t)=>e.concat(t)})}});function vp(n,e){return n?e?n+" "+e:n:e}function Sp(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s){let r=document.createElement("span");r.className="cm-completionLabel";let{label:o}=t,l=0;for(let h=1;hl&&r.appendChild(document.createTextNode(o.slice(l,a)));let f=r.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(o.slice(a,c))),f.className="cm-completionMatchedText",l=c}return lt.position-i.position).map(t=>t.render)}function $o(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class Cp{constructor(e,t){this.view=e,this.stateField=t,this.info=null,this.placeInfo={read:()=>this.measureInfo(),write:l=>this.positionInfo(l),key:this};let i=e.state.field(t),{options:s,selected:r}=i.open,o=e.state.facet(Be);this.optionContent=Sp(o),this.optionClass=o.optionClass,this.range=$o(s.length,r,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.dom.addEventListener("mousedown",l=>{for(let h=l.target,a;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(a=/-(\d+)$/.exec(h.id))&&+a[1]{this.info&&this.view.requestMeasure(this.placeInfo)})}mount(){this.updateSel()}update(e){e.state.field(this.stateField)!=e.startState.field(this.stateField)&&this.updateSel()}positioned(){this.info&&this.view.requestMeasure(this.placeInfo)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=$o(t.options.length,t.selected,this.view.state.facet(Be).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t.options,e.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfo)})),this.updateSelectedOption(t.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:i}=t.options[t.selected],{info:s}=i;if(!s)return;let r=typeof s=="string"?document.createTextNode(s):s(i);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o)}).catch(o=>Ee(this.view.state,o,"completion info")):this.addInfoPane(r)}}addInfoPane(e){let t=this.info=document.createElement("div");t.className="cm-tooltip cm-completionInfo",t.appendChild(e),this.dom.appendChild(t),this.view.requestMeasure(this.placeInfo)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return t&&Mp(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.ownerDocument.defaultView||window,i=this.dom.getBoundingClientRect(),s=this.info.getBoundingClientRect(),r=e.getBoundingClientRect();if(r.top>Math.min(t.innerHeight,i.bottom)-10||r.bottom=s.height||p>i.top?c=r.bottom-i.top+"px":f=i.bottom-r.top+"px"}return{top:c,bottom:f,maxWidth:a,class:h?o?"left-narrow":"right-narrow":l?"left":"right"}}positionInfo(e){this.info&&(e?(this.info.style.top=e.top,this.info.style.bottom=e.bottom,this.info.style.maxWidth=e.maxWidth,this.info.className="cm-tooltip cm-completionInfo cm-completionInfo-"+e.class):this.info.style.top="-1e6px")}createListBox(e,t,i){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions"));for(let r=i.from;rnew Cp(e,n)}function Mp(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect();i.topt.bottom&&(n.scrollTop+=i.bottom-t.bottom)}function jo(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function Dp(n,e){let t=[],i=0;for(let l of n)if(l.hasResult())if(l.result.filter===!1){let h=l.result.getMatch;for(let a of l.result.options){let c=[1e9-i++];if(h)for(let f of h(a))c.push(f);t.push(new zo(a,l,c))}}else{let h=new kp(e.sliceDoc(l.from,l.to)),a;for(let c of l.result.options)(a=h.match(c.label))&&(c.boost!=null&&(a[0]+=c.boost),t.push(new zo(c,l,a)))}let s=[],r=null,o=e.facet(Be).compareCompletions;for(let l of t.sort((h,a)=>a.match[0]-h.match[0]||o(h.completion,a.completion)))!r||r.label!=l.completion.label||r.detail!=l.completion.detail||r.type!=null&&l.completion.type!=null&&r.type!=l.completion.type||r.apply!=l.completion.apply?s.push(l):jo(l.completion)>jo(r)&&(s[s.length-1]=l),r=l.completion;return s}class si{constructor(e,t,i,s,r){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new si(this.options,Ko(t,e),this.tooltip,this.timestamp,e)}static build(e,t,i,s,r){let o=Dp(e,t);if(!o.length)return null;let l=t.facet(Be).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let h=s.options[s.selected].completion;for(let a=0;aa.hasResult()?Math.min(h,a.from):h,1e8),create:Ap(Ae),above:r.aboveCursor},s?s.timestamp:Date.now(),l)}map(e){return new si(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected)}}class gn{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new gn(Bp,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(Be),r=(i.override||t.languageDataAt("autocomplete",rt(t)).map(xp)).map(l=>(this.active.find(a=>a.source==l)||new ye(l,this.active.some(a=>a.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((l,h)=>l==this.active[h])&&(r=this.active);let o=e.selection||r.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Op(r,this.active)?si.build(r,t,this.id,this.open,i):this.open&&e.docChanged?this.open.map(e.changes):this.open;!o&&r.every(l=>l.state!=1)&&r.some(l=>l.hasResult())&&(r=r.map(l=>l.hasResult()?new ye(l.source,0):l));for(let l of e.effects)l.is(Aa)&&(o=o&&o.setSelected(l.value,this.id));return r==this.active&&o==this.open?this:new gn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:Tp}}function Op(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const Bp=[];function Ws(n){return n.isUserEvent("input.type")?"input":n.isUserEvent("delete.backward")?"delete":null}class ye{constructor(e,t,i=-1){this.source=e,this.state=t,this.explicitPos=i}hasResult(){return!1}update(e,t){let i=Ws(e),s=this;i?s=s.handleUserEvent(e,i,t):e.docChanged?s=s.handleChange(e):e.selection&&s.state!=0&&(s=new ye(s.source,0));for(let r of e.effects)if(r.is(cr))s=new ye(s.source,1,r.value?rt(e.state):-1);else if(r.is(mn))s=new ye(s.source,0);else if(r.is(Ca))for(let o of r.value)o.source==s.source&&(s=o);return s}handleUserEvent(e,t,i){return t=="delete"||!i.activateOnTyping?this.map(e.changes):new ye(this.source,1)}handleChange(e){return e.changes.touchesRange(rt(e.startState))?new ye(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ye(this.source,this.state,e.mapPos(this.explicitPos))}}class ri extends ye{constructor(e,t,i,s,r){super(e,2,t),this.result=i,this.from=s,this.to=r}hasResult(){return!0}handleUserEvent(e,t,i){var s;let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=rt(e.state);if((this.explicitPos<0?l<=r:lo||t=="delete"&&rt(e.startState)==this.from)return new ye(this.source,t=="input"&&i.activateOnTyping?1:0);let h=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),a;return Pp(this.result.validFor,e.state,r,o)?new ri(this.source,h,this.result,r,o):this.result.update&&(a=this.result.update(this.result,r,o,new ka(e.state,l,h>=0)))?new ri(this.source,h,a,a.from,(s=a.to)!==null&&s!==void 0?s:rt(e.state)):new ye(this.source,1,h)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new ye(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new ri(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function Pp(n,e,t,i){if(!n)return!1;let s=e.sliceDoc(t,i);return typeof n=="function"?n(s,t,i,e):va(n,!0).test(s)}const cr=L.define(),mn=L.define(),Ca=L.define({map(n,e){return n.map(t=>t.map(e))}}),Aa=L.define(),Ae=me.define({create(){return gn.start()},update(n,e){return n.update(e)},provide:n=>[ch.from(n,e=>e.tooltip),O.contentAttributes.from(n,e=>e.attrs)]});function Wi(n,e="option"){return t=>{let i=t.state.field(Ae,!1);if(!i||!i.open||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:Aa.of(l)}),!0}}const Rp=n=>{let e=n.state.field(Ae,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||Date.now()-e.open.timestampn.state.field(Ae,!1)?(n.dispatch({effects:cr.of(!0)}),!0):!1,Ep=n=>{let e=n.state.field(Ae,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:mn.of(null)}),!0)};class Ip{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Uo=50,Np=50,Vp=1e3,Fp=de.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of n.state.field(Ae).active)e.state==1&&this.startQuery(e)}update(n){let e=n.state.field(Ae);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Ae)==e)return;let t=n.transactions.some(i=>(i.selection||i.docChanged)&&!Ws(i));for(let i=0;iNp&&Date.now()-s.time>Vp){for(let r of s.context.abortListeners)try{r()}catch(o){Ee(this.view.state,o)}s.context.abortListeners=null,this.running.splice(i--,1)}else s.updates.push(...n.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(i=>i.state==1&&!this.running.some(s=>s.active.source==i.source))?setTimeout(()=>this.startUpdate(),Uo):-1,this.composing!=0)for(let i of n.transactions)Ws(i)=="input"?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:n}=this.view,e=n.field(Ae);for(let t of e.active)t.state==1&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t)}startQuery(n){let{state:e}=this.view,t=rt(e),i=new ka(e,t,n.explicitPos==t),s=new Ip(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:mn.of(null)}),Ee(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),Uo))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Be);for(let i=0;io.source==s.active.source);if(r&&r.state==1)if(s.done==null){let o=new ye(s.active.source,0);for(let l of s.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:Ca.of(e)})}},{eventHandlers:{blur(){let n=this.view.state.field(Ae,!1);n&&n.tooltip&&this.view.state.facet(Be).closeOnBlur&&this.view.dispatch({effects:mn.of(null)})},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:cr.of(!1)}),20),this.composing=0}}}),Ma=O.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",listStyle:"none",margin:0,padding:0,"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:`${400}px`,boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`${30}px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`${30}px`},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Wp{constructor(e,t,i,s){this.field=e,this.line=t,this.from=i,this.to=s}}class fr{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,le.TrackDel),i=e.mapPos(this.to,1,le.TrackDel);return t==null||i==null?null:new fr(this.field,t,i)}}class ur{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],s=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let h of this.lines){if(i.length){let a=o,c=/^\t*/.exec(h)[0].length;for(let f=0;fnew fr(h.field,s[h.line]+h.from,s[h.line]+h.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let l=r[1]?+r[1]:null,h=r[2]||r[3]||"",a=-1;for(let c=0;c=a&&f.field++}s.push(new Wp(a,i.length,r.index,r.index+h.length)),o=o.slice(0,r.index)+h+o.slice(r.index+r[0].length)}for(let l;l=/([$#])\\{/.exec(o);){o=o.slice(0,l.index)+l[1]+"{"+o.slice(l.index+l[0].length);for(let h of s)h.line==i.length&&h.from>l.index&&(h.from--,h.to--)}i.push(o)}return new ur(i,s)}}let Hp=T.widget({widget:new class extends at{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),zp=T.mark({class:"cm-snippetField"});class jt{constructor(e,t){this.ranges=e,this.active=t,this.deco=T.set(e.map(i=>(i.from==i.to?Hp:zp).range(i.from,i.to)))}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new jt(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const ki=L.define({map(n,e){return n&&n.map(e)}}),qp=L.define(),mi=me.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(ki))return t.value;if(t.is(qp)&&n)return new jt(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>O.decorations.from(n,e=>e?e.deco:T.none)});function dr(n,e){return b.create(n.filter(t=>t.field==e).map(t=>b.range(t.from,t.to)))}function $p(n){let e=ur.parse(n);return(t,i,s,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,s),h={changes:{from:s,to:r,insert:N.of(o)},scrollIntoView:!0};if(l.length&&(h.selection=dr(l,0)),l.length>1){let a=new jt(l,0),c=h.effects=[ki.of(a)];t.state.field(mi,!1)===void 0&&c.push(L.appendConfig.of([mi,Jp,_p,Ma]))}t.dispatch(t.state.update(h))}}function Da(n){return({state:e,dispatch:t})=>{let i=e.field(mi,!1);if(!i||n<0&&i.active==0)return!1;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);return t(e.update({selection:dr(i.ranges,s),effects:ki.of(r?null:new jt(i.ranges,s))})),!0}}const jp=({state:n,dispatch:e})=>n.field(mi,!1)?(e(n.update({effects:ki.of(null)})),!0):!1,Kp=Da(1),Up=Da(-1),Gp=[{key:"Tab",run:Kp,shift:Up},{key:"Escape",run:jp}],Go=D.define({combine(n){return n.length?n[0]:Gp}}),Jp=vt.highest(Js.compute([Go],n=>n.facet(Go)));function Pg(n,e){return Object.assign(Object.assign({},e),{apply:$p(n)})}const _p=O.domEventHandlers({mousedown(n,e){let t=e.state.field(mi,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);return!s||s.field==t.active?!1:(e.dispatch({selection:dr(t.ranges,s.field),effects:ki.of(t.ranges.some(r=>r.field>s.field)?new jt(t.ranges,s.field):null)}),!0)}}),yi={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},gt=L.define({map(n,e){let t=e.mapPos(n,-1,le.TrackAfter);return t==null?void 0:t}}),pr=L.define({map(n,e){return e.mapPos(n)}}),gr=new class extends yt{};gr.startSide=1;gr.endSide=-1;const Oa=me.define({create(){return j.empty},update(n,e){if(e.selection){let t=e.state.doc.lineAt(e.selection.main.head).from,i=e.startState.doc.lineAt(e.startState.selection.main.head).from;t!=e.changes.mapPos(i,-1)&&(n=j.empty)}n=n.map(e.changes);for(let t of e.effects)t.is(gt)?n=n.update({add:[gr.range(t.value,t.value+1)]}):t.is(pr)&&(n=n.update({filter:i=>i!=t.value}));return n}});function Rg(){return[Yp,Oa]}const Xn="()[]{}<>";function Ta(n){for(let e=0;e{if((Xp?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&Se(ie(i,0))==1||e!=s.from||t!=s.to)return!1;let r=Zp(n.state,i);return r?(n.dispatch(r),!0):!1}),Qp=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=Ba(n,n.selection.main.head).brackets||yi.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=eg(n.doc,o.head);for(let h of i)if(h==l&&Bn(n.doc,o.head)==Ta(ie(h,0)))return{changes:{from:o.head-h.length,to:o.head+h.length},range:b.cursor(o.head-h.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Lg=[{key:"Backspace",run:Qp}];function Zp(n,e){let t=Ba(n,n.selection.main.head),i=t.brackets||yi.brackets;for(let s of i){let r=Ta(ie(s,0));if(e==s)return r==s?ng(n,s,i.indexOf(s+s+s)>-1,t):tg(n,s,r,t.before||yi.before);if(e==r&&Pa(n,n.selection.main.from))return ig(n,s,r)}return null}function Pa(n,e){let t=!1;return n.field(Oa).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Bn(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Se(ie(t,0)))}function eg(n,e){let t=n.sliceString(e-2,e);return Se(ie(t,0))==t.length?t:t.slice(1)}function tg(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:gt.of(o.to+e.length),range:b.range(o.anchor+e.length,o.head+e.length)};let l=Bn(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:gt.of(o.head+e.length),range:b.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function ig(n,e,t){let i=null,s=n.selection.ranges.map(r=>r.empty&&Bn(n.doc,r.head)==t?b.cursor(r.head+t.length):i=r);return i?null:n.update({selection:b.create(s,n.selection.mainIndex),scrollIntoView:!0,effects:n.selection.ranges.map(({from:r})=>pr.of(r))})}function ng(n,e,t,i){let s=i.stringPrefixes||yi.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:gt.of(l.to+e.length),range:b.range(l.anchor+e.length,l.head+e.length)};let h=l.head,a=Bn(n.doc,h),c;if(a==e){if(Jo(n,h))return{changes:{insert:e+e,from:h},effects:gt.of(h+e.length),range:b.cursor(h+e.length)};if(Pa(n,h)){let f=t&&n.sliceDoc(h,h+e.length*3)==e+e+e;return{range:b.cursor(h+e.length*(f?3:1)),effects:pr.of(h)}}}else{if(t&&n.sliceDoc(h-2*e.length,h)==e+e&&(c=_o(n,h-2*e.length,s))>-1&&Jo(n,c))return{changes:{insert:e+e+e+e,from:h},effects:gt.of(h+e.length),range:b.cursor(h+e.length)};if(n.charCategorizer(h)(a)!=z.Word&&_o(n,h,s)>-1&&!sg(n,h,e,s))return{changes:{insert:e+e,from:h},effects:gt.of(h+e.length),range:b.cursor(h+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Jo(n,e){let t=ge(n).resolveInner(e+1);return t.parent&&t.from==e}function sg(n,e,t,i){let s=ge(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),h=l.indexOf(t);if(!h||h>-1&&i.indexOf(l.slice(0,h))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+h;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let a=s.to==e&&s.parent;if(!a)break;s=a}return!1}function _o(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=z.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=z.Word)return r}return-1}function Eg(n={}){return[Ae,Be.of(n),Fp,og,Ma]}const rg=[{key:"Ctrl-Space",run:Lp},{key:"Escape",run:Ep},{key:"ArrowDown",run:Wi(!0)},{key:"ArrowUp",run:Wi(!1)},{key:"PageDown",run:Wi(!0,"page")},{key:"PageUp",run:Wi(!1,"page")},{key:"Enter",run:Rp}],og=vt.highest(Js.computeN([Be],n=>n.facet(Be).defaultKeymap?[rg]:[]));export{wg as A,xg as B,yn as C,Kf as D,O as E,kg as F,mg as G,ge as H,G as I,Bg as J,bp as K,Bs as L,b as M,_s as N,bg as O,ph as P,yg as Q,Pg as R,Th as S,F as T,dg as U,I as a,ag as b,Ag as c,lg as d,hg as e,Sg as f,Cg as g,ug as h,Rg as i,Og as j,Js as k,Lg as l,Dg as m,Tg as n,Mg as o,rg as p,Eg as q,fg as r,vg as s,cg as t,pe as u,R as v,lu as w,x,pg as y,pu as z}; diff --git a/ui/dist/assets/index.e13041a6.js b/ui/dist/assets/index.e13041a6.js deleted file mode 100644 index 31fef8f47..000000000 --- a/ui/dist/assets/index.e13041a6.js +++ /dev/null @@ -1,661 +0,0 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const o of l.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerpolicy&&(l.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?l.credentials="include":s.crossorigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(s){if(s.ep)return;s.ep=!0;const l=t(s);fetch(s.href,l)}})();function se(){}const Sl=n=>n;function at(n,e){for(const t in e)n[t]=e[t];return n}function Hm(n){return n()}function su(){return Object.create(null)}function Ye(n){n.forEach(Hm)}function Jn(n){return typeof n=="function"}function De(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let ql;function ti(n,e){return ql||(ql=document.createElement("a")),ql.href=e,n===ql.href}function mb(n){return Object.keys(n).length===0}function jm(n,...e){if(n==null)return se;const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function rt(n,e,t){n.$$.on_destroy.push(jm(e,t))}function $n(n,e,t,i){if(n){const s=qm(n,e,t,i);return n[0](s)}}function qm(n,e,t,i){return n[1]&&i?at(t.ctx.slice(),n[1](i(e))):t.ctx}function Sn(n,e,t,i){if(n[2]&&i){const s=n[2](i(t));if(e.dirty===void 0)return s;if(typeof s=="object"){const l=[],o=Math.max(e.dirty.length,s.length);for(let r=0;r32){const e=[],t=n.ctx.length/32;for(let i=0;iwindow.performance.now():()=>Date.now(),ga=Vm?n=>requestAnimationFrame(n):se;const ws=new Set;function zm(n){ws.forEach(e=>{e.c(n)||(ws.delete(e),e.f())}),ws.size!==0&&ga(zm)}function jo(n){let e;return ws.size===0&&ga(zm),{promise:new Promise(t=>{ws.add(e={c:n,f:t})}),abort(){ws.delete(e)}}}function m(n,e){n.appendChild(e)}function Bm(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function gb(n){const e=_("style");return _b(Bm(n),e),e.sheet}function _b(n,e){return m(n.head||n,e),e.sheet}function w(n,e,t){n.insertBefore(e,t||null)}function k(n){n.parentNode.removeChild(n)}function nn(n,e){for(let t=0;tn.removeEventListener(e,t,i)}function Yt(n){return function(e){return e.preventDefault(),n.call(this,e)}}function ni(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function Um(n){return function(e){e.target===this&&n.call(this,e)}}function p(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function mi(n,e){const t=Object.getOwnPropertyDescriptors(n.__proto__);for(const i in e)e[i]==null?n.removeAttribute(i):i==="style"?n.style.cssText=e[i]:i==="__value"?n.value=n[i]=e[i]:t[i]&&t[i].set?n[i]=e[i]:p(n,i,e[i])}function Pt(n){return n===""?null:+n}function bb(n){return Array.from(n.childNodes)}function ue(n,e){e=""+e,n.wholeText!==e&&(n.data=e)}function Me(n,e){n.value=e==null?"":e}function ou(n,e,t,i){t===null?n.style.removeProperty(e):n.style.setProperty(e,t,i?"important":"")}function ne(n,e,t){n.classList[t?"add":"remove"](e)}function Wm(n,e,{bubbles:t=!1,cancelable:i=!1}={}){const s=document.createEvent("CustomEvent");return s.initCustomEvent(n,t,i,e),s}const go=new Map;let _o=0;function vb(n){let e=5381,t=n.length;for(;t--;)e=(e<<5)-e^n.charCodeAt(t);return e>>>0}function yb(n,e){const t={stylesheet:gb(e),rules:{}};return go.set(n,t),t}function dl(n,e,t,i,s,l,o,r=0){const a=16.666/i;let u=`{ -`;for(let b=0;b<=1;b+=a){const y=e+(t-e)*l(b);u+=b*100+`%{${o(y,1-y)}} -`}const f=u+`100% {${o(t,1-t)}} -}`,c=`__svelte_${vb(f)}_${r}`,d=Bm(n),{stylesheet:h,rules:g}=go.get(d)||yb(d,n);g[c]||(g[c]=!0,h.insertRule(`@keyframes ${c} ${f}`,h.cssRules.length));const v=n.style.animation||"";return n.style.animation=`${v?`${v}, `:""}${c} ${i}ms linear ${s}ms 1 both`,_o+=1,c}function pl(n,e){const t=(n.style.animation||"").split(", "),i=t.filter(e?l=>l.indexOf(e)<0:l=>l.indexOf("__svelte")===-1),s=t.length-i.length;s&&(n.style.animation=i.join(", "),_o-=s,_o||kb())}function kb(){ga(()=>{_o||(go.forEach(n=>{const{ownerNode:e}=n.stylesheet;e&&k(e)}),go.clear())})}function wb(n,e,t,i){if(!e)return se;const s=n.getBoundingClientRect();if(e.left===s.left&&e.right===s.right&&e.top===s.top&&e.bottom===s.bottom)return se;const{delay:l=0,duration:o=300,easing:r=Sl,start:a=Ho()+l,end:u=a+o,tick:f=se,css:c}=t(n,{from:e,to:s},i);let d=!0,h=!1,g;function v(){c&&(g=dl(n,0,1,o,l,r,c)),l||(h=!0)}function b(){c&&pl(n,g),d=!1}return jo(y=>{if(!h&&y>=a&&(h=!0),h&&y>=u&&(f(1,0),b()),!d)return!1;if(h){const $=y-a,C=0+1*r($/o);f(C,1-C)}return!0}),v(),f(0,1),b}function $b(n){const e=getComputedStyle(n);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:t,height:i}=e,s=n.getBoundingClientRect();n.style.position="absolute",n.style.width=t,n.style.height=i,Ym(n,s)}}function Ym(n,e){const t=n.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){const i=getComputedStyle(n),s=i.transform==="none"?"":i.transform;n.style.transform=`${s} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}let hl;function il(n){hl=n}function qo(){if(!hl)throw new Error("Function called outside component initialization");return hl}function Nn(n){qo().$$.on_mount.push(n)}function Sb(n){qo().$$.after_update.push(n)}function Cb(n){qo().$$.on_destroy.push(n)}function Qt(){const n=qo();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const l=Wm(e,t,{cancelable:i});return s.slice().forEach(o=>{o.call(n,l)}),!l.defaultPrevented}return!0}}function xe(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const Qs=[],me=[],uo=[],Hr=[],Km=Promise.resolve();let jr=!1;function Jm(){jr||(jr=!0,Km.then(Zm))}function Zn(){return Jm(),Km}function Tt(n){uo.push(n)}function He(n){Hr.push(n)}const or=new Set;let Vl=0;function Zm(){const n=hl;do{for(;Vl{qs=null})),qs}function ns(n,e,t){n.dispatchEvent(Wm(`${e?"intro":"outro"}${t}`))}const fo=new Set;let ci;function Ae(){ci={r:0,c:[],p:ci}}function Pe(){ci.r||Ye(ci.c),ci=ci.p}function A(n,e){n&&n.i&&(fo.delete(n),n.i(e))}function L(n,e,t,i){if(n&&n.o){if(fo.has(n))return;fo.add(n),ci.c.push(()=>{fo.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const ba={duration:0};function Gm(n,e,t){let i=e(n,t),s=!1,l,o,r=0;function a(){l&&pl(n,l)}function u(){const{delay:c=0,duration:d=300,easing:h=Sl,tick:g=se,css:v}=i||ba;v&&(l=dl(n,0,1,d,c,h,v,r++)),g(0,1);const b=Ho()+c,y=b+d;o&&o.abort(),s=!0,Tt(()=>ns(n,!0,"start")),o=jo($=>{if(s){if($>=y)return g(1,0),ns(n,!0,"end"),a(),s=!1;if($>=b){const C=h(($-b)/d);g(C,1-C)}}return s})}let f=!1;return{start(){f||(f=!0,pl(n),Jn(i)?(i=i(),_a().then(u)):u())},invalidate(){f=!1},end(){s&&(a(),s=!1)}}}function Xm(n,e,t){let i=e(n,t),s=!0,l;const o=ci;o.r+=1;function r(){const{delay:a=0,duration:u=300,easing:f=Sl,tick:c=se,css:d}=i||ba;d&&(l=dl(n,1,0,u,a,f,d));const h=Ho()+a,g=h+u;Tt(()=>ns(n,!1,"start")),jo(v=>{if(s){if(v>=g)return c(0,1),ns(n,!1,"end"),--o.r||Ye(o.c),!1;if(v>=h){const b=f((v-h)/u);c(1-b,b)}}return s})}return Jn(i)?_a().then(()=>{i=i(),r()}):r(),{end(a){a&&i.tick&&i.tick(1,0),s&&(l&&pl(n,l),s=!1)}}}function nt(n,e,t,i){let s=e(n,t),l=i?0:1,o=null,r=null,a=null;function u(){a&&pl(n,a)}function f(d,h){const g=d.b-l;return h*=Math.abs(g),{a:l,b:d.b,d:g,duration:h,start:d.start,end:d.start+h,group:d.group}}function c(d){const{delay:h=0,duration:g=300,easing:v=Sl,tick:b=se,css:y}=s||ba,$={start:Ho()+h,b:d};d||($.group=ci,ci.r+=1),o||r?r=$:(y&&(u(),a=dl(n,l,d,g,h,v,y)),d&&b(0,1),o=f($,g),Tt(()=>ns(n,d,"start")),jo(C=>{if(r&&C>r.start&&(o=f(r,g),r=null,ns(n,o.b,"start"),y&&(u(),a=dl(n,l,o.b,o.duration,0,v,s.css))),o){if(C>=o.end)b(l=o.b,1-l),ns(n,o.b,"end"),r||(o.b?u():--o.group.r||Ye(o.group.c)),o=null;else if(C>=o.start){const S=C-o.start;l=o.a+o.d*v(S/o.duration),b(l,1-l)}}return!!(o||r)}))}return{run(d){Jn(s)?_a().then(()=>{s=s(),c(d)}):c(d)},end(){u(),o=r=null}}}function pn(n,e){n.d(1),e.delete(n.key)}function Ut(n,e){L(n,1,1,()=>{e.delete(n.key)})}function Tb(n,e){n.f(),Ut(n,e)}function ct(n,e,t,i,s,l,o,r,a,u,f,c){let d=n.length,h=l.length,g=d;const v={};for(;g--;)v[n[g].key]=g;const b=[],y=new Map,$=new Map;for(g=h;g--;){const M=c(s,l,g),O=t(M);let E=o.get(O);E?i&&E.p(M,e):(E=u(O,M),E.c()),y.set(O,b[g]=E),O in v&&$.set(O,Math.abs(g-v[O]))}const C=new Set,S=new Set;function T(M){A(M,1),M.m(r,f),o.set(M.key,M),f=M.first,h--}for(;d&&h;){const M=b[h-1],O=n[d-1],E=M.key,P=O.key;M===O?(f=M.first,d--,h--):y.has(P)?!o.has(E)||C.has(E)?T(M):S.has(P)?d--:$.get(E)>$.get(P)?(S.add(E),T(M)):(C.add(P),d--):(a(O,o),d--)}for(;d--;){const M=n[d];y.has(M.key)||a(M,o)}for(;h;)T(b[h-1]);return b}function hn(n,e){const t={},i={},s={$$scope:1};let l=n.length;for(;l--;){const o=n[l],r=e[l];if(r){for(const a in o)a in r||(i[a]=1);for(const a in r)s[a]||(t[a]=r[a],s[a]=1);n[l]=r}else for(const a in o)s[a]=1}for(const o in i)o in t||(t[o]=void 0);return t}function oi(n){return typeof n=="object"&&n!==null?n:{}}function Re(n,e,t){const i=n.$$.props[e];i!==void 0&&(n.$$.bound[i]=t,t(n.$$.ctx[i]))}function q(n){n&&n.c()}function H(n,e,t,i){const{fragment:s,on_mount:l,on_destroy:o,after_update:r}=n.$$;s&&s.m(e,t),i||Tt(()=>{const a=l.map(Hm).filter(Jn);o?o.push(...a):Ye(a),n.$$.on_mount=[]}),r.forEach(Tt)}function j(n,e){const t=n.$$;t.fragment!==null&&(Ye(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Db(n,e){n.$$.dirty[0]===-1&&(Qs.push(n),Jm(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<{const g=h.length?h[0]:d;return u.ctx&&s(u.ctx[c],u.ctx[c]=g)&&(!u.skip_bound&&u.bound[c]&&u.bound[c](g),f&&Db(n,c)),d}):[],u.update(),f=!0,Ye(u.before_update),u.fragment=i?i(u.ctx):!1,e.target){if(e.hydrate){const c=bb(e.target);u.fragment&&u.fragment.l(c),c.forEach(k)}else u.fragment&&u.fragment.c();e.intro&&A(n.$$.fragment),H(n,e.target,e.anchor,e.customElement),Zm()}il(a)}class Ee{$destroy(){j(this,1),this.$destroy=se}$on(e,t){const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}$set(e){this.$$set&&!mb(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function en(n){if(!n)throw Error("Parameter args is required");if(!n.component==!n.asyncComponent)throw Error("One and only one of component and asyncComponent is required");if(n.component&&(n.asyncComponent=()=>Promise.resolve(n.component)),typeof n.asyncComponent!="function")throw Error("Parameter asyncComponent must be a function");if(n.conditions){Array.isArray(n.conditions)||(n.conditions=[n.conditions]);for(let t=0;t{i.delete(u),i.size===0&&(t(),t=null)}}return{set:s,update:l,subscribe:o}}function xm(n,e,t){const i=!Array.isArray(n),s=i?[n]:n,l=e.length<2;return Qm(t,o=>{let r=!1;const a=[];let u=0,f=se;const c=()=>{if(u)return;f();const h=e(i?a[0]:a,o);l?o(h):f=Jn(h)?h:se},d=s.map((h,g)=>jm(h,v=>{a[g]=v,u&=~(1<{u|=1<{j(f,1)}),Pe()}l?(e=new l(o()),e.$on("routeEvent",r[7]),q(e.$$.fragment),A(e.$$.fragment,1),H(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&L(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&j(e,r)}}}function Eb(n){let e,t,i;const s=[{params:n[1]},n[2]];var l=n[0];function o(r){let a={};for(let u=0;u{j(f,1)}),Pe()}l?(e=new l(o()),e.$on("routeEvent",r[6]),q(e.$$.fragment),A(e.$$.fragment,1),H(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&L(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&j(e,r)}}}function Ab(n){let e,t,i,s;const l=[Eb,Ob],o=[];function r(a,u){return a[1]?0:1}return e=r(n),t=o[e]=l[e](n),{c(){t.c(),i=Ue()},m(a,u){o[e].m(a,u),w(a,i,u),s=!0},p(a,[u]){let f=e;e=r(a),e===f?o[e].p(a,u):(Ae(),L(o[f],1,1,()=>{o[f]=null}),Pe(),t=o[e],t?t.p(a,u):(t=o[e]=l[e](a),t.c()),A(t,1),t.m(i.parentNode,i))},i(a){s||(A(t),s=!0)},o(a){L(t),s=!1},d(a){o[e].d(a),a&&k(i)}}}function ru(){const n=window.location.href.indexOf("#/");let e=n>-1?window.location.href.substr(n+1):"/";const t=e.indexOf("?");let i="";return t>-1&&(i=e.substr(t+1),e=e.substr(0,t)),{location:e,querystring:i}}const Vo=Qm(null,function(e){e(ru());const t=()=>{e(ru())};return window.addEventListener("hashchange",t,!1),function(){window.removeEventListener("hashchange",t,!1)}});xm(Vo,n=>n.location);const zo=xm(Vo,n=>n.querystring),au=Gn(void 0);async function Ci(n){if(!n||n.length<1||n.charAt(0)!="/"&&n.indexOf("#/")!==0)throw Error("Invalid parameter location");await Zn();const e=(n.charAt(0)=="#"?"":"#")+n;try{const t={...history.state};delete t.__svelte_spa_router_scrollX,delete t.__svelte_spa_router_scrollY,window.history.replaceState(t,void 0,e)}catch{console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}function gn(n,e){if(e=fu(e),!n||!n.tagName||n.tagName.toLowerCase()!="a")throw Error('Action "link" can only be used with tags');return uu(n,e),{update(t){t=fu(t),uu(n,t)}}}function Pb(n){n?window.scrollTo(n.__svelte_spa_router_scrollX,n.__svelte_spa_router_scrollY):window.scrollTo(0,0)}function uu(n,e){let t=e.href||n.getAttribute("href");if(t&&t.charAt(0)=="/")t="#"+t;else if(!t||t.length<2||t.slice(0,2)!="#/")throw Error('Invalid value for "href" attribute: '+t);n.setAttribute("href",t),n.addEventListener("click",i=>{i.preventDefault(),e.disabled||Lb(i.currentTarget.getAttribute("href"))})}function fu(n){return n&&typeof n=="string"?{href:n}:n||{}}function Lb(n){history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},void 0),window.location.hash=n}function Ib(n,e,t){let{routes:i={}}=e,{prefix:s=""}=e,{restoreScrollState:l=!1}=e;class o{constructor(T,M){if(!M||typeof M!="function"&&(typeof M!="object"||M._sveltesparouter!==!0))throw Error("Invalid component object");if(!T||typeof T=="string"&&(T.length<1||T.charAt(0)!="/"&&T.charAt(0)!="*")||typeof T=="object"&&!(T instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:O,keys:E}=eg(T);this.path=T,typeof M=="object"&&M._sveltesparouter===!0?(this.component=M.component,this.conditions=M.conditions||[],this.userData=M.userData,this.props=M.props||{}):(this.component=()=>Promise.resolve(M),this.conditions=[],this.props={}),this._pattern=O,this._keys=E}match(T){if(s){if(typeof s=="string")if(T.startsWith(s))T=T.substr(s.length)||"/";else return null;else if(s instanceof RegExp){const P=T.match(s);if(P&&P[0])T=T.substr(P[0].length)||"/";else return null}}const M=this._pattern.exec(T);if(M===null)return null;if(this._keys===!1)return M;const O={};let E=0;for(;E{r.push(new o(T,S))}):Object.keys(i).forEach(S=>{r.push(new o(S,i[S]))});let a=null,u=null,f={};const c=Qt();async function d(S,T){await Zn(),c(S,T)}let h=null,g=null;l&&(g=S=>{S.state&&(S.state.__svelte_spa_router_scrollY||S.state.__svelte_spa_router_scrollX)?h=S.state:h=null},window.addEventListener("popstate",g),Sb(()=>{Pb(h)}));let v=null,b=null;const y=Vo.subscribe(async S=>{v=S;let T=0;for(;T{au.set(u)});return}t(0,a=null),b=null,au.set(void 0)});Cb(()=>{y(),g&&window.removeEventListener("popstate",g)});function $(S){xe.call(this,n,S)}function C(S){xe.call(this,n,S)}return n.$$set=S=>{"routes"in S&&t(3,i=S.routes),"prefix"in S&&t(4,s=S.prefix),"restoreScrollState"in S&&t(5,l=S.restoreScrollState)},n.$$.update=()=>{n.$$.dirty&32&&(history.scrollRestoration=l?"manual":"auto")},[a,u,f,i,s,l,$,C]}class Nb extends Ee{constructor(e){super(),Oe(this,e,Ib,Ab,De,{routes:3,prefix:4,restoreScrollState:5})}}const co=[];let tg;function ng(n){const e=n.pattern.test(tg);cu(n,n.className,e),cu(n,n.inactiveClassName,!e)}function cu(n,e,t){(e||"").split(" ").forEach(i=>{!i||(n.node.classList.remove(i),t&&n.node.classList.add(i))})}Vo.subscribe(n=>{tg=n.location+(n.querystring?"?"+n.querystring:""),co.map(ng)});function qn(n,e){if(e&&(typeof e=="string"||typeof e=="object"&&e instanceof RegExp)?e={path:e}:e=e||{},!e.path&&n.hasAttribute("href")&&(e.path=n.getAttribute("href"),e.path&&e.path.length>1&&e.path.charAt(0)=="#"&&(e.path=e.path.substring(1))),e.className||(e.className="active"),!e.path||typeof e.path=="string"&&(e.path.length<1||e.path.charAt(0)!="/"&&e.path.charAt(0)!="*"))throw Error('Invalid value for "path" argument');const{pattern:t}=typeof e.path=="string"?eg(e.path):{pattern:e.path},i={node:n,className:e.className,inactiveClassName:e.inactiveClassName,pattern:t};return co.push(i),ng(i),{destroy(){co.splice(co.indexOf(i),1)}}}const Fb="modulepreload",Rb=function(n,e){return new URL(n,e).href},du={},Pi=function(e,t,i){return!t||t.length===0?e():Promise.all(t.map(s=>{if(s=Rb(s,i),s in du)return;du[s]=!0;const l=s.endsWith(".css"),o=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${o}`))return;const r=document.createElement("link");if(r.rel=l?"stylesheet":Fb,l||(r.as="script",r.crossOrigin=""),r.href=s,document.head.appendChild(r),l)return new Promise((a,u)=>{r.addEventListener("load",a),r.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e())};var qr=function(n,e){return qr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])},qr(n,e)};function ln(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}qr(n,e),n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Vr=function(){return Vr=Object.assign||function(n){for(var e,t=1,i=arguments.length;t0&&s[s.length-1])||f[0]!==6&&f[0]!==2)){o=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]0&&(!i.exp||i.exp-t>Date.now()/1e3))}(this.token)},enumerable:!1,configurable:!0}),n.prototype.save=function(e,t){this.baseToken=e||"",this.baseModel=t!==null&&typeof t=="object"?(t==null?void 0:t.verified)!=="undefined"?new Ts(t):new as(t):null,this.triggerChange()},n.prototype.clear=function(){this.baseToken="",this.baseModel=null,this.triggerChange()},n.prototype.loadFromCookie=function(e,t){t===void 0&&(t="pb_auth");var i=function(l,o){var r={};if(typeof l!="string")return r;for(var a=Object.assign({},o||{}).decode||Hb,u=0;u4096&&(a.model={id:(s=a==null?void 0:a.model)===null||s===void 0?void 0:s.id,email:(l=a==null?void 0:a.model)===null||l===void 0?void 0:l.email},this.model instanceof Ts&&(a.model.verified=this.model.verified),u=hu(t,JSON.stringify(a),e)),u},n.prototype.onChange=function(e){var t=this;return this._onChangeCallbacks.push(e),function(){for(var i=t._onChangeCallbacks.length-1;i>=0;i--)if(t._onChangeCallbacks[i]==e)return delete t._onChangeCallbacks[i],void t._onChangeCallbacks.splice(i,1)}},n.prototype.triggerChange=function(){for(var e=0,t=this._onChangeCallbacks;e0?n:1,this.perPage=e>=0?e:0,this.totalItems=t>=0?t:0,this.totalPages=i>=0?i:0,this.items=s||[]},og=function(n){function e(){return n!==null&&n.apply(this,arguments)||this}return ln(e,n),e.prototype._getFullList=function(t,i,s){var l=this;i===void 0&&(i=100),s===void 0&&(s={});var o=[],r=function(a){return is(l,void 0,void 0,function(){return ss(this,function(u){return[2,this._getList(t,a,i,s).then(function(f){var c=f,d=c.items,h=c.totalItems;return o=o.concat(d),d.length&&h>o.length?r(a+1):o})]})})};return r(1)},e.prototype._getList=function(t,i,s,l){var o=this;return i===void 0&&(i=1),s===void 0&&(s=30),l===void 0&&(l={}),l=Object.assign({page:i,perPage:s},l),this.client.send(t,{method:"GET",params:l}).then(function(r){var a=[];if(r!=null&&r.items){r.items=r.items||[];for(var u=0,f=r.items;u=400)throw new pu({url:S.url,status:S.status,data:T});return[2,T]}})})}).catch(function(S){throw new pu(S)})]})})},n.prototype.buildUrl=function(e){var t=this.baseUrl+(this.baseUrl.endsWith("/")?"":"/");return e&&(t+=e.startsWith("/")?e.substring(1):e),t},n.prototype.serializeQueryParams=function(e){var t=[];for(var i in e)if(e[i]!==null){var s=e[i],l=encodeURIComponent(i);if(Array.isArray(s))for(var o=0,r=s;o"u"}function ls(n){return typeof n=="number"}function Uo(n){return typeof n=="number"&&n%1===0}function e1(n){return typeof n=="string"}function t1(n){return Object.prototype.toString.call(n)==="[object Date]"}function Tg(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function n1(n){return Array.isArray(n)?n:[n]}function gu(n,e,t){if(n.length!==0)return n.reduce((i,s)=>{const l=[e(s),s];return i&&t(i[0],l[0])===i[0]?i:l},null)[1]}function i1(n,e){return e.reduce((t,i)=>(t[i]=n[i],t),{})}function Ds(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function ki(n,e,t){return Uo(n)&&n>=e&&n<=t}function s1(n,e){return n-e*Math.floor(n/e)}function Jt(n,e=2){const t=n<0;let i;return t?i="-"+(""+-n).padStart(e,"0"):i=(""+n).padStart(e,"0"),i}function Ai(n){if(!(bt(n)||n===null||n===""))return parseInt(n,10)}function Wi(n){if(!(bt(n)||n===null||n===""))return parseFloat(n)}function ka(n){if(!(bt(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function wa(n,e,t=!1){const i=10**e;return(t?Math.trunc:Math.round)(n*i)/i}function Cl(n){return n%4===0&&(n%100!==0||n%400===0)}function sl(n){return Cl(n)?366:365}function vo(n,e){const t=s1(e-1,12)+1,i=n+(e-t)/12;return t===2?Cl(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function $a(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(e.getUTCFullYear()-1900)),+e}function yo(n){const e=(n+Math.floor(n/4)-Math.floor(n/100)+Math.floor(n/400))%7,t=n-1,i=(t+Math.floor(t/4)-Math.floor(t/100)+Math.floor(t/400))%7;return e===4||i===3?53:52}function Ur(n){return n>99?n:n>60?1900+n:2e3+n}function Dg(n,e,t,i=null){const s=new Date(n),l={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};i&&(l.timeZone=i);const o={timeZoneName:e,...l},r=new Intl.DateTimeFormat(t,o).formatToParts(s).find(a=>a.type.toLowerCase()==="timezonename");return r?r.value:null}function Wo(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const i=parseInt(e,10)||0,s=t<0||Object.is(t,-0)?-i:i;return t*60+s}function Og(n){const e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new zn(`Invalid unit value ${n}`);return e}function ko(n,e){const t={};for(const i in n)if(Ds(n,i)){const s=n[i];if(s==null)continue;t[e(i)]=Og(s)}return t}function ll(n,e){const t=Math.trunc(Math.abs(n/60)),i=Math.trunc(Math.abs(n%60)),s=n>=0?"+":"-";switch(e){case"short":return`${s}${Jt(t,2)}:${Jt(i,2)}`;case"narrow":return`${s}${t}${i>0?`:${i}`:""}`;case"techie":return`${s}${Jt(t,2)}${Jt(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Yo(n){return i1(n,["hour","minute","second","millisecond"])}const Eg=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/,l1=["January","February","March","April","May","June","July","August","September","October","November","December"],Ag=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o1=["J","F","M","A","M","J","J","A","S","O","N","D"];function Pg(n){switch(n){case"narrow":return[...o1];case"short":return[...Ag];case"long":return[...l1];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const Lg=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Ig=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],r1=["M","T","W","T","F","S","S"];function Ng(n){switch(n){case"narrow":return[...r1];case"short":return[...Ig];case"long":return[...Lg];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const Fg=["AM","PM"],a1=["Before Christ","Anno Domini"],u1=["BC","AD"],f1=["B","A"];function Rg(n){switch(n){case"narrow":return[...f1];case"short":return[...u1];case"long":return[...a1];default:return null}}function c1(n){return Fg[n.hour<12?0:1]}function d1(n,e){return Ng(e)[n.weekday-1]}function p1(n,e){return Pg(e)[n.month-1]}function h1(n,e){return Rg(e)[n.year<0?0:1]}function m1(n,e,t="always",i=!1){const s={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},l=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&l){const c=n==="days";switch(e){case 1:return c?"tomorrow":`next ${s[n][0]}`;case-1:return c?"yesterday":`last ${s[n][0]}`;case 0:return c?"today":`this ${s[n][0]}`}}const o=Object.is(e,-0)||e<0,r=Math.abs(e),a=r===1,u=s[n],f=i?a?u[1]:u[2]||u[1]:a?s[n][0]:n;return o?`${r} ${f} ago`:`in ${r} ${f}`}function _u(n,e){let t="";for(const i of n)i.literal?t+=i.val:t+=e(i.val);return t}const g1={D:Br,DD:ag,DDD:ug,DDDD:fg,t:cg,tt:dg,ttt:pg,tttt:hg,T:mg,TT:gg,TTT:_g,TTTT:bg,f:vg,ff:kg,fff:$g,ffff:Cg,F:yg,FF:wg,FFF:Sg,FFFF:Mg};class wn{static create(e,t={}){return new wn(e,t)}static parseFormat(e){let t=null,i="",s=!1;const l=[];for(let o=0;o0&&l.push({literal:s,val:i}),t=null,i="",s=!s):s||r===t?i+=r:(i.length>0&&l.push({literal:!1,val:i}),i=r,t=r)}return i.length>0&&l.push({literal:s,val:i}),l}static macroTokenToFormatOpts(e){return g1[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}formatDateTime(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t}).format()}formatDateTimeParts(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t}).formatToParts()}resolvedOptions(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t}).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return Jt(e,t);const i={...this.opts};return t>0&&(i.padTo=t),this.loc.numberFormatter(i).format(e)}formatDateTimeFromString(e,t){const i=this.loc.listingMode()==="en",s=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",l=(h,g)=>this.loc.extract(e,h,g),o=h=>e.isOffsetFixed&&e.offset===0&&h.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,h.format):"",r=()=>i?c1(e):l({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(h,g)=>i?p1(e,h):l(g?{month:h}:{month:h,day:"numeric"},"month"),u=(h,g)=>i?d1(e,h):l(g?{weekday:h}:{weekday:h,month:"long",day:"numeric"},"weekday"),f=h=>{const g=wn.macroTokenToFormatOpts(h);return g?this.formatWithSystemDefault(e,g):h},c=h=>i?h1(e,h):l({era:h},"era"),d=h=>{switch(h){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return r();case"d":return s?l({day:"numeric"},"day"):this.num(e.day);case"dd":return s?l({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return u("short",!0);case"cccc":return u("long",!0);case"ccccc":return u("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return u("short",!1);case"EEEE":return u("long",!1);case"EEEEE":return u("narrow",!1);case"L":return s?l({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return s?l({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return a("short",!0);case"LLLL":return a("long",!0);case"LLLLL":return a("narrow",!0);case"M":return s?l({month:"numeric"},"month"):this.num(e.month);case"MM":return s?l({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return a("short",!1);case"MMMM":return a("long",!1);case"MMMMM":return a("narrow",!1);case"y":return s?l({year:"numeric"},"year"):this.num(e.year);case"yy":return s?l({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return s?l({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return s?l({year:"numeric"},"year"):this.num(e.year,6);case"G":return c("short");case"GG":return c("long");case"GGGGG":return c("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return f(h)}};return _u(wn.parseFormat(t),d)}formatDurationFromString(e,t){const i=a=>{switch(a[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},s=a=>u=>{const f=i(u);return f?this.num(a.get(f),u.length):u},l=wn.parseFormat(t),o=l.reduce((a,{literal:u,val:f})=>u?a:a.concat(f),[]),r=e.shiftTo(...o.map(i).filter(a=>a));return _u(l,s(r))}}class xn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}class Ml{get type(){throw new Oi}get name(){throw new Oi}get ianaName(){return this.name}get isUniversal(){throw new Oi}offsetName(e,t){throw new Oi}formatOffset(e,t){throw new Oi}offset(e){throw new Oi}equals(e){throw new Oi}get isValid(){throw new Oi}}let rr=null;class Sa extends Ml{static get instance(){return rr===null&&(rr=new Sa),rr}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:i}){return Dg(e,t,i)}formatOffset(e,t){return ll(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let po={};function _1(n){return po[n]||(po[n]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),po[n]}const b1={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function v1(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,l,o,r,a,u,f]=i;return[o,s,l,r,a,u,f]}function y1(n,e){const t=n.formatToParts(e),i=[];for(let s=0;s=0?g:1e3+g,(d-h)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let ar=null;class _n extends Ml{static get utcInstance(){return ar===null&&(ar=new _n(0)),ar}static instance(e){return e===0?_n.utcInstance:new _n(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new _n(Wo(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${ll(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${ll(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return ll(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class k1 extends Ml{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Li(n,e){if(bt(n)||n===null)return e;if(n instanceof Ml)return n;if(e1(n)){const t=n.toLowerCase();return t==="local"||t==="system"?e:t==="utc"||t==="gmt"?_n.utcInstance:_n.parseSpecifier(t)||$i.create(n)}else return ls(n)?_n.instance(n):typeof n=="object"&&n.offset&&typeof n.offset=="number"?n:new k1(n)}let bu=()=>Date.now(),vu="system",yu=null,ku=null,wu=null,$u;class Xt{static get now(){return bu}static set now(e){bu=e}static set defaultZone(e){vu=e}static get defaultZone(){return Li(vu,Sa.instance)}static get defaultLocale(){return yu}static set defaultLocale(e){yu=e}static get defaultNumberingSystem(){return ku}static set defaultNumberingSystem(e){ku=e}static get defaultOutputCalendar(){return wu}static set defaultOutputCalendar(e){wu=e}static get throwOnInvalid(){return $u}static set throwOnInvalid(e){$u=e}static resetCaches(){Rt.resetCache(),$i.resetCache()}}let Su={};function w1(n,e={}){const t=JSON.stringify([n,e]);let i=Su[t];return i||(i=new Intl.ListFormat(n,e),Su[t]=i),i}let Wr={};function Yr(n,e={}){const t=JSON.stringify([n,e]);let i=Wr[t];return i||(i=new Intl.DateTimeFormat(n,e),Wr[t]=i),i}let Kr={};function $1(n,e={}){const t=JSON.stringify([n,e]);let i=Kr[t];return i||(i=new Intl.NumberFormat(n,e),Kr[t]=i),i}let Jr={};function S1(n,e={}){const{base:t,...i}=e,s=JSON.stringify([n,i]);let l=Jr[s];return l||(l=new Intl.RelativeTimeFormat(n,e),Jr[s]=l),l}let el=null;function C1(){return el||(el=new Intl.DateTimeFormat().resolvedOptions().locale,el)}function M1(n){const e=n.indexOf("-u-");if(e===-1)return[n];{let t;const i=n.substring(0,e);try{t=Yr(n).resolvedOptions()}catch{t=Yr(i).resolvedOptions()}const{numberingSystem:s,calendar:l}=t;return[i,s,l]}}function T1(n,e,t){return(t||e)&&(n+="-u",t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function D1(n){const e=[];for(let t=1;t<=12;t++){const i=Ge.utc(2016,t,1);e.push(n(i))}return e}function O1(n){const e=[];for(let t=1;t<=7;t++){const i=Ge.utc(2016,11,13+t);e.push(n(i))}return e}function Ul(n,e,t,i,s){const l=n.listingMode(t);return l==="error"?null:l==="en"?i(e):s(e)}function E1(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||new Intl.DateTimeFormat(n.intl).resolvedOptions().numberingSystem==="latn"}class A1{constructor(e,t,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:s,floor:l,...o}=i;if(!t||Object.keys(o).length>0){const r={useGrouping:!1,...i};i.padTo>0&&(r.minimumIntegerDigits=i.padTo),this.inf=$1(e,r)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):wa(e,3);return Jt(t,this.padTo)}}}class P1{constructor(e,t,i){this.opts=i;let s;if(e.zone.isUniversal){const o=-1*(e.offset/60),r=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&$i.create(r).valid?(s=r,this.dt=e):(s="UTC",i.timeZoneName?this.dt=e:this.dt=e.offset===0?e:Ge.fromMillis(e.ts+e.offset*60*1e3))}else e.zone.type==="system"?this.dt=e:(this.dt=e,s=e.zone.name);const l={...this.opts};s&&(l.timeZone=s),this.dtf=Yr(t,l)}format(){return this.dtf.format(this.dt.toJSDate())}formatToParts(){return this.dtf.formatToParts(this.dt.toJSDate())}resolvedOptions(){return this.dtf.resolvedOptions()}}class L1{constructor(e,t,i){this.opts={style:"long",...i},!t&&Tg()&&(this.rtf=S1(e,i))}format(e,t){return this.rtf?this.rtf.format(e,t):m1(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}class Rt{static fromOpts(e){return Rt.create(e.locale,e.numberingSystem,e.outputCalendar,e.defaultToEN)}static create(e,t,i,s=!1){const l=e||Xt.defaultLocale,o=l||(s?"en-US":C1()),r=t||Xt.defaultNumberingSystem,a=i||Xt.defaultOutputCalendar;return new Rt(o,r,a,l)}static resetCache(){el=null,Wr={},Kr={},Jr={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:i}={}){return Rt.create(e,t,i)}constructor(e,t,i,s){const[l,o,r]=M1(e);this.locale=l,this.numberingSystem=t||o||null,this.outputCalendar=i||r||null,this.intl=T1(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=E1(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:Rt.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1,i=!0){return Ul(this,e,i,Pg,()=>{const s=t?{month:e,day:"numeric"}:{month:e},l=t?"format":"standalone";return this.monthsCache[l][e]||(this.monthsCache[l][e]=D1(o=>this.extract(o,s,"month"))),this.monthsCache[l][e]})}weekdays(e,t=!1,i=!0){return Ul(this,e,i,Ng,()=>{const s=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},l=t?"format":"standalone";return this.weekdaysCache[l][e]||(this.weekdaysCache[l][e]=O1(o=>this.extract(o,s,"weekday"))),this.weekdaysCache[l][e]})}meridiems(e=!0){return Ul(this,void 0,e,()=>Fg,()=>{if(!this.meridiemCache){const t={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Ge.utc(2016,11,13,9),Ge.utc(2016,11,13,19)].map(i=>this.extract(i,t,"dayperiod"))}return this.meridiemCache})}eras(e,t=!0){return Ul(this,e,t,Rg,()=>{const i={era:e};return this.eraCache[e]||(this.eraCache[e]=[Ge.utc(-40,1,1),Ge.utc(2017,1,1)].map(s=>this.extract(s,i,"era"))),this.eraCache[e]})}extract(e,t,i){const s=this.dtFormatter(e,t),l=s.formatToParts(),o=l.find(r=>r.type.toLowerCase()===i);return o?o.value:null}numberFormatter(e={}){return new A1(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new P1(e,this.intl,t)}relFormatter(e={}){return new L1(this.intl,this.isEnglish(),e)}listFormatter(e={}){return w1(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}function Ns(...n){const e=n.reduce((t,i)=>t+i.source,"");return RegExp(`^${e}$`)}function Fs(...n){return e=>n.reduce(([t,i,s],l)=>{const[o,r,a]=l(e,s);return[{...t,...o},r||i,a]},[{},null,1]).slice(0,2)}function Rs(n,...e){if(n==null)return[null,null];for(const[t,i]of e){const s=t.exec(n);if(s)return i(s)}return[null,null]}function Hg(...n){return(e,t)=>{const i={};let s;for(s=0;sh!==void 0&&(g||h&&f)?-h:h;return[{years:d(Wi(t)),months:d(Wi(i)),weeks:d(Wi(s)),days:d(Wi(l)),hours:d(Wi(o)),minutes:d(Wi(r)),seconds:d(Wi(a),a==="-0"),milliseconds:d(ka(u),c)}]}const Y1={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Ta(n,e,t,i,s,l,o){const r={year:e.length===2?Ur(Ai(e)):Ai(e),month:Ag.indexOf(t)+1,day:Ai(i),hour:Ai(s),minute:Ai(l)};return o&&(r.second=Ai(o)),n&&(r.weekday=n.length>3?Lg.indexOf(n)+1:Ig.indexOf(n)+1),r}const K1=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function J1(n){const[,e,t,i,s,l,o,r,a,u,f,c]=n,d=Ta(e,s,i,t,l,o,r);let h;return a?h=Y1[a]:u?h=0:h=Wo(f,c),[d,new _n(h)]}function Z1(n){return n.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const G1=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,X1=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Q1=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Cu(n){const[,e,t,i,s,l,o,r]=n;return[Ta(e,s,i,t,l,o,r),_n.utcInstance]}function x1(n){const[,e,t,i,s,l,o,r]=n;return[Ta(e,r,t,i,s,l,o),_n.utcInstance]}const e0=Ns(N1,Ma),t0=Ns(F1,Ma),n0=Ns(R1,Ma),i0=Ns(qg),zg=Fs(z1,Hs,Tl,Dl),s0=Fs(H1,Hs,Tl,Dl),l0=Fs(j1,Hs,Tl,Dl),o0=Fs(Hs,Tl,Dl);function r0(n){return Rs(n,[e0,zg],[t0,s0],[n0,l0],[i0,o0])}function a0(n){return Rs(Z1(n),[K1,J1])}function u0(n){return Rs(n,[G1,Cu],[X1,Cu],[Q1,x1])}function f0(n){return Rs(n,[U1,W1])}const c0=Fs(Hs);function d0(n){return Rs(n,[B1,c0])}const p0=Ns(q1,V1),h0=Ns(Vg),m0=Fs(Hs,Tl,Dl);function g0(n){return Rs(n,[p0,zg],[h0,m0])}const _0="Invalid Duration",Bg={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},b0={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...Bg},Fn=146097/400,_s=146097/4800,v0={years:{quarters:4,months:12,weeks:Fn/7,days:Fn,hours:Fn*24,minutes:Fn*24*60,seconds:Fn*24*60*60,milliseconds:Fn*24*60*60*1e3},quarters:{months:3,weeks:Fn/28,days:Fn/4,hours:Fn*24/4,minutes:Fn*24*60/4,seconds:Fn*24*60*60/4,milliseconds:Fn*24*60*60*1e3/4},months:{weeks:_s/7,days:_s,hours:_s*24,minutes:_s*24*60,seconds:_s*24*60*60,milliseconds:_s*24*60*60*1e3},...Bg},Xi=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],y0=Xi.slice(0).reverse();function Yi(n,e,t=!1){const i={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy};return new wt(i)}function k0(n){return n<0?Math.floor(n):Math.ceil(n)}function Ug(n,e,t,i,s){const l=n[s][t],o=e[t]/l,r=Math.sign(o)===Math.sign(i[s]),a=!r&&i[s]!==0&&Math.abs(o)<=1?k0(o):Math.trunc(o);i[s]+=a,e[t]-=a*l}function w0(n,e){y0.reduce((t,i)=>bt(e[i])?t:(t&&Ug(n,e,t,e,i),i),null)}class wt{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;this.values=e.values,this.loc=e.loc||Rt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=t?v0:b0,this.isLuxonDuration=!0}static fromMillis(e,t){return wt.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new zn(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new wt({values:ko(e,wt.normalizeUnit),loc:Rt.fromObject(t),conversionAccuracy:t.conversionAccuracy})}static fromDurationLike(e){if(ls(e))return wt.fromMillis(e);if(wt.isDuration(e))return e;if(typeof e=="object")return wt.fromObject(e);throw new zn(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[i]=f0(e);return i?wt.fromObject(i,t):wt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[i]=d0(e);return i?wt.fromObject(i,t):wt.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new zn("need to specify a reason the Duration is invalid");const i=e instanceof xn?e:new xn(e,t);if(Xt.throwOnInvalid)throw new Xb(i);return new wt({invalid:i})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new rg(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const i={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?wn.create(this.loc,i).formatDurationFromString(this,e):_0}toHuman(e={}){const t=Xi.map(i=>{const s=this.values[i];return bt(s)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(s)}).filter(i=>i);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(t)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=wa(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();if(t<0||t>=864e5)return null;e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e};const i=this.shiftTo("hours","minutes","seconds","milliseconds");let s=e.format==="basic"?"hhmm":"hh:mm";(!e.suppressSeconds||i.seconds!==0||i.milliseconds!==0)&&(s+=e.format==="basic"?"ss":":ss",(!e.suppressMilliseconds||i.milliseconds!==0)&&(s+=".SSS"));let l=i.toFormat(s);return e.includePrefix&&(l="T"+l),l}toJSON(){return this.toISO()}toString(){return this.toISO()}toMillis(){return this.as("milliseconds")}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=wt.fromDurationLike(e),i={};for(const s of Xi)(Ds(t.values,s)||Ds(this.values,s))&&(i[s]=t.get(s)+this.get(s));return Yi(this,{values:i},!0)}minus(e){if(!this.isValid)return this;const t=wt.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const i of Object.keys(this.values))t[i]=Og(e(this.values[i],i));return Yi(this,{values:t},!0)}get(e){return this[wt.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...ko(e,wt.normalizeUnit)};return Yi(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:i}={}){const s=this.loc.clone({locale:e,numberingSystem:t}),l={loc:s};return i&&(l.conversionAccuracy=i),Yi(this,l)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return w0(this.matrix,e),Yi(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>wt.normalizeUnit(o));const t={},i={},s=this.toObject();let l;for(const o of Xi)if(e.indexOf(o)>=0){l=o;let r=0;for(const u in i)r+=this.matrix[u][o]*i[u],i[u]=0;ls(s[o])&&(r+=s[o]);const a=Math.trunc(r);t[o]=a,i[o]=(r*1e3-a*1e3)/1e3;for(const u in s)Xi.indexOf(u)>Xi.indexOf(o)&&Ug(this.matrix,s,u,t,o)}else ls(s[o])&&(i[o]=s[o]);for(const o in i)i[o]!==0&&(t[l]+=o===l?i[o]:i[o]/this.matrix[l][o]);return Yi(this,{values:t},!0).normalize()}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Yi(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(i,s){return i===void 0||i===0?s===void 0||s===0:i===s}for(const i of Xi)if(!t(this.values[i],e.values[i]))return!1;return!0}}const Vs="Invalid Interval";function $0(n,e){return!n||!n.isValid?qt.invalid("missing or invalid start"):!e||!e.isValid?qt.invalid("missing or invalid end"):ee:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?qt.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Us).filter(o=>this.contains(o)).sort(),i=[];let{s}=this,l=0;for(;s+this.e?this.e:o;i.push(qt.fromDateTimes(s,r)),s=r,l+=1}return i}splitBy(e){const t=wt.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:i}=this,s=1,l;const o=[];for(;ia*s));l=+r>+this.e?this.e:r,o.push(qt.fromDateTimes(i,l)),i=l,s+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,i=this.e=i?null:qt.fromDateTimes(t,i)}union(e){if(!this.isValid)return this;const t=this.se.e?this.e:e.e;return qt.fromDateTimes(t,i)}static merge(e){const[t,i]=e.sort((s,l)=>s.s-l.s).reduce(([s,l],o)=>l?l.overlaps(o)||l.abutsStart(o)?[s,l.union(o)]:[s.concat([l]),o]:[s,o],[[],null]);return i&&t.push(i),t}static xor(e){let t=null,i=0;const s=[],l=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...l),r=o.sort((a,u)=>a.time-u.time);for(const a of r)i+=a.type==="s"?1:-1,i===1?t=a.time:(t&&+t!=+a.time&&s.push(qt.fromDateTimes(t,a.time)),t=null);return qt.merge(s)}difference(...e){return qt.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} \u2013 ${this.e.toISO()})`:Vs}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Vs}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Vs}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Vs}toFormat(e,{separator:t=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:Vs}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):wt.invalid(this.invalidReason)}mapEndpoints(e){return qt.fromDateTimes(e(this.s),e(this.e))}}class Wl{static hasDST(e=Xt.defaultZone){const t=Ge.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return $i.isValidZone(e)}static normalizeZone(e){return Li(e,Xt.defaultZone)}static months(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null,outputCalendar:l="gregory"}={}){return(s||Rt.create(t,i,l)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null,outputCalendar:l="gregory"}={}){return(s||Rt.create(t,i,l)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null}={}){return(s||Rt.create(t,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:s=null}={}){return(s||Rt.create(t,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Rt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return Rt.create(t,null,"gregory").eras(e)}static features(){return{relative:Tg()}}}function Mu(n,e){const t=s=>s.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=t(e)-t(n);return Math.floor(wt.fromMillis(i).as("days"))}function S0(n,e,t){const i=[["years",(r,a)=>a.year-r.year],["quarters",(r,a)=>a.quarter-r.quarter],["months",(r,a)=>a.month-r.month+(a.year-r.year)*12],["weeks",(r,a)=>{const u=Mu(r,a);return(u-u%7)/7}],["days",Mu]],s={};let l,o;for(const[r,a]of i)if(t.indexOf(r)>=0){l=r;let u=a(n,e);o=n.plus({[r]:u}),o>e?(n=n.plus({[r]:u-1}),u-=1):n=o,s[r]=u}return[n,s,o,l]}function C0(n,e,t,i){let[s,l,o,r]=S0(n,e,t);const a=e-s,u=t.filter(c=>["hours","minutes","seconds","milliseconds"].indexOf(c)>=0);u.length===0&&(o0?wt.fromMillis(a,i).shiftTo(...u).plus(f):f}const Da={arab:"[\u0660-\u0669]",arabext:"[\u06F0-\u06F9]",bali:"[\u1B50-\u1B59]",beng:"[\u09E6-\u09EF]",deva:"[\u0966-\u096F]",fullwide:"[\uFF10-\uFF19]",gujr:"[\u0AE6-\u0AEF]",hanidec:"[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",khmr:"[\u17E0-\u17E9]",knda:"[\u0CE6-\u0CEF]",laoo:"[\u0ED0-\u0ED9]",limb:"[\u1946-\u194F]",mlym:"[\u0D66-\u0D6F]",mong:"[\u1810-\u1819]",mymr:"[\u1040-\u1049]",orya:"[\u0B66-\u0B6F]",tamldec:"[\u0BE6-\u0BEF]",telu:"[\u0C66-\u0C6F]",thai:"[\u0E50-\u0E59]",tibt:"[\u0F20-\u0F29]",latn:"\\d"},Tu={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},M0=Da.hanidec.replace(/[\[|\]]/g,"").split("");function T0(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t=l&&i<=o&&(e+=i-l)}}return parseInt(e,10)}else return e}function Xn({numberingSystem:n},e=""){return new RegExp(`${Da[n||"latn"]}${e}`)}const D0="missing Intl.DateTimeFormat.formatToParts support";function $t(n,e=t=>t){return{regex:n,deser:([t])=>e(T0(t))}}const O0=String.fromCharCode(160),Wg=`[ ${O0}]`,Yg=new RegExp(Wg,"g");function E0(n){return n.replace(/\./g,"\\.?").replace(Yg,Wg)}function Du(n){return n.replace(/\./g,"").replace(Yg," ").toLowerCase()}function Qn(n,e){return n===null?null:{regex:RegExp(n.map(E0).join("|")),deser:([t])=>n.findIndex(i=>Du(t)===Du(i))+e}}function Ou(n,e){return{regex:n,deser:([,t,i])=>Wo(t,i),groups:e}}function ur(n){return{regex:n,deser:([e])=>e}}function A0(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function P0(n,e){const t=Xn(e),i=Xn(e,"{2}"),s=Xn(e,"{3}"),l=Xn(e,"{4}"),o=Xn(e,"{6}"),r=Xn(e,"{1,2}"),a=Xn(e,"{1,3}"),u=Xn(e,"{1,6}"),f=Xn(e,"{1,9}"),c=Xn(e,"{2,4}"),d=Xn(e,"{4,6}"),h=b=>({regex:RegExp(A0(b.val)),deser:([y])=>y,literal:!0}),v=(b=>{if(n.literal)return h(b);switch(b.val){case"G":return Qn(e.eras("short",!1),0);case"GG":return Qn(e.eras("long",!1),0);case"y":return $t(u);case"yy":return $t(c,Ur);case"yyyy":return $t(l);case"yyyyy":return $t(d);case"yyyyyy":return $t(o);case"M":return $t(r);case"MM":return $t(i);case"MMM":return Qn(e.months("short",!0,!1),1);case"MMMM":return Qn(e.months("long",!0,!1),1);case"L":return $t(r);case"LL":return $t(i);case"LLL":return Qn(e.months("short",!1,!1),1);case"LLLL":return Qn(e.months("long",!1,!1),1);case"d":return $t(r);case"dd":return $t(i);case"o":return $t(a);case"ooo":return $t(s);case"HH":return $t(i);case"H":return $t(r);case"hh":return $t(i);case"h":return $t(r);case"mm":return $t(i);case"m":return $t(r);case"q":return $t(r);case"qq":return $t(i);case"s":return $t(r);case"ss":return $t(i);case"S":return $t(a);case"SSS":return $t(s);case"u":return ur(f);case"uu":return ur(r);case"uuu":return $t(t);case"a":return Qn(e.meridiems(),0);case"kkkk":return $t(l);case"kk":return $t(c,Ur);case"W":return $t(r);case"WW":return $t(i);case"E":case"c":return $t(t);case"EEE":return Qn(e.weekdays("short",!1,!1),1);case"EEEE":return Qn(e.weekdays("long",!1,!1),1);case"ccc":return Qn(e.weekdays("short",!0,!1),1);case"cccc":return Qn(e.weekdays("long",!0,!1),1);case"Z":case"ZZ":return Ou(new RegExp(`([+-]${r.source})(?::(${i.source}))?`),2);case"ZZZ":return Ou(new RegExp(`([+-]${r.source})(${i.source})?`),2);case"z":return ur(/[a-z_+-/]{1,256}?/i);default:return h(b)}})(n)||{invalidReason:D0};return v.token=n,v}const L0={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour:{numeric:"h","2-digit":"hh"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"}};function I0(n,e,t){const{type:i,value:s}=n;if(i==="literal")return{literal:!0,val:s};const l=t[i];let o=L0[i];if(typeof o=="object"&&(o=o[l]),o)return{literal:!1,val:o}}function N0(n){return[`^${n.map(t=>t.regex).reduce((t,i)=>`${t}(${i.source})`,"")}$`,n]}function F0(n,e,t){const i=n.match(e);if(i){const s={};let l=1;for(const o in t)if(Ds(t,o)){const r=t[o],a=r.groups?r.groups+1:1;!r.literal&&r.token&&(s[r.token.val[0]]=r.deser(i.slice(l,l+a))),l+=a}return[i,s]}else return[i,{}]}function R0(n){const e=l=>{switch(l){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,i;return bt(n.z)||(t=$i.create(n.z)),bt(n.Z)||(t||(t=new _n(n.Z)),i=n.Z),bt(n.q)||(n.M=(n.q-1)*3+1),bt(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),bt(n.u)||(n.S=ka(n.u)),[Object.keys(n).reduce((l,o)=>{const r=e(o);return r&&(l[r]=n[o]),l},{}),t,i]}let fr=null;function H0(){return fr||(fr=Ge.fromMillis(1555555555555)),fr}function j0(n,e){if(n.literal)return n;const t=wn.macroTokenToFormatOpts(n.val);if(!t)return n;const l=wn.create(e,t).formatDateTimeParts(H0()).map(o=>I0(o,e,t));return l.includes(void 0)?n:l}function q0(n,e){return Array.prototype.concat(...n.map(t=>j0(t,e)))}function Kg(n,e,t){const i=q0(wn.parseFormat(t),n),s=i.map(o=>P0(o,n)),l=s.find(o=>o.invalidReason);if(l)return{input:e,tokens:i,invalidReason:l.invalidReason};{const[o,r]=N0(s),a=RegExp(o,"i"),[u,f]=F0(e,a,r),[c,d,h]=f?R0(f):[null,null,void 0];if(Ds(f,"a")&&Ds(f,"H"))throw new xs("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:i,regex:a,rawMatches:u,matches:f,result:c,zone:d,specificOffset:h}}}function V0(n,e,t){const{result:i,zone:s,specificOffset:l,invalidReason:o}=Kg(n,e,t);return[i,s,l,o]}const Jg=[0,31,59,90,120,151,181,212,243,273,304,334],Zg=[0,31,60,91,121,152,182,213,244,274,305,335];function Un(n,e){return new xn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function Gg(n,e,t){const i=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&i.setUTCFullYear(i.getUTCFullYear()-1900);const s=i.getUTCDay();return s===0?7:s}function Xg(n,e,t){return t+(Cl(n)?Zg:Jg)[e-1]}function Qg(n,e){const t=Cl(n)?Zg:Jg,i=t.findIndex(l=>lyo(e)?(r=e+1,o=1):r=e,{weekYear:r,weekNumber:o,weekday:l,...Yo(n)}}function Eu(n){const{weekYear:e,weekNumber:t,weekday:i}=n,s=Gg(e,1,4),l=sl(e);let o=t*7+i-s-3,r;o<1?(r=e-1,o+=sl(r)):o>l?(r=e+1,o-=sl(e)):r=e;const{month:a,day:u}=Qg(r,o);return{year:r,month:a,day:u,...Yo(n)}}function cr(n){const{year:e,month:t,day:i}=n,s=Xg(e,t,i);return{year:e,ordinal:s,...Yo(n)}}function Au(n){const{year:e,ordinal:t}=n,{month:i,day:s}=Qg(e,t);return{year:e,month:i,day:s,...Yo(n)}}function z0(n){const e=Uo(n.weekYear),t=ki(n.weekNumber,1,yo(n.weekYear)),i=ki(n.weekday,1,7);return e?t?i?!1:Un("weekday",n.weekday):Un("week",n.week):Un("weekYear",n.weekYear)}function B0(n){const e=Uo(n.year),t=ki(n.ordinal,1,sl(n.year));return e?t?!1:Un("ordinal",n.ordinal):Un("year",n.year)}function xg(n){const e=Uo(n.year),t=ki(n.month,1,12),i=ki(n.day,1,vo(n.year,n.month));return e?t?i?!1:Un("day",n.day):Un("month",n.month):Un("year",n.year)}function e_(n){const{hour:e,minute:t,second:i,millisecond:s}=n,l=ki(e,0,23)||e===24&&t===0&&i===0&&s===0,o=ki(t,0,59),r=ki(i,0,59),a=ki(s,0,999);return l?o?r?a?!1:Un("millisecond",s):Un("second",i):Un("minute",t):Un("hour",e)}const dr="Invalid DateTime",Pu=864e13;function Yl(n){return new xn("unsupported zone",`the zone "${n.name}" is not supported`)}function pr(n){return n.weekData===null&&(n.weekData=Zr(n.c)),n.weekData}function zs(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new Ge({...t,...e,old:t})}function t_(n,e,t){let i=n-e*60*1e3;const s=t.offset(i);if(e===s)return[i,e];i-=(s-e)*60*1e3;const l=t.offset(i);return s===l?[i,s]:[n-Math.min(s,l)*60*1e3,Math.max(s,l)]}function Lu(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function ho(n,e,t){return t_($a(n),e,t)}function Iu(n,e){const t=n.o,i=n.c.year+Math.trunc(e.years),s=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,l={...n.c,year:i,month:s,day:Math.min(n.c.day,vo(i,s))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=wt.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),r=$a(l);let[a,u]=t_(r,t,n.zone);return o!==0&&(a+=o,u=n.zone.offset(a)),{ts:a,o:u}}function Bs(n,e,t,i,s,l){const{setZone:o,zone:r}=t;if(n&&Object.keys(n).length!==0){const a=e||r,u=Ge.fromObject(n,{...t,zone:a,specificOffset:l});return o?u:u.setZone(r)}else return Ge.invalid(new xn("unparsable",`the input "${s}" can't be parsed as ${i}`))}function Kl(n,e,t=!0){return n.isValid?wn.create(Rt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function hr(n,e){const t=n.c.year>9999||n.c.year<0;let i="";return t&&n.c.year>=0&&(i+="+"),i+=Jt(n.c.year,t?6:4),e?(i+="-",i+=Jt(n.c.month),i+="-",i+=Jt(n.c.day)):(i+=Jt(n.c.month),i+=Jt(n.c.day)),i}function Nu(n,e,t,i,s,l){let o=Jt(n.c.hour);return e?(o+=":",o+=Jt(n.c.minute),(n.c.second!==0||!t)&&(o+=":")):o+=Jt(n.c.minute),(n.c.second!==0||!t)&&(o+=Jt(n.c.second),(n.c.millisecond!==0||!i)&&(o+=".",o+=Jt(n.c.millisecond,3))),s&&(n.isOffsetFixed&&n.offset===0&&!l?o+="Z":n.o<0?(o+="-",o+=Jt(Math.trunc(-n.o/60)),o+=":",o+=Jt(Math.trunc(-n.o%60))):(o+="+",o+=Jt(Math.trunc(n.o/60)),o+=":",o+=Jt(Math.trunc(n.o%60)))),l&&(o+="["+n.zone.ianaName+"]"),o}const n_={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},U0={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},W0={ordinal:1,hour:0,minute:0,second:0,millisecond:0},i_=["year","month","day","hour","minute","second","millisecond"],Y0=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],K0=["year","ordinal","hour","minute","second","millisecond"];function Fu(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new rg(n);return e}function Ru(n,e){const t=Li(e.zone,Xt.defaultZone),i=Rt.fromObject(e),s=Xt.now();let l,o;if(bt(n.year))l=s;else{for(const u of i_)bt(n[u])&&(n[u]=n_[u]);const r=xg(n)||e_(n);if(r)return Ge.invalid(r);const a=t.offset(s);[l,o]=ho(n,a,t)}return new Ge({ts:l,zone:t,loc:i,o})}function Hu(n,e,t){const i=bt(t.round)?!0:t.round,s=(o,r)=>(o=wa(o,i||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(o,r)),l=o=>t.calendary?e.hasSame(n,o)?0:e.startOf(o).diff(n.startOf(o),o).get(o):e.diff(n,o).get(o);if(t.unit)return s(l(t.unit),t.unit);for(const o of t.units){const r=l(o);if(Math.abs(r)>=1)return s(r,o)}return s(n>e?-0:0,t.units[t.units.length-1])}function ju(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}class Ge{constructor(e){const t=e.zone||Xt.defaultZone;let i=e.invalid||(Number.isNaN(e.ts)?new xn("invalid input"):null)||(t.isValid?null:Yl(t));this.ts=bt(e.ts)?Xt.now():e.ts;let s=null,l=null;if(!i)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[s,l]=[e.old.c,e.old.o];else{const r=t.offset(this.ts);s=Lu(this.ts,r),i=Number.isNaN(s.year)?new xn("invalid input"):null,s=i?null:s,l=i?null:r}this._zone=t,this.loc=e.loc||Rt.create(),this.invalid=i,this.weekData=null,this.c=s,this.o=l,this.isLuxonDateTime=!0}static now(){return new Ge({})}static local(){const[e,t]=ju(arguments),[i,s,l,o,r,a,u]=t;return Ru({year:i,month:s,day:l,hour:o,minute:r,second:a,millisecond:u},e)}static utc(){const[e,t]=ju(arguments),[i,s,l,o,r,a,u]=t;return e.zone=_n.utcInstance,Ru({year:i,month:s,day:l,hour:o,minute:r,second:a,millisecond:u},e)}static fromJSDate(e,t={}){const i=t1(e)?e.valueOf():NaN;if(Number.isNaN(i))return Ge.invalid("invalid input");const s=Li(t.zone,Xt.defaultZone);return s.isValid?new Ge({ts:i,zone:s,loc:Rt.fromObject(t)}):Ge.invalid(Yl(s))}static fromMillis(e,t={}){if(ls(e))return e<-Pu||e>Pu?Ge.invalid("Timestamp out of range"):new Ge({ts:e,zone:Li(t.zone,Xt.defaultZone),loc:Rt.fromObject(t)});throw new zn(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(ls(e))return new Ge({ts:e*1e3,zone:Li(t.zone,Xt.defaultZone),loc:Rt.fromObject(t)});throw new zn("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const i=Li(t.zone,Xt.defaultZone);if(!i.isValid)return Ge.invalid(Yl(i));const s=Xt.now(),l=bt(t.specificOffset)?i.offset(s):t.specificOffset,o=ko(e,Fu),r=!bt(o.ordinal),a=!bt(o.year),u=!bt(o.month)||!bt(o.day),f=a||u,c=o.weekYear||o.weekNumber,d=Rt.fromObject(t);if((f||r)&&c)throw new xs("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&r)throw new xs("Can't mix ordinal dates with month/day");const h=c||o.weekday&&!f;let g,v,b=Lu(s,l);h?(g=Y0,v=U0,b=Zr(b)):r?(g=K0,v=W0,b=cr(b)):(g=i_,v=n_);let y=!1;for(const E of g){const P=o[E];bt(P)?y?o[E]=v[E]:o[E]=b[E]:y=!0}const $=h?z0(o):r?B0(o):xg(o),C=$||e_(o);if(C)return Ge.invalid(C);const S=h?Eu(o):r?Au(o):o,[T,M]=ho(S,l,i),O=new Ge({ts:T,zone:i,o:M,loc:d});return o.weekday&&f&&e.weekday!==O.weekday?Ge.invalid("mismatched weekday",`you can't specify both a weekday of ${o.weekday} and a date of ${O.toISO()}`):O}static fromISO(e,t={}){const[i,s]=r0(e);return Bs(i,s,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[i,s]=a0(e);return Bs(i,s,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[i,s]=u0(e);return Bs(i,s,t,"HTTP",t)}static fromFormat(e,t,i={}){if(bt(e)||bt(t))throw new zn("fromFormat requires an input string and a format");const{locale:s=null,numberingSystem:l=null}=i,o=Rt.fromOpts({locale:s,numberingSystem:l,defaultToEN:!0}),[r,a,u,f]=V0(o,e,t);return f?Ge.invalid(f):Bs(r,a,i,`format ${t}`,e,u)}static fromString(e,t,i={}){return Ge.fromFormat(e,t,i)}static fromSQL(e,t={}){const[i,s]=g0(e);return Bs(i,s,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new zn("need to specify a reason the DateTime is invalid");const i=e instanceof xn?e:new xn(e,t);if(Xt.throwOnInvalid)throw new Zb(i);return new Ge({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?pr(this).weekYear:NaN}get weekNumber(){return this.isValid?pr(this).weekNumber:NaN}get weekday(){return this.isValid?pr(this).weekday:NaN}get ordinal(){return this.isValid?cr(this.c).ordinal:NaN}get monthShort(){return this.isValid?Wl.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Wl.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Wl.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Wl.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}get isInLeapYear(){return Cl(this.year)}get daysInMonth(){return vo(this.year,this.month)}get daysInYear(){return this.isValid?sl(this.year):NaN}get weeksInWeekYear(){return this.isValid?yo(this.weekYear):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:i,calendar:s}=wn.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:i,outputCalendar:s}}toUTC(e=0,t={}){return this.setZone(_n.instance(e),t)}toLocal(){return this.setZone(Xt.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:i=!1}={}){if(e=Li(e,Xt.defaultZone),e.equals(this.zone))return this;if(e.isValid){let s=this.ts;if(t||i){const l=e.offset(this.ts),o=this.toObject();[s]=ho(o,l,e)}return zs(this,{ts:s,zone:e})}else return Ge.invalid(Yl(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:i}={}){const s=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:i});return zs(this,{loc:s})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=ko(e,Fu),i=!bt(t.weekYear)||!bt(t.weekNumber)||!bt(t.weekday),s=!bt(t.ordinal),l=!bt(t.year),o=!bt(t.month)||!bt(t.day),r=l||o,a=t.weekYear||t.weekNumber;if((r||s)&&a)throw new xs("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(o&&s)throw new xs("Can't mix ordinal dates with month/day");let u;i?u=Eu({...Zr(this.c),...t}):bt(t.ordinal)?(u={...this.toObject(),...t},bt(t.day)&&(u.day=Math.min(vo(u.year,u.month),u.day))):u=Au({...cr(this.c),...t});const[f,c]=ho(u,this.o,this.zone);return zs(this,{ts:f,o:c})}plus(e){if(!this.isValid)return this;const t=wt.fromDurationLike(e);return zs(this,Iu(this,t))}minus(e){if(!this.isValid)return this;const t=wt.fromDurationLike(e).negate();return zs(this,Iu(this,t))}startOf(e){if(!this.isValid)return this;const t={},i=wt.normalizeUnit(e);switch(i){case"years":t.month=1;case"quarters":case"months":t.day=1;case"weeks":case"days":t.hour=0;case"hours":t.minute=0;case"minutes":t.second=0;case"seconds":t.millisecond=0;break}if(i==="weeks"&&(t.weekday=1),i==="quarters"){const s=Math.ceil(this.month/3);t.month=(s-1)*3+1}return this.set(t)}endOf(e){return this.isValid?this.plus({[e]:1}).startOf(e).minus(1):this}toFormat(e,t={}){return this.isValid?wn.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):dr}toLocaleString(e=Br,t={}){return this.isValid?wn.create(this.loc.clone(t),e).formatDateTime(this):dr}toLocaleParts(e={}){return this.isValid?wn.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:i=!1,includeOffset:s=!0,extendedZone:l=!1}={}){if(!this.isValid)return null;const o=e==="extended";let r=hr(this,o);return r+="T",r+=Nu(this,o,t,i,s,l),r}toISODate({format:e="extended"}={}){return this.isValid?hr(this,e==="extended"):null}toISOWeekDate(){return Kl(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:i=!0,includePrefix:s=!1,extendedZone:l=!1,format:o="extended"}={}){return this.isValid?(s?"T":"")+Nu(this,o==="extended",t,e,i,l):null}toRFC2822(){return Kl(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Kl(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?hr(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:i=!0}={}){let s="HH:mm:ss.SSS";return(t||e)&&(i&&(s+=" "),t?s+="z":e&&(s+="ZZ")),Kl(this,s,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():dr}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",i={}){if(!this.isValid||!e.isValid)return wt.invalid("created by diffing an invalid DateTime");const s={locale:this.locale,numberingSystem:this.numberingSystem,...i},l=n1(t).map(wt.normalizeUnit),o=e.valueOf()>this.valueOf(),r=o?this:e,a=o?e:this,u=C0(r,a,l,s);return o?u.negate():u}diffNow(e="milliseconds",t={}){return this.diff(Ge.now(),e,t)}until(e){return this.isValid?qt.fromDateTimes(this,e):this}hasSame(e,t){if(!this.isValid)return!1;const i=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t)<=i&&i<=s.endOf(t)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||Ge.fromObject({},{zone:this.zone}),i=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(Ge.isDateTime))throw new zn("max requires all arguments be DateTimes");return gu(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,i={}){const{locale:s=null,numberingSystem:l=null}=i,o=Rt.fromOpts({locale:s,numberingSystem:l,defaultToEN:!0});return Kg(o,e,t)}static fromStringExplain(e,t,i={}){return Ge.fromFormatExplain(e,t,i)}static get DATE_SHORT(){return Br}static get DATE_MED(){return ag}static get DATE_MED_WITH_WEEKDAY(){return Qb}static get DATE_FULL(){return ug}static get DATE_HUGE(){return fg}static get TIME_SIMPLE(){return cg}static get TIME_WITH_SECONDS(){return dg}static get TIME_WITH_SHORT_OFFSET(){return pg}static get TIME_WITH_LONG_OFFSET(){return hg}static get TIME_24_SIMPLE(){return mg}static get TIME_24_WITH_SECONDS(){return gg}static get TIME_24_WITH_SHORT_OFFSET(){return _g}static get TIME_24_WITH_LONG_OFFSET(){return bg}static get DATETIME_SHORT(){return vg}static get DATETIME_SHORT_WITH_SECONDS(){return yg}static get DATETIME_MED(){return kg}static get DATETIME_MED_WITH_SECONDS(){return wg}static get DATETIME_MED_WITH_WEEKDAY(){return xb}static get DATETIME_FULL(){return $g}static get DATETIME_FULL_WITH_SECONDS(){return Sg}static get DATETIME_HUGE(){return Cg}static get DATETIME_HUGE_WITH_SECONDS(){return Mg}}function Us(n){if(Ge.isDateTime(n))return n;if(n&&n.valueOf&&ls(n.valueOf()))return Ge.fromJSDate(n);if(n&&typeof n=="object")return Ge.fromObject(n);throw new zn(`Unknown datetime argument: ${n}, of type ${typeof n}`)}class B{static isObject(e){return e!==null&&typeof e=="object"&&e.constructor===Object}static isEmpty(e){return e===""||e===null||e==="00000000-0000-0000-0000-000000000000"||e==="0001-01-01T00:00:00Z"||e==="0001-01-01"||typeof e>"u"||Array.isArray(e)&&e.length===0||B.isObject(e)&&Object.keys(e).length===0}static isInput(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return t==="input"||t==="select"||t==="textarea"||e.isContentEditable}static isFocusable(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return B.isInput(e)||t==="button"||t==="a"||t==="details"||e.tabIndex>=0}static hasNonEmptyProps(e){for(let t in e)if(!B.isEmpty(e[t]))return!0;return!1}static toArray(e,t=!1){return Array.isArray(e)?e:(t||!B.isEmpty(e))&&typeof e<"u"?[e]:[]}static inArray(e,t){e=Array.isArray(e)?e:[];for(let i=e.length-1;i>=0;i--)if(e[i]==t)return!0;return!1}static removeByValue(e,t){e=Array.isArray(e)?e:[];for(let i=e.length-1;i>=0;i--)if(e[i]==t){e.splice(i,1);break}}static pushUnique(e,t){B.inArray(e,t)||e.push(t)}static findByKey(e,t,i){e=Array.isArray(e)?e:[];for(let s in e)if(e[s][t]==i)return e[s];return null}static groupByKey(e,t){e=Array.isArray(e)?e:[];const i={};for(let s in e)i[e[s][t]]=i[e[s][t]]||[],i[e[s][t]].push(e[s]);return i}static removeByKey(e,t,i){for(let s in e)if(e[s][t]==i){e.splice(s,1);break}}static pushOrReplaceByKey(e,t,i="id"){for(let s=e.length-1;s>=0;s--)if(e[s][i]==t[i]){e[s]=t;return}e.push(t)}static filterDuplicatesByKey(e,t="id"){e=Array.isArray(e)?e:[];const i={};for(const s of e)i[s[t]]=s;return Object.values(i)}static filterRedactedProps(e,t="******"){const i=JSON.parse(JSON.stringify(e||{}));for(let s in i)typeof i[s]=="object"&&i[s]!==null?i[s]=B.filterRedactedProps(i[s],t):i[s]===t&&delete i[s];return i}static getNestedVal(e,t,i=null,s="."){let l=e||{},o=(t||"").split(s);for(const r of o){if(!B.isObject(l)&&!Array.isArray(l)||typeof l[r]>"u")return i;l=l[r]}return l}static setByPath(e,t,i,s="."){if(!B.isObject(e)&&!Array.isArray(e)){console.warn("setByPath: data not an object or array.");return}let l=e,o=t.split(s),r=o.pop();for(const a of o)(!B.isObject(l)&&!Array.isArray(l)||!B.isObject(l[a])&&!Array.isArray(l[a]))&&(l[a]={}),l=l[a];l[r]=i}static deleteByPath(e,t,i="."){let s=e||{},l=(t||"").split(i),o=l.pop();for(const r of l)(!B.isObject(s)&&!Array.isArray(s)||!B.isObject(s[r])&&!Array.isArray(s[r]))&&(s[r]={}),s=s[r];Array.isArray(s)?s.splice(o,1):B.isObject(s)&&delete s[o],l.length>0&&(Array.isArray(s)&&!s.length||B.isObject(s)&&!Object.keys(s).length)&&(Array.isArray(e)&&e.length>0||B.isObject(e)&&Object.keys(e).length>0)&&B.deleteByPath(e,l.join(i),i)}static randomString(e){e=e||10;let t="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let s=0;s{console.warn("Failed to copy.",i)})}static downloadJson(e,t){const i="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(e,null,2)),s=document.createElement("a");s.setAttribute("href",i),s.setAttribute("download",t+".json"),s.click(),s.remove()}static getJWTPayload(e){const t=(e||"").split(".")[1]||"";if(t==="")return{};try{const i=decodeURIComponent(atob(t));return JSON.parse(i)||{}}catch(i){console.warn("Failed to parse JWT payload data.",i)}return{}}static hasImageExtension(e){return/\.jpg|\.jpeg|\.png|\.svg|\.gif|\.webp|\.avif$/.test(e)}static generateThumb(e,t=100,i=100){return new Promise(s=>{let l=new FileReader;l.onload=function(o){let r=new Image;r.onload=function(){let a=document.createElement("canvas"),u=a.getContext("2d"),f=r.width,c=r.height;return a.width=t,a.height=i,u.drawImage(r,f>c?(f-c)/2:0,0,f>c?c:f,f>c?c:f,0,0,t,i),s(a.toDataURL(e.type))},r.src=o.target.result},l.readAsDataURL(e)})}static addValueToFormData(e,t,i){if(!(typeof i>"u"))if(B.isEmpty(i))e.append(t,"");else if(Array.isArray(i))for(const s of i)B.addValueToFormData(e,t,s);else i instanceof File?e.append(t,i):i instanceof Date?e.append(t,i.toISOString()):B.isObject(i)?e.append(t,JSON.stringify(i)):e.append(t,""+i)}static defaultFlatpickrOptions(){return{dateFormat:"Y-m-d H:i:S",disableMobile:!0,allowInput:!0,enableTime:!0,time_24hr:!0,locale:{firstDayOfWeek:1}}}static dummyCollectionRecord(e){var s,l,o,r,a;const t=(e==null?void 0:e.schema)||[],i={"@collectionId":e==null?void 0:e.id,"@collectionName":e==null?void 0:e.name,id:"RECORD_ID",created:"2022-01-01 01:00:00",updated:"2022-01-01 23:59:59"};for(const u of t){let f=null;u.type==="number"?f=123:u.type==="date"?f="2022-01-01 10:00:00":u.type==="bool"?f=!0:u.type==="email"?f="test@example.com":u.type==="url"?f="https://example.com":u.type==="json"?f="JSON (array/object)":u.type==="file"?(f="filename.jpg",((s=u.options)==null?void 0:s.maxSelect)>1&&(f=[f])):u.type==="select"?(f=(o=(l=u.options)==null?void 0:l.values)==null?void 0:o[0],((r=u.options)==null?void 0:r.maxSelect)>1&&(f=[f])):u.type==="relation"||u.type==="user"?(f="RELATION_RECORD_ID",((a=u.options)==null?void 0:a.maxSelect)>1&&(f=[f])):f="test",i[u.name]=f}return i}static getFieldTypeIcon(e){switch(e==null?void 0:e.toLowerCase()){case"primary":return"ri-key-line";case"text":return"ri-text";case"number":return"ri-hashtag";case"date":return"ri-calendar-line";case"bool":return"ri-toggle-line";case"email":return"ri-mail-line";case"url":return"ri-link";case"select":return"ri-list-check";case"json":return"ri-braces-line";case"file":return"ri-image-line";case"relation":return"ri-mind-map";case"user":return"ri-user-line";default:return"ri-star-s-line"}}static getFieldValueType(e){var t;switch(e=e||{},e.type){case"bool":return"Boolean";case"number":return"Number";case"file":return"File";case"select":case"relation":case"user":return((t=e.options)==null?void 0:t.maxSelect)>1?"Array":"String";default:return"String"}}static getApiExampleUrl(e){return(window.location.href.substring(0,window.location.href.indexOf("/_"))||e||"/").replace("//localhost","//127.0.0.1")}static hasCollectionChanges(e,t,i=!1){if(e=e||{},t=t||{},e.id!=t.id)return!0;for(let u in e)if(u!=="schema"&&JSON.stringify(e[u])!==JSON.stringify(t[u]))return!0;const s=Array.isArray(e.schema)?e.schema:[],l=Array.isArray(t.schema)?t.schema:[],o=s.filter(u=>(u==null?void 0:u.id)&&!B.findByKey(l,"id",u.id)),r=l.filter(u=>(u==null?void 0:u.id)&&!B.findByKey(s,"id",u.id)),a=l.filter(u=>{const f=B.isObject(u)&&B.findByKey(s,"id",u.id);if(!f)return!1;for(let c in f)if(JSON.stringify(u[c])!=JSON.stringify(f[c]))return!0;return!1});return!!(r.length||a.length||i&&o.length)}}const Ko=Gn([]);function s_(n,e=4e3){return Jo(n,"info",e)}function sn(n,e=3e3){return Jo(n,"success",e)}function ml(n,e=4500){return Jo(n,"error",e)}function J0(n,e=4500){return Jo(n,"warning",e)}function Jo(n,e,t){t=t||4e3;const i={message:n,type:e,duration:t,timeout:setTimeout(()=>{l_(i)},t)};Ko.update(s=>(Oa(s,i.message),B.pushOrReplaceByKey(s,i,"message"),s))}function l_(n){Ko.update(e=>(Oa(e,n),e))}function Z0(){Ko.update(n=>{for(let e of n)Oa(n,e);return[]})}function Oa(n,e){let t;typeof e=="string"?t=B.findByKey(n,"message",e):t=e,t&&(clearTimeout(t.timeout),B.removeByKey(n,"message",t.message))}const Vi=Gn({});function ri(n){Vi.set(n||{})}function Ea(n){Vi.update(e=>(B.deleteByPath(e,n),e))}const Aa=Gn({});function Gr(n){Aa.set(n||{})}ya.prototype.logout=function(n=!0){this.authStore.clear(),n&&Ci("/login")};ya.prototype.errorResponseHandler=function(n,e=!0,t=""){if(!n||!(n instanceof Error)||n.isAbort)return;const i=(n==null?void 0:n.status)<<0||400,s=(n==null?void 0:n.data)||{};if(e&&i!==404){let l=s.message||n.message||t;l&&ml(l)}if(B.isEmpty(s.data)||ri(s.data),i===401)return this.cancelAllRequests(),this.logout();if(i===403)return this.cancelAllRequests(),Ci("/")};class G0 extends sg{save(e,t){super.save(e,t),t instanceof as&&Gr(t)}clear(){super.clear(),Gr(null)}}const we=new ya("../","en-US",new G0("pb_admin_auth"));we.authStore.model instanceof as&&Gr(we.authStore.model);function X0(n){let e,t,i,s,l,o,r,a;const u=n[3].default,f=$n(u,n,n[2],null);return{c(){e=_("div"),t=_("main"),f&&f.c(),i=D(),s=_("footer"),l=_("a"),o=_("span"),o.textContent="PocketBase v0.7.9",p(t,"class","page-content"),p(o,"class","txt"),p(l,"href","https://github.com/pocketbase/pocketbase/releases"),p(l,"class","inline-flex flex-gap-5"),p(l,"target","_blank"),p(l,"rel","noopener"),p(l,"title","Releases"),p(s,"class","page-footer"),p(e,"class",r="page-wrapper "+n[1]),ne(e,"center-content",n[0])},m(c,d){w(c,e,d),m(e,t),f&&f.m(t,null),m(e,i),m(e,s),m(s,l),m(l,o),a=!0},p(c,[d]){f&&f.p&&(!a||d&4)&&Cn(f,u,c,c[2],a?Sn(u,c[2],d,null):Mn(c[2]),null),(!a||d&2&&r!==(r="page-wrapper "+c[1]))&&p(e,"class",r),(!a||d&3)&&ne(e,"center-content",c[0])},i(c){a||(A(f,c),a=!0)},o(c){L(f,c),a=!1},d(c){c&&k(e),f&&f.d(c)}}}function Q0(n,e,t){let{$$slots:i={},$$scope:s}=e,{center:l=!1}=e,{class:o=""}=e;return n.$$set=r=>{"center"in r&&t(0,l=r.center),"class"in r&&t(1,o=r.class),"$$scope"in r&&t(2,s=r.$$scope)},[l,o,s,i]}class On extends Ee{constructor(e){super(),Oe(this,e,Q0,X0,De,{center:0,class:1})}}function qu(n){let e,t,i;return{c(){e=_("div"),e.innerHTML=``,t=D(),i=_("div"),p(e,"class","block txt-center m-b-lg"),p(i,"class","clearfix")},m(s,l){w(s,e,l),w(s,t,l),w(s,i,l)},d(s){s&&k(e),s&&k(t),s&&k(i)}}}function x0(n){let e,t,i,s=!n[0]&&qu();const l=n[1].default,o=$n(l,n,n[2],null);return{c(){e=_("div"),s&&s.c(),t=D(),o&&o.c(),p(e,"class","wrapper wrapper-sm m-b-xl panel-wrapper svelte-lxxzfu")},m(r,a){w(r,e,a),s&&s.m(e,null),m(e,t),o&&o.m(e,null),i=!0},p(r,a){r[0]?s&&(s.d(1),s=null):s||(s=qu(),s.c(),s.m(e,t)),o&&o.p&&(!i||a&4)&&Cn(o,l,r,r[2],i?Sn(l,r[2],a,null):Mn(r[2]),null)},i(r){i||(A(o,r),i=!0)},o(r){L(o,r),i=!1},d(r){r&&k(e),s&&s.d(),o&&o.d(r)}}}function ev(n){let e,t;return e=new On({props:{class:"full-page",center:!0,$$slots:{default:[x0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&5&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function tv(n,e,t){let{$$slots:i={},$$scope:s}=e,{nobranding:l=!1}=e;return n.$$set=o=>{"nobranding"in o&&t(0,l=o.nobranding),"$$scope"in o&&t(2,s=o.$$scope)},[l,i,s]}class o_ extends Ee{constructor(e){super(),Oe(this,e,tv,ev,De,{nobranding:0})}}function Vu(n,e,t){const i=n.slice();return i[11]=e[t],i}const nv=n=>({}),zu=n=>({uniqueId:n[3]});function iv(n){let e=(n[11]||wo)+"",t;return{c(){t=N(e)},m(i,s){w(i,t,s)},p(i,s){s&4&&e!==(e=(i[11]||wo)+"")&&ue(t,e)},d(i){i&&k(t)}}}function sv(n){var s,l;let e,t=(((s=n[11])==null?void 0:s.message)||((l=n[11])==null?void 0:l.code)||wo)+"",i;return{c(){e=_("pre"),i=N(t)},m(o,r){w(o,e,r),m(e,i)},p(o,r){var a,u;r&4&&t!==(t=(((a=o[11])==null?void 0:a.message)||((u=o[11])==null?void 0:u.code)||wo)+"")&&ue(i,t)},d(o){o&&k(e)}}}function Bu(n){let e,t;function i(o,r){return typeof o[11]=="object"?sv:iv}let s=i(n),l=s(n);return{c(){e=_("div"),l.c(),t=D(),p(e,"class","help-block help-block-error")},m(o,r){w(o,e,r),l.m(e,null),m(e,t)},p(o,r){s===(s=i(o))&&l?l.p(o,r):(l.d(1),l=s(o),l&&(l.c(),l.m(e,t)))},d(o){o&&k(e),l.d()}}}function lv(n){let e,t,i,s,l;const o=n[7].default,r=$n(o,n,n[6],zu);let a=n[2],u=[];for(let f=0;ft(5,i=g));let{$$slots:s={},$$scope:l}=e;const o="field_"+B.randomString(7);let{name:r=""}=e,{class:a=void 0}=e,u,f=[];function c(){Ea(r)}Nn(()=>(u.addEventListener("input",c),u.addEventListener("change",c),()=>{u.removeEventListener("input",c),u.removeEventListener("change",c)}));function d(g){xe.call(this,n,g)}function h(g){me[g?"unshift":"push"](()=>{u=g,t(1,u)})}return n.$$set=g=>{"name"in g&&t(4,r=g.name),"class"in g&&t(0,a=g.class),"$$scope"in g&&t(6,l=g.$$scope)},n.$$.update=()=>{n.$$.dirty&48&&t(2,f=B.toArray(B.getNestedVal(i,r)))},[a,u,f,o,r,i,l,s,d,h]}class Ne extends Ee{constructor(e){super(),Oe(this,e,ov,lv,De,{name:4,class:0})}}function rv(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Email"),s=D(),l=_("input"),p(e,"for",i=n[9]),p(l,"type","email"),p(l,"autocomplete","off"),p(l,"id",o=n[9]),l.required=!0,l.autofocus=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),Me(l,n[0]),l.focus(),r||(a=J(l,"input",n[5]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&p(e,"for",i),f&512&&o!==(o=u[9])&&p(l,"id",o),f&1&&l.value!==u[0]&&Me(l,u[0])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function av(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=N("Password"),s=D(),l=_("input"),r=D(),a=_("div"),a.textContent="Minimum 10 characters.",p(e,"for",i=n[9]),p(l,"type","password"),p(l,"autocomplete","new-password"),p(l,"minlength","10"),p(l,"id",o=n[9]),l.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),m(e,t),w(c,s,d),w(c,l,d),Me(l,n[1]),w(c,r,d),w(c,a,d),u||(f=J(l,"input",n[6]),u=!0)},p(c,d){d&512&&i!==(i=c[9])&&p(e,"for",i),d&512&&o!==(o=c[9])&&p(l,"id",o),d&2&&l.value!==c[1]&&Me(l,c[1])},d(c){c&&k(e),c&&k(s),c&&k(l),c&&k(r),c&&k(a),u=!1,f()}}}function uv(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Password confirm"),s=D(),l=_("input"),p(e,"for",i=n[9]),p(l,"type","password"),p(l,"minlength","10"),p(l,"id",o=n[9]),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),Me(l,n[2]),r||(a=J(l,"input",n[7]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&p(e,"for",i),f&512&&o!==(o=u[9])&&p(l,"id",o),f&4&&l.value!==u[2]&&Me(l,u[2])},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function fv(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;return s=new Ne({props:{class:"form-field required",name:"email",$$slots:{default:[rv,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"password",$$slots:{default:[av,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),a=new Ne({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[uv,({uniqueId:g})=>({9:g}),({uniqueId:g})=>g?512:0]},$$scope:{ctx:n}}}),{c(){e=_("form"),t=_("div"),t.innerHTML="

    Create your first admin account in order to continue

    ",i=D(),q(s.$$.fragment),l=D(),q(o.$$.fragment),r=D(),q(a.$$.fragment),u=D(),f=_("button"),f.innerHTML=`Create and login - `,p(t,"class","content txt-center m-b-base"),p(f,"type","submit"),p(f,"class","btn btn-lg btn-block btn-next"),ne(f,"btn-disabled",n[3]),ne(f,"btn-loading",n[3]),p(e,"class","block"),p(e,"autocomplete","off")},m(g,v){w(g,e,v),m(e,t),m(e,i),H(s,e,null),m(e,l),H(o,e,null),m(e,r),H(a,e,null),m(e,u),m(e,f),c=!0,d||(h=J(e,"submit",Yt(n[4])),d=!0)},p(g,[v]){const b={};v&1537&&(b.$$scope={dirty:v,ctx:g}),s.$set(b);const y={};v&1538&&(y.$$scope={dirty:v,ctx:g}),o.$set(y);const $={};v&1540&&($.$$scope={dirty:v,ctx:g}),a.$set($),(!c||v&8)&&ne(f,"btn-disabled",g[3]),(!c||v&8)&&ne(f,"btn-loading",g[3])},i(g){c||(A(s.$$.fragment,g),A(o.$$.fragment,g),A(a.$$.fragment,g),c=!0)},o(g){L(s.$$.fragment,g),L(o.$$.fragment,g),L(a.$$.fragment,g),c=!1},d(g){g&&k(e),j(s),j(o),j(a),d=!1,h()}}}function cv(n,e,t){const i=Qt();let s="",l="",o="",r=!1;async function a(){if(!r){t(3,r=!0);try{await we.admins.create({email:s,password:l,passwordConfirm:o}),await we.admins.authViaEmail(s,l),i("submit")}catch(d){we.errorResponseHandler(d)}t(3,r=!1)}}function u(){s=this.value,t(0,s)}function f(){l=this.value,t(1,l)}function c(){o=this.value,t(2,o)}return[s,l,o,r,a,u,f,c]}class dv extends Ee{constructor(e){super(),Oe(this,e,cv,fv,De,{})}}function Uu(n){let e,t;return e=new o_({props:{$$slots:{default:[pv]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,s){const l={};s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function pv(n){let e,t;return e=new dv({}),e.$on("submit",n[1]),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p:se,i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function hv(n){let e,t,i=n[0]&&Uu(n);return{c(){i&&i.c(),e=Ue()},m(s,l){i&&i.m(s,l),w(s,e,l),t=!0},p(s,[l]){s[0]?i?(i.p(s,l),l&1&&A(i,1)):(i=Uu(s),i.c(),A(i,1),i.m(e.parentNode,e)):i&&(Ae(),L(i,1,1,()=>{i=null}),Pe())},i(s){t||(A(i),t=!0)},o(s){L(i),t=!1},d(s){i&&i.d(s),s&&k(e)}}}function mv(n,e,t){let i=!1;s();function s(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("installer")){we.logout(!1),t(0,i=!0);return}we.authStore.isValid?Ci("/collections"):we.logout()}return[i,async()=>{t(0,i=!1),await Zn(),window.location.search=""}]}class gv extends Ee{constructor(e){super(),Oe(this,e,mv,hv,De,{})}}const Nt=Gn(""),$o=Gn(""),us=Gn(!1);function Zo(n){const e=n-1;return e*e*e+1}function So(n,{delay:e=0,duration:t=400,easing:i=Sl}={}){const s=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:l=>`opacity: ${l*s}`}}function Wn(n,{delay:e=0,duration:t=400,easing:i=Zo,x:s=0,y:l=0,opacity:o=0}={}){const r=getComputedStyle(n),a=+r.opacity,u=r.transform==="none"?"":r.transform,f=a*(1-o);return{delay:e,duration:t,easing:i,css:(c,d)=>` - transform: ${u} translate(${(1-c)*s}px, ${(1-c)*l}px); - opacity: ${a-f*d}`}}function on(n,{delay:e=0,duration:t=400,easing:i=Zo}={}){const s=getComputedStyle(n),l=+s.opacity,o=parseFloat(s.height),r=parseFloat(s.paddingTop),a=parseFloat(s.paddingBottom),u=parseFloat(s.marginTop),f=parseFloat(s.marginBottom),c=parseFloat(s.borderTopWidth),d=parseFloat(s.borderBottomWidth);return{delay:e,duration:t,easing:i,css:h=>`overflow: hidden;opacity: ${Math.min(h*20,1)*l};height: ${h*o}px;padding-top: ${h*r}px;padding-bottom: ${h*a}px;margin-top: ${h*u}px;margin-bottom: ${h*f}px;border-top-width: ${h*c}px;border-bottom-width: ${h*d}px;`}}function Tn(n,{delay:e=0,duration:t=400,easing:i=Zo,start:s=0,opacity:l=0}={}){const o=getComputedStyle(n),r=+o.opacity,a=o.transform==="none"?"":o.transform,u=1-s,f=r*(1-l);return{delay:e,duration:t,easing:i,css:(c,d)=>` - transform: ${a} scale(${1-u*d}); - opacity: ${r-f*d} - `}}function _v(n){let e,t,i,s;return{c(){e=_("input"),p(e,"type","text"),p(e,"id",n[8]),p(e,"placeholder",t=n[0]||n[1])},m(l,o){w(l,e,o),n[13](e),Me(e,n[7]),i||(s=J(e,"input",n[14]),i=!0)},p(l,o){o&3&&t!==(t=l[0]||l[1])&&p(e,"placeholder",t),o&128&&e.value!==l[7]&&Me(e,l[7])},i:se,o:se,d(l){l&&k(e),n[13](null),i=!1,s()}}}function bv(n){let e,t,i,s;function l(a){n[12](a)}var o=n[4];function r(a){let u={id:a[8],singleLine:!0,disableRequestKeys:!0,disableIndirectCollectionsKeys:!0,extraAutocompleteKeys:a[3],baseCollection:a[2],placeholder:a[0]||a[1]};return a[7]!==void 0&&(u.value=a[7]),{props:u}}return o&&(e=new o(r(n)),me.push(()=>Re(e,"value",l)),e.$on("submit",n[10])),{c(){e&&q(e.$$.fragment),i=Ue()},m(a,u){e&&H(e,a,u),w(a,i,u),s=!0},p(a,u){const f={};if(u&8&&(f.extraAutocompleteKeys=a[3]),u&4&&(f.baseCollection=a[2]),u&3&&(f.placeholder=a[0]||a[1]),!t&&u&128&&(t=!0,f.value=a[7],He(()=>t=!1)),o!==(o=a[4])){if(e){Ae();const c=e;L(c.$$.fragment,1,0,()=>{j(c,1)}),Pe()}o?(e=new o(r(a)),me.push(()=>Re(e,"value",l)),e.$on("submit",a[10]),q(e.$$.fragment),A(e.$$.fragment,1),H(e,i.parentNode,i)):e=null}else o&&e.$set(f)},i(a){s||(e&&A(e.$$.fragment,a),s=!0)},o(a){e&&L(e.$$.fragment,a),s=!1},d(a){a&&k(i),e&&j(e,a)}}}function Wu(n){let e,t,i,s,l,o,r=n[7]!==n[0]&&Yu();return{c(){r&&r.c(),e=D(),t=_("button"),t.innerHTML='Clear',p(t,"type","button"),p(t,"class","btn btn-secondary btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(a,u){r&&r.m(a,u),w(a,e,u),w(a,t,u),s=!0,l||(o=J(t,"click",n[15]),l=!0)},p(a,u){a[7]!==a[0]?r?u&129&&A(r,1):(r=Yu(),r.c(),A(r,1),r.m(e.parentNode,e)):r&&(Ae(),L(r,1,1,()=>{r=null}),Pe())},i(a){s||(A(r),a&&Tt(()=>{i||(i=nt(t,Wn,{duration:150,x:5},!0)),i.run(1)}),s=!0)},o(a){L(r),a&&(i||(i=nt(t,Wn,{duration:150,x:5},!1)),i.run(0)),s=!1},d(a){r&&r.d(a),a&&k(e),a&&k(t),a&&i&&i.end(),l=!1,o()}}}function Yu(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Search',p(e,"type","submit"),p(e,"class","btn btn-expanded btn-sm btn-warning")},m(s,l){w(s,e,l),i=!0},i(s){i||(s&&Tt(()=>{t||(t=nt(e,Wn,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){s&&(t||(t=nt(e,Wn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function vv(n){let e,t,i,s,l,o,r,a,u,f,c;const d=[bv,_v],h=[];function g(b,y){return b[4]&&!b[5]?0:1}o=g(n),r=h[o]=d[o](n);let v=(n[0].length||n[7].length)&&Wu(n);return{c(){e=_("div"),t=_("form"),i=_("label"),s=_("i"),l=D(),r.c(),a=D(),v&&v.c(),p(s,"class","ri-search-line"),p(i,"for",n[8]),p(i,"class","m-l-10 txt-xl"),p(t,"class","searchbar"),p(e,"class","searchbar-wrapper")},m(b,y){w(b,e,y),m(e,t),m(t,i),m(i,s),m(t,l),h[o].m(t,null),m(t,a),v&&v.m(t,null),u=!0,f||(c=[J(t,"submit",Yt(n[10])),J(e,"click",ni(n[11]))],f=!0)},p(b,[y]){let $=o;o=g(b),o===$?h[o].p(b,y):(Ae(),L(h[$],1,1,()=>{h[$]=null}),Pe(),r=h[o],r?r.p(b,y):(r=h[o]=d[o](b),r.c()),A(r,1),r.m(t,a)),b[0].length||b[7].length?v?(v.p(b,y),y&129&&A(v,1)):(v=Wu(b),v.c(),A(v,1),v.m(t,null)):v&&(Ae(),L(v,1,1,()=>{v=null}),Pe())},i(b){u||(A(r),A(v),u=!0)},o(b){L(r),L(v),u=!1},d(b){b&&k(e),h[o].d(),v&&v.d(),f=!1,Ye(c)}}}function yv(n,e,t){const i=Qt(),s="search_"+B.randomString(7);let{value:l=""}=e,{placeholder:o='Search filter, ex. created > "2022-01-01"...'}=e,{autocompleteCollection:r=new dn}=e,{extraAutocompleteKeys:a=[]}=e,u,f=!1,c,d="";function h(T=!0){t(7,d=""),T&&(c==null||c.focus()),i("clear")}function g(){t(0,l=d),i("submit",l)}async function v(){u||f||(t(5,f=!0),t(4,u=(await Pi(()=>import("./FilterAutocompleteInput.37739e76.js"),["FilterAutocompleteInput.37739e76.js","index.a9121ab1.js"],import.meta.url)).default),t(5,f=!1))}Nn(()=>{v()});function b(T){xe.call(this,n,T)}function y(T){d=T,t(7,d),t(0,l)}function $(T){me[T?"unshift":"push"](()=>{c=T,t(6,c)})}function C(){d=this.value,t(7,d),t(0,l)}const S=()=>{h(!1),g()};return n.$$set=T=>{"value"in T&&t(0,l=T.value),"placeholder"in T&&t(1,o=T.placeholder),"autocompleteCollection"in T&&t(2,r=T.autocompleteCollection),"extraAutocompleteKeys"in T&&t(3,a=T.extraAutocompleteKeys)},n.$$.update=()=>{n.$$.dirty&1&&typeof l=="string"&&t(7,d=l)},[l,o,r,a,u,f,c,d,s,h,g,b,y,$,C,S]}class Go extends Ee{constructor(e){super(),Oe(this,e,yv,vv,De,{value:0,placeholder:1,autocompleteCollection:2,extraAutocompleteKeys:3})}}let Xr,Ki;const Qr="app-tooltip";function Ku(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function Ri(){return Ki=Ki||document.querySelector("."+Qr),Ki||(Ki=document.createElement("div"),Ki.classList.add(Qr),document.body.appendChild(Ki)),Ki}function r_(n,e){let t=Ri();if(!t.classList.contains("active")||!(e!=null&&e.text)){xr();return}t.textContent=e.text,t.className=Qr+" active",e.class&&t.classList.add(e.class),e.position&&t.classList.add(e.position),t.style.top="0px",t.style.left="0px";let i=t.offsetHeight,s=t.offsetWidth,l=n.getBoundingClientRect(),o=0,r=0,a=5;e.position=="left"?(o=l.top+l.height/2-i/2,r=l.left-s-a):e.position=="right"?(o=l.top+l.height/2-i/2,r=l.right+a):e.position=="top"?(o=l.top-i-a,r=l.left+l.width/2-s/2):e.position=="top-left"?(o=l.top-i-a,r=l.left):e.position=="top-right"?(o=l.top-i-a,r=l.right-s):e.position=="bottom-left"?(o=l.top+l.height+a,r=l.left):e.position=="bottom-right"?(o=l.top+l.height+a,r=l.right-s):(o=l.top+l.height+a,r=l.left+l.width/2-s/2),r+s>document.documentElement.clientWidth&&(r=document.documentElement.clientWidth-s),r=r>=0?r:0,o+i>document.documentElement.clientHeight&&(o=document.documentElement.clientHeight-i),o=o>=0?o:0,t.style.top=o+"px",t.style.left=r+"px"}function xr(){clearTimeout(Xr),Ri().classList.remove("active"),Ri().activeNode=void 0}function kv(n,e){Ri().activeNode=n,clearTimeout(Xr),Xr=setTimeout(()=>{Ri().classList.add("active"),r_(n,e)},isNaN(e.delay)?200:e.delay)}function yt(n,e){let t=Ku(e);function i(){kv(n,t)}function s(){xr()}return n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",s),n.addEventListener("blur",s),(t.hideOnClick===!0||t.hideOnClick===null&&B.isFocusable(n))&&n.addEventListener("click",s),Ri(),{update(l){var o,r;t=Ku(l),(r=(o=Ri())==null?void 0:o.activeNode)!=null&&r.contains(n)&&r_(n,t)},destroy(){var l,o;(o=(l=Ri())==null?void 0:l.activeNode)!=null&&o.contains(n)&&xr(),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",s),n.removeEventListener("blur",s),n.removeEventListener("click",s)}}}function wv(n){let e,t,i,s;return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-secondary btn-circle svelte-b7gb6q"),ne(e,"refreshing",n[1])},m(l,o){w(l,e,o),i||(s=[We(t=yt.call(null,e,n[0])),J(e,"click",n[2])],i=!0)},p(l,[o]){t&&Jn(t.update)&&o&1&&t.update.call(null,l[0]),o&2&&ne(e,"refreshing",l[1])},i:se,o:se,d(l){l&&k(e),i=!1,Ye(s)}}}function $v(n,e,t){const i=Qt();let{tooltip:s={text:"Refresh",position:"right"}}=e,l=null;function o(){i("refresh");const r=s;t(0,s=null),clearTimeout(l),t(1,l=setTimeout(()=>{t(1,l=null),t(0,s=r)},200))}return Nn(()=>()=>clearTimeout(l)),n.$$set=r=>{"tooltip"in r&&t(0,s=r.tooltip)},[s,l,o]}class Xo extends Ee{constructor(e){super(),Oe(this,e,$v,wv,De,{tooltip:0})}}function Sv(n){let e,t,i,s,l;const o=n[6].default,r=$n(o,n,n[5],null);return{c(){e=_("th"),r&&r.c(),p(e,"tabindex","0"),p(e,"class",t="col-sort "+n[1]),ne(e,"col-sort-disabled",n[3]),ne(e,"sort-active",n[0]==="-"+n[2]||n[0]==="+"+n[2]),ne(e,"sort-desc",n[0]==="-"+n[2]),ne(e,"sort-asc",n[0]==="+"+n[2])},m(a,u){w(a,e,u),r&&r.m(e,null),i=!0,s||(l=[J(e,"click",n[7]),J(e,"keydown",n[8])],s=!0)},p(a,[u]){r&&r.p&&(!i||u&32)&&Cn(r,o,a,a[5],i?Sn(o,a[5],u,null):Mn(a[5]),null),(!i||u&2&&t!==(t="col-sort "+a[1]))&&p(e,"class",t),(!i||u&10)&&ne(e,"col-sort-disabled",a[3]),(!i||u&7)&&ne(e,"sort-active",a[0]==="-"+a[2]||a[0]==="+"+a[2]),(!i||u&7)&&ne(e,"sort-desc",a[0]==="-"+a[2]),(!i||u&7)&&ne(e,"sort-asc",a[0]==="+"+a[2])},i(a){i||(A(r,a),i=!0)},o(a){L(r,a),i=!1},d(a){a&&k(e),r&&r.d(a),s=!1,Ye(l)}}}function Cv(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,{name:o}=e,{sort:r=""}=e,{disable:a=!1}=e;function u(){a||("-"+o===r?t(0,r="+"+o):t(0,r="-"+o))}const f=()=>u(),c=d=>{(d.code==="Enter"||d.code==="Space")&&(d.preventDefault(),u())};return n.$$set=d=>{"class"in d&&t(1,l=d.class),"name"in d&&t(2,o=d.name),"sort"in d&&t(0,r=d.sort),"disable"in d&&t(3,a=d.disable),"$$scope"in d&&t(5,s=d.$$scope)},[r,l,o,a,u,s,i,f,c]}class an extends Ee{constructor(e){super(),Oe(this,e,Cv,Sv,De,{class:1,name:2,sort:0,disable:3})}}function Mv(n){let e;return{c(){e=_("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function Tv(n){let e,t,i;return{c(){e=_("span"),t=N(n[1]),i=N(" UTC"),p(e,"class","txt")},m(s,l){w(s,e,l),m(e,t),m(e,i)},p(s,l){l&2&&ue(t,s[1])},d(s){s&&k(e)}}}function Dv(n){let e;function t(l,o){return l[0]?Tv:Mv}let i=t(n),s=i(n);return{c(){s.c(),e=Ue()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:se,o:se,d(l){s.d(l),l&&k(e)}}}function Ov(n,e,t){let i,{date:s=""}=e;return n.$$set=l=>{"date"in l&&t(0,s=l.date)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=s.length>19?s.substring(0,19):s)},[s,i]}class Si extends Ee{constructor(e){super(),Oe(this,e,Ov,Dv,De,{date:0})}}function Ju(n,e,t){const i=n.slice();return i[21]=e[t],i}function Ev(n){let e;return{c(){e=_("div"),e.innerHTML=` - method`,p(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function Av(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="url",p(t,"class",B.getFieldTypeIcon("url")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function Pv(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="referer",p(t,"class",B.getFieldTypeIcon("url")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function Lv(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="status",p(t,"class",B.getFieldTypeIcon("number")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function Iv(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="created",p(t,"class",B.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function Zu(n){let e;function t(l,o){return l[6]?Fv:Nv}let i=t(n),s=i(n);return{c(){s.c(),e=Ue()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function Nv(n){var r;let e,t,i,s,l,o=((r=n[0])==null?void 0:r.length)&&Gu(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No logs found.",s=D(),o&&o.c(),l=D(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),m(e,t),m(t,i),m(t,s),o&&o.m(t,null),m(e,l)},p(a,u){var f;(f=a[0])!=null&&f.length?o?o.p(a,u):(o=Gu(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function Fv(n){let e;return{c(){e=_("tr"),e.innerHTML=` - `},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function Gu(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=J(e,"click",n[18]),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function Xu(n){let e;return{c(){e=_("i"),p(e,"class","ri-error-warning-line txt-danger m-l-5 m-r-5"),p(e,"title","Error")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Qu(n,e){var ve,_e,ge;let t,i,s,l=((ve=e[21].method)==null?void 0:ve.toUpperCase())+"",o,r,a,u,f,c=e[21].url+"",d,h,g,v,b,y,$=(e[21].referer||"N/A")+"",C,S,T,M,O,E=e[21].status+"",P,I,F,V,X,te,Z,ee,U,Y,G=(((_e=e[21].meta)==null?void 0:_e.errorMessage)||((ge=e[21].meta)==null?void 0:ge.errorData))&&Xu();V=new Si({props:{date:e[21].created}});function de(){return e[16](e[21])}function x(...K){return e[17](e[21],...K)}return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("span"),o=N(l),a=D(),u=_("td"),f=_("span"),d=N(c),g=D(),G&&G.c(),v=D(),b=_("td"),y=_("span"),C=N($),T=D(),M=_("td"),O=_("span"),P=N(E),I=D(),F=_("td"),q(V.$$.fragment),X=D(),te=_("td"),te.innerHTML='',Z=D(),p(s,"class",r="label txt-uppercase "+e[9][e[21].method.toLowerCase()]),p(i,"class","col-type-text col-field-method min-width"),p(f,"class","txt txt-ellipsis"),p(f,"title",h=e[21].url),p(u,"class","col-type-text col-field-url"),p(y,"class","txt txt-ellipsis"),p(y,"title",S=e[21].referer),ne(y,"txt-hint",!e[21].referer),p(b,"class","col-type-text col-field-referer"),p(O,"class","label"),ne(O,"label-danger",e[21].status>=400),p(M,"class","col-type-number col-field-status"),p(F,"class","col-type-date col-field-created"),p(te,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(K,ye){w(K,t,ye),m(t,i),m(i,s),m(s,o),m(t,a),m(t,u),m(u,f),m(f,d),m(u,g),G&&G.m(u,null),m(t,v),m(t,b),m(b,y),m(y,C),m(t,T),m(t,M),m(M,O),m(O,P),m(t,I),m(t,F),H(V,F,null),m(t,X),m(t,te),m(t,Z),ee=!0,U||(Y=[J(t,"click",de),J(t,"keydown",x)],U=!0)},p(K,ye){var W,ce,ae;e=K,(!ee||ye&8)&&l!==(l=((W=e[21].method)==null?void 0:W.toUpperCase())+"")&&ue(o,l),(!ee||ye&8&&r!==(r="label txt-uppercase "+e[9][e[21].method.toLowerCase()]))&&p(s,"class",r),(!ee||ye&8)&&c!==(c=e[21].url+"")&&ue(d,c),(!ee||ye&8&&h!==(h=e[21].url))&&p(f,"title",h),((ce=e[21].meta)==null?void 0:ce.errorMessage)||((ae=e[21].meta)==null?void 0:ae.errorData)?G||(G=Xu(),G.c(),G.m(u,null)):G&&(G.d(1),G=null),(!ee||ye&8)&&$!==($=(e[21].referer||"N/A")+"")&&ue(C,$),(!ee||ye&8&&S!==(S=e[21].referer))&&p(y,"title",S),(!ee||ye&8)&&ne(y,"txt-hint",!e[21].referer),(!ee||ye&8)&&E!==(E=e[21].status+"")&&ue(P,E),(!ee||ye&8)&&ne(O,"label-danger",e[21].status>=400);const oe={};ye&8&&(oe.date=e[21].created),V.$set(oe)},i(K){ee||(A(V.$$.fragment,K),ee=!0)},o(K){L(V.$$.fragment,K),ee=!1},d(K){K&&k(t),G&&G.d(),j(V),U=!1,Ye(Y)}}}function xu(n){let e,t,i=n[3].length+"",s,l,o;return{c(){e=_("small"),t=N("Showing "),s=N(i),l=N(" of "),o=N(n[4]),p(e,"class","block txt-hint txt-right m-t-sm")},m(r,a){w(r,e,a),m(e,t),m(e,s),m(e,l),m(e,o)},p(r,a){a&8&&i!==(i=r[3].length+"")&&ue(s,i),a&16&&ue(o,r[4])},d(r){r&&k(e)}}}function ef(n){let e,t,i,s,l=n[4]-n[3].length+"",o,r,a,u;return{c(){e=_("div"),t=_("button"),i=_("span"),s=N("Load more ("),o=N(l),r=N(")"),p(i,"class","txt"),p(t,"type","button"),p(t,"class","btn btn-lg btn-secondary btn-expanded"),ne(t,"btn-loading",n[6]),ne(t,"btn-disabled",n[6]),p(e,"class","block txt-center m-t-xs")},m(f,c){w(f,e,c),m(e,t),m(t,i),m(i,s),m(i,o),m(i,r),a||(u=J(t,"click",n[19]),a=!0)},p(f,c){c&24&&l!==(l=f[4]-f[3].length+"")&&ue(o,l),c&64&&ne(t,"btn-loading",f[6]),c&64&&ne(t,"btn-disabled",f[6])},d(f){f&&k(e),a=!1,u()}}}function Rv(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g,v,b,y,$,C,S,T,M,O=[],E=new Map,P,I,F,V;function X(W){n[11](W)}let te={disable:!0,class:"col-field-method",name:"method",$$slots:{default:[Ev]},$$scope:{ctx:n}};n[1]!==void 0&&(te.sort=n[1]),l=new an({props:te}),me.push(()=>Re(l,"sort",X));function Z(W){n[12](W)}let ee={disable:!0,class:"col-type-text col-field-url",name:"url",$$slots:{default:[Av]},$$scope:{ctx:n}};n[1]!==void 0&&(ee.sort=n[1]),a=new an({props:ee}),me.push(()=>Re(a,"sort",Z));function U(W){n[13](W)}let Y={disable:!0,class:"col-type-text col-field-referer",name:"referer",$$slots:{default:[Pv]},$$scope:{ctx:n}};n[1]!==void 0&&(Y.sort=n[1]),c=new an({props:Y}),me.push(()=>Re(c,"sort",U));function G(W){n[14](W)}let de={disable:!0,class:"col-type-number col-field-status",name:"status",$$slots:{default:[Lv]},$$scope:{ctx:n}};n[1]!==void 0&&(de.sort=n[1]),g=new an({props:de}),me.push(()=>Re(g,"sort",G));function x(W){n[15](W)}let ve={disable:!0,class:"col-type-date col-field-created",name:"created",$$slots:{default:[Iv]},$$scope:{ctx:n}};n[1]!==void 0&&(ve.sort=n[1]),y=new an({props:ve}),me.push(()=>Re(y,"sort",x));let _e=n[3];const ge=W=>W[21].id;for(let W=0;W<_e.length;W+=1){let ce=Ju(n,_e,W),ae=ge(ce);E.set(ae,O[W]=Qu(ae,ce))}let K=null;_e.length||(K=Zu(n));let ye=n[3].length&&xu(n),oe=n[3].length&&n[7]&&ef(n);return{c(){e=_("div"),t=_("table"),i=_("thead"),s=_("tr"),q(l.$$.fragment),r=D(),q(a.$$.fragment),f=D(),q(c.$$.fragment),h=D(),q(g.$$.fragment),b=D(),q(y.$$.fragment),C=D(),S=_("th"),T=D(),M=_("tbody");for(let W=0;Wo=!1)),l.$set(ae);const Se={};ce&16777216&&(Se.$$scope={dirty:ce,ctx:W}),!u&&ce&2&&(u=!0,Se.sort=W[1],He(()=>u=!1)),a.$set(Se);const Q={};ce&16777216&&(Q.$$scope={dirty:ce,ctx:W}),!d&&ce&2&&(d=!0,Q.sort=W[1],He(()=>d=!1)),c.$set(Q);const $e={};ce&16777216&&($e.$$scope={dirty:ce,ctx:W}),!v&&ce&2&&(v=!0,$e.sort=W[1],He(()=>v=!1)),g.$set($e);const Be={};ce&16777216&&(Be.$$scope={dirty:ce,ctx:W}),!$&&ce&2&&($=!0,Be.sort=W[1],He(()=>$=!1)),y.$set(Be),ce&841&&(_e=W[3],Ae(),O=ct(O,ce,ge,1,W,_e,E,M,Ut,Qu,null,Ju),Pe(),!_e.length&&K?K.p(W,ce):_e.length?K&&(K.d(1),K=null):(K=Zu(W),K.c(),K.m(M,null))),(!V||ce&64)&&ne(t,"table-loading",W[6]),W[3].length?ye?ye.p(W,ce):(ye=xu(W),ye.c(),ye.m(I.parentNode,I)):ye&&(ye.d(1),ye=null),W[3].length&&W[7]?oe?oe.p(W,ce):(oe=ef(W),oe.c(),oe.m(F.parentNode,F)):oe&&(oe.d(1),oe=null)},i(W){if(!V){A(l.$$.fragment,W),A(a.$$.fragment,W),A(c.$$.fragment,W),A(g.$$.fragment,W),A(y.$$.fragment,W);for(let ce=0;ce<_e.length;ce+=1)A(O[ce]);V=!0}},o(W){L(l.$$.fragment,W),L(a.$$.fragment,W),L(c.$$.fragment,W),L(g.$$.fragment,W),L(y.$$.fragment,W);for(let ce=0;ce{E<=1&&g(),t(6,d=!1),t(3,u=u.concat(P.items)),t(5,f=P.page),t(4,c=P.totalItems),s("load",u)}).catch(P=>{P!=null&&P.isAbort||(t(6,d=!1),console.warn(P),g(),we.errorResponseHandler(P,!1))})}function g(){t(3,u=[]),t(5,f=1),t(4,c=0)}function v(E){a=E,t(1,a)}function b(E){a=E,t(1,a)}function y(E){a=E,t(1,a)}function $(E){a=E,t(1,a)}function C(E){a=E,t(1,a)}const S=E=>s("select",E),T=(E,P)=>{P.code==="Enter"&&(P.preventDefault(),s("select",E))},M=()=>t(0,o=""),O=()=>h(f+1);return n.$$set=E=>{"filter"in E&&t(0,o=E.filter),"presets"in E&&t(10,r=E.presets),"sort"in E&&t(1,a=E.sort)},n.$$.update=()=>{n.$$.dirty&1027&&(typeof a<"u"||typeof o<"u"||typeof r<"u")&&(g(),h(1)),n.$$.dirty&24&&t(7,i=c>u.length)},[o,a,h,u,c,f,d,i,s,l,r,v,b,y,$,C,S,T,M,O]}class jv extends Ee{constructor(e){super(),Oe(this,e,Hv,Rv,De,{filter:0,presets:10,sort:1,load:2})}get load(){return this.$$.ctx[2]}}/*! - * Chart.js v3.9.1 - * https://www.chartjs.org - * (c) 2022 Chart.js Contributors - * Released under the MIT License - */function _i(){}const qv=function(){let n=0;return function(){return n++}}();function Mt(n){return n===null||typeof n>"u"}function It(n){if(Array.isArray&&Array.isArray(n))return!0;const e=Object.prototype.toString.call(n);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function mt(n){return n!==null&&Object.prototype.toString.call(n)==="[object Object]"}const Kt=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function Hn(n,e){return Kt(n)?n:e}function vt(n,e){return typeof n>"u"?e:n}const Vv=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/e,a_=(n,e)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*e:+n;function Vt(n,e,t){if(n&&typeof n.call=="function")return n.apply(t,e)}function Et(n,e,t,i){let s,l,o;if(It(n))if(l=n.length,i)for(s=l-1;s>=0;s--)e.call(t,n[s],s);else for(s=0;sn,x:n=>n.x,y:n=>n.y};function ji(n,e){return(tf[e]||(tf[e]=Uv(e)))(n)}function Uv(n){const e=Wv(n);return t=>{for(const i of e){if(i==="")break;t=t&&t[i]}return t}}function Wv(n){const e=n.split("."),t=[];let i="";for(const s of e)i+=s,i.endsWith("\\")?i=i.slice(0,-1)+".":(t.push(i),i="");return t}function Pa(n){return n.charAt(0).toUpperCase()+n.slice(1)}const Yn=n=>typeof n<"u",qi=n=>typeof n=="function",nf=(n,e)=>{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0};function Yv(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}const Wt=Math.PI,At=2*Wt,Kv=At+Wt,To=Number.POSITIVE_INFINITY,Jv=Wt/180,zt=Wt/2,Ws=Wt/4,sf=Wt*2/3,Bn=Math.log10,pi=Math.sign;function lf(n){const e=Math.round(n);n=rl(n,e,n/1e3)?e:n;const t=Math.pow(10,Math.floor(Bn(n))),i=n/t;return(i<=1?1:i<=2?2:i<=5?5:10)*t}function Zv(n){const e=[],t=Math.sqrt(n);let i;for(i=1;is-l).pop(),e}function Os(n){return!isNaN(parseFloat(n))&&isFinite(n)}function rl(n,e,t){return Math.abs(n-e)=n}function f_(n,e,t){let i,s,l;for(i=0,s=n.length;ia&&u=Math.min(e,t)-i&&n<=Math.max(e,t)+i}function Ia(n,e,t){t=t||(o=>n[o]1;)l=s+i>>1,t(l)?s=l:i=l;return{lo:s,hi:i}}const ts=(n,e,t,i)=>Ia(n,t,i?s=>n[s][e]<=t:s=>n[s][e]Ia(n,t,i=>n[i][e]>=t);function ey(n,e,t){let i=0,s=n.length;for(;ii&&n[s-1]>t;)s--;return i>0||s{const i="_onData"+Pa(t),s=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...l){const o=s.apply(this,l);return n._chartjs.listeners.forEach(r=>{typeof r[i]=="function"&&r[i](...l)}),o}})})}function rf(n,e){const t=n._chartjs;if(!t)return;const i=t.listeners,s=i.indexOf(e);s!==-1&&i.splice(s,1),!(i.length>0)&&(d_.forEach(l=>{delete n[l]}),delete n._chartjs)}function p_(n){const e=new Set;let t,i;for(t=0,i=n.length;t"u"?function(n){return n()}:window.requestAnimationFrame}();function m_(n,e,t){const i=t||(o=>Array.prototype.slice.call(o));let s=!1,l=[];return function(...o){l=i(o),s||(s=!0,h_.call(window,()=>{s=!1,n.apply(e,l)}))}}function ny(n,e){let t;return function(...i){return e?(clearTimeout(t),t=setTimeout(n,e,i)):n.apply(this,i),e}}const iy=n=>n==="start"?"left":n==="end"?"right":"center",af=(n,e,t)=>n==="start"?e:n==="end"?t:(e+t)/2;function g_(n,e,t){const i=e.length;let s=0,l=i;if(n._sorted){const{iScale:o,_parsed:r}=n,a=o.axis,{min:u,max:f,minDefined:c,maxDefined:d}=o.getUserBounds();c&&(s=cn(Math.min(ts(r,o.axis,u).lo,t?i:ts(e,a,o.getPixelForValue(u)).lo),0,i-1)),d?l=cn(Math.max(ts(r,o.axis,f,!0).hi+1,t?0:ts(e,a,o.getPixelForValue(f),!0).hi+1),s,i)-s:l=i-s}return{start:s,count:l}}function __(n){const{xScale:e,yScale:t,_scaleRanges:i}=n,s={xmin:e.min,xmax:e.max,ymin:t.min,ymax:t.max};if(!i)return n._scaleRanges=s,!0;const l=i.xmin!==e.min||i.xmax!==e.max||i.ymin!==t.min||i.ymax!==t.max;return Object.assign(i,s),l}const Jl=n=>n===0||n===1,uf=(n,e,t)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-e)*At/t)),ff=(n,e,t)=>Math.pow(2,-10*n)*Math.sin((n-e)*At/t)+1,al={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>-n*(n-2),easeInOutQuad:n=>(n/=.5)<1?.5*n*n:-.5*(--n*(n-2)-1),easeInCubic:n=>n*n*n,easeOutCubic:n=>(n-=1)*n*n+1,easeInOutCubic:n=>(n/=.5)<1?.5*n*n*n:.5*((n-=2)*n*n+2),easeInQuart:n=>n*n*n*n,easeOutQuart:n=>-((n-=1)*n*n*n-1),easeInOutQuart:n=>(n/=.5)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2),easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>(n-=1)*n*n*n*n+1,easeInOutQuint:n=>(n/=.5)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2),easeInSine:n=>-Math.cos(n*zt)+1,easeOutSine:n=>Math.sin(n*zt),easeInOutSine:n=>-.5*(Math.cos(Wt*n)-1),easeInExpo:n=>n===0?0:Math.pow(2,10*(n-1)),easeOutExpo:n=>n===1?1:-Math.pow(2,-10*n)+1,easeInOutExpo:n=>Jl(n)?n:n<.5?.5*Math.pow(2,10*(n*2-1)):.5*(-Math.pow(2,-10*(n*2-1))+2),easeInCirc:n=>n>=1?n:-(Math.sqrt(1-n*n)-1),easeOutCirc:n=>Math.sqrt(1-(n-=1)*n),easeInOutCirc:n=>(n/=.5)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1),easeInElastic:n=>Jl(n)?n:uf(n,.075,.3),easeOutElastic:n=>Jl(n)?n:ff(n,.075,.3),easeInOutElastic(n){return Jl(n)?n:n<.5?.5*uf(n*2,.1125,.45):.5+.5*ff(n*2-1,.1125,.45)},easeInBack(n){return n*n*((1.70158+1)*n-1.70158)},easeOutBack(n){return(n-=1)*n*((1.70158+1)*n+1.70158)+1},easeInOutBack(n){let e=1.70158;return(n/=.5)<1?.5*(n*n*(((e*=1.525)+1)*n-e)):.5*((n-=2)*n*(((e*=1.525)+1)*n+e)+2)},easeInBounce:n=>1-al.easeOutBounce(1-n),easeOutBounce(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},easeInOutBounce:n=>n<.5?al.easeInBounce(n*2)*.5:al.easeOutBounce(n*2-1)*.5+.5};/*! - * @kurkle/color v0.2.1 - * https://github.com/kurkle/color#readme - * (c) 2022 Jukka Kurkela - * Released under the MIT License - */function Ol(n){return n+.5|0}const Ni=(n,e,t)=>Math.max(Math.min(n,t),e);function tl(n){return Ni(Ol(n*2.55),0,255)}function Hi(n){return Ni(Ol(n*255),0,255)}function yi(n){return Ni(Ol(n/2.55)/100,0,1)}function cf(n){return Ni(Ol(n*100),0,100)}const Rn={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},ta=[..."0123456789ABCDEF"],sy=n=>ta[n&15],ly=n=>ta[(n&240)>>4]+ta[n&15],Zl=n=>(n&240)>>4===(n&15),oy=n=>Zl(n.r)&&Zl(n.g)&&Zl(n.b)&&Zl(n.a);function ry(n){var e=n.length,t;return n[0]==="#"&&(e===4||e===5?t={r:255&Rn[n[1]]*17,g:255&Rn[n[2]]*17,b:255&Rn[n[3]]*17,a:e===5?Rn[n[4]]*17:255}:(e===7||e===9)&&(t={r:Rn[n[1]]<<4|Rn[n[2]],g:Rn[n[3]]<<4|Rn[n[4]],b:Rn[n[5]]<<4|Rn[n[6]],a:e===9?Rn[n[7]]<<4|Rn[n[8]]:255})),t}const ay=(n,e)=>n<255?e(n):"";function uy(n){var e=oy(n)?sy:ly;return n?"#"+e(n.r)+e(n.g)+e(n.b)+ay(n.a,e):void 0}const fy=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function b_(n,e,t){const i=e*Math.min(t,1-t),s=(l,o=(l+n/30)%12)=>t-i*Math.max(Math.min(o-3,9-o,1),-1);return[s(0),s(8),s(4)]}function cy(n,e,t){const i=(s,l=(s+n/60)%6)=>t-t*e*Math.max(Math.min(l,4-l,1),0);return[i(5),i(3),i(1)]}function dy(n,e,t){const i=b_(n,1,.5);let s;for(e+t>1&&(s=1/(e+t),e*=s,t*=s),s=0;s<3;s++)i[s]*=1-e-t,i[s]+=e;return i}function py(n,e,t,i,s){return n===s?(e-t)/i+(e.5?f/(2-l-o):f/(l+o),a=py(t,i,s,f,l),a=a*60+.5),[a|0,u||0,r]}function Fa(n,e,t,i){return(Array.isArray(e)?n(e[0],e[1],e[2]):n(e,t,i)).map(Hi)}function Ra(n,e,t){return Fa(b_,n,e,t)}function hy(n,e,t){return Fa(dy,n,e,t)}function my(n,e,t){return Fa(cy,n,e,t)}function v_(n){return(n%360+360)%360}function gy(n){const e=fy.exec(n);let t=255,i;if(!e)return;e[5]!==i&&(t=e[6]?tl(+e[5]):Hi(+e[5]));const s=v_(+e[2]),l=+e[3]/100,o=+e[4]/100;return e[1]==="hwb"?i=hy(s,l,o):e[1]==="hsv"?i=my(s,l,o):i=Ra(s,l,o),{r:i[0],g:i[1],b:i[2],a:t}}function _y(n,e){var t=Na(n);t[0]=v_(t[0]+e),t=Ra(t),n.r=t[0],n.g=t[1],n.b=t[2]}function by(n){if(!n)return;const e=Na(n),t=e[0],i=cf(e[1]),s=cf(e[2]);return n.a<255?`hsla(${t}, ${i}%, ${s}%, ${yi(n.a)})`:`hsl(${t}, ${i}%, ${s}%)`}const df={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},pf={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function vy(){const n={},e=Object.keys(pf),t=Object.keys(df);let i,s,l,o,r;for(i=0;i>16&255,l>>8&255,l&255]}return n}let Gl;function yy(n){Gl||(Gl=vy(),Gl.transparent=[0,0,0,0]);const e=Gl[n.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}const ky=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function wy(n){const e=ky.exec(n);let t=255,i,s,l;if(!!e){if(e[7]!==i){const o=+e[7];t=e[8]?tl(o):Ni(o*255,0,255)}return i=+e[1],s=+e[3],l=+e[5],i=255&(e[2]?tl(i):Ni(i,0,255)),s=255&(e[4]?tl(s):Ni(s,0,255)),l=255&(e[6]?tl(l):Ni(l,0,255)),{r:i,g:s,b:l,a:t}}}function $y(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${yi(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}const mr=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,bs=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function Sy(n,e,t){const i=bs(yi(n.r)),s=bs(yi(n.g)),l=bs(yi(n.b));return{r:Hi(mr(i+t*(bs(yi(e.r))-i))),g:Hi(mr(s+t*(bs(yi(e.g))-s))),b:Hi(mr(l+t*(bs(yi(e.b))-l))),a:n.a+t*(e.a-n.a)}}function Xl(n,e,t){if(n){let i=Na(n);i[e]=Math.max(0,Math.min(i[e]+i[e]*t,e===0?360:1)),i=Ra(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function y_(n,e){return n&&Object.assign(e||{},n)}function hf(n){var e={r:0,g:0,b:0,a:255};return Array.isArray(n)?n.length>=3&&(e={r:n[0],g:n[1],b:n[2],a:255},n.length>3&&(e.a=Hi(n[3]))):(e=y_(n,{r:0,g:0,b:0,a:1}),e.a=Hi(e.a)),e}function Cy(n){return n.charAt(0)==="r"?wy(n):gy(n)}class Do{constructor(e){if(e instanceof Do)return e;const t=typeof e;let i;t==="object"?i=hf(e):t==="string"&&(i=ry(e)||yy(e)||Cy(e)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var e=y_(this._rgb);return e&&(e.a=yi(e.a)),e}set rgb(e){this._rgb=hf(e)}rgbString(){return this._valid?$y(this._rgb):void 0}hexString(){return this._valid?uy(this._rgb):void 0}hslString(){return this._valid?by(this._rgb):void 0}mix(e,t){if(e){const i=this.rgb,s=e.rgb;let l;const o=t===l?.5:t,r=2*o-1,a=i.a-s.a,u=((r*a===-1?r:(r+a)/(1+r*a))+1)/2;l=1-u,i.r=255&u*i.r+l*s.r+.5,i.g=255&u*i.g+l*s.g+.5,i.b=255&u*i.b+l*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(e,t){return e&&(this._rgb=Sy(this._rgb,e._rgb,t)),this}clone(){return new Do(this.rgb)}alpha(e){return this._rgb.a=Hi(e),this}clearer(e){const t=this._rgb;return t.a*=1-e,this}greyscale(){const e=this._rgb,t=Ol(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=t,this}opaquer(e){const t=this._rgb;return t.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return Xl(this._rgb,2,e),this}darken(e){return Xl(this._rgb,2,-e),this}saturate(e){return Xl(this._rgb,1,e),this}desaturate(e){return Xl(this._rgb,1,-e),this}rotate(e){return _y(this._rgb,e),this}}function k_(n){return new Do(n)}function w_(n){if(n&&typeof n=="object"){const e=n.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function mf(n){return w_(n)?n:k_(n)}function gr(n){return w_(n)?n:k_(n).saturate(.5).darken(.1).hexString()}const fs=Object.create(null),na=Object.create(null);function ul(n,e){if(!e)return n;const t=e.split(".");for(let i=0,s=t.length;it.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,i)=>gr(i.backgroundColor),this.hoverBorderColor=(t,i)=>gr(i.borderColor),this.hoverColor=(t,i)=>gr(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e)}set(e,t){return _r(this,e,t)}get(e){return ul(this,e)}describe(e,t){return _r(na,e,t)}override(e,t){return _r(fs,e,t)}route(e,t,i,s){const l=ul(this,e),o=ul(this,i),r="_"+t;Object.defineProperties(l,{[r]:{value:l[t],writable:!0},[t]:{enumerable:!0,get(){const a=this[r],u=o[s];return mt(a)?Object.assign({},u,a):vt(a,u)},set(a){this[r]=a}}})}}var kt=new My({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function Ty(n){return!n||Mt(n.size)||Mt(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function Oo(n,e,t,i,s){let l=e[s];return l||(l=e[s]=n.measureText(s).width,t.push(s)),l>i&&(i=l),i}function Dy(n,e,t,i){i=i||{};let s=i.data=i.data||{},l=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(s=i.data={},l=i.garbageCollect=[],i.font=e),n.save(),n.font=e;let o=0;const r=t.length;let a,u,f,c,d;for(a=0;at.length){for(a=0;a0&&n.stroke()}}function vl(n,e,t){return t=t||.5,!e||n&&n.x>e.left-t&&n.xe.top-t&&n.y0&&l.strokeColor!=="";let a,u;for(n.save(),n.font=s.string,Py(n,l),a=0;a+n||0;function qa(n,e){const t={},i=mt(e),s=i?Object.keys(e):e,l=mt(n)?i?o=>vt(n[o],n[e[o]]):o=>n[o]:()=>n;for(const o of s)t[o]=Ry(l(o));return t}function $_(n){return qa(n,{top:"y",right:"x",bottom:"y",left:"x"})}function Ss(n){return qa(n,["topLeft","topRight","bottomLeft","bottomRight"])}function Kn(n){const e=$_(n);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Ln(n,e){n=n||{},e=e||kt.font;let t=vt(n.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let i=vt(n.style,e.style);i&&!(""+i).match(Ny)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");const s={family:vt(n.family,e.family),lineHeight:Fy(vt(n.lineHeight,e.lineHeight),t),size:t,style:i,weight:vt(n.weight,e.weight),string:""};return s.string=Ty(s),s}function Ql(n,e,t,i){let s=!0,l,o,r;for(l=0,o=n.length;lt&&r===0?0:r+a;return{min:o(i,-Math.abs(l)),max:o(s,l)}}function zi(n,e){return Object.assign(Object.create(n),e)}function Va(n,e=[""],t=n,i,s=()=>n[0]){Yn(i)||(i=T_("_fallback",n));const l={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:t,_fallback:i,_getTarget:s,override:o=>Va([o,...n],e,t,i)};return new Proxy(l,{deleteProperty(o,r){return delete o[r],delete o._keys,delete n[0][r],!0},get(o,r){return C_(o,r,()=>Yy(r,e,n,o))},getOwnPropertyDescriptor(o,r){return Reflect.getOwnPropertyDescriptor(o._scopes[0],r)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(o,r){return bf(o).includes(r)},ownKeys(o){return bf(o)},set(o,r,a){const u=o._storage||(o._storage=s());return o[r]=u[r]=a,delete o._keys,!0}})}function Es(n,e,t,i){const s={_cacheable:!1,_proxy:n,_context:e,_subProxy:t,_stack:new Set,_descriptors:S_(n,i),setContext:l=>Es(n,l,t,i),override:l=>Es(n.override(l),e,t,i)};return new Proxy(s,{deleteProperty(l,o){return delete l[o],delete n[o],!0},get(l,o,r){return C_(l,o,()=>qy(l,o,r))},getOwnPropertyDescriptor(l,o){return l._descriptors.allKeys?Reflect.has(n,o)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(n,o)},getPrototypeOf(){return Reflect.getPrototypeOf(n)},has(l,o){return Reflect.has(n,o)},ownKeys(){return Reflect.ownKeys(n)},set(l,o,r){return n[o]=r,delete l[o],!0}})}function S_(n,e={scriptable:!0,indexable:!0}){const{_scriptable:t=e.scriptable,_indexable:i=e.indexable,_allKeys:s=e.allKeys}=n;return{allKeys:s,scriptable:t,indexable:i,isScriptable:qi(t)?t:()=>t,isIndexable:qi(i)?i:()=>i}}const jy=(n,e)=>n?n+Pa(e):e,za=(n,e)=>mt(e)&&n!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function C_(n,e,t){if(Object.prototype.hasOwnProperty.call(n,e))return n[e];const i=t();return n[e]=i,i}function qy(n,e,t){const{_proxy:i,_context:s,_subProxy:l,_descriptors:o}=n;let r=i[e];return qi(r)&&o.isScriptable(e)&&(r=Vy(e,r,n,t)),It(r)&&r.length&&(r=zy(e,r,n,o.isIndexable)),za(e,r)&&(r=Es(r,s,l&&l[e],o)),r}function Vy(n,e,t,i){const{_proxy:s,_context:l,_subProxy:o,_stack:r}=t;if(r.has(n))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+n);return r.add(n),e=e(l,o||i),r.delete(n),za(n,e)&&(e=Ba(s._scopes,s,n,e)),e}function zy(n,e,t,i){const{_proxy:s,_context:l,_subProxy:o,_descriptors:r}=t;if(Yn(l.index)&&i(n))e=e[l.index%e.length];else if(mt(e[0])){const a=e,u=s._scopes.filter(f=>f!==a);e=[];for(const f of a){const c=Ba(u,s,n,f);e.push(Es(c,l,o&&o[n],r))}}return e}function M_(n,e,t){return qi(n)?n(e,t):n}const By=(n,e)=>n===!0?e:typeof n=="string"?ji(e,n):void 0;function Uy(n,e,t,i,s){for(const l of e){const o=By(t,l);if(o){n.add(o);const r=M_(o._fallback,t,s);if(Yn(r)&&r!==t&&r!==i)return r}else if(o===!1&&Yn(i)&&t!==i)return null}return!1}function Ba(n,e,t,i){const s=e._rootScopes,l=M_(e._fallback,t,i),o=[...n,...s],r=new Set;r.add(i);let a=_f(r,o,t,l||t,i);return a===null||Yn(l)&&l!==t&&(a=_f(r,o,l,a,i),a===null)?!1:Va(Array.from(r),[""],s,l,()=>Wy(e,t,i))}function _f(n,e,t,i,s){for(;t;)t=Uy(n,e,t,i,s);return t}function Wy(n,e,t){const i=n._getTarget();e in i||(i[e]={});const s=i[e];return It(s)&&mt(t)?t:s}function Yy(n,e,t,i){let s;for(const l of e)if(s=T_(jy(l,n),t),Yn(s))return za(n,s)?Ba(t,i,n,s):s}function T_(n,e){for(const t of e){if(!t)continue;const i=t[n];if(Yn(i))return i}}function bf(n){let e=n._keys;return e||(e=n._keys=Ky(n._scopes)),e}function Ky(n){const e=new Set;for(const t of n)for(const i of Object.keys(t).filter(s=>!s.startsWith("_")))e.add(i);return Array.from(e)}function D_(n,e,t,i){const{iScale:s}=n,{key:l="r"}=this._parsing,o=new Array(i);let r,a,u,f;for(r=0,a=i;ren==="x"?"y":"x";function Zy(n,e,t,i){const s=n.skip?e:n,l=e,o=t.skip?e:t,r=ea(l,s),a=ea(o,l);let u=r/(r+a),f=a/(r+a);u=isNaN(u)?0:u,f=isNaN(f)?0:f;const c=i*u,d=i*f;return{previous:{x:l.x-c*(o.x-s.x),y:l.y-c*(o.y-s.y)},next:{x:l.x+d*(o.x-s.x),y:l.y+d*(o.y-s.y)}}}function Gy(n,e,t){const i=n.length;let s,l,o,r,a,u=As(n,0);for(let f=0;f!u.skip)),e.cubicInterpolationMode==="monotone")Qy(n,s);else{let u=i?n[n.length-1]:n[0];for(l=0,o=n.length;lwindow.getComputedStyle(n,null);function tk(n,e){return Qo(n).getPropertyValue(e)}const nk=["top","right","bottom","left"];function os(n,e,t){const i={};t=t?"-"+t:"";for(let s=0;s<4;s++){const l=nk[s];i[l]=parseFloat(n[e+"-"+l+t])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const ik=(n,e,t)=>(n>0||e>0)&&(!t||!t.shadowRoot);function sk(n,e){const t=n.touches,i=t&&t.length?t[0]:n,{offsetX:s,offsetY:l}=i;let o=!1,r,a;if(ik(s,l,n.target))r=s,a=l;else{const u=e.getBoundingClientRect();r=i.clientX-u.left,a=i.clientY-u.top,o=!0}return{x:r,y:a,box:o}}function Qi(n,e){if("native"in n)return n;const{canvas:t,currentDevicePixelRatio:i}=e,s=Qo(t),l=s.boxSizing==="border-box",o=os(s,"padding"),r=os(s,"border","width"),{x:a,y:u,box:f}=sk(n,t),c=o.left+(f&&r.left),d=o.top+(f&&r.top);let{width:h,height:g}=e;return l&&(h-=o.width+r.width,g-=o.height+r.height),{x:Math.round((a-c)/h*t.width/i),y:Math.round((u-d)/g*t.height/i)}}function lk(n,e,t){let i,s;if(e===void 0||t===void 0){const l=Ua(n);if(!l)e=n.clientWidth,t=n.clientHeight;else{const o=l.getBoundingClientRect(),r=Qo(l),a=os(r,"border","width"),u=os(r,"padding");e=o.width-u.width-a.width,t=o.height-u.height-a.height,i=Po(r.maxWidth,l,"clientWidth"),s=Po(r.maxHeight,l,"clientHeight")}}return{width:e,height:t,maxWidth:i||To,maxHeight:s||To}}const br=n=>Math.round(n*10)/10;function ok(n,e,t,i){const s=Qo(n),l=os(s,"margin"),o=Po(s.maxWidth,n,"clientWidth")||To,r=Po(s.maxHeight,n,"clientHeight")||To,a=lk(n,e,t);let{width:u,height:f}=a;if(s.boxSizing==="content-box"){const c=os(s,"border","width"),d=os(s,"padding");u-=d.width+c.width,f-=d.height+c.height}return u=Math.max(0,u-l.width),f=Math.max(0,i?Math.floor(u/i):f-l.height),u=br(Math.min(u,o,a.maxWidth)),f=br(Math.min(f,r,a.maxHeight)),u&&!f&&(f=br(u/2)),{width:u,height:f}}function vf(n,e,t){const i=e||1,s=Math.floor(n.height*i),l=Math.floor(n.width*i);n.height=s/i,n.width=l/i;const o=n.canvas;return o.style&&(t||!o.style.height&&!o.style.width)&&(o.style.height=`${n.height}px`,o.style.width=`${n.width}px`),n.currentDevicePixelRatio!==i||o.height!==s||o.width!==l?(n.currentDevicePixelRatio=i,o.height=s,o.width=l,n.ctx.setTransform(i,0,0,i,0,0),!0):!1}const rk=function(){let n=!1;try{const e={get passive(){return n=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch{}return n}();function yf(n,e){const t=tk(n,e),i=t&&t.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function xi(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:n.y+t*(e.y-n.y)}}function ak(n,e,t,i){return{x:n.x+t*(e.x-n.x),y:i==="middle"?t<.5?n.y:e.y:i==="after"?t<1?n.y:e.y:t>0?e.y:n.y}}function uk(n,e,t,i){const s={x:n.cp2x,y:n.cp2y},l={x:e.cp1x,y:e.cp1y},o=xi(n,s,t),r=xi(s,l,t),a=xi(l,e,t),u=xi(o,r,t),f=xi(r,a,t);return xi(u,f,t)}const kf=new Map;function fk(n,e){e=e||{};const t=n+JSON.stringify(e);let i=kf.get(t);return i||(i=new Intl.NumberFormat(n,e),kf.set(t,i)),i}function El(n,e,t){return fk(e,t).format(n)}const ck=function(n,e){return{x(t){return n+n+e-t},setWidth(t){e=t},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,i){return t-i},leftForLtr(t,i){return t-i}}},dk=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,e){return n+e},leftForLtr(n,e){return n}}};function vr(n,e,t){return n?ck(e,t):dk()}function pk(n,e){let t,i;(e==="ltr"||e==="rtl")&&(t=n.canvas.style,i=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",e,"important"),n.prevTextDirection=i)}function hk(n,e){e!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",e[0],e[1]))}function A_(n){return n==="angle"?{between:_l,compare:Xv,normalize:Pn}:{between:bl,compare:(e,t)=>e-t,normalize:e=>e}}function wf({start:n,end:e,count:t,loop:i,style:s}){return{start:n%t,end:e%t,loop:i&&(e-n+1)%t===0,style:s}}function mk(n,e,t){const{property:i,start:s,end:l}=t,{between:o,normalize:r}=A_(i),a=e.length;let{start:u,end:f,loop:c}=n,d,h;if(c){for(u+=a,f+=a,d=0,h=a;da(s,C,y)&&r(s,C)!==0,T=()=>r(l,y)===0||a(l,C,y),M=()=>v||S(),O=()=>!v||T();for(let E=f,P=f;E<=c;++E)$=e[E%o],!$.skip&&(y=u($[i]),y!==C&&(v=a(y,s,l),b===null&&M()&&(b=r(y,s)===0?E:P),b!==null&&O()&&(g.push(wf({start:b,end:E,loop:d,count:o,style:h})),b=null),P=E,C=y));return b!==null&&g.push(wf({start:b,end:c,loop:d,count:o,style:h})),g}function L_(n,e){const t=[],i=n.segments;for(let s=0;ss&&n[l%e].skip;)l--;return l%=e,{start:s,end:l}}function _k(n,e,t,i){const s=n.length,l=[];let o=e,r=n[e],a;for(a=e+1;a<=t;++a){const u=n[a%s];u.skip||u.stop?r.skip||(i=!1,l.push({start:e%s,end:(a-1)%s,loop:i}),e=o=u.stop?a:null):(o=a,r.skip&&(e=a)),r=u}return o!==null&&l.push({start:e%s,end:o%s,loop:i}),l}function bk(n,e){const t=n.points,i=n.options.spanGaps,s=t.length;if(!s)return[];const l=!!n._loop,{start:o,end:r}=gk(t,s,l,i);if(i===!0)return $f(n,[{start:o,end:r,loop:l}],t,e);const a=rr({chart:e,initial:t.initial,numSteps:o,currentStep:Math.min(i-t.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=h_.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const l=i.items;let o=l.length-1,r=!1,a;for(;o>=0;--o)a=l[o],a._active?(a._total>i.duration&&(i.duration=a._total),a.tick(e),r=!0):(l[o]=l[l.length-1],l.pop());r&&(s.draw(),this._notify(s,i,e,"progress")),l.length||(i.running=!1,this._notify(s,i,e,"complete"),i.initial=!1),t+=l.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){const t=this._charts;let i=t.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,i)),i}listen(e,t,i){this._getAnims(e).listeners[t].push(i)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){const t=this._charts.get(e);!t||(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(e){if(!this._running)return!1;const t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){const t=this._charts.get(e);if(!t||!t.items.length)return;const i=t.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var bi=new kk;const Cf="transparent",wk={boolean(n,e,t){return t>.5?e:n},color(n,e,t){const i=mf(n||Cf),s=i.valid&&mf(e||Cf);return s&&s.valid?s.mix(i,t).hexString():e},number(n,e,t){return n+(e-n)*t}};class $k{constructor(e,t,i,s){const l=t[i];s=Ql([e.to,s,l,e.from]);const o=Ql([e.from,l,s]);this._active=!0,this._fn=e.fn||wk[e.type||typeof o],this._easing=al[e.easing]||al.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(e,t,i){if(this._active){this._notify(!1);const s=this._target[this._prop],l=i-this._start,o=this._duration-l;this._start=i,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=l,this._loop=!!e.loop,this._to=Ql([e.to,t,s,e.from]),this._from=Ql([e.from,s,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const t=e-this._start,i=this._duration,s=this._prop,l=this._from,o=this._loop,r=this._to;let a;if(this._active=l!==r&&(o||t1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[s]=this._fn(l,r,a)}wait(){const e=this._promises||(this._promises=[]);return new Promise((t,i)=>{e.push({res:t,rej:i})})}_notify(e){const t=e?"res":"rej",i=this._promises||[];for(let s=0;sn!=="onProgress"&&n!=="onComplete"&&n!=="fn"});kt.set("animations",{colors:{type:"color",properties:Ck},numbers:{type:"number",properties:Sk}});kt.describe("animations",{_fallback:"animation"});kt.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:n=>n|0}}}});class I_{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!mt(e))return;const t=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!mt(s))return;const l={};for(const o of Mk)l[o]=s[o];(It(s.properties)&&s.properties||[i]).forEach(o=>{(o===i||!t.has(o))&&t.set(o,l)})})}_animateOptions(e,t){const i=t.options,s=Dk(e,i);if(!s)return[];const l=this._createAnimations(s,i);return i.$shared&&Tk(e.options.$animations,i).then(()=>{e.options=i},()=>{}),l}_createAnimations(e,t){const i=this._properties,s=[],l=e.$animations||(e.$animations={}),o=Object.keys(t),r=Date.now();let a;for(a=o.length-1;a>=0;--a){const u=o[a];if(u.charAt(0)==="$")continue;if(u==="options"){s.push(...this._animateOptions(e,t));continue}const f=t[u];let c=l[u];const d=i.get(u);if(c)if(d&&c.active()){c.update(d,f,r);continue}else c.cancel();if(!d||!d.duration){e[u]=f;continue}l[u]=c=new $k(d,e,u,f),s.push(c)}return s}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}const i=this._createAnimations(e,t);if(i.length)return bi.add(this._chart,i),!0}}function Tk(n,e){const t=[],i=Object.keys(e);for(let s=0;s0||!t&&l<0)return s.index}return null}function Ef(n,e){const{chart:t,_cachedMeta:i}=n,s=t._stacks||(t._stacks={}),{iScale:l,vScale:o,index:r}=i,a=l.axis,u=o.axis,f=Pk(l,o,i),c=e.length;let d;for(let h=0;ht[i].axis===e).shift()}function Nk(n,e){return zi(n,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Fk(n,e,t){return zi(n,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function Ys(n,e){const t=n.controller.index,i=n.vScale&&n.vScale.axis;if(!!i){e=e||n._parsed;for(const s of e){const l=s._stacks;if(!l||l[i]===void 0||l[i][t]===void 0)return;delete l[i][t]}}}const kr=n=>n==="reset"||n==="none",Af=(n,e)=>e?n:Object.assign({},n),Rk=(n,e,t)=>n&&!e.hidden&&e._stacked&&{keys:N_(t,!0),values:null};class ai{constructor(e,t){this.chart=e,this._ctx=e.ctx,this.index=t,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Df(e.vScale,e),this.addElements()}updateIndex(e){this.index!==e&&Ys(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,t=this._cachedMeta,i=this.getDataset(),s=(c,d,h,g)=>c==="x"?d:c==="r"?g:h,l=t.xAxisID=vt(i.xAxisID,yr(e,"x")),o=t.yAxisID=vt(i.yAxisID,yr(e,"y")),r=t.rAxisID=vt(i.rAxisID,yr(e,"r")),a=t.indexAxis,u=t.iAxisID=s(a,l,o,r),f=t.vAxisID=s(a,o,l,r);t.xScale=this.getScaleForId(l),t.yScale=this.getScaleForId(o),t.rScale=this.getScaleForId(r),t.iScale=this.getScaleForId(u),t.vScale=this.getScaleForId(f)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const t=this._cachedMeta;return e===t.iScale?t.vScale:t.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&rf(this._data,this),e._stacked&&Ys(e)}_dataCheck(){const e=this.getDataset(),t=e.data||(e.data=[]),i=this._data;if(mt(t))this._data=Ak(t);else if(i!==t){if(i){rf(i,this);const s=this._cachedMeta;Ys(s),s._parsed=[]}t&&Object.isExtensible(t)&&ty(t,this),this._syncList=[],this._data=t}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const t=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const l=t._stacked;t._stacked=Df(t.vScale,t),t.stack!==i.stack&&(s=!0,Ys(t),t.stack=i.stack),this._resyncElements(e),(s||l!==t._stacked)&&Ef(this,t._parsed)}configure(){const e=this.chart.config,t=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),t,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,t){const{_cachedMeta:i,_data:s}=this,{iScale:l,_stacked:o}=i,r=l.axis;let a=e===0&&t===s.length?!0:i._sorted,u=e>0&&i._parsed[e-1],f,c,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{It(s[e])?d=this.parseArrayData(i,s,e,t):mt(s[e])?d=this.parseObjectData(i,s,e,t):d=this.parsePrimitiveData(i,s,e,t);const h=()=>c[r]===null||u&&c[r]v||c=0;--d)if(!g()){this.updateRangeFromParsed(u,e,h,a);break}}return u}getAllParsedValues(e){const t=this._cachedMeta._parsed,i=[];let s,l,o;for(s=0,l=t.length;s=0&&ethis.getContext(i,s),v=u.resolveNamedOptions(d,h,g,c);return v.$shared&&(v.$shared=a,l[o]=Object.freeze(Af(v,a))),v}_resolveAnimations(e,t,i){const s=this.chart,l=this._cachedDataOpts,o=`animation-${t}`,r=l[o];if(r)return r;let a;if(s.options.animation!==!1){const f=this.chart.config,c=f.datasetAnimationScopeKeys(this._type,t),d=f.getOptionScopes(this.getDataset(),c);a=f.createResolver(d,this.getContext(e,i,t))}const u=new I_(s,a&&a.animations);return a&&a._cacheable&&(l[o]=Object.freeze(u)),u}getSharedOptions(e){if(!!e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,t){return!t||kr(e)||this.chart._animationsDisabled}_getSharedOptions(e,t){const i=this.resolveDataElementOptions(e,t),s=this._sharedOptions,l=this.getSharedOptions(i),o=this.includeOptions(t,l)||l!==s;return this.updateSharedOptions(l,t,i),{sharedOptions:l,includeOptions:o}}updateElement(e,t,i,s){kr(s)?Object.assign(e,i):this._resolveAnimations(t,s).update(e,i)}updateSharedOptions(e,t,i){e&&!kr(t)&&this._resolveAnimations(void 0,t).update(e,i)}_setStyle(e,t,i,s){e.active=s;const l=this.getStyle(t,s);this._resolveAnimations(t,i,s).update(e,{options:!s&&this.getSharedOptions(l)||l})}removeHoverStyle(e,t,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,t,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const t=this._data,i=this._cachedMeta.data;for(const[r,a,u]of this._syncList)this[r](a,u);this._syncList=[];const s=i.length,l=t.length,o=Math.min(l,s);o&&this.parse(0,o),l>s?this._insertElements(s,l-s,e):l{for(u.length+=t,r=u.length-1;r>=o;r--)u[r]=u[r-t]};for(a(l),r=e;rs-l))}return n._cache.$bar}function jk(n){const e=n.iScale,t=Hk(e,n.type);let i=e._length,s,l,o,r;const a=()=>{o===32767||o===-32768||(Yn(r)&&(i=Math.min(i,Math.abs(o-r)||i)),r=o)};for(s=0,l=t.length;s0?s[n-1]:null,r=nMath.abs(r)&&(a=r,u=o),e[t.axis]=u,e._custom={barStart:a,barEnd:u,start:s,end:l,min:o,max:r}}function F_(n,e,t,i){return It(n)?zk(n,e,t,i):e[t.axis]=t.parse(n,i),e}function Pf(n,e,t,i){const s=n.iScale,l=n.vScale,o=s.getLabels(),r=s===l,a=[];let u,f,c,d;for(u=t,f=t+i;u=t?1:-1)}function Uk(n){let e,t,i,s,l;return n.horizontal?(e=n.base>n.x,t="left",i="right"):(e=n.basea.controller.options.grouped),l=i.options.stacked,o=[],r=a=>{const u=a.controller.getParsed(t),f=u&&u[a.vScale.axis];if(Mt(f)||isNaN(f))return!0};for(const a of s)if(!(t!==void 0&&r(a))&&((l===!1||o.indexOf(a.stack)===-1||l===void 0&&a.stack===void 0)&&o.push(a.stack),a.index===e))break;return o.length||o.push(void 0),o}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,t,i){const s=this._getStacks(e,i),l=t!==void 0?s.indexOf(t):-1;return l===-1?s.length-1:l}_getRuler(){const e=this.options,t=this._cachedMeta,i=t.iScale,s=[];let l,o;for(l=0,o=t.data.length;l=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}getLabelAndValue(e){const t=this._cachedMeta,{xScale:i,yScale:s}=t,l=this.getParsed(e),o=i.getLabelForValue(l.x),r=s.getLabelForValue(l.y),a=l._custom;return{label:t.label,value:"("+o+", "+r+(a?", "+a:"")+")"}}update(e){const t=this._cachedMeta.data;this.updateElements(t,0,t.length,e)}updateElements(e,t,i,s){const l=s==="reset",{iScale:o,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:u}=this._getSharedOptions(t,s),f=o.axis,c=r.axis;for(let d=t;d_l(C,r,a,!0)?1:Math.max(S,S*t,T,T*t),g=(C,S,T)=>_l(C,r,a,!0)?-1:Math.min(S,S*t,T,T*t),v=h(0,u,c),b=h(zt,f,d),y=g(Wt,u,c),$=g(Wt+zt,f,d);i=(v-y)/2,s=(b-$)/2,l=-(v+y)/2,o=-(b+$)/2}return{ratioX:i,ratioY:s,offsetX:l,offsetY:o}}class Al extends ai{constructor(e,t){super(e,t),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,t){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let l=a=>+i[a];if(mt(i[e])){const{key:a="value"}=this._parsing;l=u=>+ji(i[u],a)}let o,r;for(o=e,r=e+t;o0&&!isNaN(e)?At*(Math.abs(e)/t):0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,s=i.data.labels||[],l=El(t._parsed[e],i.options.locale);return{label:s[e]||"",value:l}}getMaxBorderWidth(e){let t=0;const i=this.chart;let s,l,o,r,a;if(!e){for(s=0,l=i.data.datasets.length;sn!=="spacing",_indexable:n=>n!=="spacing"};Al.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const e=n.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:t}}=n.legend.options;return e.labels.map((i,s)=>{const o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:t,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,e,t){t.chart.toggleDataVisibility(e.index),t.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){let e=n.label;const t=": "+n.formattedValue;return It(e)?(e=e.slice(),e[0]+=t):e+=t,e}}}}};class xo extends ai{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const t=this._cachedMeta,{dataset:i,data:s=[],_dataset:l}=t,o=this.chart._animationsDisabled;let{start:r,count:a}=g_(t,s,o);this._drawStart=r,this._drawCount=a,__(t)&&(r=0,a=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!l._decimated,i.points=s;const u=this.resolveDatasetElementOptions(e);this.options.showLine||(u.borderWidth=0),u.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:u},e),this.updateElements(s,r,a,e)}updateElements(e,t,i,s){const l=s==="reset",{iScale:o,vScale:r,_stacked:a,_dataset:u}=this._cachedMeta,{sharedOptions:f,includeOptions:c}=this._getSharedOptions(t,s),d=o.axis,h=r.axis,{spanGaps:g,segment:v}=this.options,b=Os(g)?g:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||l||s==="none";let $=t>0&&this.getParsed(t-1);for(let C=t;C0&&Math.abs(T[d]-$[d])>b,v&&(M.parsed=T,M.raw=u.data[C]),c&&(M.options=f||this.resolveDataElementOptions(C,S.active?"active":s)),y||this.updateElement(S,C,M,s),$=T}}getMaxOverflow(){const e=this._cachedMeta,t=e.dataset,i=t.options&&t.options.borderWidth||0,s=e.data||[];if(!s.length)return i;const l=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,l,o)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}xo.id="line";xo.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};xo.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Ka extends ai{constructor(e,t){super(e,t),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){const t=this._cachedMeta,i=this.chart,s=i.data.labels||[],l=El(t._parsed[e].r,i.options.locale);return{label:s[e]||"",value:l}}parseObjectData(e,t,i,s){return D_.bind(this)(e,t,i,s)}update(e){const t=this._cachedMeta.data;this._updateRadius(),this.updateElements(t,0,t.length,e)}getMinMax(){const e=this._cachedMeta,t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return e.data.forEach((i,s)=>{const l=this.getParsed(s).r;!isNaN(l)&&this.chart.getDataVisibility(s)&&(lt.max&&(t.max=l))}),t}_updateRadius(){const e=this.chart,t=e.chartArea,i=e.options,s=Math.min(t.right-t.left,t.bottom-t.top),l=Math.max(s/2,0),o=Math.max(i.cutoutPercentage?l/100*i.cutoutPercentage:1,0),r=(l-o)/e.getVisibleDatasetCount();this.outerRadius=l-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(e,t,i,s){const l=s==="reset",o=this.chart,a=o.options.animation,u=this._cachedMeta.rScale,f=u.xCenter,c=u.yCenter,d=u.getIndexAngle(0)-.5*Wt;let h=d,g;const v=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&t++}),t}_computeAngle(e,t,i){return this.chart.getDataVisibility(e)?ei(this.resolveDataElementOptions(e,t).angle||i):0}}Ka.id="polarArea";Ka.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};Ka.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(n){const e=n.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:t}}=n.legend.options;return e.labels.map((i,s)=>{const o=n.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,lineWidth:o.borderWidth,pointStyle:t,hidden:!n.getDataVisibility(s),index:s}})}return[]}},onClick(n,e,t){t.chart.toggleDataVisibility(e.index),t.chart.update()}},tooltip:{callbacks:{title(){return""},label(n){return n.chart.data.labels[n.dataIndex]+": "+n.formattedValue}}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class R_ extends Al{}R_.id="pie";R_.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Ja extends ai{getLabelAndValue(e){const t=this._cachedMeta.vScale,i=this.getParsed(e);return{label:t.getLabels()[e],value:""+t.getLabelForValue(i[t.axis])}}parseObjectData(e,t,i,s){return D_.bind(this)(e,t,i,s)}update(e){const t=this._cachedMeta,i=t.dataset,s=t.data||[],l=t.iScale.getLabels();if(i.points=s,e!=="resize"){const o=this.resolveDatasetElementOptions(e);this.options.showLine||(o.borderWidth=0);const r={_loop:!0,_fullLoop:l.length===s.length,options:o};this.updateElement(i,void 0,r,e)}this.updateElements(s,0,s.length,e)}updateElements(e,t,i,s){const l=this._cachedMeta.rScale,o=s==="reset";for(let r=t;r{s[l]=i[l]&&i[l].active()?i[l]._to:this[l]}),s}}Mi.defaults={};Mi.defaultRoutes=void 0;const H_={values(n){return It(n)?n:""+n},numeric(n,e,t){if(n===0)return"0";const i=this.chart.options.locale;let s,l=n;if(t.length>1){const u=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(u<1e-4||u>1e15)&&(s="scientific"),l=Zk(n,t)}const o=Bn(Math.abs(l)),r=Math.max(Math.min(-1*Math.floor(o),20),0),a={notation:s,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(a,this.options.ticks.format),El(n,i,a)},logarithmic(n,e,t){if(n===0)return"0";const i=n/Math.pow(10,Math.floor(Bn(n)));return i===1||i===2||i===5?H_.numeric.call(this,n,e,t):""}};function Zk(n,e){let t=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(t)>=1&&n!==Math.floor(n)&&(t=n-Math.floor(n)),t}var er={formatters:H_};kt.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(n,e)=>e.lineWidth,tickColor:(n,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:er.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}});kt.route("scale.ticks","color","","color");kt.route("scale.grid","color","","borderColor");kt.route("scale.grid","borderColor","","borderColor");kt.route("scale.title","color","","color");kt.describe("scale",{_fallback:!1,_scriptable:n=>!n.startsWith("before")&&!n.startsWith("after")&&n!=="callback"&&n!=="parser",_indexable:n=>n!=="borderDash"&&n!=="tickBorderDash"});kt.describe("scales",{_fallback:"scale"});kt.describe("scale.ticks",{_scriptable:n=>n!=="backdropPadding"&&n!=="callback",_indexable:n=>n!=="backdropPadding"});function Gk(n,e){const t=n.options.ticks,i=t.maxTicksLimit||Xk(n),s=t.major.enabled?xk(e):[],l=s.length,o=s[0],r=s[l-1],a=[];if(l>i)return e2(e,a,s,l/i),a;const u=Qk(s,e,i);if(l>0){let f,c;const d=l>1?Math.round((r-o)/(l-1)):null;for(eo(e,a,u,Mt(d)?0:o-d,o),f=0,c=l-1;fs)return a}return Math.max(s,1)}function xk(n){const e=[];let t,i;for(t=0,i=n.length;tn==="left"?"right":n==="right"?"left":n,Nf=(n,e,t)=>e==="top"||e==="left"?n[e]+t:n[e]-t;function Ff(n,e){const t=[],i=n.length/e,s=n.length;let l=0;for(;lo+r)))return a}function s2(n,e){Et(n,t=>{const i=t.gc,s=i.length/2;let l;if(s>e){for(l=0;li?i:t,i=s&&t>i?t:i,{min:Hn(t,Hn(i,t)),max:Hn(i,Hn(t,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Vt(this.options.beforeUpdate,[this])}update(e,t,i){const{beginAtZero:s,grace:l,ticks:o}=this.options,r=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Hy(this,l,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r=l||i<=1||!this.isHorizontal()){this.labelRotation=s;return}const f=this._getLabelSizes(),c=f.widest.width,d=f.highest.height,h=cn(this.chart.width-c,0,this.maxWidth);r=e.offset?this.maxWidth/i:h/(i-1),c+6>r&&(r=h/(i-(e.offset?.5:1)),a=this.maxHeight-Ks(e.grid)-t.padding-Rf(e.title,this.chart.options.font),u=Math.sqrt(c*c+d*d),o=La(Math.min(Math.asin(cn((f.highest.height+6)/r,-1,1)),Math.asin(cn(a/u,-1,1))-Math.asin(cn(d/u,-1,1)))),o=Math.max(s,Math.min(l,o))),this.labelRotation=o}afterCalculateLabelRotation(){Vt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Vt(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:t,options:{ticks:i,title:s,grid:l}}=this,o=this._isVisible(),r=this.isHorizontal();if(o){const a=Rf(s,t.options.font);if(r?(e.width=this.maxWidth,e.height=Ks(l)+a):(e.height=this.maxHeight,e.width=Ks(l)+a),i.display&&this.ticks.length){const{first:u,last:f,widest:c,highest:d}=this._getLabelSizes(),h=i.padding*2,g=ei(this.labelRotation),v=Math.cos(g),b=Math.sin(g);if(r){const y=i.mirror?0:b*c.width+v*d.height;e.height=Math.min(this.maxHeight,e.height+y+h)}else{const y=i.mirror?0:v*c.width+b*d.height;e.width=Math.min(this.maxWidth,e.width+y+h)}this._calculatePadding(u,f,b,v)}}this._handleMargins(),r?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,i,s){const{ticks:{align:l,padding:o},position:r}=this.options,a=this.labelRotation!==0,u=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const f=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,h=0;a?u?(d=s*e.width,h=i*t.height):(d=i*e.height,h=s*t.width):l==="start"?h=t.width:l==="end"?d=e.width:l!=="inner"&&(d=e.width/2,h=t.width/2),this.paddingLeft=Math.max((d-f+o)*this.width/(this.width-f),0),this.paddingRight=Math.max((h-c+o)*this.width/(this.width-c),0)}else{let f=t.height/2,c=e.height/2;l==="start"?(f=0,c=e.height):l==="end"&&(f=t.height,c=0),this.paddingTop=f+o,this.paddingBottom=c+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){Vt(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:t}=this.options;return t==="top"||t==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,i;for(t=0,i=e.length;t({width:l[O]||0,height:o[O]||0});return{first:M(0),last:M(t-1),widest:M(S),highest:M(T),widths:l,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){const t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const t=this._startPixel+e*this._length;return Qv(this._alignToPixels?Ji(this.chart,t,0):t)}getDecimalForPixel(e){const t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){const t=this.ticks||[];if(e>=0&&er*s?r/i:a/s:a*s0}_computeGridLineItems(e){const t=this.axis,i=this.chart,s=this.options,{grid:l,position:o}=s,r=l.offset,a=this.isHorizontal(),f=this.ticks.length+(r?1:0),c=Ks(l),d=[],h=l.setContext(this.getContext()),g=h.drawBorder?h.borderWidth:0,v=g/2,b=function(Z){return Ji(i,Z,g)};let y,$,C,S,T,M,O,E,P,I,F,V;if(o==="top")y=b(this.bottom),M=this.bottom-c,E=y-v,I=b(e.top)+v,V=e.bottom;else if(o==="bottom")y=b(this.top),I=e.top,V=b(e.bottom)-v,M=y+v,E=this.top+c;else if(o==="left")y=b(this.right),T=this.right-c,O=y-v,P=b(e.left)+v,F=e.right;else if(o==="right")y=b(this.left),P=e.left,F=b(e.right)-v,T=y+v,O=this.left+c;else if(t==="x"){if(o==="center")y=b((e.top+e.bottom)/2+.5);else if(mt(o)){const Z=Object.keys(o)[0],ee=o[Z];y=b(this.chart.scales[Z].getPixelForValue(ee))}I=e.top,V=e.bottom,M=y+v,E=M+c}else if(t==="y"){if(o==="center")y=b((e.left+e.right)/2);else if(mt(o)){const Z=Object.keys(o)[0],ee=o[Z];y=b(this.chart.scales[Z].getPixelForValue(ee))}T=y-v,O=T-c,P=e.left,F=e.right}const X=vt(s.ticks.maxTicksLimit,f),te=Math.max(1,Math.ceil(f/X));for($=0;$l.value===e);return s>=0?t.setContext(this.getContext(s)).lineWidth:0}drawGrid(e){const t=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let l,o;const r=(a,u,f)=>{!f.width||!f.color||(i.save(),i.lineWidth=f.width,i.strokeStyle=f.color,i.setLineDash(f.borderDash||[]),i.lineDashOffset=f.borderDashOffset,i.beginPath(),i.moveTo(a.x,a.y),i.lineTo(u.x,u.y),i.stroke(),i.restore())};if(t.display)for(l=0,o=s.length;l{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:t,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(e){const t=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let l,o;for(l=0,o=t.length;l{const i=t.split("."),s=i.pop(),l=[n].concat(i).join("."),o=e[t].split("."),r=o.pop(),a=o.join(".");kt.route(l,s,a,r)})}function c2(n){return"id"in n&&"defaults"in n}class d2{constructor(){this.controllers=new to(ai,"datasets",!0),this.elements=new to(Mi,"elements"),this.plugins=new to(Object,"plugins"),this.scales=new to(ds,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,i){[...t].forEach(s=>{const l=i||this._getRegistryForType(s);i||l.isForType(s)||l===this.plugins&&s.id?this._exec(e,l,s):Et(s,o=>{const r=i||this._getRegistryForType(o);this._exec(e,r,o)})})}_exec(e,t,i){const s=Pa(e);Vt(i["before"+s],[],i),t[e](i),Vt(i["after"+s],[],i)}_getRegistryForType(e){for(let t=0;t0&&this.getParsed(t-1);for(let S=t;S0&&Math.abs(M[h]-C[h])>y,b&&(O.parsed=M,O.raw=u.data[S]),d&&(O.options=c||this.resolveDataElementOptions(S,T.active?"active":s)),$||this.updateElement(T,S,O,s),C=M}this.updateSharedOptions(c,s,f)}getMaxOverflow(){const e=this._cachedMeta,t=e.data||[];if(!this.options.showLine){let r=0;for(let a=t.length-1;a>=0;--a)r=Math.max(r,t[a].size(this.resolveDataElementOptions(a))/2);return r>0&&r}const i=e.dataset,s=i.options&&i.options.borderWidth||0;if(!t.length)return s;const l=t[0].size(this.resolveDataElementOptions(0)),o=t[t.length-1].size(this.resolveDataElementOptions(t.length-1));return Math.max(s,l,o)/2}}Za.id="scatter";Za.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};Za.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(n){return"("+n.label+", "+n.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};function Zi(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class sa{constructor(e){this.options=e||{}}init(e){}formats(){return Zi()}parse(e,t){return Zi()}format(e,t){return Zi()}add(e,t,i){return Zi()}diff(e,t,i){return Zi()}startOf(e,t,i){return Zi()}endOf(e,t){return Zi()}}sa.override=function(n){Object.assign(sa.prototype,n)};var j_={_date:sa};function p2(n,e,t,i){const{controller:s,data:l,_sorted:o}=n,r=s._cachedMeta.iScale;if(r&&e===r.axis&&e!=="r"&&o&&l.length){const a=r._reversePixels?xv:ts;if(i){if(s._sharedOptions){const u=l[0],f=typeof u.getRange=="function"&&u.getRange(e);if(f){const c=a(l,e,t-f),d=a(l,e,t+f);return{lo:c.lo,hi:d.hi}}}}else return a(l,e,t)}return{lo:0,hi:l.length-1}}function Pl(n,e,t,i,s){const l=n.getSortedVisibleDatasetMetas(),o=t[e];for(let r=0,a=l.length;r{a[o](e[t],s)&&(l.push({element:a,datasetIndex:u,index:f}),r=r||a.inRange(e.x,e.y,s))}),i&&!r?[]:l}var _2={evaluateInteractionItems:Pl,modes:{index(n,e,t,i){const s=Qi(e,n),l=t.axis||"x",o=t.includeInvisible||!1,r=t.intersect?$r(n,s,l,i,o):Sr(n,s,l,!1,i,o),a=[];return r.length?(n.getSortedVisibleDatasetMetas().forEach(u=>{const f=r[0].index,c=u.data[f];c&&!c.skip&&a.push({element:c,datasetIndex:u.index,index:f})}),a):[]},dataset(n,e,t,i){const s=Qi(e,n),l=t.axis||"xy",o=t.includeInvisible||!1;let r=t.intersect?$r(n,s,l,i,o):Sr(n,s,l,!1,i,o);if(r.length>0){const a=r[0].datasetIndex,u=n.getDatasetMeta(a).data;r=[];for(let f=0;ft.pos===e)}function jf(n,e){return n.filter(t=>q_.indexOf(t.pos)===-1&&t.box.axis===e)}function Zs(n,e){return n.sort((t,i)=>{const s=e?i:t,l=e?t:i;return s.weight===l.weight?s.index-l.index:s.weight-l.weight})}function b2(n){const e=[];let t,i,s,l,o,r;for(t=0,i=(n||[]).length;tu.box.fullSize),!0),i=Zs(Js(e,"left"),!0),s=Zs(Js(e,"right")),l=Zs(Js(e,"top"),!0),o=Zs(Js(e,"bottom")),r=jf(e,"x"),a=jf(e,"y");return{fullSize:t,leftAndTop:i.concat(l),rightAndBottom:s.concat(a).concat(o).concat(r),chartArea:Js(e,"chartArea"),vertical:i.concat(s).concat(a),horizontal:l.concat(o).concat(r)}}function qf(n,e,t,i){return Math.max(n[t],e[t])+Math.max(n[i],e[i])}function V_(n,e){n.top=Math.max(n.top,e.top),n.left=Math.max(n.left,e.left),n.bottom=Math.max(n.bottom,e.bottom),n.right=Math.max(n.right,e.right)}function w2(n,e,t,i){const{pos:s,box:l}=t,o=n.maxPadding;if(!mt(s)){t.size&&(n[s]-=t.size);const c=i[t.stack]||{size:0,count:1};c.size=Math.max(c.size,t.horizontal?l.height:l.width),t.size=c.size/c.count,n[s]+=t.size}l.getPadding&&V_(o,l.getPadding());const r=Math.max(0,e.outerWidth-qf(o,n,"left","right")),a=Math.max(0,e.outerHeight-qf(o,n,"top","bottom")),u=r!==n.w,f=a!==n.h;return n.w=r,n.h=a,t.horizontal?{same:u,other:f}:{same:f,other:u}}function $2(n){const e=n.maxPadding;function t(i){const s=Math.max(e[i]-n[i],0);return n[i]+=s,s}n.y+=t("top"),n.x+=t("left"),t("right"),t("bottom")}function S2(n,e){const t=e.maxPadding;function i(s){const l={left:0,top:0,right:0,bottom:0};return s.forEach(o=>{l[o]=Math.max(e[o],t[o])}),l}return i(n?["left","right"]:["top","bottom"])}function nl(n,e,t,i){const s=[];let l,o,r,a,u,f;for(l=0,o=n.length,u=0;l{typeof v.beforeLayout=="function"&&v.beforeLayout()});const f=a.reduce((v,b)=>b.box.options&&b.box.options.display===!1?v:v+1,0)||1,c=Object.freeze({outerWidth:e,outerHeight:t,padding:s,availableWidth:l,availableHeight:o,vBoxMaxWidth:l/2/f,hBoxMaxHeight:o/2}),d=Object.assign({},s);V_(d,Kn(i));const h=Object.assign({maxPadding:d,w:l,h:o,x:s.left,y:s.top},s),g=y2(a.concat(u),c);nl(r.fullSize,h,c,g),nl(a,h,c,g),nl(u,h,c,g)&&nl(a,h,c,g),$2(h),Vf(r.leftAndTop,h,c,g),h.x+=h.w,h.y+=h.h,Vf(r.rightAndBottom,h,c,g),n.chartArea={left:h.left,top:h.top,right:h.left+h.w,bottom:h.top+h.h,height:h.h,width:h.w},Et(r.chartArea,v=>{const b=v.box;Object.assign(b,n.chartArea),b.update(h.w,h.h,{left:0,top:0,right:0,bottom:0})})}};class z_{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,i){}removeEventListener(e,t,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,i,s){return t=Math.max(0,t||e.width),i=i||e.height,{width:t,height:Math.max(0,s?Math.floor(t/s):i)}}isAttached(e){return!0}updateConfig(e){}}class C2 extends z_{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const mo="$chartjs",M2={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},zf=n=>n===null||n==="";function T2(n,e){const t=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[mo]={initial:{height:i,width:s,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",zf(s)){const l=yf(n,"width");l!==void 0&&(n.width=l)}if(zf(i))if(n.style.height==="")n.height=n.width/(e||2);else{const l=yf(n,"height");l!==void 0&&(n.height=l)}return n}const B_=rk?{passive:!0}:!1;function D2(n,e,t){n.addEventListener(e,t,B_)}function O2(n,e,t){n.canvas.removeEventListener(e,t,B_)}function E2(n,e){const t=M2[n.type]||n.type,{x:i,y:s}=Qi(n,e);return{type:t,chart:e,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Lo(n,e){for(const t of n)if(t===e||t.contains(e))return!0}function A2(n,e,t){const i=n.canvas,s=new MutationObserver(l=>{let o=!1;for(const r of l)o=o||Lo(r.addedNodes,i),o=o&&!Lo(r.removedNodes,i);o&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}function P2(n,e,t){const i=n.canvas,s=new MutationObserver(l=>{let o=!1;for(const r of l)o=o||Lo(r.removedNodes,i),o=o&&!Lo(r.addedNodes,i);o&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}const yl=new Map;let Bf=0;function U_(){const n=window.devicePixelRatio;n!==Bf&&(Bf=n,yl.forEach((e,t)=>{t.currentDevicePixelRatio!==n&&e()}))}function L2(n,e){yl.size||window.addEventListener("resize",U_),yl.set(n,e)}function I2(n){yl.delete(n),yl.size||window.removeEventListener("resize",U_)}function N2(n,e,t){const i=n.canvas,s=i&&Ua(i);if(!s)return;const l=m_((r,a)=>{const u=s.clientWidth;t(r,a),u{const a=r[0],u=a.contentRect.width,f=a.contentRect.height;u===0&&f===0||l(u,f)});return o.observe(s),L2(n,l),o}function Cr(n,e,t){t&&t.disconnect(),e==="resize"&&I2(n)}function F2(n,e,t){const i=n.canvas,s=m_(l=>{n.ctx!==null&&t(E2(l,n))},n,l=>{const o=l[0];return[o,o.offsetX,o.offsetY]});return D2(i,e,s),s}class R2 extends z_{acquireContext(e,t){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(T2(e,t),i):null}releaseContext(e){const t=e.canvas;if(!t[mo])return!1;const i=t[mo].initial;["height","width"].forEach(l=>{const o=i[l];Mt(o)?t.removeAttribute(l):t.setAttribute(l,o)});const s=i.style||{};return Object.keys(s).forEach(l=>{t.style[l]=s[l]}),t.width=t.width,delete t[mo],!0}addEventListener(e,t,i){this.removeEventListener(e,t);const s=e.$proxies||(e.$proxies={}),o={attach:A2,detach:P2,resize:N2}[t]||F2;s[t]=o(e,t,i)}removeEventListener(e,t){const i=e.$proxies||(e.$proxies={}),s=i[t];if(!s)return;({attach:Cr,detach:Cr,resize:Cr}[t]||O2)(e,t,s),i[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,i,s){return ok(e,t,i,s)}isAttached(e){const t=Ua(e);return!!(t&&t.isConnected)}}function H2(n){return!E_()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?C2:R2}class j2{constructor(){this._init=[]}notify(e,t,i,s){t==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const l=s?this._descriptors(e).filter(s):this._descriptors(e),o=this._notify(l,e,t,i);return t==="afterDestroy"&&(this._notify(l,e,"stop"),this._notify(this._init,e,"uninstall")),o}_notify(e,t,i,s){s=s||{};for(const l of e){const o=l.plugin,r=o[i],a=[t,s,l.options];if(Vt(r,a,o)===!1&&s.cancelable)return!1}return!0}invalidate(){Mt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){const i=e&&e.config,s=vt(i.options&&i.options.plugins,{}),l=q2(i);return s===!1&&!t?[]:z2(e,l,s,t)}_notifyStateChanges(e){const t=this._oldCache||[],i=this._cache,s=(l,o)=>l.filter(r=>!o.some(a=>r.plugin.id===a.plugin.id));this._notify(s(t,i),e,"stop"),this._notify(s(i,t),e,"start")}}function q2(n){const e={},t=[],i=Object.keys(di.plugins.items);for(let l=0;l{const a=i[r];if(!mt(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const u=oa(r,a),f=W2(u,s),c=t.scales||{};l[u]=l[u]||r,o[r]=ol(Object.create(null),[{axis:u},a,c[u],c[f]])}),n.data.datasets.forEach(r=>{const a=r.type||n.type,u=r.indexAxis||la(a,e),c=(fs[a]||{}).scales||{};Object.keys(c).forEach(d=>{const h=U2(d,u),g=r[h+"AxisID"]||l[h]||h;o[g]=o[g]||Object.create(null),ol(o[g],[{axis:h},i[g],c[d]])})}),Object.keys(o).forEach(r=>{const a=o[r];ol(a,[kt.scales[a.type],kt.scale])}),o}function W_(n){const e=n.options||(n.options={});e.plugins=vt(e.plugins,{}),e.scales=K2(n,e)}function Y_(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function J2(n){return n=n||{},n.data=Y_(n.data),W_(n),n}const Uf=new Map,K_=new Set;function so(n,e){let t=Uf.get(n);return t||(t=e(),Uf.set(n,t),K_.add(t)),t}const Gs=(n,e,t)=>{const i=ji(e,t);i!==void 0&&n.add(i)};class Z2{constructor(e){this._config=J2(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=Y_(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),W_(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return so(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return so(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return so(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){const t=e.id,i=this.type;return so(`${i}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){const i=this._scopeCache;let s=i.get(e);return(!s||t)&&(s=new Map,i.set(e,s)),s}getOptionScopes(e,t,i){const{options:s,type:l}=this,o=this._cachedScopes(e,i),r=o.get(t);if(r)return r;const a=new Set;t.forEach(f=>{e&&(a.add(e),f.forEach(c=>Gs(a,e,c))),f.forEach(c=>Gs(a,s,c)),f.forEach(c=>Gs(a,fs[l]||{},c)),f.forEach(c=>Gs(a,kt,c)),f.forEach(c=>Gs(a,na,c))});const u=Array.from(a);return u.length===0&&u.push(Object.create(null)),K_.has(t)&&o.set(t,u),u}chartOptionScopes(){const{options:e,type:t}=this;return[e,fs[t]||{},kt.datasets[t]||{},{type:t},kt,na]}resolveNamedOptions(e,t,i,s=[""]){const l={$shared:!0},{resolver:o,subPrefixes:r}=Wf(this._resolverCache,e,s);let a=o;if(X2(o,t)){l.$shared=!1,i=qi(i)?i():i;const u=this.createResolver(e,i,r);a=Es(o,i,u)}for(const u of t)l[u]=a[u];return l}createResolver(e,t,i=[""],s){const{resolver:l}=Wf(this._resolverCache,e,i);return mt(t)?Es(l,t,void 0,s):l}}function Wf(n,e,t){let i=n.get(e);i||(i=new Map,n.set(e,i));const s=t.join();let l=i.get(s);return l||(l={resolver:Va(e,t),subPrefixes:t.filter(r=>!r.toLowerCase().includes("hover"))},i.set(s,l)),l}const G2=n=>mt(n)&&Object.getOwnPropertyNames(n).reduce((e,t)=>e||qi(n[t]),!1);function X2(n,e){const{isScriptable:t,isIndexable:i}=S_(n);for(const s of e){const l=t(s),o=i(s),r=(o||l)&&n[s];if(l&&(qi(r)||G2(r))||o&&It(r))return!0}return!1}var Q2="3.9.1";const x2=["top","bottom","left","right","chartArea"];function Yf(n,e){return n==="top"||n==="bottom"||x2.indexOf(n)===-1&&e==="x"}function Kf(n,e){return function(t,i){return t[n]===i[n]?t[e]-i[e]:t[n]-i[n]}}function Jf(n){const e=n.chart,t=e.options.animation;e.notifyPlugins("afterRender"),Vt(t&&t.onComplete,[n],e)}function ew(n){const e=n.chart,t=e.options.animation;Vt(t&&t.onProgress,[n],e)}function J_(n){return E_()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}const Io={},Z_=n=>{const e=J_(n);return Object.values(Io).filter(t=>t.canvas===e).pop()};function tw(n,e,t){const i=Object.keys(n);for(const s of i){const l=+s;if(l>=e){const o=n[s];delete n[s],(t>0||l>e)&&(n[l+t]=o)}}}function nw(n,e,t,i){return!t||n.type==="mouseout"?null:i?e:n}class No{constructor(e,t){const i=this.config=new Z2(t),s=J_(e),l=Z_(s);if(l)throw new Error("Canvas is already in use. Chart with ID '"+l.id+"' must be destroyed before the canvas with ID '"+l.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||H2(s)),this.platform.updateConfig(i);const r=this.platform.acquireContext(s,o.aspectRatio),a=r&&r.canvas,u=a&&a.height,f=a&&a.width;if(this.id=qv(),this.ctx=r,this.canvas=a,this.width=f,this.height=u,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new j2,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ny(c=>this.update(c),o.resizeDelay||0),this._dataChanges=[],Io[this.id]=this,!r||!a){console.error("Failed to create chart: can't acquire context from the given item");return}bi.listen(this,"complete",Jf),bi.listen(this,"progress",ew),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:t},width:i,height:s,_aspectRatio:l}=this;return Mt(e)?t&&l?l:s?i/s:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():vf(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return gf(this.canvas,this.ctx),this}stop(){return bi.stop(this),this}resize(e,t){bi.running(this)?this._resizeBeforeDraw={width:e,height:t}:this._resize(e,t)}_resize(e,t){const i=this.options,s=this.canvas,l=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,e,t,l),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,vf(this,r,!0)&&(this.notifyPlugins("resize",{size:o}),Vt(i.onResize,[this,o],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};Et(t,(i,s)=>{i.id=s})}buildOrUpdateScales(){const e=this.options,t=e.scales,i=this.scales,s=Object.keys(i).reduce((o,r)=>(o[r]=!1,o),{});let l=[];t&&(l=l.concat(Object.keys(t).map(o=>{const r=t[o],a=oa(o,r),u=a==="r",f=a==="x";return{options:r,dposition:u?"chartArea":f?"bottom":"left",dtype:u?"radialLinear":f?"category":"linear"}}))),Et(l,o=>{const r=o.options,a=r.id,u=oa(a,r),f=vt(r.type,o.dtype);(r.position===void 0||Yf(r.position,u)!==Yf(o.dposition))&&(r.position=o.dposition),s[a]=!0;let c=null;if(a in i&&i[a].type===f)c=i[a];else{const d=di.getScale(f);c=new d({id:a,type:f,ctx:this.ctx,chart:this}),i[c.id]=c}c.init(r,e)}),Et(s,(o,r)=>{o||delete i[r]}),Et(i,o=>{io.configure(this,o,o.options),io.addBox(this,o)})}_updateMetasets(){const e=this._metasets,t=this.data.datasets.length,i=e.length;if(e.sort((s,l)=>s.index-l.index),i>t){for(let s=t;st.length&&delete this._stacks,e.forEach((i,s)=>{t.filter(l=>l===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const e=[],t=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=t.length;i{this.getDatasetMeta(t).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const t=this.config;t.update();const i=this._options=t.createResolver(t.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const l=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let u=0,f=this.data.datasets.length;u{u.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(Kf("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){Et(this.scales,e=>{io.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,t=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!nf(t,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,t=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:l}of t){const o=i==="_removeElements"?-l:l;tw(e,s,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const t=this.data.datasets.length,i=l=>new Set(e.filter(o=>o[0]===l).map((o,r)=>r+","+o.splice(1).join(","))),s=i(0);for(let l=1;ll.split(",")).map(l=>({method:l[1],start:+l[2],count:+l[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;io.update(this,this.width,this.height,e);const t=this.chartArea,i=t.width<=0||t.height<=0;this._layers=[],Et(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,l)=>{s._idx=l}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let t=0,i=this.data.datasets.length;t=0;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const t=this.ctx,i=e._clip,s=!i.disabled,l=this.chartArea,o={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(s&&Ha(t,{left:i.left===!1?0:l.left-i.left,right:i.right===!1?this.width:l.right+i.right,top:i.top===!1?0:l.top-i.top,bottom:i.bottom===!1?this.height:l.bottom+i.bottom}),e.controller.draw(),s&&ja(t),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(e){return vl(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,t,i,s){const l=_2.modes[t];return typeof l=="function"?l(this,e,i,s):[]}getDatasetMeta(e){const t=this.data.datasets[e],i=this._metasets;let s=i.filter(l=>l&&l._dataset===t).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:t&&t.order||0,index:e,_dataset:t,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=zi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const t=this.data.datasets[e];if(!t)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!t.hidden}setDatasetVisibility(e,t){const i=this.getDatasetMeta(e);i.hidden=!t}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,t,i){const s=i?"show":"hide",l=this.getDatasetMeta(e),o=l.controller._resolveAnimations(void 0,s);Yn(t)?(l.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),o.update(l,{visible:i}),this.update(r=>r.datasetIndex===e?s:void 0))}hide(e,t){this._updateVisibility(e,t,!1)}show(e,t){this._updateVisibility(e,t,!0)}_destroyDatasetMeta(e){const t=this._metasets[e];t&&t.controller&&t.controller._destroy(),delete this._metasets[e]}_stop(){let e,t;for(this.stop(),bi.remove(this),e=0,t=this.data.datasets.length;e{t.addEventListener(this,l,o),e[l]=o},s=(l,o,r)=>{l.offsetX=o,l.offsetY=r,this._eventHandler(l)};Et(this.options.events,l=>i(l,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,t=this.platform,i=(a,u)=>{t.addEventListener(this,a,u),e[a]=u},s=(a,u)=>{e[a]&&(t.removeEventListener(this,a,u),delete e[a])},l=(a,u)=>{this.canvas&&this.resize(a,u)};let o;const r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",l),i("detach",o)};o=()=>{this.attached=!1,s("resize",l),this._stop(),this._resize(0,0),i("attach",r)},t.isAttached(this.canvas)?r():o()}unbindEvents(){Et(this._listeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._listeners={},Et(this._responsiveListeners,(e,t)=>{this.platform.removeEventListener(this,t,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,t,i){const s=i?"set":"remove";let l,o,r,a;for(t==="dataset"&&(l=this.getDatasetMeta(e[0].datasetIndex),l.controller["_"+s+"DatasetHoverStyle"]()),r=0,a=e.length;r{const r=this.getDatasetMeta(l);if(!r)throw new Error("No dataset found at index "+l);return{datasetIndex:l,element:r.data[o],index:o}});!Co(i,t)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,t))}notifyPlugins(e,t,i){return this._plugins.notify(this,e,t,i)}_updateHoverStyles(e,t,i){const s=this.options.hover,l=(a,u)=>a.filter(f=>!u.some(c=>f.datasetIndex===c.datasetIndex&&f.index===c.index)),o=l(t,e),r=i?e:l(e,t);o.length&&this.updateHoverStyle(o,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},s=o=>(o.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const l=this._handleEvent(e,t,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(l||i.changed)&&this.render(),this}_handleEvent(e,t,i){const{_active:s=[],options:l}=this,o=t,r=this._getActiveElements(e,s,i,o),a=Yv(e),u=nw(e,this._lastEvent,i,a);i&&(this._lastEvent=null,Vt(l.onHover,[e,r,this],this),a&&Vt(l.onClick,[e,r,this],this));const f=!Co(r,s);return(f||t)&&(this._active=r,this._updateHoverStyles(r,s,t)),this._lastEvent=u,f}_getActiveElements(e,t,i,s){if(e.type==="mouseout")return[];if(!i)return t;const l=this.options.hover;return this.getElementsAtEventForMode(e,l.mode,l,s)}}const Zf=()=>Et(No.instances,n=>n._plugins.invalidate()),Ei=!0;Object.defineProperties(No,{defaults:{enumerable:Ei,value:kt},instances:{enumerable:Ei,value:Io},overrides:{enumerable:Ei,value:fs},registry:{enumerable:Ei,value:di},version:{enumerable:Ei,value:Q2},getChart:{enumerable:Ei,value:Z_},register:{enumerable:Ei,value:(...n)=>{di.add(...n),Zf()}},unregister:{enumerable:Ei,value:(...n)=>{di.remove(...n),Zf()}}});function G_(n,e,t){const{startAngle:i,pixelMargin:s,x:l,y:o,outerRadius:r,innerRadius:a}=e;let u=s/r;n.beginPath(),n.arc(l,o,r,i-u,t+u),a>s?(u=s/a,n.arc(l,o,a,t+u,i-u,!0)):n.arc(l,o,s,t+zt,i-zt),n.closePath(),n.clip()}function iw(n){return qa(n,["outerStart","outerEnd","innerStart","innerEnd"])}function sw(n,e,t,i){const s=iw(n.options.borderRadius),l=(t-e)/2,o=Math.min(l,i*e/2),r=a=>{const u=(t-Math.min(l,a))*i/2;return cn(a,0,Math.min(l,u))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:cn(s.innerStart,0,o),innerEnd:cn(s.innerEnd,0,o)}}function vs(n,e,t,i){return{x:t+n*Math.cos(e),y:i+n*Math.sin(e)}}function ra(n,e,t,i,s,l){const{x:o,y:r,startAngle:a,pixelMargin:u,innerRadius:f}=e,c=Math.max(e.outerRadius+i+t-u,0),d=f>0?f+i+t+u:0;let h=0;const g=s-a;if(i){const Z=f>0?f-i:0,ee=c>0?c-i:0,U=(Z+ee)/2,Y=U!==0?g*U/(U+i):g;h=(g-Y)/2}const v=Math.max(.001,g*c-t/Wt)/c,b=(g-v)/2,y=a+b+h,$=s-b-h,{outerStart:C,outerEnd:S,innerStart:T,innerEnd:M}=sw(e,d,c,$-y),O=c-C,E=c-S,P=y+C/O,I=$-S/E,F=d+T,V=d+M,X=y+T/F,te=$-M/V;if(n.beginPath(),l){if(n.arc(o,r,c,P,I),S>0){const U=vs(E,I,o,r);n.arc(U.x,U.y,S,I,$+zt)}const Z=vs(V,$,o,r);if(n.lineTo(Z.x,Z.y),M>0){const U=vs(V,te,o,r);n.arc(U.x,U.y,M,$+zt,te+Math.PI)}if(n.arc(o,r,d,$-M/d,y+T/d,!0),T>0){const U=vs(F,X,o,r);n.arc(U.x,U.y,T,X+Math.PI,y-zt)}const ee=vs(O,y,o,r);if(n.lineTo(ee.x,ee.y),C>0){const U=vs(O,P,o,r);n.arc(U.x,U.y,C,y-zt,P)}}else{n.moveTo(o,r);const Z=Math.cos(P)*c+o,ee=Math.sin(P)*c+r;n.lineTo(Z,ee);const U=Math.cos(I)*c+o,Y=Math.sin(I)*c+r;n.lineTo(U,Y)}n.closePath()}function lw(n,e,t,i,s){const{fullCircles:l,startAngle:o,circumference:r}=e;let a=e.endAngle;if(l){ra(n,e,t,i,o+At,s);for(let u=0;u=At||_l(l,r,a),v=bl(o,u+d,f+d);return g&&v}getCenterPoint(e){const{x:t,y:i,startAngle:s,endAngle:l,innerRadius:o,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],e),{offset:a,spacing:u}=this.options,f=(s+l)/2,c=(o+r+u+a)/2;return{x:t+Math.cos(f)*c,y:i+Math.sin(f)*c}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:t,circumference:i}=this,s=(t.offset||0)/2,l=(t.spacing||0)/2,o=t.circular;if(this.pixelMargin=t.borderAlign==="inner"?.33:0,this.fullCircles=i>At?Math.floor(i/At):0,i===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let r=0;if(s){r=s/2;const u=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(u)*r,Math.sin(u)*r),this.circumference>=Wt&&(r=s)}e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor;const a=lw(e,this,r,l,o);rw(e,this,r,l,a,o),e.restore()}}Ga.id="arc";Ga.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};Ga.defaultRoutes={backgroundColor:"backgroundColor"};function X_(n,e,t=e){n.lineCap=vt(t.borderCapStyle,e.borderCapStyle),n.setLineDash(vt(t.borderDash,e.borderDash)),n.lineDashOffset=vt(t.borderDashOffset,e.borderDashOffset),n.lineJoin=vt(t.borderJoinStyle,e.borderJoinStyle),n.lineWidth=vt(t.borderWidth,e.borderWidth),n.strokeStyle=vt(t.borderColor,e.borderColor)}function aw(n,e,t){n.lineTo(t.x,t.y)}function uw(n){return n.stepped?Ey:n.tension||n.cubicInterpolationMode==="monotone"?Ay:aw}function Q_(n,e,t={}){const i=n.length,{start:s=0,end:l=i-1}=t,{start:o,end:r}=e,a=Math.max(s,o),u=Math.min(l,r),f=sr&&l>r;return{count:i,start:a,loop:e.loop,ilen:u(o+(u?r-S:S))%l,C=()=>{v!==b&&(n.lineTo(f,b),n.lineTo(f,v),n.lineTo(f,y))};for(a&&(h=s[$(0)],n.moveTo(h.x,h.y)),d=0;d<=r;++d){if(h=s[$(d)],h.skip)continue;const S=h.x,T=h.y,M=S|0;M===g?(Tb&&(b=T),f=(c*f+S)/++c):(C(),n.lineTo(S,T),g=M,c=0,v=b=T),y=T}C()}function aa(n){const e=n.options,t=e.borderDash&&e.borderDash.length;return!n._decimated&&!n._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?cw:fw}function dw(n){return n.stepped?ak:n.tension||n.cubicInterpolationMode==="monotone"?uk:xi}function pw(n,e,t,i){let s=e._path;s||(s=e._path=new Path2D,e.path(s,t,i)&&s.closePath()),X_(n,e.options),n.stroke(s)}function hw(n,e,t,i){const{segments:s,options:l}=e,o=aa(e);for(const r of s)X_(n,l,r.style),n.beginPath(),o(n,e,r,{start:t,end:t+i-1})&&n.closePath(),n.stroke()}const mw=typeof Path2D=="function";function gw(n,e,t,i){mw&&!e.options.segment?pw(n,e,t,i):hw(n,e,t,i)}class Bi extends Mi{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,t){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;ek(this._points,i,e,s,t),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=bk(this,this.options.segment))}first(){const e=this.segments,t=this.points;return e.length&&t[e[0].start]}last(){const e=this.segments,t=this.points,i=e.length;return i&&t[e[i-1].end]}interpolate(e,t){const i=this.options,s=e[t],l=this.points,o=L_(this,{property:t,start:s,end:s});if(!o.length)return;const r=[],a=dw(i);let u,f;for(u=0,f=o.length;un!=="borderDash"&&n!=="fill"};function Gf(n,e,t,i){const s=n.options,{[t]:l}=n.getProps([t],i);return Math.abs(e-l){r=Qa(o,r,s);const a=s[o],u=s[r];i!==null?(l.push({x:a.x,y:i}),l.push({x:u.x,y:i})):t!==null&&(l.push({x:t,y:a.y}),l.push({x:t,y:u.y}))}),l}function Qa(n,e,t){for(;e>n;e--){const i=t[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function Xf(n,e,t,i){return n&&e?i(n[t],e[t]):n?n[t]:e?e[t]:0}function eb(n,e){let t=[],i=!1;return It(n)?(i=!0,t=n):t=$w(n,e),t.length?new Bi({points:t,options:{tension:0},_loop:i,_fullLoop:i}):null}function Qf(n){return n&&n.fill!==!1}function Sw(n,e,t){let s=n[e].fill;const l=[e];let o;if(!t)return s;for(;s!==!1&&l.indexOf(s)===-1;){if(!Kt(s))return s;if(o=n[s],!o)return!1;if(o.visible)return s;l.push(s),s=o.fill}return!1}function Cw(n,e,t){const i=Ow(n);if(mt(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return Kt(s)&&Math.floor(s)===s?Mw(i[0],e,s,t):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Mw(n,e,t,i){return(n==="-"||n==="+")&&(t=e+t),t===e||t<0||t>=i?!1:t}function Tw(n,e){let t=null;return n==="start"?t=e.bottom:n==="end"?t=e.top:mt(n)?t=e.getPixelForValue(n.value):e.getBasePixel&&(t=e.getBasePixel()),t}function Dw(n,e,t){let i;return n==="start"?i=t:n==="end"?i=e.options.reverse?e.min:e.max:mt(n)?i=n.value:i=e.getBaseValue(),i}function Ow(n){const e=n.options,t=e.fill;let i=vt(t&&t.target,t);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Ew(n){const{scale:e,index:t,line:i}=n,s=[],l=i.segments,o=i.points,r=Aw(e,t);r.push(eb({x:null,y:e.bottom},i));for(let a=0;a=0;--o){const r=s[o].$filler;!r||(r.line.updateControlPoints(l,r.axis),i&&r.fill&&Dr(n.ctx,r,l))}},beforeDatasetsDraw(n,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;const i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){const l=i[s].$filler;Qf(l)&&Dr(n.ctx,l,n.chartArea)}},beforeDatasetDraw(n,e,t){const i=e.meta.$filler;!Qf(i)||t.drawTime!=="beforeDatasetDraw"||Dr(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const fl={average(n){if(!n.length)return!1;let e,t,i=0,s=0,l=0;for(e=0,t=n.length;e-1?n.split(` -`):n}function zw(n,e){const{element:t,datasetIndex:i,index:s}=e,l=n.getDatasetMeta(i).controller,{label:o,value:r}=l.getLabelAndValue(s);return{chart:n,label:o,parsed:l.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:r,dataset:l.getDataset(),dataIndex:s,datasetIndex:i,element:t}}function nc(n,e){const t=n.chart.ctx,{body:i,footer:s,title:l}=n,{boxWidth:o,boxHeight:r}=e,a=Ln(e.bodyFont),u=Ln(e.titleFont),f=Ln(e.footerFont),c=l.length,d=s.length,h=i.length,g=Kn(e.padding);let v=g.height,b=0,y=i.reduce((S,T)=>S+T.before.length+T.lines.length+T.after.length,0);if(y+=n.beforeBody.length+n.afterBody.length,c&&(v+=c*u.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),y){const S=e.displayColors?Math.max(r,a.lineHeight):a.lineHeight;v+=h*S+(y-h)*a.lineHeight+(y-1)*e.bodySpacing}d&&(v+=e.footerMarginTop+d*f.lineHeight+(d-1)*e.footerSpacing);let $=0;const C=function(S){b=Math.max(b,t.measureText(S).width+$)};return t.save(),t.font=u.string,Et(n.title,C),t.font=a.string,Et(n.beforeBody.concat(n.afterBody),C),$=e.displayColors?o+2+e.boxPadding:0,Et(i,S=>{Et(S.before,C),Et(S.lines,C),Et(S.after,C)}),$=0,t.font=f.string,Et(n.footer,C),t.restore(),b+=g.width,{width:b,height:v}}function Bw(n,e){const{y:t,height:i}=e;return tn.height-i/2?"bottom":"center"}function Uw(n,e,t,i){const{x:s,width:l}=i,o=t.caretSize+t.caretPadding;if(n==="left"&&s+l+o>e.width||n==="right"&&s-l-o<0)return!0}function Ww(n,e,t,i){const{x:s,width:l}=t,{width:o,chartArea:{left:r,right:a}}=n;let u="center";return i==="center"?u=s<=(r+a)/2?"left":"right":s<=l/2?u="left":s>=o-l/2&&(u="right"),Uw(u,n,e,t)&&(u="center"),u}function ic(n,e,t){const i=t.yAlign||e.yAlign||Bw(n,t);return{xAlign:t.xAlign||e.xAlign||Ww(n,e,t,i),yAlign:i}}function Yw(n,e){let{x:t,width:i}=n;return e==="right"?t-=i:e==="center"&&(t-=i/2),t}function Kw(n,e,t){let{y:i,height:s}=n;return e==="top"?i+=t:e==="bottom"?i-=s+t:i-=s/2,i}function sc(n,e,t,i){const{caretSize:s,caretPadding:l,cornerRadius:o}=n,{xAlign:r,yAlign:a}=t,u=s+l,{topLeft:f,topRight:c,bottomLeft:d,bottomRight:h}=Ss(o);let g=Yw(e,r);const v=Kw(e,a,u);return a==="center"?r==="left"?g+=u:r==="right"&&(g-=u):r==="left"?g-=Math.max(f,d)+s:r==="right"&&(g+=Math.max(c,h)+s),{x:cn(g,0,i.width-e.width),y:cn(v,0,i.height-e.height)}}function lo(n,e,t){const i=Kn(t.padding);return e==="center"?n.x+n.width/2:e==="right"?n.x+n.width-i.right:n.x+i.left}function lc(n){return fi([],vi(n))}function Jw(n,e,t){return zi(n,{tooltip:e,tooltipItems:t,type:"tooltip"})}function oc(n,e){const t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?n.override(t):n}class fa extends Mi{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart||e._chart,this._chart=this.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const t=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&t.options.animation&&i.animations,l=new I_(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(l)),l}getContext(){return this.$context||(this.$context=Jw(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,t){const{callbacks:i}=t,s=i.beforeTitle.apply(this,[e]),l=i.title.apply(this,[e]),o=i.afterTitle.apply(this,[e]);let r=[];return r=fi(r,vi(s)),r=fi(r,vi(l)),r=fi(r,vi(o)),r}getBeforeBody(e,t){return lc(t.callbacks.beforeBody.apply(this,[e]))}getBody(e,t){const{callbacks:i}=t,s=[];return Et(e,l=>{const o={before:[],lines:[],after:[]},r=oc(i,l);fi(o.before,vi(r.beforeLabel.call(this,l))),fi(o.lines,r.label.call(this,l)),fi(o.after,vi(r.afterLabel.call(this,l))),s.push(o)}),s}getAfterBody(e,t){return lc(t.callbacks.afterBody.apply(this,[e]))}getFooter(e,t){const{callbacks:i}=t,s=i.beforeFooter.apply(this,[e]),l=i.footer.apply(this,[e]),o=i.afterFooter.apply(this,[e]);let r=[];return r=fi(r,vi(s)),r=fi(r,vi(l)),r=fi(r,vi(o)),r}_createItems(e){const t=this._active,i=this.chart.data,s=[],l=[],o=[];let r=[],a,u;for(a=0,u=t.length;ae.filter(f,c,d,i))),e.itemSort&&(r=r.sort((f,c)=>e.itemSort(f,c,i))),Et(r,f=>{const c=oc(e.callbacks,f);s.push(c.labelColor.call(this,f)),l.push(c.labelPointStyle.call(this,f)),o.push(c.labelTextColor.call(this,f))}),this.labelColors=s,this.labelPointStyles=l,this.labelTextColors=o,this.dataPoints=r,r}update(e,t){const i=this.options.setContext(this.getContext()),s=this._active;let l,o=[];if(!s.length)this.opacity!==0&&(l={opacity:0});else{const r=fl[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const a=this._size=nc(this,i),u=Object.assign({},r,a),f=ic(this.chart,i,u),c=sc(i,u,f,this.chart);this.xAlign=f.xAlign,this.yAlign=f.yAlign,l={opacity:1,x:c.x,y:c.y,width:a.width,height:a.height,caretX:r.x,caretY:r.y}}this._tooltipItems=o,this.$context=void 0,l&&this._resolveAnimations().update(this,l),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:t})}drawCaret(e,t,i,s){const l=this.getCaretPosition(e,i,s);t.lineTo(l.x1,l.y1),t.lineTo(l.x2,l.y2),t.lineTo(l.x3,l.y3)}getCaretPosition(e,t,i){const{xAlign:s,yAlign:l}=this,{caretSize:o,cornerRadius:r}=i,{topLeft:a,topRight:u,bottomLeft:f,bottomRight:c}=Ss(r),{x:d,y:h}=e,{width:g,height:v}=t;let b,y,$,C,S,T;return l==="center"?(S=h+v/2,s==="left"?(b=d,y=b-o,C=S+o,T=S-o):(b=d+g,y=b+o,C=S-o,T=S+o),$=b):(s==="left"?y=d+Math.max(a,f)+o:s==="right"?y=d+g-Math.max(u,c)-o:y=this.caretX,l==="top"?(C=h,S=C-o,b=y-o,$=y+o):(C=h+v,S=C+o,b=y+o,$=y-o),T=C),{x1:b,x2:y,x3:$,y1:C,y2:S,y3:T}}drawTitle(e,t,i){const s=this.title,l=s.length;let o,r,a;if(l){const u=vr(i.rtl,this.x,this.width);for(e.x=lo(this,i.titleAlign,i),t.textAlign=u.textAlign(i.titleAlign),t.textBaseline="middle",o=Ln(i.titleFont),r=i.titleSpacing,t.fillStyle=i.titleColor,t.font=o.string,a=0;aC!==0)?(e.beginPath(),e.fillStyle=l.multiKeyBackground,Ao(e,{x:b,y:v,w:u,h:a,radius:$}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),Ao(e,{x:y,y:v+1,w:u-2,h:a-2,radius:$}),e.fill()):(e.fillStyle=l.multiKeyBackground,e.fillRect(b,v,u,a),e.strokeRect(b,v,u,a),e.fillStyle=o.backgroundColor,e.fillRect(y,v+1,u-2,a-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,t,i){const{body:s}=this,{bodySpacing:l,bodyAlign:o,displayColors:r,boxHeight:a,boxWidth:u,boxPadding:f}=i,c=Ln(i.bodyFont);let d=c.lineHeight,h=0;const g=vr(i.rtl,this.x,this.width),v=function(E){t.fillText(E,g.x(e.x+h),e.y+d/2),e.y+=d+l},b=g.textAlign(o);let y,$,C,S,T,M,O;for(t.textAlign=o,t.textBaseline="middle",t.font=c.string,e.x=lo(this,b,i),t.fillStyle=i.bodyColor,Et(this.beforeBody,v),h=r&&b!=="right"?o==="center"?u/2+f:u+2+f:0,S=0,M=s.length;S0&&t.stroke()}_updateAnimationTarget(e){const t=this.chart,i=this.$animations,s=i&&i.x,l=i&&i.y;if(s||l){const o=fl[e.position].call(this,this._active,this._eventPosition);if(!o)return;const r=this._size=nc(this,e),a=Object.assign({},o,this._size),u=ic(t,e,a),f=sc(e,a,u,t);(s._to!==f.x||l._to!==f.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=r.width,this.height=r.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,f))}}_willRender(){return!!this.opacity}draw(e){const t=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(t);const s={width:this.width,height:this.height},l={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=Kn(t.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;t.enabled&&r&&(e.save(),e.globalAlpha=i,this.drawBackground(l,e,s,t),pk(e,t.textDirection),l.y+=o.top,this.drawTitle(l,e,t),this.drawBody(l,e,t),this.drawFooter(l,e,t),hk(e,t.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const i=this._active,s=e.map(({datasetIndex:r,index:a})=>{const u=this.chart.getDatasetMeta(r);if(!u)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:u.data[a],index:a}}),l=!Co(i,s),o=this._positionChanged(s,t);(l||o)&&(this._active=s,this._eventPosition=t,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,t,i=!0){if(t&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,l=this._active||[],o=this._getActiveElements(e,l,t,i),r=this._positionChanged(o,e),a=t||!Co(o,l)||r;return a&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,t))),a}_getActiveElements(e,t,i,s){const l=this.options;if(e.type==="mouseout")return[];if(!s)return t;const o=this.chart.getElementsAtEventForMode(e,l.mode,l,i);return l.reverse&&o.reverse(),o}_positionChanged(e,t){const{caretX:i,caretY:s,options:l}=this,o=fl[l.position].call(this,e,t);return o!==!1&&(i!==o.x||s!==o.y)}}fa.positioners=fl;var Zw={id:"tooltip",_element:fa,positioners:fl,afterInit(n,e,t){t&&(n.tooltip=new fa({chart:n,options:t}))},beforeUpdate(n,e,t){n.tooltip&&n.tooltip.initialize(t)},reset(n,e,t){n.tooltip&&n.tooltip.initialize(t)},afterDraw(n){const e=n.tooltip;if(e&&e._willRender()){const t={tooltip:e};if(n.notifyPlugins("beforeTooltipDraw",t)===!1)return;e.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",t)}},afterEvent(n,e){if(n.tooltip){const t=e.replay;n.tooltip.handleEvent(e.event,t,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(n,e)=>e.bodyFont.size,boxWidth:(n,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:_i,title(n){if(n.length>0){const e=n[0],t=e.chart.data.labels,i=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndexn!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Gw=(n,e,t,i)=>(typeof e=="string"?(t=n.push(e)-1,i.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function Xw(n,e,t,i){const s=n.indexOf(e);if(s===-1)return Gw(n,e,t,i);const l=n.lastIndexOf(e);return s!==l?t:s}const Qw=(n,e)=>n===null?null:cn(Math.round(n),0,e);class ca extends ds{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const t=this._addedLabels;if(t.length){const i=this.getLabels();for(const{index:s,label:l}of t)i[s]===l&&i.splice(s,1);this._addedLabels=[]}super.init(e)}parse(e,t){if(Mt(e))return null;const i=this.getLabels();return t=isFinite(t)&&i[t]===e?t:Xw(i,e,vt(t,e),this._addedLabels),Qw(t,i.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(i=0),t||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const e=this.min,t=this.max,i=this.options.offset,s=[];let l=this.getLabels();l=e===0&&t===l.length-1?l:l.slice(e,t+1),this._valueRange=Math.max(l.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let o=e;o<=t;o++)s.push({value:o});return s}getLabelForValue(e){const t=this.getLabels();return e>=0&&et.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}ca.id="category";ca.defaults={ticks:{callback:ca.prototype.getLabelForValue}};function xw(n,e){const t=[],{bounds:s,step:l,min:o,max:r,precision:a,count:u,maxTicks:f,maxDigits:c,includeBounds:d}=n,h=l||1,g=f-1,{min:v,max:b}=e,y=!Mt(o),$=!Mt(r),C=!Mt(u),S=(b-v)/(c+1);let T=lf((b-v)/g/h)*h,M,O,E,P;if(T<1e-14&&!y&&!$)return[{value:v},{value:b}];P=Math.ceil(b/T)-Math.floor(v/T),P>g&&(T=lf(P*T/g/h)*h),Mt(a)||(M=Math.pow(10,a),T=Math.ceil(T*M)/M),s==="ticks"?(O=Math.floor(v/T)*T,E=Math.ceil(b/T)*T):(O=v,E=b),y&&$&&l&&Gv((r-o)/l,T/1e3)?(P=Math.round(Math.min((r-o)/T,f)),T=(r-o)/P,O=o,E=r):C?(O=y?o:O,E=$?r:E,P=u-1,T=(E-O)/P):(P=(E-O)/T,rl(P,Math.round(P),T/1e3)?P=Math.round(P):P=Math.ceil(P));const I=Math.max(of(T),of(O));M=Math.pow(10,Mt(a)?I:a),O=Math.round(O*M)/M,E=Math.round(E*M)/M;let F=0;for(y&&(d&&O!==o?(t.push({value:o}),Os=t?s:a,r=a=>l=i?l:a;if(e){const a=pi(s),u=pi(l);a<0&&u<0?r(0):a>0&&u>0&&o(0)}if(s===l){let a=1;(l>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(a=Math.abs(l*.05)),r(l+a),e||o(s-a)}this.min=s,this.max=l}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:t,stepSize:i}=e,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),t=t||11),t&&(s=Math.min(t,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,t=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},l=this._range||this,o=xw(s,l);return e.bounds==="ticks"&&f_(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let t=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const s=(i-t)/Math.max(e.length-1,1)/2;t-=s,i+=s}this._startValue=t,this._endValue=i,this._valueRange=i-t}getLabelForValue(e){return El(e,this.chart.options.locale,this.options.ticks.format)}}class xa extends Fo{determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Kt(e)?e:0,this.max=Kt(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),t=e?this.width:this.height,i=ei(this.options.ticks.minRotation),s=(e?Math.sin(i):Math.cos(i))||.001,l=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,l.lineHeight/s))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}xa.id="linear";xa.defaults={ticks:{callback:er.formatters.numeric}};function ac(n){return n/Math.pow(10,Math.floor(Bn(n)))===1}function e$(n,e){const t=Math.floor(Bn(e.max)),i=Math.ceil(e.max/Math.pow(10,t)),s=[];let l=Hn(n.min,Math.pow(10,Math.floor(Bn(e.min)))),o=Math.floor(Bn(l)),r=Math.floor(l/Math.pow(10,o)),a=o<0?Math.pow(10,Math.abs(o)):1;do s.push({value:l,major:ac(l)}),++r,r===10&&(r=1,++o,a=o>=0?1:a),l=Math.round(r*Math.pow(10,o)*a)/a;while(o0?i:null}determineDataLimits(){const{min:e,max:t}=this.getMinMax(!0);this.min=Kt(e)?Math.max(0,e):null,this.max=Kt(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:t}=this.getUserBounds();let i=this.min,s=this.max;const l=a=>i=e?i:a,o=a=>s=t?s:a,r=(a,u)=>Math.pow(10,Math.floor(Bn(a))+u);i===s&&(i<=0?(l(1),o(10)):(l(r(i,-1)),o(r(s,1)))),i<=0&&l(r(s,-1)),s<=0&&o(r(i,1)),this._zero&&this.min!==this._suggestedMin&&i===r(this.min,0)&&l(r(i,-1)),this.min=i,this.max=s}buildTicks(){const e=this.options,t={min:this._userMin,max:this._userMax},i=e$(t,this);return e.bounds==="ticks"&&f_(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(e){return e===void 0?"0":El(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=Bn(e),this._valueRange=Bn(this.max)-Bn(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Bn(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}}nb.id="logarithmic";nb.defaults={ticks:{callback:er.formatters.logarithmic,major:{enabled:!0}}};function da(n){const e=n.ticks;if(e.display&&n.display){const t=Kn(e.backdropPadding);return vt(e.font&&e.font.size,kt.font.size)+t.height}return 0}function t$(n,e,t){return t=It(t)?t:[t],{w:Dy(n,e.string,t),h:t.length*e.lineHeight}}function uc(n,e,t,i,s){return n===i||n===s?{start:e-t/2,end:e+t/2}:ns?{start:e-t,end:e}:{start:e,end:e+t}}function n$(n){const e={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},t=Object.assign({},e),i=[],s=[],l=n._pointLabels.length,o=n.options.pointLabels,r=o.centerPointLabels?Wt/l:0;for(let a=0;ae.r&&(r=(i.end-e.r)/l,n.r=Math.max(n.r,e.r+r)),s.starte.b&&(a=(s.end-e.b)/o,n.b=Math.max(n.b,e.b+a))}function s$(n,e,t){const i=[],s=n._pointLabels.length,l=n.options,o=da(l)/2,r=n.drawingArea,a=l.pointLabels.centerPointLabels?Wt/s:0;for(let u=0;u270||t<90)&&(n-=e),n}function a$(n,e){const{ctx:t,options:{pointLabels:i}}=n;for(let s=e-1;s>=0;s--){const l=i.setContext(n.getPointLabelContext(s)),o=Ln(l.font),{x:r,y:a,textAlign:u,left:f,top:c,right:d,bottom:h}=n._pointLabelItems[s],{backdropColor:g}=l;if(!Mt(g)){const v=Ss(l.borderRadius),b=Kn(l.backdropPadding);t.fillStyle=g;const y=f-b.left,$=c-b.top,C=d-f+b.width,S=h-c+b.height;Object.values(v).some(T=>T!==0)?(t.beginPath(),Ao(t,{x:y,y:$,w:C,h:S,radius:v}),t.fill()):t.fillRect(y,$,C,S)}Eo(t,n._pointLabels[s],r,a+o.lineHeight/2,o,{color:l.color,textAlign:u,textBaseline:"middle"})}}function ib(n,e,t,i){const{ctx:s}=n;if(t)s.arc(n.xCenter,n.yCenter,e,0,At);else{let l=n.getPointPosition(0,e);s.moveTo(l.x,l.y);for(let o=1;o{const s=Vt(this.options.pointLabels.callback,[t,i],this);return s||s===0?s:""}).filter((t,i)=>this.chart.getDataVisibility(i))}fit(){const e=this.options;e.display&&e.pointLabels.display?n$(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,i,s){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,i,s))}getIndexAngle(e){const t=At/(this._pointLabels.length||1),i=this.options.startAngle||0;return Pn(e*t+ei(i))}getDistanceFromCenterForValue(e){if(Mt(e))return NaN;const t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(Mt(e))return NaN;const t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){const t=this._pointLabels||[];if(e>=0&&e{if(f!==0){r=this.getDistanceFromCenterForValue(u.value);const c=s.setContext(this.getContext(f-1));u$(this,c,r,l)}}),i.display){for(e.save(),o=l-1;o>=0;o--){const u=i.setContext(this.getPointLabelContext(o)),{color:f,lineWidth:c}=u;!c||!f||(e.lineWidth=c,e.strokeStyle=f,e.setLineDash(u.borderDash),e.lineDashOffset=u.borderDashOffset,r=this.getDistanceFromCenterForValue(t.ticks.reverse?this.min:this.max),a=this.getPointPosition(o,r),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(a.x,a.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,t=this.options,i=t.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let l,o;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(s),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((r,a)=>{if(a===0&&!t.reverse)return;const u=i.setContext(this.getContext(a)),f=Ln(u.font);if(l=this.getDistanceFromCenterForValue(this.ticks[a].value),u.showLabelBackdrop){e.font=f.string,o=e.measureText(r.label).width,e.fillStyle=u.backdropColor;const c=Kn(u.backdropPadding);e.fillRect(-o/2-c.left,-l-f.size/2-c.top,o+c.width,f.size+c.height)}Eo(e,r.label,0,-l,f,{color:u.color})}),e.restore()}drawTitle(){}}nr.id="radialLinear";nr.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:er.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(n){return n},padding:5,centerPointLabels:!1}};nr.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};nr.descriptors={angleLines:{_fallback:"grid"}};const ir={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},kn=Object.keys(ir);function c$(n,e){return n-e}function fc(n,e){if(Mt(e))return null;const t=n._adapter,{parser:i,round:s,isoWeekday:l}=n._parseOpts;let o=e;return typeof i=="function"&&(o=i(o)),Kt(o)||(o=typeof i=="string"?t.parse(o,i):t.parse(o)),o===null?null:(s&&(o=s==="week"&&(Os(l)||l===!0)?t.startOf(o,"isoWeek",l):t.startOf(o,s)),+o)}function cc(n,e,t,i){const s=kn.length;for(let l=kn.indexOf(n);l=kn.indexOf(t);l--){const o=kn[l];if(ir[o].common&&n._adapter.diff(s,i,o)>=e-1)return o}return kn[t?kn.indexOf(t):0]}function p$(n){for(let e=kn.indexOf(n)+1,t=kn.length;e=e?t[i]:t[s];n[l]=!0}}function h$(n,e,t,i){const s=n._adapter,l=+s.startOf(e[0].value,i),o=e[e.length-1].value;let r,a;for(r=l;r<=o;r=+s.add(r,1,i))a=t[r],a>=0&&(e[a].major=!0);return e}function pc(n,e,t){const i=[],s={},l=e.length;let o,r;for(o=0;o+e.value))}initOffsets(e){let t=0,i=0,s,l;this.options.offset&&e.length&&(s=this.getDecimalForValue(e[0]),e.length===1?t=1-s:t=(this.getDecimalForValue(e[1])-s)/2,l=this.getDecimalForValue(e[e.length-1]),e.length===1?i=l:i=(l-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;t=cn(t,0,o),i=cn(i,0,o),this._offsets={start:t,end:i,factor:1/(t+1+i)}}_generate(){const e=this._adapter,t=this.min,i=this.max,s=this.options,l=s.time,o=l.unit||cc(l.minUnit,t,i,this._getLabelCapacity(t)),r=vt(l.stepSize,1),a=o==="week"?l.isoWeekday:!1,u=Os(a)||a===!0,f={};let c=t,d,h;if(u&&(c=+e.startOf(c,"isoWeek",a)),c=+e.startOf(c,u?"day":o),e.diff(i,t,o)>1e5*r)throw new Error(t+" and "+i+" are too far apart with stepSize of "+r+" "+o);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(d=c,h=0;dv-b).map(v=>+v)}getLabelForValue(e){const t=this._adapter,i=this.options.time;return i.tooltipFormat?t.format(e,i.tooltipFormat):t.format(e,i.displayFormats.datetime)}_tickFormatFunction(e,t,i,s){const l=this.options,o=l.time.displayFormats,r=this._unit,a=this._majorUnit,u=r&&o[r],f=a&&o[a],c=i[t],d=a&&f&&c&&c.major,h=this._adapter.format(e,s||(d?f:u)),g=l.ticks.callback;return g?Vt(g,[h,t,i],this):h}generateTickLabels(e){let t,i,s;for(t=0,i=e.length;t0?r:1}getDataTimestamps(){let e=this._cache.data||[],t,i;if(e.length)return e;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,i=s.length;t=n[i].pos&&e<=n[s].pos&&({lo:i,hi:s}=ts(n,"pos",e)),{pos:l,time:r}=n[i],{pos:o,time:a}=n[s]):(e>=n[i].time&&e<=n[s].time&&({lo:i,hi:s}=ts(n,"time",e)),{time:l,pos:r}=n[i],{time:o,pos:a}=n[s]);const u=o-l;return u?r+(a-r)*(e-l)/u:r}class sb extends Ll{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=oo(t,this.min),this._tableRange=oo(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:t,max:i}=this,s=[],l=[];let o,r,a,u,f;for(o=0,r=e.length;o=t&&u<=i&&s.push(u);if(s.length<2)return[{time:t,pos:0},{time:i,pos:1}];for(o=0,r=s.length;o{t||(t=nt(e,Tn,{duration:150},!0)),t.run(1)}),i=!0)},o(s){s&&(t||(t=nt(e,Tn,{duration:150},!1)),t.run(0)),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function g$(n){let e,t,i=n[1]===1?"log":"logs",s;return{c(){e=N(n[1]),t=D(),s=N(i)},m(l,o){w(l,e,o),w(l,t,o),w(l,s,o)},p(l,o){o&2&&ue(e,l[1]),o&2&&i!==(i=l[1]===1?"log":"logs")&&ue(s,i)},d(l){l&&k(e),l&&k(t),l&&k(s)}}}function _$(n){let e;return{c(){e=N("Loading...")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function b$(n){let e,t,i,s,l,o=n[2]&&hc();function r(f,c){return f[2]?_$:g$}let a=r(n),u=a(n);return{c(){e=_("div"),o&&o.c(),t=D(),i=_("canvas"),s=D(),l=_("div"),u.c(),p(i,"class","chart-canvas svelte-vh4sl8"),ou(i,"height","250px"),ou(i,"width","100%"),p(e,"class","chart-wrapper svelte-vh4sl8"),ne(e,"loading",n[2]),p(l,"class","txt-hint m-t-xs txt-right")},m(f,c){w(f,e,c),o&&o.m(e,null),m(e,t),m(e,i),n[8](i),w(f,s,c),w(f,l,c),u.m(l,null)},p(f,[c]){f[2]?o?c&4&&A(o,1):(o=hc(),o.c(),A(o,1),o.m(e,t)):o&&(Ae(),L(o,1,1,()=>{o=null}),Pe()),c&4&&ne(e,"loading",f[2]),a===(a=r(f))&&u?u.p(f,c):(u.d(1),u=a(f),u&&(u.c(),u.m(l,null)))},i(f){A(o)},o(f){L(o)},d(f){f&&k(e),o&&o.d(),n[8](null),f&&k(s),f&&k(l),u.d()}}}function v$(n,e,t){let{filter:i=""}=e,{presets:s=""}=e,l,o,r=[],a=0,u=!1;async function f(){return t(2,u=!0),we.logs.getRequestsStats({filter:[s,i].filter(Boolean).join("&&")}).then(h=>{c();for(let g of h)r.push({x:B.getDateTime(g.date).toLocal().toJSDate(),y:g.total}),t(1,a+=g.total);r.push({x:new Date,y:void 0})}).catch(h=>{h!=null&&h.isAbort||(c(),console.warn(h),we.errorResponseHandler(h,!1))}).finally(()=>{t(2,u=!1)})}function c(){t(1,a=0),t(7,r=[])}Nn(()=>(No.register(Bi,tr,xo,xa,Ll,Vw,Zw),t(6,o=new No(l,{type:"line",data:{datasets:[{label:"Total requests",data:r,borderColor:"#ef4565",pointBackgroundColor:"#ef4565",backgroundColor:"rgb(239,69,101,0.05)",borderWidth:2,pointRadius:1,pointBorderWidth:0,fill:!0}]},options:{animation:!1,interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,grid:{color:"#edf0f3",borderColor:"#dee3e8"},ticks:{precision:0,maxTicksLimit:6,autoSkip:!0,color:"#666f75"}},x:{type:"time",time:{unit:"hour",tooltipFormat:"DD h a"},grid:{borderColor:"#dee3e8",color:h=>h.tick.major?"#edf0f3":""},ticks:{maxTicksLimit:15,autoSkip:!0,maxRotation:0,major:{enabled:!0},color:h=>h.tick.major?"#16161a":"#666f75"}}},plugins:{legend:{display:!1}}}})),()=>o==null?void 0:o.destroy()));function d(h){me[h?"unshift":"push"](()=>{l=h,t(0,l)})}return n.$$set=h=>{"filter"in h&&t(3,i=h.filter),"presets"in h&&t(4,s=h.presets)},n.$$.update=()=>{n.$$.dirty&24&&(typeof i<"u"||typeof s<"u")&&f(),n.$$.dirty&192&&typeof r<"u"&&o&&(t(6,o.data.datasets[0].data=r,o),o.update())},[l,a,u,i,s,f,o,r,d]}class y$ extends Ee{constructor(e){super(),Oe(this,e,v$,b$,De,{filter:3,presets:4,load:5})}get load(){return this.$$.ctx[5]}}var mc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},lb={exports:{}};(function(n){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** - * Prism: Lightweight, robust, elegant syntax highlighting - * - * @license MIT - * @author Lea Verou - * @namespace - * @public - */var t=function(i){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,o={},r={manual:i.Prism&&i.Prism.manual,disableWorkerMessageHandler:i.Prism&&i.Prism.disableWorkerMessageHandler,util:{encode:function $(C){return C instanceof a?new a(C.type,$(C.content),C.alias):Array.isArray(C)?C.map($):C.replace(/&/g,"&").replace(/"u")return null;if("currentScript"in document&&1<2)return document.currentScript;try{throw new Error}catch(T){var $=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(T.stack)||[])[1];if($){var C=document.getElementsByTagName("script");for(var S in C)if(C[S].src==$)return C[S]}return null}},isActive:function($,C,S){for(var T="no-"+C;$;){var M=$.classList;if(M.contains(C))return!0;if(M.contains(T))return!1;$=$.parentElement}return!!S}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function($,C){var S=r.util.clone(r.languages[$]);for(var T in C)S[T]=C[T];return S},insertBefore:function($,C,S,T){T=T||r.languages;var M=T[$],O={};for(var E in M)if(M.hasOwnProperty(E)){if(E==C)for(var P in S)S.hasOwnProperty(P)&&(O[P]=S[P]);S.hasOwnProperty(E)||(O[E]=M[E])}var I=T[$];return T[$]=O,r.languages.DFS(r.languages,function(F,V){V===I&&F!=$&&(this[F]=O)}),O},DFS:function $(C,S,T,M){M=M||{};var O=r.util.objId;for(var E in C)if(C.hasOwnProperty(E)){S.call(C,E,C[E],T||E);var P=C[E],I=r.util.type(P);I==="Object"&&!M[O(P)]?(M[O(P)]=!0,$(P,S,null,M)):I==="Array"&&!M[O(P)]&&(M[O(P)]=!0,$(P,S,E,M))}}},plugins:{},highlightAll:function($,C){r.highlightAllUnder(document,$,C)},highlightAllUnder:function($,C,S){var T={callback:S,container:$,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",T),T.elements=Array.prototype.slice.apply(T.container.querySelectorAll(T.selector)),r.hooks.run("before-all-elements-highlight",T);for(var M=0,O;O=T.elements[M++];)r.highlightElement(O,C===!0,T.callback)},highlightElement:function($,C,S){var T=r.util.getLanguage($),M=r.languages[T];r.util.setLanguage($,T);var O=$.parentElement;O&&O.nodeName.toLowerCase()==="pre"&&r.util.setLanguage(O,T);var E=$.textContent,P={element:$,language:T,grammar:M,code:E};function I(V){P.highlightedCode=V,r.hooks.run("before-insert",P),P.element.innerHTML=P.highlightedCode,r.hooks.run("after-highlight",P),r.hooks.run("complete",P),S&&S.call(P.element)}if(r.hooks.run("before-sanity-check",P),O=P.element.parentElement,O&&O.nodeName.toLowerCase()==="pre"&&!O.hasAttribute("tabindex")&&O.setAttribute("tabindex","0"),!P.code){r.hooks.run("complete",P),S&&S.call(P.element);return}if(r.hooks.run("before-highlight",P),!P.grammar){I(r.util.encode(P.code));return}if(C&&i.Worker){var F=new Worker(r.filename);F.onmessage=function(V){I(V.data)},F.postMessage(JSON.stringify({language:P.language,code:P.code,immediateClose:!0}))}else I(r.highlight(P.code,P.grammar,P.language))},highlight:function($,C,S){var T={code:$,grammar:C,language:S};if(r.hooks.run("before-tokenize",T),!T.grammar)throw new Error('The language "'+T.language+'" has no grammar.');return T.tokens=r.tokenize(T.code,T.grammar),r.hooks.run("after-tokenize",T),a.stringify(r.util.encode(T.tokens),T.language)},tokenize:function($,C){var S=C.rest;if(S){for(var T in S)C[T]=S[T];delete C.rest}var M=new c;return d(M,M.head,$),f($,M,C,M.head,0),g(M)},hooks:{all:{},add:function($,C){var S=r.hooks.all;S[$]=S[$]||[],S[$].push(C)},run:function($,C){var S=r.hooks.all[$];if(!(!S||!S.length))for(var T=0,M;M=S[T++];)M(C)}},Token:a};i.Prism=r;function a($,C,S,T){this.type=$,this.content=C,this.alias=S,this.length=(T||"").length|0}a.stringify=function $(C,S){if(typeof C=="string")return C;if(Array.isArray(C)){var T="";return C.forEach(function(I){T+=$(I,S)}),T}var M={type:C.type,content:$(C.content,S),tag:"span",classes:["token",C.type],attributes:{},language:S},O=C.alias;O&&(Array.isArray(O)?Array.prototype.push.apply(M.classes,O):M.classes.push(O)),r.hooks.run("wrap",M);var E="";for(var P in M.attributes)E+=" "+P+'="'+(M.attributes[P]||"").replace(/"/g,""")+'"';return"<"+M.tag+' class="'+M.classes.join(" ")+'"'+E+">"+M.content+""};function u($,C,S,T){$.lastIndex=C;var M=$.exec(S);if(M&&T&&M[1]){var O=M[1].length;M.index+=O,M[0]=M[0].slice(O)}return M}function f($,C,S,T,M,O){for(var E in S)if(!(!S.hasOwnProperty(E)||!S[E])){var P=S[E];P=Array.isArray(P)?P:[P];for(var I=0;I=O.reach);G+=Y.value.length,Y=Y.next){var de=Y.value;if(C.length>$.length)return;if(!(de instanceof a)){var x=1,ve;if(te){if(ve=u(U,G,$,X),!ve||ve.index>=$.length)break;var ye=ve.index,_e=ve.index+ve[0].length,ge=G;for(ge+=Y.value.length;ye>=ge;)Y=Y.next,ge+=Y.value.length;if(ge-=Y.value.length,G=ge,Y.value instanceof a)continue;for(var K=Y;K!==C.tail&&(ge<_e||typeof K.value=="string");K=K.next)x++,ge+=K.value.length;x--,de=$.slice(G,ge),ve.index-=G}else if(ve=u(U,0,de,X),!ve)continue;var ye=ve.index,oe=ve[0],W=de.slice(0,ye),ce=de.slice(ye+oe.length),ae=G+de.length;O&&ae>O.reach&&(O.reach=ae);var Se=Y.prev;W&&(Se=d(C,Se,W),G+=W.length),h(C,Se,x);var Q=new a(E,V?r.tokenize(oe,V):oe,Z,oe);if(Y=d(C,Se,Q),ce&&d(C,Y,ce),x>1){var $e={cause:E+","+I,reach:ae};f($,C,S,Y.prev,G,$e),O&&$e.reach>O.reach&&(O.reach=$e.reach)}}}}}}function c(){var $={value:null,prev:null,next:null},C={value:null,prev:$,next:null};$.next=C,this.head=$,this.tail=C,this.length=0}function d($,C,S){var T=C.next,M={value:S,prev:C,next:T};return C.next=M,T.prev=M,$.length++,M}function h($,C,S){for(var T=C.next,M=0;M/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},t.languages.markup.tag.inside["attr-value"].inside.entity=t.languages.markup.entity,t.languages.markup.doctype.inside["internal-subset"].inside=t.languages.markup,t.hooks.add("wrap",function(i){i.type==="entity"&&(i.attributes.title=i.content.replace(/&/,"&"))}),Object.defineProperty(t.languages.markup.tag,"addInlined",{value:function(s,l){var o={};o["language-"+l]={pattern:/(^$)/i,lookbehind:!0,inside:t.languages[l]},o.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:o}};r["language-"+l]={pattern:/[\s\S]+/,inside:t.languages[l]};var a={};a[s]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return s}),"i"),lookbehind:!0,greedy:!0,inside:r},t.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(t.languages.markup.tag,"addAttribute",{value:function(i,s){t.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+i+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:t.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),t.languages.html=t.languages.markup,t.languages.mathml=t.languages.markup,t.languages.svg=t.languages.markup,t.languages.xml=t.languages.extend("markup",{}),t.languages.ssml=t.languages.xml,t.languages.atom=t.languages.xml,t.languages.rss=t.languages.xml,function(i){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;i.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},i.languages.css.atrule.inside.rest=i.languages.css;var l=i.languages.markup;l&&(l.tag.addInlined("style","css"),l.tag.addAttribute("style","css"))}(t),t.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},t.languages.javascript=t.languages.extend("clike",{"class-name":[t.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),t.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,t.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:t.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:t.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:t.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:t.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:t.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),t.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:t.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),t.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),t.languages.markup&&(t.languages.markup.tag.addInlined("script","javascript"),t.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),t.languages.js=t.languages.javascript,function(){if(typeof t>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var i="Loading\u2026",s=function(v,b){return"\u2716 Error "+v+" while fetching file: "+b},l="\u2716 Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},r="data-src-status",a="loading",u="loaded",f="failed",c="pre[data-src]:not(["+r+'="'+u+'"]):not(['+r+'="'+a+'"])';function d(v,b,y){var $=new XMLHttpRequest;$.open("GET",v,!0),$.onreadystatechange=function(){$.readyState==4&&($.status<400&&$.responseText?b($.responseText):$.status>=400?y(s($.status,$.statusText)):y(l))},$.send(null)}function h(v){var b=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(v||"");if(b){var y=Number(b[1]),$=b[2],C=b[3];return $?C?[y,Number(C)]:[y,void 0]:[y,y]}}t.hooks.add("before-highlightall",function(v){v.selector+=", "+c}),t.hooks.add("before-sanity-check",function(v){var b=v.element;if(b.matches(c)){v.code="",b.setAttribute(r,a);var y=b.appendChild(document.createElement("CODE"));y.textContent=i;var $=b.getAttribute("data-src"),C=v.language;if(C==="none"){var S=(/\.(\w+)$/.exec($)||[,"none"])[1];C=o[S]||S}t.util.setLanguage(y,C),t.util.setLanguage(b,C);var T=t.plugins.autoloader;T&&T.loadLanguages(C),d($,function(M){b.setAttribute(r,u);var O=h(b.getAttribute("data-range"));if(O){var E=M.split(/\r\n?|\n/g),P=O[0],I=O[1]==null?E.length:O[1];P<0&&(P+=E.length),P=Math.max(0,Math.min(P-1,E.length)),I<0&&(I+=E.length),I=Math.max(0,Math.min(I,E.length)),M=E.slice(P,I).join(` -`),b.hasAttribute("data-start")||b.setAttribute("data-start",String(P+1))}y.textContent=M,t.highlightElement(y)},function(M){b.setAttribute(r,f),y.textContent=M})}}),t.plugins.fileHighlight={highlight:function(b){for(var y=(b||document).querySelectorAll(c),$=0,C;C=y[$++];)t.highlightElement(C)}};var g=!1;t.fileHighlight=function(){g||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),g=!0),t.plugins.fileHighlight.highlight.apply(this,arguments)}}()})(lb);const Xs=lb.exports;var k$={exports:{}};(function(n){(function(){if(typeof Prism>"u")return;var e=Object.assign||function(o,r){for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);return o};function t(o){this.defaults=e({},o)}function i(o){return o.replace(/-(\w)/g,function(r,a){return a.toUpperCase()})}function s(o){for(var r=0,a=0;ar&&(f[d]=` -`+f[d],c=h)}a[u]=f.join("")}return a.join(` -`)}},n.exports&&(n.exports=t),Prism.plugins.NormalizeWhitespace=new t({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.hooks.add("before-sanity-check",function(o){var r=Prism.plugins.NormalizeWhitespace;if(!(o.settings&&o.settings["whitespace-normalization"]===!1)&&!!Prism.util.isActive(o.element,"whitespace-normalization",!0)){if((!o.element||!o.element.parentNode)&&o.code){o.code=r.normalize(o.code,o.settings);return}var a=o.element.parentNode;if(!(!o.code||!a||a.nodeName.toLowerCase()!=="pre")){o.settings==null&&(o.settings={});for(var u in l)if(Object.hasOwnProperty.call(l,u)){var f=l[u];if(a.hasAttribute("data-"+u))try{var c=JSON.parse(a.getAttribute("data-"+u)||"true");typeof c===f&&(o.settings[u]=c)}catch{}}for(var d=a.childNodes,h="",g="",v=!1,b=0;b>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),n.languages.insertBefore("dart","string",{"string-literal":{pattern:/r?(?:("""|''')[\s\S]*?\1|(["'])(?:\\.|(?!\2)[^\\\r\n])*\2(?!\2))/,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,lookbehind:!0,inside:{punctuation:/^\$\{?|\}$/,expression:{pattern:/[\s\S]+/,inside:n.languages.dart}}},string:/[\s\S]+/}},string:void 0}),n.languages.insertBefore("dart","class-name",{metadata:{pattern:/@\w+/,alias:"function"}}),n.languages.insertBefore("dart","class-name",{generics:{pattern:/<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,inside:{"class-name":i,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}}})})(Prism);function w$(n){let e,t,i;return{c(){e=_("div"),t=_("code"),p(t,"class","svelte-1ua9m3i"),p(e,"class",i="code-wrapper prism-light "+n[0]+" svelte-1ua9m3i")},m(s,l){w(s,e,l),m(e,t),t.innerHTML=n[1]},p(s,[l]){l&2&&(t.innerHTML=s[1]),l&1&&i!==(i="code-wrapper prism-light "+s[0]+" svelte-1ua9m3i")&&p(e,"class",i)},i:se,o:se,d(s){s&&k(e)}}}function $$(n,e,t){let{class:i=""}=e,{content:s=""}=e,{language:l="javascript"}=e,o="";function r(a){return a=typeof a=="string"?a:"",a=Xs.plugins.NormalizeWhitespace.normalize(a,{"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Xs.highlight(a,Xs.languages[l]||Xs.languages.javascript,l)}return n.$$set=a=>{"class"in a&&t(0,i=a.class),"content"in a&&t(2,s=a.content),"language"in a&&t(3,l=a.language)},n.$$.update=()=>{n.$$.dirty&4&&typeof Xs<"u"&&s&&t(1,o=r(s))},[i,o,s,l]}class bn extends Ee{constructor(e){super(),Oe(this,e,$$,w$,De,{class:0,content:2,language:3})}}const S$=n=>({}),gc=n=>({}),C$=n=>({}),_c=n=>({});function bc(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g,v,b,y,$,C=n[4]&&!n[2]&&vc(n);const S=n[18].header,T=$n(S,n,n[17],_c);let M=n[4]&&n[2]&&yc(n);const O=n[18].default,E=$n(O,n,n[17],null),P=n[18].footer,I=$n(P,n,n[17],gc);return{c(){e=_("div"),t=_("div"),s=D(),l=_("div"),o=_("div"),C&&C.c(),r=D(),T&&T.c(),a=D(),M&&M.c(),u=D(),f=_("div"),E&&E.c(),c=D(),d=_("div"),I&&I.c(),p(t,"class","overlay"),p(o,"class","overlay-panel-section panel-header"),p(f,"class","overlay-panel-section panel-content"),p(d,"class","overlay-panel-section panel-footer"),p(l,"class",h="overlay-panel "+n[1]+" "+n[8]),ne(l,"popup",n[2]),p(e,"class","overlay-panel-container"),ne(e,"padded",n[2]),ne(e,"active",n[0])},m(F,V){w(F,e,V),m(e,t),m(e,s),m(e,l),m(l,o),C&&C.m(o,null),m(o,r),T&&T.m(o,null),m(o,a),M&&M.m(o,null),m(l,u),m(l,f),E&&E.m(f,null),n[20](f),m(l,c),m(l,d),I&&I.m(d,null),b=!0,y||($=[J(t,"click",Yt(n[19])),J(f,"scroll",n[21])],y=!0)},p(F,V){n=F,n[4]&&!n[2]?C?C.p(n,V):(C=vc(n),C.c(),C.m(o,r)):C&&(C.d(1),C=null),T&&T.p&&(!b||V&131072)&&Cn(T,S,n,n[17],b?Sn(S,n[17],V,C$):Mn(n[17]),_c),n[4]&&n[2]?M?M.p(n,V):(M=yc(n),M.c(),M.m(o,null)):M&&(M.d(1),M=null),E&&E.p&&(!b||V&131072)&&Cn(E,O,n,n[17],b?Sn(O,n[17],V,null):Mn(n[17]),null),I&&I.p&&(!b||V&131072)&&Cn(I,P,n,n[17],b?Sn(P,n[17],V,S$):Mn(n[17]),gc),(!b||V&258&&h!==(h="overlay-panel "+n[1]+" "+n[8]))&&p(l,"class",h),(!b||V&262)&&ne(l,"popup",n[2]),(!b||V&4)&&ne(e,"padded",n[2]),(!b||V&1)&&ne(e,"active",n[0])},i(F){b||(Tt(()=>{i||(i=nt(t,So,{duration:ys,opacity:0},!0)),i.run(1)}),A(T,F),A(E,F),A(I,F),Tt(()=>{v&&v.end(1),g=Gm(l,Wn,n[2]?{duration:ys,y:-10}:{duration:ys,x:50}),g.start()}),b=!0)},o(F){i||(i=nt(t,So,{duration:ys,opacity:0},!1)),i.run(0),L(T,F),L(E,F),L(I,F),g&&g.invalidate(),v=Xm(l,Wn,n[2]?{duration:ys,y:10}:{duration:ys,x:50}),b=!1},d(F){F&&k(e),F&&i&&i.end(),C&&C.d(),T&&T.d(F),M&&M.d(),E&&E.d(F),n[20](null),I&&I.d(F),F&&v&&v.end(),y=!1,Ye($)}}}function vc(n){let e,t,i;return{c(){e=_("div"),e.innerHTML='',p(e,"class","overlay-close")},m(s,l){w(s,e,l),t||(i=J(e,"click",Yt(n[5])),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function yc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-secondary btn-close m-l-auto")},m(s,l){w(s,e,l),t||(i=J(e,"click",Yt(n[5])),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function M$(n){let e,t,i,s,l=n[0]&&bc(n);return{c(){e=_("div"),l&&l.c(),p(e,"class","overlay-panel-wrapper")},m(o,r){w(o,e,r),l&&l.m(e,null),n[22](e),t=!0,i||(s=[J(window,"resize",n[10]),J(window,"keydown",n[9])],i=!0)},p(o,[r]){o[0]?l?(l.p(o,r),r&1&&A(l,1)):(l=bc(o),l.c(),A(l,1),l.m(e,null)):l&&(Ae(),L(l,1,1,()=>{l=null}),Pe())},i(o){t||(A(l),t=!0)},o(o){L(l),t=!1},d(o){o&&k(e),l&&l.d(),n[22](null),i=!1,Ye(s)}}}let Gi;function ob(){return Gi=Gi||document.querySelector(".overlays"),Gi||(Gi=document.createElement("div"),Gi.classList.add("overlays"),document.body.appendChild(Gi)),Gi}let ys=150;function kc(){return 1e3+ob().querySelectorAll(".overlay-panel-container.active").length}function T$(n,e,t){let{$$slots:i={},$$scope:s}=e,{class:l=""}=e,{active:o=!1}=e,{popup:r=!1}=e,{overlayClose:a=!0}=e,{btnClose:u=!0}=e,{escClose:f=!0}=e,{beforeOpen:c=void 0}=e,{beforeHide:d=void 0}=e;const h=Qt();let g,v,b,y,$="";function C(){typeof c=="function"&&c()===!1||t(0,o=!0)}function S(){typeof d=="function"&&d()===!1||t(0,o=!1)}function T(){return o}async function M(Z){Z?(b=document.activeElement,g==null||g.focus(),h("show")):(clearTimeout(y),b==null||b.focus(),h("hide")),await Zn(),O()}function O(){!g||(o?t(6,g.style.zIndex=kc(),g):t(6,g.style="",g))}function E(Z){o&&f&&Z.code=="Escape"&&!B.isInput(Z.target)&&g&&g.style.zIndex==kc()&&(Z.preventDefault(),S())}function P(Z){o&&I(v)}function I(Z,ee){ee&&t(8,$=""),Z&&(y||(y=setTimeout(()=>{if(clearTimeout(y),y=null,!Z)return;if(Z.scrollHeight-Z.offsetHeight>0)t(8,$="scrollable");else{t(8,$="");return}Z.scrollTop==0?t(8,$+=" scroll-top-reached"):Z.scrollTop+Z.offsetHeight==Z.scrollHeight&&t(8,$+=" scroll-bottom-reached")},100)))}Nn(()=>(ob().appendChild(g),()=>{var Z;clearTimeout(y),(Z=g==null?void 0:g.classList)==null||Z.add("hidden")}));const F=()=>a?S():!0;function V(Z){me[Z?"unshift":"push"](()=>{v=Z,t(7,v)})}const X=Z=>I(Z.target);function te(Z){me[Z?"unshift":"push"](()=>{g=Z,t(6,g)})}return n.$$set=Z=>{"class"in Z&&t(1,l=Z.class),"active"in Z&&t(0,o=Z.active),"popup"in Z&&t(2,r=Z.popup),"overlayClose"in Z&&t(3,a=Z.overlayClose),"btnClose"in Z&&t(4,u=Z.btnClose),"escClose"in Z&&t(12,f=Z.escClose),"beforeOpen"in Z&&t(13,c=Z.beforeOpen),"beforeHide"in Z&&t(14,d=Z.beforeHide),"$$scope"in Z&&t(17,s=Z.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&M(o),n.$$.dirty&128&&I(v,!0),n.$$.dirty&64&&g&&O()},[o,l,r,a,u,S,g,v,$,E,P,I,f,c,d,C,T,s,i,F,V,X,te]}class ui extends Ee{constructor(e){super(),Oe(this,e,T$,M$,De,{class:1,active:0,popup:2,overlayClose:3,btnClose:4,escClose:12,beforeOpen:13,beforeHide:14,show:15,hide:5,isActive:16})}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[5]}get isActive(){return this.$$.ctx[16]}}function D$(n){let e;return{c(){e=_("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function O$(n){let e,t=n[2].referer+"",i,s;return{c(){e=_("a"),i=N(t),p(e,"href",s=n[2].referer),p(e,"target","_blank"),p(e,"rel","noopener noreferrer")},m(l,o){w(l,e,o),m(e,i)},p(l,o){o&4&&t!==(t=l[2].referer+"")&&ue(i,t),o&4&&s!==(s=l[2].referer)&&p(e,"href",s)},d(l){l&&k(e)}}}function E$(n){let e;return{c(){e=_("span"),e.textContent="N/A",p(e,"class","txt-hint")},m(t,i){w(t,e,i)},p:se,i:se,o:se,d(t){t&&k(e)}}}function A$(n){let e,t;return e=new bn({props:{content:JSON.stringify(n[2].meta,null,2)}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,s){const l={};s&4&&(l.content=JSON.stringify(i[2].meta,null,2)),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function P$(n){var le;let e,t,i,s,l,o,r=n[2].id+"",a,u,f,c,d,h,g,v=n[2].status+"",b,y,$,C,S,T,M=((le=n[2].method)==null?void 0:le.toUpperCase())+"",O,E,P,I,F,V,X=n[2].auth+"",te,Z,ee,U,Y,G,de=n[2].url+"",x,ve,_e,ge,K,ye,oe,W,ce,ae,Se,Q=n[2].remoteIp+"",$e,Be,Xe,ut,it,Je,et=n[2].userIp+"",Te,Ve,Ze,tt,dt,be,Fe=n[2].userAgent+"",pt,Dt,ht,st,Lt,_t,Ft,Ot,Ke,Ce,ze,lt,ot,Ht,Ct,ft;function xt(pe,ke){return pe[2].referer?O$:D$}let R=xt(n),z=R(n);const ie=[A$,E$],re=[];function Le(pe,ke){return ke&4&&(Ft=null),Ft==null&&(Ft=!B.isEmpty(pe[2].meta)),Ft?0:1}return Ot=Le(n,-1),Ke=re[Ot]=ie[Ot](n),Ct=new Si({props:{date:n[2].created}}),{c(){e=_("table"),t=_("tbody"),i=_("tr"),s=_("td"),s.textContent="ID",l=D(),o=_("td"),a=N(r),u=D(),f=_("tr"),c=_("td"),c.textContent="Status",d=D(),h=_("td"),g=_("span"),b=N(v),y=D(),$=_("tr"),C=_("td"),C.textContent="Method",S=D(),T=_("td"),O=N(M),E=D(),P=_("tr"),I=_("td"),I.textContent="Auth",F=D(),V=_("td"),te=N(X),Z=D(),ee=_("tr"),U=_("td"),U.textContent="URL",Y=D(),G=_("td"),x=N(de),ve=D(),_e=_("tr"),ge=_("td"),ge.textContent="Referer",K=D(),ye=_("td"),z.c(),oe=D(),W=_("tr"),ce=_("td"),ce.textContent="Remote IP",ae=D(),Se=_("td"),$e=N(Q),Be=D(),Xe=_("tr"),ut=_("td"),ut.textContent="User IP",it=D(),Je=_("td"),Te=N(et),Ve=D(),Ze=_("tr"),tt=_("td"),tt.textContent="UserAgent",dt=D(),be=_("td"),pt=N(Fe),Dt=D(),ht=_("tr"),st=_("td"),st.textContent="Meta",Lt=D(),_t=_("td"),Ke.c(),Ce=D(),ze=_("tr"),lt=_("td"),lt.textContent="Created",ot=D(),Ht=_("td"),q(Ct.$$.fragment),p(s,"class","min-width txt-hint txt-bold"),p(c,"class","min-width txt-hint txt-bold"),p(g,"class","label"),ne(g,"label-danger",n[2].status>=400),p(C,"class","min-width txt-hint txt-bold"),p(I,"class","min-width txt-hint txt-bold"),p(U,"class","min-width txt-hint txt-bold"),p(ge,"class","min-width txt-hint txt-bold"),p(ce,"class","min-width txt-hint txt-bold"),p(ut,"class","min-width txt-hint txt-bold"),p(tt,"class","min-width txt-hint txt-bold"),p(st,"class","min-width txt-hint txt-bold"),p(lt,"class","min-width txt-hint txt-bold"),p(e,"class","table-compact table-border")},m(pe,ke){w(pe,e,ke),m(e,t),m(t,i),m(i,s),m(i,l),m(i,o),m(o,a),m(t,u),m(t,f),m(f,c),m(f,d),m(f,h),m(h,g),m(g,b),m(t,y),m(t,$),m($,C),m($,S),m($,T),m(T,O),m(t,E),m(t,P),m(P,I),m(P,F),m(P,V),m(V,te),m(t,Z),m(t,ee),m(ee,U),m(ee,Y),m(ee,G),m(G,x),m(t,ve),m(t,_e),m(_e,ge),m(_e,K),m(_e,ye),z.m(ye,null),m(t,oe),m(t,W),m(W,ce),m(W,ae),m(W,Se),m(Se,$e),m(t,Be),m(t,Xe),m(Xe,ut),m(Xe,it),m(Xe,Je),m(Je,Te),m(t,Ve),m(t,Ze),m(Ze,tt),m(Ze,dt),m(Ze,be),m(be,pt),m(t,Dt),m(t,ht),m(ht,st),m(ht,Lt),m(ht,_t),re[Ot].m(_t,null),m(t,Ce),m(t,ze),m(ze,lt),m(ze,ot),m(ze,Ht),H(Ct,Ht,null),ft=!0},p(pe,ke){var Ie;(!ft||ke&4)&&r!==(r=pe[2].id+"")&&ue(a,r),(!ft||ke&4)&&v!==(v=pe[2].status+"")&&ue(b,v),(!ft||ke&4)&&ne(g,"label-danger",pe[2].status>=400),(!ft||ke&4)&&M!==(M=((Ie=pe[2].method)==null?void 0:Ie.toUpperCase())+"")&&ue(O,M),(!ft||ke&4)&&X!==(X=pe[2].auth+"")&&ue(te,X),(!ft||ke&4)&&de!==(de=pe[2].url+"")&&ue(x,de),R===(R=xt(pe))&&z?z.p(pe,ke):(z.d(1),z=R(pe),z&&(z.c(),z.m(ye,null))),(!ft||ke&4)&&Q!==(Q=pe[2].remoteIp+"")&&ue($e,Q),(!ft||ke&4)&&et!==(et=pe[2].userIp+"")&&ue(Te,et),(!ft||ke&4)&&Fe!==(Fe=pe[2].userAgent+"")&&ue(pt,Fe);let fe=Ot;Ot=Le(pe,ke),Ot===fe?re[Ot].p(pe,ke):(Ae(),L(re[fe],1,1,()=>{re[fe]=null}),Pe(),Ke=re[Ot],Ke?Ke.p(pe,ke):(Ke=re[Ot]=ie[Ot](pe),Ke.c()),A(Ke,1),Ke.m(_t,null));const he={};ke&4&&(he.date=pe[2].created),Ct.$set(he)},i(pe){ft||(A(Ke),A(Ct.$$.fragment,pe),ft=!0)},o(pe){L(Ke),L(Ct.$$.fragment,pe),ft=!1},d(pe){pe&&k(e),z.d(),re[Ot].d(),j(Ct)}}}function L$(n){let e;return{c(){e=_("h4"),e.textContent="Request log"},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function I$(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Close',p(e,"type","button"),p(e,"class","btn btn-secondary")},m(s,l){w(s,e,l),t||(i=J(e,"click",n[4]),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function N$(n){let e,t,i={class:"overlay-panel-lg log-panel",$$slots:{footer:[I$],header:[L$],default:[P$]},$$scope:{ctx:n}};return e=new ui({props:i}),n[5](e),e.$on("hide",n[6]),e.$on("show",n[7]),{c(){q(e.$$.fragment)},m(s,l){H(e,s,l),t=!0},p(s,[l]){const o={};l&260&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){L(e.$$.fragment,s),t=!1},d(s){n[5](null),j(e,s)}}}function F$(n,e,t){let i,s=new zr;function l(c){return t(2,s=c),i==null?void 0:i.show()}function o(){return i==null?void 0:i.hide()}const r=()=>o();function a(c){me[c?"unshift":"push"](()=>{i=c,t(1,i)})}function u(c){xe.call(this,n,c)}function f(c){xe.call(this,n,c)}return[o,i,s,l,r,a,u,f]}class R$ extends Ee{constructor(e){super(),Oe(this,e,F$,N$,De,{show:3,hide:0})}get show(){return this.$$.ctx[3]}get hide(){return this.$$.ctx[0]}}function H$(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=D(),s=_("label"),l=N("Include requests by admins"),p(e,"type","checkbox"),p(e,"id",t=n[14]),p(s,"for",o=n[14])},m(u,f){w(u,e,f),e.checked=n[0],w(u,i,f),w(u,s,f),m(s,l),r||(a=J(e,"change",n[8]),r=!0)},p(u,f){f&16384&&t!==(t=u[14])&&p(e,"id",t),f&1&&(e.checked=u[0]),f&16384&&o!==(o=u[14])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function wc(n){let e,t,i;function s(o){n[10](o)}let l={presets:n[4]};return n[2]!==void 0&&(l.filter=n[2]),e=new y$({props:l}),me.push(()=>Re(e,"filter",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r&16&&(a.presets=o[4]),!t&&r&4&&(t=!0,a.filter=o[2],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function $c(n){let e,t,i;function s(o){n[11](o)}let l={presets:n[4]};return n[2]!==void 0&&(l.filter=n[2]),e=new jv({props:l}),me.push(()=>Re(e,"filter",s)),e.$on("select",n[12]),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r&16&&(a.presets=o[4]),!t&&r&4&&(t=!0,a.filter=o[2],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function j$(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g,v,b,y,$=n[3],C,S=n[3],T,M;r=new Xo({}),r.$on("refresh",n[7]),d=new Ne({props:{class:"form-field form-field-toggle m-0",$$slots:{default:[H$,({uniqueId:P})=>({14:P}),({uniqueId:P})=>P?16384:0]},$$scope:{ctx:n}}}),g=new Go({props:{value:n[2],placeholder:"Search logs, ex. status > 200",extraAutocompleteKeys:["method","url","remoteIp","userIp","referer","status","auth","userAgent"]}}),g.$on("submit",n[9]);let O=wc(n),E=$c(n);return{c(){e=_("div"),t=_("header"),i=_("nav"),s=_("div"),l=N(n[5]),o=D(),q(r.$$.fragment),a=D(),u=_("div"),f=D(),c=_("div"),q(d.$$.fragment),h=D(),q(g.$$.fragment),v=D(),b=_("div"),y=D(),O.c(),C=D(),E.c(),T=Ue(),p(s,"class","breadcrumb-item"),p(i,"class","breadcrumbs"),p(u,"class","flex-fill"),p(c,"class","inline-flex"),p(t,"class","page-header"),p(b,"class","clearfix m-b-xs"),p(e,"class","page-header-wrapper m-b-0")},m(P,I){w(P,e,I),m(e,t),m(t,i),m(i,s),m(s,l),m(t,o),H(r,t,null),m(t,a),m(t,u),m(t,f),m(t,c),H(d,c,null),m(e,h),H(g,e,null),m(e,v),m(e,b),m(e,y),O.m(e,null),w(P,C,I),E.m(P,I),w(P,T,I),M=!0},p(P,I){(!M||I&32)&&ue(l,P[5]);const F={};I&49153&&(F.$$scope={dirty:I,ctx:P}),d.$set(F);const V={};I&4&&(V.value=P[2]),g.$set(V),I&8&&De($,$=P[3])?(Ae(),L(O,1,1,se),Pe(),O=wc(P),O.c(),A(O,1),O.m(e,null)):O.p(P,I),I&8&&De(S,S=P[3])?(Ae(),L(E,1,1,se),Pe(),E=$c(P),E.c(),A(E,1),E.m(T.parentNode,T)):E.p(P,I)},i(P){M||(A(r.$$.fragment,P),A(d.$$.fragment,P),A(g.$$.fragment,P),A(O),A(E),M=!0)},o(P){L(r.$$.fragment,P),L(d.$$.fragment,P),L(g.$$.fragment,P),L(O),L(E),M=!1},d(P){P&&k(e),j(r),j(d),j(g),O.d(P),P&&k(C),P&&k(T),E.d(P)}}}function q$(n){let e,t,i,s;e=new On({props:{$$slots:{default:[j$]},$$scope:{ctx:n}}});let l={};return i=new R$({props:l}),n[13](i),{c(){q(e.$$.fragment),t=D(),q(i.$$.fragment)},m(o,r){H(e,o,r),w(o,t,r),H(i,o,r),s=!0},p(o,[r]){const a={};r&32831&&(a.$$scope={dirty:r,ctx:o}),e.$set(a);const u={};i.$set(u)},i(o){s||(A(e.$$.fragment,o),A(i.$$.fragment,o),s=!0)},o(o){L(e.$$.fragment,o),L(i.$$.fragment,o),s=!1},d(o){j(e,o),o&&k(t),n[13](null),j(i,o)}}}const Sc="includeAdminLogs";function V$(n,e,t){var y;let i,s;rt(n,Nt,$=>t(5,s=$)),tn(Nt,s="Request logs",s);let l,o="",r=((y=window.localStorage)==null?void 0:y.getItem(Sc))<<0,a=1;function u(){t(3,a++,a)}const f=()=>u();function c(){r=this.checked,t(0,r)}const d=$=>t(2,o=$.detail);function h($){o=$,t(2,o)}function g($){o=$,t(2,o)}const v=$=>l==null?void 0:l.show($==null?void 0:$.detail);function b($){me[$?"unshift":"push"](()=>{l=$,t(1,l)})}return n.$$.update=()=>{n.$$.dirty&1&&t(4,i=r?"":'auth!="admin"'),n.$$.dirty&1&&typeof r<"u"&&window.localStorage&&window.localStorage.setItem(Sc,r<<0)},[r,l,o,a,i,s,u,f,c,d,h,g,v,b]}class z$ extends Ee{constructor(e){super(),Oe(this,e,V$,q$,De,{})}}const Ps=Gn([]),hi=Gn({}),pa=Gn(!1);function B$(n){hi.update(e=>B.isEmpty(e==null?void 0:e.id)||e.id===n.id?n:e),Ps.update(e=>(B.pushOrReplaceByKey(e,n,"id"),e))}function U$(n){Ps.update(e=>(B.removeByKey(e,"id",n.id),hi.update(t=>t.id===n.id?e.find(i=>i.name!="profiles")||{}:t),e))}async function W$(n=null){return pa.set(!0),hi.set({}),Ps.set([]),we.collections.getFullList(200,{sort:"+created"}).then(e=>{Ps.set(e);const t=n&&B.findByKey(e,"id",n);if(t)hi.set(t);else if(e.length){const i=e.find(s=>s.name!="profiles");i&&hi.set(i)}}).catch(e=>{we.errorResponseHandler(e)}).finally(()=>{pa.set(!1)})}const eu=Gn({});function si(n,e,t){eu.set({text:n,yesCallback:e,noCallback:t})}function rb(){eu.set({})}function Cc(n){let e,t,i,s;const l=n[13].default,o=$n(l,n,n[12],null);return{c(){e=_("div"),o&&o.c(),p(e,"class",n[1]),ne(e,"active",n[0])},m(r,a){w(r,e,a),o&&o.m(e,null),s=!0},p(r,a){o&&o.p&&(!s||a&4096)&&Cn(o,l,r,r[12],s?Sn(l,r[12],a,null):Mn(r[12]),null),(!s||a&2)&&p(e,"class",r[1]),(!s||a&3)&&ne(e,"active",r[0])},i(r){s||(A(o,r),r&&Tt(()=>{i&&i.end(1),t=Gm(e,Wn,{duration:150,y:-5}),t.start()}),s=!0)},o(r){L(o,r),t&&t.invalidate(),r&&(i=Xm(e,Wn,{duration:150,y:2})),s=!1},d(r){r&&k(e),o&&o.d(r),r&&i&&i.end()}}}function Y$(n){let e,t,i,s,l=n[0]&&Cc(n);return{c(){e=_("div"),l&&l.c(),p(e,"class","toggler-container")},m(o,r){w(o,e,r),l&&l.m(e,null),n[14](e),t=!0,i||(s=[J(window,"click",n[3]),J(window,"keydown",n[4]),J(window,"focusin",n[5])],i=!0)},p(o,[r]){o[0]?l?(l.p(o,r),r&1&&A(l,1)):(l=Cc(o),l.c(),A(l,1),l.m(e,null)):l&&(Ae(),L(l,1,1,()=>{l=null}),Pe())},i(o){t||(A(l),t=!0)},o(o){L(l),t=!1},d(o){o&&k(e),l&&l.d(),n[14](null),i=!1,Ye(s)}}}function K$(n,e,t){let{$$slots:i={},$$scope:s}=e,{trigger:l=void 0}=e,{active:o=!1}=e,{escClose:r=!0}=e,{closableClass:a="closable"}=e,{class:u=""}=e,f;const c=Qt();function d(){t(0,o=!1)}function h(){t(0,o=!0)}function g(){o?d():h()}function v(M){return!f||M.classList.contains(a)||(l==null?void 0:l.contains(M))&&!f.contains(M)||f.contains(M)&&M.closest&&M.closest("."+a)}function b(M){(!o||v(M.target))&&(M.preventDefault(),g())}function y(M){(M.code==="Enter"||M.code==="Space")&&(!o||v(M.target))&&(M.preventDefault(),M.stopPropagation(),g())}function $(M){o&&!(f!=null&&f.contains(M.target))&&!(l!=null&&l.contains(M.target))&&d()}function C(M){o&&r&&M.code=="Escape"&&(M.preventDefault(),d())}function S(M){return $(M)}Nn(()=>(t(6,l=l||f.parentNode),l.addEventListener("click",b),l.addEventListener("keydown",y),()=>{l.removeEventListener("click",b),l.removeEventListener("keydown",y)}));function T(M){me[M?"unshift":"push"](()=>{f=M,t(2,f)})}return n.$$set=M=>{"trigger"in M&&t(6,l=M.trigger),"active"in M&&t(0,o=M.active),"escClose"in M&&t(7,r=M.escClose),"closableClass"in M&&t(8,a=M.closableClass),"class"in M&&t(1,u=M.class),"$$scope"in M&&t(12,s=M.$$scope)},n.$$.update=()=>{var M,O;n.$$.dirty&65&&(o?((M=l==null?void 0:l.classList)==null||M.add("active"),c("show")):((O=l==null?void 0:l.classList)==null||O.remove("active"),c("hide")))},[o,u,f,$,C,S,l,r,a,d,h,g,s,i,T]}class Ti extends Ee{constructor(e){super(),Oe(this,e,K$,Y$,De,{trigger:6,active:0,escClose:7,closableClass:8,class:1,hide:9,show:10,toggle:11})}get hide(){return this.$$.ctx[9]}get show(){return this.$$.ctx[10]}get toggle(){return this.$$.ctx[11]}}const J$=n=>({active:n&1}),Mc=n=>({active:n[0]});function Tc(n){let e,t,i;const s=n[12].default,l=$n(s,n,n[11],null);return{c(){e=_("div"),l&&l.c(),p(e,"class","accordion-content")},m(o,r){w(o,e,r),l&&l.m(e,null),i=!0},p(o,r){l&&l.p&&(!i||r&2048)&&Cn(l,s,o,o[11],i?Sn(s,o[11],r,null):Mn(o[11]),null)},i(o){i||(A(l,o),o&&Tt(()=>{t||(t=nt(e,on,{duration:150},!0)),t.run(1)}),i=!0)},o(o){L(l,o),o&&(t||(t=nt(e,on,{duration:150},!1)),t.run(0)),i=!1},d(o){o&&k(e),l&&l.d(o),o&&t&&t.end()}}}function Z$(n){let e,t,i,s,l,o,r,a;const u=n[12].header,f=$n(u,n,n[11],Mc);let c=n[0]&&Tc(n);return{c(){e=_("div"),t=_("header"),f&&f.c(),i=D(),c&&c.c(),p(t,"class","accordion-header"),ne(t,"interactive",n[2]),p(e,"tabindex",s=n[2]?0:-1),p(e,"class",l="accordion "+n[1]),ne(e,"active",n[0])},m(d,h){w(d,e,h),m(e,t),f&&f.m(t,null),m(e,i),c&&c.m(e,null),n[14](e),o=!0,r||(a=[J(t,"click",Yt(n[13])),J(e,"keydown",Um(n[5]))],r=!0)},p(d,[h]){f&&f.p&&(!o||h&2049)&&Cn(f,u,d,d[11],o?Sn(u,d[11],h,J$):Mn(d[11]),Mc),(!o||h&4)&&ne(t,"interactive",d[2]),d[0]?c?(c.p(d,h),h&1&&A(c,1)):(c=Tc(d),c.c(),A(c,1),c.m(e,null)):c&&(Ae(),L(c,1,1,()=>{c=null}),Pe()),(!o||h&4&&s!==(s=d[2]?0:-1))&&p(e,"tabindex",s),(!o||h&2&&l!==(l="accordion "+d[1]))&&p(e,"class",l),(!o||h&3)&&ne(e,"active",d[0])},i(d){o||(A(f,d),A(c),o=!0)},o(d){L(f,d),L(c),o=!1},d(d){d&&k(e),f&&f.d(d),c&&c.d(),n[14](null),r=!1,Ye(a)}}}function G$(n,e,t){let{$$slots:i={},$$scope:s}=e;const l=Qt();let o,r,{class:a=""}=e,{active:u=!1}=e,{interactive:f=!0}=e,{single:c=!1}=e;function d(){v(),t(0,u=!0),l("expand")}function h(){t(0,u=!1),clearTimeout(r),l("collapse")}function g(){l("toggle"),u?h():d()}function v(){if(c&&o.parentElement){const C=o.parentElement.querySelectorAll(".accordion.active .accordion-header.interactive");for(const S of C)S.click()}}function b(C){!f||(C.code==="Enter"||C.code==="Space")&&(C.preventDefault(),g())}Nn(()=>()=>clearTimeout(r));const y=()=>f&&g();function $(C){me[C?"unshift":"push"](()=>{o=C,t(4,o)})}return n.$$set=C=>{"class"in C&&t(1,a=C.class),"active"in C&&t(0,u=C.active),"interactive"in C&&t(2,f=C.interactive),"single"in C&&t(6,c=C.single),"$$scope"in C&&t(11,s=C.$$scope)},n.$$.update=()=>{n.$$.dirty&1041&&u&&(clearTimeout(r),t(10,r=setTimeout(()=>{o!=null&&o.scrollIntoView&&o.scrollIntoView({behavior:"smooth",block:"nearest"})},250)))},[u,a,f,g,o,b,c,d,h,v,r,s,i,y,$]}class sr extends Ee{constructor(e){super(),Oe(this,e,G$,Z$,De,{class:1,active:0,interactive:2,single:6,expand:7,collapse:8,toggle:3,collapseSiblings:9})}get expand(){return this.$$.ctx[7]}get collapse(){return this.$$.ctx[8]}get toggle(){return this.$$.ctx[3]}get collapseSiblings(){return this.$$.ctx[9]}}const X$=n=>({}),Dc=n=>({});function Oc(n,e,t){const i=n.slice();return i[45]=e[t],i}const Q$=n=>({}),Ec=n=>({});function Ac(n,e,t){const i=n.slice();return i[45]=e[t],i}function Pc(n){let e,t;return{c(){e=_("div"),t=N(n[2]),p(e,"class","txt-placeholder")},m(i,s){w(i,e,s),m(e,t)},p(i,s){s[0]&4&&ue(t,i[2])},d(i){i&&k(e)}}}function x$(n){let e,t=n[45]+"",i;return{c(){e=_("span"),i=N(t),p(e,"class","txt")},m(s,l){w(s,e,l),m(e,i)},p(s,l){l[0]&1&&t!==(t=s[45]+"")&&ue(i,t)},i:se,o:se,d(s){s&&k(e)}}}function eS(n){let e,t,i;const s=[{item:n[45]},n[8]];var l=n[7];function o(r){let a={};for(let u=0;u{j(f,1)}),Pe()}l?(e=new l(o()),q(e.$$.fragment),A(e.$$.fragment,1),H(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&L(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&j(e,r)}}}function Lc(n){let e,t,i;function s(){return n[33](n[45])}return{c(){e=_("span"),e.innerHTML='',p(e,"class","clear")},m(l,o){w(l,e,o),t||(i=[We(yt.call(null,e,"Clear")),J(e,"click",ni(Yt(s)))],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,Ye(i)}}}function Ic(n){let e,t,i,s,l,o;const r=[eS,x$],a=[];function u(c,d){return c[7]?0:1}t=u(n),i=a[t]=r[t](n);let f=(n[4]||n[6])&&Lc(n);return{c(){e=_("div"),i.c(),s=D(),f&&f.c(),l=D(),p(e,"class","option")},m(c,d){w(c,e,d),a[t].m(e,null),m(e,s),f&&f.m(e,null),m(e,l),o=!0},p(c,d){let h=t;t=u(c),t===h?a[t].p(c,d):(Ae(),L(a[h],1,1,()=>{a[h]=null}),Pe(),i=a[t],i?i.p(c,d):(i=a[t]=r[t](c),i.c()),A(i,1),i.m(e,s)),c[4]||c[6]?f?f.p(c,d):(f=Lc(c),f.c(),f.m(e,l)):f&&(f.d(1),f=null)},i(c){o||(A(i),o=!0)},o(c){L(i),o=!1},d(c){c&&k(e),a[t].d(),f&&f.d()}}}function Nc(n){let e,t,i={class:"dropdown dropdown-block options-dropdown dropdown-left",trigger:n[17],$$slots:{default:[iS]},$$scope:{ctx:n}};return e=new Ti({props:i}),n[38](e),e.$on("show",n[23]),e.$on("hide",n[39]),{c(){q(e.$$.fragment)},m(s,l){H(e,s,l),t=!0},p(s,l){const o={};l[0]&131072&&(o.trigger=s[17]),l[0]&806410|l[1]&1024&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){L(e.$$.fragment,s),t=!1},d(s){n[38](null),j(e,s)}}}function Fc(n){let e,t,i,s,l,o,r,a,u=n[14].length&&Rc(n);return{c(){e=_("div"),t=_("label"),i=_("div"),i.innerHTML='',s=D(),l=_("input"),o=D(),u&&u.c(),p(i,"class","addon p-r-0"),l.autofocus=!0,p(l,"type","text"),p(l,"placeholder",n[3]),p(t,"class","input-group"),p(e,"class","form-field form-field-sm options-search")},m(f,c){w(f,e,c),m(e,t),m(t,i),m(t,s),m(t,l),Me(l,n[14]),m(t,o),u&&u.m(t,null),l.focus(),r||(a=J(l,"input",n[35]),r=!0)},p(f,c){c[0]&8&&p(l,"placeholder",f[3]),c[0]&16384&&l.value!==f[14]&&Me(l,f[14]),f[14].length?u?u.p(f,c):(u=Rc(f),u.c(),u.m(t,null)):u&&(u.d(1),u=null)},d(f){f&&k(e),u&&u.d(),r=!1,a()}}}function Rc(n){let e,t,i,s;return{c(){e=_("div"),t=_("button"),t.innerHTML='',p(t,"type","button"),p(t,"class","btn btn-sm btn-circle btn-secondary clear"),p(e,"class","addon suffix p-r-5")},m(l,o){w(l,e,o),m(e,t),i||(s=J(t,"click",ni(Yt(n[20]))),i=!0)},p:se,d(l){l&&k(e),i=!1,s()}}}function Hc(n){let e,t=n[1]&&jc(n);return{c(){t&&t.c(),e=Ue()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[1]?t?t.p(i,s):(t=jc(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function jc(n){let e,t;return{c(){e=_("div"),t=N(n[1]),p(e,"class","txt-missing")},m(i,s){w(i,e,s),m(e,t)},p(i,s){s[0]&2&&ue(t,i[1])},d(i){i&&k(e)}}}function tS(n){let e=n[45]+"",t;return{c(){t=N(e)},m(i,s){w(i,t,s)},p(i,s){s[0]&524288&&e!==(e=i[45]+"")&&ue(t,e)},i:se,o:se,d(i){i&&k(t)}}}function nS(n){let e,t,i;const s=[{item:n[45]},n[10]];var l=n[9];function o(r){let a={};for(let u=0;u{j(f,1)}),Pe()}l?(e=new l(o()),q(e.$$.fragment),A(e.$$.fragment,1),H(e,t.parentNode,t)):e=null}else l&&e.$set(u)},i(r){i||(e&&A(e.$$.fragment,r),i=!0)},o(r){e&&L(e.$$.fragment,r),i=!1},d(r){r&&k(t),e&&j(e,r)}}}function qc(n){let e,t,i,s,l,o,r;const a=[nS,tS],u=[];function f(h,g){return h[9]?0:1}t=f(n),i=u[t]=a[t](n);function c(...h){return n[36](n[45],...h)}function d(...h){return n[37](n[45],...h)}return{c(){e=_("div"),i.c(),s=D(),p(e,"tabindex","0"),p(e,"class","dropdown-item option closable"),ne(e,"selected",n[18](n[45]))},m(h,g){w(h,e,g),u[t].m(e,null),m(e,s),l=!0,o||(r=[J(e,"click",c),J(e,"keydown",d)],o=!0)},p(h,g){n=h;let v=t;t=f(n),t===v?u[t].p(n,g):(Ae(),L(u[v],1,1,()=>{u[v]=null}),Pe(),i=u[t],i?i.p(n,g):(i=u[t]=a[t](n),i.c()),A(i,1),i.m(e,s)),(!l||g[0]&786432)&&ne(e,"selected",n[18](n[45]))},i(h){l||(A(i),l=!0)},o(h){L(i),l=!1},d(h){h&&k(e),u[t].d(),o=!1,Ye(r)}}}function iS(n){let e,t,i,s,l,o=n[11]&&Fc(n);const r=n[32].beforeOptions,a=$n(r,n,n[41],Ec);let u=n[19],f=[];for(let v=0;vL(f[v],1,1,()=>{f[v]=null});let d=null;u.length||(d=Hc(n));const h=n[32].afterOptions,g=$n(h,n,n[41],Dc);return{c(){o&&o.c(),e=D(),a&&a.c(),t=D(),i=_("div");for(let v=0;vL(a[d],1,1,()=>{a[d]=null});let f=null;r.length||(f=Pc(n));let c=!n[5]&&Nc(n);return{c(){e=_("div"),t=_("div");for(let d=0;d{c=null}),Pe()):c?(c.p(d,h),h[0]&32&&A(c,1)):(c=Nc(d),c.c(),A(c,1),c.m(e,null)),(!o||h[0]&4096&&l!==(l="select "+d[12]))&&p(e,"class",l),(!o||h[0]&4112)&&ne(e,"multiple",d[4]),(!o||h[0]&4128)&&ne(e,"disabled",d[5])},i(d){if(!o){for(let h=0;hBe(Xe,$e))||[]}function de(Q,$e){Q.preventDefault(),v&&d?X($e):V($e)}function x(Q,$e){(Q.code==="Enter"||Q.code==="Space")&&de(Q,$e)}function ve(){Y(),setTimeout(()=>{const Q=P==null?void 0:P.querySelector(".dropdown-item.option.selected");Q&&(Q.focus(),Q.scrollIntoView({block:"nearest"}))},0)}function _e(Q){Q.stopPropagation(),!h&&(O==null||O.toggle())}Nn(()=>{const Q=document.querySelectorAll(`label[for="${r}"]`);for(const $e of Q)$e.addEventListener("click",_e);return()=>{for(const $e of Q)$e.removeEventListener("click",_e)}});const ge=Q=>F(Q);function K(Q){me[Q?"unshift":"push"](()=>{I=Q,t(17,I)})}function ye(){E=this.value,t(14,E)}const oe=(Q,$e)=>de($e,Q),W=(Q,$e)=>x($e,Q);function ce(Q){me[Q?"unshift":"push"](()=>{O=Q,t(15,O)})}function ae(Q){xe.call(this,n,Q)}function Se(Q){me[Q?"unshift":"push"](()=>{P=Q,t(16,P)})}return n.$$set=Q=>{"id"in Q&&t(24,r=Q.id),"noOptionsText"in Q&&t(1,a=Q.noOptionsText),"selectPlaceholder"in Q&&t(2,u=Q.selectPlaceholder),"searchPlaceholder"in Q&&t(3,f=Q.searchPlaceholder),"items"in Q&&t(25,c=Q.items),"multiple"in Q&&t(4,d=Q.multiple),"disabled"in Q&&t(5,h=Q.disabled),"selected"in Q&&t(0,g=Q.selected),"toggle"in Q&&t(6,v=Q.toggle),"labelComponent"in Q&&t(7,b=Q.labelComponent),"labelComponentProps"in Q&&t(8,y=Q.labelComponentProps),"optionComponent"in Q&&t(9,$=Q.optionComponent),"optionComponentProps"in Q&&t(10,C=Q.optionComponentProps),"searchable"in Q&&t(11,S=Q.searchable),"searchFunc"in Q&&t(26,T=Q.searchFunc),"class"in Q&&t(12,M=Q.class),"$$scope"in Q&&t(41,o=Q.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&33554432&&c&&(U(),Y()),n.$$.dirty[0]&33570816&&t(19,i=G(c,E)),n.$$.dirty[0]&1&&t(18,s=function(Q){const $e=B.toArray(g);return B.inArray($e,Q)})},[g,a,u,f,d,h,v,b,y,$,C,S,M,F,E,O,P,I,s,i,Y,de,x,ve,r,c,T,V,X,te,Z,ee,l,ge,K,ye,oe,W,ce,ae,Se,o]}class ab extends Ee{constructor(e){super(),Oe(this,e,oS,sS,De,{id:24,noOptionsText:1,selectPlaceholder:2,searchPlaceholder:3,items:25,multiple:4,disabled:5,selected:0,toggle:6,labelComponent:7,labelComponentProps:8,optionComponent:9,optionComponentProps:10,searchable:11,searchFunc:26,class:12,deselectItem:13,selectItem:27,toggleItem:28,reset:29,showDropdown:30,hideDropdown:31},null,[-1,-1])}get deselectItem(){return this.$$.ctx[13]}get selectItem(){return this.$$.ctx[27]}get toggleItem(){return this.$$.ctx[28]}get reset(){return this.$$.ctx[29]}get showDropdown(){return this.$$.ctx[30]}get hideDropdown(){return this.$$.ctx[31]}}function Vc(n){let e,t;return{c(){e=_("i"),p(e,"class",t="icon "+n[0].icon)},m(i,s){w(i,e,s)},p(i,s){s&1&&t!==(t="icon "+i[0].icon)&&p(e,"class",t)},d(i){i&&k(e)}}}function rS(n){let e,t,i=(n[0].label||n[0].name||n[0].title||n[0].id||n[0].value)+"",s,l=n[0].icon&&Vc(n);return{c(){l&&l.c(),e=D(),t=_("span"),s=N(i),p(t,"class","txt")},m(o,r){l&&l.m(o,r),w(o,e,r),w(o,t,r),m(t,s)},p(o,[r]){o[0].icon?l?l.p(o,r):(l=Vc(o),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null),r&1&&i!==(i=(o[0].label||o[0].name||o[0].title||o[0].id||o[0].value)+"")&&ue(s,i)},i:se,o:se,d(o){l&&l.d(o),o&&k(e),o&&k(t)}}}function aS(n,e,t){let{item:i={}}=e;return n.$$set=s=>{"item"in s&&t(0,i=s.item)},[i]}class zc extends Ee{constructor(e){super(),Oe(this,e,aS,rS,De,{item:0})}}const uS=n=>({}),Bc=n=>({});function fS(n){let e;const t=n[8].afterOptions,i=$n(t,n,n[12],Bc);return{c(){i&&i.c()},m(s,l){i&&i.m(s,l),e=!0},p(s,l){i&&i.p&&(!e||l&4096)&&Cn(i,t,s,s[12],e?Sn(t,s[12],l,uS):Mn(s[12]),Bc)},i(s){e||(A(i,s),e=!0)},o(s){L(i,s),e=!1},d(s){i&&i.d(s)}}}function cS(n){let e,t,i;const s=[{items:n[1]},{multiple:n[2]},{labelComponent:n[3]},{optionComponent:n[4]},n[5]];function l(r){n[9](r)}let o={$$slots:{afterOptions:[fS]},$$scope:{ctx:n}};for(let r=0;rRe(e,"selected",l)),e.$on("show",n[10]),e.$on("hide",n[11]),{c(){q(e.$$.fragment)},m(r,a){H(e,r,a),i=!0},p(r,[a]){const u=a&62?hn(s,[a&2&&{items:r[1]},a&4&&{multiple:r[2]},a&8&&{labelComponent:r[3]},a&16&&{optionComponent:r[4]},a&32&&oi(r[5])]):{};a&4096&&(u.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,u.selected=r[0],He(()=>t=!1)),e.$set(u)},i(r){i||(A(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){j(e,r)}}}function dS(n,e,t){const i=["items","multiple","selected","labelComponent","optionComponent","selectionKey","keyOfSelected"];let s=Bt(e,i),{$$slots:l={},$$scope:o}=e,{items:r=[]}=e,{multiple:a=!1}=e,{selected:u=a?[]:void 0}=e,{labelComponent:f=zc}=e,{optionComponent:c=zc}=e,{selectionKey:d="value"}=e,{keyOfSelected:h=a?[]:void 0}=e;function g(C){C=B.toArray(C,!0);let S=[];for(let T of C){const M=B.findByKey(r,d,T);M&&S.push(M)}C.length&&!S.length||t(0,u=a?S:S[0])}async function v(C){let S=B.toArray(C,!0).map(T=>T[d]);!r.length||t(6,h=a?S:S[0])}function b(C){u=C,t(0,u)}function y(C){xe.call(this,n,C)}function $(C){xe.call(this,n,C)}return n.$$set=C=>{e=at(at({},e),li(C)),t(5,s=Bt(e,i)),"items"in C&&t(1,r=C.items),"multiple"in C&&t(2,a=C.multiple),"selected"in C&&t(0,u=C.selected),"labelComponent"in C&&t(3,f=C.labelComponent),"optionComponent"in C&&t(4,c=C.optionComponent),"selectionKey"in C&&t(7,d=C.selectionKey),"keyOfSelected"in C&&t(6,h=C.keyOfSelected),"$$scope"in C&&t(12,o=C.$$scope)},n.$$.update=()=>{n.$$.dirty&66&&r&&g(h),n.$$.dirty&1&&v(u)},[u,r,a,f,c,s,h,d,l,b,y,$,o]}class ps extends Ee{constructor(e){super(),Oe(this,e,dS,cS,De,{items:1,multiple:2,selected:0,labelComponent:3,optionComponent:4,selectionKey:7,keyOfSelected:6})}}function pS(n){let e,t,i;const s=[{class:"field-type-select "+n[1]},{searchable:!0},{items:n[2]},n[3]];function l(r){n[4](r)}let o={};for(let r=0;rRe(e,"keyOfSelected",l)),{c(){q(e.$$.fragment)},m(r,a){H(e,r,a),i=!0},p(r,[a]){const u=a&14?hn(s,[a&2&&{class:"field-type-select "+r[1]},s[1],a&4&&{items:r[2]},a&8&&oi(r[3])]):{};!t&&a&1&&(t=!0,u.keyOfSelected=r[0],He(()=>t=!1)),e.$set(u)},i(r){i||(A(e.$$.fragment,r),i=!0)},o(r){L(e.$$.fragment,r),i=!1},d(r){j(e,r)}}}function hS(n,e,t){const i=["value","class"];let s=Bt(e,i),{value:l="text"}=e,{class:o=""}=e;const r=[{label:"Text",value:"text",icon:B.getFieldTypeIcon("text")},{label:"Number",value:"number",icon:B.getFieldTypeIcon("number")},{label:"Bool",value:"bool",icon:B.getFieldTypeIcon("bool")},{label:"Email",value:"email",icon:B.getFieldTypeIcon("email")},{label:"Url",value:"url",icon:B.getFieldTypeIcon("url")},{label:"DateTime",value:"date",icon:B.getFieldTypeIcon("date")},{label:"Multiple choices",value:"select",icon:B.getFieldTypeIcon("select")},{label:"JSON",value:"json",icon:B.getFieldTypeIcon("json")},{label:"File",value:"file",icon:B.getFieldTypeIcon("file")},{label:"Relation",value:"relation",icon:B.getFieldTypeIcon("relation")},{label:"User",value:"user",icon:B.getFieldTypeIcon("user")}];function a(u){l=u,t(0,l)}return n.$$set=u=>{e=at(at({},e),li(u)),t(3,s=Bt(e,i)),"value"in u&&t(0,l=u.value),"class"in u&&t(1,o=u.class)},[l,o,r,s,a]}class mS extends Ee{constructor(e){super(),Oe(this,e,hS,pS,De,{value:0,class:1})}}function gS(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Min length"),s=D(),l=_("input"),p(e,"for",i=n[5]),p(l,"type","number"),p(l,"id",o=n[5]),p(l,"step","1"),p(l,"min","0")},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].min),r||(a=J(l,"input",n[2]),r=!0)},p(u,f){f&32&&i!==(i=u[5])&&p(e,"for",i),f&32&&o!==(o=u[5])&&p(l,"id",o),f&1&&Pt(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 _S(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=N("Max length"),s=D(),l=_("input"),p(e,"for",i=n[5]),p(l,"type","number"),p(l,"id",o=n[5]),p(l,"step","1"),p(l,"min",r=n[0].min||0)},m(f,c){w(f,e,c),m(e,t),w(f,s,c),w(f,l,c),Me(l,n[0].max),a||(u=J(l,"input",n[3]),a=!0)},p(f,c){c&32&&i!==(i=f[5])&&p(e,"for",i),c&32&&o!==(o=f[5])&&p(l,"id",o),c&1&&r!==(r=f[0].min||0)&&p(l,"min",r),c&1&&Pt(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 bS(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=N("Regex pattern"),s=D(),l=_("input"),r=D(),a=_("div"),a.innerHTML="Valid Go regular expression, eg. ^\\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),m(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=J(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 vS(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:[gS,({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:[_S,({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:[bS,({uniqueId:c})=>({5:c}),({uniqueId:c})=>c?32:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),q(i.$$.fragment),s=D(),l=_("div"),q(o.$$.fragment),r=D(),a=_("div"),q(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),m(e,t),H(i,t,null),m(e,s),m(e,l),H(o,l,null),m(e,r),m(e,a),H(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 g={};d&2&&(g.name="schema."+c[1]+".options.max"),d&97&&(g.$$scope={dirty:d,ctx:c}),o.$set(g);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||(A(i.$$.fragment,c),A(o.$$.fragment,c),A(u.$$.fragment,c),f=!0)},o(c){L(i.$$.fragment,c),L(o.$$.fragment,c),L(u.$$.fragment,c),f=!1},d(c){c&&k(e),j(i),j(o),j(u)}}}function yS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=Pt(this.value),t(0,s)}function o(){s.max=Pt(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 kS extends Ee{constructor(e){super(),Oe(this,e,yS,vS,De,{key:1,options:0})}}function wS(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Min"),s=D(),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),m(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].min),r||(a=J(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&&Pt(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 $S(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=N("Max"),s=D(),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),m(e,t),w(f,s,c),w(f,l,c),Me(l,n[0].max),a||(u=J(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&&Pt(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 SS(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:[wS,({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:[$S,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),q(i.$$.fragment),s=D(),l=_("div"),q(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),m(e,t),H(i,t,null),m(e,s),m(e,l),H(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||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){L(i.$$.fragment,a),L(o.$$.fragment,a),r=!1},d(a){a&&k(e),j(i),j(o)}}}function CS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.min=Pt(this.value),t(0,s)}function o(){s.max=Pt(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 MS extends Ee{constructor(e){super(),Oe(this,e,CS,SS,De,{key:1,options:0})}}function TS(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 DS extends Ee{constructor(e){super(),Oe(this,e,TS,null,De,{key:0,options:1})}}function OS(n){let e,t,i,s,l=[{type:t=n[3].type||"text"},{value:n[2]},n[3]],o={};for(let r=0;r{t(0,o=B.splitNonEmpty(u.target.value,r))};return n.$$set=u=>{e=at(at({},e),li(u)),t(3,l=Bt(e,s)),"value"in u&&t(0,o=u.value),"separator"in u&&t(1,r=u.separator)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=(o||[]).join(", "))},[o,r,i,l,a]}class hs extends Ee{constructor(e){super(),Oe(this,e,ES,OS,De,{value:0,separator:1})}}function AS(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function g(b){n[2](b)}let v={id:n[4],disabled:!B.isEmpty(n[0].onlyDomains)};return n[0].exceptDomains!==void 0&&(v.value=n[0].exceptDomains),r=new hs({props:v}),me.push(()=>Re(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Except domains",i=D(),s=_("i"),o=D(),q(r.$$.fragment),u=D(),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[4]),p(f,"class","help-block")},m(b,y){w(b,e,y),m(e,t),m(e,i),m(e,s),w(b,o,y),H(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(h=We(yt.call(null,s,{text:`List of domains that are NOT allowed. - This field is disabled if "Only domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&16&&l!==(l=b[4]))&&p(e,"for",l);const $={};y&16&&($.id=b[4]),y&1&&($.disabled=!B.isEmpty(b[0].onlyDomains)),!a&&y&1&&(a=!0,$.value=b[0].exceptDomains,He(()=>a=!1)),r.$set($)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){L(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),j(r,b),b&&k(u),b&&k(f),d=!1,h()}}}function PS(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;function g(b){n[3](b)}let v={id:n[4]+".options.onlyDomains",disabled:!B.isEmpty(n[0].exceptDomains)};return n[0].onlyDomains!==void 0&&(v.value=n[0].onlyDomains),r=new hs({props:v}),me.push(()=>Re(r,"value",g)),{c(){e=_("label"),t=_("span"),t.textContent="Only domains",i=D(),s=_("i"),o=D(),q(r.$$.fragment),u=D(),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[4]+".options.onlyDomains"),p(f,"class","help-block")},m(b,y){w(b,e,y),m(e,t),m(e,i),m(e,s),w(b,o,y),H(r,b,y),w(b,u,y),w(b,f,y),c=!0,d||(h=We(yt.call(null,s,{text:`List of domains that are ONLY allowed. - This field is disabled if "Except domains" is set.`,position:"top"})),d=!0)},p(b,y){(!c||y&16&&l!==(l=b[4]+".options.onlyDomains"))&&p(e,"for",l);const $={};y&16&&($.id=b[4]+".options.onlyDomains"),y&1&&($.disabled=!B.isEmpty(b[0].exceptDomains)),!a&&y&1&&(a=!0,$.value=b[0].onlyDomains,He(()=>a=!1)),r.$set($)},i(b){c||(A(r.$$.fragment,b),c=!0)},o(b){L(r.$$.fragment,b),c=!1},d(b){b&&k(e),b&&k(o),j(r,b),b&&k(u),b&&k(f),d=!1,h()}}}function LS(n){let e,t,i,s,l,o,r;return i=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.exceptDomains",$$slots:{default:[AS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.onlyDomains",$$slots:{default:[PS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),q(i.$$.fragment),s=D(),l=_("div"),q(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),m(e,t),H(i,t,null),m(e,s),m(e,l),H(o,l,null),r=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.exceptDomains"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.onlyDomains"),u&49&&(c.$$scope={dirty:u,ctx:a}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){L(i.$$.fragment,a),L(o.$$.fragment,a),r=!1},d(a){a&&k(e),j(i),j(o)}}}function IS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.exceptDomains,r)&&(s.exceptDomains=r,t(0,s))}function o(r){n.$$.not_equal(s.onlyDomains,r)&&(s.onlyDomains=r,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 ub extends Ee{constructor(e){super(),Oe(this,e,IS,LS,De,{key:1,options:0})}}function NS(n){let e,t,i,s;function l(a){n[2](a)}function o(a){n[3](a)}let r={};return n[0]!==void 0&&(r.key=n[0]),n[1]!==void 0&&(r.options=n[1]),e=new ub({props:r}),me.push(()=>Re(e,"key",l)),me.push(()=>Re(e,"options",o)),{c(){q(e.$$.fragment)},m(a,u){H(e,a,u),s=!0},p(a,[u]){const f={};!t&&u&1&&(t=!0,f.key=a[0],He(()=>t=!1)),!i&&u&2&&(i=!0,f.options=a[1],He(()=>i=!1)),e.$set(f)},i(a){s||(A(e.$$.fragment,a),s=!0)},o(a){L(e.$$.fragment,a),s=!1},d(a){j(e,a)}}}function FS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){i=r,t(0,i)}function o(r){s=r,t(1,s)}return n.$$set=r=>{"key"in r&&t(0,i=r.key),"options"in r&&t(1,s=r.options)},[i,s,l,o]}class RS extends Ee{constructor(e){super(),Oe(this,e,FS,NS,De,{key:0,options:1})}}var Or=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],Cs={_disable:[],allowInput:!1,allowInvalidPreload:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:typeof window=="object"&&window.navigator.userAgent.indexOf("MSIE")===-1,ariaDateFormat:"F j, Y",autoFillDefaultTime:!0,clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enableSeconds:!1,enableTime:!1,errorHandler:function(n){return typeof console<"u"&&console.warn(n)},getWeek:function(n){var e=new Date(n.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var t=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-t.getTime())/864e5-3+(t.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",monthSelectorType:"dropdown",nextArrow:"",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},kl={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(n){var e=n%100;if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},vn=function(n,e){return e===void 0&&(e=2),("000"+n).slice(e*-1)},jn=function(n){return n===!0?1:0};function Uc(n,e){var t;return function(){var i=this,s=arguments;clearTimeout(t),t=setTimeout(function(){return n.apply(i,s)},e)}}var Er=function(n){return n instanceof Array?n:[n]};function mn(n,e,t){if(t===!0)return n.classList.add(e);n.classList.remove(e)}function St(n,e,t){var i=window.document.createElement(n);return e=e||"",t=t||"",i.className=e,t!==void 0&&(i.textContent=t),i}function ro(n){for(;n.firstChild;)n.removeChild(n.firstChild)}function fb(n,e){if(e(n))return n;if(n.parentNode)return fb(n.parentNode,e)}function ao(n,e){var t=St("div","numInputWrapper"),i=St("input","numInput "+n),s=St("span","arrowUp"),l=St("span","arrowDown");if(navigator.userAgent.indexOf("MSIE 9.0")===-1?i.type="number":(i.type="text",i.pattern="\\d*"),e!==void 0)for(var o in e)i.setAttribute(o,e[o]);return t.appendChild(i),t.appendChild(s),t.appendChild(l),t}function En(n){try{if(typeof n.composedPath=="function"){var e=n.composedPath();return e[0]}return n.target}catch{return n.target}}var Ar=function(){},Ro=function(n,e,t){return t.months[e?"shorthand":"longhand"][n]},HS={D:Ar,F:function(n,e,t){n.setMonth(t.months.longhand.indexOf(e))},G:function(n,e){n.setHours((n.getHours()>=12?12:0)+parseFloat(e))},H:function(n,e){n.setHours(parseFloat(e))},J:function(n,e){n.setDate(parseFloat(e))},K:function(n,e,t){n.setHours(n.getHours()%12+12*jn(new RegExp(t.amPM[1],"i").test(e)))},M:function(n,e,t){n.setMonth(t.months.shorthand.indexOf(e))},S:function(n,e){n.setSeconds(parseFloat(e))},U:function(n,e){return new Date(parseFloat(e)*1e3)},W:function(n,e,t){var i=parseInt(e),s=new Date(n.getFullYear(),0,2+(i-1)*7,0,0,0,0);return s.setDate(s.getDate()-s.getDay()+t.firstDayOfWeek),s},Y:function(n,e){n.setFullYear(parseFloat(e))},Z:function(n,e){return new Date(e)},d:function(n,e){n.setDate(parseFloat(e))},h:function(n,e){n.setHours((n.getHours()>=12?12:0)+parseFloat(e))},i:function(n,e){n.setMinutes(parseFloat(e))},j:function(n,e){n.setDate(parseFloat(e))},l:Ar,m:function(n,e){n.setMonth(parseFloat(e)-1)},n:function(n,e){n.setMonth(parseFloat(e)-1)},s:function(n,e){n.setSeconds(parseFloat(e))},u:function(n,e){return new Date(parseFloat(e))},w:Ar,y:function(n,e){n.setFullYear(2e3+parseFloat(e))}},es={D:"",F:"",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},cl={Z:function(n){return n.toISOString()},D:function(n,e,t){return e.weekdays.shorthand[cl.w(n,e,t)]},F:function(n,e,t){return Ro(cl.n(n,e,t)-1,!1,e)},G:function(n,e,t){return vn(cl.h(n,e,t))},H:function(n){return vn(n.getHours())},J:function(n,e){return e.ordinal!==void 0?n.getDate()+e.ordinal(n.getDate()):n.getDate()},K:function(n,e){return e.amPM[jn(n.getHours()>11)]},M:function(n,e){return Ro(n.getMonth(),!0,e)},S:function(n){return vn(n.getSeconds())},U:function(n){return n.getTime()/1e3},W:function(n,e,t){return t.getWeek(n)},Y:function(n){return vn(n.getFullYear(),4)},d:function(n){return vn(n.getDate())},h:function(n){return n.getHours()%12?n.getHours()%12:12},i:function(n){return vn(n.getMinutes())},j:function(n){return n.getDate()},l:function(n,e){return e.weekdays.longhand[n.getDay()]},m:function(n){return vn(n.getMonth()+1)},n:function(n){return n.getMonth()+1},s:function(n){return n.getSeconds()},u:function(n){return n.getTime()},w:function(n){return n.getDay()},y:function(n){return String(n.getFullYear()).substring(2)}},cb=function(n){var e=n.config,t=e===void 0?Cs:e,i=n.l10n,s=i===void 0?kl:i,l=n.isMobile,o=l===void 0?!1:l;return function(r,a,u){var f=u||s;return t.formatDate!==void 0&&!o?t.formatDate(r,a,f):a.split("").map(function(c,d,h){return cl[c]&&h[d-1]!=="\\"?cl[c](r,f,t):c!=="\\"?c:""}).join("")}},ha=function(n){var e=n.config,t=e===void 0?Cs:e,i=n.l10n,s=i===void 0?kl:i;return function(l,o,r,a){if(!(l!==0&&!l)){var u=a||s,f,c=l;if(l instanceof Date)f=new Date(l.getTime());else if(typeof l!="string"&&l.toFixed!==void 0)f=new Date(l);else if(typeof l=="string"){var d=o||(t||Cs).dateFormat,h=String(l).trim();if(h==="today")f=new Date,r=!0;else if(t&&t.parseDate)f=t.parseDate(l,d);else if(/Z$/.test(h)||/GMT$/.test(h))f=new Date(l);else{for(var g=void 0,v=[],b=0,y=0,$="";bMath.min(e,t)&&n=0?new Date:new Date(t.config.minDate.getTime()),ie=Lr(t.config);z.setHours(ie.hours,ie.minutes,ie.seconds,z.getMilliseconds()),t.selectedDates=[z],t.latestSelectedDateObj=z}R!==void 0&&R.type!=="blur"&&xt(R);var re=t._input.value;c(),Ct(),t._input.value!==re&&t._debouncedChange()}function u(R,z){return R%12+12*jn(z===t.l10n.amPM[1])}function f(R){switch(R%24){case 0:case 12:return 12;default:return R%12}}function c(){if(!(t.hourElement===void 0||t.minuteElement===void 0)){var R=(parseInt(t.hourElement.value.slice(-2),10)||0)%24,z=(parseInt(t.minuteElement.value,10)||0)%60,ie=t.secondElement!==void 0?(parseInt(t.secondElement.value,10)||0)%60:0;t.amPM!==void 0&&(R=u(R,t.amPM.textContent));var re=t.config.minTime!==void 0||t.config.minDate&&t.minDateHasTime&&t.latestSelectedDateObj&&An(t.latestSelectedDateObj,t.config.minDate,!0)===0,Le=t.config.maxTime!==void 0||t.config.maxDate&&t.maxDateHasTime&&t.latestSelectedDateObj&&An(t.latestSelectedDateObj,t.config.maxDate,!0)===0;if(t.config.maxTime!==void 0&&t.config.minTime!==void 0&&t.config.minTime>t.config.maxTime){var le=Pr(t.config.minTime.getHours(),t.config.minTime.getMinutes(),t.config.minTime.getSeconds()),pe=Pr(t.config.maxTime.getHours(),t.config.maxTime.getMinutes(),t.config.maxTime.getSeconds()),ke=Pr(R,z,ie);if(ke>pe&&ke=12)]),t.secondElement!==void 0&&(t.secondElement.value=vn(ie)))}function g(R){var z=En(R),ie=parseInt(z.value)+(R.delta||0);(ie/1e3>1||R.key==="Enter"&&!/[^\d]/.test(ie.toString()))&&oe(ie)}function v(R,z,ie,re){if(z instanceof Array)return z.forEach(function(Le){return v(R,Le,ie,re)});if(R instanceof Array)return R.forEach(function(Le){return v(Le,z,ie,re)});R.addEventListener(z,ie,re),t._handlers.push({remove:function(){return R.removeEventListener(z,ie,re)}})}function b(){Ke("onChange")}function y(){if(t.config.wrap&&["open","close","toggle","clear"].forEach(function(ie){Array.prototype.forEach.call(t.element.querySelectorAll("[data-"+ie+"]"),function(re){return v(re,"click",t[ie])})}),t.isMobile){Ft();return}var R=Uc($e,50);if(t._debouncedChange=Uc(b,zS),t.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&v(t.daysContainer,"mouseover",function(ie){t.config.mode==="range"&&Q(En(ie))}),v(t._input,"keydown",Se),t.calendarContainer!==void 0&&v(t.calendarContainer,"keydown",Se),!t.config.inline&&!t.config.static&&v(window,"resize",R),window.ontouchstart!==void 0?v(window.document,"touchstart",ye):v(window.document,"mousedown",ye),v(window.document,"focus",ye,{capture:!0}),t.config.clickOpens===!0&&(v(t._input,"focus",t.open),v(t._input,"click",t.open)),t.daysContainer!==void 0&&(v(t.monthNav,"click",ft),v(t.monthNav,["keyup","increment"],g),v(t.daysContainer,"click",dt)),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0){var z=function(ie){return En(ie).select()};v(t.timeContainer,["increment"],a),v(t.timeContainer,"blur",a,{capture:!0}),v(t.timeContainer,"click",C),v([t.hourElement,t.minuteElement],["focus","click"],z),t.secondElement!==void 0&&v(t.secondElement,"focus",function(){return t.secondElement&&t.secondElement.select()}),t.amPM!==void 0&&v(t.amPM,"click",function(ie){a(ie)})}t.config.allowInput&&v(t._input,"blur",ae)}function $(R,z){var ie=R!==void 0?t.parseDate(R):t.latestSelectedDateObj||(t.config.minDate&&t.config.minDate>t.now?t.config.minDate:t.config.maxDate&&t.config.maxDate1),t.calendarContainer.appendChild(R);var Le=t.config.appendTo!==void 0&&t.config.appendTo.nodeType!==void 0;if((t.config.inline||t.config.static)&&(t.calendarContainer.classList.add(t.config.inline?"inline":"static"),t.config.inline&&(!Le&&t.element.parentNode?t.element.parentNode.insertBefore(t.calendarContainer,t._input.nextSibling):t.config.appendTo!==void 0&&t.config.appendTo.appendChild(t.calendarContainer)),t.config.static)){var le=St("div","flatpickr-wrapper");t.element.parentNode&&t.element.parentNode.insertBefore(le,t.element),le.appendChild(t.element),t.altInput&&le.appendChild(t.altInput),le.appendChild(t.calendarContainer)}!t.config.static&&!t.config.inline&&(t.config.appendTo!==void 0?t.config.appendTo:window.document.body).appendChild(t.calendarContainer)}function M(R,z,ie,re){var Le=W(z,!0),le=St("span",R,z.getDate().toString());return le.dateObj=z,le.$i=re,le.setAttribute("aria-label",t.formatDate(z,t.config.ariaDateFormat)),R.indexOf("hidden")===-1&&An(z,t.now)===0&&(t.todayDateElem=le,le.classList.add("today"),le.setAttribute("aria-current","date")),Le?(le.tabIndex=-1,ze(z)&&(le.classList.add("selected"),t.selectedDateElem=le,t.config.mode==="range"&&(mn(le,"startRange",t.selectedDates[0]&&An(z,t.selectedDates[0],!0)===0),mn(le,"endRange",t.selectedDates[1]&&An(z,t.selectedDates[1],!0)===0),R==="nextMonthDay"&&le.classList.add("inRange")))):le.classList.add("flatpickr-disabled"),t.config.mode==="range"&<(z)&&!ze(z)&&le.classList.add("inRange"),t.weekNumbers&&t.config.showMonths===1&&R!=="prevMonthDay"&&re%7===6&&t.weekNumbers.insertAdjacentHTML("beforeend",""+t.config.getWeek(z)+""),Ke("onDayCreate",le),le}function O(R){R.focus(),t.config.mode==="range"&&Q(R)}function E(R){for(var z=R>0?0:t.config.showMonths-1,ie=R>0?t.config.showMonths:-1,re=z;re!=ie;re+=R)for(var Le=t.daysContainer.children[re],le=R>0?0:Le.children.length-1,pe=R>0?Le.children.length:-1,ke=le;ke!=pe;ke+=R){var fe=Le.children[ke];if(fe.className.indexOf("hidden")===-1&&W(fe.dateObj))return fe}}function P(R,z){for(var ie=R.className.indexOf("Month")===-1?R.dateObj.getMonth():t.currentMonth,re=z>0?t.config.showMonths:-1,Le=z>0?1:-1,le=ie-t.currentMonth;le!=re;le+=Le)for(var pe=t.daysContainer.children[le],ke=ie-t.currentMonth===le?R.$i+z:z<0?pe.children.length-1:0,fe=pe.children.length,he=ke;he>=0&&he0?fe:-1);he+=Le){var Ie=pe.children[he];if(Ie.className.indexOf("hidden")===-1&&W(Ie.dateObj)&&Math.abs(R.$i-he)>=Math.abs(z))return O(Ie)}t.changeMonth(Le),I(E(Le),0)}function I(R,z){var ie=l(),re=ce(ie||document.body),Le=R!==void 0?R:re?ie:t.selectedDateElem!==void 0&&ce(t.selectedDateElem)?t.selectedDateElem:t.todayDateElem!==void 0&&ce(t.todayDateElem)?t.todayDateElem:E(z>0?1:-1);Le===void 0?t._input.focus():re?P(Le,z):O(Le)}function F(R,z){for(var ie=(new Date(R,z,1).getDay()-t.l10n.firstDayOfWeek+7)%7,re=t.utils.getDaysInMonth((z-1+12)%12,R),Le=t.utils.getDaysInMonth(z,R),le=window.document.createDocumentFragment(),pe=t.config.showMonths>1,ke=pe?"prevMonthDay hidden":"prevMonthDay",fe=pe?"nextMonthDay hidden":"nextMonthDay",he=re+1-ie,Ie=0;he<=re;he++,Ie++)le.appendChild(M("flatpickr-day "+ke,new Date(R,z-1,he),he,Ie));for(he=1;he<=Le;he++,Ie++)le.appendChild(M("flatpickr-day",new Date(R,z,he),he,Ie));for(var gt=Le+1;gt<=42-ie&&(t.config.showMonths===1||Ie%7!==0);gt++,Ie++)le.appendChild(M("flatpickr-day "+fe,new Date(R,z+1,gt%Le),gt,Ie));var un=St("div","dayContainer");return un.appendChild(le),un}function V(){if(t.daysContainer!==void 0){ro(t.daysContainer),t.weekNumbers&&ro(t.weekNumbers);for(var R=document.createDocumentFragment(),z=0;z1||t.config.monthSelectorType!=="dropdown")){var R=function(re){return t.config.minDate!==void 0&&t.currentYear===t.config.minDate.getFullYear()&&ret.config.maxDate.getMonth())};t.monthsDropdownContainer.tabIndex=-1,t.monthsDropdownContainer.innerHTML="";for(var z=0;z<12;z++)if(!!R(z)){var ie=St("option","flatpickr-monthDropdown-month");ie.value=new Date(t.currentYear,z).getMonth().toString(),ie.textContent=Ro(z,t.config.shorthandCurrentMonth,t.l10n),ie.tabIndex=-1,t.currentMonth===z&&(ie.selected=!0),t.monthsDropdownContainer.appendChild(ie)}}}function te(){var R=St("div","flatpickr-month"),z=window.document.createDocumentFragment(),ie;t.config.showMonths>1||t.config.monthSelectorType==="static"?ie=St("span","cur-month"):(t.monthsDropdownContainer=St("select","flatpickr-monthDropdown-months"),t.monthsDropdownContainer.setAttribute("aria-label",t.l10n.monthAriaLabel),v(t.monthsDropdownContainer,"change",function(pe){var ke=En(pe),fe=parseInt(ke.value,10);t.changeMonth(fe-t.currentMonth),Ke("onMonthChange")}),X(),ie=t.monthsDropdownContainer);var re=ao("cur-year",{tabindex:"-1"}),Le=re.getElementsByTagName("input")[0];Le.setAttribute("aria-label",t.l10n.yearAriaLabel),t.config.minDate&&Le.setAttribute("min",t.config.minDate.getFullYear().toString()),t.config.maxDate&&(Le.setAttribute("max",t.config.maxDate.getFullYear().toString()),Le.disabled=!!t.config.minDate&&t.config.minDate.getFullYear()===t.config.maxDate.getFullYear());var le=St("div","flatpickr-current-month");return le.appendChild(ie),le.appendChild(re),z.appendChild(le),R.appendChild(z),{container:R,yearElement:Le,monthElement:ie}}function Z(){ro(t.monthNav),t.monthNav.appendChild(t.prevMonthNav),t.config.showMonths&&(t.yearElements=[],t.monthElements=[]);for(var R=t.config.showMonths;R--;){var z=te();t.yearElements.push(z.yearElement),t.monthElements.push(z.monthElement),t.monthNav.appendChild(z.container)}t.monthNav.appendChild(t.nextMonthNav)}function ee(){return t.monthNav=St("div","flatpickr-months"),t.yearElements=[],t.monthElements=[],t.prevMonthNav=St("span","flatpickr-prev-month"),t.prevMonthNav.innerHTML=t.config.prevArrow,t.nextMonthNav=St("span","flatpickr-next-month"),t.nextMonthNav.innerHTML=t.config.nextArrow,Z(),Object.defineProperty(t,"_hidePrevMonthArrow",{get:function(){return t.__hidePrevMonthArrow},set:function(R){t.__hidePrevMonthArrow!==R&&(mn(t.prevMonthNav,"flatpickr-disabled",R),t.__hidePrevMonthArrow=R)}}),Object.defineProperty(t,"_hideNextMonthArrow",{get:function(){return t.__hideNextMonthArrow},set:function(R){t.__hideNextMonthArrow!==R&&(mn(t.nextMonthNav,"flatpickr-disabled",R),t.__hideNextMonthArrow=R)}}),t.currentYearElement=t.yearElements[0],ot(),t.monthNav}function U(){t.calendarContainer.classList.add("hasTime"),t.config.noCalendar&&t.calendarContainer.classList.add("noCalendar");var R=Lr(t.config);t.timeContainer=St("div","flatpickr-time"),t.timeContainer.tabIndex=-1;var z=St("span","flatpickr-time-separator",":"),ie=ao("flatpickr-hour",{"aria-label":t.l10n.hourAriaLabel});t.hourElement=ie.getElementsByTagName("input")[0];var re=ao("flatpickr-minute",{"aria-label":t.l10n.minuteAriaLabel});if(t.minuteElement=re.getElementsByTagName("input")[0],t.hourElement.tabIndex=t.minuteElement.tabIndex=-1,t.hourElement.value=vn(t.latestSelectedDateObj?t.latestSelectedDateObj.getHours():t.config.time_24hr?R.hours:f(R.hours)),t.minuteElement.value=vn(t.latestSelectedDateObj?t.latestSelectedDateObj.getMinutes():R.minutes),t.hourElement.setAttribute("step",t.config.hourIncrement.toString()),t.minuteElement.setAttribute("step",t.config.minuteIncrement.toString()),t.hourElement.setAttribute("min",t.config.time_24hr?"0":"1"),t.hourElement.setAttribute("max",t.config.time_24hr?"23":"12"),t.hourElement.setAttribute("maxlength","2"),t.minuteElement.setAttribute("min","0"),t.minuteElement.setAttribute("max","59"),t.minuteElement.setAttribute("maxlength","2"),t.timeContainer.appendChild(ie),t.timeContainer.appendChild(z),t.timeContainer.appendChild(re),t.config.time_24hr&&t.timeContainer.classList.add("time24hr"),t.config.enableSeconds){t.timeContainer.classList.add("hasSeconds");var Le=ao("flatpickr-second");t.secondElement=Le.getElementsByTagName("input")[0],t.secondElement.value=vn(t.latestSelectedDateObj?t.latestSelectedDateObj.getSeconds():R.seconds),t.secondElement.setAttribute("step",t.minuteElement.getAttribute("step")),t.secondElement.setAttribute("min","0"),t.secondElement.setAttribute("max","59"),t.secondElement.setAttribute("maxlength","2"),t.timeContainer.appendChild(St("span","flatpickr-time-separator",":")),t.timeContainer.appendChild(Le)}return t.config.time_24hr||(t.amPM=St("span","flatpickr-am-pm",t.l10n.amPM[jn((t.latestSelectedDateObj?t.hourElement.value:t.config.defaultHour)>11)]),t.amPM.title=t.l10n.toggleTitle,t.amPM.tabIndex=-1,t.timeContainer.appendChild(t.amPM)),t.timeContainer}function Y(){t.weekdayContainer?ro(t.weekdayContainer):t.weekdayContainer=St("div","flatpickr-weekdays");for(var R=t.config.showMonths;R--;){var z=St("div","flatpickr-weekdaycontainer");t.weekdayContainer.appendChild(z)}return G(),t.weekdayContainer}function G(){if(!!t.weekdayContainer){var R=t.l10n.firstDayOfWeek,z=Wc(t.l10n.weekdays.shorthand);R>0&&R - `+z.join("")+` - - `}}function de(){t.calendarContainer.classList.add("hasWeeks");var R=St("div","flatpickr-weekwrapper");R.appendChild(St("span","flatpickr-weekday",t.l10n.weekAbbreviation));var z=St("div","flatpickr-weeks");return R.appendChild(z),{weekWrapper:R,weekNumbers:z}}function x(R,z){z===void 0&&(z=!0);var ie=z?R:R-t.currentMonth;ie<0&&t._hidePrevMonthArrow===!0||ie>0&&t._hideNextMonthArrow===!0||(t.currentMonth+=ie,(t.currentMonth<0||t.currentMonth>11)&&(t.currentYear+=t.currentMonth>11?1:-1,t.currentMonth=(t.currentMonth+12)%12,Ke("onYearChange"),X()),V(),Ke("onMonthChange"),ot())}function ve(R,z){if(R===void 0&&(R=!0),z===void 0&&(z=!0),t.input.value="",t.altInput!==void 0&&(t.altInput.value=""),t.mobileInput!==void 0&&(t.mobileInput.value=""),t.selectedDates=[],t.latestSelectedDateObj=void 0,z===!0&&(t.currentYear=t._initialDate.getFullYear(),t.currentMonth=t._initialDate.getMonth()),t.config.enableTime===!0){var ie=Lr(t.config),re=ie.hours,Le=ie.minutes,le=ie.seconds;h(re,Le,le)}t.redraw(),R&&Ke("onChange")}function _e(){t.isOpen=!1,t.isMobile||(t.calendarContainer!==void 0&&t.calendarContainer.classList.remove("open"),t._input!==void 0&&t._input.classList.remove("active")),Ke("onClose")}function ge(){t.config!==void 0&&Ke("onDestroy");for(var R=t._handlers.length;R--;)t._handlers[R].remove();if(t._handlers=[],t.mobileInput)t.mobileInput.parentNode&&t.mobileInput.parentNode.removeChild(t.mobileInput),t.mobileInput=void 0;else if(t.calendarContainer&&t.calendarContainer.parentNode)if(t.config.static&&t.calendarContainer.parentNode){var z=t.calendarContainer.parentNode;if(z.lastChild&&z.removeChild(z.lastChild),z.parentNode){for(;z.firstChild;)z.parentNode.insertBefore(z.firstChild,z);z.parentNode.removeChild(z)}}else t.calendarContainer.parentNode.removeChild(t.calendarContainer);t.altInput&&(t.input.type="text",t.altInput.parentNode&&t.altInput.parentNode.removeChild(t.altInput),delete t.altInput),t.input&&(t.input.type=t.input._type,t.input.classList.remove("flatpickr-input"),t.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(ie){try{delete t[ie]}catch{}})}function K(R){return t.calendarContainer.contains(R)}function ye(R){if(t.isOpen&&!t.config.inline){var z=En(R),ie=K(z),re=z===t.input||z===t.altInput||t.element.contains(z)||R.path&&R.path.indexOf&&(~R.path.indexOf(t.input)||~R.path.indexOf(t.altInput)),Le=!re&&!ie&&!K(R.relatedTarget),le=!t.config.ignoredFocusElements.some(function(pe){return pe.contains(z)});Le&&le&&(t.config.allowInput&&t.setDate(t._input.value,!1,t.config.altInput?t.config.altFormat:t.config.dateFormat),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0&&t.input.value!==""&&t.input.value!==void 0&&a(),t.close(),t.config&&t.config.mode==="range"&&t.selectedDates.length===1&&t.clear(!1))}}function oe(R){if(!(!R||t.config.minDate&&Rt.config.maxDate.getFullYear())){var z=R,ie=t.currentYear!==z;t.currentYear=z||t.currentYear,t.config.maxDate&&t.currentYear===t.config.maxDate.getFullYear()?t.currentMonth=Math.min(t.config.maxDate.getMonth(),t.currentMonth):t.config.minDate&&t.currentYear===t.config.minDate.getFullYear()&&(t.currentMonth=Math.max(t.config.minDate.getMonth(),t.currentMonth)),ie&&(t.redraw(),Ke("onYearChange"),X())}}function W(R,z){var ie;z===void 0&&(z=!0);var re=t.parseDate(R,void 0,z);if(t.config.minDate&&re&&An(re,t.config.minDate,z!==void 0?z:!t.minDateHasTime)<0||t.config.maxDate&&re&&An(re,t.config.maxDate,z!==void 0?z:!t.maxDateHasTime)>0)return!1;if(!t.config.enable&&t.config.disable.length===0)return!0;if(re===void 0)return!1;for(var Le=!!t.config.enable,le=(ie=t.config.enable)!==null&&ie!==void 0?ie:t.config.disable,pe=0,ke=void 0;pe=ke.from.getTime()&&re.getTime()<=ke.to.getTime())return Le}return!Le}function ce(R){return t.daysContainer!==void 0?R.className.indexOf("hidden")===-1&&R.className.indexOf("flatpickr-disabled")===-1&&t.daysContainer.contains(R):!1}function ae(R){var z=R.target===t._input,ie=t._input.value.trimEnd()!==Ht();z&&ie&&!(R.relatedTarget&&K(R.relatedTarget))&&t.setDate(t._input.value,!0,R.target===t.altInput?t.config.altFormat:t.config.dateFormat)}function Se(R){var z=En(R),ie=t.config.wrap?n.contains(z):z===t._input,re=t.config.allowInput,Le=t.isOpen&&(!re||!ie),le=t.config.inline&&ie&&!re;if(R.keyCode===13&&ie){if(re)return t.setDate(t._input.value,!0,z===t.altInput?t.config.altFormat:t.config.dateFormat),t.close(),z.blur();t.open()}else if(K(z)||Le||le){var pe=!!t.timeContainer&&t.timeContainer.contains(z);switch(R.keyCode){case 13:pe?(R.preventDefault(),a(),tt()):dt(R);break;case 27:R.preventDefault(),tt();break;case 8:case 46:ie&&!t.config.allowInput&&(R.preventDefault(),t.clear());break;case 37:case 39:if(!pe&&!ie){R.preventDefault();var ke=l();if(t.daysContainer!==void 0&&(re===!1||ke&&ce(ke))){var fe=R.keyCode===39?1:-1;R.ctrlKey?(R.stopPropagation(),x(fe),I(E(1),0)):I(void 0,fe)}}else t.hourElement&&t.hourElement.focus();break;case 38:case 40:R.preventDefault();var he=R.keyCode===40?1:-1;t.daysContainer&&z.$i!==void 0||z===t.input||z===t.altInput?R.ctrlKey?(R.stopPropagation(),oe(t.currentYear-he),I(E(1),0)):pe||I(void 0,he*7):z===t.currentYearElement?oe(t.currentYear-he):t.config.enableTime&&(!pe&&t.hourElement&&t.hourElement.focus(),a(R),t._debouncedChange());break;case 9:if(pe){var Ie=[t.hourElement,t.minuteElement,t.secondElement,t.amPM].concat(t.pluginElements).filter(function(jt){return jt}),gt=Ie.indexOf(z);if(gt!==-1){var un=Ie[gt+(R.shiftKey?-1:1)];R.preventDefault(),(un||t._input).focus()}}else!t.config.noCalendar&&t.daysContainer&&t.daysContainer.contains(z)&&R.shiftKey&&(R.preventDefault(),t._input.focus());break}}if(t.amPM!==void 0&&z===t.amPM)switch(R.key){case t.l10n.amPM[0].charAt(0):case t.l10n.amPM[0].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[0],c(),Ct();break;case t.l10n.amPM[1].charAt(0):case t.l10n.amPM[1].charAt(0).toLowerCase():t.amPM.textContent=t.l10n.amPM[1],c(),Ct();break}(ie||K(z))&&Ke("onKeyDown",R)}function Q(R,z){if(z===void 0&&(z="flatpickr-day"),!(t.selectedDates.length!==1||R&&(!R.classList.contains(z)||R.classList.contains("flatpickr-disabled")))){for(var ie=R?R.dateObj.getTime():t.days.firstElementChild.dateObj.getTime(),re=t.parseDate(t.selectedDates[0],void 0,!0).getTime(),Le=Math.min(ie,t.selectedDates[0].getTime()),le=Math.max(ie,t.selectedDates[0].getTime()),pe=!1,ke=0,fe=0,he=Le;heLe&&heke)?ke=he:he>re&&(!fe||he ."+z));Ie.forEach(function(gt){var un=gt.dateObj,jt=un.getTime(),Di=ke>0&&jt0&&jt>fe;if(Di){gt.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(gi){gt.classList.remove(gi)});return}else if(pe&&!Di)return;["startRange","inRange","endRange","notAllowed"].forEach(function(gi){gt.classList.remove(gi)}),R!==void 0&&(R.classList.add(ie<=t.selectedDates[0].getTime()?"startRange":"endRange"),reie&&jt===re&>.classList.add("endRange"),jt>=ke&&(fe===0||jt<=fe)&&jS(jt,re,ie)&>.classList.add("inRange"))})}}function $e(){t.isOpen&&!t.config.static&&!t.config.inline&&et()}function Be(R,z){if(z===void 0&&(z=t._positionElement),t.isMobile===!0){if(R){R.preventDefault();var ie=En(R);ie&&ie.blur()}t.mobileInput!==void 0&&(t.mobileInput.focus(),t.mobileInput.click()),Ke("onOpen");return}else if(t._input.disabled||t.config.inline)return;var re=t.isOpen;t.isOpen=!0,re||(t.calendarContainer.classList.add("open"),t._input.classList.add("active"),Ke("onOpen"),et(z)),t.config.enableTime===!0&&t.config.noCalendar===!0&&t.config.allowInput===!1&&(R===void 0||!t.timeContainer.contains(R.relatedTarget))&&setTimeout(function(){return t.hourElement.select()},50)}function Xe(R){return function(z){var ie=t.config["_"+R+"Date"]=t.parseDate(z,t.config.dateFormat),re=t.config["_"+(R==="min"?"max":"min")+"Date"];ie!==void 0&&(t[R==="min"?"minDateHasTime":"maxDateHasTime"]=ie.getHours()>0||ie.getMinutes()>0||ie.getSeconds()>0),t.selectedDates&&(t.selectedDates=t.selectedDates.filter(function(Le){return W(Le)}),!t.selectedDates.length&&R==="min"&&d(ie),Ct()),t.daysContainer&&(Ze(),ie!==void 0?t.currentYearElement[R]=ie.getFullYear().toString():t.currentYearElement.removeAttribute(R),t.currentYearElement.disabled=!!re&&ie!==void 0&&re.getFullYear()===ie.getFullYear())}}function ut(){var R=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],z=fn(fn({},JSON.parse(JSON.stringify(n.dataset||{}))),e),ie={};t.config.parseDate=z.parseDate,t.config.formatDate=z.formatDate,Object.defineProperty(t.config,"enable",{get:function(){return t.config._enable},set:function(Ie){t.config._enable=ht(Ie)}}),Object.defineProperty(t.config,"disable",{get:function(){return t.config._disable},set:function(Ie){t.config._disable=ht(Ie)}});var re=z.mode==="time";if(!z.dateFormat&&(z.enableTime||re)){var Le=Zt.defaultConfig.dateFormat||Cs.dateFormat;ie.dateFormat=z.noCalendar||re?"H:i"+(z.enableSeconds?":S":""):Le+" H:i"+(z.enableSeconds?":S":"")}if(z.altInput&&(z.enableTime||re)&&!z.altFormat){var le=Zt.defaultConfig.altFormat||Cs.altFormat;ie.altFormat=z.noCalendar||re?"h:i"+(z.enableSeconds?":S K":" K"):le+(" h:i"+(z.enableSeconds?":S":"")+" K")}Object.defineProperty(t.config,"minDate",{get:function(){return t.config._minDate},set:Xe("min")}),Object.defineProperty(t.config,"maxDate",{get:function(){return t.config._maxDate},set:Xe("max")});var pe=function(Ie){return function(gt){t.config[Ie==="min"?"_minTime":"_maxTime"]=t.parseDate(gt,"H:i:S")}};Object.defineProperty(t.config,"minTime",{get:function(){return t.config._minTime},set:pe("min")}),Object.defineProperty(t.config,"maxTime",{get:function(){return t.config._maxTime},set:pe("max")}),z.mode==="time"&&(t.config.noCalendar=!0,t.config.enableTime=!0),Object.assign(t.config,ie,z);for(var ke=0;ke-1?t.config[he]=Er(fe[he]).map(o).concat(t.config[he]):typeof z[he]>"u"&&(t.config[he]=fe[he])}z.altInputClass||(t.config.altInputClass=it().className+" "+t.config.altInputClass),Ke("onParseConfig")}function it(){return t.config.wrap?n.querySelector("[data-input]"):n}function Je(){typeof t.config.locale!="object"&&typeof Zt.l10ns[t.config.locale]>"u"&&t.config.errorHandler(new Error("flatpickr: invalid locale "+t.config.locale)),t.l10n=fn(fn({},Zt.l10ns.default),typeof t.config.locale=="object"?t.config.locale:t.config.locale!=="default"?Zt.l10ns[t.config.locale]:void 0),es.D="("+t.l10n.weekdays.shorthand.join("|")+")",es.l="("+t.l10n.weekdays.longhand.join("|")+")",es.M="("+t.l10n.months.shorthand.join("|")+")",es.F="("+t.l10n.months.longhand.join("|")+")",es.K="("+t.l10n.amPM[0]+"|"+t.l10n.amPM[1]+"|"+t.l10n.amPM[0].toLowerCase()+"|"+t.l10n.amPM[1].toLowerCase()+")";var R=fn(fn({},e),JSON.parse(JSON.stringify(n.dataset||{})));R.time_24hr===void 0&&Zt.defaultConfig.time_24hr===void 0&&(t.config.time_24hr=t.l10n.time_24hr),t.formatDate=cb(t),t.parseDate=ha({config:t.config,l10n:t.l10n})}function et(R){if(typeof t.config.position=="function")return void t.config.position(t,R);if(t.calendarContainer!==void 0){Ke("onPreCalendarPosition");var z=R||t._positionElement,ie=Array.prototype.reduce.call(t.calendarContainer.children,function(Hl,jl){return Hl+jl.offsetHeight},0),re=t.calendarContainer.offsetWidth,Le=t.config.position.split(" "),le=Le[0],pe=Le.length>1?Le[1]:null,ke=z.getBoundingClientRect(),fe=window.innerHeight-ke.bottom,he=le==="above"||le!=="below"&&feie,Ie=window.pageYOffset+ke.top+(he?-ie-2:z.offsetHeight+2);if(mn(t.calendarContainer,"arrowTop",!he),mn(t.calendarContainer,"arrowBottom",he),!t.config.inline){var gt=window.pageXOffset+ke.left,un=!1,jt=!1;pe==="center"?(gt-=(re-ke.width)/2,un=!0):pe==="right"&&(gt-=re-ke.width,jt=!0),mn(t.calendarContainer,"arrowLeft",!un&&!jt),mn(t.calendarContainer,"arrowCenter",un),mn(t.calendarContainer,"arrowRight",jt);var Di=window.document.body.offsetWidth-(window.pageXOffset+ke.right),gi=gt+re>window.document.body.offsetWidth,Il=Di+re>window.document.body.offsetWidth;if(mn(t.calendarContainer,"rightMost",gi),!t.config.static)if(t.calendarContainer.style.top=Ie+"px",!gi)t.calendarContainer.style.left=gt+"px",t.calendarContainer.style.right="auto";else if(!Il)t.calendarContainer.style.left="auto",t.calendarContainer.style.right=Di+"px";else{var ms=Te();if(ms===void 0)return;var Nl=window.document.body.offsetWidth,je=Math.max(0,Nl/2-re/2),Qe=".flatpickr-calendar.centerMost:before",Gt=".flatpickr-calendar.centerMost:after",Fl=ms.cssRules.length,Rl="{left:"+ke.left+"px;right:auto;}";mn(t.calendarContainer,"rightMost",!1),mn(t.calendarContainer,"centerMost",!0),ms.insertRule(Qe+","+Gt+Rl,Fl),t.calendarContainer.style.left=je+"px",t.calendarContainer.style.right="auto"}}}}function Te(){for(var R=null,z=0;zt.currentMonth+t.config.showMonths-1)&&t.config.mode!=="range";if(t.selectedDateElem=re,t.config.mode==="single")t.selectedDates=[Le];else if(t.config.mode==="multiple"){var pe=ze(Le);pe?t.selectedDates.splice(parseInt(pe),1):t.selectedDates.push(Le)}else t.config.mode==="range"&&(t.selectedDates.length===2&&t.clear(!1,!1),t.latestSelectedDateObj=Le,t.selectedDates.push(Le),An(Le,t.selectedDates[0],!0)!==0&&t.selectedDates.sort(function(Ie,gt){return Ie.getTime()-gt.getTime()}));if(c(),le){var ke=t.currentYear!==Le.getFullYear();t.currentYear=Le.getFullYear(),t.currentMonth=Le.getMonth(),ke&&(Ke("onYearChange"),X()),Ke("onMonthChange")}if(ot(),V(),Ct(),!le&&t.config.mode!=="range"&&t.config.showMonths===1?O(re):t.selectedDateElem!==void 0&&t.hourElement===void 0&&t.selectedDateElem&&t.selectedDateElem.focus(),t.hourElement!==void 0&&t.hourElement!==void 0&&t.hourElement.focus(),t.config.closeOnSelect){var fe=t.config.mode==="single"&&!t.config.enableTime,he=t.config.mode==="range"&&t.selectedDates.length===2&&!t.config.enableTime;(fe||he)&&tt()}b()}}var be={locale:[Je,G],showMonths:[Z,r,Y],minDate:[$],maxDate:[$],positionElement:[_t],clickOpens:[function(){t.config.clickOpens===!0?(v(t._input,"focus",t.open),v(t._input,"click",t.open)):(t._input.removeEventListener("focus",t.open),t._input.removeEventListener("click",t.open))}]};function Fe(R,z){if(R!==null&&typeof R=="object"){Object.assign(t.config,R);for(var ie in R)be[ie]!==void 0&&be[ie].forEach(function(re){return re()})}else t.config[R]=z,be[R]!==void 0?be[R].forEach(function(re){return re()}):Or.indexOf(R)>-1&&(t.config[R]=Er(z));t.redraw(),Ct(!0)}function pt(R,z){var ie=[];if(R instanceof Array)ie=R.map(function(re){return t.parseDate(re,z)});else if(R instanceof Date||typeof R=="number")ie=[t.parseDate(R,z)];else if(typeof R=="string")switch(t.config.mode){case"single":case"time":ie=[t.parseDate(R,z)];break;case"multiple":ie=R.split(t.config.conjunction).map(function(re){return t.parseDate(re,z)});break;case"range":ie=R.split(t.l10n.rangeSeparator).map(function(re){return t.parseDate(re,z)});break}else t.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(R)));t.selectedDates=t.config.allowInvalidPreload?ie:ie.filter(function(re){return re instanceof Date&&W(re,!1)}),t.config.mode==="range"&&t.selectedDates.sort(function(re,Le){return re.getTime()-Le.getTime()})}function Dt(R,z,ie){if(z===void 0&&(z=!1),ie===void 0&&(ie=t.config.dateFormat),R!==0&&!R||R instanceof Array&&R.length===0)return t.clear(z);pt(R,ie),t.latestSelectedDateObj=t.selectedDates[t.selectedDates.length-1],t.redraw(),$(void 0,z),d(),t.selectedDates.length===0&&t.clear(!1),Ct(z),z&&Ke("onChange")}function ht(R){return R.slice().map(function(z){return typeof z=="string"||typeof z=="number"||z instanceof Date?t.parseDate(z,void 0,!0):z&&typeof z=="object"&&z.from&&z.to?{from:t.parseDate(z.from,void 0),to:t.parseDate(z.to,void 0)}:z}).filter(function(z){return z})}function st(){t.selectedDates=[],t.now=t.parseDate(t.config.now)||new Date;var R=t.config.defaultDate||((t.input.nodeName==="INPUT"||t.input.nodeName==="TEXTAREA")&&t.input.placeholder&&t.input.value===t.input.placeholder?null:t.input.value);R&&pt(R,t.config.dateFormat),t._initialDate=t.selectedDates.length>0?t.selectedDates[0]:t.config.minDate&&t.config.minDate.getTime()>t.now.getTime()?t.config.minDate:t.config.maxDate&&t.config.maxDate.getTime()0&&(t.latestSelectedDateObj=t.selectedDates[0]),t.config.minTime!==void 0&&(t.config.minTime=t.parseDate(t.config.minTime,"H:i")),t.config.maxTime!==void 0&&(t.config.maxTime=t.parseDate(t.config.maxTime,"H:i")),t.minDateHasTime=!!t.config.minDate&&(t.config.minDate.getHours()>0||t.config.minDate.getMinutes()>0||t.config.minDate.getSeconds()>0),t.maxDateHasTime=!!t.config.maxDate&&(t.config.maxDate.getHours()>0||t.config.maxDate.getMinutes()>0||t.config.maxDate.getSeconds()>0)}function Lt(){if(t.input=it(),!t.input){t.config.errorHandler(new Error("Invalid input element specified"));return}t.input._type=t.input.type,t.input.type="text",t.input.classList.add("flatpickr-input"),t._input=t.input,t.config.altInput&&(t.altInput=St(t.input.nodeName,t.config.altInputClass),t._input=t.altInput,t.altInput.placeholder=t.input.placeholder,t.altInput.disabled=t.input.disabled,t.altInput.required=t.input.required,t.altInput.tabIndex=t.input.tabIndex,t.altInput.type="text",t.input.setAttribute("type","hidden"),!t.config.static&&t.input.parentNode&&t.input.parentNode.insertBefore(t.altInput,t.input.nextSibling)),t.config.allowInput||t._input.setAttribute("readonly","readonly"),_t()}function _t(){t._positionElement=t.config.positionElement||t._input}function Ft(){var R=t.config.enableTime?t.config.noCalendar?"time":"datetime-local":"date";t.mobileInput=St("input",t.input.className+" flatpickr-mobile"),t.mobileInput.tabIndex=1,t.mobileInput.type=R,t.mobileInput.disabled=t.input.disabled,t.mobileInput.required=t.input.required,t.mobileInput.placeholder=t.input.placeholder,t.mobileFormatStr=R==="datetime-local"?"Y-m-d\\TH:i:S":R==="date"?"Y-m-d":"H:i:S",t.selectedDates.length>0&&(t.mobileInput.defaultValue=t.mobileInput.value=t.formatDate(t.selectedDates[0],t.mobileFormatStr)),t.config.minDate&&(t.mobileInput.min=t.formatDate(t.config.minDate,"Y-m-d")),t.config.maxDate&&(t.mobileInput.max=t.formatDate(t.config.maxDate,"Y-m-d")),t.input.getAttribute("step")&&(t.mobileInput.step=String(t.input.getAttribute("step"))),t.input.type="hidden",t.altInput!==void 0&&(t.altInput.type="hidden");try{t.input.parentNode&&t.input.parentNode.insertBefore(t.mobileInput,t.input.nextSibling)}catch{}v(t.mobileInput,"change",function(z){t.setDate(En(z).value,!1,t.mobileFormatStr),Ke("onChange"),Ke("onClose")})}function Ot(R){if(t.isOpen===!0)return t.close();t.open(R)}function Ke(R,z){if(t.config!==void 0){var ie=t.config[R];if(ie!==void 0&&ie.length>0)for(var re=0;ie[re]&&re=0&&An(R,t.selectedDates[1])<=0}function ot(){t.config.noCalendar||t.isMobile||!t.monthNav||(t.yearElements.forEach(function(R,z){var ie=new Date(t.currentYear,t.currentMonth,1);ie.setMonth(t.currentMonth+z),t.config.showMonths>1||t.config.monthSelectorType==="static"?t.monthElements[z].textContent=Ro(ie.getMonth(),t.config.shorthandCurrentMonth,t.l10n)+" ":t.monthsDropdownContainer.value=ie.getMonth().toString(),R.value=ie.getFullYear().toString()}),t._hidePrevMonthArrow=t.config.minDate!==void 0&&(t.currentYear===t.config.minDate.getFullYear()?t.currentMonth<=t.config.minDate.getMonth():t.currentYeart.config.maxDate.getMonth():t.currentYear>t.config.maxDate.getFullYear()))}function Ht(R){var z=R||(t.config.altInput?t.config.altFormat:t.config.dateFormat);return t.selectedDates.map(function(ie){return t.formatDate(ie,z)}).filter(function(ie,re,Le){return t.config.mode!=="range"||t.config.enableTime||Le.indexOf(ie)===re}).join(t.config.mode!=="range"?t.config.conjunction:t.l10n.rangeSeparator)}function Ct(R){R===void 0&&(R=!0),t.mobileInput!==void 0&&t.mobileFormatStr&&(t.mobileInput.value=t.latestSelectedDateObj!==void 0?t.formatDate(t.latestSelectedDateObj,t.mobileFormatStr):""),t.input.value=Ht(t.config.dateFormat),t.altInput!==void 0&&(t.altInput.value=Ht(t.config.altFormat)),R!==!1&&Ke("onValueUpdate")}function ft(R){var z=En(R),ie=t.prevMonthNav.contains(z),re=t.nextMonthNav.contains(z);ie||re?x(ie?-1:1):t.yearElements.indexOf(z)>=0?z.select():z.classList.contains("arrowUp")?t.changeYear(t.currentYear+1):z.classList.contains("arrowDown")&&t.changeYear(t.currentYear-1)}function xt(R){R.preventDefault();var z=R.type==="keydown",ie=En(R),re=ie;t.amPM!==void 0&&ie===t.amPM&&(t.amPM.textContent=t.l10n.amPM[jn(t.amPM.textContent===t.l10n.amPM[0])]);var Le=parseFloat(re.getAttribute("min")),le=parseFloat(re.getAttribute("max")),pe=parseFloat(re.getAttribute("step")),ke=parseInt(re.value,10),fe=R.delta||(z?R.which===38?1:-1:0),he=ke+pe*fe;if(typeof re.value<"u"&&re.value.length===2){var Ie=re===t.hourElement,gt=re===t.minuteElement;hele&&(he=re===t.hourElement?he-le-jn(!t.amPM):Le,gt&&S(void 0,1,t.hourElement)),t.amPM&&Ie&&(pe===1?he+ke===23:Math.abs(he-ke)>pe)&&(t.amPM.textContent=t.l10n.amPM[jn(t.amPM.textContent===t.l10n.amPM[0])]),re.value=vn(he)}}return s(),t}function Ms(n,e){for(var t=Array.prototype.slice.call(n).filter(function(o){return o instanceof HTMLElement}),i=[],s=0;s{const S=f||g,T=y(d);return T.onReady.push(()=>{t(8,h=!0)}),t(3,v=Zt(S,Object.assign(T,f?{wrap:!0}:{}))),()=>{v.destroy()}});const b=Qt();function y(S={}){S=Object.assign({},S);for(const T of r){const M=(O,E,P)=>{b(YS(T),[O,E,P])};T in S?(Array.isArray(S[T])||(S[T]=[S[T]]),S[T].push(M)):S[T]=[M]}return S.onChange&&!S.onChange.includes($)&&S.onChange.push($),S}function $(S,T,M){var E,P;const O=(P=(E=M==null?void 0:M.config)==null?void 0:E.mode)!=null?P:"single";t(2,a=O==="single"?S[0]:S),t(4,u=T)}function C(S){me[S?"unshift":"push"](()=>{g=S,t(0,g)})}return n.$$set=S=>{e=at(at({},e),li(S)),t(1,s=Bt(e,i)),"value"in S&&t(2,a=S.value),"formattedValue"in S&&t(4,u=S.formattedValue),"element"in S&&t(5,f=S.element),"dateFormat"in S&&t(6,c=S.dateFormat),"options"in S&&t(7,d=S.options),"input"in S&&t(0,g=S.input),"flatpickr"in S&&t(3,v=S.flatpickr),"$$scope"in S&&t(9,o=S.$$scope)},n.$$.update=()=>{if(n.$$.dirty&332&&v&&h&&v.setDate(a,!1,c),n.$$.dirty&392&&v&&h)for(const[S,T]of Object.entries(y(d)))v.set(S,T)},[g,s,a,v,u,f,c,d,h,o,l,C]}class tu extends Ee{constructor(e){super(),Oe(this,e,KS,WS,De,{value:2,formattedValue:4,element:5,dateFormat:6,options:7,input:0,flatpickr:3})}}function JS(n){let e,t,i,s,l,o,r;function a(f){n[2](f)}let u={id:n[4],options:B.defaultFlatpickrOptions(),value:n[0].min};return n[0].min!==void 0&&(u.formattedValue=n[0].min),l=new tu({props:u}),me.push(()=>Re(l,"formattedValue",a)),{c(){e=_("label"),t=N("Min date (UTC)"),s=D(),q(l.$$.fragment),p(e,"for",i=n[4])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),H(l,f,c),r=!0},p(f,c){(!r||c&16&&i!==(i=f[4]))&&p(e,"for",i);const d={};c&16&&(d.id=f[4]),c&1&&(d.value=f[0].min),!o&&c&1&&(o=!0,d.formattedValue=f[0].min,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){L(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),j(l,f)}}}function ZS(n){let e,t,i,s,l,o,r;function a(f){n[3](f)}let u={id:n[4],options:B.defaultFlatpickrOptions(),value:n[0].max};return n[0].max!==void 0&&(u.formattedValue=n[0].max),l=new tu({props:u}),me.push(()=>Re(l,"formattedValue",a)),{c(){e=_("label"),t=N("Max date (UTC)"),s=D(),q(l.$$.fragment),p(e,"for",i=n[4])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),H(l,f,c),r=!0},p(f,c){(!r||c&16&&i!==(i=f[4]))&&p(e,"for",i);const d={};c&16&&(d.id=f[4]),c&1&&(d.value=f[0].max),!o&&c&1&&(o=!0,d.formattedValue=f[0].max,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){L(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),j(l,f)}}}function GS(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:[JS,({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:[ZS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),q(i.$$.fragment),s=D(),l=_("div"),q(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),m(e,t),H(i,t,null),m(e,s),m(e,l),H(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||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){L(i.$$.fragment,a),L(o.$$.fragment,a),r=!1},d(a){a&&k(e),j(i),j(o)}}}function XS(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.min,r)&&(s.min=r,t(0,s))}function o(r){n.$$.not_equal(s.max,r)&&(s.max=r,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 QS extends Ee{constructor(e){super(),Oe(this,e,XS,GS,De,{key:1,options:0})}}function xS(n){let e,t,i,s,l,o,r,a,u;function f(d){n[2](d)}let c={id:n[4],placeholder:"eg. optionA, optionB",required:!0};return n[0].values!==void 0&&(c.value=n[0].values),l=new hs({props:c}),me.push(()=>Re(l,"value",f)),{c(){e=_("label"),t=N("Choices"),s=D(),q(l.$$.fragment),r=D(),a=_("div"),a.textContent="Use comma as separator.",p(e,"for",i=n[4]),p(a,"class","help-block")},m(d,h){w(d,e,h),m(e,t),w(d,s,h),H(l,d,h),w(d,r,h),w(d,a,h),u=!0},p(d,h){(!u||h&16&&i!==(i=d[4]))&&p(e,"for",i);const g={};h&16&&(g.id=d[4]),!o&&h&1&&(o=!0,g.value=d[0].values,He(()=>o=!1)),l.$set(g)},i(d){u||(A(l.$$.fragment,d),u=!0)},o(d){L(l.$$.fragment,d),u=!1},d(d){d&&k(e),d&&k(s),j(l,d),d&&k(r),d&&k(a)}}}function e3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Max select"),s=D(),l=_("input"),p(e,"for",i=n[4]),p(l,"type","number"),p(l,"id",o=n[4]),p(l,"step","1"),p(l,"min","1"),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].maxSelect),r||(a=J(l,"input",n[3]),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&&Pt(l.value)!==u[0].maxSelect&&Me(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function t3(n){let e,t,i,s,l,o,r;return i=new Ne({props:{class:"form-field required",name:"schema."+n[1]+".options.values",$$slots:{default:[xS,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[e3,({uniqueId:a})=>({4:a}),({uniqueId:a})=>a?16:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),q(i.$$.fragment),s=D(),l=_("div"),q(o.$$.fragment),p(t,"class","col-sm-9"),p(l,"class","col-sm-3"),p(e,"class","grid")},m(a,u){w(a,e,u),m(e,t),H(i,t,null),m(e,s),m(e,l),H(o,l,null),r=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.values"),u&49&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.maxSelect"),u&49&&(c.$$scope={dirty:u,ctx:a}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){L(i.$$.fragment,a),L(o.$$.fragment,a),r=!1},d(a){a&&k(e),j(i),j(o)}}}function n3(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(r){n.$$.not_equal(s.values,r)&&(s.values=r,t(0,s))}function o(){s.maxSelect=Pt(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)},n.$$.update=()=>{n.$$.dirty&1&&B.isEmpty(s)&&t(0,s={maxSelect:1,values:[]})},[s,i,l,o]}class i3 extends Ee{constructor(e){super(),Oe(this,e,n3,t3,De,{key:1,options:0})}}function s3(n,e,t){return["",{}]}class l3 extends Ee{constructor(e){super(),Oe(this,e,s3,null,De,{key:0,options:1})}get key(){return this.$$.ctx[0]}get options(){return this.$$.ctx[1]}}function o3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Max file size (bytes)"),s=D(),l=_("input"),p(e,"for",i=n[10]),p(l,"type","number"),p(l,"id",o=n[10]),p(l,"step","1"),p(l,"min","0")},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].maxSize),r||(a=J(l,"input",n[2]),r=!0)},p(u,f){f&1024&&i!==(i=u[10])&&p(e,"for",i),f&1024&&o!==(o=u[10])&&p(l,"id",o),f&1&&Pt(l.value)!==u[0].maxSize&&Me(l,u[0].maxSize)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function r3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Max files"),s=D(),l=_("input"),p(e,"for",i=n[10]),p(l,"type","number"),p(l,"id",o=n[10]),p(l,"step","1"),p(l,"min",""),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].maxSelect),r||(a=J(l,"input",n[3]),r=!0)},p(u,f){f&1024&&i!==(i=u[10])&&p(e,"for",i),f&1024&&o!==(o=u[10])&&p(l,"id",o),f&1&&Pt(l.value)!==u[0].maxSelect&&Me(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function a3(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("div"),e.innerHTML='Documents (pdf, doc/docx, xls/xlsx)',t=D(),i=_("div"),i.innerHTML='Images (jpg, png, svg, gif)',s=D(),l=_("div"),l.innerHTML='Videos (mp4, avi, mov, 3gp)',o=D(),r=_("div"),r.innerHTML='Archives (zip, 7zip, rar)',p(e,"tabindex","0"),p(e,"class","dropdown-item closable"),p(i,"tabindex","0"),p(i,"class","dropdown-item closable"),p(l,"tabindex","0"),p(l,"class","dropdown-item closable"),p(r,"tabindex","0"),p(r,"class","dropdown-item closable")},m(f,c){w(f,e,c),w(f,t,c),w(f,i,c),w(f,s,c),w(f,l,c),w(f,o,c),w(f,r,c),a||(u=[J(e,"click",n[5]),J(i,"click",n[6]),J(l,"click",n[7]),J(r,"click",n[8])],a=!0)},p:se,d(f){f&&k(e),f&&k(t),f&&k(i),f&&k(s),f&&k(l),f&&k(o),f&&k(r),a=!1,Ye(u)}}}function u3(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g,v,b,y,$,C,S,T;function M(E){n[4](E)}let O={id:n[10],placeholder:"eg. image/png, application/pdf..."};return n[0].mimeTypes!==void 0&&(O.value=n[0].mimeTypes),r=new hs({props:O}),me.push(()=>Re(r,"value",M)),$=new Ti({props:{class:"dropdown dropdown-sm dropdown-nowrap",$$slots:{default:[a3]},$$scope:{ctx:n}}}),{c(){e=_("label"),t=_("span"),t.textContent="Mime types",i=D(),s=_("i"),o=D(),q(r.$$.fragment),u=D(),f=_("div"),c=_("span"),c.textContent="Use comma as separator.",d=D(),h=_("button"),g=_("span"),g.textContent="Choose presets",v=D(),b=_("i"),y=D(),q($.$$.fragment),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[10]),p(c,"class","txt"),p(g,"class","txt link-primary"),p(b,"class","ri-arrow-drop-down-fill"),p(h,"type","button"),p(h,"class","inline-flex flex-gap-0"),p(f,"class","help-block")},m(E,P){w(E,e,P),m(e,t),m(e,i),m(e,s),w(E,o,P),H(r,E,P),w(E,u,P),w(E,f,P),m(f,c),m(f,d),m(f,h),m(h,g),m(h,v),m(h,b),m(h,y),H($,h,null),C=!0,S||(T=We(yt.call(null,s,{text:`Allow files ONLY with the listed mime types. - Leave empty for no restriction.`,position:"top"})),S=!0)},p(E,P){(!C||P&1024&&l!==(l=E[10]))&&p(e,"for",l);const I={};P&1024&&(I.id=E[10]),!a&&P&1&&(a=!0,I.value=E[0].mimeTypes,He(()=>a=!1)),r.$set(I);const F={};P&2049&&(F.$$scope={dirty:P,ctx:E}),$.$set(F)},i(E){C||(A(r.$$.fragment,E),A($.$$.fragment,E),C=!0)},o(E){L(r.$$.fragment,E),L($.$$.fragment,E),C=!1},d(E){E&&k(e),E&&k(o),j(r,E),E&&k(u),E&&k(f),j($),S=!1,T()}}}function f3(n){let e;return{c(){e=_("ul"),e.innerHTML=`
  • WxH - (eg. 100x50) - crop to WxH viewbox (from center)
  • -
  • WxHt - (eg. 100x50t) - crop to WxH viewbox (from top)
  • -
  • WxHb - (eg. 100x50b) - crop to WxH viewbox (from bottom)
  • -
  • WxHf - (eg. 100x50f) - fit inside a WxH viewbox (without cropping)
  • -
  • 0xH - (eg. 0x50) - resize to H height preserving the aspect ratio
  • -
  • Wx0 - (eg. 100x0) - resize to W width preserving the aspect ratio
  • `,p(e,"class","m-0")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function c3(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g,v,b,y,$,C,S,T;function M(E){n[9](E)}let O={id:n[10],placeholder:"eg. 50x50, 480x720"};return n[0].thumbs!==void 0&&(O.value=n[0].thumbs),r=new hs({props:O}),me.push(()=>Re(r,"value",M)),$=new Ti({props:{class:"dropdown dropdown-sm dropdown-center dropdown-nowrap p-r-10",$$slots:{default:[f3]},$$scope:{ctx:n}}}),{c(){e=_("label"),t=_("span"),t.textContent="Thumb sizes",i=D(),s=_("i"),o=D(),q(r.$$.fragment),u=D(),f=_("div"),c=_("span"),c.textContent="Use comma as separator.",d=D(),h=_("button"),g=_("span"),g.textContent="Supported formats",v=D(),b=_("i"),y=D(),q($.$$.fragment),p(t,"class","txt"),p(s,"class","ri-information-line link-hint"),p(e,"for",l=n[10]),p(c,"class","txt"),p(g,"class","txt link-primary"),p(b,"class","ri-arrow-drop-down-fill"),p(h,"type","button"),p(h,"class","inline-flex flex-gap-0"),p(f,"class","help-block")},m(E,P){w(E,e,P),m(e,t),m(e,i),m(e,s),w(E,o,P),H(r,E,P),w(E,u,P),w(E,f,P),m(f,c),m(f,d),m(f,h),m(h,g),m(h,v),m(h,b),m(h,y),H($,h,null),C=!0,S||(T=We(yt.call(null,s,{text:"List of additional thumb sizes for image files, along with the default thumb size of 100x100. The thumbs are generated lazily on first access.",position:"top"})),S=!0)},p(E,P){(!C||P&1024&&l!==(l=E[10]))&&p(e,"for",l);const I={};P&1024&&(I.id=E[10]),!a&&P&1&&(a=!0,I.value=E[0].thumbs,He(()=>a=!1)),r.$set(I);const F={};P&2048&&(F.$$scope={dirty:P,ctx:E}),$.$set(F)},i(E){C||(A(r.$$.fragment,E),A($.$$.fragment,E),C=!0)},o(E){L(r.$$.fragment,E),L($.$$.fragment,E),C=!1},d(E){E&&k(e),E&&k(o),j(r,E),E&&k(u),E&&k(f),j($),S=!1,T()}}}function d3(n){let e,t,i,s,l,o,r,a,u,f,c,d,h;return i=new Ne({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSize",$$slots:{default:[o3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[r3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),u=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.mimeTypes",$$slots:{default:[u3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),d=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.thumbs",$$slots:{default:[c3,({uniqueId:g})=>({10:g}),({uniqueId:g})=>g?1024:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),q(i.$$.fragment),s=D(),l=_("div"),q(o.$$.fragment),r=D(),a=_("div"),q(u.$$.fragment),f=D(),c=_("div"),q(d.$$.fragment),p(t,"class","col-sm-6"),p(l,"class","col-sm-6"),p(a,"class","col-sm-12"),p(c,"class","col-sm-12"),p(e,"class","grid")},m(g,v){w(g,e,v),m(e,t),H(i,t,null),m(e,s),m(e,l),H(o,l,null),m(e,r),m(e,a),H(u,a,null),m(e,f),m(e,c),H(d,c,null),h=!0},p(g,[v]){const b={};v&2&&(b.name="schema."+g[1]+".options.maxSize"),v&3073&&(b.$$scope={dirty:v,ctx:g}),i.$set(b);const y={};v&2&&(y.name="schema."+g[1]+".options.maxSelect"),v&3073&&(y.$$scope={dirty:v,ctx:g}),o.$set(y);const $={};v&2&&($.name="schema."+g[1]+".options.mimeTypes"),v&3073&&($.$$scope={dirty:v,ctx:g}),u.$set($);const C={};v&2&&(C.name="schema."+g[1]+".options.thumbs"),v&3073&&(C.$$scope={dirty:v,ctx:g}),d.$set(C)},i(g){h||(A(i.$$.fragment,g),A(o.$$.fragment,g),A(u.$$.fragment,g),A(d.$$.fragment,g),h=!0)},o(g){L(i.$$.fragment,g),L(o.$$.fragment,g),L(u.$$.fragment,g),L(d.$$.fragment,g),h=!1},d(g){g&&k(e),j(i),j(o),j(u),j(d)}}}function p3(n,e,t){let{key:i=""}=e,{options:s={}}=e;function l(){s.maxSize=Pt(this.value),t(0,s)}function o(){s.maxSelect=Pt(this.value),t(0,s)}function r(h){n.$$.not_equal(s.mimeTypes,h)&&(s.mimeTypes=h,t(0,s))}const a=()=>{t(0,s.mimeTypes=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],s)},u=()=>{t(0,s.mimeTypes=["image/jpg","image/jpeg","image/png","image/svg+xml","image/gif"],s)},f=()=>{t(0,s.mimeTypes=["video/mp4","video/x-ms-wmv","video/quicktime","video/3gpp"],s)},c=()=>{t(0,s.mimeTypes=["application/zip","application/x-7z-compressed","application/x-rar-compressed"],s)};function d(h){n.$$.not_equal(s.thumbs,h)&&(s.thumbs=h,t(0,s))}return n.$$set=h=>{"key"in h&&t(1,i=h.key),"options"in h&&t(0,s=h.options)},n.$$.update=()=>{n.$$.dirty&1&&B.isEmpty(s)&&t(0,s={maxSelect:1,maxSize:5242880,thumbs:[],mimeTypes:[]})},[s,i,l,o,r,a,u,f,c,d]}class h3 extends Ee{constructor(e){super(),Oe(this,e,p3,d3,De,{key:1,options:0})}}function m3(n){let e,t,i,s,l,o,r;function a(f){n[5](f)}let u={searchable:n[3].length>5,selectPlaceholder:n[2]?"Loading...":"Select collection",noOptionsText:"No collections found",selectionKey:"id",items:n[3]};return n[0].collectionId!==void 0&&(u.keyOfSelected=n[0].collectionId),l=new ps({props:u}),me.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=N("Collection"),s=D(),q(l.$$.fragment),p(e,"for",i=n[9])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),H(l,f,c),r=!0},p(f,c){(!r||c&512&&i!==(i=f[9]))&&p(e,"for",i);const d={};c&8&&(d.searchable=f[3].length>5),c&4&&(d.selectPlaceholder=f[2]?"Loading...":"Select collection"),c&8&&(d.items=f[3]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].collectionId,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){L(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),j(l,f)}}}function g3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Max select"),s=D(),l=_("input"),p(e,"for",i=n[9]),p(l,"type","number"),p(l,"id",o=n[9]),p(l,"step","1"),p(l,"min","1"),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].maxSelect),r||(a=J(l,"input",n[6]),r=!0)},p(u,f){f&512&&i!==(i=u[9])&&p(e,"for",i),f&512&&o!==(o=u[9])&&p(l,"id",o),f&1&&Pt(l.value)!==u[0].maxSelect&&Me(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function _3(n){let e,t,i,s,l,o,r;function a(f){n[7](f)}let u={id:n[9],items:n[4]};return n[0].cascadeDelete!==void 0&&(u.keyOfSelected=n[0].cascadeDelete),l=new ps({props:u}),me.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=N("Delete record on relation delete"),s=D(),q(l.$$.fragment),p(e,"for",i=n[9])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),H(l,f,c),r=!0},p(f,c){(!r||c&512&&i!==(i=f[9]))&&p(e,"for",i);const d={};c&512&&(d.id=f[9]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].cascadeDelete,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){L(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),j(l,f)}}}function b3(n){let e,t,i,s,l,o,r,a,u,f;return i=new Ne({props:{class:"form-field required",name:"schema."+n[1]+".options.collectionId",$$slots:{default:[m3,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[g3,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),u=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[_3,({uniqueId:c})=>({9:c}),({uniqueId:c})=>c?512:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),q(i.$$.fragment),s=D(),l=_("div"),q(o.$$.fragment),r=D(),a=_("div"),q(u.$$.fragment),p(t,"class","col-sm-9"),p(l,"class","col-sm-3"),p(a,"class","col-sm-12"),p(e,"class","grid")},m(c,d){w(c,e,d),m(e,t),H(i,t,null),m(e,s),m(e,l),H(o,l,null),m(e,r),m(e,a),H(u,a,null),f=!0},p(c,[d]){const h={};d&2&&(h.name="schema."+c[1]+".options.collectionId"),d&1549&&(h.$$scope={dirty:d,ctx:c}),i.$set(h);const g={};d&2&&(g.name="schema."+c[1]+".options.maxSelect"),d&1537&&(g.$$scope={dirty:d,ctx:c}),o.$set(g);const v={};d&2&&(v.name="schema."+c[1]+".options.cascadeDelete"),d&1537&&(v.$$scope={dirty:d,ctx:c}),u.$set(v)},i(c){f||(A(i.$$.fragment,c),A(o.$$.fragment,c),A(u.$$.fragment,c),f=!0)},o(c){L(i.$$.fragment,c),L(o.$$.fragment,c),L(u.$$.fragment,c),f=!1},d(c){c&&k(e),j(i),j(o),j(u)}}}function v3(n,e,t){let{key:i=""}=e,{options:s={}}=e;const l=[{label:"False",value:!1},{label:"True",value:!0}];let o=!1,r=[];a();function a(){t(2,o=!0),we.collections.getFullList(200,{sort:"-created"}).then(d=>{t(3,r=d)}).catch(d=>{we.errorResponseHandler(d)}).finally(()=>{t(2,o=!1)})}function u(d){n.$$.not_equal(s.collectionId,d)&&(s.collectionId=d,t(0,s))}function f(){s.maxSelect=Pt(this.value),t(0,s)}function c(d){n.$$.not_equal(s.cascadeDelete,d)&&(s.cascadeDelete=d,t(0,s))}return n.$$set=d=>{"key"in d&&t(1,i=d.key),"options"in d&&t(0,s=d.options)},n.$$.update=()=>{n.$$.dirty&1&&B.isEmpty(s)&&t(0,s={maxSelect:1,collectionId:null,cascadeDelete:!1})},[s,i,o,r,l,u,f,c]}class y3 extends Ee{constructor(e){super(),Oe(this,e,v3,b3,De,{key:1,options:0})}}function k3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("label"),t=N("Max select"),s=D(),l=_("input"),p(e,"for",i=n[5]),p(l,"type","number"),p(l,"id",o=n[5]),p(l,"step","1"),p(l,"min","1"),l.required=!0},m(u,f){w(u,e,f),m(e,t),w(u,s,f),w(u,l,f),Me(l,n[0].maxSelect),r||(a=J(l,"input",n[3]),r=!0)},p(u,f){f&32&&i!==(i=u[5])&&p(e,"for",i),f&32&&o!==(o=u[5])&&p(l,"id",o),f&1&&Pt(l.value)!==u[0].maxSelect&&Me(l,u[0].maxSelect)},d(u){u&&k(e),u&&k(s),u&&k(l),r=!1,a()}}}function w3(n){let e,t,i,s,l,o,r;function a(f){n[4](f)}let u={id:n[5],items:n[2]};return n[0].cascadeDelete!==void 0&&(u.keyOfSelected=n[0].cascadeDelete),l=new ps({props:u}),me.push(()=>Re(l,"keyOfSelected",a)),{c(){e=_("label"),t=N("Delete record on user delete"),s=D(),q(l.$$.fragment),p(e,"for",i=n[5])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),H(l,f,c),r=!0},p(f,c){(!r||c&32&&i!==(i=f[5]))&&p(e,"for",i);const d={};c&32&&(d.id=f[5]),!o&&c&1&&(o=!0,d.keyOfSelected=f[0].cascadeDelete,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){L(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),j(l,f)}}}function $3(n){let e,t,i,s,l,o,r;return i=new Ne({props:{class:"form-field required",name:"schema."+n[1]+".options.maxSelect",$$slots:{default:[k3,({uniqueId:a})=>({5:a}),({uniqueId:a})=>a?32:0]},$$scope:{ctx:n}}}),o=new Ne({props:{class:"form-field",name:"schema."+n[1]+".options.cascadeDelete",$$slots:{default:[w3,({uniqueId:a})=>({5:a}),({uniqueId:a})=>a?32:0]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),q(i.$$.fragment),s=D(),l=_("div"),q(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),m(e,t),H(i,t,null),m(e,s),m(e,l),H(o,l,null),r=!0},p(a,[u]){const f={};u&2&&(f.name="schema."+a[1]+".options.maxSelect"),u&97&&(f.$$scope={dirty:u,ctx:a}),i.$set(f);const c={};u&2&&(c.name="schema."+a[1]+".options.cascadeDelete"),u&97&&(c.$$scope={dirty:u,ctx:a}),o.$set(c)},i(a){r||(A(i.$$.fragment,a),A(o.$$.fragment,a),r=!0)},o(a){L(i.$$.fragment,a),L(o.$$.fragment,a),r=!1},d(a){a&&k(e),j(i),j(o)}}}function S3(n,e,t){const i=[{label:"False",value:!1},{label:"True",value:!0}];let{key:s=""}=e,{options:l={}}=e;function o(){l.maxSelect=Pt(this.value),t(0,l)}function r(a){n.$$.not_equal(l.cascadeDelete,a)&&(l.cascadeDelete=a,t(0,l))}return n.$$set=a=>{"key"in a&&t(1,s=a.key),"options"in a&&t(0,l=a.options)},n.$$.update=()=>{n.$$.dirty&1&&B.isEmpty(l)&&t(0,l={maxSelect:1,cascadeDelete:!1})},[l,s,i,o,r]}class C3 extends Ee{constructor(e){super(),Oe(this,e,S3,$3,De,{key:1,options:0})}}function M3(n){let e,t,i,s,l,o,r;function a(f){n[16](f)}let u={id:n[38],disabled:n[0].id};return n[0].type!==void 0&&(u.value=n[0].type),l=new mS({props:u}),me.push(()=>Re(l,"value",a)),{c(){e=_("label"),t=N("Type"),s=D(),q(l.$$.fragment),p(e,"for",i=n[38])},m(f,c){w(f,e,c),m(e,t),w(f,s,c),H(l,f,c),r=!0},p(f,c){(!r||c[1]&128&&i!==(i=f[38]))&&p(e,"for",i);const d={};c[1]&128&&(d.id=f[38]),c[0]&1&&(d.disabled=f[0].id),!o&&c[0]&1&&(o=!0,d.value=f[0].type,He(()=>o=!1)),l.$set(d)},i(f){r||(A(l.$$.fragment,f),r=!0)},o(f){L(l.$$.fragment,f),r=!1},d(f){f&&k(e),f&&k(s),j(l,f)}}}function Yc(n){let e,t,i;return{c(){e=_("span"),e.textContent="Duplicated or invalid name",p(e,"class","txt invalid-name-note svelte-1tpxlm5")},m(s,l){w(s,e,l),i=!0},i(s){i||(Tt(()=>{t||(t=nt(e,Wn,{duration:150,x:5},!0)),t.run(1)}),i=!0)},o(s){t||(t=nt(e,Wn,{duration:150,x:5},!1)),t.run(0),i=!1},d(s){s&&k(e),s&&t&&t.end()}}}function T3(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g=!n[5]&&Yc();return{c(){e=_("label"),t=_("span"),t.textContent="Name",i=D(),g&&g.c(),l=D(),o=_("input"),p(t,"class","txt"),p(e,"for",s=n[38]),p(o,"type","text"),p(o,"id",r=n[38]),o.required=!0,o.disabled=a=n[0].id&&n[0].system,p(o,"spellcheck","false"),o.autofocus=u=!n[0].id,o.value=f=n[0].name},m(v,b){w(v,e,b),m(e,t),m(e,i),g&&g.m(e,null),w(v,l,b),w(v,o,b),c=!0,n[0].id||o.focus(),d||(h=J(o,"input",n[17]),d=!0)},p(v,b){v[5]?g&&(Ae(),L(g,1,1,()=>{g=null}),Pe()):g?b[0]&32&&A(g,1):(g=Yc(),g.c(),A(g,1),g.m(e,null)),(!c||b[1]&128&&s!==(s=v[38]))&&p(e,"for",s),(!c||b[1]&128&&r!==(r=v[38]))&&p(o,"id",r),(!c||b[0]&1&&a!==(a=v[0].id&&v[0].system))&&(o.disabled=a),(!c||b[0]&1&&u!==(u=!v[0].id))&&(o.autofocus=u),(!c||b[0]&1&&f!==(f=v[0].name)&&o.value!==f)&&(o.value=f)},i(v){c||(A(g),c=!0)},o(v){L(g),c=!1},d(v){v&&k(e),g&&g.d(),v&&k(l),v&&k(o),d=!1,h()}}}function D3(n){let e,t,i;function s(o){n[28](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new C3({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function O3(n){let e,t,i;function s(o){n[27](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new y3({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function E3(n){let e,t,i;function s(o){n[26](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new h3({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function A3(n){let e,t,i;function s(o){n[25](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new l3({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function P3(n){let e,t,i;function s(o){n[24](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new i3({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function L3(n){let e,t,i;function s(o){n[23](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new QS({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function I3(n){let e,t,i;function s(o){n[22](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new RS({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function N3(n){let e,t,i;function s(o){n[21](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new ub({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function F3(n){let e,t,i;function s(o){n[20](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new DS({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function R3(n){let e,t,i;function s(o){n[19](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new MS({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function H3(n){let e,t,i;function s(o){n[18](o)}let l={key:n[1]};return n[0].options!==void 0&&(l.options=n[0].options),e=new kS({props:l}),me.push(()=>Re(e,"options",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){const a={};r[0]&2&&(a.key=o[1]),!t&&r[0]&1&&(t=!0,a.options=o[0].options,He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function j3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=D(),s=_("label"),l=N("Required"),p(e,"type","checkbox"),p(e,"id",t=n[38]),p(s,"for",o=n[38])},m(u,f){w(u,e,f),e.checked=n[0].required,w(u,i,f),w(u,s,f),m(s,l),r||(a=J(e,"change",n[29]),r=!0)},p(u,f){f[1]&128&&t!==(t=u[38])&&p(e,"id",t),f[0]&1&&(e.checked=u[0].required),f[1]&128&&o!==(o=u[38])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function Kc(n){let e,t;return e=new Ne({props:{class:"form-field form-field-toggle m-0",name:"unique",$$slots:{default:[q3,({uniqueId:i})=>({38:i}),({uniqueId:i})=>[0,i?128:0]]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,s){const l={};s[0]&1|s[1]&384&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function q3(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=D(),s=_("label"),l=N("Unique"),p(e,"type","checkbox"),p(e,"id",t=n[38]),p(s,"for",o=n[38])},m(u,f){w(u,e,f),e.checked=n[0].unique,w(u,i,f),w(u,s,f),m(s,l),r||(a=J(e,"change",n[30]),r=!0)},p(u,f){f[1]&128&&t!==(t=u[38])&&p(e,"id",t),f[0]&1&&(e.checked=u[0].unique),f[1]&128&&o!==(o=u[38])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function Jc(n){let e,t,i,s,l,o,r,a,u,f;a=new Ti({props:{class:"dropdown dropdown-sm dropdown-upside dropdown-right dropdown-nowrap no-min-width",$$slots:{default:[V3]},$$scope:{ctx:n}}});let c=n[8]&&Zc(n);return{c(){e=_("div"),t=_("div"),i=D(),s=_("div"),l=_("button"),o=_("i"),r=D(),q(a.$$.fragment),u=D(),c&&c.c(),p(t,"class","flex-fill"),p(o,"class","ri-more-line"),p(l,"type","button"),p(l,"class","btn btn-circle btn-sm btn-secondary"),p(s,"class","inline-flex flex-gap-sm flex-nowrap"),p(e,"class","col-sm-4 txt-right")},m(d,h){w(d,e,h),m(e,t),m(e,i),m(e,s),m(s,l),m(l,o),m(l,r),H(a,l,null),m(s,u),c&&c.m(s,null),f=!0},p(d,h){const g={};h[1]&256&&(g.$$scope={dirty:h,ctx:d}),a.$set(g),d[8]?c?c.p(d,h):(c=Zc(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i(d){f||(A(a.$$.fragment,d),f=!0)},o(d){L(a.$$.fragment,d),f=!1},d(d){d&&k(e),j(a),c&&c.d()}}}function V3(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Remove',p(e,"type","button"),p(e,"class","dropdown-item txt-right")},m(s,l){w(s,e,l),t||(i=J(e,"click",n[9]),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function Zc(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Done',p(e,"type","button"),p(e,"class","btn btn-sm btn-outline btn-expanded-sm")},m(s,l){w(s,e,l),t||(i=J(e,"click",ni(n[3])),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function z3(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g,v,b,y,$,C,S,T,M;s=new Ne({props:{class:"form-field required "+(n[0].id?"disabled":""),name:"schema."+n[1]+".type",$$slots:{default:[M3,({uniqueId:V})=>({38:V}),({uniqueId:V})=>[0,V?128:0]]},$$scope:{ctx:n}}}),r=new Ne({props:{class:` - form-field - required - `+(n[5]?"":"invalid")+` - `+(n[0].id&&n[0].system?"disabled":"")+` - `,name:"schema."+n[1]+".name",$$slots:{default:[T3,({uniqueId:V})=>({38:V}),({uniqueId:V})=>[0,V?128:0]]},$$scope:{ctx:n}}});const O=[H3,R3,F3,N3,I3,L3,P3,A3,E3,O3,D3],E=[];function P(V,X){return V[0].type==="text"?0:V[0].type==="number"?1:V[0].type==="bool"?2:V[0].type==="email"?3:V[0].type==="url"?4:V[0].type==="date"?5:V[0].type==="select"?6:V[0].type==="json"?7:V[0].type==="file"?8:V[0].type==="relation"?9:V[0].type==="user"?10:-1}~(f=P(n))&&(c=E[f]=O[f](n)),g=new Ne({props:{class:"form-field form-field-toggle m-0",name:"requried",$$slots:{default:[j3,({uniqueId:V})=>({38:V}),({uniqueId:V})=>[0,V?128:0]]},$$scope:{ctx:n}}});let I=n[0].type!=="file"&&Kc(n),F=!n[0].toDelete&&Jc(n);return{c(){e=_("form"),t=_("div"),i=_("div"),q(s.$$.fragment),l=D(),o=_("div"),q(r.$$.fragment),a=D(),u=_("div"),c&&c.c(),d=D(),h=_("div"),q(g.$$.fragment),v=D(),b=_("div"),I&&I.c(),y=D(),F&&F.c(),$=D(),C=_("input"),p(i,"class","col-sm-6"),p(o,"class","col-sm-6"),p(u,"class","col-sm-12 hidden-empty"),p(h,"class","col-sm-4 flex"),p(b,"class","col-sm-4 flex"),p(t,"class","grid"),p(C,"type","submit"),p(C,"class","hidden"),p(C,"tabindex","-1"),p(e,"class","field-form")},m(V,X){w(V,e,X),m(e,t),m(t,i),H(s,i,null),m(t,l),m(t,o),H(r,o,null),m(t,a),m(t,u),~f&&E[f].m(u,null),m(t,d),m(t,h),H(g,h,null),m(t,v),m(t,b),I&&I.m(b,null),m(t,y),F&&F.m(t,null),m(e,$),m(e,C),S=!0,T||(M=J(e,"submit",Yt(n[31])),T=!0)},p(V,X){const te={};X[0]&1&&(te.class="form-field required "+(V[0].id?"disabled":"")),X[0]&2&&(te.name="schema."+V[1]+".type"),X[0]&1|X[1]&384&&(te.$$scope={dirty:X,ctx:V}),s.$set(te);const Z={};X[0]&33&&(Z.class=` - form-field - required - `+(V[5]?"":"invalid")+` - `+(V[0].id&&V[0].system?"disabled":"")+` - `),X[0]&2&&(Z.name="schema."+V[1]+".name"),X[0]&33|X[1]&384&&(Z.$$scope={dirty:X,ctx:V}),r.$set(Z);let ee=f;f=P(V),f===ee?~f&&E[f].p(V,X):(c&&(Ae(),L(E[ee],1,1,()=>{E[ee]=null}),Pe()),~f?(c=E[f],c?c.p(V,X):(c=E[f]=O[f](V),c.c()),A(c,1),c.m(u,null)):c=null);const U={};X[0]&1|X[1]&384&&(U.$$scope={dirty:X,ctx:V}),g.$set(U),V[0].type!=="file"?I?(I.p(V,X),X[0]&1&&A(I,1)):(I=Kc(V),I.c(),A(I,1),I.m(b,null)):I&&(Ae(),L(I,1,1,()=>{I=null}),Pe()),V[0].toDelete?F&&(Ae(),L(F,1,1,()=>{F=null}),Pe()):F?(F.p(V,X),X[0]&1&&A(F,1)):(F=Jc(V),F.c(),A(F,1),F.m(t,null))},i(V){S||(A(s.$$.fragment,V),A(r.$$.fragment,V),A(c),A(g.$$.fragment,V),A(I),A(F),S=!0)},o(V){L(s.$$.fragment,V),L(r.$$.fragment,V),L(c),L(g.$$.fragment,V),L(I),L(F),S=!1},d(V){V&&k(e),j(s),j(r),~f&&E[f].d(),j(g),I&&I.d(),F&&F.d(),T=!1,M()}}}function Gc(n){let e,t,i,s,l=n[0].system&&Xc(),o=!n[0].id&&Qc(n),r=n[0].required&&xc(),a=n[0].unique&&ed();return{c(){e=_("div"),l&&l.c(),t=D(),o&&o.c(),i=D(),r&&r.c(),s=D(),a&&a.c(),p(e,"class","inline-flex")},m(u,f){w(u,e,f),l&&l.m(e,null),m(e,t),o&&o.m(e,null),m(e,i),r&&r.m(e,null),m(e,s),a&&a.m(e,null)},p(u,f){u[0].system?l||(l=Xc(),l.c(),l.m(e,t)):l&&(l.d(1),l=null),u[0].id?o&&(o.d(1),o=null):o?o.p(u,f):(o=Qc(u),o.c(),o.m(e,i)),u[0].required?r||(r=xc(),r.c(),r.m(e,s)):r&&(r.d(1),r=null),u[0].unique?a||(a=ed(),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},d(u){u&&k(e),l&&l.d(),o&&o.d(),r&&r.d(),a&&a.d()}}}function Xc(n){let e;return{c(){e=_("span"),e.textContent="System",p(e,"class","label label-danger")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Qc(n){let e;return{c(){e=_("span"),e.textContent="New",p(e,"class","label"),ne(e,"label-warning",n[8]&&!n[0].toDelete)},m(t,i){w(t,e,i)},p(t,i){i[0]&257&&ne(e,"label-warning",t[8]&&!t[0].toDelete)},d(t){t&&k(e)}}}function xc(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 ed(n){let e;return{c(){e=_("span"),e.textContent="Unique",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function td(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=We(yt.call(null,e,{text:"Has errors",position:"left"})),s=!0)},i(o){i||(Tt(()=>{t||(t=nt(e,Tn,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){t||(t=nt(e,Tn,{duration:150,start:.7},!1)),t.run(0),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function nd(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Restore',p(e,"type","button"),p(e,"class","btn btn-sm btn-danger btn-secondary")},m(s,l){w(s,e,l),t||(i=J(e,"click",ni(n[15])),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function B3(n){let e,t,i,s,l,o,r=(n[0].name||"-")+"",a,u,f,c,d,h,g,v,b,y=!n[0].toDelete&&Gc(n),$=n[7]&&!n[0].system&&td(),C=n[0].toDelete&&nd(n);return{c(){e=_("div"),t=_("span"),i=_("i"),l=D(),o=_("strong"),a=N(r),f=D(),y&&y.c(),c=D(),d=_("div"),h=D(),$&&$.c(),g=D(),C&&C.c(),v=Ue(),p(i,"class",s=lu(B.getFieldTypeIcon(n[0].type))+" svelte-1tpxlm5"),p(t,"class","icon field-type"),p(o,"class","title field-name svelte-1tpxlm5"),p(o,"title",u=n[0].name),ne(o,"txt-strikethrough",n[0].toDelete),p(e,"class","inline-flex"),p(d,"class","flex-fill")},m(S,T){w(S,e,T),m(e,t),m(t,i),m(e,l),m(e,o),m(o,a),w(S,f,T),y&&y.m(S,T),w(S,c,T),w(S,d,T),w(S,h,T),$&&$.m(S,T),w(S,g,T),C&&C.m(S,T),w(S,v,T),b=!0},p(S,T){(!b||T[0]&1&&s!==(s=lu(B.getFieldTypeIcon(S[0].type))+" svelte-1tpxlm5"))&&p(i,"class",s),(!b||T[0]&1)&&r!==(r=(S[0].name||"-")+"")&&ue(a,r),(!b||T[0]&1&&u!==(u=S[0].name))&&p(o,"title",u),(!b||T[0]&1)&&ne(o,"txt-strikethrough",S[0].toDelete),S[0].toDelete?y&&(y.d(1),y=null):y?y.p(S,T):(y=Gc(S),y.c(),y.m(c.parentNode,c)),S[7]&&!S[0].system?$?T[0]&129&&A($,1):($=td(),$.c(),A($,1),$.m(g.parentNode,g)):$&&(Ae(),L($,1,1,()=>{$=null}),Pe()),S[0].toDelete?C?C.p(S,T):(C=nd(S),C.c(),C.m(v.parentNode,v)):C&&(C.d(1),C=null)},i(S){b||(A($),b=!0)},o(S){L($),b=!1},d(S){S&&k(e),S&&k(f),y&&y.d(S),S&&k(c),S&&k(d),S&&k(h),$&&$.d(S),S&&k(g),C&&C.d(S),S&&k(v)}}}function U3(n){let e,t,i={single:!0,interactive:n[8],class:n[2]||n[0].toDelete||n[0].system?"field-accordion disabled":"field-accordion",$$slots:{header:[B3],default:[z3]},$$scope:{ctx:n}};return e=new sr({props:i}),n[32](e),e.$on("expand",n[33]),e.$on("collapse",n[34]),e.$on("toggle",n[35]),{c(){q(e.$$.fragment)},m(s,l){H(e,s,l),t=!0},p(s,l){const o={};l[0]&256&&(o.interactive=s[8]),l[0]&5&&(o.class=s[2]||s[0].toDelete||s[0].system?"field-accordion disabled":"field-accordion"),l[0]&483|l[1]&256&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){L(e.$$.fragment,s),t=!1},d(s){n[32](null),j(e,s)}}}function W3(n,e,t){let i,s,l,o,r;rt(n,Vi,K=>t(14,r=K));const a=Qt();let{key:u="0"}=e,{field:f=new Dn}=e,{disabled:c=!1}=e,{excludeNames:d=[]}=e,h,g=f.type;function v(){h==null||h.expand()}function b(){h==null||h.collapse()}function y(){f.id?t(0,f.toDelete=!0,f):(b(),a("remove"))}function $(K){if(K=(""+K).toLowerCase(),!K)return!1;for(const ye of d)if(ye.toLowerCase()===K)return!1;return!0}function C(K){return B.slugify(K)}Nn(()=>{f.id||v()});const S=()=>{t(0,f.toDelete=!1,f)};function T(K){n.$$.not_equal(f.type,K)&&(f.type=K,t(0,f),t(13,g),t(4,h))}const M=K=>{t(0,f.name=C(K.target.value),f),K.target.value=f.name};function O(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function E(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function P(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function I(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function F(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function V(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function X(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function te(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function Z(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function ee(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function U(K){n.$$.not_equal(f.options,K)&&(f.options=K,t(0,f),t(13,g),t(4,h))}function Y(){f.required=this.checked,t(0,f),t(13,g),t(4,h)}function G(){f.unique=this.checked,t(0,f),t(13,g),t(4,h)}const de=()=>{i&&b()};function x(K){me[K?"unshift":"push"](()=>{h=K,t(4,h)})}function ve(K){xe.call(this,n,K)}function _e(K){xe.call(this,n,K)}function ge(K){xe.call(this,n,K)}return n.$$set=K=>{"key"in K&&t(1,u=K.key),"field"in K&&t(0,f=K.field),"disabled"in K&&t(2,c=K.disabled),"excludeNames"in K&&t(11,d=K.excludeNames)},n.$$.update=()=>{n.$$.dirty[0]&8193&&g!=f.type&&(t(13,g=f.type),t(0,f.options={},f),t(0,f.unique=!1,f)),n.$$.dirty[0]&17&&f.toDelete&&(h&&b(),f.originalName&&f.name!==f.originalName&&t(0,f.name=f.originalName,f)),n.$$.dirty[0]&1&&!f.originalName&&f.name&&t(0,f.originalName=f.name,f),n.$$.dirty[0]&1&&typeof f.toDelete>"u"&&t(0,f.toDelete=!1,f),n.$$.dirty[0]&1&&f.required&&t(0,f.nullable=!1,f),n.$$.dirty[0]&1&&t(6,i=!B.isEmpty(f.name)&&f.type),n.$$.dirty[0]&80&&(i||h&&v()),n.$$.dirty[0]&69&&t(8,s=!c&&!f.system&&!f.toDelete&&i),n.$$.dirty[0]&1&&t(5,l=$(f.name)),n.$$.dirty[0]&16418&&t(7,o=!l||!B.isEmpty(B.getNestedVal(r,`schema.${u}`)))},[f,u,c,b,h,l,i,o,s,y,C,d,v,g,r,S,T,M,O,E,P,I,F,V,X,te,Z,ee,U,Y,G,de,x,ve,_e,ge]}class Y3 extends Ee{constructor(e){super(),Oe(this,e,W3,U3,De,{key:1,field:0,disabled:2,excludeNames:11,expand:12,collapse:3},null,[-1,-1])}get expand(){return this.$$.ctx[12]}get collapse(){return this.$$.ctx[3]}}function id(n,e,t){const i=n.slice();return i[9]=e[t],i[10]=e,i[11]=t,i}function sd(n,e){let t,i,s,l;function o(u){e[5](u,e[9],e[10],e[11])}function r(){return e[6](e[11])}let a={key:e[11],excludeNames:e[1].concat(e[4](e[9]))};return e[9]!==void 0&&(a.field=e[9]),i=new Y3({props:a}),me.push(()=>Re(i,"field",o)),i.$on("remove",r),{key:n,first:null,c(){t=Ue(),q(i.$$.fragment),this.first=t},m(u,f){w(u,t,f),H(i,u,f),l=!0},p(u,f){e=u;const c={};f&1&&(c.key=e[11]),f&1&&(c.excludeNames=e[1].concat(e[4](e[9]))),!s&&f&1&&(s=!0,c.field=e[9],He(()=>s=!1)),i.$set(c)},i(u){l||(A(i.$$.fragment,u),l=!0)},o(u){L(i.$$.fragment,u),l=!1},d(u){u&&k(t),j(i,u)}}}function K3(n){let e,t=[],i=new Map,s,l,o,r,a,u,f,c,d,h,g,v=n[0].schema;const b=y=>y[11];for(let y=0;yh.name===d)}function u(d){let h=[];if(d.toDelete)return h;for(let g of s.schema)g===d||g.toDelete||h.push(g.name);return h}function f(d,h,g,v){g[v]=d,t(0,s)}const c=d=>l(d);return n.$$set=d=>{"collection"in d&&t(0,s=d.collection)},n.$$.update=()=>{n.$$.dirty&1&&typeof(s==null?void 0:s.schema)>"u"&&(t(0,s=s||{}),t(0,s.schema=[],s))},[s,i,l,o,u,f,c]}class Z3 extends Ee{constructor(e){super(),Oe(this,e,J3,K3,De,{collection:0})}}function ld(n,e,t){const i=n.slice();return i[13]=e[t][0],i[14]=e[t][1],i[15]=e,i[16]=t,i}function od(n,e,t){const i=n.slice();return i[18]=e[t],i}function rd(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g,v,b,y,$,C,S,T,M,O,E,P,I,F,V,X,te,Z=n[0].schema,ee=[];for(let U=0;U@request filter:",y=D(),$=_("div"),$.innerHTML=`@request.method - @request.query.* - @request.data.* - @request.user.*`,C=D(),S=_("hr"),T=D(),M=_("p"),M.innerHTML="You could also add constraints and query other collections using the @collection filter:",O=D(),E=_("div"),E.innerHTML="@collection.ANY_COLLECTION_NAME.*",P=D(),I=_("hr"),F=D(),V=_("p"),V.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(g,"class","m-t-10 m-b-5"),p(b,"class","m-b-0"),p($,"class","inline-flex flex-gap-5"),p(S,"class","m-t-10 m-b-5"),p(M,"class","m-b-0"),p(E,"class","inline-flex flex-gap-5"),p(I,"class","m-t-10 m-b-5"),p(i,"class","content"),p(t,"class","alert alert-warning m-0")},m(U,Y){w(U,e,Y),m(e,t),m(t,i),m(i,s),m(i,l),m(i,o),m(o,r),m(o,a),m(o,u),m(o,f),m(o,c),m(o,d);for(let G=0;G{X||(X=nt(e,on,{duration:150},!0)),X.run(1)}),te=!0)},o(U){U&&(X||(X=nt(e,on,{duration:150},!1)),X.run(0)),te=!1},d(U){U&&k(e),nn(ee,U),U&&X&&X.end()}}}function G3(n){let e,t=n[18].name+"",i;return{c(){e=_("code"),i=N(t)},m(s,l){w(s,e,l),m(e,i)},p(s,l){l&1&&t!==(t=s[18].name+"")&&ue(i,t)},d(s){s&&k(e)}}}function X3(n){let e,t=n[18].name+"",i,s;return{c(){e=_("code"),i=N(t),s=N(".*")},m(l,o){w(l,e,o),m(e,i),m(e,s)},p(l,o){o&1&&t!==(t=l[18].name+"")&&ue(i,t)},d(l){l&&k(e)}}}function ad(n){let e;function t(l,o){return l[18].type==="relation"||l[18].type==="user"?X3:G3}let i=t(n),s=i(n);return{c(){s.c(),e=Ue()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function Q3(n){let e=[],t=new Map,i,s,l=Object.entries(n[6]);const o=r=>r[13];for(let r=0;r',p(e,"class","txt-center")},m(t,i){w(t,e,i)},p:se,i:se,o:se,d(t){t&&k(e)}}}function eC(n){let e,t,i;function s(){return n[9](n[13])}return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","rule-toggle-btn btn btn-circle btn-outline svelte-fjxz7k")},m(l,o){w(l,e,o),t||(i=[We(yt.call(null,e,"Lock and set to Admins only")),J(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,Ye(i)}}}function tC(n){let e,t,i;function s(){return n[8](n[13])}return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","rule-toggle-btn btn btn-circle btn-outline btn-success svelte-fjxz7k")},m(l,o){w(l,e,o),t||(i=[We(yt.call(null,e,"Unlock and set custom rule")),J(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,Ye(i)}}}function nC(n){let e;return{c(){e=N("Leave empty to grant everyone access")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function iC(n){let e;return{c(){e=N("Only admins will be able to access (unlock to change)")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function sC(n){let e,t=n[14]+"",i,s,l=Ii(n[0][n[13]])?"Admins only":"Custom rule",o,r,a,u,f=n[13],c,d,h,g,v;const b=()=>n[10](u,f),y=()=>n[10](null,f);function $(E){n[11](E,n[13])}var C=n[4];function S(E){let P={id:E[17],baseCollection:E[0],disabled:Ii(E[0][E[13]])};return E[0][E[13]]!==void 0&&(P.value=E[0][E[13]]),{props:P}}C&&(u=new C(S(n)),b(),me.push(()=>Re(u,"value",$)));function T(E,P){return P&1&&(g=null),g==null&&(g=!!Ii(E[0][E[13]])),g?iC:nC}let M=T(n,-1),O=M(n);return{c(){e=_("label"),i=N(t),s=N(" - "),o=N(l),a=D(),u&&q(u.$$.fragment),d=D(),h=_("div"),O.c(),p(e,"for",r=n[17]),p(h,"class","help-block")},m(E,P){w(E,e,P),m(e,i),m(e,s),m(e,o),w(E,a,P),u&&H(u,E,P),w(E,d,P),w(E,h,P),O.m(h,null),v=!0},p(E,P){n=E,(!v||P&1)&&l!==(l=Ii(n[0][n[13]])?"Admins only":"Custom rule")&&ue(o,l),(!v||P&131072&&r!==(r=n[17]))&&p(e,"for",r),f!==n[13]&&(y(),f=n[13],b());const I={};if(P&131072&&(I.id=n[17]),P&1&&(I.baseCollection=n[0]),P&1&&(I.disabled=Ii(n[0][n[13]])),!c&&P&65&&(c=!0,I.value=n[0][n[13]],He(()=>c=!1)),C!==(C=n[4])){if(u){Ae();const F=u;L(F.$$.fragment,1,0,()=>{j(F,1)}),Pe()}C?(u=new C(S(n)),b(),me.push(()=>Re(u,"value",$)),q(u.$$.fragment),A(u.$$.fragment,1),H(u,d.parentNode,d)):u=null}else C&&u.$set(I);M!==(M=T(n,P))&&(O.d(1),O=M(n),O&&(O.c(),O.m(h,null)))},i(E){v||(u&&A(u.$$.fragment,E),v=!0)},o(E){u&&L(u.$$.fragment,E),v=!1},d(E){E&&k(e),E&&k(a),y(),u&&j(u,E),E&&k(d),E&&k(h),O.d()}}}function ud(n,e){let t,i,s,l,o,r,a,u;function f(h,g){return g&1&&(l=null),l==null&&(l=!!Ii(h[0][h[13]])),l?tC:eC}let c=f(e,-1),d=c(e);return r=new Ne({props:{class:"form-field rule-field m-0 "+(Ii(e[0][e[13]])?"disabled":""),name:e[13],$$slots:{default:[sC,({uniqueId:h})=>({17:h}),({uniqueId:h})=>h?131072:0]},$$scope:{ctx:e}}}),{key:n,first:null,c(){t=_("hr"),i=D(),s=_("div"),d.c(),o=D(),q(r.$$.fragment),a=D(),p(t,"class","m-t-sm m-b-sm"),p(s,"class","rule-block svelte-fjxz7k"),this.first=t},m(h,g){w(h,t,g),w(h,i,g),w(h,s,g),d.m(s,null),m(s,o),H(r,s,null),m(s,a),u=!0},p(h,g){e=h,c===(c=f(e,g))&&d?d.p(e,g):(d.d(1),d=c(e),d&&(d.c(),d.m(s,o)));const v={};g&1&&(v.class="form-field rule-field m-0 "+(Ii(e[0][e[13]])?"disabled":"")),g&2228249&&(v.$$scope={dirty:g,ctx:e}),r.$set(v)},i(h){u||(A(r.$$.fragment,h),u=!0)},o(h){L(r.$$.fragment,h),u=!1},d(h){h&&k(t),h&&k(i),h&&k(s),d.d(),j(r)}}}function lC(n){let e,t,i,s,l,o=n[2]?"Hide available fields":"Show available fields",r,a,u,f,c,d,h,g,v,b=n[2]&&rd(n);const y=[x3,Q3],$=[];function C(S,T){return S[5]?0:1}return f=C(n),c=$[f]=y[f](n),{c(){e=_("div"),t=_("div"),i=_("p"),i.innerHTML=`All rules follow the -
    PocketBase filter syntax and operators - .`,s=D(),l=_("span"),r=N(o),a=D(),b&&b.c(),u=D(),c.c(),d=Ue(),p(l,"class","expand-handle txt-sm txt-bold txt-nowrap link-hint"),p(t,"class","flex"),p(e,"class","block m-b-base")},m(S,T){w(S,e,T),m(e,t),m(t,i),m(t,s),m(t,l),m(l,r),m(e,a),b&&b.m(e,null),w(S,u,T),$[f].m(S,T),w(S,d,T),h=!0,g||(v=J(l,"click",n[7]),g=!0)},p(S,[T]){(!h||T&4)&&o!==(o=S[2]?"Hide available fields":"Show available fields")&&ue(r,o),S[2]?b?(b.p(S,T),T&4&&A(b,1)):(b=rd(S),b.c(),A(b,1),b.m(e,null)):b&&(Ae(),L(b,1,1,()=>{b=null}),Pe());let M=f;f=C(S),f===M?$[f].p(S,T):(Ae(),L($[M],1,1,()=>{$[M]=null}),Pe(),c=$[f],c?c.p(S,T):(c=$[f]=y[f](S),c.c()),A(c,1),c.m(d.parentNode,d))},i(S){h||(A(b),A(c),h=!0)},o(S){L(b),L(c),h=!1},d(S){S&&k(e),b&&b.d(),S&&k(u),$[f].d(S),S&&k(d),g=!1,v()}}}function Ii(n){return n===null}function oC(n,e,t){let{collection:i=new dn}=e,s={},l=!1,o={},r,a=!1;const u={listRule:"List Action",viewRule:"View Action",createRule:"Create Action",updateRule:"Update Action",deleteRule:"Delete Action"};async function f(){t(5,a=!0);try{t(4,r=(await Pi(()=>import("./FilterAutocompleteInput.37739e76.js"),["FilterAutocompleteInput.37739e76.js","index.a9121ab1.js"],import.meta.url)).default)}catch(b){console.warn(b),t(4,r=null)}t(5,a=!1)}Nn(()=>{f()});const c=()=>t(2,l=!l),d=async b=>{var y;t(0,i[b]=s[b]||"",i),await Zn(),(y=o[b])==null||y.focus()},h=b=>{t(1,s[b]=i[b],s),t(0,i[b]=null,i)};function g(b,y){me[b?"unshift":"push"](()=>{o[y]=b,t(3,o)})}function v(b,y){n.$$.not_equal(i[y],b)&&(i[y]=b,t(0,i))}return n.$$set=b=>{"collection"in b&&t(0,i=b.collection)},[i,s,l,o,r,a,u,c,d,h,g,v]}class rC extends Ee{constructor(e){super(),Oe(this,e,oC,lC,De,{collection:0})}}function fd(n,e,t){const i=n.slice();return i[14]=e[t],i}function cd(n,e,t){const i=n.slice();return i[14]=e[t],i}function dd(n){let e;return{c(){e=_("p"),e.textContent="All data associated with the removed fields will be permanently deleted!"},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function pd(n){let e,t,i,s,l=n[1].originalName+"",o,r,a,u,f,c=n[1].name+"",d;return{c(){e=_("li"),t=_("div"),i=N(`Renamed collection - `),s=_("strong"),o=N(l),r=D(),a=_("i"),u=D(),f=_("strong"),d=N(c),p(s,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(f,"class","txt"),p(t,"class","inline-flex")},m(h,g){w(h,e,g),m(e,t),m(t,i),m(t,s),m(s,o),m(t,r),m(t,a),m(t,u),m(t,f),m(f,d)},p(h,g){g&2&&l!==(l=h[1].originalName+"")&&ue(o,l),g&2&&c!==(c=h[1].name+"")&&ue(d,c)},d(h){h&&k(e)}}}function hd(n){let e,t,i,s,l=n[14].originalName+"",o,r,a,u,f,c=n[14].name+"",d;return{c(){e=_("li"),t=_("div"),i=N(`Renamed field - `),s=_("strong"),o=N(l),r=D(),a=_("i"),u=D(),f=_("strong"),d=N(c),p(s,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(f,"class","txt"),p(t,"class","inline-flex")},m(h,g){w(h,e,g),m(e,t),m(t,i),m(t,s),m(s,o),m(t,r),m(t,a),m(t,u),m(t,f),m(f,d)},p(h,g){g&16&&l!==(l=h[14].originalName+"")&&ue(o,l),g&16&&c!==(c=h[14].name+"")&&ue(d,c)},d(h){h&&k(e)}}}function md(n){let e,t,i,s=n[14].name+"",l,o;return{c(){e=_("li"),t=N("Removed field "),i=_("span"),l=N(s),o=D(),p(i,"class","txt-bold"),p(e,"class","txt-danger")},m(r,a){w(r,e,a),m(e,t),m(e,i),m(i,l),m(e,o)},p(r,a){a&8&&s!==(s=r[14].name+"")&&ue(l,s)},d(r){r&&k(e)}}}function aC(n){let e,t,i,s,l,o,r,a,u,f,c,d,h=n[3].length&&dd(),g=n[5]&&pd(n),v=n[4],b=[];for(let C=0;C',i=D(),s=_("div"),l=_("p"),l.textContent=`If any of the following changes is part of another collection rule or filter, you'll have to - update it manually!`,o=D(),h&&h.c(),r=D(),a=_("h6"),a.textContent="Changes:",u=D(),f=_("ul"),g&&g.c(),c=D();for(let C=0;CCancel',t=D(),i=_("button"),i.innerHTML='Confirm',e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-secondary"),p(i,"type","button"),p(i,"class","btn btn-expanded")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),e.focus(),s||(l=[J(e,"click",n[8]),J(i,"click",n[9])],s=!0)},p:se,d(o){o&&k(e),o&&k(t),o&&k(i),s=!1,Ye(l)}}}function cC(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[fC],header:[uC],default:[aC]},$$scope:{ctx:n}};return e=new ui({props:i}),n[10](e),e.$on("hide",n[11]),e.$on("show",n[12]),{c(){q(e.$$.fragment)},m(s,l){H(e,s,l),t=!0},p(s,[l]){const o={};l&524346&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){L(e.$$.fragment,s),t=!1},d(s){n[10](null),j(e,s)}}}function dC(n,e,t){let i,s,l;const o=Qt();let r,a;async function u(y){t(1,a=y),await Zn(),!i&&!s.length&&!l.length?c():r==null||r.show()}function f(){r==null||r.hide()}function c(){f(),o("confirm")}const d=()=>f(),h=()=>c();function g(y){me[y?"unshift":"push"](()=>{r=y,t(2,r)})}function v(y){xe.call(this,n,y)}function b(y){xe.call(this,n,y)}return n.$$.update=()=>{n.$$.dirty&2&&t(5,i=(a==null?void 0:a.originalName)!=(a==null?void 0:a.name)),n.$$.dirty&2&&t(4,s=(a==null?void 0:a.schema.filter(y=>y.id&&!y.toDelete&&y.originalName!=y.name))||[]),n.$$.dirty&2&&t(3,l=(a==null?void 0:a.schema.filter(y=>y.id&&y.toDelete))||[])},[f,a,r,l,s,i,c,u,d,h,g,v,b]}class pC extends Ee{constructor(e){super(),Oe(this,e,dC,cC,De,{show:7,hide:0})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}}function gd(n){let e,t,i,s;function l(r){n[26](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new rC({props:o}),me.push(()=>Re(t,"collection",l)),{c(){e=_("div"),q(t.$$.fragment),p(e,"class","tab-item active")},m(r,a){w(r,e,a),H(t,e,null),s=!0},p(r,a){const u={};!i&&a[0]&4&&(i=!0,u.collection=r[2],He(()=>i=!1)),t.$set(u)},i(r){s||(A(t.$$.fragment,r),s=!0)},o(r){L(t.$$.fragment,r),s=!1},d(r){r&&k(e),j(t)}}}function hC(n){let e,t,i,s,l,o;function r(f){n[25](f)}let a={};n[2]!==void 0&&(a.collection=n[2]),i=new Z3({props:a}),me.push(()=>Re(i,"collection",r));let u=n[9]===wl&&gd(n);return{c(){e=_("div"),t=_("div"),q(i.$$.fragment),l=D(),u&&u.c(),p(t,"class","tab-item"),ne(t,"active",n[9]===rs),p(e,"class","tabs-content svelte-b10vi")},m(f,c){w(f,e,c),m(e,t),H(i,t,null),m(e,l),u&&u.m(e,null),o=!0},p(f,c){const d={};!s&&c[0]&4&&(s=!0,d.collection=f[2],He(()=>s=!1)),i.$set(d),(!o||c[0]&512)&&ne(t,"active",f[9]===rs),f[9]===wl?u?(u.p(f,c),c[0]&512&&A(u,1)):(u=gd(f),u.c(),A(u,1),u.m(e,null)):u&&(Ae(),L(u,1,1,()=>{u=null}),Pe())},i(f){o||(A(i.$$.fragment,f),A(u),o=!0)},o(f){L(i.$$.fragment,f),L(u),o=!1},d(f){f&&k(e),j(i),u&&u.d()}}}function _d(n){let e,t,i,s,l,o,r;return o=new Ti({props:{class:"dropdown dropdown-right m-t-5",$$slots:{default:[mC]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=D(),i=_("button"),s=_("i"),l=D(),q(o.$$.fragment),p(e,"class","flex-fill"),p(s,"class","ri-more-line"),p(i,"type","button"),p(i,"class","btn btn-sm btn-circle btn-secondary flex-gap-0")},m(a,u){w(a,e,u),w(a,t,u),w(a,i,u),m(i,s),m(i,l),H(o,i,null),r=!0},p(a,u){const f={};u[1]&256&&(f.$$scope={dirty:u,ctx:a}),o.$set(f)},i(a){r||(A(o.$$.fragment,a),r=!0)},o(a){L(o.$$.fragment,a),r=!1},d(a){a&&k(e),a&&k(t),a&&k(i),j(o)}}}function mC(n){let e,t,i;return{c(){e=_("button"),e.innerHTML=` - Delete`,p(e,"type","button"),p(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=J(e,"click",n[20]),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function bd(n){let e;return{c(){e=_("div"),e.textContent="System collection",p(e,"class","help-block")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function gC(n){let e,t,i,s,l,o,r,a,u,f,c,d,h=n[2].system&&bd();return{c(){e=_("label"),t=N("Name"),s=D(),l=_("input"),u=D(),h&&h.c(),f=Ue(),p(e,"for",i=n[38]),p(l,"type","text"),p(l,"id",o=n[38]),l.required=!0,l.disabled=n[11],p(l,"spellcheck","false"),l.autofocus=r=n[2].isNew,p(l,"placeholder",'eg. "posts"'),l.value=a=n[2].name},m(g,v){w(g,e,v),m(e,t),w(g,s,v),w(g,l,v),w(g,u,v),h&&h.m(g,v),w(g,f,v),n[2].isNew&&l.focus(),c||(d=J(l,"input",n[21]),c=!0)},p(g,v){v[1]&128&&i!==(i=g[38])&&p(e,"for",i),v[1]&128&&o!==(o=g[38])&&p(l,"id",o),v[0]&2048&&(l.disabled=g[11]),v[0]&4&&r!==(r=g[2].isNew)&&(l.autofocus=r),v[0]&4&&a!==(a=g[2].name)&&l.value!==a&&(l.value=a),g[2].system?h||(h=bd(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},d(g){g&&k(e),g&&k(s),g&&k(l),g&&k(u),h&&h.d(g),g&&k(f),c=!1,d()}}}function vd(n){let e,t,i,s,l,o;return{c(){e=_("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(r,a){w(r,e,a),s=!0,l||(o=We(t=yt.call(null,e,n[12])),l=!0)},p(r,a){t&&Jn(t.update)&&a[0]&4096&&t.update.call(null,r[12])},i(r){s||(r&&Tt(()=>{i||(i=nt(e,Tn,{duration:150,start:.7},!0)),i.run(1)}),s=!0)},o(r){r&&(i||(i=nt(e,Tn,{duration:150,start:.7},!1)),i.run(0)),s=!1},d(r){r&&k(e),r&&i&&i.end(),l=!1,o()}}}function yd(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=We(yt.call(null,e,"Has errors")),s=!0)},i(o){i||(o&&Tt(()=>{t||(t=nt(e,Tn,{duration:150,start:.7},!0)),t.run(1)}),i=!0)},o(o){o&&(t||(t=nt(e,Tn,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&k(e),o&&t&&t.end(),s=!1,l()}}}function _C(n){var F,V,X,te,Z,ee;let e,t=n[2].isNew?"New collection":"Edit collection",i,s,l,o,r,a,u,f,c,d,h,g,v=!B.isEmpty((F=n[4])==null?void 0:F.schema),b,y,$,C,S=!B.isEmpty((V=n[4])==null?void 0:V.listRule)||!B.isEmpty((X=n[4])==null?void 0:X.viewRule)||!B.isEmpty((te=n[4])==null?void 0:te.createRule)||!B.isEmpty((Z=n[4])==null?void 0:Z.updateRule)||!B.isEmpty((ee=n[4])==null?void 0:ee.deleteRule),T,M,O,E=!n[2].isNew&&!n[2].system&&_d(n);r=new Ne({props:{class:"form-field required m-b-0 "+(n[11]?"disabled":""),name:"name",$$slots:{default:[gC,({uniqueId:U})=>({38:U}),({uniqueId:U})=>[0,U?128:0]]},$$scope:{ctx:n}}});let P=v&&vd(n),I=S&&yd();return{c(){e=_("h4"),i=N(t),s=D(),E&&E.c(),l=D(),o=_("form"),q(r.$$.fragment),a=D(),u=_("input"),f=D(),c=_("div"),d=_("button"),h=_("span"),h.textContent="Fields",g=D(),P&&P.c(),b=D(),y=_("button"),$=_("span"),$.textContent="API Rules",C=D(),I&&I.c(),p(u,"type","submit"),p(u,"class","hidden"),p(u,"tabindex","-1"),p(o,"class","block"),p(h,"class","txt"),p(d,"type","button"),p(d,"class","tab-item"),ne(d,"active",n[9]===rs),p($,"class","txt"),p(y,"type","button"),p(y,"class","tab-item"),ne(y,"active",n[9]===wl),p(c,"class","tabs-header stretched")},m(U,Y){w(U,e,Y),m(e,i),w(U,s,Y),E&&E.m(U,Y),w(U,l,Y),w(U,o,Y),H(r,o,null),m(o,a),m(o,u),w(U,f,Y),w(U,c,Y),m(c,d),m(d,h),m(d,g),P&&P.m(d,null),m(c,b),m(c,y),m(y,$),m(y,C),I&&I.m(y,null),T=!0,M||(O=[J(o,"submit",Yt(n[22])),J(d,"click",n[23]),J(y,"click",n[24])],M=!0)},p(U,Y){var de,x,ve,_e,ge,K;(!T||Y[0]&4)&&t!==(t=U[2].isNew?"New collection":"Edit collection")&&ue(i,t),!U[2].isNew&&!U[2].system?E?(E.p(U,Y),Y[0]&4&&A(E,1)):(E=_d(U),E.c(),A(E,1),E.m(l.parentNode,l)):E&&(Ae(),L(E,1,1,()=>{E=null}),Pe());const G={};Y[0]&2048&&(G.class="form-field required m-b-0 "+(U[11]?"disabled":"")),Y[0]&2052|Y[1]&384&&(G.$$scope={dirty:Y,ctx:U}),r.$set(G),Y[0]&16&&(v=!B.isEmpty((de=U[4])==null?void 0:de.schema)),v?P?(P.p(U,Y),Y[0]&16&&A(P,1)):(P=vd(U),P.c(),A(P,1),P.m(d,null)):P&&(Ae(),L(P,1,1,()=>{P=null}),Pe()),(!T||Y[0]&512)&&ne(d,"active",U[9]===rs),Y[0]&16&&(S=!B.isEmpty((x=U[4])==null?void 0:x.listRule)||!B.isEmpty((ve=U[4])==null?void 0:ve.viewRule)||!B.isEmpty((_e=U[4])==null?void 0:_e.createRule)||!B.isEmpty((ge=U[4])==null?void 0:ge.updateRule)||!B.isEmpty((K=U[4])==null?void 0:K.deleteRule)),S?I?Y[0]&16&&A(I,1):(I=yd(),I.c(),A(I,1),I.m(y,null)):I&&(Ae(),L(I,1,1,()=>{I=null}),Pe()),(!T||Y[0]&512)&&ne(y,"active",U[9]===wl)},i(U){T||(A(E),A(r.$$.fragment,U),A(P),A(I),T=!0)},o(U){L(E),L(r.$$.fragment,U),L(P),L(I),T=!1},d(U){U&&k(e),U&&k(s),E&&E.d(U),U&&k(l),U&&k(o),j(r),U&&k(f),U&&k(c),P&&P.d(),I&&I.d(),M=!1,Ye(O)}}}function bC(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=D(),s=_("button"),l=_("span"),r=N(o),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[7],p(l,"class","txt"),p(s,"type","button"),p(s,"class","btn btn-expanded"),s.disabled=a=!n[10]||n[7],ne(s,"btn-loading",n[7])},m(c,d){w(c,e,d),m(e,t),w(c,i,d),w(c,s,d),m(s,l),m(l,r),u||(f=[J(e,"click",n[18]),J(s,"click",n[19])],u=!0)},p(c,d){d[0]&128&&(e.disabled=c[7]),d[0]&4&&o!==(o=c[2].isNew?"Create":"Save changes")&&ue(r,o),d[0]&1152&&a!==(a=!c[10]||c[7])&&(s.disabled=a),d[0]&128&&ne(s,"btn-loading",c[7])},d(c){c&&k(e),c&&k(i),c&&k(s),u=!1,Ye(f)}}}function vC(n){let e,t,i,s,l={class:"overlay-panel-lg colored-header compact-header collection-panel",beforeHide:n[27],$$slots:{footer:[bC],header:[_C],default:[hC]},$$scope:{ctx:n}};e=new ui({props:l}),n[28](e),e.$on("hide",n[29]),e.$on("show",n[30]);let o={};return i=new pC({props:o}),n[31](i),i.$on("confirm",n[32]),{c(){q(e.$$.fragment),t=D(),q(i.$$.fragment)},m(r,a){H(e,r,a),w(r,t,a),H(i,r,a),s=!0},p(r,a){const u={};a[0]&264&&(u.beforeHide=r[27]),a[0]&7828|a[1]&256&&(u.$$scope={dirty:a,ctx:r}),e.$set(u);const f={};i.$set(f)},i(r){s||(A(e.$$.fragment,r),A(i.$$.fragment,r),s=!0)},o(r){L(e.$$.fragment,r),L(i.$$.fragment,r),s=!1},d(r){n[28](null),j(e,r),r&&k(t),n[31](null),j(i,r)}}}const rs="fields",wl="api_rules";function Ir(n){return JSON.stringify(n)}function yC(n,e,t){let i,s,l,o,r,a;rt(n,hi,K=>t(34,r=K)),rt(n,Vi,K=>t(4,a=K));const u=Qt();let f,c,d=null,h=new dn,g=!1,v=!1,b=rs,y=Ir(h);function $(K){t(9,b=K)}function C(K){return T(K),t(8,v=!0),$(rs),f==null?void 0:f.show()}function S(){return f==null?void 0:f.hide()}async function T(K){ri({}),typeof K<"u"?(d=K,t(2,h=K==null?void 0:K.clone())):(d=null,t(2,h=new dn)),t(2,h.schema=h.schema||[],h),t(2,h.originalName=h.name||"",h),await Zn(),t(17,y=Ir(h))}function M(){if(h.isNew)return O();c==null||c.show(h)}function O(){if(g)return;t(7,g=!0);const K=E();let ye;h.isNew?ye=we.collections.create(K):ye=we.collections.update(h.id,K),ye.then(oe=>{t(8,v=!1),S(),sn(h.isNew?"Successfully created collection.":"Successfully updated collection."),B$(oe),h.isNew&&tn(hi,r=oe,r),u("save",oe)}).catch(oe=>{we.errorResponseHandler(oe)}).finally(()=>{t(7,g=!1)})}function E(){const K=h.export();K.schema=K.schema.slice(0);for(let ye=K.schema.length-1;ye>=0;ye--)K.schema[ye].toDelete&&K.schema.splice(ye,1);return K}function P(){!(d!=null&&d.id)||si(`Do you really want to delete collection "${d==null?void 0:d.name}" and all its records?`,()=>we.collections.delete(d==null?void 0:d.id).then(()=>{S(),sn(`Successfully deleted collection "${d==null?void 0:d.name}".`),u("delete",d),U$(d)}).catch(K=>{we.errorResponseHandler(K)}))}const I=()=>S(),F=()=>M(),V=()=>P(),X=K=>{t(2,h.name=B.slugify(K.target.value),h),K.target.value=h.name},te=()=>{o&&M()},Z=()=>$(rs),ee=()=>$(wl);function U(K){h=K,t(2,h)}function Y(K){h=K,t(2,h)}const G=()=>l&&v?(si("You have unsaved changes. Do you really want to close the panel?",()=>{t(8,v=!1),S()}),!1):!0;function de(K){me[K?"unshift":"push"](()=>{f=K,t(5,f)})}function x(K){xe.call(this,n,K)}function ve(K){xe.call(this,n,K)}function _e(K){me[K?"unshift":"push"](()=>{c=K,t(6,c)})}const ge=()=>O();return n.$$.update=()=>{n.$$.dirty[0]&16&&t(12,i=typeof B.getNestedVal(a,"schema.message",null)=="string"?B.getNestedVal(a,"schema.message"):"Has errors"),n.$$.dirty[0]&4&&t(11,s=!h.isNew&&h.system),n.$$.dirty[0]&131076&&t(3,l=y!=Ir(h)),n.$$.dirty[0]&12&&t(10,o=h.isNew||l)},[$,S,h,l,a,f,c,g,v,b,o,s,i,M,O,P,C,y,I,F,V,X,te,Z,ee,U,Y,G,de,x,ve,_e,ge]}class nu extends Ee{constructor(e){super(),Oe(this,e,yC,vC,De,{changeTab:0,show:16,hide:1},null,[-1,-1])}get changeTab(){return this.$$.ctx[0]}get show(){return this.$$.ctx[16]}get hide(){return this.$$.ctx[1]}}function kd(n,e,t){const i=n.slice();return i[14]=e[t],i}function wd(n){let e,t=n[1].length&&$d();return{c(){t&&t.c(),e=Ue()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[1].length?t||(t=$d(),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function $d(n){let e;return{c(){e=_("p"),e.textContent="No collections found.",p(e,"class","txt-hint m-t-10 m-b-10 txt-center")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function kC(n){let e;return{c(){e=_("i"),p(e,"class","ri-folder-2-line")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function wC(n){let e;return{c(){e=_("i"),p(e,"class","ri-folder-open-line")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function Sd(n,e){let t,i,s,l=e[14].name+"",o,r,a,u;function f(g,v){var b;return((b=g[5])==null?void 0:b.id)===g[14].id?wC:kC}let c=f(e),d=c(e);function h(){return e[11](e[14])}return{key:n,first:null,c(){var g;t=_("div"),d.c(),i=D(),s=_("span"),o=N(l),r=D(),p(s,"class","txt"),p(t,"tabindex","0"),p(t,"class","sidebar-list-item"),ne(t,"active",((g=e[5])==null?void 0:g.id)===e[14].id),this.first=t},m(g,v){w(g,t,v),d.m(t,null),m(t,i),m(t,s),m(s,o),m(t,r),a||(u=J(t,"click",h),a=!0)},p(g,v){var b;e=g,c!==(c=f(e))&&(d.d(1),d=c(e),d&&(d.c(),d.m(t,i))),v&8&&l!==(l=e[14].name+"")&&ue(o,l),v&40&&ne(t,"active",((b=e[5])==null?void 0:b.id)===e[14].id)},d(g){g&&k(t),d.d(),a=!1,u()}}}function Cd(n){let e,t,i,s;return{c(){e=_("footer"),t=_("button"),t.innerHTML=` - New collection`,p(t,"type","button"),p(t,"class","btn btn-block btn-outline"),p(e,"class","sidebar-footer")},m(l,o){w(l,e,o),m(e,t),i||(s=J(t,"click",n[12]),i=!0)},p:se,d(l){l&&k(e),i=!1,s()}}}function $C(n){let e,t,i,s,l,o,r,a,u,f,c,d=[],h=new Map,g,v,b,y,$,C,S=n[3];const T=P=>P[14].id;for(let P=0;P',o=D(),r=_("input"),a=D(),u=_("hr"),f=D(),c=_("div");for(let P=0;Pt(5,o=y)),rt(n,Ps,y=>t(8,r=y)),rt(n,us,y=>t(6,a=y));let u,f="";function c(y){tn(hi,o=y,o)}const d=()=>t(0,f="");function h(){f=this.value,t(0,f)}const g=y=>c(y),v=()=>u==null?void 0:u.show();function b(y){me[y?"unshift":"push"](()=>{u=y,t(2,u)})}return n.$$.update=()=>{n.$$.dirty&1&&t(1,i=f.replace(/\s+/g,"").toLowerCase()),n.$$.dirty&1&&t(4,s=f!==""),n.$$.dirty&259&&t(3,l=r.filter(y=>y.name!="profiles"&&(y.id==f||y.name.replace(/\s+/g,"").toLowerCase().includes(i))))},[f,i,u,l,s,o,a,c,r,d,h,g,v,b]}class CC extends Ee{constructor(e){super(),Oe(this,e,SC,$C,De,{})}}function MC(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g,v,b,y,$,C,S,T,M,O,E,P,I,F,V,X,te,Z,ee,U,Y,G,de,x,ve,_e,ge,K,ye,oe,W,ce,ae,Se,Q,$e,Be,Xe,ut;return{c(){e=_("p"),e.innerHTML=`The syntax basically follows the format - OPERAND - OPERATOR - OPERAND, where:`,t=D(),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=D(),o=_("li"),r=_("code"),r.textContent="OPERATOR",a=N(` - is one of: - `),u=_("br"),f=D(),c=_("ul"),d=_("li"),h=_("code"),h.textContent="=",g=D(),v=_("span"),v.textContent="Equal",b=D(),y=_("li"),$=_("code"),$.textContent="!=",C=D(),S=_("span"),S.textContent="NOT equal",T=D(),M=_("li"),O=_("code"),O.textContent=">",E=D(),P=_("span"),P.textContent="Greater than",I=D(),F=_("li"),V=_("code"),V.textContent=">=",X=D(),te=_("span"),te.textContent="Greater than or equal",Z=D(),ee=_("li"),U=_("code"),U.textContent="<",Y=D(),G=_("span"),G.textContent="Less than or equal",de=D(),x=_("li"),ve=_("code"),ve.textContent="<=",_e=D(),ge=_("span"),ge.textContent="Less than or equal",K=D(),ye=_("li"),oe=_("code"),oe.textContent="~",W=D(),ce=_("span"),ce.textContent=`Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for wildcard - match)`,ae=D(),Se=_("li"),Q=_("code"),Q.textContent="!~",$e=D(),Be=_("span"),Be.textContent=`NOT Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for - wildcard match)`,Xe=D(),ut=_("p"),ut.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($,"class","filter-op svelte-1w7s5nw"),p(S,"class","txt-hint"),p(O,"class","filter-op svelte-1w7s5nw"),p(P,"class","txt-hint"),p(V,"class","filter-op svelte-1w7s5nw"),p(te,"class","txt-hint"),p(U,"class","filter-op svelte-1w7s5nw"),p(G,"class","txt-hint"),p(ve,"class","filter-op svelte-1w7s5nw"),p(ge,"class","txt-hint"),p(oe,"class","filter-op svelte-1w7s5nw"),p(ce,"class","txt-hint"),p(Q,"class","filter-op svelte-1w7s5nw"),p(Be,"class","txt-hint")},m(it,Je){w(it,e,Je),w(it,t,Je),w(it,i,Je),m(i,s),m(i,l),m(i,o),m(o,r),m(o,a),m(o,u),m(o,f),m(o,c),m(c,d),m(d,h),m(d,g),m(d,v),m(c,b),m(c,y),m(y,$),m(y,C),m(y,S),m(c,T),m(c,M),m(M,O),m(M,E),m(M,P),m(c,I),m(c,F),m(F,V),m(F,X),m(F,te),m(c,Z),m(c,ee),m(ee,U),m(ee,Y),m(ee,G),m(c,de),m(c,x),m(x,ve),m(x,_e),m(x,ge),m(c,K),m(c,ye),m(ye,oe),m(ye,W),m(ye,ce),m(c,ae),m(c,Se),m(Se,Q),m(Se,$e),m(Se,Be),w(it,Xe,Je),w(it,ut,Je)},p:se,i:se,o:se,d(it){it&&k(e),it&&k(t),it&&k(i),it&&k(Xe),it&&k(ut)}}}class TC extends Ee{constructor(e){super(),Oe(this,e,null,MC,De,{})}}function Md(n,e,t){const i=n.slice();return i[5]=e[t],i}function Td(n,e,t){const i=n.slice();return i[5]=e[t],i}function Dd(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=N(s),o=D(),p(i,"class","txt"),p(t,"class","tab-item svelte-1maocj6"),ne(t,"active",e[0]===e[5].language),this.first=t},m(f,c){w(f,t,c),m(t,i),m(i,l),m(t,o),r||(a=J(t,"click",u),r=!0)},p(f,c){e=f,c&2&&s!==(s=e[5].title+"")&&ue(l,s),c&3&&ne(t,"active",e[0]===e[5].language)},d(f){f&&k(t),r=!1,a()}}}function Od(n,e){let t,i,s,l;return i=new bn({props:{language:e[5].language,content:e[5].content}}),{key:n,first:null,c(){t=_("div"),q(i.$$.fragment),s=D(),p(t,"class","tab-item svelte-1maocj6"),ne(t,"active",e[0]===e[5].language),this.first=t},m(o,r){w(o,t,r),H(i,t,null),m(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),(!l||r&3)&&ne(t,"active",e[0]===e[5].language)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){L(i.$$.fragment,o),l=!1},d(o){o&&k(t),j(i)}}}function DC(n){let e,t,i=[],s=new Map,l,o,r=[],a=new Map,u,f=n[1];const c=g=>g[5].language;for(let g=0;gg[5].language;for(let g=0;gt(0,o=a.language);return n.$$set=a=>{"js"in a&&t(2,s=a.js),"dart"in a&&t(3,l=a.dart)},n.$$.update=()=>{n.$$.dirty&1&&o&&localStorage.setItem(Ed,o),n.$$.dirty&12&&t(1,i=[{title:"JavaScript",language:"javascript",content:s},{title:"Dart",language:"dart",content:l}])},[o,i,s,l,r]}class js extends Ee{constructor(e){super(),Oe(this,e,OC,DC,De,{js:2,dart:3})}}function Ad(n,e,t){const i=n.slice();return i[6]=e[t],i}function Pd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Ld(n){let e;return{c(){e=_("p"),e.innerHTML="Requires 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 Id(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=N(i),l=D(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=J(t,"click",a),o=!0)},p(u,f){e=u,f&20&&ne(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Nd(n,e){let t,i,s,l;return i=new bn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),q(i.$$.fragment),s=D(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),H(i,t,null),m(t,s),l=!0},p(o,r){e=o,(!l||r&20)&&ne(t,"active",e[2]===e[6].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){L(i.$$.fragment,o),l=!1},d(o){o&&k(t),j(i)}}}function EC(n){var gi,Il,ms,Nl;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,g,v,b,y=n[0].name+"",$,C,S,T,M,O,E,P,I,F,V,X,te,Z,ee,U,Y,G,de,x,ve,_e,ge,K,ye,oe,W,ce,ae,Se,Q,$e,Be,Xe,ut,it,Je,et,Te,Ve,Ze,tt,dt,be,Fe,pt,Dt,ht,st,Lt,_t,Ft,Ot,Ke,Ce,ze,lt,ot,Ht,Ct,ft,xt,R,z,ie,re=[],Le=new Map,le,pe,ke=[],fe=new Map,he,Ie=n[1]&&Ld();O=new js({props:{js:` - import PocketBase from 'pocketbase'; - - const client = new PocketBase('${n[3]}'); - - ... - - // fetch a paginated records list - const resultList = await client.records.getList('${(gi=n[0])==null?void 0:gi.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('${(Il=n[0])==null?void 0:Il.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( - '${(ms=n[0])==null?void 0:ms.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('${(Nl=n[0])==null?void 0:Nl.name}', batch: 200, sort: '-created'); - `}}),Q=new bn({props:{content:` - // DESC by created and ASC by id - ?sort=-created,id - `}}),Ve=new bn({props:{content:` - ?filter=(id='abc' && created>'2022-01-01') - `}}),tt=new TC({}),_t=new bn({props:{content:` - ?expand=rel1,rel2.subrel21.subrel22 - `}});let gt=n[4];const un=je=>je[6].code;for(let je=0;jeje[6].code;for(let je=0;jeParam - Type - Description`,X=D(),te=_("tbody"),Z=_("tr"),Z.innerHTML=`page - Number - The page (aka. offset) of the paginated list (default to 1).`,ee=D(),U=_("tr"),U.innerHTML=`perPage - Number - Specify the max returned records per page (default to 30).`,Y=D(),G=_("tr"),de=_("td"),de.textContent="sort",x=D(),ve=_("td"),ve.innerHTML='String',_e=D(),ge=_("td"),K=N("Specify the records order attribute(s). "),ye=_("br"),oe=N(` - Add `),W=_("code"),W.textContent="-",ce=N(" / "),ae=_("code"),ae.textContent="+",Se=N(` (default) in front of the attribute for DESC / ASC order. - Ex.: - `),q(Q.$$.fragment),$e=D(),Be=_("tr"),Xe=_("td"),Xe.textContent="filter",ut=D(),it=_("td"),it.innerHTML='String',Je=D(),et=_("td"),Te=N(`Filter the returned records. Ex.: - `),q(Ve.$$.fragment),Ze=D(),q(tt.$$.fragment),dt=D(),be=_("tr"),Fe=_("td"),Fe.textContent="expand",pt=D(),Dt=_("td"),Dt.innerHTML='String',ht=D(),st=_("td"),Lt=N(`Auto expand record relations. Ex.: - `),q(_t.$$.fragment),Ft=N(` - Supports up to 6-levels depth nested relations expansion. `),Ot=_("br"),Ke=N(` - The expanded relations will be appended to each individual record under the - `),Ce=_("code"),Ce.textContent="@expand",ze=N(" property (eg. "),lt=_("code"),lt.textContent='"@expand": {"rel1": {...}, ...}',ot=N(`). Only the - relations that the user has permissions to `),Ht=_("strong"),Ht.textContent="view",Ct=N(" will be expanded."),ft=D(),xt=_("div"),xt.textContent="Responses",R=D(),z=_("div"),ie=_("div");for(let je=0;je= "2022-01-01 00:00:00"', - }); - - // alternatively you can also fetch all records at once via getFullList: - const records = await client.records.getFullList('${(Rl=je[0])==null?void 0:Rl.name}', 200 /* batch size */, { - sort: '-created', - }); - `),Qe&9&&(Gt.dart=` - import 'package:pocketbase/pocketbase.dart'; - - final client = PocketBase('${je[3]}'); - - ... - - // fetch a paginated records list - final result = await client.records.getList( - '${(Hl=je[0])==null?void 0:Hl.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('${(jl=je[0])==null?void 0:jl.name}', batch: 200, sort: '-created'); - `),O.$set(Gt),Qe&20&&(gt=je[4],re=ct(re,Qe,un,1,je,gt,Le,ie,pn,Id,null,Pd)),Qe&20&&(jt=je[4],Ae(),ke=ct(ke,Qe,Di,1,je,jt,fe,pe,Ut,Nd,null,Ad),Pe())},i(je){if(!he){A(O.$$.fragment,je),A(Q.$$.fragment,je),A(Ve.$$.fragment,je),A(tt.$$.fragment,je),A(_t.$$.fragment,je);for(let Qe=0;Qet(2,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(l==null?void 0:l.listRule)===null),n.$$.dirty&3&&l!=null&&l.id&&(r.push({code:200,body:JSON.stringify({page:1,perPage:30,totalItems:2,items:[B.dummyCollectionRecord(l),B.dummyCollectionRecord(l)]},null,2)}),r.push({code:400,body:` - { - "code": 400, - "message": "Something went wrong while processing your request. Invalid filter.", - "data": {} - } - `}),i&&r.push({code:403,body:` - { - "code": 403, - "message": "Only admins can access this action.", - "data": {} - } - `}),r.push({code:404,body:` - { - "code": 404, - "message": "The requested resource wasn't found.", - "data": {} - } - `}))},t(3,s=B.getApiExampleUrl(we.baseUrl)),[l,i,o,s,r,a]}class PC extends Ee{constructor(e){super(),Oe(this,e,AC,EC,De,{collection:0})}}function Fd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Rd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Hd(n){let e;return{c(){e=_("p"),e.innerHTML="Requires 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 jd(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=N(i),l=D(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=J(t,"click",a),o=!0)},p(u,f){e=u,f&20&&ne(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function qd(n,e){let t,i,s,l;return i=new bn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),q(i.$$.fragment),s=D(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),H(i,t,null),m(t,s),l=!0},p(o,r){e=o,(!l||r&20)&&ne(t,"active",e[2]===e[6].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){L(i.$$.fragment,o),l=!1},d(o){o&&k(t),j(i)}}}function LC(n){var Ot,Ke;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,g,v,b,y,$=n[0].name+"",C,S,T,M,O,E,P,I,F,V,X,te,Z,ee,U,Y,G,de,x,ve,_e,ge,K,ye,oe,W,ce,ae,Se,Q,$e,Be,Xe,ut,it,Je,et,Te,Ve,Ze=[],tt=new Map,dt,be,Fe=[],pt=new Map,Dt,ht=n[1]&&Hd();E=new js({props:{js:` - import PocketBase from 'pocketbase'; - - const client = new PocketBase('${n[3]}'); - - ... - - const record = await client.records.getOne('${(Ot=n[0])==null?void 0:Ot.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', - }); - `}}),oe=new bn({props:{content:` - ?expand=rel1,rel2.subrel21.subrel22 - `}});let st=n[4];const Lt=Ce=>Ce[6].code;for(let Ce=0;CeCe[6].code;for(let Ce=0;Ce<_t.length;Ce+=1){let ze=Fd(n,_t,Ce),lt=Ft(ze);pt.set(lt,Fe[Ce]=qd(lt,ze))}return{c(){e=_("div"),t=_("strong"),t.textContent="GET",i=D(),s=_("div"),l=_("p"),o=N("/api/collections/"),r=_("strong"),u=N(a),f=N("/records/"),c=_("strong"),c.textContent=":id",d=D(),ht&&ht.c(),h=D(),g=_("div"),v=_("p"),b=N("Fetch a single "),y=_("strong"),C=N($),S=N(" record."),T=D(),M=_("div"),M.textContent="Client SDKs example",O=D(),q(E.$$.fragment),P=D(),I=_("div"),I.textContent="Path Parameters",F=D(),V=_("table"),V.innerHTML=`Param - Type - Description - id - String - ID of the record to view.`,X=D(),te=_("div"),te.textContent="Query parameters",Z=D(),ee=_("table"),U=_("thead"),U.innerHTML=`Param - Type - Description`,Y=D(),G=_("tbody"),de=_("tr"),x=_("td"),x.textContent="expand",ve=D(),_e=_("td"),_e.innerHTML='String',ge=D(),K=_("td"),ye=N(`Auto expand record relations. Ex.: - `),q(oe.$$.fragment),W=N(` - Supports up to 6-levels depth nested relations expansion. `),ce=_("br"),ae=N(` - The expanded relations will be appended to the record under the - `),Se=_("code"),Se.textContent="@expand",Q=N(" property (eg. "),$e=_("code"),$e.textContent='"@expand": {"rel1": {...}, ...}',Be=N(`). Only the - relations that the user has permissions to `),Xe=_("strong"),Xe.textContent="view",ut=N(" will be expanded."),it=D(),Je=_("div"),Je.textContent="Responses",et=D(),Te=_("div"),Ve=_("div");for(let Ce=0;Cet(2,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(l==null?void 0:l.viewRule)===null),n.$$.dirty&3&&l!=null&&l.id&&(r.push({code:200,body:JSON.stringify(B.dummyCollectionRecord(l),null,2)}),i&&r.push({code:403,body:` - { - "code": 403, - "message": "Only admins can access this action.", - "data": {} - } - `}),r.push({code:404,body:` - { - "code": 404, - "message": "The requested resource wasn't found.", - "data": {} - } - `}))},t(3,s=B.getApiExampleUrl(we.baseUrl)),[l,i,o,s,r,a]}class NC extends Ee{constructor(e){super(),Oe(this,e,IC,LC,De,{collection:0})}}function Vd(n,e,t){const i=n.slice();return i[6]=e[t],i}function zd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Bd(n,e,t){const i=n.slice();return i[11]=e[t],i}function Ud(n){let e;return{c(){e=_("p"),e.innerHTML="Requires 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 FC(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 RC(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 HC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=N("User "),i=N(t),s=N(".")},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 jC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=N("Relation record "),i=N(t),s=N(".")},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 qC(n){let e,t,i,s,l;return{c(){e=N("File object."),t=_("br"),i=N(` - Set to `),s=_("code"),s.textContent="null",l=N(" 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:se,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function VC(n){let e;return{c(){e=N("URL address.")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function zC(n){let e;return{c(){e=N("Email address.")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function BC(n){let e;return{c(){e=N("JSON array or object.")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function UC(n){let e;return{c(){e=N("Number value.")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function WC(n){let e;return{c(){e=N("Plain text value.")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function Wd(n,e){let t,i,s,l,o,r=e[11].name+"",a,u,f,c,d=B.getFieldValueType(e[11])+"",h,g,v,b;function y(O,E){return O[11].required?RC:FC}let $=y(e),C=$(e);function S(O,E){if(O[11].type==="text")return WC;if(O[11].type==="number")return UC;if(O[11].type==="json")return BC;if(O[11].type==="email")return zC;if(O[11].type==="url")return VC;if(O[11].type==="file")return qC;if(O[11].type==="relation")return jC;if(O[11].type==="user")return HC}let T=S(e),M=T&&T(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),C.c(),l=D(),o=_("span"),a=N(r),u=D(),f=_("td"),c=_("span"),h=N(d),g=D(),v=_("td"),M&&M.c(),b=D(),p(s,"class","inline-flex"),p(c,"class","label"),this.first=t},m(O,E){w(O,t,E),m(t,i),m(i,s),C.m(s,null),m(s,l),m(s,o),m(o,a),m(t,u),m(t,f),m(f,c),m(c,h),m(t,g),m(t,v),M&&M.m(v,null),m(t,b)},p(O,E){e=O,$!==($=y(e))&&(C.d(1),C=$(e),C&&(C.c(),C.m(s,l))),E&1&&r!==(r=e[11].name+"")&&ue(a,r),E&1&&d!==(d=B.getFieldValueType(e[11])+"")&&ue(h,d),T===(T=S(e))&&M?M.p(e,E):(M&&M.d(1),M=T&&T(e),M&&(M.c(),M.m(v,null)))},d(O){O&&k(t),C.d(),M&&M.d()}}}function Yd(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=N(i),l=D(),p(t,"class","tab-item"),ne(t,"active",e[1]===e[6].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=J(t,"click",a),o=!0)},p(u,f){e=u,f&4&&i!==(i=e[6].code+"")&&ue(s,i),f&6&&ne(t,"active",e[1]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function Kd(n,e){let t,i,s,l;return i=new bn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),q(i.$$.fragment),s=D(),p(t,"class","tab-item"),ne(t,"active",e[1]===e[6].code),this.first=t},m(o,r){w(o,t,r),H(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&4&&(a.content=e[6].body),i.$set(a),(!l||r&6)&&ne(t,"active",e[1]===e[6].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){L(i.$$.fragment,o),l=!1},d(o){o&&k(t),j(i)}}}function YC(n){var ie,re,Le;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,g,v,b,y=n[0].name+"",$,C,S,T,M,O,E,P,I,F,V,X,te,Z,ee,U,Y,G,de,x=[],ve=new Map,_e,ge,K,ye,oe,W,ce,ae,Se,Q,$e,Be,Xe,ut,it,Je,et,Te,Ve,Ze,tt,dt,be,Fe,pt,Dt,ht,st,Lt,_t=[],Ft=new Map,Ot,Ke,Ce=[],ze=new Map,lt,ot=n[4]&&Ud();F=new js({props:{js:` - import PocketBase from 'pocketbase'; - - const client = new PocketBase('${n[3]}'); - - ... - - const data = { ... }; - - const record = await client.records.create('${(ie=n[0])==null?void 0:ie.name}', data); - `,dart:` - import 'package:pocketbase/pocketbase.dart'; - - final client = PocketBase('${n[3]}'); - - ... - - final body = { ... }; - - final record = await client.records.create('${(re=n[0])==null?void 0:re.name}', body: body); - `}});let Ht=(Le=n[0])==null?void 0:Le.schema;const Ct=le=>le[11].name;for(let le=0;lele[6].code;for(let le=0;lele[6].code;for(let le=0;leapplication/json or - multipart/form-data.`,M=D(),O=_("p"),O.innerHTML="File upload is supported only via multipart/form-data.",E=D(),P=_("div"),P.textContent="Client SDKs example",I=D(),q(F.$$.fragment),V=D(),X=_("div"),X.textContent="Body Parameters",te=D(),Z=_("table"),ee=_("thead"),ee.innerHTML=`Param - Type - Description`,U=D(),Y=_("tbody"),G=_("tr"),G.innerHTML=`
    Optional - id
    - String - 15 characters string to store as record ID. -
    - If not set, it will be auto generated.`,de=D();for(let le=0;leParam - Type - Description`,W=D(),ce=_("tbody"),ae=_("tr"),Se=_("td"),Se.textContent="expand",Q=D(),$e=_("td"),$e.innerHTML='String',Be=D(),Xe=_("td"),ut=N(`Auto expand relations when returning the created record. Ex.: - `),q(it.$$.fragment),Je=N(` - Supports up to 6-levels depth nested relations expansion. `),et=_("br"),Te=N(` - The expanded relations will be appended to the record under the - `),Ve=_("code"),Ve.textContent="@expand",Ze=N(" property (eg. "),tt=_("code"),tt.textContent='"@expand": {"rel1": {...}, ...}',dt=N(`). Only the - relations that the user has permissions to `),be=_("strong"),be.textContent="view",Fe=N(" will be expanded."),pt=D(),Dt=_("div"),Dt.textContent="Responses",ht=D(),st=_("div"),Lt=_("div");for(let le=0;le<_t.length;le+=1)_t[le].c();Ot=D(),Ke=_("div");for(let le=0;le{ ... }; - - final record = await client.records.create('${(he=le[0])==null?void 0:he.name}', body: body); - `),F.$set(ke),pe&1&&(Ht=(Ie=le[0])==null?void 0:Ie.schema,x=ct(x,pe,Ct,1,le,Ht,ve,Y,pn,Wd,null,Bd)),pe&6&&(ft=le[2],_t=ct(_t,pe,xt,1,le,ft,Ft,Lt,pn,Yd,null,zd)),pe&6&&(R=le[2],Ae(),Ce=ct(Ce,pe,z,1,le,R,ze,Ke,Ut,Kd,null,Vd),Pe())},i(le){if(!lt){A(F.$$.fragment,le),A(it.$$.fragment,le);for(let pe=0;pet(1,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{var u,f;n.$$.dirty&1&&t(4,i=(l==null?void 0:l.createRule)===null),n.$$.dirty&1&&t(2,r=[{code:200,body:JSON.stringify(B.dummyCollectionRecord(l),null,2)},{code:400,body:` - { - "code": 400, - "message": "Failed to create record.", - "data": { - "${(f=(u=l==null?void 0:l.schema)==null?void 0:u[0])==null?void 0:f.name}": { - "code": "validation_required", - "message": "Missing required value." - } - } - } - `},{code:403,body:` - { - "code": 403, - "message": "You are not allowed to perform this request.", - "data": {} - } - `}])},t(3,s=B.getApiExampleUrl(we.baseUrl)),[l,o,r,s,i,a]}class JC extends Ee{constructor(e){super(),Oe(this,e,KC,YC,De,{collection:0})}}function Jd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Zd(n,e,t){const i=n.slice();return i[6]=e[t],i}function Gd(n,e,t){const i=n.slice();return i[11]=e[t],i}function Xd(n){let e;return{c(){e=_("p"),e.innerHTML="Requires 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 ZC(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 GC(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 XC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=N("User "),i=N(t),s=N(".")},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 QC(n){var l;let e,t=((l=n[11].options)==null?void 0:l.maxSelect)>1?"ids":"id",i,s;return{c(){e=N("Relation record "),i=N(t),s=N(".")},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 xC(n){let e,t,i,s,l;return{c(){e=N("File object."),t=_("br"),i=N(` - Set to `),s=_("code"),s.textContent="null",l=N(" 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:se,d(o){o&&k(e),o&&k(t),o&&k(i),o&&k(s),o&&k(l)}}}function e4(n){let e;return{c(){e=N("URL address.")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function t4(n){let e;return{c(){e=N("Email address.")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function n4(n){let e;return{c(){e=N("JSON array or object.")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function i4(n){let e;return{c(){e=N("Number value.")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function s4(n){let e;return{c(){e=N("Plain text value.")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function Qd(n,e){let t,i,s,l,o,r=e[11].name+"",a,u,f,c,d=B.getFieldValueType(e[11])+"",h,g,v,b;function y(O,E){return O[11].required?GC:ZC}let $=y(e),C=$(e);function S(O,E){if(O[11].type==="text")return s4;if(O[11].type==="number")return i4;if(O[11].type==="json")return n4;if(O[11].type==="email")return t4;if(O[11].type==="url")return e4;if(O[11].type==="file")return xC;if(O[11].type==="relation")return QC;if(O[11].type==="user")return XC}let T=S(e),M=T&&T(e);return{key:n,first:null,c(){t=_("tr"),i=_("td"),s=_("div"),C.c(),l=D(),o=_("span"),a=N(r),u=D(),f=_("td"),c=_("span"),h=N(d),g=D(),v=_("td"),M&&M.c(),b=D(),p(s,"class","inline-flex"),p(c,"class","label"),this.first=t},m(O,E){w(O,t,E),m(t,i),m(i,s),C.m(s,null),m(s,l),m(s,o),m(o,a),m(t,u),m(t,f),m(f,c),m(c,h),m(t,g),m(t,v),M&&M.m(v,null),m(t,b)},p(O,E){e=O,$!==($=y(e))&&(C.d(1),C=$(e),C&&(C.c(),C.m(s,l))),E&1&&r!==(r=e[11].name+"")&&ue(a,r),E&1&&d!==(d=B.getFieldValueType(e[11])+"")&&ue(h,d),T===(T=S(e))&&M?M.p(e,E):(M&&M.d(1),M=T&&T(e),M&&(M.c(),M.m(v,null)))},d(O){O&&k(t),C.d(),M&&M.d()}}}function xd(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=N(i),l=D(),p(t,"class","tab-item"),ne(t,"active",e[1]===e[6].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=J(t,"click",a),o=!0)},p(u,f){e=u,f&4&&i!==(i=e[6].code+"")&&ue(s,i),f&6&&ne(t,"active",e[1]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function ep(n,e){let t,i,s,l;return i=new bn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),q(i.$$.fragment),s=D(),p(t,"class","tab-item"),ne(t,"active",e[1]===e[6].code),this.first=t},m(o,r){w(o,t,r),H(i,t,null),m(t,s),l=!0},p(o,r){e=o;const a={};r&4&&(a.content=e[6].body),i.$set(a),(!l||r&6)&&ne(t,"active",e[1]===e[6].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){L(i.$$.fragment,o),l=!1},d(o){o&&k(t),j(i)}}}function l4(n){var le,pe,ke;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,g,v,b,y,$=n[0].name+"",C,S,T,M,O,E,P,I,F,V,X,te,Z,ee,U,Y,G,de,x,ve,_e,ge=[],K=new Map,ye,oe,W,ce,ae,Se,Q,$e,Be,Xe,ut,it,Je,et,Te,Ve,Ze,tt,dt,be,Fe,pt,Dt,ht,st,Lt,_t,Ft,Ot,Ke=[],Ce=new Map,ze,lt,ot=[],Ht=new Map,Ct,ft=n[4]&&Xd();V=new js({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 = { ... }; - - final record = await client.records.update('${(pe=n[0])==null?void 0:pe.name}', 'RECORD_ID', body: body); - `}});let xt=(ke=n[0])==null?void 0:ke.schema;const R=fe=>fe[11].name;for(let fe=0;fefe[6].code;for(let fe=0;fefe[6].code;for(let fe=0;feapplication/json or - multipart/form-data.`,O=D(),E=_("p"),E.innerHTML="File upload is supported only via multipart/form-data.",P=D(),I=_("div"),I.textContent="Client SDKs example",F=D(),q(V.$$.fragment),X=D(),te=_("div"),te.textContent="Path parameters",Z=D(),ee=_("table"),ee.innerHTML=`Param - Type - Description - id - String - ID of the record to update.`,U=D(),Y=_("div"),Y.textContent="Body Parameters",G=D(),de=_("table"),x=_("thead"),x.innerHTML=`Param - Type - Description`,ve=D(),_e=_("tbody");for(let fe=0;feParam - Type - Description`,Se=D(),Q=_("tbody"),$e=_("tr"),Be=_("td"),Be.textContent="expand",Xe=D(),ut=_("td"),ut.innerHTML='String',it=D(),Je=_("td"),et=N(`Auto expand relations when returning the updated record. Ex.: - `),q(Te.$$.fragment),Ve=N(` - Supports up to 6-levels depth nested relations expansion. `),Ze=_("br"),tt=N(` - The expanded relations will be appended to the record under the - `),dt=_("code"),dt.textContent="@expand",be=N(" property (eg. "),Fe=_("code"),Fe.textContent='"@expand": {"rel1": {...}, ...}',pt=N(`). Only the - relations that the user has permissions to `),Dt=_("strong"),Dt.textContent="view",ht=N(" will be expanded."),st=D(),Lt=_("div"),Lt.textContent="Responses",_t=D(),Ft=_("div"),Ot=_("div");for(let fe=0;fe{ ... }; - - final record = await client.records.update('${(un=fe[0])==null?void 0:un.name}', 'RECORD_ID', body: body); - `),V.$set(Ie),he&1&&(xt=(jt=fe[0])==null?void 0:jt.schema,ge=ct(ge,he,R,1,fe,xt,K,_e,pn,Qd,null,Gd)),he&6&&(z=fe[2],Ke=ct(Ke,he,ie,1,fe,z,Ce,Ot,pn,xd,null,Zd)),he&6&&(re=fe[2],Ae(),ot=ct(ot,he,Le,1,fe,re,Ht,lt,Ut,ep,null,Jd),Pe())},i(fe){if(!Ct){A(V.$$.fragment,fe),A(Te.$$.fragment,fe);for(let he=0;het(1,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{var u,f;n.$$.dirty&1&&t(4,i=(l==null?void 0:l.updateRule)===null),n.$$.dirty&1&&t(2,r=[{code:200,body:JSON.stringify(B.dummyCollectionRecord(l),null,2)},{code:400,body:` - { - "code": 400, - "message": "Failed to update record.", - "data": { - "${(f=(u=l==null?void 0:l.schema)==null?void 0:u[0])==null?void 0:f.name}": { - "code": "validation_required", - "message": "Missing required value." - } - } - } - `},{code:403,body:` - { - "code": 403, - "message": "You are not allowed to perform this request.", - "data": {} - } - `},{code:404,body:` - { - "code": 404, - "message": "The requested resource wasn't found.", - "data": {} - } - `}])},t(3,s=B.getApiExampleUrl(we.baseUrl)),[l,o,r,s,i,a]}class r4 extends Ee{constructor(e){super(),Oe(this,e,o4,l4,De,{collection:0})}}function tp(n,e,t){const i=n.slice();return i[6]=e[t],i}function np(n,e,t){const i=n.slice();return i[6]=e[t],i}function ip(n){let e;return{c(){e=_("p"),e.innerHTML="Requires 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 sp(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=N(i),l=D(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[6].code),this.first=t},m(u,f){w(u,t,f),m(t,s),m(t,l),o||(r=J(t,"click",a),o=!0)},p(u,f){e=u,f&20&&ne(t,"active",e[2]===e[6].code)},d(u){u&&k(t),o=!1,r()}}}function lp(n,e){let t,i,s,l;return i=new bn({props:{content:e[6].body}}),{key:n,first:null,c(){t=_("div"),q(i.$$.fragment),s=D(),p(t,"class","tab-item"),ne(t,"active",e[2]===e[6].code),this.first=t},m(o,r){w(o,t,r),H(i,t,null),m(t,s),l=!0},p(o,r){e=o,(!l||r&20)&&ne(t,"active",e[2]===e[6].code)},i(o){l||(A(i.$$.fragment,o),l=!0)},o(o){L(i.$$.fragment,o),l=!1},d(o){o&&k(t),j(i)}}}function a4(n){var ae,Se;let e,t,i,s,l,o,r,a=n[0].name+"",u,f,c,d,h,g,v,b,y,$=n[0].name+"",C,S,T,M,O,E,P,I,F,V,X,te,Z,ee,U,Y=[],G=new Map,de,x,ve=[],_e=new Map,ge,K=n[1]&&ip();E=new js({props:{js:` - import PocketBase from 'pocketbase'; - - const client = new PocketBase('${n[3]}'); - - ... - - await client.records.delete('${(ae=n[0])==null?void 0:ae.name}', 'RECORD_ID'); - `,dart:` - import 'package:pocketbase/pocketbase.dart'; - - final client = PocketBase('${n[3]}'); - - ... - - await client.records.delete('${(Se=n[0])==null?void 0:Se.name}', 'RECORD_ID'); - `}});let ye=n[4];const oe=Q=>Q[6].code;for(let Q=0;QQ[6].code;for(let Q=0;QParam - Type - Description - id - String - ID of the record to delete.`,X=D(),te=_("div"),te.textContent="Responses",Z=D(),ee=_("div"),U=_("div");for(let Q=0;Qt(2,o=u.code);return n.$$set=u=>{"collection"in u&&t(0,l=u.collection)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=(l==null?void 0:l.deleteRule)===null),n.$$.dirty&3&&l!=null&&l.id&&(r.push({code:204,body:` - null - `}),r.push({code:400,body:` - { - "code": 400, - "message": "Failed to delete record. Make sure that the record is not part of a required relation reference.", - "data": {} - } - `}),i&&r.push({code:403,body:` - { - "code": 403, - "message": "Only admins can access this action.", - "data": {} - } - `}),r.push({code:404,body:` - { - "code": 404, - "message": "The requested resource wasn't found.", - "data": {} - } - `}))},t(3,s=B.getApiExampleUrl(we.baseUrl)),[l,i,o,s,r,a]}class f4 extends Ee{constructor(e){super(),Oe(this,e,u4,a4,De,{collection:0})}}function c4(n){var h,g,v,b,y,$,C,S;let e,t,i,s,l,o,r,a,u,f,c,d;return r=new js({props:{js:` - import PocketBase from 'pocketbase'; - - const client = new PocketBase('${n[1]}'); - - ... - - // (Optionally) authenticate - client.users.authViaEmail('test@example.com', '123456'); - - // Subscribe to changes in any record from the collection - client.realtime.subscribe('${(h=n[0])==null?void 0:h.name}', function (e) { - console.log(e.record); - }); - - // Subscribe to changes in a single record - client.realtime.subscribe('${(g=n[0])==null?void 0:g.name}/RECORD_ID', function (e) { - console.log(e.record); - }); - - // Unsubscribe - client.realtime.unsubscribe() // remove all subscriptions - client.realtime.unsubscribe('${(v=n[0])==null?void 0:v.name}') // remove only the collection subscription - client.realtime.unsubscribe('${(b=n[0])==null?void 0:b.name}/RECORD_ID') // remove only the record subscription - `,dart:` - import 'package:pocketbase/pocketbase.dart'; - - final client = PocketBase('${n[1]}'); - - ... - - // (Optionally) authenticate - client.users.authViaEmail('test@example.com', '123456'); - - // Subscribe to changes in any record from the collection - client.realtime.subscribe('${(y=n[0])==null?void 0:y.name}', (e) { - print(e.record); - }); - - // Subscribe to changes in a single record - client.realtime.subscribe('${($=n[0])==null?void 0:$.name}/RECORD_ID', (e) { - print(e.record); - }); - - // Unsubscribe - client.realtime.unsubscribe() // remove all subscriptions - client.realtime.unsubscribe('${(C=n[0])==null?void 0:C.name}') // remove only the collection subscription - client.realtime.unsubscribe('${(S=n[0])==null?void 0:S.name}/RECORD_ID') // remove only the record subscription - `}}),c=new bn({props:{content:JSON.stringify({action:"create",record:B.dummyCollectionRecord(n[0])},null,2).replace('"action": "create"','"action": "create" // create, update or delete')}}),{c(){e=_("div"),e.innerHTML=`SSE -

    /api/realtime

    `,t=D(),i=_("div"),i.innerHTML=`

    Subscribe to realtime changes via Server-Sent Events (SSE).

    -

    Events are sent 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.

    `,s=D(),l=_("div"),l.textContent="Client SDKs example",o=D(),q(r.$$.fragment),a=D(),u=_("div"),u.textContent="Event data format",f=D(),q(c.$$.fragment),p(e,"class","alert"),p(i,"class","content m-b-base"),p(l,"class","section-title"),p(u,"class","section-title")},m(T,M){w(T,e,M),w(T,t,M),w(T,i,M),w(T,s,M),w(T,l,M),w(T,o,M),H(r,T,M),w(T,a,M),w(T,u,M),w(T,f,M),H(c,T,M),d=!0},p(T,[M]){var P,I,F,V,X,te,Z,ee;const O={};M&3&&(O.js=` - import PocketBase from 'pocketbase'; - - const client = new PocketBase('${T[1]}'); - - ... - - // (Optionally) authenticate - client.users.authViaEmail('test@example.com', '123456'); - - // Subscribe to changes in any record from the collection - client.realtime.subscribe('${(P=T[0])==null?void 0:P.name}', function (e) { - console.log(e.record); - }); - - // Subscribe to changes in a single record - client.realtime.subscribe('${(I=T[0])==null?void 0:I.name}/RECORD_ID', function (e) { - console.log(e.record); - }); - - // Unsubscribe - client.realtime.unsubscribe() // remove all subscriptions - client.realtime.unsubscribe('${(F=T[0])==null?void 0:F.name}') // remove only the collection subscription - client.realtime.unsubscribe('${(V=T[0])==null?void 0:V.name}/RECORD_ID') // remove only the record subscription - `),M&3&&(O.dart=` - import 'package:pocketbase/pocketbase.dart'; - - final client = PocketBase('${T[1]}'); - - ... - - // (Optionally) authenticate - client.users.authViaEmail('test@example.com', '123456'); - - // Subscribe to changes in any record from the collection - client.realtime.subscribe('${(X=T[0])==null?void 0:X.name}', (e) { - print(e.record); - }); - - // Subscribe to changes in a single record - client.realtime.subscribe('${(te=T[0])==null?void 0:te.name}/RECORD_ID', (e) { - print(e.record); - }); - - // Unsubscribe - client.realtime.unsubscribe() // remove all subscriptions - client.realtime.unsubscribe('${(Z=T[0])==null?void 0:Z.name}') // remove only the collection subscription - client.realtime.unsubscribe('${(ee=T[0])==null?void 0:ee.name}/RECORD_ID') // remove only the record subscription - `),r.$set(O);const E={};M&1&&(E.content=JSON.stringify({action:"create",record:B.dummyCollectionRecord(T[0])},null,2).replace('"action": "create"','"action": "create" // create, update or delete')),c.$set(E)},i(T){d||(A(r.$$.fragment,T),A(c.$$.fragment,T),d=!0)},o(T){L(r.$$.fragment,T),L(c.$$.fragment,T),d=!1},d(T){T&&k(e),T&&k(t),T&&k(i),T&&k(s),T&&k(l),T&&k(o),j(r,T),T&&k(a),T&&k(u),T&&k(f),j(c,T)}}}function d4(n,e,t){let i,{collection:s=new dn}=e;return n.$$set=l=>{"collection"in l&&t(0,s=l.collection)},t(1,i=B.getApiExampleUrl(we.baseUrl)),[s,i]}class p4 extends Ee{constructor(e){super(),Oe(this,e,d4,c4,De,{collection:0})}}function op(n,e,t){const i=n.slice();return i[14]=e[t],i}function rp(n,e,t){const i=n.slice();return i[14]=e[t],i}function ap(n){let e,t,i,s;var l=n[14].component;function o(r){return{props:{collection:r[3]}}}return l&&(t=new l(o(n))),{c(){e=_("div"),t&&q(t.$$.fragment),i=D(),p(e,"class","tab-item active")},m(r,a){w(r,e,a),t&&H(t,e,null),m(e,i),s=!0},p(r,a){const u={};if(a&8&&(u.collection=r[3]),l!==(l=r[14].component)){if(t){Ae();const f=t;L(f.$$.fragment,1,0,()=>{j(f,1)}),Pe()}l?(t=new l(o(r)),q(t.$$.fragment),A(t.$$.fragment,1),H(t,e,i)):t=null}else l&&t.$set(u)},i(r){s||(t&&A(t.$$.fragment,r),s=!0)},o(r){t&&L(t.$$.fragment,r),s=!1},d(r){r&&k(e),t&&j(t)}}}function up(n,e){let t,i,s,l=e[4]===e[14].id&&ap(e);return{key:n,first:null,c(){t=Ue(),l&&l.c(),i=Ue(),this.first=t},m(o,r){w(o,t,r),l&&l.m(o,r),w(o,i,r),s=!0},p(o,r){e=o,e[4]===e[14].id?l?(l.p(e,r),r&16&&A(l,1)):(l=ap(e),l.c(),A(l,1),l.m(i.parentNode,i)):l&&(Ae(),L(l,1,1,()=>{l=null}),Pe())},i(o){s||(A(l),s=!0)},o(o){L(l),s=!1},d(o){o&&k(t),l&&l.d(o),o&&k(i)}}}function h4(n){let e,t=[],i=new Map,s,l=n[5];const o=r=>r[14].id;for(let r=0;rd[14].id;for(let d=0;dClose',p(e,"type","button"),p(e,"class","btn btn-secondary")},m(s,l){w(s,e,l),t||(i=J(e,"click",n[8]),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function _4(n){let e,t,i={class:"overlay-panel-xl colored-header collection-panel",$$slots:{footer:[g4],header:[m4],default:[h4]},$$scope:{ctx:n}};return e=new ui({props:i}),n[11](e),e.$on("hide",n[12]),e.$on("show",n[13]),{c(){q(e.$$.fragment)},m(s,l){H(e,s,l),t=!0},p(s,[l]){const o={};l&524312&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){L(e.$$.fragment,s),t=!1},d(s){n[11](null),j(e,s)}}}function b4(n,e,t){const i=[{id:"list",label:"List",component:PC},{id:"view",label:"View",component:NC},{id:"create",label:"Create",component:JC},{id:"update",label:"Update",component:r4},{id:"delete",label:"Delete",component:f4},{id:"realtime",label:"Realtime",component:p4}];let s,l=new dn,o=i[0].id;function r(y){return t(3,l=y),u(i[0].id),s==null?void 0:s.show()}function a(){return s==null?void 0:s.hide()}function u(y){t(4,o=y)}function f(y,$){(y.code==="Enter"||y.code==="Space")&&(y.preventDefault(),u($))}const c=()=>a(),d=y=>u(y.id),h=(y,$)=>f($,y.id);function g(y){me[y?"unshift":"push"](()=>{s=y,t(2,s)})}function v(y){xe.call(this,n,y)}function b(y){xe.call(this,n,y)}return[a,u,s,l,o,i,f,r,c,d,h,g,v,b]}class v4 extends Ee{constructor(e){super(),Oe(this,e,b4,_4,De,{show:7,hide:0,changeTab:1})}get show(){return this.$$.ctx[7]}get hide(){return this.$$.ctx[0]}get changeTab(){return this.$$.ctx[1]}}function y4(n){let e,t,i,s=[n[3]],l={};for(let o=0;o{r&&(t(1,r.style.height="",r),t(1,r.style.height=Math.min(r.scrollHeight+2,o)+"px",r))},0)}function f(h){if((h==null?void 0:h.code)==="Enter"&&!(h!=null&&h.shiftKey)){h.preventDefault();const g=r.closest("form");g!=null&&g.requestSubmit&&g.requestSubmit()}}Nn(()=>(u(),()=>clearTimeout(a)));function c(h){me[h?"unshift":"push"](()=>{r=h,t(1,r)})}function d(){l=this.value,t(0,l)}return n.$$set=h=>{e=at(at({},e),li(h)),t(3,s=Bt(e,i)),"value"in h&&t(0,l=h.value),"maxHeight"in h&&t(4,o=h.maxHeight)},n.$$.update=()=>{n.$$.dirty&1&&typeof l!==void 0&&u()},[l,r,f,s,o,c,d]}class w4 extends Ee{constructor(e){super(),Oe(this,e,k4,y4,De,{value:0,maxHeight:4})}}function $4(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d;function h(v){n[2](v)}let g={id:n[3],required:n[1].required};return n[0]!==void 0&&(g.value=n[0]),f=new w4({props:g}),me.push(()=>Re(f,"value",h)),{c(){e=_("label"),t=_("i"),s=D(),l=_("span"),r=N(o),u=D(),q(f.$$.fragment),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3])},m(v,b){w(v,e,b),m(e,t),m(e,s),m(e,l),m(l,r),w(v,u,b),H(f,v,b),d=!0},p(v,b){(!d||b&2&&i!==(i=B.getFieldTypeIcon(v[1].type)))&&p(t,"class",i),(!d||b&2)&&o!==(o=v[1].name+"")&&ue(r,o),(!d||b&8&&a!==(a=v[3]))&&p(e,"for",a);const y={};b&8&&(y.id=v[3]),b&2&&(y.required=v[1].required),!c&&b&1&&(c=!0,y.value=v[0],He(()=>c=!1)),f.$set(y)},i(v){d||(A(f.$$.fragment,v),d=!0)},o(v){L(f.$$.fragment,v),d=!1},d(v){v&&k(e),v&&k(u),j(f,v)}}}function S4(n){let e,t;return e=new Ne({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[$4,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function C4(n,e,t){let{field:i=new Dn}=e,{value:s=void 0}=e;function l(o){s=o,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class M4 extends Ee{constructor(e){super(),Oe(this,e,C4,S4,De,{field:1,value:0})}}function T4(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,g,v,b;return{c(){var y,$;e=_("label"),t=_("i"),s=D(),l=_("span"),r=N(o),u=D(),f=_("input"),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"type","number"),p(f,"id",c=n[3]),f.required=d=n[1].required,p(f,"min",h=(y=n[1].options)==null?void 0:y.min),p(f,"max",g=($=n[1].options)==null?void 0:$.max),p(f,"step","any")},m(y,$){w(y,e,$),m(e,t),m(e,s),m(e,l),m(l,r),w(y,u,$),w(y,f,$),Me(f,n[0]),v||(b=J(f,"input",n[2]),v=!0)},p(y,$){var C,S;$&2&&i!==(i=B.getFieldTypeIcon(y[1].type))&&p(t,"class",i),$&2&&o!==(o=y[1].name+"")&&ue(r,o),$&8&&a!==(a=y[3])&&p(e,"for",a),$&8&&c!==(c=y[3])&&p(f,"id",c),$&2&&d!==(d=y[1].required)&&(f.required=d),$&2&&h!==(h=(C=y[1].options)==null?void 0:C.min)&&p(f,"min",h),$&2&&g!==(g=(S=y[1].options)==null?void 0:S.max)&&p(f,"max",g),$&1&&Pt(f.value)!==y[0]&&Me(f,y[0])},d(y){y&&k(e),y&&k(u),y&&k(f),v=!1,b()}}}function D4(n){let e,t;return e=new Ne({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[T4,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function O4(n,e,t){let{field:i=new Dn}=e,{value:s=void 0}=e;function l(){s=Pt(this.value),t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class E4 extends Ee{constructor(e){super(),Oe(this,e,O4,D4,De,{field:1,value:0})}}function A4(n){let e,t,i,s,l=n[1].name+"",o,r,a,u;return{c(){e=_("input"),i=D(),s=_("label"),o=N(l),p(e,"type","checkbox"),p(e,"id",t=n[3]),p(s,"for",r=n[3])},m(f,c){w(f,e,c),e.checked=n[0],w(f,i,c),w(f,s,c),m(s,o),a||(u=J(e,"change",n[2]),a=!0)},p(f,c){c&8&&t!==(t=f[3])&&p(e,"id",t),c&1&&(e.checked=f[0]),c&2&&l!==(l=f[1].name+"")&&ue(o,l),c&8&&r!==(r=f[3])&&p(s,"for",r)},d(f){f&&k(e),f&&k(i),f&&k(s),a=!1,u()}}}function P4(n){let e,t;return e=new Ne({props:{class:"form-field form-field-toggle "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[A4,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field form-field-toggle "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function L4(n,e,t){let{field:i=new Dn}=e,{value:s=!1}=e;function l(){s=this.checked,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class I4 extends Ee{constructor(e){super(),Oe(this,e,L4,P4,De,{field:1,value:0})}}function N4(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,g;return{c(){e=_("label"),t=_("i"),s=D(),l=_("span"),r=N(o),u=D(),f=_("input"),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"type","email"),p(f,"id",c=n[3]),f.required=d=n[1].required},m(v,b){w(v,e,b),m(e,t),m(e,s),m(e,l),m(l,r),w(v,u,b),w(v,f,b),Me(f,n[0]),h||(g=J(f,"input",n[2]),h=!0)},p(v,b){b&2&&i!==(i=B.getFieldTypeIcon(v[1].type))&&p(t,"class",i),b&2&&o!==(o=v[1].name+"")&&ue(r,o),b&8&&a!==(a=v[3])&&p(e,"for",a),b&8&&c!==(c=v[3])&&p(f,"id",c),b&2&&d!==(d=v[1].required)&&(f.required=d),b&1&&f.value!==v[0]&&Me(f,v[0])},d(v){v&&k(e),v&&k(u),v&&k(f),h=!1,g()}}}function F4(n){let e,t;return e=new Ne({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[N4,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function R4(n,e,t){let{field:i=new Dn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class H4 extends Ee{constructor(e){super(),Oe(this,e,R4,F4,De,{field:1,value:0})}}function j4(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,g;return{c(){e=_("label"),t=_("i"),s=D(),l=_("span"),r=N(o),u=D(),f=_("input"),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"type","url"),p(f,"id",c=n[3]),f.required=d=n[1].required},m(v,b){w(v,e,b),m(e,t),m(e,s),m(e,l),m(l,r),w(v,u,b),w(v,f,b),Me(f,n[0]),h||(g=J(f,"input",n[2]),h=!0)},p(v,b){b&2&&i!==(i=B.getFieldTypeIcon(v[1].type))&&p(t,"class",i),b&2&&o!==(o=v[1].name+"")&&ue(r,o),b&8&&a!==(a=v[3])&&p(e,"for",a),b&8&&c!==(c=v[3])&&p(f,"id",c),b&2&&d!==(d=v[1].required)&&(f.required=d),b&1&&Me(f,v[0])},d(v){v&&k(e),v&&k(u),v&&k(f),h=!1,g()}}}function q4(n){let e,t;return e=new Ne({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[j4,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function V4(n,e,t){let{field:i=new Dn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class z4 extends Ee{constructor(e){super(),Oe(this,e,V4,q4,De,{field:1,value:0})}}function B4(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h;function g(b){n[2](b)}let v={id:n[3],options:B.defaultFlatpickrOptions(),value:n[0]};return n[0]!==void 0&&(v.formattedValue=n[0]),c=new tu({props:v}),me.push(()=>Re(c,"formattedValue",g)),{c(){e=_("label"),t=_("i"),s=D(),l=_("span"),r=N(o),a=N(" (UTC)"),f=D(),q(c.$$.fragment),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",u=n[3])},m(b,y){w(b,e,y),m(e,t),m(e,s),m(e,l),m(l,r),m(l,a),w(b,f,y),H(c,b,y),h=!0},p(b,y){(!h||y&2&&i!==(i=B.getFieldTypeIcon(b[1].type)))&&p(t,"class",i),(!h||y&2)&&o!==(o=b[1].name+"")&&ue(r,o),(!h||y&8&&u!==(u=b[3]))&&p(e,"for",u);const $={};y&8&&($.id=b[3]),y&1&&($.value=b[0]),!d&&y&1&&(d=!0,$.formattedValue=b[0],He(()=>d=!1)),c.$set($)},i(b){h||(A(c.$$.fragment,b),h=!0)},o(b){L(c.$$.fragment,b),h=!1},d(b){b&&k(e),b&&k(f),j(c,b)}}}function U4(n){let e,t;return e=new Ne({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[B4,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function W4(n,e,t){let{field:i=new Dn}=e,{value:s=void 0}=e;function l(o){s=o,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},[s,i,l]}class Y4 extends Ee{constructor(e){super(),Oe(this,e,W4,U4,De,{field:1,value:0})}}function cp(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=_("div"),t=N("Select up to "),s=N(i),l=N(" items."),p(e,"class","help-block")},m(o,r){w(o,e,r),m(e,t),m(e,s),m(e,l)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&ue(s,i)},d(o){o&&k(e)}}}function K4(n){var $,C,S;let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,g;function v(T){n[3](T)}let b={id:n[4],toggle:!n[1].required||n[2],multiple:n[2],items:($=n[1].options)==null?void 0:$.values,searchable:((C=n[1].options)==null?void 0:C.values)>5};n[0]!==void 0&&(b.selected=n[0]),f=new ab({props:b}),me.push(()=>Re(f,"selected",v));let y=((S=n[1].options)==null?void 0:S.maxSelect)>1&&cp(n);return{c(){e=_("label"),t=_("i"),s=D(),l=_("span"),r=N(o),u=D(),q(f.$$.fragment),d=D(),y&&y.c(),h=Ue(),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[4])},m(T,M){w(T,e,M),m(e,t),m(e,s),m(e,l),m(l,r),w(T,u,M),H(f,T,M),w(T,d,M),y&&y.m(T,M),w(T,h,M),g=!0},p(T,M){var E,P,I;(!g||M&2&&i!==(i=B.getFieldTypeIcon(T[1].type)))&&p(t,"class",i),(!g||M&2)&&o!==(o=T[1].name+"")&&ue(r,o),(!g||M&16&&a!==(a=T[4]))&&p(e,"for",a);const O={};M&16&&(O.id=T[4]),M&6&&(O.toggle=!T[1].required||T[2]),M&4&&(O.multiple=T[2]),M&2&&(O.items=(E=T[1].options)==null?void 0:E.values),M&2&&(O.searchable=((P=T[1].options)==null?void 0:P.values)>5),!c&&M&1&&(c=!0,O.selected=T[0],He(()=>c=!1)),f.$set(O),((I=T[1].options)==null?void 0:I.maxSelect)>1?y?y.p(T,M):(y=cp(T),y.c(),y.m(h.parentNode,h)):y&&(y.d(1),y=null)},i(T){g||(A(f.$$.fragment,T),g=!0)},o(T){L(f.$$.fragment,T),g=!1},d(T){T&&k(e),T&&k(u),j(f,T),T&&k(d),y&&y.d(T),T&&k(h)}}}function J4(n){let e,t;return e=new Ne({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[K4,({uniqueId:i})=>({4:i}),({uniqueId:i})=>i?16:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&55&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function Z4(n,e,t){let i,{field:s=new Dn}=e,{value:l=void 0}=e;function o(r){l=r,t(0,l),t(2,i),t(1,s)}return n.$$set=r=>{"field"in r&&t(1,s=r.field),"value"in r&&t(0,l=r.value)},n.$$.update=()=>{var r;n.$$.dirty&2&&t(2,i=((r=s.options)==null?void 0:r.maxSelect)>1),n.$$.dirty&5&&typeof l>"u"&&t(0,l=i?[]:""),n.$$.dirty&7&&i&&Array.isArray(l)&&l.length>s.options.maxSelect&&t(0,l=l.slice(l.length-s.options.maxSelect))},[l,s,i,o]}class G4 extends Ee{constructor(e){super(),Oe(this,e,Z4,J4,De,{field:1,value:0})}}function X4(n){let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,g;return{c(){e=_("label"),t=_("i"),s=D(),l=_("span"),r=N(o),u=D(),f=_("textarea"),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[3]),p(f,"id",c=n[3]),f.required=d=n[1].required,p(f,"class","txt-mono")},m(v,b){w(v,e,b),m(e,t),m(e,s),m(e,l),m(l,r),w(v,u,b),w(v,f,b),Me(f,n[0]),h||(g=J(f,"input",n[2]),h=!0)},p(v,b){b&2&&i!==(i=B.getFieldTypeIcon(v[1].type))&&p(t,"class",i),b&2&&o!==(o=v[1].name+"")&&ue(r,o),b&8&&a!==(a=v[3])&&p(e,"for",a),b&8&&c!==(c=v[3])&&p(f,"id",c),b&2&&d!==(d=v[1].required)&&(f.required=d),b&1&&Me(f,v[0])},d(v){v&&k(e),v&&k(u),v&&k(f),h=!1,g()}}}function Q4(n){let e,t;return e=new Ne({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[X4,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&27&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function x4(n,e,t){let{field:i=new Dn}=e,{value:s=void 0}=e;function l(){s=this.value,t(0,s)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,s=o.value)},n.$$.update=()=>{n.$$.dirty&1&&typeof s<"u"&&typeof s!="string"&&s!==null&&t(0,s=JSON.stringify(s,null,2))},[s,i,l]}class eM extends Ee{constructor(e){super(),Oe(this,e,x4,Q4,De,{field:1,value:0})}}function tM(n){let e,t;return{c(){e=_("i"),p(e,"class","ri-file-line"),p(e,"alt",t=n[0].name)},m(i,s){w(i,e,s)},p(i,s){s&1&&t!==(t=i[0].name)&&p(e,"alt",t)},d(i){i&&k(e)}}}function nM(n){let e,t,i;return{c(){e=_("img"),ti(e.src,t=n[2])||p(e,"src",t),p(e,"width",n[1]),p(e,"height",n[1]),p(e,"alt",i=n[0].name)},m(s,l){w(s,e,l)},p(s,l){l&4&&!ti(e.src,t=s[2])&&p(e,"src",t),l&2&&p(e,"width",s[1]),l&2&&p(e,"height",s[1]),l&1&&i!==(i=s[0].name)&&p(e,"alt",i)},d(s){s&&k(e)}}}function iM(n){let e;function t(l,o){return l[2]?nM:tM}let i=t(n),s=i(n);return{c(){s.c(),e=Ue()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:se,o:se,d(l){s.d(l),l&&k(e)}}}function sM(n,e,t){let i,{file:s}=e,{size:l=50}=e;function o(){t(2,i=""),B.hasImageExtension(s==null?void 0:s.name)&&B.generateThumb(s,l,l).then(r=>{t(2,i=r)}).catch(r=>{console.warn("Unable to generate thumb: ",r)})}return n.$$set=r=>{"file"in r&&t(0,s=r.file),"size"in r&&t(1,l=r.size)},n.$$.update=()=>{n.$$.dirty&1&&typeof s<"u"&&o()},t(2,i=""),[s,l,i]}class lM extends Ee{constructor(e){super(),Oe(this,e,sM,iM,De,{file:0,size:1})}}function oM(n){let e,t,i;return{c(){e=_("img"),ti(e.src,t=n[2])||p(e,"src",t),p(e,"alt",i="Preview "+n[2])},m(s,l){w(s,e,l)},p(s,l){l&4&&!ti(e.src,t=s[2])&&p(e,"src",t),l&4&&i!==(i="Preview "+s[2])&&p(e,"alt",i)},d(s){s&&k(e)}}}function rM(n){let e,t,i;return{c(){e=_("div"),e.innerHTML='',p(e,"class","overlay-close")},m(s,l){w(s,e,l),t||(i=J(e,"click",Yt(n[0])),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function aM(n){let e,t=n[2].substring(n[2].lastIndexOf("/")+1)+"",i,s,l,o,r,a,u;return{c(){e=_("a"),i=N(t),s=D(),l=_("div"),o=D(),r=_("button"),r.textContent="Close",p(e,"href",n[2]),p(e,"title","Download"),p(e,"class","link-hint txt-ellipsis"),p(l,"class","flex-fill"),p(r,"type","button"),p(r,"class","btn btn-secondary")},m(f,c){w(f,e,c),m(e,i),w(f,s,c),w(f,l,c),w(f,o,c),w(f,r,c),a||(u=J(r,"click",n[0]),a=!0)},p(f,c){c&4&&t!==(t=f[2].substring(f[2].lastIndexOf("/")+1)+"")&&ue(i,t),c&4&&p(e,"href",f[2])},d(f){f&&k(e),f&&k(s),f&&k(l),f&&k(o),f&&k(r),a=!1,u()}}}function uM(n){let e,t,i={class:"image-preview",btnClose:!1,popup:!0,$$slots:{footer:[aM],header:[rM],default:[oM]},$$scope:{ctx:n}};return e=new ui({props:i}),n[4](e),e.$on("show",n[5]),e.$on("hide",n[6]),{c(){q(e.$$.fragment)},m(s,l){H(e,s,l),t=!0},p(s,[l]){const o={};l&132&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){L(e.$$.fragment,s),t=!1},d(s){n[4](null),j(e,s)}}}function fM(n,e,t){let i,s="";function l(f){f!==""&&(t(2,s=f),i==null||i.show())}function o(){return i==null?void 0:i.hide()}function r(f){me[f?"unshift":"push"](()=>{i=f,t(1,i)})}function a(f){xe.call(this,n,f)}function u(f){xe.call(this,n,f)}return[o,i,s,l,r,a,u]}class cM extends Ee{constructor(e){super(),Oe(this,e,fM,uM,De,{show:3,hide:0})}get show(){return this.$$.ctx[3]}get hide(){return this.$$.ctx[0]}}function dM(n){let e;return{c(){e=_("i"),p(e,"class","ri-file-line")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function pM(n){let e,t,i,s,l;return{c(){e=_("img"),ti(e.src,t=n[4])||p(e,"src",t),p(e,"alt",n[0]),p(e,"title",i="Preview "+n[0]),ne(e,"link-fade",n[2])},m(o,r){w(o,e,r),s||(l=[J(e,"click",n[7]),J(e,"error",n[5])],s=!0)},p(o,r){r&16&&!ti(e.src,t=o[4])&&p(e,"src",t),r&1&&p(e,"alt",o[0]),r&1&&i!==(i="Preview "+o[0])&&p(e,"title",i),r&4&&ne(e,"link-fade",o[2])},d(o){o&&k(e),s=!1,Ye(l)}}}function hM(n){let e,t,i;function s(a,u){return a[2]?pM:dM}let l=s(n),o=l(n),r={};return t=new cM({props:r}),n[8](t),{c(){o.c(),e=D(),q(t.$$.fragment)},m(a,u){o.m(a,u),w(a,e,u),H(t,a,u),i=!0},p(a,[u]){l===(l=s(a))&&o?o.p(a,u):(o.d(1),o=l(a),o&&(o.c(),o.m(e.parentNode,e)));const f={};t.$set(f)},i(a){i||(A(t.$$.fragment,a),i=!0)},o(a){L(t.$$.fragment,a),i=!1},d(a){o.d(a),a&&k(e),n[8](null),j(t,a)}}}function mM(n,e,t){let i,{record:s}=e,{filename:l}=e,o,r="",a="";function u(){t(4,r="")}const f=d=>{d.stopPropagation(),o==null||o.show(a)};function c(d){me[d?"unshift":"push"](()=>{o=d,t(3,o)})}return n.$$set=d=>{"record"in d&&t(6,s=d.record),"filename"in d&&t(0,l=d.filename)},n.$$.update=()=>{n.$$.dirty&1&&t(2,i=B.hasImageExtension(l)),n.$$.dirty&69&&i&&t(1,a=we.records.getFileUrl(s,`${l}`)),n.$$.dirty&2&&t(4,r=a?a+"?thumb=100x100":"")},[l,a,i,o,r,u,s,f,c]}class db extends Ee{constructor(e){super(),Oe(this,e,mM,hM,De,{record:6,filename:0})}}function dp(n,e,t){const i=n.slice();return i[22]=e[t],i[24]=t,i}function pp(n,e,t){const i=n.slice();return i[25]=e[t],i[24]=t,i}function gM(n){let e,t,i;function s(){return n[14](n[24])}return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-secondary btn-sm btn-circle btn-remove txt-hint")},m(l,o){w(l,e,o),t||(i=[We(yt.call(null,e,"Remove file")),J(e,"click",s)],t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,Ye(i)}}}function _M(n){let e,t,i;function s(){return n[13](n[24])}return{c(){e=_("button"),e.innerHTML='Restore',p(e,"type","button"),p(e,"class","btn btn-sm btn-danger btn-secondary")},m(l,o){w(l,e,o),t||(i=J(e,"click",s),t=!0)},p(l,o){n=l},d(l){l&&k(e),t=!1,i()}}}function hp(n,e){let t,i,s,l,o,r=e[25]+"",a,u,f,c,d,h,g;s=new db({props:{record:e[2],filename:e[25]}});function v($,C){return C&18&&(c=null),c==null&&(c=!!$[1].includes($[24])),c?_M:gM}let b=v(e,-1),y=b(e);return{key:n,first:null,c(){t=_("div"),i=_("figure"),q(s.$$.fragment),l=D(),o=_("a"),a=N(r),f=D(),y.c(),p(i,"class","thumb"),ne(i,"fade",e[1].includes(e[24])),p(o,"href",u=we.records.getFileUrl(e[2],e[25])),p(o,"class","filename link-hint"),p(o,"target","_blank"),p(o,"rel","noopener"),ne(o,"txt-strikethrough",e[1].includes(e[24])),p(t,"class","list-item"),this.first=t},m($,C){w($,t,C),m(t,i),H(s,i,null),m(t,l),m(t,o),m(o,a),m(t,f),y.m(t,null),d=!0,h||(g=We(yt.call(null,o,{position:"right",text:"Download"})),h=!0)},p($,C){e=$;const S={};C&4&&(S.record=e[2]),C&16&&(S.filename=e[25]),s.$set(S),(!d||C&18)&&ne(i,"fade",e[1].includes(e[24])),(!d||C&16)&&r!==(r=e[25]+"")&&ue(a,r),(!d||C&20&&u!==(u=we.records.getFileUrl(e[2],e[25])))&&p(o,"href",u),(!d||C&18)&&ne(o,"txt-strikethrough",e[1].includes(e[24])),b===(b=v(e,C))&&y?y.p(e,C):(y.d(1),y=b(e),y&&(y.c(),y.m(t,null)))},i($){d||(A(s.$$.fragment,$),d=!0)},o($){L(s.$$.fragment,$),d=!1},d($){$&&k(t),j(s),y.d(),h=!1,g()}}}function mp(n){let e,t,i,s,l,o,r,a,u=n[22].name+"",f,c,d,h,g,v,b;i=new lM({props:{file:n[22]}});function y(){return n[15](n[24])}return{c(){e=_("div"),t=_("figure"),q(i.$$.fragment),s=D(),l=_("div"),o=_("small"),o.textContent="New",r=D(),a=_("span"),f=N(u),d=D(),h=_("button"),h.innerHTML='',p(t,"class","thumb"),p(o,"class","label label-success m-r-5"),p(a,"class","txt"),p(l,"class","filename"),p(l,"title",c=n[22].name),p(h,"type","button"),p(h,"class","btn btn-secondary btn-sm btn-circle btn-remove"),p(e,"class","list-item")},m($,C){w($,e,C),m(e,t),H(i,t,null),m(e,s),m(e,l),m(l,o),m(l,r),m(l,a),m(a,f),m(e,d),m(e,h),g=!0,v||(b=[We(yt.call(null,h,"Remove file")),J(h,"click",y)],v=!0)},p($,C){n=$;const S={};C&1&&(S.file=n[22]),i.$set(S),(!g||C&1)&&u!==(u=n[22].name+"")&&ue(f,u),(!g||C&1&&c!==(c=n[22].name))&&p(l,"title",c)},i($){g||(A(i.$$.fragment,$),g=!0)},o($){L(i.$$.fragment,$),g=!1},d($){$&&k(e),j(i),v=!1,Ye(b)}}}function gp(n){let e,t,i,s,l,o;return{c(){e=_("div"),t=_("input"),i=D(),s=_("button"),s.innerHTML=` - Upload new file`,p(t,"type","file"),p(t,"class","hidden"),t.multiple=n[5],p(s,"type","button"),p(s,"class","btn btn-secondary btn-sm btn-block"),p(e,"class","list-item btn-list-item")},m(r,a){w(r,e,a),m(e,t),n[16](t),m(e,i),m(e,s),l||(o=[J(t,"change",n[17]),J(s,"click",n[18])],l=!0)},p(r,a){a&32&&(t.multiple=r[5])},d(r){r&&k(e),n[16](null),l=!1,Ye(o)}}}function bM(n){let e,t,i,s,l,o=n[3].name+"",r,a,u,f,c=[],d=new Map,h,g,v,b=n[4];const y=M=>M[25];for(let M=0;ML(C[M],1,1,()=>{C[M]=null});let T=!n[8]&&gp(n);return{c(){e=_("label"),t=_("i"),s=D(),l=_("span"),r=N(o),u=D(),f=_("div");for(let M=0;M({21:i}),({uniqueId:i})=>i?2097152:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&8&&(l.class="form-field form-field-file "+(i[3].required?"required":"")),s&8&&(l.name=i[3].name),s&136315391&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function yM(n,e,t){let i,s,l,{record:o}=e,{value:r=""}=e,{uploadedFiles:a=[]}=e,{deletedFileIndexes:u=[]}=e,{field:f=new Dn}=e,c,d;function h(E){B.removeByValue(u,E),t(1,u)}function g(E){B.pushUnique(u,E),t(1,u)}function v(E){B.isEmpty(a[E])||a.splice(E,1),t(0,a)}function b(){d==null||d.dispatchEvent(new CustomEvent("change",{detail:{value:r,uploadedFiles:a,deletedFileIndexes:u},bubbles:!0}))}const y=E=>h(E),$=E=>g(E),C=E=>v(E);function S(E){me[E?"unshift":"push"](()=>{c=E,t(6,c)})}const T=()=>{for(let E of c.files)a.push(E);t(0,a),t(6,c.value=null,c)},M=()=>c==null?void 0:c.click();function O(E){me[E?"unshift":"push"](()=>{d=E,t(7,d)})}return n.$$set=E=>{"record"in E&&t(2,o=E.record),"value"in E&&t(12,r=E.value),"uploadedFiles"in E&&t(0,a=E.uploadedFiles),"deletedFileIndexes"in E&&t(1,u=E.deletedFileIndexes),"field"in E&&t(3,f=E.field)},n.$$.update=()=>{var E,P;n.$$.dirty&1&&(Array.isArray(a)||t(0,a=B.toArray(a))),n.$$.dirty&2&&(Array.isArray(u)||t(1,u=B.toArray(u))),n.$$.dirty&8&&t(5,i=((E=f.options)==null?void 0:E.maxSelect)>1),n.$$.dirty&4128&&B.isEmpty(r)&&t(12,r=i?[]:""),n.$$.dirty&4096&&t(4,s=B.toArray(r)),n.$$.dirty&27&&t(8,l=(s.length||a.length)&&((P=f.options)==null?void 0:P.maxSelect)<=s.length+a.length-u.length),n.$$.dirty&3&&(a!==-1||u!==-1)&&b()},[a,u,o,f,s,i,c,d,l,h,g,v,r,y,$,C,S,T,M,O]}class kM extends Ee{constructor(e){super(),Oe(this,e,yM,vM,De,{record:2,value:12,uploadedFiles:0,deletedFileIndexes:1,field:3})}}function _p(n){let e,t;return{c(){e=_("small"),t=N(n[1]),p(e,"class","block txt-hint txt-ellipsis")},m(i,s){w(i,e,s),m(e,t)},p(i,s){s&2&&ue(t,i[1])},d(i){i&&k(e)}}}function wM(n){let e,t,i,s,l,o=n[0].id+"",r,a,u,f,c=n[1]!==""&&n[1]!==n[0].id&&_p(n);return{c(){e=_("i"),i=D(),s=_("div"),l=_("div"),r=N(o),a=D(),c&&c.c(),p(e,"class","ri-information-line link-hint"),p(l,"class","block txt-ellipsis"),p(s,"class","content svelte-1gjwqyd")},m(d,h){w(d,e,h),w(d,i,h),w(d,s,h),m(s,l),m(l,r),m(s,a),c&&c.m(s,null),u||(f=We(t=yt.call(null,e,{text:JSON.stringify(n[0],null,2),position:"left",class:"code"})),u=!0)},p(d,[h]){t&&Jn(t.update)&&h&1&&t.update.call(null,{text:JSON.stringify(d[0],null,2),position:"left",class:"code"}),h&1&&o!==(o=d[0].id+"")&&ue(r,o),d[1]!==""&&d[1]!==d[0].id?c?c.p(d,h):(c=_p(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i:se,o:se,d(d){d&&k(e),d&&k(i),d&&k(s),c&&c.d(),u=!1,f()}}}function $M(n,e,t){let i;const s=["id","created","updated","@collectionId","@collectionName"];let{item:l={}}=e;function o(r){r=r||{};const a=["name","title","label","key","email","heading","content",...Object.keys(r)];for(const u of a)if(typeof r[u]=="string"&&!B.isEmpty(r[u])&&!s.includes(u))return u+": "+r[u];return""}return n.$$set=r=>{"item"in r&&t(0,l=r.item)},n.$$.update=()=>{n.$$.dirty&1&&t(1,i=o(l))},[l,i]}class SM extends Ee{constructor(e){super(),Oe(this,e,$M,wM,De,{item:0})}}function bp(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Load more',p(e,"type","button"),p(e,"class","btn btn-block btn-sm"),ne(e,"btn-loading",n[6]),ne(e,"btn-disabled",n[6])},m(s,l){w(s,e,l),t||(i=J(e,"click",ni(n[14])),t=!0)},p(s,l){l&64&&ne(e,"btn-loading",s[6]),l&64&&ne(e,"btn-disabled",s[6])},d(s){s&&k(e),t=!1,i()}}}function CM(n){let e,t=n[7]&&bp(n);return{c(){t&&t.c(),e=Ue()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[7]?t?t.p(i,s):(t=bp(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function MM(n){let e,t,i,s;const l=[{selectPlaceholder:n[8]?"Loading...":n[3]},{items:n[5]},{searchable:n[5].length>5},{selectionKey:"id"},{labelComponent:n[4]},{optionComponent:n[4]},{multiple:n[2]},{class:"records-select block-options"},n[10]];function o(u){n[15](u)}function r(u){n[16](u)}let a={$$slots:{afterOptions:[CM]},$$scope:{ctx:n}};for(let u=0;uRe(e,"keyOfSelected",o)),me.push(()=>Re(e,"selected",r)),e.$on("show",n[17]),e.$on("hide",n[18]),{c(){q(e.$$.fragment)},m(u,f){H(e,u,f),s=!0},p(u,[f]){const c=f&1340?hn(l,[f&264&&{selectPlaceholder:u[8]?"Loading...":u[3]},f&32&&{items:u[5]},f&32&&{searchable:u[5].length>5},l[3],f&16&&{labelComponent:u[4]},f&16&&{optionComponent:u[4]},f&4&&{multiple:u[2]},l[7],f&1024&&oi(u[10])]):{};f&4194496&&(c.$$scope={dirty:f,ctx:u}),!t&&f&2&&(t=!0,c.keyOfSelected=u[1],He(()=>t=!1)),!i&&f&1&&(i=!0,c.selected=u[0],He(()=>i=!1)),e.$set(c)},i(u){s||(A(e.$$.fragment,u),s=!0)},o(u){L(e.$$.fragment,u),s=!1},d(u){j(e,u)}}}function TM(n,e,t){let i,s;const l=["multiple","selected","keyOfSelected","selectPlaceholder","optionComponent","collectionId"];let o=Bt(e,l);const r="select_"+B.randomString(5);let{multiple:a=!1}=e,{selected:u=[]}=e,{keyOfSelected:f=a?[]:void 0}=e,{selectPlaceholder:c="- Select -"}=e,{optionComponent:d=SM}=e,{collectionId:h}=e,g=[],v=1,b=0,y=!1,$=!1;async function C(){const I=B.toArray(f);if(!(!h||!I.length)){t(13,$=!0);try{const F=[];for(const X of I)F.push(`id="${X}"`);const V=await we.records.getFullList(h,200,{filter:F.join("||"),$cancelKey:r+"loadSelected"});t(0,u=[]);for(const X of I){const te=B.findByKey(V,"id",X);te&&u.push(te)}t(5,g=B.filterDuplicatesByKey(u.concat(g)))}catch(F){we.errorResponseHandler(F)}t(13,$=!1)}}async function S(I=!1){if(!!h){t(6,y=!0);try{const F=I?1:v+1,V=await we.records.getList(h,F,200,{sort:"-created",$cancelKey:r+"loadList"});I&&t(5,g=B.toArray(u).slice()),t(5,g=B.filterDuplicatesByKey(g.concat(V.items,B.toArray(u)))),v=V.page,t(12,b=V.totalItems)}catch(F){we.errorResponseHandler(F)}t(6,y=!1)}}const T=()=>S();function M(I){f=I,t(1,f)}function O(I){u=I,t(0,u)}function E(I){xe.call(this,n,I)}function P(I){xe.call(this,n,I)}return n.$$set=I=>{e=at(at({},e),li(I)),t(10,o=Bt(e,l)),"multiple"in I&&t(2,a=I.multiple),"selected"in I&&t(0,u=I.selected),"keyOfSelected"in I&&t(1,f=I.keyOfSelected),"selectPlaceholder"in I&&t(3,c=I.selectPlaceholder),"optionComponent"in I&&t(4,d=I.optionComponent),"collectionId"in I&&t(11,h=I.collectionId)},n.$$.update=()=>{n.$$.dirty&2048&&h&&C().then(()=>{S(!0)}),n.$$.dirty&8256&&t(8,i=y||$),n.$$.dirty&4128&&t(7,s=b>g.length)},[u,f,a,c,d,g,y,s,i,S,o,h,b,$,T,M,O,E,P]}class DM extends Ee{constructor(e){super(),Oe(this,e,TM,MM,De,{multiple:2,selected:0,keyOfSelected:1,selectPlaceholder:3,optionComponent:4,collectionId:11})}}function vp(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=_("div"),t=N("Select up to "),s=N(i),l=N(" items."),p(e,"class","help-block")},m(o,r){w(o,e,r),m(e,t),m(e,s),m(e,l)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&ue(s,i)},d(o){o&&k(e)}}}function OM(n){var $,C;let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,g;function v(S){n[3](S)}let b={toggle:!0,id:n[4],multiple:n[2],collectionId:($=n[1].options)==null?void 0:$.collectionId};n[0]!==void 0&&(b.keyOfSelected=n[0]),f=new DM({props:b}),me.push(()=>Re(f,"keyOfSelected",v));let y=((C=n[1].options)==null?void 0:C.maxSelect)>1&&vp(n);return{c(){e=_("label"),t=_("i"),s=D(),l=_("span"),r=N(o),u=D(),q(f.$$.fragment),d=D(),y&&y.c(),h=Ue(),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[4])},m(S,T){w(S,e,T),m(e,t),m(e,s),m(e,l),m(l,r),w(S,u,T),H(f,S,T),w(S,d,T),y&&y.m(S,T),w(S,h,T),g=!0},p(S,T){var O,E;(!g||T&2&&i!==(i=B.getFieldTypeIcon(S[1].type)))&&p(t,"class",i),(!g||T&2)&&o!==(o=S[1].name+"")&&ue(r,o),(!g||T&16&&a!==(a=S[4]))&&p(e,"for",a);const M={};T&16&&(M.id=S[4]),T&4&&(M.multiple=S[2]),T&2&&(M.collectionId=(O=S[1].options)==null?void 0:O.collectionId),!c&&T&1&&(c=!0,M.keyOfSelected=S[0],He(()=>c=!1)),f.$set(M),((E=S[1].options)==null?void 0:E.maxSelect)>1?y?y.p(S,T):(y=vp(S),y.c(),y.m(h.parentNode,h)):y&&(y.d(1),y=null)},i(S){g||(A(f.$$.fragment,S),g=!0)},o(S){L(f.$$.fragment,S),g=!1},d(S){S&&k(e),S&&k(u),j(f,S),S&&k(d),y&&y.d(S),S&&k(h)}}}function EM(n){let e,t;return e=new Ne({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[OM,({uniqueId:i})=>({4:i}),({uniqueId:i})=>i?16:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&2&&(l.class="form-field "+(i[1].required?"required":"")),s&2&&(l.name=i[1].name),s&55&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function AM(n,e,t){let i,{field:s=new Dn}=e,{value:l=void 0}=e;function o(r){l=r,t(0,l),t(2,i),t(1,s)}return n.$$set=r=>{"field"in r&&t(1,s=r.field),"value"in r&&t(0,l=r.value)},n.$$.update=()=>{var r;n.$$.dirty&2&&t(2,i=((r=s.options)==null?void 0:r.maxSelect)>1),n.$$.dirty&7&&i&&Array.isArray(l)&&l.length>s.options.maxSelect&&t(0,l=l.slice(s.options.maxSelect-1))},[l,s,i,o]}class PM extends Ee{constructor(e){super(),Oe(this,e,AM,EM,De,{field:1,value:0})}}function yp(n){let e,t=n[0].email+"",i;return{c(){e=_("small"),i=N(t),p(e,"class","block txt-hint txt-ellipsis")},m(s,l){w(s,e,l),m(e,i)},p(s,l){l&1&&t!==(t=s[0].email+"")&&ue(i,t)},d(s){s&&k(e)}}}function LM(n){let e,t,i,s,l,o=n[0].id+"",r,a,u,f,c=n[0].email&&yp(n);return{c(){e=_("i"),i=D(),s=_("div"),l=_("div"),r=N(o),a=D(),c&&c.c(),p(e,"class","ri-information-line link-hint"),p(l,"class","block txt-ellipsis"),p(s,"class","content")},m(d,h){w(d,e,h),w(d,i,h),w(d,s,h),m(s,l),m(l,r),m(s,a),c&&c.m(s,null),u||(f=We(t=yt.call(null,e,{text:JSON.stringify(n[0],null,2),position:"left",class:"code"})),u=!0)},p(d,[h]){t&&Jn(t.update)&&h&1&&t.update.call(null,{text:JSON.stringify(d[0],null,2),position:"left",class:"code"}),h&1&&o!==(o=d[0].id+"")&&ue(r,o),d[0].email?c?c.p(d,h):(c=yp(d),c.c(),c.m(s,null)):c&&(c.d(1),c=null)},i:se,o:se,d(d){d&&k(e),d&&k(i),d&&k(s),c&&c.d(),u=!1,f()}}}function IM(n,e,t){let{item:i={}}=e;return n.$$set=s=>{"item"in s&&t(0,i=s.item)},[i]}class ma extends Ee{constructor(e){super(),Oe(this,e,IM,LM,De,{item:0})}}function kp(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Load more',p(e,"type","button"),p(e,"class","btn btn-block btn-sm"),ne(e,"btn-loading",n[6]),ne(e,"btn-disabled",n[6])},m(s,l){w(s,e,l),t||(i=J(e,"click",ni(n[13])),t=!0)},p(s,l){l&64&&ne(e,"btn-loading",s[6]),l&64&&ne(e,"btn-disabled",s[6])},d(s){s&&k(e),t=!1,i()}}}function NM(n){let e,t=n[7]&&kp(n);return{c(){t&&t.c(),e=Ue()},m(i,s){t&&t.m(i,s),w(i,e,s)},p(i,s){i[7]?t?t.p(i,s):(t=kp(i),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(i){t&&t.d(i),i&&k(e)}}}function FM(n){let e,t,i,s;const l=[{selectPlaceholder:n[8]?"Loading...":n[3]},{items:n[5]},{searchable:n[5].length>5},{selectionKey:"id"},{labelComponent:ma},{optionComponent:n[4]},{multiple:n[2]},{class:"users-select block-options"},n[10]];function o(u){n[14](u)}function r(u){n[15](u)}let a={$$slots:{afterOptions:[NM]},$$scope:{ctx:n}};for(let u=0;uRe(e,"keyOfSelected",o)),me.push(()=>Re(e,"selected",r)),e.$on("show",n[16]),e.$on("hide",n[17]),{c(){q(e.$$.fragment)},m(u,f){H(e,u,f),s=!0},p(u,[f]){const c=f&1340?hn(l,[f&264&&{selectPlaceholder:u[8]?"Loading...":u[3]},f&32&&{items:u[5]},f&32&&{searchable:u[5].length>5},l[3],f&0&&{labelComponent:ma},f&16&&{optionComponent:u[4]},f&4&&{multiple:u[2]},l[7],f&1024&&oi(u[10])]):{};f&2097344&&(c.$$scope={dirty:f,ctx:u}),!t&&f&2&&(t=!0,c.keyOfSelected=u[1],He(()=>t=!1)),!i&&f&1&&(i=!0,c.selected=u[0],He(()=>i=!1)),e.$set(c)},i(u){s||(A(e.$$.fragment,u),s=!0)},o(u){L(e.$$.fragment,u),s=!1},d(u){j(e,u)}}}function RM(n,e,t){let i,s;const l=["multiple","selected","keyOfSelected","selectPlaceholder","optionComponent"];let o=Bt(e,l);const r="select_"+B.randomString(5);let{multiple:a=!1}=e,{selected:u=a?[]:void 0}=e,{keyOfSelected:f=a?[]:void 0}=e,{selectPlaceholder:c="- Select -"}=e,{optionComponent:d=ma}=e,h=[],g=1,v=0,b=!1,y=!1;C(!0).then(()=>{$()});async function $(){const P=B.toArray(f);if(!!P.length){t(12,y=!0);try{const I=[];for(const V of P)I.push(`id="${V}"`);const F=await we.users.getFullList(100,{filter:I.join("||"),$cancelKey:r+"loadSelected"});t(0,u=[]);for(const V of P){const X=B.findByKey(F,"id",V);X&&u.push(X)}t(5,h=B.filterDuplicatesByKey(u.concat(h)))}catch(I){we.errorResponseHandler(I)}t(12,y=!1)}}async function C(P=!1){t(6,b=!0);try{const I=P?1:g+1,F=await we.users.getList(I,200,{sort:"-created",$cancelKey:r+"loadList"});P&&t(5,h=B.toArray(u).slice()),t(5,h=B.filterDuplicatesByKey(h.concat(F.items,B.toArray(u)))),g=F.page,t(11,v=F.totalItems)}catch(I){we.errorResponseHandler(I)}t(6,b=!1)}const S=()=>C();function T(P){f=P,t(1,f)}function M(P){u=P,t(0,u)}function O(P){xe.call(this,n,P)}function E(P){xe.call(this,n,P)}return n.$$set=P=>{e=at(at({},e),li(P)),t(10,o=Bt(e,l)),"multiple"in P&&t(2,a=P.multiple),"selected"in P&&t(0,u=P.selected),"keyOfSelected"in P&&t(1,f=P.keyOfSelected),"selectPlaceholder"in P&&t(3,c=P.selectPlaceholder),"optionComponent"in P&&t(4,d=P.optionComponent)},n.$$.update=()=>{n.$$.dirty&4160&&t(8,i=b||y),n.$$.dirty&2080&&t(7,s=v>h.length)},[u,f,a,c,d,h,b,s,i,C,o,v,y,S,T,M,O,E]}class HM extends Ee{constructor(e){super(),Oe(this,e,RM,FM,De,{multiple:2,selected:0,keyOfSelected:1,selectPlaceholder:3,optionComponent:4})}}function wp(n){let e,t,i=n[1].options.maxSelect+"",s,l;return{c(){e=_("div"),t=N("Select up to "),s=N(i),l=N(" users."),p(e,"class","help-block")},m(o,r){w(o,e,r),m(e,t),m(e,s),m(e,l)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&ue(s,i)},d(o){o&&k(e)}}}function jM(n){var $;let e,t,i,s,l,o=n[1].name+"",r,a,u,f,c,d,h,g;function v(C){n[4](C)}let b={toggle:!0,id:n[5],multiple:n[2],disabled:n[3]};n[0]!==void 0&&(b.keyOfSelected=n[0]),f=new HM({props:b}),me.push(()=>Re(f,"keyOfSelected",v));let y=(($=n[1].options)==null?void 0:$.maxSelect)>1&&wp(n);return{c(){e=_("label"),t=_("i"),s=D(),l=_("span"),r=N(o),u=D(),q(f.$$.fragment),d=D(),y&&y.c(),h=Ue(),p(t,"class",i=B.getFieldTypeIcon(n[1].type)),p(l,"class","txt"),p(e,"for",a=n[5])},m(C,S){w(C,e,S),m(e,t),m(e,s),m(e,l),m(l,r),w(C,u,S),H(f,C,S),w(C,d,S),y&&y.m(C,S),w(C,h,S),g=!0},p(C,S){var M;(!g||S&2&&i!==(i=B.getFieldTypeIcon(C[1].type)))&&p(t,"class",i),(!g||S&2)&&o!==(o=C[1].name+"")&&ue(r,o),(!g||S&32&&a!==(a=C[5]))&&p(e,"for",a);const T={};S&32&&(T.id=C[5]),S&4&&(T.multiple=C[2]),S&8&&(T.disabled=C[3]),!c&&S&1&&(c=!0,T.keyOfSelected=C[0],He(()=>c=!1)),f.$set(T),((M=C[1].options)==null?void 0:M.maxSelect)>1?y?y.p(C,S):(y=wp(C),y.c(),y.m(h.parentNode,h)):y&&(y.d(1),y=null)},i(C){g||(A(f.$$.fragment,C),g=!0)},o(C){L(f.$$.fragment,C),g=!1},d(C){C&&k(e),C&&k(u),j(f,C),C&&k(d),y&&y.d(C),C&&k(h)}}}function qM(n){let e,t;return e=new Ne({props:{class:"form-field "+(n[1].required?"required":"")+" "+(n[3]?"disabled":""),name:n[1].name,$$slots:{default:[jM,({uniqueId:i})=>({5:i}),({uniqueId:i})=>i?32:0]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,[s]){const l={};s&10&&(l.class="form-field "+(i[1].required?"required":"")+" "+(i[3]?"disabled":"")),s&2&&(l.name=i[1].name),s&111&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function VM(n,e,t){let i,s,{field:l=new Dn}=e,{value:o=void 0}=e;function r(a){o=a,t(0,o),t(2,s),t(1,l)}return n.$$set=a=>{"field"in a&&t(1,l=a.field),"value"in a&&t(0,o=a.value)},n.$$.update=()=>{var a;n.$$.dirty&2&&t(2,s=((a=l.options)==null?void 0:a.maxSelect)>1),n.$$.dirty&7&&s&&Array.isArray(o)&&o.length>l.options.maxSelect&&t(0,o=o.slice(l.options.maxSelect-1)),n.$$.dirty&3&&t(3,i=!B.isEmpty(o)&&l.system)},[o,l,s,i,r]}class zM extends Ee{constructor(e){super(),Oe(this,e,VM,qM,De,{field:1,value:0})}}function $p(n,e,t){const i=n.slice();return i[40]=e[t],i[41]=e,i[42]=t,i}function Sp(n){let e,t;return e=new Ne({props:{class:"form-field disabled",name:"id",$$slots:{default:[BM,({uniqueId:i})=>({43:i}),({uniqueId:i})=>[0,i?4096:0]]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,s){const l={};s[0]&4|s[1]&12288&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function BM(n){let e,t,i,s,l,o,r,a,u,f,c;return{c(){e=_("label"),t=_("i"),i=D(),s=_("span"),s.textContent="id",l=D(),o=_("span"),a=D(),u=_("input"),p(t,"class",B.getFieldTypeIcon("primary")),p(s,"class","txt"),p(o,"class","flex-fill"),p(e,"for",r=n[43]),p(u,"type","text"),p(u,"id",f=n[43]),u.value=c=n[2].id,u.disabled=!0},m(d,h){w(d,e,h),m(e,t),m(e,i),m(e,s),m(e,l),m(e,o),w(d,a,h),w(d,u,h)},p(d,h){h[1]&4096&&r!==(r=d[43])&&p(e,"for",r),h[1]&4096&&f!==(f=d[43])&&p(u,"id",f),h[0]&4&&c!==(c=d[2].id)&&u.value!==c&&(u.value=c)},d(d){d&&k(e),d&&k(a),d&&k(u)}}}function Cp(n){let e;return{c(){e=_("div"),e.innerHTML=`
    No custom fields to be set
    - `,p(e,"class","block txt-center txt-disabled")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function UM(n){let e,t,i;function s(o){n[31](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new zM({props:l}),me.push(()=>Re(e,"value",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function WM(n){let e,t,i;function s(o){n[30](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new PM({props:l}),me.push(()=>Re(e,"value",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function YM(n){let e,t,i,s,l;function o(f){n[27](f,n[40])}function r(f){n[28](f,n[40])}function a(f){n[29](f,n[40])}let u={field:n[40],record:n[2]};return n[2][n[40].name]!==void 0&&(u.value=n[2][n[40].name]),n[3][n[40].name]!==void 0&&(u.uploadedFiles=n[3][n[40].name]),n[4][n[40].name]!==void 0&&(u.deletedFileIndexes=n[4][n[40].name]),e=new kM({props:u}),me.push(()=>Re(e,"value",o)),me.push(()=>Re(e,"uploadedFiles",r)),me.push(()=>Re(e,"deletedFileIndexes",a)),{c(){q(e.$$.fragment)},m(f,c){H(e,f,c),l=!0},p(f,c){n=f;const d={};c[0]&1&&(d.field=n[40]),c[0]&4&&(d.record=n[2]),!t&&c[0]&5&&(t=!0,d.value=n[2][n[40].name],He(()=>t=!1)),!i&&c[0]&9&&(i=!0,d.uploadedFiles=n[3][n[40].name],He(()=>i=!1)),!s&&c[0]&17&&(s=!0,d.deletedFileIndexes=n[4][n[40].name],He(()=>s=!1)),e.$set(d)},i(f){l||(A(e.$$.fragment,f),l=!0)},o(f){L(e.$$.fragment,f),l=!1},d(f){j(e,f)}}}function KM(n){let e,t,i;function s(o){n[26](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new eM({props:l}),me.push(()=>Re(e,"value",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function JM(n){let e,t,i;function s(o){n[25](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new G4({props:l}),me.push(()=>Re(e,"value",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function ZM(n){let e,t,i;function s(o){n[24](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new Y4({props:l}),me.push(()=>Re(e,"value",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function GM(n){let e,t,i;function s(o){n[23](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new z4({props:l}),me.push(()=>Re(e,"value",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function XM(n){let e,t,i;function s(o){n[22](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new H4({props:l}),me.push(()=>Re(e,"value",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function QM(n){let e,t,i;function s(o){n[21](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new I4({props:l}),me.push(()=>Re(e,"value",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function xM(n){let e,t,i;function s(o){n[20](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new E4({props:l}),me.push(()=>Re(e,"value",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function eT(n){let e,t,i;function s(o){n[19](o,n[40])}let l={field:n[40]};return n[2][n[40].name]!==void 0&&(l.value=n[2][n[40].name]),e=new M4({props:l}),me.push(()=>Re(e,"value",s)),{c(){q(e.$$.fragment)},m(o,r){H(e,o,r),i=!0},p(o,r){n=o;const a={};r[0]&1&&(a.field=n[40]),!t&&r[0]&5&&(t=!0,a.value=n[2][n[40].name],He(()=>t=!1)),e.$set(a)},i(o){i||(A(e.$$.fragment,o),i=!0)},o(o){L(e.$$.fragment,o),i=!1},d(o){j(e,o)}}}function Mp(n,e){let t,i,s,l,o;const r=[eT,xM,QM,XM,GM,ZM,JM,KM,YM,WM,UM],a=[];function u(f,c){return f[40].type==="text"?0:f[40].type==="number"?1:f[40].type==="bool"?2:f[40].type==="email"?3:f[40].type==="url"?4:f[40].type==="date"?5:f[40].type==="select"?6:f[40].type==="json"?7:f[40].type==="file"?8:f[40].type==="relation"?9:f[40].type==="user"?10:-1}return~(i=u(e))&&(s=a[i]=r[i](e)),{key:n,first:null,c(){t=Ue(),s&&s.c(),l=Ue(),this.first=t},m(f,c){w(f,t,c),~i&&a[i].m(f,c),w(f,l,c),o=!0},p(f,c){e=f;let d=i;i=u(e),i===d?~i&&a[i].p(e,c):(s&&(Ae(),L(a[d],1,1,()=>{a[d]=null}),Pe()),~i?(s=a[i],s?s.p(e,c):(s=a[i]=r[i](e),s.c()),A(s,1),s.m(l.parentNode,l)):s=null)},i(f){o||(A(s),o=!0)},o(f){L(s),o=!1},d(f){f&&k(t),~i&&a[i].d(f),f&&k(l)}}}function tT(n){var d;let e,t,i=[],s=new Map,l,o,r,a=!n[2].isNew&&Sp(n),u=((d=n[0])==null?void 0:d.schema)||[];const f=h=>h[40].name;for(let h=0;h{a=null}),Pe()):a?(a.p(h,g),g[0]&4&&A(a,1)):(a=Sp(h),a.c(),A(a,1),a.m(e,t)),g[0]&29&&(u=((v=h[0])==null?void 0:v.schema)||[],Ae(),i=ct(i,g,f,1,h,u,s,e,Ut,Mp,null,$p),Pe(),!u.length&&c?c.p(h,g):u.length?c&&(c.d(1),c=null):(c=Cp(),c.c(),c.m(e,null)))},i(h){if(!l){A(a);for(let g=0;g - Delete`,p(e,"tabindex","0"),p(e,"class","dropdown-item closable")},m(s,l){w(s,e,l),t||(i=J(e,"click",n[18]),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function iT(n){let e,t=n[2].isNew?"New":"Edit",i,s,l=n[0].name+"",o,r,a,u,f,c=!n[2].isNew&&n[10]&&Tp(n);return{c(){e=_("h4"),i=N(t),s=D(),o=N(l),r=N(" record"),a=D(),c&&c.c(),u=Ue()},m(d,h){w(d,e,h),m(e,i),m(e,s),m(e,o),m(e,r),w(d,a,h),c&&c.m(d,h),w(d,u,h),f=!0},p(d,h){(!f||h[0]&4)&&t!==(t=d[2].isNew?"New":"Edit")&&ue(i,t),(!f||h[0]&1)&&l!==(l=d[0].name+"")&&ue(o,l),!d[2].isNew&&d[10]?c?(c.p(d,h),h[0]&1028&&A(c,1)):(c=Tp(d),c.c(),A(c,1),c.m(u.parentNode,u)):c&&(Ae(),L(c,1,1,()=>{c=null}),Pe())},i(d){f||(A(c),f=!0)},o(d){L(c),f=!1},d(d){d&&k(e),d&&k(a),c&&c.d(d),d&&k(u)}}}function sT(n){let e,t,i,s,l,o=n[2].isNew?"Create":"Save changes",r,a,u,f;return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=D(),s=_("button"),l=_("span"),r=N(o),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[7],p(l,"class","txt"),p(s,"type","submit"),p(s,"form",n[11]),p(s,"class","btn btn-expanded"),s.disabled=a=!n[9]||n[7],ne(s,"btn-loading",n[7])},m(c,d){w(c,e,d),m(e,t),w(c,i,d),w(c,s,d),m(s,l),m(l,r),u||(f=J(e,"click",n[17]),u=!0)},p(c,d){d[0]&128&&(e.disabled=c[7]),d[0]&4&&o!==(o=c[2].isNew?"Create":"Save changes")&&ue(r,o),d[0]&640&&a!==(a=!c[9]||c[7])&&(s.disabled=a),d[0]&128&&ne(s,"btn-loading",c[7])},d(c){c&&k(e),c&&k(i),c&&k(s),u=!1,f()}}}function lT(n){let e,t,i={class:"overlay-panel-lg record-panel",beforeHide:n[32],$$slots:{footer:[sT],header:[iT],default:[tT]},$$scope:{ctx:n}};return e=new ui({props:i}),n[33](e),e.$on("hide",n[34]),e.$on("show",n[35]),{c(){q(e.$$.fragment)},m(s,l){H(e,s,l),t=!0},p(s,l){const o={};l[0]&288&&(o.beforeHide=s[32]),l[0]&1693|l[1]&8192&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){L(e.$$.fragment,s),t=!1},d(s){n[33](null),j(e,s)}}}function Dp(n){return JSON.stringify(n)}function oT(n,e,t){let i,s,l,o;const r=Qt(),a="record_"+B.randomString(5);let{collection:u}=e,f,c=null,d=new bo,h=!1,g=!1,v={},b={},y="";function $(oe){return S(oe),t(8,g=!0),f==null?void 0:f.show()}function C(){return f==null?void 0:f.hide()}async function S(oe){ri({}),c=oe||{},t(2,d=oe!=null&&oe.clone?oe.clone():new bo),t(3,v={}),t(4,b={}),await Zn(),t(15,y=Dp(d))}function T(){if(h||!l)return;t(7,h=!0);const oe=O();let W;d.isNew?W=we.records.create(u==null?void 0:u.id,oe):W=we.records.update(u==null?void 0:u.id,d.id,oe),W.then(async ce=>{sn(d.isNew?"Successfully created record.":"Successfully updated record."),t(8,g=!1),C(),r("save",ce)}).catch(ce=>{we.errorResponseHandler(ce)}).finally(()=>{t(7,h=!1)})}function M(){!(c!=null&&c.id)||si("Do you really want to delete the selected record?",()=>we.records.delete(c["@collectionId"],c.id).then(()=>{C(),sn("Successfully deleted record."),r("delete",c)}).catch(oe=>{we.errorResponseHandler(oe)}))}function O(){const oe=(d==null?void 0:d.export())||{},W=new FormData,ce={};for(const ae of(u==null?void 0:u.schema)||[])ce[ae.name]=ae;for(const ae in oe)!ce[ae]||(typeof oe[ae]>"u"&&(oe[ae]=null),B.addValueToFormData(W,ae,oe[ae]));for(const ae in v){const Se=B.toArray(v[ae]);for(const Q of Se)W.append(ae,Q)}for(const ae in b){const Se=B.toArray(b[ae]);for(const Q of Se)W.append(ae+"."+Q,"")}return W}const E=()=>C(),P=()=>M();function I(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}function F(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}function V(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}function X(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}function te(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}function Z(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}function ee(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}function U(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}function Y(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}function G(oe,W){n.$$.not_equal(v[W.name],oe)&&(v[W.name]=oe,t(3,v))}function de(oe,W){n.$$.not_equal(b[W.name],oe)&&(b[W.name]=oe,t(4,b))}function x(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}function ve(oe,W){n.$$.not_equal(d[W.name],oe)&&(d[W.name]=oe,t(2,d))}const _e=()=>s&&g?(si("You have unsaved changes. Do you really want to close the panel?",()=>{t(8,g=!1),C()}),!1):!0;function ge(oe){me[oe?"unshift":"push"](()=>{f=oe,t(6,f)})}function K(oe){xe.call(this,n,oe)}function ye(oe){xe.call(this,n,oe)}return n.$$set=oe=>{"collection"in oe&&t(0,u=oe.collection)},n.$$.update=()=>{n.$$.dirty[0]&24&&t(16,i=B.hasNonEmptyProps(v)||B.hasNonEmptyProps(b)),n.$$.dirty[0]&98308&&t(5,s=i||y!=Dp(d)),n.$$.dirty[0]&36&&t(9,l=d.isNew||s),n.$$.dirty[0]&1&&t(10,o=(u==null?void 0:u.name)!=="profiles")},[u,C,d,v,b,s,f,h,g,l,o,a,T,M,$,y,i,E,P,I,F,V,X,te,Z,ee,U,Y,G,de,x,ve,_e,ge,K,ye]}class pb extends Ee{constructor(e){super(),Oe(this,e,oT,lT,De,{collection:0,show:14,hide:1},null,[-1,-1])}get show(){return this.$$.ctx[14]}get hide(){return this.$$.ctx[1]}}function rT(n){let e;return{c(){e=_("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function aT(n){let e,t;return{c(){e=_("span"),t=N(n[1]),p(e,"class","label txt-base txt-mono"),p(e,"title",n[0])},m(i,s){w(i,e,s),m(e,t)},p(i,s){s&2&&ue(t,i[1]),s&1&&p(e,"title",i[0])},d(i){i&&k(e)}}}function uT(n){let e;function t(l,o){return l[0]?aT:rT}let i=t(n),s=i(n);return{c(){s.c(),e=Ue()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:se,o:se,d(l){s.d(l),l&&k(e)}}}function fT(n,e,t){let{id:i=""}=e,s=i;return n.$$set=l=>{"id"in l&&t(0,i=l.id)},n.$$.update=()=>{n.$$.dirty&1&&typeof i=="string"&&i.length>27&&t(1,s=i.substring(0,5)+"..."+i.substring(i.length-10))},[i,s]}class lr extends Ee{constructor(e){super(),Oe(this,e,fT,uT,De,{id:0})}}function Op(n,e,t){const i=n.slice();return i[7]=e[t],i[5]=t,i}function Ep(n,e,t){const i=n.slice();return i[3]=e[t],i[5]=t,i}function Ap(n,e,t){const i=n.slice();return i[3]=e[t],i[5]=t,i}function cT(n){let e,t=ks(n[0][n[1].name])+"",i,s;return{c(){e=_("span"),i=N(t),p(e,"class","txt txt-ellipsis"),p(e,"title",s=ks(n[0][n[1].name]))},m(l,o){w(l,e,o),m(e,i)},p(l,o){o&3&&t!==(t=ks(l[0][l[1].name])+"")&&ue(i,t),o&3&&s!==(s=ks(l[0][l[1].name]))&&p(e,"title",s)},i:se,o:se,d(l){l&&k(e)}}}function dT(n){let e,t=[],i=new Map,s,l=B.toArray(n[0][n[1].name]);const o=r=>r[5]+r[7];for(let r=0;rr[5]+r[3];for(let r=0;ro[5]+o[3];for(let o=0;o{a[d]=null}),Pe(),s=a[i],s?s.p(f,c):(s=a[i]=r[i](f),s.c()),A(s,1),s.m(e,null)),(!o||c&2&&l!==(l="col-type-"+f[1].type+" col-field-"+f[1].name))&&p(e,"class",l)},i(f){o||(A(s),o=!0)},o(f){L(s),o=!1},d(f){f&&k(e),a[i].d()}}}function ks(n){return n=n||"",n.length>200?n.substring(0,200):n}function kT(n,e,t){let{record:i}=e,{field:s}=e;function l(o){xe.call(this,n,o)}return n.$$set=o=>{"record"in o&&t(0,i=o.record),"field"in o&&t(1,s=o.field)},[i,s,l]}class hb extends Ee{constructor(e){super(),Oe(this,e,kT,yT,De,{record:0,field:1})}}function Np(n,e,t){const i=n.slice();return i[36]=e[t],i}function Fp(n,e,t){const i=n.slice();return i[39]=e[t],i}function Rp(n,e,t){const i=n.slice();return i[39]=e[t],i}function wT(n){let e,t,i,s,l,o,r;return{c(){e=_("div"),t=_("input"),s=D(),l=_("label"),p(t,"type","checkbox"),p(t,"id","checkbox_0"),t.disabled=i=!n[3].length,t.checked=n[10],p(l,"for","checkbox_0"),p(e,"class","form-field")},m(a,u){w(a,e,u),m(e,t),m(e,s),m(e,l),o||(r=J(t,"change",n[21]),o=!0)},p(a,u){u[0]&8&&i!==(i=!a[3].length)&&(t.disabled=i),u[0]&1024&&(t.checked=a[10])},d(a){a&&k(e),o=!1,r()}}}function $T(n){let e;return{c(){e=_("span"),p(e,"class","loader loader-sm")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function ST(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="id",p(t,"class",B.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function CT(n){let e,t,i,s,l,o=n[39].name+"",r;return{c(){e=_("div"),t=_("i"),s=D(),l=_("span"),r=N(o),p(t,"class",i=B.getFieldTypeIcon(n[39].type)),p(l,"class","txt"),p(e,"class","col-header-content")},m(a,u){w(a,e,u),m(e,t),m(e,s),m(e,l),m(l,r)},p(a,u){u[0]&4096&&i!==(i=B.getFieldTypeIcon(a[39].type))&&p(t,"class",i),u[0]&4096&&o!==(o=a[39].name+"")&&ue(r,o)},d(a){a&&k(e)}}}function Hp(n,e){let t,i,s,l;function o(a){e[23](a)}let r={class:"col-type-"+e[39].type+" col-field-"+e[39].name,name:e[39].name,$$slots:{default:[CT]},$$scope:{ctx:e}};return e[0]!==void 0&&(r.sort=e[0]),i=new an({props:r}),me.push(()=>Re(i,"sort",o)),{key:n,first:null,c(){t=Ue(),q(i.$$.fragment),this.first=t},m(a,u){w(a,t,u),H(i,a,u),l=!0},p(a,u){e=a;const f={};u[0]&4096&&(f.class="col-type-"+e[39].type+" col-field-"+e[39].name),u[0]&4096&&(f.name=e[39].name),u[0]&4096|u[1]&8192&&(f.$$scope={dirty:u,ctx:e}),!s&&u[0]&1&&(s=!0,f.sort=e[0],He(()=>s=!1)),i.$set(f)},i(a){l||(A(i.$$.fragment,a),l=!0)},o(a){L(i.$$.fragment,a),l=!1},d(a){a&&k(t),j(i,a)}}}function MT(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="created",p(t,"class",B.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function TT(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="updated",p(t,"class",B.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function jp(n){let e;function t(l,o){return l[8]?OT:DT}let i=t(n),s=i(n);return{c(){s.c(),e=Ue()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function DT(n){var r;let e,t,i,s,l,o=((r=n[1])==null?void 0:r.length)&&qp(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No records found.",s=D(),o&&o.c(),l=D(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),m(e,t),m(t,i),m(t,s),o&&o.m(t,null),m(e,l)},p(a,u){var f;(f=a[1])!=null&&f.length?o?o.p(a,u):(o=qp(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function OT(n){let e;return{c(){e=_("tr"),e.innerHTML=` - `},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function qp(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=J(e,"click",n[29]),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function Vp(n,e){let t,i,s;return i=new hb({props:{record:e[36],field:e[39]}}),{key:n,first:null,c(){t=Ue(),q(i.$$.fragment),this.first=t},m(l,o){w(l,t,o),H(i,l,o),s=!0},p(l,o){e=l;const r={};o[0]&8&&(r.record=e[36]),o[0]&4096&&(r.field=e[39]),i.$set(r)},i(l){s||(A(i.$$.fragment,l),s=!0)},o(l){L(i.$$.fragment,l),s=!1},d(l){l&&k(t),j(i,l)}}}function zp(n,e){let t,i,s,l,o,r,a,u,f,c,d,h,g,v=[],b=new Map,y,$,C,S,T,M,O,E,P,I,F,V;function X(){return e[26](e[36])}h=new lr({props:{id:e[36].id}});let te=e[12];const Z=Y=>Y[39].name;for(let Y=0;Y',P=D(),p(l,"type","checkbox"),p(l,"id",o="checkbox_"+e[36].id),l.checked=r=e[5][e[36].id],p(u,"for",f="checkbox_"+e[36].id),p(s,"class","form-field"),p(i,"class","bulk-select-col min-width"),p(d,"class","col-type-text col-field-id"),p($,"class","col-type-date col-field-created"),p(T,"class","col-type-date col-field-updated"),p(E,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(Y,G){w(Y,t,G),m(t,i),m(i,s),m(s,l),m(s,a),m(s,u),m(t,c),m(t,d),H(h,d,null),m(t,g);for(let de=0;deReset',c=D(),d=_("div"),h=D(),g=_("button"),g.innerHTML='Delete selected',p(t,"class","txt"),p(f,"type","button"),p(f,"class","btn btn-xs btn-secondary btn-outline p-l-5 p-r-5"),ne(f,"btn-disabled",n[9]),p(d,"class","flex-fill"),p(g,"type","button"),p(g,"class","btn btn-sm btn-secondary btn-danger"),ne(g,"btn-loading",n[9]),ne(g,"btn-disabled",n[9]),p(e,"class","bulkbar")},m(C,S){w(C,e,S),m(e,t),m(t,i),m(t,s),m(s,l),m(t,o),m(t,a),m(e,u),m(e,f),m(e,c),m(e,d),m(e,h),m(e,g),b=!0,y||($=[J(f,"click",n[31]),J(g,"click",n[32])],y=!0)},p(C,S){(!b||S[0]&64)&&ue(l,C[6]),(!b||S[0]&64)&&r!==(r=C[6]===1?"record":"records")&&ue(a,r),(!b||S[0]&512)&&ne(f,"btn-disabled",C[9]),(!b||S[0]&512)&&ne(g,"btn-loading",C[9]),(!b||S[0]&512)&&ne(g,"btn-disabled",C[9])},i(C){b||(C&&Tt(()=>{v||(v=nt(e,Wn,{duration:150,y:5},!0)),v.run(1)}),b=!0)},o(C){C&&(v||(v=nt(e,Wn,{duration:150,y:5},!1)),v.run(0)),b=!1},d(C){C&&k(e),C&&v&&v.end(),y=!1,Ye($)}}}function ET(n){let e,t,i,s,l,o,r,a,u,f=[],c=new Map,d,h,g,v,b,y,$,C,S,T,M=[],O=new Map,E,P,I,F,V;function X(ae,Se){return ae[8]?$T:wT}let te=X(n),Z=te(n);function ee(ae){n[22](ae)}let U={class:"col-type-text col-field-id",name:"id",$$slots:{default:[ST]},$$scope:{ctx:n}};n[0]!==void 0&&(U.sort=n[0]),r=new an({props:U}),me.push(()=>Re(r,"sort",ee));let Y=n[12];const G=ae=>ae[39].name;for(let ae=0;aeRe(h,"sort",de));function ve(ae){n[25](ae)}let _e={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[TT]},$$scope:{ctx:n}};n[0]!==void 0&&(_e.sort=n[0]),b=new an({props:_e}),me.push(()=>Re(b,"sort",ve));let ge=n[3];const K=ae=>ae[36].id;for(let ae=0;aea=!1)),r.$set(Q),Se[0]&4097&&(Y=ae[12],Ae(),f=ct(f,Se,G,1,ae,Y,c,s,Ut,Hp,d,Rp),Pe());const $e={};Se[1]&8192&&($e.$$scope={dirty:Se,ctx:ae}),!g&&Se[0]&1&&(g=!0,$e.sort=ae[0],He(()=>g=!1)),h.$set($e);const Be={};Se[1]&8192&&(Be.$$scope={dirty:Se,ctx:ae}),!y&&Se[0]&1&&(y=!0,Be.sort=ae[0],He(()=>y=!1)),b.$set(Be),Se[0]&78122&&(ge=ae[3],Ae(),M=ct(M,Se,K,1,ae,ge,O,T,Ut,zp,null,Np),Pe(),!ge.length&&ye?ye.p(ae,Se):ge.length?ye&&(ye.d(1),ye=null):(ye=jp(ae),ye.c(),ye.m(T,null))),(!V||Se[0]&256)&&ne(t,"table-loading",ae[8]),ae[3].length?oe?oe.p(ae,Se):(oe=Bp(ae),oe.c(),oe.m(P.parentNode,P)):oe&&(oe.d(1),oe=null),ae[3].length&&ae[11]?W?W.p(ae,Se):(W=Up(ae),W.c(),W.m(I.parentNode,I)):W&&(W.d(1),W=null),ae[6]?ce?(ce.p(ae,Se),Se[0]&64&&A(ce,1)):(ce=Wp(ae),ce.c(),A(ce,1),ce.m(F.parentNode,F)):ce&&(Ae(),L(ce,1,1,()=>{ce=null}),Pe())},i(ae){if(!V){A(r.$$.fragment,ae);for(let Se=0;Se{_e<=1&&C(),t(8,v=!1),t(3,c=c.concat(ge.items)),t(7,d=ge.page),t(4,h=ge.totalItems),r("load",c)}).catch(ge=>{ge!=null&&ge.isAbort||(t(8,v=!1),console.warn(ge),C(),we.errorResponseHandler(ge,!1))})}function C(){t(3,c=[]),t(7,d=1),t(4,h=0),t(5,g={})}function S(){o?T():M()}function T(){t(5,g={})}function M(){for(const _e of c)t(5,g[_e.id]=_e,g);t(5,g)}function O(_e){g[_e.id]?delete g[_e.id]:t(5,g[_e.id]=_e,g),t(5,g)}function E(){si(`Do you really want to delete the selected ${l===1?"record":"records"}?`,P)}async function P(){if(b||!l)return;let _e=[];for(const ge of Object.keys(g))_e.push(we.records.delete(a==null?void 0:a.id,ge));return t(9,b=!0),Promise.all(_e).then(()=>{sn(`Successfully deleted the selected ${l===1?"record":"records"}.`),T()}).catch(ge=>{we.errorResponseHandler(ge)}).finally(()=>(t(9,b=!1),y()))}function I(_e){xe.call(this,n,_e)}const F=()=>S();function V(_e){u=_e,t(0,u)}function X(_e){u=_e,t(0,u)}function te(_e){u=_e,t(0,u)}function Z(_e){u=_e,t(0,u)}const ee=_e=>O(_e),U=_e=>r("select",_e),Y=(_e,ge)=>{ge.code==="Enter"&&(ge.preventDefault(),r("select",_e))},G=()=>t(1,f=""),de=()=>$(d+1),x=()=>T(),ve=()=>E();return n.$$set=_e=>{"collection"in _e&&t(18,a=_e.collection),"sort"in _e&&t(0,u=_e.sort),"filter"in _e&&t(1,f=_e.filter)},n.$$.update=()=>{n.$$.dirty[0]&262144&&a!=null&&a.id&&C(),n.$$.dirty[0]&262147&&(a==null?void 0:a.id)&&u!==-1&&f!==-1&&$(1),n.$$.dirty[0]&24&&t(11,i=h>c.length),n.$$.dirty[0]&262144&&t(12,s=(a==null?void 0:a.schema)||[]),n.$$.dirty[0]&32&&t(6,l=Object.keys(g).length),n.$$.dirty[0]&72&&t(10,o=c.length&&l===c.length)},[u,f,$,c,h,g,l,d,v,b,o,i,s,r,S,T,O,E,a,y,I,F,V,X,te,Z,ee,U,Y,G,de,x,ve]}class PT extends Ee{constructor(e){super(),Oe(this,e,AT,ET,De,{collection:18,sort:0,filter:1,reloadLoadedPages:19,load:2},null,[-1,-1])}get reloadLoadedPages(){return this.$$.ctx[19]}get load(){return this.$$.ctx[2]}}function LT(n){let e,t,i,s;return e=new CC({}),i=new On({props:{$$slots:{default:[FT]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment),t=D(),q(i.$$.fragment)},m(l,o){H(e,l,o),w(l,t,o),H(i,l,o),s=!0},p(l,o){const r={};o[0]&639|o[1]&1&&(r.$$scope={dirty:o,ctx:l}),i.$set(r)},i(l){s||(A(e.$$.fragment,l),A(i.$$.fragment,l),s=!0)},o(l){L(e.$$.fragment,l),L(i.$$.fragment,l),s=!1},d(l){j(e,l),l&&k(t),j(i,l)}}}function IT(n){let e,t;return e=new On({props:{center:!0,$$slots:{default:[jT]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,s){const l={};s[0]&520|s[1]&1&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function NT(n){let e,t;return e=new On({props:{center:!0,$$slots:{default:[qT]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,s){const l={};s[1]&1&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function Yp(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-secondary btn-circle")},m(s,l){w(s,e,l),t||(i=[We(yt.call(null,e,{text:"Edit collection",position:"right"})),J(e,"click",n[13])],t=!0)},p:se,d(s){s&&k(e),t=!1,Ye(i)}}}function FT(n){let e,t,i,s,l,o=n[2].name+"",r,a,u,f,c,d,h,g,v,b,y,$,C,S,T,M,O,E,P,I=!n[9]&&Yp(n);c=new Xo({}),c.$on("refresh",n[14]),$=new Go({props:{value:n[0],autocompleteCollection:n[2]}}),$.$on("submit",n[17]);function F(te){n[19](te)}function V(te){n[20](te)}let X={collection:n[2]};return n[0]!==void 0&&(X.filter=n[0]),n[1]!==void 0&&(X.sort=n[1]),S=new PT({props:X}),n[18](S),me.push(()=>Re(S,"filter",F)),me.push(()=>Re(S,"sort",V)),S.$on("select",n[21]),{c(){e=_("header"),t=_("nav"),i=_("div"),i.textContent="Collections",s=D(),l=_("div"),r=N(o),a=D(),u=_("div"),I&&I.c(),f=D(),q(c.$$.fragment),d=D(),h=_("div"),g=_("button"),g.innerHTML=` - API Preview`,v=D(),b=_("button"),b.innerHTML=` - New record`,y=D(),q($.$$.fragment),C=D(),q(S.$$.fragment),p(i,"class","breadcrumb-item"),p(l,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(u,"class","inline-flex gap-5"),p(g,"type","button"),p(g,"class","btn btn-outline"),p(b,"type","button"),p(b,"class","btn btn-expanded"),p(h,"class","btns-group"),p(e,"class","page-header")},m(te,Z){w(te,e,Z),m(e,t),m(t,i),m(t,s),m(t,l),m(l,r),m(e,a),m(e,u),I&&I.m(u,null),m(u,f),H(c,u,null),m(e,d),m(e,h),m(h,g),m(h,v),m(h,b),w(te,y,Z),H($,te,Z),w(te,C,Z),H(S,te,Z),O=!0,E||(P=[J(g,"click",n[15]),J(b,"click",n[16])],E=!0)},p(te,Z){(!O||Z[0]&4)&&o!==(o=te[2].name+"")&&ue(r,o),te[9]?I&&(I.d(1),I=null):I?I.p(te,Z):(I=Yp(te),I.c(),I.m(u,f));const ee={};Z[0]&1&&(ee.value=te[0]),Z[0]&4&&(ee.autocompleteCollection=te[2]),$.$set(ee);const U={};Z[0]&4&&(U.collection=te[2]),!T&&Z[0]&1&&(T=!0,U.filter=te[0],He(()=>T=!1)),!M&&Z[0]&2&&(M=!0,U.sort=te[1],He(()=>M=!1)),S.$set(U)},i(te){O||(A(c.$$.fragment,te),A($.$$.fragment,te),A(S.$$.fragment,te),O=!0)},o(te){L(c.$$.fragment,te),L($.$$.fragment,te),L(S.$$.fragment,te),O=!1},d(te){te&&k(e),I&&I.d(),j(c),te&&k(y),j($,te),te&&k(C),n[18](null),j(S,te),E=!1,Ye(P)}}}function RT(n){let e,t,i,s,l;return{c(){e=_("h1"),e.textContent="Create your first collection to add records!",t=D(),i=_("button"),i.innerHTML=` - Create new collection`,p(e,"class","m-b-10"),p(i,"type","button"),p(i,"class","btn btn-expanded-lg btn-lg")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),s||(l=J(i,"click",n[12]),s=!0)},p:se,d(o){o&&k(e),o&&k(t),o&&k(i),s=!1,l()}}}function HT(n){let e;return{c(){e=_("h1"),e.textContent="You don't have any collections yet.",p(e,"class","m-b-10")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function jT(n){let e,t,i;function s(r,a){return r[9]?HT:RT}let l=s(n),o=l(n);return{c(){e=_("div"),t=_("div"),t.innerHTML='',i=D(),o.c(),p(t,"class","icon"),p(e,"class","placeholder-section m-b-base")},m(r,a){w(r,e,a),m(e,t),m(e,i),o.m(e,null)},p(r,a){l===(l=s(r))&&o?o.p(r,a):(o.d(1),o=l(r),o&&(o.c(),o.m(e,null)))},d(r){r&&k(e),o.d()}}}function qT(n){let e;return{c(){e=_("div"),e.innerHTML=` -

    Loading collections...

    `,p(e,"class","placeholder-section m-b-base")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function VT(n){let e,t,i,s,l,o,r,a,u;const f=[NT,IT,LT],c=[];function d(b,y){return b[8]?0:b[7].length?2:1}e=d(n),t=c[e]=f[e](n);let h={};s=new nu({props:h}),n[22](s);let g={};o=new v4({props:g}),n[23](o);let v={collection:n[2]};return a=new pb({props:v}),n[24](a),a.$on("save",n[25]),a.$on("delete",n[26]),{c(){t.c(),i=D(),q(s.$$.fragment),l=D(),q(o.$$.fragment),r=D(),q(a.$$.fragment)},m(b,y){c[e].m(b,y),w(b,i,y),H(s,b,y),w(b,l,y),H(o,b,y),w(b,r,y),H(a,b,y),u=!0},p(b,y){let $=e;e=d(b),e===$?c[e].p(b,y):(Ae(),L(c[$],1,1,()=>{c[$]=null}),Pe(),t=c[e],t?t.p(b,y):(t=c[e]=f[e](b),t.c()),A(t,1),t.m(i.parentNode,i));const C={};s.$set(C);const S={};o.$set(S);const T={};y[0]&4&&(T.collection=b[2]),a.$set(T)},i(b){u||(A(t),A(s.$$.fragment,b),A(o.$$.fragment,b),A(a.$$.fragment,b),u=!0)},o(b){L(t),L(s.$$.fragment,b),L(o.$$.fragment,b),L(a.$$.fragment,b),u=!1},d(b){c[e].d(b),b&&k(i),n[22](null),j(s,b),b&&k(l),n[23](null),j(o,b),b&&k(r),n[24](null),j(a,b)}}}function zT(n,e,t){let i,s,l,o,r,a,u;rt(n,hi,Y=>t(2,s=Y)),rt(n,Ps,Y=>t(11,l=Y)),rt(n,zo,Y=>t(27,o=Y)),rt(n,Nt,Y=>t(28,r=Y)),rt(n,pa,Y=>t(8,a=Y)),rt(n,us,Y=>t(9,u=Y)),tn(Nt,r="Collections",r);const f=new URLSearchParams(o);let c,d,h,g,v=f.get("filter")||"",b=f.get("sort")||"-created",y=f.get("collectionId")||"";function $(){t(10,y=s.id),t(1,b="-created"),t(0,v="")}W$(y);const C=()=>c==null?void 0:c.show(),S=()=>c==null?void 0:c.show(s),T=()=>g==null?void 0:g.load(),M=()=>d==null?void 0:d.show(s),O=()=>h==null?void 0:h.show(),E=Y=>t(0,v=Y.detail);function P(Y){me[Y?"unshift":"push"](()=>{g=Y,t(6,g)})}function I(Y){v=Y,t(0,v)}function F(Y){b=Y,t(1,b)}const V=Y=>h==null?void 0:h.show(Y==null?void 0:Y.detail);function X(Y){me[Y?"unshift":"push"](()=>{c=Y,t(3,c)})}function te(Y){me[Y?"unshift":"push"](()=>{d=Y,t(4,d)})}function Z(Y){me[Y?"unshift":"push"](()=>{h=Y,t(5,h)})}const ee=()=>g==null?void 0:g.reloadLoadedPages(),U=()=>g==null?void 0:g.reloadLoadedPages();return n.$$.update=()=>{if(n.$$.dirty[0]&2048&&t(7,i=l.filter(Y=>Y.name!="profiles")),n.$$.dirty[0]&1028&&(s==null?void 0:s.id)&&y!=s.id&&$(),n.$$.dirty[0]&7&&(b||v||(s==null?void 0:s.id))){const Y=new URLSearchParams({collectionId:(s==null?void 0:s.id)||"",filter:v,sort:b}).toString();Ci("/collections?"+Y)}},[v,b,s,c,d,h,g,i,a,u,y,l,C,S,T,M,O,E,P,I,F,V,X,te,Z,ee,U]}class BT extends Ee{constructor(e){super(),Oe(this,e,zT,VT,De,{},null,[-1,-1])}}const $l={googleAuth:{title:"Google",icon:"ri-google-fill"},facebookAuth:{title:"Facebook",icon:"ri-facebook-fill"},twitterAuth:{title:"Twitter",icon:"ri-twitter-fill"},githubAuth:{title:"GitHub",icon:"ri-github-fill"},gitlabAuth:{title:"GitLab",icon:"ri-gitlab-fill",selfHosted:!0},discordAuth:{title:"Discord",icon:"ri-discord-fill"}};function Kp(n,e,t){const i=n.slice();return i[9]=e[t],i}function UT(n){let e;return{c(){e=_("p"),e.textContent="No authorized OAuth2 providers.",p(e,"class","txt-hint txt-center")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function WT(n){let e,t=n[1],i=[];for(let s=0;s',p(e,"class","block txt-center")},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function Jp(n){let e,t,i,s,l,o=n[3](n[9].provider)+"",r,a,u,f,c=n[9].providerId+"",d,h,g,v,b,y;function $(){return n[6](n[9])}return{c(){e=_("div"),t=_("i"),s=D(),l=_("span"),r=N(o),a=D(),u=_("div"),f=N("ID: "),d=N(c),h=D(),g=_("button"),g.innerHTML='',v=D(),p(t,"class",i=n[4](n[9].provider)),p(l,"class","txt"),p(u,"class","txt-hint"),p(g,"type","button"),p(g,"class","btn btn-secondary link-hint btn-circle btn-sm m-l-auto"),p(e,"class","list-item")},m(C,S){w(C,e,S),m(e,t),m(e,s),m(e,l),m(l,r),m(e,a),m(e,u),m(u,f),m(u,d),m(e,h),m(e,g),m(e,v),b||(y=J(g,"click",$),b=!0)},p(C,S){n=C,S&2&&i!==(i=n[4](n[9].provider))&&p(t,"class",i),S&2&&o!==(o=n[3](n[9].provider)+"")&&ue(r,o),S&2&&c!==(c=n[9].providerId+"")&&ue(d,c)},d(C){C&&k(e),b=!1,y()}}}function KT(n){let e;function t(l,o){var r;return l[2]?YT:((r=l[0])==null?void 0:r.id)&&l[1].length?WT:UT}let i=t(n),s=i(n);return{c(){s.c(),e=Ue()},m(l,o){s.m(l,o),w(l,e,o)},p(l,[o]){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},i:se,o:se,d(l){s.d(l),l&&k(e)}}}function JT(n,e,t){const i=Qt();let{user:s}=e,l=[],o=!1;function r(d){var h;return((h=$l[d+"Auth"])==null?void 0:h.title)||B.sentenize(auth.provider,!1)}function a(d){var h;return((h=$l[d+"Auth"])==null?void 0:h.icon)||`ri-${d}-line`}async function u(){if(!(s!=null&&s.id)){t(1,l=[]),t(2,o=!1);return}t(2,o=!0);try{t(1,l=await we.users.listExternalAuths(s.id))}catch(d){we.errorResponseHandler(d)}t(2,o=!1)}function f(d){!(s!=null&&s.id)||!d||si(`Do you really want to unlink the ${r(d)} provider?`,()=>we.users.unlinkExternalAuth(s.id,d).then(()=>{sn(`Successfully unlinked the ${r(d)} provider.`),i("unlink",d),u()}).catch(h=>{we.errorResponseHandler(h)}))}Nn(()=>{u()});const c=d=>f(d.provider);return n.$$set=d=>{"user"in d&&t(0,s=d.user)},[s,l,o,r,a,f,c]}class ZT extends Ee{constructor(e){super(),Oe(this,e,JT,KT,De,{user:0})}}function Zp(n){let e,t,i,s,l,o;return{c(){e=_("div"),t=_("button"),t.textContent="Account",i=D(),s=_("button"),s.textContent="Authorized providers",p(t,"type","button"),p(t,"class","tab-item"),ne(t,"active",n[10]===wi),p(s,"type","button"),p(s,"class","tab-item"),ne(s,"active",n[10]===Ls),p(e,"class","tabs-header stretched")},m(r,a){w(r,e,a),m(e,t),m(e,i),m(e,s),l||(o=[J(t,"click",n[20]),J(s,"click",n[21])],l=!0)},p(r,a){a[0]&1024&&ne(t,"active",r[10]===wi),a[0]&1024&&ne(s,"active",r[10]===Ls)},d(r){r&&k(e),l=!1,Ye(o)}}}function Gp(n){let e,t;return e=new Ne({props:{class:"form-field disabled",name:"id",$$slots:{default:[GT,({uniqueId:i})=>({34:i}),({uniqueId:i})=>[0,i?8:0]]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,s){const l={};s[0]&2|s[1]&24&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function GT(n){let e,t,i,s,l,o,r,a,u;return{c(){e=_("label"),t=_("i"),i=D(),s=_("span"),s.textContent="ID",o=D(),r=_("input"),p(t,"class",B.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"for",l=n[34]),p(r,"type","text"),p(r,"id",a=n[34]),r.value=u=n[1].id,r.disabled=!0},m(f,c){w(f,e,c),m(e,t),m(e,i),m(e,s),w(f,o,c),w(f,r,c)},p(f,c){c[1]&8&&l!==(l=f[34])&&p(e,"for",l),c[1]&8&&a!==(a=f[34])&&p(r,"id",a),c[0]&2&&u!==(u=f[1].id)&&r.value!==u&&(r.value=u)},d(f){f&&k(e),f&&k(o),f&&k(r)}}}function Xp(n){let e,t,i;return{c(){e=_("div"),e.innerHTML='',p(e,"class","form-field-addon txt-success")},m(s,l){w(s,e,l),t||(i=We(yt.call(null,e,"Verified")),t=!0)},d(s){s&&k(e),t=!1,i()}}}function XT(n){let e,t,i,s,l,o,r,a,u,f,c,d=n[1].verified&&n[1].email&&Xp();return{c(){e=_("label"),t=_("i"),i=D(),s=_("span"),s.textContent="Email",o=D(),d&&d.c(),r=D(),a=_("input"),p(t,"class",B.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"for",l=n[34]),p(a,"type","email"),p(a,"autocomplete","off"),p(a,"id",u=n[34]),a.required=!0},m(h,g){w(h,e,g),m(e,t),m(e,i),m(e,s),w(h,o,g),d&&d.m(h,g),w(h,r,g),w(h,a,g),Me(a,n[2]),f||(c=J(a,"input",n[22]),f=!0)},p(h,g){g[1]&8&&l!==(l=h[34])&&p(e,"for",l),h[1].verified&&h[1].email?d||(d=Xp(),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null),g[1]&8&&u!==(u=h[34])&&p(a,"id",u),g[0]&4&&a.value!==h[2]&&Me(a,h[2])},d(h){h&&k(e),h&&k(o),d&&d.d(h),h&&k(r),h&&k(a),f=!1,c()}}}function Qp(n){let e,t;return e=new Ne({props:{class:"form-field form-field-toggle",$$slots:{default:[QT,({uniqueId:i})=>({34:i}),({uniqueId:i})=>[0,i?8:0]]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,s){const l={};s[0]&8|s[1]&24&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function QT(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=D(),s=_("label"),l=N("Change password"),p(e,"type","checkbox"),p(e,"id",t=n[34]),p(s,"for",o=n[34])},m(u,f){w(u,e,f),e.checked=n[3],w(u,i,f),w(u,s,f),m(s,l),r||(a=J(e,"change",n[23]),r=!0)},p(u,f){f[1]&8&&t!==(t=u[34])&&p(e,"id",t),f[0]&8&&(e.checked=u[3]),f[1]&8&&o!==(o=u[34])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function xp(n){let e,t,i,s,l,o,r,a,u;return s=new Ne({props:{class:"form-field required",name:"password",$$slots:{default:[xT,({uniqueId:f})=>({34:f}),({uniqueId:f})=>[0,f?8:0]]},$$scope:{ctx:n}}}),r=new Ne({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[eD,({uniqueId:f})=>({34:f}),({uniqueId:f})=>[0,f?8:0]]},$$scope:{ctx:n}}}),{c(){e=_("div"),t=_("div"),i=_("div"),q(s.$$.fragment),l=D(),o=_("div"),q(r.$$.fragment),p(i,"class","col-sm-6"),p(o,"class","col-sm-6"),p(t,"class","grid"),p(e,"class","col-12")},m(f,c){w(f,e,c),m(e,t),m(t,i),H(s,i,null),m(t,l),m(t,o),H(r,o,null),u=!0},p(f,c){const d={};c[0]&128|c[1]&24&&(d.$$scope={dirty:c,ctx:f}),s.$set(d);const h={};c[0]&256|c[1]&24&&(h.$$scope={dirty:c,ctx:f}),r.$set(h)},i(f){u||(A(s.$$.fragment,f),A(r.$$.fragment,f),f&&Tt(()=>{a||(a=nt(t,on,{duration:150},!0)),a.run(1)}),u=!0)},o(f){L(s.$$.fragment,f),L(r.$$.fragment,f),f&&(a||(a=nt(t,on,{duration:150},!1)),a.run(0)),u=!1},d(f){f&&k(e),j(s),j(r),f&&a&&a.end()}}}function xT(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=_("i"),i=D(),s=_("span"),s.textContent="Password",o=D(),r=_("input"),p(t,"class","ri-lock-line"),p(s,"class","txt"),p(e,"for",l=n[34]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[34]),r.required=!0},m(c,d){w(c,e,d),m(e,t),m(e,i),m(e,s),w(c,o,d),w(c,r,d),Me(r,n[7]),u||(f=J(r,"input",n[24]),u=!0)},p(c,d){d[1]&8&&l!==(l=c[34])&&p(e,"for",l),d[1]&8&&a!==(a=c[34])&&p(r,"id",a),d[0]&128&&r.value!==c[7]&&Me(r,c[7])},d(c){c&&k(e),c&&k(o),c&&k(r),u=!1,f()}}}function eD(n){let e,t,i,s,l,o,r,a,u,f;return{c(){e=_("label"),t=_("i"),i=D(),s=_("span"),s.textContent="Password confirm",o=D(),r=_("input"),p(t,"class","ri-lock-line"),p(s,"class","txt"),p(e,"for",l=n[34]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[34]),r.required=!0},m(c,d){w(c,e,d),m(e,t),m(e,i),m(e,s),w(c,o,d),w(c,r,d),Me(r,n[8]),u||(f=J(r,"input",n[25]),u=!0)},p(c,d){d[1]&8&&l!==(l=c[34])&&p(e,"for",l),d[1]&8&&a!==(a=c[34])&&p(r,"id",a),d[0]&256&&r.value!==c[8]&&Me(r,c[8])},d(c){c&&k(e),c&&k(o),c&&k(r),u=!1,f()}}}function eh(n){let e,t;return e=new Ne({props:{class:"form-field form-field-toggle",$$slots:{default:[tD,({uniqueId:i})=>({34:i}),({uniqueId:i})=>[0,i?8:0]]},$$scope:{ctx:n}}}),{c(){q(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,s){const l={};s[0]&512|s[1]&24&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){t||(A(e.$$.fragment,i),t=!0)},o(i){L(e.$$.fragment,i),t=!1},d(i){j(e,i)}}}function tD(n){let e,t,i,s,l,o,r,a;return{c(){e=_("input"),i=D(),s=_("label"),l=N("Send verification email"),p(e,"type","checkbox"),p(e,"id",t=n[34]),p(s,"for",o=n[34])},m(u,f){w(u,e,f),e.checked=n[9],w(u,i,f),w(u,s,f),m(s,l),r||(a=J(e,"change",n[26]),r=!0)},p(u,f){f[1]&8&&t!==(t=u[34])&&p(e,"id",t),f[0]&512&&(e.checked=u[9]),f[1]&8&&o!==(o=u[34])&&p(s,"for",o)},d(u){u&&k(e),u&&k(i),u&&k(s),r=!1,a()}}}function th(n){let e,t,i;return t=new ZT({props:{user:n[1]}}),{c(){e=_("div"),q(t.$$.fragment),p(e,"class","tab-item"),ne(e,"active",n[10]===Ls)},m(s,l){w(s,e,l),H(t,e,null),i=!0},p(s,l){const o={};l[0]&2&&(o.user=s[1]),t.$set(o),(!i||l[0]&1024)&&ne(e,"active",s[10]===Ls)},i(s){i||(A(t.$$.fragment,s),i=!0)},o(s){L(t.$$.fragment,s),i=!1},d(s){s&&k(e),j(t)}}}function nD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g,v=!n[1].isNew&&Zp(n),b=!n[1].isNew&&Gp(n);r=new Ne({props:{class:"form-field required",name:"email",$$slots:{default:[XT,({uniqueId:T})=>({34:T}),({uniqueId:T})=>[0,T?8:0]]},$$scope:{ctx:n}}});let y=!n[1].isNew&&n[1].email&&Qp(n),$=(n[1].isNew||!n[1].email||n[3])&&xp(n),C=(n[1].isNew||!n[1].email)&&eh(n),S=!n[1].isNew&&th(n);return{c(){e=_("div"),v&&v.c(),t=D(),i=_("div"),s=_("div"),l=_("form"),b&&b.c(),o=D(),q(r.$$.fragment),a=D(),y&&y.c(),u=D(),$&&$.c(),f=D(),C&&C.c(),c=D(),S&&S.c(),p(l,"id",n[12]),p(l,"class","grid"),p(l,"autocomplete","off"),p(s,"class","tab-item"),ne(s,"active",n[10]===wi),p(i,"class","tabs-content"),p(e,"class","tabs user-tabs")},m(T,M){w(T,e,M),v&&v.m(e,null),m(e,t),m(e,i),m(i,s),m(s,l),b&&b.m(l,null),m(l,o),H(r,l,null),m(l,a),y&&y.m(l,null),m(l,u),$&&$.m(l,null),m(l,f),C&&C.m(l,null),m(i,c),S&&S.m(i,null),d=!0,h||(g=J(l,"submit",Yt(n[13])),h=!0)},p(T,M){T[1].isNew?v&&(v.d(1),v=null):v?v.p(T,M):(v=Zp(T),v.c(),v.m(e,t)),T[1].isNew?b&&(Ae(),L(b,1,1,()=>{b=null}),Pe()):b?(b.p(T,M),M[0]&2&&A(b,1)):(b=Gp(T),b.c(),A(b,1),b.m(l,o));const O={};M[0]&6|M[1]&24&&(O.$$scope={dirty:M,ctx:T}),r.$set(O),!T[1].isNew&&T[1].email?y?(y.p(T,M),M[0]&2&&A(y,1)):(y=Qp(T),y.c(),A(y,1),y.m(l,u)):y&&(Ae(),L(y,1,1,()=>{y=null}),Pe()),T[1].isNew||!T[1].email||T[3]?$?($.p(T,M),M[0]&10&&A($,1)):($=xp(T),$.c(),A($,1),$.m(l,f)):$&&(Ae(),L($,1,1,()=>{$=null}),Pe()),T[1].isNew||!T[1].email?C?(C.p(T,M),M[0]&2&&A(C,1)):(C=eh(T),C.c(),A(C,1),C.m(l,null)):C&&(Ae(),L(C,1,1,()=>{C=null}),Pe()),(!d||M[0]&1024)&&ne(s,"active",T[10]===wi),T[1].isNew?S&&(Ae(),L(S,1,1,()=>{S=null}),Pe()):S?(S.p(T,M),M[0]&2&&A(S,1)):(S=th(T),S.c(),A(S,1),S.m(i,null))},i(T){d||(A(b),A(r.$$.fragment,T),A(y),A($),A(C),A(S),d=!0)},o(T){L(b),L(r.$$.fragment,T),L(y),L($),L(C),L(S),d=!1},d(T){T&&k(e),v&&v.d(),b&&b.d(),j(r),y&&y.d(),$&&$.d(),C&&C.d(),S&&S.d(),h=!1,g()}}}function nh(n){let e,t,i,s,l,o,r;return o=new Ti({props:{class:"dropdown dropdown-right dropdown-nowrap",$$slots:{default:[iD]},$$scope:{ctx:n}}}),{c(){e=_("button"),t=_("span"),i=D(),s=_("i"),l=D(),q(o.$$.fragment),p(s,"class","ri-more-line"),p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-secondary m-l-auto")},m(a,u){w(a,e,u),m(e,t),m(e,i),m(e,s),m(e,l),H(o,e,null),r=!0},p(a,u){const f={};u[0]&2|u[1]&16&&(f.$$scope={dirty:u,ctx:a}),o.$set(f)},i(a){r||(A(o.$$.fragment,a),r=!0)},o(a){L(o.$$.fragment,a),r=!1},d(a){a&&k(e),j(o)}}}function ih(n){let e,t,i;return{c(){e=_("button"),e.innerHTML=` - Send verification email`,p(e,"type","button"),p(e,"class","dropdown-item")},m(s,l){w(s,e,l),t||(i=J(e,"click",n[18]),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function iD(n){let e,t,i,s,l=!n[1].verified&&n[1].email&&ih(n);return{c(){l&&l.c(),e=D(),t=_("button"),t.innerHTML=` - Delete`,p(t,"type","button"),p(t,"class","dropdown-item")},m(o,r){l&&l.m(o,r),w(o,e,r),w(o,t,r),i||(s=J(t,"click",n[19]),i=!0)},p(o,r){!o[1].verified&&o[1].email?l?l.p(o,r):(l=ih(o),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(o){l&&l.d(o),o&&k(e),o&&k(t),i=!1,s()}}}function sD(n){let e,t=n[1].isNew?"New user":"Edit user",i,s,l,o,r=!n[1].isNew&&nh(n);return{c(){e=_("h4"),i=N(t),s=D(),r&&r.c(),l=Ue()},m(a,u){w(a,e,u),m(e,i),w(a,s,u),r&&r.m(a,u),w(a,l,u),o=!0},p(a,u){(!o||u[0]&2)&&t!==(t=a[1].isNew?"New user":"Edit user")&&ue(i,t),a[1].isNew?r&&(Ae(),L(r,1,1,()=>{r=null}),Pe()):r?(r.p(a,u),u[0]&2&&A(r,1)):(r=nh(a),r.c(),A(r,1),r.m(l.parentNode,l))},i(a){o||(A(r),o=!0)},o(a){L(r),o=!1},d(a){a&&k(e),a&&k(s),r&&r.d(a),a&&k(l)}}}function sh(n){let e,t,i=n[1].isNew?"Create":"Save changes",s,l;return{c(){e=_("button"),t=_("span"),s=N(i),p(t,"class","txt"),p(e,"type","submit"),p(e,"form",n[12]),p(e,"class","btn btn-expanded"),e.disabled=l=!n[11]||n[5],ne(e,"btn-loading",n[5])},m(o,r){w(o,e,r),m(e,t),m(t,s)},p(o,r){r[0]&2&&i!==(i=o[1].isNew?"Create":"Save changes")&&ue(s,i),r[0]&2080&&l!==(l=!o[11]||o[5])&&(e.disabled=l),r[0]&32&&ne(e,"btn-loading",o[5])},d(o){o&&k(e)}}}function lD(n){let e,t,i,s,l,o,r=n[10]===wi&&sh(n);return{c(){e=_("button"),t=_("span"),t.textContent="Cancel",i=D(),r&&r.c(),s=Ue(),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-secondary"),e.disabled=n[5]},m(a,u){w(a,e,u),m(e,t),w(a,i,u),r&&r.m(a,u),w(a,s,u),l||(o=J(e,"click",n[17]),l=!0)},p(a,u){u[0]&32&&(e.disabled=a[5]),a[10]===wi?r?r.p(a,u):(r=sh(a),r.c(),r.m(s.parentNode,s)):r&&(r.d(1),r=null)},d(a){a&&k(e),a&&k(i),r&&r.d(a),a&&k(s),l=!1,o()}}}function oD(n){let e,t,i={class:"user-panel",popup:n[1].isNew,beforeHide:n[27],$$slots:{footer:[lD],header:[sD],default:[nD]},$$scope:{ctx:n}};return e=new ui({props:i}),n[28](e),e.$on("hide",n[29]),e.$on("show",n[30]),{c(){q(e.$$.fragment)},m(s,l){H(e,s,l),t=!0},p(s,l){const o={};l[0]&2&&(o.popup=s[1].isNew),l[0]&2112&&(o.beforeHide=s[27]),l[0]&4014|l[1]&16&&(o.$$scope={dirty:l,ctx:s}),e.$set(o)},i(s){t||(A(e.$$.fragment,s),t=!0)},o(s){L(e.$$.fragment,s),t=!1},d(s){n[28](null),j(e,s)}}}const wi="account",Ls="providers";function rD(n,e,t){let i;const s=Qt(),l="user_"+B.randomString(5);let o,r=new Ts,a=!1,u=!1,f="",c="",d="",h=!1,g=!0,v=wi;function b(x){return $(x),t(6,u=!0),t(10,v=r.isNew||r.email?wi:Ls),o==null?void 0:o.show()}function y(){return o==null?void 0:o.hide()}function $(x){ri({}),t(1,r=x!=null&&x.clone?x.clone():new Ts),C()}function C(){t(3,h=!1),t(9,g=!0),t(2,f=(r==null?void 0:r.email)||""),t(7,c=""),t(8,d="")}function S(){if(a||!i)return;t(5,a=!0);const x={email:f};(r.isNew||h)&&(x.password=c,x.passwordConfirm=d);let ve;r.isNew?ve=we.users.create(x):ve=we.users.update(r.id,x),ve.then(async _e=>{t(1,r=_e),g&&M(!1),t(6,u=!1),y(),sn(r.isNew?"Successfully created user.":"Successfully updated user."),s("save",_e)}).catch(_e=>{we.errorResponseHandler(_e)}).finally(()=>{t(5,a=!1)})}function T(){!(r!=null&&r.id)||si("Do you really want to delete the selected user?",()=>we.users.delete(r.id).then(()=>{t(6,u=!1),y(),sn("Successfully deleted user."),s("delete",r)}).catch(x=>{we.errorResponseHandler(x)}))}function M(x=!0){return we.users.requestVerification(r.email||f).then(()=>{t(6,u=!1),y(),x&&sn(`Successfully sent verification email to ${r.email}.`)}).catch(ve=>{we.errorResponseHandler(ve)})}const O=()=>y(),E=()=>M(),P=()=>T(),I=()=>t(10,v=wi),F=()=>t(10,v=Ls);function V(){f=this.value,t(2,f)}function X(){h=this.checked,t(3,h)}function te(){c=this.value,t(7,c)}function Z(){d=this.value,t(8,d)}function ee(){g=this.checked,t(9,g)}const U=()=>i&&u?(si("You have unsaved changes. Do you really want to close the panel?",()=>{t(6,u=!1),y()}),!1):!0;function Y(x){me[x?"unshift":"push"](()=>{o=x,t(4,o)})}function G(x){xe.call(this,n,x)}function de(x){xe.call(this,n,x)}return n.$$.update=()=>{n.$$.dirty[0]&14&&t(11,i=r.isNew&&f!=""||h||f!==r.email)},[y,r,f,h,o,a,u,c,d,g,v,i,l,S,T,M,b,O,E,P,I,F,V,X,te,Z,ee,U,Y,G,de]}class aD extends Ee{constructor(e){super(),Oe(this,e,rD,oD,De,{show:16,hide:0},null,[-1,-1])}get show(){return this.$$.ctx[16]}get hide(){return this.$$.ctx[0]}}function lh(n,e,t){const i=n.slice();return i[41]=e[t],i}function oh(n,e,t){const i=n.slice();return i[44]=e[t],i}function rh(n,e,t){const i=n.slice();return i[44]=e[t],i}function uD(n){let e,t,i,s,l,o,r,a,u,f,c,d,h,g,v,b,y,$,C,S,T,M,O,E,P=[],I=new Map,F,V,X,te,Z,ee,U,Y,G,de,x=[],ve=new Map,_e,ge,K,ye,oe,W,ce=!n[15]&&ah(n);r=new Xo({}),r.$on("refresh",n[18]),h=new Go({props:{value:n[3],placeholder:"Search filter, eg. verified=1",extraAutocompleteKeys:["verified","email"]}}),h.$on("submit",n[20]);function ae(be){n[21](be)}let Se={class:"col-type-text col-field-id",name:"id",$$slots:{default:[cD]},$$scope:{ctx:n}};n[4]!==void 0&&(Se.sort=n[4]),C=new an({props:Se}),me.push(()=>Re(C,"sort",ae));function Q(be){n[22](be)}let $e={class:"col-type-email col-field-email",name:"email",$$slots:{default:[dD]},$$scope:{ctx:n}};n[4]!==void 0&&($e.sort=n[4]),M=new an({props:$e}),me.push(()=>Re(M,"sort",Q));let Be=n[12];const Xe=be=>be[44].name;for(let be=0;beRe(V,"sort",ut));function Je(be){n[24](be)}let et={class:"col-type-date col-field-updated",name:"updated",$$slots:{default:[hD]},$$scope:{ctx:n}};n[4]!==void 0&&(et.sort=n[4]),Z=new an({props:et}),me.push(()=>Re(Z,"sort",Je));let Te=n[1];const Ve=be=>be[41].id;for(let be=0;be - New user`,d=D(),q(h.$$.fragment),g=D(),v=_("div"),b=_("table"),y=_("thead"),$=_("tr"),q(C.$$.fragment),T=D(),q(M.$$.fragment),E=D();for(let be=0;beS=!1)),C.$set(Dt);const ht={};Fe[1]&262144&&(ht.$$scope={dirty:Fe,ctx:be}),!O&&Fe[0]&16&&(O=!0,ht.sort=be[4],He(()=>O=!1)),M.$set(ht),Fe[0]&4096&&(Be=be[12],P=ct(P,Fe,Xe,1,be,Be,I,$,pn,uh,F,rh));const st={};Fe[1]&262144&&(st.$$scope={dirty:Fe,ctx:be}),!X&&Fe[0]&16&&(X=!0,st.sort=be[4],He(()=>X=!1)),V.$set(st);const Lt={};Fe[1]&262144&&(Lt.$$scope={dirty:Fe,ctx:be}),!ee&&Fe[0]&16&&(ee=!0,Lt.sort=be[4],He(()=>ee=!1)),Z.$set(Lt),Fe[0]&5450&&(Te=be[1],Ae(),x=ct(x,Fe,Ve,1,be,Te,ve,de,Ut,hh,null,lh),Pe(),!Te.length&&Ze?Ze.p(be,Fe):Te.length?Ze&&(Ze.d(1),Ze=null):(Ze=fh(be),Ze.c(),Ze.m(de,null))),(!ye||Fe[0]&1024)&&ne(b,"table-loading",be[10]),be[1].length?tt?tt.p(be,Fe):(tt=mh(be),tt.c(),tt.m(ge.parentNode,ge)):tt&&(tt.d(1),tt=null),be[1].length&&be[13]?dt?dt.p(be,Fe):(dt=gh(be),dt.c(),dt.m(K.parentNode,K)):dt&&(dt.d(1),dt=null)},i(be){if(!ye){A(r.$$.fragment,be),A(h.$$.fragment,be),A(C.$$.fragment,be),A(M.$$.fragment,be),A(V.$$.fragment,be),A(Z.$$.fragment,be);for(let Fe=0;Fe -

    Loading users...

    `,p(e,"class","placeholder-section m-b-base")},m(t,i){w(t,e,i)},p:se,i:se,o:se,d(t){t&&k(e)}}}function ah(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-secondary btn-circle")},m(s,l){w(s,e,l),t||(i=[We(yt.call(null,e,{text:"Edit profile collection",position:"right"})),J(e,"click",n[17])],t=!0)},p:se,d(s){s&&k(e),t=!1,Ye(i)}}}function cD(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="id",p(t,"class",B.getFieldTypeIcon("primary")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function dD(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="email",p(t,"class",B.getFieldTypeIcon("email")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function uh(n,e){let t,i,s,l,o,r,a,u=e[44].name+"",f,c,d;return{key:n,first:null,c(){t=_("th"),i=_("div"),s=_("i"),o=D(),r=_("span"),a=N("profile."),f=N(u),p(s,"class",l=B.getFieldTypeIcon(e[44].type)),p(r,"class","txt"),p(i,"class","col-header-content"),p(t,"class",c="col-type-"+e[44].type+" col-field-"+e[44].name),p(t,"name",d=e[44].name),this.first=t},m(h,g){w(h,t,g),m(t,i),m(i,s),m(i,o),m(i,r),m(r,a),m(r,f)},p(h,g){e=h,g[0]&4096&&l!==(l=B.getFieldTypeIcon(e[44].type))&&p(s,"class",l),g[0]&4096&&u!==(u=e[44].name+"")&&ue(f,u),g[0]&4096&&c!==(c="col-type-"+e[44].type+" col-field-"+e[44].name)&&p(t,"class",c),g[0]&4096&&d!==(d=e[44].name)&&p(t,"name",d)},d(h){h&&k(t)}}}function pD(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="created",p(t,"class",B.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function hD(n){let e,t,i,s;return{c(){e=_("div"),t=_("i"),i=D(),s=_("span"),s.textContent="updated",p(t,"class",B.getFieldTypeIcon("date")),p(s,"class","txt"),p(e,"class","col-header-content")},m(l,o){w(l,e,o),m(e,t),m(e,i),m(e,s)},p:se,d(l){l&&k(e)}}}function fh(n){let e;function t(l,o){return l[10]?gD:mD}let i=t(n),s=i(n);return{c(){s.c(),e=Ue()},m(l,o){s.m(l,o),w(l,e,o)},p(l,o){i===(i=t(l))&&s?s.p(l,o):(s.d(1),s=i(l),s&&(s.c(),s.m(e.parentNode,e)))},d(l){s.d(l),l&&k(e)}}}function mD(n){var r;let e,t,i,s,l,o=((r=n[3])==null?void 0:r.length)&&ch(n);return{c(){e=_("tr"),t=_("td"),i=_("h6"),i.textContent="No users found.",s=D(),o&&o.c(),l=D(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,u){w(a,e,u),m(e,t),m(t,i),m(t,s),o&&o.m(t,null),m(e,l)},p(a,u){var f;(f=a[3])!=null&&f.length?o?o.p(a,u):(o=ch(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&k(e),o&&o.d()}}}function gD(n){let e;return{c(){e=_("tr"),e.innerHTML=` - `},m(t,i){w(t,e,i)},p:se,d(t){t&&k(e)}}}function ch(n){let e,t,i;return{c(){e=_("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(s,l){w(s,e,l),t||(i=J(e,"click",n[27]),t=!0)},p:se,d(s){s&&k(e),t=!1,i()}}}function _D(n){let e,t,i,s=n[41].verified&&dh();return{c(){e=_("div"),e.textContent="N/A",t=D(),s&&s.c(),i=Ue(),p(e,"class","txt-hint")},m(l,o){w(l,e,o),w(l,t,o),s&&s.m(l,o),w(l,i,o)},p(l,o){l[41].verified?s||(s=dh(),s.c(),s.m(i.parentNode,i)):s&&(s.d(1),s=null)},d(l){l&&k(e),l&&k(t),s&&s.d(l),l&&k(i)}}}function bD(n){let e,t=n[41].email+"",i,s,l,o,r=n[41].verified?"Verified":"Unverified",a;return{c(){e=_("span"),i=N(t),l=D(),o=_("span"),a=N(r),p(e,"class","txt"),p(e,"title",s=n[41].email),p(o,"class","label"),ne(o,"label-success",n[41].verified),ne(o,"label-warning",!n[41].verified)},m(u,f){w(u,e,f),m(e,i),w(u,l,f),w(u,o,f),m(o,a)},p(u,f){f[0]&2&&t!==(t=u[41].email+"")&&ue(i,t),f[0]&2&&s!==(s=u[41].email)&&p(e,"title",s),f[0]&2&&r!==(r=u[41].verified?"Verified":"Unverified")&&ue(a,r),f[0]&2&&ne(o,"label-success",u[41].verified),f[0]&2&&ne(o,"label-warning",!u[41].verified)},d(u){u&&k(e),u&&k(l),u&&k(o)}}}function dh(n){let e;return{c(){e=_("span"),e.textContent="OAuth2 verified",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&k(e)}}}function ph(n,e){let t,i,s;return i=new hb({props:{field:e[44],record:e[41].profile||{}}}),{key:n,first:null,c(){t=Ue(),q(i.$$.fragment),this.first=t},m(l,o){w(l,t,o),H(i,l,o),s=!0},p(l,o){e=l;const r={};o[0]&4096&&(r.field=e[44]),o[0]&2&&(r.record=e[41].profile||{}),i.$set(r)},i(l){s||(A(i.$$.fragment,l),s=!0)},o(l){L(i.$$.fragment,l),s=!1},d(l){l&&k(t),j(i,l)}}}function hh(n,e){let t,i,s,l,o,r,a,u=[],f=new Map,c,d,h,g,v,b,y,$,C,S,T,M,O,E,P;s=new lr({props:{id:e[41].id}});function I(U,Y){return U[41].email?bD:_D}let F=I(e),V=F(e),X=e[12];const te=U=>U[44].name;for(let U=0;U