From 20fba0f6865d64f52388c320bca00b54f0ddf85b Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sat, 24 Feb 2024 13:46:16 +0200 Subject: [PATCH] moved filter autocomplete to worker --- .../jsvm/internal/types/generated/types.d.ts | 5421 +++++++++-------- ...JCAd_pk.js => AuthMethodsDocs-YXCf-w6f.js} | 2 +- ...wWPCwEU.js => AuthRefreshDocs-JfV5JCoS.js} | 2 +- ...hOlg.js => AuthWithOAuth2Docs-N1wT5-Tm.js} | 2 +- ...b4.js => AuthWithPasswordDocs-Sqq2A_xb.js} | 2 +- ui/dist/assets/CodeEditor-f9FE6aAj.js | 14 - ui/dist/assets/CodeEditor-rvo5l1QW.js | 14 + ....js => ConfirmEmailChangeDocs-z2cifBOn.js} | 2 +- ...s => ConfirmPasswordResetDocs-XG9DX7jk.js} | 2 +- ...js => ConfirmVerificationDocs-iIwWOJ-8.js} | 2 +- ...-uAZVKP8K.js => CreateApiDocs-5RxIhvO0.js} | 2 +- ...-fOXuOKIx.js => DeleteApiDocs-j_NJpd0u.js} | 2 +- ...6rO4n1.js => FieldsQueryParam-QduFX_Q6.js} | 2 +- .../FilterAutocompleteInput-7N2kJXRh.js | 1 - .../FilterAutocompleteInput-ywiKWbDQ.js | 1 + ...cs-NLRpQyTo.js => ListApiDocs-Ej5naqCg.js} | 2 +- ...K.js => ListExternalAuthsDocs-0k6rNNq4.js} | 2 +- ...PageAdminConfirmPasswordReset-QtrIhv_d.js} | 2 +- ...PageAdminRequestPasswordReset-FK_-0PXf.js} | 2 +- ... => PageOAuth2RedirectFailure-OjogN9-X.js} | 2 +- ... => PageOAuth2RedirectSuccess-T7Wnqyzu.js} | 2 +- ... PageRecordConfirmEmailChange--1lZH6Oc.js} | 2 +- ...ageRecordConfirmPasswordReset-XkhUeLt2.js} | 2 +- ...PageRecordConfirmVerification-bo85WeJ2.js} | 2 +- ...EFv858u.js => RealtimeApiDocs-2yYxyEgN.js} | 2 +- ....js => RequestEmailChangeDocs-J7AVBZVY.js} | 2 +- ...s => RequestPasswordResetDocs-CDKXdjxv.js} | 2 +- ...js => RequestVerificationDocs-LGhIAfd9.js} | 2 +- ...dkTabs-O6auDA6S.js => SdkTabs-gnoMubZE.js} | 2 +- ....js => UnlinkExternalAuthDocs-Qe14c8ks.js} | 2 +- ...-KIEJUGwi.js => UpdateApiDocs-GDKV_HSc.js} | 2 +- ...cs-4M1eVMku.js => ViewApiDocs-EPId3tA7.js} | 2 +- .../assets/autocomplete.worker-8hFaOFLh.js | 4 + .../{index-u64XbdBO.js => index-8bZ4r7AC.js} | 22 +- .../{index-ydlV29Fj.js => index-z3vRI80T.js} | 20 +- ui/dist/index.html | 2 +- ui/src/autocomplete.worker.js | 39 + .../base/FilterAutocompleteInput.svelte | 178 +- ui/src/components/base/Searchbar.svelte | 2 +- ui/src/utils/CommonHelper.js | 136 + 40 files changed, 2990 insertions(+), 2918 deletions(-) rename ui/dist/assets/{AuthMethodsDocs-nJCAd_pk.js => AuthMethodsDocs-YXCf-w6f.js} (97%) rename ui/dist/assets/{AuthRefreshDocs-YwWPCwEU.js => AuthRefreshDocs-JfV5JCoS.js} (97%) rename ui/dist/assets/{AuthWithOAuth2Docs-uhwAhOlg.js => AuthWithOAuth2Docs-N1wT5-Tm.js} (98%) rename ui/dist/assets/{AuthWithPasswordDocs-i3lf_6b4.js => AuthWithPasswordDocs-Sqq2A_xb.js} (98%) delete mode 100644 ui/dist/assets/CodeEditor-f9FE6aAj.js create mode 100644 ui/dist/assets/CodeEditor-rvo5l1QW.js rename ui/dist/assets/{ConfirmEmailChangeDocs-eRrlYV21.js => ConfirmEmailChangeDocs-z2cifBOn.js} (97%) rename ui/dist/assets/{ConfirmPasswordResetDocs-AJWXIimi.js => ConfirmPasswordResetDocs-XG9DX7jk.js} (98%) rename ui/dist/assets/{ConfirmVerificationDocs-JgU_hYvF.js => ConfirmVerificationDocs-iIwWOJ-8.js} (97%) rename ui/dist/assets/{CreateApiDocs-uAZVKP8K.js => CreateApiDocs-5RxIhvO0.js} (98%) rename ui/dist/assets/{DeleteApiDocs-fOXuOKIx.js => DeleteApiDocs-j_NJpd0u.js} (97%) rename ui/dist/assets/{FieldsQueryParam--b6rO4n1.js => FieldsQueryParam-QduFX_Q6.js} (96%) delete mode 100644 ui/dist/assets/FilterAutocompleteInput-7N2kJXRh.js create mode 100644 ui/dist/assets/FilterAutocompleteInput-ywiKWbDQ.js rename ui/dist/assets/{ListApiDocs-NLRpQyTo.js => ListApiDocs-Ej5naqCg.js} (99%) rename ui/dist/assets/{ListExternalAuthsDocs-EllSY0vK.js => ListExternalAuthsDocs-0k6rNNq4.js} (97%) rename ui/dist/assets/{PageAdminConfirmPasswordReset-s0lBz81f.js => PageAdminConfirmPasswordReset-QtrIhv_d.js} (98%) rename ui/dist/assets/{PageAdminRequestPasswordReset-iIhRW4sL.js => PageAdminRequestPasswordReset-FK_-0PXf.js} (98%) rename ui/dist/assets/{PageOAuth2RedirectFailure-GoHDOiB1.js => PageOAuth2RedirectFailure-OjogN9-X.js} (86%) rename ui/dist/assets/{PageOAuth2RedirectSuccess-N-jghl3J.js => PageOAuth2RedirectSuccess-T7Wnqyzu.js} (86%) rename ui/dist/assets/{PageRecordConfirmEmailChange-TP7r406s.js => PageRecordConfirmEmailChange--1lZH6Oc.js} (98%) rename ui/dist/assets/{PageRecordConfirmPasswordReset-q0EEKRPk.js => PageRecordConfirmPasswordReset-XkhUeLt2.js} (98%) rename ui/dist/assets/{PageRecordConfirmVerification-hH1chnUs.js => PageRecordConfirmVerification-bo85WeJ2.js} (97%) rename ui/dist/assets/{RealtimeApiDocs-QEFv858u.js => RealtimeApiDocs-2yYxyEgN.js} (98%) rename ui/dist/assets/{RequestEmailChangeDocs-OR_qP7_j.js => RequestEmailChangeDocs-J7AVBZVY.js} (98%) rename ui/dist/assets/{RequestPasswordResetDocs-ueBKJVu4.js => RequestPasswordResetDocs-CDKXdjxv.js} (97%) rename ui/dist/assets/{RequestVerificationDocs-G73EyzMY.js => RequestVerificationDocs-LGhIAfd9.js} (97%) rename ui/dist/assets/{SdkTabs-O6auDA6S.js => SdkTabs-gnoMubZE.js} (98%) rename ui/dist/assets/{UnlinkExternalAuthDocs-52aa8RZW.js => UnlinkExternalAuthDocs-Qe14c8ks.js} (98%) rename ui/dist/assets/{UpdateApiDocs-KIEJUGwi.js => UpdateApiDocs-GDKV_HSc.js} (98%) rename ui/dist/assets/{ViewApiDocs-4M1eVMku.js => ViewApiDocs-EPId3tA7.js} (97%) create mode 100644 ui/dist/assets/autocomplete.worker-8hFaOFLh.js rename ui/dist/assets/{index-u64XbdBO.js => index-8bZ4r7AC.js} (88%) rename ui/dist/assets/{index-ydlV29Fj.js => index-z3vRI80T.js} (97%) create mode 100644 ui/src/autocomplete.worker.js diff --git a/plugins/jsvm/internal/types/generated/types.d.ts b/plugins/jsvm/internal/types/generated/types.d.ts index 1a78a85b..658181a1 100644 --- a/plugins/jsvm/internal/types/generated/types.d.ts +++ b/plugins/jsvm/internal/types/generated/types.d.ts @@ -1,4 +1,4 @@ -// 1708547740 +// 1708757858 // GENERATED CODE - DO NOT MODIFY BY HAND // ------------------------------------------------------------------- @@ -1644,8 +1644,8 @@ namespace os { * than ReadFrom. This is used to permit ReadFrom to call io.Copy * without leading to a recursive call to ReadFrom. */ - type _subvCCvT = File - interface fileWithoutReadFrom extends _subvCCvT { + type _subdHcJD = File + interface fileWithoutReadFrom extends _subdHcJD { } interface fileWithoutReadFrom { /** @@ -2302,8 +2302,8 @@ namespace os { /** * File represents an open file descriptor. */ - type _subWGTCD = file - interface File extends _subWGTCD { + type _subhMcvz = file + interface File extends _subhMcvz { } /** * A FileInfo describes a file and is returned by Stat and Lstat. @@ -2704,24 +2704,6 @@ namespace filepath { } } -/** - * Package validation provides configurable and extensible rules for validating data of various types. - */ -namespace ozzo_validation { - /** - * Error interface represents an validation error - */ - interface Error { - [key:string]: any; - error(): string - code(): string - message(): string - setMessage(_arg0: string): Error - params(): _TygojaDict - setParams(_arg0: _TygojaDict): Error - } -} - /** * Package dbx provides a set of DB-agnostic and easy-to-use query building methods for relational databases. */ @@ -3058,14 +3040,14 @@ namespace dbx { /** * MssqlBuilder is the builder for SQL Server databases. */ - type _subxeEvx = BaseBuilder - interface MssqlBuilder extends _subxeEvx { + type _subaywQM = BaseBuilder + interface MssqlBuilder extends _subaywQM { } /** * MssqlQueryBuilder is the query builder for SQL Server databases. */ - type _subiDShp = BaseQueryBuilder - interface MssqlQueryBuilder extends _subiDShp { + type _subnyWbX = BaseQueryBuilder + interface MssqlQueryBuilder extends _subnyWbX { } interface newMssqlBuilder { /** @@ -3136,8 +3118,8 @@ namespace dbx { /** * MysqlBuilder is the builder for MySQL databases. */ - type _subhGnTF = BaseBuilder - interface MysqlBuilder extends _subhGnTF { + type _subtHcpA = BaseBuilder + interface MysqlBuilder extends _subtHcpA { } interface newMysqlBuilder { /** @@ -3212,14 +3194,14 @@ namespace dbx { /** * OciBuilder is the builder for Oracle databases. */ - type _subjSlDc = BaseBuilder - interface OciBuilder extends _subjSlDc { + type _subksqoq = BaseBuilder + interface OciBuilder extends _subksqoq { } /** * OciQueryBuilder is the query builder for Oracle databases. */ - type _subkzKsb = BaseQueryBuilder - interface OciQueryBuilder extends _subkzKsb { + type _subAjpiW = BaseQueryBuilder + interface OciQueryBuilder extends _subAjpiW { } interface newOciBuilder { /** @@ -3282,8 +3264,8 @@ namespace dbx { /** * PgsqlBuilder is the builder for PostgreSQL databases. */ - type _subkHKlK = BaseBuilder - interface PgsqlBuilder extends _subkHKlK { + type _subMsCbx = BaseBuilder + interface PgsqlBuilder extends _subMsCbx { } interface newPgsqlBuilder { /** @@ -3350,8 +3332,8 @@ namespace dbx { /** * SqliteBuilder is the builder for SQLite databases. */ - type _subfmMaf = BaseBuilder - interface SqliteBuilder extends _subfmMaf { + type _sublEQPQ = BaseBuilder + interface SqliteBuilder extends _sublEQPQ { } interface newSqliteBuilder { /** @@ -3450,8 +3432,8 @@ namespace dbx { /** * StandardBuilder is the builder that is used by DB for an unknown driver. */ - type _subwBcKY = BaseBuilder - interface StandardBuilder extends _subwBcKY { + type _subooNyl = BaseBuilder + interface StandardBuilder extends _subooNyl { } interface newStandardBuilder { /** @@ -3517,8 +3499,8 @@ namespace dbx { * DB enhances sql.DB by providing a set of DB-agnostic query building methods. * DB allows easier query building and population of data into Go variables. */ - type _subXAfBs = Builder - interface DB extends _subXAfBs { + type _subTpoez = Builder + interface DB extends _subTpoez { /** * FieldMapper maps struct fields to DB columns. Defaults to DefaultFieldMapFunc. */ @@ -4322,8 +4304,8 @@ namespace dbx { * Rows enhances sql.Rows by providing additional data query methods. * Rows can be obtained by calling Query.Rows(). It is mainly used to populate data row by row. */ - type _subzNnMs = sql.Rows - interface Rows extends _subzNnMs { + type _subVMxJv = sql.Rows + interface Rows extends _subVMxJv { } interface Rows { /** @@ -4685,8 +4667,8 @@ namespace dbx { }): string } interface structInfo { } - type _subvtUqp = structInfo - interface structValue extends _subvtUqp { + type _subbiOTl = structInfo + interface structValue extends _subbiOTl { } interface fieldInfo { } @@ -4739,8 +4721,8 @@ namespace dbx { /** * Tx enhances sql.Tx with additional querying methods. */ - type _subtwCTX = Builder - interface Tx extends _subtwCTX { + type _subYbxWc = Builder + interface Tx extends _subYbxWc { } interface Tx { /** @@ -4756,6 +4738,24 @@ namespace dbx { } } +/** + * Package validation provides configurable and extensible rules for validating data of various types. + */ +namespace ozzo_validation { + /** + * Error interface represents an validation error + */ + interface Error { + [key:string]: any; + error(): string + code(): string + message(): string + setMessage(_arg0: string): Error + params(): _TygojaDict + setParams(_arg0: _TygojaDict): Error + } +} + /** * Package exec runs external commands. It wraps os.StartProcess to make it * easier to remap stdin and stdout, connect I/O with pipes, and do other @@ -5103,8 +5103,8 @@ namespace filesystem { */ open(): io.ReadSeekCloser } - type _subvccXY = bytes.Reader - interface bytesReadSeekCloser extends _subvccXY { + type _subcfeYa = bytes.Reader + interface bytesReadSeekCloser extends _subcfeYa { } interface bytesReadSeekCloser { /** @@ -5323,6 +5323,25 @@ namespace mails { } } +namespace middleware { + interface bodyLimit { + /** + * BodyLimit returns a BodyLimit middleware. + * + * BodyLimit middleware sets the maximum allowed size for a request body, if the size exceeds the configured limit, it + * sends "413 - Request Entity Too Large" response. The BodyLimit is determined based on both `Content-Length` request + * header and actual content read, which makes it super secure. + */ + (limitBytes: number): echo.MiddlewareFunc + } + interface gzip { + /** + * Gzip returns a middleware which compresses HTTP response using gzip compression scheme. + */ + (): echo.MiddlewareFunc + } +} + /** * Package models implements various services used for request data * validation and applying changes to existing DB models through the app Dao. @@ -6240,8 +6259,8 @@ namespace forms { /** * SettingsUpsert is a [settings.Settings] upsert (create/update) form. */ - type _subejzCw = settings.Settings - interface SettingsUpsert extends _subejzCw { + type _subYpGRS = settings.Settings + interface SettingsUpsert extends _subYpGRS { } interface newSettingsUpsert { /** @@ -6330,25 +6349,6 @@ namespace forms { } } -namespace middleware { - interface bodyLimit { - /** - * BodyLimit returns a BodyLimit middleware. - * - * BodyLimit middleware sets the maximum allowed size for a request body, if the size exceeds the configured limit, it - * sends "413 - Request Entity Too Large" response. The BodyLimit is determined based on both `Content-Length` request - * header and actual content read, which makes it super secure. - */ - (limitBytes: number): echo.MiddlewareFunc - } - interface gzip { - /** - * Gzip returns a middleware which compresses HTTP response using gzip compression scheme. - */ - (): echo.MiddlewareFunc - } -} - /** * Package apis implements the default PocketBase api services and middlewares. */ @@ -6691,8 +6691,8 @@ namespace pocketbase { /** * appWrapper serves as a private CoreApp instance wrapper. */ - type _subfdLlU = CoreApp - interface appWrapper extends _subfdLlU { + type _subIjkJb = CoreApp + interface appWrapper extends _subIjkJb { } /** * PocketBase defines a PocketBase app launcher. @@ -6700,8 +6700,8 @@ namespace pocketbase { * It implements [CoreApp] via embedding and all of the app interface methods * could be accessed directly through the instance (eg. PocketBase.DataDir()). */ - type _subStrKG = appWrapper - interface PocketBase extends _subStrKG { + type _subzdmoo = appWrapper + interface PocketBase extends _subzdmoo { /** * RootCmd is the main console command */ @@ -6946,6 +6946,91 @@ namespace io { } } +/** + * Package bytes implements functions for the manipulation of byte slices. + * It is analogous to the facilities of the [strings] package. + */ +namespace bytes { + /** + * A Reader implements the io.Reader, io.ReaderAt, io.WriterTo, io.Seeker, + * io.ByteScanner, and io.RuneScanner interfaces by reading from + * a byte slice. + * Unlike a Buffer, a Reader is read-only and supports seeking. + * The zero value for Reader operates like a Reader of an empty slice. + */ + interface Reader { + } + interface Reader { + /** + * Len returns the number of bytes of the unread portion of the + * slice. + */ + len(): number + } + interface Reader { + /** + * Size returns the original length of the underlying byte slice. + * Size is the number of bytes available for reading via ReadAt. + * The result is unaffected by any method calls except Reset. + */ + size(): number + } + interface Reader { + /** + * Read implements the io.Reader interface. + */ + read(b: string|Array): number + } + interface Reader { + /** + * ReadAt implements the io.ReaderAt interface. + */ + readAt(b: string|Array, off: number): number + } + interface Reader { + /** + * ReadByte implements the io.ByteReader interface. + */ + readByte(): number + } + interface Reader { + /** + * UnreadByte complements ReadByte in implementing the io.ByteScanner interface. + */ + unreadByte(): void + } + interface Reader { + /** + * ReadRune implements the io.RuneReader interface. + */ + readRune(): [number, number] + } + interface Reader { + /** + * UnreadRune complements ReadRune in implementing the io.RuneScanner interface. + */ + unreadRune(): void + } + interface Reader { + /** + * Seek implements the io.Seeker interface. + */ + seek(offset: number, whence: number): number + } + interface Reader { + /** + * WriteTo implements the io.WriterTo interface. + */ + writeTo(w: io.Writer): number + } + interface Reader { + /** + * Reset resets the Reader to be reading from b. + */ + reset(b: string|Array): void + } +} + /** * Package syscall contains an interface to the low-level operating system * primitives. The details vary depending on the underlying system, and @@ -7652,6 +7737,169 @@ namespace time { } } +/** + * Package context defines the Context type, which carries deadlines, + * cancellation signals, and other request-scoped values across API boundaries + * and between processes. + * + * Incoming requests to a server should create a [Context], and outgoing + * calls to servers should accept a Context. The chain of function + * calls between them must propagate the Context, optionally replacing + * it with a derived Context created using [WithCancel], [WithDeadline], + * [WithTimeout], or [WithValue]. When a Context is canceled, all + * Contexts derived from it are also canceled. + * + * The [WithCancel], [WithDeadline], and [WithTimeout] functions take a + * Context (the parent) and return a derived Context (the child) and a + * [CancelFunc]. Calling the CancelFunc cancels the child and its + * children, removes the parent's reference to the child, and stops + * any associated timers. Failing to call the CancelFunc leaks the + * child and its children until the parent is canceled or the timer + * fires. The go vet tool checks that CancelFuncs are used on all + * control-flow paths. + * + * The [WithCancelCause] function returns a [CancelCauseFunc], which + * takes an error and records it as the cancellation cause. Calling + * [Cause] on the canceled context or any of its children retrieves + * the cause. If no cause is specified, Cause(ctx) returns the same + * value as ctx.Err(). + * + * Programs that use Contexts should follow these rules to keep interfaces + * consistent across packages and enable static analysis tools to check context + * propagation: + * + * Do not store Contexts inside a struct type; instead, pass a Context + * explicitly to each function that needs it. The Context should be the first + * parameter, typically named ctx: + * + * ``` + * func DoSomething(ctx context.Context, arg Arg) error { + * // ... use ctx ... + * } + * ``` + * + * Do not pass a nil [Context], even if a function permits it. Pass [context.TODO] + * if you are unsure about which Context to use. + * + * Use context Values only for request-scoped data that transits processes and + * APIs, not for passing optional parameters to functions. + * + * The same Context may be passed to functions running in different goroutines; + * Contexts are safe for simultaneous use by multiple goroutines. + * + * See https://blog.golang.org/context for example code for a server that uses + * Contexts. + */ +namespace context { + /** + * A Context carries a deadline, a cancellation signal, and other values across + * API boundaries. + * + * Context's methods may be called by multiple goroutines simultaneously. + */ + interface Context { + [key:string]: any; + /** + * Deadline returns the time when work done on behalf of this context + * should be canceled. Deadline returns ok==false when no deadline is + * set. Successive calls to Deadline return the same results. + */ + deadline(): [time.Time, boolean] + /** + * Done returns a channel that's closed when work done on behalf of this + * context should be canceled. Done may return nil if this context can + * never be canceled. Successive calls to Done return the same value. + * The close of the Done channel may happen asynchronously, + * after the cancel function returns. + * + * WithCancel arranges for Done to be closed when cancel is called; + * WithDeadline arranges for Done to be closed when the deadline + * expires; WithTimeout arranges for Done to be closed when the timeout + * elapses. + * + * Done is provided for use in select statements: + * + * // Stream generates values with DoSomething and sends them to out + * // until DoSomething returns an error or ctx.Done is closed. + * func Stream(ctx context.Context, out chan<- Value) error { + * for { + * v, err := DoSomething(ctx) + * if err != nil { + * return err + * } + * select { + * case <-ctx.Done(): + * return ctx.Err() + * case out <- v: + * } + * } + * } + * + * See https://blog.golang.org/pipelines for more examples of how to use + * a Done channel for cancellation. + */ + done(): undefined + /** + * If Done is not yet closed, Err returns nil. + * If Done is closed, Err returns a non-nil error explaining why: + * Canceled if the context was canceled + * or DeadlineExceeded if the context's deadline passed. + * After Err returns a non-nil error, successive calls to Err return the same error. + */ + err(): void + /** + * Value returns the value associated with this context for key, or nil + * if no value is associated with key. Successive calls to Value with + * the same key returns the same result. + * + * Use context values only for request-scoped data that transits + * processes and API boundaries, not for passing optional parameters to + * functions. + * + * A key identifies a specific value in a Context. Functions that wish + * to store values in Context typically allocate a key in a global + * variable then use that key as the argument to context.WithValue and + * Context.Value. A key can be any type that supports equality; + * packages should define keys as an unexported type to avoid + * collisions. + * + * Packages that define a Context key should provide type-safe accessors + * for the values stored using that key: + * + * ``` + * // Package user defines a User type that's stored in Contexts. + * package user + * + * import "context" + * + * // User is the type of value stored in the Contexts. + * type User struct {...} + * + * // key is an unexported type for keys defined in this package. + * // This prevents collisions with keys defined in other packages. + * type key int + * + * // userKey is the key for user.User values in Contexts. It is + * // unexported; clients use user.NewContext and user.FromContext + * // instead of using this key directly. + * var userKey key + * + * // NewContext returns a new Context that carries value u. + * func NewContext(ctx context.Context, u *User) context.Context { + * return context.WithValue(ctx, userKey, u) + * } + * + * // FromContext returns the User value stored in ctx, if any. + * func FromContext(ctx context.Context) (*User, bool) { + * u, ok := ctx.Value(userKey).(*User) + * return u, ok + * } + * ``` + */ + value(key: any): any + } +} + /** * Package fs defines basic interfaces to a file system. * A file system can be provided by the host operating system @@ -7847,294 +8095,376 @@ namespace fs { } /** - * Package bytes implements functions for the manipulation of byte slices. - * It is analogous to the facilities of the [strings] package. - */ -namespace bytes { - /** - * A Reader implements the io.Reader, io.ReaderAt, io.WriterTo, io.Seeker, - * io.ByteScanner, and io.RuneScanner interfaces by reading from - * a byte slice. - * Unlike a Buffer, a Reader is read-only and supports seeking. - * The zero value for Reader operates like a Reader of an empty slice. - */ - interface Reader { - } - interface Reader { - /** - * Len returns the number of bytes of the unread portion of the - * slice. - */ - len(): number - } - interface Reader { - /** - * Size returns the original length of the underlying byte slice. - * Size is the number of bytes available for reading via ReadAt. - * The result is unaffected by any method calls except Reset. - */ - size(): number - } - interface Reader { - /** - * Read implements the io.Reader interface. - */ - read(b: string|Array): number - } - interface Reader { - /** - * ReadAt implements the io.ReaderAt interface. - */ - readAt(b: string|Array, off: number): number - } - interface Reader { - /** - * ReadByte implements the io.ByteReader interface. - */ - readByte(): number - } - interface Reader { - /** - * UnreadByte complements ReadByte in implementing the io.ByteScanner interface. - */ - unreadByte(): void - } - interface Reader { - /** - * ReadRune implements the io.RuneReader interface. - */ - readRune(): [number, number] - } - interface Reader { - /** - * UnreadRune complements ReadRune in implementing the io.RuneScanner interface. - */ - unreadRune(): void - } - interface Reader { - /** - * Seek implements the io.Seeker interface. - */ - seek(offset: number, whence: number): number - } - interface Reader { - /** - * WriteTo implements the io.WriterTo interface. - */ - writeTo(w: io.Writer): number - } - interface Reader { - /** - * Reset resets the Reader to be reading from b. - */ - reset(b: string|Array): void - } -} - -/** - * Package context defines the Context type, which carries deadlines, - * cancellation signals, and other request-scoped values across API boundaries - * and between processes. + * Package exec runs external commands. It wraps os.StartProcess to make it + * easier to remap stdin and stdout, connect I/O with pipes, and do other + * adjustments. * - * Incoming requests to a server should create a [Context], and outgoing - * calls to servers should accept a Context. The chain of function - * calls between them must propagate the Context, optionally replacing - * it with a derived Context created using [WithCancel], [WithDeadline], - * [WithTimeout], or [WithValue]. When a Context is canceled, all - * Contexts derived from it are also canceled. + * Unlike the "system" library call from C and other languages, the + * os/exec package intentionally does not invoke the system shell and + * does not expand any glob patterns or handle other expansions, + * pipelines, or redirections typically done by shells. The package + * behaves more like C's "exec" family of functions. To expand glob + * patterns, either call the shell directly, taking care to escape any + * dangerous input, or use the path/filepath package's Glob function. + * To expand environment variables, use package os's ExpandEnv. * - * The [WithCancel], [WithDeadline], and [WithTimeout] functions take a - * Context (the parent) and return a derived Context (the child) and a - * [CancelFunc]. Calling the CancelFunc cancels the child and its - * children, removes the parent's reference to the child, and stops - * any associated timers. Failing to call the CancelFunc leaks the - * child and its children until the parent is canceled or the timer - * fires. The go vet tool checks that CancelFuncs are used on all - * control-flow paths. + * Note that the examples in this package assume a Unix system. + * They may not run on Windows, and they do not run in the Go Playground + * used by golang.org and godoc.org. * - * The [WithCancelCause] function returns a [CancelCauseFunc], which - * takes an error and records it as the cancellation cause. Calling - * [Cause] on the canceled context or any of its children retrieves - * the cause. If no cause is specified, Cause(ctx) returns the same - * value as ctx.Err(). + * # Executables in the current directory * - * Programs that use Contexts should follow these rules to keep interfaces - * consistent across packages and enable static analysis tools to check context - * propagation: + * The functions Command and LookPath look for a program + * in the directories listed in the current path, following the + * conventions of the host operating system. + * Operating systems have for decades included the current + * directory in this search, sometimes implicitly and sometimes + * configured explicitly that way by default. + * Modern practice is that including the current directory + * is usually unexpected and often leads to security problems. * - * Do not store Contexts inside a struct type; instead, pass a Context - * explicitly to each function that needs it. The Context should be the first - * parameter, typically named ctx: + * To avoid those security problems, as of Go 1.19, this package will not resolve a program + * using an implicit or explicit path entry relative to the current directory. + * That is, if you run exec.LookPath("go"), it will not successfully return + * ./go on Unix nor .\go.exe on Windows, no matter how the path is configured. + * Instead, if the usual path algorithms would result in that answer, + * these functions return an error err satisfying errors.Is(err, ErrDot). + * + * For example, consider these two program snippets: * * ``` - * func DoSomething(ctx context.Context, arg Arg) error { - * // ... use ctx ... + * path, err := exec.LookPath("prog") + * if err != nil { + * log.Fatal(err) + * } + * use(path) + * ``` + * + * and + * + * ``` + * cmd := exec.Command("prog") + * if err := cmd.Run(); err != nil { + * log.Fatal(err) * } * ``` * - * Do not pass a nil [Context], even if a function permits it. Pass [context.TODO] - * if you are unsure about which Context to use. + * These will not find and run ./prog or .\prog.exe, + * no matter how the current path is configured. * - * Use context Values only for request-scoped data that transits processes and - * APIs, not for passing optional parameters to functions. + * Code that always wants to run a program from the current directory + * can be rewritten to say "./prog" instead of "prog". * - * The same Context may be passed to functions running in different goroutines; - * Contexts are safe for simultaneous use by multiple goroutines. + * Code that insists on including results from relative path entries + * can instead override the error using an errors.Is check: * - * See https://blog.golang.org/context for example code for a server that uses - * Contexts. + * ``` + * path, err := exec.LookPath("prog") + * if errors.Is(err, exec.ErrDot) { + * err = nil + * } + * if err != nil { + * log.Fatal(err) + * } + * use(path) + * ``` + * + * and + * + * ``` + * cmd := exec.Command("prog") + * if errors.Is(cmd.Err, exec.ErrDot) { + * cmd.Err = nil + * } + * if err := cmd.Run(); err != nil { + * log.Fatal(err) + * } + * ``` + * + * Setting the environment variable GODEBUG=execerrdot=0 + * disables generation of ErrDot entirely, temporarily restoring the pre-Go 1.19 + * behavior for programs that are unable to apply more targeted fixes. + * A future version of Go may remove support for this variable. + * + * Before adding such overrides, make sure you understand the + * security implications of doing so. + * See https://go.dev/blog/path-security for more information. */ -namespace context { +namespace exec { /** - * A Context carries a deadline, a cancellation signal, and other values across - * API boundaries. + * Cmd represents an external command being prepared or run. * - * Context's methods may be called by multiple goroutines simultaneously. + * A Cmd cannot be reused after calling its Run, Output or CombinedOutput + * methods. */ - interface Context { - [key:string]: any; + interface Cmd { /** - * Deadline returns the time when work done on behalf of this context - * should be canceled. Deadline returns ok==false when no deadline is - * set. Successive calls to Deadline return the same results. + * Path is the path of the command to run. + * + * This is the only field that must be set to a non-zero + * value. If Path is relative, it is evaluated relative + * to Dir. */ - deadline(): [time.Time, boolean] + path: string /** - * Done returns a channel that's closed when work done on behalf of this - * context should be canceled. Done may return nil if this context can - * never be canceled. Successive calls to Done return the same value. - * The close of the Done channel may happen asynchronously, - * after the cancel function returns. + * Args holds command line arguments, including the command as Args[0]. + * If the Args field is empty or nil, Run uses {Path}. * - * WithCancel arranges for Done to be closed when cancel is called; - * WithDeadline arranges for Done to be closed when the deadline - * expires; WithTimeout arranges for Done to be closed when the timeout - * elapses. - * - * Done is provided for use in select statements: - * - * // Stream generates values with DoSomething and sends them to out - * // until DoSomething returns an error or ctx.Done is closed. - * func Stream(ctx context.Context, out chan<- Value) error { - * for { - * v, err := DoSomething(ctx) - * if err != nil { - * return err - * } - * select { - * case <-ctx.Done(): - * return ctx.Err() - * case out <- v: - * } - * } - * } - * - * See https://blog.golang.org/pipelines for more examples of how to use - * a Done channel for cancellation. + * In typical use, both Path and Args are set by calling Command. */ - done(): undefined + args: Array /** - * If Done is not yet closed, Err returns nil. - * If Done is closed, Err returns a non-nil error explaining why: - * Canceled if the context was canceled - * or DeadlineExceeded if the context's deadline passed. - * After Err returns a non-nil error, successive calls to Err return the same error. + * Env specifies the environment of the process. + * Each entry is of the form "key=value". + * If Env is nil, the new process uses the current process's + * environment. + * If Env contains duplicate environment keys, only the last + * value in the slice for each duplicate key is used. + * As a special case on Windows, SYSTEMROOT is always added if + * missing and not explicitly set to the empty string. */ - err(): void + env: Array /** - * Value returns the value associated with this context for key, or nil - * if no value is associated with key. Successive calls to Value with - * the same key returns the same result. - * - * Use context values only for request-scoped data that transits - * processes and API boundaries, not for passing optional parameters to - * functions. - * - * A key identifies a specific value in a Context. Functions that wish - * to store values in Context typically allocate a key in a global - * variable then use that key as the argument to context.WithValue and - * Context.Value. A key can be any type that supports equality; - * packages should define keys as an unexported type to avoid - * collisions. - * - * Packages that define a Context key should provide type-safe accessors - * for the values stored using that key: - * - * ``` - * // Package user defines a User type that's stored in Contexts. - * package user - * - * import "context" - * - * // User is the type of value stored in the Contexts. - * type User struct {...} - * - * // key is an unexported type for keys defined in this package. - * // This prevents collisions with keys defined in other packages. - * type key int - * - * // userKey is the key for user.User values in Contexts. It is - * // unexported; clients use user.NewContext and user.FromContext - * // instead of using this key directly. - * var userKey key - * - * // NewContext returns a new Context that carries value u. - * func NewContext(ctx context.Context, u *User) context.Context { - * return context.WithValue(ctx, userKey, u) - * } - * - * // FromContext returns the User value stored in ctx, if any. - * func FromContext(ctx context.Context) (*User, bool) { - * u, ok := ctx.Value(userKey).(*User) - * return u, ok - * } - * ``` + * Dir specifies the working directory of the command. + * If Dir is the empty string, Run runs the command in the + * calling process's current directory. */ - value(key: any): any + dir: string + /** + * Stdin specifies the process's standard input. + * + * If Stdin is nil, the process reads from the null device (os.DevNull). + * + * If Stdin is an *os.File, the process's standard input is connected + * directly to that file. + * + * Otherwise, during the execution of the command a separate + * goroutine reads from Stdin and delivers that data to the command + * over a pipe. In this case, Wait does not complete until the goroutine + * stops copying, either because it has reached the end of Stdin + * (EOF or a read error), or because writing to the pipe returned an error, + * or because a nonzero WaitDelay was set and expired. + */ + stdin: io.Reader + /** + * Stdout and Stderr specify the process's standard output and error. + * + * If either is nil, Run connects the corresponding file descriptor + * to the null device (os.DevNull). + * + * If either is an *os.File, the corresponding output from the process + * is connected directly to that file. + * + * Otherwise, during the execution of the command a separate goroutine + * reads from the process over a pipe and delivers that data to the + * corresponding Writer. In this case, Wait does not complete until the + * goroutine reaches EOF or encounters an error or a nonzero WaitDelay + * expires. + * + * If Stdout and Stderr are the same writer, and have a type that can + * be compared with ==, at most one goroutine at a time will call Write. + */ + stdout: io.Writer + stderr: io.Writer + /** + * ExtraFiles specifies additional open files to be inherited by the + * new process. It does not include standard input, standard output, or + * standard error. If non-nil, entry i becomes file descriptor 3+i. + * + * ExtraFiles is not supported on Windows. + */ + extraFiles: Array<(os.File | undefined)> + /** + * SysProcAttr holds optional, operating system-specific attributes. + * Run passes it to os.StartProcess as the os.ProcAttr's Sys field. + */ + sysProcAttr?: syscall.SysProcAttr + /** + * Process is the underlying process, once started. + */ + process?: os.Process + /** + * ProcessState contains information about an exited process. + * If the process was started successfully, Wait or Run will + * populate its ProcessState when the command completes. + */ + processState?: os.ProcessState + err: Error // LookPath error, if any. + /** + * If Cancel is non-nil, the command must have been created with + * CommandContext and Cancel will be called when the command's + * Context is done. By default, CommandContext sets Cancel to + * call the Kill method on the command's Process. + * + * Typically a custom Cancel will send a signal to the command's + * Process, but it may instead take other actions to initiate cancellation, + * such as closing a stdin or stdout pipe or sending a shutdown request on a + * network socket. + * + * If the command exits with a success status after Cancel is + * called, and Cancel does not return an error equivalent to + * os.ErrProcessDone, then Wait and similar methods will return a non-nil + * error: either an error wrapping the one returned by Cancel, + * or the error from the Context. + * (If the command exits with a non-success status, or Cancel + * returns an error that wraps os.ErrProcessDone, Wait and similar methods + * continue to return the command's usual exit status.) + * + * If Cancel is set to nil, nothing will happen immediately when the command's + * Context is done, but a nonzero WaitDelay will still take effect. That may + * be useful, for example, to work around deadlocks in commands that do not + * support shutdown signals but are expected to always finish quickly. + * + * Cancel will not be called if Start returns a non-nil error. + */ + cancel: () => void + /** + * If WaitDelay is non-zero, it bounds the time spent waiting on two sources + * of unexpected delay in Wait: a child process that fails to exit after the + * associated Context is canceled, and a child process that exits but leaves + * its I/O pipes unclosed. + * + * The WaitDelay timer starts when either the associated Context is done or a + * call to Wait observes that the child process has exited, whichever occurs + * first. When the delay has elapsed, the command shuts down the child process + * and/or its I/O pipes. + * + * If the child process has failed to exit — perhaps because it ignored or + * failed to receive a shutdown signal from a Cancel function, or because no + * Cancel function was set — then it will be terminated using os.Process.Kill. + * + * Then, if the I/O pipes communicating with the child process are still open, + * those pipes are closed in order to unblock any goroutines currently blocked + * on Read or Write calls. + * + * If pipes are closed due to WaitDelay, no Cancel call has occurred, + * and the command has otherwise exited with a successful status, Wait and + * similar methods will return ErrWaitDelay instead of nil. + * + * If WaitDelay is zero (the default), I/O pipes will be read until EOF, + * which might not occur until orphaned subprocesses of the command have + * also closed their descriptors for the pipes. + */ + waitDelay: time.Duration } -} - -/** - * Package multipart implements MIME multipart parsing, as defined in RFC - * 2046. - * - * The implementation is sufficient for HTTP (RFC 2388) and the multipart - * bodies generated by popular browsers. - * - * # Limits - * - * To protect against malicious inputs, this package sets limits on the size - * of the MIME data it processes. - * - * Reader.NextPart and Reader.NextRawPart limit the number of headers in a - * part to 10000 and Reader.ReadForm limits the total number of headers in all - * FileHeaders to 10000. - * These limits may be adjusted with the GODEBUG=multipartmaxheaders= - * setting. - * - * Reader.ReadForm further limits the number of parts in a form to 1000. - * This limit may be adjusted with the GODEBUG=multipartmaxparts= - * setting. - */ -/** - * Copyright 2023 The Go Authors. All rights reserved. - * Use of this source code is governed by a BSD-style - * license that can be found in the LICENSE file. - */ -namespace multipart { - /** - * A FileHeader describes a file part of a multipart request. - */ - interface FileHeader { - filename: string - header: textproto.MIMEHeader - size: number - } - interface FileHeader { + interface Cmd { /** - * Open opens and returns the FileHeader's associated File. + * String returns a human-readable description of c. + * It is intended only for debugging. + * In particular, it is not suitable for use as input to a shell. + * The output of String may vary across Go releases. */ - open(): File + string(): string + } + interface Cmd { + /** + * Run starts the specified command and waits for it to complete. + * + * The returned error is nil if the command runs, has no problems + * copying stdin, stdout, and stderr, and exits with a zero exit + * status. + * + * If the command starts but does not complete successfully, the error is of + * type *ExitError. Other error types may be returned for other situations. + * + * If the calling goroutine has locked the operating system thread + * with runtime.LockOSThread and modified any inheritable OS-level + * thread state (for example, Linux or Plan 9 name spaces), the new + * process will inherit the caller's thread state. + */ + run(): void + } + interface Cmd { + /** + * Start starts the specified command but does not wait for it to complete. + * + * If Start returns successfully, the c.Process field will be set. + * + * After a successful call to Start the Wait method must be called in + * order to release associated system resources. + */ + start(): void + } + interface Cmd { + /** + * Wait waits for the command to exit and waits for any copying to + * stdin or copying from stdout or stderr to complete. + * + * The command must have been started by Start. + * + * The returned error is nil if the command runs, has no problems + * copying stdin, stdout, and stderr, and exits with a zero exit + * status. + * + * If the command fails to run or doesn't complete successfully, the + * error is of type *ExitError. Other error types may be + * returned for I/O problems. + * + * If any of c.Stdin, c.Stdout or c.Stderr are not an *os.File, Wait also waits + * for the respective I/O loop copying to or from the process to complete. + * + * Wait releases any resources associated with the Cmd. + */ + wait(): void + } + interface Cmd { + /** + * Output runs the command and returns its standard output. + * Any returned error will usually be of type *ExitError. + * If c.Stderr was nil, Output populates ExitError.Stderr. + */ + output(): string|Array + } + interface Cmd { + /** + * CombinedOutput runs the command and returns its combined standard + * output and standard error. + */ + combinedOutput(): string|Array + } + interface Cmd { + /** + * StdinPipe returns a pipe that will be connected to the command's + * standard input when the command starts. + * The pipe will be closed automatically after Wait sees the command exit. + * A caller need only call Close to force the pipe to close sooner. + * For example, if the command being run will not exit until standard input + * is closed, the caller must close the pipe. + */ + stdinPipe(): io.WriteCloser + } + interface Cmd { + /** + * StdoutPipe returns a pipe that will be connected to the command's + * standard output when the command starts. + * + * Wait will close the pipe after seeing the command exit, so most callers + * need not close the pipe themselves. It is thus incorrect to call Wait + * before all reads from the pipe have completed. + * For the same reason, it is incorrect to call Run when using StdoutPipe. + * See the example for idiomatic usage. + */ + stdoutPipe(): io.ReadCloser + } + interface Cmd { + /** + * StderrPipe returns a pipe that will be connected to the command's + * standard error when the command starts. + * + * Wait will close the pipe after seeing the command exit, so most callers + * need not close the pipe themselves. It is thus incorrect to call Wait + * before all reads from the pipe have completed. + * For the same reason, it is incorrect to use Run when using StderrPipe. + * See the StdoutPipe example for idiomatic usage. + */ + stderrPipe(): io.ReadCloser + } + interface Cmd { + /** + * Environ returns a copy of the environment in which the command would be run + * as it is currently configured. + */ + environ(): Array } } @@ -8781,6 +9111,50 @@ namespace sql { } } +/** + * Package multipart implements MIME multipart parsing, as defined in RFC + * 2046. + * + * The implementation is sufficient for HTTP (RFC 2388) and the multipart + * bodies generated by popular browsers. + * + * # Limits + * + * To protect against malicious inputs, this package sets limits on the size + * of the MIME data it processes. + * + * Reader.NextPart and Reader.NextRawPart limit the number of headers in a + * part to 10000 and Reader.ReadForm limits the total number of headers in all + * FileHeaders to 10000. + * These limits may be adjusted with the GODEBUG=multipartmaxheaders= + * setting. + * + * Reader.ReadForm further limits the number of parts in a form to 1000. + * This limit may be adjusted with the GODEBUG=multipartmaxparts= + * setting. + */ +/** + * Copyright 2023 The Go Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ +namespace multipart { + /** + * A FileHeader describes a file part of a multipart request. + */ + interface FileHeader { + filename: string + header: textproto.MIMEHeader + size: number + } + interface FileHeader { + /** + * Open opens and returns the FileHeader's associated File. + */ + open(): File + } +} + /** * Package http provides HTTP client and server implementations. * @@ -9693,1389 +10067,6 @@ namespace http { } } -/** - * Package exec runs external commands. It wraps os.StartProcess to make it - * easier to remap stdin and stdout, connect I/O with pipes, and do other - * adjustments. - * - * Unlike the "system" library call from C and other languages, the - * os/exec package intentionally does not invoke the system shell and - * does not expand any glob patterns or handle other expansions, - * pipelines, or redirections typically done by shells. The package - * behaves more like C's "exec" family of functions. To expand glob - * patterns, either call the shell directly, taking care to escape any - * dangerous input, or use the path/filepath package's Glob function. - * To expand environment variables, use package os's ExpandEnv. - * - * Note that the examples in this package assume a Unix system. - * They may not run on Windows, and they do not run in the Go Playground - * used by golang.org and godoc.org. - * - * # Executables in the current directory - * - * The functions Command and LookPath look for a program - * in the directories listed in the current path, following the - * conventions of the host operating system. - * Operating systems have for decades included the current - * directory in this search, sometimes implicitly and sometimes - * configured explicitly that way by default. - * Modern practice is that including the current directory - * is usually unexpected and often leads to security problems. - * - * To avoid those security problems, as of Go 1.19, this package will not resolve a program - * using an implicit or explicit path entry relative to the current directory. - * That is, if you run exec.LookPath("go"), it will not successfully return - * ./go on Unix nor .\go.exe on Windows, no matter how the path is configured. - * Instead, if the usual path algorithms would result in that answer, - * these functions return an error err satisfying errors.Is(err, ErrDot). - * - * For example, consider these two program snippets: - * - * ``` - * path, err := exec.LookPath("prog") - * if err != nil { - * log.Fatal(err) - * } - * use(path) - * ``` - * - * and - * - * ``` - * cmd := exec.Command("prog") - * if err := cmd.Run(); err != nil { - * log.Fatal(err) - * } - * ``` - * - * These will not find and run ./prog or .\prog.exe, - * no matter how the current path is configured. - * - * Code that always wants to run a program from the current directory - * can be rewritten to say "./prog" instead of "prog". - * - * Code that insists on including results from relative path entries - * can instead override the error using an errors.Is check: - * - * ``` - * path, err := exec.LookPath("prog") - * if errors.Is(err, exec.ErrDot) { - * err = nil - * } - * if err != nil { - * log.Fatal(err) - * } - * use(path) - * ``` - * - * and - * - * ``` - * cmd := exec.Command("prog") - * if errors.Is(cmd.Err, exec.ErrDot) { - * cmd.Err = nil - * } - * if err := cmd.Run(); err != nil { - * log.Fatal(err) - * } - * ``` - * - * Setting the environment variable GODEBUG=execerrdot=0 - * disables generation of ErrDot entirely, temporarily restoring the pre-Go 1.19 - * behavior for programs that are unable to apply more targeted fixes. - * A future version of Go may remove support for this variable. - * - * Before adding such overrides, make sure you understand the - * security implications of doing so. - * See https://go.dev/blog/path-security for more information. - */ -namespace exec { - /** - * Cmd represents an external command being prepared or run. - * - * A Cmd cannot be reused after calling its Run, Output or CombinedOutput - * methods. - */ - interface Cmd { - /** - * Path is the path of the command to run. - * - * This is the only field that must be set to a non-zero - * value. If Path is relative, it is evaluated relative - * to Dir. - */ - path: string - /** - * Args holds command line arguments, including the command as Args[0]. - * If the Args field is empty or nil, Run uses {Path}. - * - * In typical use, both Path and Args are set by calling Command. - */ - args: Array - /** - * Env specifies the environment of the process. - * Each entry is of the form "key=value". - * If Env is nil, the new process uses the current process's - * environment. - * If Env contains duplicate environment keys, only the last - * value in the slice for each duplicate key is used. - * As a special case on Windows, SYSTEMROOT is always added if - * missing and not explicitly set to the empty string. - */ - env: Array - /** - * Dir specifies the working directory of the command. - * If Dir is the empty string, Run runs the command in the - * calling process's current directory. - */ - dir: string - /** - * Stdin specifies the process's standard input. - * - * If Stdin is nil, the process reads from the null device (os.DevNull). - * - * If Stdin is an *os.File, the process's standard input is connected - * directly to that file. - * - * Otherwise, during the execution of the command a separate - * goroutine reads from Stdin and delivers that data to the command - * over a pipe. In this case, Wait does not complete until the goroutine - * stops copying, either because it has reached the end of Stdin - * (EOF or a read error), or because writing to the pipe returned an error, - * or because a nonzero WaitDelay was set and expired. - */ - stdin: io.Reader - /** - * Stdout and Stderr specify the process's standard output and error. - * - * If either is nil, Run connects the corresponding file descriptor - * to the null device (os.DevNull). - * - * If either is an *os.File, the corresponding output from the process - * is connected directly to that file. - * - * Otherwise, during the execution of the command a separate goroutine - * reads from the process over a pipe and delivers that data to the - * corresponding Writer. In this case, Wait does not complete until the - * goroutine reaches EOF or encounters an error or a nonzero WaitDelay - * expires. - * - * If Stdout and Stderr are the same writer, and have a type that can - * be compared with ==, at most one goroutine at a time will call Write. - */ - stdout: io.Writer - stderr: io.Writer - /** - * ExtraFiles specifies additional open files to be inherited by the - * new process. It does not include standard input, standard output, or - * standard error. If non-nil, entry i becomes file descriptor 3+i. - * - * ExtraFiles is not supported on Windows. - */ - extraFiles: Array<(os.File | undefined)> - /** - * SysProcAttr holds optional, operating system-specific attributes. - * Run passes it to os.StartProcess as the os.ProcAttr's Sys field. - */ - sysProcAttr?: syscall.SysProcAttr - /** - * Process is the underlying process, once started. - */ - process?: os.Process - /** - * ProcessState contains information about an exited process. - * If the process was started successfully, Wait or Run will - * populate its ProcessState when the command completes. - */ - processState?: os.ProcessState - err: Error // LookPath error, if any. - /** - * If Cancel is non-nil, the command must have been created with - * CommandContext and Cancel will be called when the command's - * Context is done. By default, CommandContext sets Cancel to - * call the Kill method on the command's Process. - * - * Typically a custom Cancel will send a signal to the command's - * Process, but it may instead take other actions to initiate cancellation, - * such as closing a stdin or stdout pipe or sending a shutdown request on a - * network socket. - * - * If the command exits with a success status after Cancel is - * called, and Cancel does not return an error equivalent to - * os.ErrProcessDone, then Wait and similar methods will return a non-nil - * error: either an error wrapping the one returned by Cancel, - * or the error from the Context. - * (If the command exits with a non-success status, or Cancel - * returns an error that wraps os.ErrProcessDone, Wait and similar methods - * continue to return the command's usual exit status.) - * - * If Cancel is set to nil, nothing will happen immediately when the command's - * Context is done, but a nonzero WaitDelay will still take effect. That may - * be useful, for example, to work around deadlocks in commands that do not - * support shutdown signals but are expected to always finish quickly. - * - * Cancel will not be called if Start returns a non-nil error. - */ - cancel: () => void - /** - * If WaitDelay is non-zero, it bounds the time spent waiting on two sources - * of unexpected delay in Wait: a child process that fails to exit after the - * associated Context is canceled, and a child process that exits but leaves - * its I/O pipes unclosed. - * - * The WaitDelay timer starts when either the associated Context is done or a - * call to Wait observes that the child process has exited, whichever occurs - * first. When the delay has elapsed, the command shuts down the child process - * and/or its I/O pipes. - * - * If the child process has failed to exit — perhaps because it ignored or - * failed to receive a shutdown signal from a Cancel function, or because no - * Cancel function was set — then it will be terminated using os.Process.Kill. - * - * Then, if the I/O pipes communicating with the child process are still open, - * those pipes are closed in order to unblock any goroutines currently blocked - * on Read or Write calls. - * - * If pipes are closed due to WaitDelay, no Cancel call has occurred, - * and the command has otherwise exited with a successful status, Wait and - * similar methods will return ErrWaitDelay instead of nil. - * - * If WaitDelay is zero (the default), I/O pipes will be read until EOF, - * which might not occur until orphaned subprocesses of the command have - * also closed their descriptors for the pipes. - */ - waitDelay: time.Duration - } - interface Cmd { - /** - * String returns a human-readable description of c. - * It is intended only for debugging. - * In particular, it is not suitable for use as input to a shell. - * The output of String may vary across Go releases. - */ - string(): string - } - interface Cmd { - /** - * Run starts the specified command and waits for it to complete. - * - * The returned error is nil if the command runs, has no problems - * copying stdin, stdout, and stderr, and exits with a zero exit - * status. - * - * If the command starts but does not complete successfully, the error is of - * type *ExitError. Other error types may be returned for other situations. - * - * If the calling goroutine has locked the operating system thread - * with runtime.LockOSThread and modified any inheritable OS-level - * thread state (for example, Linux or Plan 9 name spaces), the new - * process will inherit the caller's thread state. - */ - run(): void - } - interface Cmd { - /** - * Start starts the specified command but does not wait for it to complete. - * - * If Start returns successfully, the c.Process field will be set. - * - * After a successful call to Start the Wait method must be called in - * order to release associated system resources. - */ - start(): void - } - interface Cmd { - /** - * Wait waits for the command to exit and waits for any copying to - * stdin or copying from stdout or stderr to complete. - * - * The command must have been started by Start. - * - * The returned error is nil if the command runs, has no problems - * copying stdin, stdout, and stderr, and exits with a zero exit - * status. - * - * If the command fails to run or doesn't complete successfully, the - * error is of type *ExitError. Other error types may be - * returned for I/O problems. - * - * If any of c.Stdin, c.Stdout or c.Stderr are not an *os.File, Wait also waits - * for the respective I/O loop copying to or from the process to complete. - * - * Wait releases any resources associated with the Cmd. - */ - wait(): void - } - interface Cmd { - /** - * Output runs the command and returns its standard output. - * Any returned error will usually be of type *ExitError. - * If c.Stderr was nil, Output populates ExitError.Stderr. - */ - output(): string|Array - } - interface Cmd { - /** - * CombinedOutput runs the command and returns its combined standard - * output and standard error. - */ - combinedOutput(): string|Array - } - interface Cmd { - /** - * StdinPipe returns a pipe that will be connected to the command's - * standard input when the command starts. - * The pipe will be closed automatically after Wait sees the command exit. - * A caller need only call Close to force the pipe to close sooner. - * For example, if the command being run will not exit until standard input - * is closed, the caller must close the pipe. - */ - stdinPipe(): io.WriteCloser - } - interface Cmd { - /** - * StdoutPipe returns a pipe that will be connected to the command's - * standard output when the command starts. - * - * Wait will close the pipe after seeing the command exit, so most callers - * need not close the pipe themselves. It is thus incorrect to call Wait - * before all reads from the pipe have completed. - * For the same reason, it is incorrect to call Run when using StdoutPipe. - * See the example for idiomatic usage. - */ - stdoutPipe(): io.ReadCloser - } - interface Cmd { - /** - * StderrPipe returns a pipe that will be connected to the command's - * standard error when the command starts. - * - * Wait will close the pipe after seeing the command exit, so most callers - * need not close the pipe themselves. It is thus incorrect to call Wait - * before all reads from the pipe have completed. - * For the same reason, it is incorrect to use Run when using StderrPipe. - * See the StdoutPipe example for idiomatic usage. - */ - stderrPipe(): io.ReadCloser - } - interface Cmd { - /** - * Environ returns a copy of the environment in which the command would be run - * as it is currently configured. - */ - environ(): Array - } -} - -/** - * Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html - * - * See README.md for more info. - */ -namespace jwt { - /** - * MapClaims is a claims type that uses the map[string]interface{} for JSON decoding. - * This is the default claims type if you don't supply one - */ - interface MapClaims extends _TygojaDict{} - interface MapClaims { - /** - * VerifyAudience Compares the aud claim against cmp. - * If required is false, this method will return true if the value matches or is unset - */ - verifyAudience(cmp: string, req: boolean): boolean - } - interface MapClaims { - /** - * VerifyExpiresAt compares the exp claim against cmp (cmp <= exp). - * If req is false, it will return true, if exp is unset. - */ - verifyExpiresAt(cmp: number, req: boolean): boolean - } - interface MapClaims { - /** - * VerifyIssuedAt compares the exp claim against cmp (cmp >= iat). - * If req is false, it will return true, if iat is unset. - */ - verifyIssuedAt(cmp: number, req: boolean): boolean - } - interface MapClaims { - /** - * VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf). - * If req is false, it will return true, if nbf is unset. - */ - verifyNotBefore(cmp: number, req: boolean): boolean - } - interface MapClaims { - /** - * VerifyIssuer compares the iss claim against cmp. - * If required is false, this method will return true if the value matches or is unset - */ - verifyIssuer(cmp: string, req: boolean): boolean - } - interface MapClaims { - /** - * Valid validates time based claims "exp, iat, nbf". - * There is no accounting for clock skew. - * As well, if any of the above claims are not in the token, it will still - * be considered a valid claim. - */ - valid(): void - } -} - -/** - * Package blob provides an easy and portable way to interact with blobs - * within a storage location. Subpackages contain driver implementations of - * blob for supported services. - * - * See https://gocloud.dev/howto/blob/ for a detailed how-to guide. - * - * *blob.Bucket implements io/fs.FS and io/fs.SubFS, so it can be used with - * functions in that package. - * - * # Errors - * - * The errors returned from this package can be inspected in several ways: - * - * The Code function from gocloud.dev/gcerrors will return an error code, also - * defined in that package, when invoked on an error. - * - * The Bucket.ErrorAs method can retrieve the driver error underlying the returned - * error. - * - * # OpenCensus Integration - * - * OpenCensus supports tracing and metric collection for multiple languages and - * backend providers. See https://opencensus.io. - * - * This API collects OpenCensus traces and metrics for the following methods: - * ``` - * - Attributes - * - Copy - * - Delete - * - ListPage - * - NewRangeReader, from creation until the call to Close. (NewReader and ReadAll - * are included because they call NewRangeReader.) - * - NewWriter, from creation until the call to Close. - * ``` - * - * All trace and metric names begin with the package import path. - * The traces add the method name. - * For example, "gocloud.dev/blob/Attributes". - * The metrics are "completed_calls", a count of completed method calls by driver, - * method and status (error code); and "latency", a distribution of method latency - * by driver and method. - * For example, "gocloud.dev/blob/latency". - * - * It also collects the following metrics: - * ``` - * - gocloud.dev/blob/bytes_read: the total number of bytes read, by driver. - * - gocloud.dev/blob/bytes_written: the total number of bytes written, by driver. - * ``` - * - * To enable trace collection in your application, see "Configure Exporter" at - * https://opencensus.io/quickstart/go/tracing. - * To enable metric collection in your application, see "Exporting stats" at - * https://opencensus.io/quickstart/go/metrics. - */ -namespace blob { - /** - * Reader reads bytes from a blob. - * It implements io.ReadSeekCloser, and must be closed after - * reads are finished. - */ - interface Reader { - } - interface Reader { - /** - * Read implements io.Reader (https://golang.org/pkg/io/#Reader). - */ - read(p: string|Array): number - } - interface Reader { - /** - * Seek implements io.Seeker (https://golang.org/pkg/io/#Seeker). - */ - seek(offset: number, whence: number): number - } - interface Reader { - /** - * Close implements io.Closer (https://golang.org/pkg/io/#Closer). - */ - close(): void - } - interface Reader { - /** - * ContentType returns the MIME type of the blob. - */ - contentType(): string - } - interface Reader { - /** - * ModTime returns the time the blob was last modified. - */ - modTime(): time.Time - } - interface Reader { - /** - * Size returns the size of the blob content in bytes. - */ - size(): number - } - interface Reader { - /** - * As converts i to driver-specific types. - * See https://gocloud.dev/concepts/as/ for background information, the "As" - * examples in this package for examples, and the driver package - * documentation for the specific types supported for that driver. - */ - as(i: { - }): boolean - } - interface Reader { - /** - * WriteTo reads from r and writes to w until there's no more data or - * an error occurs. - * The return value is the number of bytes written to w. - * - * It implements the io.WriterTo interface. - */ - writeTo(w: io.Writer): number - } - /** - * Attributes contains attributes about a blob. - */ - interface Attributes { - /** - * CacheControl specifies caching attributes that services may use - * when serving the blob. - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control - */ - cacheControl: string - /** - * ContentDisposition specifies whether the blob content is expected to be - * displayed inline or as an attachment. - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition - */ - contentDisposition: string - /** - * ContentEncoding specifies the encoding used for the blob's content, if any. - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding - */ - contentEncoding: string - /** - * ContentLanguage specifies the language used in the blob's content, if any. - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language - */ - contentLanguage: string - /** - * ContentType is the MIME type of the blob. It will not be empty. - * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type - */ - contentType: string - /** - * Metadata holds key/value pairs associated with the blob. - * Keys are guaranteed to be in lowercase, even if the backend service - * has case-sensitive keys (although note that Metadata written via - * this package will always be lowercased). If there are duplicate - * case-insensitive keys (e.g., "foo" and "FOO"), only one value - * will be kept, and it is undefined which one. - */ - metadata: _TygojaDict - /** - * CreateTime is the time the blob was created, if available. If not available, - * CreateTime will be the zero time. - */ - createTime: time.Time - /** - * ModTime is the time the blob was last modified. - */ - modTime: time.Time - /** - * Size is the size of the blob's content in bytes. - */ - size: number - /** - * MD5 is an MD5 hash of the blob contents or nil if not available. - */ - md5: string|Array - /** - * ETag for the blob; see https://en.wikipedia.org/wiki/HTTP_ETag. - */ - eTag: string - } - interface Attributes { - /** - * As converts i to driver-specific types. - * See https://gocloud.dev/concepts/as/ for background information, the "As" - * examples in this package for examples, and the driver package - * documentation for the specific types supported for that driver. - */ - as(i: { - }): boolean - } - /** - * ListObject represents a single blob returned from List. - */ - interface ListObject { - /** - * Key is the key for this blob. - */ - key: string - /** - * ModTime is the time the blob was last modified. - */ - modTime: time.Time - /** - * Size is the size of the blob's content in bytes. - */ - size: number - /** - * MD5 is an MD5 hash of the blob contents or nil if not available. - */ - md5: string|Array - /** - * IsDir indicates that this result represents a "directory" in the - * hierarchical namespace, ending in ListOptions.Delimiter. Key can be - * passed as ListOptions.Prefix to list items in the "directory". - * Fields other than Key and IsDir will not be set if IsDir is true. - */ - isDir: boolean - } - interface ListObject { - /** - * As converts i to driver-specific types. - * See https://gocloud.dev/concepts/as/ for background information, the "As" - * examples in this package for examples, and the driver package - * documentation for the specific types supported for that driver. - */ - as(i: { - }): boolean - } -} - -/** - * Package types implements some commonly used db serializable types - * like datetime, json, etc. - */ -namespace types { - /** - * JsonArray defines a slice that is safe for json and db read/write. - */ - interface JsonArray extends Array{} - interface JsonArray { - /** - * MarshalJSON implements the [json.Marshaler] interface. - */ - marshalJSON(): string|Array - } - interface JsonArray { - /** - * Value implements the [driver.Valuer] interface. - */ - value(): any - } - interface JsonArray { - /** - * Scan implements [sql.Scanner] interface to scan the provided value - * into the current JsonArray[T] instance. - */ - scan(value: any): void - } - /** - * JsonMap defines a map that is safe for json and db read/write. - */ - interface JsonMap extends _TygojaDict{} - interface JsonMap { - /** - * MarshalJSON implements the [json.Marshaler] interface. - */ - marshalJSON(): string|Array - } - interface JsonMap { - /** - * Get retrieves a single value from the current JsonMap. - * - * This helper was added primarily to assist the goja integration since custom map types - * don't have direct access to the map keys (https://pkg.go.dev/github.com/dop251/goja#hdr-Maps_with_methods). - */ - get(key: string): any - } - interface JsonMap { - /** - * Set sets a single value in the current JsonMap. - * - * This helper was added primarily to assist the goja integration since custom map types - * don't have direct access to the map keys (https://pkg.go.dev/github.com/dop251/goja#hdr-Maps_with_methods). - */ - set(key: string, value: any): void - } - interface JsonMap { - /** - * Value implements the [driver.Valuer] interface. - */ - value(): any - } - interface JsonMap { - /** - * Scan implements [sql.Scanner] interface to scan the provided value - * into the current `JsonMap` instance. - */ - scan(value: any): void - } -} - -/** - * Package schema implements custom Schema and SchemaField datatypes - * for handling the Collection schema definitions. - */ -namespace schema { - // @ts-ignore - import validation = ozzo_validation - /** - * Schema defines a dynamic db schema as a slice of `SchemaField`s. - */ - interface Schema { - } - interface Schema { - /** - * Fields returns the registered schema fields. - */ - fields(): Array<(SchemaField | undefined)> - } - interface Schema { - /** - * InitFieldsOptions calls `InitOptions()` for all schema fields. - */ - initFieldsOptions(): void - } - interface Schema { - /** - * Clone creates a deep clone of the current schema. - */ - clone(): (Schema) - } - interface Schema { - /** - * AsMap returns a map with all registered schema field. - * The returned map is indexed with each field name. - */ - asMap(): _TygojaDict - } - interface Schema { - /** - * GetFieldById returns a single field by its id. - */ - getFieldById(id: string): (SchemaField) - } - interface Schema { - /** - * GetFieldByName returns a single field by its name. - */ - getFieldByName(name: string): (SchemaField) - } - interface Schema { - /** - * RemoveField removes a single schema field by its id. - * - * This method does nothing if field with `id` doesn't exist. - */ - removeField(id: string): void - } - interface Schema { - /** - * AddField registers the provided newField to the current schema. - * - * If field with `newField.Id` already exist, the existing field is - * replaced with the new one. - * - * Otherwise the new field is appended to the other schema fields. - */ - addField(newField: SchemaField): void - } - interface Schema { - /** - * Validate makes Schema validatable by implementing [validation.Validatable] interface. - * - * Internally calls each individual field's validator and additionally - * checks for invalid renamed fields and field name duplications. - */ - validate(): void - } - interface Schema { - /** - * MarshalJSON implements the [json.Marshaler] interface. - */ - marshalJSON(): string|Array - } - interface Schema { - /** - * UnmarshalJSON implements the [json.Unmarshaler] interface. - * - * On success, all schema field options are auto initialized. - */ - unmarshalJSON(data: string|Array): void - } - interface Schema { - /** - * Value implements the [driver.Valuer] interface. - */ - value(): any - } - interface Schema { - /** - * Scan implements [sql.Scanner] interface to scan the provided value - * into the current Schema instance. - */ - scan(value: any): void - } -} - -/** - * Package models implements all PocketBase DB models and DTOs. - */ -namespace models { - type _subIIJFq = BaseModel - interface Admin extends _subIIJFq { - avatar: number - email: string - tokenKey: string - passwordHash: string - lastResetSentAt: types.DateTime - } - interface Admin { - /** - * TableName returns the Admin model SQL table name. - */ - tableName(): string - } - interface Admin { - /** - * ValidatePassword validates a plain password against the model's password. - */ - validatePassword(password: string): boolean - } - interface Admin { - /** - * SetPassword sets cryptographically secure string to `model.Password`. - * - * Additionally this method also resets the LastResetSentAt and the TokenKey fields. - */ - setPassword(password: string): void - } - interface Admin { - /** - * RefreshTokenKey generates and sets new random token key. - */ - refreshTokenKey(): void - } - // @ts-ignore - import validation = ozzo_validation - type _subidazc = BaseModel - interface Collection extends _subidazc { - name: string - type: string - system: boolean - schema: schema.Schema - indexes: types.JsonArray - /** - * rules - */ - listRule?: string - viewRule?: string - createRule?: string - updateRule?: string - deleteRule?: string - options: types.JsonMap - } - interface Collection { - /** - * TableName returns the Collection model SQL table name. - */ - tableName(): string - } - interface Collection { - /** - * BaseFilesPath returns the storage dir path used by the collection. - */ - baseFilesPath(): string - } - interface Collection { - /** - * IsBase checks if the current collection has "base" type. - */ - isBase(): boolean - } - interface Collection { - /** - * IsAuth checks if the current collection has "auth" type. - */ - isAuth(): boolean - } - interface Collection { - /** - * IsView checks if the current collection has "view" type. - */ - isView(): boolean - } - interface Collection { - /** - * MarshalJSON implements the [json.Marshaler] interface. - */ - marshalJSON(): string|Array - } - interface Collection { - /** - * BaseOptions decodes the current collection options and returns them - * as new [CollectionBaseOptions] instance. - */ - baseOptions(): CollectionBaseOptions - } - interface Collection { - /** - * AuthOptions decodes the current collection options and returns them - * as new [CollectionAuthOptions] instance. - */ - authOptions(): CollectionAuthOptions - } - interface Collection { - /** - * ViewOptions decodes the current collection options and returns them - * as new [CollectionViewOptions] instance. - */ - viewOptions(): CollectionViewOptions - } - interface Collection { - /** - * NormalizeOptions updates the current collection options with a - * new normalized state based on the collection type. - */ - normalizeOptions(): void - } - interface Collection { - /** - * DecodeOptions decodes the current collection options into the - * provided "result" (must be a pointer). - */ - decodeOptions(result: any): void - } - interface Collection { - /** - * SetOptions normalizes and unmarshals the specified options into m.Options. - */ - setOptions(typedOptions: any): void - } - type _subsiLMo = BaseModel - interface ExternalAuth extends _subsiLMo { - collectionId: string - recordId: string - provider: string - providerId: string - } - interface ExternalAuth { - tableName(): string - } - type _subOLAqq = BaseModel - interface Record extends _subOLAqq { - } - interface Record { - /** - * TableName returns the table name associated to the current Record model. - */ - tableName(): string - } - interface Record { - /** - * Collection returns the Collection model associated to the current Record model. - */ - collection(): (Collection) - } - interface Record { - /** - * OriginalCopy returns a copy of the current record model populated - * with its ORIGINAL data state (aka. the initially loaded) and - * everything else reset to the defaults. - */ - originalCopy(): (Record) - } - interface Record { - /** - * CleanCopy returns a copy of the current record model populated only - * with its LATEST data state and everything else reset to the defaults. - */ - cleanCopy(): (Record) - } - interface Record { - /** - * Expand returns a shallow copy of the current Record model expand data. - */ - expand(): _TygojaDict - } - interface Record { - /** - * SetExpand shallow copies the provided data to the current Record model's expand. - */ - setExpand(expand: _TygojaDict): void - } - interface Record { - /** - * MergeExpand merges recursively the provided expand data into - * the current model's expand (if any). - * - * Note that if an expanded prop with the same key is a slice (old or new expand) - * then both old and new records will be merged into a new slice (aka. a :merge: [b,c] => [a,b,c]). - * Otherwise the "old" expanded record will be replace with the "new" one (aka. a :merge: aNew => aNew). - */ - mergeExpand(expand: _TygojaDict): void - } - interface Record { - /** - * SchemaData returns a shallow copy ONLY of the defined record schema fields data. - */ - schemaData(): _TygojaDict - } - interface Record { - /** - * 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. - */ - unknownData(): _TygojaDict - } - interface Record { - /** - * IgnoreEmailVisibility toggles the flag to ignore the auth record email visibility check. - */ - ignoreEmailVisibility(state: boolean): void - } - interface Record { - /** - * WithUnknownData toggles the export/serialization of unknown data fields - * (false by default). - */ - withUnknownData(state: boolean): void - } - interface Record { - /** - * Set sets the provided key-value data pair for the current Record model. - * - * If the record collection has field with name matching the provided "key", - * the value will be further normalized according to the field rules. - */ - set(key: string, value: any): void - } - interface Record { - /** - * Get returns a normalized single record model data value for "key". - */ - get(key: string): any - } - interface Record { - /** - * GetBool returns the data value for "key" as a bool. - */ - getBool(key: string): boolean - } - interface Record { - /** - * GetString returns the data value for "key" as a string. - */ - getString(key: string): string - } - interface Record { - /** - * GetInt returns the data value for "key" as an int. - */ - getInt(key: string): number - } - interface Record { - /** - * GetFloat returns the data value for "key" as a float64. - */ - getFloat(key: string): number - } - interface Record { - /** - * GetTime returns the data value for "key" as a [time.Time] instance. - */ - getTime(key: string): time.Time - } - interface Record { - /** - * GetDateTime returns the data value for "key" as a DateTime instance. - */ - getDateTime(key: string): types.DateTime - } - interface Record { - /** - * GetStringSlice returns the data value for "key" as a slice of unique strings. - */ - getStringSlice(key: string): Array - } - interface Record { - /** - * ExpandedOne retrieves a single relation Record from the already - * loaded expand data of the current model. - * - * If the requested expand relation is multiple, this method returns - * only first available Record from the expanded relation. - * - * Returns nil if there is no such expand relation loaded. - */ - expandedOne(relField: string): (Record) - } - interface Record { - /** - * ExpandedAll retrieves a slice of relation Records from the already - * loaded expand data of the current model. - * - * If the requested expand relation is single, this method normalizes - * the return result and will wrap the single model as a slice. - * - * Returns nil slice if there is no such expand relation loaded. - */ - expandedAll(relField: string): Array<(Record | undefined)> - } - interface Record { - /** - * 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) - * ``` - */ - unmarshalJSONField(key: string, result: any): void - } - interface Record { - /** - * BaseFilesPath returns the storage dir path used by the record. - */ - baseFilesPath(): string - } - interface Record { - /** - * FindFileFieldByFile returns the first file type field for which - * any of the record's data contains the provided filename. - */ - findFileFieldByFile(filename: string): (schema.SchemaField) - } - interface Record { - /** - * Load bulk loads the provided data into the current Record model. - */ - load(data: _TygojaDict): void - } - interface Record { - /** - * ColumnValueMap implements [ColumnValueMapper] interface. - */ - columnValueMap(): _TygojaDict - } - interface Record { - /** - * PublicExport exports only the record fields that are safe to be public. - * - * For auth records, to force the export of the email field you need to set - * `m.IgnoreEmailVisibility(true)`. - */ - publicExport(): _TygojaDict - } - interface Record { - /** - * MarshalJSON implements the [json.Marshaler] interface. - * - * Only the data exported by `PublicExport()` will be serialized. - */ - marshalJSON(): string|Array - } - interface Record { - /** - * UnmarshalJSON implements the [json.Unmarshaler] interface. - */ - unmarshalJSON(data: string|Array): void - } - interface Record { - /** - * ReplaceModifers returns a new map with applied modifier - * values based on the current record and the specified data. - * - * The resolved modifier keys will be removed. - * - * Multiple modifiers will be applied one after another, - * while reusing the previous base key value result (eg. 1; -5; +2 => -2). - * - * Example usage: - * - * ``` - * newData := record.ReplaceModifers(data) - * // record: {"field": 10} - * // data: {"field+": 5} - * // newData: {"field": 15} - * ``` - */ - replaceModifers(data: _TygojaDict): _TygojaDict - } - interface Record { - /** - * Username returns the "username" auth record data value. - */ - username(): string - } - interface Record { - /** - * 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. - */ - setUsername(username: string): void - } - interface Record { - /** - * Email returns the "email" auth record data value. - */ - email(): string - } - interface Record { - /** - * 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. - */ - setEmail(email: string): void - } - interface Record { - /** - * Verified returns the "emailVisibility" auth record data value. - */ - emailVisibility(): boolean - } - interface Record { - /** - * SetEmailVisibility sets the "emailVisibility" auth record data value. - * - * Returns an error if the record is not from an auth collection. - */ - setEmailVisibility(visible: boolean): void - } - interface Record { - /** - * Verified returns the "verified" auth record data value. - */ - verified(): boolean - } - interface Record { - /** - * SetVerified sets the "verified" auth record data value. - * - * Returns an error if the record is not from an auth collection. - */ - setVerified(verified: boolean): void - } - interface Record { - /** - * TokenKey returns the "tokenKey" auth record data value. - */ - tokenKey(): string - } - interface Record { - /** - * SetTokenKey sets the "tokenKey" auth record data value. - * - * Returns an error if the record is not from an auth collection. - */ - setTokenKey(key: string): void - } - interface Record { - /** - * RefreshTokenKey generates and sets new random auth record "tokenKey". - * - * Returns an error if the record is not from an auth collection. - */ - refreshTokenKey(): void - } - interface Record { - /** - * LastResetSentAt returns the "lastResentSentAt" auth record data value. - */ - lastResetSentAt(): types.DateTime - } - interface Record { - /** - * SetLastResetSentAt sets the "lastResentSentAt" auth record data value. - * - * Returns an error if the record is not from an auth collection. - */ - setLastResetSentAt(dateTime: types.DateTime): void - } - interface Record { - /** - * LastVerificationSentAt returns the "lastVerificationSentAt" auth record data value. - */ - lastVerificationSentAt(): types.DateTime - } - interface Record { - /** - * SetLastVerificationSentAt sets an "lastVerificationSentAt" auth record data value. - * - * Returns an error if the record is not from an auth collection. - */ - setLastVerificationSentAt(dateTime: types.DateTime): void - } - interface Record { - /** - * PasswordHash returns the "passwordHash" auth record data value. - */ - passwordHash(): string - } - interface Record { - /** - * 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. - */ - validatePassword(password: string): boolean - } - interface Record { - /** - * 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. - */ - setPassword(password: string): void - } - /** - * RequestInfo defines a HTTP request data struct, usually used - * as part of the `@request.*` filter resolver. - */ - interface RequestInfo { - context: string - query: _TygojaDict - data: _TygojaDict - headers: _TygojaDict - authRecord?: Record - admin?: Admin - method: string - } - interface RequestInfo { - /** - * HasModifierDataKeys loosely checks if the current struct has any modifier Data keys. - */ - hasModifierDataKeys(): boolean - } -} - /** * Package echo implements high performance, minimalist Go web framework. * @@ -11652,6 +10643,1015 @@ namespace echo { } } +/** + * Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html + * + * See README.md for more info. + */ +namespace jwt { + /** + * MapClaims is a claims type that uses the map[string]interface{} for JSON decoding. + * This is the default claims type if you don't supply one + */ + interface MapClaims extends _TygojaDict{} + interface MapClaims { + /** + * VerifyAudience Compares the aud claim against cmp. + * If required is false, this method will return true if the value matches or is unset + */ + verifyAudience(cmp: string, req: boolean): boolean + } + interface MapClaims { + /** + * VerifyExpiresAt compares the exp claim against cmp (cmp <= exp). + * If req is false, it will return true, if exp is unset. + */ + verifyExpiresAt(cmp: number, req: boolean): boolean + } + interface MapClaims { + /** + * VerifyIssuedAt compares the exp claim against cmp (cmp >= iat). + * If req is false, it will return true, if iat is unset. + */ + verifyIssuedAt(cmp: number, req: boolean): boolean + } + interface MapClaims { + /** + * VerifyNotBefore compares the nbf claim against cmp (cmp >= nbf). + * If req is false, it will return true, if nbf is unset. + */ + verifyNotBefore(cmp: number, req: boolean): boolean + } + interface MapClaims { + /** + * VerifyIssuer compares the iss claim against cmp. + * If required is false, this method will return true if the value matches or is unset + */ + verifyIssuer(cmp: string, req: boolean): boolean + } + interface MapClaims { + /** + * Valid validates time based claims "exp, iat, nbf". + * There is no accounting for clock skew. + * As well, if any of the above claims are not in the token, it will still + * be considered a valid claim. + */ + valid(): void + } +} + +/** + * Package blob provides an easy and portable way to interact with blobs + * within a storage location. Subpackages contain driver implementations of + * blob for supported services. + * + * See https://gocloud.dev/howto/blob/ for a detailed how-to guide. + * + * *blob.Bucket implements io/fs.FS and io/fs.SubFS, so it can be used with + * functions in that package. + * + * # Errors + * + * The errors returned from this package can be inspected in several ways: + * + * The Code function from gocloud.dev/gcerrors will return an error code, also + * defined in that package, when invoked on an error. + * + * The Bucket.ErrorAs method can retrieve the driver error underlying the returned + * error. + * + * # OpenCensus Integration + * + * OpenCensus supports tracing and metric collection for multiple languages and + * backend providers. See https://opencensus.io. + * + * This API collects OpenCensus traces and metrics for the following methods: + * ``` + * - Attributes + * - Copy + * - Delete + * - ListPage + * - NewRangeReader, from creation until the call to Close. (NewReader and ReadAll + * are included because they call NewRangeReader.) + * - NewWriter, from creation until the call to Close. + * ``` + * + * All trace and metric names begin with the package import path. + * The traces add the method name. + * For example, "gocloud.dev/blob/Attributes". + * The metrics are "completed_calls", a count of completed method calls by driver, + * method and status (error code); and "latency", a distribution of method latency + * by driver and method. + * For example, "gocloud.dev/blob/latency". + * + * It also collects the following metrics: + * ``` + * - gocloud.dev/blob/bytes_read: the total number of bytes read, by driver. + * - gocloud.dev/blob/bytes_written: the total number of bytes written, by driver. + * ``` + * + * To enable trace collection in your application, see "Configure Exporter" at + * https://opencensus.io/quickstart/go/tracing. + * To enable metric collection in your application, see "Exporting stats" at + * https://opencensus.io/quickstart/go/metrics. + */ +namespace blob { + /** + * Reader reads bytes from a blob. + * It implements io.ReadSeekCloser, and must be closed after + * reads are finished. + */ + interface Reader { + } + interface Reader { + /** + * Read implements io.Reader (https://golang.org/pkg/io/#Reader). + */ + read(p: string|Array): number + } + interface Reader { + /** + * Seek implements io.Seeker (https://golang.org/pkg/io/#Seeker). + */ + seek(offset: number, whence: number): number + } + interface Reader { + /** + * Close implements io.Closer (https://golang.org/pkg/io/#Closer). + */ + close(): void + } + interface Reader { + /** + * ContentType returns the MIME type of the blob. + */ + contentType(): string + } + interface Reader { + /** + * ModTime returns the time the blob was last modified. + */ + modTime(): time.Time + } + interface Reader { + /** + * Size returns the size of the blob content in bytes. + */ + size(): number + } + interface Reader { + /** + * As converts i to driver-specific types. + * See https://gocloud.dev/concepts/as/ for background information, the "As" + * examples in this package for examples, and the driver package + * documentation for the specific types supported for that driver. + */ + as(i: { + }): boolean + } + interface Reader { + /** + * WriteTo reads from r and writes to w until there's no more data or + * an error occurs. + * The return value is the number of bytes written to w. + * + * It implements the io.WriterTo interface. + */ + writeTo(w: io.Writer): number + } + /** + * Attributes contains attributes about a blob. + */ + interface Attributes { + /** + * CacheControl specifies caching attributes that services may use + * when serving the blob. + * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control + */ + cacheControl: string + /** + * ContentDisposition specifies whether the blob content is expected to be + * displayed inline or as an attachment. + * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition + */ + contentDisposition: string + /** + * ContentEncoding specifies the encoding used for the blob's content, if any. + * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding + */ + contentEncoding: string + /** + * ContentLanguage specifies the language used in the blob's content, if any. + * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language + */ + contentLanguage: string + /** + * ContentType is the MIME type of the blob. It will not be empty. + * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type + */ + contentType: string + /** + * Metadata holds key/value pairs associated with the blob. + * Keys are guaranteed to be in lowercase, even if the backend service + * has case-sensitive keys (although note that Metadata written via + * this package will always be lowercased). If there are duplicate + * case-insensitive keys (e.g., "foo" and "FOO"), only one value + * will be kept, and it is undefined which one. + */ + metadata: _TygojaDict + /** + * CreateTime is the time the blob was created, if available. If not available, + * CreateTime will be the zero time. + */ + createTime: time.Time + /** + * ModTime is the time the blob was last modified. + */ + modTime: time.Time + /** + * Size is the size of the blob's content in bytes. + */ + size: number + /** + * MD5 is an MD5 hash of the blob contents or nil if not available. + */ + md5: string|Array + /** + * ETag for the blob; see https://en.wikipedia.org/wiki/HTTP_ETag. + */ + eTag: string + } + interface Attributes { + /** + * As converts i to driver-specific types. + * See https://gocloud.dev/concepts/as/ for background information, the "As" + * examples in this package for examples, and the driver package + * documentation for the specific types supported for that driver. + */ + as(i: { + }): boolean + } + /** + * ListObject represents a single blob returned from List. + */ + interface ListObject { + /** + * Key is the key for this blob. + */ + key: string + /** + * ModTime is the time the blob was last modified. + */ + modTime: time.Time + /** + * Size is the size of the blob's content in bytes. + */ + size: number + /** + * MD5 is an MD5 hash of the blob contents or nil if not available. + */ + md5: string|Array + /** + * IsDir indicates that this result represents a "directory" in the + * hierarchical namespace, ending in ListOptions.Delimiter. Key can be + * passed as ListOptions.Prefix to list items in the "directory". + * Fields other than Key and IsDir will not be set if IsDir is true. + */ + isDir: boolean + } + interface ListObject { + /** + * As converts i to driver-specific types. + * See https://gocloud.dev/concepts/as/ for background information, the "As" + * examples in this package for examples, and the driver package + * documentation for the specific types supported for that driver. + */ + as(i: { + }): boolean + } +} + +/** + * Package types implements some commonly used db serializable types + * like datetime, json, etc. + */ +namespace types { + /** + * JsonArray defines a slice that is safe for json and db read/write. + */ + interface JsonArray extends Array{} + interface JsonArray { + /** + * MarshalJSON implements the [json.Marshaler] interface. + */ + marshalJSON(): string|Array + } + interface JsonArray { + /** + * Value implements the [driver.Valuer] interface. + */ + value(): any + } + interface JsonArray { + /** + * Scan implements [sql.Scanner] interface to scan the provided value + * into the current JsonArray[T] instance. + */ + scan(value: any): void + } + /** + * JsonMap defines a map that is safe for json and db read/write. + */ + interface JsonMap extends _TygojaDict{} + interface JsonMap { + /** + * MarshalJSON implements the [json.Marshaler] interface. + */ + marshalJSON(): string|Array + } + interface JsonMap { + /** + * Get retrieves a single value from the current JsonMap. + * + * This helper was added primarily to assist the goja integration since custom map types + * don't have direct access to the map keys (https://pkg.go.dev/github.com/dop251/goja#hdr-Maps_with_methods). + */ + get(key: string): any + } + interface JsonMap { + /** + * Set sets a single value in the current JsonMap. + * + * This helper was added primarily to assist the goja integration since custom map types + * don't have direct access to the map keys (https://pkg.go.dev/github.com/dop251/goja#hdr-Maps_with_methods). + */ + set(key: string, value: any): void + } + interface JsonMap { + /** + * Value implements the [driver.Valuer] interface. + */ + value(): any + } + interface JsonMap { + /** + * Scan implements [sql.Scanner] interface to scan the provided value + * into the current `JsonMap` instance. + */ + scan(value: any): void + } +} + +/** + * Package schema implements custom Schema and SchemaField datatypes + * for handling the Collection schema definitions. + */ +namespace schema { + // @ts-ignore + import validation = ozzo_validation + /** + * Schema defines a dynamic db schema as a slice of `SchemaField`s. + */ + interface Schema { + } + interface Schema { + /** + * Fields returns the registered schema fields. + */ + fields(): Array<(SchemaField | undefined)> + } + interface Schema { + /** + * InitFieldsOptions calls `InitOptions()` for all schema fields. + */ + initFieldsOptions(): void + } + interface Schema { + /** + * Clone creates a deep clone of the current schema. + */ + clone(): (Schema) + } + interface Schema { + /** + * AsMap returns a map with all registered schema field. + * The returned map is indexed with each field name. + */ + asMap(): _TygojaDict + } + interface Schema { + /** + * GetFieldById returns a single field by its id. + */ + getFieldById(id: string): (SchemaField) + } + interface Schema { + /** + * GetFieldByName returns a single field by its name. + */ + getFieldByName(name: string): (SchemaField) + } + interface Schema { + /** + * RemoveField removes a single schema field by its id. + * + * This method does nothing if field with `id` doesn't exist. + */ + removeField(id: string): void + } + interface Schema { + /** + * AddField registers the provided newField to the current schema. + * + * If field with `newField.Id` already exist, the existing field is + * replaced with the new one. + * + * Otherwise the new field is appended to the other schema fields. + */ + addField(newField: SchemaField): void + } + interface Schema { + /** + * Validate makes Schema validatable by implementing [validation.Validatable] interface. + * + * Internally calls each individual field's validator and additionally + * checks for invalid renamed fields and field name duplications. + */ + validate(): void + } + interface Schema { + /** + * MarshalJSON implements the [json.Marshaler] interface. + */ + marshalJSON(): string|Array + } + interface Schema { + /** + * UnmarshalJSON implements the [json.Unmarshaler] interface. + * + * On success, all schema field options are auto initialized. + */ + unmarshalJSON(data: string|Array): void + } + interface Schema { + /** + * Value implements the [driver.Valuer] interface. + */ + value(): any + } + interface Schema { + /** + * Scan implements [sql.Scanner] interface to scan the provided value + * into the current Schema instance. + */ + scan(value: any): void + } +} + +/** + * Package models implements all PocketBase DB models and DTOs. + */ +namespace models { + type _subuNyHO = BaseModel + interface Admin extends _subuNyHO { + avatar: number + email: string + tokenKey: string + passwordHash: string + lastResetSentAt: types.DateTime + } + interface Admin { + /** + * TableName returns the Admin model SQL table name. + */ + tableName(): string + } + interface Admin { + /** + * ValidatePassword validates a plain password against the model's password. + */ + validatePassword(password: string): boolean + } + interface Admin { + /** + * SetPassword sets cryptographically secure string to `model.Password`. + * + * Additionally this method also resets the LastResetSentAt and the TokenKey fields. + */ + setPassword(password: string): void + } + interface Admin { + /** + * RefreshTokenKey generates and sets new random token key. + */ + refreshTokenKey(): void + } + // @ts-ignore + import validation = ozzo_validation + type _subbjOVf = BaseModel + interface Collection extends _subbjOVf { + name: string + type: string + system: boolean + schema: schema.Schema + indexes: types.JsonArray + /** + * rules + */ + listRule?: string + viewRule?: string + createRule?: string + updateRule?: string + deleteRule?: string + options: types.JsonMap + } + interface Collection { + /** + * TableName returns the Collection model SQL table name. + */ + tableName(): string + } + interface Collection { + /** + * BaseFilesPath returns the storage dir path used by the collection. + */ + baseFilesPath(): string + } + interface Collection { + /** + * IsBase checks if the current collection has "base" type. + */ + isBase(): boolean + } + interface Collection { + /** + * IsAuth checks if the current collection has "auth" type. + */ + isAuth(): boolean + } + interface Collection { + /** + * IsView checks if the current collection has "view" type. + */ + isView(): boolean + } + interface Collection { + /** + * MarshalJSON implements the [json.Marshaler] interface. + */ + marshalJSON(): string|Array + } + interface Collection { + /** + * BaseOptions decodes the current collection options and returns them + * as new [CollectionBaseOptions] instance. + */ + baseOptions(): CollectionBaseOptions + } + interface Collection { + /** + * AuthOptions decodes the current collection options and returns them + * as new [CollectionAuthOptions] instance. + */ + authOptions(): CollectionAuthOptions + } + interface Collection { + /** + * ViewOptions decodes the current collection options and returns them + * as new [CollectionViewOptions] instance. + */ + viewOptions(): CollectionViewOptions + } + interface Collection { + /** + * NormalizeOptions updates the current collection options with a + * new normalized state based on the collection type. + */ + normalizeOptions(): void + } + interface Collection { + /** + * DecodeOptions decodes the current collection options into the + * provided "result" (must be a pointer). + */ + decodeOptions(result: any): void + } + interface Collection { + /** + * SetOptions normalizes and unmarshals the specified options into m.Options. + */ + setOptions(typedOptions: any): void + } + type _subaKbuR = BaseModel + interface ExternalAuth extends _subaKbuR { + collectionId: string + recordId: string + provider: string + providerId: string + } + interface ExternalAuth { + tableName(): string + } + type _subJFlSh = BaseModel + interface Record extends _subJFlSh { + } + interface Record { + /** + * TableName returns the table name associated to the current Record model. + */ + tableName(): string + } + interface Record { + /** + * Collection returns the Collection model associated to the current Record model. + */ + collection(): (Collection) + } + interface Record { + /** + * OriginalCopy returns a copy of the current record model populated + * with its ORIGINAL data state (aka. the initially loaded) and + * everything else reset to the defaults. + */ + originalCopy(): (Record) + } + interface Record { + /** + * CleanCopy returns a copy of the current record model populated only + * with its LATEST data state and everything else reset to the defaults. + */ + cleanCopy(): (Record) + } + interface Record { + /** + * Expand returns a shallow copy of the current Record model expand data. + */ + expand(): _TygojaDict + } + interface Record { + /** + * SetExpand shallow copies the provided data to the current Record model's expand. + */ + setExpand(expand: _TygojaDict): void + } + interface Record { + /** + * MergeExpand merges recursively the provided expand data into + * the current model's expand (if any). + * + * Note that if an expanded prop with the same key is a slice (old or new expand) + * then both old and new records will be merged into a new slice (aka. a :merge: [b,c] => [a,b,c]). + * Otherwise the "old" expanded record will be replace with the "new" one (aka. a :merge: aNew => aNew). + */ + mergeExpand(expand: _TygojaDict): void + } + interface Record { + /** + * SchemaData returns a shallow copy ONLY of the defined record schema fields data. + */ + schemaData(): _TygojaDict + } + interface Record { + /** + * 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. + */ + unknownData(): _TygojaDict + } + interface Record { + /** + * IgnoreEmailVisibility toggles the flag to ignore the auth record email visibility check. + */ + ignoreEmailVisibility(state: boolean): void + } + interface Record { + /** + * WithUnknownData toggles the export/serialization of unknown data fields + * (false by default). + */ + withUnknownData(state: boolean): void + } + interface Record { + /** + * Set sets the provided key-value data pair for the current Record model. + * + * If the record collection has field with name matching the provided "key", + * the value will be further normalized according to the field rules. + */ + set(key: string, value: any): void + } + interface Record { + /** + * Get returns a normalized single record model data value for "key". + */ + get(key: string): any + } + interface Record { + /** + * GetBool returns the data value for "key" as a bool. + */ + getBool(key: string): boolean + } + interface Record { + /** + * GetString returns the data value for "key" as a string. + */ + getString(key: string): string + } + interface Record { + /** + * GetInt returns the data value for "key" as an int. + */ + getInt(key: string): number + } + interface Record { + /** + * GetFloat returns the data value for "key" as a float64. + */ + getFloat(key: string): number + } + interface Record { + /** + * GetTime returns the data value for "key" as a [time.Time] instance. + */ + getTime(key: string): time.Time + } + interface Record { + /** + * GetDateTime returns the data value for "key" as a DateTime instance. + */ + getDateTime(key: string): types.DateTime + } + interface Record { + /** + * GetStringSlice returns the data value for "key" as a slice of unique strings. + */ + getStringSlice(key: string): Array + } + interface Record { + /** + * ExpandedOne retrieves a single relation Record from the already + * loaded expand data of the current model. + * + * If the requested expand relation is multiple, this method returns + * only first available Record from the expanded relation. + * + * Returns nil if there is no such expand relation loaded. + */ + expandedOne(relField: string): (Record) + } + interface Record { + /** + * ExpandedAll retrieves a slice of relation Records from the already + * loaded expand data of the current model. + * + * If the requested expand relation is single, this method normalizes + * the return result and will wrap the single model as a slice. + * + * Returns nil slice if there is no such expand relation loaded. + */ + expandedAll(relField: string): Array<(Record | undefined)> + } + interface Record { + /** + * 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) + * ``` + */ + unmarshalJSONField(key: string, result: any): void + } + interface Record { + /** + * BaseFilesPath returns the storage dir path used by the record. + */ + baseFilesPath(): string + } + interface Record { + /** + * FindFileFieldByFile returns the first file type field for which + * any of the record's data contains the provided filename. + */ + findFileFieldByFile(filename: string): (schema.SchemaField) + } + interface Record { + /** + * Load bulk loads the provided data into the current Record model. + */ + load(data: _TygojaDict): void + } + interface Record { + /** + * ColumnValueMap implements [ColumnValueMapper] interface. + */ + columnValueMap(): _TygojaDict + } + interface Record { + /** + * PublicExport exports only the record fields that are safe to be public. + * + * For auth records, to force the export of the email field you need to set + * `m.IgnoreEmailVisibility(true)`. + */ + publicExport(): _TygojaDict + } + interface Record { + /** + * MarshalJSON implements the [json.Marshaler] interface. + * + * Only the data exported by `PublicExport()` will be serialized. + */ + marshalJSON(): string|Array + } + interface Record { + /** + * UnmarshalJSON implements the [json.Unmarshaler] interface. + */ + unmarshalJSON(data: string|Array): void + } + interface Record { + /** + * ReplaceModifers returns a new map with applied modifier + * values based on the current record and the specified data. + * + * The resolved modifier keys will be removed. + * + * Multiple modifiers will be applied one after another, + * while reusing the previous base key value result (eg. 1; -5; +2 => -2). + * + * Example usage: + * + * ``` + * newData := record.ReplaceModifers(data) + * // record: {"field": 10} + * // data: {"field+": 5} + * // newData: {"field": 15} + * ``` + */ + replaceModifers(data: _TygojaDict): _TygojaDict + } + interface Record { + /** + * Username returns the "username" auth record data value. + */ + username(): string + } + interface Record { + /** + * 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. + */ + setUsername(username: string): void + } + interface Record { + /** + * Email returns the "email" auth record data value. + */ + email(): string + } + interface Record { + /** + * 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. + */ + setEmail(email: string): void + } + interface Record { + /** + * Verified returns the "emailVisibility" auth record data value. + */ + emailVisibility(): boolean + } + interface Record { + /** + * SetEmailVisibility sets the "emailVisibility" auth record data value. + * + * Returns an error if the record is not from an auth collection. + */ + setEmailVisibility(visible: boolean): void + } + interface Record { + /** + * Verified returns the "verified" auth record data value. + */ + verified(): boolean + } + interface Record { + /** + * SetVerified sets the "verified" auth record data value. + * + * Returns an error if the record is not from an auth collection. + */ + setVerified(verified: boolean): void + } + interface Record { + /** + * TokenKey returns the "tokenKey" auth record data value. + */ + tokenKey(): string + } + interface Record { + /** + * SetTokenKey sets the "tokenKey" auth record data value. + * + * Returns an error if the record is not from an auth collection. + */ + setTokenKey(key: string): void + } + interface Record { + /** + * RefreshTokenKey generates and sets new random auth record "tokenKey". + * + * Returns an error if the record is not from an auth collection. + */ + refreshTokenKey(): void + } + interface Record { + /** + * LastResetSentAt returns the "lastResentSentAt" auth record data value. + */ + lastResetSentAt(): types.DateTime + } + interface Record { + /** + * SetLastResetSentAt sets the "lastResentSentAt" auth record data value. + * + * Returns an error if the record is not from an auth collection. + */ + setLastResetSentAt(dateTime: types.DateTime): void + } + interface Record { + /** + * LastVerificationSentAt returns the "lastVerificationSentAt" auth record data value. + */ + lastVerificationSentAt(): types.DateTime + } + interface Record { + /** + * SetLastVerificationSentAt sets an "lastVerificationSentAt" auth record data value. + * + * Returns an error if the record is not from an auth collection. + */ + setLastVerificationSentAt(dateTime: types.DateTime): void + } + interface Record { + /** + * PasswordHash returns the "passwordHash" auth record data value. + */ + passwordHash(): string + } + interface Record { + /** + * 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. + */ + validatePassword(password: string): boolean + } + interface Record { + /** + * 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. + */ + setPassword(password: string): void + } + /** + * RequestInfo defines a HTTP request data struct, usually used + * as part of the `@request.*` filter resolver. + */ + interface RequestInfo { + context: string + query: _TygojaDict + data: _TygojaDict + headers: _TygojaDict + authRecord?: Record + admin?: Admin + method: string + } + interface RequestInfo { + /** + * HasModifierDataKeys loosely checks if the current struct has any modifier Data keys. + */ + hasModifierDataKeys(): boolean + } +} + namespace auth { /** * AuthUser defines a standardized oauth2 user data structure. @@ -11828,6 +11828,7 @@ namespace settings { patreonAuth: AuthProviderConfig mailcowAuth: AuthProviderConfig bitbucketAuth: AuthProviderConfig + planningcenterAuth: AuthProviderConfig } interface Settings { /** @@ -14700,6 +14701,14 @@ namespace time { } } +/** + * Package fs defines basic interfaces to a file system. + * A file system can be provided by the host operating system + * but also by other packages. + */ +namespace fs { +} + /** * Package context defines the Context type, which carries deadlines, * cancellation signals, and other request-scoped values across API boundaries @@ -14756,14 +14765,6 @@ namespace time { namespace context { } -/** - * Package fs defines basic interfaces to a file system. - * A file system can be provided by the host operating system - * but also by other packages. - */ -namespace fs { -} - /** * Package net provides a portable interface for network I/O, including * TCP/IP, UDP, domain name resolution, and Unix domain sockets. @@ -14943,6 +14944,77 @@ namespace net { } } +/** + * Package textproto implements generic support for text-based request/response + * protocols in the style of HTTP, NNTP, and SMTP. + * + * The package provides: + * + * Error, which represents a numeric error response from + * a server. + * + * Pipeline, to manage pipelined requests and responses + * in a client. + * + * Reader, to read numeric response code lines, + * key: value headers, lines wrapped with leading spaces + * on continuation lines, and whole text blocks ending + * with a dot on a line by itself. + * + * Writer, to write dot-encoded text blocks. + * + * Conn, a convenient packaging of Reader, Writer, and Pipeline for use + * with a single network connection. + */ +namespace textproto { + /** + * A MIMEHeader represents a MIME-style header mapping + * keys to sets of values. + */ + interface MIMEHeader extends _TygojaDict{} + interface MIMEHeader { + /** + * Add adds the key, value pair to the header. + * It appends to any existing values associated with key. + */ + add(key: string, value: string): void + } + interface MIMEHeader { + /** + * Set sets the header entries associated with key to + * the single element value. It replaces any existing + * values associated with key. + */ + set(key: string, value: string): void + } + interface MIMEHeader { + /** + * Get gets the first value associated with the given key. + * It is case insensitive; CanonicalMIMEHeaderKey is used + * to canonicalize the provided key. + * If there are no values associated with the key, Get returns "". + * To use non-canonical keys, access the map directly. + */ + get(key: string): string + } + interface MIMEHeader { + /** + * Values returns all values associated with the given key. + * It is case insensitive; CanonicalMIMEHeaderKey is + * used to canonicalize the provided key. To use non-canonical + * keys, access the map directly. + * The returned slice is not a copy. + */ + values(key: string): Array + } + interface MIMEHeader { + /** + * Del deletes the values associated with key. + */ + del(key: string): void + } +} + /** * Package url parses URLs and implements query escaping. */ @@ -15175,73 +15247,226 @@ namespace url { } /** - * Package textproto implements generic support for text-based request/response - * protocols in the style of HTTP, NNTP, and SMTP. + * Package sql provides a generic interface around SQL (or SQL-like) + * databases. * - * The package provides: + * The sql package must be used in conjunction with a database driver. + * See https://golang.org/s/sqldrivers for a list of drivers. * - * Error, which represents a numeric error response from - * a server. + * Drivers that do not support context cancellation will not return until + * after the query is completed. * - * Pipeline, to manage pipelined requests and responses - * in a client. - * - * Reader, to read numeric response code lines, - * key: value headers, lines wrapped with leading spaces - * on continuation lines, and whole text blocks ending - * with a dot on a line by itself. - * - * Writer, to write dot-encoded text blocks. - * - * Conn, a convenient packaging of Reader, Writer, and Pipeline for use - * with a single network connection. + * For usage examples, see the wiki page at + * https://golang.org/s/sqlwiki. */ -namespace textproto { +namespace sql { /** - * A MIMEHeader represents a MIME-style header mapping - * keys to sets of values. + * IsolationLevel is the transaction isolation level used in TxOptions. */ - interface MIMEHeader extends _TygojaDict{} - interface MIMEHeader { + interface IsolationLevel extends Number{} + interface IsolationLevel { /** - * Add adds the key, value pair to the header. - * It appends to any existing values associated with key. + * String returns the name of the transaction isolation level. */ - add(key: string, value: string): void + string(): string } - interface MIMEHeader { + /** + * DBStats contains database statistics. + */ + interface DBStats { + maxOpenConnections: number // Maximum number of open connections to the database. /** - * Set sets the header entries associated with key to - * the single element value. It replaces any existing - * values associated with key. + * Pool Status */ - set(key: string, value: string): void + openConnections: number // The number of established connections both in use and idle. + inUse: number // The number of connections currently in use. + idle: number // The number of idle connections. + /** + * Counters + */ + waitCount: number // The total number of connections waited for. + waitDuration: time.Duration // The total time blocked waiting for a new connection. + maxIdleClosed: number // The total number of connections closed due to SetMaxIdleConns. + maxIdleTimeClosed: number // The total number of connections closed due to SetConnMaxIdleTime. + maxLifetimeClosed: number // The total number of connections closed due to SetConnMaxLifetime. } - interface MIMEHeader { - /** - * Get gets the first value associated with the given key. - * It is case insensitive; CanonicalMIMEHeaderKey is used - * to canonicalize the provided key. - * If there are no values associated with the key, Get returns "". - * To use non-canonical keys, access the map directly. - */ - get(key: string): string + /** + * Conn represents a single database connection rather than a pool of database + * connections. Prefer running queries from DB unless there is a specific + * need for a continuous single database connection. + * + * A Conn must call Close to return the connection to the database pool + * and may do so concurrently with a running query. + * + * After a call to Close, all operations on the + * connection fail with ErrConnDone. + */ + interface Conn { } - interface MIMEHeader { + interface Conn { /** - * Values returns all values associated with the given key. - * It is case insensitive; CanonicalMIMEHeaderKey is - * used to canonicalize the provided key. To use non-canonical - * keys, access the map directly. - * The returned slice is not a copy. + * PingContext verifies the connection to the database is still alive. */ - values(key: string): Array + pingContext(ctx: context.Context): void } - interface MIMEHeader { + interface Conn { /** - * Del deletes the values associated with key. + * ExecContext executes a query without returning any rows. + * The args are for any placeholder parameters in the query. */ - del(key: string): void + execContext(ctx: context.Context, query: string, ...args: any[]): Result + } + interface Conn { + /** + * QueryContext executes a query that returns rows, typically a SELECT. + * The args are for any placeholder parameters in the query. + */ + queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows) + } + interface Conn { + /** + * QueryRowContext executes a query that is expected to return at most one row. + * QueryRowContext always returns a non-nil value. Errors are deferred until + * Row's Scan method is called. + * If the query selects no rows, the *Row's Scan will return ErrNoRows. + * Otherwise, the *Row's Scan scans the first selected row and discards + * the rest. + */ + queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row) + } + interface Conn { + /** + * PrepareContext creates a prepared statement for later queries or executions. + * Multiple queries or executions may be run concurrently from the + * returned statement. + * The caller must call the statement's Close method + * when the statement is no longer needed. + * + * The provided context is used for the preparation of the statement, not for the + * execution of the statement. + */ + prepareContext(ctx: context.Context, query: string): (Stmt) + } + interface Conn { + /** + * Raw executes f exposing the underlying driver connection for the + * duration of f. The driverConn must not be used outside of f. + * + * Once f returns and err is not driver.ErrBadConn, the Conn will continue to be usable + * until Conn.Close is called. + */ + raw(f: (driverConn: any) => void): void + } + interface Conn { + /** + * BeginTx starts a transaction. + * + * The provided context is used until the transaction is committed or rolled back. + * If the context is canceled, the sql package will roll back + * the transaction. Tx.Commit will return an error if the context provided to + * BeginTx is canceled. + * + * The provided TxOptions is optional and may be nil if defaults should be used. + * If a non-default isolation level is used that the driver doesn't support, + * an error will be returned. + */ + beginTx(ctx: context.Context, opts: TxOptions): (Tx) + } + interface Conn { + /** + * Close returns the connection to the connection pool. + * All operations after a Close will return with ErrConnDone. + * Close is safe to call concurrently with other operations and will + * block until all other operations finish. It may be useful to first + * cancel any used context and then call close directly after. + */ + close(): void + } + /** + * ColumnType contains the name and type of a column. + */ + interface ColumnType { + } + interface ColumnType { + /** + * Name returns the name or alias of the column. + */ + name(): string + } + interface ColumnType { + /** + * Length returns the column type length for variable length column types such + * as text and binary field types. If the type length is unbounded the value will + * be math.MaxInt64 (any database limits will still apply). + * If the column type is not variable length, such as an int, or if not supported + * by the driver ok is false. + */ + length(): [number, boolean] + } + interface ColumnType { + /** + * DecimalSize returns the scale and precision of a decimal type. + * If not applicable or if not supported ok is false. + */ + decimalSize(): [number, boolean] + } + interface ColumnType { + /** + * ScanType returns a Go type suitable for scanning into using Rows.Scan. + * If a driver does not support this property ScanType will return + * the type of an empty interface. + */ + scanType(): any + } + interface ColumnType { + /** + * Nullable reports whether the column may be null. + * If a driver does not support this property ok will be false. + */ + nullable(): boolean + } + interface ColumnType { + /** + * DatabaseTypeName returns the database system name of the column type. If an empty + * string is returned, then the driver type name is not supported. + * Consult your driver documentation for a list of driver data types. Length specifiers + * are not included. + * Common type names include "VARCHAR", "TEXT", "NVARCHAR", "DECIMAL", "BOOL", + * "INT", and "BIGINT". + */ + databaseTypeName(): string + } + /** + * Row is the result of calling QueryRow to select a single row. + */ + interface Row { + } + interface Row { + /** + * Scan copies the columns from the matched row into the values + * pointed at by dest. See the documentation on Rows.Scan for details. + * If more than one row matches the query, + * Scan uses the first row and discards the rest. If no row matches + * the query, Scan returns ErrNoRows. + */ + scan(...dest: any[]): void + } + interface Row { + /** + * Err provides a way for wrapping packages to check for + * query errors without calling Scan. + * Err returns the error, if any, that was encountered while running the query. + * If this error is not nil, this error will also be returned from Scan. + */ + err(): void + } +} + +namespace migrate { + interface Migration { + file: string + up: (db: dbx.Builder) => void + down: (db: dbx.Builder) => void } } @@ -15769,517 +15994,97 @@ namespace http { } /** - * Package echo implements high performance, minimalist Go web framework. - * - * Example: - * - * ``` - * package main - * - * import ( - * "github.com/labstack/echo/v5" - * "github.com/labstack/echo/v5/middleware" - * "log" - * "net/http" - * ) - * - * // Handler - * func hello(c echo.Context) error { - * return c.String(http.StatusOK, "Hello, World!") - * } - * - * func main() { - * // Echo instance - * e := echo.New() - * - * // Middleware - * e.Use(middleware.Logger()) - * e.Use(middleware.Recover()) - * - * // Routes - * e.GET("/", hello) - * - * // Start server - * if err := e.Start(":8080"); err != http.ErrServerClosed { - * log.Fatal(err) - * } - * } - * ``` - * - * Learn more at https://echo.labstack.com + * Package oauth2 provides support for making + * OAuth2 authorized and authenticated HTTP requests, + * as specified in RFC 6749. + * It can additionally grant authorization with Bearer JWT. */ -namespace echo { - /** - * Binder is the interface that wraps the Bind method. - */ - interface Binder { - [key:string]: any; - bind(c: Context, i: { - }): void - } - /** - * ServableContext is interface that Echo context implementation must implement to be usable in middleware/handlers and - * be able to be routed by Router. - */ - interface ServableContext { - [key:string]: any; - /** - * Reset resets the context after request completes. It must be called along - * with `Echo#AcquireContext()` and `Echo#ReleaseContext()`. - * See `Echo#ServeHTTP()` - */ - reset(r: http.Request, w: http.ResponseWriter): void - } - // @ts-ignore - import stdContext = context - /** - * JSONSerializer is the interface that encodes and decodes JSON to and from interfaces. - */ - interface JSONSerializer { - [key:string]: any; - serialize(c: Context, i: { - }, indent: string): void - deserialize(c: Context, i: { - }): void - } - /** - * HTTPErrorHandler is a centralized HTTP error handler. - */ - interface HTTPErrorHandler {(c: Context, err: Error): void } - /** - * Validator is the interface that wraps the Validate function. - */ - interface Validator { - [key:string]: any; - validate(i: { - }): void - } - /** - * Renderer is the interface that wraps the Render function. - */ - interface Renderer { - [key:string]: any; - render(_arg0: io.Writer, _arg1: string, _arg2: { - }, _arg3: Context): void - } - /** - * Group is a set of sub-routes for a specified route. It can be used for inner - * routes that share a common middleware or functionality that should be separate - * from the parent echo instance while still inheriting from it. - */ - interface Group { - } - interface Group { - /** - * Use implements `Echo#Use()` for sub-routes within the Group. - * Group middlewares are not executed on request when there is no matching route found. - */ - use(...middleware: MiddlewareFunc[]): void - } - interface Group { - /** - * CONNECT implements `Echo#CONNECT()` for sub-routes within the Group. Panics on error. - */ - connect(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * DELETE implements `Echo#DELETE()` for sub-routes within the Group. Panics on error. - */ - delete(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * GET implements `Echo#GET()` for sub-routes within the Group. Panics on error. - */ - get(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * HEAD implements `Echo#HEAD()` for sub-routes within the Group. Panics on error. - */ - head(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * OPTIONS implements `Echo#OPTIONS()` for sub-routes within the Group. Panics on error. - */ - options(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * PATCH implements `Echo#PATCH()` for sub-routes within the Group. Panics on error. - */ - patch(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * POST implements `Echo#POST()` for sub-routes within the Group. Panics on error. - */ - post(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * PUT implements `Echo#PUT()` for sub-routes within the Group. Panics on error. - */ - put(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * TRACE implements `Echo#TRACE()` for sub-routes within the Group. Panics on error. - */ - trace(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * Any implements `Echo#Any()` for sub-routes within the Group. Panics on error. - */ - any(path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes - } - interface Group { - /** - * Match implements `Echo#Match()` for sub-routes within the Group. Panics on error. - */ - match(methods: Array, path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes - } - interface Group { - /** - * Group creates a new sub-group with prefix and optional sub-group-level middleware. - * Important! Group middlewares are only executed in case there was exact route match and not - * for 404 (not found) or 405 (method not allowed) cases. If this kind of behaviour is needed then add - * a catch-all route `/*` for the group which handler returns always 404 - */ - group(prefix: string, ...middleware: MiddlewareFunc[]): (Group) - } - interface Group { - /** - * Static implements `Echo#Static()` for sub-routes within the Group. - */ - static(pathPrefix: string, fsRoot: string): RouteInfo - } - interface Group { - /** - * StaticFS implements `Echo#StaticFS()` for sub-routes within the Group. - * - * When dealing with `embed.FS` use `fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary - * prefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths - * including `assets/images` as their prefix. - */ - staticFS(pathPrefix: string, filesystem: fs.FS): RouteInfo - } - interface Group { - /** - * FileFS implements `Echo#FileFS()` for sub-routes within the Group. - */ - fileFS(path: string, file: string, filesystem: fs.FS, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * File implements `Echo#File()` for sub-routes within the Group. Panics on error. - */ - file(path: string, file: string, ...middleware: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * RouteNotFound implements `Echo#RouteNotFound()` for sub-routes within the Group. - * - * Example: `g.RouteNotFound("/*", func(c echo.Context) error { return c.NoContent(http.StatusNotFound) })` - */ - routeNotFound(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * Add implements `Echo#Add()` for sub-routes within the Group. Panics on error. - */ - add(method: string, path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): RouteInfo - } - interface Group { - /** - * AddRoute registers a new Routable with Router - */ - addRoute(route: Routable): RouteInfo - } - /** - * IPExtractor is a function to extract IP addr from http.Request. - * Set appropriate one to Echo#IPExtractor. - * See https://echo.labstack.com/guide/ip-address for more details. - */ - interface IPExtractor {(_arg0: http.Request): string } - /** - * Logger defines the logging interface that Echo uses internally in few places. - * For logging in handlers use your own logger instance (dependency injected or package/public variable) from logging framework of your choice. - */ - interface Logger { - [key:string]: any; - /** - * Write provides writer interface for http.Server `ErrorLog` and for logging startup messages. - * `http.Server.ErrorLog` logs errors from accepting connections, unexpected behavior from handlers, - * and underlying FileSystem errors. - * `logger` middleware will use this method to write its JSON payload. - */ - write(p: string|Array): number - /** - * Error logs the error - */ - error(err: Error): void - } - /** - * Response wraps an http.ResponseWriter and implements its interface to be used - * by an HTTP handler to construct an HTTP response. - * See: https://golang.org/pkg/net/http/#ResponseWriter - */ - interface Response { - writer: http.ResponseWriter - status: number - size: number - committed: boolean - } - interface Response { - /** - * Header returns the header map for the writer that will be sent by - * WriteHeader. Changing the header after a call to WriteHeader (or Write) has - * no effect unless the modified headers were declared as trailers by setting - * the "Trailer" header before the call to WriteHeader (see example) - * To suppress implicit response headers, set their value to nil. - * Example: https://golang.org/pkg/net/http/#example_ResponseWriter_trailers - */ - header(): http.Header - } - interface Response { - /** - * Before registers a function which is called just before the response is written. - */ - before(fn: () => void): void - } - interface Response { - /** - * After registers a function which is called just after the response is written. - * If the `Content-Length` is unknown, none of the after function is executed. - */ - after(fn: () => void): void - } - interface Response { - /** - * WriteHeader sends an HTTP response header with status code. If WriteHeader is - * not called explicitly, the first call to Write will trigger an implicit - * WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly - * used to send error codes. - */ - writeHeader(code: number): void - } - interface Response { - /** - * Write writes the data to the connection as part of an HTTP reply. - */ - write(b: string|Array): number - } - interface Response { - /** - * Flush implements the http.Flusher interface to allow an HTTP handler to flush - * buffered data to the client. - * See [http.Flusher](https://golang.org/pkg/net/http/#Flusher) - */ - flush(): void - } - interface Response { - /** - * Hijack implements the http.Hijacker interface to allow an HTTP handler to - * take over the connection. - * See [http.Hijacker](https://golang.org/pkg/net/http/#Hijacker) - */ - hijack(): [net.Conn, (bufio.ReadWriter)] - } - interface Response { - /** - * Unwrap returns the original http.ResponseWriter. - * ResponseController can be used to access the original http.ResponseWriter. - * See [https://go.dev/blog/go1.20] - */ - unwrap(): http.ResponseWriter - } - interface Routes { - /** - * Reverse reverses route to URL string by replacing path parameters with given params values. - */ - reverse(name: string, ...params: { - }[]): string - } - interface Routes { - /** - * FindByMethodPath searched for matching route info by method and path - */ - findByMethodPath(method: string, path: string): RouteInfo - } - interface Routes { - /** - * FilterByMethod searched for matching route info by method - */ - filterByMethod(method: string): Routes - } - interface Routes { - /** - * FilterByPath searched for matching route info by path - */ - filterByPath(path: string): Routes - } - interface Routes { - /** - * FilterByName searched for matching route info by name - */ - filterByName(name: string): Routes - } - /** - * Router is interface for routing request contexts to registered routes. - * - * Contract between Echo/Context instance and the router: - * ``` - * - all routes must be added through methods on echo.Echo instance. - * Reason: Echo instance uses RouteInfo.Params() length to allocate slice for paths parameters (see `Echo.contextPathParamAllocSize`). - * - Router must populate Context during Router.Route call with: - * - RoutableContext.SetPath - * - RoutableContext.SetRawPathParams (IMPORTANT! with same slice pointer that c.RawPathParams() returns) - * - RoutableContext.SetRouteInfo - * And optionally can set additional information to Context with RoutableContext.Set - * ``` - */ - interface Router { - [key:string]: any; - /** - * Add registers Routable with the Router and returns registered RouteInfo - */ - add(routable: Routable): RouteInfo - /** - * Remove removes route from the Router - */ - remove(method: string, path: string): void - /** - * Routes returns information about all registered routes - */ - routes(): Routes - /** - * Route searches Router for matching route and applies it to the given context. In case when no matching method - * was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404 - * handler function. - */ - route(c: RoutableContext): HandlerFunc - } - /** - * Routable is interface for registering Route with Router. During route registration process the Router will - * convert Routable to RouteInfo with ToRouteInfo method. By creating custom implementation of Routable additional - * information about registered route can be stored in Routes (i.e. privileges used with route etc.) - */ - interface Routable { - [key:string]: any; - /** - * ToRouteInfo converts Routable to RouteInfo - * - * This method is meant to be used by Router after it parses url for path parameters, to store information about - * route just added. - */ - toRouteInfo(params: Array): RouteInfo - /** - * ToRoute converts Routable to Route which Router uses to register the method handler for path. - * - * This method is meant to be used by Router to get fields (including handler and middleware functions) needed to - * add Route to Router. - */ - toRoute(): Route - /** - * ForGroup recreates routable with added group prefix and group middlewares it is grouped to. - * - * Is necessary for Echo.Group to be able to add/register Routable with Router and having group prefix and group - * middlewares included in actually registered Route. - */ - forGroup(pathPrefix: string, middlewares: Array): Routable - } - /** - * Routes is collection of RouteInfo instances with various helper methods. - */ - interface Routes extends Array{} - /** - * RouteInfo describes registered route base fields. - * Method+Path pair uniquely identifies the Route. Name can have duplicates. - */ - interface RouteInfo { - [key:string]: any; - method(): string - path(): string - name(): string - params(): Array - /** - * Reverse reverses route to URL string by replacing path parameters with given params values. - */ - reverse(...params: { - }[]): string - } - /** - * PathParams is collections of PathParam instances with various helper methods - */ - interface PathParams extends Array{} - interface PathParams { - /** - * Get returns path parameter value for given name or default value. - */ - get(name: string, defaultValue: string): string - } -} - /** - * Package types implements some commonly used db serializable types - * like datetime, json, etc. + * Copyright 2023 The Go Authors. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. */ -namespace types { +namespace oauth2 { /** - * DateTime represents a [time.Time] instance in UTC that is wrapped - * and serialized using the app default date layout. + * An AuthCodeOption is passed to Config.AuthCodeURL. */ - interface DateTime { + interface AuthCodeOption { + [key:string]: any; } - interface DateTime { + /** + * Token represents the credentials used to authorize + * the requests to access protected resources on the OAuth 2.0 + * provider's backend. + * + * Most users of this package should not access fields of Token + * directly. They're exported mostly for use by related packages + * implementing derivative OAuth2 flows. + */ + interface Token { /** - * Time returns the internal [time.Time] instance. + * AccessToken is the token that authorizes and authenticates + * the requests. */ - time(): time.Time - } - interface DateTime { + accessToken: string /** - * IsZero checks whether the current DateTime instance has zero time value. + * TokenType is the type of token. + * The Type method returns either this or "Bearer", the default. */ - isZero(): boolean - } - interface DateTime { + tokenType: string /** - * String serializes the current DateTime instance into a formatted - * UTC date string. + * RefreshToken is a token that's used by the application + * (as opposed to the user) to refresh the access token + * if it expires. + */ + refreshToken: string + /** + * Expiry is the optional expiration time of the access token. * - * The zero value is serialized to an empty string. + * If zero, TokenSource implementations will reuse the same + * token forever and RefreshToken or equivalent + * mechanisms for that TokenSource will not be used. */ - string(): string + expiry: time.Time } - interface DateTime { + interface Token { /** - * MarshalJSON implements the [json.Marshaler] interface. + * Type returns t.TokenType if non-empty, else "Bearer". */ - marshalJSON(): string|Array + type(): string } - interface DateTime { + interface Token { /** - * UnmarshalJSON implements the [json.Unmarshaler] interface. + * SetAuthHeader sets the Authorization header to r using the access + * token in t. + * + * This method is unnecessary when using Transport or an HTTP Client + * returned by this package. */ - unmarshalJSON(b: string|Array): void + setAuthHeader(r: http.Request): void } - interface DateTime { + interface Token { /** - * Value implements the [driver.Valuer] interface. + * WithExtra returns a new Token that's a clone of t, but using the + * provided raw extra map. This is only intended for use by packages + * implementing derivative OAuth2 flows. */ - value(): any + withExtra(extra: { + }): (Token) } - interface DateTime { + interface Token { /** - * Scan implements [sql.Scanner] interface to scan the provided value - * into the current DateTime instance. + * Extra returns an extra field. + * Extra fields are key-value pairs returned by the server as a + * part of the token retrieval response. */ - scan(value: any): void + extra(key: string): { + } + } + interface Token { + /** + * Valid reports whether t is non-nil, has an AccessToken, and is not expired. + */ + valid(): boolean } } @@ -16772,218 +16577,517 @@ namespace slog { } /** - * Package sql provides a generic interface around SQL (or SQL-like) - * databases. - * - * The sql package must be used in conjunction with a database driver. - * See https://golang.org/s/sqldrivers for a list of drivers. - * - * Drivers that do not support context cancellation will not return until - * after the query is completed. - * - * For usage examples, see the wiki page at - * https://golang.org/s/sqlwiki. + * Package types implements some commonly used db serializable types + * like datetime, json, etc. */ -namespace sql { +namespace types { /** - * IsolationLevel is the transaction isolation level used in TxOptions. + * DateTime represents a [time.Time] instance in UTC that is wrapped + * and serialized using the app default date layout. */ - interface IsolationLevel extends Number{} - interface IsolationLevel { + interface DateTime { + } + interface DateTime { /** - * String returns the name of the transaction isolation level. + * Time returns the internal [time.Time] instance. + */ + time(): time.Time + } + interface DateTime { + /** + * IsZero checks whether the current DateTime instance has zero time value. + */ + isZero(): boolean + } + interface DateTime { + /** + * String serializes the current DateTime instance into a formatted + * UTC date string. + * + * The zero value is serialized to an empty string. */ string(): string } + interface DateTime { + /** + * MarshalJSON implements the [json.Marshaler] interface. + */ + marshalJSON(): string|Array + } + interface DateTime { + /** + * UnmarshalJSON implements the [json.Unmarshaler] interface. + */ + unmarshalJSON(b: string|Array): void + } + interface DateTime { + /** + * Value implements the [driver.Valuer] interface. + */ + value(): any + } + interface DateTime { + /** + * Scan implements [sql.Scanner] interface to scan the provided value + * into the current DateTime instance. + */ + scan(value: any): void + } +} + +/** + * Package echo implements high performance, minimalist Go web framework. + * + * Example: + * + * ``` + * package main + * + * import ( + * "github.com/labstack/echo/v5" + * "github.com/labstack/echo/v5/middleware" + * "log" + * "net/http" + * ) + * + * // Handler + * func hello(c echo.Context) error { + * return c.String(http.StatusOK, "Hello, World!") + * } + * + * func main() { + * // Echo instance + * e := echo.New() + * + * // Middleware + * e.Use(middleware.Logger()) + * e.Use(middleware.Recover()) + * + * // Routes + * e.GET("/", hello) + * + * // Start server + * if err := e.Start(":8080"); err != http.ErrServerClosed { + * log.Fatal(err) + * } + * } + * ``` + * + * Learn more at https://echo.labstack.com + */ +namespace echo { /** - * DBStats contains database statistics. + * Binder is the interface that wraps the Bind method. */ - interface DBStats { - maxOpenConnections: number // Maximum number of open connections to the database. - /** - * Pool Status - */ - openConnections: number // The number of established connections both in use and idle. - inUse: number // The number of connections currently in use. - idle: number // The number of idle connections. - /** - * Counters - */ - waitCount: number // The total number of connections waited for. - waitDuration: time.Duration // The total time blocked waiting for a new connection. - maxIdleClosed: number // The total number of connections closed due to SetMaxIdleConns. - maxIdleTimeClosed: number // The total number of connections closed due to SetConnMaxIdleTime. - maxLifetimeClosed: number // The total number of connections closed due to SetConnMaxLifetime. + interface Binder { + [key:string]: any; + bind(c: Context, i: { + }): void } /** - * Conn represents a single database connection rather than a pool of database - * connections. Prefer running queries from DB unless there is a specific - * need for a continuous single database connection. + * ServableContext is interface that Echo context implementation must implement to be usable in middleware/handlers and + * be able to be routed by Router. + */ + interface ServableContext { + [key:string]: any; + /** + * Reset resets the context after request completes. It must be called along + * with `Echo#AcquireContext()` and `Echo#ReleaseContext()`. + * See `Echo#ServeHTTP()` + */ + reset(r: http.Request, w: http.ResponseWriter): void + } + // @ts-ignore + import stdContext = context + /** + * JSONSerializer is the interface that encodes and decodes JSON to and from interfaces. + */ + interface JSONSerializer { + [key:string]: any; + serialize(c: Context, i: { + }, indent: string): void + deserialize(c: Context, i: { + }): void + } + /** + * HTTPErrorHandler is a centralized HTTP error handler. + */ + interface HTTPErrorHandler {(c: Context, err: Error): void } + /** + * Validator is the interface that wraps the Validate function. + */ + interface Validator { + [key:string]: any; + validate(i: { + }): void + } + /** + * Renderer is the interface that wraps the Render function. + */ + interface Renderer { + [key:string]: any; + render(_arg0: io.Writer, _arg1: string, _arg2: { + }, _arg3: Context): void + } + /** + * Group is a set of sub-routes for a specified route. It can be used for inner + * routes that share a common middleware or functionality that should be separate + * from the parent echo instance while still inheriting from it. + */ + interface Group { + } + interface Group { + /** + * Use implements `Echo#Use()` for sub-routes within the Group. + * Group middlewares are not executed on request when there is no matching route found. + */ + use(...middleware: MiddlewareFunc[]): void + } + interface Group { + /** + * CONNECT implements `Echo#CONNECT()` for sub-routes within the Group. Panics on error. + */ + connect(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * DELETE implements `Echo#DELETE()` for sub-routes within the Group. Panics on error. + */ + delete(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * GET implements `Echo#GET()` for sub-routes within the Group. Panics on error. + */ + get(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * HEAD implements `Echo#HEAD()` for sub-routes within the Group. Panics on error. + */ + head(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * OPTIONS implements `Echo#OPTIONS()` for sub-routes within the Group. Panics on error. + */ + options(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * PATCH implements `Echo#PATCH()` for sub-routes within the Group. Panics on error. + */ + patch(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * POST implements `Echo#POST()` for sub-routes within the Group. Panics on error. + */ + post(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * PUT implements `Echo#PUT()` for sub-routes within the Group. Panics on error. + */ + put(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * TRACE implements `Echo#TRACE()` for sub-routes within the Group. Panics on error. + */ + trace(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * Any implements `Echo#Any()` for sub-routes within the Group. Panics on error. + */ + any(path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes + } + interface Group { + /** + * Match implements `Echo#Match()` for sub-routes within the Group. Panics on error. + */ + match(methods: Array, path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): Routes + } + interface Group { + /** + * Group creates a new sub-group with prefix and optional sub-group-level middleware. + * Important! Group middlewares are only executed in case there was exact route match and not + * for 404 (not found) or 405 (method not allowed) cases. If this kind of behaviour is needed then add + * a catch-all route `/*` for the group which handler returns always 404 + */ + group(prefix: string, ...middleware: MiddlewareFunc[]): (Group) + } + interface Group { + /** + * Static implements `Echo#Static()` for sub-routes within the Group. + */ + static(pathPrefix: string, fsRoot: string): RouteInfo + } + interface Group { + /** + * StaticFS implements `Echo#StaticFS()` for sub-routes within the Group. + * + * When dealing with `embed.FS` use `fs := echo.MustSubFS(fs, "rootDirectory") to create sub fs which uses necessary + * prefix for directory path. This is necessary as `//go:embed assets/images` embeds files with paths + * including `assets/images` as their prefix. + */ + staticFS(pathPrefix: string, filesystem: fs.FS): RouteInfo + } + interface Group { + /** + * FileFS implements `Echo#FileFS()` for sub-routes within the Group. + */ + fileFS(path: string, file: string, filesystem: fs.FS, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * File implements `Echo#File()` for sub-routes within the Group. Panics on error. + */ + file(path: string, file: string, ...middleware: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * RouteNotFound implements `Echo#RouteNotFound()` for sub-routes within the Group. + * + * Example: `g.RouteNotFound("/*", func(c echo.Context) error { return c.NoContent(http.StatusNotFound) })` + */ + routeNotFound(path: string, h: HandlerFunc, ...m: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * Add implements `Echo#Add()` for sub-routes within the Group. Panics on error. + */ + add(method: string, path: string, handler: HandlerFunc, ...middleware: MiddlewareFunc[]): RouteInfo + } + interface Group { + /** + * AddRoute registers a new Routable with Router + */ + addRoute(route: Routable): RouteInfo + } + /** + * IPExtractor is a function to extract IP addr from http.Request. + * Set appropriate one to Echo#IPExtractor. + * See https://echo.labstack.com/guide/ip-address for more details. + */ + interface IPExtractor {(_arg0: http.Request): string } + /** + * Logger defines the logging interface that Echo uses internally in few places. + * For logging in handlers use your own logger instance (dependency injected or package/public variable) from logging framework of your choice. + */ + interface Logger { + [key:string]: any; + /** + * Write provides writer interface for http.Server `ErrorLog` and for logging startup messages. + * `http.Server.ErrorLog` logs errors from accepting connections, unexpected behavior from handlers, + * and underlying FileSystem errors. + * `logger` middleware will use this method to write its JSON payload. + */ + write(p: string|Array): number + /** + * Error logs the error + */ + error(err: Error): void + } + /** + * Response wraps an http.ResponseWriter and implements its interface to be used + * by an HTTP handler to construct an HTTP response. + * See: https://golang.org/pkg/net/http/#ResponseWriter + */ + interface Response { + writer: http.ResponseWriter + status: number + size: number + committed: boolean + } + interface Response { + /** + * Header returns the header map for the writer that will be sent by + * WriteHeader. Changing the header after a call to WriteHeader (or Write) has + * no effect unless the modified headers were declared as trailers by setting + * the "Trailer" header before the call to WriteHeader (see example) + * To suppress implicit response headers, set their value to nil. + * Example: https://golang.org/pkg/net/http/#example_ResponseWriter_trailers + */ + header(): http.Header + } + interface Response { + /** + * Before registers a function which is called just before the response is written. + */ + before(fn: () => void): void + } + interface Response { + /** + * After registers a function which is called just after the response is written. + * If the `Content-Length` is unknown, none of the after function is executed. + */ + after(fn: () => void): void + } + interface Response { + /** + * WriteHeader sends an HTTP response header with status code. If WriteHeader is + * not called explicitly, the first call to Write will trigger an implicit + * WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly + * used to send error codes. + */ + writeHeader(code: number): void + } + interface Response { + /** + * Write writes the data to the connection as part of an HTTP reply. + */ + write(b: string|Array): number + } + interface Response { + /** + * Flush implements the http.Flusher interface to allow an HTTP handler to flush + * buffered data to the client. + * See [http.Flusher](https://golang.org/pkg/net/http/#Flusher) + */ + flush(): void + } + interface Response { + /** + * Hijack implements the http.Hijacker interface to allow an HTTP handler to + * take over the connection. + * See [http.Hijacker](https://golang.org/pkg/net/http/#Hijacker) + */ + hijack(): [net.Conn, (bufio.ReadWriter)] + } + interface Response { + /** + * Unwrap returns the original http.ResponseWriter. + * ResponseController can be used to access the original http.ResponseWriter. + * See [https://go.dev/blog/go1.20] + */ + unwrap(): http.ResponseWriter + } + interface Routes { + /** + * Reverse reverses route to URL string by replacing path parameters with given params values. + */ + reverse(name: string, ...params: { + }[]): string + } + interface Routes { + /** + * FindByMethodPath searched for matching route info by method and path + */ + findByMethodPath(method: string, path: string): RouteInfo + } + interface Routes { + /** + * FilterByMethod searched for matching route info by method + */ + filterByMethod(method: string): Routes + } + interface Routes { + /** + * FilterByPath searched for matching route info by path + */ + filterByPath(path: string): Routes + } + interface Routes { + /** + * FilterByName searched for matching route info by name + */ + filterByName(name: string): Routes + } + /** + * Router is interface for routing request contexts to registered routes. * - * A Conn must call Close to return the connection to the database pool - * and may do so concurrently with a running query. - * - * After a call to Close, all operations on the - * connection fail with ErrConnDone. + * Contract between Echo/Context instance and the router: + * ``` + * - all routes must be added through methods on echo.Echo instance. + * Reason: Echo instance uses RouteInfo.Params() length to allocate slice for paths parameters (see `Echo.contextPathParamAllocSize`). + * - Router must populate Context during Router.Route call with: + * - RoutableContext.SetPath + * - RoutableContext.SetRawPathParams (IMPORTANT! with same slice pointer that c.RawPathParams() returns) + * - RoutableContext.SetRouteInfo + * And optionally can set additional information to Context with RoutableContext.Set + * ``` */ - interface Conn { - } - interface Conn { + interface Router { + [key:string]: any; /** - * PingContext verifies the connection to the database is still alive. + * Add registers Routable with the Router and returns registered RouteInfo */ - pingContext(ctx: context.Context): void - } - interface Conn { + add(routable: Routable): RouteInfo /** - * ExecContext executes a query without returning any rows. - * The args are for any placeholder parameters in the query. + * Remove removes route from the Router */ - execContext(ctx: context.Context, query: string, ...args: any[]): Result - } - interface Conn { + remove(method: string, path: string): void /** - * QueryContext executes a query that returns rows, typically a SELECT. - * The args are for any placeholder parameters in the query. + * Routes returns information about all registered routes */ - queryContext(ctx: context.Context, query: string, ...args: any[]): (Rows) - } - interface Conn { + routes(): Routes /** - * QueryRowContext executes a query that is expected to return at most one row. - * QueryRowContext always returns a non-nil value. Errors are deferred until - * Row's Scan method is called. - * If the query selects no rows, the *Row's Scan will return ErrNoRows. - * Otherwise, the *Row's Scan scans the first selected row and discards - * the rest. + * Route searches Router for matching route and applies it to the given context. In case when no matching method + * was not found (405) or no matching route exists for path (404), router will return its implementation of 405/404 + * handler function. */ - queryRowContext(ctx: context.Context, query: string, ...args: any[]): (Row) - } - interface Conn { - /** - * PrepareContext creates a prepared statement for later queries or executions. - * Multiple queries or executions may be run concurrently from the - * returned statement. - * The caller must call the statement's Close method - * when the statement is no longer needed. - * - * The provided context is used for the preparation of the statement, not for the - * execution of the statement. - */ - prepareContext(ctx: context.Context, query: string): (Stmt) - } - interface Conn { - /** - * Raw executes f exposing the underlying driver connection for the - * duration of f. The driverConn must not be used outside of f. - * - * Once f returns and err is not driver.ErrBadConn, the Conn will continue to be usable - * until Conn.Close is called. - */ - raw(f: (driverConn: any) => void): void - } - interface Conn { - /** - * BeginTx starts a transaction. - * - * The provided context is used until the transaction is committed or rolled back. - * If the context is canceled, the sql package will roll back - * the transaction. Tx.Commit will return an error if the context provided to - * BeginTx is canceled. - * - * The provided TxOptions is optional and may be nil if defaults should be used. - * If a non-default isolation level is used that the driver doesn't support, - * an error will be returned. - */ - beginTx(ctx: context.Context, opts: TxOptions): (Tx) - } - interface Conn { - /** - * Close returns the connection to the connection pool. - * All operations after a Close will return with ErrConnDone. - * Close is safe to call concurrently with other operations and will - * block until all other operations finish. It may be useful to first - * cancel any used context and then call close directly after. - */ - close(): void + route(c: RoutableContext): HandlerFunc } /** - * ColumnType contains the name and type of a column. + * Routable is interface for registering Route with Router. During route registration process the Router will + * convert Routable to RouteInfo with ToRouteInfo method. By creating custom implementation of Routable additional + * information about registered route can be stored in Routes (i.e. privileges used with route etc.) */ - interface ColumnType { - } - interface ColumnType { + interface Routable { + [key:string]: any; /** - * Name returns the name or alias of the column. + * ToRouteInfo converts Routable to RouteInfo + * + * This method is meant to be used by Router after it parses url for path parameters, to store information about + * route just added. */ + toRouteInfo(params: Array): RouteInfo + /** + * ToRoute converts Routable to Route which Router uses to register the method handler for path. + * + * This method is meant to be used by Router to get fields (including handler and middleware functions) needed to + * add Route to Router. + */ + toRoute(): Route + /** + * ForGroup recreates routable with added group prefix and group middlewares it is grouped to. + * + * Is necessary for Echo.Group to be able to add/register Routable with Router and having group prefix and group + * middlewares included in actually registered Route. + */ + forGroup(pathPrefix: string, middlewares: Array): Routable + } + /** + * Routes is collection of RouteInfo instances with various helper methods. + */ + interface Routes extends Array{} + /** + * RouteInfo describes registered route base fields. + * Method+Path pair uniquely identifies the Route. Name can have duplicates. + */ + interface RouteInfo { + [key:string]: any; + method(): string + path(): string name(): string - } - interface ColumnType { + params(): Array /** - * Length returns the column type length for variable length column types such - * as text and binary field types. If the type length is unbounded the value will - * be math.MaxInt64 (any database limits will still apply). - * If the column type is not variable length, such as an int, or if not supported - * by the driver ok is false. + * Reverse reverses route to URL string by replacing path parameters with given params values. */ - length(): [number, boolean] - } - interface ColumnType { - /** - * DecimalSize returns the scale and precision of a decimal type. - * If not applicable or if not supported ok is false. - */ - decimalSize(): [number, boolean] - } - interface ColumnType { - /** - * ScanType returns a Go type suitable for scanning into using Rows.Scan. - * If a driver does not support this property ScanType will return - * the type of an empty interface. - */ - scanType(): any - } - interface ColumnType { - /** - * Nullable reports whether the column may be null. - * If a driver does not support this property ok will be false. - */ - nullable(): boolean - } - interface ColumnType { - /** - * DatabaseTypeName returns the database system name of the column type. If an empty - * string is returned, then the driver type name is not supported. - * Consult your driver documentation for a list of driver data types. Length specifiers - * are not included. - * Common type names include "VARCHAR", "TEXT", "NVARCHAR", "DECIMAL", "BOOL", - * "INT", and "BIGINT". - */ - databaseTypeName(): string + reverse(...params: { + }[]): string } /** - * Row is the result of calling QueryRow to select a single row. + * PathParams is collections of PathParam instances with various helper methods */ - interface Row { - } - interface Row { + interface PathParams extends Array{} + interface PathParams { /** - * Scan copies the columns from the matched row into the values - * pointed at by dest. See the documentation on Rows.Scan for details. - * If more than one row matches the query, - * Scan uses the first row and discards the rest. If no row matches - * the query, Scan returns ErrNoRows. + * Get returns path parameter value for given name or default value. */ - scan(...dest: any[]): void - } - interface Row { - /** - * Err provides a way for wrapping packages to check for - * query errors without calling Scan. - * Err returns the error, if any, that was encountered while running the query. - * If this error is not nil, this error will also be returned from Scan. - */ - err(): void + get(name: string, defaultValue: string): string } } @@ -17293,8 +17397,8 @@ namespace models { */ validate(): void } - type _subFZqWb = BaseModel - interface Log extends _subFZqWb { + type _subvsOcC = BaseModel + interface Log extends _subvsOcC { data: types.JsonMap message: string level: number @@ -17302,8 +17406,8 @@ namespace models { interface Log { tableName(): string } - type _subZeZZx = BaseModel - interface Param extends _subZeZZx { + type _subOmLPB = BaseModel + interface Param extends _subOmLPB { key: string value: types.JsonRaw } @@ -17324,101 +17428,6 @@ namespace models { } } -/** - * Package oauth2 provides support for making - * OAuth2 authorized and authenticated HTTP requests, - * as specified in RFC 6749. - * It can additionally grant authorization with Bearer JWT. - */ -/** - * Copyright 2023 The Go Authors. All rights reserved. - * Use of this source code is governed by a BSD-style - * license that can be found in the LICENSE file. - */ -namespace oauth2 { - /** - * An AuthCodeOption is passed to Config.AuthCodeURL. - */ - interface AuthCodeOption { - [key:string]: any; - } - /** - * Token represents the credentials used to authorize - * the requests to access protected resources on the OAuth 2.0 - * provider's backend. - * - * Most users of this package should not access fields of Token - * directly. They're exported mostly for use by related packages - * implementing derivative OAuth2 flows. - */ - interface Token { - /** - * AccessToken is the token that authorizes and authenticates - * the requests. - */ - accessToken: string - /** - * TokenType is the type of token. - * The Type method returns either this or "Bearer", the default. - */ - tokenType: string - /** - * RefreshToken is a token that's used by the application - * (as opposed to the user) to refresh the access token - * if it expires. - */ - refreshToken: string - /** - * Expiry is the optional expiration time of the access token. - * - * If zero, TokenSource implementations will reuse the same - * token forever and RefreshToken or equivalent - * mechanisms for that TokenSource will not be used. - */ - expiry: time.Time - } - interface Token { - /** - * Type returns t.TokenType if non-empty, else "Bearer". - */ - type(): string - } - interface Token { - /** - * SetAuthHeader sets the Authorization header to r using the access - * token in t. - * - * This method is unnecessary when using Transport or an HTTP Client - * returned by this package. - */ - setAuthHeader(r: http.Request): void - } - interface Token { - /** - * WithExtra returns a new Token that's a clone of t, but using the - * provided raw extra map. This is only intended for use by packages - * implementing derivative OAuth2 flows. - */ - withExtra(extra: { - }): (Token) - } - interface Token { - /** - * Extra returns an extra field. - * Extra fields are key-value pairs returned by the server as a - * part of the token retrieval response. - */ - extra(key: string): { - } - } - interface Token { - /** - * Valid reports whether t is non-nil, has an AccessToken, and is not expired. - */ - valid(): boolean - } -} - namespace mailer { /** * Mailer defines a base mail client interface. @@ -17653,8 +17662,8 @@ namespace hook { * TaggedHook defines a proxy hook which register handlers that are triggered only * if the TaggedHook.tags are empty or includes at least one of the event data tag(s). */ - type _subSLCnj = mainHook - interface TaggedHook extends _subSLCnj { + type _subPKYfQ = mainHook + interface TaggedHook extends _subPKYfQ { } interface TaggedHook { /** @@ -17741,12 +17750,12 @@ namespace core { httpContext: echo.Context error: Error } - type _subBUiWR = BaseModelEvent - interface ModelEvent extends _subBUiWR { + type _subwwsIU = BaseModelEvent + interface ModelEvent extends _subwwsIU { dao?: daos.Dao } - type _subtkWKY = BaseCollectionEvent - interface MailerRecordEvent extends _subtkWKY { + type _subXLEYM = BaseCollectionEvent + interface MailerRecordEvent extends _subXLEYM { mailClient: mailer.Mailer message?: mailer.Message record?: models.Record @@ -17786,50 +17795,50 @@ namespace core { oldSettings?: settings.Settings newSettings?: settings.Settings } - type _subBJDnN = BaseCollectionEvent - interface RecordsListEvent extends _subBJDnN { + type _subKgJls = BaseCollectionEvent + interface RecordsListEvent extends _subKgJls { httpContext: echo.Context records: Array<(models.Record | undefined)> result?: search.Result } - type _subhCdKe = BaseCollectionEvent - interface RecordViewEvent extends _subhCdKe { + type _subJWcvH = BaseCollectionEvent + interface RecordViewEvent extends _subJWcvH { httpContext: echo.Context record?: models.Record } - type _subDMBJS = BaseCollectionEvent - interface RecordCreateEvent extends _subDMBJS { + type _suboxkNc = BaseCollectionEvent + interface RecordCreateEvent extends _suboxkNc { httpContext: echo.Context record?: models.Record uploadedFiles: _TygojaDict } - type _subZsYLI = BaseCollectionEvent - interface RecordUpdateEvent extends _subZsYLI { + type _subIMCGe = BaseCollectionEvent + interface RecordUpdateEvent extends _subIMCGe { httpContext: echo.Context record?: models.Record uploadedFiles: _TygojaDict } - type _subofwGN = BaseCollectionEvent - interface RecordDeleteEvent extends _subofwGN { + type _subbaeYH = BaseCollectionEvent + interface RecordDeleteEvent extends _subbaeYH { httpContext: echo.Context record?: models.Record } - type _subHqDXC = BaseCollectionEvent - interface RecordAuthEvent extends _subHqDXC { + type _subGfimf = BaseCollectionEvent + interface RecordAuthEvent extends _subGfimf { httpContext: echo.Context record?: models.Record token: string meta: any } - type _subPujao = BaseCollectionEvent - interface RecordAuthWithPasswordEvent extends _subPujao { + type _subFmTtJ = BaseCollectionEvent + interface RecordAuthWithPasswordEvent extends _subFmTtJ { httpContext: echo.Context record?: models.Record identity: string password: string } - type _subxhXlg = BaseCollectionEvent - interface RecordAuthWithOAuth2Event extends _subxhXlg { + type _subgoEli = BaseCollectionEvent + interface RecordAuthWithOAuth2Event extends _subgoEli { httpContext: echo.Context providerName: string providerClient: auth.Provider @@ -17837,49 +17846,49 @@ namespace core { oAuth2User?: auth.AuthUser isNewRecord: boolean } - type _subgwYMB = BaseCollectionEvent - interface RecordAuthRefreshEvent extends _subgwYMB { + type _subwSIQW = BaseCollectionEvent + interface RecordAuthRefreshEvent extends _subwSIQW { httpContext: echo.Context record?: models.Record } - type _subHQqUY = BaseCollectionEvent - interface RecordRequestPasswordResetEvent extends _subHQqUY { + type _subkXaHS = BaseCollectionEvent + interface RecordRequestPasswordResetEvent extends _subkXaHS { httpContext: echo.Context record?: models.Record } - type _subyvoEK = BaseCollectionEvent - interface RecordConfirmPasswordResetEvent extends _subyvoEK { + type _subBCpfK = BaseCollectionEvent + interface RecordConfirmPasswordResetEvent extends _subBCpfK { httpContext: echo.Context record?: models.Record } - type _subIabgq = BaseCollectionEvent - interface RecordRequestVerificationEvent extends _subIabgq { + type _subPFSOR = BaseCollectionEvent + interface RecordRequestVerificationEvent extends _subPFSOR { httpContext: echo.Context record?: models.Record } - type _subDRZhM = BaseCollectionEvent - interface RecordConfirmVerificationEvent extends _subDRZhM { + type _subsvjWT = BaseCollectionEvent + interface RecordConfirmVerificationEvent extends _subsvjWT { httpContext: echo.Context record?: models.Record } - type _subZXqjw = BaseCollectionEvent - interface RecordRequestEmailChangeEvent extends _subZXqjw { + type _subzUbPw = BaseCollectionEvent + interface RecordRequestEmailChangeEvent extends _subzUbPw { httpContext: echo.Context record?: models.Record } - type _subbeYeY = BaseCollectionEvent - interface RecordConfirmEmailChangeEvent extends _subbeYeY { + type _subghKDH = BaseCollectionEvent + interface RecordConfirmEmailChangeEvent extends _subghKDH { httpContext: echo.Context record?: models.Record } - type _subYHsUT = BaseCollectionEvent - interface RecordListExternalAuthsEvent extends _subYHsUT { + type _subosDhX = BaseCollectionEvent + interface RecordListExternalAuthsEvent extends _subosDhX { httpContext: echo.Context record?: models.Record externalAuths: Array<(models.ExternalAuth | undefined)> } - type _subCTvvD = BaseCollectionEvent - interface RecordUnlinkExternalAuthEvent extends _subCTvvD { + type _subAnTvs = BaseCollectionEvent + interface RecordUnlinkExternalAuthEvent extends _subAnTvs { httpContext: echo.Context record?: models.Record externalAuth?: models.ExternalAuth @@ -17933,33 +17942,33 @@ namespace core { collections: Array<(models.Collection | undefined)> result?: search.Result } - type _suboiAUo = BaseCollectionEvent - interface CollectionViewEvent extends _suboiAUo { + type _subNENvb = BaseCollectionEvent + interface CollectionViewEvent extends _subNENvb { httpContext: echo.Context } - type _subCWmMd = BaseCollectionEvent - interface CollectionCreateEvent extends _subCWmMd { + type _subbnFZx = BaseCollectionEvent + interface CollectionCreateEvent extends _subbnFZx { httpContext: echo.Context } - type _subpTqml = BaseCollectionEvent - interface CollectionUpdateEvent extends _subpTqml { + type _subezvfN = BaseCollectionEvent + interface CollectionUpdateEvent extends _subezvfN { httpContext: echo.Context } - type _subQOLmx = BaseCollectionEvent - interface CollectionDeleteEvent extends _subQOLmx { + type _subWIYgL = BaseCollectionEvent + interface CollectionDeleteEvent extends _subWIYgL { httpContext: echo.Context } interface CollectionsImportEvent { httpContext: echo.Context collections: Array<(models.Collection | undefined)> } - type _subFwVAw = BaseModelEvent - interface FileTokenEvent extends _subFwVAw { + type _suboVcYS = BaseModelEvent + interface FileTokenEvent extends _suboVcYS { httpContext: echo.Context token: string } - type _subuQFTd = BaseCollectionEvent - interface FileDownloadEvent extends _subuQFTd { + type _subQdytn = BaseCollectionEvent + interface FileDownloadEvent extends _subQdytn { httpContext: echo.Context record?: models.Record fileField?: schema.SchemaField @@ -18017,12 +18026,7 @@ namespace cobra { } } -namespace migrate { - interface Migration { - file: string - up: (db: dbx.Builder) => void - down: (db: dbx.Builder) => void - } +namespace store { } /** @@ -18058,63 +18062,6 @@ namespace url { } } -/** - * Package types implements some commonly used db serializable types - * like datetime, json, etc. - */ -namespace types { - /** - * JsonRaw defines a json value type that is safe for db read/write. - */ - interface JsonRaw extends Array{} - interface JsonRaw { - /** - * String returns the current JsonRaw instance as a json encoded string. - */ - string(): string - } - interface JsonRaw { - /** - * MarshalJSON implements the [json.Marshaler] interface. - */ - marshalJSON(): string|Array - } - interface JsonRaw { - /** - * UnmarshalJSON implements the [json.Unmarshaler] interface. - */ - unmarshalJSON(b: string|Array): void - } - interface JsonRaw { - /** - * Value implements the [driver.Valuer] interface. - */ - value(): any - } - interface JsonRaw { - /** - * Scan implements [sql.Scanner] interface to scan the provided value - * into the current JsonRaw instance. - */ - scan(value: any): void - } -} - -/** - * Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer - * object, creating another object (Reader or Writer) that also implements - * the interface but provides buffering and some help for textual I/O. - */ -namespace bufio { - /** - * ReadWriter stores pointers to a Reader and a Writer. - * It implements io.ReadWriter. - */ - type _subTTuJP = Reader&Writer - interface ReadWriter extends _subTTuJP { - } -} - /** * Package net provides a portable interface for network I/O, including * TCP/IP, UDP, domain name resolution, and Unix domain sockets. @@ -18214,6 +18161,89 @@ namespace net { } } +namespace hook { + /** + * Handler defines a hook handler function. + */ + interface Handler {(e: T): void } + /** + * wrapped local Hook embedded struct to limit the public API surface. + */ + type _subNrJKS = Hook + interface mainHook extends _subNrJKS { + } +} + +/** + * Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer + * object, creating another object (Reader or Writer) that also implements + * the interface but provides buffering and some help for textual I/O. + */ +namespace bufio { + /** + * ReadWriter stores pointers to a Reader and a Writer. + * It implements io.ReadWriter. + */ + type _subKMuQM = Reader&Writer + interface ReadWriter extends _subKMuQM { + } +} + +/** + * Package types implements some commonly used db serializable types + * like datetime, json, etc. + */ +namespace types { + /** + * JsonRaw defines a json value type that is safe for db read/write. + */ + interface JsonRaw extends Array{} + interface JsonRaw { + /** + * String returns the current JsonRaw instance as a json encoded string. + */ + string(): string + } + interface JsonRaw { + /** + * MarshalJSON implements the [json.Marshaler] interface. + */ + marshalJSON(): string|Array + } + interface JsonRaw { + /** + * UnmarshalJSON implements the [json.Unmarshaler] interface. + */ + unmarshalJSON(b: string|Array): void + } + interface JsonRaw { + /** + * Value implements the [driver.Valuer] interface. + */ + value(): any + } + interface JsonRaw { + /** + * Scan implements [sql.Scanner] interface to scan the provided value + * into the current JsonRaw instance. + */ + scan(value: any): void + } +} + +namespace search { + /** + * Result defines the returned search result structure. + */ + interface Result { + page: number + perPage: number + totalItems: number + totalPages: number + items: any + } +} + /** * Package multipart implements MIME multipart parsing, as defined in RFC * 2046. @@ -18415,52 +18445,6 @@ namespace http { import urlpkg = url } -namespace store { -} - -namespace mailer { - /** - * Message defines a generic email message struct. - */ - interface Message { - from: mail.Address - to: Array - bcc: Array - cc: Array - subject: string - html: string - text: string - headers: _TygojaDict - attachments: _TygojaDict - } -} - -namespace hook { - /** - * Handler defines a hook handler function. - */ - interface Handler {(e: T): void } - /** - * wrapped local Hook embedded struct to limit the public API surface. - */ - type _subowHsb = Hook - interface mainHook extends _subowHsb { - } -} - -namespace search { - /** - * Result defines the returned search result structure. - */ - interface Result { - page: number - perPage: number - totalItems: number - totalPages: number - items: any - } -} - /** * Package echo implements high performance, minimalist Go web framework. * @@ -18576,6 +18560,23 @@ namespace echo { } } +namespace mailer { + /** + * Message defines a generic email message struct. + */ + interface Message { + from: mail.Address + to: Array + bcc: Array + cc: Array + subject: string + html: string + text: string + headers: _TygojaDict + attachments: _TygojaDict + } +} + namespace settings { // @ts-ignore import validation = ozzo_validation @@ -19237,16 +19238,6 @@ namespace core { } } -namespace subscriptions { -} - -/** - * Package types implements some commonly used db serializable types - * like datetime, json, etc. - */ -namespace types { -} - /** * Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer * object, creating another object (Reader or Writer) that also implements @@ -19512,6 +19503,16 @@ namespace bufio { } } +/** + * Package types implements some commonly used db serializable types + * like datetime, json, etc. + */ +namespace types { +} + +namespace search { +} + /** * Package mail implements parsing of mail messages. * @@ -19548,9 +19549,6 @@ namespace mail { } } -namespace search { -} - /** * Package slog provides structured logging, * in which log records include a message, @@ -20094,6 +20092,9 @@ namespace slog { } } +namespace subscriptions { +} + /** * Package slog provides structured logging, * in which log records include a message, diff --git a/ui/dist/assets/AuthMethodsDocs-nJCAd_pk.js b/ui/dist/assets/AuthMethodsDocs-YXCf-w6f.js similarity index 97% rename from ui/dist/assets/AuthMethodsDocs-nJCAd_pk.js rename to ui/dist/assets/AuthMethodsDocs-YXCf-w6f.js index 2bd363f5..430e8d97 100644 --- a/ui/dist/assets/AuthMethodsDocs-nJCAd_pk.js +++ b/ui/dist/assets/AuthMethodsDocs-YXCf-w6f.js @@ -1,4 +1,4 @@ -import{S as Se,i as ye,s as Ae,O as G,e as c,v as w,b as k,c as se,f as p,g as d,h as a,m as ae,w as U,P as ve,Q as Te,k as je,R as Be,n as Oe,t as W,a as V,o as u,d as ne,C as Fe,A as Qe,q as L,r as Ne,N as qe}from"./index-ydlV29Fj.js";import{S as He}from"./SdkTabs-O6auDA6S.js";import{F as Ke}from"./FieldsQueryParam--b6rO4n1.js";function Ce(n,l,o){const s=n.slice();return s[5]=l[o],s}function Pe(n,l,o){const s=n.slice();return s[5]=l[o],s}function $e(n,l){let o,s=l[5].code+"",_,f,i,h;function m(){return l[4](l[5])}return{key:n,first:null,c(){o=c("button"),_=w(s),f=k(),p(o,"class","tab-item"),L(o,"active",l[1]===l[5].code),this.first=o},m(v,C){d(v,o,C),a(o,_),a(o,f),i||(h=Ne(o,"click",m),i=!0)},p(v,C){l=v,C&4&&s!==(s=l[5].code+"")&&U(_,s),C&6&&L(o,"active",l[1]===l[5].code)},d(v){v&&u(o),i=!1,h()}}}function Me(n,l){let o,s,_,f;return s=new qe({props:{content:l[5].body}}),{key:n,first:null,c(){o=c("div"),se(s.$$.fragment),_=k(),p(o,"class","tab-item"),L(o,"active",l[1]===l[5].code),this.first=o},m(i,h){d(i,o,h),ae(s,o,null),a(o,_),f=!0},p(i,h){l=i;const m={};h&4&&(m.content=l[5].body),s.$set(m),(!f||h&6)&&L(o,"active",l[1]===l[5].code)},i(i){f||(W(s.$$.fragment,i),f=!0)},o(i){V(s.$$.fragment,i),f=!1},d(i){i&&u(o),ne(s)}}}function ze(n){var be,ke;let l,o,s=n[0].name+"",_,f,i,h,m,v,C,q=n[0].name+"",E,ie,I,P,J,T,Y,$,H,ce,K,j,re,R,z=n[0].name+"",X,de,Z,B,x,M,ee,ue,te,A,le,O,oe,S,F,g=[],he=new Map,me,Q,b=[],fe=new Map,y;P=new He({props:{js:` +import{S as Se,i as ye,s as Ae,O as G,e as c,v as w,b as k,c as se,f as p,g as d,h as a,m as ae,w as U,P as ve,Q as Te,k as je,R as Be,n as Oe,t as W,a as V,o as u,d as ne,C as Fe,A as Qe,q as L,r as Ne,N as qe}from"./index-z3vRI80T.js";import{S as He}from"./SdkTabs-gnoMubZE.js";import{F as Ke}from"./FieldsQueryParam-QduFX_Q6.js";function Ce(n,l,o){const s=n.slice();return s[5]=l[o],s}function Pe(n,l,o){const s=n.slice();return s[5]=l[o],s}function $e(n,l){let o,s=l[5].code+"",_,f,i,h;function m(){return l[4](l[5])}return{key:n,first:null,c(){o=c("button"),_=w(s),f=k(),p(o,"class","tab-item"),L(o,"active",l[1]===l[5].code),this.first=o},m(v,C){d(v,o,C),a(o,_),a(o,f),i||(h=Ne(o,"click",m),i=!0)},p(v,C){l=v,C&4&&s!==(s=l[5].code+"")&&U(_,s),C&6&&L(o,"active",l[1]===l[5].code)},d(v){v&&u(o),i=!1,h()}}}function Me(n,l){let o,s,_,f;return s=new qe({props:{content:l[5].body}}),{key:n,first:null,c(){o=c("div"),se(s.$$.fragment),_=k(),p(o,"class","tab-item"),L(o,"active",l[1]===l[5].code),this.first=o},m(i,h){d(i,o,h),ae(s,o,null),a(o,_),f=!0},p(i,h){l=i;const m={};h&4&&(m.content=l[5].body),s.$set(m),(!f||h&6)&&L(o,"active",l[1]===l[5].code)},i(i){f||(W(s.$$.fragment,i),f=!0)},o(i){V(s.$$.fragment,i),f=!1},d(i){i&&u(o),ne(s)}}}function ze(n){var be,ke;let l,o,s=n[0].name+"",_,f,i,h,m,v,C,q=n[0].name+"",E,ie,I,P,J,T,Y,$,H,ce,K,j,re,R,z=n[0].name+"",X,de,Z,B,x,M,ee,ue,te,A,le,O,oe,S,F,g=[],he=new Map,me,Q,b=[],fe=new Map,y;P=new He({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${n[3]}'); diff --git a/ui/dist/assets/AuthRefreshDocs-YwWPCwEU.js b/ui/dist/assets/AuthRefreshDocs-JfV5JCoS.js similarity index 97% rename from ui/dist/assets/AuthRefreshDocs-YwWPCwEU.js rename to ui/dist/assets/AuthRefreshDocs-JfV5JCoS.js index b6878ca7..6701a797 100644 --- a/ui/dist/assets/AuthRefreshDocs-YwWPCwEU.js +++ b/ui/dist/assets/AuthRefreshDocs-JfV5JCoS.js @@ -1,4 +1,4 @@ -import{S as je,i as xe,s as Je,N as Ue,O as J,e as s,v as k,b as p,c as K,f as b,g as d,h as o,m as I,w as de,P as Ee,Q as Ke,k as Ie,R as We,n as Ge,t as N,a as V,o as u,d as W,C as Le,A as Xe,q as G,r as Ye}from"./index-ydlV29Fj.js";import{S as Ze}from"./SdkTabs-O6auDA6S.js";import{F as et}from"./FieldsQueryParam--b6rO4n1.js";function Ne(r,l,a){const n=r.slice();return n[5]=l[a],n}function Ve(r,l,a){const n=r.slice();return n[5]=l[a],n}function ze(r,l){let a,n=l[5].code+"",m,_,i,h;function g(){return l[4](l[5])}return{key:r,first:null,c(){a=s("button"),m=k(n),_=p(),b(a,"class","tab-item"),G(a,"active",l[1]===l[5].code),this.first=a},m(v,w){d(v,a,w),o(a,m),o(a,_),i||(h=Ye(a,"click",g),i=!0)},p(v,w){l=v,w&4&&n!==(n=l[5].code+"")&&de(m,n),w&6&&G(a,"active",l[1]===l[5].code)},d(v){v&&u(a),i=!1,h()}}}function Qe(r,l){let a,n,m,_;return n=new Ue({props:{content:l[5].body}}),{key:r,first:null,c(){a=s("div"),K(n.$$.fragment),m=p(),b(a,"class","tab-item"),G(a,"active",l[1]===l[5].code),this.first=a},m(i,h){d(i,a,h),I(n,a,null),o(a,m),_=!0},p(i,h){l=i;const g={};h&4&&(g.content=l[5].body),n.$set(g),(!_||h&6)&&G(a,"active",l[1]===l[5].code)},i(i){_||(N(n.$$.fragment,i),_=!0)},o(i){V(n.$$.fragment,i),_=!1},d(i){i&&u(a),W(n)}}}function tt(r){var De,Fe;let l,a,n=r[0].name+"",m,_,i,h,g,v,w,B,X,S,z,ue,Q,M,pe,Y,U=r[0].name+"",Z,he,fe,j,ee,D,te,T,oe,be,F,C,le,me,ae,_e,f,ke,R,ge,ve,$e,se,ye,ne,Se,we,Te,re,Ce,Pe,A,ie,O,ce,P,H,y=[],Re=new Map,Ae,E,$=[],qe=new Map,q;v=new Ze({props:{js:` +import{S as je,i as xe,s as Je,N as Ue,O as J,e as s,v as k,b as p,c as K,f as b,g as d,h as o,m as I,w as de,P as Ee,Q as Ke,k as Ie,R as We,n as Ge,t as N,a as V,o as u,d as W,C as Le,A as Xe,q as G,r as Ye}from"./index-z3vRI80T.js";import{S as Ze}from"./SdkTabs-gnoMubZE.js";import{F as et}from"./FieldsQueryParam-QduFX_Q6.js";function Ne(r,l,a){const n=r.slice();return n[5]=l[a],n}function Ve(r,l,a){const n=r.slice();return n[5]=l[a],n}function ze(r,l){let a,n=l[5].code+"",m,_,i,h;function g(){return l[4](l[5])}return{key:r,first:null,c(){a=s("button"),m=k(n),_=p(),b(a,"class","tab-item"),G(a,"active",l[1]===l[5].code),this.first=a},m(v,w){d(v,a,w),o(a,m),o(a,_),i||(h=Ye(a,"click",g),i=!0)},p(v,w){l=v,w&4&&n!==(n=l[5].code+"")&&de(m,n),w&6&&G(a,"active",l[1]===l[5].code)},d(v){v&&u(a),i=!1,h()}}}function Qe(r,l){let a,n,m,_;return n=new Ue({props:{content:l[5].body}}),{key:r,first:null,c(){a=s("div"),K(n.$$.fragment),m=p(),b(a,"class","tab-item"),G(a,"active",l[1]===l[5].code),this.first=a},m(i,h){d(i,a,h),I(n,a,null),o(a,m),_=!0},p(i,h){l=i;const g={};h&4&&(g.content=l[5].body),n.$set(g),(!_||h&6)&&G(a,"active",l[1]===l[5].code)},i(i){_||(N(n.$$.fragment,i),_=!0)},o(i){V(n.$$.fragment,i),_=!1},d(i){i&&u(a),W(n)}}}function tt(r){var De,Fe;let l,a,n=r[0].name+"",m,_,i,h,g,v,w,B,X,S,z,ue,Q,M,pe,Y,U=r[0].name+"",Z,he,fe,j,ee,D,te,T,oe,be,F,C,le,me,ae,_e,f,ke,R,ge,ve,$e,se,ye,ne,Se,we,Te,re,Ce,Pe,A,ie,O,ce,P,H,y=[],Re=new Map,Ae,E,$=[],qe=new Map,q;v=new Ze({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${r[3]}'); diff --git a/ui/dist/assets/AuthWithOAuth2Docs-uhwAhOlg.js b/ui/dist/assets/AuthWithOAuth2Docs-N1wT5-Tm.js similarity index 98% rename from ui/dist/assets/AuthWithOAuth2Docs-uhwAhOlg.js rename to ui/dist/assets/AuthWithOAuth2Docs-N1wT5-Tm.js index 23c76801..a191cec0 100644 --- a/ui/dist/assets/AuthWithOAuth2Docs-uhwAhOlg.js +++ b/ui/dist/assets/AuthWithOAuth2Docs-N1wT5-Tm.js @@ -1,4 +1,4 @@ -import{S as Ee,i as Je,s as Ne,N as Le,O as z,e as o,v as k,b as h,c as I,f as p,g as r,h as a,m as K,w as pe,P as Ue,Q as Qe,k as xe,R as ze,n as Ie,t as L,a as E,o as c,d as G,C as Be,A as Ke,q as X,r as Ge}from"./index-ydlV29Fj.js";import{S as Xe}from"./SdkTabs-O6auDA6S.js";import{F as Ye}from"./FieldsQueryParam--b6rO4n1.js";function Fe(s,l,n){const i=s.slice();return i[5]=l[n],i}function He(s,l,n){const i=s.slice();return i[5]=l[n],i}function je(s,l){let n,i=l[5].code+"",f,g,d,m;function _(){return l[4](l[5])}return{key:s,first:null,c(){n=o("button"),f=k(i),g=h(),p(n,"class","tab-item"),X(n,"active",l[1]===l[5].code),this.first=n},m(v,O){r(v,n,O),a(n,f),a(n,g),d||(m=Ge(n,"click",_),d=!0)},p(v,O){l=v,O&4&&i!==(i=l[5].code+"")&&pe(f,i),O&6&&X(n,"active",l[1]===l[5].code)},d(v){v&&c(n),d=!1,m()}}}function Ve(s,l){let n,i,f,g;return i=new Le({props:{content:l[5].body}}),{key:s,first:null,c(){n=o("div"),I(i.$$.fragment),f=h(),p(n,"class","tab-item"),X(n,"active",l[1]===l[5].code),this.first=n},m(d,m){r(d,n,m),K(i,n,null),a(n,f),g=!0},p(d,m){l=d;const _={};m&4&&(_.content=l[5].body),i.$set(_),(!g||m&6)&&X(n,"active",l[1]===l[5].code)},i(d){g||(L(i.$$.fragment,d),g=!0)},o(d){E(i.$$.fragment,d),g=!1},d(d){d&&c(n),G(i)}}}function Ze(s){let l,n,i=s[0].name+"",f,g,d,m,_,v,O,P,Y,A,J,me,N,R,be,Z,Q=s[0].name+"",ee,fe,te,M,ae,W,le,U,ne,S,oe,ge,B,y,se,ke,ie,_e,b,ve,C,we,$e,Oe,re,Ae,ce,Se,ye,Te,de,Ce,qe,q,ue,F,he,T,H,$=[],De=new Map,Pe,j,w=[],Re=new Map,D;v=new Xe({props:{js:` +import{S as Ee,i as Je,s as Ne,N as Le,O as z,e as o,v as k,b as h,c as I,f as p,g as r,h as a,m as K,w as pe,P as Ue,Q as Qe,k as xe,R as ze,n as Ie,t as L,a as E,o as c,d as G,C as Be,A as Ke,q as X,r as Ge}from"./index-z3vRI80T.js";import{S as Xe}from"./SdkTabs-gnoMubZE.js";import{F as Ye}from"./FieldsQueryParam-QduFX_Q6.js";function Fe(s,l,n){const i=s.slice();return i[5]=l[n],i}function He(s,l,n){const i=s.slice();return i[5]=l[n],i}function je(s,l){let n,i=l[5].code+"",f,g,d,m;function _(){return l[4](l[5])}return{key:s,first:null,c(){n=o("button"),f=k(i),g=h(),p(n,"class","tab-item"),X(n,"active",l[1]===l[5].code),this.first=n},m(v,O){r(v,n,O),a(n,f),a(n,g),d||(m=Ge(n,"click",_),d=!0)},p(v,O){l=v,O&4&&i!==(i=l[5].code+"")&&pe(f,i),O&6&&X(n,"active",l[1]===l[5].code)},d(v){v&&c(n),d=!1,m()}}}function Ve(s,l){let n,i,f,g;return i=new Le({props:{content:l[5].body}}),{key:s,first:null,c(){n=o("div"),I(i.$$.fragment),f=h(),p(n,"class","tab-item"),X(n,"active",l[1]===l[5].code),this.first=n},m(d,m){r(d,n,m),K(i,n,null),a(n,f),g=!0},p(d,m){l=d;const _={};m&4&&(_.content=l[5].body),i.$set(_),(!g||m&6)&&X(n,"active",l[1]===l[5].code)},i(d){g||(L(i.$$.fragment,d),g=!0)},o(d){E(i.$$.fragment,d),g=!1},d(d){d&&c(n),G(i)}}}function Ze(s){let l,n,i=s[0].name+"",f,g,d,m,_,v,O,P,Y,A,J,me,N,R,be,Z,Q=s[0].name+"",ee,fe,te,M,ae,W,le,U,ne,S,oe,ge,B,y,se,ke,ie,_e,b,ve,C,we,$e,Oe,re,Ae,ce,Se,ye,Te,de,Ce,qe,q,ue,F,he,T,H,$=[],De=new Map,Pe,j,w=[],Re=new Map,D;v=new Xe({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${s[3]}'); diff --git a/ui/dist/assets/AuthWithPasswordDocs-i3lf_6b4.js b/ui/dist/assets/AuthWithPasswordDocs-Sqq2A_xb.js similarity index 98% rename from ui/dist/assets/AuthWithPasswordDocs-i3lf_6b4.js rename to ui/dist/assets/AuthWithPasswordDocs-Sqq2A_xb.js index ad7a6c22..64e9f974 100644 --- a/ui/dist/assets/AuthWithPasswordDocs-i3lf_6b4.js +++ b/ui/dist/assets/AuthWithPasswordDocs-Sqq2A_xb.js @@ -1,4 +1,4 @@ -import{S as wt,i as yt,s as $t,N as vt,O as oe,e as n,v as p,b as d,c as ne,f as m,g as r,h as t,m as se,w as De,P as pt,Q as Pt,k as Rt,R as At,n as Ct,t as Z,a as x,o as c,d as ie,C as ft,A as Ot,q as re,r as Tt}from"./index-ydlV29Fj.js";import{S as Ut}from"./SdkTabs-O6auDA6S.js";import{F as Mt}from"./FieldsQueryParam--b6rO4n1.js";function ht(s,l,a){const i=s.slice();return i[8]=l[a],i}function bt(s,l,a){const i=s.slice();return i[8]=l[a],i}function Dt(s){let l;return{c(){l=p("email")},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function Et(s){let l;return{c(){l=p("username")},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function Wt(s){let l;return{c(){l=p("username/email")},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function mt(s){let l;return{c(){l=n("strong"),l.textContent="username"},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function _t(s){let l;return{c(){l=p("or")},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function kt(s){let l;return{c(){l=n("strong"),l.textContent="email"},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function gt(s,l){let a,i=l[8].code+"",g,b,f,u;function _(){return l[7](l[8])}return{key:s,first:null,c(){a=n("button"),g=p(i),b=d(),m(a,"class","tab-item"),re(a,"active",l[3]===l[8].code),this.first=a},m(R,A){r(R,a,A),t(a,g),t(a,b),f||(u=Tt(a,"click",_),f=!0)},p(R,A){l=R,A&16&&i!==(i=l[8].code+"")&&De(g,i),A&24&&re(a,"active",l[3]===l[8].code)},d(R){R&&c(a),f=!1,u()}}}function St(s,l){let a,i,g,b;return i=new vt({props:{content:l[8].body}}),{key:s,first:null,c(){a=n("div"),ne(i.$$.fragment),g=d(),m(a,"class","tab-item"),re(a,"active",l[3]===l[8].code),this.first=a},m(f,u){r(f,a,u),se(i,a,null),t(a,g),b=!0},p(f,u){l=f;const _={};u&16&&(_.content=l[8].body),i.$set(_),(!b||u&24)&&re(a,"active",l[3]===l[8].code)},i(f){b||(Z(i.$$.fragment,f),b=!0)},o(f){x(i.$$.fragment,f),b=!1},d(f){f&&c(a),ie(i)}}}function Lt(s){var rt,ct;let l,a,i=s[0].name+"",g,b,f,u,_,R,A,C,q,Ee,ce,T,de,N,ue,U,ee,We,te,I,Le,pe,le=s[0].name+"",fe,qe,he,V,be,M,me,Be,Q,D,_e,Fe,ke,He,$,Ye,ge,Se,ve,Ne,we,ye,j,$e,E,Pe,Ie,J,W,Re,Ve,Ae,Qe,k,je,B,Je,Ke,ze,Ce,Ge,Oe,Xe,Ze,xe,Te,et,tt,F,Ue,K,Me,L,z,O=[],lt=new Map,at,G,S=[],ot=new Map,H;function nt(e,o){if(e[1]&&e[2])return Wt;if(e[1])return Et;if(e[2])return Dt}let Y=nt(s),P=Y&&Y(s);T=new Ut({props:{js:` +import{S as wt,i as yt,s as $t,N as vt,O as oe,e as n,v as p,b as d,c as ne,f as m,g as r,h as t,m as se,w as De,P as pt,Q as Pt,k as Rt,R as At,n as Ct,t as Z,a as x,o as c,d as ie,C as ft,A as Ot,q as re,r as Tt}from"./index-z3vRI80T.js";import{S as Ut}from"./SdkTabs-gnoMubZE.js";import{F as Mt}from"./FieldsQueryParam-QduFX_Q6.js";function ht(s,l,a){const i=s.slice();return i[8]=l[a],i}function bt(s,l,a){const i=s.slice();return i[8]=l[a],i}function Dt(s){let l;return{c(){l=p("email")},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function Et(s){let l;return{c(){l=p("username")},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function Wt(s){let l;return{c(){l=p("username/email")},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function mt(s){let l;return{c(){l=n("strong"),l.textContent="username"},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function _t(s){let l;return{c(){l=p("or")},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function kt(s){let l;return{c(){l=n("strong"),l.textContent="email"},m(a,i){r(a,l,i)},d(a){a&&c(l)}}}function gt(s,l){let a,i=l[8].code+"",g,b,f,u;function _(){return l[7](l[8])}return{key:s,first:null,c(){a=n("button"),g=p(i),b=d(),m(a,"class","tab-item"),re(a,"active",l[3]===l[8].code),this.first=a},m(R,A){r(R,a,A),t(a,g),t(a,b),f||(u=Tt(a,"click",_),f=!0)},p(R,A){l=R,A&16&&i!==(i=l[8].code+"")&&De(g,i),A&24&&re(a,"active",l[3]===l[8].code)},d(R){R&&c(a),f=!1,u()}}}function St(s,l){let a,i,g,b;return i=new vt({props:{content:l[8].body}}),{key:s,first:null,c(){a=n("div"),ne(i.$$.fragment),g=d(),m(a,"class","tab-item"),re(a,"active",l[3]===l[8].code),this.first=a},m(f,u){r(f,a,u),se(i,a,null),t(a,g),b=!0},p(f,u){l=f;const _={};u&16&&(_.content=l[8].body),i.$set(_),(!b||u&24)&&re(a,"active",l[3]===l[8].code)},i(f){b||(Z(i.$$.fragment,f),b=!0)},o(f){x(i.$$.fragment,f),b=!1},d(f){f&&c(a),ie(i)}}}function Lt(s){var rt,ct;let l,a,i=s[0].name+"",g,b,f,u,_,R,A,C,q,Ee,ce,T,de,N,ue,U,ee,We,te,I,Le,pe,le=s[0].name+"",fe,qe,he,V,be,M,me,Be,Q,D,_e,Fe,ke,He,$,Ye,ge,Se,ve,Ne,we,ye,j,$e,E,Pe,Ie,J,W,Re,Ve,Ae,Qe,k,je,B,Je,Ke,ze,Ce,Ge,Oe,Xe,Ze,xe,Te,et,tt,F,Ue,K,Me,L,z,O=[],lt=new Map,at,G,S=[],ot=new Map,H;function nt(e,o){if(e[1]&&e[2])return Wt;if(e[1])return Et;if(e[2])return Dt}let Y=nt(s),P=Y&&Y(s);T=new Ut({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${s[6]}'); diff --git a/ui/dist/assets/CodeEditor-f9FE6aAj.js b/ui/dist/assets/CodeEditor-f9FE6aAj.js deleted file mode 100644 index e551a923..00000000 --- a/ui/dist/assets/CodeEditor-f9FE6aAj.js +++ /dev/null @@ -1,14 +0,0 @@ -import{S as wt,i as yt,s as xt,e as Yt,f as Wt,U as H,g as Tt,x as De,o as jt,J as vt,K as qt,L as _t,I as Rt,C as Vt,M as Gt}from"./index-ydlV29Fj.js";import{P as Ct,N as zt,v as Ut,D as Et,w as je,T as Oe,I as ve,x as J,y as o,z as At,L,A as K,B as _,F,G as qe,H as M,u as C,J as YO,K as WO,M as TO,E as q,O as jO,Q as m,R as It,U as Nt,V as vO,W as Dt,X as Bt,a as z,h as Jt,b as Lt,c as Kt,d as Ft,e as Mt,s as Ht,t as ea,f as Oa,g as ta,r as aa,i as ra,k as ia,j as sa,l as na,m as oa,n as la,o as ca,p as Qa,q as Be,C as ee}from"./index-u64XbdBO.js";var Je={};class ie{constructor(e,a,t,r,s,i,n,l,Q,d=0,c){this.p=e,this.stack=a,this.state=t,this.reducePos=r,this.pos=s,this.score=i,this.buffer=n,this.bufferBase=l,this.curContext=Q,this.lookAhead=d,this.parent=c}toString(){return`[${this.stack.filter((e,a)=>a%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,a,t=0){let r=e.parser.context;return new ie(e,[],a,t,t,0,[],0,r?new Le(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,a){this.stack.push(this.state,a,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var a;let t=e>>19,r=e&65535,{parser:s}=this.p,i=s.dynamicPrecedence(r);if(i&&(this.score+=i),t==0){this.pushState(s.getGoto(this.state,r,!0),this.reducePos),r=2e3&&!(!((a=this.p.parser.nodeSet.types[r])===null||a===void 0)&&a.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=Q):this.p.lastBigReductionSizen;)this.stack.pop();this.reduceContext(r,l)}storeNode(e,a,t,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&i.buffer[n-4]==0&&i.buffer[n-1]>-1){if(a==t)return;if(i.buffer[n-2]>=a){i.buffer[n-2]=t;return}}}if(!s||this.pos==t)this.buffer.push(e,a,t,r);else{let i=this.buffer.length;if(i>0&&this.buffer[i-4]!=0)for(;i>0&&this.buffer[i-2]>t;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4);this.buffer[i]=e,this.buffer[i+1]=a,this.buffer[i+2]=t,this.buffer[i+3]=r}}shift(e,a,t,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(a,t),a<=this.p.parser.maxNode&&this.buffer.push(a,t,r,4);else{let s=e,{parser:i}=this.p;(r>this.pos||a<=i.maxNode)&&(this.pos=r,i.stateFlag(s,1)||(this.reducePos=r)),this.pushState(s,t),this.shiftContext(a,t),a<=i.maxNode&&this.buffer.push(a,t,r,4)}}apply(e,a,t,r){e&65536?this.reduce(e):this.shift(e,a,t,r)}useNode(e,a){let t=this.p.reused.length-1;(t<0||this.p.reused[t]!=e)&&(this.p.reused.push(e),t++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(a,r),this.buffer.push(t,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,a=e.buffer.length;for(;a>0&&e.buffer[a-2]>e.reducePos;)a-=4;let t=e.buffer.slice(a),r=e.bufferBase+a;for(;e&&r==e.bufferBase;)e=e.parent;return new ie(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,t,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,a){let t=e<=this.p.parser.maxNode;t&&this.storeNode(e,this.pos,a,4),this.storeNode(0,this.pos,a,t?8:4),this.pos=this.reducePos=a,this.score-=190}canShift(e){for(let a=new pa(this);;){let t=this.p.parser.stateSlot(a.state,4)||this.p.parser.hasAction(a.state,e);if(t==0)return!1;if(!(t&65536))return!0;a.reduce(t)}}recoverByInsert(e){if(this.stack.length>=300)return[];let a=this.p.parser.nextStates(this.state);if(a.length>8||this.stack.length>=120){let r=[];for(let s=0,i;sl&1&&n==i)||r.push(a[s],i)}a=r}let t=[];for(let r=0;r>19,r=a&65535,s=this.stack.length-t*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let i=this.findForcedReduction();if(i==null)return!1;a=i}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(a),!0}findForcedReduction(){let{parser:e}=this.p,a=[],t=(r,s)=>{if(!a.includes(r))return a.push(r),e.allActions(r,i=>{if(!(i&393216))if(i&65536){let n=(i>>19)-s;if(n>1){let l=i&65535,Q=this.stack.length-n*3;if(Q>=0&&e.getGoto(this.stack[Q],l,!1)>=0)return n<<19|65536|l}}else{let n=t(i,s+1);if(n!=null)return n}})};return t(this.state,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:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let a=0;athis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Le{constructor(e,a){this.tracker=e,this.context=a,this.hash=e.strict?e.hash(a):0}}class pa{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let a=e&65535,t=e>>19;t==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(t-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],a,!0);this.state=r}}class se{constructor(e,a,t){this.stack=e,this.pos=a,this.index=t,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,a=e.bufferBase+e.buffer.length){return new se(e,a,a-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.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 se(this.stack,this.pos,this.index)}}function I(O,e=Uint16Array){if(typeof O!="string")return O;let a=null;for(let t=0,r=0;t=92&&i--,i>=34&&i--;let l=i-32;if(l>=46&&(l-=46,n=!0),s+=l,n)break;s*=46}a?a[r++]=s:a=new e(s)}return a}class te{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Ke=new te;class da{constructor(e,a){this.input=e,this.ranges=a,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Ke,this.rangeIndex=0,this.pos=this.chunkPos=a[0].from,this.range=a[0],this.end=a[a.length-1].to,this.readNext()}resolveOffset(e,a){let t=this.range,r=this.rangeIndex,s=this.pos+e;for(;st.to:s>=t.to;){if(r==this.ranges.length-1)return null;let i=this.ranges[++r];s+=i.from-t.to,t=i}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,a.from);return this.end}peek(e){let a=this.chunkOff+e,t,r;if(a>=0&&a=this.chunk2Pos&&tn.to&&(this.chunk2=this.chunk2.slice(0,n.to-t)),r=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),r}acceptToken(e,a=0){let t=a?this.resolveOffset(a,-1):this.pos;if(t==null||t=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,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(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,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(e,a){if(a?(this.token=a,a.start=e,a.lookAhead=e+1,a.value=a.extended=-1):this.token=Ke,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&a<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,a-this.chunkPos);if(e>=this.chunk2Pos&&a<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,a-this.chunk2Pos);if(e>=this.range.from&&a<=this.range.to)return this.input.read(e,a);let t="";for(let r of this.ranges){if(r.from>=a)break;r.to>e&&(t+=this.input.read(Math.max(r.from,e),Math.min(r.to,a)))}return t}}class R{constructor(e,a){this.data=e,this.id=a}token(e,a){let{parser:t}=a.p;qO(this.data,e,a,this.id,t.data,t.tokenPrecTable)}}R.prototype.contextual=R.prototype.fallback=R.prototype.extend=!1;class ne{constructor(e,a,t){this.precTable=a,this.elseToken=t,this.data=typeof e=="string"?I(e):e}token(e,a){let t=e.pos,r=0;for(;;){let s=e.next<0,i=e.resolveOffset(1,1);if(qO(this.data,e,a,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(t,e.token),e.acceptToken(this.elseToken,r))}}ne.prototype.contextual=R.prototype.fallback=R.prototype.extend=!1;class k{constructor(e,a={}){this.token=e,this.contextual=!!a.contextual,this.fallback=!!a.fallback,this.extend=!!a.extend}}function qO(O,e,a,t,r,s){let i=0,n=1<0){let f=O[p];if(l.allows(f)&&(e.token.value==-1||e.token.value==f||ha(f,e.token.value,r,s))){e.acceptToken(f);break}}let d=e.next,c=0,u=O[i+2];if(e.next<0&&u>c&&O[Q+u*3-3]==65535){i=O[Q+u*3-1];continue e}for(;c>1,f=Q+p+(p<<1),P=O[f],S=O[f+1]||65536;if(d=S)c=p+1;else{i=O[f+2],e.advance();continue e}}break}}function Fe(O,e,a){for(let t=e,r;(r=O[t])!=65535;t++)if(r==a)return t-e;return-1}function ha(O,e,a,t){let r=Fe(a,t,e);return r<0||Fe(a,t,O)e)&&!t.type.isError)return a<0?Math.max(0,Math.min(t.to-1,e-25)):Math.min(O.length,Math.max(t.from+1,e+25));if(a<0?t.prevSibling():t.nextSibling())break;if(!t.parent())return a<0?0:O.length}}class fa{constructor(e,a){this.fragments=e,this.nodeSet=a,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Me(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Me(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=i,null;if(s instanceof Oe){if(i==e){if(i=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(i),this.index.push(0))}else this.index[a]++,this.nextStart=i+s.length}}}class ua{constructor(e,a){this.stream=a,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(t=>new te)}getActions(e){let a=0,t=null,{parser:r}=e.p,{tokenizers:s}=r,i=r.stateSlot(e.state,3),n=e.curContext?e.curContext.hash:0,l=0;for(let Q=0;Qc.end+25&&(l=Math.max(c.lookAhead,l)),c.value!=0)){let u=a;if(c.extended>-1&&(a=this.addActions(e,c.extended,c.end,a)),a=this.addActions(e,c.value,c.end,a),!d.extend&&(t=c,a>u))break}}for(;this.actions.length>a;)this.actions.pop();return l&&e.setLookAhead(l),!t&&e.pos==this.stream.end&&(t=new te,t.value=e.p.parser.eofTerm,t.start=t.end=e.pos,a=this.addActions(e,t.value,t.end,a)),this.mainToken=t,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let a=new te,{pos:t,p:r}=e;return a.start=t,a.end=Math.min(t+1,r.stream.end),a.value=t==r.stream.end?r.parser.eofTerm:0,a}updateCachedToken(e,a,t){let r=this.stream.clipPos(t.pos);if(a.token(this.stream.reset(r,e),t),e.value>-1){let{parser:s}=t.p;for(let i=0;i=0&&t.p.parser.dialect.allows(n>>1)){n&1?e.extended=n>>1:e.value=n>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,a,t,r){for(let s=0;se.bufferLength*4?new fa(t,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,a=this.minStackPos,t=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[i]=e;for(;i.forceReduce()&&i.stack.length&&i.stack[i.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let i=0;ia)t.push(n);else{if(this.advanceStack(n,t,e))continue;{r||(r=[],s=[]),r.push(n);let l=this.tokens.getMainToken(n);s.push(l.value,l.end)}}break}}if(!t.length){let i=r&&Sa(r);if(i)return g&&console.log("Finish with "+this.stackID(i)),this.stackToTree(i);if(this.parser.strict)throw g&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+a);this.recovering||(this.recovering=5)}if(this.recovering&&r){let i=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,t);if(i)return g&&console.log("Force-finish "+this.stackID(i)),this.stackToTree(i.forceAll())}if(this.recovering){let i=this.recovering==1?1:this.recovering*3;if(t.length>i)for(t.sort((n,l)=>l.score-n.score);t.length>i;)t.pop();t.some(n=>n.reducePos>a)&&this.recovering--}else if(t.length>1){e:for(let i=0;i500&&Q.buffer.length>500)if((n.score-Q.score||n.buffer.length-Q.buffer.length)>0)t.splice(l--,1);else{t.splice(i--,1);continue e}}}t.length>12&&t.splice(12,t.length-12)}this.minStackPos=t[0].pos;for(let i=1;i ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let Q=e.curContext&&e.curContext.tracker.strict,d=Q?e.curContext.hash:0;for(let c=this.fragments.nodeAt(r);c;){let u=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(e.state,c.type.id):-1;if(u>-1&&c.length&&(!Q||(c.prop(je.contextHash)||0)==d))return e.useNode(c,u),g&&console.log(i+this.stackID(e)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof Oe)||c.children.length==0||c.positions[0]>0)break;let p=c.children[0];if(p instanceof Oe&&c.positions[0]==0)c=p;else break}}let n=s.stateSlot(e.state,4);if(n>0)return e.reduce(n),g&&console.log(i+this.stackID(e)+` (via always-reduce ${s.getName(n&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let Q=0;Qr?a.push(f):t.push(f)}return!1}advanceFully(e,a){let t=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>t)return He(e,a),!0}}runRecovery(e,a,t){let r=null,s=!1;for(let i=0;i ":"";if(n.deadEnd&&(s||(s=!0,n.restart(),g&&console.log(d+this.stackID(n)+" (restarted)"),this.advanceFully(n,t))))continue;let c=n.split(),u=d;for(let p=0;c.forceReduce()&&p<10&&(g&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,t));p++)g&&(u=this.stackID(c)+" -> ");for(let p of n.recoverByInsert(l))g&&console.log(d+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,t);this.stream.end>n.pos?(Q==n.pos&&(Q++,l=0),n.recoverByDelete(l,Q),g&&console.log(d+this.stackID(n)+` (via recover-delete ${this.parser.getName(l)})`),He(n,t)):(!r||r.scoreO;class _O{constructor(e){this.start=e.start,this.shift=e.shift||he,this.reduce=e.reduce||he,this.reuse=e.reuse||he,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class T extends Ct{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let a=e.nodeNames.split(" ");this.minRepeatTerm=a.length;for(let n=0;ne.topRules[n][1]),r=[];for(let n=0;n=0)s(d,l,n[Q++]);else{let c=n[Q+-d];for(let u=-d;u>0;u--)s(n[Q++],l,c);Q++}}}this.nodeSet=new zt(a.map((n,l)=>Ut.define({name:l>=this.minRepeatTerm?void 0:n,id:l,props:r[l],top:t.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Et;let i=I(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;ntypeof n=="number"?new R(i,n):n),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,a,t){let r=new $a(this,e,a,t);for(let s of this.wrappers)r=s(r,e,a,t);return r}getGoto(e,a,t=!1){let r=this.goto;if(a>=r[0])return-1;for(let s=r[a+1];;){let i=r[s++],n=i&1,l=r[s++];if(n&&t)return l;for(let Q=s+(i>>1);s0}validAction(e,a){return!!this.allActions(e,t=>t==a?!0:null)}allActions(e,a){let t=this.stateSlot(e,4),r=t?a(t):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=x(this.data,s+2);else break;r=a(x(this.data,s+1))}return r}nextStates(e){let a=[];for(let t=this.stateSlot(e,1);;t+=3){if(this.data[t]==65535)if(this.data[t+1]==1)t=x(this.data,t+2);else break;if(!(this.data[t+2]&1)){let r=this.data[t+1];a.some((s,i)=>i&1&&s==r)||a.push(this.data[t],r)}}return a}configure(e){let a=Object.assign(Object.create(T.prototype),this);if(e.props&&(a.nodeSet=this.nodeSet.extend(...e.props)),e.top){let t=this.topRules[e.top];if(!t)throw new RangeError(`Invalid top rule name ${e.top}`);a.top=t}return e.tokenizers&&(a.tokenizers=this.tokenizers.map(t=>{let r=e.tokenizers.find(s=>s.from==t);return r?r.to:t})),e.specializers&&(a.specializers=this.specializers.slice(),a.specializerSpecs=this.specializerSpecs.map((t,r)=>{let s=e.specializers.find(n=>n.from==t.external);if(!s)return t;let i=Object.assign(Object.assign({},t),{external:s.to});return a.specializers[r]=eO(i),i})),e.contextTracker&&(a.context=e.contextTracker),e.dialect&&(a.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(a.strict=e.strict),e.wrap&&(a.wrappers=a.wrappers.concat(e.wrap)),e.bufferLength!=null&&(a.bufferLength=e.bufferLength),a}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let a=this.dynamicPrecedences;return a==null?0:a[e]||0}parseDialect(e){let a=Object.keys(this.dialects),t=a.map(()=>!1);if(e)for(let s of e.split(" ")){let i=a.indexOf(s);i>=0&&(t[i]=!0)}let r=null;for(let s=0;st)&&a.p.parser.stateFlag(a.state,2)&&(!e||e.scoreO.external(a,t)<<1|e}return O.get}const Za=54,ma=1,ga=55,ba=2,ka=56,Xa=3,OO=4,wa=5,oe=6,RO=7,VO=8,GO=9,CO=10,ya=11,xa=12,Ya=13,fe=57,Wa=14,tO=58,zO=20,Ta=22,UO=23,ja=24,Xe=26,EO=27,va=28,qa=31,_a=34,Ra=36,Va=37,Ga=0,Ca=1,za={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},Ua={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},aO={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 Ea(O){return O==45||O==46||O==58||O>=65&&O<=90||O==95||O>=97&&O<=122||O>=161}function AO(O){return O==9||O==10||O==13||O==32}let rO=null,iO=null,sO=0;function we(O,e){let a=O.pos+e;if(sO==a&&iO==O)return rO;let t=O.peek(e);for(;AO(t);)t=O.peek(++e);let r="";for(;Ea(t);)r+=String.fromCharCode(t),t=O.peek(++e);return iO=O,sO=a,rO=r?r.toLowerCase():t==Aa||t==Ia?void 0:null}const IO=60,le=62,_e=47,Aa=63,Ia=33,Na=45;function nO(O,e){this.name=O,this.parent=e,this.hash=e?e.hash:0;for(let a=0;a-1?new nO(we(t,1)||"",O):O},reduce(O,e){return e==zO&&O?O.parent:O},reuse(O,e,a,t){let r=e.type.id;return r==oe||r==Ra?new nO(we(t,1)||"",O):O},hash(O){return O?O.hash:0},strict:!1}),Ja=new k((O,e)=>{if(O.next!=IO){O.next<0&&e.context&&O.acceptToken(fe);return}O.advance();let a=O.next==_e;a&&O.advance();let t=we(O,0);if(t===void 0)return;if(!t)return O.acceptToken(a?Wa:oe);let r=e.context?e.context.name:null;if(a){if(t==r)return O.acceptToken(ya);if(r&&Ua[r])return O.acceptToken(fe,-2);if(e.dialectEnabled(Ga))return O.acceptToken(xa);for(let s=e.context;s;s=s.parent)if(s.name==t)return;O.acceptToken(Ya)}else{if(t=="script")return O.acceptToken(RO);if(t=="style")return O.acceptToken(VO);if(t=="textarea")return O.acceptToken(GO);if(za.hasOwnProperty(t))return O.acceptToken(CO);r&&aO[r]&&aO[r][t]?O.acceptToken(fe,-1):O.acceptToken(oe)}},{contextual:!0}),La=new k(O=>{for(let e=0,a=0;;a++){if(O.next<0){a&&O.acceptToken(tO);break}if(O.next==Na)e++;else if(O.next==le&&e>=2){a>=3&&O.acceptToken(tO,-2);break}else e=0;O.advance()}});function Ka(O){for(;O;O=O.parent)if(O.name=="svg"||O.name=="math")return!0;return!1}const Fa=new k((O,e)=>{if(O.next==_e&&O.peek(1)==le){let a=e.dialectEnabled(Ca)||Ka(e.context);O.acceptToken(a?wa:OO,2)}else O.next==le&&O.acceptToken(OO,1)});function Re(O,e,a){let t=2+O.length;return new k(r=>{for(let s=0,i=0,n=0;;n++){if(r.next<0){n&&r.acceptToken(e);break}if(s==0&&r.next==IO||s==1&&r.next==_e||s>=2&&si?r.acceptToken(e,-i):r.acceptToken(a,-(i-2));break}else if((r.next==10||r.next==13)&&n){r.acceptToken(e,1);break}else s=i=0;r.advance()}})}const Ma=Re("script",Za,ma),Ha=Re("style",ga,ba),er=Re("textarea",ka,Xa),Or=J({"Text RawText":o.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":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}),tr=T.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1G/YOOOa-E7[-E7[O)RQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)WQ#tO'#C|OOOd-E7^-E7^O)]Q#tO'#DPOOO`-E7_-E7_O)bQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O)gQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOOb7+$l7+$lOOOd7+$o7+$oOOO`7+$r7+$rOOO`7+$t7+$tO)rQ#|O,59eO)wQ#|O,59hO)|Q#|O,59kOOO`1G/X1G/XO*RO7[O'#CvO*dOMhO'#CvOOQW1G.y1G.yOOO`1G/P1G/POOO`1G/S1G/SOOO`1G/V1G/VOOOO'#D['#D[O*uO7[O,59bOOQW,59b,59bOOOO'#D]'#D]O+WOMhO,59bOOOO-E7Y-E7YOOQW1G.|1G.|OOOO-E7Z-E7Z",stateData:"+s~O!^OS~OUSOVPOWQOXROYTO[]O][O^^O`^Oa^Ob^Oc^Ox^O{_O!dZO~OfaO~OfbO~OfcO~OfdO~OfeO~O!WfOPlP!ZlP~O!XiOQoP!ZoP~O!YlORrP!ZrP~OUSOVPOWQOXROYTOZqO[]O][O^^O`^Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:Ba,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"],["isolate",-11,21,29,30,32,33,35,36,37,38,41,42,"ltr",-3,26,27,39,""]],propSources:[Or],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zbkWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOa!R!R7tP;=`<%l7S!Z8OYkWa!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{ihSkWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbhSkWa!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXhSa!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhhSkWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TakWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOb!R!RAwP;=`<%lAY!ZBRYkWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhhSkWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbhSkWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbhSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXhSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!bx`P!a`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYlhS`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_khS`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_X`P!a`!cp!eQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZhSfQ`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!a`!cpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!a`!cpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!a`!cpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!a`!cp!dPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!a`!cpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!a`!cpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!a`!cpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!a`!cpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!a`!cpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!a`!cpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!a`!cpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!cpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO{PP!-nP;=`<%l!-Sq!-xS!cp{POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!a`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!a`{POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!a`!cp{POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!a`!cpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!a`!cpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!a`!cpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!a`!cpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!a`!cpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!a`!cpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!cpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOxPP!7TP;=`<%l!6Vq!7]V!cpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!cpxPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!a`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!a`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!a`xPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let Q=n.type.id;if(Q==va)return ue(n,l,a);if(Q==qa)return ue(n,l,t);if(Q==_a)return ue(n,l,r);if(Q==zO&&s.length){let d=n.node,c=d.firstChild,u=c&&oO(c,l),p;if(u){for(let f of s)if(f.tag==u&&(!f.attrs||f.attrs(p||(p=NO(d,l))))){let P=d.lastChild,S=P.type.id==Va?P.from:d.to;if(S>c.to)return{parser:f.parser,overlay:[{from:c.to,to:S}]}}}}if(i&&Q==UO){let d=n.node,c;if(c=d.firstChild){let u=i[l.read(c.from,c.to)];if(u)for(let p of u){if(p.tagName&&p.tagName!=oO(d.parent,l))continue;let f=d.lastChild;if(f.type.id==Xe){let P=f.from+1,S=f.lastChild,X=f.to-(S&&S.isError?0:1);if(X>P)return{parser:p.parser,overlay:[{from:P,to:X}]}}else if(f.type.id==EO)return{parser:p.parser,overlay:[{from:f.from,to:f.to}]}}}}return null})}const ar=99,lO=1,rr=100,ir=101,cO=2,BO=[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],sr=58,nr=40,JO=95,or=91,ae=45,lr=46,cr=35,Qr=37,pr=38,dr=92,hr=10;function N(O){return O>=65&&O<=90||O>=97&&O<=122||O>=161}function fr(O){return O>=48&&O<=57}const ur=new k((O,e)=>{for(let a=!1,t=0,r=0;;r++){let{next:s}=O;if(N(s)||s==ae||s==JO||a&&fr(s))!a&&(s!=ae||r>0)&&(a=!0),t===r&&s==ae&&t++,O.advance();else if(s==dr&&O.peek(1)!=hr)O.advance(),O.next>-1&&O.advance(),a=!0;else{a&&O.acceptToken(s==nr?rr:t==2&&e.canShift(cO)?cO:ir);break}}}),$r=new k(O=>{if(BO.includes(O.peek(-1))){let{next:e}=O;(N(e)||e==JO||e==cr||e==lr||e==or||e==sr&&N(O.peek(1))||e==ae||e==pr)&&O.acceptToken(ar)}}),Pr=new k(O=>{if(!BO.includes(O.peek(-1))){let{next:e}=O;if(e==Qr&&(O.advance(),O.acceptToken(lO)),N(e)){do O.advance();while(N(O.next));O.acceptToken(lO)}}}),Sr=J({"AtKeyword import charset namespace keyframes media supports":o.definitionKeyword,"from to selector":o.keyword,NamespaceName:o.namespace,KeyframeName:o.labelName,KeyframeRangeName:o.operatorKeyword,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,ColorLiteral:o.color,"ParenthesizedContent StringLiteral":o.string,":":o.punctuation,"PseudoOp #":o.derefOperator,"; ,":o.separator,"( )":o.paren,"[ ]":o.squareBracket,"{ }":o.brace}),Zr={__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:138},mr={__proto__:null,"@import":118,"@media":142,"@charset":146,"@namespace":150,"@keyframes":156,"@supports":168},gr={__proto__:null,not:132,only:132},br=T.deserialize({version:14,states:":^QYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DTO$vQ[O'#DWOOQP'#Em'#EmO${QdO'#DgO%jQ[O'#DtO${QdO'#DvO%{Q[O'#DxO&WQ[O'#D{O&`Q[O'#ERO&nQ[O'#ETOOQS'#El'#ElOOQS'#EW'#EWQYQ[OOO&uQXO'#CdO'jQWO'#DcO'oQWO'#EsO'zQ[O'#EsQOQWOOP(UO#tO'#C_POOO)C@[)C@[OOQP'#Cg'#CgOOQP,59Q,59QO#kQ[O,59QO(aQ[O'#E[O({QWO,58{O)TQ[O,59SO$qQ[O,59oO$vQ[O,59rO(aQ[O,59uO(aQ[O,59wO(aQ[O,59xO)`Q[O'#DbOOQS,58{,58{OOQP'#Ck'#CkOOQO'#DR'#DROOQP,59S,59SO)gQWO,59SO)lQWO,59SOOQP'#DV'#DVOOQP,59o,59oOOQO'#DX'#DXO)qQ`O,59rOOQS'#Cp'#CpO${QdO'#CqO)yQvO'#CsO+ZQtO,5:ROOQO'#Cx'#CxO)lQWO'#CwO+oQWO'#CyO+tQ[O'#DOOOQS'#Ep'#EpOOQO'#Dj'#DjO+|Q[O'#DqO,[QWO'#EtO&`Q[O'#DoO,jQWO'#DrOOQO'#Eu'#EuO)OQWO,5:`O,oQpO,5:bOOQS'#Dz'#DzO,wQWO,5:dO,|Q[O,5:dOOQO'#D}'#D}O-UQWO,5:gO-ZQWO,5:mO-cQWO,5:oOOQS-E8U-E8UO${QdO,59}O-kQ[O'#E^O-xQWO,5;_O-xQWO,5;_POOO'#EV'#EVP.TO#tO,58yPOOO,58y,58yOOQP1G.l1G.lO.zQXO,5:vOOQO-E8Y-E8YOOQS1G.g1G.gOOQP1G.n1G.nO)gQWO1G.nO)lQWO1G.nOOQP1G/Z1G/ZO/XQ`O1G/^O/rQXO1G/aO0YQXO1G/cO0pQXO1G/dO1WQWO,59|O1]Q[O'#DSO1dQdO'#CoOOQP1G/^1G/^O${QdO1G/^O1kQpO,59]OOQS,59_,59_O${QdO,59aO1sQWO1G/mOOQS,59c,59cO1xQ!bO,59eOOQS'#DP'#DPOOQS'#EY'#EYO2QQ[O,59jOOQS,59j,59jO2YQWO'#DjO2eQWO,5:VO2jQWO,5:]O&`Q[O,5:XO&`Q[O'#E_O2rQWO,5;`O2}QWO,5:ZO(aQ[O,5:^OOQS1G/z1G/zOOQS1G/|1G/|OOQS1G0O1G0OO3`QWO1G0OO3eQdO'#EOOOQS1G0R1G0ROOQS1G0X1G0XOOQS1G0Z1G0ZO3pQtO1G/iOOQO,5:x,5:xO4WQ[O,5:xOOQO-E8[-E8[O4eQWO1G0yPOOO-E8T-E8TPOOO1G.e1G.eOOQP7+$Y7+$YOOQP7+$x7+$xO${QdO7+$xOOQS1G/h1G/hO4pQXO'#ErO4wQWO,59nO4|QtO'#EXO5tQdO'#EoO6OQWO,59ZO6TQpO7+$xOOQS1G.w1G.wOOQS1G.{1G.{OOQS7+%X7+%XO6]QWO1G/POOQS-E8W-E8WOOQS1G/U1G/UO${QdO1G/qOOQO1G/w1G/wOOQO1G/s1G/sO6bQWO,5:yOOQO-E8]-E8]O6pQXO1G/xOOQS7+%j7+%jO6wQYO'#CsOOQO'#EQ'#EQO7SQ`O'#EPOOQO'#EP'#EPO7_QWO'#E`O7gQdO,5:jOOQS,5:j,5:jO7rQtO'#E]O${QdO'#E]O8sQdO7+%TOOQO7+%T7+%TOOQO1G0d1G0dO9WQpO<OAN>OO:xQdO,5:uOOQO-E8X-E8XOOQO<T![;'S%^;'S;=`%o<%lO%^l;TUo`Oy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^l;nYo`#e[Oy%^z!Q%^!Q![;g![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^l[[o`#e[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^n?VSt^Oy%^z;'S%^;'S;=`%o<%lO%^l?hWjWOy%^z!O%^!O!P;O!P!Q%^!Q![>T![;'S%^;'S;=`%o<%lO%^n@VU#bQOy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^~@nTjWOy%^z{@}{;'S%^;'S;=`%o<%lO%^~AUSo`#[~Oy%^z;'S%^;'S;=`%o<%lO%^lAg[#e[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^bBbU]QOy%^z![%^![!]Bt!];'S%^;'S;=`%o<%lO%^bB{S^Qo`Oy%^z;'S%^;'S;=`%o<%lO%^nC^S!Y^Oy%^z;'S%^;'S;=`%o<%lO%^dCoS|SOy%^z;'S%^;'S;=`%o<%lO%^bDQU!OQOy%^z!`%^!`!aDd!a;'S%^;'S;=`%o<%lO%^bDkS!OQo`Oy%^z;'S%^;'S;=`%o<%lO%^bDzWOy%^z!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bEk[![Qo`Oy%^z}%^}!OEd!O!Q%^!Q![Ed![!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^nFfSq^Oy%^z;'S%^;'S;=`%o<%lO%^nFwSp^Oy%^z;'S%^;'S;=`%o<%lO%^bGWUOy%^z#b%^#b#cGj#c;'S%^;'S;=`%o<%lO%^bGoUo`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!bQo`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!TUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!S^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!RQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}",tokenizers:[$r,Pr,ur,1,2,3,4,new ne("m~RRYZ[z{a~~g~aO#^~~dP!P!Qg~lO#_~~",28,105)],topRules:{StyleSheet:[0,4],Styles:[1,86]},specialized:[{term:100,get:O=>Zr[O]||-1},{term:58,get:O=>mr[O]||-1},{term:101,get:O=>gr[O]||-1}],tokenPrec:1200});let $e=null;function Pe(){if(!$e&&typeof document=="object"&&document.body){let{style:O}=document.body,e=[],a=new Set;for(let t in O)t!="cssText"&&t!="cssFloat"&&typeof O[t]=="string"&&(/[A-Z]/.test(t)&&(t=t.replace(/[A-Z]/g,r=>"-"+r.toLowerCase())),a.has(t)||(e.push(t),a.add(t)));$e=e.sort().map(t=>({type:"property",label:t}))}return $e||[]}const QO=["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(O=>({type:"class",label:O})),pO=["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(O=>({type:"keyword",label:O})).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(O=>({type:"constant",label:O}))),kr=["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(O=>({type:"type",label:O})),W=/^(\w[\w-]*|-\w[\w-]*|)$/,Xr=/^-(-[\w-]*)?$/;function wr(O,e){var a;if((O.name=="("||O.type.isError)&&(O=O.parent||O),O.name!="ArgList")return!1;let t=(a=O.parent)===null||a===void 0?void 0:a.firstChild;return(t==null?void 0:t.name)!="Callee"?!1:e.sliceString(t.from,t.to)=="var"}const dO=new YO,yr=["Declaration"];function xr(O){for(let e=O;;){if(e.type.isTop)return e;if(!(e=e.parent))return O}}function LO(O,e,a){if(e.to-e.from>4096){let t=dO.get(e);if(t)return t;let r=[],s=new Set,i=e.cursor(ve.IncludeAnonymous);if(i.firstChild())do for(let n of LO(O,i.node,a))s.has(n.label)||(s.add(n.label),r.push(n));while(i.nextSibling());return dO.set(e,r),r}else{let t=[],r=new Set;return e.cursor().iterate(s=>{var i;if(a(s)&&s.matchContext(yr)&&((i=s.node.nextSibling)===null||i===void 0?void 0:i.name)==":"){let n=O.sliceString(s.from,s.to);r.has(n)||(r.add(n),t.push({label:n,type:"variable"}))}}),t}}const Yr=O=>e=>{let{state:a,pos:t}=e,r=C(a).resolveInner(t,-1),s=r.type.isError&&r.from==r.to-1&&a.doc.sliceString(r.from,r.to)=="-";if(r.name=="PropertyName"||(s||r.name=="TagName")&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:Pe(),validFor:W};if(r.name=="ValueName")return{from:r.from,options:pO,validFor:W};if(r.name=="PseudoClassName")return{from:r.from,options:QO,validFor:W};if(O(r)||(e.explicit||s)&&wr(r,a.doc))return{from:O(r)||s?r.from:t,options:LO(a.doc,xr(r),O),validFor:Xr};if(r.name=="TagName"){for(let{parent:l}=r;l;l=l.parent)if(l.name=="Block")return{from:r.from,options:Pe(),validFor:W};return{from:r.from,options:kr,validFor:W}}if(!e.explicit)return null;let i=r.resolve(t),n=i.childBefore(t);return n&&n.name==":"&&i.name=="PseudoClassSelector"?{from:t,options:QO,validFor:W}:n&&n.name==":"&&i.name=="Declaration"||i.name=="ArgList"?{from:t,options:pO,validFor:W}:i.name=="Block"||i.name=="Styles"?{from:t,options:Pe(),validFor:W}:null},Wr=Yr(O=>O.name=="VariableName"),ce=L.define({name:"css",parser:br.configure({props:[K.add({Declaration:_()}),F.add({"Block KeyframeList":qe})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Tr(){return new M(ce,ce.data.of({autocomplete:Wr}))}const jr=309,hO=1,vr=2,qr=3,_r=310,Rr=312,Vr=313,Gr=4,Cr=5,zr=0,ye=[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],KO=125,Ur=59,xe=47,Er=42,Ar=43,Ir=45,Nr=60,Dr=44,Br=new _O({start:!1,shift(O,e){return e==Gr||e==Cr||e==Rr?O:e==Vr},strict:!1}),Jr=new k((O,e)=>{let{next:a}=O;(a==KO||a==-1||e.context)&&O.acceptToken(_r)},{contextual:!0,fallback:!0}),Lr=new k((O,e)=>{let{next:a}=O,t;ye.indexOf(a)>-1||a==xe&&((t=O.peek(1))==xe||t==Er)||a!=KO&&a!=Ur&&a!=-1&&!e.context&&O.acceptToken(jr)},{contextual:!0}),Kr=new k((O,e)=>{let{next:a}=O;if((a==Ar||a==Ir)&&(O.advance(),a==O.next)){O.advance();let t=!e.context&&e.canShift(hO);O.acceptToken(t?hO:vr)}},{contextual:!0});function Se(O,e){return O>=65&&O<=90||O>=97&&O<=122||O==95||O>=192||!e&&O>=48&&O<=57}const Fr=new k((O,e)=>{if(O.next!=Nr||!e.dialectEnabled(zr)||(O.advance(),O.next==xe))return;let a=0;for(;ye.indexOf(O.next)>-1;)O.advance(),a++;if(Se(O.next,!0)){for(O.advance(),a++;Se(O.next,!1);)O.advance(),a++;for(;ye.indexOf(O.next)>-1;)O.advance(),a++;if(O.next==Dr)return;for(let t=0;;t++){if(t==7){if(!Se(O.next,!0))return;break}if(O.next!="extends".charCodeAt(t))break;O.advance(),a++}}O.acceptToken(qr,-a)}),Mr=J({"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 using 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 Hashbang":o.lineComment,BlockComment:o.blockComment,Number:o.number,String:o.string,Escape:o.escape,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,"@":o.meta,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,"JSXBuiltin/JSXIdentifier":o.standard(o.tagName)}),Hr={__proto__:null,export:18,as:23,from:31,default:34,async:39,function:40,extends:52,this:56,true:64,false:64,null:76,void:80,typeof:84,super:102,new:136,delete:152,yield:161,await:165,class:170,public:227,private:227,protected:227,readonly:229,instanceof:248,satisfies:251,in:252,const:254,import:286,keyof:339,unique:343,infer:349,is:385,abstract:405,implements:407,type:409,let:412,var:414,using:417,interface:423,enum:427,namespace:433,module:435,declare:439,global:443,for:462,of:471,while:474,with:478,do:482,if:486,else:488,switch:492,case:498,try:504,catch:508,finally:512,return:516,throw:520,break:524,continue:528,debugger:532},ei={__proto__:null,async:123,get:125,set:127,declare:187,public:189,private:189,protected:189,static:191,abstract:193,override:195,readonly:201,accessor:203,new:389},Oi={__proto__:null,"<":143},ti=T.deserialize({version:14,states:"$RQWO'#CdO>cQWO'#H[O>kQWO'#HbO>kQWO'#HdO`Q^O'#HfO>kQWO'#HhO>kQWO'#HkO>pQWO'#HqO>uQ07iO'#HwO%[Q^O'#HyO?QQ07iO'#H{O?]Q07iO'#H}O9kQ07hO'#IPO?hQ08SO'#ChO@jQ`O'#DiQOQWOOO%[Q^O'#EPOAQQWO'#ESO:RQ7[O'#EjOA]QWO'#EjOAhQpO'#FbOOQU'#Cf'#CfOOQ07`'#Dn'#DnOOQ07`'#Jm'#JmO%[Q^O'#JmOOQO'#Jq'#JqOOQO'#Ib'#IbOBhQ`O'#EcOOQ07`'#Eb'#EbOCdQ07pO'#EcOCnQ`O'#EVOOQO'#Jp'#JpODSQ`O'#JqOEaQ`O'#EVOCnQ`O'#EcPEnO!0LbO'#CaPOOO)CDu)CDuOOOO'#IX'#IXOEyO!bO,59TOOQ07b,59T,59TOOOO'#IY'#IYOFXO#tO,59TO%[Q^O'#D`OOOO'#I['#I[OFgO?MpO,59xOOQ07b,59x,59xOFuQ^O'#I]OGYQWO'#JkOI[QrO'#JkO+}Q^O'#JkOIcQWO,5:OOIyQWO'#ElOJWQWO'#JyOJcQWO'#JxOJcQWO'#JxOJkQWO,5;YOJpQWO'#JwOOQ07f,5:Z,5:ZOJwQ^O,5:ZOLxQ08SO,5:eOMiQWO,5:mONSQ07hO'#JvONZQWO'#JuO9ZQWO'#JuONoQWO'#JuONwQWO,5;XON|QWO'#JuO!#UQrO'#JjOOQ07b'#Ch'#ChO%[Q^O'#ERO!#tQpO,5:rOOQO'#Jr'#JrOOQO-EmOOQU'#J`'#J`OOQU,5>n,5>nOOQU-EpQWO'#HQO9aQWO'#HSO!CgQWO'#HSO:RQ7[O'#HUO!ClQWO'#HUOOQU,5=j,5=jO!CqQWO'#HVO!DSQWO'#CnO!DXQWO,59OO!DcQWO,59OO!FhQ^O,59OOOQU,59O,59OO!FxQ07hO,59OO%[Q^O,59OO!ITQ^O'#H^OOQU'#H_'#H_OOQU'#H`'#H`O`Q^O,5=vO!IkQWO,5=vO`Q^O,5=|O`Q^O,5>OO!IpQWO,5>QO`Q^O,5>SO!IuQWO,5>VO!IzQ^O,5>]OOQU,5>c,5>cO%[Q^O,5>cO9kQ07hO,5>eOOQU,5>g,5>gO!NUQWO,5>gOOQU,5>i,5>iO!NUQWO,5>iOOQU,5>k,5>kO!NZQ`O'#D[O%[Q^O'#JmO!NxQ`O'#JmO# gQ`O'#DjO# xQ`O'#DjO#$ZQ^O'#DjO#$bQWO'#JlO#$jQWO,5:TO#$oQWO'#EpO#$}QWO'#JzO#%VQWO,5;ZO#%[Q`O'#DjO#%iQ`O'#EUOOQ07b,5:n,5:nO%[Q^O,5:nO#%pQWO,5:nO>pQWO,5;UO!@}Q`O,5;UO!AVQ7[O,5;UO:RQ7[O,5;UO#%xQWO,5@XO#%}Q$ISO,5:rOOQO-E<`-E<`O#'TQ07pO,5:}OCnQ`O,5:qO#'_Q`O,5:qOCnQ`O,5:}O!@rQ07hO,5:qOOQ07`'#Ef'#EfOOQO,5:},5:}O%[Q^O,5:}O#'lQ07hO,5:}O#'wQ07hO,5:}O!@}Q`O,5:qOOQO,5;T,5;TO#(VQ07hO,5:}POOO'#IV'#IVP#(kO!0LbO,58{POOO,58{,58{OOOO-EwO+}Q^O,5>wOOQO,5>},5>}O#)VQ^O'#I]OOQO-EjQ08SO1G0{O#>wQ08SO1G0{O#@uQ08SO1G0{O#CuQ(CYO'#ChO#EsQ(CYO1G1^O#EzQ(CYO'#JjO!,lQWO1G1dO#F[Q08SO,5?TOOQ07`-EkQWO1G3lO$2dQ^O1G3nO$6hQ^O'#HmOOQU1G3q1G3qO$6uQWO'#HsO>pQWO'#HuOOQU1G3w1G3wO$6}Q^O1G3wO9kQ07hO1G3}OOQU1G4P1G4POOQ07`'#GY'#GYO9kQ07hO1G4RO9kQ07hO1G4TO$;UQWO,5@XO!*fQ^O,5;[O9ZQWO,5;[O>pQWO,5:UO!*fQ^O,5:UO!@}Q`O,5:UO$;ZQ(CYO,5:UOOQO,5;[,5;[O$;eQ`O'#I^O$;{QWO,5@WOOQ07b1G/o1G/oO$pQWO1G0pO!@}Q`O1G0pO!AVQ7[O1G0pOOQ07`1G5s1G5sO!@rQ07hO1G0]OOQO1G0i1G0iO%[Q^O1G0iO$PQrO1G4cOOQO1G4i1G4iO%[Q^O,5>wO$>ZQWO1G5qO$>cQWO1G6OO$>kQrO1G6PO9ZQWO,5>}O$>uQ08SO1G5|O%[Q^O1G5|O$?VQ07hO1G5|O$?hQWO1G5{O$?hQWO1G5{O9ZQWO1G5{O$?pQWO,5?QO9ZQWO,5?QOOQO,5?Q,5?QO$@UQWO,5?QO$'ZQWO,5?QOOQO-EXOOQU,5>X,5>XO%[Q^O'#HnO%7dQWO'#HpOOQU,5>_,5>_O9ZQWO,5>_OOQU,5>a,5>aOOQU7+)c7+)cOOQU7+)i7+)iOOQU7+)m7+)mOOQU7+)o7+)oO%7iQ`O1G5sO%7}Q(CYO1G0vO%8XQWO1G0vOOQO1G/p1G/pO%8dQ(CYO1G/pO>pQWO1G/pO!*fQ^O'#DjOOQO,5>x,5>xOOQO-E<[-E<[OOQO,5?O,5?OOOQO-EpQWO7+&[O!@}Q`O7+&[OOQO7+%w7+%wO$=mQ08SO7+&TOOQO7+&T7+&TO%[Q^O7+&TO%8nQ07hO7+&TO!@rQ07hO7+%wO!@}Q`O7+%wO%8yQ07hO7+&TO%9XQ08SO7++hO%[Q^O7++hO%9iQWO7++gO%9iQWO7++gOOQO1G4l1G4lO9ZQWO1G4lO%9qQWO1G4lOOQO7+%|7+%|O#%sQWO<zQ08SO1G2ZO%A]Q08SO1G2mO%ChQ08SO1G2oO%EsQ7[O,5>yOOQO-E<]-E<]O%E}QrO,5>zO%[Q^O,5>zOOQO-E<^-E<^O%FXQWO1G5uOOQ07b<YOOQU,5>[,5>[O&5oQWO1G3yO9ZQWO7+&bO!*fQ^O7+&bOOQO7+%[7+%[O&5tQ(CYO1G6PO>pQWO7+%[OOQ07b<pQWO<pQWO7+)eO'&sQWO<}AN>}O%[Q^OAN?ZOOQO<qQ(CYOG26}O!*fQ^O'#DyO1PQWO'#EWO'@gQrO'#JiO!*fQ^O'#DqO'@nQ^O'#D}O'@uQrO'#ChO'C]QrO'#ChO!*fQ^O'#EPO'CmQ^O,5;VO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O'#IiO'EpQWO,5a#@O#@^#@d#Ax#BW#Cr#DQ#DW#D^#Dd#Dn#Dt#Dz#EU#Eh#EnPPPPPPPPPP#EtPPPPPPP#Fi#Ip#KP#KW#K`PPPP$!d$%Z$+r$+u$+x$,q$,t$,w$-O$-WPP$-^$-b$.Y$/X$/]$/qPP$/u$/{$0PP$0S$0W$0Z$1P$1h$2P$2T$2W$2Z$2a$2d$2h$2lR!{RoqOXst!Z#c%j&m&o&p&r,h,m1w1zY!uQ'Z-Y1[5]Q%pvQ%xyQ&P|Q&e!VS'R!e-QQ'a!iS'g!r!xS*c$|*hQ+f%yQ+s&RQ,X&_Q-W'YQ-b'bQ-j'hQ/|*jQ1f,YR;Y:g%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%j%p%}&f&i&m&o&p&r&v'O']'m'}(P(V(^(r(v(z)y+O+S,e,h,m-^-f-t-z.l.s0[0a0q1_1o1p1r1t1w1z1|2m2s3Z5Y5d5t5u5x6]7w7|8]8gS#p]:d!r)[$[$m'S)n,y,|.{2]3p5W6S9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]Q*u%ZQ+k%{Q,Z&bQ,b&jQ.c;QQ0h+^Q0l+`Q0w+lQ1n,`Q2{.[Q4v0rQ5k1gQ6i3PQ6u;RQ7h4wR8m6j&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%j%p%}&f&i&j&m&o&p&r&v'O'S']'m'}(P(V(^(r(v(z)n)y+O+S+^,e,h,m,y,|-^-f-t-z.[.l.s.{0[0a0q1_1o1p1r1t1w1z1|2]2m2s3P3Z3p5W5Y5d5t5u5x6S6]6j7w7|8]8g9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]t!nQ!r!u!x!y'R'Y'Z'g'h'i-Q-W-Y-j1[5]5_$v$si#u#w$c$d$x${%O%Q%[%]%a)u){)}*P*R*Y*`*p*q+]+`+w+z.Z.i/Z/j/k/m0Q0S0^1R1U1^3O3x4S4[4f4n4p5c6g7T7^7y8j8w9[9n:O:W:y:z:|:};O;P;S;T;U;V;W;X;_;`;a;b;c;d;g;h;i;j;k;l;m;n;q;r < TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin 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 PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody 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 SingleExpression SingleClassItem",maxTerm:371,context:Br,nodeProps:[["isolate",-8,4,5,13,33,35,48,50,52,""],["group",-26,8,16,18,65,201,205,209,210,212,215,218,228,230,236,238,240,242,245,251,257,259,261,263,265,267,268,"Statement",-32,12,13,28,31,32,38,48,51,52,54,59,67,75,79,81,83,84,106,107,116,117,134,137,139,140,141,142,144,145,164,165,167,"Expression",-23,27,29,33,37,39,41,168,170,172,173,175,176,177,179,180,181,183,184,185,195,197,199,200,"Type",-3,87,99,105,"ClassItem"],["openedBy",22,"<",34,"InterpolationStart",53,"[",57,"{",72,"(",157,"JSXStartCloseTag"],["closedBy",23,">",36,"InterpolationEnd",47,"]",58,"}",73,")",162,"JSXEndTag"]],propSources:[Mr],skippedNodes:[0,4,5,271],repeatNodeCount:37,tokenData:"$Fj(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Ns!`!a$#_!a!b$(l!b!c$,k!c!}Er!}#O$-u#O#P$/P#P#Q$4h#Q#R$5r#R#SEr#S#T$7P#T#o$8Z#o#p$q#r#s$?}#s$f%Z$f$g+g$g#BYEr#BY#BZ$AX#BZ$ISEr$IS$I_$AX$I_$I|Er$I|$I}$Dd$I}$JO$Dd$JO$JTEr$JT$JU$AX$JU$KVEr$KV$KW$AX$KW&FUEr&FU&FV$AX&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$AX?HUOEr(n%d_$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$f&j(OpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(OpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Op(R!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$f&j(Op(R!b't(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST(P#S$f&j'u(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$f&j(Op(R!b'u(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$f&j!o$Ip(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#t$Id$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#t$Id$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/|3l_'}$(n$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$f&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$a`$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$a``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$a`$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(R!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$a`(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k#%|:hh$f&j(Op(R!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXVS$f&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSVSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWVS(R!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]VS$f&j(OpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWVS(OpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYVS(Op(R!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%lQ^$f&j!USOY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@Y!_!}!=y!}#O!Bw#O#P!Dj#P#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!?Ta$f&j!USO!^&c!_#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&cS!@_X!USOY!@YZ!P!@Y!P!Q!@z!Q!}!@Y!}#O!Ac#O#P!Bb#P;'S!@Y;'S;=`!Bq<%lO!@YS!APU!US#Z#[!@z#]#^!@z#a#b!@z#g#h!@z#i#j!@z#m#n!@zS!AfVOY!AcZ#O!Ac#O#P!A{#P#Q!@Y#Q;'S!Ac;'S;=`!B[<%lO!AcS!BOSOY!AcZ;'S!Ac;'S;=`!B[<%lO!AcS!B_P;=`<%l!AcS!BeSOY!@YZ;'S!@Y;'S;=`!Bq<%lO!@YS!BtP;=`<%l!@Y&n!B|[$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#O!Bw#O#P!Cr#P#Q!=y#Q#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!CwX$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!DgP;=`<%l!Bw&n!DoX$f&jOY!=yYZ&cZ!^!=y!^!_!@Y!_#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!E_P;=`<%l!=y(Q!Eki$f&j(R!b!USOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#Z&}#Z#[!Eb#[#]&}#]#^!Eb#^#a&}#a#b!Eb#b#g&}#g#h!Eb#h#i&}#i#j!Eb#j#m&}#m#n!Eb#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!f!GaZ(R!b!USOY!GYZw!GYwx!@Yx!P!GY!P!Q!HS!Q!}!GY!}#O!Ic#O#P!Bb#P;'S!GY;'S;=`!JZ<%lO!GY!f!HZb(R!b!USOY'}Zw'}x#O'}#P#Z'}#Z#[!HS#[#]'}#]#^!HS#^#a'}#a#b!HS#b#g'}#g#h!HS#h#i'}#i#j!HS#j#m'}#m#n!HS#n;'S'};'S;=`(f<%lO'}!f!IhX(R!bOY!IcZw!Icwx!Acx#O!Ic#O#P!A{#P#Q!GY#Q;'S!Ic;'S;=`!JT<%lO!Ic!f!JWP;=`<%l!Ic!f!J^P;=`<%l!GY(Q!Jh^$f&j(R!bOY!JaYZ&cZw!Jawx!Bwx!^!Ja!^!_!Ic!_#O!Ja#O#P!Cr#P#Q!Q#V#X%Z#X#Y!4|#Y#b%Z#b#c#Zd$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#?tf$f&j(Op(R!bo$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c#Hr[O]||-1},{term:334,get:O=>ei[O]||-1},{term:70,get:O=>Oi[O]||-1}],tokenPrec:14638}),FO=[m("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),m("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),m("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),m("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),m("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),m(`try { - \${} -} catch (\${error}) { - \${} -}`,{label:"try",detail:"/ catch block",type:"keyword"}),m("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),m(`if (\${}) { - \${} -} else { - \${} -}`,{label:"if",detail:"/ else block",type:"keyword"}),m(`class \${name} { - constructor(\${params}) { - \${} - } -}`,{label:"class",detail:"definition",type:"keyword"}),m('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),m('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],ai=FO.concat([m("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),m("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),m("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),fO=new YO,MO=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function U(O){return(e,a)=>{let t=e.node.getChild("VariableDefinition");return t&&a(t,O),!0}}const ri=["FunctionDeclaration"],ii={FunctionDeclaration:U("function"),ClassDeclaration:U("class"),ClassExpression:()=>!0,EnumDeclaration:U("constant"),TypeAliasDeclaration:U("type"),NamespaceDeclaration:U("namespace"),VariableDefinition(O,e){O.matchContext(ri)||e(O,"variable")},TypeDefinition(O,e){e(O,"type")},__proto__:null};function HO(O,e){let a=fO.get(e);if(a)return a;let t=[],r=!0;function s(i,n){let l=O.sliceString(i.from,i.to);t.push({label:l,type:n})}return e.cursor(ve.IncludeAnonymous).iterate(i=>{if(r)r=!1;else if(i.name){let n=ii[i.name];if(n&&n(i,s)||MO.has(i.name))return!1}else if(i.to-i.from>8192){for(let n of HO(O,i.node))t.push(n);return!1}}),fO.set(e,t),t}const uO=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,et=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function si(O){let e=C(O.state).resolveInner(O.pos,-1);if(et.indexOf(e.name)>-1)return null;let a=e.name=="VariableName"||e.to-e.from<20&&uO.test(O.state.sliceDoc(e.from,e.to));if(!a&&!O.explicit)return null;let t=[];for(let r=e;r;r=r.parent)MO.has(r.name)&&(t=t.concat(HO(O.state.doc,r)));return{options:t,from:a?e.from:O.pos,validFor:uO}}const w=L.define({name:"javascript",parser:ti.configure({props:[K.add({IfStatement:_({except:/^\s*({|else\b)/}),TryStatement:_({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:It,SwitchBody:O=>{let e=O.textAfter,a=/^\s*\}/.test(e),t=/^\s*(case|default)\b/.test(e);return O.baseIndent+(a?0:t?1:2)*O.unit},Block:Nt({closing:"}"}),ArrowFunction:O=>O.baseIndent+O.unit,"TemplateString BlockComment":()=>null,"Statement Property":_({except:/^{/}),JSXElement(O){let e=/^\s*<\//.test(O.textAfter);return O.lineIndent(O.node.from)+(e?0:O.unit)},JSXEscape(O){let e=/\s*\}/.test(O.textAfter);return O.lineIndent(O.node.from)+(e?0:O.unit)},"JSXOpenTag JSXSelfClosingTag"(O){return O.column(O.node.from)+O.unit}}),F.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":qe,BlockComment(O){return{from:O.from+2,to:O.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Ot={test:O=>/^JSX/.test(O.name),facet:Dt({commentTokens:{block:{open:"{/*",close:"*/}"}}})},tt=w.configure({dialect:"ts"},"typescript"),at=w.configure({dialect:"jsx",props:[vO.add(O=>O.isTop?[Ot]:void 0)]}),rt=w.configure({dialect:"jsx ts",props:[vO.add(O=>O.isTop?[Ot]:void 0)]},"typescript");let it=O=>({label:O,type:"keyword"});const st="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(it),ni=st.concat(["declare","implements","private","protected","public"].map(it));function nt(O={}){let e=O.jsx?O.typescript?rt:at:O.typescript?tt:w,a=O.typescript?ai.concat(ni):FO.concat(st);return new M(e,[w.data.of({autocomplete:WO(et,TO(a))}),w.data.of({autocomplete:si}),O.jsx?ci:[]])}function oi(O){for(;;){if(O.name=="JSXOpenTag"||O.name=="JSXSelfClosingTag"||O.name=="JSXFragmentTag")return O;if(O.name=="JSXEscape"||!O.parent)return null;O=O.parent}}function $O(O,e,a=O.length){for(let t=e==null?void 0:e.firstChild;t;t=t.nextSibling)if(t.name=="JSXIdentifier"||t.name=="JSXBuiltin"||t.name=="JSXNamespacedName"||t.name=="JSXMemberExpression")return O.sliceString(t.from,Math.min(t.to,a));return""}const li=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),ci=q.inputHandler.of((O,e,a,t,r)=>{if((li?O.composing:O.compositionStarted)||O.state.readOnly||e!=a||t!=">"&&t!="/"||!w.isActiveAt(O.state,e,-1))return!1;let s=r(),{state:i}=s,n=i.changeByRange(l=>{var Q;let{head:d}=l,c=C(i).resolveInner(d-1,-1),u;if(c.name=="JSXStartTag"&&(c=c.parent),!(i.doc.sliceString(d-1,d)!=t||c.name=="JSXAttributeValue"&&c.to>d)){if(t==">"&&c.name=="JSXFragmentTag")return{range:l,changes:{from:d,insert:""}};if(t=="/"&&c.name=="JSXStartCloseTag"){let p=c.parent,f=p.parent;if(f&&p.from==d-2&&((u=$O(i.doc,f.firstChild,d))||((Q=f.firstChild)===null||Q===void 0?void 0:Q.name)=="JSXFragmentTag")){let P=`${u}>`;return{range:jO.cursor(d+P.length,-1),changes:{from:d,insert:P}}}}else if(t==">"){let p=oi(c);if(p&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(u=$O(i.doc,p,d)))return{range:l,changes:{from:d,insert:``}}}}return{range:l}});return n.changes.empty?!1:(O.dispatch([s,i.update(n,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),E=["_blank","_self","_top","_parent"],Ze=["ascii","utf-8","utf-16","latin1","latin1"],me=["get","post","put","delete"],ge=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],b=["true","false"],h={},Qi={a:{attrs:{href:null,ping:null,type:null,media:null,target:E,hreflang:null}},abbr:h,address:h,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:h,aside:h,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:h,base:{attrs:{href:null,target:E}},bdi:h,bdo:h,blockquote:{attrs:{cite:null}},body:h,br:h,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:ge,formmethod:me,formnovalidate:["novalidate"],formtarget:E,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:h,center:h,cite:h,code:h,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:h,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:h,div:h,dl:h,dt:h,em:h,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:h,figure:h,footer:h,form:{attrs:{action:null,name:null,"accept-charset":Ze,autocomplete:["on","off"],enctype:ge,method:me,novalidate:["novalidate"],target:E}},h1:h,h2:h,h3:h,h4:h,h5:h,h6:h,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:h,hgroup:h,hr:h,html:{attrs:{manifest:null}},i:h,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:ge,formmethod:me,formnovalidate:["novalidate"],formtarget:E,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:h,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:h,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:h,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Ze,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:h,noscript:h,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:h,param:{attrs:{name:null,value:null}},pre:h,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:h,rt:h,ruby:h,samp:h,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Ze}},section:h,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:h,source:{attrs:{src:null,type:null,media:null}},span:h,strong:h,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:h,summary:h,sup:h,table:h,tbody:h,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:h,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:h,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:h,time:{attrs:{datetime:null}},title:h,tr:h,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:h,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:h},ot={accesskey:null,class:null,contenteditable:b,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:b,autocorrect:b,autocapitalize:b,style:null,tabindex:null,title:null,translate:["yes","no"],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":b,"aria-autocomplete":["inline","list","both","none"],"aria-busy":b,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":b,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":b,"aria-hidden":b,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":b,"aria-multiselectable":b,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":b,"aria-relevant":null,"aria-required":b,"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},lt="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(O=>"on"+O);for(let O of lt)ot[O]=null;class Qe{constructor(e,a){this.tags=Object.assign(Object.assign({},Qi),e),this.globalAttrs=Object.assign(Object.assign({},ot),a),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Qe.default=new Qe;function V(O,e,a=O.length){if(!e)return"";let t=e.firstChild,r=t&&t.getChild("TagName");return r?O.sliceString(r.from,Math.min(r.to,a)):""}function G(O,e=!1){for(;O;O=O.parent)if(O.name=="Element")if(e)e=!1;else return O;return null}function ct(O,e,a){let t=a.tags[V(O,G(e))];return(t==null?void 0:t.children)||a.allTags}function Ve(O,e){let a=[];for(let t=G(e);t&&!t.type.isTop;t=G(t.parent)){let r=V(O,t);if(r&&t.lastChild.name=="CloseTag")break;r&&a.indexOf(r)<0&&(e.name=="EndTag"||e.from>=t.firstChild.to)&&a.push(r)}return a}const Qt=/^[:\-\.\w\u00b7-\uffff]*$/;function PO(O,e,a,t,r){let s=/\s*>/.test(O.sliceDoc(r,r+5))?"":">",i=G(a,!0);return{from:t,to:r,options:ct(O.doc,i,e).map(n=>({label:n,type:"type"})).concat(Ve(O.doc,a).map((n,l)=>({label:"/"+n,apply:"/"+n+s,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function SO(O,e,a,t){let r=/\s*>/.test(O.sliceDoc(t,t+5))?"":">";return{from:a,to:t,options:Ve(O.doc,e).map((s,i)=>({label:s,apply:s+r,type:"type",boost:99-i})),validFor:Qt}}function pi(O,e,a,t){let r=[],s=0;for(let i of ct(O.doc,a,e))r.push({label:"<"+i,type:"type"});for(let i of Ve(O.doc,a))r.push({label:"",type:"type",boost:99-s++});return{from:t,to:t,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function di(O,e,a,t,r){let s=G(a),i=s?e.tags[V(O.doc,s)]:null,n=i&&i.attrs?Object.keys(i.attrs):[],l=i&&i.globalAttrs===!1?n:n.length?n.concat(e.globalAttrNames):e.globalAttrNames;return{from:t,to:r,options:l.map(Q=>({label:Q,type:"property"})),validFor:Qt}}function hi(O,e,a,t,r){var s;let i=(s=a.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),n=[],l;if(i){let Q=O.sliceDoc(i.from,i.to),d=e.globalAttrs[Q];if(!d){let c=G(a),u=c?e.tags[V(O.doc,c)]:null;d=(u==null?void 0:u.attrs)&&u.attrs[Q]}if(d){let c=O.sliceDoc(t,r).toLowerCase(),u='"',p='"';/^['"]/.test(c)?(l=c[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",p=O.sliceDoc(r,r+1)==c[0]?"":c[0],c=c.slice(1),t++):l=/^[^\s<>='"]*$/;for(let f of d)n.push({label:f,apply:u+f+p,type:"constant"})}}return{from:t,to:r,options:n,validFor:l}}function fi(O,e){let{state:a,pos:t}=e,r=C(a).resolveInner(t,-1),s=r.resolve(t);for(let i=t,n;s==r&&(n=r.childBefore(i));){let l=n.lastChild;if(!l||!l.type.isError||l.fromfi(t,r)}const $i=w.parser.configure({top:"SingleExpression"}),pt=[{tag:"script",attrs:O=>O.type=="text/typescript"||O.lang=="ts",parser:tt.parser},{tag:"script",attrs:O=>O.type=="text/babel"||O.type=="text/jsx",parser:at.parser},{tag:"script",attrs:O=>O.type=="text/typescript-jsx",parser:rt.parser},{tag:"script",attrs(O){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(O.type)},parser:$i},{tag:"script",attrs(O){return!O.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(O.type)},parser:w.parser},{tag:"style",attrs(O){return(!O.lang||O.lang=="css")&&(!O.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(O.type))},parser:ce.parser}],dt=[{name:"style",parser:ce.parser.configure({top:"Styles"})}].concat(lt.map(O=>({name:O,parser:w.parser}))),ht=L.define({name:"html",parser:tr.configure({props:[K.add({Element(O){let e=/^(\s*)(<\/)?/.exec(O.textAfter);return O.node.to<=O.pos+e[0].length?O.continue():O.lineIndent(O.node.from)+(e[2]?0:O.unit)},"OpenTag CloseTag SelfClosingTag"(O){return O.column(O.node.from)+O.unit},Document(O){if(O.pos+/\s*/.exec(O.textAfter)[0].lengthO.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),re=ht.configure({wrap:DO(pt,dt)});function Pi(O={}){let e="",a;O.matchClosingTags===!1&&(e="noMatch"),O.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(O.nestedLanguages&&O.nestedLanguages.length||O.nestedAttributes&&O.nestedAttributes.length)&&(a=DO((O.nestedLanguages||[]).concat(pt),(O.nestedAttributes||[]).concat(dt)));let t=a?ht.configure({wrap:a,dialect:e}):e?re.configure({dialect:e}):re;return new M(t,[re.data.of({autocomplete:ui(O)}),O.autoCloseTags!==!1?Si:[],nt().support,Tr().support])}const ZO=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Si=q.inputHandler.of((O,e,a,t,r)=>{if(O.composing||O.state.readOnly||e!=a||t!=">"&&t!="/"||!re.isActiveAt(O.state,e,-1))return!1;let s=r(),{state:i}=s,n=i.changeByRange(l=>{var Q,d,c;let u=i.doc.sliceString(l.from-1,l.to)==t,{head:p}=l,f=C(i).resolveInner(p-1,-1),P;if((f.name=="TagName"||f.name=="StartTag")&&(f=f.parent),u&&t==">"&&f.name=="OpenTag"){if(((d=(Q=f.parent)===null||Q===void 0?void 0:Q.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(P=V(i.doc,f.parent,p))&&!ZO.has(P)){let S=p+(i.doc.sliceString(p,p+1)===">"?1:0),X=``;return{range:l,changes:{from:p,to:S,insert:X}}}}else if(u&&t=="/"&&f.name=="IncompleteCloseTag"){let S=f.parent;if(f.from==p-2&&((c=S.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(P=V(i.doc,S,p))&&!ZO.has(P)){let X=p+(i.doc.sliceString(p,p+1)===">"?1:0),y=`${P}>`;return{range:jO.cursor(p+y.length,-1),changes:{from:p,to:X,insert:y}}}}return{range:l}});return n.changes.empty?!1:(O.dispatch([s,i.update(n,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Zi=J({String:o.string,Number:o.number,"True False":o.bool,PropertyName:o.propertyName,Null:o.null,",":o.separator,"[ ]":o.squareBracket,"{ }":o.brace}),mi=T.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[Zi],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),gi=L.define({name:"json",parser:mi.configure({props:[K.add({Object:_({except:/^\s*\}/}),Array:_({except:/^\s*\]/})}),F.add({"Object Array":qe})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function bi(){return new M(gi)}const ki=36,mO=1,Xi=2,A=3,be=4,wi=5,yi=6,xi=7,Yi=8,Wi=9,Ti=10,ji=11,vi=12,qi=13,_i=14,Ri=15,Vi=16,Gi=17,gO=18,Ci=19,ft=20,ut=21,bO=22,zi=23,Ui=24;function Ye(O){return O>=65&&O<=90||O>=97&&O<=122||O>=48&&O<=57}function Ei(O){return O>=48&&O<=57||O>=97&&O<=102||O>=65&&O<=70}function v(O,e,a){for(let t=!1;;){if(O.next<0)return;if(O.next==e&&!t){O.advance();return}t=a&&!t&&O.next==92,O.advance()}}function Ai(O){for(;;){if(O.next<0||O.peek(1)<0)return;if(O.next==36&&O.peek(1)==36){O.advance(2);return}O.advance()}}function Ii(O,e){let a="[{<(".indexOf(String.fromCharCode(e)),t=a<0?e:"]}>)".charCodeAt(a);for(;;){if(O.next<0)return;if(O.next==t&&O.peek(1)==39){O.advance(2);return}O.advance()}}function $t(O,e){for(;!(O.next!=95&&!Ye(O.next));)e!=null&&(e+=String.fromCharCode(O.next)),O.advance();return e}function Ni(O){if(O.next==39||O.next==34||O.next==96){let e=O.next;O.advance(),v(O,e,!1)}else $t(O)}function kO(O,e){for(;O.next==48||O.next==49;)O.advance();e&&O.next==e&&O.advance()}function XO(O,e){for(;;){if(O.next==46){if(e)break;e=!0}else if(O.next<48||O.next>57)break;O.advance()}if(O.next==69||O.next==101)for(O.advance(),(O.next==43||O.next==45)&&O.advance();O.next>=48&&O.next<=57;)O.advance()}function wO(O){for(;!(O.next<0||O.next==10);)O.advance()}function j(O,e){for(let a=0;a!=&|~^/",specialVar:"?",identifierQuotes:'"',words:Pt(Bi,Di)};function Ji(O,e,a,t){let r={};for(let s in We)r[s]=(O.hasOwnProperty(s)?O:We)[s];return e&&(r.words=Pt(e,a||"",t)),r}function St(O){return new k(e=>{var a;let{next:t}=e;if(e.advance(),j(t,ke)){for(;j(e.next,ke);)e.advance();e.acceptToken(ki)}else if(t==36&&e.next==36&&O.doubleDollarQuotedStrings)Ai(e),e.acceptToken(A);else if(t==39||t==34&&O.doubleQuotedStrings)v(e,t,O.backslashEscapes),e.acceptToken(A);else if(t==35&&O.hashComments||t==47&&e.next==47&&O.slashComments)wO(e),e.acceptToken(mO);else if(t==45&&e.next==45&&(!O.spaceAfterDashes||e.peek(1)==32))wO(e),e.acceptToken(mO);else if(t==47&&e.next==42){e.advance();for(let r=1;;){let s=e.next;if(e.next<0)break;if(e.advance(),s==42&&e.next==47){if(r--,e.advance(),!r)break}else s==47&&e.next==42&&(r++,e.advance())}e.acceptToken(Xi)}else if((t==101||t==69)&&e.next==39)e.advance(),v(e,39,!0);else if((t==110||t==78)&&e.next==39&&O.charSetCasts)e.advance(),v(e,39,O.backslashEscapes),e.acceptToken(A);else if(t==95&&O.charSetCasts)for(let r=0;;r++){if(e.next==39&&r>1){e.advance(),v(e,39,O.backslashEscapes),e.acceptToken(A);break}if(!Ye(e.next))break;e.advance()}else if(O.plsqlQuotingMechanism&&(t==113||t==81)&&e.next==39&&e.peek(1)>0&&!j(e.peek(1),ke)){let r=e.peek(1);e.advance(2),Ii(e,r),e.acceptToken(A)}else if(t==40)e.acceptToken(xi);else if(t==41)e.acceptToken(Yi);else if(t==123)e.acceptToken(Wi);else if(t==125)e.acceptToken(Ti);else if(t==91)e.acceptToken(ji);else if(t==93)e.acceptToken(vi);else if(t==59)e.acceptToken(qi);else if(O.unquotedBitLiterals&&t==48&&e.next==98)e.advance(),kO(e),e.acceptToken(bO);else if((t==98||t==66)&&(e.next==39||e.next==34)){const r=e.next;e.advance(),O.treatBitsAsBytes?(v(e,r,O.backslashEscapes),e.acceptToken(zi)):(kO(e,r),e.acceptToken(bO))}else if(t==48&&(e.next==120||e.next==88)||(t==120||t==88)&&e.next==39){let r=e.next==39;for(e.advance();Ei(e.next);)e.advance();r&&e.next==39&&e.advance(),e.acceptToken(be)}else if(t==46&&e.next>=48&&e.next<=57)XO(e,!0),e.acceptToken(be);else if(t==46)e.acceptToken(_i);else if(t>=48&&t<=57)XO(e,!1),e.acceptToken(be);else if(j(t,O.operatorChars)){for(;j(e.next,O.operatorChars);)e.advance();e.acceptToken(Ri)}else if(j(t,O.specialVar))e.next==t&&e.advance(),Ni(e),e.acceptToken(Gi);else if(j(t,O.identifierQuotes))v(e,t,!1),e.acceptToken(Ci);else if(t==58||t==44)e.acceptToken(Vi);else if(Ye(t)){let r=$t(e,String.fromCharCode(t));e.acceptToken(e.next==46?gO:(a=O.words[r.toLowerCase()])!==null&&a!==void 0?a:gO)}})}const Zt=St(We),Li=T.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,Zt],topRules:{Script:[0,25]},tokenPrec:0});function Te(O){let e=O.cursor().moveTo(O.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function D(O,e){let a=O.sliceString(e.from,e.to),t=/^([`'"])(.*)\1$/.exec(a);return t?t[2]:a}function pe(O){return O&&(O.name=="Identifier"||O.name=="QuotedIdentifier")}function Ki(O,e){if(e.name=="CompositeIdentifier"){let a=[];for(let t=e.firstChild;t;t=t.nextSibling)pe(t)&&a.push(D(O,t));return a}return[D(O,e)]}function yO(O,e){for(let a=[];;){if(!e||e.name!=".")return a;let t=Te(e);if(!pe(t))return a;a.unshift(D(O,t)),e=Te(t)}}function Fi(O,e){let a=C(O).resolveInner(e,-1),t=Hi(O.doc,a);return a.name=="Identifier"||a.name=="QuotedIdentifier"||a.name=="Keyword"?{from:a.from,quoted:a.name=="QuotedIdentifier"?O.doc.sliceString(a.from,a.from+1):null,parents:yO(O.doc,Te(a)),aliases:t}:a.name=="."?{from:e,quoted:null,parents:yO(O.doc,a),aliases:t}:{from:e,quoted:null,parents:[],empty:!0,aliases:t}}const Mi=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function Hi(O,e){let a;for(let r=e;!a;r=r.parent){if(!r)return null;r.name=="Statement"&&(a=r)}let t=null;for(let r=a.firstChild,s=!1,i=null;r;r=r.nextSibling){let n=r.name=="Keyword"?O.sliceString(r.from,r.to).toLowerCase():null,l=null;if(!s)s=n=="from";else if(n=="as"&&i&&pe(r.nextSibling))l=D(O,r.nextSibling);else{if(n&&Mi.has(n))break;i&&pe(r)&&(l=D(O,r))}l&&(t||(t=Object.create(null)),t[l]=Ki(O,i)),i=/Identifier$/.test(r.name)?r:null}return t}function es(O,e){return O?e.map(a=>Object.assign(Object.assign({},a),{label:a.label[0]==O?a.label:O+a.label+O,apply:void 0})):e}const Os=/^\w*$/,ts=/^[`'"]?\w*[`'"]?$/;class Ge{constructor(){this.list=[],this.children=void 0}child(e,a){let t=this.children||(this.children=Object.create(null)),r=t[e];return r||(e&&this.list.push(mt(e,"type",a)),t[e]=new Ge)}addCompletions(e){for(let a of e){let t=this.list.findIndex(r=>r.label==a.label);t>-1?this.list[t]=a:this.list.push(a)}}}function mt(O,e,a){return/^[a-z_][a-z_\d]*$/.test(O)?{label:O,type:e}:{label:O,type:e,apply:a+O+a}}function as(O,e,a,t,r,s){var i;let n=new Ge,l=((i=s==null?void 0:s.spec.identifierQuotes)===null||i===void 0?void 0:i[0])||'"',Q=n.child(r||"",l);for(let d in O){let c=d.replace(/\\?\./g,p=>p=="."?"\0":p).split("\0"),u=c.length==1?Q:n;for(let p of c)u=u.child(p.replace(/\\\./g,"."),l);for(let p of O[d])p&&u.list.push(typeof p=="string"?mt(p,"property",l):p)}return e&&Q.addCompletions(e),a&&n.addCompletions(a),n.addCompletions(Q.list),t&&n.addCompletions(Q.child(t,l).list),d=>{let{parents:c,from:u,quoted:p,empty:f,aliases:P}=Fi(d.state,d.pos);if(f&&!d.explicit)return null;P&&c.length==1&&(c=P[c[0]]||c);let S=n;for(let Y of c){for(;!S.children||!S.children[Y];)if(S==n)S=Q;else if(S==Q&&t)S=S.child(t,l);else return null;S=S.child(Y,l)}let X=p&&d.state.sliceDoc(d.pos,d.pos+1)==p,y=S.list;return S==n&&P&&(y=y.concat(Object.keys(P).map(Y=>({label:Y,type:"constant"})))),{from:u,to:X?d.pos+1:void 0,options:es(p,y),validFor:p?ts:Os}}}function rs(O,e){let a=Object.keys(O).map(t=>({label:e?t.toUpperCase():t,type:O[t]==ut?"type":O[t]==ft?"keyword":"variable",boost:-1}));return WO(["QuotedIdentifier","SpecialVar","String","LineComment","BlockComment","."],TO(a))}let is=Li.configure({props:[K.add({Statement:_()}),F.add({Statement(O){return{from:O.firstChild.to,to:O.to}},BlockComment(O){return{from:O.from+2,to:O.to-2}}}),J({Keyword:o.keyword,Type:o.typeName,Builtin:o.standard(o.name),Bits:o.number,Bytes:o.string,Bool:o.bool,Null:o.null,Number:o.number,String:o.string,Identifier:o.name,QuotedIdentifier:o.special(o.string),SpecialVar:o.special(o.name),LineComment:o.lineComment,BlockComment:o.blockComment,Operator:o.operator,"Semi Punctuation":o.punctuation,"( )":o.paren,"{ }":o.brace,"[ ]":o.squareBracket})]});class B{constructor(e,a,t){this.dialect=e,this.language=a,this.spec=t}get extension(){return this.language.extension}static define(e){let a=Ji(e,e.keywords,e.types,e.builtin),t=L.define({name:"sql",parser:is.configure({tokenizers:[{from:Zt,to:St(a)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new B(a,t,e)}}function ss(O,e=!1){return rs(O.dialect.words,e)}function ns(O,e=!1){return O.language.data.of({autocomplete:ss(O,e)})}function os(O){return O.schema?as(O.schema,O.tables,O.schemas,O.defaultTable,O.defaultSchema,O.dialect||Ce):()=>null}function ls(O){return O.schema?(O.dialect||Ce).language.data.of({autocomplete:os(O)}):[]}function xO(O={}){let e=O.dialect||Ce;return new M(e.language,[ls(O),ns(e,!!O.upperCaseKeywords)])}const Ce=B.define({});function cs(O){let e;return{c(){e=Yt("div"),Wt(e,"class","code-editor"),H(e,"min-height",O[0]?O[0]+"px":null),H(e,"max-height",O[1]?O[1]+"px":"auto")},m(a,t){Tt(a,e,t),O[11](e)},p(a,[t]){t&1&&H(e,"min-height",a[0]?a[0]+"px":null),t&2&&H(e,"max-height",a[1]?a[1]+"px":"auto")},i:De,o:De,d(a){a&&jt(e),O[11](null)}}}function Qs(O,e,a){let t;vt(O,qt,$=>a(12,t=$));const r=_t();let{id:s=""}=e,{value:i=""}=e,{minHeight:n=null}=e,{maxHeight:l=null}=e,{disabled:Q=!1}=e,{placeholder:d=""}=e,{language:c="javascript"}=e,{singleLine:u=!1}=e,p,f,P=new ee,S=new ee,X=new ee,y=new ee;function Y(){p==null||p.focus()}function gt(){f==null||f.dispatchEvent(new CustomEvent("change",{detail:{value:i},bubbles:!0})),r("change",i)}function ze(){if(!s)return;const $=document.querySelectorAll('[for="'+s+'"]');for(let Z of $)Z.removeEventListener("click",Y)}function Ue(){if(!s)return;ze();const $=document.querySelectorAll('[for="'+s+'"]');for(let Z of $)Z.addEventListener("click",Y)}function Ee(){switch(c){case"html":return Pi();case"json":return bi();case"sql-create-index":return xO({dialect:B.define({keywords:"create unique index if not exists on collate asc desc where like isnull notnull date time datetime unixepoch strftime lower upper substr case when then iif if else json_extract json_each json_tree json_array_length json_valid ",operatorChars:"*+-%<>!=&|/~",identifierQuotes:'`"',specialVar:"@:?$"}),upperCaseKeywords:!0});case"sql-select":let $={};for(let Z of t)$[Z.name]=Vt.getAllCollectionIdentifiers(Z);return xO({dialect:B.define({keywords:"select distinct from where having group by order limit offset join left right inner with like not in match asc desc regexp isnull notnull glob count avg sum min max current random cast as int real text bool date time datetime unixepoch strftime coalesce lower upper substr case when then iif if else json_extract json_each json_tree json_array_length json_valid ",operatorChars:"*+-%<>!=&|/~",identifierQuotes:'`"',specialVar:"@:?$"}),schema:$,upperCaseKeywords:!0});default:return nt()}}Rt(()=>{const $={key:"Enter",run:Z=>{u&&r("submit",i)}};return Ue(),a(10,p=new q({parent:f,state:z.create({doc:i,extensions:[Jt(),Lt(),Kt(),Ft(),Mt(),z.allowMultipleSelections.of(!0),Ht(ea,{fallback:!0}),Oa(),ta(),aa(),ra(),ia.of([$,...sa,...na,oa.find(Z=>Z.key==="Mod-d"),...la,...ca]),q.lineWrapping,Qa({icons:!1}),P.of(Ee()),y.of(Be(d)),S.of(q.editable.of(!0)),X.of(z.readOnly.of(!1)),z.transactionFilter.of(Z=>{var Ae,Ie,Ne;if(u&&Z.newDoc.lines>1){if(!((Ne=(Ie=(Ae=Z.changes)==null?void 0:Ae.inserted)==null?void 0:Ie.filter(kt=>!!kt.text.find(Xt=>Xt)))!=null&&Ne.length))return[];Z.newDoc.text=[Z.newDoc.text.join(" ")]}return Z}),q.updateListener.of(Z=>{!Z.docChanged||Q||(a(3,i=Z.state.doc.toString()),gt())})]})})),()=>{ze(),p==null||p.destroy()}});function bt($){Gt[$?"unshift":"push"](()=>{f=$,a(2,f)})}return O.$$set=$=>{"id"in $&&a(4,s=$.id),"value"in $&&a(3,i=$.value),"minHeight"in $&&a(0,n=$.minHeight),"maxHeight"in $&&a(1,l=$.maxHeight),"disabled"in $&&a(5,Q=$.disabled),"placeholder"in $&&a(6,d=$.placeholder),"language"in $&&a(7,c=$.language),"singleLine"in $&&a(8,u=$.singleLine)},O.$$.update=()=>{O.$$.dirty&16&&s&&Ue(),O.$$.dirty&1152&&p&&c&&p.dispatch({effects:[P.reconfigure(Ee())]}),O.$$.dirty&1056&&p&&typeof Q<"u"&&p.dispatch({effects:[S.reconfigure(q.editable.of(!Q)),X.reconfigure(z.readOnly.of(Q))]}),O.$$.dirty&1032&&p&&i!=p.state.doc.toString()&&p.dispatch({changes:{from:0,to:p.state.doc.length,insert:i}}),O.$$.dirty&1088&&p&&typeof d<"u"&&p.dispatch({effects:[y.reconfigure(Be(d))]})},[n,l,f,i,s,Q,d,c,u,Y,p,bt]}class hs extends wt{constructor(e){super(),yt(this,e,Qs,cs,xt,{id:4,value:3,minHeight:0,maxHeight:1,disabled:5,placeholder:6,language:7,singleLine:8,focus:9})}get focus(){return this.$$.ctx[9]}}export{hs as default}; diff --git a/ui/dist/assets/CodeEditor-rvo5l1QW.js b/ui/dist/assets/CodeEditor-rvo5l1QW.js new file mode 100644 index 00000000..7cc17610 --- /dev/null +++ b/ui/dist/assets/CodeEditor-rvo5l1QW.js @@ -0,0 +1,14 @@ +import{S as wt,i as yt,s as xt,e as Yt,f as Wt,U as H,g as Tt,x as De,o as jt,J as vt,K as qt,L as _t,I as Rt,C as Vt,M as Gt}from"./index-z3vRI80T.js";import{P as Ct,N as zt,w as Ut,D as Et,x as je,T as Oe,I as ve,y as J,z as o,A as At,L,B as K,F as _,G as F,H as qe,J as M,v as C,K as YO,M as WO,O as TO,E as q,Q as jO,R as m,U as It,V as Nt,W as vO,X as Dt,Y as Bt,a as z,h as Jt,b as Lt,c as Kt,d as Ft,e as Mt,s as Ht,u as ea,f as Oa,g as ta,r as aa,i as ra,k as ia,j as sa,l as na,m as oa,n as la,o as ca,q as Qa,t as Be,C as ee}from"./index-8bZ4r7AC.js";var Je={};class ie{constructor(e,a,t,r,s,i,n,l,Q,d=0,c){this.p=e,this.stack=a,this.state=t,this.reducePos=r,this.pos=s,this.score=i,this.buffer=n,this.bufferBase=l,this.curContext=Q,this.lookAhead=d,this.parent=c}toString(){return`[${this.stack.filter((e,a)=>a%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,a,t=0){let r=e.parser.context;return new ie(e,[],a,t,t,0,[],0,r?new Le(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,a){this.stack.push(this.state,a,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var a;let t=e>>19,r=e&65535,{parser:s}=this.p,i=s.dynamicPrecedence(r);if(i&&(this.score+=i),t==0){this.pushState(s.getGoto(this.state,r,!0),this.reducePos),r=2e3&&!(!((a=this.p.parser.nodeSet.types[r])===null||a===void 0)&&a.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=Q):this.p.lastBigReductionSizen;)this.stack.pop();this.reduceContext(r,l)}storeNode(e,a,t,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&i.buffer[n-4]==0&&i.buffer[n-1]>-1){if(a==t)return;if(i.buffer[n-2]>=a){i.buffer[n-2]=t;return}}}if(!s||this.pos==t)this.buffer.push(e,a,t,r);else{let i=this.buffer.length;if(i>0&&this.buffer[i-4]!=0)for(;i>0&&this.buffer[i-2]>t;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4);this.buffer[i]=e,this.buffer[i+1]=a,this.buffer[i+2]=t,this.buffer[i+3]=r}}shift(e,a,t,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(a,t),a<=this.p.parser.maxNode&&this.buffer.push(a,t,r,4);else{let s=e,{parser:i}=this.p;(r>this.pos||a<=i.maxNode)&&(this.pos=r,i.stateFlag(s,1)||(this.reducePos=r)),this.pushState(s,t),this.shiftContext(a,t),a<=i.maxNode&&this.buffer.push(a,t,r,4)}}apply(e,a,t,r){e&65536?this.reduce(e):this.shift(e,a,t,r)}useNode(e,a){let t=this.p.reused.length-1;(t<0||this.p.reused[t]!=e)&&(this.p.reused.push(e),t++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(a,r),this.buffer.push(t,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,a=e.buffer.length;for(;a>0&&e.buffer[a-2]>e.reducePos;)a-=4;let t=e.buffer.slice(a),r=e.bufferBase+a;for(;e&&r==e.bufferBase;)e=e.parent;return new ie(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,t,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,a){let t=e<=this.p.parser.maxNode;t&&this.storeNode(e,this.pos,a,4),this.storeNode(0,this.pos,a,t?8:4),this.pos=this.reducePos=a,this.score-=190}canShift(e){for(let a=new pa(this);;){let t=this.p.parser.stateSlot(a.state,4)||this.p.parser.hasAction(a.state,e);if(t==0)return!1;if(!(t&65536))return!0;a.reduce(t)}}recoverByInsert(e){if(this.stack.length>=300)return[];let a=this.p.parser.nextStates(this.state);if(a.length>8||this.stack.length>=120){let r=[];for(let s=0,i;sl&1&&n==i)||r.push(a[s],i)}a=r}let t=[];for(let r=0;r>19,r=a&65535,s=this.stack.length-t*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let i=this.findForcedReduction();if(i==null)return!1;a=i}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(a),!0}findForcedReduction(){let{parser:e}=this.p,a=[],t=(r,s)=>{if(!a.includes(r))return a.push(r),e.allActions(r,i=>{if(!(i&393216))if(i&65536){let n=(i>>19)-s;if(n>1){let l=i&65535,Q=this.stack.length-n*3;if(Q>=0&&e.getGoto(this.stack[Q],l,!1)>=0)return n<<19|65536|l}}else{let n=t(i,s+1);if(n!=null)return n}})};return t(this.state,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:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let a=0;athis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Le{constructor(e,a){this.tracker=e,this.context=a,this.hash=e.strict?e.hash(a):0}}class pa{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let a=e&65535,t=e>>19;t==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(t-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],a,!0);this.state=r}}class se{constructor(e,a,t){this.stack=e,this.pos=a,this.index=t,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,a=e.bufferBase+e.buffer.length){return new se(e,a,a-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.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 se(this.stack,this.pos,this.index)}}function I(O,e=Uint16Array){if(typeof O!="string")return O;let a=null;for(let t=0,r=0;t=92&&i--,i>=34&&i--;let l=i-32;if(l>=46&&(l-=46,n=!0),s+=l,n)break;s*=46}a?a[r++]=s:a=new e(s)}return a}class te{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Ke=new te;class da{constructor(e,a){this.input=e,this.ranges=a,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Ke,this.rangeIndex=0,this.pos=this.chunkPos=a[0].from,this.range=a[0],this.end=a[a.length-1].to,this.readNext()}resolveOffset(e,a){let t=this.range,r=this.rangeIndex,s=this.pos+e;for(;st.to:s>=t.to;){if(r==this.ranges.length-1)return null;let i=this.ranges[++r];s+=i.from-t.to,t=i}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,a.from);return this.end}peek(e){let a=this.chunkOff+e,t,r;if(a>=0&&a=this.chunk2Pos&&tn.to&&(this.chunk2=this.chunk2.slice(0,n.to-t)),r=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),r}acceptToken(e,a=0){let t=a?this.resolveOffset(a,-1):this.pos;if(t==null||t=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,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(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,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(e,a){if(a?(this.token=a,a.start=e,a.lookAhead=e+1,a.value=a.extended=-1):this.token=Ke,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&a<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,a-this.chunkPos);if(e>=this.chunk2Pos&&a<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,a-this.chunk2Pos);if(e>=this.range.from&&a<=this.range.to)return this.input.read(e,a);let t="";for(let r of this.ranges){if(r.from>=a)break;r.to>e&&(t+=this.input.read(Math.max(r.from,e),Math.min(r.to,a)))}return t}}class R{constructor(e,a){this.data=e,this.id=a}token(e,a){let{parser:t}=a.p;qO(this.data,e,a,this.id,t.data,t.tokenPrecTable)}}R.prototype.contextual=R.prototype.fallback=R.prototype.extend=!1;class ne{constructor(e,a,t){this.precTable=a,this.elseToken=t,this.data=typeof e=="string"?I(e):e}token(e,a){let t=e.pos,r=0;for(;;){let s=e.next<0,i=e.resolveOffset(1,1);if(qO(this.data,e,a,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(t,e.token),e.acceptToken(this.elseToken,r))}}ne.prototype.contextual=R.prototype.fallback=R.prototype.extend=!1;class k{constructor(e,a={}){this.token=e,this.contextual=!!a.contextual,this.fallback=!!a.fallback,this.extend=!!a.extend}}function qO(O,e,a,t,r,s){let i=0,n=1<0){let f=O[p];if(l.allows(f)&&(e.token.value==-1||e.token.value==f||ha(f,e.token.value,r,s))){e.acceptToken(f);break}}let d=e.next,c=0,u=O[i+2];if(e.next<0&&u>c&&O[Q+u*3-3]==65535){i=O[Q+u*3-1];continue e}for(;c>1,f=Q+p+(p<<1),P=O[f],S=O[f+1]||65536;if(d=S)c=p+1;else{i=O[f+2],e.advance();continue e}}break}}function Fe(O,e,a){for(let t=e,r;(r=O[t])!=65535;t++)if(r==a)return t-e;return-1}function ha(O,e,a,t){let r=Fe(a,t,e);return r<0||Fe(a,t,O)e)&&!t.type.isError)return a<0?Math.max(0,Math.min(t.to-1,e-25)):Math.min(O.length,Math.max(t.from+1,e+25));if(a<0?t.prevSibling():t.nextSibling())break;if(!t.parent())return a<0?0:O.length}}class fa{constructor(e,a){this.fragments=e,this.nodeSet=a,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Me(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Me(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=i,null;if(s instanceof Oe){if(i==e){if(i=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(i),this.index.push(0))}else this.index[a]++,this.nextStart=i+s.length}}}class ua{constructor(e,a){this.stream=a,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(t=>new te)}getActions(e){let a=0,t=null,{parser:r}=e.p,{tokenizers:s}=r,i=r.stateSlot(e.state,3),n=e.curContext?e.curContext.hash:0,l=0;for(let Q=0;Qc.end+25&&(l=Math.max(c.lookAhead,l)),c.value!=0)){let u=a;if(c.extended>-1&&(a=this.addActions(e,c.extended,c.end,a)),a=this.addActions(e,c.value,c.end,a),!d.extend&&(t=c,a>u))break}}for(;this.actions.length>a;)this.actions.pop();return l&&e.setLookAhead(l),!t&&e.pos==this.stream.end&&(t=new te,t.value=e.p.parser.eofTerm,t.start=t.end=e.pos,a=this.addActions(e,t.value,t.end,a)),this.mainToken=t,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let a=new te,{pos:t,p:r}=e;return a.start=t,a.end=Math.min(t+1,r.stream.end),a.value=t==r.stream.end?r.parser.eofTerm:0,a}updateCachedToken(e,a,t){let r=this.stream.clipPos(t.pos);if(a.token(this.stream.reset(r,e),t),e.value>-1){let{parser:s}=t.p;for(let i=0;i=0&&t.p.parser.dialect.allows(n>>1)){n&1?e.extended=n>>1:e.value=n>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,a,t,r){for(let s=0;se.bufferLength*4?new fa(t,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,a=this.minStackPos,t=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[i]=e;for(;i.forceReduce()&&i.stack.length&&i.stack[i.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let i=0;ia)t.push(n);else{if(this.advanceStack(n,t,e))continue;{r||(r=[],s=[]),r.push(n);let l=this.tokens.getMainToken(n);s.push(l.value,l.end)}}break}}if(!t.length){let i=r&&Sa(r);if(i)return g&&console.log("Finish with "+this.stackID(i)),this.stackToTree(i);if(this.parser.strict)throw g&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+a);this.recovering||(this.recovering=5)}if(this.recovering&&r){let i=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,t);if(i)return g&&console.log("Force-finish "+this.stackID(i)),this.stackToTree(i.forceAll())}if(this.recovering){let i=this.recovering==1?1:this.recovering*3;if(t.length>i)for(t.sort((n,l)=>l.score-n.score);t.length>i;)t.pop();t.some(n=>n.reducePos>a)&&this.recovering--}else if(t.length>1){e:for(let i=0;i500&&Q.buffer.length>500)if((n.score-Q.score||n.buffer.length-Q.buffer.length)>0)t.splice(l--,1);else{t.splice(i--,1);continue e}}}t.length>12&&t.splice(12,t.length-12)}this.minStackPos=t[0].pos;for(let i=1;i ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let Q=e.curContext&&e.curContext.tracker.strict,d=Q?e.curContext.hash:0;for(let c=this.fragments.nodeAt(r);c;){let u=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(e.state,c.type.id):-1;if(u>-1&&c.length&&(!Q||(c.prop(je.contextHash)||0)==d))return e.useNode(c,u),g&&console.log(i+this.stackID(e)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof Oe)||c.children.length==0||c.positions[0]>0)break;let p=c.children[0];if(p instanceof Oe&&c.positions[0]==0)c=p;else break}}let n=s.stateSlot(e.state,4);if(n>0)return e.reduce(n),g&&console.log(i+this.stackID(e)+` (via always-reduce ${s.getName(n&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let Q=0;Qr?a.push(f):t.push(f)}return!1}advanceFully(e,a){let t=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>t)return He(e,a),!0}}runRecovery(e,a,t){let r=null,s=!1;for(let i=0;i ":"";if(n.deadEnd&&(s||(s=!0,n.restart(),g&&console.log(d+this.stackID(n)+" (restarted)"),this.advanceFully(n,t))))continue;let c=n.split(),u=d;for(let p=0;c.forceReduce()&&p<10&&(g&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,t));p++)g&&(u=this.stackID(c)+" -> ");for(let p of n.recoverByInsert(l))g&&console.log(d+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,t);this.stream.end>n.pos?(Q==n.pos&&(Q++,l=0),n.recoverByDelete(l,Q),g&&console.log(d+this.stackID(n)+` (via recover-delete ${this.parser.getName(l)})`),He(n,t)):(!r||r.scoreO;class _O{constructor(e){this.start=e.start,this.shift=e.shift||he,this.reduce=e.reduce||he,this.reuse=e.reuse||he,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class T extends Ct{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let a=e.nodeNames.split(" ");this.minRepeatTerm=a.length;for(let n=0;ne.topRules[n][1]),r=[];for(let n=0;n=0)s(d,l,n[Q++]);else{let c=n[Q+-d];for(let u=-d;u>0;u--)s(n[Q++],l,c);Q++}}}this.nodeSet=new zt(a.map((n,l)=>Ut.define({name:l>=this.minRepeatTerm?void 0:n,id:l,props:r[l],top:t.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Et;let i=I(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;ntypeof n=="number"?new R(i,n):n),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,a,t){let r=new $a(this,e,a,t);for(let s of this.wrappers)r=s(r,e,a,t);return r}getGoto(e,a,t=!1){let r=this.goto;if(a>=r[0])return-1;for(let s=r[a+1];;){let i=r[s++],n=i&1,l=r[s++];if(n&&t)return l;for(let Q=s+(i>>1);s0}validAction(e,a){return!!this.allActions(e,t=>t==a?!0:null)}allActions(e,a){let t=this.stateSlot(e,4),r=t?a(t):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=x(this.data,s+2);else break;r=a(x(this.data,s+1))}return r}nextStates(e){let a=[];for(let t=this.stateSlot(e,1);;t+=3){if(this.data[t]==65535)if(this.data[t+1]==1)t=x(this.data,t+2);else break;if(!(this.data[t+2]&1)){let r=this.data[t+1];a.some((s,i)=>i&1&&s==r)||a.push(this.data[t],r)}}return a}configure(e){let a=Object.assign(Object.create(T.prototype),this);if(e.props&&(a.nodeSet=this.nodeSet.extend(...e.props)),e.top){let t=this.topRules[e.top];if(!t)throw new RangeError(`Invalid top rule name ${e.top}`);a.top=t}return e.tokenizers&&(a.tokenizers=this.tokenizers.map(t=>{let r=e.tokenizers.find(s=>s.from==t);return r?r.to:t})),e.specializers&&(a.specializers=this.specializers.slice(),a.specializerSpecs=this.specializerSpecs.map((t,r)=>{let s=e.specializers.find(n=>n.from==t.external);if(!s)return t;let i=Object.assign(Object.assign({},t),{external:s.to});return a.specializers[r]=eO(i),i})),e.contextTracker&&(a.context=e.contextTracker),e.dialect&&(a.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(a.strict=e.strict),e.wrap&&(a.wrappers=a.wrappers.concat(e.wrap)),e.bufferLength!=null&&(a.bufferLength=e.bufferLength),a}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let a=this.dynamicPrecedences;return a==null?0:a[e]||0}parseDialect(e){let a=Object.keys(this.dialects),t=a.map(()=>!1);if(e)for(let s of e.split(" ")){let i=a.indexOf(s);i>=0&&(t[i]=!0)}let r=null;for(let s=0;st)&&a.p.parser.stateFlag(a.state,2)&&(!e||e.scoreO.external(a,t)<<1|e}return O.get}const Za=54,ma=1,ga=55,ba=2,ka=56,Xa=3,OO=4,wa=5,oe=6,RO=7,VO=8,GO=9,CO=10,ya=11,xa=12,Ya=13,fe=57,Wa=14,tO=58,zO=20,Ta=22,UO=23,ja=24,Xe=26,EO=27,va=28,qa=31,_a=34,Ra=36,Va=37,Ga=0,Ca=1,za={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},Ua={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},aO={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 Ea(O){return O==45||O==46||O==58||O>=65&&O<=90||O==95||O>=97&&O<=122||O>=161}function AO(O){return O==9||O==10||O==13||O==32}let rO=null,iO=null,sO=0;function we(O,e){let a=O.pos+e;if(sO==a&&iO==O)return rO;let t=O.peek(e);for(;AO(t);)t=O.peek(++e);let r="";for(;Ea(t);)r+=String.fromCharCode(t),t=O.peek(++e);return iO=O,sO=a,rO=r?r.toLowerCase():t==Aa||t==Ia?void 0:null}const IO=60,le=62,_e=47,Aa=63,Ia=33,Na=45;function nO(O,e){this.name=O,this.parent=e,this.hash=e?e.hash:0;for(let a=0;a-1?new nO(we(t,1)||"",O):O},reduce(O,e){return e==zO&&O?O.parent:O},reuse(O,e,a,t){let r=e.type.id;return r==oe||r==Ra?new nO(we(t,1)||"",O):O},hash(O){return O?O.hash:0},strict:!1}),Ja=new k((O,e)=>{if(O.next!=IO){O.next<0&&e.context&&O.acceptToken(fe);return}O.advance();let a=O.next==_e;a&&O.advance();let t=we(O,0);if(t===void 0)return;if(!t)return O.acceptToken(a?Wa:oe);let r=e.context?e.context.name:null;if(a){if(t==r)return O.acceptToken(ya);if(r&&Ua[r])return O.acceptToken(fe,-2);if(e.dialectEnabled(Ga))return O.acceptToken(xa);for(let s=e.context;s;s=s.parent)if(s.name==t)return;O.acceptToken(Ya)}else{if(t=="script")return O.acceptToken(RO);if(t=="style")return O.acceptToken(VO);if(t=="textarea")return O.acceptToken(GO);if(za.hasOwnProperty(t))return O.acceptToken(CO);r&&aO[r]&&aO[r][t]?O.acceptToken(fe,-1):O.acceptToken(oe)}},{contextual:!0}),La=new k(O=>{for(let e=0,a=0;;a++){if(O.next<0){a&&O.acceptToken(tO);break}if(O.next==Na)e++;else if(O.next==le&&e>=2){a>=3&&O.acceptToken(tO,-2);break}else e=0;O.advance()}});function Ka(O){for(;O;O=O.parent)if(O.name=="svg"||O.name=="math")return!0;return!1}const Fa=new k((O,e)=>{if(O.next==_e&&O.peek(1)==le){let a=e.dialectEnabled(Ca)||Ka(e.context);O.acceptToken(a?wa:OO,2)}else O.next==le&&O.acceptToken(OO,1)});function Re(O,e,a){let t=2+O.length;return new k(r=>{for(let s=0,i=0,n=0;;n++){if(r.next<0){n&&r.acceptToken(e);break}if(s==0&&r.next==IO||s==1&&r.next==_e||s>=2&&si?r.acceptToken(e,-i):r.acceptToken(a,-(i-2));break}else if((r.next==10||r.next==13)&&n){r.acceptToken(e,1);break}else s=i=0;r.advance()}})}const Ma=Re("script",Za,ma),Ha=Re("style",ga,ba),er=Re("textarea",ka,Xa),Or=J({"Text RawText":o.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":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}),tr=T.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1G/YOOOa-E7[-E7[O)RQ#tO'#CyOOO`1G.v1G.vOOOb-E7]-E7]O)WQ#tO'#C|OOOd-E7^-E7^O)]Q#tO'#DPOOO`-E7_-E7_O)bQ#|O,59mOOOp-E7`-E7`OOO`1G/Z1G/ZOOO`1G/]1G/]OOO`1G/^1G/^O)gQ,UO,59_OOQW-E7X-E7XOOOa7+$c7+$cOOOb7+$l7+$lOOOd7+$o7+$oOOO`7+$r7+$rOOO`7+$t7+$tO)rQ#|O,59eO)wQ#|O,59hO)|Q#|O,59kOOO`1G/X1G/XO*RO7[O'#CvO*dOMhO'#CvOOQW1G.y1G.yOOO`1G/P1G/POOO`1G/S1G/SOOO`1G/V1G/VOOOO'#D['#D[O*uO7[O,59bOOQW,59b,59bOOOO'#D]'#D]O+WOMhO,59bOOOO-E7Y-E7YOOQW1G.|1G.|OOOO-E7Z-E7Z",stateData:"+s~O!^OS~OUSOVPOWQOXROYTO[]O][O^^O`^Oa^Ob^Oc^Ox^O{_O!dZO~OfaO~OfbO~OfcO~OfdO~OfeO~O!WfOPlP!ZlP~O!XiOQoP!ZoP~O!YlORrP!ZrP~OUSOVPOWQOXROYTOZqO[]O][O^^O`^Oa^Ob^Oc^Ox^O!dZO~O!ZrO~P#dO![sO!euO~OfvO~OfwO~OS|OhyO~OS!OOhyO~OS!QOhyO~OS!SOT!TOhyO~OS!TOhyO~O!WfOPlX!ZlX~OP!WO!Z!XO~O!XiOQoX!ZoX~OQ!ZO!Z!XO~O!YlORrX!ZrX~OR!]O!Z!XO~O!Z!XO~P#dOf!_O~O![sO!e!aO~OS!bO~OS!cO~Oi!dOSgXhgXTgX~OS!fOhyO~OS!gOhyO~OS!hOhyO~OS!iOT!jOhyO~OS!jOhyO~Of!kO~Of!lO~Of!mO~OS!nO~Ok!qO!`!oO!b!pO~OS!rO~OS!sO~OS!tO~Oa!uOb!uOc!uO!`!wO!a!uO~Oa!xOb!xOc!xO!b!wO!c!xO~Oa!uOb!uOc!uO!`!{O!a!uO~Oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:Ba,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"],["isolate",-11,21,29,30,32,33,35,36,37,38,41,42,"ltr",-3,26,27,39,""]],propSources:[Or],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zbkWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOa!R!R7tP;=`<%l7S!Z8OYkWa!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{ihSkWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbhSkWa!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXhSa!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhhSkWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TakWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOb!R!RAwP;=`<%lAY!ZBRYkWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhhSkWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbhSkWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbhSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXhSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!bx`P!a`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYlhS`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_khS`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_X`P!a`!cp!eQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZhSfQ`PkW!a`!cpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!a`!cpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!a`!cpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!a`!cpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!a`!cp!dPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!a`!cpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!a`!cpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!a`!cpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!a`!cpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!a`!cpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!a`!cpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!a`!cpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!cpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO{PP!-nP;=`<%l!-Sq!-xS!cp{POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!a`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!a`{POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!a`!cp{POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!a`!cpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!a`!cpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!a`!cpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!a`!cpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!a`!cpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!a`!cpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!cpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOxPP!7TP;=`<%l!6Vq!7]V!cpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!cpxPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!a`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!a`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!a`xPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!a`!cpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let Q=n.type.id;if(Q==va)return ue(n,l,a);if(Q==qa)return ue(n,l,t);if(Q==_a)return ue(n,l,r);if(Q==zO&&s.length){let d=n.node,c=d.firstChild,u=c&&oO(c,l),p;if(u){for(let f of s)if(f.tag==u&&(!f.attrs||f.attrs(p||(p=NO(d,l))))){let P=d.lastChild,S=P.type.id==Va?P.from:d.to;if(S>c.to)return{parser:f.parser,overlay:[{from:c.to,to:S}]}}}}if(i&&Q==UO){let d=n.node,c;if(c=d.firstChild){let u=i[l.read(c.from,c.to)];if(u)for(let p of u){if(p.tagName&&p.tagName!=oO(d.parent,l))continue;let f=d.lastChild;if(f.type.id==Xe){let P=f.from+1,S=f.lastChild,X=f.to-(S&&S.isError?0:1);if(X>P)return{parser:p.parser,overlay:[{from:P,to:X}]}}else if(f.type.id==EO)return{parser:p.parser,overlay:[{from:f.from,to:f.to}]}}}}return null})}const ar=99,lO=1,rr=100,ir=101,cO=2,BO=[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],sr=58,nr=40,JO=95,or=91,ae=45,lr=46,cr=35,Qr=37,pr=38,dr=92,hr=10;function N(O){return O>=65&&O<=90||O>=97&&O<=122||O>=161}function fr(O){return O>=48&&O<=57}const ur=new k((O,e)=>{for(let a=!1,t=0,r=0;;r++){let{next:s}=O;if(N(s)||s==ae||s==JO||a&&fr(s))!a&&(s!=ae||r>0)&&(a=!0),t===r&&s==ae&&t++,O.advance();else if(s==dr&&O.peek(1)!=hr)O.advance(),O.next>-1&&O.advance(),a=!0;else{a&&O.acceptToken(s==nr?rr:t==2&&e.canShift(cO)?cO:ir);break}}}),$r=new k(O=>{if(BO.includes(O.peek(-1))){let{next:e}=O;(N(e)||e==JO||e==cr||e==lr||e==or||e==sr&&N(O.peek(1))||e==ae||e==pr)&&O.acceptToken(ar)}}),Pr=new k(O=>{if(!BO.includes(O.peek(-1))){let{next:e}=O;if(e==Qr&&(O.advance(),O.acceptToken(lO)),N(e)){do O.advance();while(N(O.next));O.acceptToken(lO)}}}),Sr=J({"AtKeyword import charset namespace keyframes media supports":o.definitionKeyword,"from to selector":o.keyword,NamespaceName:o.namespace,KeyframeName:o.labelName,KeyframeRangeName:o.operatorKeyword,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,ColorLiteral:o.color,"ParenthesizedContent StringLiteral":o.string,":":o.punctuation,"PseudoOp #":o.derefOperator,"; ,":o.separator,"( )":o.paren,"[ ]":o.squareBracket,"{ }":o.brace}),Zr={__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:138},mr={__proto__:null,"@import":118,"@media":142,"@charset":146,"@namespace":150,"@keyframes":156,"@supports":168},gr={__proto__:null,not:132,only:132},br=T.deserialize({version:14,states:":^QYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DTO$vQ[O'#DWOOQP'#Em'#EmO${QdO'#DgO%jQ[O'#DtO${QdO'#DvO%{Q[O'#DxO&WQ[O'#D{O&`Q[O'#ERO&nQ[O'#ETOOQS'#El'#ElOOQS'#EW'#EWQYQ[OOO&uQXO'#CdO'jQWO'#DcO'oQWO'#EsO'zQ[O'#EsQOQWOOP(UO#tO'#C_POOO)C@[)C@[OOQP'#Cg'#CgOOQP,59Q,59QO#kQ[O,59QO(aQ[O'#E[O({QWO,58{O)TQ[O,59SO$qQ[O,59oO$vQ[O,59rO(aQ[O,59uO(aQ[O,59wO(aQ[O,59xO)`Q[O'#DbOOQS,58{,58{OOQP'#Ck'#CkOOQO'#DR'#DROOQP,59S,59SO)gQWO,59SO)lQWO,59SOOQP'#DV'#DVOOQP,59o,59oOOQO'#DX'#DXO)qQ`O,59rOOQS'#Cp'#CpO${QdO'#CqO)yQvO'#CsO+ZQtO,5:ROOQO'#Cx'#CxO)lQWO'#CwO+oQWO'#CyO+tQ[O'#DOOOQS'#Ep'#EpOOQO'#Dj'#DjO+|Q[O'#DqO,[QWO'#EtO&`Q[O'#DoO,jQWO'#DrOOQO'#Eu'#EuO)OQWO,5:`O,oQpO,5:bOOQS'#Dz'#DzO,wQWO,5:dO,|Q[O,5:dOOQO'#D}'#D}O-UQWO,5:gO-ZQWO,5:mO-cQWO,5:oOOQS-E8U-E8UO${QdO,59}O-kQ[O'#E^O-xQWO,5;_O-xQWO,5;_POOO'#EV'#EVP.TO#tO,58yPOOO,58y,58yOOQP1G.l1G.lO.zQXO,5:vOOQO-E8Y-E8YOOQS1G.g1G.gOOQP1G.n1G.nO)gQWO1G.nO)lQWO1G.nOOQP1G/Z1G/ZO/XQ`O1G/^O/rQXO1G/aO0YQXO1G/cO0pQXO1G/dO1WQWO,59|O1]Q[O'#DSO1dQdO'#CoOOQP1G/^1G/^O${QdO1G/^O1kQpO,59]OOQS,59_,59_O${QdO,59aO1sQWO1G/mOOQS,59c,59cO1xQ!bO,59eOOQS'#DP'#DPOOQS'#EY'#EYO2QQ[O,59jOOQS,59j,59jO2YQWO'#DjO2eQWO,5:VO2jQWO,5:]O&`Q[O,5:XO&`Q[O'#E_O2rQWO,5;`O2}QWO,5:ZO(aQ[O,5:^OOQS1G/z1G/zOOQS1G/|1G/|OOQS1G0O1G0OO3`QWO1G0OO3eQdO'#EOOOQS1G0R1G0ROOQS1G0X1G0XOOQS1G0Z1G0ZO3pQtO1G/iOOQO,5:x,5:xO4WQ[O,5:xOOQO-E8[-E8[O4eQWO1G0yPOOO-E8T-E8TPOOO1G.e1G.eOOQP7+$Y7+$YOOQP7+$x7+$xO${QdO7+$xOOQS1G/h1G/hO4pQXO'#ErO4wQWO,59nO4|QtO'#EXO5tQdO'#EoO6OQWO,59ZO6TQpO7+$xOOQS1G.w1G.wOOQS1G.{1G.{OOQS7+%X7+%XO6]QWO1G/POOQS-E8W-E8WOOQS1G/U1G/UO${QdO1G/qOOQO1G/w1G/wOOQO1G/s1G/sO6bQWO,5:yOOQO-E8]-E8]O6pQXO1G/xOOQS7+%j7+%jO6wQYO'#CsOOQO'#EQ'#EQO7SQ`O'#EPOOQO'#EP'#EPO7_QWO'#E`O7gQdO,5:jOOQS,5:j,5:jO7rQtO'#E]O${QdO'#E]O8sQdO7+%TOOQO7+%T7+%TOOQO1G0d1G0dO9WQpO<OAN>OO:xQdO,5:uOOQO-E8X-E8XOOQO<T![;'S%^;'S;=`%o<%lO%^l;TUo`Oy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^l;nYo`#e[Oy%^z!Q%^!Q![;g![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^l[[o`#e[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^n?VSt^Oy%^z;'S%^;'S;=`%o<%lO%^l?hWjWOy%^z!O%^!O!P;O!P!Q%^!Q![>T![;'S%^;'S;=`%o<%lO%^n@VU#bQOy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^~@nTjWOy%^z{@}{;'S%^;'S;=`%o<%lO%^~AUSo`#[~Oy%^z;'S%^;'S;=`%o<%lO%^lAg[#e[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^bBbU]QOy%^z![%^![!]Bt!];'S%^;'S;=`%o<%lO%^bB{S^Qo`Oy%^z;'S%^;'S;=`%o<%lO%^nC^S!Y^Oy%^z;'S%^;'S;=`%o<%lO%^dCoS|SOy%^z;'S%^;'S;=`%o<%lO%^bDQU!OQOy%^z!`%^!`!aDd!a;'S%^;'S;=`%o<%lO%^bDkS!OQo`Oy%^z;'S%^;'S;=`%o<%lO%^bDzWOy%^z!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bEk[![Qo`Oy%^z}%^}!OEd!O!Q%^!Q![Ed![!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^nFfSq^Oy%^z;'S%^;'S;=`%o<%lO%^nFwSp^Oy%^z;'S%^;'S;=`%o<%lO%^bGWUOy%^z#b%^#b#cGj#c;'S%^;'S;=`%o<%lO%^bGoUo`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!bQo`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!TUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!S^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!RQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}",tokenizers:[$r,Pr,ur,1,2,3,4,new ne("m~RRYZ[z{a~~g~aO#^~~dP!P!Qg~lO#_~~",28,105)],topRules:{StyleSheet:[0,4],Styles:[1,86]},specialized:[{term:100,get:O=>Zr[O]||-1},{term:58,get:O=>mr[O]||-1},{term:101,get:O=>gr[O]||-1}],tokenPrec:1200});let $e=null;function Pe(){if(!$e&&typeof document=="object"&&document.body){let{style:O}=document.body,e=[],a=new Set;for(let t in O)t!="cssText"&&t!="cssFloat"&&typeof O[t]=="string"&&(/[A-Z]/.test(t)&&(t=t.replace(/[A-Z]/g,r=>"-"+r.toLowerCase())),a.has(t)||(e.push(t),a.add(t)));$e=e.sort().map(t=>({type:"property",label:t}))}return $e||[]}const QO=["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(O=>({type:"class",label:O})),pO=["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(O=>({type:"keyword",label:O})).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(O=>({type:"constant",label:O}))),kr=["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(O=>({type:"type",label:O})),W=/^(\w[\w-]*|-\w[\w-]*|)$/,Xr=/^-(-[\w-]*)?$/;function wr(O,e){var a;if((O.name=="("||O.type.isError)&&(O=O.parent||O),O.name!="ArgList")return!1;let t=(a=O.parent)===null||a===void 0?void 0:a.firstChild;return(t==null?void 0:t.name)!="Callee"?!1:e.sliceString(t.from,t.to)=="var"}const dO=new YO,yr=["Declaration"];function xr(O){for(let e=O;;){if(e.type.isTop)return e;if(!(e=e.parent))return O}}function LO(O,e,a){if(e.to-e.from>4096){let t=dO.get(e);if(t)return t;let r=[],s=new Set,i=e.cursor(ve.IncludeAnonymous);if(i.firstChild())do for(let n of LO(O,i.node,a))s.has(n.label)||(s.add(n.label),r.push(n));while(i.nextSibling());return dO.set(e,r),r}else{let t=[],r=new Set;return e.cursor().iterate(s=>{var i;if(a(s)&&s.matchContext(yr)&&((i=s.node.nextSibling)===null||i===void 0?void 0:i.name)==":"){let n=O.sliceString(s.from,s.to);r.has(n)||(r.add(n),t.push({label:n,type:"variable"}))}}),t}}const Yr=O=>e=>{let{state:a,pos:t}=e,r=C(a).resolveInner(t,-1),s=r.type.isError&&r.from==r.to-1&&a.doc.sliceString(r.from,r.to)=="-";if(r.name=="PropertyName"||(s||r.name=="TagName")&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:Pe(),validFor:W};if(r.name=="ValueName")return{from:r.from,options:pO,validFor:W};if(r.name=="PseudoClassName")return{from:r.from,options:QO,validFor:W};if(O(r)||(e.explicit||s)&&wr(r,a.doc))return{from:O(r)||s?r.from:t,options:LO(a.doc,xr(r),O),validFor:Xr};if(r.name=="TagName"){for(let{parent:l}=r;l;l=l.parent)if(l.name=="Block")return{from:r.from,options:Pe(),validFor:W};return{from:r.from,options:kr,validFor:W}}if(!e.explicit)return null;let i=r.resolve(t),n=i.childBefore(t);return n&&n.name==":"&&i.name=="PseudoClassSelector"?{from:t,options:QO,validFor:W}:n&&n.name==":"&&i.name=="Declaration"||i.name=="ArgList"?{from:t,options:pO,validFor:W}:i.name=="Block"||i.name=="Styles"?{from:t,options:Pe(),validFor:W}:null},Wr=Yr(O=>O.name=="VariableName"),ce=L.define({name:"css",parser:br.configure({props:[K.add({Declaration:_()}),F.add({"Block KeyframeList":qe})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Tr(){return new M(ce,ce.data.of({autocomplete:Wr}))}const jr=309,hO=1,vr=2,qr=3,_r=310,Rr=312,Vr=313,Gr=4,Cr=5,zr=0,ye=[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],KO=125,Ur=59,xe=47,Er=42,Ar=43,Ir=45,Nr=60,Dr=44,Br=new _O({start:!1,shift(O,e){return e==Gr||e==Cr||e==Rr?O:e==Vr},strict:!1}),Jr=new k((O,e)=>{let{next:a}=O;(a==KO||a==-1||e.context)&&O.acceptToken(_r)},{contextual:!0,fallback:!0}),Lr=new k((O,e)=>{let{next:a}=O,t;ye.indexOf(a)>-1||a==xe&&((t=O.peek(1))==xe||t==Er)||a!=KO&&a!=Ur&&a!=-1&&!e.context&&O.acceptToken(jr)},{contextual:!0}),Kr=new k((O,e)=>{let{next:a}=O;if((a==Ar||a==Ir)&&(O.advance(),a==O.next)){O.advance();let t=!e.context&&e.canShift(hO);O.acceptToken(t?hO:vr)}},{contextual:!0});function Se(O,e){return O>=65&&O<=90||O>=97&&O<=122||O==95||O>=192||!e&&O>=48&&O<=57}const Fr=new k((O,e)=>{if(O.next!=Nr||!e.dialectEnabled(zr)||(O.advance(),O.next==xe))return;let a=0;for(;ye.indexOf(O.next)>-1;)O.advance(),a++;if(Se(O.next,!0)){for(O.advance(),a++;Se(O.next,!1);)O.advance(),a++;for(;ye.indexOf(O.next)>-1;)O.advance(),a++;if(O.next==Dr)return;for(let t=0;;t++){if(t==7){if(!Se(O.next,!0))return;break}if(O.next!="extends".charCodeAt(t))break;O.advance(),a++}}O.acceptToken(qr,-a)}),Mr=J({"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 using 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 Hashbang":o.lineComment,BlockComment:o.blockComment,Number:o.number,String:o.string,Escape:o.escape,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,"@":o.meta,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,"JSXBuiltin/JSXIdentifier":o.standard(o.tagName)}),Hr={__proto__:null,export:18,as:23,from:31,default:34,async:39,function:40,extends:52,this:56,true:64,false:64,null:76,void:80,typeof:84,super:102,new:136,delete:152,yield:161,await:165,class:170,public:227,private:227,protected:227,readonly:229,instanceof:248,satisfies:251,in:252,const:254,import:286,keyof:339,unique:343,infer:349,is:385,abstract:405,implements:407,type:409,let:412,var:414,using:417,interface:423,enum:427,namespace:433,module:435,declare:439,global:443,for:462,of:471,while:474,with:478,do:482,if:486,else:488,switch:492,case:498,try:504,catch:508,finally:512,return:516,throw:520,break:524,continue:528,debugger:532},ei={__proto__:null,async:123,get:125,set:127,declare:187,public:189,private:189,protected:189,static:191,abstract:193,override:195,readonly:201,accessor:203,new:389},Oi={__proto__:null,"<":143},ti=T.deserialize({version:14,states:"$RQWO'#CdO>cQWO'#H[O>kQWO'#HbO>kQWO'#HdO`Q^O'#HfO>kQWO'#HhO>kQWO'#HkO>pQWO'#HqO>uQ07iO'#HwO%[Q^O'#HyO?QQ07iO'#H{O?]Q07iO'#H}O9kQ07hO'#IPO?hQ08SO'#ChO@jQ`O'#DiQOQWOOO%[Q^O'#EPOAQQWO'#ESO:RQ7[O'#EjOA]QWO'#EjOAhQpO'#FbOOQU'#Cf'#CfOOQ07`'#Dn'#DnOOQ07`'#Jm'#JmO%[Q^O'#JmOOQO'#Jq'#JqOOQO'#Ib'#IbOBhQ`O'#EcOOQ07`'#Eb'#EbOCdQ07pO'#EcOCnQ`O'#EVOOQO'#Jp'#JpODSQ`O'#JqOEaQ`O'#EVOCnQ`O'#EcPEnO!0LbO'#CaPOOO)CDu)CDuOOOO'#IX'#IXOEyO!bO,59TOOQ07b,59T,59TOOOO'#IY'#IYOFXO#tO,59TO%[Q^O'#D`OOOO'#I['#I[OFgO?MpO,59xOOQ07b,59x,59xOFuQ^O'#I]OGYQWO'#JkOI[QrO'#JkO+}Q^O'#JkOIcQWO,5:OOIyQWO'#ElOJWQWO'#JyOJcQWO'#JxOJcQWO'#JxOJkQWO,5;YOJpQWO'#JwOOQ07f,5:Z,5:ZOJwQ^O,5:ZOLxQ08SO,5:eOMiQWO,5:mONSQ07hO'#JvONZQWO'#JuO9ZQWO'#JuONoQWO'#JuONwQWO,5;XON|QWO'#JuO!#UQrO'#JjOOQ07b'#Ch'#ChO%[Q^O'#ERO!#tQpO,5:rOOQO'#Jr'#JrOOQO-EmOOQU'#J`'#J`OOQU,5>n,5>nOOQU-EpQWO'#HQO9aQWO'#HSO!CgQWO'#HSO:RQ7[O'#HUO!ClQWO'#HUOOQU,5=j,5=jO!CqQWO'#HVO!DSQWO'#CnO!DXQWO,59OO!DcQWO,59OO!FhQ^O,59OOOQU,59O,59OO!FxQ07hO,59OO%[Q^O,59OO!ITQ^O'#H^OOQU'#H_'#H_OOQU'#H`'#H`O`Q^O,5=vO!IkQWO,5=vO`Q^O,5=|O`Q^O,5>OO!IpQWO,5>QO`Q^O,5>SO!IuQWO,5>VO!IzQ^O,5>]OOQU,5>c,5>cO%[Q^O,5>cO9kQ07hO,5>eOOQU,5>g,5>gO!NUQWO,5>gOOQU,5>i,5>iO!NUQWO,5>iOOQU,5>k,5>kO!NZQ`O'#D[O%[Q^O'#JmO!NxQ`O'#JmO# gQ`O'#DjO# xQ`O'#DjO#$ZQ^O'#DjO#$bQWO'#JlO#$jQWO,5:TO#$oQWO'#EpO#$}QWO'#JzO#%VQWO,5;ZO#%[Q`O'#DjO#%iQ`O'#EUOOQ07b,5:n,5:nO%[Q^O,5:nO#%pQWO,5:nO>pQWO,5;UO!@}Q`O,5;UO!AVQ7[O,5;UO:RQ7[O,5;UO#%xQWO,5@XO#%}Q$ISO,5:rOOQO-E<`-E<`O#'TQ07pO,5:}OCnQ`O,5:qO#'_Q`O,5:qOCnQ`O,5:}O!@rQ07hO,5:qOOQ07`'#Ef'#EfOOQO,5:},5:}O%[Q^O,5:}O#'lQ07hO,5:}O#'wQ07hO,5:}O!@}Q`O,5:qOOQO,5;T,5;TO#(VQ07hO,5:}POOO'#IV'#IVP#(kO!0LbO,58{POOO,58{,58{OOOO-EwO+}Q^O,5>wOOQO,5>},5>}O#)VQ^O'#I]OOQO-EjQ08SO1G0{O#>wQ08SO1G0{O#@uQ08SO1G0{O#CuQ(CYO'#ChO#EsQ(CYO1G1^O#EzQ(CYO'#JjO!,lQWO1G1dO#F[Q08SO,5?TOOQ07`-EkQWO1G3lO$2dQ^O1G3nO$6hQ^O'#HmOOQU1G3q1G3qO$6uQWO'#HsO>pQWO'#HuOOQU1G3w1G3wO$6}Q^O1G3wO9kQ07hO1G3}OOQU1G4P1G4POOQ07`'#GY'#GYO9kQ07hO1G4RO9kQ07hO1G4TO$;UQWO,5@XO!*fQ^O,5;[O9ZQWO,5;[O>pQWO,5:UO!*fQ^O,5:UO!@}Q`O,5:UO$;ZQ(CYO,5:UOOQO,5;[,5;[O$;eQ`O'#I^O$;{QWO,5@WOOQ07b1G/o1G/oO$pQWO1G0pO!@}Q`O1G0pO!AVQ7[O1G0pOOQ07`1G5s1G5sO!@rQ07hO1G0]OOQO1G0i1G0iO%[Q^O1G0iO$PQrO1G4cOOQO1G4i1G4iO%[Q^O,5>wO$>ZQWO1G5qO$>cQWO1G6OO$>kQrO1G6PO9ZQWO,5>}O$>uQ08SO1G5|O%[Q^O1G5|O$?VQ07hO1G5|O$?hQWO1G5{O$?hQWO1G5{O9ZQWO1G5{O$?pQWO,5?QO9ZQWO,5?QOOQO,5?Q,5?QO$@UQWO,5?QO$'ZQWO,5?QOOQO-EXOOQU,5>X,5>XO%[Q^O'#HnO%7dQWO'#HpOOQU,5>_,5>_O9ZQWO,5>_OOQU,5>a,5>aOOQU7+)c7+)cOOQU7+)i7+)iOOQU7+)m7+)mOOQU7+)o7+)oO%7iQ`O1G5sO%7}Q(CYO1G0vO%8XQWO1G0vOOQO1G/p1G/pO%8dQ(CYO1G/pO>pQWO1G/pO!*fQ^O'#DjOOQO,5>x,5>xOOQO-E<[-E<[OOQO,5?O,5?OOOQO-EpQWO7+&[O!@}Q`O7+&[OOQO7+%w7+%wO$=mQ08SO7+&TOOQO7+&T7+&TO%[Q^O7+&TO%8nQ07hO7+&TO!@rQ07hO7+%wO!@}Q`O7+%wO%8yQ07hO7+&TO%9XQ08SO7++hO%[Q^O7++hO%9iQWO7++gO%9iQWO7++gOOQO1G4l1G4lO9ZQWO1G4lO%9qQWO1G4lOOQO7+%|7+%|O#%sQWO<zQ08SO1G2ZO%A]Q08SO1G2mO%ChQ08SO1G2oO%EsQ7[O,5>yOOQO-E<]-E<]O%E}QrO,5>zO%[Q^O,5>zOOQO-E<^-E<^O%FXQWO1G5uOOQ07b<YOOQU,5>[,5>[O&5oQWO1G3yO9ZQWO7+&bO!*fQ^O7+&bOOQO7+%[7+%[O&5tQ(CYO1G6PO>pQWO7+%[OOQ07b<pQWO<pQWO7+)eO'&sQWO<}AN>}O%[Q^OAN?ZOOQO<qQ(CYOG26}O!*fQ^O'#DyO1PQWO'#EWO'@gQrO'#JiO!*fQ^O'#DqO'@nQ^O'#D}O'@uQrO'#ChO'C]QrO'#ChO!*fQ^O'#EPO'CmQ^O,5;VO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O,5;aO!*fQ^O'#IiO'EpQWO,5a#@O#@^#@d#Ax#BW#Cr#DQ#DW#D^#Dd#Dn#Dt#Dz#EU#Eh#EnPPPPPPPPPP#EtPPPPPPP#Fi#Ip#KP#KW#K`PPPP$!d$%Z$+r$+u$+x$,q$,t$,w$-O$-WPP$-^$-b$.Y$/X$/]$/qPP$/u$/{$0PP$0S$0W$0Z$1P$1h$2P$2T$2W$2Z$2a$2d$2h$2lR!{RoqOXst!Z#c%j&m&o&p&r,h,m1w1zY!uQ'Z-Y1[5]Q%pvQ%xyQ&P|Q&e!VS'R!e-QQ'a!iS'g!r!xS*c$|*hQ+f%yQ+s&RQ,X&_Q-W'YQ-b'bQ-j'hQ/|*jQ1f,YR;Y:g%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%j%p%}&f&i&m&o&p&r&v'O']'m'}(P(V(^(r(v(z)y+O+S,e,h,m-^-f-t-z.l.s0[0a0q1_1o1p1r1t1w1z1|2m2s3Z5Y5d5t5u5x6]7w7|8]8gS#p]:d!r)[$[$m'S)n,y,|.{2]3p5W6S9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]Q*u%ZQ+k%{Q,Z&bQ,b&jQ.c;QQ0h+^Q0l+`Q0w+lQ1n,`Q2{.[Q4v0rQ5k1gQ6i3PQ6u;RQ7h4wR8m6j&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%j%p%}&f&i&j&m&o&p&r&v'O'S']'m'}(P(V(^(r(v(z)n)y+O+S+^,e,h,m,y,|-^-f-t-z.[.l.s.{0[0a0q1_1o1p1r1t1w1z1|2]2m2s3P3Z3p5W5Y5d5t5u5x6S6]6j7w7|8]8g9W9i:c:f:g:j:k:l:m:n:o:p:q:r:s:t:u:v:w:{;Y;Z;[;^;e;f;o;p<]t!nQ!r!u!x!y'R'Y'Z'g'h'i-Q-W-Y-j1[5]5_$v$si#u#w$c$d$x${%O%Q%[%]%a)u){)}*P*R*Y*`*p*q+]+`+w+z.Z.i/Z/j/k/m0Q0S0^1R1U1^3O3x4S4[4f4n4p5c6g7T7^7y8j8w9[9n:O:W:y:z:|:};O;P;S;T;U;V;W;X;_;`;a;b;c;d;g;h;i;j;k;l;m;n;q;r < TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin 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 PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody 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 SingleExpression SingleClassItem",maxTerm:371,context:Br,nodeProps:[["isolate",-8,4,5,13,33,35,48,50,52,""],["group",-26,8,16,18,65,201,205,209,210,212,215,218,228,230,236,238,240,242,245,251,257,259,261,263,265,267,268,"Statement",-32,12,13,28,31,32,38,48,51,52,54,59,67,75,79,81,83,84,106,107,116,117,134,137,139,140,141,142,144,145,164,165,167,"Expression",-23,27,29,33,37,39,41,168,170,172,173,175,176,177,179,180,181,183,184,185,195,197,199,200,"Type",-3,87,99,105,"ClassItem"],["openedBy",22,"<",34,"InterpolationStart",53,"[",57,"{",72,"(",157,"JSXStartCloseTag"],["closedBy",23,">",36,"InterpolationEnd",47,"]",58,"}",73,")",162,"JSXEndTag"]],propSources:[Mr],skippedNodes:[0,4,5,271],repeatNodeCount:37,tokenData:"$Fj(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Ns!`!a$#_!a!b$(l!b!c$,k!c!}Er!}#O$-u#O#P$/P#P#Q$4h#Q#R$5r#R#SEr#S#T$7P#T#o$8Z#o#p$q#r#s$?}#s$f%Z$f$g+g$g#BYEr#BY#BZ$AX#BZ$ISEr$IS$I_$AX$I_$I|Er$I|$I}$Dd$I}$JO$Dd$JO$JTEr$JT$JU$AX$JU$KVEr$KV$KW$AX$KW&FUEr&FU&FV$AX&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$AX?HUOEr(n%d_$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$f&j(OpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(OpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Op(R!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$f&j(Op(R!b't(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST(P#S$f&j'u(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$f&j(Op(R!b'u(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$f&j!o$Ip(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#t$Id$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#t$Id$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/|3l_'}$(n$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$f&j(R!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$f&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$a`$f&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$a``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$a`$f&j(R!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(R!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$a`(R!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k#%|:hh$f&j(Op(R!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXVS$f&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSVSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWVS(R!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]VS$f&j(OpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWVS(OpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYVS(Op(R!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%lQ^$f&j!USOY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@Y!_!}!=y!}#O!Bw#O#P!Dj#P#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!?Ta$f&j!USO!^&c!_#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&cS!@_X!USOY!@YZ!P!@Y!P!Q!@z!Q!}!@Y!}#O!Ac#O#P!Bb#P;'S!@Y;'S;=`!Bq<%lO!@YS!APU!US#Z#[!@z#]#^!@z#a#b!@z#g#h!@z#i#j!@z#m#n!@zS!AfVOY!AcZ#O!Ac#O#P!A{#P#Q!@Y#Q;'S!Ac;'S;=`!B[<%lO!AcS!BOSOY!AcZ;'S!Ac;'S;=`!B[<%lO!AcS!B_P;=`<%l!AcS!BeSOY!@YZ;'S!@Y;'S;=`!Bq<%lO!@YS!BtP;=`<%l!@Y&n!B|[$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#O!Bw#O#P!Cr#P#Q!=y#Q#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!CwX$f&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!DgP;=`<%l!Bw&n!DoX$f&jOY!=yYZ&cZ!^!=y!^!_!@Y!_#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!E_P;=`<%l!=y(Q!Eki$f&j(R!b!USOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#Z&}#Z#[!Eb#[#]&}#]#^!Eb#^#a&}#a#b!Eb#b#g&}#g#h!Eb#h#i&}#i#j!Eb#j#m&}#m#n!Eb#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!f!GaZ(R!b!USOY!GYZw!GYwx!@Yx!P!GY!P!Q!HS!Q!}!GY!}#O!Ic#O#P!Bb#P;'S!GY;'S;=`!JZ<%lO!GY!f!HZb(R!b!USOY'}Zw'}x#O'}#P#Z'}#Z#[!HS#[#]'}#]#^!HS#^#a'}#a#b!HS#b#g'}#g#h!HS#h#i'}#i#j!HS#j#m'}#m#n!HS#n;'S'};'S;=`(f<%lO'}!f!IhX(R!bOY!IcZw!Icwx!Acx#O!Ic#O#P!A{#P#Q!GY#Q;'S!Ic;'S;=`!JT<%lO!Ic!f!JWP;=`<%l!Ic!f!J^P;=`<%l!GY(Q!Jh^$f&j(R!bOY!JaYZ&cZw!Jawx!Bwx!^!Ja!^!_!Ic!_#O!Ja#O#P!Cr#P#Q!Q#V#X%Z#X#Y!4|#Y#b%Z#b#c#Zd$f&j(Op(R!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#?tf$f&j(Op(R!bo$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c#Hr[O]||-1},{term:334,get:O=>ei[O]||-1},{term:70,get:O=>Oi[O]||-1}],tokenPrec:14638}),FO=[m("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),m("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),m("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),m("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),m("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),m(`try { + \${} +} catch (\${error}) { + \${} +}`,{label:"try",detail:"/ catch block",type:"keyword"}),m("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),m(`if (\${}) { + \${} +} else { + \${} +}`,{label:"if",detail:"/ else block",type:"keyword"}),m(`class \${name} { + constructor(\${params}) { + \${} + } +}`,{label:"class",detail:"definition",type:"keyword"}),m('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),m('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],ai=FO.concat([m("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),m("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),m("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),fO=new YO,MO=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function U(O){return(e,a)=>{let t=e.node.getChild("VariableDefinition");return t&&a(t,O),!0}}const ri=["FunctionDeclaration"],ii={FunctionDeclaration:U("function"),ClassDeclaration:U("class"),ClassExpression:()=>!0,EnumDeclaration:U("constant"),TypeAliasDeclaration:U("type"),NamespaceDeclaration:U("namespace"),VariableDefinition(O,e){O.matchContext(ri)||e(O,"variable")},TypeDefinition(O,e){e(O,"type")},__proto__:null};function HO(O,e){let a=fO.get(e);if(a)return a;let t=[],r=!0;function s(i,n){let l=O.sliceString(i.from,i.to);t.push({label:l,type:n})}return e.cursor(ve.IncludeAnonymous).iterate(i=>{if(r)r=!1;else if(i.name){let n=ii[i.name];if(n&&n(i,s)||MO.has(i.name))return!1}else if(i.to-i.from>8192){for(let n of HO(O,i.node))t.push(n);return!1}}),fO.set(e,t),t}const uO=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,et=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function si(O){let e=C(O.state).resolveInner(O.pos,-1);if(et.indexOf(e.name)>-1)return null;let a=e.name=="VariableName"||e.to-e.from<20&&uO.test(O.state.sliceDoc(e.from,e.to));if(!a&&!O.explicit)return null;let t=[];for(let r=e;r;r=r.parent)MO.has(r.name)&&(t=t.concat(HO(O.state.doc,r)));return{options:t,from:a?e.from:O.pos,validFor:uO}}const w=L.define({name:"javascript",parser:ti.configure({props:[K.add({IfStatement:_({except:/^\s*({|else\b)/}),TryStatement:_({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:It,SwitchBody:O=>{let e=O.textAfter,a=/^\s*\}/.test(e),t=/^\s*(case|default)\b/.test(e);return O.baseIndent+(a?0:t?1:2)*O.unit},Block:Nt({closing:"}"}),ArrowFunction:O=>O.baseIndent+O.unit,"TemplateString BlockComment":()=>null,"Statement Property":_({except:/^{/}),JSXElement(O){let e=/^\s*<\//.test(O.textAfter);return O.lineIndent(O.node.from)+(e?0:O.unit)},JSXEscape(O){let e=/\s*\}/.test(O.textAfter);return O.lineIndent(O.node.from)+(e?0:O.unit)},"JSXOpenTag JSXSelfClosingTag"(O){return O.column(O.node.from)+O.unit}}),F.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":qe,BlockComment(O){return{from:O.from+2,to:O.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Ot={test:O=>/^JSX/.test(O.name),facet:Dt({commentTokens:{block:{open:"{/*",close:"*/}"}}})},tt=w.configure({dialect:"ts"},"typescript"),at=w.configure({dialect:"jsx",props:[vO.add(O=>O.isTop?[Ot]:void 0)]}),rt=w.configure({dialect:"jsx ts",props:[vO.add(O=>O.isTop?[Ot]:void 0)]},"typescript");let it=O=>({label:O,type:"keyword"});const st="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(it),ni=st.concat(["declare","implements","private","protected","public"].map(it));function nt(O={}){let e=O.jsx?O.typescript?rt:at:O.typescript?tt:w,a=O.typescript?ai.concat(ni):FO.concat(st);return new M(e,[w.data.of({autocomplete:WO(et,TO(a))}),w.data.of({autocomplete:si}),O.jsx?ci:[]])}function oi(O){for(;;){if(O.name=="JSXOpenTag"||O.name=="JSXSelfClosingTag"||O.name=="JSXFragmentTag")return O;if(O.name=="JSXEscape"||!O.parent)return null;O=O.parent}}function $O(O,e,a=O.length){for(let t=e==null?void 0:e.firstChild;t;t=t.nextSibling)if(t.name=="JSXIdentifier"||t.name=="JSXBuiltin"||t.name=="JSXNamespacedName"||t.name=="JSXMemberExpression")return O.sliceString(t.from,Math.min(t.to,a));return""}const li=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),ci=q.inputHandler.of((O,e,a,t,r)=>{if((li?O.composing:O.compositionStarted)||O.state.readOnly||e!=a||t!=">"&&t!="/"||!w.isActiveAt(O.state,e,-1))return!1;let s=r(),{state:i}=s,n=i.changeByRange(l=>{var Q;let{head:d}=l,c=C(i).resolveInner(d-1,-1),u;if(c.name=="JSXStartTag"&&(c=c.parent),!(i.doc.sliceString(d-1,d)!=t||c.name=="JSXAttributeValue"&&c.to>d)){if(t==">"&&c.name=="JSXFragmentTag")return{range:l,changes:{from:d,insert:""}};if(t=="/"&&c.name=="JSXStartCloseTag"){let p=c.parent,f=p.parent;if(f&&p.from==d-2&&((u=$O(i.doc,f.firstChild,d))||((Q=f.firstChild)===null||Q===void 0?void 0:Q.name)=="JSXFragmentTag")){let P=`${u}>`;return{range:jO.cursor(d+P.length,-1),changes:{from:d,insert:P}}}}else if(t==">"){let p=oi(c);if(p&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(u=$O(i.doc,p,d)))return{range:l,changes:{from:d,insert:``}}}}return{range:l}});return n.changes.empty?!1:(O.dispatch([s,i.update(n,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),E=["_blank","_self","_top","_parent"],Ze=["ascii","utf-8","utf-16","latin1","latin1"],me=["get","post","put","delete"],ge=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],b=["true","false"],h={},Qi={a:{attrs:{href:null,ping:null,type:null,media:null,target:E,hreflang:null}},abbr:h,address:h,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:h,aside:h,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:h,base:{attrs:{href:null,target:E}},bdi:h,bdo:h,blockquote:{attrs:{cite:null}},body:h,br:h,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:ge,formmethod:me,formnovalidate:["novalidate"],formtarget:E,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:h,center:h,cite:h,code:h,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:h,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:h,div:h,dl:h,dt:h,em:h,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:h,figure:h,footer:h,form:{attrs:{action:null,name:null,"accept-charset":Ze,autocomplete:["on","off"],enctype:ge,method:me,novalidate:["novalidate"],target:E}},h1:h,h2:h,h3:h,h4:h,h5:h,h6:h,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:h,hgroup:h,hr:h,html:{attrs:{manifest:null}},i:h,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:ge,formmethod:me,formnovalidate:["novalidate"],formtarget:E,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:h,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:h,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:h,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Ze,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:h,noscript:h,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:h,param:{attrs:{name:null,value:null}},pre:h,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:h,rt:h,ruby:h,samp:h,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Ze}},section:h,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:h,source:{attrs:{src:null,type:null,media:null}},span:h,strong:h,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:h,summary:h,sup:h,table:h,tbody:h,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:h,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:h,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:h,time:{attrs:{datetime:null}},title:h,tr:h,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:h,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:h},ot={accesskey:null,class:null,contenteditable:b,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:b,autocorrect:b,autocapitalize:b,style:null,tabindex:null,title:null,translate:["yes","no"],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":b,"aria-autocomplete":["inline","list","both","none"],"aria-busy":b,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":b,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":b,"aria-hidden":b,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":b,"aria-multiselectable":b,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":b,"aria-relevant":null,"aria-required":b,"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},lt="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(O=>"on"+O);for(let O of lt)ot[O]=null;class Qe{constructor(e,a){this.tags=Object.assign(Object.assign({},Qi),e),this.globalAttrs=Object.assign(Object.assign({},ot),a),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Qe.default=new Qe;function V(O,e,a=O.length){if(!e)return"";let t=e.firstChild,r=t&&t.getChild("TagName");return r?O.sliceString(r.from,Math.min(r.to,a)):""}function G(O,e=!1){for(;O;O=O.parent)if(O.name=="Element")if(e)e=!1;else return O;return null}function ct(O,e,a){let t=a.tags[V(O,G(e))];return(t==null?void 0:t.children)||a.allTags}function Ve(O,e){let a=[];for(let t=G(e);t&&!t.type.isTop;t=G(t.parent)){let r=V(O,t);if(r&&t.lastChild.name=="CloseTag")break;r&&a.indexOf(r)<0&&(e.name=="EndTag"||e.from>=t.firstChild.to)&&a.push(r)}return a}const Qt=/^[:\-\.\w\u00b7-\uffff]*$/;function PO(O,e,a,t,r){let s=/\s*>/.test(O.sliceDoc(r,r+5))?"":">",i=G(a,!0);return{from:t,to:r,options:ct(O.doc,i,e).map(n=>({label:n,type:"type"})).concat(Ve(O.doc,a).map((n,l)=>({label:"/"+n,apply:"/"+n+s,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function SO(O,e,a,t){let r=/\s*>/.test(O.sliceDoc(t,t+5))?"":">";return{from:a,to:t,options:Ve(O.doc,e).map((s,i)=>({label:s,apply:s+r,type:"type",boost:99-i})),validFor:Qt}}function pi(O,e,a,t){let r=[],s=0;for(let i of ct(O.doc,a,e))r.push({label:"<"+i,type:"type"});for(let i of Ve(O.doc,a))r.push({label:"",type:"type",boost:99-s++});return{from:t,to:t,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function di(O,e,a,t,r){let s=G(a),i=s?e.tags[V(O.doc,s)]:null,n=i&&i.attrs?Object.keys(i.attrs):[],l=i&&i.globalAttrs===!1?n:n.length?n.concat(e.globalAttrNames):e.globalAttrNames;return{from:t,to:r,options:l.map(Q=>({label:Q,type:"property"})),validFor:Qt}}function hi(O,e,a,t,r){var s;let i=(s=a.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),n=[],l;if(i){let Q=O.sliceDoc(i.from,i.to),d=e.globalAttrs[Q];if(!d){let c=G(a),u=c?e.tags[V(O.doc,c)]:null;d=(u==null?void 0:u.attrs)&&u.attrs[Q]}if(d){let c=O.sliceDoc(t,r).toLowerCase(),u='"',p='"';/^['"]/.test(c)?(l=c[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",p=O.sliceDoc(r,r+1)==c[0]?"":c[0],c=c.slice(1),t++):l=/^[^\s<>='"]*$/;for(let f of d)n.push({label:f,apply:u+f+p,type:"constant"})}}return{from:t,to:r,options:n,validFor:l}}function fi(O,e){let{state:a,pos:t}=e,r=C(a).resolveInner(t,-1),s=r.resolve(t);for(let i=t,n;s==r&&(n=r.childBefore(i));){let l=n.lastChild;if(!l||!l.type.isError||l.fromfi(t,r)}const $i=w.parser.configure({top:"SingleExpression"}),pt=[{tag:"script",attrs:O=>O.type=="text/typescript"||O.lang=="ts",parser:tt.parser},{tag:"script",attrs:O=>O.type=="text/babel"||O.type=="text/jsx",parser:at.parser},{tag:"script",attrs:O=>O.type=="text/typescript-jsx",parser:rt.parser},{tag:"script",attrs(O){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(O.type)},parser:$i},{tag:"script",attrs(O){return!O.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(O.type)},parser:w.parser},{tag:"style",attrs(O){return(!O.lang||O.lang=="css")&&(!O.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(O.type))},parser:ce.parser}],dt=[{name:"style",parser:ce.parser.configure({top:"Styles"})}].concat(lt.map(O=>({name:O,parser:w.parser}))),ht=L.define({name:"html",parser:tr.configure({props:[K.add({Element(O){let e=/^(\s*)(<\/)?/.exec(O.textAfter);return O.node.to<=O.pos+e[0].length?O.continue():O.lineIndent(O.node.from)+(e[2]?0:O.unit)},"OpenTag CloseTag SelfClosingTag"(O){return O.column(O.node.from)+O.unit},Document(O){if(O.pos+/\s*/.exec(O.textAfter)[0].lengthO.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),re=ht.configure({wrap:DO(pt,dt)});function Pi(O={}){let e="",a;O.matchClosingTags===!1&&(e="noMatch"),O.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(O.nestedLanguages&&O.nestedLanguages.length||O.nestedAttributes&&O.nestedAttributes.length)&&(a=DO((O.nestedLanguages||[]).concat(pt),(O.nestedAttributes||[]).concat(dt)));let t=a?ht.configure({wrap:a,dialect:e}):e?re.configure({dialect:e}):re;return new M(t,[re.data.of({autocomplete:ui(O)}),O.autoCloseTags!==!1?Si:[],nt().support,Tr().support])}const ZO=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Si=q.inputHandler.of((O,e,a,t,r)=>{if(O.composing||O.state.readOnly||e!=a||t!=">"&&t!="/"||!re.isActiveAt(O.state,e,-1))return!1;let s=r(),{state:i}=s,n=i.changeByRange(l=>{var Q,d,c;let u=i.doc.sliceString(l.from-1,l.to)==t,{head:p}=l,f=C(i).resolveInner(p-1,-1),P;if((f.name=="TagName"||f.name=="StartTag")&&(f=f.parent),u&&t==">"&&f.name=="OpenTag"){if(((d=(Q=f.parent)===null||Q===void 0?void 0:Q.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(P=V(i.doc,f.parent,p))&&!ZO.has(P)){let S=p+(i.doc.sliceString(p,p+1)===">"?1:0),X=``;return{range:l,changes:{from:p,to:S,insert:X}}}}else if(u&&t=="/"&&f.name=="IncompleteCloseTag"){let S=f.parent;if(f.from==p-2&&((c=S.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(P=V(i.doc,S,p))&&!ZO.has(P)){let X=p+(i.doc.sliceString(p,p+1)===">"?1:0),y=`${P}>`;return{range:jO.cursor(p+y.length,-1),changes:{from:p,to:X,insert:y}}}}return{range:l}});return n.changes.empty?!1:(O.dispatch([s,i.update(n,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Zi=J({String:o.string,Number:o.number,"True False":o.bool,PropertyName:o.propertyName,Null:o.null,",":o.separator,"[ ]":o.squareBracket,"{ }":o.brace}),mi=T.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[Zi],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),gi=L.define({name:"json",parser:mi.configure({props:[K.add({Object:_({except:/^\s*\}/}),Array:_({except:/^\s*\]/})}),F.add({"Object Array":qe})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function bi(){return new M(gi)}const ki=36,mO=1,Xi=2,A=3,be=4,wi=5,yi=6,xi=7,Yi=8,Wi=9,Ti=10,ji=11,vi=12,qi=13,_i=14,Ri=15,Vi=16,Gi=17,gO=18,Ci=19,ft=20,ut=21,bO=22,zi=23,Ui=24;function Ye(O){return O>=65&&O<=90||O>=97&&O<=122||O>=48&&O<=57}function Ei(O){return O>=48&&O<=57||O>=97&&O<=102||O>=65&&O<=70}function v(O,e,a){for(let t=!1;;){if(O.next<0)return;if(O.next==e&&!t){O.advance();return}t=a&&!t&&O.next==92,O.advance()}}function Ai(O){for(;;){if(O.next<0||O.peek(1)<0)return;if(O.next==36&&O.peek(1)==36){O.advance(2);return}O.advance()}}function Ii(O,e){let a="[{<(".indexOf(String.fromCharCode(e)),t=a<0?e:"]}>)".charCodeAt(a);for(;;){if(O.next<0)return;if(O.next==t&&O.peek(1)==39){O.advance(2);return}O.advance()}}function $t(O,e){for(;!(O.next!=95&&!Ye(O.next));)e!=null&&(e+=String.fromCharCode(O.next)),O.advance();return e}function Ni(O){if(O.next==39||O.next==34||O.next==96){let e=O.next;O.advance(),v(O,e,!1)}else $t(O)}function kO(O,e){for(;O.next==48||O.next==49;)O.advance();e&&O.next==e&&O.advance()}function XO(O,e){for(;;){if(O.next==46){if(e)break;e=!0}else if(O.next<48||O.next>57)break;O.advance()}if(O.next==69||O.next==101)for(O.advance(),(O.next==43||O.next==45)&&O.advance();O.next>=48&&O.next<=57;)O.advance()}function wO(O){for(;!(O.next<0||O.next==10);)O.advance()}function j(O,e){for(let a=0;a!=&|~^/",specialVar:"?",identifierQuotes:'"',words:Pt(Bi,Di)};function Ji(O,e,a,t){let r={};for(let s in We)r[s]=(O.hasOwnProperty(s)?O:We)[s];return e&&(r.words=Pt(e,a||"",t)),r}function St(O){return new k(e=>{var a;let{next:t}=e;if(e.advance(),j(t,ke)){for(;j(e.next,ke);)e.advance();e.acceptToken(ki)}else if(t==36&&e.next==36&&O.doubleDollarQuotedStrings)Ai(e),e.acceptToken(A);else if(t==39||t==34&&O.doubleQuotedStrings)v(e,t,O.backslashEscapes),e.acceptToken(A);else if(t==35&&O.hashComments||t==47&&e.next==47&&O.slashComments)wO(e),e.acceptToken(mO);else if(t==45&&e.next==45&&(!O.spaceAfterDashes||e.peek(1)==32))wO(e),e.acceptToken(mO);else if(t==47&&e.next==42){e.advance();for(let r=1;;){let s=e.next;if(e.next<0)break;if(e.advance(),s==42&&e.next==47){if(r--,e.advance(),!r)break}else s==47&&e.next==42&&(r++,e.advance())}e.acceptToken(Xi)}else if((t==101||t==69)&&e.next==39)e.advance(),v(e,39,!0);else if((t==110||t==78)&&e.next==39&&O.charSetCasts)e.advance(),v(e,39,O.backslashEscapes),e.acceptToken(A);else if(t==95&&O.charSetCasts)for(let r=0;;r++){if(e.next==39&&r>1){e.advance(),v(e,39,O.backslashEscapes),e.acceptToken(A);break}if(!Ye(e.next))break;e.advance()}else if(O.plsqlQuotingMechanism&&(t==113||t==81)&&e.next==39&&e.peek(1)>0&&!j(e.peek(1),ke)){let r=e.peek(1);e.advance(2),Ii(e,r),e.acceptToken(A)}else if(t==40)e.acceptToken(xi);else if(t==41)e.acceptToken(Yi);else if(t==123)e.acceptToken(Wi);else if(t==125)e.acceptToken(Ti);else if(t==91)e.acceptToken(ji);else if(t==93)e.acceptToken(vi);else if(t==59)e.acceptToken(qi);else if(O.unquotedBitLiterals&&t==48&&e.next==98)e.advance(),kO(e),e.acceptToken(bO);else if((t==98||t==66)&&(e.next==39||e.next==34)){const r=e.next;e.advance(),O.treatBitsAsBytes?(v(e,r,O.backslashEscapes),e.acceptToken(zi)):(kO(e,r),e.acceptToken(bO))}else if(t==48&&(e.next==120||e.next==88)||(t==120||t==88)&&e.next==39){let r=e.next==39;for(e.advance();Ei(e.next);)e.advance();r&&e.next==39&&e.advance(),e.acceptToken(be)}else if(t==46&&e.next>=48&&e.next<=57)XO(e,!0),e.acceptToken(be);else if(t==46)e.acceptToken(_i);else if(t>=48&&t<=57)XO(e,!1),e.acceptToken(be);else if(j(t,O.operatorChars)){for(;j(e.next,O.operatorChars);)e.advance();e.acceptToken(Ri)}else if(j(t,O.specialVar))e.next==t&&e.advance(),Ni(e),e.acceptToken(Gi);else if(j(t,O.identifierQuotes))v(e,t,!1),e.acceptToken(Ci);else if(t==58||t==44)e.acceptToken(Vi);else if(Ye(t)){let r=$t(e,String.fromCharCode(t));e.acceptToken(e.next==46?gO:(a=O.words[r.toLowerCase()])!==null&&a!==void 0?a:gO)}})}const Zt=St(We),Li=T.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,Zt],topRules:{Script:[0,25]},tokenPrec:0});function Te(O){let e=O.cursor().moveTo(O.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function D(O,e){let a=O.sliceString(e.from,e.to),t=/^([`'"])(.*)\1$/.exec(a);return t?t[2]:a}function pe(O){return O&&(O.name=="Identifier"||O.name=="QuotedIdentifier")}function Ki(O,e){if(e.name=="CompositeIdentifier"){let a=[];for(let t=e.firstChild;t;t=t.nextSibling)pe(t)&&a.push(D(O,t));return a}return[D(O,e)]}function yO(O,e){for(let a=[];;){if(!e||e.name!=".")return a;let t=Te(e);if(!pe(t))return a;a.unshift(D(O,t)),e=Te(t)}}function Fi(O,e){let a=C(O).resolveInner(e,-1),t=Hi(O.doc,a);return a.name=="Identifier"||a.name=="QuotedIdentifier"||a.name=="Keyword"?{from:a.from,quoted:a.name=="QuotedIdentifier"?O.doc.sliceString(a.from,a.from+1):null,parents:yO(O.doc,Te(a)),aliases:t}:a.name=="."?{from:e,quoted:null,parents:yO(O.doc,a),aliases:t}:{from:e,quoted:null,parents:[],empty:!0,aliases:t}}const Mi=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function Hi(O,e){let a;for(let r=e;!a;r=r.parent){if(!r)return null;r.name=="Statement"&&(a=r)}let t=null;for(let r=a.firstChild,s=!1,i=null;r;r=r.nextSibling){let n=r.name=="Keyword"?O.sliceString(r.from,r.to).toLowerCase():null,l=null;if(!s)s=n=="from";else if(n=="as"&&i&&pe(r.nextSibling))l=D(O,r.nextSibling);else{if(n&&Mi.has(n))break;i&&pe(r)&&(l=D(O,r))}l&&(t||(t=Object.create(null)),t[l]=Ki(O,i)),i=/Identifier$/.test(r.name)?r:null}return t}function es(O,e){return O?e.map(a=>Object.assign(Object.assign({},a),{label:a.label[0]==O?a.label:O+a.label+O,apply:void 0})):e}const Os=/^\w*$/,ts=/^[`'"]?\w*[`'"]?$/;class Ge{constructor(){this.list=[],this.children=void 0}child(e,a){let t=this.children||(this.children=Object.create(null)),r=t[e];return r||(e&&this.list.push(mt(e,"type",a)),t[e]=new Ge)}addCompletions(e){for(let a of e){let t=this.list.findIndex(r=>r.label==a.label);t>-1?this.list[t]=a:this.list.push(a)}}}function mt(O,e,a){return/^[a-z_][a-z_\d]*$/.test(O)?{label:O,type:e}:{label:O,type:e,apply:a+O+a}}function as(O,e,a,t,r,s){var i;let n=new Ge,l=((i=s==null?void 0:s.spec.identifierQuotes)===null||i===void 0?void 0:i[0])||'"',Q=n.child(r||"",l);for(let d in O){let c=d.replace(/\\?\./g,p=>p=="."?"\0":p).split("\0"),u=c.length==1?Q:n;for(let p of c)u=u.child(p.replace(/\\\./g,"."),l);for(let p of O[d])p&&u.list.push(typeof p=="string"?mt(p,"property",l):p)}return e&&Q.addCompletions(e),a&&n.addCompletions(a),n.addCompletions(Q.list),t&&n.addCompletions(Q.child(t,l).list),d=>{let{parents:c,from:u,quoted:p,empty:f,aliases:P}=Fi(d.state,d.pos);if(f&&!d.explicit)return null;P&&c.length==1&&(c=P[c[0]]||c);let S=n;for(let Y of c){for(;!S.children||!S.children[Y];)if(S==n)S=Q;else if(S==Q&&t)S=S.child(t,l);else return null;S=S.child(Y,l)}let X=p&&d.state.sliceDoc(d.pos,d.pos+1)==p,y=S.list;return S==n&&P&&(y=y.concat(Object.keys(P).map(Y=>({label:Y,type:"constant"})))),{from:u,to:X?d.pos+1:void 0,options:es(p,y),validFor:p?ts:Os}}}function rs(O,e){let a=Object.keys(O).map(t=>({label:e?t.toUpperCase():t,type:O[t]==ut?"type":O[t]==ft?"keyword":"variable",boost:-1}));return WO(["QuotedIdentifier","SpecialVar","String","LineComment","BlockComment","."],TO(a))}let is=Li.configure({props:[K.add({Statement:_()}),F.add({Statement(O){return{from:O.firstChild.to,to:O.to}},BlockComment(O){return{from:O.from+2,to:O.to-2}}}),J({Keyword:o.keyword,Type:o.typeName,Builtin:o.standard(o.name),Bits:o.number,Bytes:o.string,Bool:o.bool,Null:o.null,Number:o.number,String:o.string,Identifier:o.name,QuotedIdentifier:o.special(o.string),SpecialVar:o.special(o.name),LineComment:o.lineComment,BlockComment:o.blockComment,Operator:o.operator,"Semi Punctuation":o.punctuation,"( )":o.paren,"{ }":o.brace,"[ ]":o.squareBracket})]});class B{constructor(e,a,t){this.dialect=e,this.language=a,this.spec=t}get extension(){return this.language.extension}static define(e){let a=Ji(e,e.keywords,e.types,e.builtin),t=L.define({name:"sql",parser:is.configure({tokenizers:[{from:Zt,to:St(a)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new B(a,t,e)}}function ss(O,e=!1){return rs(O.dialect.words,e)}function ns(O,e=!1){return O.language.data.of({autocomplete:ss(O,e)})}function os(O){return O.schema?as(O.schema,O.tables,O.schemas,O.defaultTable,O.defaultSchema,O.dialect||Ce):()=>null}function ls(O){return O.schema?(O.dialect||Ce).language.data.of({autocomplete:os(O)}):[]}function xO(O={}){let e=O.dialect||Ce;return new M(e.language,[ls(O),ns(e,!!O.upperCaseKeywords)])}const Ce=B.define({});function cs(O){let e;return{c(){e=Yt("div"),Wt(e,"class","code-editor"),H(e,"min-height",O[0]?O[0]+"px":null),H(e,"max-height",O[1]?O[1]+"px":"auto")},m(a,t){Tt(a,e,t),O[11](e)},p(a,[t]){t&1&&H(e,"min-height",a[0]?a[0]+"px":null),t&2&&H(e,"max-height",a[1]?a[1]+"px":"auto")},i:De,o:De,d(a){a&&jt(e),O[11](null)}}}function Qs(O,e,a){let t;vt(O,qt,$=>a(12,t=$));const r=_t();let{id:s=""}=e,{value:i=""}=e,{minHeight:n=null}=e,{maxHeight:l=null}=e,{disabled:Q=!1}=e,{placeholder:d=""}=e,{language:c="javascript"}=e,{singleLine:u=!1}=e,p,f,P=new ee,S=new ee,X=new ee,y=new ee;function Y(){p==null||p.focus()}function gt(){f==null||f.dispatchEvent(new CustomEvent("change",{detail:{value:i},bubbles:!0})),r("change",i)}function ze(){if(!s)return;const $=document.querySelectorAll('[for="'+s+'"]');for(let Z of $)Z.removeEventListener("click",Y)}function Ue(){if(!s)return;ze();const $=document.querySelectorAll('[for="'+s+'"]');for(let Z of $)Z.addEventListener("click",Y)}function Ee(){switch(c){case"html":return Pi();case"json":return bi();case"sql-create-index":return xO({dialect:B.define({keywords:"create unique index if not exists on collate asc desc where like isnull notnull date time datetime unixepoch strftime lower upper substr case when then iif if else json_extract json_each json_tree json_array_length json_valid ",operatorChars:"*+-%<>!=&|/~",identifierQuotes:'`"',specialVar:"@:?$"}),upperCaseKeywords:!0});case"sql-select":let $={};for(let Z of t)$[Z.name]=Vt.getAllCollectionIdentifiers(Z);return xO({dialect:B.define({keywords:"select distinct from where having group by order limit offset join left right inner with like not in match asc desc regexp isnull notnull glob count avg sum min max current random cast as int real text bool date time datetime unixepoch strftime coalesce lower upper substr case when then iif if else json_extract json_each json_tree json_array_length json_valid ",operatorChars:"*+-%<>!=&|/~",identifierQuotes:'`"',specialVar:"@:?$"}),schema:$,upperCaseKeywords:!0});default:return nt()}}Rt(()=>{const $={key:"Enter",run:Z=>{u&&r("submit",i)}};return Ue(),a(10,p=new q({parent:f,state:z.create({doc:i,extensions:[Jt(),Lt(),Kt(),Ft(),Mt(),z.allowMultipleSelections.of(!0),Ht(ea,{fallback:!0}),Oa(),ta(),aa(),ra(),ia.of([$,...sa,...na,oa.find(Z=>Z.key==="Mod-d"),...la,...ca]),q.lineWrapping,Qa({icons:!1}),P.of(Ee()),y.of(Be(d)),S.of(q.editable.of(!0)),X.of(z.readOnly.of(!1)),z.transactionFilter.of(Z=>{var Ae,Ie,Ne;if(u&&Z.newDoc.lines>1){if(!((Ne=(Ie=(Ae=Z.changes)==null?void 0:Ae.inserted)==null?void 0:Ie.filter(kt=>!!kt.text.find(Xt=>Xt)))!=null&&Ne.length))return[];Z.newDoc.text=[Z.newDoc.text.join(" ")]}return Z}),q.updateListener.of(Z=>{!Z.docChanged||Q||(a(3,i=Z.state.doc.toString()),gt())})]})})),()=>{ze(),p==null||p.destroy()}});function bt($){Gt[$?"unshift":"push"](()=>{f=$,a(2,f)})}return O.$$set=$=>{"id"in $&&a(4,s=$.id),"value"in $&&a(3,i=$.value),"minHeight"in $&&a(0,n=$.minHeight),"maxHeight"in $&&a(1,l=$.maxHeight),"disabled"in $&&a(5,Q=$.disabled),"placeholder"in $&&a(6,d=$.placeholder),"language"in $&&a(7,c=$.language),"singleLine"in $&&a(8,u=$.singleLine)},O.$$.update=()=>{O.$$.dirty&16&&s&&Ue(),O.$$.dirty&1152&&p&&c&&p.dispatch({effects:[P.reconfigure(Ee())]}),O.$$.dirty&1056&&p&&typeof Q<"u"&&p.dispatch({effects:[S.reconfigure(q.editable.of(!Q)),X.reconfigure(z.readOnly.of(Q))]}),O.$$.dirty&1032&&p&&i!=p.state.doc.toString()&&p.dispatch({changes:{from:0,to:p.state.doc.length,insert:i}}),O.$$.dirty&1088&&p&&typeof d<"u"&&p.dispatch({effects:[y.reconfigure(Be(d))]})},[n,l,f,i,s,Q,d,c,u,Y,p,bt]}class hs extends wt{constructor(e){super(),yt(this,e,Qs,cs,xt,{id:4,value:3,minHeight:0,maxHeight:1,disabled:5,placeholder:6,language:7,singleLine:8,focus:9})}get focus(){return this.$$.ctx[9]}}export{hs as default}; diff --git a/ui/dist/assets/ConfirmEmailChangeDocs-eRrlYV21.js b/ui/dist/assets/ConfirmEmailChangeDocs-z2cifBOn.js similarity index 97% rename from ui/dist/assets/ConfirmEmailChangeDocs-eRrlYV21.js rename to ui/dist/assets/ConfirmEmailChangeDocs-z2cifBOn.js index 2fc8ebb9..0d9de27c 100644 --- a/ui/dist/assets/ConfirmEmailChangeDocs-eRrlYV21.js +++ b/ui/dist/assets/ConfirmEmailChangeDocs-z2cifBOn.js @@ -1,4 +1,4 @@ -import{S as Pe,i as Se,s as Oe,O as Y,e as r,v,b as k,c as Ce,f as b,g as d,h as n,m as $e,w as j,P as _e,Q as ye,k as Re,R as Te,n as Ae,t as ee,a as te,o as m,d as we,C as Ee,A as qe,q as H,r as Be,N as Ue}from"./index-ydlV29Fj.js";import{S as De}from"./SdkTabs-O6auDA6S.js";function he(o,l,s){const a=o.slice();return a[5]=l[s],a}function ke(o,l,s){const a=o.slice();return a[5]=l[s],a}function ge(o,l){let s,a=l[5].code+"",_,u,i,p;function f(){return l[4](l[5])}return{key:o,first:null,c(){s=r("button"),_=v(a),u=k(),b(s,"class","tab-item"),H(s,"active",l[1]===l[5].code),this.first=s},m(C,$){d(C,s,$),n(s,_),n(s,u),i||(p=Be(s,"click",f),i=!0)},p(C,$){l=C,$&4&&a!==(a=l[5].code+"")&&j(_,a),$&6&&H(s,"active",l[1]===l[5].code)},d(C){C&&m(s),i=!1,p()}}}function ve(o,l){let s,a,_,u;return a=new Ue({props:{content:l[5].body}}),{key:o,first:null,c(){s=r("div"),Ce(a.$$.fragment),_=k(),b(s,"class","tab-item"),H(s,"active",l[1]===l[5].code),this.first=s},m(i,p){d(i,s,p),$e(a,s,null),n(s,_),u=!0},p(i,p){l=i;const f={};p&4&&(f.content=l[5].body),a.$set(f),(!u||p&6)&&H(s,"active",l[1]===l[5].code)},i(i){u||(ee(a.$$.fragment,i),u=!0)},o(i){te(a.$$.fragment,i),u=!1},d(i){i&&m(s),we(a)}}}function Ne(o){var pe,fe;let l,s,a=o[0].name+"",_,u,i,p,f,C,$,D=o[0].name+"",F,le,se,I,L,w,Q,y,z,P,N,ae,K,R,ne,G,M=o[0].name+"",J,oe,V,T,X,A,Z,E,x,S,q,g=[],ie=new Map,ce,B,h=[],re=new Map,O;w=new De({props:{js:` +import{S as Pe,i as Se,s as Oe,O as Y,e as r,v,b as k,c as Ce,f as b,g as d,h as n,m as $e,w as j,P as _e,Q as ye,k as Re,R as Te,n as Ae,t as ee,a as te,o as m,d as we,C as Ee,A as qe,q as H,r as Be,N as Ue}from"./index-z3vRI80T.js";import{S as De}from"./SdkTabs-gnoMubZE.js";function he(o,l,s){const a=o.slice();return a[5]=l[s],a}function ke(o,l,s){const a=o.slice();return a[5]=l[s],a}function ge(o,l){let s,a=l[5].code+"",_,u,i,p;function f(){return l[4](l[5])}return{key:o,first:null,c(){s=r("button"),_=v(a),u=k(),b(s,"class","tab-item"),H(s,"active",l[1]===l[5].code),this.first=s},m(C,$){d(C,s,$),n(s,_),n(s,u),i||(p=Be(s,"click",f),i=!0)},p(C,$){l=C,$&4&&a!==(a=l[5].code+"")&&j(_,a),$&6&&H(s,"active",l[1]===l[5].code)},d(C){C&&m(s),i=!1,p()}}}function ve(o,l){let s,a,_,u;return a=new Ue({props:{content:l[5].body}}),{key:o,first:null,c(){s=r("div"),Ce(a.$$.fragment),_=k(),b(s,"class","tab-item"),H(s,"active",l[1]===l[5].code),this.first=s},m(i,p){d(i,s,p),$e(a,s,null),n(s,_),u=!0},p(i,p){l=i;const f={};p&4&&(f.content=l[5].body),a.$set(f),(!u||p&6)&&H(s,"active",l[1]===l[5].code)},i(i){u||(ee(a.$$.fragment,i),u=!0)},o(i){te(a.$$.fragment,i),u=!1},d(i){i&&m(s),we(a)}}}function Ne(o){var pe,fe;let l,s,a=o[0].name+"",_,u,i,p,f,C,$,D=o[0].name+"",F,le,se,I,L,w,Q,y,z,P,N,ae,K,R,ne,G,M=o[0].name+"",J,oe,V,T,X,A,Z,E,x,S,q,g=[],ie=new Map,ce,B,h=[],re=new Map,O;w=new De({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${o[3]}'); diff --git a/ui/dist/assets/ConfirmPasswordResetDocs-AJWXIimi.js b/ui/dist/assets/ConfirmPasswordResetDocs-XG9DX7jk.js similarity index 98% rename from ui/dist/assets/ConfirmPasswordResetDocs-AJWXIimi.js rename to ui/dist/assets/ConfirmPasswordResetDocs-XG9DX7jk.js index 709a09f7..8b31f631 100644 --- a/ui/dist/assets/ConfirmPasswordResetDocs-AJWXIimi.js +++ b/ui/dist/assets/ConfirmPasswordResetDocs-XG9DX7jk.js @@ -1,4 +1,4 @@ -import{S as Ne,i as $e,s as Ce,O as K,e as c,v as w,b as k,c as Ae,f as b,g as r,h as n,m as Re,w as U,P as we,Q as Ee,k as ye,R as De,n as Te,t as ee,a as te,o as p,d as Oe,C as qe,A as Be,q as j,r as Me,N as Fe}from"./index-ydlV29Fj.js";import{S as Ie}from"./SdkTabs-O6auDA6S.js";function Se(o,l,s){const a=o.slice();return a[5]=l[s],a}function Pe(o,l,s){const a=o.slice();return a[5]=l[s],a}function We(o,l){let s,a=l[5].code+"",_,m,i,u;function f(){return l[4](l[5])}return{key:o,first:null,c(){s=c("button"),_=w(a),m=k(),b(s,"class","tab-item"),j(s,"active",l[1]===l[5].code),this.first=s},m(S,P){r(S,s,P),n(s,_),n(s,m),i||(u=Me(s,"click",f),i=!0)},p(S,P){l=S,P&4&&a!==(a=l[5].code+"")&&U(_,a),P&6&&j(s,"active",l[1]===l[5].code)},d(S){S&&p(s),i=!1,u()}}}function ge(o,l){let s,a,_,m;return a=new Fe({props:{content:l[5].body}}),{key:o,first:null,c(){s=c("div"),Ae(a.$$.fragment),_=k(),b(s,"class","tab-item"),j(s,"active",l[1]===l[5].code),this.first=s},m(i,u){r(i,s,u),Re(a,s,null),n(s,_),m=!0},p(i,u){l=i;const f={};u&4&&(f.content=l[5].body),a.$set(f),(!m||u&6)&&j(s,"active",l[1]===l[5].code)},i(i){m||(ee(a.$$.fragment,i),m=!0)},o(i){te(a.$$.fragment,i),m=!1},d(i){i&&p(s),Oe(a)}}}function Ke(o){var ue,fe,me,be;let l,s,a=o[0].name+"",_,m,i,u,f,S,P,q=o[0].name+"",H,le,se,L,Q,W,z,O,G,g,B,ae,M,N,oe,J,F=o[0].name+"",V,ne,X,$,Y,C,Z,E,x,A,y,v=[],ie=new Map,de,D,h=[],ce=new Map,R;W=new Ie({props:{js:` +import{S as Ne,i as $e,s as Ce,O as K,e as c,v as w,b as k,c as Ae,f as b,g as r,h as n,m as Re,w as U,P as we,Q as Ee,k as ye,R as De,n as Te,t as ee,a as te,o as p,d as Oe,C as qe,A as Be,q as j,r as Me,N as Fe}from"./index-z3vRI80T.js";import{S as Ie}from"./SdkTabs-gnoMubZE.js";function Se(o,l,s){const a=o.slice();return a[5]=l[s],a}function Pe(o,l,s){const a=o.slice();return a[5]=l[s],a}function We(o,l){let s,a=l[5].code+"",_,m,i,u;function f(){return l[4](l[5])}return{key:o,first:null,c(){s=c("button"),_=w(a),m=k(),b(s,"class","tab-item"),j(s,"active",l[1]===l[5].code),this.first=s},m(S,P){r(S,s,P),n(s,_),n(s,m),i||(u=Me(s,"click",f),i=!0)},p(S,P){l=S,P&4&&a!==(a=l[5].code+"")&&U(_,a),P&6&&j(s,"active",l[1]===l[5].code)},d(S){S&&p(s),i=!1,u()}}}function ge(o,l){let s,a,_,m;return a=new Fe({props:{content:l[5].body}}),{key:o,first:null,c(){s=c("div"),Ae(a.$$.fragment),_=k(),b(s,"class","tab-item"),j(s,"active",l[1]===l[5].code),this.first=s},m(i,u){r(i,s,u),Re(a,s,null),n(s,_),m=!0},p(i,u){l=i;const f={};u&4&&(f.content=l[5].body),a.$set(f),(!m||u&6)&&j(s,"active",l[1]===l[5].code)},i(i){m||(ee(a.$$.fragment,i),m=!0)},o(i){te(a.$$.fragment,i),m=!1},d(i){i&&p(s),Oe(a)}}}function Ke(o){var ue,fe,me,be;let l,s,a=o[0].name+"",_,m,i,u,f,S,P,q=o[0].name+"",H,le,se,L,Q,W,z,O,G,g,B,ae,M,N,oe,J,F=o[0].name+"",V,ne,X,$,Y,C,Z,E,x,A,y,v=[],ie=new Map,de,D,h=[],ce=new Map,R;W=new Ie({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${o[3]}'); diff --git a/ui/dist/assets/ConfirmVerificationDocs-JgU_hYvF.js b/ui/dist/assets/ConfirmVerificationDocs-iIwWOJ-8.js similarity index 97% rename from ui/dist/assets/ConfirmVerificationDocs-JgU_hYvF.js rename to ui/dist/assets/ConfirmVerificationDocs-iIwWOJ-8.js index 5eee7be7..e3bece1a 100644 --- a/ui/dist/assets/ConfirmVerificationDocs-JgU_hYvF.js +++ b/ui/dist/assets/ConfirmVerificationDocs-iIwWOJ-8.js @@ -1,4 +1,4 @@ -import{S as Se,i as Te,s as Be,O as D,e as r,v as g,b as k,c as ye,f as h,g as f,h as n,m as Ce,w as H,P as ke,Q as qe,k as Re,R as Oe,n as Ae,t as x,a as ee,o as d,d as Pe,C as Ee,A as Ne,q as F,r as Ve,N as Ke}from"./index-ydlV29Fj.js";import{S as Me}from"./SdkTabs-O6auDA6S.js";function ve(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 we(o,l){let s,a=l[5].code+"",b,m,i,p;function u(){return l[4](l[5])}return{key:o,first:null,c(){s=r("button"),b=g(a),m=k(),h(s,"class","tab-item"),F(s,"active",l[1]===l[5].code),this.first=s},m(w,$){f(w,s,$),n(s,b),n(s,m),i||(p=Ve(s,"click",u),i=!0)},p(w,$){l=w,$&4&&a!==(a=l[5].code+"")&&H(b,a),$&6&&F(s,"active",l[1]===l[5].code)},d(w){w&&d(s),i=!1,p()}}}function $e(o,l){let s,a,b,m;return a=new Ke({props:{content:l[5].body}}),{key:o,first:null,c(){s=r("div"),ye(a.$$.fragment),b=k(),h(s,"class","tab-item"),F(s,"active",l[1]===l[5].code),this.first=s},m(i,p){f(i,s,p),Ce(a,s,null),n(s,b),m=!0},p(i,p){l=i;const u={};p&4&&(u.content=l[5].body),a.$set(u),(!m||p&6)&&F(s,"active",l[1]===l[5].code)},i(i){m||(x(a.$$.fragment,i),m=!0)},o(i){ee(a.$$.fragment,i),m=!1},d(i){i&&d(s),Pe(a)}}}function Ue(o){var fe,de,pe,ue;let l,s,a=o[0].name+"",b,m,i,p,u,w,$,V=o[0].name+"",I,te,L,y,Q,T,z,C,K,le,M,B,se,G,U=o[0].name+"",J,ae,W,q,X,R,Y,O,Z,P,A,v=[],oe=new Map,ne,E,_=[],ie=new Map,S;y=new Me({props:{js:` +import{S as Se,i as Te,s as Be,O as D,e as r,v as g,b as k,c as ye,f as h,g as f,h as n,m as Ce,w as H,P as ke,Q as qe,k as Re,R as Oe,n as Ae,t as x,a as ee,o as d,d as Pe,C as Ee,A as Ne,q as F,r as Ve,N as Ke}from"./index-z3vRI80T.js";import{S as Me}from"./SdkTabs-gnoMubZE.js";function ve(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 we(o,l){let s,a=l[5].code+"",b,m,i,p;function u(){return l[4](l[5])}return{key:o,first:null,c(){s=r("button"),b=g(a),m=k(),h(s,"class","tab-item"),F(s,"active",l[1]===l[5].code),this.first=s},m(w,$){f(w,s,$),n(s,b),n(s,m),i||(p=Ve(s,"click",u),i=!0)},p(w,$){l=w,$&4&&a!==(a=l[5].code+"")&&H(b,a),$&6&&F(s,"active",l[1]===l[5].code)},d(w){w&&d(s),i=!1,p()}}}function $e(o,l){let s,a,b,m;return a=new Ke({props:{content:l[5].body}}),{key:o,first:null,c(){s=r("div"),ye(a.$$.fragment),b=k(),h(s,"class","tab-item"),F(s,"active",l[1]===l[5].code),this.first=s},m(i,p){f(i,s,p),Ce(a,s,null),n(s,b),m=!0},p(i,p){l=i;const u={};p&4&&(u.content=l[5].body),a.$set(u),(!m||p&6)&&F(s,"active",l[1]===l[5].code)},i(i){m||(x(a.$$.fragment,i),m=!0)},o(i){ee(a.$$.fragment,i),m=!1},d(i){i&&d(s),Pe(a)}}}function Ue(o){var fe,de,pe,ue;let l,s,a=o[0].name+"",b,m,i,p,u,w,$,V=o[0].name+"",I,te,L,y,Q,T,z,C,K,le,M,B,se,G,U=o[0].name+"",J,ae,W,q,X,R,Y,O,Z,P,A,v=[],oe=new Map,ne,E,_=[],ie=new Map,S;y=new Me({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${o[3]}'); diff --git a/ui/dist/assets/CreateApiDocs-uAZVKP8K.js b/ui/dist/assets/CreateApiDocs-5RxIhvO0.js similarity index 98% rename from ui/dist/assets/CreateApiDocs-uAZVKP8K.js rename to ui/dist/assets/CreateApiDocs-5RxIhvO0.js index 99bf13c0..e5aabcf1 100644 --- a/ui/dist/assets/CreateApiDocs-uAZVKP8K.js +++ b/ui/dist/assets/CreateApiDocs-5RxIhvO0.js @@ -1,4 +1,4 @@ -import{S as qt,i as Ot,s as Mt,C as Q,O as ne,N as Tt,e as s,v as _,b as f,c as _e,f as v,g as r,h as n,m as he,w as x,P as Be,Q as ht,k as Ht,R as Lt,n as Pt,t as fe,a as ue,o as d,d as ke,A as At,q as ye,r as Ft,x as ae}from"./index-ydlV29Fj.js";import{S as Rt}from"./SdkTabs-O6auDA6S.js";import{F as Bt}from"./FieldsQueryParam--b6rO4n1.js";function kt(o,e,t){const a=o.slice();return a[8]=e[t],a}function yt(o,e,t){const a=o.slice();return a[8]=e[t],a}function vt(o,e,t){const a=o.slice();return a[13]=e[t],a}function gt(o){let e;return{c(){e=s("p"),e.innerHTML="Requires admin Authorization:TOKEN header",v(e,"class","txt-hint txt-sm txt-right")},m(t,a){r(t,e,a)},d(t){t&&d(e)}}}function wt(o){let e,t,a,u,m,c,p,y,S,T,w,H,D,E,P,I,j,B,C,N,q,g,b;function O(h,$){var ee,K;return(K=(ee=h[0])==null?void 0:ee.options)!=null&&K.requireEmail?Dt:jt}let z=O(o),A=z(o);return{c(){e=s("tr"),e.innerHTML='Auth fields',t=f(),a=s("tr"),a.innerHTML=`
Optional username
String The username of the auth record. +import{S as qt,i as Ot,s as Mt,C as Q,O as ne,N as Tt,e as s,v as _,b as f,c as _e,f as v,g as r,h as n,m as he,w as x,P as Be,Q as ht,k as Ht,R as Lt,n as Pt,t as fe,a as ue,o as d,d as ke,A as At,q as ye,r as Ft,x as ae}from"./index-z3vRI80T.js";import{S as Rt}from"./SdkTabs-gnoMubZE.js";import{F as Bt}from"./FieldsQueryParam-QduFX_Q6.js";function kt(o,e,t){const a=o.slice();return a[8]=e[t],a}function yt(o,e,t){const a=o.slice();return a[8]=e[t],a}function vt(o,e,t){const a=o.slice();return a[13]=e[t],a}function gt(o){let e;return{c(){e=s("p"),e.innerHTML="Requires admin Authorization:TOKEN header",v(e,"class","txt-hint txt-sm txt-right")},m(t,a){r(t,e,a)},d(t){t&&d(e)}}}function wt(o){let e,t,a,u,m,c,p,y,S,T,w,H,D,E,P,I,j,B,C,N,q,g,b;function O(h,$){var ee,K;return(K=(ee=h[0])==null?void 0:ee.options)!=null&&K.requireEmail?Dt:jt}let z=O(o),A=z(o);return{c(){e=s("tr"),e.innerHTML='Auth fields',t=f(),a=s("tr"),a.innerHTML=`
Optional username
String The username of the auth record.
If not set, it will be auto generated.`,u=f(),m=s("tr"),c=s("td"),p=s("div"),A.c(),y=f(),S=s("span"),S.textContent="email",T=f(),w=s("td"),w.innerHTML='String',H=f(),D=s("td"),D.textContent="Auth record email address.",E=f(),P=s("tr"),P.innerHTML='
Optional emailVisibility
Boolean Whether to show/hide the auth record email when fetching the record data.',I=f(),j=s("tr"),j.innerHTML='
Required password
String Auth record password.',B=f(),C=s("tr"),C.innerHTML='
Required passwordConfirm
String Auth record password confirmation.',N=f(),q=s("tr"),q.innerHTML=`
Optional verified
Boolean Indicates whether the auth record is verified or not.
diff --git a/ui/dist/assets/DeleteApiDocs-fOXuOKIx.js b/ui/dist/assets/DeleteApiDocs-j_NJpd0u.js similarity index 97% rename from ui/dist/assets/DeleteApiDocs-fOXuOKIx.js rename to ui/dist/assets/DeleteApiDocs-j_NJpd0u.js index e88d3821..9f850ff4 100644 --- a/ui/dist/assets/DeleteApiDocs-fOXuOKIx.js +++ b/ui/dist/assets/DeleteApiDocs-j_NJpd0u.js @@ -1,4 +1,4 @@ -import{S as Re,i as Pe,s as Ee,O as j,e as c,v as y,b as k,c as Ce,f as m,g as p,h as i,m as De,w as ee,P as he,Q as Oe,k as Te,R as Ae,n as Be,t as te,a as le,o as u,d as we,C as Ie,A as qe,q as N,r as Me,N as Se}from"./index-ydlV29Fj.js";import{S as He}from"./SdkTabs-O6auDA6S.js";function ke(a,l,s){const o=a.slice();return o[6]=l[s],o}function ge(a,l,s){const o=a.slice();return o[6]=l[s],o}function ve(a){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,o){p(s,l,o)},d(s){s&&u(l)}}}function ye(a,l){let s,o,h;function d(){return l[5](l[6])}return{key:a,first:null,c(){s=c("button"),s.textContent=`${l[6].code} `,m(s,"class","tab-item"),N(s,"active",l[2]===l[6].code),this.first=s},m(n,r){p(n,s,r),o||(h=Me(s,"click",d),o=!0)},p(n,r){l=n,r&20&&N(s,"active",l[2]===l[6].code)},d(n){n&&u(s),o=!1,h()}}}function $e(a,l){let s,o,h,d;return o=new Se({props:{content:l[6].body}}),{key:a,first:null,c(){s=c("div"),Ce(o.$$.fragment),h=k(),m(s,"class","tab-item"),N(s,"active",l[2]===l[6].code),this.first=s},m(n,r){p(n,s,r),De(o,s,null),i(s,h),d=!0},p(n,r){l=n,(!d||r&20)&&N(s,"active",l[2]===l[6].code)},i(n){d||(te(o.$$.fragment,n),d=!0)},o(n){le(o.$$.fragment,n),d=!1},d(n){n&&u(s),we(o)}}}function Le(a){var ue,me;let l,s,o=a[0].name+"",h,d,n,r,$,C,z,M=a[0].name+"",F,se,K,D,Q,E,G,g,S,ae,H,P,oe,J,L=a[0].name+"",V,ne,W,ie,X,O,Y,T,Z,A,x,w,B,v=[],ce=new Map,de,I,b=[],re=new Map,R;D=new He({props:{js:` +import{S as Re,i as Pe,s as Ee,O as j,e as c,v as y,b as k,c as Ce,f as m,g as p,h as i,m as De,w as ee,P as he,Q as Oe,k as Te,R as Ae,n as Be,t as te,a as le,o as u,d as we,C as Ie,A as qe,q as N,r as Me,N as Se}from"./index-z3vRI80T.js";import{S as He}from"./SdkTabs-gnoMubZE.js";function ke(a,l,s){const o=a.slice();return o[6]=l[s],o}function ge(a,l,s){const o=a.slice();return o[6]=l[s],o}function ve(a){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,o){p(s,l,o)},d(s){s&&u(l)}}}function ye(a,l){let s,o,h;function d(){return l[5](l[6])}return{key:a,first:null,c(){s=c("button"),s.textContent=`${l[6].code} `,m(s,"class","tab-item"),N(s,"active",l[2]===l[6].code),this.first=s},m(n,r){p(n,s,r),o||(h=Me(s,"click",d),o=!0)},p(n,r){l=n,r&20&&N(s,"active",l[2]===l[6].code)},d(n){n&&u(s),o=!1,h()}}}function $e(a,l){let s,o,h,d;return o=new Se({props:{content:l[6].body}}),{key:a,first:null,c(){s=c("div"),Ce(o.$$.fragment),h=k(),m(s,"class","tab-item"),N(s,"active",l[2]===l[6].code),this.first=s},m(n,r){p(n,s,r),De(o,s,null),i(s,h),d=!0},p(n,r){l=n,(!d||r&20)&&N(s,"active",l[2]===l[6].code)},i(n){d||(te(o.$$.fragment,n),d=!0)},o(n){le(o.$$.fragment,n),d=!1},d(n){n&&u(s),we(o)}}}function Le(a){var ue,me;let l,s,o=a[0].name+"",h,d,n,r,$,C,z,M=a[0].name+"",F,se,K,D,Q,E,G,g,S,ae,H,P,oe,J,L=a[0].name+"",V,ne,W,ie,X,O,Y,T,Z,A,x,w,B,v=[],ce=new Map,de,I,b=[],re=new Map,R;D=new He({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${a[3]}'); diff --git a/ui/dist/assets/FieldsQueryParam--b6rO4n1.js b/ui/dist/assets/FieldsQueryParam-QduFX_Q6.js similarity index 96% rename from ui/dist/assets/FieldsQueryParam--b6rO4n1.js rename to ui/dist/assets/FieldsQueryParam-QduFX_Q6.js index 1e2452bb..1473fcb4 100644 --- a/ui/dist/assets/FieldsQueryParam--b6rO4n1.js +++ b/ui/dist/assets/FieldsQueryParam-QduFX_Q6.js @@ -1,4 +1,4 @@ -import{S as J,i as O,s as P,N as Q,e as t,b as c,v as i,c as R,f as j,g as z,h as e,m as A,w as D,t as G,a as K,o as U,d as V}from"./index-ydlV29Fj.js";function W(f){let n,o,u,d,k,s,p,w,h,y,r,F,_,S,b,E,C,a,$,L,q,H,M,N,m,T,v,B,x;return r=new Q({props:{content:"?fields=*,"+f[0]+"expand.relField.name"}}),{c(){n=t("tr"),o=t("td"),o.textContent="fields",u=c(),d=t("td"),d.innerHTML='String',k=c(),s=t("td"),p=t("p"),w=i(`Comma separated string of the fields to return in the JSON response +import{S as J,i as O,s as P,N as Q,e as t,b as c,v as i,c as R,f as j,g as z,h as e,m as A,w as D,t as G,a as K,o as U,d as V}from"./index-z3vRI80T.js";function W(f){let n,o,u,d,k,s,p,w,h,y,r,F,_,S,b,E,C,a,$,L,q,H,M,N,m,T,v,B,x;return r=new Q({props:{content:"?fields=*,"+f[0]+"expand.relField.name"}}),{c(){n=t("tr"),o=t("td"),o.textContent="fields",u=c(),d=t("td"),d.innerHTML='String',k=c(),s=t("td"),p=t("p"),w=i(`Comma separated string of the fields to return in the JSON response `),h=t("em"),h.textContent="(by default returns all fields)",y=i(`. Ex.: `),R(r.$$.fragment),F=c(),_=t("p"),_.innerHTML="* targets all keys from the specific depth level.",S=c(),b=t("p"),b.textContent="In addition, the following field modifiers are also supported:",E=c(),C=t("ul"),a=t("li"),$=t("code"),$.textContent=":excerpt(maxLength, withEllipsis?)",L=c(),q=t("br"),H=i(` Returns a short plain text version of the field string value. diff --git a/ui/dist/assets/FilterAutocompleteInput-7N2kJXRh.js b/ui/dist/assets/FilterAutocompleteInput-7N2kJXRh.js deleted file mode 100644 index 2a3b2d44..00000000 --- a/ui/dist/assets/FilterAutocompleteInput-7N2kJXRh.js +++ /dev/null @@ -1 +0,0 @@ -import{S as le,i as ce,s as ue,e as de,f as fe,g as he,x as H,o as ge,J as pe,K as ye,L as me,I as ke,C as h,M as xe}from"./index-ydlV29Fj.js";import{E as R,a as I,h as be,b as we,c as Ee,d as Ke,e as Se,s as Ce,f as qe,g as Re,r as Ie,i as Le,k as _e,j as ve,l as Ae,m as De,n as Oe,o as Be,p as Me,q as j,C as v,S as He,t as Fe,u as Te}from"./index-u64XbdBO.js";function Ue(e){$(e,"start");var o={},n=e.languageData||{},y=!1;for(var m in e)if(m!=n&&e.hasOwnProperty(m))for(var g=o[m]=[],s=e[m],r=0;r2&&s.token&&typeof s.token!="string"){n.pending=[];for(var a=2;a-1)return null;var m=n.indent.length-1,g=e[n.state];e:for(;;){for(var s=0;sn(21,y=t));const m=me();let{id:g=""}=o,{value:s=""}=o,{disabled:r=!1}=o,{placeholder:l=""}=o,{baseCollection:a=null}=o,{singleLine:b=!1}=o,{extraAutocompleteKeys:A=[]}=o,{disableRequestKeys:K=!1}=o,{disableIndirectCollectionsKeys:C=!1}=o,f,w,D=r,F=new v,T=new v,U=new v,W=new v,q=[],N=[],J=[],P=[],L="",O="";function B(){f==null||f.focus()}let M=null;function ee(){clearTimeout(M),M=setTimeout(()=>{q=te(y),P=ne(),N=K?[]:oe(),J=C?[]:ie()},300)}function te(t){let i=t.slice();return a&&h.pushOrReplaceByKey(i,a,"id"),i}function V(){w==null||w.dispatchEvent(new CustomEvent("change",{detail:{value:s},bubbles:!0}))}function G(){if(!g)return;const t=document.querySelectorAll('[for="'+g+'"]');for(let i of t)i.removeEventListener("click",B)}function z(){if(!g)return;G();const t=document.querySelectorAll('[for="'+g+'"]');for(let i of t)i.addEventListener("click",B)}function S(t,i="",c=0){var k,x,X,Y;let u=q.find(p=>p.name==t||p.id==t);if(!u||c>=4)return[];u.schema=u.schema||[];let d=h.getAllCollectionIdentifiers(u,i);for(const p of u.schema){const E=i+p.name;if(p.type==="relation"&&((k=p.options)!=null&&k.collectionId)){const _=S(p.options.collectionId,E+".",c+1);_.length&&(d=d.concat(_))}p.type==="select"&&((x=p.options)==null?void 0:x.maxSelect)!=1&&d.push(E+":each"),((X=p.options)==null?void 0:X.maxSelect)!=1&&["select","file","relation"].includes(p.type)&&d.push(E+":length")}for(const p of q){p.schema=p.schema||[];for(const E of p.schema)if(E.type=="relation"&&((Y=E.options)==null?void 0:Y.collectionId)==u.id){const _=i+p.name+"_via_"+E.name,Z=S(p.id,_+".",c+2);Z.length&&(d=d.concat(Z))}}return d}function ne(){return S(a==null?void 0:a.name)}function oe(){const t=[];t.push("@request.context"),t.push("@request.method"),t.push("@request.query."),t.push("@request.data."),t.push("@request.headers."),t.push("@request.auth.id"),t.push("@request.auth.collectionId"),t.push("@request.auth.collectionName"),t.push("@request.auth.verified"),t.push("@request.auth.username"),t.push("@request.auth.email"),t.push("@request.auth.emailVisibility"),t.push("@request.auth.created"),t.push("@request.auth.updated");const i=q.filter(u=>u.type==="auth");for(const u of i){const d=S(u.id,"@request.auth.");for(const k of d)h.pushUnique(t,k)}const c=["created","updated"];if(a!=null&&a.id){const u=S(a.name,"@request.data.");for(const d of u){t.push(d);const k=d.split(".");k.length===3&&k[2].indexOf(":")===-1&&!c.includes(k[2])&&t.push(d+":isset")}}return t}function ie(){const t=[];for(const i of q){const c="@collection."+i.name+".",u=S(i.name,c);for(const d of u)t.push(d)}return t}function re(t=!0,i=!0){let c=[].concat(A);return c=c.concat(P||[]),t&&(c=c.concat(N||[])),i&&(c=c.concat(J||[])),c.sort(function(u,d){return u.length-d.length}),c}function se(t){var k;let i=t.matchBefore(/[\'\"\@\w\.]*/);if(i&&i.from==i.to&&!t.explicit)return null;let c=Te(t.state).resolveInner(t.pos,-1);if(((k=c==null?void 0:c.type)==null?void 0:k.name)=="comment")return null;let u=[{label:"false"},{label:"true"},{label:"@now"},{label:"@second"},{label:"@minute"},{label:"@hour"},{label:"@year"},{label:"@day"},{label:"@month"},{label:"@weekday"},{label:"@todayStart"},{label:"@todayEnd"},{label:"@monthStart"},{label:"@monthEnd"},{label:"@yearStart"},{label:"@yearEnd"}];C||u.push({label:"@collection.*",apply:"@collection."});const d=re(!K,!K&&i.text.startsWith("@c"));for(const x of d)u.push({label:x.endsWith(".")?x+"*":x,apply:x});return{from:i.from,options:u}}function Q(){return He.define(Ue({start:[{regex:/true|false|null/,token:"atom"},{regex:/\/\/.*/,token:"comment"},{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},{regex:/\w+[\w\.]*\w+/,token:"keyword"},{regex:h.escapeRegExp("@now"),token:"keyword"},{regex:h.escapeRegExp("@second"),token:"keyword"},{regex:h.escapeRegExp("@minute"),token:"keyword"},{regex:h.escapeRegExp("@hour"),token:"keyword"},{regex:h.escapeRegExp("@year"),token:"keyword"},{regex:h.escapeRegExp("@day"),token:"keyword"},{regex:h.escapeRegExp("@month"),token:"keyword"},{regex:h.escapeRegExp("@weekday"),token:"keyword"},{regex:h.escapeRegExp("@todayStart"),token:"keyword"},{regex:h.escapeRegExp("@todayEnd"),token:"keyword"},{regex:h.escapeRegExp("@monthStart"),token:"keyword"},{regex:h.escapeRegExp("@monthEnd"),token:"keyword"},{regex:h.escapeRegExp("@yearStart"),token:"keyword"},{regex:h.escapeRegExp("@yearEnd"),token:"keyword"},{regex:h.escapeRegExp("@request.method"),token:"keyword"}],meta:{lineComment:"//"}}))}ke(()=>{const t={key:"Enter",run:i=>{b&&m("submit",s)}};return z(),n(11,f=new R({parent:w,state:I.create({doc:s,extensions:[be(),we(),Ee(),Ke(),Se(),I.allowMultipleSelections.of(!0),Ce(Fe,{fallback:!0}),qe(),Re(),Ie(),Le(),_e.of([t,...ve,...Ae,De.find(i=>i.key==="Mod-d"),...Oe,...Be]),R.lineWrapping,Me({override:[se],icons:!1}),W.of(j(l)),T.of(R.editable.of(!r)),U.of(I.readOnly.of(r)),F.of(Q()),I.transactionFilter.of(i=>{var c,u,d;if(b&&i.newDoc.lines>1){if(!((d=(u=(c=i.changes)==null?void 0:c.inserted)==null?void 0:u.filter(k=>!!k.text.find(x=>x)))!=null&&d.length))return[];i.newDoc.text=[i.newDoc.text.join(" ")]}return i}),R.updateListener.of(i=>{!i.docChanged||r||(n(1,s=i.state.doc.toString()),V())})]})})),()=>{clearTimeout(M),G(),f==null||f.destroy()}});function ae(t){xe[t?"unshift":"push"](()=>{w=t,n(0,w)})}return e.$$set=t=>{"id"in t&&n(2,g=t.id),"value"in t&&n(1,s=t.value),"disabled"in t&&n(3,r=t.disabled),"placeholder"in t&&n(4,l=t.placeholder),"baseCollection"in t&&n(5,a=t.baseCollection),"singleLine"in t&&n(6,b=t.singleLine),"extraAutocompleteKeys"in t&&n(7,A=t.extraAutocompleteKeys),"disableRequestKeys"in t&&n(8,K=t.disableRequestKeys),"disableIndirectCollectionsKeys"in t&&n(9,C=t.disableIndirectCollectionsKeys)},e.$$.update=()=>{e.$$.dirty[0]&32&&n(13,L=ze(a)),e.$$.dirty[0]&25352&&!r&&(O!=L||K!==-1||C!==-1)&&(n(14,O=L),ee()),e.$$.dirty[0]&4&&g&&z(),e.$$.dirty[0]&2080&&f&&a!=null&&a.schema&&f.dispatch({effects:[F.reconfigure(Q())]}),e.$$.dirty[0]&6152&&f&&D!=r&&(f.dispatch({effects:[T.reconfigure(R.editable.of(!r)),U.reconfigure(I.readOnly.of(r))]}),n(12,D=r),V()),e.$$.dirty[0]&2050&&f&&s!=f.state.doc.toString()&&f.dispatch({changes:{from:0,to:f.state.doc.length,insert:s}}),e.$$.dirty[0]&2064&&f&&typeof l<"u"&&f.dispatch({effects:[W.reconfigure(j(l))]})},[w,s,g,r,l,a,b,A,K,C,B,f,D,L,O,ae]}class Ze extends le{constructor(o){super(),ce(this,o,Qe,Ge,ue,{id:2,value:1,disabled:3,placeholder:4,baseCollection:5,singleLine:6,extraAutocompleteKeys:7,disableRequestKeys:8,disableIndirectCollectionsKeys:9,focus:10},null,[-1,-1])}get focus(){return this.$$.ctx[10]}}export{Ze as default}; diff --git a/ui/dist/assets/FilterAutocompleteInput-ywiKWbDQ.js b/ui/dist/assets/FilterAutocompleteInput-ywiKWbDQ.js new file mode 100644 index 00000000..fac917bb --- /dev/null +++ b/ui/dist/assets/FilterAutocompleteInput-ywiKWbDQ.js @@ -0,0 +1 @@ +import{S as Z,i as $,s as ee,e as te,f as ne,g as re,x as D,o as ae,J as ie,K as oe,L as le,I as se,C as f,M as de}from"./index-z3vRI80T.js";import{E as w,a as E,h as ce,b as fe,c as ue,d as ge,e as he,s as ye,f as pe,g as me,r as ke,i as xe,k as be,j as we,l as Ee,m as Se,n as Ke,o as Ce,p as Re,q as Le,t as G,C as R,S as qe,u as ve,v as Oe}from"./index-8bZ4r7AC.js";function We(e){return new Worker(""+new URL("autocomplete.worker-8hFaOFLh.js",import.meta.url).href,{name:e==null?void 0:e.name})}function _e(e){V(e,"start");var n={},t=e.languageData||{},u=!1;for(var h in e)if(h!=t&&e.hasOwnProperty(h))for(var c=n[h]=[],i=e[h],a=0;a2&&i.token&&typeof i.token!="string"){t.pending=[];for(var s=2;s-1)return null;var h=t.indent.length-1,c=e[t.state];e:for(;;){for(var i=0;it(21,u=r));const h=le();let{id:c=""}=n,{value:i=""}=n,{disabled:a=!1}=n,{placeholder:l=""}=n,{baseCollection:s=null}=n,{singleLine:y=!1}=n,{extraAutocompleteKeys:L=[]}=n,{disableRequestKeys:b=!1}=n,{disableCollectionJoinKeys:k=!1}=n,d,p,q=a,I=new R,J=new R,M=new R,A=new R,v=new We,B=[],F=[],H=[],S="",O="";function W(){d==null||d.focus()}let _=null;v.onmessage=r=>{H=r.data.baseKeys||[],B=r.data.requestKeys||[],F=r.data.collectionJoinKeys||[]};function j(){clearTimeout(_),_=setTimeout(()=>{v.postMessage({baseCollection:s,collections:z(u),disableRequestKeys:b,disableCollectionJoinKeys:k})},250)}function z(r){let o=r.slice();return s&&f.pushOrReplaceByKey(o,s,"id"),o}function T(){p==null||p.dispatchEvent(new CustomEvent("change",{detail:{value:i},bubbles:!0}))}function U(){if(!c)return;const r=document.querySelectorAll('[for="'+c+'"]');for(let o of r)o.removeEventListener("click",W)}function N(){if(!c)return;U();const r=document.querySelectorAll('[for="'+c+'"]');for(let o of r)o.addEventListener("click",W)}function Q(r=!0,o=!0){let g=[].concat(L);return g=g.concat(H||[]),r&&(g=g.concat(B||[])),o&&(g=g.concat(F||[])),g}function X(r){var C;let o=r.matchBefore(/[\'\"\@\w\.]*/);if(o&&o.from==o.to&&!r.explicit)return null;let g=Oe(r.state).resolveInner(r.pos,-1);if(((C=g==null?void 0:g.type)==null?void 0:C.name)=="comment")return null;let x=[{label:"false"},{label:"true"},{label:"@now"},{label:"@second"},{label:"@minute"},{label:"@hour"},{label:"@year"},{label:"@day"},{label:"@month"},{label:"@weekday"},{label:"@todayStart"},{label:"@todayEnd"},{label:"@monthStart"},{label:"@monthEnd"},{label:"@yearStart"},{label:"@yearEnd"}];k||x.push({label:"@collection.*",apply:"@collection."});let K=Q(!b&&o.text.startsWith("@r"),!k&&o.text.startsWith("@c"));for(const m of K)x.push({label:m.endsWith(".")?m+"*":m,apply:m,boost:m.indexOf("_via_")>0?-1:0});return{from:o.from,options:x}}function P(){return qe.define(_e({start:[{regex:/true|false|null/,token:"atom"},{regex:/\/\/.*/,token:"comment"},{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},{regex:/\w+[\w\.]*\w+/,token:"keyword"},{regex:f.escapeRegExp("@now"),token:"keyword"},{regex:f.escapeRegExp("@second"),token:"keyword"},{regex:f.escapeRegExp("@minute"),token:"keyword"},{regex:f.escapeRegExp("@hour"),token:"keyword"},{regex:f.escapeRegExp("@year"),token:"keyword"},{regex:f.escapeRegExp("@day"),token:"keyword"},{regex:f.escapeRegExp("@month"),token:"keyword"},{regex:f.escapeRegExp("@weekday"),token:"keyword"},{regex:f.escapeRegExp("@todayStart"),token:"keyword"},{regex:f.escapeRegExp("@todayEnd"),token:"keyword"},{regex:f.escapeRegExp("@monthStart"),token:"keyword"},{regex:f.escapeRegExp("@monthEnd"),token:"keyword"},{regex:f.escapeRegExp("@yearStart"),token:"keyword"},{regex:f.escapeRegExp("@yearEnd"),token:"keyword"},{regex:f.escapeRegExp("@request.method"),token:"keyword"}],meta:{lineComment:"//"}}))}se(()=>{const r={key:"Enter",run:o=>{y&&h("submit",i)}};return N(),t(11,d=new w({parent:p,state:E.create({doc:i,extensions:[ce(),fe(),ue(),ge(),he(),E.allowMultipleSelections.of(!0),ye(ve,{fallback:!0}),pe(),me(),ke(),xe(),be.of([r,...we,...Ee,Se.find(o=>o.key==="Mod-d"),...Ke,...Ce,Re]),w.lineWrapping,Le({override:[X],icons:!1}),A.of(G(l)),J.of(w.editable.of(!a)),M.of(E.readOnly.of(a)),I.of(P()),E.transactionFilter.of(o=>{var g,x,K;if(y&&o.newDoc.lines>1){if(!((K=(x=(g=o.changes)==null?void 0:g.inserted)==null?void 0:x.filter(C=>!!C.text.find(m=>m)))!=null&&K.length))return[];o.newDoc.text=[o.newDoc.text.join(" ")]}return o}),w.updateListener.of(o=>{!o.docChanged||a||(t(1,i=o.state.doc.toString()),T())})]})})),()=>{clearTimeout(_),U(),d==null||d.destroy(),v.terminate()}});function Y(r){de[r?"unshift":"push"](()=>{p=r,t(0,p)})}return e.$$set=r=>{"id"in r&&t(2,c=r.id),"value"in r&&t(1,i=r.value),"disabled"in r&&t(3,a=r.disabled),"placeholder"in r&&t(4,l=r.placeholder),"baseCollection"in r&&t(5,s=r.baseCollection),"singleLine"in r&&t(6,y=r.singleLine),"extraAutocompleteKeys"in r&&t(7,L=r.extraAutocompleteKeys),"disableRequestKeys"in r&&t(8,b=r.disableRequestKeys),"disableCollectionJoinKeys"in r&&t(9,k=r.disableCollectionJoinKeys)},e.$$.update=()=>{e.$$.dirty[0]&32&&t(13,S=Fe(s)),e.$$.dirty[0]&25352&&!a&&(O!=S||b!==-1||k!==-1)&&(t(14,O=S),j()),e.$$.dirty[0]&4&&c&&N(),e.$$.dirty[0]&2080&&d&&s!=null&&s.schema&&d.dispatch({effects:[I.reconfigure(P())]}),e.$$.dirty[0]&6152&&d&&q!=a&&(d.dispatch({effects:[J.reconfigure(w.editable.of(!a)),M.reconfigure(E.readOnly.of(a))]}),t(12,q=a),T()),e.$$.dirty[0]&2050&&d&&i!=d.state.doc.toString()&&d.dispatch({changes:{from:0,to:d.state.doc.length,insert:i}}),e.$$.dirty[0]&2064&&d&&typeof l<"u"&&d.dispatch({effects:[A.reconfigure(G(l))]})},[p,i,c,a,l,s,y,L,b,k,W,d,q,S,O,Y]}class Ne extends Z{constructor(n){super(),$(this,n,He,Be,ee,{id:2,value:1,disabled:3,placeholder:4,baseCollection:5,singleLine:6,extraAutocompleteKeys:7,disableRequestKeys:8,disableCollectionJoinKeys:9,focus:10},null,[-1,-1])}get focus(){return this.$$.ctx[10]}}export{Ne as default}; diff --git a/ui/dist/assets/ListApiDocs-NLRpQyTo.js b/ui/dist/assets/ListApiDocs-Ej5naqCg.js similarity index 99% rename from ui/dist/assets/ListApiDocs-NLRpQyTo.js rename to ui/dist/assets/ListApiDocs-Ej5naqCg.js index 09188c9f..d3adaecf 100644 --- a/ui/dist/assets/ListApiDocs-NLRpQyTo.js +++ b/ui/dist/assets/ListApiDocs-Ej5naqCg.js @@ -1,4 +1,4 @@ -import{S as Ze,i as tl,s as el,e,b as s,E as sl,f as a,g as u,r as ll,x as Qe,o as m,v as _,h as t,N as Fe,O as se,c as Qt,m as Ut,w as ke,P as Ue,Q as nl,k as ol,R as al,n as il,t as $t,a as Ct,d as jt,T as rl,C as ve,A as cl,q as Le}from"./index-ydlV29Fj.js";import{S as dl}from"./SdkTabs-O6auDA6S.js";import{F as pl}from"./FieldsQueryParam--b6rO4n1.js";function fl(d){let n,o,i;return{c(){n=e("span"),n.textContent="Show details",o=s(),i=e("i"),a(n,"class","txt"),a(i,"class","ri-arrow-down-s-line")},m(f,h){u(f,n,h),u(f,o,h),u(f,i,h)},d(f){f&&(m(n),m(o),m(i))}}}function ul(d){let n,o,i;return{c(){n=e("span"),n.textContent="Hide details",o=s(),i=e("i"),a(n,"class","txt"),a(i,"class","ri-arrow-up-s-line")},m(f,h){u(f,n,h),u(f,o,h),u(f,i,h)},d(f){f&&(m(n),m(o),m(i))}}}function je(d){let n,o,i,f,h,r,b,$,C,g,p,tt,kt,zt,E,Kt,H,rt,R,et,ne,Q,U,oe,ct,yt,lt,vt,ae,dt,pt,st,N,Jt,Ft,y,nt,Lt,Vt,At,j,ot,Tt,Wt,Pt,F,ft,Rt,ie,ut,re,M,Ot,at,St,O,mt,ce,z,Et,Xt,Nt,de,q,Yt,K,ht,pe,I,fe,B,ue,P,qt,J,bt,me,gt,he,x,Dt,it,Ht,be,Mt,Zt,V,_t,ge,It,_e,wt,we,W,G,xe,xt,te,X,ee,L,Y,S,Bt,$e,Z,v,Gt;return{c(){n=e("p"),n.innerHTML=`The syntax basically follows the format +import{S as Ze,i as tl,s as el,e,b as s,E as sl,f as a,g as u,r as ll,x as Qe,o as m,v as _,h as t,N as Fe,O as se,c as Qt,m as Ut,w as ke,P as Ue,Q as nl,k as ol,R as al,n as il,t as $t,a as Ct,d as jt,T as rl,C as ve,A as cl,q as Le}from"./index-z3vRI80T.js";import{S as dl}from"./SdkTabs-gnoMubZE.js";import{F as pl}from"./FieldsQueryParam-QduFX_Q6.js";function fl(d){let n,o,i;return{c(){n=e("span"),n.textContent="Show details",o=s(),i=e("i"),a(n,"class","txt"),a(i,"class","ri-arrow-down-s-line")},m(f,h){u(f,n,h),u(f,o,h),u(f,i,h)},d(f){f&&(m(n),m(o),m(i))}}}function ul(d){let n,o,i;return{c(){n=e("span"),n.textContent="Hide details",o=s(),i=e("i"),a(n,"class","txt"),a(i,"class","ri-arrow-up-s-line")},m(f,h){u(f,n,h),u(f,o,h),u(f,i,h)},d(f){f&&(m(n),m(o),m(i))}}}function je(d){let n,o,i,f,h,r,b,$,C,g,p,tt,kt,zt,E,Kt,H,rt,R,et,ne,Q,U,oe,ct,yt,lt,vt,ae,dt,pt,st,N,Jt,Ft,y,nt,Lt,Vt,At,j,ot,Tt,Wt,Pt,F,ft,Rt,ie,ut,re,M,Ot,at,St,O,mt,ce,z,Et,Xt,Nt,de,q,Yt,K,ht,pe,I,fe,B,ue,P,qt,J,bt,me,gt,he,x,Dt,it,Ht,be,Mt,Zt,V,_t,ge,It,_e,wt,we,W,G,xe,xt,te,X,ee,L,Y,S,Bt,$e,Z,v,Gt;return{c(){n=e("p"),n.innerHTML=`The syntax basically follows the format OPERAND OPERATOR OPERAND, where:`,o=s(),i=e("ul"),f=e("li"),f.innerHTML=`OPERAND - could be any of the above field literal, string (single or double quoted), number, null, true, false`,h=s(),r=e("li"),b=e("code"),b.textContent="OPERATOR",$=_(` - is one of: `),C=e("br"),g=s(),p=e("ul"),tt=e("li"),kt=e("code"),kt.textContent="=",zt=s(),E=e("span"),E.textContent="Equal",Kt=s(),H=e("li"),rt=e("code"),rt.textContent="!=",R=s(),et=e("span"),et.textContent="NOT equal",ne=s(),Q=e("li"),U=e("code"),U.textContent=">",oe=s(),ct=e("span"),ct.textContent="Greater than",yt=s(),lt=e("li"),vt=e("code"),vt.textContent=">=",ae=s(),dt=e("span"),dt.textContent="Greater than or equal",pt=s(),st=e("li"),N=e("code"),N.textContent="<",Jt=s(),Ft=e("span"),Ft.textContent="Less than",y=s(),nt=e("li"),Lt=e("code"),Lt.textContent="<=",Vt=s(),At=e("span"),At.textContent="Less than or equal",j=s(),ot=e("li"),Tt=e("code"),Tt.textContent="~",Wt=s(),Pt=e("span"),Pt.textContent=`Like/Contains (if not specified auto wraps the right string OPERAND in a "%" for diff --git a/ui/dist/assets/ListExternalAuthsDocs-EllSY0vK.js b/ui/dist/assets/ListExternalAuthsDocs-0k6rNNq4.js similarity index 97% rename from ui/dist/assets/ListExternalAuthsDocs-EllSY0vK.js rename to ui/dist/assets/ListExternalAuthsDocs-0k6rNNq4.js index 11c1051c..171fcb5a 100644 --- a/ui/dist/assets/ListExternalAuthsDocs-EllSY0vK.js +++ b/ui/dist/assets/ListExternalAuthsDocs-0k6rNNq4.js @@ -1,4 +1,4 @@ -import{S as ze,i as Qe,s as Ue,O as F,e as i,v,b as m,c as pe,f as b,g as c,h as a,m as ue,w as N,P as Oe,Q as je,k as Fe,R as Ne,n as Ge,t as G,a as K,o as d,d as me,C as Ke,A as Je,q as J,r as Ve,N as Xe}from"./index-ydlV29Fj.js";import{S as Ye}from"./SdkTabs-O6auDA6S.js";import{F as Ze}from"./FieldsQueryParam--b6rO4n1.js";function De(o,l,s){const n=o.slice();return n[5]=l[s],n}function He(o,l,s){const n=o.slice();return n[5]=l[s],n}function Re(o,l){let s,n=l[5].code+"",f,_,r,u;function h(){return l[4](l[5])}return{key:o,first:null,c(){s=i("button"),f=v(n),_=m(),b(s,"class","tab-item"),J(s,"active",l[1]===l[5].code),this.first=s},m(w,y){c(w,s,y),a(s,f),a(s,_),r||(u=Ve(s,"click",h),r=!0)},p(w,y){l=w,y&4&&n!==(n=l[5].code+"")&&N(f,n),y&6&&J(s,"active",l[1]===l[5].code)},d(w){w&&d(s),r=!1,u()}}}function We(o,l){let s,n,f,_;return n=new Xe({props:{content:l[5].body}}),{key:o,first:null,c(){s=i("div"),pe(n.$$.fragment),f=m(),b(s,"class","tab-item"),J(s,"active",l[1]===l[5].code),this.first=s},m(r,u){c(r,s,u),ue(n,s,null),a(s,f),_=!0},p(r,u){l=r;const h={};u&4&&(h.content=l[5].body),n.$set(h),(!_||u&6)&&J(s,"active",l[1]===l[5].code)},i(r){_||(G(n.$$.fragment,r),_=!0)},o(r){K(n.$$.fragment,r),_=!1},d(r){r&&d(s),me(n)}}}function xe(o){var Te,Se,Ee,Ie;let l,s,n=o[0].name+"",f,_,r,u,h,w,y,R=o[0].name+"",V,be,fe,X,Y,P,Z,I,x,$,W,he,z,A,_e,ee,Q=o[0].name+"",te,ke,le,ve,ge,U,se,q,ae,B,oe,L,ne,C,ie,$e,ce,E,de,M,re,T,O,g=[],we=new Map,ye,D,k=[],Pe=new Map,S;P=new Ye({props:{js:` +import{S as ze,i as Qe,s as Ue,O as F,e as i,v,b as m,c as pe,f as b,g as c,h as a,m as ue,w as N,P as Oe,Q as je,k as Fe,R as Ne,n as Ge,t as G,a as K,o as d,d as me,C as Ke,A as Je,q as J,r as Ve,N as Xe}from"./index-z3vRI80T.js";import{S as Ye}from"./SdkTabs-gnoMubZE.js";import{F as Ze}from"./FieldsQueryParam-QduFX_Q6.js";function De(o,l,s){const n=o.slice();return n[5]=l[s],n}function He(o,l,s){const n=o.slice();return n[5]=l[s],n}function Re(o,l){let s,n=l[5].code+"",f,_,r,u;function h(){return l[4](l[5])}return{key:o,first:null,c(){s=i("button"),f=v(n),_=m(),b(s,"class","tab-item"),J(s,"active",l[1]===l[5].code),this.first=s},m(w,y){c(w,s,y),a(s,f),a(s,_),r||(u=Ve(s,"click",h),r=!0)},p(w,y){l=w,y&4&&n!==(n=l[5].code+"")&&N(f,n),y&6&&J(s,"active",l[1]===l[5].code)},d(w){w&&d(s),r=!1,u()}}}function We(o,l){let s,n,f,_;return n=new Xe({props:{content:l[5].body}}),{key:o,first:null,c(){s=i("div"),pe(n.$$.fragment),f=m(),b(s,"class","tab-item"),J(s,"active",l[1]===l[5].code),this.first=s},m(r,u){c(r,s,u),ue(n,s,null),a(s,f),_=!0},p(r,u){l=r;const h={};u&4&&(h.content=l[5].body),n.$set(h),(!_||u&6)&&J(s,"active",l[1]===l[5].code)},i(r){_||(G(n.$$.fragment,r),_=!0)},o(r){K(n.$$.fragment,r),_=!1},d(r){r&&d(s),me(n)}}}function xe(o){var Te,Se,Ee,Ie;let l,s,n=o[0].name+"",f,_,r,u,h,w,y,R=o[0].name+"",V,be,fe,X,Y,P,Z,I,x,$,W,he,z,A,_e,ee,Q=o[0].name+"",te,ke,le,ve,ge,U,se,q,ae,B,oe,L,ne,C,ie,$e,ce,E,de,M,re,T,O,g=[],we=new Map,ye,D,k=[],Pe=new Map,S;P=new Ye({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${o[3]}'); diff --git a/ui/dist/assets/PageAdminConfirmPasswordReset-s0lBz81f.js b/ui/dist/assets/PageAdminConfirmPasswordReset-QtrIhv_d.js similarity index 98% rename from ui/dist/assets/PageAdminConfirmPasswordReset-s0lBz81f.js rename to ui/dist/assets/PageAdminConfirmPasswordReset-QtrIhv_d.js index e8e30929..17848b8d 100644 --- a/ui/dist/assets/PageAdminConfirmPasswordReset-s0lBz81f.js +++ b/ui/dist/assets/PageAdminConfirmPasswordReset-QtrIhv_d.js @@ -1,2 +1,2 @@ -import{S as E,i as G,s as I,F as K,c as F,m as R,t as B,a as N,d as T,C as M,p as H,e as _,v as P,b as h,f,q as J,g as b,h as c,r as j,u as O,j as Q,l as U,o as w,z as V,A as L,B as X,D as Y,w as Z,y as q}from"./index-ydlV29Fj.js";function W(i){let e,n,s;return{c(){e=P("for "),n=_("strong"),s=P(i[3]),f(n,"class","txt-nowrap")},m(l,t){b(l,e,t),b(l,n,t),c(n,s)},p(l,t){t&8&&Z(s,l[3])},d(l){l&&(w(e),w(n))}}}function x(i){let e,n,s,l,t,u,p,d;return{c(){e=_("label"),n=P("New password"),l=h(),t=_("input"),f(e,"for",s=i[8]),f(t,"type","password"),f(t,"id",u=i[8]),t.required=!0,t.autofocus=!0},m(r,a){b(r,e,a),c(e,n),b(r,l,a),b(r,t,a),q(t,i[0]),t.focus(),p||(d=j(t,"input",i[6]),p=!0)},p(r,a){a&256&&s!==(s=r[8])&&f(e,"for",s),a&256&&u!==(u=r[8])&&f(t,"id",u),a&1&&t.value!==r[0]&&q(t,r[0])},d(r){r&&(w(e),w(l),w(t)),p=!1,d()}}}function ee(i){let e,n,s,l,t,u,p,d;return{c(){e=_("label"),n=P("New password confirm"),l=h(),t=_("input"),f(e,"for",s=i[8]),f(t,"type","password"),f(t,"id",u=i[8]),t.required=!0},m(r,a){b(r,e,a),c(e,n),b(r,l,a),b(r,t,a),q(t,i[1]),p||(d=j(t,"input",i[7]),p=!0)},p(r,a){a&256&&s!==(s=r[8])&&f(e,"for",s),a&256&&u!==(u=r[8])&&f(t,"id",u),a&2&&t.value!==r[1]&&q(t,r[1])},d(r){r&&(w(e),w(l),w(t)),p=!1,d()}}}function te(i){let e,n,s,l,t,u,p,d,r,a,g,S,k,v,C,A,y,m=i[3]&&W(i);return u=new H({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:o})=>({8:o}),({uniqueId:o})=>o?256:0]},$$scope:{ctx:i}}}),d=new H({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[ee,({uniqueId:o})=>({8:o}),({uniqueId:o})=>o?256:0]},$$scope:{ctx:i}}}),{c(){e=_("form"),n=_("div"),s=_("h4"),l=P(`Reset your admin password +import{S as E,i as G,s as I,F as K,c as F,m as R,t as B,a as N,d as T,C as M,p as H,e as _,v as P,b as h,f,q as J,g as b,h as c,r as j,u as O,j as Q,l as U,o as w,z as V,A as L,B as X,D as Y,w as Z,y as q}from"./index-z3vRI80T.js";function W(i){let e,n,s;return{c(){e=P("for "),n=_("strong"),s=P(i[3]),f(n,"class","txt-nowrap")},m(l,t){b(l,e,t),b(l,n,t),c(n,s)},p(l,t){t&8&&Z(s,l[3])},d(l){l&&(w(e),w(n))}}}function x(i){let e,n,s,l,t,u,p,d;return{c(){e=_("label"),n=P("New password"),l=h(),t=_("input"),f(e,"for",s=i[8]),f(t,"type","password"),f(t,"id",u=i[8]),t.required=!0,t.autofocus=!0},m(r,a){b(r,e,a),c(e,n),b(r,l,a),b(r,t,a),q(t,i[0]),t.focus(),p||(d=j(t,"input",i[6]),p=!0)},p(r,a){a&256&&s!==(s=r[8])&&f(e,"for",s),a&256&&u!==(u=r[8])&&f(t,"id",u),a&1&&t.value!==r[0]&&q(t,r[0])},d(r){r&&(w(e),w(l),w(t)),p=!1,d()}}}function ee(i){let e,n,s,l,t,u,p,d;return{c(){e=_("label"),n=P("New password confirm"),l=h(),t=_("input"),f(e,"for",s=i[8]),f(t,"type","password"),f(t,"id",u=i[8]),t.required=!0},m(r,a){b(r,e,a),c(e,n),b(r,l,a),b(r,t,a),q(t,i[1]),p||(d=j(t,"input",i[7]),p=!0)},p(r,a){a&256&&s!==(s=r[8])&&f(e,"for",s),a&256&&u!==(u=r[8])&&f(t,"id",u),a&2&&t.value!==r[1]&&q(t,r[1])},d(r){r&&(w(e),w(l),w(t)),p=!1,d()}}}function te(i){let e,n,s,l,t,u,p,d,r,a,g,S,k,v,C,A,y,m=i[3]&&W(i);return u=new H({props:{class:"form-field required",name:"password",$$slots:{default:[x,({uniqueId:o})=>({8:o}),({uniqueId:o})=>o?256:0]},$$scope:{ctx:i}}}),d=new H({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[ee,({uniqueId:o})=>({8:o}),({uniqueId:o})=>o?256:0]},$$scope:{ctx:i}}}),{c(){e=_("form"),n=_("div"),s=_("h4"),l=P(`Reset your admin password `),m&&m.c(),t=h(),F(u.$$.fragment),p=h(),F(d.$$.fragment),r=h(),a=_("button"),g=_("span"),g.textContent="Set new password",S=h(),k=_("div"),v=_("a"),v.textContent="Back to login",f(s,"class","m-b-xs"),f(n,"class","content txt-center m-b-sm"),f(g,"class","txt"),f(a,"type","submit"),f(a,"class","btn btn-lg btn-block"),a.disabled=i[2],J(a,"btn-loading",i[2]),f(e,"class","m-b-base"),f(v,"href","/login"),f(v,"class","link-hint"),f(k,"class","content txt-center")},m(o,$){b(o,e,$),c(e,n),c(n,s),c(s,l),m&&m.m(s,null),c(e,t),R(u,e,null),c(e,p),R(d,e,null),c(e,r),c(e,a),c(a,g),b(o,S,$),b(o,k,$),c(k,v),C=!0,A||(y=[j(e,"submit",O(i[4])),Q(U.call(null,v))],A=!0)},p(o,$){o[3]?m?m.p(o,$):(m=W(o),m.c(),m.m(s,null)):m&&(m.d(1),m=null);const z={};$&769&&(z.$$scope={dirty:$,ctx:o}),u.$set(z);const D={};$&770&&(D.$$scope={dirty:$,ctx:o}),d.$set(D),(!C||$&4)&&(a.disabled=o[2]),(!C||$&4)&&J(a,"btn-loading",o[2])},i(o){C||(B(u.$$.fragment,o),B(d.$$.fragment,o),C=!0)},o(o){N(u.$$.fragment,o),N(d.$$.fragment,o),C=!1},d(o){o&&(w(e),w(S),w(k)),m&&m.d(),T(u),T(d),A=!1,V(y)}}}function se(i){let e,n;return e=new K({props:{$$slots:{default:[te]},$$scope:{ctx:i}}}),{c(){F(e.$$.fragment)},m(s,l){R(e,s,l),n=!0},p(s,[l]){const t={};l&527&&(t.$$scope={dirty:l,ctx:s}),e.$set(t)},i(s){n||(B(e.$$.fragment,s),n=!0)},o(s){N(e.$$.fragment,s),n=!1},d(s){T(e,s)}}}function le(i,e,n){let s,{params:l}=e,t="",u="",p=!1;async function d(){if(!p){n(2,p=!0);try{await L.admins.confirmPasswordReset(l==null?void 0:l.token,t,u),X("Successfully set a new admin password."),Y("/")}catch(g){L.error(g)}n(2,p=!1)}}function r(){t=this.value,n(0,t)}function a(){u=this.value,n(1,u)}return i.$$set=g=>{"params"in g&&n(5,l=g.params)},i.$$.update=()=>{i.$$.dirty&32&&n(3,s=M.getJWTPayload(l==null?void 0:l.token).email||"")},[t,u,p,s,d,l,r,a]}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-iIhRW4sL.js b/ui/dist/assets/PageAdminRequestPasswordReset-FK_-0PXf.js similarity index 98% rename from ui/dist/assets/PageAdminRequestPasswordReset-iIhRW4sL.js rename to ui/dist/assets/PageAdminRequestPasswordReset-FK_-0PXf.js index 0a6b2c96..53534e3c 100644 --- a/ui/dist/assets/PageAdminRequestPasswordReset-iIhRW4sL.js +++ b/ui/dist/assets/PageAdminRequestPasswordReset-FK_-0PXf.js @@ -1 +1 @@ -import{S as H,i as M,s as T,F as j,c as L,m as R,t as w,a as y,d as S,b as v,e as _,f as p,g,h as d,j as B,l as N,k as z,n as D,o as k,A as C,p as G,q as F,r as E,u as I,v as h,w as J,x as P,y as A}from"./index-ydlV29Fj.js";function K(u){let e,s,n,l,t,i,c,m,r,a,b,f;return l=new G({props:{class:"form-field required",name:"email",$$slots:{default:[Q,({uniqueId:o})=>({5:o}),({uniqueId:o})=>o?32:0]},$$scope:{ctx:u}}}),{c(){e=_("form"),s=_("div"),s.innerHTML='

Forgotten admin password

Enter the email associated with your account and we’ll send you a recovery link:

',n=v(),L(l.$$.fragment),t=v(),i=_("button"),c=_("i"),m=v(),r=_("span"),r.textContent="Send recovery link",p(s,"class","content txt-center m-b-sm"),p(c,"class","ri-mail-send-line"),p(r,"class","txt"),p(i,"type","submit"),p(i,"class","btn btn-lg btn-block"),i.disabled=u[1],F(i,"btn-loading",u[1]),p(e,"class","m-b-base")},m(o,$){g(o,e,$),d(e,s),d(e,n),R(l,e,null),d(e,t),d(e,i),d(i,c),d(i,m),d(i,r),a=!0,b||(f=E(e,"submit",I(u[3])),b=!0)},p(o,$){const q={};$&97&&(q.$$scope={dirty:$,ctx:o}),l.$set(q),(!a||$&2)&&(i.disabled=o[1]),(!a||$&2)&&F(i,"btn-loading",o[1])},i(o){a||(w(l.$$.fragment,o),a=!0)},o(o){y(l.$$.fragment,o),a=!1},d(o){o&&k(e),S(l),b=!1,f()}}}function O(u){let e,s,n,l,t,i,c,m,r;return{c(){e=_("div"),s=_("div"),s.innerHTML='',n=v(),l=_("div"),t=_("p"),i=h("Check "),c=_("strong"),m=h(u[0]),r=h(" for the recovery link."),p(s,"class","icon"),p(c,"class","txt-nowrap"),p(l,"class","content"),p(e,"class","alert alert-success")},m(a,b){g(a,e,b),d(e,s),d(e,n),d(e,l),d(l,t),d(t,i),d(t,c),d(c,m),d(t,r)},p(a,b){b&1&&J(m,a[0])},i:P,o:P,d(a){a&&k(e)}}}function Q(u){let e,s,n,l,t,i,c,m;return{c(){e=_("label"),s=h("Email"),l=v(),t=_("input"),p(e,"for",n=u[5]),p(t,"type","email"),p(t,"id",i=u[5]),t.required=!0,t.autofocus=!0},m(r,a){g(r,e,a),d(e,s),g(r,l,a),g(r,t,a),A(t,u[0]),t.focus(),c||(m=E(t,"input",u[4]),c=!0)},p(r,a){a&32&&n!==(n=r[5])&&p(e,"for",n),a&32&&i!==(i=r[5])&&p(t,"id",i),a&1&&t.value!==r[0]&&A(t,r[0])},d(r){r&&(k(e),k(l),k(t)),c=!1,m()}}}function U(u){let e,s,n,l,t,i,c,m;const r=[O,K],a=[];function b(f,o){return f[2]?0:1}return e=b(u),s=a[e]=r[e](u),{c(){s.c(),n=v(),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(f,o){a[e].m(f,o),g(f,n,o),g(f,l,o),d(l,t),i=!0,c||(m=B(N.call(null,t)),c=!0)},p(f,o){let $=e;e=b(f),e===$?a[e].p(f,o):(z(),y(a[$],1,1,()=>{a[$]=null}),D(),s=a[e],s?s.p(f,o):(s=a[e]=r[e](f),s.c()),w(s,1),s.m(n.parentNode,n))},i(f){i||(w(s),i=!0)},o(f){y(s),i=!1},d(f){f&&(k(n),k(l)),a[e].d(f),c=!1,m()}}}function V(u){let e,s;return e=new j({props:{$$slots:{default:[U]},$$scope:{ctx:u}}}),{c(){L(e.$$.fragment)},m(n,l){R(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(u,e,s){let n="",l=!1,t=!1;async function i(){if(!l){s(1,l=!0);try{await C.admins.requestPasswordReset(n),s(2,t=!0)}catch(m){C.error(m)}s(1,l=!1)}}function c(){n=this.value,s(0,n)}return[n,l,t,i,c]}class Y extends H{constructor(e){super(),M(this,e,W,V,T,{})}}export{Y as default}; +import{S as H,i as M,s as T,F as j,c as L,m as R,t as w,a as y,d as S,b as v,e as _,f as p,g,h as d,j as B,l as N,k as z,n as D,o as k,A as C,p as G,q as F,r as E,u as I,v as h,w as J,x as P,y as A}from"./index-z3vRI80T.js";function K(u){let e,s,n,l,t,i,c,m,r,a,b,f;return l=new G({props:{class:"form-field required",name:"email",$$slots:{default:[Q,({uniqueId:o})=>({5:o}),({uniqueId:o})=>o?32:0]},$$scope:{ctx:u}}}),{c(){e=_("form"),s=_("div"),s.innerHTML='

Forgotten admin password

Enter the email associated with your account and we’ll send you a recovery link:

',n=v(),L(l.$$.fragment),t=v(),i=_("button"),c=_("i"),m=v(),r=_("span"),r.textContent="Send recovery link",p(s,"class","content txt-center m-b-sm"),p(c,"class","ri-mail-send-line"),p(r,"class","txt"),p(i,"type","submit"),p(i,"class","btn btn-lg btn-block"),i.disabled=u[1],F(i,"btn-loading",u[1]),p(e,"class","m-b-base")},m(o,$){g(o,e,$),d(e,s),d(e,n),R(l,e,null),d(e,t),d(e,i),d(i,c),d(i,m),d(i,r),a=!0,b||(f=E(e,"submit",I(u[3])),b=!0)},p(o,$){const q={};$&97&&(q.$$scope={dirty:$,ctx:o}),l.$set(q),(!a||$&2)&&(i.disabled=o[1]),(!a||$&2)&&F(i,"btn-loading",o[1])},i(o){a||(w(l.$$.fragment,o),a=!0)},o(o){y(l.$$.fragment,o),a=!1},d(o){o&&k(e),S(l),b=!1,f()}}}function O(u){let e,s,n,l,t,i,c,m,r;return{c(){e=_("div"),s=_("div"),s.innerHTML='',n=v(),l=_("div"),t=_("p"),i=h("Check "),c=_("strong"),m=h(u[0]),r=h(" for the recovery link."),p(s,"class","icon"),p(c,"class","txt-nowrap"),p(l,"class","content"),p(e,"class","alert alert-success")},m(a,b){g(a,e,b),d(e,s),d(e,n),d(e,l),d(l,t),d(t,i),d(t,c),d(c,m),d(t,r)},p(a,b){b&1&&J(m,a[0])},i:P,o:P,d(a){a&&k(e)}}}function Q(u){let e,s,n,l,t,i,c,m;return{c(){e=_("label"),s=h("Email"),l=v(),t=_("input"),p(e,"for",n=u[5]),p(t,"type","email"),p(t,"id",i=u[5]),t.required=!0,t.autofocus=!0},m(r,a){g(r,e,a),d(e,s),g(r,l,a),g(r,t,a),A(t,u[0]),t.focus(),c||(m=E(t,"input",u[4]),c=!0)},p(r,a){a&32&&n!==(n=r[5])&&p(e,"for",n),a&32&&i!==(i=r[5])&&p(t,"id",i),a&1&&t.value!==r[0]&&A(t,r[0])},d(r){r&&(k(e),k(l),k(t)),c=!1,m()}}}function U(u){let e,s,n,l,t,i,c,m;const r=[O,K],a=[];function b(f,o){return f[2]?0:1}return e=b(u),s=a[e]=r[e](u),{c(){s.c(),n=v(),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(f,o){a[e].m(f,o),g(f,n,o),g(f,l,o),d(l,t),i=!0,c||(m=B(N.call(null,t)),c=!0)},p(f,o){let $=e;e=b(f),e===$?a[e].p(f,o):(z(),y(a[$],1,1,()=>{a[$]=null}),D(),s=a[e],s?s.p(f,o):(s=a[e]=r[e](f),s.c()),w(s,1),s.m(n.parentNode,n))},i(f){i||(w(s),i=!0)},o(f){y(s),i=!1},d(f){f&&(k(n),k(l)),a[e].d(f),c=!1,m()}}}function V(u){let e,s;return e=new j({props:{$$slots:{default:[U]},$$scope:{ctx:u}}}),{c(){L(e.$$.fragment)},m(n,l){R(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(u,e,s){let n="",l=!1,t=!1;async function i(){if(!l){s(1,l=!0);try{await C.admins.requestPasswordReset(n),s(2,t=!0)}catch(m){C.error(m)}s(1,l=!1)}}function c(){n=this.value,s(0,n)}return[n,l,t,i,c]}class Y extends H{constructor(e){super(),M(this,e,W,V,T,{})}}export{Y as default}; diff --git a/ui/dist/assets/PageOAuth2RedirectFailure-GoHDOiB1.js b/ui/dist/assets/PageOAuth2RedirectFailure-OjogN9-X.js similarity index 86% rename from ui/dist/assets/PageOAuth2RedirectFailure-GoHDOiB1.js rename to ui/dist/assets/PageOAuth2RedirectFailure-OjogN9-X.js index b6855014..d21a6a4e 100644 --- a/ui/dist/assets/PageOAuth2RedirectFailure-GoHDOiB1.js +++ b/ui/dist/assets/PageOAuth2RedirectFailure-OjogN9-X.js @@ -1 +1 @@ -import{S as o,i,s as c,e as r,f as l,g as u,x as a,o as d,I as h}from"./index-ydlV29Fj.js";function f(n){let t;return{c(){t=r("div"),t.innerHTML='

Auth failed.

You can close this window and go back to the app to try again.
',l(t,"class","content txt-hint txt-center p-base")},m(e,s){u(e,t,s)},p:a,i:a,o:a,d(e){e&&d(t)}}}function p(n){return h(()=>{window.close()}),[]}class x extends o{constructor(t){super(),i(this,t,p,f,c,{})}}export{x as default}; +import{S as o,i,s as c,e as r,f as l,g as u,x as a,o as d,I as h}from"./index-z3vRI80T.js";function f(n){let t;return{c(){t=r("div"),t.innerHTML='

Auth failed.

You can close this window and go back to the app to try again.
',l(t,"class","content txt-hint txt-center p-base")},m(e,s){u(e,t,s)},p:a,i:a,o:a,d(e){e&&d(t)}}}function p(n){return h(()=>{window.close()}),[]}class x extends o{constructor(t){super(),i(this,t,p,f,c,{})}}export{x as default}; diff --git a/ui/dist/assets/PageOAuth2RedirectSuccess-N-jghl3J.js b/ui/dist/assets/PageOAuth2RedirectSuccess-T7Wnqyzu.js similarity index 86% rename from ui/dist/assets/PageOAuth2RedirectSuccess-N-jghl3J.js rename to ui/dist/assets/PageOAuth2RedirectSuccess-T7Wnqyzu.js index 98d541ed..66015d73 100644 --- a/ui/dist/assets/PageOAuth2RedirectSuccess-N-jghl3J.js +++ b/ui/dist/assets/PageOAuth2RedirectSuccess-T7Wnqyzu.js @@ -1 +1 @@ -import{S as o,i as c,s as i,e as r,f as u,g as l,x as s,o as d,I as h}from"./index-ydlV29Fj.js";function p(n){let t;return{c(){t=r("div"),t.innerHTML='

Auth completed.

You can close this window and go back to the app.
',u(t,"class","content txt-hint txt-center p-base")},m(e,a){l(e,t,a)},p:s,i:s,o:s,d(e){e&&d(t)}}}function f(n){return h(()=>{window.close()}),[]}class x extends o{constructor(t){super(),c(this,t,f,p,i,{})}}export{x as default}; +import{S as o,i as c,s as i,e as r,f as u,g as l,x as s,o as d,I as h}from"./index-z3vRI80T.js";function p(n){let t;return{c(){t=r("div"),t.innerHTML='

Auth completed.

You can close this window and go back to the app.
',u(t,"class","content txt-hint txt-center p-base")},m(e,a){l(e,t,a)},p:s,i:s,o:s,d(e){e&&d(t)}}}function f(n){return h(()=>{window.close()}),[]}class x extends o{constructor(t){super(),c(this,t,f,p,i,{})}}export{x as default}; diff --git a/ui/dist/assets/PageRecordConfirmEmailChange-TP7r406s.js b/ui/dist/assets/PageRecordConfirmEmailChange--1lZH6Oc.js similarity index 98% rename from ui/dist/assets/PageRecordConfirmEmailChange-TP7r406s.js rename to ui/dist/assets/PageRecordConfirmEmailChange--1lZH6Oc.js index 56ed63f8..79aefd04 100644 --- a/ui/dist/assets/PageRecordConfirmEmailChange-TP7r406s.js +++ b/ui/dist/assets/PageRecordConfirmEmailChange--1lZH6Oc.js @@ -1,2 +1,2 @@ -import{S as G,i as I,s as J,F as M,c as S,m as A,t as h,a as v,d as L,C as N,E as R,g as _,k as W,n as Y,o as b,G as j,H as z,A as B,p as D,e as m,v as y,b as C,f as p,q as T,h as g,r as P,u as K,x as E,w as O,y as F}from"./index-ydlV29Fj.js";function Q(i){let e,t,n,l,s,o,f,a,r,u,k,$,d=i[3]&&H(i);return o=new D({props:{class:"form-field required",name:"password",$$slots:{default:[V,({uniqueId:c})=>({8:c}),({uniqueId:c})=>c?256:0]},$$scope:{ctx:i}}}),{c(){e=m("form"),t=m("div"),n=m("h5"),l=y(`Type your password to confirm changing your email address +import{S as G,i as I,s as J,F as M,c as S,m as A,t as h,a as v,d as L,C as N,E as R,g as _,k as W,n as Y,o as b,G as j,H as z,A as B,p as D,e as m,v as y,b as C,f as p,q as T,h as g,r as P,u as K,x as E,w as O,y as F}from"./index-z3vRI80T.js";function Q(i){let e,t,n,l,s,o,f,a,r,u,k,$,d=i[3]&&H(i);return o=new D({props:{class:"form-field required",name:"password",$$slots:{default:[V,({uniqueId:c})=>({8:c}),({uniqueId:c})=>c?256:0]},$$scope:{ctx:i}}}),{c(){e=m("form"),t=m("div"),n=m("h5"),l=y(`Type your password to confirm changing your email address `),d&&d.c(),s=C(),S(o.$$.fragment),f=C(),a=m("button"),r=m("span"),r.textContent="Confirm new email",p(t,"class","content txt-center m-b-base"),p(r,"class","txt"),p(a,"type","submit"),p(a,"class","btn btn-lg btn-block"),a.disabled=i[1],T(a,"btn-loading",i[1])},m(c,w){_(c,e,w),g(e,t),g(t,n),g(n,l),d&&d.m(n,null),g(e,s),A(o,e,null),g(e,f),g(e,a),g(a,r),u=!0,k||($=P(e,"submit",K(i[4])),k=!0)},p(c,w){c[3]?d?d.p(c,w):(d=H(c),d.c(),d.m(n,null)):d&&(d.d(1),d=null);const q={};w&769&&(q.$$scope={dirty:w,ctx:c}),o.$set(q),(!u||w&2)&&(a.disabled=c[1]),(!u||w&2)&&T(a,"btn-loading",c[1])},i(c){u||(h(o.$$.fragment,c),u=!0)},o(c){v(o.$$.fragment,c),u=!1},d(c){c&&b(e),d&&d.d(),L(o),k=!1,$()}}}function U(i){let e,t,n,l,s;return{c(){e=m("div"),e.innerHTML='

Successfully changed the user email address.

You can now sign in with your new email address.

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

Invalid or expired verification token.

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

Successfully verified email address.

',s=_(),e=f("button"),e.textContent="Close",d(t,"class","alert alert-success"),d(e,"type","button"),d(e,"class","btn btn-transparent btn-block")},m(i,o){r(i,t,o),r(i,s,o),r(i,e,o),n||(l=b(e,"click",c[3]),n=!0)},p,d(i){i&&(a(t),a(s),a(e)),n=!1,l()}}}function F(c){let t;return{c(){t=f("div"),t.innerHTML='
Please wait...
',d(t,"class","txt-center")},m(s,e){r(s,t,e)},p,d(s){s&&a(t)}}}function I(c){let t;function s(l,i){return l[1]?F:l[0]?h:S}let e=s(c),n=e(c);return{c(){n.c(),t=M()},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){l&&a(t),n.d(l)}}}function V(c){let t,s;return t=new w({props:{nobranding:!0,$$slots:{default:[I]},$$scope:{ctx:c}}}),{c(){x(t.$$.fragment)},m(e,n){C(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(c,t,s){let{params:e}=t,n=!1,l=!1;i();async function i(){s(1,l=!0);const u=new P("../");try{const m=T(e==null?void 0:e.token);await u.collection(m.collectionId).confirmVerification(e==null?void 0:e.token),s(0,n=!0)}catch{s(0,n=!1)}s(1,l=!1)}const o=()=>window.close(),k=()=>window.close();return c.$$set=u=>{"params"in u&&s(2,e=u.params)},[n,l,e,o,k]}class G extends v{constructor(t){super(),y(this,t,q,V,g,{params:2})}}export{G as default}; +import{S as v,i as y,s as g,F as w,c as x,m as C,t as $,a as H,d as L,G as P,H as T,E as M,g as r,o as a,e as f,b as _,f as d,r as b,x as p}from"./index-z3vRI80T.js";function S(c){let t,s,e,n,l;return{c(){t=f("div"),t.innerHTML='

Invalid or expired verification token.

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

Successfully verified email address.

',s=_(),e=f("button"),e.textContent="Close",d(t,"class","alert alert-success"),d(e,"type","button"),d(e,"class","btn btn-transparent btn-block")},m(i,o){r(i,t,o),r(i,s,o),r(i,e,o),n||(l=b(e,"click",c[3]),n=!0)},p,d(i){i&&(a(t),a(s),a(e)),n=!1,l()}}}function F(c){let t;return{c(){t=f("div"),t.innerHTML='
Please wait...
',d(t,"class","txt-center")},m(s,e){r(s,t,e)},p,d(s){s&&a(t)}}}function I(c){let t;function s(l,i){return l[1]?F:l[0]?h:S}let e=s(c),n=e(c);return{c(){n.c(),t=M()},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){l&&a(t),n.d(l)}}}function V(c){let t,s;return t=new w({props:{nobranding:!0,$$slots:{default:[I]},$$scope:{ctx:c}}}),{c(){x(t.$$.fragment)},m(e,n){C(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(c,t,s){let{params:e}=t,n=!1,l=!1;i();async function i(){s(1,l=!0);const u=new P("../");try{const m=T(e==null?void 0:e.token);await u.collection(m.collectionId).confirmVerification(e==null?void 0:e.token),s(0,n=!0)}catch{s(0,n=!1)}s(1,l=!1)}const o=()=>window.close(),k=()=>window.close();return c.$$set=u=>{"params"in u&&s(2,e=u.params)},[n,l,e,o,k]}class G extends v{constructor(t){super(),y(this,t,q,V,g,{params:2})}}export{G as default}; diff --git a/ui/dist/assets/RealtimeApiDocs-QEFv858u.js b/ui/dist/assets/RealtimeApiDocs-2yYxyEgN.js similarity index 98% rename from ui/dist/assets/RealtimeApiDocs-QEFv858u.js rename to ui/dist/assets/RealtimeApiDocs-2yYxyEgN.js index 5757427a..976830f4 100644 --- a/ui/dist/assets/RealtimeApiDocs-QEFv858u.js +++ b/ui/dist/assets/RealtimeApiDocs-2yYxyEgN.js @@ -1,4 +1,4 @@ -import{S as re,i as ae,s as be,N as pe,C as P,e as p,v as y,b as a,c as se,f as u,g as s,h as I,m as ne,w as ue,t as ie,a as ce,o as n,d as le,A as me}from"./index-ydlV29Fj.js";import{S as de}from"./SdkTabs-O6auDA6S.js";function he(t){var B,U,A,W,H,L,T,q,M,N,j,J;let i,m,c=t[0].name+"",b,d,k,h,D,f,_,l,C,$,S,g,w,v,E,r,R;return l=new de({props:{js:` +import{S as re,i as ae,s as be,N as pe,C as P,e as p,v as y,b as a,c as se,f as u,g as s,h as I,m as ne,w as ue,t as ie,a as ce,o as n,d as le,A as me}from"./index-z3vRI80T.js";import{S as de}from"./SdkTabs-gnoMubZE.js";function he(t){var B,U,A,W,H,L,T,q,M,N,j,J;let i,m,c=t[0].name+"",b,d,k,h,D,f,_,l,C,$,S,g,w,v,E,r,R;return l=new de({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${t[1]}'); diff --git a/ui/dist/assets/RequestEmailChangeDocs-OR_qP7_j.js b/ui/dist/assets/RequestEmailChangeDocs-J7AVBZVY.js similarity index 98% rename from ui/dist/assets/RequestEmailChangeDocs-OR_qP7_j.js rename to ui/dist/assets/RequestEmailChangeDocs-J7AVBZVY.js index 671697c9..cacc114b 100644 --- a/ui/dist/assets/RequestEmailChangeDocs-OR_qP7_j.js +++ b/ui/dist/assets/RequestEmailChangeDocs-J7AVBZVY.js @@ -1,4 +1,4 @@ -import{S as Ee,i as Be,s as Se,O as L,e as r,v,b as k,c as Ce,f as b,g as d,h as n,m as ye,w as N,P as ve,Q as Ae,k as Re,R as Me,n as We,t as ee,a as te,o as m,d as Te,C as ze,A as He,q as F,r as Oe,N as Ue}from"./index-ydlV29Fj.js";import{S as je}from"./SdkTabs-O6auDA6S.js";function we(o,l,a){const s=o.slice();return s[5]=l[a],s}function $e(o,l,a){const s=o.slice();return s[5]=l[a],s}function qe(o,l){let a,s=l[5].code+"",h,f,i,p;function u(){return l[4](l[5])}return{key:o,first:null,c(){a=r("button"),h=v(s),f=k(),b(a,"class","tab-item"),F(a,"active",l[1]===l[5].code),this.first=a},m($,q){d($,a,q),n(a,h),n(a,f),i||(p=Oe(a,"click",u),i=!0)},p($,q){l=$,q&4&&s!==(s=l[5].code+"")&&N(h,s),q&6&&F(a,"active",l[1]===l[5].code)},d($){$&&m(a),i=!1,p()}}}function Pe(o,l){let a,s,h,f;return s=new Ue({props:{content:l[5].body}}),{key:o,first:null,c(){a=r("div"),Ce(s.$$.fragment),h=k(),b(a,"class","tab-item"),F(a,"active",l[1]===l[5].code),this.first=a},m(i,p){d(i,a,p),ye(s,a,null),n(a,h),f=!0},p(i,p){l=i;const u={};p&4&&(u.content=l[5].body),s.$set(u),(!f||p&6)&&F(a,"active",l[1]===l[5].code)},i(i){f||(ee(s.$$.fragment,i),f=!0)},o(i){te(s.$$.fragment,i),f=!1},d(i){i&&m(a),Te(s)}}}function De(o){var pe,ue,be,fe;let l,a,s=o[0].name+"",h,f,i,p,u,$,q,z=o[0].name+"",I,le,K,P,Q,T,G,w,H,ae,O,E,se,J,U=o[0].name+"",V,oe,ne,j,X,B,Y,S,Z,A,x,C,R,g=[],ie=new Map,ce,M,_=[],re=new Map,y;P=new je({props:{js:` +import{S as Ee,i as Be,s as Se,O as L,e as r,v,b as k,c as Ce,f as b,g as d,h as n,m as ye,w as N,P as ve,Q as Ae,k as Re,R as Me,n as We,t as ee,a as te,o as m,d as Te,C as ze,A as He,q as F,r as Oe,N as Ue}from"./index-z3vRI80T.js";import{S as je}from"./SdkTabs-gnoMubZE.js";function we(o,l,a){const s=o.slice();return s[5]=l[a],s}function $e(o,l,a){const s=o.slice();return s[5]=l[a],s}function qe(o,l){let a,s=l[5].code+"",h,f,i,p;function u(){return l[4](l[5])}return{key:o,first:null,c(){a=r("button"),h=v(s),f=k(),b(a,"class","tab-item"),F(a,"active",l[1]===l[5].code),this.first=a},m($,q){d($,a,q),n(a,h),n(a,f),i||(p=Oe(a,"click",u),i=!0)},p($,q){l=$,q&4&&s!==(s=l[5].code+"")&&N(h,s),q&6&&F(a,"active",l[1]===l[5].code)},d($){$&&m(a),i=!1,p()}}}function Pe(o,l){let a,s,h,f;return s=new Ue({props:{content:l[5].body}}),{key:o,first:null,c(){a=r("div"),Ce(s.$$.fragment),h=k(),b(a,"class","tab-item"),F(a,"active",l[1]===l[5].code),this.first=a},m(i,p){d(i,a,p),ye(s,a,null),n(a,h),f=!0},p(i,p){l=i;const u={};p&4&&(u.content=l[5].body),s.$set(u),(!f||p&6)&&F(a,"active",l[1]===l[5].code)},i(i){f||(ee(s.$$.fragment,i),f=!0)},o(i){te(s.$$.fragment,i),f=!1},d(i){i&&m(a),Te(s)}}}function De(o){var pe,ue,be,fe;let l,a,s=o[0].name+"",h,f,i,p,u,$,q,z=o[0].name+"",I,le,K,P,Q,T,G,w,H,ae,O,E,se,J,U=o[0].name+"",V,oe,ne,j,X,B,Y,S,Z,A,x,C,R,g=[],ie=new Map,ce,M,_=[],re=new Map,y;P=new je({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${o[3]}'); diff --git a/ui/dist/assets/RequestPasswordResetDocs-ueBKJVu4.js b/ui/dist/assets/RequestPasswordResetDocs-CDKXdjxv.js similarity index 97% rename from ui/dist/assets/RequestPasswordResetDocs-ueBKJVu4.js rename to ui/dist/assets/RequestPasswordResetDocs-CDKXdjxv.js index 333eb499..ce78720c 100644 --- a/ui/dist/assets/RequestPasswordResetDocs-ueBKJVu4.js +++ b/ui/dist/assets/RequestPasswordResetDocs-CDKXdjxv.js @@ -1,4 +1,4 @@ -import{S as Pe,i as $e,s as qe,O as I,e as r,v as g,b as h,c as ve,f as b,g as d,h as n,m as ge,w as L,P as fe,Q as ye,k as Re,R as Ce,n as Be,t as x,a as ee,o as p,d as we,C as Se,A as Te,q as N,r as Ae,N as Me}from"./index-ydlV29Fj.js";import{S as Ue}from"./SdkTabs-O6auDA6S.js";function be(o,s,l){const a=o.slice();return a[5]=s[l],a}function _e(o,s,l){const a=o.slice();return a[5]=s[l],a}function ke(o,s){let l,a=s[5].code+"",_,f,i,m;function u(){return s[4](s[5])}return{key:o,first:null,c(){l=r("button"),_=g(a),f=h(),b(l,"class","tab-item"),N(l,"active",s[1]===s[5].code),this.first=l},m(w,P){d(w,l,P),n(l,_),n(l,f),i||(m=Ae(l,"click",u),i=!0)},p(w,P){s=w,P&4&&a!==(a=s[5].code+"")&&L(_,a),P&6&&N(l,"active",s[1]===s[5].code)},d(w){w&&p(l),i=!1,m()}}}function he(o,s){let l,a,_,f;return a=new Me({props:{content:s[5].body}}),{key:o,first:null,c(){l=r("div"),ve(a.$$.fragment),_=h(),b(l,"class","tab-item"),N(l,"active",s[1]===s[5].code),this.first=l},m(i,m){d(i,l,m),ge(a,l,null),n(l,_),f=!0},p(i,m){s=i;const u={};m&4&&(u.content=s[5].body),a.$set(u),(!f||m&6)&&N(l,"active",s[1]===s[5].code)},i(i){f||(x(a.$$.fragment,i),f=!0)},o(i){ee(a.$$.fragment,i),f=!1},d(i){i&&p(l),we(a)}}}function je(o){var de,pe;let s,l,a=o[0].name+"",_,f,i,m,u,w,P,D=o[0].name+"",Q,te,z,$,G,C,J,q,H,se,O,B,le,K,E=o[0].name+"",V,ae,W,S,X,T,Y,A,Z,y,M,v=[],oe=new Map,ne,U,k=[],ie=new Map,R;$=new Ue({props:{js:` +import{S as Pe,i as $e,s as qe,O as I,e as r,v as g,b as h,c as ve,f as b,g as d,h as n,m as ge,w as L,P as fe,Q as ye,k as Re,R as Ce,n as Be,t as x,a as ee,o as p,d as we,C as Se,A as Te,q as N,r as Ae,N as Me}from"./index-z3vRI80T.js";import{S as Ue}from"./SdkTabs-gnoMubZE.js";function be(o,s,l){const a=o.slice();return a[5]=s[l],a}function _e(o,s,l){const a=o.slice();return a[5]=s[l],a}function ke(o,s){let l,a=s[5].code+"",_,f,i,m;function u(){return s[4](s[5])}return{key:o,first:null,c(){l=r("button"),_=g(a),f=h(),b(l,"class","tab-item"),N(l,"active",s[1]===s[5].code),this.first=l},m(w,P){d(w,l,P),n(l,_),n(l,f),i||(m=Ae(l,"click",u),i=!0)},p(w,P){s=w,P&4&&a!==(a=s[5].code+"")&&L(_,a),P&6&&N(l,"active",s[1]===s[5].code)},d(w){w&&p(l),i=!1,m()}}}function he(o,s){let l,a,_,f;return a=new Me({props:{content:s[5].body}}),{key:o,first:null,c(){l=r("div"),ve(a.$$.fragment),_=h(),b(l,"class","tab-item"),N(l,"active",s[1]===s[5].code),this.first=l},m(i,m){d(i,l,m),ge(a,l,null),n(l,_),f=!0},p(i,m){s=i;const u={};m&4&&(u.content=s[5].body),a.$set(u),(!f||m&6)&&N(l,"active",s[1]===s[5].code)},i(i){f||(x(a.$$.fragment,i),f=!0)},o(i){ee(a.$$.fragment,i),f=!1},d(i){i&&p(l),we(a)}}}function je(o){var de,pe;let s,l,a=o[0].name+"",_,f,i,m,u,w,P,D=o[0].name+"",Q,te,z,$,G,C,J,q,H,se,O,B,le,K,E=o[0].name+"",V,ae,W,S,X,T,Y,A,Z,y,M,v=[],oe=new Map,ne,U,k=[],ie=new Map,R;$=new Ue({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${o[3]}'); diff --git a/ui/dist/assets/RequestVerificationDocs-G73EyzMY.js b/ui/dist/assets/RequestVerificationDocs-LGhIAfd9.js similarity index 97% rename from ui/dist/assets/RequestVerificationDocs-G73EyzMY.js rename to ui/dist/assets/RequestVerificationDocs-LGhIAfd9.js index 148d0867..cdcac4f2 100644 --- a/ui/dist/assets/RequestVerificationDocs-G73EyzMY.js +++ b/ui/dist/assets/RequestVerificationDocs-LGhIAfd9.js @@ -1,4 +1,4 @@ -import{S as qe,i as we,s as Pe,O as F,e as r,v as g,b as h,c as ve,f as b,g as d,h as n,m as ge,w as I,P as pe,Q as ye,k as Ce,R as Be,n as Se,t as x,a as ee,o as f,d as $e,C as Te,A as Ae,q as L,r as Re,N as Ve}from"./index-ydlV29Fj.js";import{S as Me}from"./SdkTabs-O6auDA6S.js";function be(o,l,s){const a=o.slice();return a[5]=l[s],a}function _e(o,l,s){const a=o.slice();return a[5]=l[s],a}function ke(o,l){let s,a=l[5].code+"",_,p,i,m;function u(){return l[4](l[5])}return{key:o,first:null,c(){s=r("button"),_=g(a),p=h(),b(s,"class","tab-item"),L(s,"active",l[1]===l[5].code),this.first=s},m($,q){d($,s,q),n(s,_),n(s,p),i||(m=Re(s,"click",u),i=!0)},p($,q){l=$,q&4&&a!==(a=l[5].code+"")&&I(_,a),q&6&&L(s,"active",l[1]===l[5].code)},d($){$&&f(s),i=!1,m()}}}function he(o,l){let s,a,_,p;return a=new Ve({props:{content:l[5].body}}),{key:o,first:null,c(){s=r("div"),ve(a.$$.fragment),_=h(),b(s,"class","tab-item"),L(s,"active",l[1]===l[5].code),this.first=s},m(i,m){d(i,s,m),ge(a,s,null),n(s,_),p=!0},p(i,m){l=i;const u={};m&4&&(u.content=l[5].body),a.$set(u),(!p||m&6)&&L(s,"active",l[1]===l[5].code)},i(i){p||(x(a.$$.fragment,i),p=!0)},o(i){ee(a.$$.fragment,i),p=!1},d(i){i&&f(s),$e(a)}}}function Ue(o){var de,fe;let l,s,a=o[0].name+"",_,p,i,m,u,$,q,j=o[0].name+"",N,te,Q,w,z,B,G,P,D,le,H,S,se,J,O=o[0].name+"",K,ae,W,T,X,A,Y,R,Z,y,V,v=[],oe=new Map,ne,M,k=[],ie=new Map,C;w=new Me({props:{js:` +import{S as qe,i as we,s as Pe,O as F,e as r,v as g,b as h,c as ve,f as b,g as d,h as n,m as ge,w as I,P as pe,Q as ye,k as Ce,R as Be,n as Se,t as x,a as ee,o as f,d as $e,C as Te,A as Ae,q as L,r as Re,N as Ve}from"./index-z3vRI80T.js";import{S as Me}from"./SdkTabs-gnoMubZE.js";function be(o,l,s){const a=o.slice();return a[5]=l[s],a}function _e(o,l,s){const a=o.slice();return a[5]=l[s],a}function ke(o,l){let s,a=l[5].code+"",_,p,i,m;function u(){return l[4](l[5])}return{key:o,first:null,c(){s=r("button"),_=g(a),p=h(),b(s,"class","tab-item"),L(s,"active",l[1]===l[5].code),this.first=s},m($,q){d($,s,q),n(s,_),n(s,p),i||(m=Re(s,"click",u),i=!0)},p($,q){l=$,q&4&&a!==(a=l[5].code+"")&&I(_,a),q&6&&L(s,"active",l[1]===l[5].code)},d($){$&&f(s),i=!1,m()}}}function he(o,l){let s,a,_,p;return a=new Ve({props:{content:l[5].body}}),{key:o,first:null,c(){s=r("div"),ve(a.$$.fragment),_=h(),b(s,"class","tab-item"),L(s,"active",l[1]===l[5].code),this.first=s},m(i,m){d(i,s,m),ge(a,s,null),n(s,_),p=!0},p(i,m){l=i;const u={};m&4&&(u.content=l[5].body),a.$set(u),(!p||m&6)&&L(s,"active",l[1]===l[5].code)},i(i){p||(x(a.$$.fragment,i),p=!0)},o(i){ee(a.$$.fragment,i),p=!1},d(i){i&&f(s),$e(a)}}}function Ue(o){var de,fe;let l,s,a=o[0].name+"",_,p,i,m,u,$,q,j=o[0].name+"",N,te,Q,w,z,B,G,P,D,le,H,S,se,J,O=o[0].name+"",K,ae,W,T,X,A,Y,R,Z,y,V,v=[],oe=new Map,ne,M,k=[],ie=new Map,C;w=new Me({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${o[3]}'); diff --git a/ui/dist/assets/SdkTabs-O6auDA6S.js b/ui/dist/assets/SdkTabs-gnoMubZE.js similarity index 98% rename from ui/dist/assets/SdkTabs-O6auDA6S.js rename to ui/dist/assets/SdkTabs-gnoMubZE.js index 47ee331a..ee2f31b2 100644 --- a/ui/dist/assets/SdkTabs-O6auDA6S.js +++ b/ui/dist/assets/SdkTabs-gnoMubZE.js @@ -1 +1 @@ -import{S as B,i as F,s as J,O as j,e as v,b as S,f as h,g as y,h as m,P as D,Q as O,k as Q,R as Y,n as z,t as N,a as P,o as C,v as w,q as E,r as A,w as T,N as G,c as H,m as L,d as U}from"./index-ydlV29Fj.js";function K(o,e,l){const s=o.slice();return s[6]=e[l],s}function R(o,e,l){const s=o.slice();return s[6]=e[l],s}function q(o,e){let l,s,g=e[6].title+"",r,i,n,k;function c(){return e[5](e[6])}return{key:o,first:null,c(){l=v("button"),s=v("div"),r=w(g),i=S(),h(s,"class","txt"),h(l,"class","tab-item svelte-1maocj6"),E(l,"active",e[1]===e[6].language),this.first=l},m(_,f){y(_,l,f),m(l,s),m(s,r),m(l,i),n||(k=A(l,"click",c),n=!0)},p(_,f){e=_,f&4&&g!==(g=e[6].title+"")&&T(r,g),f&6&&E(l,"active",e[1]===e[6].language)},d(_){_&&C(l),n=!1,k()}}}function I(o,e){let l,s,g,r,i,n,k=e[6].title+"",c,_,f,p,d;return s=new G({props:{language:e[6].language,content:e[6].content}}),{key:o,first:null,c(){l=v("div"),H(s.$$.fragment),g=S(),r=v("div"),i=v("em"),n=v("a"),c=w(k),_=w(" SDK"),p=S(),h(n,"href",f=e[6].url),h(n,"target","_blank"),h(n,"rel","noopener noreferrer"),h(i,"class","txt-sm txt-hint"),h(r,"class","txt-right"),h(l,"class","tab-item svelte-1maocj6"),E(l,"active",e[1]===e[6].language),this.first=l},m(b,t){y(b,l,t),L(s,l,null),m(l,g),m(l,r),m(r,i),m(i,n),m(n,c),m(n,_),m(l,p),d=!0},p(b,t){e=b;const a={};t&4&&(a.language=e[6].language),t&4&&(a.content=e[6].content),s.$set(a),(!d||t&4)&&k!==(k=e[6].title+"")&&T(c,k),(!d||t&4&&f!==(f=e[6].url))&&h(n,"href",f),(!d||t&6)&&E(l,"active",e[1]===e[6].language)},i(b){d||(N(s.$$.fragment,b),d=!0)},o(b){P(s.$$.fragment,b),d=!1},d(b){b&&C(l),U(s)}}}function V(o){let e,l,s=[],g=new Map,r,i,n=[],k=new Map,c,_,f=j(o[2]);const p=t=>t[6].language;for(let t=0;tt[6].language;for(let t=0;tl(1,n=c.language);return o.$$set=c=>{"class"in c&&l(0,g=c.class),"js"in c&&l(3,r=c.js),"dart"in c&&l(4,i=c.dart)},o.$$.update=()=>{o.$$.dirty&2&&n&&localStorage.setItem(M,n),o.$$.dirty&24&&l(2,s=[{title:"JavaScript",language:"javascript",content:r,url:"https://github.com/pocketbase/js-sdk"},{title:"Dart",language:"dart",content:i,url:"https://github.com/pocketbase/dart-sdk"}])},[g,n,s,r,i,k]}class Z extends B{constructor(e){super(),F(this,e,W,V,J,{class:0,js:3,dart:4})}}export{Z as S}; +import{S as B,i as F,s as J,O as j,e as v,b as S,f as h,g as y,h as m,P as D,Q as O,k as Q,R as Y,n as z,t as N,a as P,o as C,v as w,q as E,r as A,w as T,N as G,c as H,m as L,d as U}from"./index-z3vRI80T.js";function K(o,e,l){const s=o.slice();return s[6]=e[l],s}function R(o,e,l){const s=o.slice();return s[6]=e[l],s}function q(o,e){let l,s,g=e[6].title+"",r,i,n,k;function c(){return e[5](e[6])}return{key:o,first:null,c(){l=v("button"),s=v("div"),r=w(g),i=S(),h(s,"class","txt"),h(l,"class","tab-item svelte-1maocj6"),E(l,"active",e[1]===e[6].language),this.first=l},m(_,f){y(_,l,f),m(l,s),m(s,r),m(l,i),n||(k=A(l,"click",c),n=!0)},p(_,f){e=_,f&4&&g!==(g=e[6].title+"")&&T(r,g),f&6&&E(l,"active",e[1]===e[6].language)},d(_){_&&C(l),n=!1,k()}}}function I(o,e){let l,s,g,r,i,n,k=e[6].title+"",c,_,f,p,d;return s=new G({props:{language:e[6].language,content:e[6].content}}),{key:o,first:null,c(){l=v("div"),H(s.$$.fragment),g=S(),r=v("div"),i=v("em"),n=v("a"),c=w(k),_=w(" SDK"),p=S(),h(n,"href",f=e[6].url),h(n,"target","_blank"),h(n,"rel","noopener noreferrer"),h(i,"class","txt-sm txt-hint"),h(r,"class","txt-right"),h(l,"class","tab-item svelte-1maocj6"),E(l,"active",e[1]===e[6].language),this.first=l},m(b,t){y(b,l,t),L(s,l,null),m(l,g),m(l,r),m(r,i),m(i,n),m(n,c),m(n,_),m(l,p),d=!0},p(b,t){e=b;const a={};t&4&&(a.language=e[6].language),t&4&&(a.content=e[6].content),s.$set(a),(!d||t&4)&&k!==(k=e[6].title+"")&&T(c,k),(!d||t&4&&f!==(f=e[6].url))&&h(n,"href",f),(!d||t&6)&&E(l,"active",e[1]===e[6].language)},i(b){d||(N(s.$$.fragment,b),d=!0)},o(b){P(s.$$.fragment,b),d=!1},d(b){b&&C(l),U(s)}}}function V(o){let e,l,s=[],g=new Map,r,i,n=[],k=new Map,c,_,f=j(o[2]);const p=t=>t[6].language;for(let t=0;tt[6].language;for(let t=0;tl(1,n=c.language);return o.$$set=c=>{"class"in c&&l(0,g=c.class),"js"in c&&l(3,r=c.js),"dart"in c&&l(4,i=c.dart)},o.$$.update=()=>{o.$$.dirty&2&&n&&localStorage.setItem(M,n),o.$$.dirty&24&&l(2,s=[{title:"JavaScript",language:"javascript",content:r,url:"https://github.com/pocketbase/js-sdk"},{title:"Dart",language:"dart",content:i,url:"https://github.com/pocketbase/dart-sdk"}])},[g,n,s,r,i,k]}class Z extends B{constructor(e){super(),F(this,e,W,V,J,{class:0,js:3,dart:4})}}export{Z as S}; diff --git a/ui/dist/assets/UnlinkExternalAuthDocs-52aa8RZW.js b/ui/dist/assets/UnlinkExternalAuthDocs-Qe14c8ks.js similarity index 98% rename from ui/dist/assets/UnlinkExternalAuthDocs-52aa8RZW.js rename to ui/dist/assets/UnlinkExternalAuthDocs-Qe14c8ks.js index 1caa1e32..73e18c70 100644 --- a/ui/dist/assets/UnlinkExternalAuthDocs-52aa8RZW.js +++ b/ui/dist/assets/UnlinkExternalAuthDocs-Qe14c8ks.js @@ -1,4 +1,4 @@ -import{S as Oe,i as De,s as Me,O as j,e as i,v as g,b as f,c as Be,f as h,g as d,h as a,m as qe,w as I,P as ye,Q as We,k as ze,R as He,n as Le,t as oe,a as ae,o as u,d as Ue,C as Re,A as je,q as N,r as Ie,N as Ne}from"./index-ydlV29Fj.js";import{S as Ke}from"./SdkTabs-O6auDA6S.js";function Ce(n,l,o){const s=n.slice();return s[5]=l[o],s}function Te(n,l,o){const s=n.slice();return s[5]=l[o],s}function Ee(n,l){let o,s=l[5].code+"",_,b,c,p;function m(){return l[4](l[5])}return{key:n,first:null,c(){o=i("button"),_=g(s),b=f(),h(o,"class","tab-item"),N(o,"active",l[1]===l[5].code),this.first=o},m($,P){d($,o,P),a(o,_),a(o,b),c||(p=Ie(o,"click",m),c=!0)},p($,P){l=$,P&4&&s!==(s=l[5].code+"")&&I(_,s),P&6&&N(o,"active",l[1]===l[5].code)},d($){$&&u(o),c=!1,p()}}}function Se(n,l){let o,s,_,b;return s=new Ne({props:{content:l[5].body}}),{key:n,first:null,c(){o=i("div"),Be(s.$$.fragment),_=f(),h(o,"class","tab-item"),N(o,"active",l[1]===l[5].code),this.first=o},m(c,p){d(c,o,p),qe(s,o,null),a(o,_),b=!0},p(c,p){l=c;const m={};p&4&&(m.content=l[5].body),s.$set(m),(!b||p&6)&&N(o,"active",l[1]===l[5].code)},i(c){b||(oe(s.$$.fragment,c),b=!0)},o(c){ae(s.$$.fragment,c),b=!1},d(c){c&&u(o),Ue(s)}}}function Qe(n){var _e,ke,ge,ve;let l,o,s=n[0].name+"",_,b,c,p,m,$,P,M=n[0].name+"",K,se,ne,Q,F,y,G,E,J,w,W,ie,z,A,ce,V,H=n[0].name+"",X,re,Y,de,Z,ue,L,x,S,ee,B,te,q,le,C,U,v=[],pe=new Map,me,O,k=[],he=new Map,T;y=new Ke({props:{js:` +import{S as Oe,i as De,s as Me,O as j,e as i,v as g,b as f,c as Be,f as h,g as d,h as a,m as qe,w as I,P as ye,Q as We,k as ze,R as He,n as Le,t as oe,a as ae,o as u,d as Ue,C as Re,A as je,q as N,r as Ie,N as Ne}from"./index-z3vRI80T.js";import{S as Ke}from"./SdkTabs-gnoMubZE.js";function Ce(n,l,o){const s=n.slice();return s[5]=l[o],s}function Te(n,l,o){const s=n.slice();return s[5]=l[o],s}function Ee(n,l){let o,s=l[5].code+"",_,b,c,p;function m(){return l[4](l[5])}return{key:n,first:null,c(){o=i("button"),_=g(s),b=f(),h(o,"class","tab-item"),N(o,"active",l[1]===l[5].code),this.first=o},m($,P){d($,o,P),a(o,_),a(o,b),c||(p=Ie(o,"click",m),c=!0)},p($,P){l=$,P&4&&s!==(s=l[5].code+"")&&I(_,s),P&6&&N(o,"active",l[1]===l[5].code)},d($){$&&u(o),c=!1,p()}}}function Se(n,l){let o,s,_,b;return s=new Ne({props:{content:l[5].body}}),{key:n,first:null,c(){o=i("div"),Be(s.$$.fragment),_=f(),h(o,"class","tab-item"),N(o,"active",l[1]===l[5].code),this.first=o},m(c,p){d(c,o,p),qe(s,o,null),a(o,_),b=!0},p(c,p){l=c;const m={};p&4&&(m.content=l[5].body),s.$set(m),(!b||p&6)&&N(o,"active",l[1]===l[5].code)},i(c){b||(oe(s.$$.fragment,c),b=!0)},o(c){ae(s.$$.fragment,c),b=!1},d(c){c&&u(o),Ue(s)}}}function Qe(n){var _e,ke,ge,ve;let l,o,s=n[0].name+"",_,b,c,p,m,$,P,M=n[0].name+"",K,se,ne,Q,F,y,G,E,J,w,W,ie,z,A,ce,V,H=n[0].name+"",X,re,Y,de,Z,ue,L,x,S,ee,B,te,q,le,C,U,v=[],pe=new Map,me,O,k=[],he=new Map,T;y=new Ke({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${n[3]}'); diff --git a/ui/dist/assets/UpdateApiDocs-KIEJUGwi.js b/ui/dist/assets/UpdateApiDocs-GDKV_HSc.js similarity index 98% rename from ui/dist/assets/UpdateApiDocs-KIEJUGwi.js rename to ui/dist/assets/UpdateApiDocs-GDKV_HSc.js index 4950bbe1..70bad891 100644 --- a/ui/dist/assets/UpdateApiDocs-KIEJUGwi.js +++ b/ui/dist/assets/UpdateApiDocs-GDKV_HSc.js @@ -1,4 +1,4 @@ -import{S as $t,i as Mt,s as qt,C as I,O as Z,N as Ot,e as r,v as b,b as f,c as he,f as v,g as i,h as s,m as ye,w as J,P as Ee,Q as _t,k as Ht,R as Rt,n as Dt,t as ce,a as pe,o as d,d as ke,A as Lt,q as ve,r as Pt,x as ee}from"./index-ydlV29Fj.js";import{S as Ft}from"./SdkTabs-O6auDA6S.js";import{F as At}from"./FieldsQueryParam--b6rO4n1.js";function ht(c,e,t){const n=c.slice();return n[8]=e[t],n}function yt(c,e,t){const n=c.slice();return n[8]=e[t],n}function kt(c,e,t){const n=c.slice();return n[13]=e[t],n}function vt(c){let e;return{c(){e=r("p"),e.innerHTML=`Note that in case of a password change all previously issued tokens for the current record +import{S as $t,i as Mt,s as qt,C as I,O as Z,N as Ot,e as r,v as b,b as f,c as he,f as v,g as i,h as s,m as ye,w as J,P as Ee,Q as _t,k as Ht,R as Rt,n as Dt,t as ce,a as pe,o as d,d as ke,A as Lt,q as ve,r as Pt,x as ee}from"./index-z3vRI80T.js";import{S as Ft}from"./SdkTabs-gnoMubZE.js";import{F as At}from"./FieldsQueryParam-QduFX_Q6.js";function ht(c,e,t){const n=c.slice();return n[8]=e[t],n}function yt(c,e,t){const n=c.slice();return n[8]=e[t],n}function kt(c,e,t){const n=c.slice();return n[13]=e[t],n}function vt(c){let e;return{c(){e=r("p"),e.innerHTML=`Note that in case of a password change all previously issued tokens for the current record will be automatically invalidated and if you want your user to remain signed in you need to reauthenticate manually after the update call.`},m(t,n){i(t,e,n)},d(t){t&&d(e)}}}function gt(c){let e;return{c(){e=r("p"),e.innerHTML="Requires admin Authorization:TOKEN header",v(e,"class","txt-hint txt-sm txt-right")},m(t,n){i(t,e,n)},d(t){t&&d(e)}}}function wt(c){let e,t,n,u,m,o,p,h,w,S,g,$,P,E,M,U,F;return{c(){e=r("tr"),e.innerHTML='Auth fields',t=f(),n=r("tr"),n.innerHTML='
Optional username
String The username of the auth record.',u=f(),m=r("tr"),m.innerHTML=`
Optional email
String The auth record email address.
diff --git a/ui/dist/assets/ViewApiDocs-4M1eVMku.js b/ui/dist/assets/ViewApiDocs-EPId3tA7.js similarity index 97% rename from ui/dist/assets/ViewApiDocs-4M1eVMku.js rename to ui/dist/assets/ViewApiDocs-EPId3tA7.js index 4f46c5bf..1cb8716b 100644 --- a/ui/dist/assets/ViewApiDocs-4M1eVMku.js +++ b/ui/dist/assets/ViewApiDocs-EPId3tA7.js @@ -1,4 +1,4 @@ -import{S as lt,i as nt,s as st,N as tt,O as K,e as o,v as _,b as m,c as W,f as b,g as r,h as l,m as X,w as ve,P as Je,Q as ot,k as at,R as it,n as rt,t as Q,a as U,o as d,d as Y,C as Ke,A as dt,q as Z,r as ct}from"./index-ydlV29Fj.js";import{S as pt}from"./SdkTabs-O6auDA6S.js";import{F as ut}from"./FieldsQueryParam--b6rO4n1.js";function We(a,n,s){const i=a.slice();return i[6]=n[s],i}function Xe(a,n,s){const i=a.slice();return i[6]=n[s],i}function Ye(a){let n;return{c(){n=o("p"),n.innerHTML="Requires admin Authorization:TOKEN header",b(n,"class","txt-hint txt-sm txt-right")},m(s,i){r(s,n,i)},d(s){s&&d(n)}}}function Ze(a,n){let s,i,v;function p(){return n[5](n[6])}return{key:a,first:null,c(){s=o("button"),s.textContent=`${n[6].code} `,b(s,"class","tab-item"),Z(s,"active",n[2]===n[6].code),this.first=s},m(c,f){r(c,s,f),i||(v=ct(s,"click",p),i=!0)},p(c,f){n=c,f&20&&Z(s,"active",n[2]===n[6].code)},d(c){c&&d(s),i=!1,v()}}}function et(a,n){let s,i,v,p;return i=new tt({props:{content:n[6].body}}),{key:a,first:null,c(){s=o("div"),W(i.$$.fragment),v=m(),b(s,"class","tab-item"),Z(s,"active",n[2]===n[6].code),this.first=s},m(c,f){r(c,s,f),X(i,s,null),l(s,v),p=!0},p(c,f){n=c,(!p||f&20)&&Z(s,"active",n[2]===n[6].code)},i(c){p||(Q(i.$$.fragment,c),p=!0)},o(c){U(i.$$.fragment,c),p=!1},d(c){c&&d(s),Y(i)}}}function ft(a){var je,Ve;let n,s,i=a[0].name+"",v,p,c,f,w,C,ee,j=a[0].name+"",te,$e,le,F,ne,S,se,$,V,ye,z,T,we,oe,G=a[0].name+"",ae,Ce,ie,Fe,re,B,de,q,ce,x,pe,R,ue,Re,I,O,fe,Oe,me,Pe,h,De,A,Te,Ae,Ee,be,Se,_e,Be,qe,xe,he,Ie,Me,E,ke,M,ge,P,H,y=[],He=new Map,Le,L,k=[],Ne=new Map,D;F=new pt({props:{js:` +import{S as lt,i as nt,s as st,N as tt,O as K,e as o,v as _,b as m,c as W,f as b,g as r,h as l,m as X,w as ve,P as Je,Q as ot,k as at,R as it,n as rt,t as Q,a as U,o as d,d as Y,C as Ke,A as dt,q as Z,r as ct}from"./index-z3vRI80T.js";import{S as pt}from"./SdkTabs-gnoMubZE.js";import{F as ut}from"./FieldsQueryParam-QduFX_Q6.js";function We(a,n,s){const i=a.slice();return i[6]=n[s],i}function Xe(a,n,s){const i=a.slice();return i[6]=n[s],i}function Ye(a){let n;return{c(){n=o("p"),n.innerHTML="Requires admin Authorization:TOKEN header",b(n,"class","txt-hint txt-sm txt-right")},m(s,i){r(s,n,i)},d(s){s&&d(n)}}}function Ze(a,n){let s,i,v;function p(){return n[5](n[6])}return{key:a,first:null,c(){s=o("button"),s.textContent=`${n[6].code} `,b(s,"class","tab-item"),Z(s,"active",n[2]===n[6].code),this.first=s},m(c,f){r(c,s,f),i||(v=ct(s,"click",p),i=!0)},p(c,f){n=c,f&20&&Z(s,"active",n[2]===n[6].code)},d(c){c&&d(s),i=!1,v()}}}function et(a,n){let s,i,v,p;return i=new tt({props:{content:n[6].body}}),{key:a,first:null,c(){s=o("div"),W(i.$$.fragment),v=m(),b(s,"class","tab-item"),Z(s,"active",n[2]===n[6].code),this.first=s},m(c,f){r(c,s,f),X(i,s,null),l(s,v),p=!0},p(c,f){n=c,(!p||f&20)&&Z(s,"active",n[2]===n[6].code)},i(c){p||(Q(i.$$.fragment,c),p=!0)},o(c){U(i.$$.fragment,c),p=!1},d(c){c&&d(s),Y(i)}}}function ft(a){var je,Ve;let n,s,i=a[0].name+"",v,p,c,f,w,C,ee,j=a[0].name+"",te,$e,le,F,ne,S,se,$,V,ye,z,T,we,oe,G=a[0].name+"",ae,Ce,ie,Fe,re,B,de,q,ce,x,pe,R,ue,Re,I,O,fe,Oe,me,Pe,h,De,A,Te,Ae,Ee,be,Se,_e,Be,qe,xe,he,Ie,Me,E,ke,M,ge,P,H,y=[],He=new Map,Le,L,k=[],Ne=new Map,D;F=new pt({props:{js:` import PocketBase from 'pocketbase'; const pb = new PocketBase('${a[3]}'); diff --git a/ui/dist/assets/autocomplete.worker-8hFaOFLh.js b/ui/dist/assets/autocomplete.worker-8hFaOFLh.js new file mode 100644 index 00000000..01b7fabb --- /dev/null +++ b/ui/dist/assets/autocomplete.worker-8hFaOFLh.js @@ -0,0 +1,4 @@ +(function(){"use strict";class P extends Error{}class $n extends P{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Zn extends P{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Un extends P{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class j extends P{}class at extends P{constructor(e){super(`Invalid unit ${e}`)}}class D extends P{}class Z extends P{constructor(){super("Zone is an abstract class")}}const c="numeric",C="short",M="long",ge={year:c,month:c,day:c},ot={year:c,month:C,day:c},qn={year:c,month:C,day:c,weekday:C},ut={year:c,month:M,day:c},lt={year:c,month:M,day:c,weekday:M},ct={hour:c,minute:c},ft={hour:c,minute:c,second:c},dt={hour:c,minute:c,second:c,timeZoneName:C},ht={hour:c,minute:c,second:c,timeZoneName:M},mt={hour:c,minute:c,hourCycle:"h23"},yt={hour:c,minute:c,second:c,hourCycle:"h23"},gt={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:C},pt={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:M},wt={year:c,month:c,day:c,hour:c,minute:c},St={year:c,month:c,day:c,hour:c,minute:c,second:c},kt={year:c,month:C,day:c,hour:c,minute:c},Tt={year:c,month:C,day:c,hour:c,minute:c,second:c},zn={year:c,month:C,day:c,weekday:C,hour:c,minute:c},Ot={year:c,month:M,day:c,hour:c,minute:c,timeZoneName:C},Nt={year:c,month:M,day:c,hour:c,minute:c,second:c,timeZoneName:C},Et={year:c,month:M,day:c,weekday:M,hour:c,minute:c,timeZoneName:M},xt={year:c,month:M,day:c,weekday:M,hour:c,minute:c,second:c,timeZoneName:M};class ie{get type(){throw new Z}get name(){throw new Z}get ianaName(){return this.name}get isUniversal(){throw new Z}offsetName(e,t){throw new Z}formatOffset(e,t){throw new Z}offset(e){throw new Z}equals(e){throw new Z}get isValid(){throw new Z}}let Ce=null;class pe extends ie{static get instance(){return Ce===null&&(Ce=new pe),Ce}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return Kt(e,t,n)}formatOffset(e,t){return le(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let we={};function Pn(s){return we[s]||(we[s]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),we[s]}const Yn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Jn(s,e){const t=s.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,r,i,a,o,u,l,f]=n;return[a,r,i,o,u,l,f]}function Bn(s,e){const t=s.formatToParts(e),n=[];for(let r=0;r=0?O:1e3+O,(p-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let bt={};function Gn(s,e={}){const t=JSON.stringify([s,e]);let n=bt[t];return n||(n=new Intl.ListFormat(s,e),bt[t]=n),n}let We={};function Le(s,e={}){const t=JSON.stringify([s,e]);let n=We[t];return n||(n=new Intl.DateTimeFormat(s,e),We[t]=n),n}let Re={};function jn(s,e={}){const t=JSON.stringify([s,e]);let n=Re[t];return n||(n=new Intl.NumberFormat(s,e),Re[t]=n),n}let $e={};function Kn(s,e={}){const{base:t,...n}=e,r=JSON.stringify([s,n]);let i=$e[r];return i||(i=new Intl.RelativeTimeFormat(s,e),$e[r]=i),i}let ae=null;function Hn(){return ae||(ae=new Intl.DateTimeFormat().resolvedOptions().locale,ae)}let It={};function _n(s){let e=It[s];if(!e){const t=new Intl.Locale(s);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,It[s]=e}return e}function Qn(s){const e=s.indexOf("-x-");e!==-1&&(s=s.substring(0,e));const t=s.indexOf("-u-");if(t===-1)return[s];{let n,r;try{n=Le(s).resolvedOptions(),r=s}catch{const u=s.substring(0,t);n=Le(u).resolvedOptions(),r=u}const{numberingSystem:i,calendar:a}=n;return[r,i,a]}}function Xn(s,e,t){return(t||e)&&(s.includes("-u-")||(s+="-u"),t&&(s+=`-ca-${t}`),e&&(s+=`-nu-${e}`)),s}function es(s){const e=[];for(let t=1;t<=12;t++){const n=g.utc(2009,t,1);e.push(s(n))}return e}function ts(s){const e=[];for(let t=1;t<=7;t++){const n=g.utc(2016,11,13+t);e.push(s(n))}return e}function ke(s,e,t,n){const r=s.listingMode();return r==="error"?null:r==="en"?t(e):n(e)}function ns(s){return s.numberingSystem&&s.numberingSystem!=="latn"?!1:s.numberingSystem==="latn"||!s.locale||s.locale.startsWith("en")||new Intl.DateTimeFormat(s.intl).resolvedOptions().numberingSystem==="latn"}class ss{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;const{padTo:r,floor:i,...a}=n;if(!t||Object.keys(a).length>0){const o={useGrouping:!1,...n};n.padTo>0&&(o.minimumIntegerDigits=n.padTo),this.inf=jn(e,o)}}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):Je(e,3);return b(t,this.padTo)}}}class rs{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const a=-1*(e.offset/60),o=a>=0?`Etc/GMT+${a}`:`Etc/GMT${a}`;e.offset!==0&&$.create(o).valid?(r=o,this.dt=e):(r="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=Le(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const n=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:n}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class is{constructor(e,t,n){this.opts={style:"long",...n},!t&&Jt()&&(this.rtf=Kn(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):xs(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const as={firstDay:1,minimalDays:4,weekend:[6,7]};class T{static fromOpts(e){return T.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,n,r,i=!1){const a=e||x.defaultLocale,o=a||(i?"en-US":Hn()),u=t||x.defaultNumberingSystem,l=n||x.defaultOutputCalendar,f=Pe(r)||x.defaultWeekSettings;return new T(o,u,l,f,a)}static resetCache(){ae=null,We={},Re={},$e={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:n,weekSettings:r}={}){return T.create(e,t,n,r)}constructor(e,t,n,r,i){const[a,o,u]=Qn(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=n||u||null,this.weekSettings=r,this.intl=Xn(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=ns(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:T.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Pe(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return ke(this,e,Qt,()=>{const n=t?{month:e,day:"numeric"}:{month:e},r=t?"format":"standalone";return this.monthsCache[r][e]||(this.monthsCache[r][e]=es(i=>this.extract(i,n,"month"))),this.monthsCache[r][e]})}weekdays(e,t=!1){return ke(this,e,tn,()=>{const n=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=t?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=ts(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return ke(this,void 0,()=>nn,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[g.utc(2016,11,13,9),g.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return ke(this,e,sn,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[g.utc(-40,1,1),g.utc(2017,1,1)].map(n=>this.extract(n,t,"era"))),this.eraCache[e]})}extract(e,t,n){const r=this.dtFormatter(e,t),i=r.formatToParts(),a=i.find(o=>o.type.toLowerCase()===n);return a?a.value:null}numberFormatter(e={}){return new ss(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new rs(e,this.intl,t)}relFormatter(e={}){return new is(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Gn(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:Bt()?_n(this.locale):as}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let Ze=null;class v extends ie{static get utcInstance(){return Ze===null&&(Ze=new v(0)),Ze}static instance(e){return e===0?v.utcInstance:new v(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new v(xe(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${le(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${le(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return le(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 os extends ie{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 U(s,e){if(y(s)||s===null)return e;if(s instanceof ie)return s;if(cs(s)){const t=s.toLowerCase();return t==="default"?e:t==="local"||t==="system"?pe.instance:t==="utc"||t==="gmt"?v.utcInstance:v.parseSpecifier(t)||$.create(s)}else return Y(s)?v.instance(s):typeof s=="object"&&"offset"in s&&typeof s.offset=="function"?s:new os(s)}let vt=()=>Date.now(),Dt="system",Mt=null,Ft=null,Vt=null,At=60,Ct,Wt=null;class x{static get now(){return vt}static set now(e){vt=e}static set defaultZone(e){Dt=e}static get defaultZone(){return U(Dt,pe.instance)}static get defaultLocale(){return Mt}static set defaultLocale(e){Mt=e}static get defaultNumberingSystem(){return Ft}static set defaultNumberingSystem(e){Ft=e}static get defaultOutputCalendar(){return Vt}static set defaultOutputCalendar(e){Vt=e}static get defaultWeekSettings(){return Wt}static set defaultWeekSettings(e){Wt=Pe(e)}static get twoDigitCutoffYear(){return At}static set twoDigitCutoffYear(e){At=e%100}static get throwOnInvalid(){return Ct}static set throwOnInvalid(e){Ct=e}static resetCaches(){T.resetCache(),$.resetCache()}}class W{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Lt=[0,31,59,90,120,151,181,212,243,273,304,334],Rt=[0,31,60,91,121,152,182,213,244,274,305,335];function F(s,e){return new W("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${s}, which is invalid`)}function Ue(s,e,t){const n=new Date(Date.UTC(s,e-1,t));s<100&&s>=0&&n.setUTCFullYear(n.getUTCFullYear()-1900);const r=n.getUTCDay();return r===0?7:r}function $t(s,e,t){return t+(oe(s)?Rt:Lt)[e-1]}function Zt(s,e){const t=oe(s)?Rt:Lt,n=t.findIndex(i=>iue(n,e,t)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:o,...Ie(s)}}function Ut(s,e=4,t=1){const{weekYear:n,weekNumber:r,weekday:i}=s,a=qe(Ue(n,1,e),t),o=H(n);let u=r*7+i-a-7+e,l;u<1?(l=n-1,u+=H(l)):u>o?(l=n+1,u-=H(n)):l=n;const{month:f,day:d}=Zt(l,u);return{year:l,month:f,day:d,...Ie(s)}}function ze(s){const{year:e,month:t,day:n}=s,r=$t(e,t,n);return{year:e,ordinal:r,...Ie(s)}}function qt(s){const{year:e,ordinal:t}=s,{month:n,day:r}=Zt(e,t);return{year:e,month:n,day:r,...Ie(s)}}function zt(s,e){if(!y(s.localWeekday)||!y(s.localWeekNumber)||!y(s.localWeekYear)){if(!y(s.weekday)||!y(s.weekNumber)||!y(s.weekYear))throw new j("Cannot mix locale-based week fields with ISO-based week fields");return y(s.localWeekday)||(s.weekday=s.localWeekday),y(s.localWeekNumber)||(s.weekNumber=s.localWeekNumber),y(s.localWeekYear)||(s.weekYear=s.localWeekYear),delete s.localWeekday,delete s.localWeekNumber,delete s.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function us(s,e=4,t=1){const n=Oe(s.weekYear),r=V(s.weekNumber,1,ue(s.weekYear,e,t)),i=V(s.weekday,1,7);return n?r?i?!1:F("weekday",s.weekday):F("week",s.weekNumber):F("weekYear",s.weekYear)}function ls(s){const e=Oe(s.year),t=V(s.ordinal,1,H(s.year));return e?t?!1:F("ordinal",s.ordinal):F("year",s.year)}function Pt(s){const e=Oe(s.year),t=V(s.month,1,12),n=V(s.day,1,Ne(s.year,s.month));return e?t?n?!1:F("day",s.day):F("month",s.month):F("year",s.year)}function Yt(s){const{hour:e,minute:t,second:n,millisecond:r}=s,i=V(e,0,23)||e===24&&t===0&&n===0&&r===0,a=V(t,0,59),o=V(n,0,59),u=V(r,0,999);return i?a?o?u?!1:F("millisecond",r):F("second",n):F("minute",t):F("hour",e)}function y(s){return typeof s>"u"}function Y(s){return typeof s=="number"}function Oe(s){return typeof s=="number"&&s%1===0}function cs(s){return typeof s=="string"}function fs(s){return Object.prototype.toString.call(s)==="[object Date]"}function Jt(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Bt(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function ds(s){return Array.isArray(s)?s:[s]}function Gt(s,e,t){if(s.length!==0)return s.reduce((n,r)=>{const i=[e(r),r];return n&&t(n[0],i[0])===n[0]?n:i},null)[1]}function hs(s,e){return e.reduce((t,n)=>(t[n]=s[n],t),{})}function K(s,e){return Object.prototype.hasOwnProperty.call(s,e)}function Pe(s){if(s==null)return null;if(typeof s!="object")throw new D("Week settings must be an object");if(!V(s.firstDay,1,7)||!V(s.minimalDays,1,7)||!Array.isArray(s.weekend)||s.weekend.some(e=>!V(e,1,7)))throw new D("Invalid week settings");return{firstDay:s.firstDay,minimalDays:s.minimalDays,weekend:Array.from(s.weekend)}}function V(s,e,t){return Oe(s)&&s>=e&&s<=t}function ms(s,e){return s-e*Math.floor(s/e)}function b(s,e=2){const t=s<0;let n;return t?n="-"+(""+-s).padStart(e,"0"):n=(""+s).padStart(e,"0"),n}function q(s){if(!(y(s)||s===null||s===""))return parseInt(s,10)}function J(s){if(!(y(s)||s===null||s===""))return parseFloat(s)}function Ye(s){if(!(y(s)||s===null||s==="")){const e=parseFloat("0."+s)*1e3;return Math.floor(e)}}function Je(s,e,t=!1){const n=10**e;return(t?Math.trunc:Math.round)(s*n)/n}function oe(s){return s%4===0&&(s%100!==0||s%400===0)}function H(s){return oe(s)?366:365}function Ne(s,e){const t=ms(e-1,12)+1,n=s+(e-t)/12;return t===2?oe(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Ee(s){let e=Date.UTC(s.year,s.month-1,s.day,s.hour,s.minute,s.second,s.millisecond);return s.year<100&&s.year>=0&&(e=new Date(e),e.setUTCFullYear(s.year,s.month-1,s.day)),+e}function jt(s,e,t){return-qe(Ue(s,1,e),t)+e-1}function ue(s,e=4,t=1){const n=jt(s,e,t),r=jt(s+1,e,t);return(H(s)-n+r)/7}function Be(s){return s>99?s:s>x.twoDigitCutoffYear?1900+s:2e3+s}function Kt(s,e,t,n=null){const r=new Date(s),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};n&&(i.timeZone=n);const a={timeZoneName:e,...i},o=new Intl.DateTimeFormat(t,a).formatToParts(r).find(u=>u.type.toLowerCase()==="timezonename");return o?o.value:null}function xe(s,e){let t=parseInt(s,10);Number.isNaN(t)&&(t=0);const n=parseInt(e,10)||0,r=t<0||Object.is(t,-0)?-n:n;return t*60+r}function Ht(s){const e=Number(s);if(typeof s=="boolean"||s===""||Number.isNaN(e))throw new D(`Invalid unit value ${s}`);return e}function be(s,e){const t={};for(const n in s)if(K(s,n)){const r=s[n];if(r==null)continue;t[e(n)]=Ht(r)}return t}function le(s,e){const t=Math.trunc(Math.abs(s/60)),n=Math.trunc(Math.abs(s%60)),r=s>=0?"+":"-";switch(e){case"short":return`${r}${b(t,2)}:${b(n,2)}`;case"narrow":return`${r}${t}${n>0?`:${n}`:""}`;case"techie":return`${r}${b(t,2)}${b(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Ie(s){return hs(s,["hour","minute","second","millisecond"])}const ys=["January","February","March","April","May","June","July","August","September","October","November","December"],_t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],gs=["J","F","M","A","M","J","J","A","S","O","N","D"];function Qt(s){switch(s){case"narrow":return[...gs];case"short":return[..._t];case"long":return[...ys];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 Xt=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],en=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ps=["M","T","W","T","F","S","S"];function tn(s){switch(s){case"narrow":return[...ps];case"short":return[...en];case"long":return[...Xt];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const nn=["AM","PM"],ws=["Before Christ","Anno Domini"],Ss=["BC","AD"],ks=["B","A"];function sn(s){switch(s){case"narrow":return[...ks];case"short":return[...Ss];case"long":return[...ws];default:return null}}function Ts(s){return nn[s.hour<12?0:1]}function Os(s,e){return tn(e)[s.weekday-1]}function Ns(s,e){return Qt(e)[s.month-1]}function Es(s,e){return sn(e)[s.year<0?0:1]}function xs(s,e,t="always",n=!1){const r={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."]},i=["hours","minutes","seconds"].indexOf(s)===-1;if(t==="auto"&&i){const d=s==="days";switch(e){case 1:return d?"tomorrow":`next ${r[s][0]}`;case-1:return d?"yesterday":`last ${r[s][0]}`;case 0:return d?"today":`this ${r[s][0]}`}}const a=Object.is(e,-0)||e<0,o=Math.abs(e),u=o===1,l=r[s],f=n?u?l[1]:l[2]||l[1]:u?r[s][0]:s;return a?`${o} ${f} ago`:`in ${o} ${f}`}function rn(s,e){let t="";for(const n of s)n.literal?t+=n.val:t+=e(n.val);return t}const bs={D:ge,DD:ot,DDD:ut,DDDD:lt,t:ct,tt:ft,ttt:dt,tttt:ht,T:mt,TT:yt,TTT:gt,TTTT:pt,f:wt,ff:kt,fff:Ot,ffff:Et,F:St,FF:Tt,FFF:Nt,FFFF:xt};class I{static create(e,t={}){return new I(e,t)}static parseFormat(e){let t=null,n="",r=!1;const i=[];for(let a=0;a0&&i.push({literal:r||/^\s+$/.test(n),val:n}),t=null,n="",r=!r):r||o===t?n+=o:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=o,t=o)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return bs[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()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return b(e,t);const n={...this.opts};return t>0&&(n.padTo=t),this.loc.numberFormatter(n).format(e)}formatDateTimeFromString(e,t){const n=this.loc.listingMode()==="en",r=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(m,O)=>this.loc.extract(e,m,O),a=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",o=()=>n?Ts(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(m,O)=>n?Ns(e,m):i(O?{month:m}:{month:m,day:"numeric"},"month"),l=(m,O)=>n?Os(e,m):i(O?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),f=m=>{const O=I.macroTokenToFormatOpts(m);return O?this.formatWithSystemDefault(e,O):m},d=m=>n?Es(e,m):i({era:m},"era"),p=m=>{switch(m){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 a({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return a({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return a({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 o();case"d":return r?i({day:"numeric"},"day"):this.num(e.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return l("short",!0);case"cccc":return l("long",!0);case"ccccc":return l("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return l("short",!1);case"EEEE":return l("long",!1);case"EEEEE":return l("narrow",!1);case"L":return r?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return u("short",!0);case"LLLL":return u("long",!0);case"LLLLL":return u("narrow",!0);case"M":return r?i({month:"numeric"},"month"):this.num(e.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return u("short",!1);case"MMMM":return u("long",!1);case"MMMMM":return u("narrow",!1);case"y":return r?i({year:"numeric"},"year"):this.num(e.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return d("short");case"GG":return d("long");case"GGGGG":return d("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"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);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(m)}};return rn(I.parseFormat(t),p)}formatDurationFromString(e,t){const n=u=>{switch(u[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}},r=u=>l=>{const f=n(l);return f?this.num(u.get(f),l.length):l},i=I.parseFormat(t),a=i.reduce((u,{literal:l,val:f})=>l?u:u.concat(f),[]),o=e.shiftTo(...a.map(n).filter(u=>u));return rn(i,r(o))}}const an=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function _(...s){const e=s.reduce((t,n)=>t+n.source,"");return RegExp(`^${e}$`)}function Q(...s){return e=>s.reduce(([t,n,r],i)=>{const[a,o,u]=i(e,r);return[{...t,...a},o||n,u]},[{},null,1]).slice(0,2)}function X(s,...e){if(s==null)return[null,null];for(const[t,n]of e){const r=t.exec(s);if(r)return n(r)}return[null,null]}function on(...s){return(e,t)=>{const n={};let r;for(r=0;rm!==void 0&&(O||m&&f)?-m:m;return[{years:p(J(t)),months:p(J(n)),weeks:p(J(r)),days:p(J(i)),hours:p(J(a)),minutes:p(J(o)),seconds:p(J(u),u==="-0"),milliseconds:p(Ye(l),d)}]}const Zs={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 Ke(s,e,t,n,r,i,a){const o={year:e.length===2?Be(q(e)):q(e),month:_t.indexOf(t)+1,day:q(n),hour:q(r),minute:q(i)};return a&&(o.second=q(a)),s&&(o.weekday=s.length>3?Xt.indexOf(s)+1:en.indexOf(s)+1),o}const Us=/^(?:(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 qs(s){const[,e,t,n,r,i,a,o,u,l,f,d]=s,p=Ke(e,r,n,t,i,a,o);let m;return u?m=Zs[u]:l?m=0:m=xe(f,d),[p,new v(m)]}function zs(s){return s.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const Ps=/^(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$/,Ys=/^(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$/,Js=/^(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 fn(s){const[,e,t,n,r,i,a,o]=s;return[Ke(e,r,n,t,i,a,o),v.utcInstance]}function Bs(s){const[,e,t,n,r,i,a,o]=s;return[Ke(e,o,t,n,r,i,a),v.utcInstance]}const Gs=_(vs,je),js=_(Ds,je),Ks=_(Ms,je),Hs=_(ln),dn=Q(Ws,te,ce,fe),_s=Q(Fs,te,ce,fe),Qs=Q(Vs,te,ce,fe),Xs=Q(te,ce,fe);function er(s){return X(s,[Gs,dn],[js,_s],[Ks,Qs],[Hs,Xs])}function tr(s){return X(zs(s),[Us,qs])}function nr(s){return X(s,[Ps,fn],[Ys,fn],[Js,Bs])}function sr(s){return X(s,[Rs,$s])}const rr=Q(te);function ir(s){return X(s,[Ls,rr])}const ar=_(As,Cs),or=_(cn),ur=Q(te,ce,fe);function lr(s){return X(s,[ar,dn],[or,ur])}const hn="Invalid Duration",mn={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}},cr={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},...mn},A=146097/400,ne=146097/4800,fr={years:{quarters:4,months:12,weeks:A/7,days:A,hours:A*24,minutes:A*24*60,seconds:A*24*60*60,milliseconds:A*24*60*60*1e3},quarters:{months:3,weeks:A/28,days:A/4,hours:A*24/4,minutes:A*24*60/4,seconds:A*24*60*60/4,milliseconds:A*24*60*60*1e3/4},months:{weeks:ne/7,days:ne,hours:ne*24,minutes:ne*24*60,seconds:ne*24*60*60,milliseconds:ne*24*60*60*1e3},...mn},B=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],dr=B.slice(0).reverse();function z(s,e,t=!1){const n={values:t?e.values:{...s.values,...e.values||{}},loc:s.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||s.conversionAccuracy,matrix:e.matrix||s.matrix};return new w(n)}function yn(s,e){let t=e.milliseconds??0;for(const n of dr.slice(1))e[n]&&(t+=e[n]*s[n].milliseconds);return t}function gn(s,e){const t=yn(s,e)<0?-1:1;B.reduceRight((n,r)=>{if(y(e[r]))return n;if(n){const i=e[n]*t,a=s[r][n],o=Math.floor(i/a);e[r]+=o*t,e[n]-=o*a*t}return r},null),B.reduce((n,r)=>{if(y(e[r]))return n;if(n){const i=e[n]%1;e[n]-=i,e[r]+=i*s[n][r]}return r},null)}function hr(s){const e={};for(const[t,n]of Object.entries(s))n!==0&&(e[t]=n);return e}class w{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let n=t?fr:cr;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||T.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(e,t){return w.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new D(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new w({values:be(e,w.normalizeUnit),loc:T.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Y(e))return w.fromMillis(e);if(w.isDuration(e))return e;if(typeof e=="object")return w.fromObject(e);throw new D(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[n]=sr(e);return n?w.fromObject(n,t):w.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[n]=ir(e);return n?w.fromObject(n,t):w.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new D("need to specify a reason the Duration is invalid");const n=e instanceof W?e:new W(e,t);if(x.throwOnInvalid)throw new Un(n);return new w({invalid:n})}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 at(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 n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?I.create(this.loc,n).formatDurationFromString(this,e):hn}toHuman(e={}){if(!this.isValid)return hn;const t=B.map(n=>{const r=this.values[n];return y(r)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:n.slice(0,-1)}).format(r)}).filter(n=>n);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+=Je(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},g.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?yn(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=w.fromDurationLike(e),n={};for(const r of B)(K(t.values,r)||K(this.values,r))&&(n[r]=t.get(r)+this.get(r));return z(this,{values:n},!0)}minus(e){if(!this.isValid)return this;const t=w.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const n of Object.keys(this.values))t[n]=Ht(e(this.values[n],n));return z(this,{values:t},!0)}get(e){return this[w.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...be(e,w.normalizeUnit)};return z(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){const a={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n};return z(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return gn(this.matrix,e),z(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=hr(this.normalize().shiftToAll().toObject());return z(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(a=>w.normalizeUnit(a));const t={},n={},r=this.toObject();let i;for(const a of B)if(e.indexOf(a)>=0){i=a;let o=0;for(const l in n)o+=this.matrix[l][a]*n[l],n[l]=0;Y(r[a])&&(o+=r[a]);const u=Math.trunc(o);t[a]=u,n[a]=(o*1e3-u*1e3)/1e3}else Y(r[a])&&(n[a]=r[a]);for(const a in n)n[a]!==0&&(t[i]+=a===i?n[a]:n[a]/this.matrix[i][a]);return gn(this.matrix,t),z(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}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 z(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(n,r){return n===void 0||n===0?r===void 0||r===0:n===r}for(const n of B)if(!t(this.values[n],e.values[n]))return!1;return!0}}const se="Invalid Interval";function mr(s,e){return!s||!s.isValid?E.invalid("missing or invalid start"):!e||!e.isValid?E.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?E.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(he).filter(a=>this.contains(a)).sort((a,o)=>a.toMillis()-o.toMillis()),n=[];let{s:r}=this,i=0;for(;r+this.e?this.e:a;n.push(E.fromDateTimes(r,o)),r=o,i+=1}return n}splitBy(e){const t=w.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:n}=this,r=1,i;const a=[];for(;nu*r));i=+o>+this.e?this.e:o,a.push(E.fromDateTimes(n,i)),n=i,r+=1}return a}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,n=this.e=n?null:E.fromDateTimes(t,n)}union(e){if(!this.isValid)return this;const t=this.se.e?this.e:e.e;return E.fromDateTimes(t,n)}static merge(e){const[t,n]=e.sort((r,i)=>r.s-i.s).reduce(([r,i],a)=>i?i.overlaps(a)||i.abutsStart(a)?[r,i.union(a)]:[r.concat([i]),a]:[r,a],[[],null]);return n&&t.push(n),t}static xor(e){let t=null,n=0;const r=[],i=e.map(u=>[{time:u.s,type:"s"},{time:u.e,type:"e"}]),a=Array.prototype.concat(...i),o=a.sort((u,l)=>u.time-l.time);for(const u of o)n+=u.type==="s"?1:-1,n===1?t=u.time:(t&&+t!=+u.time&&r.push(E.fromDateTimes(t,u.time)),t=null);return E.merge(r)}difference(...e){return E.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:se}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=ge,t={}){return this.isValid?I.create(this.s.loc.clone(t),e).formatInterval(this):se}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:se}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:se}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:se}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:se}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):w.invalid(this.invalidReason)}mapEndpoints(e){return E.fromDateTimes(e(this.s),e(this.e))}}class ve{static hasDST(e=x.defaultZone){const t=g.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return $.isValidZone(e)}static normalizeZone(e){return U(e,x.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||T.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||T.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||T.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||T.create(t,n,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||T.create(t,n,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||T.create(t,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||T.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return T.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return T.create(t,null,"gregory").eras(e)}static features(){return{relative:Jt(),localeWeek:Bt()}}}function pn(s,e){const t=r=>r.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=t(e)-t(s);return Math.floor(w.fromMillis(n).as("days"))}function yr(s,e,t){const n=[["years",(u,l)=>l.year-u.year],["quarters",(u,l)=>l.quarter-u.quarter+(l.year-u.year)*4],["months",(u,l)=>l.month-u.month+(l.year-u.year)*12],["weeks",(u,l)=>{const f=pn(u,l);return(f-f%7)/7}],["days",pn]],r={},i=s;let a,o;for(const[u,l]of n)t.indexOf(u)>=0&&(a=u,r[u]=l(s,e),o=i.plus(r),o>e?(r[u]--,s=i.plus(r),s>e&&(o=s,r[u]--,s=i.plus(r))):s=o);return[s,r,o,a]}function gr(s,e,t,n){let[r,i,a,o]=yr(s,e,t);const u=e-r,l=t.filter(d=>["hours","minutes","seconds","milliseconds"].indexOf(d)>=0);l.length===0&&(a0?w.fromMillis(u,n).shiftTo(...l).plus(f):f}const He={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},wn={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]},pr=He.hanidec.replace(/[\[|\]]/g,"").split("");function wr(s){let e=parseInt(s,10);if(isNaN(e)){e="";for(let t=0;t=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}function L({numberingSystem:s},e=""){return new RegExp(`${He[s||"latn"]}${e}`)}const Sr="missing Intl.DateTimeFormat.formatToParts support";function S(s,e=t=>t){return{regex:s,deser:([t])=>e(wr(t))}}const Sn="[  ]",kn=new RegExp(Sn,"g");function kr(s){return s.replace(/\./g,"\\.?").replace(kn,Sn)}function Tn(s){return s.replace(/\./g,"").replace(kn," ").toLowerCase()}function R(s,e){return s===null?null:{regex:RegExp(s.map(kr).join("|")),deser:([t])=>s.findIndex(n=>Tn(t)===Tn(n))+e}}function On(s,e){return{regex:s,deser:([,t,n])=>xe(t,n),groups:e}}function De(s){return{regex:s,deser:([e])=>e}}function Tr(s){return s.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Or(s,e){const t=L(e),n=L(e,"{2}"),r=L(e,"{3}"),i=L(e,"{4}"),a=L(e,"{6}"),o=L(e,"{1,2}"),u=L(e,"{1,3}"),l=L(e,"{1,6}"),f=L(e,"{1,9}"),d=L(e,"{2,4}"),p=L(e,"{4,6}"),m=k=>({regex:RegExp(Tr(k.val)),deser:([re])=>re,literal:!0}),N=(k=>{if(s.literal)return m(k);switch(k.val){case"G":return R(e.eras("short"),0);case"GG":return R(e.eras("long"),0);case"y":return S(l);case"yy":return S(d,Be);case"yyyy":return S(i);case"yyyyy":return S(p);case"yyyyyy":return S(a);case"M":return S(o);case"MM":return S(n);case"MMM":return R(e.months("short",!0),1);case"MMMM":return R(e.months("long",!0),1);case"L":return S(o);case"LL":return S(n);case"LLL":return R(e.months("short",!1),1);case"LLLL":return R(e.months("long",!1),1);case"d":return S(o);case"dd":return S(n);case"o":return S(u);case"ooo":return S(r);case"HH":return S(n);case"H":return S(o);case"hh":return S(n);case"h":return S(o);case"mm":return S(n);case"m":return S(o);case"q":return S(o);case"qq":return S(n);case"s":return S(o);case"ss":return S(n);case"S":return S(u);case"SSS":return S(r);case"u":return De(f);case"uu":return De(o);case"uuu":return S(t);case"a":return R(e.meridiems(),0);case"kkkk":return S(i);case"kk":return S(d,Be);case"W":return S(o);case"WW":return S(n);case"E":case"c":return S(t);case"EEE":return R(e.weekdays("short",!1),1);case"EEEE":return R(e.weekdays("long",!1),1);case"ccc":return R(e.weekdays("short",!0),1);case"cccc":return R(e.weekdays("long",!0),1);case"Z":case"ZZ":return On(new RegExp(`([+-]${o.source})(?::(${n.source}))?`),2);case"ZZZ":return On(new RegExp(`([+-]${o.source})(${n.source})?`),2);case"z":return De(/[a-z_+-/]{1,256}?/i);case" ":return De(/[^\S\n\r]/);default:return m(k)}})(s)||{invalidReason:Sr};return N.token=s,N}const Nr={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",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function Er(s,e,t){const{type:n,value:r}=s;if(n==="literal"){const u=/^\s+$/.test(r);return{literal:!u,val:u?" ":r}}const i=e[n];let a=n;n==="hour"&&(e.hour12!=null?a=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?a="hour12":a="hour24":a=t.hour12?"hour12":"hour24");let o=Nr[a];if(typeof o=="object"&&(o=o[i]),o)return{literal:!1,val:o}}function xr(s){return[`^${s.map(t=>t.regex).reduce((t,n)=>`${t}(${n.source})`,"")}$`,s]}function br(s,e,t){const n=s.match(e);if(n){const r={};let i=1;for(const a in t)if(K(t,a)){const o=t[a],u=o.groups?o.groups+1:1;!o.literal&&o.token&&(r[o.token.val[0]]=o.deser(n.slice(i,i+u))),i+=u}return[n,r]}else return[n,{}]}function Ir(s){const e=i=>{switch(i){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,n;return y(s.z)||(t=$.create(s.z)),y(s.Z)||(t||(t=new v(s.Z)),n=s.Z),y(s.q)||(s.M=(s.q-1)*3+1),y(s.h)||(s.h<12&&s.a===1?s.h+=12:s.h===12&&s.a===0&&(s.h=0)),s.G===0&&s.y&&(s.y=-s.y),y(s.u)||(s.S=Ye(s.u)),[Object.keys(s).reduce((i,a)=>{const o=e(a);return o&&(i[o]=s[a]),i},{}),t,n]}let _e=null;function vr(){return _e||(_e=g.fromMillis(1555555555555)),_e}function Dr(s,e){if(s.literal)return s;const t=I.macroTokenToFormatOpts(s.val),n=xn(t,e);return n==null||n.includes(void 0)?s:n}function Nn(s,e){return Array.prototype.concat(...s.map(t=>Dr(t,e)))}function En(s,e,t){const n=Nn(I.parseFormat(t),s),r=n.map(a=>Or(a,s)),i=r.find(a=>a.invalidReason);if(i)return{input:e,tokens:n,invalidReason:i.invalidReason};{const[a,o]=xr(r),u=RegExp(a,"i"),[l,f]=br(e,u,o),[d,p,m]=f?Ir(f):[null,null,void 0];if(K(f,"a")&&K(f,"H"))throw new j("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:n,regex:u,rawMatches:l,matches:f,result:d,zone:p,specificOffset:m}}}function Mr(s,e,t){const{result:n,zone:r,specificOffset:i,invalidReason:a}=En(s,e,t);return[n,r,i,a]}function xn(s,e){if(!s)return null;const n=I.create(e,s).dtFormatter(vr()),r=n.formatToParts(),i=n.resolvedOptions();return r.map(a=>Er(a,s,i))}const Qe="Invalid DateTime",bn=864e13;function Me(s){return new W("unsupported zone",`the zone "${s.name}" is not supported`)}function Xe(s){return s.weekData===null&&(s.weekData=Te(s.c)),s.weekData}function et(s){return s.localWeekData===null&&(s.localWeekData=Te(s.c,s.loc.getMinDaysInFirstWeek(),s.loc.getStartOfWeek())),s.localWeekData}function G(s,e){const t={ts:s.ts,zone:s.zone,c:s.c,o:s.o,loc:s.loc,invalid:s.invalid};return new g({...t,...e,old:t})}function In(s,e,t){let n=s-e*60*1e3;const r=t.offset(n);if(e===r)return[n,e];n-=(r-e)*60*1e3;const i=t.offset(n);return r===i?[n,r]:[s-Math.min(r,i)*60*1e3,Math.max(r,i)]}function Fe(s,e){s+=e*60*1e3;const t=new Date(s);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function Ve(s,e,t){return In(Ee(s),e,t)}function vn(s,e){const t=s.o,n=s.c.year+Math.trunc(e.years),r=s.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...s.c,year:n,month:r,day:Math.min(s.c.day,Ne(n,r))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=w.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"),o=Ee(i);let[u,l]=In(o,t,s.zone);return a!==0&&(u+=a,l=s.zone.offset(u)),{ts:u,o:l}}function de(s,e,t,n,r,i){const{setZone:a,zone:o}=t;if(s&&Object.keys(s).length!==0||e){const u=e||o,l=g.fromObject(s,{...t,zone:u,specificOffset:i});return a?l:l.setZone(o)}else return g.invalid(new W("unparsable",`the input "${r}" can't be parsed as ${n}`))}function Ae(s,e,t=!0){return s.isValid?I.create(T.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(s,e):null}function tt(s,e){const t=s.c.year>9999||s.c.year<0;let n="";return t&&s.c.year>=0&&(n+="+"),n+=b(s.c.year,t?6:4),e?(n+="-",n+=b(s.c.month),n+="-",n+=b(s.c.day)):(n+=b(s.c.month),n+=b(s.c.day)),n}function Dn(s,e,t,n,r,i){let a=b(s.c.hour);return e?(a+=":",a+=b(s.c.minute),(s.c.millisecond!==0||s.c.second!==0||!t)&&(a+=":")):a+=b(s.c.minute),(s.c.millisecond!==0||s.c.second!==0||!t)&&(a+=b(s.c.second),(s.c.millisecond!==0||!n)&&(a+=".",a+=b(s.c.millisecond,3))),r&&(s.isOffsetFixed&&s.offset===0&&!i?a+="Z":s.o<0?(a+="-",a+=b(Math.trunc(-s.o/60)),a+=":",a+=b(Math.trunc(-s.o%60))):(a+="+",a+=b(Math.trunc(s.o/60)),a+=":",a+=b(Math.trunc(s.o%60)))),i&&(a+="["+s.zone.ianaName+"]"),a}const Mn={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Fr={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Vr={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Fn=["year","month","day","hour","minute","second","millisecond"],Ar=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Cr=["year","ordinal","hour","minute","second","millisecond"];function Wr(s){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"}[s.toLowerCase()];if(!e)throw new at(s);return e}function Vn(s){switch(s.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Wr(s)}}function An(s,e){const t=U(e.zone,x.defaultZone),n=T.fromObject(e),r=x.now();let i,a;if(y(s.year))i=r;else{for(const l of Fn)y(s[l])&&(s[l]=Mn[l]);const o=Pt(s)||Yt(s);if(o)return g.invalid(o);const u=t.offset(r);[i,a]=Ve(s,u,t)}return new g({ts:i,zone:t,loc:n,o:a})}function Cn(s,e,t){const n=y(t.round)?!0:t.round,r=(a,o)=>(a=Je(a,n||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(a,o)),i=a=>t.calendary?e.hasSame(s,a)?0:e.startOf(a).diff(s.startOf(a),a).get(a):e.diff(s,a).get(a);if(t.unit)return r(i(t.unit),t.unit);for(const a of t.units){const o=i(a);if(Math.abs(o)>=1)return r(o,a)}return r(s>e?-0:0,t.units[t.units.length-1])}function Wn(s){let e={},t;return s.length>0&&typeof s[s.length-1]=="object"?(e=s[s.length-1],t=Array.from(s).slice(0,s.length-1)):t=Array.from(s),[e,t]}class g{constructor(e){const t=e.zone||x.defaultZone;let n=e.invalid||(Number.isNaN(e.ts)?new W("invalid input"):null)||(t.isValid?null:Me(t));this.ts=y(e.ts)?x.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{const o=t.offset(this.ts);r=Fe(this.ts,o),n=Number.isNaN(r.year)?new W("invalid input"):null,r=n?null:r,i=n?null:o}this._zone=t,this.loc=e.loc||T.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new g({})}static local(){const[e,t]=Wn(arguments),[n,r,i,a,o,u,l]=t;return An({year:n,month:r,day:i,hour:a,minute:o,second:u,millisecond:l},e)}static utc(){const[e,t]=Wn(arguments),[n,r,i,a,o,u,l]=t;return e.zone=v.utcInstance,An({year:n,month:r,day:i,hour:a,minute:o,second:u,millisecond:l},e)}static fromJSDate(e,t={}){const n=fs(e)?e.valueOf():NaN;if(Number.isNaN(n))return g.invalid("invalid input");const r=U(t.zone,x.defaultZone);return r.isValid?new g({ts:n,zone:r,loc:T.fromObject(t)}):g.invalid(Me(r))}static fromMillis(e,t={}){if(Y(e))return e<-bn||e>bn?g.invalid("Timestamp out of range"):new g({ts:e,zone:U(t.zone,x.defaultZone),loc:T.fromObject(t)});throw new D(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Y(e))return new g({ts:e*1e3,zone:U(t.zone,x.defaultZone),loc:T.fromObject(t)});throw new D("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const n=U(t.zone,x.defaultZone);if(!n.isValid)return g.invalid(Me(n));const r=T.fromObject(t),i=be(e,Vn),{minDaysInFirstWeek:a,startOfWeek:o}=zt(i,r),u=x.now(),l=y(t.specificOffset)?n.offset(u):t.specificOffset,f=!y(i.ordinal),d=!y(i.year),p=!y(i.month)||!y(i.day),m=d||p,O=i.weekYear||i.weekNumber;if((m||f)&&O)throw new j("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(p&&f)throw new j("Can't mix ordinal dates with month/day");const N=O||i.weekday&&!m;let k,re,me=Fe(u,l);N?(k=Ar,re=Fr,me=Te(me,a,o)):f?(k=Cr,re=Vr,me=ze(me)):(k=Fn,re=Mn);let Ln=!1;for(const ye of k){const Yr=i[ye];y(Yr)?Ln?i[ye]=re[ye]:i[ye]=me[ye]:Ln=!0}const Ur=N?us(i,a,o):f?ls(i):Pt(i),Rn=Ur||Yt(i);if(Rn)return g.invalid(Rn);const qr=N?Ut(i,a,o):f?qt(i):i,[zr,Pr]=Ve(qr,l,n),it=new g({ts:zr,zone:n,o:Pr,loc:r});return i.weekday&&m&&e.weekday!==it.weekday?g.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${it.toISO()}`):it}static fromISO(e,t={}){const[n,r]=er(e);return de(n,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[n,r]=tr(e);return de(n,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[n,r]=nr(e);return de(n,r,t,"HTTP",t)}static fromFormat(e,t,n={}){if(y(e)||y(t))throw new D("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=n,a=T.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[o,u,l,f]=Mr(a,e,t);return f?g.invalid(f):de(o,u,n,`format ${t}`,e,l)}static fromString(e,t,n={}){return g.fromFormat(e,t,n)}static fromSQL(e,t={}){const[n,r]=lr(e);return de(n,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new D("need to specify a reason the DateTime is invalid");const n=e instanceof W?e:new W(e,t);if(x.throwOnInvalid)throw new $n(n);return new g({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const n=xn(e,T.fromObject(t));return n?n.map(r=>r?r.val:null).join(""):null}static expandFormat(e,t={}){return Nn(I.parseFormat(e),T.fromObject(t)).map(r=>r.val).join("")}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?Xe(this).weekYear:NaN}get weekNumber(){return this.isValid?Xe(this).weekNumber:NaN}get weekday(){return this.isValid?Xe(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?et(this).weekday:NaN}get localWeekNumber(){return this.isValid?et(this).weekNumber:NaN}get localWeekYear(){return this.isValid?et(this).weekYear:NaN}get ordinal(){return this.isValid?ze(this.c).ordinal:NaN}get monthShort(){return this.isValid?ve.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?ve.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?ve.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?ve.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}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,n=Ee(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-r*t),o=this.zone.offset(n-i*t);if(a===o)return[this];const u=n-a*t,l=n-o*t,f=Fe(u,a),d=Fe(l,o);return f.hour===d.hour&&f.minute===d.minute&&f.second===d.second&&f.millisecond===d.millisecond?[G(this,{ts:u}),G(this,{ts:l})]:[this]}get isInLeapYear(){return oe(this.year)}get daysInMonth(){return Ne(this.year,this.month)}get daysInYear(){return this.isValid?H(this.year):NaN}get weeksInWeekYear(){return this.isValid?ue(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?ue(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:n,calendar:r}=I.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(v.instance(e),t)}toLocal(){return this.setZone(x.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:n=!1}={}){if(e=U(e,x.defaultZone),e.equals(this.zone))return this;if(e.isValid){let r=this.ts;if(t||n){const i=e.offset(this.ts),a=this.toObject();[r]=Ve(a,i,e)}return G(this,{ts:r,zone:e})}else return g.invalid(Me(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){const r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return G(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=be(e,Vn),{minDaysInFirstWeek:n,startOfWeek:r}=zt(t,this.loc),i=!y(t.weekYear)||!y(t.weekNumber)||!y(t.weekday),a=!y(t.ordinal),o=!y(t.year),u=!y(t.month)||!y(t.day),l=o||u,f=t.weekYear||t.weekNumber;if((l||a)&&f)throw new j("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new j("Can't mix ordinal dates with month/day");let d;i?d=Ut({...Te(this.c,n,r),...t},n,r):y(t.ordinal)?(d={...this.toObject(),...t},y(t.day)&&(d.day=Math.min(Ne(d.year,d.month),d.day))):d=qt({...ze(this.c),...t});const[p,m]=Ve(d,this.o,this.zone);return G(this,{ts:p,o:m})}plus(e){if(!this.isValid)return this;const t=w.fromDurationLike(e);return G(this,vn(this,t))}minus(e){if(!this.isValid)return this;const t=w.fromDurationLike(e).negate();return G(this,vn(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const n={},r=w.normalizeUnit(e);switch(r){case"years":n.month=1;case"quarters":case"months":n.day=1;case"weeks":case"days":n.hour=0;case"hours":n.minute=0;case"minutes":n.second=0;case"seconds":n.millisecond=0;break}if(r==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:a}=this;athis.valueOf(),o=a?this:e,u=a?e:this,l=gr(o,u,i,r);return a?l.negate():l}diffNow(e="milliseconds",t={}){return this.diff(g.now(),e,t)}until(e){return this.isValid?E.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;const r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}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||g.fromObject({},{zone:this.zone}),n=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(g.isDateTime))throw new D("max requires all arguments be DateTimes");return Gt(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){const{locale:r=null,numberingSystem:i=null}=n,a=T.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});return En(a,e,t)}static fromStringExplain(e,t,n={}){return g.fromFormatExplain(e,t,n)}static get DATE_SHORT(){return ge}static get DATE_MED(){return ot}static get DATE_MED_WITH_WEEKDAY(){return qn}static get DATE_FULL(){return ut}static get DATE_HUGE(){return lt}static get TIME_SIMPLE(){return ct}static get TIME_WITH_SECONDS(){return ft}static get TIME_WITH_SHORT_OFFSET(){return dt}static get TIME_WITH_LONG_OFFSET(){return ht}static get TIME_24_SIMPLE(){return mt}static get TIME_24_WITH_SECONDS(){return yt}static get TIME_24_WITH_SHORT_OFFSET(){return gt}static get TIME_24_WITH_LONG_OFFSET(){return pt}static get DATETIME_SHORT(){return wt}static get DATETIME_SHORT_WITH_SECONDS(){return St}static get DATETIME_MED(){return kt}static get DATETIME_MED_WITH_SECONDS(){return Tt}static get DATETIME_MED_WITH_WEEKDAY(){return zn}static get DATETIME_FULL(){return Ot}static get DATETIME_FULL_WITH_SECONDS(){return Nt}static get DATETIME_HUGE(){return Et}static get DATETIME_HUGE_WITH_SECONDS(){return xt}}function he(s){if(g.isDateTime(s))return s;if(s&&s.valueOf&&Y(s.valueOf()))return g.fromJSDate(s);if(s&&typeof s=="object")return g.fromObject(s);throw new D(`Unknown datetime argument: ${s}, of type ${typeof s}`)}const Lr=[".jpg",".jpeg",".png",".svg",".gif",".jfif",".webp",".avif"],Rr=[".mp4",".avi",".mov",".3gp",".wmv"],$r=[".aa",".aac",".m4v",".mp3",".ogg",".oga",".mogg",".amr"],Zr=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".odp",".odt",".ods",".txt"];class h{static isObject(e){return e!==null&&typeof e=="object"&&e.constructor===Object}static clone(e){return typeof structuredClone<"u"?structuredClone(e):JSON.parse(JSON.stringify(e))}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||h.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==null?void 0:e.isContentEditable)}static isFocusable(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return h.isInput(e)||t==="button"||t==="a"||t==="details"||(e==null?void 0:e.tabIndex)>=0}static hasNonEmptyProps(e){for(let t in e)if(!h.isEmpty(e[t]))return!0;return!1}static toArray(e,t=!1){return Array.isArray(e)?e.slice():(t||!h.isEmpty(e))&&typeof e<"u"?[e]:[]}static inArray(e,t){e=Array.isArray(e)?e:[];for(let n=e.length-1;n>=0;n--)if(e[n]==t)return!0;return!1}static removeByValue(e,t){e=Array.isArray(e)?e:[];for(let n=e.length-1;n>=0;n--)if(e[n]==t){e.splice(n,1);break}}static pushUnique(e,t){h.inArray(e,t)||e.push(t)}static findByKey(e,t,n){e=Array.isArray(e)?e:[];for(let r in e)if(e[r][t]==n)return e[r];return null}static groupByKey(e,t){e=Array.isArray(e)?e:[];const n={};for(let r in e)n[e[r][t]]=n[e[r][t]]||[],n[e[r][t]].push(e[r]);return n}static removeByKey(e,t,n){for(let r in e)if(e[r][t]==n){e.splice(r,1);break}}static pushOrReplaceByKey(e,t,n="id"){for(let r=e.length-1;r>=0;r--)if(e[r][n]==t[n]){e[r]=t;return}e.push(t)}static filterDuplicatesByKey(e,t="id"){e=Array.isArray(e)?e:[];const n={};for(const r of e)n[r[t]]=r;return Object.values(n)}static filterRedactedProps(e,t="******"){const n=JSON.parse(JSON.stringify(e||{}));for(let r in n)typeof n[r]=="object"&&n[r]!==null?n[r]=h.filterRedactedProps(n[r],t):n[r]===t&&delete n[r];return n}static getNestedVal(e,t,n=null,r="."){let i=e||{},a=(t||"").split(r);for(const o of a){if(!h.isObject(i)&&!Array.isArray(i)||typeof i[o]>"u")return n;i=i[o]}return i}static setByPath(e,t,n,r="."){if(e===null||typeof e!="object"){console.warn("setByPath: data not an object or array.");return}let i=e,a=t.split(r),o=a.pop();for(const u of a)(!h.isObject(i)&&!Array.isArray(i)||!h.isObject(i[u])&&!Array.isArray(i[u]))&&(i[u]={}),i=i[u];i[o]=n}static deleteByPath(e,t,n="."){let r=e||{},i=(t||"").split(n),a=i.pop();for(const o of i)(!h.isObject(r)&&!Array.isArray(r)||!h.isObject(r[o])&&!Array.isArray(r[o]))&&(r[o]={}),r=r[o];Array.isArray(r)?r.splice(a,1):h.isObject(r)&&delete r[a],i.length>0&&(Array.isArray(r)&&!r.length||h.isObject(r)&&!Object.keys(r).length)&&(Array.isArray(e)&&e.length>0||h.isObject(e)&&Object.keys(e).length>0)&&h.deleteByPath(e,i.join(n),n)}static randomString(e=10){let t="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let r=0;r"u")return h.randomString(e);const t=new Uint8Array(e);crypto.getRandomValues(t);const n="-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";let r="";for(let i=0;ii.replaceAll("{_PB_ESCAPED_}",t));for(let i of r)i=i.trim(),h.isEmpty(i)||n.push(i);return n}static joinNonEmpty(e,t=", "){e=e||[];const n=[],r=t.length>1?t.trim():t;for(let i of e)i=typeof i=="string"?i.trim():"",h.isEmpty(i)||n.push(i.replaceAll(r,"\\"+r));return n.join(t)}static getInitials(e){if(e=(e||"").split("@")[0].trim(),e.length<=2)return e.toUpperCase();const t=e.split(/[\.\_\-\ ]/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e[0].toUpperCase()}static formattedFileSize(e){const t=e?Math.floor(Math.log(e)/Math.log(1024)):0;return(e/Math.pow(1024,t)).toFixed(2)*1+" "+["B","KB","MB","GB","TB"][t]}static getDateTime(e){if(typeof e=="string"){const t={19:"yyyy-MM-dd HH:mm:ss",23:"yyyy-MM-dd HH:mm:ss.SSS",20:"yyyy-MM-dd HH:mm:ss'Z'",24:"yyyy-MM-dd HH:mm:ss.SSS'Z'"},n=t[e.length]||t[19];return g.fromFormat(e,n,{zone:"UTC"})}return g.fromJSDate(e)}static formatToUTCDate(e,t="yyyy-MM-dd HH:mm:ss"){return h.getDateTime(e).toUTC().toFormat(t)}static formatToLocalDate(e,t="yyyy-MM-dd HH:mm:ss"){return h.getDateTime(e).toLocal().toFormat(t)}static async copyToClipboard(e){var t;if(e=""+e,!(!e.length||!((t=window==null?void 0:window.navigator)!=null&&t.clipboard)))return window.navigator.clipboard.writeText(e).catch(n=>{console.warn("Failed to copy.",n)})}static download(e,t){const n=document.createElement("a");n.setAttribute("href",e),n.setAttribute("download",t),n.setAttribute("target","_blank"),n.click(),n.remove()}static downloadJson(e,t){t=t.endsWith(".json")?t:t+".json";const n=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),r=window.URL.createObjectURL(n);h.download(r,t)}static getJWTPayload(e){const t=(e||"").split(".")[1]||"";if(t==="")return{};try{const n=decodeURIComponent(atob(t));return JSON.parse(n)||{}}catch(n){console.warn("Failed to parse JWT payload data.",n)}return{}}static hasImageExtension(e){return e=e||"",!!Lr.find(t=>e.toLowerCase().endsWith(t))}static hasVideoExtension(e){return e=e||"",!!Rr.find(t=>e.toLowerCase().endsWith(t))}static hasAudioExtension(e){return e=e||"",!!$r.find(t=>e.toLowerCase().endsWith(t))}static hasDocumentExtension(e){return e=e||"",!!Zr.find(t=>e.toLowerCase().endsWith(t))}static getFileType(e){return h.hasImageExtension(e)?"image":h.hasDocumentExtension(e)?"document":h.hasVideoExtension(e)?"video":h.hasAudioExtension(e)?"audio":"file"}static generateThumb(e,t=100,n=100){return new Promise(r=>{let i=new FileReader;i.onload=function(a){let o=new Image;o.onload=function(){let u=document.createElement("canvas"),l=u.getContext("2d"),f=o.width,d=o.height;return u.width=t,u.height=n,l.drawImage(o,f>d?(f-d)/2:0,0,f>d?d:f,f>d?d:f,0,0,t,n),r(u.toDataURL(e.type))},o.src=a.target.result},i.readAsDataURL(e)})}static addValueToFormData(e,t,n){if(!(typeof n>"u"))if(h.isEmpty(n))e.append(t,"");else if(Array.isArray(n))for(const r of n)h.addValueToFormData(e,t,r);else n instanceof File?e.append(t,n):n instanceof Date?e.append(t,n.toISOString()):h.isObject(n)?e.append(t,JSON.stringify(n)):e.append(t,""+n)}static dummyCollectionRecord(e){var u,l,f,d,p,m,O;const t=(e==null?void 0:e.schema)||[],n=(e==null?void 0:e.type)==="auth",r=(e==null?void 0:e.type)==="view",i={id:"RECORD_ID",collectionId:e==null?void 0:e.id,collectionName:e==null?void 0:e.name};n&&(i.username="username123",i.verified=!1,i.emailVisibility=!0,i.email="test@example.com"),(!r||h.extractColumnsFromQuery((u=e==null?void 0:e.options)==null?void 0:u.query).includes("created"))&&(i.created="2022-01-01 01:00:00.123Z"),(!r||h.extractColumnsFromQuery((l=e==null?void 0:e.options)==null?void 0:l.query).includes("updated"))&&(i.updated="2022-01-01 23:59:59.456Z");for(const N of t){let k=null;N.type==="number"?k=123:N.type==="date"?k="2022-01-01 10:00:00.123Z":N.type==="bool"?k=!0:N.type==="email"?k="test@example.com":N.type==="url"?k="https://example.com":N.type==="json"?k="JSON":N.type==="file"?(k="filename.jpg",((f=N.options)==null?void 0:f.maxSelect)!==1&&(k=[k])):N.type==="select"?(k=(p=(d=N.options)==null?void 0:d.values)==null?void 0:p[0],((m=N.options)==null?void 0:m.maxSelect)!==1&&(k=[k])):N.type==="relation"?(k="RELATION_RECORD_ID",((O=N.options)==null?void 0:O.maxSelect)!==1&&(k=[k])):k="test",i[N.name]=k}return i}static dummyCollectionSchemaData(e){var r,i,a,o;const t=(e==null?void 0:e.schema)||[],n={};for(const u of t){let l=null;if(u.type==="number")l=123;else if(u.type==="date")l="2022-01-01 10:00:00.123Z";else if(u.type==="bool")l=!0;else if(u.type==="email")l="test@example.com";else if(u.type==="url")l="https://example.com";else if(u.type==="json")l="JSON";else{if(u.type==="file")continue;u.type==="select"?(l=(i=(r=u.options)==null?void 0:r.values)==null?void 0:i[0],((a=u.options)==null?void 0:a.maxSelect)!==1&&(l=[l])):u.type==="relation"?(l="RELATION_RECORD_ID",((o=u.options)==null?void 0:o.maxSelect)!==1&&(l=[l])):l="test"}n[u.name]=l}return n}static getCollectionTypeIcon(e){switch(e==null?void 0:e.toLowerCase()){case"auth":return"ri-group-line";case"view":return"ri-table-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"editor":return"ri-edit-2-line";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":(e==null?void 0:e.type)==="bool"?"false":(e==null?void 0:e.type)==="json"?'null, "", [], {}':["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,n=!1){if(e=e||{},t=t||{},e.id!=t.id)return!0;for(let l in e)if(l!=="schema"&&JSON.stringify(e[l])!==JSON.stringify(t[l]))return!0;const r=Array.isArray(e.schema)?e.schema:[],i=Array.isArray(t.schema)?t.schema:[],a=r.filter(l=>(l==null?void 0:l.id)&&!h.findByKey(i,"id",l.id)),o=i.filter(l=>(l==null?void 0:l.id)&&!h.findByKey(r,"id",l.id)),u=i.filter(l=>{const f=h.isObject(l)&&h.findByKey(r,"id",l.id);if(!f)return!1;for(let d in f)if(JSON.stringify(l[d])!=JSON.stringify(f[d]))return!0;return!1});return!!(o.length||u.length||n&&a.length)}static sortCollections(e=[]){const t=[],n=[],r=[];for(const a of e)a.type==="auth"?t.push(a):a.type==="base"?n.push(a):r.push(a);function i(a,o){return a.name>o.name?1:a.name{setTimeout(e,0)})}static defaultFlatpickrOptions(){return{dateFormat:"Y-m-d H:i:S",disableMobile:!0,allowInput:!0,enableTime:!0,time_24hr:!0,locale:{firstDayOfWeek:1}}}static defaultEditorOptions(){const e=["DIV","P","A","EM","B","STRONG","H1","H2","H3","H4","H5","H6","TABLE","TR","TD","TH","TBODY","THEAD","TFOOT","BR","HR","Q","SUP","SUB","DEL","IMG","OL","UL","LI","CODE"];function t(r){let i=r.parentNode;for(;r.firstChild;)i.insertBefore(r.firstChild,r);i.removeChild(r)}function n(r){if(r){for(const i of r.children)n(i);e.includes(r.tagName)?(r.removeAttribute("style"),r.removeAttribute("class")):t(r)}}return{branding:!1,promotion:!1,menubar:!1,min_height:270,height:270,max_height:700,autoresize_bottom_margin:30,skin:"pocketbase",content_style:"body { font-size: 14px }",plugins:["autoresize","autolink","lists","link","image","searchreplace","fullscreen","media","table","code","codesample","directionality"],codesample_global_prismjs:!0,codesample_languages:[{text:"HTML/XML",value:"markup"},{text:"CSS",value:"css"},{text:"SQL",value:"sql"},{text:"JavaScript",value:"javascript"},{text:"Go",value:"go"},{text:"Dart",value:"dart"},{text:"Zig",value:"zig"},{text:"Rust",value:"rust"},{text:"Lua",value:"lua"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"},{text:"Markdown",value:"markdown"},{text:"Swift",value:"swift"},{text:"Kotlin",value:"kotlin"},{text:"Elixir",value:"elixir"},{text:"Scala",value:"scala"},{text:"Julia",value:"julia"},{text:"Haskell",value:"haskell"}],toolbar:"styles | alignleft aligncenter alignright | bold italic forecolor backcolor | bullist numlist | link image_picker table codesample direction | code fullscreen",paste_postprocess:(r,i)=>{n(i.node)},file_picker_types:"image",file_picker_callback:(r,i,a)=>{const o=document.createElement("input");o.setAttribute("type","file"),o.setAttribute("accept","image/*"),o.addEventListener("change",u=>{const l=u.target.files[0],f=new FileReader;f.addEventListener("load",()=>{if(!tinymce)return;const d="blobid"+new Date().getTime(),p=tinymce.activeEditor.editorUpload.blobCache,m=f.result.split(",")[1],O=p.create(d,l,m);p.add(O),r(O.blobUri(),{title:l.name})}),f.readAsDataURL(l)}),o.click()},setup:r=>{r.on("keydown",a=>{(a.ctrlKey||a.metaKey)&&a.code=="KeyS"&&r.formElement&&(a.preventDefault(),a.stopPropagation(),r.formElement.dispatchEvent(new KeyboardEvent("keydown",a)))});const i="tinymce_last_direction";r.on("init",()=>{var o;const a=(o=window==null?void 0:window.localStorage)==null?void 0:o.getItem(i);!r.isDirty()&&r.getContent()==""&&a=="rtl"&&r.execCommand("mceDirectionRTL")}),r.ui.registry.addMenuButton("direction",{icon:"visualchars",fetch:a=>{a([{type:"menuitem",text:"LTR content",icon:"ltr",onAction:()=>{var u;(u=window==null?void 0:window.localStorage)==null||u.setItem(i,"ltr"),r.execCommand("mceDirectionLTR")}},{type:"menuitem",text:"RTL content",icon:"rtl",onAction:()=>{var u;(u=window==null?void 0:window.localStorage)==null||u.setItem(i,"rtl"),r.execCommand("mceDirectionRTL")}}])}}),r.ui.registry.addMenuButton("image_picker",{icon:"image",fetch:a=>{a([{type:"menuitem",text:"From collection",icon:"gallery",onAction:()=>{r.dispatch("collections_file_picker",{})}},{type:"menuitem",text:"Inline",icon:"browse",onAction:()=>{r.execCommand("mceImage")}}])}})}}}static displayValue(e,t,n="N/A"){e=e||{},t=t||[];let r=[];for(const a of t){let o=e[a];typeof o>"u"||(o=h.stringifyValue(o,n),r.push(o))}if(r.length>0)return r.join(", ");const i=["title","name","slug","email","username","nickname","label","heading","message","key","identifier","id"];for(const a of i){let o=h.stringifyValue(e[a],"");if(o)return o}return n}static stringifyValue(e,t="N/A",n=150){if(h.isEmpty(e))return t;if(typeof e=="number")return""+e;if(typeof e=="boolean")return e?"True":"False";if(typeof e=="string")return e=e.indexOf("<")>=0?h.plainText(e):e,h.truncate(e,n)||t;if(Array.isArray(e)&&typeof e[0]!="object")return h.truncate(e.join(","),n);if(typeof e=="object")try{return h.truncate(JSON.stringify(e),n)||t}catch{return t}return e}static extractColumnsFromQuery(e){var a;const t="__GROUP__";e=(e||"").replace(/\([\s\S]+?\)/gm,t).replace(/[\t\r\n]|(?:\s\s)+/g," ");const n=e.match(/select\s+([\s\S]+)\s+from/),r=((a=n==null?void 0:n[1])==null?void 0:a.split(","))||[],i=[];for(let o of r){const u=o.trim().split(" ").pop();u!=""&&u!=t&&i.push(u.replace(/[\'\"\`\[\]\s]/g,""))}return i}static getAllCollectionIdentifiers(e,t=""){if(!e)return[];let n=[t+"id"];if(e.type==="view")for(let i of h.extractColumnsFromQuery(e.options.query))h.pushUnique(n,t+i);else e.type==="auth"?(n.push(t+"username"),n.push(t+"email"),n.push(t+"emailVisibility"),n.push(t+"verified"),n.push(t+"created"),n.push(t+"updated")):(n.push(t+"created"),n.push(t+"updated"));const r=e.schema||[];for(const i of r)h.pushUnique(n,t+i.name);return n}static getCollectionAutocompleteKeys(e,t,n="",r=0){var o,u,l,f;let i=e.find(d=>d.name==t||d.id==t);if(!i||r>=4)return[];i.schema=i.schema||[];let a=h.getAllCollectionIdentifiers(i,n);for(const d of i.schema){const p=n+d.name;if(d.type=="relation"&&((o=d.options)!=null&&o.collectionId)){const m=h.getCollectionAutocompleteKeys(e,d.options.collectionId,p+".",r+1);m.length&&(a=a.concat(m))}d.type=="select"&&((u=d.options)==null?void 0:u.maxSelect)!=1&&a.push(p+":each"),((l=d.options)==null?void 0:l.maxSelect)!=1&&["select","file","relation"].includes(d.type)&&a.push(p+":length")}for(const d of e){d.schema=d.schema||[];for(const p of d.schema)if(p.type=="relation"&&((f=p.options)==null?void 0:f.collectionId)==i.id){const m=n+d.name+"_via_"+p.name,O=h.getCollectionAutocompleteKeys(e,d.id,m+".",r+2);O.length&&(a=a.concat(O))}}return a}static getCollectionJoinAutocompleteKeys(e){const t=[];for(const n of e){const r="@collection."+n.name+".",i=h.getCollectionAutocompleteKeys(e,n.name,r);for(const a of i)t.push(a)}return t}static getRequestAutocompleteKeys(e,t){const n=[];n.push("@request.context"),n.push("@request.method"),n.push("@request.query."),n.push("@request.data."),n.push("@request.headers."),n.push("@request.auth.id"),n.push("@request.auth.collectionId"),n.push("@request.auth.collectionName"),n.push("@request.auth.verified"),n.push("@request.auth.username"),n.push("@request.auth.email"),n.push("@request.auth.emailVisibility"),n.push("@request.auth.created"),n.push("@request.auth.updated");const r=e.filter(i=>i.type==="auth");for(const i of r){const a=h.getCollectionAutocompleteKeys(e,i.id,"@request.auth.");for(const o of a)h.pushUnique(n,o)}if(t){const i=["created","updated"],a=h.getCollectionAutocompleteKeys(e,t,"@request.data.");for(const o of a){n.push(o);const u=o.split(".");u.length===3&&u[2].indexOf(":")===-1&&!i.includes(u[2])&&n.push(o+":isset")}}return n}static parseIndex(e){var u,l,f,d,p;const t={unique:!1,optional:!1,schemaName:"",indexName:"",tableName:"",columns:[],where:""},r=/create\s+(unique\s+)?\s*index\s*(if\s+not\s+exists\s+)?(\S*)\s+on\s+(\S*)\s*\(([\s\S]*)\)(?:\s*where\s+([\s\S]*))?/gmi.exec((e||"").trim());if((r==null?void 0:r.length)!=7)return t;const i=/^[\"\'\`\[\{}]|[\"\'\`\]\}]$/gm;t.unique=((u=r[1])==null?void 0:u.trim().toLowerCase())==="unique",t.optional=!h.isEmpty((l=r[2])==null?void 0:l.trim());const a=(r[3]||"").split(".");a.length==2?(t.schemaName=a[0].replace(i,""),t.indexName=a[1].replace(i,"")):(t.schemaName="",t.indexName=a[0].replace(i,"")),t.tableName=(r[4]||"").replace(i,"");const o=(r[5]||"").replace(/,(?=[^\(]*\))/gmi,"{PB_TEMP}").split(",");for(let m of o){m=m.trim().replaceAll("{PB_TEMP}",",");const N=/^([\s\S]+?)(?:\s+collate\s+([\w]+))?(?:\s+(asc|desc))?$/gmi.exec(m);if((N==null?void 0:N.length)!=4)continue;const k=(d=(f=N[1])==null?void 0:f.trim())==null?void 0:d.replace(i,"");k&&t.columns.push({name:k,collate:N[2]||"",sort:((p=N[3])==null?void 0:p.toUpperCase())||""})}return t.where=r[6]||"",t}static buildIndex(e){let t="CREATE ";e.unique&&(t+="UNIQUE "),t+="INDEX ",e.optional&&(t+="IF NOT EXISTS "),e.schemaName&&(t+=`\`${e.schemaName}\`.`),t+=`\`${e.indexName||"idx_"+h.randomString(7)}\` `,t+=`ON \`${e.tableName}\` (`;const n=e.columns.filter(r=>!!(r!=null&&r.name));return n.length>1&&(t+=` + `),t+=n.map(r=>{let i="";return r.name.includes("(")||r.name.includes(" ")?i+=r.name:i+="`"+r.name+"`",r.collate&&(i+=" COLLATE "+r.collate),r.sort&&(i+=" "+r.sort.toUpperCase()),i}).join(`, + `),n.length>1&&(t+=` +`),t+=")",e.where&&(t+=` WHERE ${e.where}`),t}static replaceIndexTableName(e,t){const n=h.parseIndex(e);return n.tableName=t,h.buildIndex(n)}static replaceIndexColumn(e,t,n){if(t===n)return e;const r=h.parseIndex(e);let i=!1;for(let a of r.columns)a.name===t&&(a.name=n,i=!0);return i?h.buildIndex(r):e}static normalizeSearchFilter(e,t){if(e=(e||"").trim(),!e||!t.length)return e;const n=["=","!=","~","!~",">",">=","<","<="];for(const r of n)if(e.includes(r))return e;return e=isNaN(e)&&e!="true"&&e!="false"?`"${e.replace(/^[\"\'\`]|[\"\'\`]$/gm,"")}"`:e,t.map(r=>`${r}~${e}`).join("||")}static normalizeLogsFilter(e,t=[]){return h.normalizeSearchFilter(e,["level","message","data"].concat(t))}static initCollection(e){return Object.assign({id:"",created:"",updated:"",name:"",type:"base",system:!1,listRule:null,viewRule:null,createRule:null,updateRule:null,deleteRule:null,schema:[],indexes:[],options:{}},e)}static initSchemaField(e){return Object.assign({id:"",name:"",type:"text",system:!1,required:!1,options:{}},e)}static triggerResize(){window.dispatchEvent(new Event("resize"))}static getHashQueryParams(){let e="";const t=window.location.hash.indexOf("?");return t>-1&&(e=window.location.hash.substring(t+1)),Object.fromEntries(new URLSearchParams(e))}static replaceHashQueryParams(e){e=e||{};let t="",n=window.location.hash;const r=n.indexOf("?");r>-1&&(t=n.substring(r+1),n=n.substring(0,r));const i=new URLSearchParams(t);for(let u in e){const l=e[u];l===null?i.delete(u):i.set(u,l)}t=i.toString(),t!=""&&(n+="?"+t);let a=window.location.href;const o=a.indexOf("#");o>-1&&(a=a.substring(0,o)),window.location.replace(a+n)}}const nt=11e3;onmessage=s=>{var t,n;if(!s.data.collections)return;const e={};e.baseKeys=h.getCollectionAutocompleteKeys(s.data.collections,(t=s.data.baseCollection)==null?void 0:t.name),e.baseKeys=rt(e.baseKeys.sort(st),nt),s.data.disableRequestKeys||(e.requestKeys=h.getRequestAutocompleteKeys(s.data.collections,(n=s.data.baseCollection)==null?void 0:n.name),e.requestKeys=rt(e.requestKeys.sort(st),nt)),s.data.disableCollectionJoinKeys||(e.collectionJoinKeys=h.getCollectionJoinAutocompleteKeys(s.data.collections),e.collectionJoinKeys=rt(e.collectionJoinKeys.sort(st),nt)),postMessage(e)};function st(s,e){return s.length-e.length}function rt(s,e){return s.length>e?s.slice(0,e):s}})(); diff --git a/ui/dist/assets/index-u64XbdBO.js b/ui/dist/assets/index-8bZ4r7AC.js similarity index 88% rename from ui/dist/assets/index-u64XbdBO.js rename to ui/dist/assets/index-8bZ4r7AC.js index 56f13a45..94b50301 100644 --- a/ui/dist/assets/index-u64XbdBO.js +++ b/ui/dist/assets/index-8bZ4r7AC.js @@ -1,13 +1,13 @@ -class V{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){[e,t]=Kt(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),Ue.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Kt(this,e,t);let i=[];return this.decompose(e,t,i,0),Ue.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),n=new ui(this),r=new ui(e);for(let o=t,l=t;;){if(n.next(o),r.next(o),o=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(e=1){return new ui(this,e)}iterRange(e,t=this.length){return new yl(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bl(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?V.empty:e.length<=32?new _(e):Ue.from(_.split(e,[]))}}class _ extends V{constructor(e,t=ac(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let r=0;;r++){let o=this.text[r],l=n+o.length;if((t?i:l)>=e)return new hc(n,l,i,o);n=l+1,i++}}decompose(e,t,i,n){let r=e<=0&&t>=this.length?this:new _(Rr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=i.pop(),l=nn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new _(l,o.length+r.length));else{let a=l.length>>1;i.push(new _(l.slice(0,a)),new _(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof _))return super.replace(e,t,i);[e,t]=Kt(this,e,t);let n=nn(this.text,nn(i.text,Rr(this.text,0,e)),t),r=this.length+i.length-(t-e);return n.length<=32?new _(n,r):Ue.from(_.split(n,[]),r)}sliceString(e,t=this.length,i=` +class V{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){[e,t]=Kt(this,e,t);let n=[];return this.decompose(0,e,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(t,this.length,n,1),Ue.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Kt(this,e,t);let i=[];return this.decompose(e,t,i,0),Ue.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),n=new ui(this),r=new ui(e);for(let o=t,l=t;;){if(n.next(o),r.next(o),o=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(e=1){return new ui(this,e)}iterRange(e,t=this.length){return new yl(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bl(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?V.empty:e.length<=32?new _(e):Ue.from(_.split(e,[]))}}class _ extends V{constructor(e,t=cc(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let r=0;;r++){let o=this.text[r],l=n+o.length;if((t?i:l)>=e)return new fc(n,l,i,o);n=l+1,i++}}decompose(e,t,i,n){let r=e<=0&&t>=this.length?this:new _(Rr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=i.pop(),l=nn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new _(l,o.length+r.length));else{let a=l.length>>1;i.push(new _(l.slice(0,a)),new _(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof _))return super.replace(e,t,i);[e,t]=Kt(this,e,t);let n=nn(this.text,nn(i.text,Rr(this.text,0,e)),t),r=this.length+i.length-(t-e);return n.length<=32?new _(n,r):Ue.from(_.split(n,[]),r)}sliceString(e,t=this.length,i=` `){[e,t]=Kt(this,e,t);let n="";for(let r=0,o=0;r<=t&&oe&&o&&(n+=i),er&&(n+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let r of e)i.push(r),n+=r.length+1,i.length==32&&(t.push(new _(i,n)),i=[],n=-1);return n>-1&&t.push(new _(i,n)),t}}class Ue extends V{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,n){for(let r=0;;r++){let o=this.children[r],l=n+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,n);n=l+1,i=a+1}}decompose(e,t,i,n){for(let r=0,o=0;o<=t&&r=o){let h=n&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=Kt(this,e,t),i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[n]=a,new Ue(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` -`){[e,t]=Kt(this,e,t);let n="";for(let r=0,o=0;re&&r&&(n+=i),eo&&(n+=l.sliceString(e-o,t-o,i)),o=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ue))return 0;let i=0,[n,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,r+=t){if(n==o||r==l)return i;let a=this.children[n],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,n)=>i+n.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 _(d,t)}let n=Math.max(32,i>>5),r=n<<1,o=n>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ue)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof _&&a&&(p=c[c.length-1])instanceof _&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new _(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Ue.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ue(l,t)}}V.empty=new _([""],0);function ac(s){let e=-1;for(let t of s)e+=t.length+1;return e}function nn(s,e,t=0,i=1e9){for(let n=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-n)),n0?1:(e instanceof _?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],o=r>>1,l=n instanceof _?n.text.length:n.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(n instanceof _){let a=n.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=n.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof _?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class yl{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new ui(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:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.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 bl{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},ui.prototype[Symbol.iterator]=yl.prototype[Symbol.iterator]=bl.prototype[Symbol.iterator]=function(){return this});class hc{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}}function Kt(s,e,t){return e=Math.max(0,Math.min(s.length,e)),[e,Math.max(e,Math.min(s.length,t))]}let Vt="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(s=>s?parseInt(s,36):1);for(let s=1;ss)return Vt[e-1]<=s;return!1}function Er(s){return s>=127462&&s<=127487}const Ir=8205;function oe(s,e,t=!0,i=!0){return(t?wl:fc)(s,e,i)}function wl(s,e,t){if(e==s.length)return e;e&&xl(s.charCodeAt(e))&&vl(s.charCodeAt(e-1))&&e--;let i=ne(s,e);for(e+=Be(i);e=0&&Er(ne(s,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function fc(s,e,t){for(;e>0;){let i=wl(s,e-2,t);if(i=56320&&s<57344}function vl(s){return s>=55296&&s<56320}function ne(s,e){let t=s.charCodeAt(e);if(!vl(t)||e+1==s.length)return t;let i=s.charCodeAt(e+1);return xl(i)?(t-55296<<10)+(i-56320)+65536:t}function nr(s){return s<=65535?String.fromCharCode(s):(s-=65536,String.fromCharCode((s>>10)+55296,(s&1023)+56320))}function Be(s){return s<65536?1:2}const hs=/\r\n?|\n/;var he=function(s){return s[s.Simple=0]="Simple",s[s.TrackDel=1]="TrackDel",s[s.TrackBefore=2]="TrackBefore",s[s.TrackAfter=3]="TrackAfter",s}(he||(he={}));class _e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-n);r+=l}else{if(i!=he.Simple&&h>=e&&(i==he.TrackDel&&ne||i==he.TrackBefore&&ne))return null;if(h>e||h==e&&t<0&&!l)return e==n||t<0?r:r+a;r+=a}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return r}touchesRange(e,t=e){for(let i=0,n=0;i=0&&n<=t&&l>=e)return nt?"cover":!0;n=l}return!1}toString(){let e="";for(let t=0;t=0?":"+n:"")}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 _e(e)}static create(e){return new _e(e)}}class te extends _e{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 cs(this,(t,i,n,r,o)=>e=e.replace(n,n+(i-t),o),!1),e}mapDesc(e,t=!1){return fs(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,r=0;n=0){t[n]=l,t[n+1]=o;let a=n>>1;for(;i.length0&<(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let n=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!n.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"?V.of(d.split(i||hs)):d:V.empty,m=p.length;if(f==u&&m==0)return;fo&&ae(n,f-o,-1),ae(n,u-f,m),lt(r,n,p),o=u}}return h(e),a(!l),l}static empty(e){return new te(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let n=0;nl&&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==s[n+1]?s[n]+=e:e==0&&s[n]==0?s[n+1]+=t:i?(s[n]+=e,s[n+1]+=t):s.push(e,t)}function lt(s,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==s.sections.length||s.sections[o+1]<0);)l=s.sections[o++],a=s.sections[o++];e(n,h,r,c,f),n=h,r=c}}}function fs(s,e,t,i=!1){let n=[],r=i?[]:null,o=new mi(s),l=new mi(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ae(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class mi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?V.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?V.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 xt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,n;return this.empty?i=n=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new xt(i,n,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,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}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 xt(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,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.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=>xt.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,n=0;ne?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((n,r)=>n.from-r.from),t=e.indexOf(i);for(let n=1;nr.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function Sl(s,e){for(let t of s.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let sr=0;class O{constructor(e,t,i,n,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=sr++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new O(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:rr),!!e.static,e.enables)}of(e){return new sn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new sn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new sn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function rr(s,e){return s==e||s.length==e.length&&s.every((t,i)=>t===e[i])}class sn{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=sr++}dynamicSlot(e){var t;let i=this.value,n=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||us(f,c)){let d=i(f);if(l?!Nr(d,f.values[o],n):!n(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=un(u,p);if(this.dependencies.every(g=>g instanceof O?u.facet(g)===f.facet(g):g instanceof ye?u.field(g,!1)==f.field(g,!1):!0)||(l?Nr(d=i(f),m,n):n(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function Nr(s,e,t){if(s.length!=e.length)return!1;for(let i=0;is[a.id]),n=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=s[e.id]>>1;function l(a){let h=[];for(let c=0;ci===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Fr).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,n)=>{let r=i.values[t],o=this.updateF(r,n);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,n)=>n.config.address[this.id]!=null?(i.values[t]=n.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,Fr.of({field:this,create:e})]}get extension(){return this}}const wt={lowest:4,low:3,default:2,high:1,highest:0};function ti(s){return e=>new Cl(e,s)}const Bt={highest:ti(wt.highest),high:ti(wt.high),default:ti(wt.default),low:ti(wt.low),lowest:ti(wt.lowest)};class Cl{constructor(e,t){this.inner=e,this.prec=t}}class Pn{of(e){return new ds(this,e)}reconfigure(e){return Pn.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ds{constructor(e,t){this.compartment=e,this.inner=t}}class fn{constructor(e,t,i,n,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=n,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let n=[],r=Object.create(null),o=new Map;for(let u of dc(e,t,o))u instanceof ye?n.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.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]=a.length<<1|1,rr(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(y=>g.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(g=>uc(g,p,d))}}let f=h.map(u=>u(l));return new fn(e,o,f,l,a,r)}}function dc(s,e,t){let i=[[],[],[],[],[]],n=new Map;function r(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof ds&&t.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof ds){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Cl)r(o.inner,o.prec);else if(o instanceof ye)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof sn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,wt.default);else{let h=o.extension;if(!h)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(h,l)}}return r(s,wt.default),i.reduce((o,l)=>o.concat(l))}function di(s,e){if(e&1)return 2;let t=e>>1,i=s.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;s.status[t]=4;let n=s.computeSlot(s,s.config.dynamicSlots[t]);return s.status[t]=2|n}function un(s,e){return e&1?s.config.staticValues[e>>1]:s.values[e>>1]}const Al=O.define(),ps=O.define({combine:s=>s.some(e=>e),static:!0}),Ml=O.define({combine:s=>s.length?s[0]:void 0,static:!0}),Dl=O.define(),Ol=O.define(),Tl=O.define(),Bl=O.define({combine:s=>s.length?s[0]:!1});class nt{constructor(e,t){this.type=e,this.value=t}static define(){return new pc}}class pc{of(e){return new nt(this,e)}}class gc{constructor(e){this.map=e}of(e){return new F(this,e)}}class F{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 F(this.type,t)}is(e){return this.type==e}static define(e={}){return new gc(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let n of e){let r=n.map(t);r&&i.push(r)}return i}}F.reconfigure=F.define();F.appendConfig=F.define();class Q{constructor(e,t,i,n,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=n,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Sl(i,t.newLength),r.some(l=>l.type==Q.time)||(this.annotations=r.concat(Q.time.of(Date.now())))}static create(e,t,i,n,r,o){return new Q(e,t,i,n,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=nt.define();Q.userEvent=nt.define();Q.addToHistory=nt.define();Q.remote=nt.define();function mc(s,e){let t=[];for(let i=0,n=0;;){let r,o;if(i=s[i]))r=s[i++],o=s[i++];else if(n=0;n--){let r=i[n](s);r instanceof Q?s=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Q?s=r[0]:s=Ll(e,Wt(r),!1)}return s}function bc(s){let e=s.startState,t=e.facet(Tl),i=s;for(let n=t.length-1;n>=0;n--){let r=t[n](s);r&&Object.keys(r).length&&(i=Pl(i,gs(e,r,s.changes.newLength),!0))}return i==s?s:Q.create(e,s.changes,s.selection,i.effects,i.annotations,i.scrollIntoView)}const wc=[];function Wt(s){return s==null?wc:Array.isArray(s)?s:[s]}var G=function(s){return s[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s}(G||(G={}));const xc=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ms;try{ms=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function vc(s){if(ms)return ms.test(s);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||xc.test(t)))return!0}return!1}function kc(s){return e=>{if(!/\S/.test(e))return G.Space;if(vc(e))return G.Word;for(let t=0;t-1)return G.Word;return G.Other}}class H{constructor(e,t,i,n,r,o){this.config=e,this.doc=t,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ln.set(h,a)),t=null),n.set(l.value.compartment,l.value.extension)):l.is(F.reconfigure)?(t=null,i=l.value):l.is(F.appendConfig)&&(t=null,i=Wt(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=fn.resolve(i,n,this),r=new H(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(ps)?e.newSelection:e.newSelection.asSingle();new H(t,e.newDoc,o,r,(l,a)=>a.update(l,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]),n=this.changes(i.changes),r=[i.range],o=Wt(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return H.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=fn.resolve(e.extensions||[],new Map),i=e.doc instanceof V?e.doc:V.of((e.doc||"").split(t.staticFacet(H.lineSeparator)||hs)),n=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return Sl(n,i.length),t.staticFacet(ps)||(n=n.asSingle()),new H(t,i,n,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(H.tabSize)}get lineBreak(){return this.facet(H.lineSeparator)||` -`}get readOnly(){return this.facet(Bl)}phrase(e,...t){for(let i of this.facet(H.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,n)=>{if(n=="$")return"$";let r=+(n||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let n=[];for(let r of this.facet(Al))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){return kc(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:n}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=oe(t,o,!1);if(r(t.slice(a,o))!=G.Word)break;o=a}for(;ls.length?s[0]:4});H.lineSeparator=Ml;H.readOnly=Bl;H.phrases=O.define({compare(s,e){let t=Object.keys(s),i=Object.keys(e);return t.length==i.length&&t.every(n=>s[n]==e[n])}});H.languageData=Al;H.changeFilter=Dl;H.transactionFilter=Ol;H.transactionExtender=Tl;Pn.reconfigure=F.define();function Pt(s,e,t={}){let i={};for(let n of s)for(let r of Object.keys(n)){let o=n[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 n in e)i[n]===void 0&&(i[n]=e[n]);return i}class Ct{eq(e){return this==e}range(e,t=e){return ys.create(e,t,this)}}Ct.prototype.startSide=Ct.prototype.endSide=0;Ct.prototype.point=!1;Ct.prototype.mapMode=he.TrackDel;let ys=class Rl{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Rl(e,t,i)}};function bs(s,e){return s.from-e.from||s.value.startSide-e.value.startSide}class or{constructor(e,t,i,n){this.from=e,this.to=t,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,n=0){let r=i?this.to:this.from;for(let o=n,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,n){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),n.push(u-o),r.push(d-o))}return{mapped:i.length?new or(n,r,i,l):null,pos:o}}}class ${constructor(e,t,i,n){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=n}static create(e,t,i,n){return new $(e,t,i,n)}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:n=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(bs)),this.isEmpty)return t.length?$.of(t):this;let l=new El(this,null,-1).goto(0),a=0,h=[],c=new At;for(;l.value||a=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.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 yi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return yi.from(e).goto(t)}static compare(e,t,i,n,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),a=Vr(o,l,i),h=new ii(o,a,r),c=new ii(l,a,r);i.iterGaps((f,u,d)=>Wr(h,f,c,u,d,n)),i.empty&&i.length==0&&Wr(h,0,c,0,0,n)}static eq(e,t,i=0,n){n==null&&(n=999999999);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),a=new ii(r,l,0).goto(i),h=new ii(o,l,0).goto(i);for(;;){if(a.to!=h.to||!ws(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>n)return!0;a.next(),h.next()}}static spans(e,t,i,n,r=-1){let o=new ii(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(n.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new At;for(let n of e instanceof ys?[e]:t?Sc(e):e)i.add(n.from,n.to,n.value);return i.finish()}static join(e){if(!e.length)return $.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let n=e[i];n!=$.empty;n=n.nextLayer)t=new $(n.chunkPos,n.chunk,t,Math.max(n.maxPoint,t.maxPoint));return t}}$.empty=new $([],[],null,-1);function Sc(s){if(s.length>1)for(let e=s[0],t=1;t0)return s.slice().sort(bs);e=i}return s}$.empty.nextLayer=$.empty;class At{finishChunk(e){this.chunks.push(new or(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=[])}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}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new At)).add(e,t,i)}addInner(e,t,i){let n=e-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return n<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($.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=$.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Vr(s,e,t){let i=new Map;for(let r of s)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&&n.push(new El(o,t,i,r));return n.length==1?n[0]:new yi(n)}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--)$n(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--)$n(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(),$n(this.heap,0)}}}function $n(s,e){for(let t=s[e];;){let i=(e<<1)+1;if(i>=s.length)break;let n=s[i];if(i+1=0&&(n=s[i+1],i++),t.compare(n)<0)break;s[i]=t,s[e]=n,e=i}}class ii{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=yi.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){Ni(this.active,e),Ni(this.activeTo,e),Ni(this.activeRank,e),this.minActive=Hr(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:n,rank:r}=this.cursor;for(;t0;)t++;Fi(this.active,t,i),Fi(this.activeTo,t,n),Fi(this.activeRank,t,r),e&&Fi(e,t,this.cursor.from),this.minActive=Hr(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Ni(i,n)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[n]=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 Wr(s,e,t,i,n,r){s.goto(e),t.goto(i);let o=i+n,l=i,a=i-e;for(;;){let h=s.to+a-t.to||s.endSide-t.endSide,c=h<0?s.to+a:t.to,f=Math.min(c,o);if(s.point||t.point?s.point&&t.point&&(s.point==t.point||s.point.eq(t.point))&&ws(s.activeForPoint(s.to),t.activeForPoint(t.to))||r.comparePoint(l,f,s.point,t.point):f>l&&!ws(s.active,t.active)&&r.compareRange(l,f,s.active,t.active),c>o)break;l=c,h<=0&&s.next(),h>=0&&t.next()}}function ws(s,e){if(s.length!=e.length)return!1;for(let t=0;t=e;i--)s[i+1]=s[i];s[e]=t}function Hr(s,e){let t=-1,i=1e9;for(let n=0;n=e)return n;if(n==s.length)break;r+=s.charCodeAt(n)==9?t-r%t:1,n=oe(s,n)}return i===!0?-1:s.length}const vs="ͼ",zr=typeof Symbol>"u"?"__"+vs:Symbol.for(vs),ks=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),qr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ut{constructor(e,t){this.rules=[];let{finish:i}=t||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.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,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(n(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(n(o),e[o],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=qr[zr]||1;return qr[zr]=e+1,vs+e.toString(36)}static mount(e,t,i){let n=e[ks],r=i&&i.nonce;n?r&&n.setNonce(r):n=new Cc(e,r),n.mount(Array.isArray(t)?t:[t])}}let $r=new Map;class Cc{constructor(e,t){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let r=$r.get(i);if(r)return e.adoptedStyleSheets=[r.sheet,...e.adoptedStyleSheets],e[ks]=r;this.sheet=new n.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],$r.set(i,this)}else{this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);let r=e.head||e;r.insertBefore(this.styleTag,r.firstChild)}this.modules=[],e[ks]=this}mount(e){let t=this.sheet,i=0,n=0;for(let r=0;r-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,o),t)for(let a=0;a",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ac=typeof navigator<"u"&&/Mac/.test(navigator.platform),Mc=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var se=0;se<10;se++)dt[48+se]=dt[96+se]=String(se);for(var se=1;se<=24;se++)dt[se+111]="F"+se;for(var se=65;se<=90;se++)dt[se]=String.fromCharCode(se+32),bi[se]=String.fromCharCode(se);for(var Kn in dt)bi.hasOwnProperty(Kn)||(bi[Kn]=dt[Kn]);function Dc(s){var e=Ac&&s.metaKey&&s.shiftKey&&!s.ctrlKey&&!s.altKey||Mc&&s.shiftKey&&s.key&&s.key.length==1||s.key=="Unidentified",t=!e&&s.key||(s.shiftKey?bi:dt)[s.keyCode]||s.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 dn(s){let e;return s.nodeType==11?e=s.getSelection?s:s.ownerDocument:e=s,e.getSelection()}function Ss(s,e){return e?s==e||s.contains(e.nodeType!=1?e.parentNode:e):!1}function Oc(s){let e=s.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function rn(s,e){if(!e.anchorNode)return!1;try{return Ss(s,e.anchorNode)}catch{return!1}}function jt(s){return s.nodeType==3?Mt(s,0,s.nodeValue.length).getClientRects():s.nodeType==1?s.getClientRects():[]}function pi(s,e,t,i){return t?Kr(s,e,t,i,-1)||Kr(s,e,t,i,1):!1}function wi(s){for(var e=0;;e++)if(s=s.previousSibling,!s)return e}function Kr(s,e,t,i,n){for(;;){if(s==t&&e==i)return!0;if(e==(n<0?0:et(s))){if(s.nodeName=="DIV")return!1;let r=s.parentNode;if(!r||r.nodeType!=1)return!1;e=wi(s)+(n<0?0:1),s=r}else if(s.nodeType==1){if(s=s.childNodes[e+(n<0?-1:0)],s.nodeType==1&&s.contentEditable=="false")return!1;e=n<0?et(s):0}else return!1}}function et(s){return s.nodeType==3?s.nodeValue.length:s.childNodes.length}function Ln(s,e){let t=e?s.left:s.right;return{left:t,right:t,top:s.top,bottom:s.bottom}}function Tc(s){return{left:0,right:s.innerWidth,top:0,bottom:s.innerHeight}}function Il(s,e){let t=e.width/s.offsetWidth,i=e.height/s.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-s.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-s.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function Bc(s,e,t,i,n,r,o,l){let a=s.ownerDocument,h=a.defaultView||window;for(let c=s,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,p=1,m=1;if(d)u=Tc(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let w=c.getBoundingClientRect();({scaleX:p,scaleY:m}=Il(c,w)),u={left:w.left,right:w.left+c.clientWidth*p,top:w.top,bottom:w.top+c.clientHeight*m}}let g=0,y=0;if(n=="nearest")e.top0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+y+o)):e.bottom>u.bottom&&(y=e.bottom-u.bottom+o,t<0&&e.top-y0&&e.right>u.right+g&&(g=e.right-u.right+g+r)):e.right>u.right&&(g=e.right-u.right+r,t<0&&e.leftt.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11)t=t.host;else break;return null}class Lc{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?et(t):0),i,Math.min(e.focusOffset,i?et(i):0))}set(e,t,i,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=n}}let Et=null;function Nl(s){if(s.setActive)return s.setActive();if(Et)return s.focus(Et);let e=[];for(let t=s;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(s.focus(Et==null?{get preventScroll(){return Et={preventScroll:!0},!0}}:void 0),!Et){Et=!1;for(let t=0;tMath.max(1,s.scrollHeight-s.clientHeight-4)}class ce{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new ce(e.parentNode,wi(e),t)}static after(e,t){return new ce(e.parentNode,wi(e)+1,t)}}const lr=[];class U{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,n=null,r;for(let o of this.children){if(o.flags&7){if(!o.dom&&(r=n?n.nextSibling:i.firstChild)){let l=U.get(r);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(r)}o.sync(e,t),o.flags&=-8}if(r=n?n.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&r!=o.dom&&(t.written=!0),o.dom.parentNode==i)for(;r&&r!=o.dom;)r=Ur(r);else i.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:i.firstChild,r&&t&&t.node==i&&(t.written=!0);r;)r=Ur(r)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let n=et(e)==0?0:t==0?-1:1;for(;;){let r=e.parentNode;if(r==this.dom)break;n==0&&r.firstChild!=r.lastChild&&(e==r.firstChild?n=-1:n=1),e=r}n<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!U.get(i);)i=i.nextSibling;if(!i)return this.length;for(let n=0,r=0;;n++){let o=this.children[n];if(o.dom==i)return r;r+=o.length+o.breakAfter}}domBoundsAround(e,t,i=0){let n=-1,r=-1,o=-1,l=-1;for(let a=0,h=i,c=i;at)return f.domBoundsAround(e,t,h);if(u>=e&&n==-1&&(n=a,r=h),h>t&&f.dom.parentNode==this.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=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=lr){this.markDirty();for(let n=e;nthis.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 Hl(s,e,t,i,n,r,o,l,a){let{children:h}=s,c=h.length?h[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,n,r.length?f:null,t==0,l,a))){if(i0&&(!o&&r.length&&c.merge(t,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(t2);var D={mac:Yr||/Mac/.test(Me.platform),windows:/Win/.test(Me.platform),linux:/Linux|X11/.test(Me.platform),ie:Rn,ie_version:ql?Cs.documentMode||6:Ms?+Ms[1]:As?+As[1]:0,gecko:Gr,gecko_version:Gr?+(/Firefox\/(\d+)/.exec(Me.userAgent)||[0,0])[1]:0,chrome:!!jn,chrome_version:jn?+jn[1]:0,ios:Yr,android:/Android\b/.test(Me.userAgent),webkit:Jr,safari:$l,webkit_version:Jr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Cs.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Ic=256;class tt extends U{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return this.flags&8||i&&(!(i instanceof tt)||this.length-(t-e)+i.length>Ic||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new tt(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new ce(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 Nc(this.dom,e,t)}}class it extends U{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let n of t)n.setParent(this)}setAttrs(e){if(Fl(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}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,n,r,o){return i&&(!(i instanceof it&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(n=r),i=a,r++}let o=this.length-e;return this.length=e,n>-1&&(this.children.length=n,this.markDirty()),new it(this.mark,t,o)}domAtPos(e){return Kl(this,e)}coordsAt(e,t){return Ul(this,e,t)}}function Nc(s,e,t){let i=s.nodeValue.length;e>i&&(e=i);let n=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?D.chrome||D.gecko||(e?(n--,o=1):r=0)?0:l.length-1];return D.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?Ln(a,o<0):a||null}class vt extends U{static create(e,t,i){return new vt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=vt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,n,r,o){return i&&(!(i instanceof vt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0)?ce.before(this.dom):ce.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let n=this.dom.getClientRects(),r=null;if(!n.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?n.length-1:0;r=n[l],!(e>0?l==0:l==n.length-1||r.top0?ce.before(this.dom):ce.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return V.empty}get isHidden(){return!0}}tt.prototype.children=vt.prototype.children=Ut.prototype.children=lr;function Kl(s,e){let t=s.dom,{children:i}=s,n=0;for(let r=0;nr&&e0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=n;r0&&e instanceof it&&n.length&&(i=n[n.length-1])instanceof it&&i.mark.eq(e.mark)?jl(i,e.children[0],t-1):(n.push(e),e.setParent(s)),s.length+=e.length}function Ul(s,e,t){let i=null,n=-1,r=null,o=-1;function l(h,c){for(let f=0,u=0;f=c&&(d.children.length?l(d,c-u):(!r||r.isHidden&&t>0)&&(p>c||u==p&&d.getSide()>0)?(r=d,o=c-u):(u-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let r of i)if(r!=t&&(n.indexOf(r)==-1||s[r]!==e[r]))return!1;return!0}function Os(s,e,t){let i=!1;if(e)for(let n in e)t&&n in t||(i=!0,n=="style"?s.style.cssText="":s.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(i=!0,n=="style"?s.style.cssText=t[n]:s.setAttribute(n,t[n]));return i}function Vc(s){let e=Object.create(null);for(let t=0;t0&&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){ar(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){jl(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Ds(t,this.attrs||{})),i&&(this.attrs=Ds({class:i},this.attrs||{}))}domAtPos(e){return Kl(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Fl(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&&(Os(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let n=this.dom.lastChild;for(;n&&U.get(n)instanceof it;)n=n.lastChild;if(!n||!this.length||n.nodeName!="BR"&&((i=U.get(n))===null||i===void 0?void 0:i.isEditable)==!1&&(!D.ios||!this.children.some(r=>r instanceof tt))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof tt)||/[^ -~]/.test(i.text))return null;let n=jt(i.dom);if(n.length!=1)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Ul(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:n}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-n.lineHeight)<2&&n.textHeight=t){if(r instanceof ee)return r;if(o>t)break}n=o+r.breakAfter}return null}}class ht extends U{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,n,r,o){return i&&(!(i instanceof ht)||!this.widget.compare(i.widget)||e>0&&r<=0||t0}}class Lt{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var De=function(s){return s[s.Text=0]="Text",s[s.WidgetBefore=1]="WidgetBefore",s[s.WidgetAfter=2]="WidgetAfter",s[s.WidgetRange=3]="WidgetRange",s}(De||(De={}));class B extends Ct{constructor(e,t,i,n){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(e){return new Ti(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new pt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,n;if(e.isBlockGap)i=-5e8,n=4e8;else{let{start:r,end:o}=Gl(e,t);i=(r?t?-3e8:-1:5e8)-1,n=(o?t?2e8:1:-6e8)+1}return new pt(e,i,n,t,e.widget||null,!0)}static line(e){return new Bi(e)}static set(e,t=!1){return $.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}B.none=$.empty;class Ti extends B{constructor(e){let{start:t,end:i}=Gl(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){var t,i;return this==e||e instanceof Ti&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&ar(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Ti.prototype.point=!1;class Bi extends B{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Bi&&this.spec.class==e.spec.class&&ar(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)}}Bi.prototype.mapMode=he.TrackBefore;Bi.prototype.point=!0;class pt extends B{constructor(e,t,i,n,r,o){super(t,i,r,e),this.block=n,this.isReplace=o,this.mapMode=n?t<=0?he.TrackBefore:he.TrackAfter:he.TrackDel}get type(){return this.startSide!=this.endSide?De.WidgetRange:this.startSide<=0?De.WidgetBefore:De.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof pt&&Wc(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)}}pt.prototype.point=!0;function Gl(s,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=s;return t==null&&(t=s.inclusive),i==null&&(i=s.inclusive),{start:t??e,end:i??e}}function Wc(s,e){return s==e||!!(s&&e&&s.compare(e))}function Ts(s,e,t,i=0){let n=t.length-1;n>=0&&t[n]+i>=s?t[n]=Math.max(t[n],e):t.push(s,e)}class gi{constructor(e,t,i,n){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ht&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ee),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Vi(new Ut(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof ht)&&this.getLine()}buildText(e,t,i){for(;e>0;){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,this.atCursorPos=!0,e--;continue}else this.text=r,this.textOff=0}let n=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Vi(new tt(this.text.slice(this.textOff,this.textOff+n)),t),i),this.atCursorPos=!0,this.textOff+=n,e-=n,i=0}}span(e,t,i,n){this.buildText(t-e,i,n),this.pos=t,this.openStart<0&&(this.openStart=n)}point(e,t,i,n,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof pt){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 pt)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ht(i.widget||new _r("div"),l,i));else{let a=vt.create(i.widget||new _r("span"),l,l?0:i.startSide),h=this.atCursorPos&&!a.isEditable&&r<=n.length&&(e0),c=!a.isEditable&&(en.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),h&&(f.append(Vi(new Ut(1),n),r),r=n.length+Math.max(0,r-n.length)),f.append(Vi(a,n),r),this.atCursorPos=c,this.pendingBuffer=c?en.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,i,n,r){let o=new gi(e,t,i,r);return o.openEnd=$.spans(n,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Vi(s,e){for(let t of e)s=new it(t,[s],s.length);return s}class _r extends Lt{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}var X=function(s){return s[s.LTR=0]="LTR",s[s.RTL=1]="RTL",s}(X||(X={}));const Dt=X.LTR,hr=X.RTL;function Jl(s){let e=[];for(let t=0;t=t){if(l.level==i)return o;(r<0||(n!=0?n<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function Xl(s,e){if(s.length!=e.length)return!1;for(let t=0;t=0;m-=3)if(ze[m+1]==-d){let g=ze[m+2],y=g&2?n:g&4?g&1?r:n:0;y&&(q[f]=q[ze[m]]=y),l=m;break}}else{if(ze.length==189)break;ze[l++]=f,ze[l++]=u,ze[l++]=a}else if((p=q[f])==2||p==1){let m=p==n;a=m?0:1;for(let g=l-3;g>=0;g-=3){let y=ze[g+2];if(y&2)break;if(m)ze[g+2]|=2;else{if(y&4)break;ze[g+2]|=4}}}}}function jc(s,e,t,i){for(let n=0,r=i;n<=t.length;n++){let o=n?t[n-1].to:s,l=na;)p==g&&(p=t[--m].from,g=m?t[m-1].to:s),q[--p]=d;a=c}else r=h,a++}}}function Ps(s,e,t,i,n,r,o){let l=i%2?2:1;if(i%2==n%2)for(let a=e,h=0;aa&&o.push(new at(a,m.from,d));let g=m.direction==Dt!=!(d%2);Ls(s,g?i+1:i,n,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(c?q[p]!=l:q[p]==l))break;p++}u?Ps(s,a,p,i+1,n,u,o):ae;){let c=!0,f=!1;if(!h||a>r[h-1].to){let m=q[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(h&&p==r[h-1].to){if(f)break e;let m=r[--h];if(!c)for(let g=m.from,y=h;;){if(g==e)break e;if(y&&r[y-1].to==g)g=r[--y].from;else{if(q[g-1]==l)break e;break}}if(u)u.push(m);else{m.toq.length;)q[q.length]=256;let i=[],n=e==Dt?0:1;return Ls(s,n,n,t,0,s.length,i),i}function _l(s){return[new at(0,s,0)]}let Ql="";function Gc(s,e,t,i,n){var r;let o=i.head-s.from,l=at.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=e[l],h=a.side(n,t);if(o==h){let u=l+=n?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!n,t),h=a.side(n,t)}let c=oe(s.text,o,a.forward(n,t));(ca.to)&&(c=h),Ql=s.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(n?e.length-1:0)?null:e[l+(n?1:-1)];return f&&c==h&&f.level+(n?0:1)s.some(e=>e)}),oa=O.define({combine:s=>s.some(e=>e)});class zt{constructor(e,t="nearest",i="nearest",n=5,r=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=n,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new zt(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new zt(b.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Wi=F.define({map:(s,e)=>s.map(e)});function Ne(s,e,t){let i=s.facet(ia);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 En=O.define({combine:s=>s.length?s[0]:!0});let Yc=0;const li=O.define();class ue{constructor(e,t,i,n,r){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=n,this.extension=r(this)}static define(e,t){const{eventHandlers:i,eventObservers:n,provide:r,decorations:o}=t||{};return new ue(Yc++,e,i,n,l=>{let a=[li.of(l)];return o&&a.push(xi.of(h=>{let c=h.plugin(l);return c?o(c):B.none})),r&&a.push(r(l)),a})}static fromClass(e,t){return ue.define(i=>new e(i),t)}}class Un{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(Ne(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){Ne(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){Ne(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const la=O.define(),cr=O.define(),xi=O.define(),aa=O.define(),fr=O.define(),ha=O.define();function Qr(s,e){let t=s.state.facet(ha);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(s):r),n=[];return $.spans(i,e.from,e.to,{point(){},span(r,o,l,a){let h=r-e.from,c=o-e.from,f=n;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,p;if(d==null&&(d=Jc(e.text,h,c)),a>0&&f.length&&(p=f[f.length-1]).to==h&&p.direction==d)p.to=c,f=p.inner;else{let m={from:h,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),n}const ca=O.define();function fa(s){let e=0,t=0,i=0,n=0;for(let r of s.state.facet(ca)){let o=r(s);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:e,right:t,top:i,bottom:n}}const ai=O.define();class Ee{constructor(e,t,i,n){this.fromA=e,this.toA=t,this.fromB=i,this.toB=n}join(e){return new Ee(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 n=e[t-1];if(!(n.fromA>i.toA)){if(n.toAc)break;r+=2}if(!a)return i;new Ee(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),o=a.toA,l=a.toB}}}class pn{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=te.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let n=[];this.changes.iterChangedRanges((r,o,l,a)=>n.push(new Ee(r,o,l,a))),this.changedRanges=n}static create(e,t,i){return new pn(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}}class Zr extends U{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,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 ee],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ee(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:h,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?n=this.domChanged.newSel.head:!nf(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?_c(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:c}=this.hasComposition;i=new Ee(h,c,e.changes.mapPos(h,-1),e.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(D.ie||D.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=ef(o,l,e.changes);return i=Ee.extendWithRanges(i,a),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=D.chrome||D.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||n.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to=0?n[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:c,toB:f}=l,u,d,p,m;if(i&&i.range.fromBc){let v=gi.build(this.view.state.doc,c,i.range.fromB,this.decorations,this.dynamicDecorationMap),x=gi.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);d=v.breakAtStart,p=v.openStart,m=x.openEnd;let A=this.compositionView(i);x.breakAtStart?A.breakAfter=1:x.content.length&&A.merge(A.length,A.length,x.content[0],!1,x.openStart,0)&&(A.breakAfter=x.content[0].breakAfter,x.content.shift()),v.content.length&&A.merge(0,0,v.content[v.content.length-1],!0,0,v.openEnd)&&v.content.pop(),u=v.content.concat(A).concat(x.content)}else({content:u,breakAtStart:d,openStart:p,openEnd:m}=gi.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:y}=r.findPos(h,1),{i:w,off:S}=r.findPos(a,-1);Hl(this,w,S,g,y,u,d,p,m)}i&&this.fixCompositionDOM(i)}compositionView(e){let t=new tt(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new it(n,[t],t.length);let i=new ee;return i.append(t,0),i}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=U.get(r);l&&l!=o&&(l.dom=null),o.setDOM(r)},i=this.childPos(e.range.fromB,1),n=this.children[i.i];t(e.line,n);for(let r=e.marks.length-1;r>=-1;r--)i=n.childPos(i.off,1),n=n.children[i.i],t(r>=0?e.marks[r].node:e.text,n)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,r=!n&&rn(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(D.gecko&&l.empty&&!this.hasComposition&&Xc(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=h=new ce(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!pi(a.node,a.offset,c.anchorNode,c.anchorOffset)||!pi(h.node,h.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))&&(this.view.observer.ignore(()=>{D.android&&D.chrome&&this.dom.contains(c.focusNode)&&tf(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=dn(this.view.root);if(f)if(l.empty){if(D.gecko){let u=Qc(a.node,a.offset);if(u&&u!=3){let d=da(a.node,a.offset,u==1?1:-1);d&&(a=new ce(d.node,d.offset))}}f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(u)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new ce(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new ce(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&pi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=dn(e.root),{anchorNode:n,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=ee.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(n,r)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let n=e.offset;!i&&n=0;n--){let r=U.get(t.childNodes[n]);r instanceof ee&&(i=r.domAtPos(r.length))}return i?new ce(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=U.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(;t=0;o--){let l=this.children[o],a=r-l.breakAfter,h=a-l.length;if(ae||l.covers(1))&&(!i||l instanceof ee&&!(i instanceof ee&&t>=0))&&(i=l,n=h),r=h}return i?i.coordsAt(e-n,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),n=this.children[t];if(!(n instanceof ee))return null;for(;n.children.length;){let{i:l,off:a}=n.childPos(i,1);for(;;l++){if(l==n.children.length)return null;if((n=n.children[l]).length)break}i=a}if(!(n instanceof tt))return null;let r=oe(n.text,i);if(r==i)return null;let o=Mt(n.dom,i,r).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==X.LTR;for(let h=0,c=0;cn)break;if(h>=i){let d=f.dom.getBoundingClientRect();if(t.push(d.height),o){let p=f.dom.lastChild,m=p?jt(p):[];if(m.length){let g=m[m.length-1],y=a?g.right-d.left:d.right-g.left;y>l&&(l=y,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?X.RTL:X.LTR}measureTextSize(){for(let r of this.children)if(r instanceof ee){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,n;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=jt(e.firstChild)[0];t=e.getBoundingClientRect().height,i=r?r.width/27:7,n=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Wl(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,n=0;;n++){let r=n==t.viewports.length?null:t.viewports[n],o=r?r.from-1:this.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(B.replace({widget:new eo(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return B.set(e)}updateDeco(){let e=this.view.state.facet(xi).map((n,r)=>(this.dynamicDecorationMap[r]=typeof n=="function")?n(this.view):n),t=!1,i=this.view.state.facet(aa).map((n,r)=>{let o=typeof n=="function";return o&&(t=!0),o?n(this.view):n});i.length&&(this.dynamicDecorationMap[e.length]=t,e.push($.join(i)));for(let n=e.length;nt.anchor?-1:1),n;if(!i)return;!t.empty&&(n=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,n.left),top:Math.min(i.top,n.top),right:Math.max(i.right,n.right),bottom:Math.max(i.bottom,n.bottom)});let r=fa(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;Bc(this.view.scrollDOM,o,t.head0)i=i.childNodes[n-1],n=et(i);else break}if(t>=0)for(let i=s,n=e;;){if(i.nodeType==3)return{node:i,offset:n};if(i.nodeType==1&&n=0)i=i.childNodes[n],n=0;else break}return null}function Qc(s,e){return s.nodeType!=1?0:(e&&s.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}function sf(s,e,t=1){let i=s.charCategorizer(e),n=s.doc.lineAt(e),r=e-n.from;if(n.length==0)return b.cursor(e);r==0?t=1:r==n.length&&(t=-1);let o=r,l=r;t<0?o=oe(n.text,r,!1):l=oe(n.text,r);let a=i(n.text.slice(o,l));for(;o>0;){let h=oe(n.text,o,!1);if(i(n.text.slice(h,o))!=a)break;o=h}for(;ls?e.left-s:Math.max(0,s-e.right)}function of(s,e){return e.top>s?e.top-s:Math.max(0,s-e.bottom)}function Gn(s,e){return s.tope.top+1}function to(s,e){return es.bottom?{top:s.top,left:s.left,right:s.right,bottom:e}:s}function Es(s,e,t){let i,n,r,o,l=!1,a,h,c,f;for(let p=s.firstChild;p;p=p.nextSibling){let m=jt(p);for(let g=0;gS||o==S&&r>w){i=p,n=y,r=w,o=S;let v=S?t0?g0)}w==0?t>y.bottom&&(!c||c.bottomy.top)&&(h=p,f=y):c&&Gn(c,y)?c=io(c,y.bottom):f&&Gn(f,y)&&(f=to(f,y.top))}}if(c&&c.bottom>=t?(i=a,n=c):f&&f.top<=t&&(i=h,n=f),!i)return{node:s,offset:0};let u=Math.max(n.left,Math.min(n.right,e));if(i.nodeType==3)return no(i,u,t);if(l&&i.contentEditable!="false")return Es(i,u,t);let d=Array.prototype.indexOf.call(s.childNodes,i)+(e>=(n.left+n.right)/2?1:0);return{node:s,offset:d}}function no(s,e,t){let i=s.nodeValue.length,n=-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((D.chrome||D.gecko)&&Mt(s,l).getBoundingClientRect().left==c.right&&(d=!u),f<=0)return{node:s,offset:l+(d?1:0)};n=l+(d?1:0),r=f}}}return{node:s,offset:n>-1?n:o>0?s.nodeValue.length:0}}function pa(s,e,t,i=-1){var n,r;let o=s.contentDOM.getBoundingClientRect(),l=o.top+s.viewState.paddingTop,a,{docHeight:h}=s.viewState,{x:c,y:f}=e,u=f-l;if(u<0)return 0;if(u>h)return s.state.doc.length;for(let v=s.viewState.heightOracle.textHeight/2,x=!1;a=s.elementAtHeight(u),a.type!=De.Text;)for(;u=i>0?a.bottom+v:a.top-v,!(u>=0&&u<=h);){if(x)return t?null:0;x=!0,i=-i}f=l+u;let d=a.from;if(ds.viewport.to)return s.viewport.to==s.state.doc.length?s.state.doc.length:t?null:so(s,o,a,c,f);let p=s.dom.ownerDocument,m=s.root.elementFromPoint?s.root:p,g=m.elementFromPoint(c,f);g&&!s.contentDOM.contains(g)&&(g=null),g||(c=Math.max(o.left+1,Math.min(o.right-1,c)),g=m.elementFromPoint(c,f),g&&!s.contentDOM.contains(g)&&(g=null));let y,w=-1;if(g&&((n=s.docView.nearest(g))===null||n===void 0?void 0:n.isEditable)!=!1){if(p.caretPositionFromPoint){let v=p.caretPositionFromPoint(c,f);v&&({offsetNode:y,offset:w}=v)}else if(p.caretRangeFromPoint){let v=p.caretRangeFromPoint(c,f);v&&({startContainer:y,startOffset:w}=v,(!s.contentDOM.contains(y)||D.safari&&lf(y,w,c)||D.chrome&&af(y,w,c))&&(y=void 0))}}if(!y||!s.docView.dom.contains(y)){let v=ee.find(s.docView,d);if(!v)return u>a.top+a.height/2?a.to:a.from;({node:y,offset:w}=Es(v.dom,c,f))}let S=s.docView.nearest(y);if(!S)return null;if(S.isWidget&&((r=S.dom)===null||r===void 0?void 0:r.nodeType)==1){let v=S.dom.getBoundingClientRect();return e.ys.defaultLineHeight*1.5){let l=s.viewState.heightOracle.textHeight,a=Math.floor((n-t.top-(s.defaultLineHeight-l)*.5)/l);r+=a*s.viewState.heightOracle.lineLength}let o=s.state.sliceDoc(t.from,t.to);return t.from+xs(o,r,s.state.tabSize)}function lf(s,e,t){let i;if(s.nodeType!=3||e!=(i=s.nodeValue.length))return!1;for(let n=s.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!="BR")return!1;return Mt(s,i-1,i).getBoundingClientRect().left>t}function af(s,e,t){if(e!=0)return!1;for(let n=s;;){let r=n.parentNode;if(!r||r.nodeType!=1||r.firstChild!=n)return!1;if(r.classList.contains("cm-line"))break;n=r}let i=s.nodeType==1?s.getBoundingClientRect():Mt(s,0,Math.max(s.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Is(s,e){let t=s.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==De.Text))return i}return t}function hf(s,e,t,i){let n=Is(s,e.head),r=!i||n.type!=De.Text||!(s.lineWrapping||n.widgetLineBreaks)?null:s.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head);if(r){let o=s.dom.getBoundingClientRect(),l=s.textDirectionAt(n.from),a=s.posAtCoords({x:t==(l==X.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return b.cursor(a,t?-1:1)}return b.cursor(t?n.to:n.from,t?-1:1)}function ro(s,e,t,i){let n=s.state.doc.lineAt(e.head),r=s.bidiSpans(n),o=s.textDirectionAt(n.from);for(let l=e,a=null;;){let h=Gc(n,r,o,l,t),c=Ql;if(!h){if(n.number==(t?s.state.doc.lines:1))return l;c=` -`,n=s.state.doc.line(n.number+(t?1:-1)),r=s.bidiSpans(n),h=s.visualLineSide(n,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function cf(s,e,t){let i=s.state.charCategorizer(e),n=i(t);return r=>{let o=i(r);return n==G.Space&&(n=o),n==o}}function ff(s,e,t,i){let n=e.head,r=t?1:-1;if(n==(t?s.state.doc.length:0))return b.cursor(n,e.assoc);let o=e.goalColumn,l,a=s.contentDOM.getBoundingClientRect(),h=s.coordsAtPos(n,e.assoc||-1),c=s.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let d=s.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,s.defaultCharacterWidth*(n-d.from))),l=(r<0?d.top:d.bottom)+c}let f=a.left+o,u=i??s.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,m=pa(s,{x:f,y:p},!1,r);if(pa.bottom||(r<0?mn)){let g=s.docView.coordsForChar(m),y=!g||p{if(e>r&&en(s)),t.from,e.head>t.from?-1:1);return i==t.from?t:b.cursor(i,inull),D.gecko&&Of(e.contentDOM.ownerDocument)}handleEvent(e){!xf(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let n of i.observers)n(this.view,t);for(let n of i.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=df(e),i=this.handlers,n=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(n.removeEventListener(r,this.handleEvent),l=null),l||n.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!t[r]&&n.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()i.keyCode==e.keyCode))&&!e.ctrlKey||pf.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,Ht(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:D.safari&&!D.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function oo(s,e){return(t,i)=>{try{return e.call(s,i,t)}catch(n){Ne(t.state,n)}}}function df(s){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of s){let n=i.spec;if(n&&n.domEventHandlers)for(let r in n.domEventHandlers){let o=n.domEventHandlers[r];o&&t(r).handlers.push(oo(i.value,o))}if(n&&n.domEventObservers)for(let r in n.domEventObservers){let o=n.domEventObservers[r];o&&t(r).observers.push(oo(i.value,o))}}for(let i in Fe)t(i).handlers.push(Fe[i]);for(let i in Ve)t(i).observers.push(Ve[i]);return e}const ga=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],pf="dthko",ma=[16,17,18,20,91,92,224,225],Hi=6;function zi(s){return Math.max(0,s)*.7+8}function gf(s,e){return Math.max(Math.abs(s.clientX-e.clientX),Math.abs(s.clientY-e.clientY))}class mf{constructor(e,t,i,n){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=Pc(e.contentDOM),this.atoms=e.state.facet(fr).map(o=>o(e));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(H.allowMultipleSelections)&&yf(e,t),this.dragging=wf(e,t)&&xa(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&gf(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,n=0,r=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=fa(this.view);e.clientX-o.left<=r.left+Hi?i=-zi(r.left-e.clientX):e.clientX+o.right>=r.right-Hi&&(i=zi(e.clientX-r.right)),e.clientY-o.top<=r.top+Hi?n=-zi(r.top-e.clientY):e.clientY+o.bottom>=r.bottom-Hi&&(n=zi(e.clientY-r.bottom)),this.setScrollSpeed(i,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;ithis.select(this.lastEvent),20)}}function yf(s,e){let t=s.state.facet(Zl);return t.length?t[0](e):D.mac?e.metaKey:e.ctrlKey}function bf(s,e){let t=s.state.facet(ea);return t.length?t[0](e):D.mac?!e.altKey:!e.ctrlKey}function wf(s,e){let{main:t}=s.state.selection;if(t.empty)return!1;let i=dn(s.root);if(!i||i.rangeCount==0)return!0;let n=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function xf(s,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=s.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=U.get(t))&&i.ignoreEvent(e))return!1;return!0}const Fe=Object.create(null),Ve=Object.create(null),ya=D.ie&&D.ie_version<15||D.ios&&D.webkit_version<604;function vf(s){let e=s.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{s.focus(),t.remove(),ba(s,t.value)},50)}function ba(s,e){let{state:t}=s,i,n=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Ns!=null&&t.selection.ranges.every(a=>a.empty)&&Ns==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(n++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:b.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):i=t.replaceSelection(r);s.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Ve.scroll=s=>{s.inputState.lastScrollTop=s.scrollDOM.scrollTop,s.inputState.lastScrollLeft=s.scrollDOM.scrollLeft};Fe.keydown=(s,e)=>(s.inputState.setSelectionOrigin("select"),e.keyCode==27&&(s.inputState.lastEscPress=Date.now()),!1);Ve.touchstart=(s,e)=>{s.inputState.lastTouchTime=Date.now(),s.inputState.setSelectionOrigin("select.pointer")};Ve.touchmove=s=>{s.inputState.setSelectionOrigin("select.pointer")};Fe.mousedown=(s,e)=>{if(s.observer.flush(),s.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of s.state.facet(ta))if(t=i(s,e),t)break;if(!t&&e.button==0&&(t=Cf(s,e)),t){let i=!s.hasFocus;s.inputState.startMouseSelection(new mf(s,e,t,i)),i&&s.observer.ignore(()=>Nl(s.contentDOM));let n=s.inputState.mouseSelection;if(n)return n.start(e),n.dragging===!1}return!1};function lo(s,e,t,i){if(i==1)return b.cursor(e,t);if(i==2)return sf(s.state,e,t);{let n=ee.find(s.docView,e),r=s.state.doc.lineAt(n?n.posAtEnd:e),o=n?n.posAtStart:r.from,l=n?n.posAtEnd:r.to;return ls>=e.top&&s<=e.bottom,ao=(s,e,t)=>wa(e,t)&&s>=t.left&&s<=t.right;function kf(s,e,t,i){let n=ee.find(s.docView,e);if(!n)return 1;let r=e-n.posAtStart;if(r==0)return 1;if(r==n.length)return-1;let o=n.coordsAt(r,-1);if(o&&ao(t,i,o))return-1;let l=n.coordsAt(r,1);return l&&ao(t,i,l)?1:o&&wa(i,o)?-1:1}function ho(s,e){let t=s.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:kf(s,t,e.clientX,e.clientY)}}const Sf=D.ie&&D.ie_version<=11;let co=null,fo=0,uo=0;function xa(s){if(!Sf)return s.detail;let e=co,t=uo;return co=s,uo=Date.now(),fo=!e||t>Date.now()-400&&Math.abs(e.clientX-s.clientX)<2&&Math.abs(e.clientY-s.clientY)<2?(fo+1)%3:1}function Cf(s,e){let t=ho(s,e),i=xa(e),n=s.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),n=n.map(r.changes))},get(r,o,l){let a=ho(s,r),h,c=lo(s,a.pos,a.bias,i);if(t.pos!=a.pos&&!o){let f=lo(s,t.pos,t.bias,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=Af(n,a.pos))?h:l?n.addRange(c):b.create([c])}}}function Af(s,e){for(let t=0;t=e)return b.create(s.ranges.slice(0,t).concat(s.ranges.slice(t+1)),s.mainIndex==t?0:s.mainIndex-(s.mainIndex>t?1:0))}return null}Fe.dragstart=(s,e)=>{let{selection:{main:t}}=s.state;if(e.target.draggable){let n=s.docView.nearest(e.target);if(n&&n.isWidget){let r=n.posAtStart,o=r+n.length;(r>=t.to||o<=t.from)&&(t=b.range(r,o))}}let{inputState:i}=s;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",s.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};Fe.dragend=s=>(s.inputState.draggedContent=null,!1);function po(s,e,t,i){if(!t)return;let n=s.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=s.inputState,o=i&&r&&bf(s,e)?{from:r.from,to:r.to}:null,l={from:n,insert:t},a=s.state.changes(o?[o,l]:l);s.focus(),s.dispatch({changes:a,selection:{anchor:a.mapPos(n,-1),head:a.mapPos(n,1)},userEvent:o?"move.drop":"input.drop"}),s.inputState.draggedContent=null}Fe.drop=(s,e)=>{if(!e.dataTransfer)return!1;if(s.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),n=0,r=()=>{++n==t.length&&po(s,e,i.filter(o=>o!=null).join(s.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])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return po(s,e,i,!0),!0}return!1};Fe.paste=(s,e)=>{if(s.state.readOnly)return!0;s.observer.flush();let t=ya?null:e.clipboardData;return t?(ba(s,t.getData("text/plain")||t.getData("text/uri-text")),!0):(vf(s),!1)};function Mf(s,e){let t=s.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(),s.focus()},50)}function Df(s){let e=[],t=[],i=!1;for(let n of s.selection.ranges)n.empty||(e.push(s.sliceDoc(n.from,n.to)),t.push(n));if(!e.length){let n=-1;for(let{from:r}of s.selection.ranges){let o=s.doc.lineAt(r);o.number>n&&(e.push(o.text),t.push({from:o.from,to:Math.min(s.doc.length,o.to+1)})),n=o.number}i=!0}return{text:e.join(s.lineBreak),ranges:t,linewise:i}}let Ns=null;Fe.copy=Fe.cut=(s,e)=>{let{text:t,ranges:i,linewise:n}=Df(s.state);if(!t&&!n)return!1;Ns=n?t:null,e.type=="cut"&&!s.state.readOnly&&s.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=ya?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(Mf(s,t),!1)};const va=nt.define();function ka(s,e){let t=[];for(let i of s.facet(sa)){let n=i(s,e);n&&t.push(n)}return t?s.update({effects:t,annotations:va.of(!0)}):null}function Sa(s){setTimeout(()=>{let e=s.hasFocus;if(e!=s.inputState.notifiedFocused){let t=ka(s.state,e);t?s.dispatch(t):s.update([])}},10)}Ve.focus=s=>{s.inputState.lastFocusTime=Date.now(),!s.scrollDOM.scrollTop&&(s.inputState.lastScrollTop||s.inputState.lastScrollLeft)&&(s.scrollDOM.scrollTop=s.inputState.lastScrollTop,s.scrollDOM.scrollLeft=s.inputState.lastScrollLeft),Sa(s)};Ve.blur=s=>{s.observer.clearSelectionRange(),Sa(s)};Ve.compositionstart=Ve.compositionupdate=s=>{s.inputState.compositionFirstChange==null&&(s.inputState.compositionFirstChange=!0),s.inputState.composing<0&&(s.inputState.composing=0)};Ve.compositionend=s=>{s.inputState.composing=-1,s.inputState.compositionEndedAt=Date.now(),s.inputState.compositionPendingKey=!0,s.inputState.compositionPendingChange=s.observer.pendingRecords().length>0,s.inputState.compositionFirstChange=null,D.chrome&&D.android?s.observer.flushSoon():s.inputState.compositionPendingChange?Promise.resolve().then(()=>s.observer.flush()):setTimeout(()=>{s.inputState.composing<0&&s.docView.hasComposition&&s.update([])},50)};Ve.contextmenu=s=>{s.inputState.lastContextMenu=Date.now()};Fe.beforeinput=(s,e)=>{var t;let i;if(D.chrome&&D.android&&(i=ga.find(n=>n.inputType==e.inputType))&&(s.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let n=((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)>n+10&&s.hasFocus&&(s.contentDOM.blur(),s.focus())},100)}return!1};const go=new Set;function Of(s){go.has(s)||(go.add(s),s.addEventListener("copy",()=>{}),s.addEventListener("cut",()=>{}))}const mo=["pre-wrap","normal","pre-line","break-spaces"];class Tf{constructor(e){this.lineWrapping=e,this.doc=V.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,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.max(0,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 mo.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=n,this.lineLength=r,a){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)>ln&&(e.heightChanged=!0),this.height=t)}replace(e,t,i){return pe.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,n){let r=this,o=i.doc;for(let l=n.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=n[l],u=r.lineAt(a,j.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,j.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=n[l-1].toA;)a=n[l-1].fromA,c=n[l-1].fromB,l--,ar*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,n-=l.size}else if(r>n*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(n=r&&o(this.blockAt(0,i,n,r))}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more&&this.setHeight(e,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ce extends Ca{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,n){return new Ge(n,this.length,i,this.height,this.breaks)}replace(e,t,i){let n=i[0];return i.length==1&&(n instanceof Ce||n instanceof ie&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof ie?n=new Ce(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):pe.of(i)}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more?this.setHeight(e,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ie extends pe{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,n=e.doc.lineAt(t+this.length).number,r=n-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:n,perLine:o,perChar:l}}blockAt(e,t,i,n){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,n);if(t.lineWrapping){let h=n+Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length),c=t.doc.lineAt(h),f=l+c.length*a,u=Math.max(i,e-f/2);return new Ge(c.from,c.length,u,f,0)}else{let h=Math.max(0,Math.min(o-r,Math.floor((e-i)/l))),{from:c,length:f}=t.doc.line(r+h);return new Ge(c,f,i+l*h,l,0)}}lineAt(e,t,i,n,r){if(t==j.ByHeight)return this.blockAt(e,i,n,r);if(t==j.ByPosNoHeight){let{from:d,to:p}=i.doc.lineAt(e);return new Ge(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,r),h=i.doc.lineAt(e),c=l+h.length*a,f=h.number-o,u=n+l*f+a*(h.from-r-f);return new Ge(h.from,h.length,Math.max(n,Math.min(u,n+this.height-c)),c,0)}forEachLine(e,t,i,n,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(i,r);for(let c=e,f=n;c<=t;){let u=i.doc.lineAt(c);if(c==e){let p=u.number-l;f+=a*p+h*(e-r-p)}let d=a+h*u.length;o(new Ge(u.from,u.length,f,d,0)),f+=d,c=u.to+1}}replace(e,t,i){let n=this.length-t;if(n>0){let r=i[i.length-1];r instanceof ie?i[i.length-1]=new ie(r.length+n):i.push(null,new ie(n-1))}if(e>0){let r=i[0];r instanceof ie?i[0]=new ie(e+r.length):i.unshift(new ie(e-1),null)}return pe.of(i)}decomposeLeft(e,t){t.push(new ie(e-1),null)}decomposeRight(e,t){t.push(null,new ie(this.length-e-1))}updateHeight(e,t=0,i=!1,n){let r=t+this.length;if(n&&n.from<=t+this.length&&n.more){let o=[],l=Math.max(t,n.from),a=-1;for(n.from>t&&o.push(new ie(n.from-t-1).updateHeight(e,t));l<=r&&n.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=n.heights[n.index++];a==-1?a=f:Math.abs(f-a)>=ln&&(a=-2);let u=new Ce(c,f);u.outdated=!1,o.push(u),l+=c+1}l<=r&&o.push(null,new ie(r-l).updateHeight(e,l));let h=pe.of(o);return(a<0||Math.abs(h.height-this.height)>=ln||Math.abs(a-this.heightMetrics(e,t).perLine)>=ln)&&(e.heightChanged=!0),h}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Pf extends pe{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,n){let r=i+this.left.height;return el))return h;let c=t==j.ByPosNoHeight?j.ByPosNoHeight:j.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,n,r).join(h)}forEachLine(e,t,i,n,r,o){let l=n+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,j.ByPos,i,n,r);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let n=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&yo(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,n=i+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e2*t.size||t.size>2*e.size?pe.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,n){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return n&&n.from<=t+r.length&&n.more?a=r=r.updateHeight(e,t,i,n):r.updateHeight(e,t,i),n&&n.from<=l+o.length&&n.more?a=o=o.updateHeight(e,l,i,n):o.updateHeight(e,l,i),a?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 yo(s,e){let t,i;s[e]==null&&(t=s[e-1])instanceof ie&&(i=s[e+1])instanceof ie&&s.splice(e-1,3,new ie(t.length+1+i.length))}const Lf=5;class ur{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),n=this.nodes[this.nodes.length-1];n instanceof Ce?n.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Ce(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=Lf)&&this.addLineDeco(n,r,o)}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 Ce(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new ie(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 Ce)return e;let t=new Ce(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ce)&&!this.isCovered?this.nodes.push(new Ce(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),a=h==s.parentNode?u.bottom:Math.min(a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function Nf(s,e){let t=s.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Yn{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 i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new Tf(t),this.stateDeco=e.facet(xi).filter(i=>typeof i!="function"),this.heightMap=pe.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle.setDoc(e.doc),[new Ee(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=B.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let n=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>n>=r&&n<=o)){let{from:r,to:o}=this.lineBlockAt(n);e.push(new qi(r,o))}}this.viewports=e.sort((i,n)=>i.from-n.from),this.scaler=this.heightMap.height<=7e6?wo:new Hf(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:hi(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(xi).filter(c=>typeof c!="function");let n=e.changedRanges,r=Ee.extendWithRanges(n,Rf(i,this.stateDeco,e?e.changes:te.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=!e.changes.empty||e.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&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&&!e.state.facet(oa)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),n=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?X.RTL:X.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:v,scaleY:x}=Il(t,l);(this.scaleX!=v||this.scaleY!=x)&&(this.scaleX=v,this.scaleY=x,h|=8,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Vl(e.scrollDOM);let p=(this.printing?Nf:If)(t,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let w=l.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),a){let v=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(v)&&(o=!0),o||n.lineWrapping&&Math.abs(w-this.contentDOMWidth)>n.charWidth){let{lineHeight:x,charWidth:A,textHeight:C}=e.docView.measureTextSize();o=x>0&&n.refresh(r,x,A,C,w/A,v),o&&(e.docView.minWidth=0,h|=8)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),n.heightChanged=!1;for(let x of this.viewports){let A=x.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(x);this.heightMap=(o?pe.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle,[new Ee(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new Bf(x.from,A))}n.heightChanged&&(h|=2)}let S=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return S&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(h&2||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&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)),n=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new qi(n.lineAt(o-i*1e3,j.ByHeight,r,0,0).from,n.lineAt(l+(1-i)*1e3,j.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=n.lineAt(h,j.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&n>o-2*1e3&&r>1,o=n<<1;if(this.defaultTextDirection!=X.LTR&&!i)return[];let l=[],a=(h,c,f,u)=>{if(c-hh&&gg.from>=f.from&&g.to<=f.to&&Math.abs(g.from-h)g.fromy));if(!m){if(cg.from<=c&&g.to>=c)){let g=t.moveToLineBoundary(b.cursor(c),!1,!0).head;g>h&&(c=g)}m=new Yn(h,c,this.gapSize(f,h,c,u))}l.push(m)};for(let h of this.viewportLines){if(h.lengthh.from&&a(h.from,u,h,c),dt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];$.spans(e,this.viewport.from,this.viewport.to,{span(n,r){t.push({from:n,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((n,r)=>n.from!=t[r].from||n.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)||hi(this.heightMap.lineAt(e,j.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return hi(this.heightMap.lineAt(this.scaler.fromDOM(e),j.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return hi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class qi{constructor(e,t){this.from=e,this.to=t}}function Vf(s,e,t){let i=[],n=s,r=0;return $.spans(t,s,e,{span(){},point(o,l){o>n&&(i.push({from:n,to:o}),r+=o-n),n=l}},20),n=1)return e[e.length-1].to;let i=Math.floor(s*t);for(let n=0;;n++){let{from:r,to:o}=e[n],l=o-r;if(i<=l)return r+i;i-=l}}function Ki(s,e){let t=0;for(let{from:i,to:n}of s.ranges){if(e<=n){t+=e-i;break}t+=n-i}return t/s.total}function Wf(s,e){for(let t of s)if(e(t))return t}const wo={toDOM(s){return s},fromDOM(s){return s},scale:1};class Hf{constructor(e,t,i){let n=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,j.ByPos,e,0,0).top,c=t.lineAt(a,j.ByPos,e,0,0).bottom;return n+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(t.height-n);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,n=0;;t++){let r=thi(n,e)):s._content)}const ji=O.define({combine:s=>s.join(" ")}),Fs=O.define({combine:s=>s.indexOf(!0)>-1}),Vs=ut.newName(),Aa=ut.newName(),Ma=ut.newName(),Da={"&light":"."+Aa,"&dark":"."+Ma};function Ws(s,e,t){return new ut(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,n=>{if(n=="&")return s;if(!t||!t[n])throw new RangeError(`Unsupported selector: ${n}`);return t[n]}):s+" "+i}})}const zf=Ws("."+Vs,{"&":{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,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",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 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .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":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&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",insetInlineStart: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-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".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"}},Da),ci="￿";class qf{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(H.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ci}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let n=e;;){this.findPointBefore(i,n);let r=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==t)break;let l=U.get(n),a=U.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:xo(n))||xo(o)&&(n.nodeName!="BR"||n.cmIgnore)&&this.text.length>r)&&this.lineBreak(),n=o}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=n.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=U.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let n=i.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.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+($f(e,i.node,i.offset)?t:0))}}function $f(s,e,t){for(;;){if(!e||t-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let l=r||o?[]:Gf(e),a=new qf(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=Jf(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!Ss(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Ss(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if(D.ios&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.toDate.now()-100?s.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=n.from,h=null;(r===8||D.android&&e.text.length=n.from&&t.to<=n.to&&(t.from!=n.from||t.to!=n.to)&&n.to-n.from-(t.to-t.from)<=4?t={from:n.from,to:n.to,insert:s.state.doc.slice(n.from,t.from).append(t.insert).append(s.state.doc.slice(t.to,n.to))}:(D.mac||D.android)&&t&&t.from==t.to&&t.from==n.head-1&&/^\. ?$/.test(t.insert.toString())&&s.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:n.from,to:n.to,insert:V.of([" "])}):D.chrome&&t&&t.from==t.to&&t.from==n.head&&t.insert.toString()==` - `&&s.lineWrapping&&(i&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:n.from,to:n.to,insert:V.of([" "])}),t){if(D.ios&&s.inputState.flushIOSKey()||D.android&&(t.from==n.from&&t.to==n.to&&t.insert.length==1&&t.insert.lines==2&&Ht(s.contentDOM,"Enter",13)||(t.from==n.from-1&&t.to==n.to&&t.insert.length==0||r==8&&t.insert.lengthn.head)&&Ht(s.contentDOM,"Backspace",8)||t.from==n.from&&t.to==n.to+1&&t.insert.length==0&&Ht(s.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();s.inputState.composing>=0&&s.inputState.composing++;let l,a=()=>l||(l=jf(s,t,i));return s.state.facet(na).some(h=>h(s,t.from,t.to,o,a))||s.dispatch(a()),!0}else if(i&&!i.main.eq(n)){let o=!1,l="select";return s.inputState.lastSelectionTime>Date.now()-50&&(s.inputState.lastSelectionOrigin=="select"&&(o=!0),l=s.inputState.lastSelectionOrigin),s.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function jf(s,e,t){let i,n=s.state,r=n.selection.main;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&s.inputState.composing<0){let l=r.frome.to?n.sliceDoc(e.to,r.to):"";i=n.replaceSelection(s.state.toText(l+e.insert.sliceString(0,void 0,s.state.lineBreak)+a))}else{let l=n.changes(e),a=t&&t.main.to<=l.newLength?t.main:void 0;if(n.selection.ranges.length>1&&s.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let h=s.state.sliceDoc(e.from,e.to),c,f=t&&ua(s,t.main.head);if(f){let p=e.insert.length-(e.to-e.from);c={from:f.from,to:f.to-p}}else c=s.state.doc.lineAt(r.head);let u=r.to-e.to,d=r.to-r.from;i=n.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:l,range:a||p.map(l)};let m=p.to-u,g=m-h.length;if(p.to-p.from!=d||s.state.sliceDoc(g,m)!=h||p.to>=c.from&&p.from<=c.to)return{range:p};let y=n.changes({from:g,to:m,insert:e.insert}),w=p.to-r.to;return{changes:y,range:a?b.range(Math.max(0,a.anchor+w),Math.max(0,a.head+w)):p.map(y)}})}else i={changes:l,selection:a&&n.selection.replaceRange(a)}}let o="input.type";return(s.composing||s.inputState.compositionPendingChange&&s.inputState.compositionEndedAt>Date.now()-50)&&(s.inputState.compositionPendingChange=!1,o+=".compose",s.inputState.compositionFirstChange&&(o+=".start",s.inputState.compositionFirstChange=!1)),n.update(i,{userEvent:o,scrollIntoView:!0})}function Uf(s,e,t,i){let n=Math.min(s.length,e.length),r=0;for(;r0&&l>0&&s.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Gf(s){let e=[];if(s.root.activeElement!=s.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:r}=s.observer.selectionRange;return t&&(e.push(new vo(t,i)),(n!=t||r!=i)&&e.push(new vo(n,r))),e}function Jf(s,e){if(s.length==0)return null;let t=s[0].pos,i=s.length==2?s[1].pos:t;return t>-1&&i>-1?b.single(t+e,i+e):null}const Yf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xn=D.ie&&D.ie_version<=11;class Xf{constructor(e){this.view=e,this.active=!1,this.selectionRange=new Lc,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.resizeScroll=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);(D.ie&&D.ie_version<=11||D.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()}),Xn&&(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.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.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")))},{threshold:[0,.001]}),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.runHandlers("scroll",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,n=this.selectionRange;if(i.state.facet(En)?i.root.activeElement!=this.dom:!rn(i.dom,n))return;let r=n.anchorNode&&i.docView.nearest(n.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(D.ie&&D.ie_version<=11||D.android&&D.chrome)&&!i.state.selection.main.empty&&n.focusNode&&pi(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=D.safari&&e.root.nodeType==11&&Oc(this.dom.ownerDocument)==this.dom&&_f(this.view)||dn(e.root);if(!t||this.selectionRange.eq(t))return!1;let i=rn(this.dom,t);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&Ht(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!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()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,n=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(n=!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:n}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),n=this.selectionChanged&&rn(this.dom,this.selectionRange);if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Kf(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,n=Oa(this.view,t);return this.view.state==i&&this.view.update([]),n}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.flags|=4),e.type=="childList"){let i=ko(t,e.previousSibling||e.target.previousSibling,-1),n=ko(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:n?t.posBefore(n):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.resizeScroll)===null||i===void 0||i.disconnect();for(let n of this.scrollTargets)n.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 ko(s,e,t){for(;e;){let i=U.get(e);if(i&&i.parent==s)return i;let n=e.parentNode;e=n!=s.dom?n:t>0?e.nextSibling:e.previousSibling}return null}function _f(s){let e=null;function t(a){a.preventDefault(),a.stopImmediatePropagation(),e=a.getTargetRanges()[0]}if(s.contentDOM.addEventListener("beforeinput",t,!0),s.dom.ownerDocument.execCommand("indent"),s.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let i=e.startContainer,n=e.startOffset,r=e.endContainer,o=e.endOffset,l=s.docView.domAtPos(s.state.selection.main.anchor);return pi(l.node,l.offset,r,o)&&([i,n,r,o]=[r,o,i,n]),{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:o}}class T{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}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.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(i=>i.forEach(n=>t(n,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Rc(e.parent)||document,this.viewState=new bo(e.state||H.create(e)),e.scrollTo&&e.scrollTo.is(Wi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(li).map(i=>new Un(i));for(let i of this.plugins)i.update(this);this.observer=new Xf(this),this.inputState=new uf(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Zr(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let t=e.length==1&&e[0]instanceof Q?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}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,n,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(va))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=ka(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(H.phrases)!=this.state.facet(H.phrases))return this.setState(r);n=pn.create(this,r,e),n.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new zt(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(Wi)&&(f=d.value.clip(this.state))}this.viewState.update(n,f),this.bidiCache=gn.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),t=this.docView.update(n),this.state.facet(ai)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(ji)!=n.state.facet(ji)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty)for(let u of this.state.facet(Rs))try{u(n)}catch(d){Ne(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Oa(this,c)&&h.force&&Ht(this.contentDOM,h.key,h.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 bo(e),this.plugins=e.facet(li).map(i=>new Un(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Zr(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(li),i=e.state.facet(li);if(t!=i){let n=[];for(let r of i){let o=t.indexOf(r);if(o<0)n.push(new Un(r));else{let l=this.plugins[o];l.mustUpdate=e,n.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Vl(i))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(n);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!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 h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(p){return Ne(this.state,p),So}}),f=pn.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f));for(let d=0;d1||p<-1){n=n+p,i.scrollTop=n/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Rs))l(t)}get themeClasses(){return Vs+" "+(this.state.facet(Fs)?Ma:Aa)+" "+this.state.facet(ji)}updateAttrs(){let e=Co(this,la,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(En)?"true":"false",class:"cm-content",style:`${D.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Co(this,cr,t);let i=this.observer.ignore(()=>{let n=Os(this.contentDOM,this.contentAttrs,t),r=Os(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let n of i.effects)if(n.is(T.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(ai);let e=this.state.facet(T.cspNonce);ut.mount(this.root,this.styleModules.concat(zf).reverse(),e?{nonce:e}:void 0)}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(this.measureRequests.indexOf(e)>-1)return;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}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}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 Jn(this,e,ro(this,e,t,i))}moveByGroup(e,t){return Jn(this,e,ro(this,e,t,i=>cf(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),n=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return b.cursor(r.side(t,n)+e.from,r.forward(!t,n)?1:-1)}moveToLineBoundary(e,t,i=!0){return hf(this,e,t,i)}moveVertically(e,t,i){return Jn(this,e,ff(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(),pa(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 n=this.state.doc.lineAt(e),r=this.bidiSpans(n),o=r[at.find(r,e-n.from,-1,t)];return Ln(i,o.dir==X.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}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(ra)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Qf)return _l(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||Xl(r.isolates,i=Qr(this,e))))return r.order;i||(i=Qr(this,e));let n=Uc(e.text,t,i);return this.bidiCache.push(new gn(e.from,e.to,t,i,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||D.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Nl(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.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Wi.of(new zt(typeof e=="number"?b.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Wi.of(new zt(b.cursor(i.from),"start","start",i.top-e,t,!0))}static domEventHandlers(e){return ue.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ue.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=ut.newName(),n=[ji.of(i),ai.of(Ws(`.${i}`,e))];return t&&t.dark&&n.push(Fs.of(!0)),n}static baseTheme(e){return Bt.lowest(ai.of(Ws("."+Vs,e,Da)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),n=i&&U.get(i)||U.get(e);return((t=n==null?void 0:n.rootView)===null||t===void 0?void 0:t.view)||null}}T.styleModule=ai;T.inputHandler=na;T.focusChangeEffect=sa;T.perLineTextDirection=ra;T.exceptionSink=ia;T.updateListener=Rs;T.editable=En;T.mouseSelectionStyle=ta;T.dragMovesSelection=ea;T.clickAddsSelectionRange=Zl;T.decorations=xi;T.outerDecorations=aa;T.atomicRanges=fr;T.bidiIsolatedRanges=ha;T.scrollMargins=ca;T.darkTheme=Fs;T.cspNonce=O.define({combine:s=>s.length?s[0]:""});T.contentAttributes=cr;T.editorAttributes=la;T.lineWrapping=T.contentAttributes.of({class:"cm-lineWrapping"});T.announce=F.define();const Qf=4096,So={};class gn{constructor(e,t,i,n,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=n,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],n=e.length?e[e.length-1].dir:X.LTR;for(let r=Math.max(0,e.length-10);r=0;n--){let r=i[n],o=typeof r=="function"?r(s):r;o&&Ds(o,t)}return t}const Zf=D.mac?"mac":D.windows?"win":D.linux?"linux":"key";function eu(s,e){const t=s.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let n,r,o,l;for(let a=0;ai.concat(n),[]))),t}function iu(s,e,t){return Ba(Ta(s.state),e,s,t)}let ot=null;const nu=4e3;function su(s,e=Zf){let t=Object.create(null),i=Object.create(null),n=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>eu(y,e));for(let y=1;y{let v=ot={view:S,prefix:w,scope:o};return setTimeout(()=>{ot==v&&(ot=null)},nu),!0}]})}let m=p.join(" ");n(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of s){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let f in c)c[f].run.push(o.any)}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}function Ba(s,e,t,i){let n=Dc(e),r=ne(n,0),o=Be(r)==n.length&&n!=" ",l="",a=!1,h=!1,c=!1;ot&&ot.view==t&&ot.scope==i&&(l=ot.prefix+" ",ma.indexOf(e.keyCode)<0&&(h=!0,ot=null));let f=new Set,u=g=>{if(g){for(let y of g.run)if(!f.has(y)&&(f.add(y),y(t,e)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},d=s[i],p,m;return d&&(u(d[l+Ui(n,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(D.windows&&e.ctrlKey&&e.altKey)&&(p=dt[e.keyCode])&&p!=n?(u(d[l+Ui(p,e,!0)])||e.shiftKey&&(m=bi[e.keyCode])!=n&&m!=p&&u(d[l+Ui(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+Ui(n,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),a}class Pi{constructor(e,t,i,n,r){this.className=e,this.left=t,this.top=i,this.width=n,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(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}static forRange(e,t,i){if(i.empty){let n=e.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let r=Pa(e);return[new Pi(t,n.left-r.left,n.top-r.top,null,n.bottom-n.top)]}else return ru(e,t,i)}}function Pa(s){let e=s.scrollDOM.getBoundingClientRect();return{left:(s.textDirection==X.LTR?e.left:e.right-s.scrollDOM.clientWidth*s.scaleX)-s.scrollDOM.scrollLeft*s.scaleX,top:e.top-s.scrollDOM.scrollTop*s.scaleY}}function Mo(s,e,t){let i=b.cursor(e);return{from:Math.max(t.from,s.moveToLineBoundary(i,!1,!0).from),to:Math.min(t.to,s.moveToLineBoundary(i,!0,!0).from),type:De.Text}}function ru(s,e,t){if(t.to<=s.viewport.from||t.from>=s.viewport.to)return[];let i=Math.max(t.from,s.viewport.from),n=Math.min(t.to,s.viewport.to),r=s.textDirection==X.LTR,o=s.contentDOM,l=o.getBoundingClientRect(),a=Pa(s),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=Is(s,i),p=Is(s,n),m=d.type==De.Text?d:null,g=p.type==De.Text?p:null;if(m&&(s.lineWrapping||d.widgetLineBreaks)&&(m=Mo(s,i,m)),g&&(s.lineWrapping||p.widgetLineBreaks)&&(g=Mo(s,n,g)),m&&g&&m.from==g.from)return w(S(t.from,t.to,m));{let x=m?S(t.from,null,m):v(d,!1),A=g?S(null,t.to,g):v(p,!0),C=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&x.bottom+s.defaultLineHeight/2L&&W.from=be)break;Z>J&&E(Math.max(Oe,J),x==null&&Oe<=L,Math.min(Z,be),A==null&&Z>=z,ke.dir)}if(J=we.to+1,J>=be)break}return N.length==0&&E(L,x==null,z,A==null,s.textDirection),{top:P,bottom:I,horizontal:N}}function v(x,A){let C=l.top+(A?x.top:x.bottom);return{top:C,bottom:C,horizontal:[]}}}function ou(s,e){return s.constructor==e.constructor&&s.eq(e)}class lu{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(an)!=e.state.facet(an)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let t=0,i=e.facet(an);for(;t!ou(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let n of e)n.update&&t&&n.constructor&&this.drawn[i].constructor&&n.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(n.draw(),t);for(;t;){let n=t.nextSibling;t.remove(),t=n}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const an=O.define();function La(s){return[ue.define(e=>new lu(e,s)),an.of(s)]}const Ra=!D.ios,vi=O.define({combine(s){return Pt(s,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function im(s={}){return[vi.of(s),au,hu,cu,oa.of(!0)]}function Ea(s){return s.startState.facet(vi)!=s.state.facet(vi)}const au=La({above:!0,markers(s){let{state:e}=s,t=e.facet(vi),i=[];for(let n of e.selection.ranges){let r=n==e.selection.main;if(n.empty?!r||Ra:t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=n.empty?n:b.cursor(n.head,n.head>n.anchor?-1:1);for(let a of Pi.forRange(s,o,l))i.push(a)}}return i},update(s,e){s.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Ea(s);return t&&Do(s.state,e),s.docChanged||s.selectionSet||t},mount(s,e){Do(e.state,s)},class:"cm-cursorLayer"});function Do(s,e){e.style.animationDuration=s.facet(vi).cursorBlinkRate+"ms"}const hu=La({above:!1,markers(s){return s.state.selection.ranges.map(e=>e.empty?[]:Pi.forRange(s,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(s,e){return s.docChanged||s.selectionSet||s.viewportChanged||Ea(s)},class:"cm-selectionLayer"}),Hs={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Ra&&(Hs[".cm-line"].caretColor="transparent !important",Hs[".cm-content"]={caretColor:"transparent !important"});const cu=Bt.highest(T.theme(Hs)),Ia=F.define({map(s,e){return s==null?null:e.mapPos(s)}}),fi=ye.define({create(){return null},update(s,e){return s!=null&&(s=e.changes.mapPos(s)),e.effects.reduce((t,i)=>i.is(Ia)?i.value:t,s)}}),fu=ue.fromClass(class{constructor(s){this.view=s,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(s){var e;let t=s.state.field(fi);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"),(s.startState.field(fi)!=t||s.docChanged||s.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:s}=this,e=s.state.field(fi),t=e!=null&&s.coordsAtPos(e);if(!t)return null;let i=s.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+s.scrollDOM.scrollLeft*s.scaleX,top:t.top-i.top+s.scrollDOM.scrollTop*s.scaleY,height:t.bottom-t.top}}drawCursor(s){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;s?(this.cursor.style.left=s.left/e+"px",this.cursor.style.top=s.top/t+"px",this.cursor.style.height=s.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(s){this.view.state.field(fi)!=s&&this.view.dispatch({effects:Ia.of(s)})}},{eventObservers:{dragover(s){this.setDropPos(this.view.posAtCoords({x:s.clientX,y:s.clientY}))},dragleave(s){(s.target==this.view.contentDOM||!this.view.contentDOM.contains(s.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function nm(){return[fi,fu]}function Oo(s,e,t,i,n){e.lastIndex=0;for(let r=s.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)n(o+l.index,l)}function uu(s,e){let t=s.visibleRanges;if(t.length==1&&t[0].from==s.viewport.from&&t[0].to==s.viewport.to)return t;let i=[];for(let{from:n,to:r}of t)n=Math.max(s.state.doc.lineAt(n).from,n-e),r=Math.min(s.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=n?i[i.length-1].to=r:i.push({from:n,to:r});return i}class du{constructor(e){const{regexp:t,decoration:i,decorate:n,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,n)this.addMatch=(l,a,h,c)=>n(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+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 At,i=t.add.bind(t);for(let{from:n,to:r}of uu(e,this.maxLength))Oo(e.state.doc,this.regexp,n,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,n=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>e.view.viewport.from&&l1e3?this.createDeco(e.view):n>-1?this.updateRange(e.view,t.map(e.changes),i,n):t}updateRange(e,t,i,n){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,n);if(l>o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(y.range(m,g));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(g,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:u})}}return t}}const zs=/x/.unicode!=null?"gu":"g",pu=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,zs),gu={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 _n=null;function mu(){var s;if(_n==null&&typeof document<"u"&&document.body){let e=document.body.style;_n=((s=e.tabSize)!==null&&s!==void 0?s:e.MozTabSize)!=null}return _n||!1}const hn=O.define({combine(s){let e=Pt(s,{render:null,specialChars:pu,addSpecialChars:null});return(e.replaceTabs=!mu())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,zs)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,zs)),e}});function sm(s={}){return[hn.of(s),yu()]}let To=null;function yu(){return To||(To=ue.fromClass(class{constructor(s){this.view=s,this.decorations=B.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(s.state.facet(hn)),this.decorations=this.decorator.createDeco(s)}makeDecorator(s){return new du({regexp:s.specialChars,decoration:(e,t,i)=>{let{doc:n}=t.state,r=ne(e[0],0);if(r==9){let o=n.lineAt(i),l=t.state.tabSize,a=_t(o.text,l,i-o.from);return B.replace({widget:new vu((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=B.replace({widget:new xu(s,r)}))},boundary:s.replaceTabs?void 0:/[^]/})}update(s){let e=s.state.facet(hn);s.startState.facet(hn)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(s.view)):this.decorations=this.decorator.updateDeco(s,this.decorations)}},{decorations:s=>s.decorations}))}const bu="•";function wu(s){return s>=32?bu:s==10?"␤":String.fromCharCode(9216+s)}class xu extends Lt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=wu(this.code),i=e.state.phrase("Control character")+" "+(gu[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,t);if(n)return n;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 vu extends Lt{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 ku extends Lt{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}coordsAt(e){let t=e.firstChild?jt(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),n=Ln(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return n.bottom-n.top>r*1.5?{left:n.left,right:n.right,top:n.top,bottom:n.top+r}:n}ignoreEvent(){return!1}}function rm(s){return ue.fromClass(class{constructor(e){this.view=e,this.placeholder=s?B.set([B.widget({widget:new ku(s),side:1}).range(0)]):B.none}get decorations(){return this.view.state.doc.length?B.none:this.placeholder}},{decorations:e=>e.decorations})}const qs=2e3;function Su(s,e,t){let i=Math.min(e.line,t.line),n=Math.max(e.line,t.line),r=[];if(e.off>qs||t.off>qs||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=n;a++){let h=s.doc.line(a);h.length<=l&&r.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=n;a++){let h=s.doc.line(a),c=xs(h.text,o,s.tabSize,!0);if(c<0)r.push(b.cursor(h.to));else{let f=xs(h.text,l,s.tabSize);r.push(b.range(h.from+c,h.from+f))}}}return r}function Cu(s,e){let t=s.coordsAtPos(s.viewport.from);return t?Math.round(Math.abs((t.left-e)/s.defaultCharacterWidth)):-1}function Bo(s,e){let t=s.posAtCoords({x:e.clientX,y:e.clientY},!1),i=s.state.doc.lineAt(t),n=t-i.from,r=n>qs?-1:n==i.length?Cu(s,e.clientX):_t(i.text,s.state.tabSize,t-i.from);return{line:i.number,col:r,off:n}}function Au(s,e){let t=Bo(s,e),i=s.state.selection;return t?{update(n){if(n.docChanged){let r=n.changes.mapPos(n.startState.doc.line(t.line).from),o=n.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(n.changes)}},get(n,r,o){let l=Bo(s,n);if(!l)return i;let a=Su(s.state,t,l);return a.length?o?b.create(a.concat(i.ranges)):b.create(a):i}}:null}function om(s){let e=(s==null?void 0:s.eventFilter)||(t=>t.altKey&&t.button==0);return T.mouseSelectionStyle.of((t,i)=>e(i)?Au(t,i):null)}const ni="-10000px";class Mu{constructor(e,t,i,n){this.facet=t,this.createTooltipView=i,this.removeTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter(r=>r),this.tooltipViews=this.tooltips.map(i)}update(e,t){var i;let n=e.state.facet(this.facet),r=n.filter(a=>a);if(n===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=n,this.tooltips=r,this.tooltipViews=o,!0}}function Du(s){let{win:e}=s;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Qn=O.define({combine:s=>{var e,t,i;return{position:D.ios?"absolute":((e=s.find(n=>n.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=s.find(n=>n.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=s.find(n=>n.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Du}}}),Po=new WeakMap,Na=ue.fromClass(class{constructor(s){this.view=s,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=s.state.facet(Qn);this.position=e.position,this.parent=e.parent,this.classes=s.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Mu(s,Fa,t=>this.createTooltip(t),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),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(),s.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 s of this.manager.tooltipViews)this.intersectionObserver.observe(s.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(s){s.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(s,this.above);e&&this.observeIntersection();let t=e||s.geometryChanged,i=s.state.facet(Qn);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let n of this.manager.tooltipViews)n.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 n of this.manager.tooltipViews)this.container.appendChild(n.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(s){let e=s.create(this.view);if(e.dom.classList.add("cm-tooltip"),s.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=ni,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var s,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(s=i.destroy)===null||s===void 0||s.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let s=this.view.dom.getBoundingClientRect(),e=1,t=1,i=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(D.gecko)i=n.offsetParent!=this.container.ownerDocument.body;else if(n.style.top==ni&&n.style.left=="0px"){let r=n.getBoundingClientRect();i=Math.abs(r.top+1e4)>1||Math.abs(r.left)>1}}if(i||this.position=="absolute")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:s,parent:this.parent?this.container.getBoundingClientRect():s,pos:this.manager.tooltips.map((n,r)=>{let o=this.manager.tooltipViews[r];return o.getCoords?o.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(Qn).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:i}}writeMeasure(s){var e;if(s.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:t,space:i,scaleX:n,scaleY:r}=s,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1){c.style.top=ni;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=u.right-u.left,g=(e=Po.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||Tu,w=this.view.textDirection==X.LTR,S=u.width>i.right-i.left?w?i.left:i.right-u.width:w?Math.min(f.left-(d?14:0)+y.x,i.right-m):Math.max(i.left,f.left-m+(d?14:0)-y.x),v=this.above[l];!a.strictSide&&(v?f.top-(u.bottom-u.top)-y.yi.bottom)&&v==i.bottom-f.bottom>f.top-i.top&&(v=this.above[l]=!v);let x=(v?f.top-i.top:i.bottom-f.bottom)-p;if(xS&&P.topA&&(A=v?P.top-g-2-p:P.bottom+p+2);if(this.position=="absolute"?(c.style.top=(A-s.parent.top)/r+"px",c.style.left=(S-s.parent.left)/n+"px"):(c.style.top=A/r+"px",c.style.left=S/n+"px"),d){let P=f.left+(w?y.x:-y.x)-(S+14-7);d.style.left=P/n+"px"}h.overlap!==!0&&o.push({left:S,top:A,right:C,bottom:A+g}),c.classList.toggle("cm-tooltip-above",v),c.classList.toggle("cm-tooltip-below",!v),h.positioned&&h.positioned(s.space)}}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 s of this.manager.tooltipViews)s.dom.style.top=ni}},{eventObservers:{scroll(){this.maybeMeasure()}}}),Ou=T.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&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:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Tu={x:0,y:0},Fa=O.define({enables:[Na,Ou]});function Va(s,e){let t=s.plugin(Na);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Lo=O.define({combine(s){let e,t;for(let i of s)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function mn(s,e){let t=s.plugin(Wa),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const Wa=ue.fromClass(class{constructor(s){this.input=s.state.facet(yn),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(s));let e=s.state.facet(Lo);this.top=new Gi(s,!0,e.topContainer),this.bottom=new Gi(s,!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(s){let e=s.state.facet(Lo);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Gi(s.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Gi(s.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=s.state.facet(yn);if(t!=this.input){let i=t.filter(a=>a),n=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(s.view),l.push(c)):(c=this.panels[h],c.update&&c.update(s)),n.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=n,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(s)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:s=>T.scrollMargins.of(e=>{let t=e.plugin(s);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Gi{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=Ro(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Ro(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 Ro(s){let e=s.nextSibling;return s.remove(),e}const yn=O.define({enables:Wa});class Ot extends Ct{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ot.prototype.elementClass="";Ot.prototype.toDOM=void 0;Ot.prototype.mapMode=he.TrackBefore;Ot.prototype.startSide=Ot.prototype.endSide=-1;Ot.prototype.point=!0;const Bu=O.define(),Pu=new class extends Ot{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Lu=Bu.compute(["selection"],s=>{let e=[],t=-1;for(let i of s.selection.ranges){let n=s.doc.lineAt(i.head).from;n>t&&(t=n,e.push(Pu.range(n)))}return $.of(e)});function lm(){return Lu}const Ru=1024;let Eu=0;class Pe{constructor(e,t){this.from=e,this.to=t}}class R{constructor(e={}){this.id=Eu++,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=ge.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}R.closedBy=new R({deserialize:s=>s.split(" ")});R.openedBy=new R({deserialize:s=>s.split(" ")});R.group=new R({deserialize:s=>s.split(" ")});R.isolate=new R({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}});R.contextHash=new R({perNode:!0});R.lookAhead=new R({perNode:!0});R.mounted=new R({perNode:!0});class ki{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[R.mounted.id]}}const Iu=Object.create(null);class ge{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):Iu,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new ge(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(n)),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 n}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 n of i.split(" "))t[n]=e[i];return i=>{for(let n=i.prop(R.group),r=-1;r<(n?n.length:0);r++){let o=t[r<0?i.name:n[r]];if(o)return o}}}}ge.none=new ge("",Object.create(null),0,8);class pr{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|Y.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=n&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!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:yr(ge.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new K(this.type,t,i,n,this.propValues),e.makeTree||((t,i,n)=>new K(ge.none,t,i,n)))}static build(e){return Wu(e)}}K.empty=new K(ge.none,[],[],0);class gr{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 gr(this.buffer,this.index)}}class gt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return ge.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let n=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Si(s,e,t,i){for(var n;s.from==s.to||(t<1?s.from>=e:s.from>e)||(t>-1?s.to<=e:s.to0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from;if(Ha(n,i,f,f+c.length)){if(c instanceof gt){if(r&Y.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,n);if(u>-1)return new Je(new Nu(o,c,e,f),null,u)}else if(r&Y.IncludeAnonymous||!c.type.isAnonymous||mr(c)){let u;if(!(r&Y.IgnoreMounts)&&(u=ki.get(c))&&!u.overlay)return new fe(u.tree,f,e,o);let d=new fe(c,f,e,o);return r&Y.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,n)}}}if(r&Y.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 n;if(!(i&Y.IgnoreOverlays)&&(n=ki.get(this._tree))&&n.overlay){let r=e-this.from;for(let{from:o,to:l}of n.overlay)if((t>0?o<=r:o=r:l>r))return new fe(n.tree,n.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}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Io(s,e,t,i){let n=s.cursor(),r=[];if(!n.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return r}for(;;){if(i!=null&&n.type.is(i))return r;if(n.type.is(e)&&r.push(n.node),!n.nextSibling())return i==null?r:[]}}function $s(s,e,t=e.length-1){for(let i=s.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 Nu{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}}class Je extends za{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]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new Je(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&Y.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Je(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 Je(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 Je(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let o=i.buffer[this.index+1];e.push(i.slice(n,r,o)),t.push(0)}return new K(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function qa(s){if(!s.length)return null;let e=0,t=s[0];for(let r=1;rt.from||o.to=e){let l=new fe(o.tree,o.overlay[0].from+r.from,-1,r);(n||(n=[i])).push(Si(l,e,t,!1))}}return n?qa(n):i}class bn{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof fe)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)}}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:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return e?e instanceof fe?(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:n}=this.buffer,r=n.findChild(this.index+4,n.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&Y.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Y.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Y.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 n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(n)}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:n}=this;if(n){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&Y.IncludeAnonymous||l instanceof gt||!l.type.isAnonymous||mr(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==n){if(n==this.index)return o;t=o,i=r+1;break e}n=this.stack[--r]}for(let n=i;n=0;r--){if(r<0)return $s(this.node,e,n);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}}function mr(s){return s.children.some(e=>e instanceof gt||!e.type.isAnonymous||mr(e))}function Wu(s){var e;let{buffer:t,nodeSet:i,maxBufferLength:n=Ru,reused:r=[],minRepeatType:o=i.types.length}=s,l=Array.isArray(t)?new gr(t,t.length):t,a=i.types,h=0,c=0;function f(x,A,C,P,I,N){let{id:E,start:L,end:z,size:W}=l,J=c;for(;W<0;)if(l.next(),W==-1){let Z=r[E];C.push(Z),P.push(L-x);return}else if(W==-3){h=E;return}else if(W==-4){c=E;return}else throw new RangeError(`Unrecognized record size: ${W}`);let be=a[E],we,ke,Oe=L-x;if(z-L<=n&&(ke=g(l.pos-A,I))){let Z=new Uint16Array(ke.size-ke.skip),Te=l.pos-ke.size,He=Z.length;for(;l.pos>Te;)He=y(ke.start,Z,He);we=new gt(Z,z-ke.start,i),Oe=ke.start-x}else{let Z=l.pos-W;l.next();let Te=[],He=[],yt=E>=o?E:-1,Rt=0,Ii=z;for(;l.pos>Z;)yt>=0&&l.id==yt&&l.size>=0?(l.end<=Ii-n&&(p(Te,He,L,Rt,l.end,Ii,yt,J),Rt=Te.length,Ii=l.end),l.next()):N>2500?u(L,Z,Te,He):f(L,Z,Te,He,yt,N+1);if(yt>=0&&Rt>0&&Rt-1&&Rt>0){let Lr=d(be);we=yr(be,Te,He,0,Te.length,0,z-L,Lr,Lr)}else we=m(be,Te,He,z-L,J-z)}C.push(we),P.push(Oe)}function u(x,A,C,P){let I=[],N=0,E=-1;for(;l.pos>A;){let{id:L,start:z,end:W,size:J}=l;if(J>4)l.next();else{if(E>-1&&z=0;W-=3)L[J++]=I[W],L[J++]=I[W+1]-z,L[J++]=I[W+2]-z,L[J++]=J;C.push(new gt(L,I[2]-z,i)),P.push(z-x)}}function d(x){return(A,C,P)=>{let I=0,N=A.length-1,E,L;if(N>=0&&(E=A[N])instanceof K){if(!N&&E.type==x&&E.length==P)return E;(L=E.prop(R.lookAhead))&&(I=C[N]+E.length+L)}return m(x,A,C,P,I)}}function p(x,A,C,P,I,N,E,L){let z=[],W=[];for(;x.length>P;)z.push(x.pop()),W.push(A.pop()+C-I);x.push(m(i.types[E],z,W,N-I,L-N)),A.push(I-C)}function m(x,A,C,P,I=0,N){if(h){let E=[R.contextHash,h];N=N?[E].concat(N):[E]}if(I>25){let E=[R.lookAhead,I];N=N?[E].concat(N):[E]}return new K(x,A,C,P,N)}function g(x,A){let C=l.fork(),P=0,I=0,N=0,E=C.end-n,L={size:0,start:0,skip:0};e:for(let z=C.pos-x;C.pos>z;){let W=C.size;if(C.id==A&&W>=0){L.size=P,L.start=I,L.skip=N,N+=4,P+=4,C.next();continue}let J=C.pos-W;if(W<0||J=o?4:0,we=C.start;for(C.next();C.pos>J;){if(C.size<0)if(C.size==-3)be+=4;else break e;else C.id>=o&&(be+=4);C.next()}I=we,P+=W,N+=be}return(A<0||P==x)&&(L.size=P,L.start=I,L.skip=N),L.size>4?L:void 0}function y(x,A,C){let{id:P,start:I,end:N,size:E}=l;if(l.next(),E>=0&&P4){let z=l.pos-(E-4);for(;l.pos>z;)C=y(x,A,C)}A[--C]=L,A[--C]=N-x,A[--C]=I-x,A[--C]=P}else E==-3?h=P:E==-4&&(c=P);return C}let w=[],S=[];for(;l.pos>0;)f(s.start||0,s.bufferStart||0,w,S,-1,0);let v=(e=s.length)!==null&&e!==void 0?e:w.length?S[0]+w[0].length:0;return new K(a[s.topID],w.reverse(),S.reverse(),v)}const No=new WeakMap;function cn(s,e){if(!s.isAnonymous||e instanceof gt||e.type!=s)return 1;let t=No.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=s||!(i instanceof K)){t=1;break}t+=cn(s,i)}No.set(e,t)}return t}function yr(s,e,t,i,n,r,o,l,a){let h=0;for(let p=i;p=c)break;A+=C}if(S==v+1){if(A>c){let C=p[v];d(C.children,C.positions,0,C.children.length,m[v]+w);continue}f.push(p[v])}else{let C=m[S-1]+p[S-1].length-x;f.push(yr(s,p,m,v,S,x,C,null,a))}u.push(x+w-r)}}return d(e,t,i,n,0),(l||a)(f,u,o)}class am{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Je?this.setBuffer(e.context.buffer,e.index,t):e instanceof fe&&this.map.set(e.tree,t)}get(e){return e instanceof Je?this.getBuffer(e.context.buffer,e.index):e instanceof fe?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 Ze{constructor(e,t,i,n,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,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 n=[new Ze(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&n.push(r);return n}static applyChanges(e,t,i=128){if(!t.length)return e;let n=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new Ze(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&n.push(u),o.to>f)break;o=rnew Pe(n.from,n.to)):[new Pe(0,0)]:[new Pe(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let r=n.advance();if(r)return r}}}class Hu{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 hm(s){return(e,t,i,n)=>new qu(e,s,t,i,n)}class Fo{constructor(e,t,i,n,r){this.parser=e,this.parse=t,this.overlay=i,this.target=n,this.from=r}}function Vo(s){if(!s.length||s.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}class zu{constructor(e,t,i,n,r,o,l){this.parser=e,this.predicate=t,this.mounts=i,this.index=n,this.start=r,this.target=o,this.prev=l,this.depth=0,this.ranges=[]}}const Ks=new R({perNode:!0});class qu{constructor(e,t,i,n,r){this.nest=t,this.input=i,this.fragments=n,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 n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new K(i.type,i.children,i.positions,i.length,i.propValues.concat([[Ks,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 ki(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;t=this.stoppedAt)l=!1;else if(e.hasNode(n)){if(t){let h=t.mounts.find(c=>c.frag.from<=n.from&&c.frag.to>=n.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let f=c.from+h.pos,u=c.to+h.pos;f>=n.from&&u<=n.to&&!t.ranges.some(d=>d.fromf)&&t.ranges.push({from:f,to:u})}}l=!1}else if(i&&(o=$u(i.ranges,n.from,n.to)))l=o!=2;else if(!n.type.isAnonymous&&(r=this.nest(n,this.input))&&(n.fromnew Pe(f.from-n.from,f.to-n.from)):null,n.tree,c.length?c[0].from:n.from)),r.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else t&&(a=t.predicate(n))&&(a===!0&&(a=new Pe(n.from,n.to)),a.fromnew Pe(c.from-t.start,c.to-t.start)),t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function $u(s,e,t){for(let i of s){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function Wo(s,e,t,i,n,r){if(e=e&&t.enter(i,1,Y.IgnoreOverlays|Y.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 K)t=t.children[0];else break}return!1}}class ju{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(Ks))!==null&&t!==void 0?t:i.to,this.inner=new Ho(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(Ks))!==null&&e!==void 0?e:t.to,this.inner=new Ho(t.tree,-t.offset)}}findMounts(e,t){var i;let n=[];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;a.tree==this.curFrag.tree&&n.push({frag:a,pos:r.from-a.offset,mount:o})}}}return n}}function zo(s,e){let t=null,i=e;for(let n=1,r=0;n=l)break;a.to<=o||(t||(i=t=e.slice()),a.froml&&t.splice(r+1,0,new Pe(l,a.to))):a.to>l?t[r--]=new Pe(l,a.to):t.splice(r--,1))}}return i}function Uu(s,e,t,i){let n=0,r=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=n==s.length?1e9:o?s[n].to:s[n].from,f=r==e.length?1e9:l?e[r].to:e[r].from;if(o!=l){let u=Math.max(a,t),d=Math.min(c,f,i);unew Pe(u.from+i,u.to+i)),f=Uu(e,c,a,h);for(let u=0,d=a;;u++){let p=u==f.length,m=p?h:f[u].from;if(m>d&&t.push(new Ze(d,m,n.tree,-o,r.from>=d||r.openStart,r.to<=m||r.openEnd)),p)break;d=f[u].to}}else t.push(new Ze(a,h,n.tree,-o,r.from>=o||r.openStart,r.to<=l||r.openEnd))}return t}let Gu=0;class je{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=Gu++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new je([],null,[]);if(t.set.push(t),e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new wn;return t=>t.modified.indexOf(e)>-1?t:wn.get(t.base||t,t.modified.concat(e).sort((i,n)=>i.id-n.id))}}let Ju=0;class wn{constructor(){this.instances=[],this.id=Ju++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&Yu(t,l.modified));if(i)return i;let n=[],r=new je(n,e,t);for(let l of t)l.instances.push(r);let o=Xu(t);for(let l of e.set)if(!l.modified.length)for(let a of o)n.push(wn.get(l,a));return r}}function Yu(s,e){return s.length==e.length&&s.every((t,i)=>t==e[i])}function Xu(s){let e=[[]];for(let t=0;ti.length-t.length)}function _u(s){let e=Object.create(null);for(let t in s){let i=s[t];Array.isArray(i)||(i=[i]);for(let n of t.split(" "))if(n){let r=[],o=2,l=n;for(let f=0;;){if(l=="..."&&f>0&&f+3==n.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+n);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==n.length)break;let d=n[f++];if(f==n.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+n);l=n.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+n);let c=new xn(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return Ka.add(e)}const Ka=new R;class xn{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=n;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function Qu(s,e){let t=null;for(let i of s){let n=i.style(e);n&&(t=t?t+" "+n:n)}return t}function Zu(s,e,t,i=0,n=s.length){let r=new ed(i,Array.isArray(e)?e:[e],t);r.highlightRange(s.cursor(),i,n,"",r.highlighters),r.flush(n)}class ed{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,n,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=n,c=td(e)||xn.empty,f=Qu(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(n+=(n?" ":"")+f)),this.startSpan(Math.max(t,l),h),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 w=g=S||!e.nextSibling())););if(!w||S>i)break;y=w.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,w.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),h))}m&&e.parent()}else if(e.firstChild()){u&&(n="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,n,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function td(s){let e=s.type.prop(Ka);for(;e&&e.context&&!s.matchContext(e.context);)e=e.next;return e||null}const k=je.define,Yi=k(),st=k(),$o=k(st),Ko=k(st),rt=k(),Xi=k(rt),Zn=k(rt),Ke=k(),bt=k(Ke),qe=k(),$e=k(),js=k(),si=k(js),_i=k(),M={comment:Yi,lineComment:k(Yi),blockComment:k(Yi),docComment:k(Yi),name:st,variableName:k(st),typeName:$o,tagName:k($o),propertyName:Ko,attributeName:k(Ko),className:k(st),labelName:k(st),namespace:k(st),macroName:k(st),literal:rt,string:Xi,docString:k(Xi),character:k(Xi),attributeValue:k(Xi),number:Zn,integer:k(Zn),float:k(Zn),bool:k(rt),regexp:k(rt),escape:k(rt),color:k(rt),url:k(rt),keyword:qe,self:k(qe),null:k(qe),atom:k(qe),unit:k(qe),modifier:k(qe),operatorKeyword:k(qe),controlKeyword:k(qe),definitionKeyword:k(qe),moduleKeyword:k(qe),operator:$e,derefOperator:k($e),arithmeticOperator:k($e),logicOperator:k($e),bitwiseOperator:k($e),compareOperator:k($e),updateOperator:k($e),definitionOperator:k($e),typeOperator:k($e),controlOperator:k($e),punctuation:js,separator:k(js),bracket:si,angleBracket:k(si),squareBracket:k(si),paren:k(si),brace:k(si),content:Ke,heading:bt,heading1:k(bt),heading2:k(bt),heading3:k(bt),heading4:k(bt),heading5:k(bt),heading6:k(bt),contentSeparator:k(Ke),list:k(Ke),quote:k(Ke),emphasis:k(Ke),strong:k(Ke),link:k(Ke),monospace:k(Ke),strikethrough:k(Ke),inserted:k(),deleted:k(),changed:k(),invalid:k(),meta:_i,documentMeta:k(_i),annotation:k(_i),processingInstruction:k(_i),definition:je.defineModifier(),constant:je.defineModifier(),function:je.defineModifier(),standard:je.defineModifier(),local:je.defineModifier(),special:je.defineModifier()};ja([{tag:M.link,class:"tok-link"},{tag:M.heading,class:"tok-heading"},{tag:M.emphasis,class:"tok-emphasis"},{tag:M.strong,class:"tok-strong"},{tag:M.keyword,class:"tok-keyword"},{tag:M.atom,class:"tok-atom"},{tag:M.bool,class:"tok-bool"},{tag:M.url,class:"tok-url"},{tag:M.labelName,class:"tok-labelName"},{tag:M.inserted,class:"tok-inserted"},{tag:M.deleted,class:"tok-deleted"},{tag:M.literal,class:"tok-literal"},{tag:M.string,class:"tok-string"},{tag:M.number,class:"tok-number"},{tag:[M.regexp,M.escape,M.special(M.string)],class:"tok-string2"},{tag:M.variableName,class:"tok-variableName"},{tag:M.local(M.variableName),class:"tok-variableName tok-local"},{tag:M.definition(M.variableName),class:"tok-variableName tok-definition"},{tag:M.special(M.variableName),class:"tok-variableName2"},{tag:M.definition(M.propertyName),class:"tok-propertyName tok-definition"},{tag:M.typeName,class:"tok-typeName"},{tag:M.namespace,class:"tok-namespace"},{tag:M.className,class:"tok-className"},{tag:M.macroName,class:"tok-macroName"},{tag:M.propertyName,class:"tok-propertyName"},{tag:M.operator,class:"tok-operator"},{tag:M.comment,class:"tok-comment"},{tag:M.meta,class:"tok-meta"},{tag:M.invalid,class:"tok-invalid"},{tag:M.punctuation,class:"tok-punctuation"}]);var es;const kt=new R;function Ua(s){return O.define({combine:s?e=>e.concat(s):void 0})}const id=new R;class Le{constructor(e,t,i=[],n=""){this.data=e,this.name=n,H.prototype.hasOwnProperty("tree")||Object.defineProperty(H.prototype,"tree",{get(){return me(this)}}),this.parser=t,this.extension=[Yt.of(this),H.languageData.of((r,o,l)=>{let a=jo(r,o,l),h=a.type.prop(kt);if(!h)return[];let c=r.facet(h),f=a.type.prop(id);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return jo(e,t,i).type.prop(kt)==this.data}findRegions(e){let t=e.facet(Yt);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],n=(r,o)=>{if(r.prop(kt)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(R.mounted);if(l){if(l.tree.prop(kt)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(n(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new Us(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function me(s){let e=s.field(Le.state,!1);return e?e.tree:K.empty}class nd{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}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 ri=null;class Gt{constructor(e,t,i=[],n,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=n,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Gt(e,t,[],K.empty,0,i,[],null)}startParse(){return this.parser.startParse(new nd(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=K.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let n=Date.now()+e;e=()=>Date.now()>n}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(Ze.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ri;ri=this;try{return e()}finally{ri=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Uo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:n,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=Ze.applyChanges(i,a),n=K.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=Uo(this.fragments,n,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 $a{createParse(t,i,n){let r=n[0].from,o=n[n.length-1].to;return{parsedPos:r,advance(){let a=ri;if(a){for(let h of n)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new K(ge.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 ri}}function Uo(s,e,t){return Ze.applyChanges(s,[{fromA:e,toA:t,fromB:e,toB:t}])}class Jt{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 Jt(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Gt.create(e.facet(Yt).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Jt(i)}}Le.state=ye.define({create:Jt.init,update(s,e){for(let t of e.effects)if(t.is(Le.setState))return t.value;return e.startState.facet(Yt)!=e.state.facet(Yt)?Jt.init(e.state):s.apply(e)}});let Ga=s=>{let e=setTimeout(()=>s(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Ga=s=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(s,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const ts=typeof navigator<"u"&&(!((es=navigator.scheduling)===null||es===void 0)&&es.isInputPending)?()=>navigator.scheduling.isInputPending():null,sd=ue.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(Le.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Le.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Ga(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndn+1e3,a=r.context.work(()=>ts&&ts()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Le.setState.of(new Jt(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ne(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()}}}),Yt=O.define({combine(s){return s.length?s[0]:null},enables:s=>[Le.state,sd,T.contentAttributes.compute([s],e=>{let t=e.facet(s);return t&&t.name?{"data-language":t.name}:{}})]});class fm{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Ja=O.define(),In=O.define({combine:s=>{if(!s.length)return" ";let e=s[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(s[0]));return e}});function Tt(s){let e=s.facet(In);return e.charCodeAt(0)==9?s.tabSize*e.length:e.length}function vn(s,e){let t="",i=s.tabSize,n=s.facet(In)[0];if(n==" "){for(;e>=i;)t+=" ",e-=i;n=" "}for(let r=0;r=e?od(s,t,e):null}class Nn{constructor(e,t={}){this.state=e,this.options=t,this.unit=Tt(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:r}=this.options;return n!=null&&n>=i.from&&n<=i.to?r&&n==e?{text:"",from:e}:(t<0?n-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return _t(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:n}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(n);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const rd=new R;function od(s,e,t){let i=e.resolveStack(t),n=i.node.enterUnfinishedNodesBefore(t);if(n!=i.node){let r=[];for(let o=n;o!=i.node;o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return Xa(i,s,t)}function Xa(s,e,t){for(let i=s;i;i=i.next){let n=ad(i.node);if(n)return n(br.create(e,t,i))}return 0}function ld(s){return s.pos==s.options.simulateBreak&&s.options.simulateDoubleBreak}function ad(s){let e=s.type.prop(rd);if(e)return e;let t=s.firstChild,i;if(t&&(i=t.type.prop(R.closedBy))){let n=s.lastChild,r=n&&i.indexOf(n.name)>-1;return o=>_a(o,!0,1,void 0,r&&!ld(o)?n.from:void 0)}return s.parent==null?hd:null}function hd(){return 0}class br extends Nn{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new br(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(cd(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return Xa(this.context.next,this.base,this.pos)}}function cd(s,e){for(let t=e;t;t=t.parent)if(s==t)return!0;return!1}function fd(s){let e=s.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let n=s.options.simulateBreak,r=s.state.doc.lineAt(t.from),o=n==null||n<=r.from?r.to:Math.min(r.to,n);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped)return a.from_a(i,e,t,s)}function _a(s,e,t,i,n){let r=s.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||n==s.pos+o,a=e?fd(s):null;return a?l?s.column(a.from):s.column(a.to):s.baseIndent+(l?0:s.unit*t)}const dm=s=>s.baseIndent;function pm({except:s,units:e=1}={}){return t=>{let i=s&&s.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const gm=new R;function mm(s){let e=s.firstChild,t=s.lastChild;return e&&e.tol.prop(kt)==o.data:o?l=>l==o:void 0,this.style=ja(e.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new ut(i):null,this.themeType=t.themeType}static define(e,t){return new Fn(e,t||{})}}const Gs=O.define(),Qa=O.define({combine(s){return s.length?[s[0]]:null}});function is(s){let e=s.facet(Gs);return e.length?e:s.facet(Qa)}function ym(s,e){let t=[dd],i;return s instanceof Fn&&(s.module&&t.push(T.styleModule.of(s.module)),i=s.themeType),e!=null&&e.fallback?t.push(Qa.of(s)):i?t.push(Gs.computeN([T.darkTheme],n=>n.facet(T.darkTheme)==(i=="dark")?[s]:[])):t.push(Gs.of(s)),t}class ud{constructor(e){this.markCache=Object.create(null),this.tree=me(e.state),this.decorations=this.buildDeco(e,is(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=me(e.state),i=is(e.state),n=i!=is(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||n)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return B.none;let i=new At;for(let{from:n,to:r}of e.visibleRanges)Zu(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=B.mark({class:a})))},n,r);return i.finish()}}const dd=Bt.high(ue.fromClass(ud,{decorations:s=>s.decorations})),bm=Fn.define([{tag:M.meta,color:"#404740"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,textDecoration:"underline",fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strong,fontWeight:"bold"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.keyword,color:"#708"},{tag:[M.atom,M.bool,M.url,M.contentSeparator,M.labelName],color:"#219"},{tag:[M.literal,M.inserted],color:"#164"},{tag:[M.string,M.deleted],color:"#a11"},{tag:[M.regexp,M.escape,M.special(M.string)],color:"#e40"},{tag:M.definition(M.variableName),color:"#00f"},{tag:M.local(M.variableName),color:"#30a"},{tag:[M.typeName,M.namespace],color:"#085"},{tag:M.className,color:"#167"},{tag:[M.special(M.variableName),M.macroName],color:"#256"},{tag:M.definition(M.propertyName),color:"#00c"},{tag:M.comment,color:"#940"},{tag:M.invalid,color:"#f00"}]),pd=T.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Za=1e4,eh="()[]{}",th=O.define({combine(s){return Pt(s,{afterCursor:!0,brackets:eh,maxScanDistance:Za,renderMatch:yd})}}),gd=B.mark({class:"cm-matchingBracket"}),md=B.mark({class:"cm-nonmatchingBracket"});function yd(s){let e=[],t=s.matched?gd:md;return e.push(t.range(s.start.from,s.start.to)),s.end&&e.push(t.range(s.end.from,s.end.to)),e}const bd=ye.define({create(){return B.none},update(s,e){if(!e.docChanged&&!e.selection)return s;let t=[],i=e.state.facet(th);for(let n of e.state.selection.ranges){if(!n.empty)continue;let r=Ye(e.state,n.head,-1,i)||n.head>0&&Ye(e.state,n.head-1,1,i)||i.afterCursor&&(Ye(e.state,n.head,1,i)||n.headT.decorations.from(s)}),wd=[bd,pd];function wm(s={}){return[th.of(s),wd]}const xd=new R;function Js(s,e,t){let i=s.prop(e<0?R.openedBy:R.closedBy);if(i)return i;if(s.name.length==1){let n=t.indexOf(s.name);if(n>-1&&n%2==(e<0?1:0))return[t[n+e]]}return null}function Ys(s){let e=s.type.prop(xd);return e?e(s.node):s}function Ye(s,e,t,i={}){let n=i.maxScanDistance||Za,r=i.brackets||eh,o=me(s),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=Js(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return vd(s,e,t,a,c,h,r)}}return kd(s,e,t,o,l.type,n,r)}function vd(s,e,t,i,n,r,o){let l=i.parent,a={from:n.from,to:n.to},h=0,c=l==null?void 0:l.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=s.doc.iterRange(e,t>0?s.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!=n))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}function Go(s,e,t,i=0,n=0){e==null&&(e=s.search(/[^\s\u00a0]/),e==-1&&(e=s.length));let r=n;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 n(r)==n(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}}function Sd(s){return{name:s.name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||Cd,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||xr}}function Cd(s){if(typeof s!="object")return s;let e={};for(let t in s){let i=s[t];e[t]=i instanceof Array?i.slice():i}return e}const Jo=new WeakMap;class nh extends Le{constructor(e){let t=Ua(e.languageData),i=Sd(e),n,r=new class extends $a{createParse(o,l,a){return new Md(n,o,l,a)}};super(t,r,[Ja.of((o,l)=>this.getIndent(o,l))],e.name),this.topNode=Td(t),n=this,this.streamParser=i,this.stateAfter=new R({perNode:!0}),this.tokenTable=e.tokenTable?new lh(i.tokenTable):Od}static define(e){return new nh(e)}getIndent(e,t){let i=me(e.state),n=i.resolve(t);for(;n&&n.type!=this.topNode;)n=n.parent;if(!n)return null;let r,{overrideIndentation:o}=e.options;o&&(r=Jo.get(e.state),r!=null&&r1e4)return null;for(;a=i&&t+e.length<=n&&e.prop(s.stateAfter);if(r)return{state:s.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],h=l instanceof K&&a=e.length)return e;!n&&e.type==s.topNode&&(n=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],a;if(ot&&wr(s,n.tree,0-n.offset,t,o),a;if(l&&(a=sh(s,n.tree,t+n.offset,l.pos+n.offset,!1)))return{state:l.state,tree:a}}return{state:s.streamParser.startState(i?Tt(i):4),tree:K.empty}}class Md{constructor(e,t,i,n){this.lang=e,this.input=t,this.fragments=i,this.ranges=n,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=n[n.length-1].to;let r=Gt.get(),o=n[0].from,{state:l,tree:a}=Ad(e,i,o,r==null?void 0:r.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;h=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==` +`){[e,t]=Kt(this,e,t);let n="";for(let r=0,o=0;re&&r&&(n+=i),eo&&(n+=l.sliceString(e-o,t-o,i)),o=a+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ue))return 0;let i=0,[n,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,r+=t){if(n==o||r==l)return i;let a=this.children[n],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,n)=>i+n.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 _(d,t)}let n=Math.max(32,i>>5),r=n<<1,o=n>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Ue)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof _&&a&&(p=c[c.length-1])instanceof _&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new _(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Ue.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Ue(l,t)}}V.empty=new _([""],0);function cc(s){let e=-1;for(let t of s)e+=t.length+1;return e}function nn(s,e,t=0,i=1e9){for(let n=0,r=0,o=!0;r=t&&(a>i&&(l=l.slice(0,i-n)),n0?1:(e instanceof _?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],o=r>>1,l=n instanceof _?n.text.length:n.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(n instanceof _){let a=n.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=n.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof _?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class yl{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new ui(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:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=i?n:t<0?n.slice(n.length-i):n.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 bl{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},ui.prototype[Symbol.iterator]=yl.prototype[Symbol.iterator]=bl.prototype[Symbol.iterator]=function(){return this});class fc{constructor(e,t,i,n){this.from=e,this.to=t,this.number=i,this.text=n}get length(){return this.to-this.from}}function Kt(s,e,t){return e=Math.max(0,Math.min(s.length,e)),[e,Math.max(e,Math.min(s.length,t))]}let Vt="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(s=>s?parseInt(s,36):1);for(let s=1;ss)return Vt[e-1]<=s;return!1}function Er(s){return s>=127462&&s<=127487}const Ir=8205;function oe(s,e,t=!0,i=!0){return(t?wl:dc)(s,e,i)}function wl(s,e,t){if(e==s.length)return e;e&&xl(s.charCodeAt(e))&&vl(s.charCodeAt(e-1))&&e--;let i=ne(s,e);for(e+=Be(i);e=0&&Er(ne(s,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function dc(s,e,t){for(;e>0;){let i=wl(s,e-2,t);if(i=56320&&s<57344}function vl(s){return s>=55296&&s<56320}function ne(s,e){let t=s.charCodeAt(e);if(!vl(t)||e+1==s.length)return t;let i=s.charCodeAt(e+1);return xl(i)?(t-55296<<10)+(i-56320)+65536:t}function nr(s){return s<=65535?String.fromCharCode(s):(s-=65536,String.fromCharCode((s>>10)+55296,(s&1023)+56320))}function Be(s){return s<65536?1:2}const hs=/\r\n?|\n/;var he=function(s){return s[s.Simple=0]="Simple",s[s.TrackDel=1]="TrackDel",s[s.TrackBefore=2]="TrackBefore",s[s.TrackAfter=3]="TrackAfter",s}(he||(he={}));class _e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-n);r+=l}else{if(i!=he.Simple&&h>=e&&(i==he.TrackDel&&ne||i==he.TrackBefore&&ne))return null;if(h>e||h==e&&t<0&&!l)return e==n||t<0?r:r+a;r+=a}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return r}touchesRange(e,t=e){for(let i=0,n=0;i=0&&n<=t&&l>=e)return nt?"cover":!0;n=l}return!1}toString(){let e="";for(let t=0;t=0?":"+n:"")}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 _e(e)}static create(e){return new _e(e)}}class te extends _e{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 cs(this,(t,i,n,r,o)=>e=e.replace(n,n+(i-t),o),!1),e}mapDesc(e,t=!1){return fs(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let n=0,r=0;n=0){t[n]=l,t[n+1]=o;let a=n>>1;for(;i.length0&<(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let n=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!n.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"?V.of(d.split(i||hs)):d:V.empty,m=p.length;if(f==u&&m==0)return;fo&&ae(n,f-o,-1),ae(n,u-f,m),lt(r,n,p),o=u}}return h(e),a(!l),l}static empty(e){return new te(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let n=0;nl&&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==s[n+1]?s[n]+=e:e==0&&s[n]==0?s[n+1]+=t:i?(s[n]+=e,s[n+1]+=t):s.push(e,t)}function lt(s,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==s.sections.length||s.sections[o+1]<0);)l=s.sections[o++],a=s.sections[o++];e(n,h,r,c,f),n=h,r=c}}}function fs(s,e,t,i=!1){let n=[],r=i?[]:null,o=new mi(s),l=new mi(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ae(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class mi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?V.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?V.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 xt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,n;return this.empty?i=n=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new xt(i,n,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,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}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 xt(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,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.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=>xt.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,n=0;ne?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((n,r)=>n.from-r.from),t=e.indexOf(i);for(let n=1;nr.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function Sl(s,e){for(let t of s.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let sr=0;class O{constructor(e,t,i,n,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=n,this.id=sr++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new O(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:rr),!!e.static,e.enables)}of(e){return new sn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new sn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new sn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function rr(s,e){return s==e||s.length==e.length&&s.every((t,i)=>t===e[i])}class sn{constructor(e,t,i,n){this.dependencies=e,this.facet=t,this.type=i,this.value=n,this.id=sr++}dynamicSlot(e){var t;let i=this.value,n=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||us(f,c)){let d=i(f);if(l?!Nr(d,f.values[o],n):!n(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=un(u,p);if(this.dependencies.every(g=>g instanceof O?u.facet(g)===f.facet(g):g instanceof ye?u.field(g,!1)==f.field(g,!1):!0)||(l?Nr(d=i(f),m,n):n(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function Nr(s,e,t){if(s.length!=e.length)return!1;for(let i=0;is[a.id]),n=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=s[e.id]>>1;function l(a){let h=[];for(let c=0;ci===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Fr).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,n)=>{let r=i.values[t],o=this.updateF(r,n);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,n)=>n.config.address[this.id]!=null?(i.values[t]=n.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,Fr.of({field:this,create:e})]}get extension(){return this}}const wt={lowest:4,low:3,default:2,high:1,highest:0};function ti(s){return e=>new Cl(e,s)}const Bt={highest:ti(wt.highest),high:ti(wt.high),default:ti(wt.default),low:ti(wt.low),lowest:ti(wt.lowest)};class Cl{constructor(e,t){this.inner=e,this.prec=t}}class Pn{of(e){return new ds(this,e)}reconfigure(e){return Pn.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ds{constructor(e,t){this.compartment=e,this.inner=t}}class fn{constructor(e,t,i,n,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=n,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let n=[],r=Object.create(null),o=new Map;for(let u of gc(e,t,o))u instanceof ye?n.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.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]=a.length<<1|1,rr(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(y=>g.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(g=>pc(g,p,d))}}let f=h.map(u=>u(l));return new fn(e,o,f,l,a,r)}}function gc(s,e,t){let i=[[],[],[],[],[]],n=new Map;function r(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof ds&&t.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof ds){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Cl)r(o.inner,o.prec);else if(o instanceof ye)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof sn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,wt.default);else{let h=o.extension;if(!h)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(h,l)}}return r(s,wt.default),i.reduce((o,l)=>o.concat(l))}function di(s,e){if(e&1)return 2;let t=e>>1,i=s.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;s.status[t]=4;let n=s.computeSlot(s,s.config.dynamicSlots[t]);return s.status[t]=2|n}function un(s,e){return e&1?s.config.staticValues[e>>1]:s.values[e>>1]}const Al=O.define(),ps=O.define({combine:s=>s.some(e=>e),static:!0}),Ml=O.define({combine:s=>s.length?s[0]:void 0,static:!0}),Dl=O.define(),Ol=O.define(),Tl=O.define(),Bl=O.define({combine:s=>s.length?s[0]:!1});class nt{constructor(e,t){this.type=e,this.value=t}static define(){return new mc}}class mc{of(e){return new nt(this,e)}}class yc{constructor(e){this.map=e}of(e){return new F(this,e)}}class F{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 F(this.type,t)}is(e){return this.type==e}static define(e={}){return new yc(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let n of e){let r=n.map(t);r&&i.push(r)}return i}}F.reconfigure=F.define();F.appendConfig=F.define();class Q{constructor(e,t,i,n,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=n,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Sl(i,t.newLength),r.some(l=>l.type==Q.time)||(this.annotations=r.concat(Q.time.of(Date.now())))}static create(e,t,i,n,r,o){return new Q(e,t,i,n,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=nt.define();Q.userEvent=nt.define();Q.addToHistory=nt.define();Q.remote=nt.define();function bc(s,e){let t=[];for(let i=0,n=0;;){let r,o;if(i=s[i]))r=s[i++],o=s[i++];else if(n=0;n--){let r=i[n](s);r instanceof Q?s=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Q?s=r[0]:s=Ll(e,Wt(r),!1)}return s}function xc(s){let e=s.startState,t=e.facet(Tl),i=s;for(let n=t.length-1;n>=0;n--){let r=t[n](s);r&&Object.keys(r).length&&(i=Pl(i,gs(e,r,s.changes.newLength),!0))}return i==s?s:Q.create(e,s.changes,s.selection,i.effects,i.annotations,i.scrollIntoView)}const vc=[];function Wt(s){return s==null?vc:Array.isArray(s)?s:[s]}var G=function(s){return s[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s}(G||(G={}));const kc=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ms;try{ms=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Sc(s){if(ms)return ms.test(s);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||kc.test(t)))return!0}return!1}function Cc(s){return e=>{if(!/\S/.test(e))return G.Space;if(Sc(e))return G.Word;for(let t=0;t-1)return G.Word;return G.Other}}class H{constructor(e,t,i,n,r,o){this.config=e,this.doc=t,this.selection=i,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;ln.set(h,a)),t=null),n.set(l.value.compartment,l.value.extension)):l.is(F.reconfigure)?(t=null,i=l.value):l.is(F.appendConfig)&&(t=null,i=Wt(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=fn.resolve(i,n,this),r=new H(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(ps)?e.newSelection:e.newSelection.asSingle();new H(t,e.newDoc,o,r,(l,a)=>a.update(l,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]),n=this.changes(i.changes),r=[i.range],o=Wt(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return H.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=fn.resolve(e.extensions||[],new Map),i=e.doc instanceof V?e.doc:V.of((e.doc||"").split(t.staticFacet(H.lineSeparator)||hs)),n=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return Sl(n,i.length),t.staticFacet(ps)||(n=n.asSingle()),new H(t,i,n,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(H.tabSize)}get lineBreak(){return this.facet(H.lineSeparator)||` +`}get readOnly(){return this.facet(Bl)}phrase(e,...t){for(let i of this.facet(H.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,n)=>{if(n=="$")return"$";let r=+(n||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let n=[];for(let r of this.facet(Al))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){return Cc(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:n}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=oe(t,o,!1);if(r(t.slice(a,o))!=G.Word)break;o=a}for(;ls.length?s[0]:4});H.lineSeparator=Ml;H.readOnly=Bl;H.phrases=O.define({compare(s,e){let t=Object.keys(s),i=Object.keys(e);return t.length==i.length&&t.every(n=>s[n]==e[n])}});H.languageData=Al;H.changeFilter=Dl;H.transactionFilter=Ol;H.transactionExtender=Tl;Pn.reconfigure=F.define();function Pt(s,e,t={}){let i={};for(let n of s)for(let r of Object.keys(n)){let o=n[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 n in e)i[n]===void 0&&(i[n]=e[n]);return i}class Ct{eq(e){return this==e}range(e,t=e){return ys.create(e,t,this)}}Ct.prototype.startSide=Ct.prototype.endSide=0;Ct.prototype.point=!1;Ct.prototype.mapMode=he.TrackDel;let ys=class Rl{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new Rl(e,t,i)}};function bs(s,e){return s.from-e.from||s.value.startSide-e.value.startSide}class or{constructor(e,t,i,n){this.from=e,this.to=t,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,n=0){let r=i?this.to:this.from;for(let o=n,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,n){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);rd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),n.push(u-o),r.push(d-o))}return{mapped:i.length?new or(n,r,i,l):null,pos:o}}}class ${constructor(e,t,i,n){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=n}static create(e,t,i,n){return new $(e,t,i,n)}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:n=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(bs)),this.isEmpty)return t.length?$.of(t):this;let l=new El(this,null,-1).goto(0),a=0,h=[],c=new At;for(;l.value||a=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.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 yi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return yi.from(e).goto(t)}static compare(e,t,i,n,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),a=Vr(o,l,i),h=new ii(o,a,r),c=new ii(l,a,r);i.iterGaps((f,u,d)=>Wr(h,f,c,u,d,n)),i.empty&&i.length==0&&Wr(h,0,c,0,0,n)}static eq(e,t,i=0,n){n==null&&(n=999999999);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),a=new ii(r,l,0).goto(i),h=new ii(o,l,0).goto(i);for(;;){if(a.to!=h.to||!ws(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>n)return!0;a.next(),h.next()}}static spans(e,t,i,n,r=-1){let o=new ii(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(n.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new At;for(let n of e instanceof ys?[e]:t?Ac(e):e)i.add(n.from,n.to,n.value);return i.finish()}static join(e){if(!e.length)return $.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let n=e[i];n!=$.empty;n=n.nextLayer)t=new $(n.chunkPos,n.chunk,t,Math.max(n.maxPoint,t.maxPoint));return t}}$.empty=new $([],[],null,-1);function Ac(s){if(s.length>1)for(let e=s[0],t=1;t0)return s.slice().sort(bs);e=i}return s}$.empty.nextLayer=$.empty;class At{finishChunk(e){this.chunks.push(new or(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=[])}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}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new At)).add(e,t,i)}addInner(e,t,i){let n=e-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return n<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($.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=$.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Vr(s,e,t){let i=new Map;for(let r of s)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&&n.push(new El(o,t,i,r));return n.length==1?n[0]:new yi(n)}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--)$n(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--)$n(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(),$n(this.heap,0)}}}function $n(s,e){for(let t=s[e];;){let i=(e<<1)+1;if(i>=s.length)break;let n=s[i];if(i+1=0&&(n=s[i+1],i++),t.compare(n)<0)break;s[i]=t,s[e]=n,e=i}}class ii{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=yi.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){Ni(this.active,e),Ni(this.activeTo,e),Ni(this.activeRank,e),this.minActive=Hr(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:n,rank:r}=this.cursor;for(;t0;)t++;Fi(this.active,t,i),Fi(this.activeTo,t,n),Fi(this.activeRank,t,r),e&&Fi(e,t,this.cursor.from),this.minActive=Hr(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Ni(i,n)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[n]=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 Wr(s,e,t,i,n,r){s.goto(e),t.goto(i);let o=i+n,l=i,a=i-e;for(;;){let h=s.to+a-t.to||s.endSide-t.endSide,c=h<0?s.to+a:t.to,f=Math.min(c,o);if(s.point||t.point?s.point&&t.point&&(s.point==t.point||s.point.eq(t.point))&&ws(s.activeForPoint(s.to),t.activeForPoint(t.to))||r.comparePoint(l,f,s.point,t.point):f>l&&!ws(s.active,t.active)&&r.compareRange(l,f,s.active,t.active),c>o)break;l=c,h<=0&&s.next(),h>=0&&t.next()}}function ws(s,e){if(s.length!=e.length)return!1;for(let t=0;t=e;i--)s[i+1]=s[i];s[e]=t}function Hr(s,e){let t=-1,i=1e9;for(let n=0;n=e)return n;if(n==s.length)break;r+=s.charCodeAt(n)==9?t-r%t:1,n=oe(s,n)}return i===!0?-1:s.length}const vs="ͼ",zr=typeof Symbol>"u"?"__"+vs:Symbol.for(vs),ks=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),qr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ut{constructor(e,t){this.rules=[];let{finish:i}=t||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.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,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(n(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)r(n(o),e[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=qr[zr]||1;return qr[zr]=e+1,vs+e.toString(36)}static mount(e,t,i){let n=e[ks],r=i&&i.nonce;n?r&&n.setNonce(r):n=new Mc(e,r),n.mount(Array.isArray(t)?t:[t])}}let $r=new Map;class Mc{constructor(e,t){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let r=$r.get(i);if(r)return e.adoptedStyleSheets=[r.sheet,...e.adoptedStyleSheets],e[ks]=r;this.sheet=new n.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],$r.set(i,this)}else{this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);let r=e.head||e;r.insertBefore(this.styleTag,r.firstChild)}this.modules=[],e[ks]=this}mount(e){let t=this.sheet,i=0,n=0;for(let r=0;r-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,o),t)for(let a=0;a",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Dc=typeof navigator<"u"&&/Mac/.test(navigator.platform),Oc=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var se=0;se<10;se++)dt[48+se]=dt[96+se]=String(se);for(var se=1;se<=24;se++)dt[se+111]="F"+se;for(var se=65;se<=90;se++)dt[se]=String.fromCharCode(se+32),bi[se]=String.fromCharCode(se);for(var Kn in dt)bi.hasOwnProperty(Kn)||(bi[Kn]=dt[Kn]);function Tc(s){var e=Dc&&s.metaKey&&s.shiftKey&&!s.ctrlKey&&!s.altKey||Oc&&s.shiftKey&&s.key&&s.key.length==1||s.key=="Unidentified",t=!e&&s.key||(s.shiftKey?bi:dt)[s.keyCode]||s.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 dn(s){let e;return s.nodeType==11?e=s.getSelection?s:s.ownerDocument:e=s,e.getSelection()}function Ss(s,e){return e?s==e||s.contains(e.nodeType!=1?e.parentNode:e):!1}function Bc(s){let e=s.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function rn(s,e){if(!e.anchorNode)return!1;try{return Ss(s,e.anchorNode)}catch{return!1}}function jt(s){return s.nodeType==3?Mt(s,0,s.nodeValue.length).getClientRects():s.nodeType==1?s.getClientRects():[]}function pi(s,e,t,i){return t?Kr(s,e,t,i,-1)||Kr(s,e,t,i,1):!1}function wi(s){for(var e=0;;e++)if(s=s.previousSibling,!s)return e}function Kr(s,e,t,i,n){for(;;){if(s==t&&e==i)return!0;if(e==(n<0?0:et(s))){if(s.nodeName=="DIV")return!1;let r=s.parentNode;if(!r||r.nodeType!=1)return!1;e=wi(s)+(n<0?0:1),s=r}else if(s.nodeType==1){if(s=s.childNodes[e+(n<0?-1:0)],s.nodeType==1&&s.contentEditable=="false")return!1;e=n<0?et(s):0}else return!1}}function et(s){return s.nodeType==3?s.nodeValue.length:s.childNodes.length}function Ln(s,e){let t=e?s.left:s.right;return{left:t,right:t,top:s.top,bottom:s.bottom}}function Pc(s){return{left:0,right:s.innerWidth,top:0,bottom:s.innerHeight}}function Il(s,e){let t=e.width/s.offsetWidth,i=e.height/s.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-s.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-s.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function Lc(s,e,t,i,n,r,o,l){let a=s.ownerDocument,h=a.defaultView||window;for(let c=s,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,p=1,m=1;if(d)u=Pc(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let w=c.getBoundingClientRect();({scaleX:p,scaleY:m}=Il(c,w)),u={left:w.left,right:w.left+c.clientWidth*p,top:w.top,bottom:w.top+c.clientHeight*m}}let g=0,y=0;if(n=="nearest")e.top0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+y+o)):e.bottom>u.bottom&&(y=e.bottom-u.bottom+o,t<0&&e.top-y0&&e.right>u.right+g&&(g=e.right-u.right+g+r)):e.right>u.right&&(g=e.right-u.right+r,t<0&&e.leftt.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11)t=t.host;else break;return null}class Ec{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?et(t):0),i,Math.min(e.focusOffset,i?et(i):0))}set(e,t,i,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=n}}let Et=null;function Nl(s){if(s.setActive)return s.setActive();if(Et)return s.focus(Et);let e=[];for(let t=s;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(s.focus(Et==null?{get preventScroll(){return Et={preventScroll:!0},!0}}:void 0),!Et){Et=!1;for(let t=0;tMath.max(1,s.scrollHeight-s.clientHeight-4)}class ce{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new ce(e.parentNode,wi(e),t)}static after(e,t){return new ce(e.parentNode,wi(e)+1,t)}}const lr=[];class U{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let i of this.children){if(i==e)return t;t+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let i=this.dom,n=null,r;for(let o of this.children){if(o.flags&7){if(!o.dom&&(r=n?n.nextSibling:i.firstChild)){let l=U.get(r);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(r)}o.sync(e,t),o.flags&=-8}if(r=n?n.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&r!=o.dom&&(t.written=!0),o.dom.parentNode==i)for(;r&&r!=o.dom;)r=Ur(r);else i.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:i.firstChild,r&&t&&t.node==i&&(t.written=!0);r;)r=Ur(r)}else if(this.flags&1)for(let i of this.children)i.flags&7&&(i.sync(e,t),i.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let i;if(e==this.dom)i=this.dom.childNodes[t];else{let n=et(e)==0?0:t==0?-1:1;for(;;){let r=e.parentNode;if(r==this.dom)break;n==0&&r.firstChild!=r.lastChild&&(e==r.firstChild?n=-1:n=1),e=r}n<0?i=e:i=e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!U.get(i);)i=i.nextSibling;if(!i)return this.length;for(let n=0,r=0;;n++){let o=this.children[n];if(o.dom==i)return r;r+=o.length+o.breakAfter}}domBoundsAround(e,t,i=0){let n=-1,r=-1,o=-1,l=-1;for(let a=0,h=i,c=i;at)return f.domBoundsAround(e,t,h);if(u>=e&&n==-1&&(n=a,r=h),h>t&&f.dom.parentNode==this.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=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=lr){this.markDirty();for(let n=e;nthis.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 Hl(s,e,t,i,n,r,o,l,a){let{children:h}=s,c=h.length?h[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,n,r.length?f:null,t==0,l,a))){if(i0&&(!o&&r.length&&c.merge(t,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(t2);var D={mac:Yr||/Mac/.test(Me.platform),windows:/Win/.test(Me.platform),linux:/Linux|X11/.test(Me.platform),ie:Rn,ie_version:ql?Cs.documentMode||6:Ms?+Ms[1]:As?+As[1]:0,gecko:Gr,gecko_version:Gr?+(/Firefox\/(\d+)/.exec(Me.userAgent)||[0,0])[1]:0,chrome:!!jn,chrome_version:jn?+jn[1]:0,ios:Yr,android:/Android\b/.test(Me.userAgent),webkit:Jr,safari:$l,webkit_version:Jr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:Cs.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Fc=256;class tt extends U{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,i){return this.flags&8||i&&(!(i instanceof tt)||this.length-(t-e)+i.length>Fc||i.flags&8)?!1:(this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new tt(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new ce(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 Vc(this.dom,e,t)}}class it extends U{constructor(e,t=[],i=0){super(),this.mark=e,this.children=t,this.length=i;for(let n of t)n.setParent(this)}setAttrs(e){if(Fl(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}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,i,n,r,o){return i&&(!(i instanceof it&&i.mark.eq(this.mark))||e&&r<=0||te&&t.push(i=e&&(n=r),i=a,r++}let o=this.length-e;return this.length=e,n>-1&&(this.children.length=n,this.markDirty()),new it(this.mark,t,o)}domAtPos(e){return Kl(this,e)}coordsAt(e,t){return Ul(this,e,t)}}function Vc(s,e,t){let i=s.nodeValue.length;e>i&&(e=i);let n=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?D.chrome||D.gecko||(e?(n--,o=1):r=0)?0:l.length-1];return D.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?Ln(a,o<0):a||null}class vt extends U{static create(e,t,i){return new vt(e,t,i)}constructor(e,t,i){super(),this.widget=e,this.length=t,this.side=i,this.prevWidget=null}split(e){let t=vt.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,i,n,r,o){return i&&(!(i instanceof vt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0)?ce.before(this.dom):ce.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let n=this.dom.getClientRects(),r=null;if(!n.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?n.length-1:0;r=n[l],!(e>0?l==0:l==n.length-1||r.top0?ce.before(this.dom):ce.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return V.empty}get isHidden(){return!0}}tt.prototype.children=vt.prototype.children=Ut.prototype.children=lr;function Kl(s,e){let t=s.dom,{children:i}=s,n=0;for(let r=0;nr&&e0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=n;r0&&e instanceof it&&n.length&&(i=n[n.length-1])instanceof it&&i.mark.eq(e.mark)?jl(i,e.children[0],t-1):(n.push(e),e.setParent(s)),s.length+=e.length}function Ul(s,e,t){let i=null,n=-1,r=null,o=-1;function l(h,c){for(let f=0,u=0;f=c&&(d.children.length?l(d,c-u):(!r||r.isHidden&&t>0)&&(p>c||u==p&&d.getSide()>0)?(r=d,o=c-u):(u-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let r of i)if(r!=t&&(n.indexOf(r)==-1||s[r]!==e[r]))return!1;return!0}function Os(s,e,t){let i=!1;if(e)for(let n in e)t&&n in t||(i=!0,n=="style"?s.style.cssText="":s.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(i=!0,n=="style"?s.style.cssText=t[n]:s.setAttribute(n,t[n]));return i}function Hc(s){let e=Object.create(null);for(let t=0;t0&&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){ar(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){jl(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;t&&(this.attrs=Ds(t,this.attrs||{})),i&&(this.attrs=Ds({class:i},this.attrs||{}))}domAtPos(e){return Kl(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var i;this.dom?this.flags&4&&(Fl(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&&(Os(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let n=this.dom.lastChild;for(;n&&U.get(n)instanceof it;)n=n.lastChild;if(!n||!this.length||n.nodeName!="BR"&&((i=U.get(n))===null||i===void 0?void 0:i.isEditable)==!1&&(!D.ios||!this.children.some(r=>r instanceof tt))){let r=document.createElement("BR");r.cmIgnore=!0,this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof tt)||/[^ -~]/.test(i.text))return null;let n=jt(i.dom);if(n.length!=1)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let i=Ul(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:n}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-n.lineHeight)<2&&n.textHeight=t){if(r instanceof ee)return r;if(o>t)break}n=o+r.breakAfter}return null}}class ht extends U{constructor(e,t,i){super(),this.widget=e,this.length=t,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(e,t,i,n,r,o){return i&&(!(i instanceof ht)||!this.widget.compare(i.widget)||e>0&&r<=0||t0}}class Lt{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var De=function(s){return s[s.Text=0]="Text",s[s.WidgetBefore=1]="WidgetBefore",s[s.WidgetAfter=2]="WidgetAfter",s[s.WidgetRange=3]="WidgetRange",s}(De||(De={}));class B extends Ct{constructor(e,t,i,n){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=n}get heightRelevant(){return!1}static mark(e){return new Ti(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new pt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,n;if(e.isBlockGap)i=-5e8,n=4e8;else{let{start:r,end:o}=Gl(e,t);i=(r?t?-3e8:-1:5e8)-1,n=(o?t?2e8:1:-6e8)+1}return new pt(e,i,n,t,e.widget||null,!0)}static line(e){return new Bi(e)}static set(e,t=!1){return $.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}B.none=$.empty;class Ti extends B{constructor(e){let{start:t,end:i}=Gl(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){var t,i;return this==e||e instanceof Ti&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&ar(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Ti.prototype.point=!1;class Bi extends B{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Bi&&this.spec.class==e.spec.class&&ar(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)}}Bi.prototype.mapMode=he.TrackBefore;Bi.prototype.point=!0;class pt extends B{constructor(e,t,i,n,r,o){super(t,i,r,e),this.block=n,this.isReplace=o,this.mapMode=n?t<=0?he.TrackBefore:he.TrackAfter:he.TrackDel}get type(){return this.startSide!=this.endSide?De.WidgetRange:this.startSide<=0?De.WidgetBefore:De.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof pt&&zc(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)}}pt.prototype.point=!0;function Gl(s,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=s;return t==null&&(t=s.inclusive),i==null&&(i=s.inclusive),{start:t??e,end:i??e}}function zc(s,e){return s==e||!!(s&&e&&s.compare(e))}function Ts(s,e,t,i=0){let n=t.length-1;n>=0&&t[n]+i>=s?t[n]=Math.max(t[n],e):t.push(s,e)}class gi{constructor(e,t,i,n){this.doc=e,this.pos=t,this.end=i,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ht&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ee),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Vi(new Ut(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof ht)&&this.getLine()}buildText(e,t,i){for(;e>0;){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,this.atCursorPos=!0,e--;continue}else this.text=r,this.textOff=0}let n=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i)),this.getLine().append(Vi(new tt(this.text.slice(this.textOff,this.textOff+n)),t),i),this.atCursorPos=!0,this.textOff+=n,e-=n,i=0}}span(e,t,i,n){this.buildText(t-e,i,n),this.pos=t,this.openStart<0&&(this.openStart=n)}point(e,t,i,n,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof pt){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 pt)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ht(i.widget||new _r("div"),l,i));else{let a=vt.create(i.widget||new _r("span"),l,l?0:i.startSide),h=this.atCursorPos&&!a.isEditable&&r<=n.length&&(e0),c=!a.isEditable&&(en.length||i.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),h&&(f.append(Vi(new Ut(1),n),r),r=n.length+Math.max(0,r-n.length)),f.append(Vi(a,n),r),this.atCursorPos=c,this.pendingBuffer=c?en.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,i,n,r){let o=new gi(e,t,i,r);return o.openEnd=$.spans(n,t,i,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Vi(s,e){for(let t of e)s=new it(t,[s],s.length);return s}class _r extends Lt{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}var X=function(s){return s[s.LTR=0]="LTR",s[s.RTL=1]="RTL",s}(X||(X={}));const Dt=X.LTR,hr=X.RTL;function Jl(s){let e=[];for(let t=0;t=t){if(l.level==i)return o;(r<0||(n!=0?n<0?l.fromt:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function Xl(s,e){if(s.length!=e.length)return!1;for(let t=0;t=0;m-=3)if(ze[m+1]==-d){let g=ze[m+2],y=g&2?n:g&4?g&1?r:n:0;y&&(q[f]=q[ze[m]]=y),l=m;break}}else{if(ze.length==189)break;ze[l++]=f,ze[l++]=u,ze[l++]=a}else if((p=q[f])==2||p==1){let m=p==n;a=m?0:1;for(let g=l-3;g>=0;g-=3){let y=ze[g+2];if(y&2)break;if(m)ze[g+2]|=2;else{if(y&4)break;ze[g+2]|=4}}}}}function Gc(s,e,t,i){for(let n=0,r=i;n<=t.length;n++){let o=n?t[n-1].to:s,l=na;)p==g&&(p=t[--m].from,g=m?t[m-1].to:s),q[--p]=d;a=c}else r=h,a++}}}function Ps(s,e,t,i,n,r,o){let l=i%2?2:1;if(i%2==n%2)for(let a=e,h=0;aa&&o.push(new at(a,m.from,d));let g=m.direction==Dt!=!(d%2);Ls(s,g?i+1:i,n,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(c?q[p]!=l:q[p]==l))break;p++}u?Ps(s,a,p,i+1,n,u,o):ae;){let c=!0,f=!1;if(!h||a>r[h-1].to){let m=q[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(h&&p==r[h-1].to){if(f)break e;let m=r[--h];if(!c)for(let g=m.from,y=h;;){if(g==e)break e;if(y&&r[y-1].to==g)g=r[--y].from;else{if(q[g-1]==l)break e;break}}if(u)u.push(m);else{m.toq.length;)q[q.length]=256;let i=[],n=e==Dt?0:1;return Ls(s,n,n,t,0,s.length,i),i}function _l(s){return[new at(0,s,0)]}let Ql="";function Yc(s,e,t,i,n){var r;let o=i.head-s.from,l=at.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=e[l],h=a.side(n,t);if(o==h){let u=l+=n?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!n,t),h=a.side(n,t)}let c=oe(s.text,o,a.forward(n,t));(ca.to)&&(c=h),Ql=s.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(n?e.length-1:0)?null:e[l+(n?1:-1)];return f&&c==h&&f.level+(n?0:1)s.some(e=>e)}),oa=O.define({combine:s=>s.some(e=>e)});class zt{constructor(e,t="nearest",i="nearest",n=5,r=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=n,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new zt(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new zt(b.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Wi=F.define({map:(s,e)=>s.map(e)});function Ne(s,e,t){let i=s.facet(ia);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 En=O.define({combine:s=>s.length?s[0]:!0});let _c=0;const li=O.define();class ue{constructor(e,t,i,n,r){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=n,this.extension=r(this)}static define(e,t){const{eventHandlers:i,eventObservers:n,provide:r,decorations:o}=t||{};return new ue(_c++,e,i,n,l=>{let a=[li.of(l)];return o&&a.push(xi.of(h=>{let c=h.plugin(l);return c?o(c):B.none})),r&&a.push(r(l)),a})}static fromClass(e,t){return ue.define(i=>new e(i),t)}}class Un{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(Ne(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){Ne(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){Ne(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const la=O.define(),cr=O.define(),xi=O.define(),aa=O.define(),fr=O.define(),ha=O.define();function Qr(s,e){let t=s.state.facet(ha);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(s):r),n=[];return $.spans(i,e.from,e.to,{point(){},span(r,o,l,a){let h=r-e.from,c=o-e.from,f=n;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,p;if(d==null&&(d=Xc(e.text,h,c)),a>0&&f.length&&(p=f[f.length-1]).to==h&&p.direction==d)p.to=c,f=p.inner;else{let m={from:h,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),n}const ca=O.define();function fa(s){let e=0,t=0,i=0,n=0;for(let r of s.state.facet(ca)){let o=r(s);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:e,right:t,top:i,bottom:n}}const ai=O.define();class Ee{constructor(e,t,i,n){this.fromA=e,this.toA=t,this.fromB=i,this.toB=n}join(e){return new Ee(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 n=e[t-1];if(!(n.fromA>i.toA)){if(n.toAc)break;r+=2}if(!a)return i;new Ee(a.fromA,a.toA,a.fromB,a.toB).addToSet(i),o=a.toA,l=a.toB}}}class pn{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=te.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let n=[];this.changes.iterChangedRanges((r,o,l,a)=>n.push(new Ee(r,o,l,a))),this.changedRanges=n}static create(e,t,i){return new pn(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}}class Zr extends U{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,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 ee],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ee(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:h,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?n=this.domChanged.newSel.head:!rf(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?Zc(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:c}=this.hasComposition;i=new Ee(h,c,e.changes.mapPos(h,-1),e.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(D.ie||D.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=nf(o,l,e.changes);return i=Ee.extendWithRanges(i,a),!(this.flags&7)&&i.length==0?!1:(this.updateInner(i,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,i);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=D.chrome||D.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||n.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let r=[];if(this.view.viewport.from||this.view.viewport.to=0?n[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:c,toB:f}=l,u,d,p,m;if(i&&i.range.fromBc){let v=gi.build(this.view.state.doc,c,i.range.fromB,this.decorations,this.dynamicDecorationMap),x=gi.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);d=v.breakAtStart,p=v.openStart,m=x.openEnd;let A=this.compositionView(i);x.breakAtStart?A.breakAfter=1:x.content.length&&A.merge(A.length,A.length,x.content[0],!1,x.openStart,0)&&(A.breakAfter=x.content[0].breakAfter,x.content.shift()),v.content.length&&A.merge(0,0,v.content[v.content.length-1],!0,0,v.openEnd)&&v.content.pop(),u=v.content.concat(A).concat(x.content)}else({content:u,breakAtStart:d,openStart:p,openEnd:m}=gi.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:y}=r.findPos(h,1),{i:w,off:S}=r.findPos(a,-1);Hl(this,w,S,g,y,u,d,p,m)}i&&this.fixCompositionDOM(i)}compositionView(e){let t=new tt(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new it(n,[t],t.length);let i=new ee;return i.append(t,0),i}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=U.get(r);l&&l!=o&&(l.dom=null),o.setDOM(r)},i=this.childPos(e.range.fromB,1),n=this.children[i.i];t(e.line,n);for(let r=e.marks.length-1;r>=-1;r--)i=n.childPos(i.off,1),n=n.children[i.i],t(r>=0?e.marks[r].node:e.text,n)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,r=!n&&rn(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||t||r))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(D.gecko&&l.empty&&!this.hasComposition&&Qc(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=h=new ce(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!pi(a.node,a.offset,c.anchorNode,c.anchorOffset)||!pi(h.node,h.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))&&(this.view.observer.ignore(()=>{D.android&&D.chrome&&this.dom.contains(c.focusNode)&&sf(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=dn(this.view.root);if(f)if(l.empty){if(D.gecko){let u=ef(a.node,a.offset);if(u&&u!=3){let d=da(a.node,a.offset,u==1?1:-1);d&&(a=new ce(d.node,d.offset))}}f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(u)}r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new ce(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new ce(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&pi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=dn(e.root),{anchorNode:n,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=ee.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(n,r)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let n=e.offset;!i&&n=0;n--){let r=U.get(t.childNodes[n]);r instanceof ee&&(i=r.domAtPos(r.length))}return i?new ce(i.node,i.offset,!0):e}nearest(e){for(let t=e;t;){let i=U.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(;t=0;o--){let l=this.children[o],a=r-l.breakAfter,h=a-l.length;if(ae||l.covers(1))&&(!i||l instanceof ee&&!(i instanceof ee&&t>=0))&&(i=l,n=h),r=h}return i?i.coordsAt(e-n,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),n=this.children[t];if(!(n instanceof ee))return null;for(;n.children.length;){let{i:l,off:a}=n.childPos(i,1);for(;;l++){if(l==n.children.length)return null;if((n=n.children[l]).length)break}i=a}if(!(n instanceof tt))return null;let r=oe(n.text,i);if(r==i)return null;let o=Mt(n.dom,i,r).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==X.LTR;for(let h=0,c=0;cn)break;if(h>=i){let d=f.dom.getBoundingClientRect();if(t.push(d.height),o){let p=f.dom.lastChild,m=p?jt(p):[];if(m.length){let g=m[m.length-1],y=a?g.right-d.left:d.right-g.left;y>l&&(l=y,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?X.RTL:X.LTR}measureTextSize(){for(let r of this.children)if(r instanceof ee){let o=r.measureTextSize();if(o)return o}let e=document.createElement("div"),t,i,n;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=jt(e.firstChild)[0];t=e.getBoundingClientRect().height,i=r?r.width/27:7,n=r?r.height:t,e.remove()}),{lineHeight:t,charWidth:i,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Wl(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,n=0;;n++){let r=n==t.viewports.length?null:t.viewports[n],o=r?r.from-1:this.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(B.replace({widget:new eo(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return B.set(e)}updateDeco(){let e=this.view.state.facet(xi).map((n,r)=>(this.dynamicDecorationMap[r]=typeof n=="function")?n(this.view):n),t=!1,i=this.view.state.facet(aa).map((n,r)=>{let o=typeof n=="function";return o&&(t=!0),o?n(this.view):n});i.length&&(this.dynamicDecorationMap[e.length]=t,e.push($.join(i)));for(let n=e.length;nt.anchor?-1:1),n;if(!i)return;!t.empty&&(n=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,n.left),top:Math.min(i.top,n.top),right:Math.max(i.right,n.right),bottom:Math.max(i.bottom,n.bottom)});let r=fa(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;Lc(this.view.scrollDOM,o,t.head0)i=i.childNodes[n-1],n=et(i);else break}if(t>=0)for(let i=s,n=e;;){if(i.nodeType==3)return{node:i,offset:n};if(i.nodeType==1&&n=0)i=i.childNodes[n],n=0;else break}return null}function ef(s,e){return s.nodeType!=1?0:(e&&s.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}function of(s,e,t=1){let i=s.charCategorizer(e),n=s.doc.lineAt(e),r=e-n.from;if(n.length==0)return b.cursor(e);r==0?t=1:r==n.length&&(t=-1);let o=r,l=r;t<0?o=oe(n.text,r,!1):l=oe(n.text,r);let a=i(n.text.slice(o,l));for(;o>0;){let h=oe(n.text,o,!1);if(i(n.text.slice(h,o))!=a)break;o=h}for(;ls?e.left-s:Math.max(0,s-e.right)}function af(s,e){return e.top>s?e.top-s:Math.max(0,s-e.bottom)}function Gn(s,e){return s.tope.top+1}function to(s,e){return es.bottom?{top:s.top,left:s.left,right:s.right,bottom:e}:s}function Es(s,e,t){let i,n,r,o,l=!1,a,h,c,f;for(let p=s.firstChild;p;p=p.nextSibling){let m=jt(p);for(let g=0;gS||o==S&&r>w){i=p,n=y,r=w,o=S;let v=S?t0?g0)}w==0?t>y.bottom&&(!c||c.bottomy.top)&&(h=p,f=y):c&&Gn(c,y)?c=io(c,y.bottom):f&&Gn(f,y)&&(f=to(f,y.top))}}if(c&&c.bottom>=t?(i=a,n=c):f&&f.top<=t&&(i=h,n=f),!i)return{node:s,offset:0};let u=Math.max(n.left,Math.min(n.right,e));if(i.nodeType==3)return no(i,u,t);if(l&&i.contentEditable!="false")return Es(i,u,t);let d=Array.prototype.indexOf.call(s.childNodes,i)+(e>=(n.left+n.right)/2?1:0);return{node:s,offset:d}}function no(s,e,t){let i=s.nodeValue.length,n=-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((D.chrome||D.gecko)&&Mt(s,l).getBoundingClientRect().left==c.right&&(d=!u),f<=0)return{node:s,offset:l+(d?1:0)};n=l+(d?1:0),r=f}}}return{node:s,offset:n>-1?n:o>0?s.nodeValue.length:0}}function pa(s,e,t,i=-1){var n,r;let o=s.contentDOM.getBoundingClientRect(),l=o.top+s.viewState.paddingTop,a,{docHeight:h}=s.viewState,{x:c,y:f}=e,u=f-l;if(u<0)return 0;if(u>h)return s.state.doc.length;for(let v=s.viewState.heightOracle.textHeight/2,x=!1;a=s.elementAtHeight(u),a.type!=De.Text;)for(;u=i>0?a.bottom+v:a.top-v,!(u>=0&&u<=h);){if(x)return t?null:0;x=!0,i=-i}f=l+u;let d=a.from;if(ds.viewport.to)return s.viewport.to==s.state.doc.length?s.state.doc.length:t?null:so(s,o,a,c,f);let p=s.dom.ownerDocument,m=s.root.elementFromPoint?s.root:p,g=m.elementFromPoint(c,f);g&&!s.contentDOM.contains(g)&&(g=null),g||(c=Math.max(o.left+1,Math.min(o.right-1,c)),g=m.elementFromPoint(c,f),g&&!s.contentDOM.contains(g)&&(g=null));let y,w=-1;if(g&&((n=s.docView.nearest(g))===null||n===void 0?void 0:n.isEditable)!=!1){if(p.caretPositionFromPoint){let v=p.caretPositionFromPoint(c,f);v&&({offsetNode:y,offset:w}=v)}else if(p.caretRangeFromPoint){let v=p.caretRangeFromPoint(c,f);v&&({startContainer:y,startOffset:w}=v,(!s.contentDOM.contains(y)||D.safari&&hf(y,w,c)||D.chrome&&cf(y,w,c))&&(y=void 0))}}if(!y||!s.docView.dom.contains(y)){let v=ee.find(s.docView,d);if(!v)return u>a.top+a.height/2?a.to:a.from;({node:y,offset:w}=Es(v.dom,c,f))}let S=s.docView.nearest(y);if(!S)return null;if(S.isWidget&&((r=S.dom)===null||r===void 0?void 0:r.nodeType)==1){let v=S.dom.getBoundingClientRect();return e.ys.defaultLineHeight*1.5){let l=s.viewState.heightOracle.textHeight,a=Math.floor((n-t.top-(s.defaultLineHeight-l)*.5)/l);r+=a*s.viewState.heightOracle.lineLength}let o=s.state.sliceDoc(t.from,t.to);return t.from+xs(o,r,s.state.tabSize)}function hf(s,e,t){let i;if(s.nodeType!=3||e!=(i=s.nodeValue.length))return!1;for(let n=s.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!="BR")return!1;return Mt(s,i-1,i).getBoundingClientRect().left>t}function cf(s,e,t){if(e!=0)return!1;for(let n=s;;){let r=n.parentNode;if(!r||r.nodeType!=1||r.firstChild!=n)return!1;if(r.classList.contains("cm-line"))break;n=r}let i=s.nodeType==1?s.getBoundingClientRect():Mt(s,0,Math.max(s.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Is(s,e){let t=s.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==De.Text))return i}return t}function ff(s,e,t,i){let n=Is(s,e.head),r=!i||n.type!=De.Text||!(s.lineWrapping||n.widgetLineBreaks)?null:s.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head);if(r){let o=s.dom.getBoundingClientRect(),l=s.textDirectionAt(n.from),a=s.posAtCoords({x:t==(l==X.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return b.cursor(a,t?-1:1)}return b.cursor(t?n.to:n.from,t?-1:1)}function ro(s,e,t,i){let n=s.state.doc.lineAt(e.head),r=s.bidiSpans(n),o=s.textDirectionAt(n.from);for(let l=e,a=null;;){let h=Yc(n,r,o,l,t),c=Ql;if(!h){if(n.number==(t?s.state.doc.lines:1))return l;c=` +`,n=s.state.doc.line(n.number+(t?1:-1)),r=s.bidiSpans(n),h=s.visualLineSide(n,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function uf(s,e,t){let i=s.state.charCategorizer(e),n=i(t);return r=>{let o=i(r);return n==G.Space&&(n=o),n==o}}function df(s,e,t,i){let n=e.head,r=t?1:-1;if(n==(t?s.state.doc.length:0))return b.cursor(n,e.assoc);let o=e.goalColumn,l,a=s.contentDOM.getBoundingClientRect(),h=s.coordsAtPos(n,e.assoc||-1),c=s.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let d=s.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,s.defaultCharacterWidth*(n-d.from))),l=(r<0?d.top:d.bottom)+c}let f=a.left+o,u=i??s.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*r,m=pa(s,{x:f,y:p},!1,r);if(pa.bottom||(r<0?mn)){let g=s.docView.coordsForChar(m),y=!g||p{if(e>r&&en(s)),t.from,e.head>t.from?-1:1);return i==t.from?t:b.cursor(i,inull),D.gecko&&Bf(e.contentDOM.ownerDocument)}handleEvent(e){!kf(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let n of i.observers)n(this.view,t);for(let n of i.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=gf(e),i=this.handlers,n=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(n.removeEventListener(r,this.handleEvent),l=null),l||n.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!t[r]&&n.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()i.keyCode==e.keyCode))&&!e.ctrlKey||mf.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,Ht(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:D.safari&&!D.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function oo(s,e){return(t,i)=>{try{return e.call(s,i,t)}catch(n){Ne(t.state,n)}}}function gf(s){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of s){let n=i.spec;if(n&&n.domEventHandlers)for(let r in n.domEventHandlers){let o=n.domEventHandlers[r];o&&t(r).handlers.push(oo(i.value,o))}if(n&&n.domEventObservers)for(let r in n.domEventObservers){let o=n.domEventObservers[r];o&&t(r).observers.push(oo(i.value,o))}}for(let i in Fe)t(i).handlers.push(Fe[i]);for(let i in Ve)t(i).observers.push(Ve[i]);return e}const ga=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],mf="dthko",ma=[16,17,18,20,91,92,224,225],Hi=6;function zi(s){return Math.max(0,s)*.7+8}function yf(s,e){return Math.max(Math.abs(s.clientX-e.clientX),Math.abs(s.clientY-e.clientY))}class bf{constructor(e,t,i,n){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=Rc(e.contentDOM),this.atoms=e.state.facet(fr).map(o=>o(e));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(H.allowMultipleSelections)&&wf(e,t),this.dragging=vf(e,t)&&xa(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&yf(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,n=0,r=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=fa(this.view);e.clientX-o.left<=r.left+Hi?i=-zi(r.left-e.clientX):e.clientX+o.right>=r.right-Hi&&(i=zi(e.clientX-r.right)),e.clientY-o.top<=r.top+Hi?n=-zi(r.top-e.clientY):e.clientY+o.bottom>=r.bottom-Hi&&(n=zi(e.clientY-r.bottom)),this.setScrollSpeed(i,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;ithis.select(this.lastEvent),20)}}function wf(s,e){let t=s.state.facet(Zl);return t.length?t[0](e):D.mac?e.metaKey:e.ctrlKey}function xf(s,e){let t=s.state.facet(ea);return t.length?t[0](e):D.mac?!e.altKey:!e.ctrlKey}function vf(s,e){let{main:t}=s.state.selection;if(t.empty)return!1;let i=dn(s.root);if(!i||i.rangeCount==0)return!0;let n=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function kf(s,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=s.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=U.get(t))&&i.ignoreEvent(e))return!1;return!0}const Fe=Object.create(null),Ve=Object.create(null),ya=D.ie&&D.ie_version<15||D.ios&&D.webkit_version<604;function Sf(s){let e=s.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{s.focus(),t.remove(),ba(s,t.value)},50)}function ba(s,e){let{state:t}=s,i,n=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Ns!=null&&t.selection.ranges.every(a=>a.empty)&&Ns==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(n++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:b.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):i=t.replaceSelection(r);s.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Ve.scroll=s=>{s.inputState.lastScrollTop=s.scrollDOM.scrollTop,s.inputState.lastScrollLeft=s.scrollDOM.scrollLeft};Fe.keydown=(s,e)=>(s.inputState.setSelectionOrigin("select"),e.keyCode==27&&(s.inputState.lastEscPress=Date.now()),!1);Ve.touchstart=(s,e)=>{s.inputState.lastTouchTime=Date.now(),s.inputState.setSelectionOrigin("select.pointer")};Ve.touchmove=s=>{s.inputState.setSelectionOrigin("select.pointer")};Fe.mousedown=(s,e)=>{if(s.observer.flush(),s.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of s.state.facet(ta))if(t=i(s,e),t)break;if(!t&&e.button==0&&(t=Mf(s,e)),t){let i=!s.hasFocus;s.inputState.startMouseSelection(new bf(s,e,t,i)),i&&s.observer.ignore(()=>Nl(s.contentDOM));let n=s.inputState.mouseSelection;if(n)return n.start(e),n.dragging===!1}return!1};function lo(s,e,t,i){if(i==1)return b.cursor(e,t);if(i==2)return of(s.state,e,t);{let n=ee.find(s.docView,e),r=s.state.doc.lineAt(n?n.posAtEnd:e),o=n?n.posAtStart:r.from,l=n?n.posAtEnd:r.to;return ls>=e.top&&s<=e.bottom,ao=(s,e,t)=>wa(e,t)&&s>=t.left&&s<=t.right;function Cf(s,e,t,i){let n=ee.find(s.docView,e);if(!n)return 1;let r=e-n.posAtStart;if(r==0)return 1;if(r==n.length)return-1;let o=n.coordsAt(r,-1);if(o&&ao(t,i,o))return-1;let l=n.coordsAt(r,1);return l&&ao(t,i,l)?1:o&&wa(i,o)?-1:1}function ho(s,e){let t=s.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Cf(s,t,e.clientX,e.clientY)}}const Af=D.ie&&D.ie_version<=11;let co=null,fo=0,uo=0;function xa(s){if(!Af)return s.detail;let e=co,t=uo;return co=s,uo=Date.now(),fo=!e||t>Date.now()-400&&Math.abs(e.clientX-s.clientX)<2&&Math.abs(e.clientY-s.clientY)<2?(fo+1)%3:1}function Mf(s,e){let t=ho(s,e),i=xa(e),n=s.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),n=n.map(r.changes))},get(r,o,l){let a=ho(s,r),h,c=lo(s,a.pos,a.bias,i);if(t.pos!=a.pos&&!o){let f=lo(s,t.pos,t.bias,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=Df(n,a.pos))?h:l?n.addRange(c):b.create([c])}}}function Df(s,e){for(let t=0;t=e)return b.create(s.ranges.slice(0,t).concat(s.ranges.slice(t+1)),s.mainIndex==t?0:s.mainIndex-(s.mainIndex>t?1:0))}return null}Fe.dragstart=(s,e)=>{let{selection:{main:t}}=s.state;if(e.target.draggable){let n=s.docView.nearest(e.target);if(n&&n.isWidget){let r=n.posAtStart,o=r+n.length;(r>=t.to||o<=t.from)&&(t=b.range(r,o))}}let{inputState:i}=s;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",s.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};Fe.dragend=s=>(s.inputState.draggedContent=null,!1);function po(s,e,t,i){if(!t)return;let n=s.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=s.inputState,o=i&&r&&xf(s,e)?{from:r.from,to:r.to}:null,l={from:n,insert:t},a=s.state.changes(o?[o,l]:l);s.focus(),s.dispatch({changes:a,selection:{anchor:a.mapPos(n,-1),head:a.mapPos(n,1)},userEvent:o?"move.drop":"input.drop"}),s.inputState.draggedContent=null}Fe.drop=(s,e)=>{if(!e.dataTransfer)return!1;if(s.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),n=0,r=()=>{++n==t.length&&po(s,e,i.filter(o=>o!=null).join(s.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])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return po(s,e,i,!0),!0}return!1};Fe.paste=(s,e)=>{if(s.state.readOnly)return!0;s.observer.flush();let t=ya?null:e.clipboardData;return t?(ba(s,t.getData("text/plain")||t.getData("text/uri-text")),!0):(Sf(s),!1)};function Of(s,e){let t=s.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(),s.focus()},50)}function Tf(s){let e=[],t=[],i=!1;for(let n of s.selection.ranges)n.empty||(e.push(s.sliceDoc(n.from,n.to)),t.push(n));if(!e.length){let n=-1;for(let{from:r}of s.selection.ranges){let o=s.doc.lineAt(r);o.number>n&&(e.push(o.text),t.push({from:o.from,to:Math.min(s.doc.length,o.to+1)})),n=o.number}i=!0}return{text:e.join(s.lineBreak),ranges:t,linewise:i}}let Ns=null;Fe.copy=Fe.cut=(s,e)=>{let{text:t,ranges:i,linewise:n}=Tf(s.state);if(!t&&!n)return!1;Ns=n?t:null,e.type=="cut"&&!s.state.readOnly&&s.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=ya?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(Of(s,t),!1)};const va=nt.define();function ka(s,e){let t=[];for(let i of s.facet(sa)){let n=i(s,e);n&&t.push(n)}return t?s.update({effects:t,annotations:va.of(!0)}):null}function Sa(s){setTimeout(()=>{let e=s.hasFocus;if(e!=s.inputState.notifiedFocused){let t=ka(s.state,e);t?s.dispatch(t):s.update([])}},10)}Ve.focus=s=>{s.inputState.lastFocusTime=Date.now(),!s.scrollDOM.scrollTop&&(s.inputState.lastScrollTop||s.inputState.lastScrollLeft)&&(s.scrollDOM.scrollTop=s.inputState.lastScrollTop,s.scrollDOM.scrollLeft=s.inputState.lastScrollLeft),Sa(s)};Ve.blur=s=>{s.observer.clearSelectionRange(),Sa(s)};Ve.compositionstart=Ve.compositionupdate=s=>{s.inputState.compositionFirstChange==null&&(s.inputState.compositionFirstChange=!0),s.inputState.composing<0&&(s.inputState.composing=0)};Ve.compositionend=s=>{s.inputState.composing=-1,s.inputState.compositionEndedAt=Date.now(),s.inputState.compositionPendingKey=!0,s.inputState.compositionPendingChange=s.observer.pendingRecords().length>0,s.inputState.compositionFirstChange=null,D.chrome&&D.android?s.observer.flushSoon():s.inputState.compositionPendingChange?Promise.resolve().then(()=>s.observer.flush()):setTimeout(()=>{s.inputState.composing<0&&s.docView.hasComposition&&s.update([])},50)};Ve.contextmenu=s=>{s.inputState.lastContextMenu=Date.now()};Fe.beforeinput=(s,e)=>{var t;let i;if(D.chrome&&D.android&&(i=ga.find(n=>n.inputType==e.inputType))&&(s.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let n=((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)>n+10&&s.hasFocus&&(s.contentDOM.blur(),s.focus())},100)}return!1};const go=new Set;function Bf(s){go.has(s)||(go.add(s),s.addEventListener("copy",()=>{}),s.addEventListener("cut",()=>{}))}const mo=["pre-wrap","normal","pre-line","break-spaces"];class Pf{constructor(e){this.lineWrapping=e,this.doc=V.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,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.max(0,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 mo.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=n,this.lineLength=r,a){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)>ln&&(e.heightChanged=!0),this.height=t)}replace(e,t,i){return pe.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,n){let r=this,o=i.doc;for(let l=n.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=n[l],u=r.lineAt(a,j.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,j.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=n[l-1].toA;)a=n[l-1].fromA,c=n[l-1].fromB,l--,ar*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,n-=l.size}else if(r>n*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(n=r&&o(this.blockAt(0,i,n,r))}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more&&this.setHeight(e,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ce extends Ca{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,i,n){return new Ge(n,this.length,i,this.height,this.breaks)}replace(e,t,i){let n=i[0];return i.length==1&&(n instanceof Ce||n instanceof ie&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof ie?n=new Ce(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):pe.of(i)}updateHeight(e,t=0,i=!1,n){return n&&n.from<=t&&n.more?this.setHeight(e,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ie extends pe{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,n=e.doc.lineAt(t+this.length).number,r=n-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:n,perLine:o,perChar:l}}blockAt(e,t,i,n){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,n);if(t.lineWrapping){let h=n+Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length),c=t.doc.lineAt(h),f=l+c.length*a,u=Math.max(i,e-f/2);return new Ge(c.from,c.length,u,f,0)}else{let h=Math.max(0,Math.min(o-r,Math.floor((e-i)/l))),{from:c,length:f}=t.doc.line(r+h);return new Ge(c,f,i+l*h,l,0)}}lineAt(e,t,i,n,r){if(t==j.ByHeight)return this.blockAt(e,i,n,r);if(t==j.ByPosNoHeight){let{from:d,to:p}=i.doc.lineAt(e);return new Ge(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,r),h=i.doc.lineAt(e),c=l+h.length*a,f=h.number-o,u=n+l*f+a*(h.from-r-f);return new Ge(h.from,h.length,Math.max(n,Math.min(u,n+this.height-c)),c,0)}forEachLine(e,t,i,n,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(i,r);for(let c=e,f=n;c<=t;){let u=i.doc.lineAt(c);if(c==e){let p=u.number-l;f+=a*p+h*(e-r-p)}let d=a+h*u.length;o(new Ge(u.from,u.length,f,d,0)),f+=d,c=u.to+1}}replace(e,t,i){let n=this.length-t;if(n>0){let r=i[i.length-1];r instanceof ie?i[i.length-1]=new ie(r.length+n):i.push(null,new ie(n-1))}if(e>0){let r=i[0];r instanceof ie?i[0]=new ie(e+r.length):i.unshift(new ie(e-1),null)}return pe.of(i)}decomposeLeft(e,t){t.push(new ie(e-1),null)}decomposeRight(e,t){t.push(null,new ie(this.length-e-1))}updateHeight(e,t=0,i=!1,n){let r=t+this.length;if(n&&n.from<=t+this.length&&n.more){let o=[],l=Math.max(t,n.from),a=-1;for(n.from>t&&o.push(new ie(n.from-t-1).updateHeight(e,t));l<=r&&n.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=n.heights[n.index++];a==-1?a=f:Math.abs(f-a)>=ln&&(a=-2);let u=new Ce(c,f);u.outdated=!1,o.push(u),l+=c+1}l<=r&&o.push(null,new ie(r-l).updateHeight(e,l));let h=pe.of(o);return(a<0||Math.abs(h.height-this.height)>=ln||Math.abs(a-this.heightMetrics(e,t).perLine)>=ln)&&(e.heightChanged=!0),h}else(i||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Rf extends pe{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,n){let r=i+this.left.height;return el))return h;let c=t==j.ByPosNoHeight?j.ByPosNoHeight:j.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,n,r).join(h)}forEachLine(e,t,i,n,r,o){let l=n+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,j.ByPos,i,n,r);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let n=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&yo(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,n=i+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e2*t.size||t.size>2*e.size?pe.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,n){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return n&&n.from<=t+r.length&&n.more?a=r=r.updateHeight(e,t,i,n):r.updateHeight(e,t,i),n&&n.from<=l+o.length&&n.more?a=o=o.updateHeight(e,l,i,n):o.updateHeight(e,l,i),a?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 yo(s,e){let t,i;s[e]==null&&(t=s[e-1])instanceof ie&&(i=s[e+1])instanceof ie&&s.splice(e-1,3,new ie(t.length+1+i.length))}const Ef=5;class ur{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),n=this.nodes[this.nodes.length-1];n instanceof Ce?n.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Ce(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=Ef)&&this.addLineDeco(n,r,o)}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 Ce(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let i=new ie(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 Ce)return e;let t=new Ce(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ce)&&!this.isCovered?this.nodes.push(new Ce(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),a=h==s.parentNode?u.bottom:Math.min(a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function Vf(s,e){let t=s.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Yn{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 i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new Pf(t),this.stateDeco=e.facet(xi).filter(i=>typeof i!="function"),this.heightMap=pe.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle.setDoc(e.doc),[new Ee(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=B.set(this.lineGaps.map(i=>i.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let n=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>n>=r&&n<=o)){let{from:r,to:o}=this.lineBlockAt(n);e.push(new qi(r,o))}}this.viewports=e.sort((i,n)=>i.from-n.from),this.scaler=this.heightMap.height<=7e6?wo:new qf(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:hi(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(xi).filter(c=>typeof c!="function");let n=e.changedRanges,r=Ee.extendWithRanges(n,If(i,this.stateDeco,e?e.changes:te.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=!e.changes.empty||e.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&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&&!e.state.facet(oa)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t),n=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?X.RTL:X.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:v,scaleY:x}=Il(t,l);(this.scaleX!=v||this.scaleY!=x)&&(this.scaleX=v,this.scaleY=x,h|=8,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Vl(e.scrollDOM);let p=(this.printing?Vf:Ff)(t,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let w=l.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),a){let v=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(v)&&(o=!0),o||n.lineWrapping&&Math.abs(w-this.contentDOMWidth)>n.charWidth){let{lineHeight:x,charWidth:A,textHeight:C}=e.docView.measureTextSize();o=x>0&&n.refresh(r,x,A,C,w/A,v),o&&(e.docView.minWidth=0,h|=8)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),n.heightChanged=!1;for(let x of this.viewports){let A=x.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(x);this.heightMap=(o?pe.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle,[new Ee(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new Lf(x.from,A))}n.heightChanged&&(h|=2)}let S=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return S&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(h&2||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&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)),n=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new qi(n.lineAt(o-i*1e3,j.ByHeight,r,0,0).from,n.lineAt(l+(1-i)*1e3,j.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=n.lineAt(h,j.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&n>o-2*1e3&&r>1,o=n<<1;if(this.defaultTextDirection!=X.LTR&&!i)return[];let l=[],a=(h,c,f,u)=>{if(c-hh&&gg.from>=f.from&&g.to<=f.to&&Math.abs(g.from-h)g.fromy));if(!m){if(cg.from<=c&&g.to>=c)){let g=t.moveToLineBoundary(b.cursor(c),!1,!0).head;g>h&&(c=g)}m=new Yn(h,c,this.gapSize(f,h,c,u))}l.push(m)};for(let h of this.viewportLines){if(h.lengthh.from&&a(h.from,u,h,c),dt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];$.spans(e,this.viewport.from,this.viewport.to,{span(n,r){t.push({from:n,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((n,r)=>n.from!=t[r].from||n.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)||hi(this.heightMap.lineAt(e,j.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return hi(this.heightMap.lineAt(this.scaler.fromDOM(e),j.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return hi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class qi{constructor(e,t){this.from=e,this.to=t}}function Hf(s,e,t){let i=[],n=s,r=0;return $.spans(t,s,e,{span(){},point(o,l){o>n&&(i.push({from:n,to:o}),r+=o-n),n=l}},20),n=1)return e[e.length-1].to;let i=Math.floor(s*t);for(let n=0;;n++){let{from:r,to:o}=e[n],l=o-r;if(i<=l)return r+i;i-=l}}function Ki(s,e){let t=0;for(let{from:i,to:n}of s.ranges){if(e<=n){t+=e-i;break}t+=n-i}return t/s.total}function zf(s,e){for(let t of s)if(e(t))return t}const wo={toDOM(s){return s},fromDOM(s){return s},scale:1};class qf{constructor(e,t,i){let n=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,j.ByPos,e,0,0).top,c=t.lineAt(a,j.ByPos,e,0,0).bottom;return n+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(t.height-n);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,n=0;;t++){let r=thi(n,e)):s._content)}const ji=O.define({combine:s=>s.join(" ")}),Fs=O.define({combine:s=>s.indexOf(!0)>-1}),Vs=ut.newName(),Aa=ut.newName(),Ma=ut.newName(),Da={"&light":"."+Aa,"&dark":"."+Ma};function Ws(s,e,t){return new ut(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,n=>{if(n=="&")return s;if(!t||!t[n])throw new RangeError(`Unsupported selector: ${n}`);return t[n]}):s+" "+i}})}const $f=Ws("."+Vs,{"&":{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,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",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 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .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":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&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",insetInlineStart: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-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".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"}},Da),ci="￿";class Kf{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(H.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=ci}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let n=e;;){this.findPointBefore(i,n);let r=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==t)break;let l=U.get(n),a=U.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:xo(n))||xo(o)&&(n.nodeName!="BR"||n.cmIgnore)&&this.text.length>r)&&this.lineBreak(),n=o}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=n.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){if(e.cmIgnore)return;let t=U.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let n=i.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.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+(jf(e,i.node,i.offset)?t:0))}}function jf(s,e,t){for(;;){if(!e||t-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let l=r||o?[]:Yf(e),a=new Kf(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=Xf(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!Ss(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Ss(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if(D.ios&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.toDate.now()-100?s.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=n.from,h=null;(r===8||D.android&&e.text.length=n.from&&t.to<=n.to&&(t.from!=n.from||t.to!=n.to)&&n.to-n.from-(t.to-t.from)<=4?t={from:n.from,to:n.to,insert:s.state.doc.slice(n.from,t.from).append(t.insert).append(s.state.doc.slice(t.to,n.to))}:(D.mac||D.android)&&t&&t.from==t.to&&t.from==n.head-1&&/^\. ?$/.test(t.insert.toString())&&s.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:n.from,to:n.to,insert:V.of([" "])}):D.chrome&&t&&t.from==t.to&&t.from==n.head&&t.insert.toString()==` + `&&s.lineWrapping&&(i&&(i=b.single(i.main.anchor-1,i.main.head-1)),t={from:n.from,to:n.to,insert:V.of([" "])}),t){if(D.ios&&s.inputState.flushIOSKey()||D.android&&(t.from==n.from&&t.to==n.to&&t.insert.length==1&&t.insert.lines==2&&Ht(s.contentDOM,"Enter",13)||(t.from==n.from-1&&t.to==n.to&&t.insert.length==0||r==8&&t.insert.lengthn.head)&&Ht(s.contentDOM,"Backspace",8)||t.from==n.from&&t.to==n.to+1&&t.insert.length==0&&Ht(s.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();s.inputState.composing>=0&&s.inputState.composing++;let l,a=()=>l||(l=Gf(s,t,i));return s.state.facet(na).some(h=>h(s,t.from,t.to,o,a))||s.dispatch(a()),!0}else if(i&&!i.main.eq(n)){let o=!1,l="select";return s.inputState.lastSelectionTime>Date.now()-50&&(s.inputState.lastSelectionOrigin=="select"&&(o=!0),l=s.inputState.lastSelectionOrigin),s.dispatch({selection:i,scrollIntoView:o,userEvent:l}),!0}else return!1}function Gf(s,e,t){let i,n=s.state,r=n.selection.main;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&s.inputState.composing<0){let l=r.frome.to?n.sliceDoc(e.to,r.to):"";i=n.replaceSelection(s.state.toText(l+e.insert.sliceString(0,void 0,s.state.lineBreak)+a))}else{let l=n.changes(e),a=t&&t.main.to<=l.newLength?t.main:void 0;if(n.selection.ranges.length>1&&s.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let h=s.state.sliceDoc(e.from,e.to),c,f=t&&ua(s,t.main.head);if(f){let p=e.insert.length-(e.to-e.from);c={from:f.from,to:f.to-p}}else c=s.state.doc.lineAt(r.head);let u=r.to-e.to,d=r.to-r.from;i=n.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:l,range:a||p.map(l)};let m=p.to-u,g=m-h.length;if(p.to-p.from!=d||s.state.sliceDoc(g,m)!=h||p.to>=c.from&&p.from<=c.to)return{range:p};let y=n.changes({from:g,to:m,insert:e.insert}),w=p.to-r.to;return{changes:y,range:a?b.range(Math.max(0,a.anchor+w),Math.max(0,a.head+w)):p.map(y)}})}else i={changes:l,selection:a&&n.selection.replaceRange(a)}}let o="input.type";return(s.composing||s.inputState.compositionPendingChange&&s.inputState.compositionEndedAt>Date.now()-50)&&(s.inputState.compositionPendingChange=!1,o+=".compose",s.inputState.compositionFirstChange&&(o+=".start",s.inputState.compositionFirstChange=!1)),n.update(i,{userEvent:o,scrollIntoView:!0})}function Jf(s,e,t,i){let n=Math.min(s.length,e.length),r=0;for(;r0&&l>0&&s.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Yf(s){let e=[];if(s.root.activeElement!=s.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:n,focusOffset:r}=s.observer.selectionRange;return t&&(e.push(new vo(t,i)),(n!=t||r!=i)&&e.push(new vo(n,r))),e}function Xf(s,e){if(s.length==0)return null;let t=s[0].pos,i=s.length==2?s[1].pos:t;return t>-1&&i>-1?b.single(t+e,i+e):null}const _f={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xn=D.ie&&D.ie_version<=11;class Qf{constructor(e){this.view=e,this.active=!1,this.selectionRange=new Ec,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.resizeScroll=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);(D.ie&&D.ie_version<=11||D.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()}),Xn&&(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.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.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")))},{threshold:[0,.001]}),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.runHandlers("scroll",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,n=this.selectionRange;if(i.state.facet(En)?i.root.activeElement!=this.dom:!rn(i.dom,n))return;let r=n.anchorNode&&i.docView.nearest(n.anchorNode);if(r&&r.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(D.ie&&D.ie_version<=11||D.android&&D.chrome)&&!i.state.selection.main.empty&&n.focusNode&&pi(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=D.safari&&e.root.nodeType==11&&Bc(this.dom.ownerDocument)==this.dom&&Zf(this.view)||dn(e.root);if(!t||this.selectionRange.eq(t))return!1;let i=rn(this.dom,t);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&Ht(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!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()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,n=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(n=!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:n}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),n=this.selectionChanged&&rn(this.dom,this.selectionRange);if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Uf(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,n=Oa(this.view,t);return this.view.state==i&&this.view.update([]),n}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.flags|=4),e.type=="childList"){let i=ko(t,e.previousSibling||e.target.previousSibling,-1),n=ko(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:n?t.posBefore(n):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.resizeScroll)===null||i===void 0||i.disconnect();for(let n of this.scrollTargets)n.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 ko(s,e,t){for(;e;){let i=U.get(e);if(i&&i.parent==s)return i;let n=e.parentNode;e=n!=s.dom?n:t>0?e.nextSibling:e.previousSibling}return null}function Zf(s){let e=null;function t(a){a.preventDefault(),a.stopImmediatePropagation(),e=a.getTargetRanges()[0]}if(s.contentDOM.addEventListener("beforeinput",t,!0),s.dom.ownerDocument.execCommand("indent"),s.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let i=e.startContainer,n=e.startOffset,r=e.endContainer,o=e.endOffset,l=s.docView.domAtPos(s.state.selection.main.anchor);return pi(l.node,l.offset,r,o)&&([i,n,r,o]=[r,o,i,n]),{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:o}}class T{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}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.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(i=>i.forEach(n=>t(n,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Ic(e.parent)||document,this.viewState=new bo(e.state||H.create(e)),e.scrollTo&&e.scrollTo.is(Wi)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(li).map(i=>new Un(i));for(let i of this.plugins)i.update(this);this.observer=new Qf(this),this.inputState=new pf(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Zr(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let t=e.length==1&&e[0]instanceof Q?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}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,n,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(va))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=ka(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(H.phrases)!=this.state.facet(H.phrases))return this.setState(r);n=pn.create(this,r,e),n.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new zt(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(Wi)&&(f=d.value.clip(this.state))}this.viewState.update(n,f),this.bidiCache=gn.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),t=this.docView.update(n),this.state.facet(ai)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(ji)!=n.state.facet(ji)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty)for(let u of this.state.facet(Rs))try{u(n)}catch(d){Ne(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Oa(this,c)&&h.force&&Ht(this.contentDOM,h.key,h.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 bo(e),this.plugins=e.facet(li).map(i=>new Un(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Zr(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(li),i=e.state.facet(li);if(t!=i){let n=[];for(let r of i){let o=t.indexOf(r);if(o<0)n.push(new Un(r));else{let l=this.plugins[o];l.mustUpdate=e,n.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Vl(i))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(n);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!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 h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(p){return Ne(this.state,p),So}}),f=pn.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f));for(let d=0;d1||p<-1){n=n+p,i.scrollTop=n/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Rs))l(t)}get themeClasses(){return Vs+" "+(this.state.facet(Fs)?Ma:Aa)+" "+this.state.facet(ji)}updateAttrs(){let e=Co(this,la,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(En)?"true":"false",class:"cm-content",style:`${D.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Co(this,cr,t);let i=this.observer.ignore(()=>{let n=Os(this.contentDOM,this.contentAttrs,t),r=Os(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let n of i.effects)if(n.is(T.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(ai);let e=this.state.facet(T.cspNonce);ut.mount(this.root,this.styleModules.concat($f).reverse(),e?{nonce:e}:void 0)}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(this.measureRequests.indexOf(e)>-1)return;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}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}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 Jn(this,e,ro(this,e,t,i))}moveByGroup(e,t){return Jn(this,e,ro(this,e,t,i=>uf(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),n=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return b.cursor(r.side(t,n)+e.from,r.forward(!t,n)?1:-1)}moveToLineBoundary(e,t,i=!0){return ff(this,e,t,i)}moveVertically(e,t,i){return Jn(this,e,df(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(),pa(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 n=this.state.doc.lineAt(e),r=this.bidiSpans(n),o=r[at.find(r,e-n.from,-1,t)];return Ln(i,o.dir==X.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}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(ra)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>eu)return _l(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||Xl(r.isolates,i=Qr(this,e))))return r.order;i||(i=Qr(this,e));let n=Jc(e.text,t,i);return this.bidiCache.push(new gn(e.from,e.to,t,i,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||D.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Nl(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.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Wi.of(new zt(typeof e=="number"?b.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Wi.of(new zt(b.cursor(i.from),"start","start",i.top-e,t,!0))}static domEventHandlers(e){return ue.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ue.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=ut.newName(),n=[ji.of(i),ai.of(Ws(`.${i}`,e))];return t&&t.dark&&n.push(Fs.of(!0)),n}static baseTheme(e){return Bt.lowest(ai.of(Ws("."+Vs,e,Da)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),n=i&&U.get(i)||U.get(e);return((t=n==null?void 0:n.rootView)===null||t===void 0?void 0:t.view)||null}}T.styleModule=ai;T.inputHandler=na;T.focusChangeEffect=sa;T.perLineTextDirection=ra;T.exceptionSink=ia;T.updateListener=Rs;T.editable=En;T.mouseSelectionStyle=ta;T.dragMovesSelection=ea;T.clickAddsSelectionRange=Zl;T.decorations=xi;T.outerDecorations=aa;T.atomicRanges=fr;T.bidiIsolatedRanges=ha;T.scrollMargins=ca;T.darkTheme=Fs;T.cspNonce=O.define({combine:s=>s.length?s[0]:""});T.contentAttributes=cr;T.editorAttributes=la;T.lineWrapping=T.contentAttributes.of({class:"cm-lineWrapping"});T.announce=F.define();const eu=4096,So={};class gn{constructor(e,t,i,n,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=n,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],n=e.length?e[e.length-1].dir:X.LTR;for(let r=Math.max(0,e.length-10);r=0;n--){let r=i[n],o=typeof r=="function"?r(s):r;o&&Ds(o,t)}return t}const tu=D.mac?"mac":D.windows?"win":D.linux?"linux":"key";function iu(s,e){const t=s.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let n,r,o,l;for(let a=0;ai.concat(n),[]))),t}function su(s,e,t){return Ba(Ta(s.state),e,s,t)}let ot=null;const ru=4e3;function ou(s,e=tu){let t=Object.create(null),i=Object.create(null),n=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>iu(y,e));for(let y=1;y{let v=ot={view:S,prefix:w,scope:o};return setTimeout(()=>{ot==v&&(ot=null)},ru),!0}]})}let m=p.join(" ");n(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of s){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let f in c)c[f].run.push(o.any)}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}function Ba(s,e,t,i){let n=Tc(e),r=ne(n,0),o=Be(r)==n.length&&n!=" ",l="",a=!1,h=!1,c=!1;ot&&ot.view==t&&ot.scope==i&&(l=ot.prefix+" ",ma.indexOf(e.keyCode)<0&&(h=!0,ot=null));let f=new Set,u=g=>{if(g){for(let y of g.run)if(!f.has(y)&&(f.add(y),y(t,e)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},d=s[i],p,m;return d&&(u(d[l+Ui(n,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(D.windows&&e.ctrlKey&&e.altKey)&&(p=dt[e.keyCode])&&p!=n?(u(d[l+Ui(p,e,!0)])||e.shiftKey&&(m=bi[e.keyCode])!=n&&m!=p&&u(d[l+Ui(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+Ui(n,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),a}class Pi{constructor(e,t,i,n,r){this.className=e,this.left=t,this.top=i,this.width=n,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(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}static forRange(e,t,i){if(i.empty){let n=e.coordsAtPos(i.head,i.assoc||1);if(!n)return[];let r=Pa(e);return[new Pi(t,n.left-r.left,n.top-r.top,null,n.bottom-n.top)]}else return lu(e,t,i)}}function Pa(s){let e=s.scrollDOM.getBoundingClientRect();return{left:(s.textDirection==X.LTR?e.left:e.right-s.scrollDOM.clientWidth*s.scaleX)-s.scrollDOM.scrollLeft*s.scaleX,top:e.top-s.scrollDOM.scrollTop*s.scaleY}}function Mo(s,e,t){let i=b.cursor(e);return{from:Math.max(t.from,s.moveToLineBoundary(i,!1,!0).from),to:Math.min(t.to,s.moveToLineBoundary(i,!0,!0).from),type:De.Text}}function lu(s,e,t){if(t.to<=s.viewport.from||t.from>=s.viewport.to)return[];let i=Math.max(t.from,s.viewport.from),n=Math.min(t.to,s.viewport.to),r=s.textDirection==X.LTR,o=s.contentDOM,l=o.getBoundingClientRect(),a=Pa(s),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=Is(s,i),p=Is(s,n),m=d.type==De.Text?d:null,g=p.type==De.Text?p:null;if(m&&(s.lineWrapping||d.widgetLineBreaks)&&(m=Mo(s,i,m)),g&&(s.lineWrapping||p.widgetLineBreaks)&&(g=Mo(s,n,g)),m&&g&&m.from==g.from)return w(S(t.from,t.to,m));{let x=m?S(t.from,null,m):v(d,!1),A=g?S(null,t.to,g):v(p,!0),C=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&x.bottom+s.defaultLineHeight/2L&&W.from=be)break;Z>J&&E(Math.max(Oe,J),x==null&&Oe<=L,Math.min(Z,be),A==null&&Z>=z,ke.dir)}if(J=we.to+1,J>=be)break}return N.length==0&&E(L,x==null,z,A==null,s.textDirection),{top:P,bottom:I,horizontal:N}}function v(x,A){let C=l.top+(A?x.top:x.bottom);return{top:C,bottom:C,horizontal:[]}}}function au(s,e){return s.constructor==e.constructor&&s.eq(e)}class hu{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(an)!=e.state.facet(an)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let t=0,i=e.facet(an);for(;t!au(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let n of e)n.update&&t&&n.constructor&&this.drawn[i].constructor&&n.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(n.draw(),t);for(;t;){let n=t.nextSibling;t.remove(),t=n}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const an=O.define();function La(s){return[ue.define(e=>new hu(e,s)),an.of(s)]}const Ra=!D.ios,vi=O.define({combine(s){return Pt(s,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function im(s={}){return[vi.of(s),cu,fu,uu,oa.of(!0)]}function Ea(s){return s.startState.facet(vi)!=s.state.facet(vi)}const cu=La({above:!0,markers(s){let{state:e}=s,t=e.facet(vi),i=[];for(let n of e.selection.ranges){let r=n==e.selection.main;if(n.empty?!r||Ra:t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=n.empty?n:b.cursor(n.head,n.head>n.anchor?-1:1);for(let a of Pi.forRange(s,o,l))i.push(a)}}return i},update(s,e){s.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Ea(s);return t&&Do(s.state,e),s.docChanged||s.selectionSet||t},mount(s,e){Do(e.state,s)},class:"cm-cursorLayer"});function Do(s,e){e.style.animationDuration=s.facet(vi).cursorBlinkRate+"ms"}const fu=La({above:!1,markers(s){return s.state.selection.ranges.map(e=>e.empty?[]:Pi.forRange(s,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(s,e){return s.docChanged||s.selectionSet||s.viewportChanged||Ea(s)},class:"cm-selectionLayer"}),Hs={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Ra&&(Hs[".cm-line"].caretColor="transparent !important",Hs[".cm-content"]={caretColor:"transparent !important"});const uu=Bt.highest(T.theme(Hs)),Ia=F.define({map(s,e){return s==null?null:e.mapPos(s)}}),fi=ye.define({create(){return null},update(s,e){return s!=null&&(s=e.changes.mapPos(s)),e.effects.reduce((t,i)=>i.is(Ia)?i.value:t,s)}}),du=ue.fromClass(class{constructor(s){this.view=s,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(s){var e;let t=s.state.field(fi);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"),(s.startState.field(fi)!=t||s.docChanged||s.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:s}=this,e=s.state.field(fi),t=e!=null&&s.coordsAtPos(e);if(!t)return null;let i=s.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+s.scrollDOM.scrollLeft*s.scaleX,top:t.top-i.top+s.scrollDOM.scrollTop*s.scaleY,height:t.bottom-t.top}}drawCursor(s){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;s?(this.cursor.style.left=s.left/e+"px",this.cursor.style.top=s.top/t+"px",this.cursor.style.height=s.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(s){this.view.state.field(fi)!=s&&this.view.dispatch({effects:Ia.of(s)})}},{eventObservers:{dragover(s){this.setDropPos(this.view.posAtCoords({x:s.clientX,y:s.clientY}))},dragleave(s){(s.target==this.view.contentDOM||!this.view.contentDOM.contains(s.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function nm(){return[fi,du]}function Oo(s,e,t,i,n){e.lastIndex=0;for(let r=s.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)n(o+l.index,l)}function pu(s,e){let t=s.visibleRanges;if(t.length==1&&t[0].from==s.viewport.from&&t[0].to==s.viewport.to)return t;let i=[];for(let{from:n,to:r}of t)n=Math.max(s.state.doc.lineAt(n).from,n-e),r=Math.min(s.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=n?i[i.length-1].to=r:i.push({from:n,to:r});return i}class gu{constructor(e){const{regexp:t,decoration:i,decorate:n,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,n)this.addMatch=(l,a,h,c)=>n(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+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 At,i=t.add.bind(t);for(let{from:n,to:r}of pu(e,this.maxLength))Oo(e.state.doc,this.regexp,n,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,n=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>e.view.viewport.from&&l1e3?this.createDeco(e.view):n>-1?this.updateRange(e.view,t.map(e.changes),i,n):t}updateRange(e,t,i,n){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,n);if(l>o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(y.range(m,g));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(g,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:u})}}return t}}const zs=/x/.unicode!=null?"gu":"g",mu=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,zs),yu={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 _n=null;function bu(){var s;if(_n==null&&typeof document<"u"&&document.body){let e=document.body.style;_n=((s=e.tabSize)!==null&&s!==void 0?s:e.MozTabSize)!=null}return _n||!1}const hn=O.define({combine(s){let e=Pt(s,{render:null,specialChars:mu,addSpecialChars:null});return(e.replaceTabs=!bu())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,zs)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,zs)),e}});function sm(s={}){return[hn.of(s),wu()]}let To=null;function wu(){return To||(To=ue.fromClass(class{constructor(s){this.view=s,this.decorations=B.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(s.state.facet(hn)),this.decorations=this.decorator.createDeco(s)}makeDecorator(s){return new gu({regexp:s.specialChars,decoration:(e,t,i)=>{let{doc:n}=t.state,r=ne(e[0],0);if(r==9){let o=n.lineAt(i),l=t.state.tabSize,a=_t(o.text,l,i-o.from);return B.replace({widget:new Su((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=B.replace({widget:new ku(s,r)}))},boundary:s.replaceTabs?void 0:/[^]/})}update(s){let e=s.state.facet(hn);s.startState.facet(hn)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(s.view)):this.decorations=this.decorator.updateDeco(s,this.decorations)}},{decorations:s=>s.decorations}))}const xu="•";function vu(s){return s>=32?xu:s==10?"␤":String.fromCharCode(9216+s)}class ku extends Lt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=vu(this.code),i=e.state.phrase("Control character")+" "+(yu[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,i,t);if(n)return n;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 Su extends Lt{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 Cu extends Lt{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}coordsAt(e){let t=e.firstChild?jt(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),n=Ln(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return n.bottom-n.top>r*1.5?{left:n.left,right:n.right,top:n.top,bottom:n.top+r}:n}ignoreEvent(){return!1}}function rm(s){return ue.fromClass(class{constructor(e){this.view=e,this.placeholder=s?B.set([B.widget({widget:new Cu(s),side:1}).range(0)]):B.none}get decorations(){return this.view.state.doc.length?B.none:this.placeholder}},{decorations:e=>e.decorations})}const qs=2e3;function Au(s,e,t){let i=Math.min(e.line,t.line),n=Math.max(e.line,t.line),r=[];if(e.off>qs||t.off>qs||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=n;a++){let h=s.doc.line(a);h.length<=l&&r.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=n;a++){let h=s.doc.line(a),c=xs(h.text,o,s.tabSize,!0);if(c<0)r.push(b.cursor(h.to));else{let f=xs(h.text,l,s.tabSize);r.push(b.range(h.from+c,h.from+f))}}}return r}function Mu(s,e){let t=s.coordsAtPos(s.viewport.from);return t?Math.round(Math.abs((t.left-e)/s.defaultCharacterWidth)):-1}function Bo(s,e){let t=s.posAtCoords({x:e.clientX,y:e.clientY},!1),i=s.state.doc.lineAt(t),n=t-i.from,r=n>qs?-1:n==i.length?Mu(s,e.clientX):_t(i.text,s.state.tabSize,t-i.from);return{line:i.number,col:r,off:n}}function Du(s,e){let t=Bo(s,e),i=s.state.selection;return t?{update(n){if(n.docChanged){let r=n.changes.mapPos(n.startState.doc.line(t.line).from),o=n.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(n.changes)}},get(n,r,o){let l=Bo(s,n);if(!l)return i;let a=Au(s.state,t,l);return a.length?o?b.create(a.concat(i.ranges)):b.create(a):i}}:null}function om(s){let e=(s==null?void 0:s.eventFilter)||(t=>t.altKey&&t.button==0);return T.mouseSelectionStyle.of((t,i)=>e(i)?Du(t,i):null)}const ni="-10000px";class Ou{constructor(e,t,i,n){this.facet=t,this.createTooltipView=i,this.removeTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter(r=>r),this.tooltipViews=this.tooltips.map(i)}update(e,t){var i;let n=e.state.facet(this.facet),r=n.filter(a=>a);if(n===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=n,this.tooltips=r,this.tooltipViews=o,!0}}function Tu(s){let{win:e}=s;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Qn=O.define({combine:s=>{var e,t,i;return{position:D.ios?"absolute":((e=s.find(n=>n.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=s.find(n=>n.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=s.find(n=>n.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||Tu}}}),Po=new WeakMap,Na=ue.fromClass(class{constructor(s){this.view=s,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=s.state.facet(Qn);this.position=e.position,this.parent=e.parent,this.classes=s.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Ou(s,Fa,t=>this.createTooltip(t),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),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(),s.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 s of this.manager.tooltipViews)this.intersectionObserver.observe(s.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(s){s.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(s,this.above);e&&this.observeIntersection();let t=e||s.geometryChanged,i=s.state.facet(Qn);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let n of this.manager.tooltipViews)n.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 n of this.manager.tooltipViews)this.container.appendChild(n.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(s){let e=s.create(this.view);if(e.dom.classList.add("cm-tooltip"),s.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=ni,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var s,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(s=i.destroy)===null||s===void 0||s.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let s=this.view.dom.getBoundingClientRect(),e=1,t=1,i=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(D.gecko)i=n.offsetParent!=this.container.ownerDocument.body;else if(n.style.top==ni&&n.style.left=="0px"){let r=n.getBoundingClientRect();i=Math.abs(r.top+1e4)>1||Math.abs(r.left)>1}}if(i||this.position=="absolute")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:s,parent:this.parent?this.container.getBoundingClientRect():s,pos:this.manager.tooltips.map((n,r)=>{let o=this.manager.tooltipViews[r];return o.getCoords?o.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(Qn).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:i}}writeMeasure(s){var e;if(s.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:t,space:i,scaleX:n,scaleY:r}=s,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1){c.style.top=ni;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=u.right-u.left,g=(e=Po.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||Pu,w=this.view.textDirection==X.LTR,S=u.width>i.right-i.left?w?i.left:i.right-u.width:w?Math.min(f.left-(d?14:0)+y.x,i.right-m):Math.max(i.left,f.left-m+(d?14:0)-y.x),v=this.above[l];!a.strictSide&&(v?f.top-(u.bottom-u.top)-y.yi.bottom)&&v==i.bottom-f.bottom>f.top-i.top&&(v=this.above[l]=!v);let x=(v?f.top-i.top:i.bottom-f.bottom)-p;if(xS&&P.topA&&(A=v?P.top-g-2-p:P.bottom+p+2);if(this.position=="absolute"?(c.style.top=(A-s.parent.top)/r+"px",c.style.left=(S-s.parent.left)/n+"px"):(c.style.top=A/r+"px",c.style.left=S/n+"px"),d){let P=f.left+(w?y.x:-y.x)-(S+14-7);d.style.left=P/n+"px"}h.overlap!==!0&&o.push({left:S,top:A,right:C,bottom:A+g}),c.classList.toggle("cm-tooltip-above",v),c.classList.toggle("cm-tooltip-below",!v),h.positioned&&h.positioned(s.space)}}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 s of this.manager.tooltipViews)s.dom.style.top=ni}},{eventObservers:{scroll(){this.maybeMeasure()}}}),Bu=T.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&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:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Pu={x:0,y:0},Fa=O.define({enables:[Na,Bu]});function Va(s,e){let t=s.plugin(Na);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Lo=O.define({combine(s){let e,t;for(let i of s)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function mn(s,e){let t=s.plugin(Wa),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const Wa=ue.fromClass(class{constructor(s){this.input=s.state.facet(yn),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(s));let e=s.state.facet(Lo);this.top=new Gi(s,!0,e.topContainer),this.bottom=new Gi(s,!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(s){let e=s.state.facet(Lo);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Gi(s.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Gi(s.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=s.state.facet(yn);if(t!=this.input){let i=t.filter(a=>a),n=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(s.view),l.push(c)):(c=this.panels[h],c.update&&c.update(s)),n.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=n,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(s)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:s=>T.scrollMargins.of(e=>{let t=e.plugin(s);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Gi{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=Ro(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Ro(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 Ro(s){let e=s.nextSibling;return s.remove(),e}const yn=O.define({enables:Wa});class Ot extends Ct{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ot.prototype.elementClass="";Ot.prototype.toDOM=void 0;Ot.prototype.mapMode=he.TrackBefore;Ot.prototype.startSide=Ot.prototype.endSide=-1;Ot.prototype.point=!0;const Lu=O.define(),Ru=new class extends Ot{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Eu=Lu.compute(["selection"],s=>{let e=[],t=-1;for(let i of s.selection.ranges){let n=s.doc.lineAt(i.head).from;n>t&&(t=n,e.push(Ru.range(n)))}return $.of(e)});function lm(){return Eu}const Iu=1024;let Nu=0;class Pe{constructor(e,t){this.from=e,this.to=t}}class R{constructor(e={}){this.id=Nu++,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=ge.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}R.closedBy=new R({deserialize:s=>s.split(" ")});R.openedBy=new R({deserialize:s=>s.split(" ")});R.group=new R({deserialize:s=>s.split(" ")});R.isolate=new R({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}});R.contextHash=new R({perNode:!0});R.lookAhead=new R({perNode:!0});R.mounted=new R({perNode:!0});class ki{constructor(e,t,i){this.tree=e,this.overlay=t,this.parser=i}static get(e){return e&&e.props&&e.props[R.mounted.id]}}const Fu=Object.create(null);class ge{constructor(e,t,i,n=0){this.name=e,this.props=t,this.id=i,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):Fu,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new ge(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(n)),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 n}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 n of i.split(" "))t[n]=e[i];return i=>{for(let n=i.prop(R.group),r=-1;r<(n?n.length:0);r++){let o=t[r<0?i.name:n[r]];if(o)return o}}}}ge.none=new ge("",Object.create(null),0,8);class pr{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|Y.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=n&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!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:yr(ge.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,n)=>new K(this.type,t,i,n,this.propValues),e.makeTree||((t,i,n)=>new K(ge.none,t,i,n)))}static build(e){return zu(e)}}K.empty=new K(ge.none,[],[],0);class gr{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 gr(this.buffer,this.index)}}class gt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return ge.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let n=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Si(s,e,t,i){for(var n;s.from==s.to||(t<1?s.from>=e:s.from>e)||(t>-1?s.to<=e:s.to0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from;if(Ha(n,i,f,f+c.length)){if(c instanceof gt){if(r&Y.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,n);if(u>-1)return new Je(new Vu(o,c,e,f),null,u)}else if(r&Y.IncludeAnonymous||!c.type.isAnonymous||mr(c)){let u;if(!(r&Y.IgnoreMounts)&&(u=ki.get(c))&&!u.overlay)return new fe(u.tree,f,e,o);let d=new fe(c,f,e,o);return r&Y.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,n)}}}if(r&Y.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 n;if(!(i&Y.IgnoreOverlays)&&(n=ki.get(this._tree))&&n.overlay){let r=e-this.from;for(let{from:o,to:l}of n.overlay)if((t>0?o<=r:o=r:l>r))return new fe(n.tree,n.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}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Io(s,e,t,i){let n=s.cursor(),r=[];if(!n.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return r}for(;;){if(i!=null&&n.type.is(i))return r;if(n.type.is(e)&&r.push(n.node),!n.nextSibling())return i==null?r:[]}}function $s(s,e,t=e.length-1){for(let i=s.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 Vu{constructor(e,t,i,n){this.parent=e,this.buffer=t,this.index=i,this.start=n}}class Je extends za{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]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new Je(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&Y.ExcludeBuffers)return null;let{buffer:n}=this.context,r=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Je(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 Je(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 Je(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,n=this.index+4,r=i.buffer[this.index+3];if(r>n){let o=i.buffer[this.index+1];e.push(i.slice(n,r,o)),t.push(0)}return new K(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function qa(s){if(!s.length)return null;let e=0,t=s[0];for(let r=1;rt.from||o.to=e){let l=new fe(o.tree,o.overlay[0].from+r.from,-1,r);(n||(n=[i])).push(Si(l,e,t,!1))}}return n?qa(n):i}class bn{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof fe)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)}}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:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=i+n.buffer[e+1],this.to=i+n.buffer[e+2],!0}yield(e){return e?e instanceof fe?(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:n}=this.buffer,r=n.findChild(this.index+4,n.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&Y.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Y.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Y.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 n=i<0?0:this.stack[i]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(n)}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:n}=this;if(n){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&Y.IncludeAnonymous||l instanceof gt||!l.type.isAnonymous||mr(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==n){if(n==this.index)return o;t=o,i=r+1;break e}n=this.stack[--r]}for(let n=i;n=0;r--){if(r<0)return $s(this.node,e,n);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}}function mr(s){return s.children.some(e=>e instanceof gt||!e.type.isAnonymous||mr(e))}function zu(s){var e;let{buffer:t,nodeSet:i,maxBufferLength:n=Iu,reused:r=[],minRepeatType:o=i.types.length}=s,l=Array.isArray(t)?new gr(t,t.length):t,a=i.types,h=0,c=0;function f(x,A,C,P,I,N){let{id:E,start:L,end:z,size:W}=l,J=c;for(;W<0;)if(l.next(),W==-1){let Z=r[E];C.push(Z),P.push(L-x);return}else if(W==-3){h=E;return}else if(W==-4){c=E;return}else throw new RangeError(`Unrecognized record size: ${W}`);let be=a[E],we,ke,Oe=L-x;if(z-L<=n&&(ke=g(l.pos-A,I))){let Z=new Uint16Array(ke.size-ke.skip),Te=l.pos-ke.size,He=Z.length;for(;l.pos>Te;)He=y(ke.start,Z,He);we=new gt(Z,z-ke.start,i),Oe=ke.start-x}else{let Z=l.pos-W;l.next();let Te=[],He=[],yt=E>=o?E:-1,Rt=0,Ii=z;for(;l.pos>Z;)yt>=0&&l.id==yt&&l.size>=0?(l.end<=Ii-n&&(p(Te,He,L,Rt,l.end,Ii,yt,J),Rt=Te.length,Ii=l.end),l.next()):N>2500?u(L,Z,Te,He):f(L,Z,Te,He,yt,N+1);if(yt>=0&&Rt>0&&Rt-1&&Rt>0){let Lr=d(be);we=yr(be,Te,He,0,Te.length,0,z-L,Lr,Lr)}else we=m(be,Te,He,z-L,J-z)}C.push(we),P.push(Oe)}function u(x,A,C,P){let I=[],N=0,E=-1;for(;l.pos>A;){let{id:L,start:z,end:W,size:J}=l;if(J>4)l.next();else{if(E>-1&&z=0;W-=3)L[J++]=I[W],L[J++]=I[W+1]-z,L[J++]=I[W+2]-z,L[J++]=J;C.push(new gt(L,I[2]-z,i)),P.push(z-x)}}function d(x){return(A,C,P)=>{let I=0,N=A.length-1,E,L;if(N>=0&&(E=A[N])instanceof K){if(!N&&E.type==x&&E.length==P)return E;(L=E.prop(R.lookAhead))&&(I=C[N]+E.length+L)}return m(x,A,C,P,I)}}function p(x,A,C,P,I,N,E,L){let z=[],W=[];for(;x.length>P;)z.push(x.pop()),W.push(A.pop()+C-I);x.push(m(i.types[E],z,W,N-I,L-N)),A.push(I-C)}function m(x,A,C,P,I=0,N){if(h){let E=[R.contextHash,h];N=N?[E].concat(N):[E]}if(I>25){let E=[R.lookAhead,I];N=N?[E].concat(N):[E]}return new K(x,A,C,P,N)}function g(x,A){let C=l.fork(),P=0,I=0,N=0,E=C.end-n,L={size:0,start:0,skip:0};e:for(let z=C.pos-x;C.pos>z;){let W=C.size;if(C.id==A&&W>=0){L.size=P,L.start=I,L.skip=N,N+=4,P+=4,C.next();continue}let J=C.pos-W;if(W<0||J=o?4:0,we=C.start;for(C.next();C.pos>J;){if(C.size<0)if(C.size==-3)be+=4;else break e;else C.id>=o&&(be+=4);C.next()}I=we,P+=W,N+=be}return(A<0||P==x)&&(L.size=P,L.start=I,L.skip=N),L.size>4?L:void 0}function y(x,A,C){let{id:P,start:I,end:N,size:E}=l;if(l.next(),E>=0&&P4){let z=l.pos-(E-4);for(;l.pos>z;)C=y(x,A,C)}A[--C]=L,A[--C]=N-x,A[--C]=I-x,A[--C]=P}else E==-3?h=P:E==-4&&(c=P);return C}let w=[],S=[];for(;l.pos>0;)f(s.start||0,s.bufferStart||0,w,S,-1,0);let v=(e=s.length)!==null&&e!==void 0?e:w.length?S[0]+w[0].length:0;return new K(a[s.topID],w.reverse(),S.reverse(),v)}const No=new WeakMap;function cn(s,e){if(!s.isAnonymous||e instanceof gt||e.type!=s)return 1;let t=No.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=s||!(i instanceof K)){t=1;break}t+=cn(s,i)}No.set(e,t)}return t}function yr(s,e,t,i,n,r,o,l,a){let h=0;for(let p=i;p=c)break;A+=C}if(S==v+1){if(A>c){let C=p[v];d(C.children,C.positions,0,C.children.length,m[v]+w);continue}f.push(p[v])}else{let C=m[S-1]+p[S-1].length-x;f.push(yr(s,p,m,v,S,x,C,null,a))}u.push(x+w-r)}}return d(e,t,i,n,0),(l||a)(f,u,o)}class am{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof Je?this.setBuffer(e.context.buffer,e.index,t):e instanceof fe&&this.map.set(e.tree,t)}get(e){return e instanceof Je?this.getBuffer(e.context.buffer,e.index):e instanceof fe?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 Ze{constructor(e,t,i,n,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=n,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 n=[new Ze(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&n.push(r);return n}static applyChanges(e,t,i=128){if(!t.length)return e;let n=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new Ze(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&n.push(u),o.to>f)break;o=rnew Pe(n.from,n.to)):[new Pe(0,0)]:[new Pe(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let n=this.startParse(e,t,i);for(;;){let r=n.advance();if(r)return r}}}class qu{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 hm(s){return(e,t,i,n)=>new Ku(e,s,t,i,n)}class Fo{constructor(e,t,i,n,r){this.parser=e,this.parse=t,this.overlay=i,this.target=n,this.from=r}}function Vo(s){if(!s.length||s.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}class $u{constructor(e,t,i,n,r,o,l){this.parser=e,this.predicate=t,this.mounts=i,this.index=n,this.start=r,this.target=o,this.prev=l,this.depth=0,this.ranges=[]}}const Ks=new R({perNode:!0});class Ku{constructor(e,t,i,n,r){this.nest=t,this.input=i,this.fragments=n,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 n of this.inner)n.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new K(i.type,i.children,i.positions,i.length,i.propValues.concat([[Ks,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 ki(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;t=this.stoppedAt)l=!1;else if(e.hasNode(n)){if(t){let h=t.mounts.find(c=>c.frag.from<=n.from&&c.frag.to>=n.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let f=c.from+h.pos,u=c.to+h.pos;f>=n.from&&u<=n.to&&!t.ranges.some(d=>d.fromf)&&t.ranges.push({from:f,to:u})}}l=!1}else if(i&&(o=ju(i.ranges,n.from,n.to)))l=o!=2;else if(!n.type.isAnonymous&&(r=this.nest(n,this.input))&&(n.fromnew Pe(f.from-n.from,f.to-n.from)):null,n.tree,c.length?c[0].from:n.from)),r.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else t&&(a=t.predicate(n))&&(a===!0&&(a=new Pe(n.from,n.to)),a.fromnew Pe(c.from-t.start,c.to-t.start)),t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function ju(s,e,t){for(let i of s){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function Wo(s,e,t,i,n,r){if(e=e&&t.enter(i,1,Y.IgnoreOverlays|Y.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 K)t=t.children[0];else break}return!1}}class Gu{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(Ks))!==null&&t!==void 0?t:i.to,this.inner=new Ho(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(Ks))!==null&&e!==void 0?e:t.to,this.inner=new Ho(t.tree,-t.offset)}}findMounts(e,t){var i;let n=[];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;a.tree==this.curFrag.tree&&n.push({frag:a,pos:r.from-a.offset,mount:o})}}}return n}}function zo(s,e){let t=null,i=e;for(let n=1,r=0;n=l)break;a.to<=o||(t||(i=t=e.slice()),a.froml&&t.splice(r+1,0,new Pe(l,a.to))):a.to>l?t[r--]=new Pe(l,a.to):t.splice(r--,1))}}return i}function Ju(s,e,t,i){let n=0,r=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=n==s.length?1e9:o?s[n].to:s[n].from,f=r==e.length?1e9:l?e[r].to:e[r].from;if(o!=l){let u=Math.max(a,t),d=Math.min(c,f,i);unew Pe(u.from+i,u.to+i)),f=Ju(e,c,a,h);for(let u=0,d=a;;u++){let p=u==f.length,m=p?h:f[u].from;if(m>d&&t.push(new Ze(d,m,n.tree,-o,r.from>=d||r.openStart,r.to<=m||r.openEnd)),p)break;d=f[u].to}}else t.push(new Ze(a,h,n.tree,-o,r.from>=o||r.openStart,r.to<=l||r.openEnd))}return t}let Yu=0;class je{constructor(e,t,i){this.set=e,this.base=t,this.modified=i,this.id=Yu++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let t=new je([],null,[]);if(t.set.push(t),e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new wn;return t=>t.modified.indexOf(e)>-1?t:wn.get(t.base||t,t.modified.concat(e).sort((i,n)=>i.id-n.id))}}let Xu=0;class wn{constructor(){this.instances=[],this.id=Xu++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&_u(t,l.modified));if(i)return i;let n=[],r=new je(n,e,t);for(let l of t)l.instances.push(r);let o=Qu(t);for(let l of e.set)if(!l.modified.length)for(let a of o)n.push(wn.get(l,a));return r}}function _u(s,e){return s.length==e.length&&s.every((t,i)=>t==e[i])}function Qu(s){let e=[[]];for(let t=0;ti.length-t.length)}function Zu(s){let e=Object.create(null);for(let t in s){let i=s[t];Array.isArray(i)||(i=[i]);for(let n of t.split(" "))if(n){let r=[],o=2,l=n;for(let f=0;;){if(l=="..."&&f>0&&f+3==n.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+n);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==n.length)break;let d=n[f++];if(f==n.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+n);l=n.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+n);let c=new xn(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return Ka.add(e)}const Ka=new R;class xn{constructor(e,t,i,n){this.tags=e,this.mode=t,this.context=i,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=n;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function ed(s,e){let t=null;for(let i of s){let n=i.style(e);n&&(t=t?t+" "+n:n)}return t}function td(s,e,t,i=0,n=s.length){let r=new id(i,Array.isArray(e)?e:[e],t);r.highlightRange(s.cursor(),i,n,"",r.highlighters),r.flush(n)}class id{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,n,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=n,c=nd(e)||xn.empty,f=ed(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(n+=(n?" ":"")+f)),this.startSpan(Math.max(t,l),h),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 w=g=S||!e.nextSibling())););if(!w||S>i)break;y=w.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,w.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),h))}m&&e.parent()}else if(e.firstChild()){u&&(n="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,n,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function nd(s){let e=s.type.prop(Ka);for(;e&&e.context&&!s.matchContext(e.context);)e=e.next;return e||null}const k=je.define,Yi=k(),st=k(),$o=k(st),Ko=k(st),rt=k(),Xi=k(rt),Zn=k(rt),Ke=k(),bt=k(Ke),qe=k(),$e=k(),js=k(),si=k(js),_i=k(),M={comment:Yi,lineComment:k(Yi),blockComment:k(Yi),docComment:k(Yi),name:st,variableName:k(st),typeName:$o,tagName:k($o),propertyName:Ko,attributeName:k(Ko),className:k(st),labelName:k(st),namespace:k(st),macroName:k(st),literal:rt,string:Xi,docString:k(Xi),character:k(Xi),attributeValue:k(Xi),number:Zn,integer:k(Zn),float:k(Zn),bool:k(rt),regexp:k(rt),escape:k(rt),color:k(rt),url:k(rt),keyword:qe,self:k(qe),null:k(qe),atom:k(qe),unit:k(qe),modifier:k(qe),operatorKeyword:k(qe),controlKeyword:k(qe),definitionKeyword:k(qe),moduleKeyword:k(qe),operator:$e,derefOperator:k($e),arithmeticOperator:k($e),logicOperator:k($e),bitwiseOperator:k($e),compareOperator:k($e),updateOperator:k($e),definitionOperator:k($e),typeOperator:k($e),controlOperator:k($e),punctuation:js,separator:k(js),bracket:si,angleBracket:k(si),squareBracket:k(si),paren:k(si),brace:k(si),content:Ke,heading:bt,heading1:k(bt),heading2:k(bt),heading3:k(bt),heading4:k(bt),heading5:k(bt),heading6:k(bt),contentSeparator:k(Ke),list:k(Ke),quote:k(Ke),emphasis:k(Ke),strong:k(Ke),link:k(Ke),monospace:k(Ke),strikethrough:k(Ke),inserted:k(),deleted:k(),changed:k(),invalid:k(),meta:_i,documentMeta:k(_i),annotation:k(_i),processingInstruction:k(_i),definition:je.defineModifier(),constant:je.defineModifier(),function:je.defineModifier(),standard:je.defineModifier(),local:je.defineModifier(),special:je.defineModifier()};ja([{tag:M.link,class:"tok-link"},{tag:M.heading,class:"tok-heading"},{tag:M.emphasis,class:"tok-emphasis"},{tag:M.strong,class:"tok-strong"},{tag:M.keyword,class:"tok-keyword"},{tag:M.atom,class:"tok-atom"},{tag:M.bool,class:"tok-bool"},{tag:M.url,class:"tok-url"},{tag:M.labelName,class:"tok-labelName"},{tag:M.inserted,class:"tok-inserted"},{tag:M.deleted,class:"tok-deleted"},{tag:M.literal,class:"tok-literal"},{tag:M.string,class:"tok-string"},{tag:M.number,class:"tok-number"},{tag:[M.regexp,M.escape,M.special(M.string)],class:"tok-string2"},{tag:M.variableName,class:"tok-variableName"},{tag:M.local(M.variableName),class:"tok-variableName tok-local"},{tag:M.definition(M.variableName),class:"tok-variableName tok-definition"},{tag:M.special(M.variableName),class:"tok-variableName2"},{tag:M.definition(M.propertyName),class:"tok-propertyName tok-definition"},{tag:M.typeName,class:"tok-typeName"},{tag:M.namespace,class:"tok-namespace"},{tag:M.className,class:"tok-className"},{tag:M.macroName,class:"tok-macroName"},{tag:M.propertyName,class:"tok-propertyName"},{tag:M.operator,class:"tok-operator"},{tag:M.comment,class:"tok-comment"},{tag:M.meta,class:"tok-meta"},{tag:M.invalid,class:"tok-invalid"},{tag:M.punctuation,class:"tok-punctuation"}]);var es;const kt=new R;function Ua(s){return O.define({combine:s?e=>e.concat(s):void 0})}const sd=new R;class Le{constructor(e,t,i=[],n=""){this.data=e,this.name=n,H.prototype.hasOwnProperty("tree")||Object.defineProperty(H.prototype,"tree",{get(){return me(this)}}),this.parser=t,this.extension=[Yt.of(this),H.languageData.of((r,o,l)=>{let a=jo(r,o,l),h=a.type.prop(kt);if(!h)return[];let c=r.facet(h),f=a.type.prop(sd);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return jo(e,t,i).type.prop(kt)==this.data}findRegions(e){let t=e.facet(Yt);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],n=(r,o)=>{if(r.prop(kt)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(R.mounted);if(l){if(l.tree.prop(kt)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(n(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new Us(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function me(s){let e=s.field(Le.state,!1);return e?e.tree:K.empty}class rd{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}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 ri=null;class Gt{constructor(e,t,i=[],n,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=n,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Gt(e,t,[],K.empty,0,i,[],null)}startParse(){return this.parser.startParse(new rd(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=K.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let n=Date.now()+e;e=()=>Date.now()>n}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(Ze.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ri;ri=this;try{return e()}finally{ri=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Uo(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:n,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=Ze.applyChanges(i,a),n=K.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=Uo(this.fragments,n,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 $a{createParse(t,i,n){let r=n[0].from,o=n[n.length-1].to;return{parsedPos:r,advance(){let a=ri;if(a){for(let h of n)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new K(ge.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 ri}}function Uo(s,e,t){return Ze.applyChanges(s,[{fromA:e,toA:t,fromB:e,toB:t}])}class Jt{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 Jt(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Gt.create(e.facet(Yt).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Jt(i)}}Le.state=ye.define({create:Jt.init,update(s,e){for(let t of e.effects)if(t.is(Le.setState))return t.value;return e.startState.facet(Yt)!=e.state.facet(Yt)?Jt.init(e.state):s.apply(e)}});let Ga=s=>{let e=setTimeout(()=>s(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Ga=s=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(s,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const ts=typeof navigator<"u"&&(!((es=navigator.scheduling)===null||es===void 0)&&es.isInputPending)?()=>navigator.scheduling.isInputPending():null,od=ue.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(Le.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Le.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Ga(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndn+1e3,a=r.context.work(()=>ts&&ts()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Le.setState.of(new Jt(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Ne(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()}}}),Yt=O.define({combine(s){return s.length?s[0]:null},enables:s=>[Le.state,od,T.contentAttributes.compute([s],e=>{let t=e.facet(s);return t&&t.name?{"data-language":t.name}:{}})]});class fm{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Ja=O.define(),In=O.define({combine:s=>{if(!s.length)return" ";let e=s[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(s[0]));return e}});function Tt(s){let e=s.facet(In);return e.charCodeAt(0)==9?s.tabSize*e.length:e.length}function vn(s,e){let t="",i=s.tabSize,n=s.facet(In)[0];if(n==" "){for(;e>=i;)t+=" ",e-=i;n=" "}for(let r=0;r=e?ad(s,t,e):null}class Nn{constructor(e,t={}){this.state=e,this.options=t,this.unit=Tt(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:r}=this.options;return n!=null&&n>=i.from&&n<=i.to?r&&n==e?{text:"",from:e}:(t<0?n-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return _t(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:n}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(n);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const ld=new R;function ad(s,e,t){let i=e.resolveStack(t),n=i.node.enterUnfinishedNodesBefore(t);if(n!=i.node){let r=[];for(let o=n;o!=i.node;o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return Xa(i,s,t)}function Xa(s,e,t){for(let i=s;i;i=i.next){let n=cd(i.node);if(n)return n(br.create(e,t,i))}return 0}function hd(s){return s.pos==s.options.simulateBreak&&s.options.simulateDoubleBreak}function cd(s){let e=s.type.prop(ld);if(e)return e;let t=s.firstChild,i;if(t&&(i=t.type.prop(R.closedBy))){let n=s.lastChild,r=n&&i.indexOf(n.name)>-1;return o=>_a(o,!0,1,void 0,r&&!hd(o)?n.from:void 0)}return s.parent==null?fd:null}function fd(){return 0}class br extends Nn{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new br(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(ud(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return Xa(this.context.next,this.base,this.pos)}}function ud(s,e){for(let t=e;t;t=t.parent)if(s==t)return!0;return!1}function dd(s){let e=s.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let n=s.options.simulateBreak,r=s.state.doc.lineAt(t.from),o=n==null||n<=r.from?r.to:Math.min(r.to,n);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped)return a.from_a(i,e,t,s)}function _a(s,e,t,i,n){let r=s.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||n==s.pos+o,a=e?dd(s):null;return a?l?s.column(a.from):s.column(a.to):s.baseIndent+(l?0:s.unit*t)}const dm=s=>s.baseIndent;function pm({except:s,units:e=1}={}){return t=>{let i=s&&s.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const gm=new R;function mm(s){let e=s.firstChild,t=s.lastChild;return e&&e.tol.prop(kt)==o.data:o?l=>l==o:void 0,this.style=ja(e.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new ut(i):null,this.themeType=t.themeType}static define(e,t){return new Fn(e,t||{})}}const Gs=O.define(),Qa=O.define({combine(s){return s.length?[s[0]]:null}});function is(s){let e=s.facet(Gs);return e.length?e:s.facet(Qa)}function ym(s,e){let t=[gd],i;return s instanceof Fn&&(s.module&&t.push(T.styleModule.of(s.module)),i=s.themeType),e!=null&&e.fallback?t.push(Qa.of(s)):i?t.push(Gs.computeN([T.darkTheme],n=>n.facet(T.darkTheme)==(i=="dark")?[s]:[])):t.push(Gs.of(s)),t}class pd{constructor(e){this.markCache=Object.create(null),this.tree=me(e.state),this.decorations=this.buildDeco(e,is(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=me(e.state),i=is(e.state),n=i!=is(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||n)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return B.none;let i=new At;for(let{from:n,to:r}of e.visibleRanges)td(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=B.mark({class:a})))},n,r);return i.finish()}}const gd=Bt.high(ue.fromClass(pd,{decorations:s=>s.decorations})),bm=Fn.define([{tag:M.meta,color:"#404740"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,textDecoration:"underline",fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strong,fontWeight:"bold"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.keyword,color:"#708"},{tag:[M.atom,M.bool,M.url,M.contentSeparator,M.labelName],color:"#219"},{tag:[M.literal,M.inserted],color:"#164"},{tag:[M.string,M.deleted],color:"#a11"},{tag:[M.regexp,M.escape,M.special(M.string)],color:"#e40"},{tag:M.definition(M.variableName),color:"#00f"},{tag:M.local(M.variableName),color:"#30a"},{tag:[M.typeName,M.namespace],color:"#085"},{tag:M.className,color:"#167"},{tag:[M.special(M.variableName),M.macroName],color:"#256"},{tag:M.definition(M.propertyName),color:"#00c"},{tag:M.comment,color:"#940"},{tag:M.invalid,color:"#f00"}]),md=T.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Za=1e4,eh="()[]{}",th=O.define({combine(s){return Pt(s,{afterCursor:!0,brackets:eh,maxScanDistance:Za,renderMatch:wd})}}),yd=B.mark({class:"cm-matchingBracket"}),bd=B.mark({class:"cm-nonmatchingBracket"});function wd(s){let e=[],t=s.matched?yd:bd;return e.push(t.range(s.start.from,s.start.to)),s.end&&e.push(t.range(s.end.from,s.end.to)),e}const xd=ye.define({create(){return B.none},update(s,e){if(!e.docChanged&&!e.selection)return s;let t=[],i=e.state.facet(th);for(let n of e.state.selection.ranges){if(!n.empty)continue;let r=Ye(e.state,n.head,-1,i)||n.head>0&&Ye(e.state,n.head-1,1,i)||i.afterCursor&&(Ye(e.state,n.head,1,i)||n.headT.decorations.from(s)}),vd=[xd,md];function wm(s={}){return[th.of(s),vd]}const kd=new R;function Js(s,e,t){let i=s.prop(e<0?R.openedBy:R.closedBy);if(i)return i;if(s.name.length==1){let n=t.indexOf(s.name);if(n>-1&&n%2==(e<0?1:0))return[t[n+e]]}return null}function Ys(s){let e=s.type.prop(kd);return e?e(s.node):s}function Ye(s,e,t,i={}){let n=i.maxScanDistance||Za,r=i.brackets||eh,o=me(s),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=Js(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return Sd(s,e,t,a,c,h,r)}}return Cd(s,e,t,o,l.type,n,r)}function Sd(s,e,t,i,n,r,o){let l=i.parent,a={from:n.from,to:n.to},h=0,c=l==null?void 0:l.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=s.doc.iterRange(e,t>0?s.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!=n))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}function Go(s,e,t,i=0,n=0){e==null&&(e=s.search(/[^\s\u00a0]/),e==-1&&(e=s.length));let r=n;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 n(r)==n(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}}function Ad(s){return{name:s.name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||Md,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||xr}}function Md(s){if(typeof s!="object")return s;let e={};for(let t in s){let i=s[t];e[t]=i instanceof Array?i.slice():i}return e}const Jo=new WeakMap;class nh extends Le{constructor(e){let t=Ua(e.languageData),i=Ad(e),n,r=new class extends $a{createParse(o,l,a){return new Od(n,o,l,a)}};super(t,r,[Ja.of((o,l)=>this.getIndent(o,l))],e.name),this.topNode=Pd(t),n=this,this.streamParser=i,this.stateAfter=new R({perNode:!0}),this.tokenTable=e.tokenTable?new lh(i.tokenTable):Bd}static define(e){return new nh(e)}getIndent(e,t){let i=me(e.state),n=i.resolve(t);for(;n&&n.type!=this.topNode;)n=n.parent;if(!n)return null;let r,{overrideIndentation:o}=e.options;o&&(r=Jo.get(e.state),r!=null&&r1e4)return null;for(;a=i&&t+e.length<=n&&e.prop(s.stateAfter);if(r)return{state:s.streamParser.copyState(r),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],h=l instanceof K&&a=e.length)return e;!n&&e.type==s.topNode&&(n=!0);for(let r=e.children.length-1;r>=0;r--){let o=e.positions[r],l=e.children[r],a;if(ot&&wr(s,n.tree,0-n.offset,t,o),a;if(l&&(a=sh(s,n.tree,t+n.offset,l.pos+n.offset,!1)))return{state:l.state,tree:a}}return{state:s.streamParser.startState(i?Tt(i):4),tree:K.empty}}class Od{constructor(e,t,i,n){this.lang=e,this.input=t,this.fragments=i,this.ranges=n,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=n[n.length-1].to;let r=Gt.get(),o=n[0].from,{state:l,tree:a}=Dd(e,i,o,r==null?void 0:r.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let h=0;h=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 n=this.rangeIndex;;){let r=this.ranges[n].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),n++,n==this.ranges.length))break;let o=this.ranges[n].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let n=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?n>r:n>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-n}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,n+=this.chunk.length-o}return this.chunk.push(e,t,i,n),r}parseLine(e){let{line:t,end:i}=this.nextLine(),n=0,{streamParser:r}=this.lang,o=new ih(t,e?e.state.tabSize:4,e?Tt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=rh(r.token,o,this.state);if(l&&(n=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,4,n)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return n}throw new Error("Stream parser failed to advance stream.")}const xr=Object.create(null),Ci=[ge.none],Dd=new pr(Ci),Yo=[],Xo=Object.create(null),oh=Object.create(null);for(let[s,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"]])oh[s]=ah(xr,e);class lh{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),oh)}resolve(e){return e?this.table[e]||(this.table[e]=ah(this.extra,e)):0}}const Od=new lh(xr);function ns(s,e){Yo.indexOf(s)>-1||(Yo.push(s),console.warn(e))}function ah(s,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=s[h]||M[h];c?typeof c=="function"?a.length?a=a.map(c):ns(h,`Modifier ${h} used at start of tag`):a.length?ns(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:ns(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),n=i+" "+t.map(l=>l.id),r=Xo[n];if(r)return r.id;let o=Xo[n]=ge.define({id:Ci.length,name:i,props:[_u({[i]:t})]});return Ci.push(o),o.id}function Td(s){let e=ge.define({id:Ci.length,name:"Document",props:[kt.add(()=>s)],top:!0});return Ci.push(e),e}X.RTL,X.LTR;const Bd=s=>{let{state:e}=s,t=e.doc.lineAt(e.selection.main.from),i=kr(s.state,t.from);return i.line?Pd(s):i.block?Rd(s):!1};function vr(s,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let n=s(e,t);return n?(i(t.update(n)),!0):!1}}const Pd=vr(Nd,0),Ld=vr(hh,0),Rd=vr((s,e)=>hh(s,e,Id(e)),0);function kr(s,e){let t=s.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const oi=50;function Ed(s,{open:e,close:t},i,n){let r=s.sliceDoc(i-oi,i),o=s.sliceDoc(n,n+oi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:n+a,margin:a&&1}};let c,f;n-i<=2*oi?c=f=s.sliceDoc(i,n):(c=s.sliceDoc(i,i+oi),f=s.sliceDoc(n-oi,n));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:n-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function Id(s){let e=[];for(let t of s.selection.ranges){let i=s.doc.lineAt(t.from),n=t.to<=i.to?i:s.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=n.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:n.to})}return e}function hh(s,e,t=e.selection.ranges){let i=t.map(r=>kr(e,r.from).block);if(!i.every(r=>r))return null;let n=t.map((r,o)=>Ed(e,i[o],r.from,r.to));if(s!=2&&!n.every(r=>r))return{changes:e.changes(t.map((r,o)=>n[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(s!=1&&n.some(r=>r)){let r=[];for(let o=0,l;on&&(r==o||o>f.from)){n=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,p=f.text.slice(u,u+h.length)==h?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(s!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}const Xs=nt.define(),Fd=nt.define(),Vd=O.define(),ch=O.define({combine(s){return Pt(s,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,n)=>e(i,n)||t(i,n)})}}),fh=ye.define({create(){return Xe.empty},update(s,e){let t=e.state.facet(ch),i=e.annotation(Xs);if(i){let a=ve.fromTransaction(e,i.selection),h=i.side,c=h==0?s.undone:s.done;return a?c=kn(c,c.length,t.minDepth,a):c=ph(c,e.startState.selection),new Xe(h==0?i.rest:c,h==0?c:i.rest)}let n=e.annotation(Fd);if((n=="full"||n=="before")&&(s=s.isolate()),e.annotation(Q.addToHistory)===!1)return e.changes.empty?s:s.addMapping(e.changes.desc);let r=ve.fromTransaction(e),o=e.annotation(Q.time),l=e.annotation(Q.userEvent);return r?s=s.addChanges(r,o,l,t,e):e.selection&&(s=s.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(n=="full"||n=="after")&&(s=s.isolate()),s},toJSON(s){return{done:s.done.map(e=>e.toJSON()),undone:s.undone.map(e=>e.toJSON())}},fromJSON(s){return new Xe(s.done.map(ve.fromJSON),s.undone.map(ve.fromJSON))}});function xm(s={}){return[fh,ch.of(s),T.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?uh:e.inputType=="historyRedo"?_s:null;return i?(e.preventDefault(),i(t)):!1}})]}function Vn(s,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let n=t.field(fh,!1);if(!n)return!1;let r=n.pop(s,t,e);return r?(i(r),!0):!1}}const uh=Vn(0,!1),_s=Vn(1,!1),Wd=Vn(0,!0),Hd=Vn(1,!0);class ve{constructor(e,t,i,n,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=n,this.selectionsAfter=r}setSelAfter(e){return new ve(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(n=>n.toJSON())}}static fromJSON(e){return new ve(e.changes&&te.fromJSON(e.changes),[],e.mapped&&_e.fromJSON(e.mapped),e.startSelection&&b.fromJSON(e.startSelection),e.selectionsAfter.map(b.fromJSON))}static fromTransaction(e,t){let i=Re;for(let n of e.startState.facet(Vd)){let r=n(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new ve(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Re)}static selection(e){return new ve(void 0,Re,void 0,void 0,e)}}function kn(s,e,t,i){let n=e+1>t+20?e-t-1:0,r=s.slice(n,e);return r.push(i),r}function zd(s,e){let t=[],i=!1;return s.iterChangedRanges((n,r)=>t.push(n,r)),e.iterChangedRanges((n,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function qd(s,e){return s.ranges.length==e.ranges.length&&s.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function dh(s,e){return s.length?e.length?s.concat(e):s:e}const Re=[],$d=200;function ph(s,e){if(s.length){let t=s[s.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-$d));return i.length&&i[i.length-1].eq(e)?s:(i.push(e),kn(s,s.length-1,1e9,t.setSelAfter(i)))}else return[ve.selection([e])]}function Kd(s){let e=s[s.length-1],t=s.slice();return t[s.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function ss(s,e){if(!s.length)return s;let t=s.length,i=Re;for(;t;){let n=jd(s[t-1],e,i);if(n.changes&&!n.changes.empty||n.effects.length){let r=s.slice(0,t);return r[t-1]=n,r}else e=n.mapped,t--,i=n.selectionsAfter}return i.length?[ve.selection(i)]:Re}function jd(s,e,t){let i=dh(s.selectionsAfter.length?s.selectionsAfter.map(l=>l.map(e)):Re,t);if(!s.changes)return ve.selection(i);let n=s.changes.map(e),r=e.mapDesc(s.changes,!0),o=s.mapped?s.mapped.composeDesc(r):r;return new ve(n,F.mapEffects(s.effects,e),o,s.startSelection.map(r),i)}const Ud=/^(input\.type|delete)($|\.)/;class Xe{constructor(e,t,i=0,n=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new Xe(this.done,this.undone):this}addChanges(e,t,i,n,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||Ud.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?s.moveByChar(t,e):Wn(t,e))}function de(s){return s.textDirectionAt(s.state.selection.main.head)==X.LTR}const mh=s=>gh(s,!de(s)),yh=s=>gh(s,de(s));function bh(s,e){return We(s,t=>t.empty?s.moveByGroup(t,e):Wn(t,e))}const Gd=s=>bh(s,!de(s)),Jd=s=>bh(s,de(s));function Yd(s,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(s.sliceDoc(e.from,e.to)))||e.firstChild}function Hn(s,e,t){let i=me(s).resolveInner(e.head),n=t?R.closedBy:R.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;Yd(s,h,n)?i=h:a=t?h.to:h.from}let r=i.type.prop(n),o,l;return r&&(o=t?Ye(s,i.from,1):Ye(s,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 Xd=s=>We(s,e=>Hn(s.state,e,!de(s))),_d=s=>We(s,e=>Hn(s.state,e,de(s)));function wh(s,e){return We(s,t=>{if(!t.empty)return Wn(t,e);let i=s.moveVertically(t,e);return i.head!=t.head?i:s.moveToLineBoundary(t,e)})}const xh=s=>wh(s,!1),vh=s=>wh(s,!0);function kh(s){let e=s.scrollDOM.clientHeighto.empty?s.moveVertically(o,e,t.height):Wn(o,e));if(n.eq(i.selection))return!1;let r;if(t.selfScroll){let o=s.coordsAtPos(i.selection.main.head),l=s.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomSh(s,!1),Qs=s=>Sh(s,!0);function mt(s,e,t){let i=s.lineBlockAt(e.head),n=s.moveToLineBoundary(e,t);if(n.head==e.head&&n.head!=(t?i.to:i.from)&&(n=s.moveToLineBoundary(e,t,!1)),!t&&n.head==i.from&&i.length){let r=/^\s*/.exec(s.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(n=b.cursor(i.from+r))}return n}const Qd=s=>We(s,e=>mt(s,e,!0)),Zd=s=>We(s,e=>mt(s,e,!1)),ep=s=>We(s,e=>mt(s,e,!de(s))),tp=s=>We(s,e=>mt(s,e,de(s))),ip=s=>We(s,e=>b.cursor(s.lineBlockAt(e.head).from,1)),np=s=>We(s,e=>b.cursor(s.lineBlockAt(e.head).to,-1));function sp(s,e,t){let i=!1,n=Qt(s.selection,r=>{let o=Ye(s,r.head,-1)||Ye(s,r.head,1)||r.head>0&&Ye(s,r.head-1,1)||r.headsp(s,e,!1);function Ie(s,e){let t=Qt(s.state.selection,i=>{let n=e(i);return b.range(i.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return t.eq(s.state.selection)?!1:(s.dispatch(Qe(s.state,t)),!0)}function Ch(s,e){return Ie(s,t=>s.moveByChar(t,e))}const Ah=s=>Ch(s,!de(s)),Mh=s=>Ch(s,de(s));function Dh(s,e){return Ie(s,t=>s.moveByGroup(t,e))}const op=s=>Dh(s,!de(s)),lp=s=>Dh(s,de(s)),ap=s=>Ie(s,e=>Hn(s.state,e,!de(s))),hp=s=>Ie(s,e=>Hn(s.state,e,de(s)));function Oh(s,e){return Ie(s,t=>s.moveVertically(t,e))}const Th=s=>Oh(s,!1),Bh=s=>Oh(s,!0);function Ph(s,e){return Ie(s,t=>s.moveVertically(t,e,kh(s).height))}const Qo=s=>Ph(s,!1),Zo=s=>Ph(s,!0),cp=s=>Ie(s,e=>mt(s,e,!0)),fp=s=>Ie(s,e=>mt(s,e,!1)),up=s=>Ie(s,e=>mt(s,e,!de(s))),dp=s=>Ie(s,e=>mt(s,e,de(s))),pp=s=>Ie(s,e=>b.cursor(s.lineBlockAt(e.head).from)),gp=s=>Ie(s,e=>b.cursor(s.lineBlockAt(e.head).to)),el=({state:s,dispatch:e})=>(e(Qe(s,{anchor:0})),!0),tl=({state:s,dispatch:e})=>(e(Qe(s,{anchor:s.doc.length})),!0),il=({state:s,dispatch:e})=>(e(Qe(s,{anchor:s.selection.main.anchor,head:0})),!0),nl=({state:s,dispatch:e})=>(e(Qe(s,{anchor:s.selection.main.anchor,head:s.doc.length})),!0),mp=({state:s,dispatch:e})=>(e(s.update({selection:{anchor:0,head:s.doc.length},userEvent:"select"})),!0),yp=({state:s,dispatch:e})=>{let t=zn(s).map(({from:i,to:n})=>b.range(i,Math.min(n+1,s.doc.length)));return e(s.update({selection:b.create(t),userEvent:"select"})),!0},bp=({state:s,dispatch:e})=>{let t=Qt(s.selection,i=>{var n;let r=me(s).resolveStack(i.from,1);for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&(!((n=l.parent)===null||n===void 0)&&n.parent))return b.range(l.to,l.from)}return i});return e(Qe(s,t)),!0},wp=({state:s,dispatch:e})=>{let t=s.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(Qe(s,i)),!0):!1};function Li(s,e){if(s.state.readOnly)return!1;let t="delete.selection",{state:i}=s,n=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=Qi(s,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Qi(s,o,!1),l=Qi(s,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:b.cursor(o,on(s)))i.between(e,e,(n,r)=>{ne&&(e=t?r:n)});return e}const Lh=(s,e)=>Li(s,t=>{let i=t.from,{state:n}=s,r=n.doc.lineAt(i),o,l;if(!e&&i>r.from&&iLh(s,!1),Rh=s=>Lh(s,!0),Eh=(s,e)=>Li(s,t=>{let i=t.head,{state:n}=s,r=n.doc.lineAt(i),o=n.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?n.doc.lines:1)&&(i+=e?1:-1);break}let a=oe(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),Ih=s=>Eh(s,!1),xp=s=>Eh(s,!0),vp=s=>Li(s,e=>{let t=s.lineBlockAt(e.head).to;return e.headLi(s,e=>{let t=s.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Sp=s=>Li(s,e=>{let t=s.moveToLineBoundary(e,!0).head;return e.head{if(s.readOnly)return!1;let t=s.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:V.of(["",""])},range:b.cursor(i.from)}));return e(s.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Ap=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let t=s.changeByRange(i=>{if(!i.empty||i.from==0||i.from==s.doc.length)return{range:i};let n=i.from,r=s.doc.lineAt(n),o=n==r.from?n-1:oe(r.text,n-r.from,!1)+r.from,l=n==r.to?n+1:oe(r.text,n-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:s.doc.slice(n,l).append(s.doc.slice(o,n))},range:b.cursor(l)}});return t.changes.empty?!1:(e(s.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function zn(s){let e=[],t=-1;for(let i of s.selection.ranges){let n=s.doc.lineAt(i.from),r=s.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=s.doc.lineAt(i.to-1)),t>=n.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:n.from,to:r.to,ranges:[i]});t=r.number+1}return e}function Nh(s,e,t){if(s.readOnly)return!1;let i=[],n=[];for(let r of zn(s)){if(t?r.to==s.doc.length:r.from==0)continue;let o=s.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+s.lineBreak});for(let a of r.ranges)n.push(b.range(Math.min(s.doc.length,a.anchor+l),Math.min(s.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:s.lineBreak+o.text});for(let a of r.ranges)n.push(b.range(a.anchor-l,a.head-l))}}return i.length?(e(s.update({changes:i,scrollIntoView:!0,selection:b.create(n,s.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Mp=({state:s,dispatch:e})=>Nh(s,e,!1),Dp=({state:s,dispatch:e})=>Nh(s,e,!0);function Fh(s,e,t){if(s.readOnly)return!1;let i=[];for(let n of zn(s))t?i.push({from:n.from,insert:s.doc.slice(n.from,n.to)+s.lineBreak}):i.push({from:n.to,insert:s.lineBreak+s.doc.slice(n.from,n.to)});return e(s.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Op=({state:s,dispatch:e})=>Fh(s,e,!1),Tp=({state:s,dispatch:e})=>Fh(s,e,!0),Bp=s=>{if(s.state.readOnly)return!1;let{state:e}=s,t=e.changes(zn(e).map(({from:n,to:r})=>(n>0?n--:rs.moveVertically(n,!0)).map(t);return s.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Pp(s,e){if(/\(\)|\[\]|\{\}/.test(s.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=me(s).resolveInner(e),i=t.childBefore(e),n=t.childAfter(e),r;return i&&n&&i.to<=e&&n.from>=e&&(r=i.type.prop(R.closedBy))&&r.indexOf(n.name)>-1&&s.doc.lineAt(i.to).from==s.doc.lineAt(n.from).from&&!/\S/.test(s.sliceDoc(i.to,n.from))?{from:i.to,to:n.from}:null}const Lp=Vh(!1),Rp=Vh(!0);function Vh(s){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(n=>{let{from:r,to:o}=n,l=e.doc.lineAt(r),a=!s&&r==o&&Pp(e,r);s&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new Nn(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=Ya(h,r);for(c==null&&(c=_t(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let n=[];for(let o=i.from;o<=i.to;){let l=s.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,n,i),t=l.number),o=l.to+1}let r=s.changes(n);return{changes:n,range:b.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const Ep=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let t=Object.create(null),i=new Nn(s,{overrideIndentation:r=>{let o=t[r];return o??-1}}),n=Sr(s,(r,o,l)=>{let a=Ya(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=vn(s,a);(h!=c||l.froms.readOnly?!1:(e(s.update(Sr(s,(t,i)=>{i.push({from:t.from,insert:s.facet(In)})}),{userEvent:"input.indent"})),!0),Np=({state:s,dispatch:e})=>s.readOnly?!1:(e(s.update(Sr(s,(t,i)=>{let n=/^\s*/.exec(t.text)[0];if(!n)return;let r=_t(n,s.tabSize),o=0,l=vn(s,Math.max(0,r-Tt(s)));for(;o({mac:s.key,run:s.run,shift:s.shift}))),km=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Xd,shift:ap},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:_d,shift:hp},{key:"Alt-ArrowUp",run:Mp},{key:"Shift-Alt-ArrowUp",run:Op},{key:"Alt-ArrowDown",run:Dp},{key:"Shift-Alt-ArrowDown",run:Tp},{key:"Escape",run:wp},{key:"Mod-Enter",run:Rp},{key:"Alt-l",mac:"Ctrl-l",run:yp},{key:"Mod-i",run:bp,preventDefault:!0},{key:"Mod-[",run:Np},{key:"Mod-]",run:Ip},{key:"Mod-Alt-\\",run:Ep},{key:"Shift-Mod-k",run:Bp},{key:"Shift-Mod-\\",run:rp},{key:"Mod-/",run:Bd},{key:"Alt-A",run:Ld}].concat(Vp);function le(){var s=arguments[0];typeof s=="string"&&(s=document.createElement(s));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 n=t[i];typeof n=="string"?s.setAttribute(i,n):n!=null&&(s[i]=n)}e++}for(;es.normalize("NFKD"):s=>s;class Xt{constructor(e,t,i=0,n=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,n),this.bufferStart=i,this.normalize=r?l=>r(sl(l)):sl,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 ne(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=nr(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Be(e);let n=this.normalize(t);for(let r=0,o=i;;r++){let l=n.charCodeAt(r),a=this.match(l,o);if(r==n.length-1){if(a)return this.value=a,this;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,n=i+t[0].length;if(this.matchPos=Sn(this.text,n+(i==n?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,n,t)))return this.value={from:i,to:n,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||n.to<=t){let l=new qt(t,e.sliceString(t,i));return rs.set(e,l),l}if(n.from==t&&n.to==i)return n;let{text:r,from:o}=n;return o>t&&(r=e.sliceString(t,o)+r,o=t),n.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,n=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,n,t)))return this.value={from:i,to:n,match:t},this.matchPos=Sn(this.text,n+(i==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=qt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(zh.prototype[Symbol.iterator]=qh.prototype[Symbol.iterator]=function(){return this});function Wp(s){try{return new RegExp(s,Cr),!0}catch{return!1}}function Sn(s,e){if(e>=s.length)return e;let t=s.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function er(s){let e=String(s.state.doc.lineAt(s.state.selection.main.head).number),t=le("input",{class:"cm-textfield",name:"line",value:e}),i=le("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),s.dispatch({effects:Cn.of(!1)}),s.focus()):r.keyCode==13&&(r.preventDefault(),n())},onsubmit:r=>{r.preventDefault(),n()}},le("label",s.state.phrase("Go to line"),": ",t)," ",le("button",{class:"cm-button",type:"submit"},s.state.phrase("go")));function n(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=s,l=o.doc.lineAt(o.selection.main.head),[,a,h,c,f]=r,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),m=b.cursor(p.from+Math.max(0,Math.min(u,p.length)));s.dispatch({effects:[Cn.of(!1),T.scrollIntoView(m.from,{y:"center"})],selection:m}),s.focus()}return{dom:i}}const Cn=F.define(),rl=ye.define({create(){return!0},update(s,e){for(let t of e.effects)t.is(Cn)&&(s=t.value);return s},provide:s=>yn.from(s,e=>e?er:null)}),Hp=s=>{let e=mn(s,er);if(!e){let t=[Cn.of(!0)];s.state.field(rl,!1)==null&&t.push(F.appendConfig.of([rl,zp])),s.dispatch({effects:t}),e=mn(s,er)}return e&&e.dom.querySelector("input").select(),!0},zp=T.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),qp={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},$h=O.define({combine(s){return Pt(s,qp,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Sm(s){let e=[Gp,Up];return s&&e.push($h.of(s)),e}const $p=B.mark({class:"cm-selectionMatch"}),Kp=B.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ol(s,e,t,i){return(t==0||s(e.sliceDoc(t-1,t))!=G.Word)&&(i==e.doc.length||s(e.sliceDoc(i,i+1))!=G.Word)}function jp(s,e,t,i){return s(e.sliceDoc(t,t+1))==G.Word&&s(e.sliceDoc(i-1,i))==G.Word}const Up=ue.fromClass(class{constructor(s){this.decorations=this.getDeco(s)}update(s){(s.selectionSet||s.docChanged||s.viewportChanged)&&(this.decorations=this.getDeco(s.view))}getDeco(s){let e=s.state.facet($h),{state:t}=s,i=t.selection;if(i.ranges.length>1)return B.none;let n=i.main,r,o=null;if(n.empty){if(!e.highlightWordAroundCursor)return B.none;let a=t.wordAt(n.head);if(!a)return B.none;o=t.charCategorizer(n.head),r=t.sliceDoc(a.from,a.to)}else{let a=n.to-n.from;if(a200)return B.none;if(e.wholeWords){if(r=t.sliceDoc(n.from,n.to),o=t.charCategorizer(n.head),!(ol(o,t,n.from,n.to)&&jp(o,t,n.from,n.to)))return B.none}else if(r=t.sliceDoc(n.from,n.to).trim(),!r)return B.none}let l=[];for(let a of s.visibleRanges){let h=new Xt(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||ol(o,t,c,f))&&(n.empty&&c<=n.from&&f>=n.to?l.push(Kp.range(c,f)):(c>=n.to||f<=n.from)&&l.push($p.range(c,f)),l.length>e.maxMatches))return B.none}}return B.set(l)}},{decorations:s=>s.decorations}),Gp=T.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Jp=({state:s,dispatch:e})=>{let{selection:t}=s,i=b.create(t.ranges.map(n=>s.wordAt(n.head)||b.cursor(n.head)),t.mainIndex);return i.eq(t)?!1:(e(s.update({selection:i})),!0)};function Yp(s,e){let{main:t,ranges:i}=s.selection,n=s.wordAt(t.head),r=n&&n.from==t.from&&n.to==t.to;for(let o=!1,l=new Xt(s.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Xt(s.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=s.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const Xp=({state:s,dispatch:e})=>{let{ranges:t}=s.selection;if(t.some(r=>r.from===r.to))return Jp({state:s,dispatch:e});let i=s.sliceDoc(t[0].from,t[0].to);if(s.selection.ranges.some(r=>s.sliceDoc(r.from,r.to)!=i))return!1;let n=Yp(s,i);return n?(e(s.update({selection:s.selection.addRange(b.range(n.from,n.to),!1),effects:T.scrollIntoView(n.to)})),!0):!1},Zt=O.define({combine(s){return Pt(s,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new lg(e),scrollToMatch:e=>T.scrollIntoView(e)})}});class Kh{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||Wp(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 eg(this):new Qp(this)}getCursor(e,t=0,i){let n=e.doc?e:H.create({doc:e});return i==null&&(i=n.doc.length),this.regexp?Nt(this,n,t,i):It(this,n,t,i)}}class jh{constructor(e){this.spec=e}}function It(s,e,t,i){return new Xt(e.doc,s.unquoted,t,i,s.caseSensitive?void 0:n=>n.toLowerCase(),s.wholeWord?_p(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function _p(s,e){return(t,i,n,r)=>((r>t||r+n.length=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let r=It(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;)n(r.value.from,r.value.to)}}function Nt(s,e,t,i){return new zh(e.doc,s.search,{ignoreCase:!s.caseSensitive,test:s.wholeWord?Zp(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function An(s,e){return s.slice(oe(s,e,!1),e)}function Mn(s,e){return s.slice(e,oe(s,e))}function Zp(s){return(e,t,i)=>!i[0].length||(s(An(i.input,i.index))!=G.Word||s(Mn(i.input,i.index))!=G.Word)&&(s(Mn(i.input,i.index+i[0].length))!=G.Word||s(An(i.input,i.index+i[0].length))!=G.Word)}class eg extends jh{nextMatch(e,t,i){let n=Nt(this.spec,e,i,e.doc.length).next();return n.done&&(n=Nt(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,i){for(let n=1;;n++){let r=Math.max(t,i-n*1e4),o=Nt(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;n.push(i.value)}return n}highlight(e,t,i,n){let r=Nt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}}const Ai=F.define(),Ar=F.define(),ct=ye.define({create(s){return new os(tr(s).create(),null)},update(s,e){for(let t of e.effects)t.is(Ai)?s=new os(t.value.create(),s.panel):t.is(Ar)&&(s=new os(s.query,t.value?Mr:null));return s},provide:s=>yn.from(s,e=>e.panel)});class os{constructor(e,t){this.query=e,this.panel=t}}const tg=B.mark({class:"cm-searchMatch"}),ig=B.mark({class:"cm-searchMatch cm-searchMatch-selected"}),ng=ue.fromClass(class{constructor(s){this.view=s,this.decorations=this.highlight(s.state.field(ct))}update(s){let e=s.state.field(ct);(e!=s.startState.field(ct)||s.docChanged||s.selectionSet||s.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:s,panel:e}){if(!e||!s.spec.valid)return B.none;let{view:t}=this,i=new At;for(let n=0,r=t.visibleRanges,o=r.length;nr[n+1].from-2*250;)a=r[++n].to;s.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?ig:tg)})}return i.finish()}},{decorations:s=>s.decorations});function Ri(s){return e=>{let t=e.state.field(ct,!1);return t&&t.query.spec.valid?s(e,t):Jh(e)}}const Dn=Ri((s,{query:e})=>{let{to:t}=s.state.selection.main,i=e.nextMatch(s.state,t,t);if(!i)return!1;let n=b.single(i.from,i.to),r=s.state.facet(Zt);return s.dispatch({selection:n,effects:[Dr(s,i),r.scrollToMatch(n.main,s)],userEvent:"select.search"}),Gh(s),!0}),On=Ri((s,{query:e})=>{let{state:t}=s,{from:i}=t.selection.main,n=e.prevMatch(t,i,i);if(!n)return!1;let r=b.single(n.from,n.to),o=s.state.facet(Zt);return s.dispatch({selection:r,effects:[Dr(s,n),o.scrollToMatch(r.main,s)],userEvent:"select.search"}),Gh(s),!0}),sg=Ri((s,{query:e})=>{let t=e.matchAll(s.state,1e3);return!t||!t.length?!1:(s.dispatch({selection:b.create(t.map(i=>b.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),rg=({state:s,dispatch:e})=>{let t=s.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:n}=t.main,r=[],o=0;for(let l=new Xt(s.doc,s.sliceDoc(i,n));!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(s.update({selection:b.create(r,o),userEvent:"select.search.matches"})),!0},ll=Ri((s,{query:e})=>{let{state:t}=s,{from:i,to:n}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=[],l,a,h=[];if(r.from==i&&r.to==n&&(a=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(t,r.from,r.to),h.push(T.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-a.length;l=b.single(r.from-c,r.to-c),h.push(Dr(s,r)),h.push(t.facet(Zt).scrollToMatch(l.main,s))}return s.dispatch({changes:o,selection:l,effects:h,userEvent:"input.replace"}),!0}),og=Ri((s,{query:e})=>{if(s.state.readOnly)return!1;let t=e.matchAll(s.state,1e9).map(n=>{let{from:r,to:o}=n;return{from:r,to:o,insert:e.getReplacement(n)}});if(!t.length)return!1;let i=s.state.phrase("replaced $ matches",t.length)+".";return s.dispatch({changes:t,effects:T.announce.of(i),userEvent:"input.replace.all"}),!0});function Mr(s){return s.state.facet(Zt).createPanel(s)}function tr(s,e){var t,i,n,r,o;let l=s.selection.main,a=l.empty||l.to>l.from+100?"":s.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=s.facet(Zt);return new Kh({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(n=e==null?void 0:e.literal)!==null&&n!==void 0?n:h.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function Uh(s){let e=mn(s,Mr);return e&&e.dom.querySelector("[main-field]")}function Gh(s){let e=Uh(s);e&&e==s.root.activeElement&&e.select()}const Jh=s=>{let e=s.state.field(ct,!1);if(e&&e.panel){let t=Uh(s);if(t&&t!=s.root.activeElement){let i=tr(s.state,e.query.spec);i.valid&&s.dispatch({effects:Ai.of(i)}),t.focus(),t.select()}}else s.dispatch({effects:[Ar.of(!0),e?Ai.of(tr(s.state,e.query.spec)):F.appendConfig.of(hg)]});return!0},Yh=s=>{let e=s.state.field(ct,!1);if(!e||!e.panel)return!1;let t=mn(s,Mr);return t&&t.dom.contains(s.root.activeElement)&&s.focus(),s.dispatch({effects:Ar.of(!1)}),!0},Cm=[{key:"Mod-f",run:Jh,scope:"editor search-panel"},{key:"F3",run:Dn,shift:On,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Dn,shift:On,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Yh,scope:"editor search-panel"},{key:"Mod-Shift-l",run:rg},{key:"Mod-Alt-g",run:Hp},{key:"Mod-d",run:Xp,preventDefault:!0}];class lg{constructor(e){this.view=e;let t=this.query=e.state.field(ct).query.spec;this.commit=this.commit.bind(this),this.searchField=le("input",{value:t.search,placeholder:Se(e,"Find"),"aria-label":Se(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=le("input",{value:t.replace,placeholder:Se(e,"Replace"),"aria-label":Se(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=le("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=le("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=le("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(n,r,o){return le("button",{class:"cm-button",name:n,onclick:r,type:"button"},o)}this.dom=le("div",{onkeydown:n=>this.keydown(n),class:"cm-search"},[this.searchField,i("next",()=>Dn(e),[Se(e,"next")]),i("prev",()=>On(e),[Se(e,"previous")]),i("select",()=>sg(e),[Se(e,"all")]),le("label",null,[this.caseField,Se(e,"match case")]),le("label",null,[this.reField,Se(e,"regexp")]),le("label",null,[this.wordField,Se(e,"by word")]),...e.state.readOnly?[]:[le("br"),this.replaceField,i("replace",()=>ll(e),[Se(e,"replace")]),i("replaceAll",()=>og(e),[Se(e,"replace all")])],le("button",{name:"close",onclick:()=>Yh(e),"aria-label":Se(e,"close"),type:"button"},["×"])])}commit(){let e=new Kh({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:Ai.of(e)}))}keydown(e){iu(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?On:Dn)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ll(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Ai)&&!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(Zt).top}}function Se(s,e){return s.state.phrase(e)}const Zi=30,en=/[\s\.,:;?!]/;function Dr(s,{from:e,to:t}){let i=s.state.doc.lineAt(e),n=s.state.doc.lineAt(t).to,r=Math.max(i.from,e-Zi),o=Math.min(n,t+Zi),l=s.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-Zi;a--)if(!en.test(l[a-1])&&en.test(l[a])){l=l.slice(0,a);break}}return T.announce.of(`${s.state.phrase("current match")}. ${l} ${s.state.phrase("on line")} ${i.number}.`)}const ag=T.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"}}),hg=[ct,Bt.low(ng),ag];class Xh{constructor(e,t,i){this.state=e,this.pos=t,this.explicit=i,this.abortListeners=[]}tokenBefore(e){let t=me(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),n=t.text.slice(i-t.from,this.pos-t.from),r=n.search(_h(e,!1));return r<0?null:{from:i+r,to:this.pos,text:n.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function al(s){let e=Object.keys(s).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function cg(s){let e=Object.create(null),t=Object.create(null);for(let{label:n}of s){e[n[0]]=!0;for(let r=1;rtypeof n=="string"?{label:n}:n),[t,i]=e.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:cg(e);return n=>{let r=n.matchBefore(i);return r||n.explicit?{from:r?r.from:n.pos,options:e,validFor:t}:null}}function Am(s,e){return t=>{for(let i=me(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(s.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class hl{constructor(e,t,i,n){this.completion=e,this.source=t,this.match=i,this.score=n}}function ft(s){return s.selection.main.from}function _h(s,e){var t;let{source:i}=s,n=e&&i[0]!="^",r=i[i.length-1]!="$";return!n&&!r?s:new RegExp(`${n?"^":""}(?:${i})${r?"$":""}`,(t=s.flags)!==null&&t!==void 0?t:s.ignoreCase?"i":"")}const Qh=nt.define();function ug(s,e,t,i){let{main:n}=s.selection,r=t-n.from,o=i-n.from;return Object.assign(Object.assign({},s.changeByRange(l=>l!=n&&t!=i&&s.sliceDoc(l.from+r,l.from+o)!=s.sliceDoc(t,i)?{range:l}:{changes:{from:l.from+r,to:i==n.from?l.to:l.from+o,insert:e},range:b.cursor(l.from+r+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const cl=new WeakMap;function dg(s){if(!Array.isArray(s))return s;let e=cl.get(s);return e||cl.set(s,e=fg(s)),e}const Tn=F.define(),Mi=F.define();class pg{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(A=nr(x))!=A.toLowerCase()?1:A!=A.toUpperCase()?2:0;(!w||C==1&&g||v==0&&C!=0)&&(t[f]==x||i[f]==x&&(u=!0)?o[f++]=w:o.length&&(y=!1)),v=C,w+=Be(x)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?!1:this.result((n[0]?-700:0)+-200+-1100,n,e)}result(e,t,i){let n=[],r=0;for(let o of t){let l=o+(this.astral?Be(ne(i,o)):1);r&&n[r-1]==o?n[r-1]=l:(n[r++]=o,n[r++]=l)}return this.ret(e-i.length,n)}}const re=O.define({combine(s){return Pt(s,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:gg,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>fl(e(i),t(i)),optionClass:(e,t)=>i=>fl(e(i),t(i)),addToOptions:(e,t)=>e.concat(t)})}});function fl(s,e){return s?e?s+" "+e:s:e}function gg(s,e,t,i,n,r){let o=s.textDirection==X.RTL,l=o,a=!1,h="top",c,f,u=e.left-n.left,d=n.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||w>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function mg(s){let e=s.addToOptions.slice();return s.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(n=>"cm-completionIcon-"+n)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,n,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function ls(s,e,t){if(s<=t)return{from:0,to:s};if(e<0&&(e=0),e<=s>>1){let n=Math.floor(e/t);return{from:n*t,to:(n+1)*t}}let i=Math.floor((s-e)/t);return{from:s-(i+1)*t,to:s-i*t}}class yg{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let n=e.state.field(t),{options:r,selected:o}=n.open,l=e.state.facet(re);this.optionContent=mg(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=ls(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(re).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Mi.of(null)})}),this.showOptions(r,n.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=n){let{options:r,selected:o,disabled:l}=i.open;(!n.open||n.open.options!=r)&&(this.range=ls(r.length,o,e.state.facet(re).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=n.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=ls(t.options.length,t.selected,this.view.state.facet(re).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:n}=i;if(!n)return;let r=typeof n=="string"?document.createTextNode(n):n(i);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>Ne(this.view.state,o,"completion info")):this.addInfoPane(r,i)}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:n,destroy:r}=e;i.appendChild(n),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)i.nodeName!="LI"||!i.id?n--:n==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return t&&wg(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return n.top>Math.min(r.bottom,t.bottom)-10||n.bottomi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)n.appendChild(h.header(h));else{let d=n.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=n.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.tonew yg(t,s,e)}function wg(s,e){let t=s.getBoundingClientRect(),i=e.getBoundingClientRect(),n=t.height/s.offsetHeight;i.topt.bottom&&(s.scrollTop+=(i.bottom-t.bottom)/n)}function ul(s){return(s.boost||0)*100+(s.apply?10:0)+(s.info?5:0)+(s.type?1:0)}function xg(s,e){let t=[],i=null,n=a=>{t.push(a);let{section:h}=a.completion;if(h){i||(i=[]);let c=typeof h=="string"?h:h.name;i.some(f=>f.name==c)||i.push(typeof h=="string"?{name:c}:h)}};for(let a of s)if(a.hasResult()){let h=a.result.getMatch;if(a.result.filter===!1)for(let c of a.result.options)n(new hl(c,a.source,h?h(c):[],1e9-t.length));else{let c=new pg(e.sliceDoc(a.from,a.to));for(let f of a.result.options)if(c.match(f.label)){let u=f.displayLabel?h?h(f,c.matched):[]:c.matched;n(new hl(f,a.source,u,c.score+(f.boost||0)))}}}if(i){let a=Object.create(null),h=0,c=(f,u)=>{var d,p;return((d=f.rank)!==null&&d!==void 0?d:1e9)-((p=u.rank)!==null&&p!==void 0?p:1e9)||(f.namec.score-h.score||l(h.completion,c.completion))){let h=a.completion;!o||o.label!=h.label||o.detail!=h.detail||o.type!=null&&h.type!=null&&o.type!=h.type||o.apply!=h.apply||o.boost!=h.boost?r.push(a):ul(a.completion)>ul(o)&&(r[r.length-1]=a),o=a.completion}return r}class Ft{constructor(e,t,i,n,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=n,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Ft(this.options,dl(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,n,r){let o=xg(e,t);if(!o.length)return n&&e.some(a=>a.state==1)?new Ft(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let l=t.facet(re).selectOnOpen?0:-1;if(n&&n.selected!=l&&n.selected!=-1){let a=n.options[n.selected].completion;for(let h=0;hh.hasResult()?Math.min(a,h.from):a,1e8),create:Ag,above:r.aboveCursor},n?n.timestamp:Date.now(),l,!1)}map(e){return new Ft(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class Bn{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new Bn(Sg,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(re),r=(i.override||t.languageDataAt("autocomplete",ft(t)).map(dg)).map(l=>(this.active.find(h=>h.source==l)||new xe(l,this.active.some(h=>h.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((l,a)=>l==this.active[a])&&(r=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!vg(r,this.active)?o=Ft.build(r,t,this.id,o,i):o&&o.disabled&&!r.some(l=>l.state==1)&&(o=null),!o&&r.every(l=>l.state!=1)&&r.some(l=>l.hasResult())&&(r=r.map(l=>l.hasResult()?new xe(l.source,0):l));for(let l of e.effects)l.is(ec)&&(o=o&&o.setSelected(l.value,this.id));return r==this.active&&o==this.open?this:new Bn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:kg}}function vg(s,e){if(s==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=s+"-"+e),t}const Sg=[];function ir(s){return s.isUserEvent("input.type")?"input":s.isUserEvent("delete.backward")?"delete":null}class xe{constructor(e,t,i=-1){this.source=e,this.state=t,this.explicitPos=i}hasResult(){return!1}update(e,t){let i=ir(e),n=this;i?n=n.handleUserEvent(e,i,t):e.docChanged?n=n.handleChange(e):e.selection&&n.state!=0&&(n=new xe(n.source,0));for(let r of e.effects)if(r.is(Tn))n=new xe(n.source,1,r.value?ft(e.state):-1);else if(r.is(Mi))n=new xe(n.source,0);else if(r.is(Zh))for(let o of r.value)o.source==n.source&&(n=o);return n}handleUserEvent(e,t,i){return t=="delete"||!i.activateOnTyping?this.map(e.changes):new xe(this.source,1)}handleChange(e){return e.changes.touchesRange(ft(e.startState))?new xe(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new xe(this.source,this.state,e.mapPos(this.explicitPos))}}class $t extends xe{constructor(e,t,i,n,r){super(e,2,t),this.result=i,this.from=n,this.to=r}hasResult(){return!0}handleUserEvent(e,t,i){var n;let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=ft(e.state);if((this.explicitPos<0?l<=r:lo||t=="delete"&&ft(e.startState)==this.from)return new xe(this.source,t=="input"&&i.activateOnTyping?1:0);let a=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),h;return Cg(this.result.validFor,e.state,r,o)?new $t(this.source,a,this.result,r,o):this.result.update&&(h=this.result.update(this.result,r,o,new Xh(e.state,l,a>=0)))?new $t(this.source,a,h,h.from,(n=h.to)!==null&&n!==void 0?n:ft(e.state)):new xe(this.source,1,a)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new xe(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new $t(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function Cg(s,e,t,i){if(!s)return!1;let n=e.sliceDoc(t,i);return typeof s=="function"?s(n,t,i,e):_h(s,!0).test(n)}const Zh=F.define({map(s,e){return s.map(t=>t.map(e))}}),ec=F.define(),Ae=ye.define({create(){return Bn.start()},update(s,e){return s.update(e)},provide:s=>[Fa.from(s,e=>e.tooltip),T.contentAttributes.from(s,e=>e.attrs)]});function tc(s,e){const t=e.completion.apply||e.completion.label;let i=s.state.field(Ae).active.find(n=>n.source==e.source);return i instanceof $t?(typeof t=="string"?s.dispatch(Object.assign(Object.assign({},ug(s.state,t,i.from,i.to)),{annotations:Qh.of(e.completion)})):t(s,e.completion,i.from,i.to),!0):!1}const Ag=bg(Ae,tc);function tn(s,e="option"){return t=>{let i=t.state.field(Ae,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+n*(s?1:-1):s?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:ec.of(l)}),!0}}const Mg=s=>{let e=s.state.field(Ae,!1);return s.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamps.state.field(Ae,!1)?(s.dispatch({effects:Tn.of(!0)}),!0):!1,Og=s=>{let e=s.state.field(Ae,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(s.dispatch({effects:Mi.of(null)}),!0)};class Tg{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Bg=50,Pg=1e3,Lg=ue.fromClass(class{constructor(s){this.view=s,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of s.state.field(Ae).active)e.state==1&&this.startQuery(e)}update(s){let e=s.state.field(Ae);if(!s.selectionSet&&!s.docChanged&&s.startState.field(Ae)==e)return;let t=s.transactions.some(n=>(n.selection||n.docChanged)&&!ir(n));for(let n=0;nBg&&Date.now()-r.time>Pg){for(let o of r.context.abortListeners)try{o()}catch(l){Ne(this.view.state,l)}r.context.abortListeners=null,this.running.splice(n--,1)}else r.updates.push(...s.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),s.transactions.some(n=>n.effects.some(r=>r.is(Tn)))&&(this.pendingStart=!0);let i=this.pendingStart?50:s.state.facet(re).activateOnTypingDelay;if(this.debounceUpdate=e.active.some(n=>n.state==1&&!this.running.some(r=>r.active.source==n.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let n of s.transactions)ir(n)=="input"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:s}=this.view,e=s.field(Ae);for(let t of e.active)t.state==1&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t)}startQuery(s){let{state:e}=this.view,t=ft(e),i=new Xh(e,t,s.explicitPos==t),n=new Tg(s,i);this.running.push(n),Promise.resolve(s.source(i)).then(r=>{n.context.aborted||(n.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:Mi.of(null)}),Ne(this.view.state,r)})}scheduleAccept(){this.running.every(s=>s.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(re).updateSyncTime))}accept(){var s;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(re);for(let i=0;io.source==n.active.source);if(r&&r.state==1)if(n.done==null){let o=new xe(n.active.source,0);for(let l of n.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:Zh.of(e)})}},{eventHandlers:{blur(s){let e=this.view.state.field(Ae,!1);if(e&&e.tooltip&&this.view.state.facet(re).closeOnBlur){let t=e.open&&Va(this.view,e.open.tooltip);(!t||!t.dom.contains(s.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Mi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Tn.of(!1)}),20),this.composing=0}}}),ic=T.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",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&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",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Rg{constructor(e,t,i,n){this.field=e,this.line=t,this.from=i,this.to=n}}class Or{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,he.TrackDel),i=e.mapPos(this.to,1,he.TrackDel);return t==null||i==null?null:new Or(this.field,t,i)}}class Tr{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],n=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew Or(a.field,n[a.line]+a.from,n[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],n=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let l=r[1]?+r[1]:null,a=r[2]||r[3]||"",h=-1;for(let c=0;c=h&&f.field++}n.push(new Rg(h,i.length,r.index,r.index+a.length)),o=o.slice(0,r.index)+a+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 a of n)a.line==i.length&&a.from>l.index&&(a.from--,a.to--)}i.push(o)}return new Tr(i,n)}}let Eg=B.widget({widget:new class extends Lt{toDOM(){let s=document.createElement("span");return s.className="cm-snippetFieldPosition",s}ignoreEvent(){return!1}}}),Ig=B.mark({class:"cm-snippetField"});class ei{constructor(e,t){this.ranges=e,this.active=t,this.deco=B.set(e.map(i=>(i.from==i.to?Eg:Ig).range(i.from,i.to)))}map(e){let t=[];for(let i of this.ranges){let n=i.map(e);if(!n)return null;t.push(n)}return new ei(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 Ei=F.define({map(s,e){return s&&s.map(e)}}),Ng=F.define(),Di=ye.define({create(){return null},update(s,e){for(let t of e.effects){if(t.is(Ei))return t.value;if(t.is(Ng)&&s)return new ei(s.ranges,t.value)}return s&&e.docChanged&&(s=s.map(e.changes)),s&&e.selection&&!s.selectionInsideField(e.selection)&&(s=null),s},provide:s=>T.decorations.from(s,e=>e?e.deco:B.none)});function Br(s,e){return b.create(s.filter(t=>t.field==e).map(t=>b.range(t.from,t.to)))}function Fg(s){let e=Tr.parse(s);return(t,i,n,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,n),a={changes:{from:n,to:r,insert:V.of(o)},scrollIntoView:!0,annotations:i?[Qh.of(i),Q.userEvent.of("input.complete")]:void 0};if(l.length&&(a.selection=Br(l,0)),l.some(h=>h.field>0)){let h=new ei(l,0),c=a.effects=[Ei.of(h)];t.state.field(Di,!1)===void 0&&c.push(F.appendConfig.of([Di,qg,$g,ic]))}t.dispatch(t.state.update(a))}}function nc(s){return({state:e,dispatch:t})=>{let i=e.field(Di,!1);if(!i||s<0&&i.active==0)return!1;let n=i.active+s,r=s>0&&!i.ranges.some(o=>o.field==n+s);return t(e.update({selection:Br(i.ranges,n),effects:Ei.of(r?null:new ei(i.ranges,n)),scrollIntoView:!0})),!0}}const Vg=({state:s,dispatch:e})=>s.field(Di,!1)?(e(s.update({effects:Ei.of(null)})),!0):!1,Wg=nc(1),Hg=nc(-1),zg=[{key:"Tab",run:Wg,shift:Hg},{key:"Escape",run:Vg}],pl=O.define({combine(s){return s.length?s[0]:zg}}),qg=Bt.highest(dr.compute([pl],s=>s.facet(pl)));function Mm(s,e){return Object.assign(Object.assign({},e),{apply:Fg(s)})}const $g=T.domEventHandlers({mousedown(s,e){let t=e.state.field(Di,!1),i;if(!t||(i=e.posAtCoords({x:s.clientX,y:s.clientY}))==null)return!1;let n=t.ranges.find(r=>r.from<=i&&r.to>=i);return!n||n.field==t.active?!1:(e.dispatch({selection:Br(t.ranges,n.field),effects:Ei.of(t.ranges.some(r=>r.field>n.field)?new ei(t.ranges,n.field):null),scrollIntoView:!0}),!0)}}),Oi={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},St=F.define({map(s,e){let t=e.mapPos(s,-1,he.TrackAfter);return t??void 0}}),Pr=new class extends Ct{};Pr.startSide=1;Pr.endSide=-1;const sc=ye.define({create(){return $.empty},update(s,e){if(s=s.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);s=s.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(St)&&(s=s.update({add:[Pr.range(t.value,t.value+1)]}));return s}});function Dm(){return[jg,sc]}const as="()[]{}<>";function rc(s){for(let e=0;e{if((Kg?s.composing:s.compositionStarted)||s.state.readOnly)return!1;let n=s.state.selection.main;if(i.length>2||i.length==2&&Be(ne(i,0))==1||e!=n.from||t!=n.to)return!1;let r=Gg(s.state,i);return r?(s.dispatch(r),!0):!1}),Ug=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let i=oc(s,s.selection.main.head).brackets||Oi.brackets,n=null,r=s.changeByRange(o=>{if(o.empty){let l=Jg(s.doc,o.head);for(let a of i)if(a==l&&qn(s.doc,o.head)==rc(ne(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:n=o}});return n||e(s.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!n},Om=[{key:"Backspace",run:Ug}];function Gg(s,e){let t=oc(s,s.selection.main.head),i=t.brackets||Oi.brackets;for(let n of i){let r=rc(ne(n,0));if(e==n)return r==n?_g(s,n,i.indexOf(n+n+n)>-1,t):Yg(s,n,r,t.before||Oi.before);if(e==r&&lc(s,s.selection.main.from))return Xg(s,n,r)}return null}function lc(s,e){let t=!1;return s.field(sc).between(0,s.doc.length,i=>{i==e&&(t=!0)}),t}function qn(s,e){let t=s.sliceString(e,e+2);return t.slice(0,Be(ne(t,0)))}function Jg(s,e){let t=s.sliceString(e-2,e);return Be(ne(t,0))==t.length?t:t.slice(1)}function Yg(s,e,t,i){let n=null,r=s.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:St.of(o.to+e.length),range:b.range(o.anchor+e.length,o.head+e.length)};let l=qn(s.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:St.of(o.head+e.length),range:b.cursor(o.head+e.length)}:{range:n=o}});return n?null:s.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Xg(s,e,t){let i=null,n=s.changeByRange(r=>r.empty&&qn(s.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:b.cursor(r.head+t.length)}:i={range:r});return i?null:s.update(n,{scrollIntoView:!0,userEvent:"input.type"})}function _g(s,e,t,i){let n=i.stringPrefixes||Oi.stringPrefixes,r=null,o=s.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:St.of(l.to+e.length),range:b.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=qn(s.doc,a),c;if(h==e){if(gl(s,a))return{changes:{insert:e+e,from:a},effects:St.of(a+e.length),range:b.cursor(a+e.length)};if(lc(s,a)){let u=t&&s.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(t&&s.sliceDoc(a-2*e.length,a)==e+e&&(c=ml(s,a-2*e.length,n))>-1&&gl(s,c))return{changes:{insert:e+e+e+e,from:a},effects:St.of(a+e.length),range:b.cursor(a+e.length)};if(s.charCategorizer(a)(h)!=G.Word&&ml(s,a,n)>-1&&!Qg(s,a,e,n))return{changes:{insert:e+e,from:a},effects:St.of(a+e.length),range:b.cursor(a+e.length)}}return{range:r=l}});return r?null:s.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function gl(s,e){let t=me(s).resolveInner(e+1);return t.parent&&t.from==e}function Qg(s,e,t,i){let n=me(s).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=s.sliceDoc(n.from,Math.min(n.to,n.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=n.firstChild;for(;c&&c.from==n.from&&c.to-c.from>t.length+a;){if(s.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=n.to==e&&n.parent;if(!h)break;n=h}return!1}function ml(s,e,t){let i=s.charCategorizer(e);if(i(s.sliceDoc(e-1,e))!=G.Word)return e;for(let n of t){let r=e-n.length;if(s.sliceDoc(r,e)==n&&i(s.sliceDoc(r-1,r))!=G.Word)return r}return-1}function Tm(s={}){return[Ae,re.of(s),Lg,em,ic]}const Zg=[{key:"Ctrl-Space",run:Dg},{key:"Escape",run:Og},{key:"ArrowDown",run:tn(!0)},{key:"ArrowUp",run:tn(!1)},{key:"PageDown",run:tn(!0,"page")},{key:"PageUp",run:tn(!1,"page")},{key:"Enter",run:Mg}],em=Bt.highest(dr.computeN([re],s=>s.facet(re).defaultKeymap?[Zg]:[]));export{rd as A,pm as B,Pn as C,Ru as D,T as E,gm as F,mm as G,fm as H,Y as I,am as J,Am as K,Us as L,fg as M,pr as N,b as O,$a as P,Mm as Q,dm as R,nh as S,K as T,um as U,id as V,Ua as W,xd as X,H as a,sm as b,xm as c,im as d,nm as e,wm as f,Dm as g,lm as h,Sm as i,Om as j,dr as k,km as l,Cm as m,vm as n,Zg as o,Tm as p,rm as q,om as r,ym as s,bm as t,me as u,ge as v,R as w,_u as x,M as y,hm as z}; +`);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 n=this.rangeIndex;;){let r=this.ranges[n].to;if(r>=i||(t=t.slice(0,r-(i-t.length)),n++,n==this.ranges.length))break;let o=this.ranges[n].from,l=this.lineAfter(o);t+=l,i=o+l.length}return{line:t,end:i}}skipGapsTo(e,t,i){for(;;){let n=this.ranges[this.rangeIndex].to,r=e+t;if(i>0?n>r:n>=r)break;let o=this.ranges[++this.rangeIndex].from;t+=o-n}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,n+=this.chunk.length-o}return this.chunk.push(e,t,i,n),r}parseLine(e){let{line:t,end:i}=this.nextLine(),n=0,{streamParser:r}=this.lang,o=new ih(t,e?e.state.tabSize:4,e?Tt(e.state):2);if(o.eol())r.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=rh(r.token,o,this.state);if(l&&(n=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,4,n)),o.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return n}throw new Error("Stream parser failed to advance stream.")}const xr=Object.create(null),Ci=[ge.none],Td=new pr(Ci),Yo=[],Xo=Object.create(null),oh=Object.create(null);for(let[s,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"]])oh[s]=ah(xr,e);class lh{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),oh)}resolve(e){return e?this.table[e]||(this.table[e]=ah(this.extra,e)):0}}const Bd=new lh(xr);function ns(s,e){Yo.indexOf(s)>-1||(Yo.push(s),console.warn(e))}function ah(s,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=s[h]||M[h];c?typeof c=="function"?a.length?a=a.map(c):ns(h,`Modifier ${h} used at start of tag`):a.length?ns(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:ns(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),n=i+" "+t.map(l=>l.id),r=Xo[n];if(r)return r.id;let o=Xo[n]=ge.define({id:Ci.length,name:i,props:[Zu({[i]:t})]});return Ci.push(o),o.id}function Pd(s){let e=ge.define({id:Ci.length,name:"Document",props:[kt.add(()=>s)],top:!0});return Ci.push(e),e}X.RTL,X.LTR;const Ld=s=>{let{state:e}=s,t=e.doc.lineAt(e.selection.main.from),i=kr(s.state,t.from);return i.line?Rd(s):i.block?Id(s):!1};function vr(s,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let n=s(e,t);return n?(i(t.update(n)),!0):!1}}const Rd=vr(Vd,0),Ed=vr(hh,0),Id=vr((s,e)=>hh(s,e,Fd(e)),0);function kr(s,e){let t=s.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const oi=50;function Nd(s,{open:e,close:t},i,n){let r=s.sliceDoc(i-oi,i),o=s.sliceDoc(n,n+oi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:n+a,margin:a&&1}};let c,f;n-i<=2*oi?c=f=s.sliceDoc(i,n):(c=s.sliceDoc(i,i+oi),f=s.sliceDoc(n-oi,n));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:n-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function Fd(s){let e=[];for(let t of s.selection.ranges){let i=s.doc.lineAt(t.from),n=t.to<=i.to?i:s.doc.lineAt(t.to),r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=n.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:n.to})}return e}function hh(s,e,t=e.selection.ranges){let i=t.map(r=>kr(e,r.from).block);if(!i.every(r=>r))return null;let n=t.map((r,o)=>Nd(e,i[o],r.from,r.to));if(s!=2&&!n.every(r=>r))return{changes:e.changes(t.map((r,o)=>n[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(s!=1&&n.some(r=>r)){let r=[];for(let o=0,l;on&&(r==o||o>f.from)){n=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,p=f.text.slice(u,u+h.length)==h?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(s!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}const Xs=nt.define(),Wd=nt.define(),Hd=O.define(),ch=O.define({combine(s){return Pt(s,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,n)=>e(i,n)||t(i,n)})}}),fh=ye.define({create(){return Xe.empty},update(s,e){let t=e.state.facet(ch),i=e.annotation(Xs);if(i){let a=ve.fromTransaction(e,i.selection),h=i.side,c=h==0?s.undone:s.done;return a?c=kn(c,c.length,t.minDepth,a):c=ph(c,e.startState.selection),new Xe(h==0?i.rest:c,h==0?c:i.rest)}let n=e.annotation(Wd);if((n=="full"||n=="before")&&(s=s.isolate()),e.annotation(Q.addToHistory)===!1)return e.changes.empty?s:s.addMapping(e.changes.desc);let r=ve.fromTransaction(e),o=e.annotation(Q.time),l=e.annotation(Q.userEvent);return r?s=s.addChanges(r,o,l,t,e):e.selection&&(s=s.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(n=="full"||n=="after")&&(s=s.isolate()),s},toJSON(s){return{done:s.done.map(e=>e.toJSON()),undone:s.undone.map(e=>e.toJSON())}},fromJSON(s){return new Xe(s.done.map(ve.fromJSON),s.undone.map(ve.fromJSON))}});function xm(s={}){return[fh,ch.of(s),T.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?uh:e.inputType=="historyRedo"?_s:null;return i?(e.preventDefault(),i(t)):!1}})]}function Vn(s,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let n=t.field(fh,!1);if(!n)return!1;let r=n.pop(s,t,e);return r?(i(r),!0):!1}}const uh=Vn(0,!1),_s=Vn(1,!1),zd=Vn(0,!0),qd=Vn(1,!0);class ve{constructor(e,t,i,n,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=n,this.selectionsAfter=r}setSelAfter(e){return new ve(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(n=>n.toJSON())}}static fromJSON(e){return new ve(e.changes&&te.fromJSON(e.changes),[],e.mapped&&_e.fromJSON(e.mapped),e.startSelection&&b.fromJSON(e.startSelection),e.selectionsAfter.map(b.fromJSON))}static fromTransaction(e,t){let i=Re;for(let n of e.startState.facet(Hd)){let r=n(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new ve(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Re)}static selection(e){return new ve(void 0,Re,void 0,void 0,e)}}function kn(s,e,t,i){let n=e+1>t+20?e-t-1:0,r=s.slice(n,e);return r.push(i),r}function $d(s,e){let t=[],i=!1;return s.iterChangedRanges((n,r)=>t.push(n,r)),e.iterChangedRanges((n,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function Kd(s,e){return s.ranges.length==e.ranges.length&&s.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function dh(s,e){return s.length?e.length?s.concat(e):s:e}const Re=[],jd=200;function ph(s,e){if(s.length){let t=s[s.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-jd));return i.length&&i[i.length-1].eq(e)?s:(i.push(e),kn(s,s.length-1,1e9,t.setSelAfter(i)))}else return[ve.selection([e])]}function Ud(s){let e=s[s.length-1],t=s.slice();return t[s.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function ss(s,e){if(!s.length)return s;let t=s.length,i=Re;for(;t;){let n=Gd(s[t-1],e,i);if(n.changes&&!n.changes.empty||n.effects.length){let r=s.slice(0,t);return r[t-1]=n,r}else e=n.mapped,t--,i=n.selectionsAfter}return i.length?[ve.selection(i)]:Re}function Gd(s,e,t){let i=dh(s.selectionsAfter.length?s.selectionsAfter.map(l=>l.map(e)):Re,t);if(!s.changes)return ve.selection(i);let n=s.changes.map(e),r=e.mapDesc(s.changes,!0),o=s.mapped?s.mapped.composeDesc(r):r;return new ve(n,F.mapEffects(s.effects,e),o,s.startSelection.map(r),i)}const Jd=/^(input\.type|delete)($|\.)/;class Xe{constructor(e,t,i=0,n=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new Xe(this.done,this.undone):this}addChanges(e,t,i,n,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||Jd.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?s.moveByChar(t,e):Wn(t,e))}function de(s){return s.textDirectionAt(s.state.selection.main.head)==X.LTR}const mh=s=>gh(s,!de(s)),yh=s=>gh(s,de(s));function bh(s,e){return We(s,t=>t.empty?s.moveByGroup(t,e):Wn(t,e))}const Yd=s=>bh(s,!de(s)),Xd=s=>bh(s,de(s));function _d(s,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(s.sliceDoc(e.from,e.to)))||e.firstChild}function Hn(s,e,t){let i=me(s).resolveInner(e.head),n=t?R.closedBy:R.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;_d(s,h,n)?i=h:a=t?h.to:h.from}let r=i.type.prop(n),o,l;return r&&(o=t?Ye(s,i.from,1):Ye(s,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 Qd=s=>We(s,e=>Hn(s.state,e,!de(s))),Zd=s=>We(s,e=>Hn(s.state,e,de(s)));function wh(s,e){return We(s,t=>{if(!t.empty)return Wn(t,e);let i=s.moveVertically(t,e);return i.head!=t.head?i:s.moveToLineBoundary(t,e)})}const xh=s=>wh(s,!1),vh=s=>wh(s,!0);function kh(s){let e=s.scrollDOM.clientHeighto.empty?s.moveVertically(o,e,t.height):Wn(o,e));if(n.eq(i.selection))return!1;let r;if(t.selfScroll){let o=s.coordsAtPos(i.selection.main.head),l=s.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomSh(s,!1),Qs=s=>Sh(s,!0);function mt(s,e,t){let i=s.lineBlockAt(e.head),n=s.moveToLineBoundary(e,t);if(n.head==e.head&&n.head!=(t?i.to:i.from)&&(n=s.moveToLineBoundary(e,t,!1)),!t&&n.head==i.from&&i.length){let r=/^\s*/.exec(s.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(n=b.cursor(i.from+r))}return n}const ep=s=>We(s,e=>mt(s,e,!0)),tp=s=>We(s,e=>mt(s,e,!1)),ip=s=>We(s,e=>mt(s,e,!de(s))),np=s=>We(s,e=>mt(s,e,de(s))),sp=s=>We(s,e=>b.cursor(s.lineBlockAt(e.head).from,1)),rp=s=>We(s,e=>b.cursor(s.lineBlockAt(e.head).to,-1));function op(s,e,t){let i=!1,n=Qt(s.selection,r=>{let o=Ye(s,r.head,-1)||Ye(s,r.head,1)||r.head>0&&Ye(s,r.head-1,1)||r.headop(s,e,!1);function Ie(s,e){let t=Qt(s.state.selection,i=>{let n=e(i);return b.range(i.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return t.eq(s.state.selection)?!1:(s.dispatch(Qe(s.state,t)),!0)}function Ch(s,e){return Ie(s,t=>s.moveByChar(t,e))}const Ah=s=>Ch(s,!de(s)),Mh=s=>Ch(s,de(s));function Dh(s,e){return Ie(s,t=>s.moveByGroup(t,e))}const ap=s=>Dh(s,!de(s)),hp=s=>Dh(s,de(s)),cp=s=>Ie(s,e=>Hn(s.state,e,!de(s))),fp=s=>Ie(s,e=>Hn(s.state,e,de(s)));function Oh(s,e){return Ie(s,t=>s.moveVertically(t,e))}const Th=s=>Oh(s,!1),Bh=s=>Oh(s,!0);function Ph(s,e){return Ie(s,t=>s.moveVertically(t,e,kh(s).height))}const Qo=s=>Ph(s,!1),Zo=s=>Ph(s,!0),up=s=>Ie(s,e=>mt(s,e,!0)),dp=s=>Ie(s,e=>mt(s,e,!1)),pp=s=>Ie(s,e=>mt(s,e,!de(s))),gp=s=>Ie(s,e=>mt(s,e,de(s))),mp=s=>Ie(s,e=>b.cursor(s.lineBlockAt(e.head).from)),yp=s=>Ie(s,e=>b.cursor(s.lineBlockAt(e.head).to)),el=({state:s,dispatch:e})=>(e(Qe(s,{anchor:0})),!0),tl=({state:s,dispatch:e})=>(e(Qe(s,{anchor:s.doc.length})),!0),il=({state:s,dispatch:e})=>(e(Qe(s,{anchor:s.selection.main.anchor,head:0})),!0),nl=({state:s,dispatch:e})=>(e(Qe(s,{anchor:s.selection.main.anchor,head:s.doc.length})),!0),bp=({state:s,dispatch:e})=>(e(s.update({selection:{anchor:0,head:s.doc.length},userEvent:"select"})),!0),wp=({state:s,dispatch:e})=>{let t=zn(s).map(({from:i,to:n})=>b.range(i,Math.min(n+1,s.doc.length)));return e(s.update({selection:b.create(t),userEvent:"select"})),!0},xp=({state:s,dispatch:e})=>{let t=Qt(s.selection,i=>{var n;let r=me(s).resolveStack(i.from,1);for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&(!((n=l.parent)===null||n===void 0)&&n.parent))return b.range(l.to,l.from)}return i});return e(Qe(s,t)),!0},vp=({state:s,dispatch:e})=>{let t=s.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(Qe(s,i)),!0):!1};function Li(s,e){if(s.state.readOnly)return!1;let t="delete.selection",{state:i}=s,n=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=Qi(s,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Qi(s,o,!1),l=Qi(s,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:b.cursor(o,on(s)))i.between(e,e,(n,r)=>{ne&&(e=t?r:n)});return e}const Lh=(s,e)=>Li(s,t=>{let i=t.from,{state:n}=s,r=n.doc.lineAt(i),o,l;if(!e&&i>r.from&&iLh(s,!1),Rh=s=>Lh(s,!0),Eh=(s,e)=>Li(s,t=>{let i=t.head,{state:n}=s,r=n.doc.lineAt(i),o=n.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?n.doc.lines:1)&&(i+=e?1:-1);break}let a=oe(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),Ih=s=>Eh(s,!1),kp=s=>Eh(s,!0),Sp=s=>Li(s,e=>{let t=s.lineBlockAt(e.head).to;return e.headLi(s,e=>{let t=s.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Ap=s=>Li(s,e=>{let t=s.moveToLineBoundary(e,!0).head;return e.head{if(s.readOnly)return!1;let t=s.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:V.of(["",""])},range:b.cursor(i.from)}));return e(s.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Dp=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let t=s.changeByRange(i=>{if(!i.empty||i.from==0||i.from==s.doc.length)return{range:i};let n=i.from,r=s.doc.lineAt(n),o=n==r.from?n-1:oe(r.text,n-r.from,!1)+r.from,l=n==r.to?n+1:oe(r.text,n-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:s.doc.slice(n,l).append(s.doc.slice(o,n))},range:b.cursor(l)}});return t.changes.empty?!1:(e(s.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function zn(s){let e=[],t=-1;for(let i of s.selection.ranges){let n=s.doc.lineAt(i.from),r=s.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=s.doc.lineAt(i.to-1)),t>=n.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:n.from,to:r.to,ranges:[i]});t=r.number+1}return e}function Nh(s,e,t){if(s.readOnly)return!1;let i=[],n=[];for(let r of zn(s)){if(t?r.to==s.doc.length:r.from==0)continue;let o=s.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+s.lineBreak});for(let a of r.ranges)n.push(b.range(Math.min(s.doc.length,a.anchor+l),Math.min(s.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:s.lineBreak+o.text});for(let a of r.ranges)n.push(b.range(a.anchor-l,a.head-l))}}return i.length?(e(s.update({changes:i,scrollIntoView:!0,selection:b.create(n,s.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Op=({state:s,dispatch:e})=>Nh(s,e,!1),Tp=({state:s,dispatch:e})=>Nh(s,e,!0);function Fh(s,e,t){if(s.readOnly)return!1;let i=[];for(let n of zn(s))t?i.push({from:n.from,insert:s.doc.slice(n.from,n.to)+s.lineBreak}):i.push({from:n.to,insert:s.lineBreak+s.doc.slice(n.from,n.to)});return e(s.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Bp=({state:s,dispatch:e})=>Fh(s,e,!1),Pp=({state:s,dispatch:e})=>Fh(s,e,!0),Lp=s=>{if(s.state.readOnly)return!1;let{state:e}=s,t=e.changes(zn(e).map(({from:n,to:r})=>(n>0?n--:rs.moveVertically(n,!0)).map(t);return s.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Rp(s,e){if(/\(\)|\[\]|\{\}/.test(s.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=me(s).resolveInner(e),i=t.childBefore(e),n=t.childAfter(e),r;return i&&n&&i.to<=e&&n.from>=e&&(r=i.type.prop(R.closedBy))&&r.indexOf(n.name)>-1&&s.doc.lineAt(i.to).from==s.doc.lineAt(n.from).from&&!/\S/.test(s.sliceDoc(i.to,n.from))?{from:i.to,to:n.from}:null}const Ep=Vh(!1),Ip=Vh(!0);function Vh(s){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(n=>{let{from:r,to:o}=n,l=e.doc.lineAt(r),a=!s&&r==o&&Rp(e,r);s&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new Nn(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=Ya(h,r);for(c==null&&(c=_t(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let n=[];for(let o=i.from;o<=i.to;){let l=s.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,n,i),t=l.number),o=l.to+1}let r=s.changes(n);return{changes:n,range:b.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const Np=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let t=Object.create(null),i=new Nn(s,{overrideIndentation:r=>{let o=t[r];return o??-1}}),n=Sr(s,(r,o,l)=>{let a=Ya(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=vn(s,a);(h!=c||l.froms.readOnly?!1:(e(s.update(Sr(s,(t,i)=>{i.push({from:t.from,insert:s.facet(In)})}),{userEvent:"input.indent"})),!0),Hh=({state:s,dispatch:e})=>s.readOnly?!1:(e(s.update(Sr(s,(t,i)=>{let n=/^\s*/.exec(t.text)[0];if(!n)return;let r=_t(n,s.tabSize),o=0,l=vn(s,Math.max(0,r-Tt(s)));for(;o({mac:s.key,run:s.run,shift:s.shift}))),km=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Qd,shift:cp},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Zd,shift:fp},{key:"Alt-ArrowUp",run:Op},{key:"Shift-Alt-ArrowUp",run:Bp},{key:"Alt-ArrowDown",run:Tp},{key:"Shift-Alt-ArrowDown",run:Pp},{key:"Escape",run:vp},{key:"Mod-Enter",run:Ip},{key:"Alt-l",mac:"Ctrl-l",run:wp},{key:"Mod-i",run:xp,preventDefault:!0},{key:"Mod-[",run:Hh},{key:"Mod-]",run:Wh},{key:"Mod-Alt-\\",run:Np},{key:"Shift-Mod-k",run:Lp},{key:"Shift-Mod-\\",run:lp},{key:"Mod-/",run:Ld},{key:"Alt-A",run:Ed}].concat(Vp),Sm={key:"Tab",run:Wh,shift:Hh};function le(){var s=arguments[0];typeof s=="string"&&(s=document.createElement(s));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 n=t[i];typeof n=="string"?s.setAttribute(i,n):n!=null&&(s[i]=n)}e++}for(;es.normalize("NFKD"):s=>s;class Xt{constructor(e,t,i=0,n=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,n),this.bufferStart=i,this.normalize=r?l=>r(sl(l)):sl,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 ne(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=nr(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Be(e);let n=this.normalize(t);for(let r=0,o=i;;r++){let l=n.charCodeAt(r),a=this.match(l,o);if(r==n.length-1){if(a)return this.value=a,this;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,n=i+t[0].length;if(this.matchPos=Sn(this.text,n+(i==n?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,n,t)))return this.value={from:i,to:n,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||n.to<=t){let l=new qt(t,e.sliceString(t,i));return rs.set(e,l),l}if(n.from==t&&n.to==i)return n;let{text:r,from:o}=n;return o>t&&(r=e.sliceString(t,o)+r,o=t),n.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,n=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,n,t)))return this.value={from:i,to:n,match:t},this.matchPos=Sn(this.text,n+(i==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=qt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&($h.prototype[Symbol.iterator]=Kh.prototype[Symbol.iterator]=function(){return this});function Wp(s){try{return new RegExp(s,Cr),!0}catch{return!1}}function Sn(s,e){if(e>=s.length)return e;let t=s.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}function er(s){let e=String(s.state.doc.lineAt(s.state.selection.main.head).number),t=le("input",{class:"cm-textfield",name:"line",value:e}),i=le("form",{class:"cm-gotoLine",onkeydown:r=>{r.keyCode==27?(r.preventDefault(),s.dispatch({effects:Cn.of(!1)}),s.focus()):r.keyCode==13&&(r.preventDefault(),n())},onsubmit:r=>{r.preventDefault(),n()}},le("label",s.state.phrase("Go to line"),": ",t)," ",le("button",{class:"cm-button",type:"submit"},s.state.phrase("go")));function n(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=s,l=o.doc.lineAt(o.selection.main.head),[,a,h,c,f]=r,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),m=b.cursor(p.from+Math.max(0,Math.min(u,p.length)));s.dispatch({effects:[Cn.of(!1),T.scrollIntoView(m.from,{y:"center"})],selection:m}),s.focus()}return{dom:i}}const Cn=F.define(),rl=ye.define({create(){return!0},update(s,e){for(let t of e.effects)t.is(Cn)&&(s=t.value);return s},provide:s=>yn.from(s,e=>e?er:null)}),Hp=s=>{let e=mn(s,er);if(!e){let t=[Cn.of(!0)];s.state.field(rl,!1)==null&&t.push(F.appendConfig.of([rl,zp])),s.dispatch({effects:t}),e=mn(s,er)}return e&&e.dom.querySelector("input").select(),!0},zp=T.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),qp={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},jh=O.define({combine(s){return Pt(s,qp,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Cm(s){let e=[Gp,Up];return s&&e.push(jh.of(s)),e}const $p=B.mark({class:"cm-selectionMatch"}),Kp=B.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ol(s,e,t,i){return(t==0||s(e.sliceDoc(t-1,t))!=G.Word)&&(i==e.doc.length||s(e.sliceDoc(i,i+1))!=G.Word)}function jp(s,e,t,i){return s(e.sliceDoc(t,t+1))==G.Word&&s(e.sliceDoc(i-1,i))==G.Word}const Up=ue.fromClass(class{constructor(s){this.decorations=this.getDeco(s)}update(s){(s.selectionSet||s.docChanged||s.viewportChanged)&&(this.decorations=this.getDeco(s.view))}getDeco(s){let e=s.state.facet(jh),{state:t}=s,i=t.selection;if(i.ranges.length>1)return B.none;let n=i.main,r,o=null;if(n.empty){if(!e.highlightWordAroundCursor)return B.none;let a=t.wordAt(n.head);if(!a)return B.none;o=t.charCategorizer(n.head),r=t.sliceDoc(a.from,a.to)}else{let a=n.to-n.from;if(a200)return B.none;if(e.wholeWords){if(r=t.sliceDoc(n.from,n.to),o=t.charCategorizer(n.head),!(ol(o,t,n.from,n.to)&&jp(o,t,n.from,n.to)))return B.none}else if(r=t.sliceDoc(n.from,n.to).trim(),!r)return B.none}let l=[];for(let a of s.visibleRanges){let h=new Xt(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||ol(o,t,c,f))&&(n.empty&&c<=n.from&&f>=n.to?l.push(Kp.range(c,f)):(c>=n.to||f<=n.from)&&l.push($p.range(c,f)),l.length>e.maxMatches))return B.none}}return B.set(l)}},{decorations:s=>s.decorations}),Gp=T.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Jp=({state:s,dispatch:e})=>{let{selection:t}=s,i=b.create(t.ranges.map(n=>s.wordAt(n.head)||b.cursor(n.head)),t.mainIndex);return i.eq(t)?!1:(e(s.update({selection:i})),!0)};function Yp(s,e){let{main:t,ranges:i}=s.selection,n=s.wordAt(t.head),r=n&&n.from==t.from&&n.to==t.to;for(let o=!1,l=new Xt(s.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Xt(s.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=s.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const Xp=({state:s,dispatch:e})=>{let{ranges:t}=s.selection;if(t.some(r=>r.from===r.to))return Jp({state:s,dispatch:e});let i=s.sliceDoc(t[0].from,t[0].to);if(s.selection.ranges.some(r=>s.sliceDoc(r.from,r.to)!=i))return!1;let n=Yp(s,i);return n?(e(s.update({selection:s.selection.addRange(b.range(n.from,n.to),!1),effects:T.scrollIntoView(n.to)})),!0):!1},Zt=O.define({combine(s){return Pt(s,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new lg(e),scrollToMatch:e=>T.scrollIntoView(e)})}});class Uh{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||Wp(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 eg(this):new Qp(this)}getCursor(e,t=0,i){let n=e.doc?e:H.create({doc:e});return i==null&&(i=n.doc.length),this.regexp?Nt(this,n,t,i):It(this,n,t,i)}}class Gh{constructor(e){this.spec=e}}function It(s,e,t,i){return new Xt(e.doc,s.unquoted,t,i,s.caseSensitive?void 0:n=>n.toLowerCase(),s.wholeWord?_p(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function _p(s,e){return(t,i,n,r)=>((r>t||r+n.length=t)return null;n.push(i.value)}return n}highlight(e,t,i,n){let r=It(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;)n(r.value.from,r.value.to)}}function Nt(s,e,t,i){return new $h(e.doc,s.search,{ignoreCase:!s.caseSensitive,test:s.wholeWord?Zp(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function An(s,e){return s.slice(oe(s,e,!1),e)}function Mn(s,e){return s.slice(e,oe(s,e))}function Zp(s){return(e,t,i)=>!i[0].length||(s(An(i.input,i.index))!=G.Word||s(Mn(i.input,i.index))!=G.Word)&&(s(Mn(i.input,i.index+i[0].length))!=G.Word||s(An(i.input,i.index+i[0].length))!=G.Word)}class eg extends Gh{nextMatch(e,t,i){let n=Nt(this.spec,e,i,e.doc.length).next();return n.done&&(n=Nt(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,i){for(let n=1;;n++){let r=Math.max(t,i-n*1e4),o=Nt(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;n.push(i.value)}return n}highlight(e,t,i,n){let r=Nt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}}const Ai=F.define(),Ar=F.define(),ct=ye.define({create(s){return new os(tr(s).create(),null)},update(s,e){for(let t of e.effects)t.is(Ai)?s=new os(t.value.create(),s.panel):t.is(Ar)&&(s=new os(s.query,t.value?Mr:null));return s},provide:s=>yn.from(s,e=>e.panel)});class os{constructor(e,t){this.query=e,this.panel=t}}const tg=B.mark({class:"cm-searchMatch"}),ig=B.mark({class:"cm-searchMatch cm-searchMatch-selected"}),ng=ue.fromClass(class{constructor(s){this.view=s,this.decorations=this.highlight(s.state.field(ct))}update(s){let e=s.state.field(ct);(e!=s.startState.field(ct)||s.docChanged||s.selectionSet||s.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:s,panel:e}){if(!e||!s.spec.valid)return B.none;let{view:t}=this,i=new At;for(let n=0,r=t.visibleRanges,o=r.length;nr[n+1].from-2*250;)a=r[++n].to;s.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?ig:tg)})}return i.finish()}},{decorations:s=>s.decorations});function Ri(s){return e=>{let t=e.state.field(ct,!1);return t&&t.query.spec.valid?s(e,t):Xh(e)}}const Dn=Ri((s,{query:e})=>{let{to:t}=s.state.selection.main,i=e.nextMatch(s.state,t,t);if(!i)return!1;let n=b.single(i.from,i.to),r=s.state.facet(Zt);return s.dispatch({selection:n,effects:[Dr(s,i),r.scrollToMatch(n.main,s)],userEvent:"select.search"}),Yh(s),!0}),On=Ri((s,{query:e})=>{let{state:t}=s,{from:i}=t.selection.main,n=e.prevMatch(t,i,i);if(!n)return!1;let r=b.single(n.from,n.to),o=s.state.facet(Zt);return s.dispatch({selection:r,effects:[Dr(s,n),o.scrollToMatch(r.main,s)],userEvent:"select.search"}),Yh(s),!0}),sg=Ri((s,{query:e})=>{let t=e.matchAll(s.state,1e3);return!t||!t.length?!1:(s.dispatch({selection:b.create(t.map(i=>b.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),rg=({state:s,dispatch:e})=>{let t=s.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:n}=t.main,r=[],o=0;for(let l=new Xt(s.doc,s.sliceDoc(i,n));!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(s.update({selection:b.create(r,o),userEvent:"select.search.matches"})),!0},ll=Ri((s,{query:e})=>{let{state:t}=s,{from:i,to:n}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=[],l,a,h=[];if(r.from==i&&r.to==n&&(a=t.toText(e.getReplacement(r)),o.push({from:r.from,to:r.to,insert:a}),r=e.nextMatch(t,r.from,r.to),h.push(T.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-a.length;l=b.single(r.from-c,r.to-c),h.push(Dr(s,r)),h.push(t.facet(Zt).scrollToMatch(l.main,s))}return s.dispatch({changes:o,selection:l,effects:h,userEvent:"input.replace"}),!0}),og=Ri((s,{query:e})=>{if(s.state.readOnly)return!1;let t=e.matchAll(s.state,1e9).map(n=>{let{from:r,to:o}=n;return{from:r,to:o,insert:e.getReplacement(n)}});if(!t.length)return!1;let i=s.state.phrase("replaced $ matches",t.length)+".";return s.dispatch({changes:t,effects:T.announce.of(i),userEvent:"input.replace.all"}),!0});function Mr(s){return s.state.facet(Zt).createPanel(s)}function tr(s,e){var t,i,n,r,o;let l=s.selection.main,a=l.empty||l.to>l.from+100?"":s.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=s.facet(Zt);return new Uh({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(n=e==null?void 0:e.literal)!==null&&n!==void 0?n:h.literal,regexp:(r=e==null?void 0:e.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function Jh(s){let e=mn(s,Mr);return e&&e.dom.querySelector("[main-field]")}function Yh(s){let e=Jh(s);e&&e==s.root.activeElement&&e.select()}const Xh=s=>{let e=s.state.field(ct,!1);if(e&&e.panel){let t=Jh(s);if(t&&t!=s.root.activeElement){let i=tr(s.state,e.query.spec);i.valid&&s.dispatch({effects:Ai.of(i)}),t.focus(),t.select()}}else s.dispatch({effects:[Ar.of(!0),e?Ai.of(tr(s.state,e.query.spec)):F.appendConfig.of(hg)]});return!0},_h=s=>{let e=s.state.field(ct,!1);if(!e||!e.panel)return!1;let t=mn(s,Mr);return t&&t.dom.contains(s.root.activeElement)&&s.focus(),s.dispatch({effects:Ar.of(!1)}),!0},Am=[{key:"Mod-f",run:Xh,scope:"editor search-panel"},{key:"F3",run:Dn,shift:On,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Dn,shift:On,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:_h,scope:"editor search-panel"},{key:"Mod-Shift-l",run:rg},{key:"Mod-Alt-g",run:Hp},{key:"Mod-d",run:Xp,preventDefault:!0}];class lg{constructor(e){this.view=e;let t=this.query=e.state.field(ct).query.spec;this.commit=this.commit.bind(this),this.searchField=le("input",{value:t.search,placeholder:Se(e,"Find"),"aria-label":Se(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=le("input",{value:t.replace,placeholder:Se(e,"Replace"),"aria-label":Se(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=le("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=le("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=le("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(n,r,o){return le("button",{class:"cm-button",name:n,onclick:r,type:"button"},o)}this.dom=le("div",{onkeydown:n=>this.keydown(n),class:"cm-search"},[this.searchField,i("next",()=>Dn(e),[Se(e,"next")]),i("prev",()=>On(e),[Se(e,"previous")]),i("select",()=>sg(e),[Se(e,"all")]),le("label",null,[this.caseField,Se(e,"match case")]),le("label",null,[this.reField,Se(e,"regexp")]),le("label",null,[this.wordField,Se(e,"by word")]),...e.state.readOnly?[]:[le("br"),this.replaceField,i("replace",()=>ll(e),[Se(e,"replace")]),i("replaceAll",()=>og(e),[Se(e,"replace all")])],le("button",{name:"close",onclick:()=>_h(e),"aria-label":Se(e,"close"),type:"button"},["×"])])}commit(){let e=new Uh({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:Ai.of(e)}))}keydown(e){su(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?On:Dn)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ll(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Ai)&&!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(Zt).top}}function Se(s,e){return s.state.phrase(e)}const Zi=30,en=/[\s\.,:;?!]/;function Dr(s,{from:e,to:t}){let i=s.state.doc.lineAt(e),n=s.state.doc.lineAt(t).to,r=Math.max(i.from,e-Zi),o=Math.min(n,t+Zi),l=s.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-Zi;a--)if(!en.test(l[a-1])&&en.test(l[a])){l=l.slice(0,a);break}}return T.announce.of(`${s.state.phrase("current match")}. ${l} ${s.state.phrase("on line")} ${i.number}.`)}const ag=T.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"}}),hg=[ct,Bt.low(ng),ag];class Qh{constructor(e,t,i){this.state=e,this.pos=t,this.explicit=i,this.abortListeners=[]}tokenBefore(e){let t=me(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),n=t.text.slice(i-t.from,this.pos-t.from),r=n.search(Zh(e,!1));return r<0?null:{from:i+r,to:this.pos,text:n.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function al(s){let e=Object.keys(s).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function cg(s){let e=Object.create(null),t=Object.create(null);for(let{label:n}of s){e[n[0]]=!0;for(let r=1;rtypeof n=="string"?{label:n}:n),[t,i]=e.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:cg(e);return n=>{let r=n.matchBefore(i);return r||n.explicit?{from:r?r.from:n.pos,options:e,validFor:t}:null}}function Mm(s,e){return t=>{for(let i=me(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(s.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class hl{constructor(e,t,i,n){this.completion=e,this.source=t,this.match=i,this.score=n}}function ft(s){return s.selection.main.from}function Zh(s,e){var t;let{source:i}=s,n=e&&i[0]!="^",r=i[i.length-1]!="$";return!n&&!r?s:new RegExp(`${n?"^":""}(?:${i})${r?"$":""}`,(t=s.flags)!==null&&t!==void 0?t:s.ignoreCase?"i":"")}const ec=nt.define();function ug(s,e,t,i){let{main:n}=s.selection,r=t-n.from,o=i-n.from;return Object.assign(Object.assign({},s.changeByRange(l=>l!=n&&t!=i&&s.sliceDoc(l.from+r,l.from+o)!=s.sliceDoc(t,i)?{range:l}:{changes:{from:l.from+r,to:i==n.from?l.to:l.from+o,insert:e},range:b.cursor(l.from+r+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const cl=new WeakMap;function dg(s){if(!Array.isArray(s))return s;let e=cl.get(s);return e||cl.set(s,e=fg(s)),e}const Tn=F.define(),Mi=F.define();class pg{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(A=nr(x))!=A.toLowerCase()?1:A!=A.toUpperCase()?2:0;(!w||C==1&&g||v==0&&C!=0)&&(t[f]==x||i[f]==x&&(u=!0)?o[f++]=w:o.length&&(y=!1)),v=C,w+=Be(x)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?!1:this.result((n[0]?-700:0)+-200+-1100,n,e)}result(e,t,i){let n=[],r=0;for(let o of t){let l=o+(this.astral?Be(ne(i,o)):1);r&&n[r-1]==o?n[r-1]=l:(n[r++]=o,n[r++]=l)}return this.ret(e-i.length,n)}}const re=O.define({combine(s){return Pt(s,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:gg,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>fl(e(i),t(i)),optionClass:(e,t)=>i=>fl(e(i),t(i)),addToOptions:(e,t)=>e.concat(t)})}});function fl(s,e){return s?e?s+" "+e:s:e}function gg(s,e,t,i,n,r){let o=s.textDirection==X.RTL,l=o,a=!1,h="top",c,f,u=e.left-n.left,d=n.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||w>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function mg(s){let e=s.addToOptions.slice();return s.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(n=>"cm-completionIcon-"+n)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,n,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function ls(s,e,t){if(s<=t)return{from:0,to:s};if(e<0&&(e=0),e<=s>>1){let n=Math.floor(e/t);return{from:n*t,to:(n+1)*t}}let i=Math.floor((s-e)/t);return{from:s-(i+1)*t,to:s-i*t}}class yg{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let n=e.state.field(t),{options:r,selected:o}=n.open,l=e.state.facet(re);this.optionContent=mg(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=ls(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(re).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Mi.of(null)})}),this.showOptions(r,n.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=n){let{options:r,selected:o,disabled:l}=i.open;(!n.open||n.open.options!=r)&&(this.range=ls(r.length,o,e.state.facet(re).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=n.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=ls(t.options.length,t.selected,this.view.state.facet(re).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:n}=i;if(!n)return;let r=typeof n=="string"?document.createTextNode(n):n(i);if(!r)return;"then"in r?r.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>Ne(this.view.state,o,"completion info")):this.addInfoPane(r,i)}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:n,destroy:r}=e;i.appendChild(n),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)i.nodeName!="LI"||!i.id?n--:n==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected");return t&&wg(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return n.top>Math.min(r.bottom,t.bottom)-10||n.bottomi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)n.appendChild(h.header(h));else{let d=n.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=n.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.tonew yg(t,s,e)}function wg(s,e){let t=s.getBoundingClientRect(),i=e.getBoundingClientRect(),n=t.height/s.offsetHeight;i.topt.bottom&&(s.scrollTop+=(i.bottom-t.bottom)/n)}function ul(s){return(s.boost||0)*100+(s.apply?10:0)+(s.info?5:0)+(s.type?1:0)}function xg(s,e){let t=[],i=null,n=a=>{t.push(a);let{section:h}=a.completion;if(h){i||(i=[]);let c=typeof h=="string"?h:h.name;i.some(f=>f.name==c)||i.push(typeof h=="string"?{name:c}:h)}};for(let a of s)if(a.hasResult()){let h=a.result.getMatch;if(a.result.filter===!1)for(let c of a.result.options)n(new hl(c,a.source,h?h(c):[],1e9-t.length));else{let c=new pg(e.sliceDoc(a.from,a.to));for(let f of a.result.options)if(c.match(f.label)){let u=f.displayLabel?h?h(f,c.matched):[]:c.matched;n(new hl(f,a.source,u,c.score+(f.boost||0)))}}}if(i){let a=Object.create(null),h=0,c=(f,u)=>{var d,p;return((d=f.rank)!==null&&d!==void 0?d:1e9)-((p=u.rank)!==null&&p!==void 0?p:1e9)||(f.namec.score-h.score||l(h.completion,c.completion))){let h=a.completion;!o||o.label!=h.label||o.detail!=h.detail||o.type!=null&&h.type!=null&&o.type!=h.type||o.apply!=h.apply||o.boost!=h.boost?r.push(a):ul(a.completion)>ul(o)&&(r[r.length-1]=a),o=a.completion}return r}class Ft{constructor(e,t,i,n,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=n,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Ft(this.options,dl(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,n,r){let o=xg(e,t);if(!o.length)return n&&e.some(a=>a.state==1)?new Ft(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let l=t.facet(re).selectOnOpen?0:-1;if(n&&n.selected!=l&&n.selected!=-1){let a=n.options[n.selected].completion;for(let h=0;hh.hasResult()?Math.min(a,h.from):a,1e8),create:Ag,above:r.aboveCursor},n?n.timestamp:Date.now(),l,!1)}map(e){return new Ft(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class Bn{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new Bn(Sg,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(re),r=(i.override||t.languageDataAt("autocomplete",ft(t)).map(dg)).map(l=>(this.active.find(h=>h.source==l)||new xe(l,this.active.some(h=>h.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((l,a)=>l==this.active[a])&&(r=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!vg(r,this.active)?o=Ft.build(r,t,this.id,o,i):o&&o.disabled&&!r.some(l=>l.state==1)&&(o=null),!o&&r.every(l=>l.state!=1)&&r.some(l=>l.hasResult())&&(r=r.map(l=>l.hasResult()?new xe(l.source,0):l));for(let l of e.effects)l.is(ic)&&(o=o&&o.setSelected(l.value,this.id));return r==this.active&&o==this.open?this:new Bn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:kg}}function vg(s,e){if(s==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=s+"-"+e),t}const Sg=[];function ir(s){return s.isUserEvent("input.type")?"input":s.isUserEvent("delete.backward")?"delete":null}class xe{constructor(e,t,i=-1){this.source=e,this.state=t,this.explicitPos=i}hasResult(){return!1}update(e,t){let i=ir(e),n=this;i?n=n.handleUserEvent(e,i,t):e.docChanged?n=n.handleChange(e):e.selection&&n.state!=0&&(n=new xe(n.source,0));for(let r of e.effects)if(r.is(Tn))n=new xe(n.source,1,r.value?ft(e.state):-1);else if(r.is(Mi))n=new xe(n.source,0);else if(r.is(tc))for(let o of r.value)o.source==n.source&&(n=o);return n}handleUserEvent(e,t,i){return t=="delete"||!i.activateOnTyping?this.map(e.changes):new xe(this.source,1)}handleChange(e){return e.changes.touchesRange(ft(e.startState))?new xe(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new xe(this.source,this.state,e.mapPos(this.explicitPos))}}class $t extends xe{constructor(e,t,i,n,r){super(e,2,t),this.result=i,this.from=n,this.to=r}hasResult(){return!0}handleUserEvent(e,t,i){var n;let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=ft(e.state);if((this.explicitPos<0?l<=r:lo||t=="delete"&&ft(e.startState)==this.from)return new xe(this.source,t=="input"&&i.activateOnTyping?1:0);let a=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),h;return Cg(this.result.validFor,e.state,r,o)?new $t(this.source,a,this.result,r,o):this.result.update&&(h=this.result.update(this.result,r,o,new Qh(e.state,l,a>=0)))?new $t(this.source,a,h,h.from,(n=h.to)!==null&&n!==void 0?n:ft(e.state)):new xe(this.source,1,a)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new xe(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new $t(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function Cg(s,e,t,i){if(!s)return!1;let n=e.sliceDoc(t,i);return typeof s=="function"?s(n,t,i,e):Zh(s,!0).test(n)}const tc=F.define({map(s,e){return s.map(t=>t.map(e))}}),ic=F.define(),Ae=ye.define({create(){return Bn.start()},update(s,e){return s.update(e)},provide:s=>[Fa.from(s,e=>e.tooltip),T.contentAttributes.from(s,e=>e.attrs)]});function nc(s,e){const t=e.completion.apply||e.completion.label;let i=s.state.field(Ae).active.find(n=>n.source==e.source);return i instanceof $t?(typeof t=="string"?s.dispatch(Object.assign(Object.assign({},ug(s.state,t,i.from,i.to)),{annotations:ec.of(e.completion)})):t(s,e.completion,i.from,i.to),!0):!1}const Ag=bg(Ae,nc);function tn(s,e="option"){return t=>{let i=t.state.field(Ae,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+n*(s?1:-1):s?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:ic.of(l)}),!0}}const Mg=s=>{let e=s.state.field(Ae,!1);return s.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamps.state.field(Ae,!1)?(s.dispatch({effects:Tn.of(!0)}),!0):!1,Og=s=>{let e=s.state.field(Ae,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(s.dispatch({effects:Mi.of(null)}),!0)};class Tg{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Bg=50,Pg=1e3,Lg=ue.fromClass(class{constructor(s){this.view=s,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of s.state.field(Ae).active)e.state==1&&this.startQuery(e)}update(s){let e=s.state.field(Ae);if(!s.selectionSet&&!s.docChanged&&s.startState.field(Ae)==e)return;let t=s.transactions.some(n=>(n.selection||n.docChanged)&&!ir(n));for(let n=0;nBg&&Date.now()-r.time>Pg){for(let o of r.context.abortListeners)try{o()}catch(l){Ne(this.view.state,l)}r.context.abortListeners=null,this.running.splice(n--,1)}else r.updates.push(...s.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),s.transactions.some(n=>n.effects.some(r=>r.is(Tn)))&&(this.pendingStart=!0);let i=this.pendingStart?50:s.state.facet(re).activateOnTypingDelay;if(this.debounceUpdate=e.active.some(n=>n.state==1&&!this.running.some(r=>r.active.source==n.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let n of s.transactions)ir(n)=="input"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:s}=this.view,e=s.field(Ae);for(let t of e.active)t.state==1&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t)}startQuery(s){let{state:e}=this.view,t=ft(e),i=new Qh(e,t,s.explicitPos==t),n=new Tg(s,i);this.running.push(n),Promise.resolve(s.source(i)).then(r=>{n.context.aborted||(n.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:Mi.of(null)}),Ne(this.view.state,r)})}scheduleAccept(){this.running.every(s=>s.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(re).updateSyncTime))}accept(){var s;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(re);for(let i=0;io.source==n.active.source);if(r&&r.state==1)if(n.done==null){let o=new xe(n.active.source,0);for(let l of n.updates)o=o.update(l,t);o.state!=1&&e.push(o)}else this.startQuery(r)}e.length&&this.view.dispatch({effects:tc.of(e)})}},{eventHandlers:{blur(s){let e=this.view.state.field(Ae,!1);if(e&&e.tooltip&&this.view.state.facet(re).closeOnBlur){let t=e.open&&Va(this.view,e.open.tooltip);(!t||!t.dom.contains(s.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Mi.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Tn.of(!1)}),20),this.composing=0}}}),sc=T.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",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&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",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Rg{constructor(e,t,i,n){this.field=e,this.line=t,this.from=i,this.to=n}}class Or{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,he.TrackDel),i=e.mapPos(this.to,1,he.TrackDel);return t==null||i==null?null:new Or(this.field,t,i)}}class Tr{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],n=[t],r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew Or(a.field,n[a.line]+a.from,n[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],n=[],r;for(let o of e.split(/\r\n?|\n/)){for(;r=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o);){let l=r[1]?+r[1]:null,a=r[2]||r[3]||"",h=-1;for(let c=0;c=h&&f.field++}n.push(new Rg(h,i.length,r.index,r.index+a.length)),o=o.slice(0,r.index)+a+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 a of n)a.line==i.length&&a.from>l.index&&(a.from--,a.to--)}i.push(o)}return new Tr(i,n)}}let Eg=B.widget({widget:new class extends Lt{toDOM(){let s=document.createElement("span");return s.className="cm-snippetFieldPosition",s}ignoreEvent(){return!1}}}),Ig=B.mark({class:"cm-snippetField"});class ei{constructor(e,t){this.ranges=e,this.active=t,this.deco=B.set(e.map(i=>(i.from==i.to?Eg:Ig).range(i.from,i.to)))}map(e){let t=[];for(let i of this.ranges){let n=i.map(e);if(!n)return null;t.push(n)}return new ei(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 Ei=F.define({map(s,e){return s&&s.map(e)}}),Ng=F.define(),Di=ye.define({create(){return null},update(s,e){for(let t of e.effects){if(t.is(Ei))return t.value;if(t.is(Ng)&&s)return new ei(s.ranges,t.value)}return s&&e.docChanged&&(s=s.map(e.changes)),s&&e.selection&&!s.selectionInsideField(e.selection)&&(s=null),s},provide:s=>T.decorations.from(s,e=>e?e.deco:B.none)});function Br(s,e){return b.create(s.filter(t=>t.field==e).map(t=>b.range(t.from,t.to)))}function Fg(s){let e=Tr.parse(s);return(t,i,n,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,n),a={changes:{from:n,to:r,insert:V.of(o)},scrollIntoView:!0,annotations:i?[ec.of(i),Q.userEvent.of("input.complete")]:void 0};if(l.length&&(a.selection=Br(l,0)),l.some(h=>h.field>0)){let h=new ei(l,0),c=a.effects=[Ei.of(h)];t.state.field(Di,!1)===void 0&&c.push(F.appendConfig.of([Di,qg,$g,sc]))}t.dispatch(t.state.update(a))}}function rc(s){return({state:e,dispatch:t})=>{let i=e.field(Di,!1);if(!i||s<0&&i.active==0)return!1;let n=i.active+s,r=s>0&&!i.ranges.some(o=>o.field==n+s);return t(e.update({selection:Br(i.ranges,n),effects:Ei.of(r?null:new ei(i.ranges,n)),scrollIntoView:!0})),!0}}const Vg=({state:s,dispatch:e})=>s.field(Di,!1)?(e(s.update({effects:Ei.of(null)})),!0):!1,Wg=rc(1),Hg=rc(-1),zg=[{key:"Tab",run:Wg,shift:Hg},{key:"Escape",run:Vg}],pl=O.define({combine(s){return s.length?s[0]:zg}}),qg=Bt.highest(dr.compute([pl],s=>s.facet(pl)));function Dm(s,e){return Object.assign(Object.assign({},e),{apply:Fg(s)})}const $g=T.domEventHandlers({mousedown(s,e){let t=e.state.field(Di,!1),i;if(!t||(i=e.posAtCoords({x:s.clientX,y:s.clientY}))==null)return!1;let n=t.ranges.find(r=>r.from<=i&&r.to>=i);return!n||n.field==t.active?!1:(e.dispatch({selection:Br(t.ranges,n.field),effects:Ei.of(t.ranges.some(r=>r.field>n.field)?new ei(t.ranges,n.field):null),scrollIntoView:!0}),!0)}}),Oi={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},St=F.define({map(s,e){let t=e.mapPos(s,-1,he.TrackAfter);return t??void 0}}),Pr=new class extends Ct{};Pr.startSide=1;Pr.endSide=-1;const oc=ye.define({create(){return $.empty},update(s,e){if(s=s.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);s=s.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(St)&&(s=s.update({add:[Pr.range(t.value,t.value+1)]}));return s}});function Om(){return[jg,oc]}const as="()[]{}<>";function lc(s){for(let e=0;e{if((Kg?s.composing:s.compositionStarted)||s.state.readOnly)return!1;let n=s.state.selection.main;if(i.length>2||i.length==2&&Be(ne(i,0))==1||e!=n.from||t!=n.to)return!1;let r=Gg(s.state,i);return r?(s.dispatch(r),!0):!1}),Ug=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let i=ac(s,s.selection.main.head).brackets||Oi.brackets,n=null,r=s.changeByRange(o=>{if(o.empty){let l=Jg(s.doc,o.head);for(let a of i)if(a==l&&qn(s.doc,o.head)==lc(ne(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:n=o}});return n||e(s.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!n},Tm=[{key:"Backspace",run:Ug}];function Gg(s,e){let t=ac(s,s.selection.main.head),i=t.brackets||Oi.brackets;for(let n of i){let r=lc(ne(n,0));if(e==n)return r==n?_g(s,n,i.indexOf(n+n+n)>-1,t):Yg(s,n,r,t.before||Oi.before);if(e==r&&hc(s,s.selection.main.from))return Xg(s,n,r)}return null}function hc(s,e){let t=!1;return s.field(oc).between(0,s.doc.length,i=>{i==e&&(t=!0)}),t}function qn(s,e){let t=s.sliceString(e,e+2);return t.slice(0,Be(ne(t,0)))}function Jg(s,e){let t=s.sliceString(e-2,e);return Be(ne(t,0))==t.length?t:t.slice(1)}function Yg(s,e,t,i){let n=null,r=s.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:St.of(o.to+e.length),range:b.range(o.anchor+e.length,o.head+e.length)};let l=qn(s.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:St.of(o.head+e.length),range:b.cursor(o.head+e.length)}:{range:n=o}});return n?null:s.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Xg(s,e,t){let i=null,n=s.changeByRange(r=>r.empty&&qn(s.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:b.cursor(r.head+t.length)}:i={range:r});return i?null:s.update(n,{scrollIntoView:!0,userEvent:"input.type"})}function _g(s,e,t,i){let n=i.stringPrefixes||Oi.stringPrefixes,r=null,o=s.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:St.of(l.to+e.length),range:b.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=qn(s.doc,a),c;if(h==e){if(gl(s,a))return{changes:{insert:e+e,from:a},effects:St.of(a+e.length),range:b.cursor(a+e.length)};if(hc(s,a)){let u=t&&s.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(t&&s.sliceDoc(a-2*e.length,a)==e+e&&(c=ml(s,a-2*e.length,n))>-1&&gl(s,c))return{changes:{insert:e+e+e+e,from:a},effects:St.of(a+e.length),range:b.cursor(a+e.length)};if(s.charCategorizer(a)(h)!=G.Word&&ml(s,a,n)>-1&&!Qg(s,a,e,n))return{changes:{insert:e+e,from:a},effects:St.of(a+e.length),range:b.cursor(a+e.length)}}return{range:r=l}});return r?null:s.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function gl(s,e){let t=me(s).resolveInner(e+1);return t.parent&&t.from==e}function Qg(s,e,t,i){let n=me(s).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=s.sliceDoc(n.from,Math.min(n.to,n.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=n.firstChild;for(;c&&c.from==n.from&&c.to-c.from>t.length+a;){if(s.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=n.to==e&&n.parent;if(!h)break;n=h}return!1}function ml(s,e,t){let i=s.charCategorizer(e);if(i(s.sliceDoc(e-1,e))!=G.Word)return e;for(let n of t){let r=e-n.length;if(s.sliceDoc(r,e)==n&&i(s.sliceDoc(r-1,r))!=G.Word)return r}return-1}function Bm(s={}){return[Ae,re.of(s),Lg,em,sc]}const Zg=[{key:"Ctrl-Space",run:Dg},{key:"Escape",run:Og},{key:"ArrowDown",run:tn(!0)},{key:"ArrowUp",run:tn(!1)},{key:"PageDown",run:tn(!0,"page")},{key:"PageUp",run:tn(!1,"page")},{key:"Enter",run:Mg}],em=Bt.highest(dr.computeN([re],s=>s.facet(re).defaultKeymap?[Zg]:[]));export{hm as A,ld as B,Pn as C,Iu as D,T as E,pm as F,gm as G,mm as H,Y as I,fm as J,am as K,Us as L,Mm as M,pr as N,fg as O,$a as P,b as Q,Dm as R,nh as S,K as T,dm as U,um as V,sd as W,Ua as X,kd as Y,H as a,sm as b,xm as c,im as d,nm as e,wm as f,Om as g,lm as h,Cm as i,Tm as j,dr as k,km as l,Am as m,vm as n,Zg as o,Sm as p,Bm as q,om as r,ym as s,rm as t,bm as u,me as v,ge as w,R as x,Zu as y,M as z}; diff --git a/ui/dist/assets/index-ydlV29Fj.js b/ui/dist/assets/index-z3vRI80T.js similarity index 97% rename from ui/dist/assets/index-ydlV29Fj.js rename to ui/dist/assets/index-z3vRI80T.js index 9882a5d8..b905af8e 100644 --- a/ui/dist/assets/index-ydlV29Fj.js +++ b/ui/dist/assets/index-z3vRI80T.js @@ -1,7 +1,7 @@ var a0=Object.defineProperty;var f0=(n,e,t)=>e in n?a0(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Je=(n,e,t)=>(f0(n,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(l){if(l.ep)return;l.ep=!0;const s=t(l);fetch(l.href,s)}})();function Q(){}const gs=n=>n;function Pe(n,e){for(const t in e)n[t]=e[t];return n}function u0(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}function Cg(n){return n()}function Ga(){return Object.create(null)}function ve(n){n.forEach(Cg)}function Tt(n){return typeof n=="function"}function me(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}let Ds;function en(n,e){return n===e?!0:(Ds||(Ds=document.createElement("a")),Ds.href=e,n===Ds.href)}function c0(n){return Object.keys(n).length===0}function oa(n,...e){if(n==null){for(const i of e)i(void 0);return Q}const t=n.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function Og(n){let e;return oa(n,t=>e=t)(),e}function Ue(n,e,t){n.$$.on_destroy.push(oa(e,t))}function vt(n,e,t,i){if(n){const l=Mg(n,e,t,i);return n[0](l)}}function Mg(n,e,t,i){return n[1]&&i?Pe(t.ctx.slice(),n[1](i(e))):t.ctx}function wt(n,e,t,i){if(n[2]&&i){const l=n[2](i(t));if(e.dirty===void 0)return l;if(typeof l=="object"){const s=[],o=Math.max(e.dirty.length,l.length);for(let r=0;r32){const e=[],t=n.ctx.length/32;for(let i=0;iwindow.performance.now():()=>Date.now(),ra=Dg?n=>requestAnimationFrame(n):Q;const bl=new Set;function Eg(n){bl.forEach(e=>{e.c(n)||(bl.delete(e),e.f())}),bl.size!==0&&ra(Eg)}function Ro(n){let e;return bl.size===0&&ra(Eg),{promise:new Promise(t=>{bl.add(e={c:n,f:t})}),abort(){bl.delete(e)}}}function k(n,e){n.appendChild(e)}function Ig(n){if(!n)return document;const e=n.getRootNode?n.getRootNode():n.ownerDocument;return e&&e.host?e:n.ownerDocument}function d0(n){const e=b("style");return e.textContent="/* empty */",p0(Ig(n),e),e.sheet}function p0(n,e){return k(n.head||n,e),e.sheet}function w(n,e,t){n.insertBefore(e,t||null)}function v(n){n.parentNode&&n.parentNode.removeChild(n)}function rt(n,e){for(let t=0;tn.removeEventListener(e,t,i)}function Be(n){return function(e){return e.preventDefault(),n.call(this,e)}}function cn(n){return function(e){return e.stopPropagation(),n.call(this,e)}}function p(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}const m0=["width","height"];function ni(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&&m0.indexOf(i)===-1?n[i]=e[i]:p(n,i,e[i])}function h0(n){let e;return{p(...t){e=t,e.forEach(i=>n.push(i))},r(){e.forEach(t=>n.splice(n.indexOf(t),1))}}}function lt(n){return n===""?null:+n}function _0(n){return Array.from(n.childNodes)}function re(n,e){e=""+e,n.data!==e&&(n.data=e)}function ae(n,e){n.value=e??""}function g0(n,e,t,i){t==null?n.style.removeProperty(e):n.style.setProperty(e,t,i?"important":"")}function x(n,e,t){n.classList.toggle(e,!!t)}function Ag(n,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:i})}function Ot(n,e){return new n(e)}const bo=new Map;let ko=0;function b0(n){let e=5381,t=n.length;for(;t--;)e=(e<<5)-e^n.charCodeAt(t);return e>>>0}function k0(n,e){const t={stylesheet:d0(e),rules:{}};return bo.set(n,t),t}function is(n,e,t,i,l,s,o,r=0){const a=16.666/i;let f=`{ `;for(let g=0;g<=1;g+=a){const y=e+(t-e)*s(g);f+=g*100+`%{${o(y,1-y)}} `}const u=f+`100% {${o(t,1-t)}} -}`,c=`__svelte_${b0(u)}_${r}`,d=Ig(n),{stylesheet:m,rules:h}=bo.get(d)||k0(d,n);h[c]||(h[c]=!0,m.insertRule(`@keyframes ${c} ${u}`,m.cssRules.length));const _=n.style.animation||"";return n.style.animation=`${_?`${_}, `:""}${c} ${i}ms linear ${l}ms 1 both`,ko+=1,c}function ls(n,e){const t=(n.style.animation||"").split(", "),i=t.filter(e?s=>s.indexOf(e)<0:s=>s.indexOf("__svelte")===-1),l=t.length-i.length;l&&(n.style.animation=i.join(", "),ko-=l,ko||y0())}function y0(){ra(()=>{ko||(bo.forEach(n=>{const{ownerNode:e}=n.stylesheet;e&&v(e)}),bo.clear())})}function v0(n,e,t,i){if(!e)return Q;const l=n.getBoundingClientRect();if(e.left===l.left&&e.right===l.right&&e.top===l.top&&e.bottom===l.bottom)return Q;const{delay:s=0,duration:o=300,easing:r=gs,start:a=Fo()+s,end:f=a+o,tick:u=Q,css:c}=t(n,{from:e,to:l},i);let d=!0,m=!1,h;function _(){c&&(h=is(n,0,1,o,s,r,c)),s||(m=!0)}function g(){c&&ls(n,h),d=!1}return Ro(y=>{if(!m&&y>=a&&(m=!0),m&&y>=f&&(u(1,0),g()),!d)return!1;if(m){const S=y-a,T=0+1*r(S/o);u(T,1-T)}return!0}),_(),u(0,1),g}function w0(n){const e=getComputedStyle(n);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:t,height:i}=e,l=n.getBoundingClientRect();n.style.position="absolute",n.style.width=t,n.style.height=i,Lg(n,l)}}function Lg(n,e){const t=n.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){const i=getComputedStyle(n),l=i.transform==="none"?"":i.transform;n.style.transform=`${l} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}let ss;function di(n){ss=n}function bs(){if(!ss)throw new Error("Function called outside component initialization");return ss}function jt(n){bs().$$.on_mount.push(n)}function S0(n){bs().$$.after_update.push(n)}function ks(n){bs().$$.on_destroy.push(n)}function st(){const n=bs();return(e,t,{cancelable:i=!1}={})=>{const l=n.$$.callbacks[e];if(l){const s=Ag(e,t,{cancelable:i});return l.slice().forEach(o=>{o.call(n,s)}),!s.defaultPrevented}return!0}}function Te(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const _l=[],ee=[];let kl=[];const Fr=[],Ng=Promise.resolve();let Rr=!1;function Pg(){Rr||(Rr=!0,Ng.then(aa))}function Xt(){return Pg(),Ng}function Ye(n){kl.push(n)}function ke(n){Fr.push(n)}const tr=new Set;let cl=0;function aa(){if(cl!==0)return;const n=ss;do{try{for(;cl<_l.length;){const e=_l[cl];cl++,di(e),$0(e.$$)}}catch(e){throw _l.length=0,cl=0,e}for(di(null),_l.length=0,cl=0;ee.length;)ee.pop()();for(let e=0;en.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),kl=e}let Rl;function fa(){return Rl||(Rl=Promise.resolve(),Rl.then(()=>{Rl=null})),Rl}function Ki(n,e,t){n.dispatchEvent(Ag(`${e?"intro":"outro"}${t}`))}const io=new Set;let ei;function se(){ei={r:0,c:[],p:ei}}function oe(){ei.r||ve(ei.c),ei=ei.p}function E(n,e){n&&n.i&&(io.delete(n),n.i(e))}function A(n,e,t,i){if(n&&n.o){if(io.has(n))return;io.add(n),ei.c.push(()=>{io.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const ua={duration:0};function Fg(n,e,t){const i={direction:"in"};let l=e(n,t,i),s=!1,o,r,a=0;function f(){o&&ls(n,o)}function u(){const{delay:d=0,duration:m=300,easing:h=gs,tick:_=Q,css:g}=l||ua;g&&(o=is(n,0,1,m,d,h,g,a++)),_(0,1);const y=Fo()+d,S=y+m;r&&r.abort(),s=!0,Ye(()=>Ki(n,!0,"start")),r=Ro(T=>{if(s){if(T>=S)return _(1,0),Ki(n,!0,"end"),f(),s=!1;if(T>=y){const $=h((T-y)/m);_($,1-$)}}return s})}let c=!1;return{start(){c||(c=!0,ls(n),Tt(l)?(l=l(i),fa().then(u)):u())},invalidate(){c=!1},end(){s&&(f(),s=!1)}}}function ca(n,e,t){const i={direction:"out"};let l=e(n,t,i),s=!0,o;const r=ei;r.r+=1;let a;function f(){const{delay:u=0,duration:c=300,easing:d=gs,tick:m=Q,css:h}=l||ua;h&&(o=is(n,1,0,c,u,d,h));const _=Fo()+u,g=_+c;Ye(()=>Ki(n,!1,"start")),"inert"in n&&(a=n.inert,n.inert=!0),Ro(y=>{if(s){if(y>=g)return m(0,1),Ki(n,!1,"end"),--r.r||ve(r.c),!1;if(y>=_){const S=d((y-_)/c);m(1-S,S)}}return s})}return Tt(l)?fa().then(()=>{l=l(i),f()}):f(),{end(u){u&&"inert"in n&&(n.inert=a),u&&l.tick&&l.tick(1,0),s&&(o&&ls(n,o),s=!1)}}}function Ne(n,e,t,i){let s=e(n,t,{direction:"both"}),o=i?0:1,r=null,a=null,f=null,u;function c(){f&&ls(n,f)}function d(h,_){const g=h.b-o;return _*=Math.abs(g),{a:o,b:h.b,d:g,duration:_,start:h.start,end:h.start+_,group:h.group}}function m(h){const{delay:_=0,duration:g=300,easing:y=gs,tick:S=Q,css:T}=s||ua,$={start:Fo()+_,b:h};h||($.group=ei,ei.r+=1),"inert"in n&&(h?u!==void 0&&(n.inert=u):(u=n.inert,n.inert=!0)),r||a?a=$:(T&&(c(),f=is(n,o,h,g,_,y,T)),h&&S(0,1),r=d($,g),Ye(()=>Ki(n,h,"start")),Ro(C=>{if(a&&C>a.start&&(r=d(a,g),a=null,Ki(n,r.b,"start"),T&&(c(),f=is(n,o,r.b,r.duration,0,y,s.css))),r){if(C>=r.end)S(o=r.b,1-o),Ki(n,r.b,"end"),a||(r.b?c():--r.group.r||ve(r.group.c)),r=null;else if(C>=r.start){const M=C-r.start;o=r.a+r.d*y(M/r.duration),S(o,1-o)}}return!!(r||a)}))}return{run(h){Tt(s)?fa().then(()=>{s=s({direction:h?"in":"out"}),m(h)}):m(h)},end(){c(),r=a=null}}}function Qa(n,e){const t=e.token={};function i(l,s,o,r){if(e.token!==t)return;e.resolved=r;let a=e.ctx;o!==void 0&&(a=a.slice(),a[o]=r);const f=l&&(e.current=l)(a);let u=!1;e.block&&(e.blocks?e.blocks.forEach((c,d)=>{d!==s&&c&&(se(),A(c,1,1,()=>{e.blocks[d]===c&&(e.blocks[d]=null)}),oe())}):e.block.d(1),f.c(),E(f,1),f.m(e.mount(),e.anchor),u=!0),e.block=f,e.blocks&&(e.blocks[s]=f),u&&aa()}if(u0(n)){const l=bs();if(n.then(s=>{di(l),i(e.then,1,e.value,s),di(null)},s=>{if(di(l),i(e.catch,2,e.error,s),di(null),!e.hasCatch)throw s}),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 C0(n,e,t){const i=e.slice(),{resolved:l}=n;n.current===n.then&&(i[n.value]=l),n.current===n.catch&&(i[n.error]=l),n.block.p(i,t)}function de(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function Ii(n,e){n.d(1),e.delete(n.key)}function Mt(n,e){A(n,1,1,()=>{e.delete(n.key)})}function O0(n,e){n.f(),Mt(n,e)}function at(n,e,t,i,l,s,o,r,a,f,u,c){let d=n.length,m=s.length,h=d;const _={};for(;h--;)_[n[h].key]=h;const g=[],y=new Map,S=new Map,T=[];for(h=m;h--;){const D=c(l,s,h),I=t(D);let L=o.get(I);L?i&&T.push(()=>L.p(D,e)):(L=f(I,D),L.c()),y.set(I,g[h]=L),I in _&&S.set(I,Math.abs(h-_[I]))}const $=new Set,C=new Set;function M(D){E(D,1),D.m(r,u),o.set(D.key,D),u=D.first,m--}for(;d&&m;){const D=g[m-1],I=n[d-1],L=D.key,R=I.key;D===I?(u=D.first,d--,m--):y.has(R)?!o.has(L)||$.has(L)?M(D):C.has(R)?d--:S.get(L)>S.get(R)?(C.add(L),M(D)):($.add(R),d--):(a(I,o),d--)}for(;d--;){const D=n[d];y.has(D.key)||a(D,o)}for(;m;)M(g[m-1]);return ve(T),g}function ct(n,e){const t={},i={},l={$$scope:1};let s=n.length;for(;s--;){const o=n[s],r=e[s];if(r){for(const a in o)a in r||(i[a]=1);for(const a in r)l[a]||(t[a]=r[a],l[a]=1);n[s]=r}else for(const a in o)l[a]=1}for(const o in i)o in t||(t[o]=void 0);return t}function Ct(n){return typeof n=="object"&&n!==null?n:{}}function be(n,e,t){const i=n.$$.props[e];i!==void 0&&(n.$$.bound[i]=t,t(n.$$.ctx[i]))}function B(n){n&&n.c()}function z(n,e,t){const{fragment:i,after_update:l}=n.$$;i&&i.m(e,t),Ye(()=>{const s=n.$$.on_mount.map(Cg).filter(Tt);n.$$.on_destroy?n.$$.on_destroy.push(...s):ve(s),n.$$.on_mount=[]}),l.forEach(Ye)}function V(n,e){const t=n.$$;t.fragment!==null&&(T0(t.after_update),ve(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function M0(n,e){n.$$.dirty[0]===-1&&(_l.push(n),Pg(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<{const h=m.length?m[0]:d;return f.ctx&&l(f.ctx[c],f.ctx[c]=h)&&(!f.skip_bound&&f.bound[c]&&f.bound[c](h),u&&M0(n,c)),d}):[],f.update(),u=!0,ve(f.before_update),f.fragment=i?i(f.ctx):!1,e.target){if(e.hydrate){const c=_0(e.target);f.fragment&&f.fragment.l(c),c.forEach(v)}else f.fragment&&f.fragment.c();e.intro&&E(n.$$.fragment),z(n,e.target,e.anchor),aa()}di(a)}class ge{constructor(){Je(this,"$$");Je(this,"$$set")}$destroy(){V(this,1),this.$destroy=Q}$on(e,t){if(!Tt(t))return Q;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const l=i.indexOf(t);l!==-1&&i.splice(l,1)}}$set(e){this.$$set&&!c0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const D0="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(D0);const dl=[];function Rg(n,e){return{subscribe:Cn(n,e).subscribe}}function Cn(n,e=Q){let t;const i=new Set;function l(r){if(me(n,r)&&(n=r,t)){const a=!dl.length;for(const f of i)f[1](),dl.push(f,n);if(a){for(let f=0;f{i.delete(f),i.size===0&&t&&(t(),t=null)}}return{set:l,update:s,subscribe:o}}function qg(n,e,t){const i=!Array.isArray(n),l=i?[n]:n;if(!l.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Rg(t,(o,r)=>{let a=!1;const f=[];let u=0,c=Q;const d=()=>{if(u)return;c();const h=e(i?f[0]:f,o,r);s?o(h):c=Tt(h)?h:Q},m=l.map((h,_)=>oa(h,g=>{f[_]=g,u&=~(1<<_),a&&d()},()=>{u|=1<<_}));return a=!0,d(),function(){ve(m),c(),a=!1}})}function jg(n,e){if(n instanceof RegExp)return{keys:!1,pattern:n};var t,i,l,s,o=[],r="",a=n.split("/");for(a[0]||a.shift();l=a.shift();)t=l[0],t==="*"?(o.push("wild"),r+="/(.*)"):t===":"?(i=l.indexOf("?",1),s=l.indexOf(".",1),o.push(l.substring(1,~i?i:~s?s:l.length)),r+=~i&&!~s?"(?:/([^/]+?))?":"/([^/]+?)",~s&&(r+=(~i?"?":"")+"\\"+l.substring(s))):r+="/"+l;return{keys:o,pattern:new RegExp("^"+r+(e?"(?=$|/)":"/?$"),"i")}}function E0(n){let e,t,i;const l=[n[2]];var s=n[0];function o(r,a){let f={};if(a!==void 0&&a&4)f=ct(l,[Ct(r[2])]);else for(let u=0;u{V(f,1)}),oe()}s?(e=Ot(s,o(r,a)),e.$on("routeEvent",r[7]),B(e.$$.fragment),E(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(s){const f=a&4?ct(l,[Ct(r[2])]):{};e.$set(f)}},i(r){i||(e&&E(e.$$.fragment,r),i=!0)},o(r){e&&A(e.$$.fragment,r),i=!1},d(r){r&&v(t),e&&V(e,r)}}}function I0(n){let e,t,i;const l=[{params:n[1]},n[2]];var s=n[0];function o(r,a){let f={};if(a!==void 0&&a&6)f=ct(l,[a&2&&{params:r[1]},a&4&&Ct(r[2])]);else for(let u=0;u{V(f,1)}),oe()}s?(e=Ot(s,o(r,a)),e.$on("routeEvent",r[6]),B(e.$$.fragment),E(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(s){const f=a&6?ct(l,[a&2&&{params:r[1]},a&4&&Ct(r[2])]):{};e.$set(f)}},i(r){i||(e&&E(e.$$.fragment,r),i=!0)},o(r){e&&A(e.$$.fragment,r),i=!1},d(r){r&&v(t),e&&V(e,r)}}}function A0(n){let e,t,i,l;const s=[I0,E0],o=[];function r(a,f){return a[1]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ye()},m(a,f){o[e].m(a,f),w(a,i,f),l=!0},p(a,[f]){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),A(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){l||(E(t),l=!0)},o(a){A(t),l=!1},d(a){a&&v(i),o[e].d(a)}}}function xa(){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 qo=Rg(null,function(e){e(xa());const t=()=>{e(xa())};return window.addEventListener("hashchange",t,!1),function(){window.removeEventListener("hashchange",t,!1)}});qg(qo,n=>n.location);const jo=qg(qo,n=>n.querystring),ef=Cn(void 0);async function tl(n){if(!n||n.length<1||n.charAt(0)!="/"&&n.indexOf("#/")!==0)throw Error("Invalid parameter location");await Xt();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 nn(n,e){if(e=nf(e),!n||!n.tagName||n.tagName.toLowerCase()!="a")throw Error('Action "link" can only be used with tags');return tf(n,e),{update(t){t=nf(t),tf(n,t)}}}function L0(n){n?window.scrollTo(n.__svelte_spa_router_scrollX,n.__svelte_spa_router_scrollY):window.scrollTo(0,0)}function tf(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||N0(i.currentTarget.getAttribute("href"))})}function nf(n){return n&&typeof n=="string"?{href:n}:n||{}}function N0(n){history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},void 0),window.location.hash=n}function P0(n,e,t){let{routes:i={}}=e,{prefix:l=""}=e,{restoreScrollState:s=!1}=e;class o{constructor(C,M){if(!M||typeof M!="function"&&(typeof M!="object"||M._sveltesparouter!==!0))throw Error("Invalid component object");if(!C||typeof C=="string"&&(C.length<1||C.charAt(0)!="/"&&C.charAt(0)!="*")||typeof C=="object"&&!(C instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:D,keys:I}=jg(C);this.path=C,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=D,this._keys=I}match(C){if(l){if(typeof l=="string")if(C.startsWith(l))C=C.substr(l.length)||"/";else return null;else if(l instanceof RegExp){const L=C.match(l);if(L&&L[0])C=C.substr(L[0].length)||"/";else return null}}const M=this._pattern.exec(C);if(M===null)return null;if(this._keys===!1)return M;const D={};let I=0;for(;I{r.push(new o(C,$))}):Object.keys(i).forEach($=>{r.push(new o($,i[$]))});let a=null,f=null,u={};const c=st();async function d($,C){await Xt(),c($,C)}let m=null,h=null;s&&(h=$=>{$.state&&($.state.__svelte_spa_router_scrollY||$.state.__svelte_spa_router_scrollX)?m=$.state:m=null},window.addEventListener("popstate",h),S0(()=>{L0(m)}));let _=null,g=null;const y=qo.subscribe(async $=>{_=$;let C=0;for(;C{ef.set(f)});return}t(0,a=null),g=null,ef.set(void 0)});ks(()=>{y(),h&&window.removeEventListener("popstate",h)});function S($){Te.call(this,n,$)}function T($){Te.call(this,n,$)}return n.$$set=$=>{"routes"in $&&t(3,i=$.routes),"prefix"in $&&t(4,l=$.prefix),"restoreScrollState"in $&&t(5,s=$.restoreScrollState)},n.$$.update=()=>{n.$$.dirty&32&&(history.scrollRestoration=s?"manual":"auto")},[a,f,u,i,l,s,S,T]}class F0 extends ge{constructor(e){super(),_e(this,e,P0,A0,me,{routes:3,prefix:4,restoreScrollState:5})}}const lo=[];let Hg;function zg(n){const e=n.pattern.test(Hg);lf(n,n.className,e),lf(n,n.inactiveClassName,!e)}function lf(n,e,t){(e||"").split(" ").forEach(i=>{i&&(n.node.classList.remove(i),t&&n.node.classList.add(i))})}qo.subscribe(n=>{Hg=n.location+(n.querystring?"?"+n.querystring:""),lo.map(zg)});function An(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"?jg(e.path):{pattern:e.path},i={node:n,className:e.className,inactiveClassName:e.inactiveClassName,pattern:t};return lo.push(i),zg(i),{destroy(){lo.splice(lo.indexOf(i),1)}}}const R0="modulepreload",q0=function(n,e){return new URL(n,e).href},sf={},nt=function(e,t,i){let l=Promise.resolve();if(t&&t.length>0){const s=document.getElementsByTagName("link");l=Promise.all(t.map(o=>{if(o=q0(o,i),o in sf)return;sf[o]=!0;const r=o.endsWith(".css"),a=r?'[rel="stylesheet"]':"";if(!!i)for(let c=s.length-1;c>=0;c--){const d=s[c];if(d.href===o&&(!r||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const u=document.createElement("link");if(u.rel=r?"stylesheet":R0,r||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),r)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})}))}return l.then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function It(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;t0&&(!t.exp||t.exp-e>Date.now()/1e3))}Vg=typeof atob=="function"?atob:n=>{let e=String(n).replace(/=+$/,"");if(e.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,i,l=0,s=0,o="";i=e.charAt(s++);~i&&(t=l%4?64*t+i:i,l++%4)?o+=String.fromCharCode(255&t>>(-2*l&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};const rf="pb_auth";class V0{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get model(){return this.baseModel}get isValid(){return!da(this.token)}get isAdmin(){return so(this.token).type==="admin"}get isAuthRecord(){return so(this.token).type==="authRecord"}save(e,t){this.baseToken=e||"",this.baseModel=t||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(e,t=rf){const i=j0(e||"")[t]||"";let l={};try{l=JSON.parse(i),(typeof l===null||typeof l!="object"||Array.isArray(l))&&(l={})}catch{}this.save(l.token||"",l.model||null)}exportToCookie(e,t=rf){var a,f;const i={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},l=so(this.token);i.expires=l!=null&&l.exp?new Date(1e3*l.exp):new Date("1970-01-01"),e=Object.assign({},i,e);const s={token:this.token,model:this.model?JSON.parse(JSON.stringify(this.model)):null};let o=of(t,JSON.stringify(s),e);const r=typeof Blob<"u"?new Blob([o]).size:o.length;if(s.model&&r>4096){s.model={id:(a=s==null?void 0:s.model)==null?void 0:a.id,email:(f=s==null?void 0:s.model)==null?void 0:f.email};const u=["collectionId","username","verified"];for(const c in this.model)u.includes(c)&&(s.model[c]=this.model[c]);o=of(t,JSON.stringify(s),e)}return o}onChange(e,t=!1){return this._onChangeCallbacks.push(e),t&&e(this.token,this.model),()=>{for(let i=this._onChangeCallbacks.length-1;i>=0;i--)if(this._onChangeCallbacks[i]==e)return delete this._onChangeCallbacks[i],void this._onChangeCallbacks.splice(i,1)}}triggerChange(){for(const e of this._onChangeCallbacks)e&&e(this.token,this.model)}}class Bg extends V0{constructor(e="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=e,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get model(){return(this._storageGet(this.storageKey)||{}).model||null}save(e,t){this._storageSet(this.storageKey,{token:e,model:t}),super.save(e,t)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(e){if(typeof window<"u"&&(window!=null&&window.localStorage)){const t=window.localStorage.getItem(e)||"";try{return JSON.parse(t)}catch{return t}}return this.storageFallback[e]}_storageSet(e,t){if(typeof window<"u"&&(window!=null&&window.localStorage)){let i=t;typeof t!="string"&&(i=JSON.stringify(t)),window.localStorage.setItem(e,i)}else this.storageFallback[e]=t}_storageRemove(e){var t;typeof window<"u"&&(window!=null&&window.localStorage)&&((t=window.localStorage)==null||t.removeItem(e)),delete this.storageFallback[e]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",e=>{if(e.key!=this.storageKey)return;const t=this._storageGet(this.storageKey)||{};super.save(t.token||"",t.model||null)})}}class nl{constructor(e){this.client=e}}class B0 extends nl{async getAll(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/settings",e)}async update(e,t){return t=Object.assign({method:"PATCH",body:e},t),this.client.send("/api/settings",t)}async testS3(e="storage",t){return t=Object.assign({method:"POST",body:{filesystem:e}},t),this.client.send("/api/settings/test/s3",t).then(()=>!0)}async testEmail(e,t,i){return i=Object.assign({method:"POST",body:{email:e,template:t}},i),this.client.send("/api/settings/test/email",i).then(()=>!0)}async generateAppleClientSecret(e,t,i,l,s,o){return o=Object.assign({method:"POST",body:{clientId:e,teamId:t,keyId:i,privateKey:l,duration:s}},o),this.client.send("/api/settings/apple/generate-client-secret",o)}}class pa extends nl{decode(e){return e}async getFullList(e,t){if(typeof e=="number")return this._getFullList(e,t);let i=500;return(t=Object.assign({},e,t)).batch&&(i=t.batch,delete t.batch),this._getFullList(i,t)}async getList(e=1,t=30,i){return(i=Object.assign({method:"GET"},i)).query=Object.assign({page:e,perPage:t},i.query),this.client.send(this.baseCrudPath,i).then(l=>{var s;return l.items=((s=l.items)==null?void 0:s.map(o=>this.decode(o)))||[],l})}async getFirstListItem(e,t){return(t=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+e},t)).query=Object.assign({filter:e,skipTotal:1},t.query),this.getList(1,1,t).then(i=>{var l;if(!((l=i==null?void 0:i.items)!=null&&l.length))throw new bn({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return i.items[0]})}async getOne(e,t){if(!e)throw new bn({url:this.client.buildUrl(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return t=Object.assign({method:"GET"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),t).then(i=>this.decode(i))}async create(e,t){return t=Object.assign({method:"POST",body:e},t),this.client.send(this.baseCrudPath,t).then(i=>this.decode(i))}async update(e,t,i){return i=Object.assign({method:"PATCH",body:t},i),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),i).then(l=>this.decode(l))}async delete(e,t){return t=Object.assign({method:"DELETE"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),t).then(()=>!0)}_getFullList(e=500,t){(t=t||{}).query=Object.assign({skipTotal:1},t.query);let i=[],l=async s=>this.getList(s,e||500,t).then(o=>{const r=o.items;return i=i.concat(r),r.length==o.perPage?l(s+1):i});return l(1)}}function Sn(n,e,t,i){const l=i!==void 0;return l||t!==void 0?l?(console.warn(n),e.body=Object.assign({},e.body,t),e.query=Object.assign({},e.query,i),e):Object.assign(e,t):e}function nr(n){var e;(e=n._resetAutoRefresh)==null||e.call(n)}class U0 extends pa{get baseCrudPath(){return"/api/admins"}async update(e,t,i){return super.update(e,t,i).then(l=>{var s,o;return((s=this.client.authStore.model)==null?void 0:s.id)===l.id&&((o=this.client.authStore.model)==null?void 0:o.collectionId)===void 0&&this.client.authStore.save(this.client.authStore.token,l),l})}async delete(e,t){return super.delete(e,t).then(i=>{var l,s;return i&&((l=this.client.authStore.model)==null?void 0:l.id)===e&&((s=this.client.authStore.model)==null?void 0:s.collectionId)===void 0&&this.client.authStore.clear(),i})}authResponse(e){const t=this.decode((e==null?void 0:e.admin)||{});return e!=null&&e.token&&(e!=null&&e.admin)&&this.client.authStore.save(e.token,t),Object.assign({},e,{token:(e==null?void 0:e.token)||"",admin:t})}async authWithPassword(e,t,i,l){let s={method:"POST",body:{identity:e,password:t}};s=Sn("This form of authWithPassword(email, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(email, pass, options?).",s,i,l);const o=s.autoRefreshThreshold;delete s.autoRefreshThreshold,s.autoRefresh||nr(this.client);let r=await this.client.send(this.baseCrudPath+"/auth-with-password",s);return r=this.authResponse(r),o&&function(f,u,c,d){nr(f);const m=f.beforeSend,h=f.authStore.model,_=f.authStore.onChange((g,y)=>{(!g||(y==null?void 0:y.id)!=(h==null?void 0:h.id)||(y!=null&&y.collectionId||h!=null&&h.collectionId)&&(y==null?void 0:y.collectionId)!=(h==null?void 0:h.collectionId))&&nr(f)});f._resetAutoRefresh=function(){_(),f.beforeSend=m,delete f._resetAutoRefresh},f.beforeSend=async(g,y)=>{var C;const S=f.authStore.token;if((C=y.query)!=null&&C.autoRefresh)return m?m(g,y):{url:g,sendOptions:y};let T=f.authStore.isValid;if(T&&da(f.authStore.token,u))try{await c()}catch{T=!1}T||await d();const $=y.headers||{};for(let M in $)if(M.toLowerCase()=="authorization"&&S==$[M]&&f.authStore.token){$[M]=f.authStore.token;break}return y.headers=$,m?m(g,y):{url:g,sendOptions:y}}}(this.client,o,()=>this.authRefresh({autoRefresh:!0}),()=>this.authWithPassword(e,t,Object.assign({autoRefresh:!0},s))),r}async authRefresh(e,t){let i={method:"POST"};return i=Sn("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",i,e,t),this.client.send(this.baseCrudPath+"/auth-refresh",i).then(this.authResponse.bind(this))}async requestPasswordReset(e,t,i){let l={method:"POST",body:{email:e}};return l=Sn("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",l,t,i),this.client.send(this.baseCrudPath+"/request-password-reset",l).then(()=>!0)}async confirmPasswordReset(e,t,i,l,s){let o={method:"POST",body:{token:e,password:t,passwordConfirm:i}};return o=Sn("This form of confirmPasswordReset(resetToken, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(resetToken, password, passwordConfirm, options?).",o,l,s),this.client.send(this.baseCrudPath+"/confirm-password-reset",o).then(()=>!0)}}const W0=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function Ug(n){if(n){n.query=n.query||{};for(let e in n)W0.includes(e)||(n.query[e]=n[e],delete n[e])}}class Wg extends nl{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(e,t,i){var o;if(!e)throw new Error("topic must be set.");let l=e;if(i){Ug(i);const r="options="+encodeURIComponent(JSON.stringify({query:i.query,headers:i.headers}));l+=(l.includes("?")?"&":"?")+r}const s=function(r){const a=r;let f;try{f=JSON.parse(a==null?void 0:a.data)}catch{}t(f||{})};return this.subscriptions[l]||(this.subscriptions[l]=[]),this.subscriptions[l].push(s),this.isConnected?this.subscriptions[l].length===1?await this.submitSubscriptions():(o=this.eventSource)==null||o.addEventListener(l,s):await this.connect(),async()=>this.unsubscribeByTopicAndListener(e,s)}async unsubscribe(e){var i;let t=!1;if(e){const l=this.getSubscriptionsByTopic(e);for(let s in l)if(this.hasSubscriptionListeners(s)){for(let o of this.subscriptions[s])(i=this.eventSource)==null||i.removeEventListener(s,o);delete this.subscriptions[s],t||(t=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?t&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(e){var i;let t=!1;for(let l in this.subscriptions)if((l+"?").startsWith(e)){t=!0;for(let s of this.subscriptions[l])(i=this.eventSource)==null||i.removeEventListener(l,s);delete this.subscriptions[l]}t&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(e,t){var s;let i=!1;const l=this.getSubscriptionsByTopic(e);for(let o in l){if(!Array.isArray(this.subscriptions[o])||!this.subscriptions[o].length)continue;let r=!1;for(let a=this.subscriptions[o].length-1;a>=0;a--)this.subscriptions[o][a]===t&&(r=!0,delete this.subscriptions[o][a],this.subscriptions[o].splice(a,1),(s=this.eventSource)==null||s.removeEventListener(o,t));r&&(this.subscriptions[o].length||delete this.subscriptions[o],i||this.hasSubscriptionListeners(o)||(i=!0))}this.hasSubscriptionListeners()?i&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(e){var t,i;if(this.subscriptions=this.subscriptions||{},e)return!!((t=this.subscriptions[e])!=null&&t.length);for(let l in this.subscriptions)if((i=this.subscriptions[l])!=null&&i.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch(e=>{if(!(e!=null&&e.isAbort))throw e})}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(e){const t={};e=e.includes("?")?e:e+"?";for(let i in this.subscriptions)(i+"?").startsWith(e)&&(t[i]=this.subscriptions[i]);return t}getNonEmptySubscriptionKeys(){const e=[];for(let t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let e in this.subscriptions)for(let t of this.subscriptions[e])this.eventSource.addEventListener(e,t)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let e in this.subscriptions)for(let t of this.subscriptions[e])this.eventSource.removeEventListener(e,t)}async connect(){if(!(this.reconnectAttempts>0))return new Promise((e,t)=>{this.pendingConnects.push({resolve:e,reject:t}),this.pendingConnects.length>1||this.initConnect()})}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout(()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))},this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=e=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",e=>{const t=e;this.clientId=t==null?void 0:t.lastEventId,this.submitSubscriptions().then(async()=>{let i=3;for(;this.hasUnsentSubscriptions()&&i>0;)i--,await this.submitSubscriptions()}).then(()=>{for(let l of this.pendingConnects)l.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const i=this.getSubscriptionsByTopic("PB_CONNECT");for(let l in i)for(let s of i[l])s(e)}).catch(i=>{this.clientId="",this.connectErrorHandler(i)})})}hasUnsentSubscriptions(){const e=this.getNonEmptySubscriptionKeys();if(e.length!=this.lastSentSubscriptions.length)return!0;for(const t of e)if(!this.lastSentSubscriptions.includes(t))return!0;return!1}connectErrorHandler(e){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let i of this.pendingConnects)i.reject(new bn(e));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const t=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.initConnect()},t)}disconnect(e=!1){var t;if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(t=this.eventSource)==null||t.close(),this.eventSource=null,this.clientId="",!e){this.reconnectAttempts=0;for(let i of this.pendingConnects)i.resolve();this.pendingConnects=[]}}}class Y0 extends pa{constructor(e,t){super(e),this.collectionIdOrName=t}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}async subscribe(e,t,i){if(!e)throw new Error("Missing topic.");if(!t)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+e,t,i)}async unsubscribe(e){return e?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+e):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(e,t){if(typeof e=="number")return super.getFullList(e,t);const i=Object.assign({},e,t);return super.getFullList(i)}async getList(e=1,t=30,i){return super.getList(e,t,i)}async getFirstListItem(e,t){return super.getFirstListItem(e,t)}async getOne(e,t){return super.getOne(e,t)}async create(e,t){return super.create(e,t)}async update(e,t,i){return super.update(e,t,i).then(l=>{var s,o,r;return((s=this.client.authStore.model)==null?void 0:s.id)!==(l==null?void 0:l.id)||((o=this.client.authStore.model)==null?void 0:o.collectionId)!==this.collectionIdOrName&&((r=this.client.authStore.model)==null?void 0:r.collectionName)!==this.collectionIdOrName||this.client.authStore.save(this.client.authStore.token,l),l})}async delete(e,t){return super.delete(e,t).then(i=>{var l,s,o;return!i||((l=this.client.authStore.model)==null?void 0:l.id)!==e||((s=this.client.authStore.model)==null?void 0:s.collectionId)!==this.collectionIdOrName&&((o=this.client.authStore.model)==null?void 0:o.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),i})}authResponse(e){const t=this.decode((e==null?void 0:e.record)||{});return this.client.authStore.save(e==null?void 0:e.token,t),Object.assign({},e,{token:(e==null?void 0:e.token)||"",record:t})}async listAuthMethods(e){return e=Object.assign({method:"GET"},e),this.client.send(this.baseCollectionPath+"/auth-methods",e).then(t=>Object.assign({},t,{usernamePassword:!!(t!=null&&t.usernamePassword),emailPassword:!!(t!=null&&t.emailPassword),authProviders:Array.isArray(t==null?void 0:t.authProviders)?t==null?void 0:t.authProviders:[]}))}async authWithPassword(e,t,i,l){let s={method:"POST",body:{identity:e,password:t}};return s=Sn("This form of authWithPassword(usernameOrEmail, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(usernameOrEmail, pass, options?).",s,i,l),this.client.send(this.baseCollectionPath+"/auth-with-password",s).then(o=>this.authResponse(o))}async authWithOAuth2Code(e,t,i,l,s,o,r){let a={method:"POST",body:{provider:e,code:t,codeVerifier:i,redirectUrl:l,createData:s}};return a=Sn("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, options?).",a,o,r),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",a).then(f=>this.authResponse(f))}async authWithOAuth2(...e){if(e.length>1||typeof(e==null?void 0:e[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((e==null?void 0:e[0])||"",(e==null?void 0:e[1])||"",(e==null?void 0:e[2])||"",(e==null?void 0:e[3])||"",(e==null?void 0:e[4])||{},(e==null?void 0:e[5])||{},(e==null?void 0:e[6])||{});const t=(e==null?void 0:e[0])||{},i=(await this.listAuthMethods()).authProviders.find(a=>a.name===t.provider);if(!i)throw new bn(new Error(`Missing or invalid provider "${t.provider}".`));const l=this.client.buildUrl("/api/oauth2-redirect"),s=new Wg(this.client);let o=null;function r(){o==null||o.close(),s.unsubscribe()}return t.urlCallback||(o=af(void 0)),new Promise(async(a,f)=>{var u;try{await s.subscribe("@oauth2",async h=>{const _=s.clientId;try{if(!h.state||_!==h.state)throw new Error("State parameters don't match.");const g=Object.assign({},t);delete g.provider,delete g.scopes,delete g.createData,delete g.urlCallback;const y=await this.authWithOAuth2Code(i.name,h.code,i.codeVerifier,l,t.createData,g);a(y)}catch(g){f(new bn(g))}r()});const c={state:s.clientId};(u=t.scopes)!=null&&u.length&&(c.scope=t.scopes.join(" "));const d=this._replaceQueryParams(i.authUrl+l,c);await(t.urlCallback||function(h){o?o.location.href=h:o=af(h)})(d)}catch(c){r(),f(new bn(c))}})}async authRefresh(e,t){let i={method:"POST"};return i=Sn("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",i,e,t),this.client.send(this.baseCollectionPath+"/auth-refresh",i).then(l=>this.authResponse(l))}async requestPasswordReset(e,t,i){let l={method:"POST",body:{email:e}};return l=Sn("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/request-password-reset",l).then(()=>!0)}async confirmPasswordReset(e,t,i,l,s){let o={method:"POST",body:{token:e,password:t,passwordConfirm:i}};return o=Sn("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",o,l,s),this.client.send(this.baseCollectionPath+"/confirm-password-reset",o).then(()=>!0)}async requestVerification(e,t,i){let l={method:"POST",body:{email:e}};return l=Sn("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/request-verification",l).then(()=>!0)}async confirmVerification(e,t,i){let l={method:"POST",body:{token:e}};return l=Sn("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/confirm-verification",l).then(()=>!0)}async requestEmailChange(e,t,i){let l={method:"POST",body:{newEmail:e}};return l=Sn("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/request-email-change",l).then(()=>!0)}async confirmEmailChange(e,t,i,l){let s={method:"POST",body:{token:e,password:t}};return s=Sn("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",s,i,l),this.client.send(this.baseCollectionPath+"/confirm-email-change",s).then(()=>!0)}async listExternalAuths(e,t){return t=Object.assign({method:"GET"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",t)}async unlinkExternalAuth(e,t,i){return i=Object.assign({method:"DELETE"},i),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths/"+encodeURIComponent(t),i).then(()=>!0)}_replaceQueryParams(e,t={}){let i=e,l="";e.indexOf("?")>=0&&(i=e.substring(0,e.indexOf("?")),l=e.substring(e.indexOf("?")+1));const s={},o=l.split("&");for(const r of o){if(r=="")continue;const a=r.split("=");s[decodeURIComponent(a[0].replace(/\+/g," "))]=decodeURIComponent((a[1]||"").replace(/\+/g," "))}for(let r in t)t.hasOwnProperty(r)&&(t[r]==null?delete s[r]:s[r]=t[r]);l="";for(let r in s)s.hasOwnProperty(r)&&(l!=""&&(l+="&"),l+=encodeURIComponent(r.replace(/%20/g,"+"))+"="+encodeURIComponent(s[r].replace(/%20/g,"+")));return l!=""?i+"?"+l:i}}function af(n){if(typeof window>"u"||!(window!=null&&window.open))throw new bn(new Error("Not in a browser context - please pass a custom urlCallback function."));let e=1024,t=768,i=window.innerWidth,l=window.innerHeight;e=e>i?i:e,t=t>l?l:t;let s=i/2-e/2,o=l/2-t/2;return window.open(n,"popup_window","width="+e+",height="+t+",top="+o+",left="+s+",resizable,menubar=no")}class K0 extends pa{get baseCrudPath(){return"/api/collections"}async import(e,t=!1,i){return i=Object.assign({method:"PUT",body:{collections:e,deleteMissing:t}},i),this.client.send(this.baseCrudPath+"/import",i).then(()=>!0)}}class J0 extends nl{async getList(e=1,t=30,i){return(i=Object.assign({method:"GET"},i)).query=Object.assign({page:e,perPage:t},i.query),this.client.send("/api/logs",i)}async getOne(e,t){if(!e)throw new bn({url:this.client.buildUrl("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/"+encodeURIComponent(e),t)}async getStats(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/logs/stats",e)}}class Z0 extends nl{async check(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/health",e)}}class G0 extends nl{getUrl(e,t,i={}){if(!t||!(e!=null&&e.id)||!(e!=null&&e.collectionId)&&!(e!=null&&e.collectionName))return"";const l=[];l.push("api"),l.push("files"),l.push(encodeURIComponent(e.collectionId||e.collectionName)),l.push(encodeURIComponent(e.id)),l.push(encodeURIComponent(t));let s=this.client.buildUrl(l.join("/"));if(Object.keys(i).length){i.download===!1&&delete i.download;const o=new URLSearchParams(i);s+=(s.includes("?")?"&":"?")+o}return s}async getToken(e){return e=Object.assign({method:"POST"},e),this.client.send("/api/files/token",e).then(t=>(t==null?void 0:t.token)||"")}}class X0 extends nl{async getFullList(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/backups",e)}async create(e,t){return t=Object.assign({method:"POST",body:{name:e}},t),this.client.send("/api/backups",t).then(()=>!0)}async upload(e,t){return t=Object.assign({method:"POST",body:e},t),this.client.send("/api/backups/upload",t).then(()=>!0)}async delete(e,t){return t=Object.assign({method:"DELETE"},t),this.client.send(`/api/backups/${encodeURIComponent(e)}`,t).then(()=>!0)}async restore(e,t){return t=Object.assign({method:"POST"},t),this.client.send(`/api/backups/${encodeURIComponent(e)}/restore`,t).then(()=>!0)}getDownloadUrl(e,t){return this.client.buildUrl(`/api/backups/${encodeURIComponent(t)}?token=${encodeURIComponent(e)}`)}}class Ho{constructor(e="/",t,i="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseUrl=e,this.lang=i,this.authStore=t||new Bg,this.admins=new U0(this),this.collections=new K0(this),this.files=new G0(this),this.logs=new J0(this),this.settings=new B0(this),this.realtime=new Wg(this),this.health=new Z0(this),this.backups=new X0(this)}collection(e){return this.recordServices[e]||(this.recordServices[e]=new Y0(this,e)),this.recordServices[e]}autoCancellation(e){return this.enableAutoCancellation=!!e,this}cancelRequest(e){return this.cancelControllers[e]&&(this.cancelControllers[e].abort(),delete this.cancelControllers[e]),this}cancelAllRequests(){for(let e in this.cancelControllers)this.cancelControllers[e].abort();return this.cancelControllers={},this}filter(e,t){if(!t)return e;for(let i in t){let l=t[i];switch(typeof l){case"boolean":case"number":l=""+l;break;case"string":l="'"+l.replace(/'/g,"\\'")+"'";break;default:l=l===null?"null":l instanceof Date?"'"+l.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(l).replace(/'/g,"\\'")+"'"}e=e.replaceAll("{:"+i+"}",l)}return e}getFileUrl(e,t,i={}){return this.files.getUrl(e,t,i)}buildUrl(e){var i;let t=this.baseUrl;return typeof window>"u"||!window.location||t.startsWith("https://")||t.startsWith("http://")||(t=(i=window.location.origin)!=null&&i.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(t+=window.location.pathname||"/",t+=t.endsWith("/")?"":"/"),t+=this.baseUrl),e&&(t+=t.endsWith("/")?"":"/",t+=e.startsWith("/")?e.substring(1):e),t}async send(e,t){t=this.initSendOptions(e,t);let i=this.buildUrl(e);if(this.beforeSend){const l=Object.assign({},await this.beforeSend(i,t));l.url!==void 0||l.options!==void 0?(i=l.url||i,t=l.options||t):Object.keys(l).length&&(t=l,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(t.query!==void 0){const l=this.serializeQueryParams(t.query);l&&(i+=(i.includes("?")?"&":"?")+l),delete t.query}return this.getHeader(t.headers,"Content-Type")=="application/json"&&t.body&&typeof t.body!="string"&&(t.body=JSON.stringify(t.body)),(t.fetch||fetch)(i,t).then(async l=>{let s={};try{s=await l.json()}catch{}if(this.afterSend&&(s=await this.afterSend(l,s)),l.status>=400)throw new bn({url:l.url,status:l.status,data:s});return s}).catch(l=>{throw new bn(l)})}initSendOptions(e,t){if((t=Object.assign({method:"GET"},t)).body=this.convertToFormDataIfNeeded(t.body),Ug(t),t.query=Object.assign({},t.params,t.query),t.requestKey===void 0&&(t.$autoCancel===!1||t.query.$autoCancel===!1?t.requestKey=null:(t.$cancelKey||t.query.$cancelKey)&&(t.requestKey=t.$cancelKey||t.query.$cancelKey)),delete t.$autoCancel,delete t.query.$autoCancel,delete t.$cancelKey,delete t.query.$cancelKey,this.getHeader(t.headers,"Content-Type")!==null||this.isFormData(t.body)||(t.headers=Object.assign({},t.headers,{"Content-Type":"application/json"})),this.getHeader(t.headers,"Accept-Language")===null&&(t.headers=Object.assign({},t.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(t.headers,"Authorization")===null&&(t.headers=Object.assign({},t.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&t.requestKey!==null){const i=t.requestKey||(t.method||"GET")+e;delete t.requestKey,this.cancelRequest(i);const l=new AbortController;this.cancelControllers[i]=l,t.signal=l.signal}return t}convertToFormDataIfNeeded(e){if(typeof FormData>"u"||e===void 0||typeof e!="object"||e===null||this.isFormData(e)||!this.hasBlobField(e))return e;const t=new FormData;for(let i in e){const l=this.normalizeFormDataValue(e[i]),s=Array.isArray(l)?l:[l];if(s.length)for(const o of s)t.append(i,o);else t.append(i,"")}return t}normalizeFormDataValue(e){return e===null||typeof e!="object"||e instanceof Date||this.hasBlobField({data:e})||Array.isArray(e)&&!e.filter(t=>typeof t!="string").length?e:JSON.stringify(e)}hasBlobField(e){for(let t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let l of i)if(typeof Blob<"u"&&l instanceof Blob||typeof File<"u"&&l instanceof File)return!0}return!1}getHeader(e,t){e=e||{},t=t.toLowerCase();for(let i in e)if(i.toLowerCase()==t)return e[i];return null}isFormData(e){return e&&(e.constructor.name==="FormData"||typeof FormData<"u"&&e instanceof FormData)}serializeQueryParams(e){const t=[];for(const i in e){if(e[i]===null)continue;const l=e[i],s=encodeURIComponent(i);if(Array.isArray(l))for(const o of l)t.push(s+"="+encodeURIComponent(o));else l instanceof Date?t.push(s+"="+encodeURIComponent(l.toISOString())):typeof l!==null&&typeof l=="object"?t.push(s+"="+encodeURIComponent(JSON.stringify(l))):t.push(s+"="+encodeURIComponent(l))}return t.join("&")}}class il extends Error{}class Q0 extends il{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class x0 extends il{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class ek extends il{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class gl extends il{}class Yg extends il{constructor(e){super(`Invalid unit ${e}`)}}class hn extends il{}class ki extends il{constructor(){super("Zone is an abstract class")}}const Oe="numeric",Yn="short",Tn="long",yo={year:Oe,month:Oe,day:Oe},Kg={year:Oe,month:Yn,day:Oe},tk={year:Oe,month:Yn,day:Oe,weekday:Yn},Jg={year:Oe,month:Tn,day:Oe},Zg={year:Oe,month:Tn,day:Oe,weekday:Tn},Gg={hour:Oe,minute:Oe},Xg={hour:Oe,minute:Oe,second:Oe},Qg={hour:Oe,minute:Oe,second:Oe,timeZoneName:Yn},xg={hour:Oe,minute:Oe,second:Oe,timeZoneName:Tn},e1={hour:Oe,minute:Oe,hourCycle:"h23"},t1={hour:Oe,minute:Oe,second:Oe,hourCycle:"h23"},n1={hour:Oe,minute:Oe,second:Oe,hourCycle:"h23",timeZoneName:Yn},i1={hour:Oe,minute:Oe,second:Oe,hourCycle:"h23",timeZoneName:Tn},l1={year:Oe,month:Oe,day:Oe,hour:Oe,minute:Oe},s1={year:Oe,month:Oe,day:Oe,hour:Oe,minute:Oe,second:Oe},o1={year:Oe,month:Yn,day:Oe,hour:Oe,minute:Oe},r1={year:Oe,month:Yn,day:Oe,hour:Oe,minute:Oe,second:Oe},nk={year:Oe,month:Yn,day:Oe,weekday:Yn,hour:Oe,minute:Oe},a1={year:Oe,month:Tn,day:Oe,hour:Oe,minute:Oe,timeZoneName:Yn},f1={year:Oe,month:Tn,day:Oe,hour:Oe,minute:Oe,second:Oe,timeZoneName:Yn},u1={year:Oe,month:Tn,day:Oe,weekday:Tn,hour:Oe,minute:Oe,timeZoneName:Tn},c1={year:Oe,month:Tn,day:Oe,weekday:Tn,hour:Oe,minute:Oe,second:Oe,timeZoneName:Tn};class ys{get type(){throw new ki}get name(){throw new ki}get ianaName(){return this.name}get isUniversal(){throw new ki}offsetName(e,t){throw new ki}formatOffset(e,t){throw new ki}offset(e){throw new ki}equals(e){throw new ki}get isValid(){throw new ki}}let ir=null;class zo extends ys{static get instance(){return ir===null&&(ir=new zo),ir}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:i}){return y1(e,t,i)}formatOffset(e,t){return Zl(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let oo={};function ik(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 lk={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function sk(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,l,s,o,r,a,f,u]=i;return[o,l,s,r,a,f,u]}function ok(n,e){const t=n.formatToParts(e),i=[];for(let l=0;l=0?h:1e3+h,(d-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let ff={};function rk(n,e={}){const t=JSON.stringify([n,e]);let i=ff[t];return i||(i=new Intl.ListFormat(n,e),ff[t]=i),i}let qr={};function jr(n,e={}){const t=JSON.stringify([n,e]);let i=qr[t];return i||(i=new Intl.DateTimeFormat(n,e),qr[t]=i),i}let Hr={};function ak(n,e={}){const t=JSON.stringify([n,e]);let i=Hr[t];return i||(i=new Intl.NumberFormat(n,e),Hr[t]=i),i}let zr={};function fk(n,e={}){const{base:t,...i}=e,l=JSON.stringify([n,i]);let s=zr[l];return s||(s=new Intl.RelativeTimeFormat(n,e),zr[l]=s),s}let Wl=null;function uk(){return Wl||(Wl=new Intl.DateTimeFormat().resolvedOptions().locale,Wl)}let uf={};function ck(n){let e=uf[n];if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,uf[n]=e}return e}function dk(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let i,l;try{i=jr(n).resolvedOptions(),l=n}catch{const a=n.substring(0,t);i=jr(a).resolvedOptions(),l=a}const{numberingSystem:s,calendar:o}=i;return[l,s,o]}}function pk(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function mk(n){const e=[];for(let t=1;t<=12;t++){const i=je.utc(2009,t,1);e.push(n(i))}return e}function hk(n){const e=[];for(let t=1;t<=7;t++){const i=je.utc(2016,11,13+t);e.push(n(i))}return e}function As(n,e,t,i){const l=n.listingMode();return l==="error"?null:l==="en"?t(e):i(e)}function _k(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 gk{constructor(e,t,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:l,floor:s,...o}=i;if(!t||Object.keys(o).length>0){const r={useGrouping:!1,...i};i.padTo>0&&(r.minimumIntegerDigits=i.padTo),this.inf=ak(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):ga(e,3);return zt(t,this.padTo)}}}class bk{constructor(e,t,i){this.opts=i,this.originalZone=void 0;let l;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),r=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&pi.create(r).valid?(l=r,this.dt=e):(l="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,l=e.zone.name):(l="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||l,this.dtf=jr(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const i=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:i}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class kk{constructor(e,t,i){this.opts={style:"long",...i},!t&&b1()&&(this.rtf=fk(e,i))}format(e,t){return this.rtf?this.rtf.format(e,t):jk(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const yk={firstDay:1,minimalDays:4,weekend:[6,7]};class bt{static fromOpts(e){return bt.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,i,l,s=!1){const o=e||Rt.defaultLocale,r=o||(s?"en-US":uk()),a=t||Rt.defaultNumberingSystem,f=i||Rt.defaultOutputCalendar,u=Vr(l)||Rt.defaultWeekSettings;return new bt(r,a,f,u,o)}static resetCache(){Wl=null,qr={},Hr={},zr={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:i,weekSettings:l}={}){return bt.create(e,t,i,l)}constructor(e,t,i,l,s){const[o,r,a]=dk(e);this.locale=o,this.numberingSystem=t||r||null,this.outputCalendar=i||a||null,this.weekSettings=l,this.intl=pk(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=_k(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:bt.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Vr(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return As(this,e,S1,()=>{const i=t?{month:e,day:"numeric"}:{month:e},l=t?"format":"standalone";return this.monthsCache[l][e]||(this.monthsCache[l][e]=mk(s=>this.extract(s,i,"month"))),this.monthsCache[l][e]})}weekdays(e,t=!1){return As(this,e,C1,()=>{const i=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},l=t?"format":"standalone";return this.weekdaysCache[l][e]||(this.weekdaysCache[l][e]=hk(s=>this.extract(s,i,"weekday"))),this.weekdaysCache[l][e]})}meridiems(){return As(this,void 0,()=>O1,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[je.utc(2016,11,13,9),je.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return As(this,e,M1,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[je.utc(-40,1,1),je.utc(2017,1,1)].map(i=>this.extract(i,t,"era"))),this.eraCache[e]})}extract(e,t,i){const l=this.dtFormatter(e,t),s=l.formatToParts(),o=s.find(r=>r.type.toLowerCase()===i);return o?o.value:null}numberFormatter(e={}){return new gk(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new bk(e,this.intl,t)}relFormatter(e={}){return new kk(this.intl,this.isEnglish(),e)}listFormatter(e={}){return rk(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:k1()?ck(this.locale):yk}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let lr=null;class un extends ys{static get utcInstance(){return lr===null&&(lr=new un(0)),lr}static instance(e){return e===0?un.utcInstance:new un(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new un(Uo(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Zl(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Zl(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Zl(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 vk extends ys{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 Si(n,e){if(We(n)||n===null)return e;if(n instanceof ys)return n;if($k(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?zo.instance:t==="utc"||t==="gmt"?un.utcInstance:un.parseSpecifier(t)||pi.create(n)}else return Ji(n)?un.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new vk(n)}let cf=()=>Date.now(),df="system",pf=null,mf=null,hf=null,_f=60,gf,bf=null;class Rt{static get now(){return cf}static set now(e){cf=e}static set defaultZone(e){df=e}static get defaultZone(){return Si(df,zo.instance)}static get defaultLocale(){return pf}static set defaultLocale(e){pf=e}static get defaultNumberingSystem(){return mf}static set defaultNumberingSystem(e){mf=e}static get defaultOutputCalendar(){return hf}static set defaultOutputCalendar(e){hf=e}static get defaultWeekSettings(){return bf}static set defaultWeekSettings(e){bf=Vr(e)}static get twoDigitCutoffYear(){return _f}static set twoDigitCutoffYear(e){_f=e%100}static get throwOnInvalid(){return gf}static set throwOnInvalid(e){gf=e}static resetCaches(){bt.resetCache(),pi.resetCache()}}class zn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const d1=[0,31,59,90,120,151,181,212,243,273,304,334],p1=[0,31,60,91,121,152,182,213,244,274,305,335];function Ln(n,e){return new zn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function ma(n,e,t){const i=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&i.setUTCFullYear(i.getUTCFullYear()-1900);const l=i.getUTCDay();return l===0?7:l}function m1(n,e,t){return t+(vs(n)?p1:d1)[e-1]}function h1(n,e){const t=vs(n)?p1:d1,i=t.findIndex(s=>sos(i,e,t)?(f=i+1,a=1):f=i,{weekYear:f,weekNumber:a,weekday:r,...Wo(n)}}function kf(n,e=4,t=1){const{weekYear:i,weekNumber:l,weekday:s}=n,o=ha(ma(i,1,e),t),r=yl(i);let a=l*7+s-o-7+e,f;a<1?(f=i-1,a+=yl(f)):a>r?(f=i+1,a-=yl(i)):f=i;const{month:u,day:c}=h1(f,a);return{year:f,month:u,day:c,...Wo(n)}}function sr(n){const{year:e,month:t,day:i}=n,l=m1(e,t,i);return{year:e,ordinal:l,...Wo(n)}}function yf(n){const{year:e,ordinal:t}=n,{month:i,day:l}=h1(e,t);return{year:e,month:i,day:l,...Wo(n)}}function vf(n,e){if(!We(n.localWeekday)||!We(n.localWeekNumber)||!We(n.localWeekYear)){if(!We(n.weekday)||!We(n.weekNumber)||!We(n.weekYear))throw new gl("Cannot mix locale-based week fields with ISO-based week fields");return We(n.localWeekday)||(n.weekday=n.localWeekday),We(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),We(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function wk(n,e=4,t=1){const i=Vo(n.weekYear),l=Nn(n.weekNumber,1,os(n.weekYear,e,t)),s=Nn(n.weekday,1,7);return i?l?s?!1:Ln("weekday",n.weekday):Ln("week",n.weekNumber):Ln("weekYear",n.weekYear)}function Sk(n){const e=Vo(n.year),t=Nn(n.ordinal,1,yl(n.year));return e?t?!1:Ln("ordinal",n.ordinal):Ln("year",n.year)}function _1(n){const e=Vo(n.year),t=Nn(n.month,1,12),i=Nn(n.day,1,wo(n.year,n.month));return e?t?i?!1:Ln("day",n.day):Ln("month",n.month):Ln("year",n.year)}function g1(n){const{hour:e,minute:t,second:i,millisecond:l}=n,s=Nn(e,0,23)||e===24&&t===0&&i===0&&l===0,o=Nn(t,0,59),r=Nn(i,0,59),a=Nn(l,0,999);return s?o?r?a?!1:Ln("millisecond",l):Ln("second",i):Ln("minute",t):Ln("hour",e)}function We(n){return typeof n>"u"}function Ji(n){return typeof n=="number"}function Vo(n){return typeof n=="number"&&n%1===0}function $k(n){return typeof n=="string"}function Tk(n){return Object.prototype.toString.call(n)==="[object Date]"}function b1(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function k1(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Ck(n){return Array.isArray(n)?n:[n]}function wf(n,e,t){if(n.length!==0)return n.reduce((i,l)=>{const s=[e(l),l];return i&&t(i[0],s[0])===i[0]?i:s},null)[1]}function Ok(n,e){return e.reduce((t,i)=>(t[i]=n[i],t),{})}function Tl(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Vr(n){if(n==null)return null;if(typeof n!="object")throw new hn("Week settings must be an object");if(!Nn(n.firstDay,1,7)||!Nn(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!Nn(e,1,7)))throw new hn("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function Nn(n,e,t){return Vo(n)&&n>=e&&n<=t}function Mk(n,e){return n-e*Math.floor(n/e)}function zt(n,e=2){const t=n<0;let i;return t?i="-"+(""+-n).padStart(e,"0"):i=(""+n).padStart(e,"0"),i}function vi(n){if(!(We(n)||n===null||n===""))return parseInt(n,10)}function Ni(n){if(!(We(n)||n===null||n===""))return parseFloat(n)}function _a(n){if(!(We(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function ga(n,e,t=!1){const i=10**e;return(t?Math.trunc:Math.round)(n*i)/i}function vs(n){return n%4===0&&(n%100!==0||n%400===0)}function yl(n){return vs(n)?366:365}function wo(n,e){const t=Mk(e-1,12)+1,i=n+(e-t)/12;return t===2?vs(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Bo(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(n.year,n.month-1,n.day)),+e}function Sf(n,e,t){return-ha(ma(n,1,e),t)+e-1}function os(n,e=4,t=1){const i=Sf(n,e,t),l=Sf(n+1,e,t);return(yl(n)-i+l)/7}function Br(n){return n>99?n:n>Rt.twoDigitCutoffYear?1900+n:2e3+n}function y1(n,e,t,i=null){const l=new Date(n),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};i&&(s.timeZone=i);const o={timeZoneName:e,...s},r=new Intl.DateTimeFormat(t,o).formatToParts(l).find(a=>a.type.toLowerCase()==="timezonename");return r?r.value:null}function Uo(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const i=parseInt(e,10)||0,l=t<0||Object.is(t,-0)?-i:i;return t*60+l}function v1(n){const e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new hn(`Invalid unit value ${n}`);return e}function So(n,e){const t={};for(const i in n)if(Tl(n,i)){const l=n[i];if(l==null)continue;t[e(i)]=v1(l)}return t}function Zl(n,e){const t=Math.trunc(Math.abs(n/60)),i=Math.trunc(Math.abs(n%60)),l=n>=0?"+":"-";switch(e){case"short":return`${l}${zt(t,2)}:${zt(i,2)}`;case"narrow":return`${l}${t}${i>0?`:${i}`:""}`;case"techie":return`${l}${zt(t,2)}${zt(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Wo(n){return Ok(n,["hour","minute","second","millisecond"])}const Dk=["January","February","March","April","May","June","July","August","September","October","November","December"],w1=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ek=["J","F","M","A","M","J","J","A","S","O","N","D"];function S1(n){switch(n){case"narrow":return[...Ek];case"short":return[...w1];case"long":return[...Dk];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 $1=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],T1=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ik=["M","T","W","T","F","S","S"];function C1(n){switch(n){case"narrow":return[...Ik];case"short":return[...T1];case"long":return[...$1];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const O1=["AM","PM"],Ak=["Before Christ","Anno Domini"],Lk=["BC","AD"],Nk=["B","A"];function M1(n){switch(n){case"narrow":return[...Nk];case"short":return[...Lk];case"long":return[...Ak];default:return null}}function Pk(n){return O1[n.hour<12?0:1]}function Fk(n,e){return C1(e)[n.weekday-1]}function Rk(n,e){return S1(e)[n.month-1]}function qk(n,e){return M1(e)[n.year<0?0:1]}function jk(n,e,t="always",i=!1){const l={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."]},s=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&s){const c=n==="days";switch(e){case 1:return c?"tomorrow":`next ${l[n][0]}`;case-1:return c?"yesterday":`last ${l[n][0]}`;case 0:return c?"today":`this ${l[n][0]}`}}const o=Object.is(e,-0)||e<0,r=Math.abs(e),a=r===1,f=l[n],u=i?a?f[1]:f[2]||f[1]:a?l[n][0]:n;return o?`${r} ${u} ago`:`in ${r} ${u}`}function $f(n,e){let t="";for(const i of n)i.literal?t+=i.val:t+=e(i.val);return t}const Hk={D:yo,DD:Kg,DDD:Jg,DDDD:Zg,t:Gg,tt:Xg,ttt:Qg,tttt:xg,T:e1,TT:t1,TTT:n1,TTTT:i1,f:l1,ff:o1,fff:a1,ffff:u1,F:s1,FF:r1,FFF:f1,FFFF:c1};class ln{static create(e,t={}){return new ln(e,t)}static parseFormat(e){let t=null,i="",l=!1;const s=[];for(let o=0;o0&&s.push({literal:l||/^\s+$/.test(i),val:i}),t=null,i="",l=!l):l||r===t?i+=r:(i.length>0&&s.push({literal:/^\s+$/.test(i),val:i}),i=r,t=r)}return i.length>0&&s.push({literal:l||/^\s+$/.test(i),val:i}),s}static macroTokenToFormatOpts(e){return Hk[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()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return zt(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",l=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(m,h)=>this.loc.extract(e,m,h),o=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",r=()=>i?Pk(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(m,h)=>i?Rk(e,m):s(h?{month:m}:{month:m,day:"numeric"},"month"),f=(m,h)=>i?Fk(e,m):s(h?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),u=m=>{const h=ln.macroTokenToFormatOpts(m);return h?this.formatWithSystemDefault(e,h):m},c=m=>i?qk(e,m):s({era:m},"era"),d=m=>{switch(m){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 l?s({day:"numeric"},"day"):this.num(e.day);case"dd":return l?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return f("short",!0);case"cccc":return f("long",!0);case"ccccc":return f("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return f("short",!1);case"EEEE":return f("long",!1);case"EEEEE":return f("narrow",!1);case"L":return l?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return l?s({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 l?s({month:"numeric"},"month"):this.num(e.month);case"MM":return l?s({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 l?s({year:"numeric"},"year"):this.num(e.year);case"yy":return l?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return l?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return l?s({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"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);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 u(m)}};return $f(ln.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}},l=a=>f=>{const u=i(f);return u?this.num(a.get(u),f.length):f},s=ln.parseFormat(t),o=s.reduce((a,{literal:f,val:u})=>f?a:a.concat(u),[]),r=e.shiftTo(...o.map(i).filter(a=>a));return $f(s,l(r))}}const D1=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function El(...n){const e=n.reduce((t,i)=>t+i.source,"");return RegExp(`^${e}$`)}function Il(...n){return e=>n.reduce(([t,i,l],s)=>{const[o,r,a]=s(e,l);return[{...t,...o},r||i,a]},[{},null,1]).slice(0,2)}function Al(n,...e){if(n==null)return[null,null];for(const[t,i]of e){const l=t.exec(n);if(l)return i(l)}return[null,null]}function E1(...n){return(e,t)=>{const i={};let l;for(l=0;lm!==void 0&&(h||m&&u)?-m:m;return[{years:d(Ni(t)),months:d(Ni(i)),weeks:d(Ni(l)),days:d(Ni(s)),hours:d(Ni(o)),minutes:d(Ni(r)),seconds:d(Ni(a),a==="-0"),milliseconds:d(_a(f),c)}]}const xk={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 ya(n,e,t,i,l,s,o){const r={year:e.length===2?Br(vi(e)):vi(e),month:w1.indexOf(t)+1,day:vi(i),hour:vi(l),minute:vi(s)};return o&&(r.second=vi(o)),n&&(r.weekday=n.length>3?$1.indexOf(n)+1:T1.indexOf(n)+1),r}const ey=/^(?:(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 ty(n){const[,e,t,i,l,s,o,r,a,f,u,c]=n,d=ya(e,l,i,t,s,o,r);let m;return a?m=xk[a]:f?m=0:m=Uo(u,c),[d,new un(m)]}function ny(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const iy=/^(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$/,ly=/^(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$/,sy=/^(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 Tf(n){const[,e,t,i,l,s,o,r]=n;return[ya(e,l,i,t,s,o,r),un.utcInstance]}function oy(n){const[,e,t,i,l,s,o,r]=n;return[ya(e,r,t,i,l,s,o),un.utcInstance]}const ry=El(Vk,ka),ay=El(Bk,ka),fy=El(Uk,ka),uy=El(A1),N1=Il(Zk,Ll,ws,Ss),cy=Il(Wk,Ll,ws,Ss),dy=Il(Yk,Ll,ws,Ss),py=Il(Ll,ws,Ss);function my(n){return Al(n,[ry,N1],[ay,cy],[fy,dy],[uy,py])}function hy(n){return Al(ny(n),[ey,ty])}function _y(n){return Al(n,[iy,Tf],[ly,Tf],[sy,oy])}function gy(n){return Al(n,[Xk,Qk])}const by=Il(Ll);function ky(n){return Al(n,[Gk,by])}const yy=El(Kk,Jk),vy=El(L1),wy=Il(Ll,ws,Ss);function Sy(n){return Al(n,[yy,N1],[vy,wy])}const Cf="Invalid Duration",P1={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}},$y={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},...P1},Mn=146097/400,pl=146097/4800,Ty={years:{quarters:4,months:12,weeks:Mn/7,days:Mn,hours:Mn*24,minutes:Mn*24*60,seconds:Mn*24*60*60,milliseconds:Mn*24*60*60*1e3},quarters:{months:3,weeks:Mn/28,days:Mn/4,hours:Mn*24/4,minutes:Mn*24*60/4,seconds:Mn*24*60*60/4,milliseconds:Mn*24*60*60*1e3/4},months:{weeks:pl/7,days:pl,hours:pl*24,minutes:pl*24*60,seconds:pl*24*60*60,milliseconds:pl*24*60*60*1e3},...P1},Ui=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Cy=Ui.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,matrix:e.matrix||n.matrix};return new ot(i)}function F1(n,e){let t=e.milliseconds??0;for(const i of Cy.slice(1))e[i]&&(t+=e[i]*n[i].milliseconds);return t}function Of(n,e){const t=F1(n,e)<0?-1:1;Ui.reduceRight((i,l)=>{if(We(e[l]))return i;if(i){const s=e[i]*t,o=n[l][i],r=Math.floor(s/o);e[l]+=r*t,e[i]-=r*o*t}return l},null),Ui.reduce((i,l)=>{if(We(e[l]))return i;if(i){const s=e[i]%1;e[i]-=s,e[l]+=s*n[i][l]}return l},null)}function Oy(n){const e={};for(const[t,i]of Object.entries(n))i!==0&&(e[t]=i);return e}class ot{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let i=t?Ty:$y;e.matrix&&(i=e.matrix),this.values=e.values,this.loc=e.loc||bt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=i,this.isLuxonDuration=!0}static fromMillis(e,t){return ot.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new hn(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new ot({values:So(e,ot.normalizeUnit),loc:bt.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Ji(e))return ot.fromMillis(e);if(ot.isDuration(e))return e;if(typeof e=="object")return ot.fromObject(e);throw new hn(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[i]=gy(e);return i?ot.fromObject(i,t):ot.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[i]=ky(e);return i?ot.fromObject(i,t):ot.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new hn("need to specify a reason the Duration is invalid");const i=e instanceof zn?e:new zn(e,t);if(Rt.throwOnInvalid)throw new ek(i);return new ot({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 Yg(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?ln.create(this.loc,i).formatDurationFromString(this,e):Cf}toHuman(e={}){if(!this.isValid)return Cf;const t=Ui.map(i=>{const l=this.values[i];return We(l)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(l)}).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+=ga(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},je.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?F1(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=ot.fromDurationLike(e),i={};for(const l of Ui)(Tl(t.values,l)||Tl(this.values,l))&&(i[l]=t.get(l)+this.get(l));return yi(this,{values:i},!0)}minus(e){if(!this.isValid)return this;const t=ot.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]=v1(e(this.values[i],i));return yi(this,{values:t},!0)}get(e){return this[ot.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...So(e,ot.normalizeUnit)};return yi(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:i,matrix:l}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:l,conversionAccuracy:i};return yi(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Of(this.matrix,e),yi(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Oy(this.normalize().shiftToAll().toObject());return yi(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>ot.normalizeUnit(o));const t={},i={},l=this.toObject();let s;for(const o of Ui)if(e.indexOf(o)>=0){s=o;let r=0;for(const f in i)r+=this.matrix[f][o]*i[f],i[f]=0;Ji(l[o])&&(r+=l[o]);const a=Math.trunc(r);t[o]=a,i[o]=(r*1e3-a*1e3)/1e3}else Ji(l[o])&&(i[o]=l[o]);for(const o in i)i[o]!==0&&(t[s]+=o===s?i[o]:i[o]/this.matrix[s][o]);return Of(this.matrix,t),yi(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}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,l){return i===void 0||i===0?l===void 0||l===0:i===l}for(const i of Ui)if(!t(this.values[i],e.values[i]))return!1;return!0}}const ml="Invalid Interval";function My(n,e){return!n||!n.isValid?Pt.invalid("missing or invalid start"):!e||!e.isValid?Pt.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?Pt.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(jl).filter(o=>this.contains(o)).sort((o,r)=>o.toMillis()-r.toMillis()),i=[];let{s:l}=this,s=0;for(;l+this.e?this.e:o;i.push(Pt.fromDateTimes(l,r)),l=r,s+=1}return i}splitBy(e){const t=ot.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:i}=this,l=1,s;const o=[];for(;ia*l));s=+r>+this.e?this.e:r,o.push(Pt.fromDateTimes(i,s)),i=s,l+=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:Pt.fromDateTimes(t,i)}union(e){if(!this.isValid)return this;const t=this.se.e?this.e:e.e;return Pt.fromDateTimes(t,i)}static merge(e){const[t,i]=e.sort((l,s)=>l.s-s.s).reduce(([l,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[l,s.union(o)]:[l.concat([s]),o]:[l,o],[[],null]);return i&&t.push(i),t}static xor(e){let t=null,i=0;const l=[],s=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...s),r=o.sort((a,f)=>a.time-f.time);for(const a of r)i+=a.type==="s"?1:-1,i===1?t=a.time:(t&&+t!=+a.time&&l.push(Pt.fromDateTimes(t,a.time)),t=null);return Pt.merge(l)}difference(...e){return Pt.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ml}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=yo,t={}){return this.isValid?ln.create(this.s.loc.clone(t),e).formatInterval(this):ml}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ml}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ml}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ml}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ml}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):ot.invalid(this.invalidReason)}mapEndpoints(e){return Pt.fromDateTimes(e(this.s),e(this.e))}}class Ls{static hasDST(e=Rt.defaultZone){const t=je.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return pi.isValidZone(e)}static normalizeZone(e){return Si(e,Rt.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||bt.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||bt.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||bt.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null,outputCalendar:s="gregory"}={}){return(l||bt.create(t,i,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null,outputCalendar:s="gregory"}={}){return(l||bt.create(t,i,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null}={}){return(l||bt.create(t,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null}={}){return(l||bt.create(t,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return bt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return bt.create(t,null,"gregory").eras(e)}static features(){return{relative:b1(),localeWeek:k1()}}}function Mf(n,e){const t=l=>l.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=t(e)-t(n);return Math.floor(ot.fromMillis(i).as("days"))}function Dy(n,e,t){const i=[["years",(a,f)=>f.year-a.year],["quarters",(a,f)=>f.quarter-a.quarter+(f.year-a.year)*4],["months",(a,f)=>f.month-a.month+(f.year-a.year)*12],["weeks",(a,f)=>{const u=Mf(a,f);return(u-u%7)/7}],["days",Mf]],l={},s=n;let o,r;for(const[a,f]of i)t.indexOf(a)>=0&&(o=a,l[a]=f(n,e),r=s.plus(l),r>e?(l[a]--,n=s.plus(l),n>e&&(r=n,l[a]--,n=s.plus(l))):n=r);return[n,l,r,o]}function Ey(n,e,t,i){let[l,s,o,r]=Dy(n,e,t);const a=e-l,f=t.filter(c=>["hours","minutes","seconds","milliseconds"].indexOf(c)>=0);f.length===0&&(o0?ot.fromMillis(a,i).shiftTo(...f).plus(u):u}const va={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Df={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]},Iy=va.hanidec.replace(/[\[|\]]/g,"").split("");function Ay(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t=s&&i<=o&&(e+=i-s)}}return parseInt(e,10)}else return e}function jn({numberingSystem:n},e=""){return new RegExp(`${va[n||"latn"]}${e}`)}const Ly="missing Intl.DateTimeFormat.formatToParts support";function ft(n,e=t=>t){return{regex:n,deser:([t])=>e(Ay(t))}}const Ny=" ",R1=`[ ${Ny}]`,q1=new RegExp(R1,"g");function Py(n){return n.replace(/\./g,"\\.?").replace(q1,R1)}function Ef(n){return n.replace(/\./g,"").replace(q1," ").toLowerCase()}function Hn(n,e){return n===null?null:{regex:RegExp(n.map(Py).join("|")),deser:([t])=>n.findIndex(i=>Ef(t)===Ef(i))+e}}function If(n,e){return{regex:n,deser:([,t,i])=>Uo(t,i),groups:e}}function Ns(n){return{regex:n,deser:([e])=>e}}function Fy(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ry(n,e){const t=jn(e),i=jn(e,"{2}"),l=jn(e,"{3}"),s=jn(e,"{4}"),o=jn(e,"{6}"),r=jn(e,"{1,2}"),a=jn(e,"{1,3}"),f=jn(e,"{1,6}"),u=jn(e,"{1,9}"),c=jn(e,"{2,4}"),d=jn(e,"{4,6}"),m=g=>({regex:RegExp(Fy(g.val)),deser:([y])=>y,literal:!0}),_=(g=>{if(n.literal)return m(g);switch(g.val){case"G":return Hn(e.eras("short"),0);case"GG":return Hn(e.eras("long"),0);case"y":return ft(f);case"yy":return ft(c,Br);case"yyyy":return ft(s);case"yyyyy":return ft(d);case"yyyyyy":return ft(o);case"M":return ft(r);case"MM":return ft(i);case"MMM":return Hn(e.months("short",!0),1);case"MMMM":return Hn(e.months("long",!0),1);case"L":return ft(r);case"LL":return ft(i);case"LLL":return Hn(e.months("short",!1),1);case"LLLL":return Hn(e.months("long",!1),1);case"d":return ft(r);case"dd":return ft(i);case"o":return ft(a);case"ooo":return ft(l);case"HH":return ft(i);case"H":return ft(r);case"hh":return ft(i);case"h":return ft(r);case"mm":return ft(i);case"m":return ft(r);case"q":return ft(r);case"qq":return ft(i);case"s":return ft(r);case"ss":return ft(i);case"S":return ft(a);case"SSS":return ft(l);case"u":return Ns(u);case"uu":return Ns(r);case"uuu":return ft(t);case"a":return Hn(e.meridiems(),0);case"kkkk":return ft(s);case"kk":return ft(c,Br);case"W":return ft(r);case"WW":return ft(i);case"E":case"c":return ft(t);case"EEE":return Hn(e.weekdays("short",!1),1);case"EEEE":return Hn(e.weekdays("long",!1),1);case"ccc":return Hn(e.weekdays("short",!0),1);case"cccc":return Hn(e.weekdays("long",!0),1);case"Z":case"ZZ":return If(new RegExp(`([+-]${r.source})(?::(${i.source}))?`),2);case"ZZZ":return If(new RegExp(`([+-]${r.source})(${i.source})?`),2);case"z":return Ns(/[a-z_+-/]{1,256}?/i);case" ":return Ns(/[^\S\n\r]/);default:return m(g)}})(n)||{invalidReason:Ly};return _.token=n,_}const qy={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",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function jy(n,e,t){const{type:i,value:l}=n;if(i==="literal"){const a=/^\s+$/.test(l);return{literal:!a,val:a?" ":l}}const s=e[i];let o=i;i==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let r=qy[o];if(typeof r=="object"&&(r=r[s]),r)return{literal:!1,val:r}}function Hy(n){return[`^${n.map(t=>t.regex).reduce((t,i)=>`${t}(${i.source})`,"")}$`,n]}function zy(n,e,t){const i=n.match(e);if(i){const l={};let s=1;for(const o in t)if(Tl(t,o)){const r=t[o],a=r.groups?r.groups+1:1;!r.literal&&r.token&&(l[r.token.val[0]]=r.deser(i.slice(s,s+a))),s+=a}return[i,l]}else return[i,{}]}function Vy(n){const e=s=>{switch(s){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 We(n.z)||(t=pi.create(n.z)),We(n.Z)||(t||(t=new un(n.Z)),i=n.Z),We(n.q)||(n.M=(n.q-1)*3+1),We(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),We(n.u)||(n.S=_a(n.u)),[Object.keys(n).reduce((s,o)=>{const r=e(o);return r&&(s[r]=n[o]),s},{}),t,i]}let or=null;function By(){return or||(or=je.fromMillis(1555555555555)),or}function Uy(n,e){if(n.literal)return n;const t=ln.macroTokenToFormatOpts(n.val),i=z1(t,e);return i==null||i.includes(void 0)?n:i}function j1(n,e){return Array.prototype.concat(...n.map(t=>Uy(t,e)))}function H1(n,e,t){const i=j1(ln.parseFormat(t),n),l=i.map(o=>Ry(o,n)),s=l.find(o=>o.invalidReason);if(s)return{input:e,tokens:i,invalidReason:s.invalidReason};{const[o,r]=Hy(l),a=RegExp(o,"i"),[f,u]=zy(e,a,r),[c,d,m]=u?Vy(u):[null,null,void 0];if(Tl(u,"a")&&Tl(u,"H"))throw new gl("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:i,regex:a,rawMatches:f,matches:u,result:c,zone:d,specificOffset:m}}}function Wy(n,e,t){const{result:i,zone:l,specificOffset:s,invalidReason:o}=H1(n,e,t);return[i,l,s,o]}function z1(n,e){if(!n)return null;const i=ln.create(e,n).dtFormatter(By()),l=i.formatToParts(),s=i.resolvedOptions();return l.map(o=>jy(o,n,s))}const rr="Invalid DateTime",Af=864e13;function Ps(n){return new zn("unsupported zone",`the zone "${n.name}" is not supported`)}function ar(n){return n.weekData===null&&(n.weekData=vo(n.c)),n.weekData}function fr(n){return n.localWeekData===null&&(n.localWeekData=vo(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function Pi(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new je({...t,...e,old:t})}function V1(n,e,t){let i=n-e*60*1e3;const l=t.offset(i);if(e===l)return[i,e];i-=(l-e)*60*1e3;const s=t.offset(i);return l===s?[i,l]:[n-Math.min(l,s)*60*1e3,Math.max(l,s)]}function Fs(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 V1(Bo(n),e,t)}function Lf(n,e){const t=n.o,i=n.c.year+Math.trunc(e.years),l=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...n.c,year:i,month:l,day:Math.min(n.c.day,wo(i,l))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=ot.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=Bo(s);let[a,f]=V1(r,t,n.zone);return o!==0&&(a+=o,f=n.zone.offset(a)),{ts:a,o:f}}function ql(n,e,t,i,l,s){const{setZone:o,zone:r}=t;if(n&&Object.keys(n).length!==0||e){const a=e||r,f=je.fromObject(n,{...t,zone:a,specificOffset:s});return o?f:f.setZone(r)}else return je.invalid(new zn("unparsable",`the input "${l}" can't be parsed as ${i}`))}function Rs(n,e,t=!0){return n.isValid?ln.create(bt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function ur(n,e){const t=n.c.year>9999||n.c.year<0;let i="";return t&&n.c.year>=0&&(i+="+"),i+=zt(n.c.year,t?6:4),e?(i+="-",i+=zt(n.c.month),i+="-",i+=zt(n.c.day)):(i+=zt(n.c.month),i+=zt(n.c.day)),i}function Nf(n,e,t,i,l,s){let o=zt(n.c.hour);return e?(o+=":",o+=zt(n.c.minute),(n.c.millisecond!==0||n.c.second!==0||!t)&&(o+=":")):o+=zt(n.c.minute),(n.c.millisecond!==0||n.c.second!==0||!t)&&(o+=zt(n.c.second),(n.c.millisecond!==0||!i)&&(o+=".",o+=zt(n.c.millisecond,3))),l&&(n.isOffsetFixed&&n.offset===0&&!s?o+="Z":n.o<0?(o+="-",o+=zt(Math.trunc(-n.o/60)),o+=":",o+=zt(Math.trunc(-n.o%60))):(o+="+",o+=zt(Math.trunc(n.o/60)),o+=":",o+=zt(Math.trunc(n.o%60)))),s&&(o+="["+n.zone.ianaName+"]"),o}const B1={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Yy={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ky={ordinal:1,hour:0,minute:0,second:0,millisecond:0},U1=["year","month","day","hour","minute","second","millisecond"],Jy=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Zy=["year","ordinal","hour","minute","second","millisecond"];function Gy(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 Yg(n);return e}function Pf(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Gy(n)}}function Ff(n,e){const t=Si(e.zone,Rt.defaultZone),i=bt.fromObject(e),l=Rt.now();let s,o;if(We(n.year))s=l;else{for(const f of U1)We(n[f])&&(n[f]=B1[f]);const r=_1(n)||g1(n);if(r)return je.invalid(r);const a=t.offset(l);[s,o]=ro(n,a,t)}return new je({ts:s,zone:t,loc:i,o})}function Rf(n,e,t){const i=We(t.round)?!0:t.round,l=(o,r)=>(o=ga(o,i||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(o,r)),s=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 l(s(t.unit),t.unit);for(const o of t.units){const r=s(o);if(Math.abs(r)>=1)return l(r,o)}return l(n>e?-0:0,t.units[t.units.length-1])}function qf(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 je{constructor(e){const t=e.zone||Rt.defaultZone;let i=e.invalid||(Number.isNaN(e.ts)?new zn("invalid input"):null)||(t.isValid?null:Ps(t));this.ts=We(e.ts)?Rt.now():e.ts;let l=null,s=null;if(!i)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[l,s]=[e.old.c,e.old.o];else{const r=t.offset(this.ts);l=Fs(this.ts,r),i=Number.isNaN(l.year)?new zn("invalid input"):null,l=i?null:l,s=i?null:r}this._zone=t,this.loc=e.loc||bt.create(),this.invalid=i,this.weekData=null,this.localWeekData=null,this.c=l,this.o=s,this.isLuxonDateTime=!0}static now(){return new je({})}static local(){const[e,t]=qf(arguments),[i,l,s,o,r,a,f]=t;return Ff({year:i,month:l,day:s,hour:o,minute:r,second:a,millisecond:f},e)}static utc(){const[e,t]=qf(arguments),[i,l,s,o,r,a,f]=t;return e.zone=un.utcInstance,Ff({year:i,month:l,day:s,hour:o,minute:r,second:a,millisecond:f},e)}static fromJSDate(e,t={}){const i=Tk(e)?e.valueOf():NaN;if(Number.isNaN(i))return je.invalid("invalid input");const l=Si(t.zone,Rt.defaultZone);return l.isValid?new je({ts:i,zone:l,loc:bt.fromObject(t)}):je.invalid(Ps(l))}static fromMillis(e,t={}){if(Ji(e))return e<-Af||e>Af?je.invalid("Timestamp out of range"):new je({ts:e,zone:Si(t.zone,Rt.defaultZone),loc:bt.fromObject(t)});throw new hn(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Ji(e))return new je({ts:e*1e3,zone:Si(t.zone,Rt.defaultZone),loc:bt.fromObject(t)});throw new hn("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const i=Si(t.zone,Rt.defaultZone);if(!i.isValid)return je.invalid(Ps(i));const l=bt.fromObject(t),s=So(e,Pf),{minDaysInFirstWeek:o,startOfWeek:r}=vf(s,l),a=Rt.now(),f=We(t.specificOffset)?i.offset(a):t.specificOffset,u=!We(s.ordinal),c=!We(s.year),d=!We(s.month)||!We(s.day),m=c||d,h=s.weekYear||s.weekNumber;if((m||u)&&h)throw new gl("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new gl("Can't mix ordinal dates with month/day");const _=h||s.weekday&&!m;let g,y,S=Fs(a,f);_?(g=Jy,y=Yy,S=vo(S,o,r)):u?(g=Zy,y=Ky,S=sr(S)):(g=U1,y=B1);let T=!1;for(const R of g){const F=s[R];We(F)?T?s[R]=y[R]:s[R]=S[R]:T=!0}const $=_?wk(s,o,r):u?Sk(s):_1(s),C=$||g1(s);if(C)return je.invalid(C);const M=_?kf(s,o,r):u?yf(s):s,[D,I]=ro(M,f,i),L=new je({ts:D,zone:i,o:I,loc:l});return s.weekday&&m&&e.weekday!==L.weekday?je.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${L.toISO()}`):L}static fromISO(e,t={}){const[i,l]=my(e);return ql(i,l,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[i,l]=hy(e);return ql(i,l,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[i,l]=_y(e);return ql(i,l,t,"HTTP",t)}static fromFormat(e,t,i={}){if(We(e)||We(t))throw new hn("fromFormat requires an input string and a format");const{locale:l=null,numberingSystem:s=null}=i,o=bt.fromOpts({locale:l,numberingSystem:s,defaultToEN:!0}),[r,a,f,u]=Wy(o,e,t);return u?je.invalid(u):ql(r,a,i,`format ${t}`,e,f)}static fromString(e,t,i={}){return je.fromFormat(e,t,i)}static fromSQL(e,t={}){const[i,l]=Sy(e);return ql(i,l,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new hn("need to specify a reason the DateTime is invalid");const i=e instanceof zn?e:new zn(e,t);if(Rt.throwOnInvalid)throw new Q0(i);return new je({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const i=z1(e,bt.fromObject(t));return i?i.map(l=>l?l.val:null).join(""):null}static expandFormat(e,t={}){return j1(ln.parseFormat(e),bt.fromObject(t)).map(l=>l.val).join("")}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?ar(this).weekYear:NaN}get weekNumber(){return this.isValid?ar(this).weekNumber:NaN}get weekday(){return this.isValid?ar(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?fr(this).weekday:NaN}get localWeekNumber(){return this.isValid?fr(this).weekNumber:NaN}get localWeekYear(){return this.isValid?fr(this).weekYear:NaN}get ordinal(){return this.isValid?sr(this.c).ordinal:NaN}get monthShort(){return this.isValid?Ls.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Ls.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Ls.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Ls.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}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,i=Bo(this.c),l=this.zone.offset(i-e),s=this.zone.offset(i+e),o=this.zone.offset(i-l*t),r=this.zone.offset(i-s*t);if(o===r)return[this];const a=i-o*t,f=i-r*t,u=Fs(a,o),c=Fs(f,r);return u.hour===c.hour&&u.minute===c.minute&&u.second===c.second&&u.millisecond===c.millisecond?[Pi(this,{ts:a}),Pi(this,{ts:f})]:[this]}get isInLeapYear(){return vs(this.year)}get daysInMonth(){return wo(this.year,this.month)}get daysInYear(){return this.isValid?yl(this.year):NaN}get weeksInWeekYear(){return this.isValid?os(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?os(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:i,calendar:l}=ln.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:i,outputCalendar:l}}toUTC(e=0,t={}){return this.setZone(un.instance(e),t)}toLocal(){return this.setZone(Rt.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:i=!1}={}){if(e=Si(e,Rt.defaultZone),e.equals(this.zone))return this;if(e.isValid){let l=this.ts;if(t||i){const s=e.offset(this.ts),o=this.toObject();[l]=ro(o,s,e)}return Pi(this,{ts:l,zone:e})}else return je.invalid(Ps(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:i}={}){const l=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:i});return Pi(this,{loc:l})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=So(e,Pf),{minDaysInFirstWeek:i,startOfWeek:l}=vf(t,this.loc),s=!We(t.weekYear)||!We(t.weekNumber)||!We(t.weekday),o=!We(t.ordinal),r=!We(t.year),a=!We(t.month)||!We(t.day),f=r||a,u=t.weekYear||t.weekNumber;if((f||o)&&u)throw new gl("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new gl("Can't mix ordinal dates with month/day");let c;s?c=kf({...vo(this.c,i,l),...t},i,l):We(t.ordinal)?(c={...this.toObject(),...t},We(t.day)&&(c.day=Math.min(wo(c.year,c.month),c.day))):c=yf({...sr(this.c),...t});const[d,m]=ro(c,this.o,this.zone);return Pi(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;const t=ot.fromDurationLike(e);return Pi(this,Lf(this,t))}minus(e){if(!this.isValid)return this;const t=ot.fromDurationLike(e).negate();return Pi(this,Lf(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const i={},l=ot.normalizeUnit(e);switch(l){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(l==="weeks")if(t){const s=this.loc.getStartOfWeek(),{weekday:o}=this;othis.valueOf(),r=o?this:e,a=o?e:this,f=Ey(r,a,s,l);return o?f.negate():f}diffNow(e="milliseconds",t={}){return this.diff(je.now(),e,t)}until(e){return this.isValid?Pt.fromDateTimes(this,e):this}hasSame(e,t,i){if(!this.isValid)return!1;const l=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,i)<=l&&l<=s.endOf(t,i)}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||je.fromObject({},{zone:this.zone}),i=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(je.isDateTime))throw new hn("max requires all arguments be DateTimes");return wf(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,i={}){const{locale:l=null,numberingSystem:s=null}=i,o=bt.fromOpts({locale:l,numberingSystem:s,defaultToEN:!0});return H1(o,e,t)}static fromStringExplain(e,t,i={}){return je.fromFormatExplain(e,t,i)}static get DATE_SHORT(){return yo}static get DATE_MED(){return Kg}static get DATE_MED_WITH_WEEKDAY(){return tk}static get DATE_FULL(){return Jg}static get DATE_HUGE(){return Zg}static get TIME_SIMPLE(){return Gg}static get TIME_WITH_SECONDS(){return Xg}static get TIME_WITH_SHORT_OFFSET(){return Qg}static get TIME_WITH_LONG_OFFSET(){return xg}static get TIME_24_SIMPLE(){return e1}static get TIME_24_WITH_SECONDS(){return t1}static get TIME_24_WITH_SHORT_OFFSET(){return n1}static get TIME_24_WITH_LONG_OFFSET(){return i1}static get DATETIME_SHORT(){return l1}static get DATETIME_SHORT_WITH_SECONDS(){return s1}static get DATETIME_MED(){return o1}static get DATETIME_MED_WITH_SECONDS(){return r1}static get DATETIME_MED_WITH_WEEKDAY(){return nk}static get DATETIME_FULL(){return a1}static get DATETIME_FULL_WITH_SECONDS(){return f1}static get DATETIME_HUGE(){return u1}static get DATETIME_HUGE_WITH_SECONDS(){return c1}}function jl(n){if(je.isDateTime(n))return n;if(n&&n.valueOf&&Ji(n.valueOf()))return je.fromJSDate(n);if(n&&typeof n=="object")return je.fromObject(n);throw new hn(`Unknown datetime argument: ${n}, of type ${typeof n}`)}const Xy=[".jpg",".jpeg",".png",".svg",".gif",".jfif",".webp",".avif"],Qy=[".mp4",".avi",".mov",".3gp",".wmv"],xy=[".aa",".aac",".m4v",".mp3",".ogg",".oga",".mogg",".amr"],ev=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".odp",".odt",".ods",".txt"],W1=[{level:-4,label:"DEBUG",class:""},{level:0,label:"INFO",class:"label-success"},{level:4,label:"WARN",class:"label-warning"},{level:8,label:"ERROR",class:"label-danger"}];class H{static isObject(e){return e!==null&&typeof e=="object"&&e.constructor===Object}static clone(e){return typeof structuredClone<"u"?structuredClone(e):JSON.parse(JSON.stringify(e))}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||H.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==null?void 0:e.isContentEditable)}static isFocusable(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return H.isInput(e)||t==="button"||t==="a"||t==="details"||(e==null?void 0:e.tabIndex)>=0}static hasNonEmptyProps(e){for(let t in e)if(!H.isEmpty(e[t]))return!0;return!1}static toArray(e,t=!1){return Array.isArray(e)?e.slice():(t||!H.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){H.inArray(e,t)||e.push(t)}static findByKey(e,t,i){e=Array.isArray(e)?e:[];for(let l in e)if(e[l][t]==i)return e[l];return null}static groupByKey(e,t){e=Array.isArray(e)?e:[];const i={};for(let l in e)i[e[l][t]]=i[e[l][t]]||[],i[e[l][t]].push(e[l]);return i}static removeByKey(e,t,i){for(let l in e)if(e[l][t]==i){e.splice(l,1);break}}static pushOrReplaceByKey(e,t,i="id"){for(let l=e.length-1;l>=0;l--)if(e[l][i]==t[i]){e[l]=t;return}e.push(t)}static filterDuplicatesByKey(e,t="id"){e=Array.isArray(e)?e:[];const i={};for(const l of e)i[l[t]]=l;return Object.values(i)}static filterRedactedProps(e,t="******"){const i=JSON.parse(JSON.stringify(e||{}));for(let l in i)typeof i[l]=="object"&&i[l]!==null?i[l]=H.filterRedactedProps(i[l],t):i[l]===t&&delete i[l];return i}static getNestedVal(e,t,i=null,l="."){let s=e||{},o=(t||"").split(l);for(const r of o){if(!H.isObject(s)&&!Array.isArray(s)||typeof s[r]>"u")return i;s=s[r]}return s}static setByPath(e,t,i,l="."){if(e===null||typeof e!="object"){console.warn("setByPath: data not an object or array.");return}let s=e,o=t.split(l),r=o.pop();for(const a of o)(!H.isObject(s)&&!Array.isArray(s)||!H.isObject(s[a])&&!Array.isArray(s[a]))&&(s[a]={}),s=s[a];s[r]=i}static deleteByPath(e,t,i="."){let l=e||{},s=(t||"").split(i),o=s.pop();for(const r of s)(!H.isObject(l)&&!Array.isArray(l)||!H.isObject(l[r])&&!Array.isArray(l[r]))&&(l[r]={}),l=l[r];Array.isArray(l)?l.splice(o,1):H.isObject(l)&&delete l[o],s.length>0&&(Array.isArray(l)&&!l.length||H.isObject(l)&&!Object.keys(l).length)&&(Array.isArray(e)&&e.length>0||H.isObject(e)&&Object.keys(e).length>0)&&H.deleteByPath(e,s.join(i),i)}static randomString(e=10){let t="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let l=0;l"u")return H.randomString(e);const t=new Uint8Array(e);crypto.getRandomValues(t);const i="-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";let l="";for(let s=0;ss.replaceAll("{_PB_ESCAPED_}",t));for(let s of l)s=s.trim(),H.isEmpty(s)||i.push(s);return i}static joinNonEmpty(e,t=", "){e=e||[];const i=[],l=t.length>1?t.trim():t;for(let s of e)s=typeof s=="string"?s.trim():"",H.isEmpty(s)||i.push(s.replaceAll(l,"\\"+l));return i.join(t)}static getInitials(e){if(e=(e||"").split("@")[0].trim(),e.length<=2)return e.toUpperCase();const t=e.split(/[\.\_\-\ ]/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e[0].toUpperCase()}static formattedFileSize(e){const t=e?Math.floor(Math.log(e)/Math.log(1024)):0;return(e/Math.pow(1024,t)).toFixed(2)*1+" "+["B","KB","MB","GB","TB"][t]}static getDateTime(e){if(typeof e=="string"){const t={19:"yyyy-MM-dd HH:mm:ss",23:"yyyy-MM-dd HH:mm:ss.SSS",20:"yyyy-MM-dd HH:mm:ss'Z'",24:"yyyy-MM-dd HH:mm:ss.SSS'Z'"},i=t[e.length]||t[19];return je.fromFormat(e,i,{zone:"UTC"})}return je.fromJSDate(e)}static formatToUTCDate(e,t="yyyy-MM-dd HH:mm:ss"){return H.getDateTime(e).toUTC().toFormat(t)}static formatToLocalDate(e,t="yyyy-MM-dd HH:mm:ss"){return H.getDateTime(e).toLocal().toFormat(t)}static async copyToClipboard(e){var t;if(e=""+e,!(!e.length||!((t=window==null?void 0:window.navigator)!=null&&t.clipboard)))return window.navigator.clipboard.writeText(e).catch(i=>{console.warn("Failed to copy.",i)})}static download(e,t){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("download",t),i.setAttribute("target","_blank"),i.click(),i.remove()}static downloadJson(e,t){t=t.endsWith(".json")?t:t+".json";const i=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),l=window.URL.createObjectURL(i);H.download(l,t)}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 e=e||"",!!Xy.find(t=>e.toLowerCase().endsWith(t))}static hasVideoExtension(e){return e=e||"",!!Qy.find(t=>e.toLowerCase().endsWith(t))}static hasAudioExtension(e){return e=e||"",!!xy.find(t=>e.toLowerCase().endsWith(t))}static hasDocumentExtension(e){return e=e||"",!!ev.find(t=>e.toLowerCase().endsWith(t))}static getFileType(e){return H.hasImageExtension(e)?"image":H.hasDocumentExtension(e)?"document":H.hasVideoExtension(e)?"video":H.hasAudioExtension(e)?"audio":"file"}static generateThumb(e,t=100,i=100){return new Promise(l=>{let s=new FileReader;s.onload=function(o){let r=new Image;r.onload=function(){let a=document.createElement("canvas"),f=a.getContext("2d"),u=r.width,c=r.height;return a.width=t,a.height=i,f.drawImage(r,u>c?(u-c)/2:0,0,u>c?c:u,u>c?c:u,0,0,t,i),l(a.toDataURL(e.type))},r.src=o.target.result},s.readAsDataURL(e)})}static addValueToFormData(e,t,i){if(!(typeof i>"u"))if(H.isEmpty(i))e.append(t,"");else if(Array.isArray(i))for(const l of i)H.addValueToFormData(e,t,l);else i instanceof File?e.append(t,i):i instanceof Date?e.append(t,i.toISOString()):H.isObject(i)?e.append(t,JSON.stringify(i)):e.append(t,""+i)}static dummyCollectionRecord(e){var a,f,u,c,d,m,h;const t=(e==null?void 0:e.schema)||[],i=(e==null?void 0:e.type)==="auth",l=(e==null?void 0:e.type)==="view",s={id:"RECORD_ID",collectionId:e==null?void 0:e.id,collectionName:e==null?void 0:e.name};i&&(s.username="username123",s.verified=!1,s.emailVisibility=!0,s.email="test@example.com"),(!l||H.extractColumnsFromQuery((a=e==null?void 0:e.options)==null?void 0:a.query).includes("created"))&&(s.created="2022-01-01 01:00:00.123Z"),(!l||H.extractColumnsFromQuery((f=e==null?void 0:e.options)==null?void 0:f.query).includes("updated"))&&(s.updated="2022-01-01 23:59:59.456Z");for(const _ of t){let g=null;_.type==="number"?g=123:_.type==="date"?g="2022-01-01 10:00:00.123Z":_.type==="bool"?g=!0:_.type==="email"?g="test@example.com":_.type==="url"?g="https://example.com":_.type==="json"?g="JSON":_.type==="file"?(g="filename.jpg",((u=_.options)==null?void 0:u.maxSelect)!==1&&(g=[g])):_.type==="select"?(g=(d=(c=_.options)==null?void 0:c.values)==null?void 0:d[0],((m=_.options)==null?void 0:m.maxSelect)!==1&&(g=[g])):_.type==="relation"?(g="RELATION_RECORD_ID",((h=_.options)==null?void 0:h.maxSelect)!==1&&(g=[g])):g="test",s[_.name]=g}return s}static dummyCollectionSchemaData(e){var l,s,o,r;const t=(e==null?void 0:e.schema)||[],i={};for(const a of t){let f=null;if(a.type==="number")f=123;else if(a.type==="date")f="2022-01-01 10:00:00.123Z";else if(a.type==="bool")f=!0;else if(a.type==="email")f="test@example.com";else if(a.type==="url")f="https://example.com";else if(a.type==="json")f="JSON";else{if(a.type==="file")continue;a.type==="select"?(f=(s=(l=a.options)==null?void 0:l.values)==null?void 0:s[0],((o=a.options)==null?void 0:o.maxSelect)!==1&&(f=[f])):a.type==="relation"?(f="RELATION_RECORD_ID",((r=a.options)==null?void 0:r.maxSelect)!==1&&(f=[f])):f="test"}i[a.name]=f}return i}static getCollectionTypeIcon(e){switch(e==null?void 0:e.toLowerCase()){case"auth":return"ri-group-line";case"view":return"ri-table-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"editor":return"ri-edit-2-line";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":(e==null?void 0:e.type)==="bool"?"false":(e==null?void 0:e.type)==="json"?'null, "", [], {}':["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 f in e)if(f!=="schema"&&JSON.stringify(e[f])!==JSON.stringify(t[f]))return!0;const l=Array.isArray(e.schema)?e.schema:[],s=Array.isArray(t.schema)?t.schema:[],o=l.filter(f=>(f==null?void 0:f.id)&&!H.findByKey(s,"id",f.id)),r=s.filter(f=>(f==null?void 0:f.id)&&!H.findByKey(l,"id",f.id)),a=s.filter(f=>{const u=H.isObject(f)&&H.findByKey(l,"id",f.id);if(!u)return!1;for(let c in u)if(JSON.stringify(f[c])!=JSON.stringify(u[c]))return!0;return!1});return!!(r.length||a.length||i&&o.length)}static sortCollections(e=[]){const t=[],i=[],l=[];for(const o of e)o.type==="auth"?t.push(o):o.type==="base"?i.push(o):l.push(o);function s(o,r){return o.name>r.name?1:o.name{setTimeout(e,0)})}static defaultFlatpickrOptions(){return{dateFormat:"Y-m-d H:i:S",disableMobile:!0,allowInput:!0,enableTime:!0,time_24hr:!0,locale:{firstDayOfWeek:1}}}static defaultEditorOptions(){const e=["DIV","P","A","EM","B","STRONG","H1","H2","H3","H4","H5","H6","TABLE","TR","TD","TH","TBODY","THEAD","TFOOT","BR","HR","Q","SUP","SUB","DEL","IMG","OL","UL","LI","CODE"];function t(l){let s=l.parentNode;for(;l.firstChild;)s.insertBefore(l.firstChild,l);s.removeChild(l)}function i(l){if(l){for(const s of l.children)i(s);e.includes(l.tagName)?(l.removeAttribute("style"),l.removeAttribute("class")):t(l)}}return{branding:!1,promotion:!1,menubar:!1,min_height:270,height:270,max_height:700,autoresize_bottom_margin:30,skin:"pocketbase",content_style:"body { font-size: 14px }",plugins:["autoresize","autolink","lists","link","image","searchreplace","fullscreen","media","table","code","codesample","directionality"],codesample_global_prismjs:!0,codesample_languages:[{text:"HTML/XML",value:"markup"},{text:"CSS",value:"css"},{text:"SQL",value:"sql"},{text:"JavaScript",value:"javascript"},{text:"Go",value:"go"},{text:"Dart",value:"dart"},{text:"Zig",value:"zig"},{text:"Rust",value:"rust"},{text:"Lua",value:"lua"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"},{text:"Markdown",value:"markdown"},{text:"Swift",value:"swift"},{text:"Kotlin",value:"kotlin"},{text:"Elixir",value:"elixir"},{text:"Scala",value:"scala"},{text:"Julia",value:"julia"},{text:"Haskell",value:"haskell"}],toolbar:"styles | alignleft aligncenter alignright | bold italic forecolor backcolor | bullist numlist | link image_picker table codesample direction | code fullscreen",paste_postprocess:(l,s)=>{i(s.node)},file_picker_types:"image",file_picker_callback:(l,s,o)=>{const r=document.createElement("input");r.setAttribute("type","file"),r.setAttribute("accept","image/*"),r.addEventListener("change",a=>{const f=a.target.files[0],u=new FileReader;u.addEventListener("load",()=>{if(!tinymce)return;const c="blobid"+new Date().getTime(),d=tinymce.activeEditor.editorUpload.blobCache,m=u.result.split(",")[1],h=d.create(c,f,m);d.add(h),l(h.blobUri(),{title:f.name})}),u.readAsDataURL(f)}),r.click()},setup:l=>{l.on("keydown",o=>{(o.ctrlKey||o.metaKey)&&o.code=="KeyS"&&l.formElement&&(o.preventDefault(),o.stopPropagation(),l.formElement.dispatchEvent(new KeyboardEvent("keydown",o)))});const s="tinymce_last_direction";l.on("init",()=>{var r;const o=(r=window==null?void 0:window.localStorage)==null?void 0:r.getItem(s);!l.isDirty()&&l.getContent()==""&&o=="rtl"&&l.execCommand("mceDirectionRTL")}),l.ui.registry.addMenuButton("direction",{icon:"visualchars",fetch:o=>{o([{type:"menuitem",text:"LTR content",icon:"ltr",onAction:()=>{var a;(a=window==null?void 0:window.localStorage)==null||a.setItem(s,"ltr"),l.execCommand("mceDirectionLTR")}},{type:"menuitem",text:"RTL content",icon:"rtl",onAction:()=>{var a;(a=window==null?void 0:window.localStorage)==null||a.setItem(s,"rtl"),l.execCommand("mceDirectionRTL")}}])}}),l.ui.registry.addMenuButton("image_picker",{icon:"image",fetch:o=>{o([{type:"menuitem",text:"From collection",icon:"gallery",onAction:()=>{l.dispatch("collections_file_picker",{})}},{type:"menuitem",text:"Inline",icon:"browse",onAction:()=>{l.execCommand("mceImage")}}])}})}}}static displayValue(e,t,i="N/A"){e=e||{},t=t||[];let l=[];for(const o of t){let r=e[o];typeof r>"u"||(r=H.stringifyValue(r,i),l.push(r))}if(l.length>0)return l.join(", ");const s=["title","name","slug","email","username","nickname","label","heading","message","key","identifier","id"];for(const o of s){let r=H.stringifyValue(e[o],"");if(r)return r}return i}static stringifyValue(e,t="N/A",i=150){if(H.isEmpty(e))return t;if(typeof e=="number")return""+e;if(typeof e=="boolean")return e?"True":"False";if(typeof e=="string")return e=e.indexOf("<")>=0?H.plainText(e):e,H.truncate(e,i)||t;if(Array.isArray(e)&&typeof e[0]!="object")return H.truncate(e.join(","),i);if(typeof e=="object")try{return H.truncate(JSON.stringify(e),i)||t}catch{return t}return e}static extractColumnsFromQuery(e){var o;const t="__GROUP__";e=(e||"").replace(/\([\s\S]+?\)/gm,t).replace(/[\t\r\n]|(?:\s\s)+/g," ");const i=e.match(/select\s+([\s\S]+)\s+from/),l=((o=i==null?void 0:i[1])==null?void 0:o.split(","))||[],s=[];for(let r of l){const a=r.trim().split(" ").pop();a!=""&&a!=t&&s.push(a.replace(/[\'\"\`\[\]\s]/g,""))}return s}static getAllCollectionIdentifiers(e,t=""){if(!e)return[];let i=[t+"id"];if(e.type==="view")for(let s of H.extractColumnsFromQuery(e.options.query))H.pushUnique(i,t+s);else e.type==="auth"?(i.push(t+"username"),i.push(t+"email"),i.push(t+"emailVisibility"),i.push(t+"verified"),i.push(t+"created"),i.push(t+"updated")):(i.push(t+"created"),i.push(t+"updated"));const l=e.schema||[];for(const s of l)H.pushUnique(i,t+s.name);return i}static parseIndex(e){var a,f,u,c,d;const t={unique:!1,optional:!1,schemaName:"",indexName:"",tableName:"",columns:[],where:""},l=/create\s+(unique\s+)?\s*index\s*(if\s+not\s+exists\s+)?(\S*)\s+on\s+(\S*)\s*\(([\s\S]*)\)(?:\s*where\s+([\s\S]*))?/gmi.exec((e||"").trim());if((l==null?void 0:l.length)!=7)return t;const s=/^[\"\'\`\[\{}]|[\"\'\`\]\}]$/gm;t.unique=((a=l[1])==null?void 0:a.trim().toLowerCase())==="unique",t.optional=!H.isEmpty((f=l[2])==null?void 0:f.trim());const o=(l[3]||"").split(".");o.length==2?(t.schemaName=o[0].replace(s,""),t.indexName=o[1].replace(s,"")):(t.schemaName="",t.indexName=o[0].replace(s,"")),t.tableName=(l[4]||"").replace(s,"");const r=(l[5]||"").replace(/,(?=[^\(]*\))/gmi,"{PB_TEMP}").split(",");for(let m of r){m=m.trim().replaceAll("{PB_TEMP}",",");const _=/^([\s\S]+?)(?:\s+collate\s+([\w]+))?(?:\s+(asc|desc))?$/gmi.exec(m);if((_==null?void 0:_.length)!=4)continue;const g=(c=(u=_[1])==null?void 0:u.trim())==null?void 0:c.replace(s,"");g&&t.columns.push({name:g,collate:_[2]||"",sort:((d=_[3])==null?void 0:d.toUpperCase())||""})}return t.where=l[6]||"",t}static buildIndex(e){let t="CREATE ";e.unique&&(t+="UNIQUE "),t+="INDEX ",e.optional&&(t+="IF NOT EXISTS "),e.schemaName&&(t+=`\`${e.schemaName}\`.`),t+=`\`${e.indexName||"idx_"+H.randomString(7)}\` `,t+=`ON \`${e.tableName}\` (`;const i=e.columns.filter(l=>!!(l!=null&&l.name));return i.length>1&&(t+=` +}`,c=`__svelte_${b0(u)}_${r}`,d=Ig(n),{stylesheet:m,rules:h}=bo.get(d)||k0(d,n);h[c]||(h[c]=!0,m.insertRule(`@keyframes ${c} ${u}`,m.cssRules.length));const _=n.style.animation||"";return n.style.animation=`${_?`${_}, `:""}${c} ${i}ms linear ${l}ms 1 both`,ko+=1,c}function ls(n,e){const t=(n.style.animation||"").split(", "),i=t.filter(e?s=>s.indexOf(e)<0:s=>s.indexOf("__svelte")===-1),l=t.length-i.length;l&&(n.style.animation=i.join(", "),ko-=l,ko||y0())}function y0(){ra(()=>{ko||(bo.forEach(n=>{const{ownerNode:e}=n.stylesheet;e&&v(e)}),bo.clear())})}function v0(n,e,t,i){if(!e)return Q;const l=n.getBoundingClientRect();if(e.left===l.left&&e.right===l.right&&e.top===l.top&&e.bottom===l.bottom)return Q;const{delay:s=0,duration:o=300,easing:r=gs,start:a=Fo()+s,end:f=a+o,tick:u=Q,css:c}=t(n,{from:e,to:l},i);let d=!0,m=!1,h;function _(){c&&(h=is(n,0,1,o,s,r,c)),s||(m=!0)}function g(){c&&ls(n,h),d=!1}return Ro(y=>{if(!m&&y>=a&&(m=!0),m&&y>=f&&(u(1,0),g()),!d)return!1;if(m){const S=y-a,T=0+1*r(S/o);u(T,1-T)}return!0}),_(),u(0,1),g}function w0(n){const e=getComputedStyle(n);if(e.position!=="absolute"&&e.position!=="fixed"){const{width:t,height:i}=e,l=n.getBoundingClientRect();n.style.position="absolute",n.style.width=t,n.style.height=i,Lg(n,l)}}function Lg(n,e){const t=n.getBoundingClientRect();if(e.left!==t.left||e.top!==t.top){const i=getComputedStyle(n),l=i.transform==="none"?"":i.transform;n.style.transform=`${l} translate(${e.left-t.left}px, ${e.top-t.top}px)`}}let ss;function di(n){ss=n}function bs(){if(!ss)throw new Error("Function called outside component initialization");return ss}function jt(n){bs().$$.on_mount.push(n)}function S0(n){bs().$$.after_update.push(n)}function ks(n){bs().$$.on_destroy.push(n)}function st(){const n=bs();return(e,t,{cancelable:i=!1}={})=>{const l=n.$$.callbacks[e];if(l){const s=Ag(e,t,{cancelable:i});return l.slice().forEach(o=>{o.call(n,s)}),!s.defaultPrevented}return!0}}function Te(n,e){const t=n.$$.callbacks[e.type];t&&t.slice().forEach(i=>i.call(this,e))}const _l=[],ee=[];let kl=[];const Fr=[],Ng=Promise.resolve();let Rr=!1;function Pg(){Rr||(Rr=!0,Ng.then(aa))}function Xt(){return Pg(),Ng}function Ye(n){kl.push(n)}function ke(n){Fr.push(n)}const tr=new Set;let cl=0;function aa(){if(cl!==0)return;const n=ss;do{try{for(;cl<_l.length;){const e=_l[cl];cl++,di(e),$0(e.$$)}}catch(e){throw _l.length=0,cl=0,e}for(di(null),_l.length=0,cl=0;ee.length;)ee.pop()();for(let e=0;en.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),kl=e}let Rl;function fa(){return Rl||(Rl=Promise.resolve(),Rl.then(()=>{Rl=null})),Rl}function Ki(n,e,t){n.dispatchEvent(Ag(`${e?"intro":"outro"}${t}`))}const io=new Set;let ei;function se(){ei={r:0,c:[],p:ei}}function oe(){ei.r||ve(ei.c),ei=ei.p}function E(n,e){n&&n.i&&(io.delete(n),n.i(e))}function A(n,e,t,i){if(n&&n.o){if(io.has(n))return;io.add(n),ei.c.push(()=>{io.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}const ua={duration:0};function Fg(n,e,t){const i={direction:"in"};let l=e(n,t,i),s=!1,o,r,a=0;function f(){o&&ls(n,o)}function u(){const{delay:d=0,duration:m=300,easing:h=gs,tick:_=Q,css:g}=l||ua;g&&(o=is(n,0,1,m,d,h,g,a++)),_(0,1);const y=Fo()+d,S=y+m;r&&r.abort(),s=!0,Ye(()=>Ki(n,!0,"start")),r=Ro(T=>{if(s){if(T>=S)return _(1,0),Ki(n,!0,"end"),f(),s=!1;if(T>=y){const $=h((T-y)/m);_($,1-$)}}return s})}let c=!1;return{start(){c||(c=!0,ls(n),Tt(l)?(l=l(i),fa().then(u)):u())},invalidate(){c=!1},end(){s&&(f(),s=!1)}}}function ca(n,e,t){const i={direction:"out"};let l=e(n,t,i),s=!0,o;const r=ei;r.r+=1;let a;function f(){const{delay:u=0,duration:c=300,easing:d=gs,tick:m=Q,css:h}=l||ua;h&&(o=is(n,1,0,c,u,d,h));const _=Fo()+u,g=_+c;Ye(()=>Ki(n,!1,"start")),"inert"in n&&(a=n.inert,n.inert=!0),Ro(y=>{if(s){if(y>=g)return m(0,1),Ki(n,!1,"end"),--r.r||ve(r.c),!1;if(y>=_){const S=d((y-_)/c);m(1-S,S)}}return s})}return Tt(l)?fa().then(()=>{l=l(i),f()}):f(),{end(u){u&&"inert"in n&&(n.inert=a),u&&l.tick&&l.tick(1,0),s&&(o&&ls(n,o),s=!1)}}}function Ne(n,e,t,i){let s=e(n,t,{direction:"both"}),o=i?0:1,r=null,a=null,f=null,u;function c(){f&&ls(n,f)}function d(h,_){const g=h.b-o;return _*=Math.abs(g),{a:o,b:h.b,d:g,duration:_,start:h.start,end:h.start+_,group:h.group}}function m(h){const{delay:_=0,duration:g=300,easing:y=gs,tick:S=Q,css:T}=s||ua,$={start:Fo()+_,b:h};h||($.group=ei,ei.r+=1),"inert"in n&&(h?u!==void 0&&(n.inert=u):(u=n.inert,n.inert=!0)),r||a?a=$:(T&&(c(),f=is(n,o,h,g,_,y,T)),h&&S(0,1),r=d($,g),Ye(()=>Ki(n,h,"start")),Ro(C=>{if(a&&C>a.start&&(r=d(a,g),a=null,Ki(n,r.b,"start"),T&&(c(),f=is(n,o,r.b,r.duration,0,y,s.css))),r){if(C>=r.end)S(o=r.b,1-o),Ki(n,r.b,"end"),a||(r.b?c():--r.group.r||ve(r.group.c)),r=null;else if(C>=r.start){const M=C-r.start;o=r.a+r.d*y(M/r.duration),S(o,1-o)}}return!!(r||a)}))}return{run(h){Tt(s)?fa().then(()=>{s=s({direction:h?"in":"out"}),m(h)}):m(h)},end(){c(),r=a=null}}}function Qa(n,e){const t=e.token={};function i(l,s,o,r){if(e.token!==t)return;e.resolved=r;let a=e.ctx;o!==void 0&&(a=a.slice(),a[o]=r);const f=l&&(e.current=l)(a);let u=!1;e.block&&(e.blocks?e.blocks.forEach((c,d)=>{d!==s&&c&&(se(),A(c,1,1,()=>{e.blocks[d]===c&&(e.blocks[d]=null)}),oe())}):e.block.d(1),f.c(),E(f,1),f.m(e.mount(),e.anchor),u=!0),e.block=f,e.blocks&&(e.blocks[s]=f),u&&aa()}if(u0(n)){const l=bs();if(n.then(s=>{di(l),i(e.then,1,e.value,s),di(null)},s=>{if(di(l),i(e.catch,2,e.error,s),di(null),!e.hasCatch)throw s}),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 C0(n,e,t){const i=e.slice(),{resolved:l}=n;n.current===n.then&&(i[n.value]=l),n.current===n.catch&&(i[n.error]=l),n.block.p(i,t)}function de(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function Ii(n,e){n.d(1),e.delete(n.key)}function Mt(n,e){A(n,1,1,()=>{e.delete(n.key)})}function O0(n,e){n.f(),Mt(n,e)}function at(n,e,t,i,l,s,o,r,a,f,u,c){let d=n.length,m=s.length,h=d;const _={};for(;h--;)_[n[h].key]=h;const g=[],y=new Map,S=new Map,T=[];for(h=m;h--;){const D=c(l,s,h),I=t(D);let L=o.get(I);L?i&&T.push(()=>L.p(D,e)):(L=f(I,D),L.c()),y.set(I,g[h]=L),I in _&&S.set(I,Math.abs(h-_[I]))}const $=new Set,C=new Set;function M(D){E(D,1),D.m(r,u),o.set(D.key,D),u=D.first,m--}for(;d&&m;){const D=g[m-1],I=n[d-1],L=D.key,R=I.key;D===I?(u=D.first,d--,m--):y.has(R)?!o.has(L)||$.has(L)?M(D):C.has(R)?d--:S.get(L)>S.get(R)?(C.add(L),M(D)):($.add(R),d--):(a(I,o),d--)}for(;d--;){const D=n[d];y.has(D.key)||a(D,o)}for(;m;)M(g[m-1]);return ve(T),g}function ct(n,e){const t={},i={},l={$$scope:1};let s=n.length;for(;s--;){const o=n[s],r=e[s];if(r){for(const a in o)a in r||(i[a]=1);for(const a in r)l[a]||(t[a]=r[a],l[a]=1);n[s]=r}else for(const a in o)l[a]=1}for(const o in i)o in t||(t[o]=void 0);return t}function Ct(n){return typeof n=="object"&&n!==null?n:{}}function be(n,e,t){const i=n.$$.props[e];i!==void 0&&(n.$$.bound[i]=t,t(n.$$.ctx[i]))}function B(n){n&&n.c()}function z(n,e,t){const{fragment:i,after_update:l}=n.$$;i&&i.m(e,t),Ye(()=>{const s=n.$$.on_mount.map(Cg).filter(Tt);n.$$.on_destroy?n.$$.on_destroy.push(...s):ve(s),n.$$.on_mount=[]}),l.forEach(Ye)}function V(n,e){const t=n.$$;t.fragment!==null&&(T0(t.after_update),ve(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function M0(n,e){n.$$.dirty[0]===-1&&(_l.push(n),Pg(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<{const h=m.length?m[0]:d;return f.ctx&&l(f.ctx[c],f.ctx[c]=h)&&(!f.skip_bound&&f.bound[c]&&f.bound[c](h),u&&M0(n,c)),d}):[],f.update(),u=!0,ve(f.before_update),f.fragment=i?i(f.ctx):!1,e.target){if(e.hydrate){const c=_0(e.target);f.fragment&&f.fragment.l(c),c.forEach(v)}else f.fragment&&f.fragment.c();e.intro&&E(n.$$.fragment),z(n,e.target,e.anchor),aa()}di(a)}class ge{constructor(){Je(this,"$$");Je(this,"$$set")}$destroy(){V(this,1),this.$destroy=Q}$on(e,t){if(!Tt(t))return Q;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const l=i.indexOf(t);l!==-1&&i.splice(l,1)}}$set(e){this.$$set&&!c0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const D0="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(D0);const dl=[];function Rg(n,e){return{subscribe:Cn(n,e).subscribe}}function Cn(n,e=Q){let t;const i=new Set;function l(r){if(me(n,r)&&(n=r,t)){const a=!dl.length;for(const f of i)f[1](),dl.push(f,n);if(a){for(let f=0;f{i.delete(f),i.size===0&&t&&(t(),t=null)}}return{set:l,update:s,subscribe:o}}function qg(n,e,t){const i=!Array.isArray(n),l=i?[n]:n;if(!l.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return Rg(t,(o,r)=>{let a=!1;const f=[];let u=0,c=Q;const d=()=>{if(u)return;c();const h=e(i?f[0]:f,o,r);s?o(h):c=Tt(h)?h:Q},m=l.map((h,_)=>oa(h,g=>{f[_]=g,u&=~(1<<_),a&&d()},()=>{u|=1<<_}));return a=!0,d(),function(){ve(m),c(),a=!1}})}function jg(n,e){if(n instanceof RegExp)return{keys:!1,pattern:n};var t,i,l,s,o=[],r="",a=n.split("/");for(a[0]||a.shift();l=a.shift();)t=l[0],t==="*"?(o.push("wild"),r+="/(.*)"):t===":"?(i=l.indexOf("?",1),s=l.indexOf(".",1),o.push(l.substring(1,~i?i:~s?s:l.length)),r+=~i&&!~s?"(?:/([^/]+?))?":"/([^/]+?)",~s&&(r+=(~i?"?":"")+"\\"+l.substring(s))):r+="/"+l;return{keys:o,pattern:new RegExp("^"+r+(e?"(?=$|/)":"/?$"),"i")}}function E0(n){let e,t,i;const l=[n[2]];var s=n[0];function o(r,a){let f={};if(a!==void 0&&a&4)f=ct(l,[Ct(r[2])]);else for(let u=0;u{V(f,1)}),oe()}s?(e=Ot(s,o(r,a)),e.$on("routeEvent",r[7]),B(e.$$.fragment),E(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(s){const f=a&4?ct(l,[Ct(r[2])]):{};e.$set(f)}},i(r){i||(e&&E(e.$$.fragment,r),i=!0)},o(r){e&&A(e.$$.fragment,r),i=!1},d(r){r&&v(t),e&&V(e,r)}}}function I0(n){let e,t,i;const l=[{params:n[1]},n[2]];var s=n[0];function o(r,a){let f={};if(a!==void 0&&a&6)f=ct(l,[a&2&&{params:r[1]},a&4&&Ct(r[2])]);else for(let u=0;u{V(f,1)}),oe()}s?(e=Ot(s,o(r,a)),e.$on("routeEvent",r[6]),B(e.$$.fragment),E(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(s){const f=a&6?ct(l,[a&2&&{params:r[1]},a&4&&Ct(r[2])]):{};e.$set(f)}},i(r){i||(e&&E(e.$$.fragment,r),i=!0)},o(r){e&&A(e.$$.fragment,r),i=!1},d(r){r&&v(t),e&&V(e,r)}}}function A0(n){let e,t,i,l;const s=[I0,E0],o=[];function r(a,f){return a[1]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ye()},m(a,f){o[e].m(a,f),w(a,i,f),l=!0},p(a,[f]){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),A(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){l||(E(t),l=!0)},o(a){A(t),l=!1},d(a){a&&v(i),o[e].d(a)}}}function xa(){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 qo=Rg(null,function(e){e(xa());const t=()=>{e(xa())};return window.addEventListener("hashchange",t,!1),function(){window.removeEventListener("hashchange",t,!1)}});qg(qo,n=>n.location);const jo=qg(qo,n=>n.querystring),ef=Cn(void 0);async function tl(n){if(!n||n.length<1||n.charAt(0)!="/"&&n.indexOf("#/")!==0)throw Error("Invalid parameter location");await Xt();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 nn(n,e){if(e=nf(e),!n||!n.tagName||n.tagName.toLowerCase()!="a")throw Error('Action "link" can only be used with tags');return tf(n,e),{update(t){t=nf(t),tf(n,t)}}}function L0(n){n?window.scrollTo(n.__svelte_spa_router_scrollX,n.__svelte_spa_router_scrollY):window.scrollTo(0,0)}function tf(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||N0(i.currentTarget.getAttribute("href"))})}function nf(n){return n&&typeof n=="string"?{href:n}:n||{}}function N0(n){history.replaceState({...history.state,__svelte_spa_router_scrollX:window.scrollX,__svelte_spa_router_scrollY:window.scrollY},void 0),window.location.hash=n}function P0(n,e,t){let{routes:i={}}=e,{prefix:l=""}=e,{restoreScrollState:s=!1}=e;class o{constructor(C,M){if(!M||typeof M!="function"&&(typeof M!="object"||M._sveltesparouter!==!0))throw Error("Invalid component object");if(!C||typeof C=="string"&&(C.length<1||C.charAt(0)!="/"&&C.charAt(0)!="*")||typeof C=="object"&&!(C instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:D,keys:I}=jg(C);this.path=C,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=D,this._keys=I}match(C){if(l){if(typeof l=="string")if(C.startsWith(l))C=C.substr(l.length)||"/";else return null;else if(l instanceof RegExp){const L=C.match(l);if(L&&L[0])C=C.substr(L[0].length)||"/";else return null}}const M=this._pattern.exec(C);if(M===null)return null;if(this._keys===!1)return M;const D={};let I=0;for(;I{r.push(new o(C,$))}):Object.keys(i).forEach($=>{r.push(new o($,i[$]))});let a=null,f=null,u={};const c=st();async function d($,C){await Xt(),c($,C)}let m=null,h=null;s&&(h=$=>{$.state&&($.state.__svelte_spa_router_scrollY||$.state.__svelte_spa_router_scrollX)?m=$.state:m=null},window.addEventListener("popstate",h),S0(()=>{L0(m)}));let _=null,g=null;const y=qo.subscribe(async $=>{_=$;let C=0;for(;C{ef.set(f)});return}t(0,a=null),g=null,ef.set(void 0)});ks(()=>{y(),h&&window.removeEventListener("popstate",h)});function S($){Te.call(this,n,$)}function T($){Te.call(this,n,$)}return n.$$set=$=>{"routes"in $&&t(3,i=$.routes),"prefix"in $&&t(4,l=$.prefix),"restoreScrollState"in $&&t(5,s=$.restoreScrollState)},n.$$.update=()=>{n.$$.dirty&32&&(history.scrollRestoration=s?"manual":"auto")},[a,f,u,i,l,s,S,T]}class F0 extends ge{constructor(e){super(),_e(this,e,P0,A0,me,{routes:3,prefix:4,restoreScrollState:5})}}const lo=[];let Hg;function zg(n){const e=n.pattern.test(Hg);lf(n,n.className,e),lf(n,n.inactiveClassName,!e)}function lf(n,e,t){(e||"").split(" ").forEach(i=>{i&&(n.node.classList.remove(i),t&&n.node.classList.add(i))})}qo.subscribe(n=>{Hg=n.location+(n.querystring?"?"+n.querystring:""),lo.map(zg)});function An(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"?jg(e.path):{pattern:e.path},i={node:n,className:e.className,inactiveClassName:e.inactiveClassName,pattern:t};return lo.push(i),zg(i),{destroy(){lo.splice(lo.indexOf(i),1)}}}const R0="modulepreload",q0=function(n,e){return new URL(n,e).href},sf={},nt=function(e,t,i){let l=Promise.resolve();if(t&&t.length>0){const s=document.getElementsByTagName("link");l=Promise.all(t.map(o=>{if(o=q0(o,i),o in sf)return;sf[o]=!0;const r=o.endsWith(".css"),a=r?'[rel="stylesheet"]':"";if(!!i)for(let c=s.length-1;c>=0;c--){const d=s[c];if(d.href===o&&(!r||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const u=document.createElement("link");if(u.rel=r?"stylesheet":R0,r||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),r)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})}))}return l.then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function It(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;t0&&(!t.exp||t.exp-e>Date.now()/1e3))}Vg=typeof atob=="function"?atob:n=>{let e=String(n).replace(/=+$/,"");if(e.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var t,i,l=0,s=0,o="";i=e.charAt(s++);~i&&(t=l%4?64*t+i:i,l++%4)?o+=String.fromCharCode(255&t>>(-2*l&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};const rf="pb_auth";class V0{constructor(){this.baseToken="",this.baseModel=null,this._onChangeCallbacks=[]}get token(){return this.baseToken}get model(){return this.baseModel}get isValid(){return!da(this.token)}get isAdmin(){return so(this.token).type==="admin"}get isAuthRecord(){return so(this.token).type==="authRecord"}save(e,t){this.baseToken=e||"",this.baseModel=t||null,this.triggerChange()}clear(){this.baseToken="",this.baseModel=null,this.triggerChange()}loadFromCookie(e,t=rf){const i=j0(e||"")[t]||"";let l={};try{l=JSON.parse(i),(typeof l===null||typeof l!="object"||Array.isArray(l))&&(l={})}catch{}this.save(l.token||"",l.model||null)}exportToCookie(e,t=rf){var a,f;const i={secure:!0,sameSite:!0,httpOnly:!0,path:"/"},l=so(this.token);i.expires=l!=null&&l.exp?new Date(1e3*l.exp):new Date("1970-01-01"),e=Object.assign({},i,e);const s={token:this.token,model:this.model?JSON.parse(JSON.stringify(this.model)):null};let o=of(t,JSON.stringify(s),e);const r=typeof Blob<"u"?new Blob([o]).size:o.length;if(s.model&&r>4096){s.model={id:(a=s==null?void 0:s.model)==null?void 0:a.id,email:(f=s==null?void 0:s.model)==null?void 0:f.email};const u=["collectionId","username","verified"];for(const c in this.model)u.includes(c)&&(s.model[c]=this.model[c]);o=of(t,JSON.stringify(s),e)}return o}onChange(e,t=!1){return this._onChangeCallbacks.push(e),t&&e(this.token,this.model),()=>{for(let i=this._onChangeCallbacks.length-1;i>=0;i--)if(this._onChangeCallbacks[i]==e)return delete this._onChangeCallbacks[i],void this._onChangeCallbacks.splice(i,1)}}triggerChange(){for(const e of this._onChangeCallbacks)e&&e(this.token,this.model)}}class Bg extends V0{constructor(e="pocketbase_auth"){super(),this.storageFallback={},this.storageKey=e,this._bindStorageEvent()}get token(){return(this._storageGet(this.storageKey)||{}).token||""}get model(){return(this._storageGet(this.storageKey)||{}).model||null}save(e,t){this._storageSet(this.storageKey,{token:e,model:t}),super.save(e,t)}clear(){this._storageRemove(this.storageKey),super.clear()}_storageGet(e){if(typeof window<"u"&&(window!=null&&window.localStorage)){const t=window.localStorage.getItem(e)||"";try{return JSON.parse(t)}catch{return t}}return this.storageFallback[e]}_storageSet(e,t){if(typeof window<"u"&&(window!=null&&window.localStorage)){let i=t;typeof t!="string"&&(i=JSON.stringify(t)),window.localStorage.setItem(e,i)}else this.storageFallback[e]=t}_storageRemove(e){var t;typeof window<"u"&&(window!=null&&window.localStorage)&&((t=window.localStorage)==null||t.removeItem(e)),delete this.storageFallback[e]}_bindStorageEvent(){typeof window<"u"&&(window!=null&&window.localStorage)&&window.addEventListener&&window.addEventListener("storage",e=>{if(e.key!=this.storageKey)return;const t=this._storageGet(this.storageKey)||{};super.save(t.token||"",t.model||null)})}}class nl{constructor(e){this.client=e}}class B0 extends nl{async getAll(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/settings",e)}async update(e,t){return t=Object.assign({method:"PATCH",body:e},t),this.client.send("/api/settings",t)}async testS3(e="storage",t){return t=Object.assign({method:"POST",body:{filesystem:e}},t),this.client.send("/api/settings/test/s3",t).then(()=>!0)}async testEmail(e,t,i){return i=Object.assign({method:"POST",body:{email:e,template:t}},i),this.client.send("/api/settings/test/email",i).then(()=>!0)}async generateAppleClientSecret(e,t,i,l,s,o){return o=Object.assign({method:"POST",body:{clientId:e,teamId:t,keyId:i,privateKey:l,duration:s}},o),this.client.send("/api/settings/apple/generate-client-secret",o)}}class pa extends nl{decode(e){return e}async getFullList(e,t){if(typeof e=="number")return this._getFullList(e,t);let i=500;return(t=Object.assign({},e,t)).batch&&(i=t.batch,delete t.batch),this._getFullList(i,t)}async getList(e=1,t=30,i){return(i=Object.assign({method:"GET"},i)).query=Object.assign({page:e,perPage:t},i.query),this.client.send(this.baseCrudPath,i).then(l=>{var s;return l.items=((s=l.items)==null?void 0:s.map(o=>this.decode(o)))||[],l})}async getFirstListItem(e,t){return(t=Object.assign({requestKey:"one_by_filter_"+this.baseCrudPath+"_"+e},t)).query=Object.assign({filter:e,skipTotal:1},t.query),this.getList(1,1,t).then(i=>{var l;if(!((l=i==null?void 0:i.items)!=null&&l.length))throw new bn({status:404,response:{code:404,message:"The requested resource wasn't found.",data:{}}});return i.items[0]})}async getOne(e,t){if(!e)throw new bn({url:this.client.buildUrl(this.baseCrudPath+"/"),status:404,response:{code:404,message:"Missing required record id.",data:{}}});return t=Object.assign({method:"GET"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),t).then(i=>this.decode(i))}async create(e,t){return t=Object.assign({method:"POST",body:e},t),this.client.send(this.baseCrudPath,t).then(i=>this.decode(i))}async update(e,t,i){return i=Object.assign({method:"PATCH",body:t},i),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),i).then(l=>this.decode(l))}async delete(e,t){return t=Object.assign({method:"DELETE"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e),t).then(()=>!0)}_getFullList(e=500,t){(t=t||{}).query=Object.assign({skipTotal:1},t.query);let i=[],l=async s=>this.getList(s,e||500,t).then(o=>{const r=o.items;return i=i.concat(r),r.length==o.perPage?l(s+1):i});return l(1)}}function Sn(n,e,t,i){const l=i!==void 0;return l||t!==void 0?l?(console.warn(n),e.body=Object.assign({},e.body,t),e.query=Object.assign({},e.query,i),e):Object.assign(e,t):e}function nr(n){var e;(e=n._resetAutoRefresh)==null||e.call(n)}class U0 extends pa{get baseCrudPath(){return"/api/admins"}async update(e,t,i){return super.update(e,t,i).then(l=>{var s,o;return((s=this.client.authStore.model)==null?void 0:s.id)===l.id&&((o=this.client.authStore.model)==null?void 0:o.collectionId)===void 0&&this.client.authStore.save(this.client.authStore.token,l),l})}async delete(e,t){return super.delete(e,t).then(i=>{var l,s;return i&&((l=this.client.authStore.model)==null?void 0:l.id)===e&&((s=this.client.authStore.model)==null?void 0:s.collectionId)===void 0&&this.client.authStore.clear(),i})}authResponse(e){const t=this.decode((e==null?void 0:e.admin)||{});return e!=null&&e.token&&(e!=null&&e.admin)&&this.client.authStore.save(e.token,t),Object.assign({},e,{token:(e==null?void 0:e.token)||"",admin:t})}async authWithPassword(e,t,i,l){let s={method:"POST",body:{identity:e,password:t}};s=Sn("This form of authWithPassword(email, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(email, pass, options?).",s,i,l);const o=s.autoRefreshThreshold;delete s.autoRefreshThreshold,s.autoRefresh||nr(this.client);let r=await this.client.send(this.baseCrudPath+"/auth-with-password",s);return r=this.authResponse(r),o&&function(f,u,c,d){nr(f);const m=f.beforeSend,h=f.authStore.model,_=f.authStore.onChange((g,y)=>{(!g||(y==null?void 0:y.id)!=(h==null?void 0:h.id)||(y!=null&&y.collectionId||h!=null&&h.collectionId)&&(y==null?void 0:y.collectionId)!=(h==null?void 0:h.collectionId))&&nr(f)});f._resetAutoRefresh=function(){_(),f.beforeSend=m,delete f._resetAutoRefresh},f.beforeSend=async(g,y)=>{var C;const S=f.authStore.token;if((C=y.query)!=null&&C.autoRefresh)return m?m(g,y):{url:g,sendOptions:y};let T=f.authStore.isValid;if(T&&da(f.authStore.token,u))try{await c()}catch{T=!1}T||await d();const $=y.headers||{};for(let M in $)if(M.toLowerCase()=="authorization"&&S==$[M]&&f.authStore.token){$[M]=f.authStore.token;break}return y.headers=$,m?m(g,y):{url:g,sendOptions:y}}}(this.client,o,()=>this.authRefresh({autoRefresh:!0}),()=>this.authWithPassword(e,t,Object.assign({autoRefresh:!0},s))),r}async authRefresh(e,t){let i={method:"POST"};return i=Sn("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",i,e,t),this.client.send(this.baseCrudPath+"/auth-refresh",i).then(this.authResponse.bind(this))}async requestPasswordReset(e,t,i){let l={method:"POST",body:{email:e}};return l=Sn("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",l,t,i),this.client.send(this.baseCrudPath+"/request-password-reset",l).then(()=>!0)}async confirmPasswordReset(e,t,i,l,s){let o={method:"POST",body:{token:e,password:t,passwordConfirm:i}};return o=Sn("This form of confirmPasswordReset(resetToken, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(resetToken, password, passwordConfirm, options?).",o,l,s),this.client.send(this.baseCrudPath+"/confirm-password-reset",o).then(()=>!0)}}const W0=["requestKey","$cancelKey","$autoCancel","fetch","headers","body","query","params","cache","credentials","headers","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","window"];function Ug(n){if(n){n.query=n.query||{};for(let e in n)W0.includes(e)||(n.query[e]=n[e],delete n[e])}}class Wg extends nl{constructor(){super(...arguments),this.clientId="",this.eventSource=null,this.subscriptions={},this.lastSentSubscriptions=[],this.maxConnectTimeout=15e3,this.reconnectAttempts=0,this.maxReconnectAttempts=1/0,this.predefinedReconnectIntervals=[200,300,500,1e3,1200,1500,2e3],this.pendingConnects=[]}get isConnected(){return!!this.eventSource&&!!this.clientId&&!this.pendingConnects.length}async subscribe(e,t,i){var o;if(!e)throw new Error("topic must be set.");let l=e;if(i){Ug(i);const r="options="+encodeURIComponent(JSON.stringify({query:i.query,headers:i.headers}));l+=(l.includes("?")?"&":"?")+r}const s=function(r){const a=r;let f;try{f=JSON.parse(a==null?void 0:a.data)}catch{}t(f||{})};return this.subscriptions[l]||(this.subscriptions[l]=[]),this.subscriptions[l].push(s),this.isConnected?this.subscriptions[l].length===1?await this.submitSubscriptions():(o=this.eventSource)==null||o.addEventListener(l,s):await this.connect(),async()=>this.unsubscribeByTopicAndListener(e,s)}async unsubscribe(e){var i;let t=!1;if(e){const l=this.getSubscriptionsByTopic(e);for(let s in l)if(this.hasSubscriptionListeners(s)){for(let o of this.subscriptions[s])(i=this.eventSource)==null||i.removeEventListener(s,o);delete this.subscriptions[s],t||(t=!0)}}else this.subscriptions={};this.hasSubscriptionListeners()?t&&await this.submitSubscriptions():this.disconnect()}async unsubscribeByPrefix(e){var i;let t=!1;for(let l in this.subscriptions)if((l+"?").startsWith(e)){t=!0;for(let s of this.subscriptions[l])(i=this.eventSource)==null||i.removeEventListener(l,s);delete this.subscriptions[l]}t&&(this.hasSubscriptionListeners()?await this.submitSubscriptions():this.disconnect())}async unsubscribeByTopicAndListener(e,t){var s;let i=!1;const l=this.getSubscriptionsByTopic(e);for(let o in l){if(!Array.isArray(this.subscriptions[o])||!this.subscriptions[o].length)continue;let r=!1;for(let a=this.subscriptions[o].length-1;a>=0;a--)this.subscriptions[o][a]===t&&(r=!0,delete this.subscriptions[o][a],this.subscriptions[o].splice(a,1),(s=this.eventSource)==null||s.removeEventListener(o,t));r&&(this.subscriptions[o].length||delete this.subscriptions[o],i||this.hasSubscriptionListeners(o)||(i=!0))}this.hasSubscriptionListeners()?i&&await this.submitSubscriptions():this.disconnect()}hasSubscriptionListeners(e){var t,i;if(this.subscriptions=this.subscriptions||{},e)return!!((t=this.subscriptions[e])!=null&&t.length);for(let l in this.subscriptions)if((i=this.subscriptions[l])!=null&&i.length)return!0;return!1}async submitSubscriptions(){if(this.clientId)return this.addAllSubscriptionListeners(),this.lastSentSubscriptions=this.getNonEmptySubscriptionKeys(),this.client.send("/api/realtime",{method:"POST",body:{clientId:this.clientId,subscriptions:this.lastSentSubscriptions},requestKey:this.getSubscriptionsCancelKey()}).catch(e=>{if(!(e!=null&&e.isAbort))throw e})}getSubscriptionsCancelKey(){return"realtime_"+this.clientId}getSubscriptionsByTopic(e){const t={};e=e.includes("?")?e:e+"?";for(let i in this.subscriptions)(i+"?").startsWith(e)&&(t[i]=this.subscriptions[i]);return t}getNonEmptySubscriptionKeys(){const e=[];for(let t in this.subscriptions)this.subscriptions[t].length&&e.push(t);return e}addAllSubscriptionListeners(){if(this.eventSource){this.removeAllSubscriptionListeners();for(let e in this.subscriptions)for(let t of this.subscriptions[e])this.eventSource.addEventListener(e,t)}}removeAllSubscriptionListeners(){if(this.eventSource)for(let e in this.subscriptions)for(let t of this.subscriptions[e])this.eventSource.removeEventListener(e,t)}async connect(){if(!(this.reconnectAttempts>0))return new Promise((e,t)=>{this.pendingConnects.push({resolve:e,reject:t}),this.pendingConnects.length>1||this.initConnect()})}initConnect(){this.disconnect(!0),clearTimeout(this.connectTimeoutId),this.connectTimeoutId=setTimeout(()=>{this.connectErrorHandler(new Error("EventSource connect took too long."))},this.maxConnectTimeout),this.eventSource=new EventSource(this.client.buildUrl("/api/realtime")),this.eventSource.onerror=e=>{this.connectErrorHandler(new Error("Failed to establish realtime connection."))},this.eventSource.addEventListener("PB_CONNECT",e=>{const t=e;this.clientId=t==null?void 0:t.lastEventId,this.submitSubscriptions().then(async()=>{let i=3;for(;this.hasUnsentSubscriptions()&&i>0;)i--,await this.submitSubscriptions()}).then(()=>{for(let l of this.pendingConnects)l.resolve();this.pendingConnects=[],this.reconnectAttempts=0,clearTimeout(this.reconnectTimeoutId),clearTimeout(this.connectTimeoutId);const i=this.getSubscriptionsByTopic("PB_CONNECT");for(let l in i)for(let s of i[l])s(e)}).catch(i=>{this.clientId="",this.connectErrorHandler(i)})})}hasUnsentSubscriptions(){const e=this.getNonEmptySubscriptionKeys();if(e.length!=this.lastSentSubscriptions.length)return!0;for(const t of e)if(!this.lastSentSubscriptions.includes(t))return!0;return!1}connectErrorHandler(e){if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),!this.clientId&&!this.reconnectAttempts||this.reconnectAttempts>this.maxReconnectAttempts){for(let i of this.pendingConnects)i.reject(new bn(e));return this.pendingConnects=[],void this.disconnect()}this.disconnect(!0);const t=this.predefinedReconnectIntervals[this.reconnectAttempts]||this.predefinedReconnectIntervals[this.predefinedReconnectIntervals.length-1];this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.initConnect()},t)}disconnect(e=!1){var t;if(clearTimeout(this.connectTimeoutId),clearTimeout(this.reconnectTimeoutId),this.removeAllSubscriptionListeners(),this.client.cancelRequest(this.getSubscriptionsCancelKey()),(t=this.eventSource)==null||t.close(),this.eventSource=null,this.clientId="",!e){this.reconnectAttempts=0;for(let i of this.pendingConnects)i.resolve();this.pendingConnects=[]}}}class Y0 extends pa{constructor(e,t){super(e),this.collectionIdOrName=t}get baseCrudPath(){return this.baseCollectionPath+"/records"}get baseCollectionPath(){return"/api/collections/"+encodeURIComponent(this.collectionIdOrName)}async subscribe(e,t,i){if(!e)throw new Error("Missing topic.");if(!t)throw new Error("Missing subscription callback.");return this.client.realtime.subscribe(this.collectionIdOrName+"/"+e,t,i)}async unsubscribe(e){return e?this.client.realtime.unsubscribe(this.collectionIdOrName+"/"+e):this.client.realtime.unsubscribeByPrefix(this.collectionIdOrName)}async getFullList(e,t){if(typeof e=="number")return super.getFullList(e,t);const i=Object.assign({},e,t);return super.getFullList(i)}async getList(e=1,t=30,i){return super.getList(e,t,i)}async getFirstListItem(e,t){return super.getFirstListItem(e,t)}async getOne(e,t){return super.getOne(e,t)}async create(e,t){return super.create(e,t)}async update(e,t,i){return super.update(e,t,i).then(l=>{var s,o,r;return((s=this.client.authStore.model)==null?void 0:s.id)!==(l==null?void 0:l.id)||((o=this.client.authStore.model)==null?void 0:o.collectionId)!==this.collectionIdOrName&&((r=this.client.authStore.model)==null?void 0:r.collectionName)!==this.collectionIdOrName||this.client.authStore.save(this.client.authStore.token,l),l})}async delete(e,t){return super.delete(e,t).then(i=>{var l,s,o;return!i||((l=this.client.authStore.model)==null?void 0:l.id)!==e||((s=this.client.authStore.model)==null?void 0:s.collectionId)!==this.collectionIdOrName&&((o=this.client.authStore.model)==null?void 0:o.collectionName)!==this.collectionIdOrName||this.client.authStore.clear(),i})}authResponse(e){const t=this.decode((e==null?void 0:e.record)||{});return this.client.authStore.save(e==null?void 0:e.token,t),Object.assign({},e,{token:(e==null?void 0:e.token)||"",record:t})}async listAuthMethods(e){return e=Object.assign({method:"GET"},e),this.client.send(this.baseCollectionPath+"/auth-methods",e).then(t=>Object.assign({},t,{usernamePassword:!!(t!=null&&t.usernamePassword),emailPassword:!!(t!=null&&t.emailPassword),authProviders:Array.isArray(t==null?void 0:t.authProviders)?t==null?void 0:t.authProviders:[]}))}async authWithPassword(e,t,i,l){let s={method:"POST",body:{identity:e,password:t}};return s=Sn("This form of authWithPassword(usernameOrEmail, pass, body?, query?) is deprecated. Consider replacing it with authWithPassword(usernameOrEmail, pass, options?).",s,i,l),this.client.send(this.baseCollectionPath+"/auth-with-password",s).then(o=>this.authResponse(o))}async authWithOAuth2Code(e,t,i,l,s,o,r){let a={method:"POST",body:{provider:e,code:t,codeVerifier:i,redirectUrl:l,createData:s}};return a=Sn("This form of authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, body?, query?) is deprecated. Consider replacing it with authWithOAuth2Code(provider, code, codeVerifier, redirectUrl, createData?, options?).",a,o,r),this.client.send(this.baseCollectionPath+"/auth-with-oauth2",a).then(f=>this.authResponse(f))}async authWithOAuth2(...e){if(e.length>1||typeof(e==null?void 0:e[0])=="string")return console.warn("PocketBase: This form of authWithOAuth2() is deprecated and may get removed in the future. Please replace with authWithOAuth2Code() OR use the authWithOAuth2() realtime form as shown in https://pocketbase.io/docs/authentication/#oauth2-integration."),this.authWithOAuth2Code((e==null?void 0:e[0])||"",(e==null?void 0:e[1])||"",(e==null?void 0:e[2])||"",(e==null?void 0:e[3])||"",(e==null?void 0:e[4])||{},(e==null?void 0:e[5])||{},(e==null?void 0:e[6])||{});const t=(e==null?void 0:e[0])||{},i=(await this.listAuthMethods()).authProviders.find(a=>a.name===t.provider);if(!i)throw new bn(new Error(`Missing or invalid provider "${t.provider}".`));const l=this.client.buildUrl("/api/oauth2-redirect"),s=new Wg(this.client);let o=null;function r(){o==null||o.close(),s.unsubscribe()}return t.urlCallback||(o=af(void 0)),new Promise(async(a,f)=>{var u;try{await s.subscribe("@oauth2",async h=>{const _=s.clientId;try{if(!h.state||_!==h.state)throw new Error("State parameters don't match.");const g=Object.assign({},t);delete g.provider,delete g.scopes,delete g.createData,delete g.urlCallback;const y=await this.authWithOAuth2Code(i.name,h.code,i.codeVerifier,l,t.createData,g);a(y)}catch(g){f(new bn(g))}r()});const c={state:s.clientId};(u=t.scopes)!=null&&u.length&&(c.scope=t.scopes.join(" "));const d=this._replaceQueryParams(i.authUrl+l,c);await(t.urlCallback||function(h){o?o.location.href=h:o=af(h)})(d)}catch(c){r(),f(new bn(c))}})}async authRefresh(e,t){let i={method:"POST"};return i=Sn("This form of authRefresh(body?, query?) is deprecated. Consider replacing it with authRefresh(options?).",i,e,t),this.client.send(this.baseCollectionPath+"/auth-refresh",i).then(l=>this.authResponse(l))}async requestPasswordReset(e,t,i){let l={method:"POST",body:{email:e}};return l=Sn("This form of requestPasswordReset(email, body?, query?) is deprecated. Consider replacing it with requestPasswordReset(email, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/request-password-reset",l).then(()=>!0)}async confirmPasswordReset(e,t,i,l,s){let o={method:"POST",body:{token:e,password:t,passwordConfirm:i}};return o=Sn("This form of confirmPasswordReset(token, password, passwordConfirm, body?, query?) is deprecated. Consider replacing it with confirmPasswordReset(token, password, passwordConfirm, options?).",o,l,s),this.client.send(this.baseCollectionPath+"/confirm-password-reset",o).then(()=>!0)}async requestVerification(e,t,i){let l={method:"POST",body:{email:e}};return l=Sn("This form of requestVerification(email, body?, query?) is deprecated. Consider replacing it with requestVerification(email, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/request-verification",l).then(()=>!0)}async confirmVerification(e,t,i){let l={method:"POST",body:{token:e}};return l=Sn("This form of confirmVerification(token, body?, query?) is deprecated. Consider replacing it with confirmVerification(token, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/confirm-verification",l).then(()=>!0)}async requestEmailChange(e,t,i){let l={method:"POST",body:{newEmail:e}};return l=Sn("This form of requestEmailChange(newEmail, body?, query?) is deprecated. Consider replacing it with requestEmailChange(newEmail, options?).",l,t,i),this.client.send(this.baseCollectionPath+"/request-email-change",l).then(()=>!0)}async confirmEmailChange(e,t,i,l){let s={method:"POST",body:{token:e,password:t}};return s=Sn("This form of confirmEmailChange(token, password, body?, query?) is deprecated. Consider replacing it with confirmEmailChange(token, password, options?).",s,i,l),this.client.send(this.baseCollectionPath+"/confirm-email-change",s).then(()=>!0)}async listExternalAuths(e,t){return t=Object.assign({method:"GET"},t),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths",t)}async unlinkExternalAuth(e,t,i){return i=Object.assign({method:"DELETE"},i),this.client.send(this.baseCrudPath+"/"+encodeURIComponent(e)+"/external-auths/"+encodeURIComponent(t),i).then(()=>!0)}_replaceQueryParams(e,t={}){let i=e,l="";e.indexOf("?")>=0&&(i=e.substring(0,e.indexOf("?")),l=e.substring(e.indexOf("?")+1));const s={},o=l.split("&");for(const r of o){if(r=="")continue;const a=r.split("=");s[decodeURIComponent(a[0].replace(/\+/g," "))]=decodeURIComponent((a[1]||"").replace(/\+/g," "))}for(let r in t)t.hasOwnProperty(r)&&(t[r]==null?delete s[r]:s[r]=t[r]);l="";for(let r in s)s.hasOwnProperty(r)&&(l!=""&&(l+="&"),l+=encodeURIComponent(r.replace(/%20/g,"+"))+"="+encodeURIComponent(s[r].replace(/%20/g,"+")));return l!=""?i+"?"+l:i}}function af(n){if(typeof window>"u"||!(window!=null&&window.open))throw new bn(new Error("Not in a browser context - please pass a custom urlCallback function."));let e=1024,t=768,i=window.innerWidth,l=window.innerHeight;e=e>i?i:e,t=t>l?l:t;let s=i/2-e/2,o=l/2-t/2;return window.open(n,"popup_window","width="+e+",height="+t+",top="+o+",left="+s+",resizable,menubar=no")}class K0 extends pa{get baseCrudPath(){return"/api/collections"}async import(e,t=!1,i){return i=Object.assign({method:"PUT",body:{collections:e,deleteMissing:t}},i),this.client.send(this.baseCrudPath+"/import",i).then(()=>!0)}}class J0 extends nl{async getList(e=1,t=30,i){return(i=Object.assign({method:"GET"},i)).query=Object.assign({page:e,perPage:t},i.query),this.client.send("/api/logs",i)}async getOne(e,t){if(!e)throw new bn({url:this.client.buildUrl("/api/logs/"),status:404,response:{code:404,message:"Missing required log id.",data:{}}});return t=Object.assign({method:"GET"},t),this.client.send("/api/logs/"+encodeURIComponent(e),t)}async getStats(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/logs/stats",e)}}class Z0 extends nl{async check(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/health",e)}}class G0 extends nl{getUrl(e,t,i={}){if(!t||!(e!=null&&e.id)||!(e!=null&&e.collectionId)&&!(e!=null&&e.collectionName))return"";const l=[];l.push("api"),l.push("files"),l.push(encodeURIComponent(e.collectionId||e.collectionName)),l.push(encodeURIComponent(e.id)),l.push(encodeURIComponent(t));let s=this.client.buildUrl(l.join("/"));if(Object.keys(i).length){i.download===!1&&delete i.download;const o=new URLSearchParams(i);s+=(s.includes("?")?"&":"?")+o}return s}async getToken(e){return e=Object.assign({method:"POST"},e),this.client.send("/api/files/token",e).then(t=>(t==null?void 0:t.token)||"")}}class X0 extends nl{async getFullList(e){return e=Object.assign({method:"GET"},e),this.client.send("/api/backups",e)}async create(e,t){return t=Object.assign({method:"POST",body:{name:e}},t),this.client.send("/api/backups",t).then(()=>!0)}async upload(e,t){return t=Object.assign({method:"POST",body:e},t),this.client.send("/api/backups/upload",t).then(()=>!0)}async delete(e,t){return t=Object.assign({method:"DELETE"},t),this.client.send(`/api/backups/${encodeURIComponent(e)}`,t).then(()=>!0)}async restore(e,t){return t=Object.assign({method:"POST"},t),this.client.send(`/api/backups/${encodeURIComponent(e)}/restore`,t).then(()=>!0)}getDownloadUrl(e,t){return this.client.buildUrl(`/api/backups/${encodeURIComponent(t)}?token=${encodeURIComponent(e)}`)}}class Ho{constructor(e="/",t,i="en-US"){this.cancelControllers={},this.recordServices={},this.enableAutoCancellation=!0,this.baseUrl=e,this.lang=i,this.authStore=t||new Bg,this.admins=new U0(this),this.collections=new K0(this),this.files=new G0(this),this.logs=new J0(this),this.settings=new B0(this),this.realtime=new Wg(this),this.health=new Z0(this),this.backups=new X0(this)}collection(e){return this.recordServices[e]||(this.recordServices[e]=new Y0(this,e)),this.recordServices[e]}autoCancellation(e){return this.enableAutoCancellation=!!e,this}cancelRequest(e){return this.cancelControllers[e]&&(this.cancelControllers[e].abort(),delete this.cancelControllers[e]),this}cancelAllRequests(){for(let e in this.cancelControllers)this.cancelControllers[e].abort();return this.cancelControllers={},this}filter(e,t){if(!t)return e;for(let i in t){let l=t[i];switch(typeof l){case"boolean":case"number":l=""+l;break;case"string":l="'"+l.replace(/'/g,"\\'")+"'";break;default:l=l===null?"null":l instanceof Date?"'"+l.toISOString().replace("T"," ")+"'":"'"+JSON.stringify(l).replace(/'/g,"\\'")+"'"}e=e.replaceAll("{:"+i+"}",l)}return e}getFileUrl(e,t,i={}){return this.files.getUrl(e,t,i)}buildUrl(e){var i;let t=this.baseUrl;return typeof window>"u"||!window.location||t.startsWith("https://")||t.startsWith("http://")||(t=(i=window.location.origin)!=null&&i.endsWith("/")?window.location.origin.substring(0,window.location.origin.length-1):window.location.origin||"",this.baseUrl.startsWith("/")||(t+=window.location.pathname||"/",t+=t.endsWith("/")?"":"/"),t+=this.baseUrl),e&&(t+=t.endsWith("/")?"":"/",t+=e.startsWith("/")?e.substring(1):e),t}async send(e,t){t=this.initSendOptions(e,t);let i=this.buildUrl(e);if(this.beforeSend){const l=Object.assign({},await this.beforeSend(i,t));l.url!==void 0||l.options!==void 0?(i=l.url||i,t=l.options||t):Object.keys(l).length&&(t=l,console!=null&&console.warn&&console.warn("Deprecated format of beforeSend return: please use `return { url, options }`, instead of `return options`."))}if(t.query!==void 0){const l=this.serializeQueryParams(t.query);l&&(i+=(i.includes("?")?"&":"?")+l),delete t.query}return this.getHeader(t.headers,"Content-Type")=="application/json"&&t.body&&typeof t.body!="string"&&(t.body=JSON.stringify(t.body)),(t.fetch||fetch)(i,t).then(async l=>{let s={};try{s=await l.json()}catch{}if(this.afterSend&&(s=await this.afterSend(l,s)),l.status>=400)throw new bn({url:l.url,status:l.status,data:s});return s}).catch(l=>{throw new bn(l)})}initSendOptions(e,t){if((t=Object.assign({method:"GET"},t)).body=this.convertToFormDataIfNeeded(t.body),Ug(t),t.query=Object.assign({},t.params,t.query),t.requestKey===void 0&&(t.$autoCancel===!1||t.query.$autoCancel===!1?t.requestKey=null:(t.$cancelKey||t.query.$cancelKey)&&(t.requestKey=t.$cancelKey||t.query.$cancelKey)),delete t.$autoCancel,delete t.query.$autoCancel,delete t.$cancelKey,delete t.query.$cancelKey,this.getHeader(t.headers,"Content-Type")!==null||this.isFormData(t.body)||(t.headers=Object.assign({},t.headers,{"Content-Type":"application/json"})),this.getHeader(t.headers,"Accept-Language")===null&&(t.headers=Object.assign({},t.headers,{"Accept-Language":this.lang})),this.authStore.token&&this.getHeader(t.headers,"Authorization")===null&&(t.headers=Object.assign({},t.headers,{Authorization:this.authStore.token})),this.enableAutoCancellation&&t.requestKey!==null){const i=t.requestKey||(t.method||"GET")+e;delete t.requestKey,this.cancelRequest(i);const l=new AbortController;this.cancelControllers[i]=l,t.signal=l.signal}return t}convertToFormDataIfNeeded(e){if(typeof FormData>"u"||e===void 0||typeof e!="object"||e===null||this.isFormData(e)||!this.hasBlobField(e))return e;const t=new FormData;for(let i in e){const l=this.normalizeFormDataValue(e[i]),s=Array.isArray(l)?l:[l];if(s.length)for(const o of s)t.append(i,o);else t.append(i,"")}return t}normalizeFormDataValue(e){return e===null||typeof e!="object"||e instanceof Date||this.hasBlobField({data:e})||Array.isArray(e)&&!e.filter(t=>typeof t!="string").length?e:JSON.stringify(e)}hasBlobField(e){for(let t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let l of i)if(typeof Blob<"u"&&l instanceof Blob||typeof File<"u"&&l instanceof File)return!0}return!1}getHeader(e,t){e=e||{},t=t.toLowerCase();for(let i in e)if(i.toLowerCase()==t)return e[i];return null}isFormData(e){return e&&(e.constructor.name==="FormData"||typeof FormData<"u"&&e instanceof FormData)}serializeQueryParams(e){const t=[];for(const i in e){if(e[i]===null)continue;const l=e[i],s=encodeURIComponent(i);if(Array.isArray(l))for(const o of l)t.push(s+"="+encodeURIComponent(o));else l instanceof Date?t.push(s+"="+encodeURIComponent(l.toISOString())):typeof l!==null&&typeof l=="object"?t.push(s+"="+encodeURIComponent(JSON.stringify(l))):t.push(s+"="+encodeURIComponent(l))}return t.join("&")}}class il extends Error{}class Q0 extends il{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class x0 extends il{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class ek extends il{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class gl extends il{}class Yg extends il{constructor(e){super(`Invalid unit ${e}`)}}class hn extends il{}class ki extends il{constructor(){super("Zone is an abstract class")}}const Oe="numeric",Yn="short",Tn="long",yo={year:Oe,month:Oe,day:Oe},Kg={year:Oe,month:Yn,day:Oe},tk={year:Oe,month:Yn,day:Oe,weekday:Yn},Jg={year:Oe,month:Tn,day:Oe},Zg={year:Oe,month:Tn,day:Oe,weekday:Tn},Gg={hour:Oe,minute:Oe},Xg={hour:Oe,minute:Oe,second:Oe},Qg={hour:Oe,minute:Oe,second:Oe,timeZoneName:Yn},xg={hour:Oe,minute:Oe,second:Oe,timeZoneName:Tn},e1={hour:Oe,minute:Oe,hourCycle:"h23"},t1={hour:Oe,minute:Oe,second:Oe,hourCycle:"h23"},n1={hour:Oe,minute:Oe,second:Oe,hourCycle:"h23",timeZoneName:Yn},i1={hour:Oe,minute:Oe,second:Oe,hourCycle:"h23",timeZoneName:Tn},l1={year:Oe,month:Oe,day:Oe,hour:Oe,minute:Oe},s1={year:Oe,month:Oe,day:Oe,hour:Oe,minute:Oe,second:Oe},o1={year:Oe,month:Yn,day:Oe,hour:Oe,minute:Oe},r1={year:Oe,month:Yn,day:Oe,hour:Oe,minute:Oe,second:Oe},nk={year:Oe,month:Yn,day:Oe,weekday:Yn,hour:Oe,minute:Oe},a1={year:Oe,month:Tn,day:Oe,hour:Oe,minute:Oe,timeZoneName:Yn},f1={year:Oe,month:Tn,day:Oe,hour:Oe,minute:Oe,second:Oe,timeZoneName:Yn},u1={year:Oe,month:Tn,day:Oe,weekday:Tn,hour:Oe,minute:Oe,timeZoneName:Tn},c1={year:Oe,month:Tn,day:Oe,weekday:Tn,hour:Oe,minute:Oe,second:Oe,timeZoneName:Tn};class ys{get type(){throw new ki}get name(){throw new ki}get ianaName(){return this.name}get isUniversal(){throw new ki}offsetName(e,t){throw new ki}formatOffset(e,t){throw new ki}offset(e){throw new ki}equals(e){throw new ki}get isValid(){throw new ki}}let ir=null;class zo extends ys{static get instance(){return ir===null&&(ir=new zo),ir}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:i}){return y1(e,t,i)}formatOffset(e,t){return Zl(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let oo={};function ik(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 lk={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function sk(n,e){const t=n.format(e).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,l,s,o,r,a,f,u]=i;return[o,l,s,r,a,f,u]}function ok(n,e){const t=n.formatToParts(e),i=[];for(let l=0;l=0?h:1e3+h,(d-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let ff={};function rk(n,e={}){const t=JSON.stringify([n,e]);let i=ff[t];return i||(i=new Intl.ListFormat(n,e),ff[t]=i),i}let qr={};function jr(n,e={}){const t=JSON.stringify([n,e]);let i=qr[t];return i||(i=new Intl.DateTimeFormat(n,e),qr[t]=i),i}let Hr={};function ak(n,e={}){const t=JSON.stringify([n,e]);let i=Hr[t];return i||(i=new Intl.NumberFormat(n,e),Hr[t]=i),i}let zr={};function fk(n,e={}){const{base:t,...i}=e,l=JSON.stringify([n,i]);let s=zr[l];return s||(s=new Intl.RelativeTimeFormat(n,e),zr[l]=s),s}let Wl=null;function uk(){return Wl||(Wl=new Intl.DateTimeFormat().resolvedOptions().locale,Wl)}let uf={};function ck(n){let e=uf[n];if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,uf[n]=e}return e}function dk(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let i,l;try{i=jr(n).resolvedOptions(),l=n}catch{const a=n.substring(0,t);i=jr(a).resolvedOptions(),l=a}const{numberingSystem:s,calendar:o}=i;return[l,s,o]}}function pk(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function mk(n){const e=[];for(let t=1;t<=12;t++){const i=je.utc(2009,t,1);e.push(n(i))}return e}function hk(n){const e=[];for(let t=1;t<=7;t++){const i=je.utc(2016,11,13+t);e.push(n(i))}return e}function As(n,e,t,i){const l=n.listingMode();return l==="error"?null:l==="en"?t(e):i(e)}function _k(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 gk{constructor(e,t,i){this.padTo=i.padTo||0,this.floor=i.floor||!1;const{padTo:l,floor:s,...o}=i;if(!t||Object.keys(o).length>0){const r={useGrouping:!1,...i};i.padTo>0&&(r.minimumIntegerDigits=i.padTo),this.inf=ak(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):ga(e,3);return zt(t,this.padTo)}}}class bk{constructor(e,t,i){this.opts=i,this.originalZone=void 0;let l;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),r=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&pi.create(r).valid?(l=r,this.dt=e):(l="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,l=e.zone.name):(l="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||l,this.dtf=jr(t,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const i=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:i}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class kk{constructor(e,t,i){this.opts={style:"long",...i},!t&&b1()&&(this.rtf=fk(e,i))}format(e,t){return this.rtf?this.rtf.format(e,t):jk(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const yk={firstDay:1,minimalDays:4,weekend:[6,7]};class bt{static fromOpts(e){return bt.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,i,l,s=!1){const o=e||Rt.defaultLocale,r=o||(s?"en-US":uk()),a=t||Rt.defaultNumberingSystem,f=i||Rt.defaultOutputCalendar,u=Vr(l)||Rt.defaultWeekSettings;return new bt(r,a,f,u,o)}static resetCache(){Wl=null,qr={},Hr={},zr={}}static fromObject({locale:e,numberingSystem:t,outputCalendar:i,weekSettings:l}={}){return bt.create(e,t,i,l)}constructor(e,t,i,l,s){const[o,r,a]=dk(e);this.locale=o,this.numberingSystem=t||r||null,this.outputCalendar=i||a||null,this.weekSettings=l,this.intl=pk(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=_k(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:bt.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Vr(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return As(this,e,S1,()=>{const i=t?{month:e,day:"numeric"}:{month:e},l=t?"format":"standalone";return this.monthsCache[l][e]||(this.monthsCache[l][e]=mk(s=>this.extract(s,i,"month"))),this.monthsCache[l][e]})}weekdays(e,t=!1){return As(this,e,C1,()=>{const i=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},l=t?"format":"standalone";return this.weekdaysCache[l][e]||(this.weekdaysCache[l][e]=hk(s=>this.extract(s,i,"weekday"))),this.weekdaysCache[l][e]})}meridiems(){return As(this,void 0,()=>O1,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[je.utc(2016,11,13,9),je.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return As(this,e,M1,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[je.utc(-40,1,1),je.utc(2017,1,1)].map(i=>this.extract(i,t,"era"))),this.eraCache[e]})}extract(e,t,i){const l=this.dtFormatter(e,t),s=l.formatToParts(),o=s.find(r=>r.type.toLowerCase()===i);return o?o.value:null}numberFormatter(e={}){return new gk(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new bk(e,this.intl,t)}relFormatter(e={}){return new kk(this.intl,this.isEnglish(),e)}listFormatter(e={}){return rk(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:k1()?ck(this.locale):yk}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let lr=null;class un extends ys{static get utcInstance(){return lr===null&&(lr=new un(0)),lr}static instance(e){return e===0?un.utcInstance:new un(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new un(Uo(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Zl(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Zl(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Zl(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 vk extends ys{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 Si(n,e){if(We(n)||n===null)return e;if(n instanceof ys)return n;if($k(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?zo.instance:t==="utc"||t==="gmt"?un.utcInstance:un.parseSpecifier(t)||pi.create(n)}else return Ji(n)?un.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new vk(n)}let cf=()=>Date.now(),df="system",pf=null,mf=null,hf=null,_f=60,gf,bf=null;class Rt{static get now(){return cf}static set now(e){cf=e}static set defaultZone(e){df=e}static get defaultZone(){return Si(df,zo.instance)}static get defaultLocale(){return pf}static set defaultLocale(e){pf=e}static get defaultNumberingSystem(){return mf}static set defaultNumberingSystem(e){mf=e}static get defaultOutputCalendar(){return hf}static set defaultOutputCalendar(e){hf=e}static get defaultWeekSettings(){return bf}static set defaultWeekSettings(e){bf=Vr(e)}static get twoDigitCutoffYear(){return _f}static set twoDigitCutoffYear(e){_f=e%100}static get throwOnInvalid(){return gf}static set throwOnInvalid(e){gf=e}static resetCaches(){bt.resetCache(),pi.resetCache()}}class zn{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const d1=[0,31,59,90,120,151,181,212,243,273,304,334],p1=[0,31,60,91,121,152,182,213,244,274,305,335];function Ln(n,e){return new zn("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function ma(n,e,t){const i=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&i.setUTCFullYear(i.getUTCFullYear()-1900);const l=i.getUTCDay();return l===0?7:l}function m1(n,e,t){return t+(vs(n)?p1:d1)[e-1]}function h1(n,e){const t=vs(n)?p1:d1,i=t.findIndex(s=>sos(i,e,t)?(f=i+1,a=1):f=i,{weekYear:f,weekNumber:a,weekday:r,...Wo(n)}}function kf(n,e=4,t=1){const{weekYear:i,weekNumber:l,weekday:s}=n,o=ha(ma(i,1,e),t),r=yl(i);let a=l*7+s-o-7+e,f;a<1?(f=i-1,a+=yl(f)):a>r?(f=i+1,a-=yl(i)):f=i;const{month:u,day:c}=h1(f,a);return{year:f,month:u,day:c,...Wo(n)}}function sr(n){const{year:e,month:t,day:i}=n,l=m1(e,t,i);return{year:e,ordinal:l,...Wo(n)}}function yf(n){const{year:e,ordinal:t}=n,{month:i,day:l}=h1(e,t);return{year:e,month:i,day:l,...Wo(n)}}function vf(n,e){if(!We(n.localWeekday)||!We(n.localWeekNumber)||!We(n.localWeekYear)){if(!We(n.weekday)||!We(n.weekNumber)||!We(n.weekYear))throw new gl("Cannot mix locale-based week fields with ISO-based week fields");return We(n.localWeekday)||(n.weekday=n.localWeekday),We(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),We(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function wk(n,e=4,t=1){const i=Vo(n.weekYear),l=Nn(n.weekNumber,1,os(n.weekYear,e,t)),s=Nn(n.weekday,1,7);return i?l?s?!1:Ln("weekday",n.weekday):Ln("week",n.weekNumber):Ln("weekYear",n.weekYear)}function Sk(n){const e=Vo(n.year),t=Nn(n.ordinal,1,yl(n.year));return e?t?!1:Ln("ordinal",n.ordinal):Ln("year",n.year)}function _1(n){const e=Vo(n.year),t=Nn(n.month,1,12),i=Nn(n.day,1,wo(n.year,n.month));return e?t?i?!1:Ln("day",n.day):Ln("month",n.month):Ln("year",n.year)}function g1(n){const{hour:e,minute:t,second:i,millisecond:l}=n,s=Nn(e,0,23)||e===24&&t===0&&i===0&&l===0,o=Nn(t,0,59),r=Nn(i,0,59),a=Nn(l,0,999);return s?o?r?a?!1:Ln("millisecond",l):Ln("second",i):Ln("minute",t):Ln("hour",e)}function We(n){return typeof n>"u"}function Ji(n){return typeof n=="number"}function Vo(n){return typeof n=="number"&&n%1===0}function $k(n){return typeof n=="string"}function Tk(n){return Object.prototype.toString.call(n)==="[object Date]"}function b1(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function k1(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function Ck(n){return Array.isArray(n)?n:[n]}function wf(n,e,t){if(n.length!==0)return n.reduce((i,l)=>{const s=[e(l),l];return i&&t(i[0],s[0])===i[0]?i:s},null)[1]}function Ok(n,e){return e.reduce((t,i)=>(t[i]=n[i],t),{})}function Tl(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Vr(n){if(n==null)return null;if(typeof n!="object")throw new hn("Week settings must be an object");if(!Nn(n.firstDay,1,7)||!Nn(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!Nn(e,1,7)))throw new hn("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function Nn(n,e,t){return Vo(n)&&n>=e&&n<=t}function Mk(n,e){return n-e*Math.floor(n/e)}function zt(n,e=2){const t=n<0;let i;return t?i="-"+(""+-n).padStart(e,"0"):i=(""+n).padStart(e,"0"),i}function vi(n){if(!(We(n)||n===null||n===""))return parseInt(n,10)}function Ni(n){if(!(We(n)||n===null||n===""))return parseFloat(n)}function _a(n){if(!(We(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function ga(n,e,t=!1){const i=10**e;return(t?Math.trunc:Math.round)(n*i)/i}function vs(n){return n%4===0&&(n%100!==0||n%400===0)}function yl(n){return vs(n)?366:365}function wo(n,e){const t=Mk(e-1,12)+1,i=n+(e-t)/12;return t===2?vs(i)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Bo(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(n.year,n.month-1,n.day)),+e}function Sf(n,e,t){return-ha(ma(n,1,e),t)+e-1}function os(n,e=4,t=1){const i=Sf(n,e,t),l=Sf(n+1,e,t);return(yl(n)-i+l)/7}function Br(n){return n>99?n:n>Rt.twoDigitCutoffYear?1900+n:2e3+n}function y1(n,e,t,i=null){const l=new Date(n),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};i&&(s.timeZone=i);const o={timeZoneName:e,...s},r=new Intl.DateTimeFormat(t,o).formatToParts(l).find(a=>a.type.toLowerCase()==="timezonename");return r?r.value:null}function Uo(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const i=parseInt(e,10)||0,l=t<0||Object.is(t,-0)?-i:i;return t*60+l}function v1(n){const e=Number(n);if(typeof n=="boolean"||n===""||Number.isNaN(e))throw new hn(`Invalid unit value ${n}`);return e}function So(n,e){const t={};for(const i in n)if(Tl(n,i)){const l=n[i];if(l==null)continue;t[e(i)]=v1(l)}return t}function Zl(n,e){const t=Math.trunc(Math.abs(n/60)),i=Math.trunc(Math.abs(n%60)),l=n>=0?"+":"-";switch(e){case"short":return`${l}${zt(t,2)}:${zt(i,2)}`;case"narrow":return`${l}${t}${i>0?`:${i}`:""}`;case"techie":return`${l}${zt(t,2)}${zt(i,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Wo(n){return Ok(n,["hour","minute","second","millisecond"])}const Dk=["January","February","March","April","May","June","July","August","September","October","November","December"],w1=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ek=["J","F","M","A","M","J","J","A","S","O","N","D"];function S1(n){switch(n){case"narrow":return[...Ek];case"short":return[...w1];case"long":return[...Dk];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 $1=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],T1=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Ik=["M","T","W","T","F","S","S"];function C1(n){switch(n){case"narrow":return[...Ik];case"short":return[...T1];case"long":return[...$1];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const O1=["AM","PM"],Ak=["Before Christ","Anno Domini"],Lk=["BC","AD"],Nk=["B","A"];function M1(n){switch(n){case"narrow":return[...Nk];case"short":return[...Lk];case"long":return[...Ak];default:return null}}function Pk(n){return O1[n.hour<12?0:1]}function Fk(n,e){return C1(e)[n.weekday-1]}function Rk(n,e){return S1(e)[n.month-1]}function qk(n,e){return M1(e)[n.year<0?0:1]}function jk(n,e,t="always",i=!1){const l={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."]},s=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&s){const c=n==="days";switch(e){case 1:return c?"tomorrow":`next ${l[n][0]}`;case-1:return c?"yesterday":`last ${l[n][0]}`;case 0:return c?"today":`this ${l[n][0]}`}}const o=Object.is(e,-0)||e<0,r=Math.abs(e),a=r===1,f=l[n],u=i?a?f[1]:f[2]||f[1]:a?l[n][0]:n;return o?`${r} ${u} ago`:`in ${r} ${u}`}function $f(n,e){let t="";for(const i of n)i.literal?t+=i.val:t+=e(i.val);return t}const Hk={D:yo,DD:Kg,DDD:Jg,DDDD:Zg,t:Gg,tt:Xg,ttt:Qg,tttt:xg,T:e1,TT:t1,TTT:n1,TTTT:i1,f:l1,ff:o1,fff:a1,ffff:u1,F:s1,FF:r1,FFF:f1,FFFF:c1};class ln{static create(e,t={}){return new ln(e,t)}static parseFormat(e){let t=null,i="",l=!1;const s=[];for(let o=0;o0&&s.push({literal:l||/^\s+$/.test(i),val:i}),t=null,i="",l=!l):l||r===t?i+=r:(i.length>0&&s.push({literal:/^\s+$/.test(i),val:i}),i=r,t=r)}return i.length>0&&s.push({literal:l||/^\s+$/.test(i),val:i}),s}static macroTokenToFormatOpts(e){return Hk[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()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0){if(this.opts.forceSimple)return zt(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",l=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(m,h)=>this.loc.extract(e,m,h),o=m=>e.isOffsetFixed&&e.offset===0&&m.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,m.format):"",r=()=>i?Pk(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),a=(m,h)=>i?Rk(e,m):s(h?{month:m}:{month:m,day:"numeric"},"month"),f=(m,h)=>i?Fk(e,m):s(h?{weekday:m}:{weekday:m,month:"long",day:"numeric"},"weekday"),u=m=>{const h=ln.macroTokenToFormatOpts(m);return h?this.formatWithSystemDefault(e,h):m},c=m=>i?qk(e,m):s({era:m},"era"),d=m=>{switch(m){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 l?s({day:"numeric"},"day"):this.num(e.day);case"dd":return l?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return f("short",!0);case"cccc":return f("long",!0);case"ccccc":return f("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return f("short",!1);case"EEEE":return f("long",!1);case"EEEEE":return f("narrow",!1);case"L":return l?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return l?s({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 l?s({month:"numeric"},"month"):this.num(e.month);case"MM":return l?s({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 l?s({year:"numeric"},"year"):this.num(e.year);case"yy":return l?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return l?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return l?s({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"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);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 u(m)}};return $f(ln.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}},l=a=>f=>{const u=i(f);return u?this.num(a.get(u),f.length):f},s=ln.parseFormat(t),o=s.reduce((a,{literal:f,val:u})=>f?a:a.concat(u),[]),r=e.shiftTo(...o.map(i).filter(a=>a));return $f(s,l(r))}}const D1=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function El(...n){const e=n.reduce((t,i)=>t+i.source,"");return RegExp(`^${e}$`)}function Il(...n){return e=>n.reduce(([t,i,l],s)=>{const[o,r,a]=s(e,l);return[{...t,...o},r||i,a]},[{},null,1]).slice(0,2)}function Al(n,...e){if(n==null)return[null,null];for(const[t,i]of e){const l=t.exec(n);if(l)return i(l)}return[null,null]}function E1(...n){return(e,t)=>{const i={};let l;for(l=0;lm!==void 0&&(h||m&&u)?-m:m;return[{years:d(Ni(t)),months:d(Ni(i)),weeks:d(Ni(l)),days:d(Ni(s)),hours:d(Ni(o)),minutes:d(Ni(r)),seconds:d(Ni(a),a==="-0"),milliseconds:d(_a(f),c)}]}const xk={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 ya(n,e,t,i,l,s,o){const r={year:e.length===2?Br(vi(e)):vi(e),month:w1.indexOf(t)+1,day:vi(i),hour:vi(l),minute:vi(s)};return o&&(r.second=vi(o)),n&&(r.weekday=n.length>3?$1.indexOf(n)+1:T1.indexOf(n)+1),r}const ey=/^(?:(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 ty(n){const[,e,t,i,l,s,o,r,a,f,u,c]=n,d=ya(e,l,i,t,s,o,r);let m;return a?m=xk[a]:f?m=0:m=Uo(u,c),[d,new un(m)]}function ny(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const iy=/^(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$/,ly=/^(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$/,sy=/^(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 Tf(n){const[,e,t,i,l,s,o,r]=n;return[ya(e,l,i,t,s,o,r),un.utcInstance]}function oy(n){const[,e,t,i,l,s,o,r]=n;return[ya(e,r,t,i,l,s,o),un.utcInstance]}const ry=El(Vk,ka),ay=El(Bk,ka),fy=El(Uk,ka),uy=El(A1),N1=Il(Zk,Ll,ws,Ss),cy=Il(Wk,Ll,ws,Ss),dy=Il(Yk,Ll,ws,Ss),py=Il(Ll,ws,Ss);function my(n){return Al(n,[ry,N1],[ay,cy],[fy,dy],[uy,py])}function hy(n){return Al(ny(n),[ey,ty])}function _y(n){return Al(n,[iy,Tf],[ly,Tf],[sy,oy])}function gy(n){return Al(n,[Xk,Qk])}const by=Il(Ll);function ky(n){return Al(n,[Gk,by])}const yy=El(Kk,Jk),vy=El(L1),wy=Il(Ll,ws,Ss);function Sy(n){return Al(n,[yy,N1],[vy,wy])}const Cf="Invalid Duration",P1={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}},$y={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},...P1},Mn=146097/400,pl=146097/4800,Ty={years:{quarters:4,months:12,weeks:Mn/7,days:Mn,hours:Mn*24,minutes:Mn*24*60,seconds:Mn*24*60*60,milliseconds:Mn*24*60*60*1e3},quarters:{months:3,weeks:Mn/28,days:Mn/4,hours:Mn*24/4,minutes:Mn*24*60/4,seconds:Mn*24*60*60/4,milliseconds:Mn*24*60*60*1e3/4},months:{weeks:pl/7,days:pl,hours:pl*24,minutes:pl*24*60,seconds:pl*24*60*60,milliseconds:pl*24*60*60*1e3},...P1},Ui=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Cy=Ui.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,matrix:e.matrix||n.matrix};return new ot(i)}function F1(n,e){let t=e.milliseconds??0;for(const i of Cy.slice(1))e[i]&&(t+=e[i]*n[i].milliseconds);return t}function Of(n,e){const t=F1(n,e)<0?-1:1;Ui.reduceRight((i,l)=>{if(We(e[l]))return i;if(i){const s=e[i]*t,o=n[l][i],r=Math.floor(s/o);e[l]+=r*t,e[i]-=r*o*t}return l},null),Ui.reduce((i,l)=>{if(We(e[l]))return i;if(i){const s=e[i]%1;e[i]-=s,e[l]+=s*n[i][l]}return l},null)}function Oy(n){const e={};for(const[t,i]of Object.entries(n))i!==0&&(e[t]=i);return e}class ot{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let i=t?Ty:$y;e.matrix&&(i=e.matrix),this.values=e.values,this.loc=e.loc||bt.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=i,this.isLuxonDuration=!0}static fromMillis(e,t){return ot.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new hn(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new ot({values:So(e,ot.normalizeUnit),loc:bt.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(Ji(e))return ot.fromMillis(e);if(ot.isDuration(e))return e;if(typeof e=="object")return ot.fromObject(e);throw new hn(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[i]=gy(e);return i?ot.fromObject(i,t):ot.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[i]=ky(e);return i?ot.fromObject(i,t):ot.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new hn("need to specify a reason the Duration is invalid");const i=e instanceof zn?e:new zn(e,t);if(Rt.throwOnInvalid)throw new ek(i);return new ot({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 Yg(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?ln.create(this.loc,i).formatDurationFromString(this,e):Cf}toHuman(e={}){if(!this.isValid)return Cf;const t=Ui.map(i=>{const l=this.values[i];return We(l)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:i.slice(0,-1)}).format(l)}).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+=ga(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},je.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?F1(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=ot.fromDurationLike(e),i={};for(const l of Ui)(Tl(t.values,l)||Tl(this.values,l))&&(i[l]=t.get(l)+this.get(l));return yi(this,{values:i},!0)}minus(e){if(!this.isValid)return this;const t=ot.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]=v1(e(this.values[i],i));return yi(this,{values:t},!0)}get(e){return this[ot.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...So(e,ot.normalizeUnit)};return yi(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:i,matrix:l}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:l,conversionAccuracy:i};return yi(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Of(this.matrix,e),yi(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Oy(this.normalize().shiftToAll().toObject());return yi(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>ot.normalizeUnit(o));const t={},i={},l=this.toObject();let s;for(const o of Ui)if(e.indexOf(o)>=0){s=o;let r=0;for(const f in i)r+=this.matrix[f][o]*i[f],i[f]=0;Ji(l[o])&&(r+=l[o]);const a=Math.trunc(r);t[o]=a,i[o]=(r*1e3-a*1e3)/1e3}else Ji(l[o])&&(i[o]=l[o]);for(const o in i)i[o]!==0&&(t[s]+=o===s?i[o]:i[o]/this.matrix[s][o]);return Of(this.matrix,t),yi(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}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,l){return i===void 0||i===0?l===void 0||l===0:i===l}for(const i of Ui)if(!t(this.values[i],e.values[i]))return!1;return!0}}const ml="Invalid Interval";function My(n,e){return!n||!n.isValid?Pt.invalid("missing or invalid start"):!e||!e.isValid?Pt.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?Pt.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(jl).filter(o=>this.contains(o)).sort((o,r)=>o.toMillis()-r.toMillis()),i=[];let{s:l}=this,s=0;for(;l+this.e?this.e:o;i.push(Pt.fromDateTimes(l,r)),l=r,s+=1}return i}splitBy(e){const t=ot.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s:i}=this,l=1,s;const o=[];for(;ia*l));s=+r>+this.e?this.e:r,o.push(Pt.fromDateTimes(i,s)),i=s,l+=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:Pt.fromDateTimes(t,i)}union(e){if(!this.isValid)return this;const t=this.se.e?this.e:e.e;return Pt.fromDateTimes(t,i)}static merge(e){const[t,i]=e.sort((l,s)=>l.s-s.s).reduce(([l,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[l,s.union(o)]:[l.concat([s]),o]:[l,o],[[],null]);return i&&t.push(i),t}static xor(e){let t=null,i=0;const l=[],s=e.map(a=>[{time:a.s,type:"s"},{time:a.e,type:"e"}]),o=Array.prototype.concat(...s),r=o.sort((a,f)=>a.time-f.time);for(const a of r)i+=a.type==="s"?1:-1,i===1?t=a.time:(t&&+t!=+a.time&&l.push(Pt.fromDateTimes(t,a.time)),t=null);return Pt.merge(l)}difference(...e){return Pt.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:ml}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=yo,t={}){return this.isValid?ln.create(this.s.loc.clone(t),e).formatInterval(this):ml}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:ml}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:ml}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:ml}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:ml}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):ot.invalid(this.invalidReason)}mapEndpoints(e){return Pt.fromDateTimes(e(this.s),e(this.e))}}class Ls{static hasDST(e=Rt.defaultZone){const t=je.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return pi.isValidZone(e)}static normalizeZone(e){return Si(e,Rt.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||bt.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||bt.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||bt.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null,outputCalendar:s="gregory"}={}){return(l||bt.create(t,i,s)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null,outputCalendar:s="gregory"}={}){return(l||bt.create(t,i,s)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null}={}){return(l||bt.create(t,i,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:i=null,locObj:l=null}={}){return(l||bt.create(t,i,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return bt.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return bt.create(t,null,"gregory").eras(e)}static features(){return{relative:b1(),localeWeek:k1()}}}function Mf(n,e){const t=l=>l.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),i=t(e)-t(n);return Math.floor(ot.fromMillis(i).as("days"))}function Dy(n,e,t){const i=[["years",(a,f)=>f.year-a.year],["quarters",(a,f)=>f.quarter-a.quarter+(f.year-a.year)*4],["months",(a,f)=>f.month-a.month+(f.year-a.year)*12],["weeks",(a,f)=>{const u=Mf(a,f);return(u-u%7)/7}],["days",Mf]],l={},s=n;let o,r;for(const[a,f]of i)t.indexOf(a)>=0&&(o=a,l[a]=f(n,e),r=s.plus(l),r>e?(l[a]--,n=s.plus(l),n>e&&(r=n,l[a]--,n=s.plus(l))):n=r);return[n,l,r,o]}function Ey(n,e,t,i){let[l,s,o,r]=Dy(n,e,t);const a=e-l,f=t.filter(c=>["hours","minutes","seconds","milliseconds"].indexOf(c)>=0);f.length===0&&(o0?ot.fromMillis(a,i).shiftTo(...f).plus(u):u}const va={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Df={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]},Iy=va.hanidec.replace(/[\[|\]]/g,"").split("");function Ay(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t=s&&i<=o&&(e+=i-s)}}return parseInt(e,10)}else return e}function jn({numberingSystem:n},e=""){return new RegExp(`${va[n||"latn"]}${e}`)}const Ly="missing Intl.DateTimeFormat.formatToParts support";function ft(n,e=t=>t){return{regex:n,deser:([t])=>e(Ay(t))}}const Ny=" ",R1=`[ ${Ny}]`,q1=new RegExp(R1,"g");function Py(n){return n.replace(/\./g,"\\.?").replace(q1,R1)}function Ef(n){return n.replace(/\./g,"").replace(q1," ").toLowerCase()}function Hn(n,e){return n===null?null:{regex:RegExp(n.map(Py).join("|")),deser:([t])=>n.findIndex(i=>Ef(t)===Ef(i))+e}}function If(n,e){return{regex:n,deser:([,t,i])=>Uo(t,i),groups:e}}function Ns(n){return{regex:n,deser:([e])=>e}}function Fy(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Ry(n,e){const t=jn(e),i=jn(e,"{2}"),l=jn(e,"{3}"),s=jn(e,"{4}"),o=jn(e,"{6}"),r=jn(e,"{1,2}"),a=jn(e,"{1,3}"),f=jn(e,"{1,6}"),u=jn(e,"{1,9}"),c=jn(e,"{2,4}"),d=jn(e,"{4,6}"),m=g=>({regex:RegExp(Fy(g.val)),deser:([y])=>y,literal:!0}),_=(g=>{if(n.literal)return m(g);switch(g.val){case"G":return Hn(e.eras("short"),0);case"GG":return Hn(e.eras("long"),0);case"y":return ft(f);case"yy":return ft(c,Br);case"yyyy":return ft(s);case"yyyyy":return ft(d);case"yyyyyy":return ft(o);case"M":return ft(r);case"MM":return ft(i);case"MMM":return Hn(e.months("short",!0),1);case"MMMM":return Hn(e.months("long",!0),1);case"L":return ft(r);case"LL":return ft(i);case"LLL":return Hn(e.months("short",!1),1);case"LLLL":return Hn(e.months("long",!1),1);case"d":return ft(r);case"dd":return ft(i);case"o":return ft(a);case"ooo":return ft(l);case"HH":return ft(i);case"H":return ft(r);case"hh":return ft(i);case"h":return ft(r);case"mm":return ft(i);case"m":return ft(r);case"q":return ft(r);case"qq":return ft(i);case"s":return ft(r);case"ss":return ft(i);case"S":return ft(a);case"SSS":return ft(l);case"u":return Ns(u);case"uu":return Ns(r);case"uuu":return ft(t);case"a":return Hn(e.meridiems(),0);case"kkkk":return ft(s);case"kk":return ft(c,Br);case"W":return ft(r);case"WW":return ft(i);case"E":case"c":return ft(t);case"EEE":return Hn(e.weekdays("short",!1),1);case"EEEE":return Hn(e.weekdays("long",!1),1);case"ccc":return Hn(e.weekdays("short",!0),1);case"cccc":return Hn(e.weekdays("long",!0),1);case"Z":case"ZZ":return If(new RegExp(`([+-]${r.source})(?::(${i.source}))?`),2);case"ZZZ":return If(new RegExp(`([+-]${r.source})(${i.source})?`),2);case"z":return Ns(/[a-z_+-/]{1,256}?/i);case" ":return Ns(/[^\S\n\r]/);default:return m(g)}})(n)||{invalidReason:Ly};return _.token=n,_}const qy={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",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function jy(n,e,t){const{type:i,value:l}=n;if(i==="literal"){const a=/^\s+$/.test(l);return{literal:!a,val:a?" ":l}}const s=e[i];let o=i;i==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let r=qy[o];if(typeof r=="object"&&(r=r[s]),r)return{literal:!1,val:r}}function Hy(n){return[`^${n.map(t=>t.regex).reduce((t,i)=>`${t}(${i.source})`,"")}$`,n]}function zy(n,e,t){const i=n.match(e);if(i){const l={};let s=1;for(const o in t)if(Tl(t,o)){const r=t[o],a=r.groups?r.groups+1:1;!r.literal&&r.token&&(l[r.token.val[0]]=r.deser(i.slice(s,s+a))),s+=a}return[i,l]}else return[i,{}]}function Vy(n){const e=s=>{switch(s){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 We(n.z)||(t=pi.create(n.z)),We(n.Z)||(t||(t=new un(n.Z)),i=n.Z),We(n.q)||(n.M=(n.q-1)*3+1),We(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),We(n.u)||(n.S=_a(n.u)),[Object.keys(n).reduce((s,o)=>{const r=e(o);return r&&(s[r]=n[o]),s},{}),t,i]}let or=null;function By(){return or||(or=je.fromMillis(1555555555555)),or}function Uy(n,e){if(n.literal)return n;const t=ln.macroTokenToFormatOpts(n.val),i=z1(t,e);return i==null||i.includes(void 0)?n:i}function j1(n,e){return Array.prototype.concat(...n.map(t=>Uy(t,e)))}function H1(n,e,t){const i=j1(ln.parseFormat(t),n),l=i.map(o=>Ry(o,n)),s=l.find(o=>o.invalidReason);if(s)return{input:e,tokens:i,invalidReason:s.invalidReason};{const[o,r]=Hy(l),a=RegExp(o,"i"),[f,u]=zy(e,a,r),[c,d,m]=u?Vy(u):[null,null,void 0];if(Tl(u,"a")&&Tl(u,"H"))throw new gl("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:i,regex:a,rawMatches:f,matches:u,result:c,zone:d,specificOffset:m}}}function Wy(n,e,t){const{result:i,zone:l,specificOffset:s,invalidReason:o}=H1(n,e,t);return[i,l,s,o]}function z1(n,e){if(!n)return null;const i=ln.create(e,n).dtFormatter(By()),l=i.formatToParts(),s=i.resolvedOptions();return l.map(o=>jy(o,n,s))}const rr="Invalid DateTime",Af=864e13;function Ps(n){return new zn("unsupported zone",`the zone "${n.name}" is not supported`)}function ar(n){return n.weekData===null&&(n.weekData=vo(n.c)),n.weekData}function fr(n){return n.localWeekData===null&&(n.localWeekData=vo(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function Pi(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new je({...t,...e,old:t})}function V1(n,e,t){let i=n-e*60*1e3;const l=t.offset(i);if(e===l)return[i,e];i-=(l-e)*60*1e3;const s=t.offset(i);return l===s?[i,l]:[n-Math.min(l,s)*60*1e3,Math.max(l,s)]}function Fs(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 V1(Bo(n),e,t)}function Lf(n,e){const t=n.o,i=n.c.year+Math.trunc(e.years),l=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...n.c,year:i,month:l,day:Math.min(n.c.day,wo(i,l))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=ot.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=Bo(s);let[a,f]=V1(r,t,n.zone);return o!==0&&(a+=o,f=n.zone.offset(a)),{ts:a,o:f}}function ql(n,e,t,i,l,s){const{setZone:o,zone:r}=t;if(n&&Object.keys(n).length!==0||e){const a=e||r,f=je.fromObject(n,{...t,zone:a,specificOffset:s});return o?f:f.setZone(r)}else return je.invalid(new zn("unparsable",`the input "${l}" can't be parsed as ${i}`))}function Rs(n,e,t=!0){return n.isValid?ln.create(bt.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function ur(n,e){const t=n.c.year>9999||n.c.year<0;let i="";return t&&n.c.year>=0&&(i+="+"),i+=zt(n.c.year,t?6:4),e?(i+="-",i+=zt(n.c.month),i+="-",i+=zt(n.c.day)):(i+=zt(n.c.month),i+=zt(n.c.day)),i}function Nf(n,e,t,i,l,s){let o=zt(n.c.hour);return e?(o+=":",o+=zt(n.c.minute),(n.c.millisecond!==0||n.c.second!==0||!t)&&(o+=":")):o+=zt(n.c.minute),(n.c.millisecond!==0||n.c.second!==0||!t)&&(o+=zt(n.c.second),(n.c.millisecond!==0||!i)&&(o+=".",o+=zt(n.c.millisecond,3))),l&&(n.isOffsetFixed&&n.offset===0&&!s?o+="Z":n.o<0?(o+="-",o+=zt(Math.trunc(-n.o/60)),o+=":",o+=zt(Math.trunc(-n.o%60))):(o+="+",o+=zt(Math.trunc(n.o/60)),o+=":",o+=zt(Math.trunc(n.o%60)))),s&&(o+="["+n.zone.ianaName+"]"),o}const B1={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Yy={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ky={ordinal:1,hour:0,minute:0,second:0,millisecond:0},U1=["year","month","day","hour","minute","second","millisecond"],Jy=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Zy=["year","ordinal","hour","minute","second","millisecond"];function Gy(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 Yg(n);return e}function Pf(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return Gy(n)}}function Ff(n,e){const t=Si(e.zone,Rt.defaultZone),i=bt.fromObject(e),l=Rt.now();let s,o;if(We(n.year))s=l;else{for(const f of U1)We(n[f])&&(n[f]=B1[f]);const r=_1(n)||g1(n);if(r)return je.invalid(r);const a=t.offset(l);[s,o]=ro(n,a,t)}return new je({ts:s,zone:t,loc:i,o})}function Rf(n,e,t){const i=We(t.round)?!0:t.round,l=(o,r)=>(o=ga(o,i||t.calendary?0:2,!0),e.loc.clone(t).relFormatter(t).format(o,r)),s=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 l(s(t.unit),t.unit);for(const o of t.units){const r=s(o);if(Math.abs(r)>=1)return l(r,o)}return l(n>e?-0:0,t.units[t.units.length-1])}function qf(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 je{constructor(e){const t=e.zone||Rt.defaultZone;let i=e.invalid||(Number.isNaN(e.ts)?new zn("invalid input"):null)||(t.isValid?null:Ps(t));this.ts=We(e.ts)?Rt.now():e.ts;let l=null,s=null;if(!i)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[l,s]=[e.old.c,e.old.o];else{const r=t.offset(this.ts);l=Fs(this.ts,r),i=Number.isNaN(l.year)?new zn("invalid input"):null,l=i?null:l,s=i?null:r}this._zone=t,this.loc=e.loc||bt.create(),this.invalid=i,this.weekData=null,this.localWeekData=null,this.c=l,this.o=s,this.isLuxonDateTime=!0}static now(){return new je({})}static local(){const[e,t]=qf(arguments),[i,l,s,o,r,a,f]=t;return Ff({year:i,month:l,day:s,hour:o,minute:r,second:a,millisecond:f},e)}static utc(){const[e,t]=qf(arguments),[i,l,s,o,r,a,f]=t;return e.zone=un.utcInstance,Ff({year:i,month:l,day:s,hour:o,minute:r,second:a,millisecond:f},e)}static fromJSDate(e,t={}){const i=Tk(e)?e.valueOf():NaN;if(Number.isNaN(i))return je.invalid("invalid input");const l=Si(t.zone,Rt.defaultZone);return l.isValid?new je({ts:i,zone:l,loc:bt.fromObject(t)}):je.invalid(Ps(l))}static fromMillis(e,t={}){if(Ji(e))return e<-Af||e>Af?je.invalid("Timestamp out of range"):new je({ts:e,zone:Si(t.zone,Rt.defaultZone),loc:bt.fromObject(t)});throw new hn(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(Ji(e))return new je({ts:e*1e3,zone:Si(t.zone,Rt.defaultZone),loc:bt.fromObject(t)});throw new hn("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const i=Si(t.zone,Rt.defaultZone);if(!i.isValid)return je.invalid(Ps(i));const l=bt.fromObject(t),s=So(e,Pf),{minDaysInFirstWeek:o,startOfWeek:r}=vf(s,l),a=Rt.now(),f=We(t.specificOffset)?i.offset(a):t.specificOffset,u=!We(s.ordinal),c=!We(s.year),d=!We(s.month)||!We(s.day),m=c||d,h=s.weekYear||s.weekNumber;if((m||u)&&h)throw new gl("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(d&&u)throw new gl("Can't mix ordinal dates with month/day");const _=h||s.weekday&&!m;let g,y,S=Fs(a,f);_?(g=Jy,y=Yy,S=vo(S,o,r)):u?(g=Zy,y=Ky,S=sr(S)):(g=U1,y=B1);let T=!1;for(const R of g){const F=s[R];We(F)?T?s[R]=y[R]:s[R]=S[R]:T=!0}const $=_?wk(s,o,r):u?Sk(s):_1(s),C=$||g1(s);if(C)return je.invalid(C);const M=_?kf(s,o,r):u?yf(s):s,[D,I]=ro(M,f,i),L=new je({ts:D,zone:i,o:I,loc:l});return s.weekday&&m&&e.weekday!==L.weekday?je.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${L.toISO()}`):L}static fromISO(e,t={}){const[i,l]=my(e);return ql(i,l,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[i,l]=hy(e);return ql(i,l,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[i,l]=_y(e);return ql(i,l,t,"HTTP",t)}static fromFormat(e,t,i={}){if(We(e)||We(t))throw new hn("fromFormat requires an input string and a format");const{locale:l=null,numberingSystem:s=null}=i,o=bt.fromOpts({locale:l,numberingSystem:s,defaultToEN:!0}),[r,a,f,u]=Wy(o,e,t);return u?je.invalid(u):ql(r,a,i,`format ${t}`,e,f)}static fromString(e,t,i={}){return je.fromFormat(e,t,i)}static fromSQL(e,t={}){const[i,l]=Sy(e);return ql(i,l,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new hn("need to specify a reason the DateTime is invalid");const i=e instanceof zn?e:new zn(e,t);if(Rt.throwOnInvalid)throw new Q0(i);return new je({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const i=z1(e,bt.fromObject(t));return i?i.map(l=>l?l.val:null).join(""):null}static expandFormat(e,t={}){return j1(ln.parseFormat(e),bt.fromObject(t)).map(l=>l.val).join("")}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?ar(this).weekYear:NaN}get weekNumber(){return this.isValid?ar(this).weekNumber:NaN}get weekday(){return this.isValid?ar(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?fr(this).weekday:NaN}get localWeekNumber(){return this.isValid?fr(this).weekNumber:NaN}get localWeekYear(){return this.isValid?fr(this).weekYear:NaN}get ordinal(){return this.isValid?sr(this.c).ordinal:NaN}get monthShort(){return this.isValid?Ls.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Ls.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Ls.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Ls.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}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,i=Bo(this.c),l=this.zone.offset(i-e),s=this.zone.offset(i+e),o=this.zone.offset(i-l*t),r=this.zone.offset(i-s*t);if(o===r)return[this];const a=i-o*t,f=i-r*t,u=Fs(a,o),c=Fs(f,r);return u.hour===c.hour&&u.minute===c.minute&&u.second===c.second&&u.millisecond===c.millisecond?[Pi(this,{ts:a}),Pi(this,{ts:f})]:[this]}get isInLeapYear(){return vs(this.year)}get daysInMonth(){return wo(this.year,this.month)}get daysInYear(){return this.isValid?yl(this.year):NaN}get weeksInWeekYear(){return this.isValid?os(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?os(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:i,calendar:l}=ln.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:i,outputCalendar:l}}toUTC(e=0,t={}){return this.setZone(un.instance(e),t)}toLocal(){return this.setZone(Rt.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:i=!1}={}){if(e=Si(e,Rt.defaultZone),e.equals(this.zone))return this;if(e.isValid){let l=this.ts;if(t||i){const s=e.offset(this.ts),o=this.toObject();[l]=ro(o,s,e)}return Pi(this,{ts:l,zone:e})}else return je.invalid(Ps(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:i}={}){const l=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:i});return Pi(this,{loc:l})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=So(e,Pf),{minDaysInFirstWeek:i,startOfWeek:l}=vf(t,this.loc),s=!We(t.weekYear)||!We(t.weekNumber)||!We(t.weekday),o=!We(t.ordinal),r=!We(t.year),a=!We(t.month)||!We(t.day),f=r||a,u=t.weekYear||t.weekNumber;if((f||o)&&u)throw new gl("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(a&&o)throw new gl("Can't mix ordinal dates with month/day");let c;s?c=kf({...vo(this.c,i,l),...t},i,l):We(t.ordinal)?(c={...this.toObject(),...t},We(t.day)&&(c.day=Math.min(wo(c.year,c.month),c.day))):c=yf({...sr(this.c),...t});const[d,m]=ro(c,this.o,this.zone);return Pi(this,{ts:d,o:m})}plus(e){if(!this.isValid)return this;const t=ot.fromDurationLike(e);return Pi(this,Lf(this,t))}minus(e){if(!this.isValid)return this;const t=ot.fromDurationLike(e).negate();return Pi(this,Lf(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const i={},l=ot.normalizeUnit(e);switch(l){case"years":i.month=1;case"quarters":case"months":i.day=1;case"weeks":case"days":i.hour=0;case"hours":i.minute=0;case"minutes":i.second=0;case"seconds":i.millisecond=0;break}if(l==="weeks")if(t){const s=this.loc.getStartOfWeek(),{weekday:o}=this;othis.valueOf(),r=o?this:e,a=o?e:this,f=Ey(r,a,s,l);return o?f.negate():f}diffNow(e="milliseconds",t={}){return this.diff(je.now(),e,t)}until(e){return this.isValid?Pt.fromDateTimes(this,e):this}hasSame(e,t,i){if(!this.isValid)return!1;const l=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(t,i)<=l&&l<=s.endOf(t,i)}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||je.fromObject({},{zone:this.zone}),i=e.padding?thist.valueOf(),Math.min)}static max(...e){if(!e.every(je.isDateTime))throw new hn("max requires all arguments be DateTimes");return wf(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,i={}){const{locale:l=null,numberingSystem:s=null}=i,o=bt.fromOpts({locale:l,numberingSystem:s,defaultToEN:!0});return H1(o,e,t)}static fromStringExplain(e,t,i={}){return je.fromFormatExplain(e,t,i)}static get DATE_SHORT(){return yo}static get DATE_MED(){return Kg}static get DATE_MED_WITH_WEEKDAY(){return tk}static get DATE_FULL(){return Jg}static get DATE_HUGE(){return Zg}static get TIME_SIMPLE(){return Gg}static get TIME_WITH_SECONDS(){return Xg}static get TIME_WITH_SHORT_OFFSET(){return Qg}static get TIME_WITH_LONG_OFFSET(){return xg}static get TIME_24_SIMPLE(){return e1}static get TIME_24_WITH_SECONDS(){return t1}static get TIME_24_WITH_SHORT_OFFSET(){return n1}static get TIME_24_WITH_LONG_OFFSET(){return i1}static get DATETIME_SHORT(){return l1}static get DATETIME_SHORT_WITH_SECONDS(){return s1}static get DATETIME_MED(){return o1}static get DATETIME_MED_WITH_SECONDS(){return r1}static get DATETIME_MED_WITH_WEEKDAY(){return nk}static get DATETIME_FULL(){return a1}static get DATETIME_FULL_WITH_SECONDS(){return f1}static get DATETIME_HUGE(){return u1}static get DATETIME_HUGE_WITH_SECONDS(){return c1}}function jl(n){if(je.isDateTime(n))return n;if(n&&n.valueOf&&Ji(n.valueOf()))return je.fromJSDate(n);if(n&&typeof n=="object")return je.fromObject(n);throw new hn(`Unknown datetime argument: ${n}, of type ${typeof n}`)}const Xy=[".jpg",".jpeg",".png",".svg",".gif",".jfif",".webp",".avif"],Qy=[".mp4",".avi",".mov",".3gp",".wmv"],xy=[".aa",".aac",".m4v",".mp3",".ogg",".oga",".mogg",".amr"],ev=[".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".odp",".odt",".ods",".txt"],W1=[{level:-4,label:"DEBUG",class:""},{level:0,label:"INFO",class:"label-success"},{level:4,label:"WARN",class:"label-warning"},{level:8,label:"ERROR",class:"label-danger"}];class H{static isObject(e){return e!==null&&typeof e=="object"&&e.constructor===Object}static clone(e){return typeof structuredClone<"u"?structuredClone(e):JSON.parse(JSON.stringify(e))}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||H.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==null?void 0:e.isContentEditable)}static isFocusable(e){let t=e&&e.tagName?e.tagName.toLowerCase():"";return H.isInput(e)||t==="button"||t==="a"||t==="details"||(e==null?void 0:e.tabIndex)>=0}static hasNonEmptyProps(e){for(let t in e)if(!H.isEmpty(e[t]))return!0;return!1}static toArray(e,t=!1){return Array.isArray(e)?e.slice():(t||!H.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){H.inArray(e,t)||e.push(t)}static findByKey(e,t,i){e=Array.isArray(e)?e:[];for(let l in e)if(e[l][t]==i)return e[l];return null}static groupByKey(e,t){e=Array.isArray(e)?e:[];const i={};for(let l in e)i[e[l][t]]=i[e[l][t]]||[],i[e[l][t]].push(e[l]);return i}static removeByKey(e,t,i){for(let l in e)if(e[l][t]==i){e.splice(l,1);break}}static pushOrReplaceByKey(e,t,i="id"){for(let l=e.length-1;l>=0;l--)if(e[l][i]==t[i]){e[l]=t;return}e.push(t)}static filterDuplicatesByKey(e,t="id"){e=Array.isArray(e)?e:[];const i={};for(const l of e)i[l[t]]=l;return Object.values(i)}static filterRedactedProps(e,t="******"){const i=JSON.parse(JSON.stringify(e||{}));for(let l in i)typeof i[l]=="object"&&i[l]!==null?i[l]=H.filterRedactedProps(i[l],t):i[l]===t&&delete i[l];return i}static getNestedVal(e,t,i=null,l="."){let s=e||{},o=(t||"").split(l);for(const r of o){if(!H.isObject(s)&&!Array.isArray(s)||typeof s[r]>"u")return i;s=s[r]}return s}static setByPath(e,t,i,l="."){if(e===null||typeof e!="object"){console.warn("setByPath: data not an object or array.");return}let s=e,o=t.split(l),r=o.pop();for(const a of o)(!H.isObject(s)&&!Array.isArray(s)||!H.isObject(s[a])&&!Array.isArray(s[a]))&&(s[a]={}),s=s[a];s[r]=i}static deleteByPath(e,t,i="."){let l=e||{},s=(t||"").split(i),o=s.pop();for(const r of s)(!H.isObject(l)&&!Array.isArray(l)||!H.isObject(l[r])&&!Array.isArray(l[r]))&&(l[r]={}),l=l[r];Array.isArray(l)?l.splice(o,1):H.isObject(l)&&delete l[o],s.length>0&&(Array.isArray(l)&&!l.length||H.isObject(l)&&!Object.keys(l).length)&&(Array.isArray(e)&&e.length>0||H.isObject(e)&&Object.keys(e).length>0)&&H.deleteByPath(e,s.join(i),i)}static randomString(e=10){let t="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let l=0;l"u")return H.randomString(e);const t=new Uint8Array(e);crypto.getRandomValues(t);const i="-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";let l="";for(let s=0;ss.replaceAll("{_PB_ESCAPED_}",t));for(let s of l)s=s.trim(),H.isEmpty(s)||i.push(s);return i}static joinNonEmpty(e,t=", "){e=e||[];const i=[],l=t.length>1?t.trim():t;for(let s of e)s=typeof s=="string"?s.trim():"",H.isEmpty(s)||i.push(s.replaceAll(l,"\\"+l));return i.join(t)}static getInitials(e){if(e=(e||"").split("@")[0].trim(),e.length<=2)return e.toUpperCase();const t=e.split(/[\.\_\-\ ]/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e[0].toUpperCase()}static formattedFileSize(e){const t=e?Math.floor(Math.log(e)/Math.log(1024)):0;return(e/Math.pow(1024,t)).toFixed(2)*1+" "+["B","KB","MB","GB","TB"][t]}static getDateTime(e){if(typeof e=="string"){const t={19:"yyyy-MM-dd HH:mm:ss",23:"yyyy-MM-dd HH:mm:ss.SSS",20:"yyyy-MM-dd HH:mm:ss'Z'",24:"yyyy-MM-dd HH:mm:ss.SSS'Z'"},i=t[e.length]||t[19];return je.fromFormat(e,i,{zone:"UTC"})}return je.fromJSDate(e)}static formatToUTCDate(e,t="yyyy-MM-dd HH:mm:ss"){return H.getDateTime(e).toUTC().toFormat(t)}static formatToLocalDate(e,t="yyyy-MM-dd HH:mm:ss"){return H.getDateTime(e).toLocal().toFormat(t)}static async copyToClipboard(e){var t;if(e=""+e,!(!e.length||!((t=window==null?void 0:window.navigator)!=null&&t.clipboard)))return window.navigator.clipboard.writeText(e).catch(i=>{console.warn("Failed to copy.",i)})}static download(e,t){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("download",t),i.setAttribute("target","_blank"),i.click(),i.remove()}static downloadJson(e,t){t=t.endsWith(".json")?t:t+".json";const i=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),l=window.URL.createObjectURL(i);H.download(l,t)}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 e=e||"",!!Xy.find(t=>e.toLowerCase().endsWith(t))}static hasVideoExtension(e){return e=e||"",!!Qy.find(t=>e.toLowerCase().endsWith(t))}static hasAudioExtension(e){return e=e||"",!!xy.find(t=>e.toLowerCase().endsWith(t))}static hasDocumentExtension(e){return e=e||"",!!ev.find(t=>e.toLowerCase().endsWith(t))}static getFileType(e){return H.hasImageExtension(e)?"image":H.hasDocumentExtension(e)?"document":H.hasVideoExtension(e)?"video":H.hasAudioExtension(e)?"audio":"file"}static generateThumb(e,t=100,i=100){return new Promise(l=>{let s=new FileReader;s.onload=function(o){let r=new Image;r.onload=function(){let a=document.createElement("canvas"),f=a.getContext("2d"),u=r.width,c=r.height;return a.width=t,a.height=i,f.drawImage(r,u>c?(u-c)/2:0,0,u>c?c:u,u>c?c:u,0,0,t,i),l(a.toDataURL(e.type))},r.src=o.target.result},s.readAsDataURL(e)})}static addValueToFormData(e,t,i){if(!(typeof i>"u"))if(H.isEmpty(i))e.append(t,"");else if(Array.isArray(i))for(const l of i)H.addValueToFormData(e,t,l);else i instanceof File?e.append(t,i):i instanceof Date?e.append(t,i.toISOString()):H.isObject(i)?e.append(t,JSON.stringify(i)):e.append(t,""+i)}static dummyCollectionRecord(e){var a,f,u,c,d,m,h;const t=(e==null?void 0:e.schema)||[],i=(e==null?void 0:e.type)==="auth",l=(e==null?void 0:e.type)==="view",s={id:"RECORD_ID",collectionId:e==null?void 0:e.id,collectionName:e==null?void 0:e.name};i&&(s.username="username123",s.verified=!1,s.emailVisibility=!0,s.email="test@example.com"),(!l||H.extractColumnsFromQuery((a=e==null?void 0:e.options)==null?void 0:a.query).includes("created"))&&(s.created="2022-01-01 01:00:00.123Z"),(!l||H.extractColumnsFromQuery((f=e==null?void 0:e.options)==null?void 0:f.query).includes("updated"))&&(s.updated="2022-01-01 23:59:59.456Z");for(const _ of t){let g=null;_.type==="number"?g=123:_.type==="date"?g="2022-01-01 10:00:00.123Z":_.type==="bool"?g=!0:_.type==="email"?g="test@example.com":_.type==="url"?g="https://example.com":_.type==="json"?g="JSON":_.type==="file"?(g="filename.jpg",((u=_.options)==null?void 0:u.maxSelect)!==1&&(g=[g])):_.type==="select"?(g=(d=(c=_.options)==null?void 0:c.values)==null?void 0:d[0],((m=_.options)==null?void 0:m.maxSelect)!==1&&(g=[g])):_.type==="relation"?(g="RELATION_RECORD_ID",((h=_.options)==null?void 0:h.maxSelect)!==1&&(g=[g])):g="test",s[_.name]=g}return s}static dummyCollectionSchemaData(e){var l,s,o,r;const t=(e==null?void 0:e.schema)||[],i={};for(const a of t){let f=null;if(a.type==="number")f=123;else if(a.type==="date")f="2022-01-01 10:00:00.123Z";else if(a.type==="bool")f=!0;else if(a.type==="email")f="test@example.com";else if(a.type==="url")f="https://example.com";else if(a.type==="json")f="JSON";else{if(a.type==="file")continue;a.type==="select"?(f=(s=(l=a.options)==null?void 0:l.values)==null?void 0:s[0],((o=a.options)==null?void 0:o.maxSelect)!==1&&(f=[f])):a.type==="relation"?(f="RELATION_RECORD_ID",((r=a.options)==null?void 0:r.maxSelect)!==1&&(f=[f])):f="test"}i[a.name]=f}return i}static getCollectionTypeIcon(e){switch(e==null?void 0:e.toLowerCase()){case"auth":return"ri-group-line";case"view":return"ri-table-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"editor":return"ri-edit-2-line";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":(e==null?void 0:e.type)==="bool"?"false":(e==null?void 0:e.type)==="json"?'null, "", [], {}':["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 f in e)if(f!=="schema"&&JSON.stringify(e[f])!==JSON.stringify(t[f]))return!0;const l=Array.isArray(e.schema)?e.schema:[],s=Array.isArray(t.schema)?t.schema:[],o=l.filter(f=>(f==null?void 0:f.id)&&!H.findByKey(s,"id",f.id)),r=s.filter(f=>(f==null?void 0:f.id)&&!H.findByKey(l,"id",f.id)),a=s.filter(f=>{const u=H.isObject(f)&&H.findByKey(l,"id",f.id);if(!u)return!1;for(let c in u)if(JSON.stringify(f[c])!=JSON.stringify(u[c]))return!0;return!1});return!!(r.length||a.length||i&&o.length)}static sortCollections(e=[]){const t=[],i=[],l=[];for(const o of e)o.type==="auth"?t.push(o):o.type==="base"?i.push(o):l.push(o);function s(o,r){return o.name>r.name?1:o.name{setTimeout(e,0)})}static defaultFlatpickrOptions(){return{dateFormat:"Y-m-d H:i:S",disableMobile:!0,allowInput:!0,enableTime:!0,time_24hr:!0,locale:{firstDayOfWeek:1}}}static defaultEditorOptions(){const e=["DIV","P","A","EM","B","STRONG","H1","H2","H3","H4","H5","H6","TABLE","TR","TD","TH","TBODY","THEAD","TFOOT","BR","HR","Q","SUP","SUB","DEL","IMG","OL","UL","LI","CODE"];function t(l){let s=l.parentNode;for(;l.firstChild;)s.insertBefore(l.firstChild,l);s.removeChild(l)}function i(l){if(l){for(const s of l.children)i(s);e.includes(l.tagName)?(l.removeAttribute("style"),l.removeAttribute("class")):t(l)}}return{branding:!1,promotion:!1,menubar:!1,min_height:270,height:270,max_height:700,autoresize_bottom_margin:30,skin:"pocketbase",content_style:"body { font-size: 14px }",plugins:["autoresize","autolink","lists","link","image","searchreplace","fullscreen","media","table","code","codesample","directionality"],codesample_global_prismjs:!0,codesample_languages:[{text:"HTML/XML",value:"markup"},{text:"CSS",value:"css"},{text:"SQL",value:"sql"},{text:"JavaScript",value:"javascript"},{text:"Go",value:"go"},{text:"Dart",value:"dart"},{text:"Zig",value:"zig"},{text:"Rust",value:"rust"},{text:"Lua",value:"lua"},{text:"PHP",value:"php"},{text:"Ruby",value:"ruby"},{text:"Python",value:"python"},{text:"Java",value:"java"},{text:"C",value:"c"},{text:"C#",value:"csharp"},{text:"C++",value:"cpp"},{text:"Markdown",value:"markdown"},{text:"Swift",value:"swift"},{text:"Kotlin",value:"kotlin"},{text:"Elixir",value:"elixir"},{text:"Scala",value:"scala"},{text:"Julia",value:"julia"},{text:"Haskell",value:"haskell"}],toolbar:"styles | alignleft aligncenter alignright | bold italic forecolor backcolor | bullist numlist | link image_picker table codesample direction | code fullscreen",paste_postprocess:(l,s)=>{i(s.node)},file_picker_types:"image",file_picker_callback:(l,s,o)=>{const r=document.createElement("input");r.setAttribute("type","file"),r.setAttribute("accept","image/*"),r.addEventListener("change",a=>{const f=a.target.files[0],u=new FileReader;u.addEventListener("load",()=>{if(!tinymce)return;const c="blobid"+new Date().getTime(),d=tinymce.activeEditor.editorUpload.blobCache,m=u.result.split(",")[1],h=d.create(c,f,m);d.add(h),l(h.blobUri(),{title:f.name})}),u.readAsDataURL(f)}),r.click()},setup:l=>{l.on("keydown",o=>{(o.ctrlKey||o.metaKey)&&o.code=="KeyS"&&l.formElement&&(o.preventDefault(),o.stopPropagation(),l.formElement.dispatchEvent(new KeyboardEvent("keydown",o)))});const s="tinymce_last_direction";l.on("init",()=>{var r;const o=(r=window==null?void 0:window.localStorage)==null?void 0:r.getItem(s);!l.isDirty()&&l.getContent()==""&&o=="rtl"&&l.execCommand("mceDirectionRTL")}),l.ui.registry.addMenuButton("direction",{icon:"visualchars",fetch:o=>{o([{type:"menuitem",text:"LTR content",icon:"ltr",onAction:()=>{var a;(a=window==null?void 0:window.localStorage)==null||a.setItem(s,"ltr"),l.execCommand("mceDirectionLTR")}},{type:"menuitem",text:"RTL content",icon:"rtl",onAction:()=>{var a;(a=window==null?void 0:window.localStorage)==null||a.setItem(s,"rtl"),l.execCommand("mceDirectionRTL")}}])}}),l.ui.registry.addMenuButton("image_picker",{icon:"image",fetch:o=>{o([{type:"menuitem",text:"From collection",icon:"gallery",onAction:()=>{l.dispatch("collections_file_picker",{})}},{type:"menuitem",text:"Inline",icon:"browse",onAction:()=>{l.execCommand("mceImage")}}])}})}}}static displayValue(e,t,i="N/A"){e=e||{},t=t||[];let l=[];for(const o of t){let r=e[o];typeof r>"u"||(r=H.stringifyValue(r,i),l.push(r))}if(l.length>0)return l.join(", ");const s=["title","name","slug","email","username","nickname","label","heading","message","key","identifier","id"];for(const o of s){let r=H.stringifyValue(e[o],"");if(r)return r}return i}static stringifyValue(e,t="N/A",i=150){if(H.isEmpty(e))return t;if(typeof e=="number")return""+e;if(typeof e=="boolean")return e?"True":"False";if(typeof e=="string")return e=e.indexOf("<")>=0?H.plainText(e):e,H.truncate(e,i)||t;if(Array.isArray(e)&&typeof e[0]!="object")return H.truncate(e.join(","),i);if(typeof e=="object")try{return H.truncate(JSON.stringify(e),i)||t}catch{return t}return e}static extractColumnsFromQuery(e){var o;const t="__GROUP__";e=(e||"").replace(/\([\s\S]+?\)/gm,t).replace(/[\t\r\n]|(?:\s\s)+/g," ");const i=e.match(/select\s+([\s\S]+)\s+from/),l=((o=i==null?void 0:i[1])==null?void 0:o.split(","))||[],s=[];for(let r of l){const a=r.trim().split(" ").pop();a!=""&&a!=t&&s.push(a.replace(/[\'\"\`\[\]\s]/g,""))}return s}static getAllCollectionIdentifiers(e,t=""){if(!e)return[];let i=[t+"id"];if(e.type==="view")for(let s of H.extractColumnsFromQuery(e.options.query))H.pushUnique(i,t+s);else e.type==="auth"?(i.push(t+"username"),i.push(t+"email"),i.push(t+"emailVisibility"),i.push(t+"verified"),i.push(t+"created"),i.push(t+"updated")):(i.push(t+"created"),i.push(t+"updated"));const l=e.schema||[];for(const s of l)H.pushUnique(i,t+s.name);return i}static getCollectionAutocompleteKeys(e,t,i="",l=0){var r,a,f,u;let s=e.find(c=>c.name==t||c.id==t);if(!s||l>=4)return[];s.schema=s.schema||[];let o=H.getAllCollectionIdentifiers(s,i);for(const c of s.schema){const d=i+c.name;if(c.type=="relation"&&((r=c.options)!=null&&r.collectionId)){const m=H.getCollectionAutocompleteKeys(e,c.options.collectionId,d+".",l+1);m.length&&(o=o.concat(m))}c.type=="select"&&((a=c.options)==null?void 0:a.maxSelect)!=1&&o.push(d+":each"),((f=c.options)==null?void 0:f.maxSelect)!=1&&["select","file","relation"].includes(c.type)&&o.push(d+":length")}for(const c of e){c.schema=c.schema||[];for(const d of c.schema)if(d.type=="relation"&&((u=d.options)==null?void 0:u.collectionId)==s.id){const m=i+c.name+"_via_"+d.name,h=H.getCollectionAutocompleteKeys(e,c.id,m+".",l+2);h.length&&(o=o.concat(h))}}return o}static getCollectionJoinAutocompleteKeys(e){const t=[];for(const i of e){const l="@collection."+i.name+".",s=H.getCollectionAutocompleteKeys(e,i.name,l);for(const o of s)t.push(o)}return t}static getRequestAutocompleteKeys(e,t){const i=[];i.push("@request.context"),i.push("@request.method"),i.push("@request.query."),i.push("@request.data."),i.push("@request.headers."),i.push("@request.auth.id"),i.push("@request.auth.collectionId"),i.push("@request.auth.collectionName"),i.push("@request.auth.verified"),i.push("@request.auth.username"),i.push("@request.auth.email"),i.push("@request.auth.emailVisibility"),i.push("@request.auth.created"),i.push("@request.auth.updated");const l=e.filter(s=>s.type==="auth");for(const s of l){const o=H.getCollectionAutocompleteKeys(e,s.id,"@request.auth.");for(const r of o)H.pushUnique(i,r)}if(t){const s=["created","updated"],o=H.getCollectionAutocompleteKeys(e,t,"@request.data.");for(const r of o){i.push(r);const a=r.split(".");a.length===3&&a[2].indexOf(":")===-1&&!s.includes(a[2])&&i.push(r+":isset")}}return i}static parseIndex(e){var a,f,u,c,d;const t={unique:!1,optional:!1,schemaName:"",indexName:"",tableName:"",columns:[],where:""},l=/create\s+(unique\s+)?\s*index\s*(if\s+not\s+exists\s+)?(\S*)\s+on\s+(\S*)\s*\(([\s\S]*)\)(?:\s*where\s+([\s\S]*))?/gmi.exec((e||"").trim());if((l==null?void 0:l.length)!=7)return t;const s=/^[\"\'\`\[\{}]|[\"\'\`\]\}]$/gm;t.unique=((a=l[1])==null?void 0:a.trim().toLowerCase())==="unique",t.optional=!H.isEmpty((f=l[2])==null?void 0:f.trim());const o=(l[3]||"").split(".");o.length==2?(t.schemaName=o[0].replace(s,""),t.indexName=o[1].replace(s,"")):(t.schemaName="",t.indexName=o[0].replace(s,"")),t.tableName=(l[4]||"").replace(s,"");const r=(l[5]||"").replace(/,(?=[^\(]*\))/gmi,"{PB_TEMP}").split(",");for(let m of r){m=m.trim().replaceAll("{PB_TEMP}",",");const _=/^([\s\S]+?)(?:\s+collate\s+([\w]+))?(?:\s+(asc|desc))?$/gmi.exec(m);if((_==null?void 0:_.length)!=4)continue;const g=(c=(u=_[1])==null?void 0:u.trim())==null?void 0:c.replace(s,"");g&&t.columns.push({name:g,collate:_[2]||"",sort:((d=_[3])==null?void 0:d.toUpperCase())||""})}return t.where=l[6]||"",t}static buildIndex(e){let t="CREATE ";e.unique&&(t+="UNIQUE "),t+="INDEX ",e.optional&&(t+="IF NOT EXISTS "),e.schemaName&&(t+=`\`${e.schemaName}\`.`),t+=`\`${e.indexName||"idx_"+H.randomString(7)}\` `,t+=`ON \`${e.tableName}\` (`;const i=e.columns.filter(l=>!!(l!=null&&l.name));return i.length>1&&(t+=` `),t+=i.map(l=>{let s="";return l.name.includes("(")||l.name.includes(" ")?s+=l.name:s+="`"+l.name+"`",l.collate&&(s+=" COLLATE "+l.collate),l.sort&&(s+=" "+l.sort.toUpperCase()),s}).join(`, `),i.length>1&&(t+=` `),t+=")",e.where&&(t+=` WHERE ${e.where}`),t}static replaceIndexTableName(e,t){const i=H.parseIndex(e);return i.tableName=t,H.buildIndex(i)}static replaceIndexColumn(e,t,i){if(t===i)return e;const l=H.parseIndex(e);let s=!1;for(let o of l.columns)o.name===t&&(o.name=i,s=!0);return s?H.buildIndex(l):e}static normalizeSearchFilter(e,t){if(e=(e||"").trim(),!e||!t.length)return e;const i=["=","!=","~","!~",">",">=","<","<="];for(const l of i)if(e.includes(l))return e;return e=isNaN(e)&&e!="true"&&e!="false"?`"${e.replace(/^[\"\'\`]|[\"\'\`]$/gm,"")}"`:e,t.map(l=>`${l}~${e}`).join("||")}static normalizeLogsFilter(e,t=[]){return H.normalizeSearchFilter(e,["level","message","data"].concat(t))}static initCollection(e){return Object.assign({id:"",created:"",updated:"",name:"",type:"base",system:!1,listRule:null,viewRule:null,createRule:null,updateRule:null,deleteRule:null,schema:[],indexes:[],options:{}},e)}static initSchemaField(e){return Object.assign({id:"",name:"",type:"text",system:!1,required:!1,options:{}},e)}static triggerResize(){window.dispatchEvent(new Event("resize"))}static getHashQueryParams(){let e="";const t=window.location.hash.indexOf("?");return t>-1&&(e=window.location.hash.substring(t+1)),Object.fromEntries(new URLSearchParams(e))}static replaceHashQueryParams(e){e=e||{};let t="",i=window.location.hash;const l=i.indexOf("?");l>-1&&(t=i.substring(l+1),i=i.substring(0,l));const s=new URLSearchParams(t);for(let a in e){const f=e[a];f===null?s.delete(a):s.set(a,f)}t=s.toString(),t!=""&&(i+="?"+t);let o=window.location.href;const r=o.indexOf("#");r>-1&&(o=o.substring(0,r)),window.location.replace(o+i)}}const Yo=Cn([]);function $o(n,e=4e3){return Ko(n,"info",e)}function At(n,e=3e3){return Ko(n,"success",e)}function ii(n,e=4500){return Ko(n,"error",e)}function tv(n,e=4500){return Ko(n,"warning",e)}function Ko(n,e,t){t=t||4e3;const i={message:n,type:e,duration:t,timeout:setTimeout(()=>{Y1(i)},t)};Yo.update(l=>(Sa(l,i.message),H.pushOrReplaceByKey(l,i,"message"),l))}function Y1(n){Yo.update(e=>(Sa(e,n),e))}function wa(){Yo.update(n=>{for(let e of n)Sa(n,e);return[]})}function Sa(n,e){let t;typeof e=="string"?t=H.findByKey(n,"message",e):t=e,t&&(clearTimeout(t.timeout),H.removeByKey(n,"message",t.message))}const mi=Cn({});function Jt(n){mi.set(n||{})}function li(n){mi.update(e=>(H.deleteByPath(e,n),e))}const $a=Cn({});function Ur(n){$a.set(n||{})}const Fn=Cn([]),Kn=Cn({}),To=Cn(!1),K1=Cn({});let Gl;typeof BroadcastChannel<"u"&&(Gl=new BroadcastChannel("collections"),Gl.onmessage=()=>{var n;Z1((n=Og(Kn))==null?void 0:n.id)});function J1(){Gl==null||Gl.postMessage("reload")}function nv(n){Fn.update(e=>{const t=H.findByKey(e,"id",n);return t?Kn.set(t):e.length&&Kn.set(e[0]),e})}function iv(n){Kn.update(e=>H.isEmpty(e==null?void 0:e.id)||e.id===n.id?n:e),Fn.update(e=>(H.pushOrReplaceByKey(e,n,"id"),Ta(),J1(),H.sortCollections(e)))}function lv(n){Fn.update(e=>(H.removeByKey(e,"id",n.id),Kn.update(t=>t.id===n.id?e[0]:t),Ta(),J1(),e))}async function Z1(n=null){To.set(!0);try{let e=await fe.collections.getFullList(200,{sort:"+name"});e=H.sortCollections(e),Fn.set(e);const t=n&&H.findByKey(e,"id",n);t?Kn.set(t):e.length&&Kn.set(e[0]),Ta()}catch(e){fe.error(e)}To.set(!1)}function Ta(){K1.update(n=>(Fn.update(e=>{var t;for(let i of e)n[i.id]=!!((t=i.schema)!=null&&t.find(l=>{var s;return l.type=="file"&&((s=l.options)==null?void 0:s.protected)}));return e}),n))}const cr="pb_admin_file_token";Ho.prototype.logout=function(n=!0){this.authStore.clear(),n&&tl("/login")};Ho.prototype.error=function(n,e=!0,t=""){if(!n||!(n instanceof Error)||n.isAbort)return;const i=(n==null?void 0:n.status)<<0||400,l=(n==null?void 0:n.data)||{},s=l.message||n.message||t;if(e&&s&&ii(s),H.isEmpty(l.data)||Jt(l.data),i===401)return this.cancelAllRequests(),this.logout();if(i===403)return this.cancelAllRequests(),tl("/")};Ho.prototype.getAdminFileToken=async function(n=""){let e=!0;if(n){const i=Og(K1);e=typeof i[n]<"u"?i[n]:!0}if(!e)return"";let t=localStorage.getItem(cr)||"";return(!t||da(t,10))&&(t&&localStorage.removeItem(cr),this._adminFileTokenRequest||(this._adminFileTokenRequest=this.files.getToken()),t=await this._adminFileTokenRequest,localStorage.setItem(cr,t),this._adminFileTokenRequest=null),t};class sv extends Bg{save(e,t){super.save(e,t),t&&!t.collectionId&&Ur(t)}clear(){super.clear(),Ur(null)}}const ao=new Ho("../",new sv("pb_admin_auth"));ao.authStore.model&&!ao.authStore.model.collectionId&&Ur(ao.authStore.model);const fe=ao,ov=n=>({}),jf=n=>({});function rv(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;const h=n[3].default,_=vt(h,n,n[2],null),g=n[3].footer,y=vt(g,n,n[2],jf);return{c(){e=b("div"),t=b("main"),_&&_.c(),i=O(),l=b("footer"),y&&y.c(),s=O(),o=b("a"),o.innerHTML=' Docs',r=O(),a=b("span"),a.textContent="|",f=O(),u=b("a"),c=b("span"),c.textContent="PocketBase v0.21.3",p(t,"class","page-content"),p(o,"href","https://pocketbase.io/docs/"),p(o,"target","_blank"),p(o,"rel","noopener noreferrer"),p(a,"class","delimiter"),p(c,"class","txt"),p(u,"href","https://github.com/pocketbase/pocketbase/releases"),p(u,"target","_blank"),p(u,"rel","noopener noreferrer"),p(u,"title","Releases"),p(l,"class","page-footer"),p(e,"class",d="page-wrapper "+n[1]),x(e,"center-content",n[0])},m(S,T){w(S,e,T),k(e,t),_&&_.m(t,null),k(e,i),k(e,l),y&&y.m(l,null),k(l,s),k(l,o),k(l,r),k(l,a),k(l,f),k(l,u),k(u,c),m=!0},p(S,[T]){_&&_.p&&(!m||T&4)&&St(_,h,S,S[2],m?wt(h,S[2],T,null):$t(S[2]),null),y&&y.p&&(!m||T&4)&&St(y,g,S,S[2],m?wt(g,S[2],T,ov):$t(S[2]),jf),(!m||T&2&&d!==(d="page-wrapper "+S[1]))&&p(e,"class",d),(!m||T&3)&&x(e,"center-content",S[0])},i(S){m||(E(_,S),E(y,S),m=!0)},o(S){A(_,S),A(y,S),m=!1},d(S){S&&v(e),_&&_.d(S),y&&y.d(S)}}}function av(n,e,t){let{$$slots:i={},$$scope:l}=e,{center:s=!1}=e,{class:o=""}=e;return n.$$set=r=>{"center"in r&&t(0,s=r.center),"class"in r&&t(1,o=r.class),"$$scope"in r&&t(2,l=r.$$scope)},[s,o,l,i]}class kn extends ge{constructor(e){super(),_e(this,e,av,rv,me,{center:0,class:1})}}function Hf(n){let e,t,i;return{c(){e=b("div"),e.innerHTML='',t=O(),i=b("div"),p(e,"class","block txt-center m-b-lg"),p(i,"class","clearfix")},m(l,s){w(l,e,s),w(l,t,s),w(l,i,s)},d(l){l&&(v(e),v(t),v(i))}}}function fv(n){let e,t,i,l=!n[0]&&Hf();const s=n[1].default,o=vt(s,n,n[2],null);return{c(){e=b("div"),l&&l.c(),t=O(),o&&o.c(),p(e,"class","wrapper wrapper-sm m-b-xl panel-wrapper svelte-lxxzfu")},m(r,a){w(r,e,a),l&&l.m(e,null),k(e,t),o&&o.m(e,null),i=!0},p(r,a){r[0]?l&&(l.d(1),l=null):l||(l=Hf(),l.c(),l.m(e,t)),o&&o.p&&(!i||a&4)&&St(o,s,r,r[2],i?wt(s,r[2],a,null):$t(r[2]),null)},i(r){i||(E(o,r),i=!0)},o(r){A(o,r),i=!1},d(r){r&&v(e),l&&l.d(),o&&o.d(r)}}}function uv(n){let e,t;return e=new kn({props:{class:"full-page",center:!0,$$slots:{default:[fv]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&5&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function cv(n,e,t){let{$$slots:i={},$$scope:l}=e,{nobranding:s=!1}=e;return n.$$set=o=>{"nobranding"in o&&t(0,s=o.nobranding),"$$scope"in o&&t(2,l=o.$$scope)},[s,i,l]}class G1 extends ge{constructor(e){super(),_e(this,e,cv,uv,me,{nobranding:0})}}function Jo(n){const e=n-1;return e*e*e+1}function rs(n,{delay:e=0,duration:t=400,easing:i=gs}={}){const l=+getComputedStyle(n).opacity;return{delay:e,duration:t,easing:i,css:s=>`opacity: ${s*l}`}}function Pn(n,{delay:e=0,duration:t=400,easing:i=Jo,x:l=0,y:s=0,opacity:o=0}={}){const r=getComputedStyle(n),a=+r.opacity,f=r.transform==="none"?"":r.transform,u=a*(1-o),[c,d]=Xa(l),[m,h]=Xa(s);return{delay:e,duration:t,easing:i,css:(_,g)=>` @@ -11,7 +11,7 @@ var a0=Object.defineProperty;var f0=(n,e,t)=>e in n?a0(n,e,{enumerable:!0,config opacity: ${r-u*d} `}}let Wr,Fi;const Yr="app-tooltip";function zf(n){return typeof n=="string"?{text:n,position:"bottom",hideOnClick:null}:n||{}}function Oi(){return Fi=Fi||document.querySelector("."+Yr),Fi||(Fi=document.createElement("div"),Fi.classList.add(Yr),document.body.appendChild(Fi)),Fi}function X1(n,e){let t=Oi();if(!t.classList.contains("active")||!(e!=null&&e.text)){Kr();return}t.textContent=e.text,t.className=Yr+" 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,l=t.offsetWidth,s=n.getBoundingClientRect(),o=0,r=0,a=5;e.position=="left"?(o=s.top+s.height/2-i/2,r=s.left-l-a):e.position=="right"?(o=s.top+s.height/2-i/2,r=s.right+a):e.position=="top"?(o=s.top-i-a,r=s.left+s.width/2-l/2):e.position=="top-left"?(o=s.top-i-a,r=s.left):e.position=="top-right"?(o=s.top-i-a,r=s.right-l):e.position=="bottom-left"?(o=s.top+s.height+a,r=s.left):e.position=="bottom-right"?(o=s.top+s.height+a,r=s.right-l):(o=s.top+s.height+a,r=s.left+s.width/2-l/2),r+l>document.documentElement.clientWidth&&(r=document.documentElement.clientWidth-l),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 Kr(){clearTimeout(Wr),Oi().classList.remove("active"),Oi().activeNode=void 0}function dv(n,e){Oi().activeNode=n,clearTimeout(Wr),Wr=setTimeout(()=>{Oi().classList.add("active"),X1(n,e)},isNaN(e.delay)?0:e.delay)}function Le(n,e){let t=zf(e);function i(){dv(n,t)}function l(){Kr()}return n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",l),n.addEventListener("blur",l),(t.hideOnClick===!0||t.hideOnClick===null&&H.isFocusable(n))&&n.addEventListener("click",l),Oi(),{update(s){var o,r;t=zf(s),(r=(o=Oi())==null?void 0:o.activeNode)!=null&&r.contains(n)&&X1(n,t)},destroy(){var s,o;(o=(s=Oi())==null?void 0:s.activeNode)!=null&&o.contains(n)&&Kr(),n.removeEventListener("mouseenter",i),n.removeEventListener("mouseleave",l),n.removeEventListener("blur",l),n.removeEventListener("click",l)}}}function Vf(n,e,t){const i=n.slice();return i[12]=e[t],i}const pv=n=>({}),Bf=n=>({uniqueId:n[4]});function mv(n){let e,t,i=de(n[3]),l=[];for(let o=0;oA(l[o],1,1,()=>{l[o]=null});return{c(){for(let o=0;o{s&&(l||(l=Ne(t,Ut,{duration:150,start:.7},!0)),l.run(1))}),s=!0)},o(a){a&&(l||(l=Ne(t,Ut,{duration:150,start:.7},!1)),l.run(0)),s=!1},d(a){a&&v(e),a&&l&&l.end(),o=!1,r()}}}function Uf(n){let e,t,i=Co(n[12])+"",l,s,o,r;return{c(){e=b("div"),t=b("pre"),l=Y(i),s=O(),p(e,"class","help-block help-block-error")},m(a,f){w(a,e,f),k(e,t),k(t,l),k(e,s),r=!0},p(a,f){(!r||f&8)&&i!==(i=Co(a[12])+"")&&re(l,i)},i(a){r||(a&&Ye(()=>{r&&(o||(o=Ne(e,et,{duration:150},!0)),o.run(1))}),r=!0)},o(a){a&&(o||(o=Ne(e,et,{duration:150},!1)),o.run(0)),r=!1},d(a){a&&v(e),a&&o&&o.end()}}}function _v(n){let e,t,i,l,s,o,r;const a=n[9].default,f=vt(a,n,n[8],Bf),u=[hv,mv],c=[];function d(m,h){return m[0]&&m[3].length?0:1}return i=d(n),l=c[i]=u[i](n),{c(){e=b("div"),f&&f.c(),t=O(),l.c(),p(e,"class",n[1]),x(e,"error",n[3].length)},m(m,h){w(m,e,h),f&&f.m(e,null),k(e,t),c[i].m(e,null),n[11](e),s=!0,o||(r=K(e,"click",n[10]),o=!0)},p(m,[h]){f&&f.p&&(!s||h&256)&&St(f,a,m,m[8],s?wt(a,m[8],h,pv):$t(m[8]),Bf);let _=i;i=d(m),i===_?c[i].p(m,h):(se(),A(c[_],1,1,()=>{c[_]=null}),oe(),l=c[i],l?l.p(m,h):(l=c[i]=u[i](m),l.c()),E(l,1),l.m(e,null)),(!s||h&2)&&p(e,"class",m[1]),(!s||h&10)&&x(e,"error",m[3].length)},i(m){s||(E(f,m),E(l),s=!0)},o(m){A(f,m),A(l),s=!1},d(m){m&&v(e),f&&f.d(m),c[i].d(),n[11](null),o=!1,r()}}}const Wf="Invalid value";function Co(n){return typeof n=="object"?(n==null?void 0:n.message)||(n==null?void 0:n.code)||Wf:n||Wf}function gv(n,e,t){let i;Ue(n,mi,_=>t(7,i=_));let{$$slots:l={},$$scope:s}=e;const o="field_"+H.randomString(7);let{name:r=""}=e,{inlineError:a=!1}=e,{class:f=void 0}=e,u,c=[];function d(){li(r)}jt(()=>(u.addEventListener("input",d),u.addEventListener("change",d),()=>{u.removeEventListener("input",d),u.removeEventListener("change",d)}));function m(_){Te.call(this,n,_)}function h(_){ee[_?"unshift":"push"](()=>{u=_,t(2,u)})}return n.$$set=_=>{"name"in _&&t(5,r=_.name),"inlineError"in _&&t(0,a=_.inlineError),"class"in _&&t(1,f=_.class),"$$scope"in _&&t(8,s=_.$$scope)},n.$$.update=()=>{n.$$.dirty&160&&t(3,c=H.toArray(H.getNestedVal(i,r)))},[a,f,u,c,o,r,d,i,s,l,m,h]}class pe extends ge{constructor(e){super(),_e(this,e,gv,_v,me,{name:5,inlineError:0,class:1,changed:6})}get changed(){return this.$$.ctx[6]}}function bv(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Email"),l=O(),s=b("input"),p(e,"for",i=n[9]),p(s,"type","email"),p(s,"autocomplete","off"),p(s,"id",o=n[9]),s.required=!0,s.autofocus=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0]),s.focus(),r||(a=K(s,"input",n[5]),r=!0)},p(f,u){u&512&&i!==(i=f[9])&&p(e,"for",i),u&512&&o!==(o=f[9])&&p(s,"id",o),u&1&&s.value!==f[0]&&ae(s,f[0])},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function kv(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=Y("Password"),l=O(),s=b("input"),r=O(),a=b("div"),a.textContent="Minimum 10 characters.",p(e,"for",i=n[9]),p(s,"type","password"),p(s,"autocomplete","new-password"),p(s,"minlength","10"),p(s,"id",o=n[9]),s.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),k(e,t),w(c,l,d),w(c,s,d),ae(s,n[1]),w(c,r,d),w(c,a,d),f||(u=K(s,"input",n[6]),f=!0)},p(c,d){d&512&&i!==(i=c[9])&&p(e,"for",i),d&512&&o!==(o=c[9])&&p(s,"id",o),d&2&&s.value!==c[1]&&ae(s,c[1])},d(c){c&&(v(e),v(l),v(s),v(r),v(a)),f=!1,u()}}}function yv(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Password confirm"),l=O(),s=b("input"),p(e,"for",i=n[9]),p(s,"type","password"),p(s,"minlength","10"),p(s,"id",o=n[9]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[2]),r||(a=K(s,"input",n[7]),r=!0)},p(f,u){u&512&&i!==(i=f[9])&&p(e,"for",i),u&512&&o!==(o=f[9])&&p(s,"id",o),u&4&&s.value!==f[2]&&ae(s,f[2])},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function vv(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;return l=new pe({props:{class:"form-field required",name:"email",$$slots:{default:[bv,({uniqueId:h})=>({9:h}),({uniqueId:h})=>h?512:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field required",name:"password",$$slots:{default:[kv,({uniqueId:h})=>({9:h}),({uniqueId:h})=>h?512:0]},$$scope:{ctx:n}}}),a=new pe({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[yv,({uniqueId:h})=>({9:h}),({uniqueId:h})=>h?512:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),t=b("div"),t.innerHTML="

Create your first admin account in order to continue

",i=O(),B(l.$$.fragment),s=O(),B(o.$$.fragment),r=O(),B(a.$$.fragment),f=O(),u=b("button"),u.innerHTML='Create and login ',p(t,"class","content txt-center m-b-base"),p(u,"type","submit"),p(u,"class","btn btn-lg btn-block btn-next"),x(u,"btn-disabled",n[3]),x(u,"btn-loading",n[3]),p(e,"class","block"),p(e,"autocomplete","off")},m(h,_){w(h,e,_),k(e,t),k(e,i),z(l,e,null),k(e,s),z(o,e,null),k(e,r),z(a,e,null),k(e,f),k(e,u),c=!0,d||(m=K(e,"submit",Be(n[4])),d=!0)},p(h,[_]){const g={};_&1537&&(g.$$scope={dirty:_,ctx:h}),l.$set(g);const y={};_&1538&&(y.$$scope={dirty:_,ctx:h}),o.$set(y);const S={};_&1540&&(S.$$scope={dirty:_,ctx:h}),a.$set(S),(!c||_&8)&&x(u,"btn-disabled",h[3]),(!c||_&8)&&x(u,"btn-loading",h[3])},i(h){c||(E(l.$$.fragment,h),E(o.$$.fragment,h),E(a.$$.fragment,h),c=!0)},o(h){A(l.$$.fragment,h),A(o.$$.fragment,h),A(a.$$.fragment,h),c=!1},d(h){h&&v(e),V(l),V(o),V(a),d=!1,m()}}}function wv(n,e,t){const i=st();let l="",s="",o="",r=!1;async function a(){if(!r){t(3,r=!0);try{await fe.admins.create({email:l,password:s,passwordConfirm:o}),await fe.admins.authWithPassword(l,s),i("submit")}catch(d){fe.error(d)}t(3,r=!1)}}function f(){l=this.value,t(0,l)}function u(){s=this.value,t(1,s)}function c(){o=this.value,t(2,o)}return[l,s,o,r,a,f,u,c]}class Sv extends ge{constructor(e){super(),_e(this,e,wv,vv,me,{})}}function Yf(n){let e,t;return e=new G1({props:{$$slots:{default:[$v]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&9&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function $v(n){let e,t;return e=new Sv({}),e.$on("submit",n[1]),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p:Q,i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Tv(n){let e,t,i=n[0]&&Yf(n);return{c(){i&&i.c(),e=ye()},m(l,s){i&&i.m(l,s),w(l,e,s),t=!0},p(l,[s]){l[0]?i?(i.p(l,s),s&1&&E(i,1)):(i=Yf(l),i.c(),E(i,1),i.m(e.parentNode,e)):i&&(se(),A(i,1,1,()=>{i=null}),oe())},i(l){t||(E(i),t=!0)},o(l){A(i),t=!1},d(l){l&&v(e),i&&i.d(l)}}}function Cv(n,e,t){let i=!1;l();function l(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("installer")){fe.logout(!1),t(0,i=!0);return}fe.authStore.isValid?tl("/collections"):fe.logout()}return[i,async()=>{t(0,i=!1),await Xt(),window.location.search=""}]}class Ov extends ge{constructor(e){super(),_e(this,e,Cv,Tv,me,{})}}const Dt=Cn(""),Oo=Cn(""),Xi=Cn(!1);function Mv(n){let e,t,i,l;return{c(){e=b("input"),p(e,"type","text"),p(e,"id",n[8]),p(e,"placeholder",t=n[0]||n[1])},m(s,o){w(s,e,o),n[13](e),ae(e,n[7]),i||(l=K(e,"input",n[14]),i=!0)},p(s,o){o&3&&t!==(t=s[0]||s[1])&&p(e,"placeholder",t),o&128&&e.value!==s[7]&&ae(e,s[7])},i:Q,o:Q,d(s){s&&v(e),n[13](null),i=!1,l()}}}function Dv(n){let e,t,i,l;function s(a){n[12](a)}var o=n[4];function r(a,f){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=Ot(o,r(n)),ee.push(()=>be(e,"value",s)),e.$on("submit",n[10])),{c(){e&&B(e.$$.fragment),i=ye()},m(a,f){e&&z(e,a,f),w(a,i,f),l=!0},p(a,f){if(f&16&&o!==(o=a[4])){if(e){se();const u=e;A(u.$$.fragment,1,0,()=>{V(u,1)}),oe()}o?(e=Ot(o,r(a)),ee.push(()=>be(e,"value",s)),e.$on("submit",a[10]),B(e.$$.fragment),E(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else if(o){const u={};f&8&&(u.extraAutocompleteKeys=a[3]),f&4&&(u.baseCollection=a[2]),f&3&&(u.placeholder=a[0]||a[1]),!t&&f&128&&(t=!0,u.value=a[7],ke(()=>t=!1)),e.$set(u)}},i(a){l||(e&&E(e.$$.fragment,a),l=!0)},o(a){e&&A(e.$$.fragment,a),l=!1},d(a){a&&v(i),e&&V(e,a)}}}function Kf(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='Search',p(e,"type","submit"),p(e,"class","btn btn-expanded-sm btn-sm btn-warning")},m(l,s){w(l,e,s),i=!0},i(l){i||(l&&Ye(()=>{i&&(t||(t=Ne(e,Pn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(l){l&&(t||(t=Ne(e,Pn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(l){l&&v(e),l&&t&&t.end()}}}function Jf(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='Clear',p(e,"type","button"),p(e,"class","btn btn-transparent btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(o,r){w(o,e,r),i=!0,l||(s=K(e,"click",n[15]),l=!0)},p:Q,i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Pn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Pn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function Ev(n){let e,t,i,l,s,o,r,a,f,u,c;const d=[Dv,Mv],m=[];function h(y,S){return y[4]&&!y[5]?0:1}s=h(n),o=m[s]=d[s](n);let _=(n[0].length||n[7].length)&&n[7]!=n[0]&&Kf(),g=(n[0].length||n[7].length)&&Jf(n);return{c(){e=b("form"),t=b("label"),i=b("i"),l=O(),o.c(),r=O(),_&&_.c(),a=O(),g&&g.c(),p(i,"class","ri-search-line"),p(t,"for",n[8]),p(t,"class","m-l-10 txt-xl"),p(e,"class","searchbar")},m(y,S){w(y,e,S),k(e,t),k(t,i),k(e,l),m[s].m(e,null),k(e,r),_&&_.m(e,null),k(e,a),g&&g.m(e,null),f=!0,u||(c=[K(e,"click",cn(n[11])),K(e,"submit",Be(n[10]))],u=!0)},p(y,[S]){let T=s;s=h(y),s===T?m[s].p(y,S):(se(),A(m[T],1,1,()=>{m[T]=null}),oe(),o=m[s],o?o.p(y,S):(o=m[s]=d[s](y),o.c()),E(o,1),o.m(e,r)),(y[0].length||y[7].length)&&y[7]!=y[0]?_?S&129&&E(_,1):(_=Kf(),_.c(),E(_,1),_.m(e,a)):_&&(se(),A(_,1,1,()=>{_=null}),oe()),y[0].length||y[7].length?g?(g.p(y,S),S&129&&E(g,1)):(g=Jf(y),g.c(),E(g,1),g.m(e,null)):g&&(se(),A(g,1,1,()=>{g=null}),oe())},i(y){f||(E(o),E(_),E(g),f=!0)},o(y){A(o),A(_),A(g),f=!1},d(y){y&&v(e),m[s].d(),_&&_.d(),g&&g.d(),u=!1,ve(c)}}}function Iv(n,e,t){const i=st(),l="search_"+H.randomString(7);let{value:s=""}=e,{placeholder:o='Search term or filter like created > "2022-01-01"...'}=e,{autocompleteCollection:r=H.initCollection()}=e,{extraAutocompleteKeys:a=[]}=e,f,u=!1,c,d="";function m(C=!0){t(7,d=""),C&&(c==null||c.focus()),i("clear")}function h(){t(0,s=d),i("submit",s)}async function _(){f||u||(t(5,u=!0),t(4,f=(await nt(()=>import("./FilterAutocompleteInput-7N2kJXRh.js"),__vite__mapDeps([0,1]),import.meta.url)).default),t(5,u=!1))}jt(()=>{_()});function g(C){Te.call(this,n,C)}function y(C){d=C,t(7,d),t(0,s)}function S(C){ee[C?"unshift":"push"](()=>{c=C,t(6,c)})}function T(){d=this.value,t(7,d),t(0,s)}const $=()=>{m(!1),h()};return n.$$set=C=>{"value"in C&&t(0,s=C.value),"placeholder"in C&&t(1,o=C.placeholder),"autocompleteCollection"in C&&t(2,r=C.autocompleteCollection),"extraAutocompleteKeys"in C&&t(3,a=C.extraAutocompleteKeys)},n.$$.update=()=>{n.$$.dirty&1&&typeof s=="string"&&t(7,d=s)},[s,o,r,a,f,u,c,d,l,m,h,g,y,S,T,$]}class $s extends ge{constructor(e){super(),_e(this,e,Iv,Ev,me,{value:0,placeholder:1,autocompleteCollection:2,extraAutocompleteKeys:3})}}function Av(n){let e,t,i,l,s,o;return{c(){e=b("button"),t=b("i"),p(t,"class","ri-refresh-line svelte-1bvelc2"),p(e,"type","button"),p(e,"aria-label","Refresh"),p(e,"class",i="btn btn-transparent btn-circle "+n[1]+" svelte-1bvelc2"),x(e,"refreshing",n[2])},m(r,a){w(r,e,a),k(e,t),s||(o=[we(l=Le.call(null,e,n[0])),K(e,"click",n[3])],s=!0)},p(r,[a]){a&2&&i!==(i="btn btn-transparent btn-circle "+r[1]+" svelte-1bvelc2")&&p(e,"class",i),l&&Tt(l.update)&&a&1&&l.update.call(null,r[0]),a&6&&x(e,"refreshing",r[2])},i:Q,o:Q,d(r){r&&v(e),s=!1,ve(o)}}}function Lv(n,e,t){const i=st();let{tooltip:l={text:"Refresh",position:"right"}}=e,{class:s=""}=e,o=null;function r(){i("refresh");const a=l;t(0,l=null),clearTimeout(o),t(2,o=setTimeout(()=>{t(2,o=null),t(0,l=a)},150))}return jt(()=>()=>clearTimeout(o)),n.$$set=a=>{"tooltip"in a&&t(0,l=a.tooltip),"class"in a&&t(1,s=a.class)},[l,s,o,r]}class Zo extends ge{constructor(e){super(),_e(this,e,Lv,Av,me,{tooltip:0,class:1})}}function Nv(n){let e,t,i,l,s;const o=n[6].default,r=vt(o,n,n[5],null);return{c(){e=b("th"),r&&r.c(),p(e,"tabindex","0"),p(e,"title",n[2]),p(e,"class",t="col-sort "+n[1]),x(e,"col-sort-disabled",n[3]),x(e,"sort-active",n[0]==="-"+n[2]||n[0]==="+"+n[2]),x(e,"sort-desc",n[0]==="-"+n[2]),x(e,"sort-asc",n[0]==="+"+n[2])},m(a,f){w(a,e,f),r&&r.m(e,null),i=!0,l||(s=[K(e,"click",n[7]),K(e,"keydown",n[8])],l=!0)},p(a,[f]){r&&r.p&&(!i||f&32)&&St(r,o,a,a[5],i?wt(o,a[5],f,null):$t(a[5]),null),(!i||f&4)&&p(e,"title",a[2]),(!i||f&2&&t!==(t="col-sort "+a[1]))&&p(e,"class",t),(!i||f&10)&&x(e,"col-sort-disabled",a[3]),(!i||f&7)&&x(e,"sort-active",a[0]==="-"+a[2]||a[0]==="+"+a[2]),(!i||f&7)&&x(e,"sort-desc",a[0]==="-"+a[2]),(!i||f&7)&&x(e,"sort-asc",a[0]==="+"+a[2])},i(a){i||(E(r,a),i=!0)},o(a){A(r,a),i=!1},d(a){a&&v(e),r&&r.d(a),l=!1,ve(s)}}}function Pv(n,e,t){let{$$slots:i={},$$scope:l}=e,{class:s=""}=e,{name:o}=e,{sort:r=""}=e,{disable:a=!1}=e;function f(){a||("-"+o===r?t(0,r="+"+o):t(0,r="-"+o))}const u=()=>f(),c=d=>{(d.code==="Enter"||d.code==="Space")&&(d.preventDefault(),f())};return n.$$set=d=>{"class"in d&&t(1,s=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,l=d.$$scope)},[r,s,o,a,f,l,i,u,c]}class $n extends ge{constructor(e){super(),_e(this,e,Pv,Nv,me,{class:1,name:2,sort:0,disable:3})}}const Fv=n=>({}),Zf=n=>({}),Rv=n=>({}),Gf=n=>({});function qv(n){let e,t,i,l,s,o,r,a;const f=n[11].before,u=vt(f,n,n[10],Gf),c=n[11].default,d=vt(c,n,n[10],null),m=n[11].after,h=vt(m,n,n[10],Zf);return{c(){e=b("div"),u&&u.c(),t=O(),i=b("div"),d&&d.c(),s=O(),h&&h.c(),p(i,"class",l="scroller "+n[0]+" "+n[3]+" svelte-3a0gfs"),p(e,"class","scroller-wrapper svelte-3a0gfs")},m(_,g){w(_,e,g),u&&u.m(e,null),k(e,t),k(e,i),d&&d.m(i,null),n[12](i),k(e,s),h&&h.m(e,null),o=!0,r||(a=[K(window,"resize",n[1]),K(i,"scroll",n[1])],r=!0)},p(_,[g]){u&&u.p&&(!o||g&1024)&&St(u,f,_,_[10],o?wt(f,_[10],g,Rv):$t(_[10]),Gf),d&&d.p&&(!o||g&1024)&&St(d,c,_,_[10],o?wt(c,_[10],g,null):$t(_[10]),null),(!o||g&9&&l!==(l="scroller "+_[0]+" "+_[3]+" svelte-3a0gfs"))&&p(i,"class",l),h&&h.p&&(!o||g&1024)&&St(h,m,_,_[10],o?wt(m,_[10],g,Fv):$t(_[10]),Zf)},i(_){o||(E(u,_),E(d,_),E(h,_),o=!0)},o(_){A(u,_),A(d,_),A(h,_),o=!1},d(_){_&&v(e),u&&u.d(_),d&&d.d(_),n[12](null),h&&h.d(_),r=!1,ve(a)}}}function jv(n,e,t){let{$$slots:i={},$$scope:l}=e;const s=st();let{class:o=""}=e,{vThreshold:r=0}=e,{hThreshold:a=0}=e,{dispatchOnNoScroll:f=!0}=e,u=null,c="",d=null,m,h,_,g,y;function S(){u&&t(2,u.scrollTop=0,u)}function T(){u&&t(2,u.scrollLeft=0,u)}function $(){u&&(t(3,c=""),_=u.clientWidth+2,g=u.clientHeight+2,m=u.scrollWidth-_,h=u.scrollHeight-g,h>0?(t(3,c+=" v-scroll"),r>=g&&t(4,r=0),u.scrollTop-r<=0&&(t(3,c+=" v-scroll-start"),s("vScrollStart")),u.scrollTop+r>=h&&(t(3,c+=" v-scroll-end"),s("vScrollEnd"))):f&&s("vScrollEnd"),m>0?(t(3,c+=" h-scroll"),a>=_&&t(5,a=0),u.scrollLeft-a<=0&&(t(3,c+=" h-scroll-start"),s("hScrollStart")),u.scrollLeft+a>=m&&(t(3,c+=" h-scroll-end"),s("hScrollEnd"))):f&&s("hScrollEnd"))}function C(){d||(d=setTimeout(()=>{$(),d=null},150))}jt(()=>(C(),y=new MutationObserver(C),y.observe(u,{attributeFilter:["width","height"],childList:!0,subtree:!0}),()=>{y==null||y.disconnect(),clearTimeout(d)}));function M(D){ee[D?"unshift":"push"](()=>{u=D,t(2,u)})}return n.$$set=D=>{"class"in D&&t(0,o=D.class),"vThreshold"in D&&t(4,r=D.vThreshold),"hThreshold"in D&&t(5,a=D.hThreshold),"dispatchOnNoScroll"in D&&t(6,f=D.dispatchOnNoScroll),"$$scope"in D&&t(10,l=D.$$scope)},[o,C,u,c,r,a,f,S,T,$,l,i,M]}class Go extends ge{constructor(e){super(),_e(this,e,jv,qv,me,{class:0,vThreshold:4,hThreshold:5,dispatchOnNoScroll:6,resetVerticalScroll:7,resetHorizontalScroll:8,refresh:9,throttleRefresh:1})}get resetVerticalScroll(){return this.$$.ctx[7]}get resetHorizontalScroll(){return this.$$.ctx[8]}get refresh(){return this.$$.ctx[9]}get throttleRefresh(){return this.$$.ctx[1]}}function Hv(n){let e,t,i=(n[1]||"UNKN")+"",l,s,o,r,a;return{c(){e=b("div"),t=b("span"),l=Y(i),s=Y(" ("),o=Y(n[0]),r=Y(")"),p(t,"class","txt"),p(e,"class",a="label log-level-label level-"+n[0]+" svelte-ha6hme")},m(f,u){w(f,e,u),k(e,t),k(t,l),k(t,s),k(t,o),k(t,r)},p(f,[u]){u&2&&i!==(i=(f[1]||"UNKN")+"")&&re(l,i),u&1&&re(o,f[0]),u&1&&a!==(a="label log-level-label level-"+f[0]+" svelte-ha6hme")&&p(e,"class",a)},i:Q,o:Q,d(f){f&&v(e)}}}function zv(n,e,t){let i,{level:l}=e;return n.$$set=s=>{"level"in s&&t(0,l=s.level)},n.$$.update=()=>{var s;n.$$.dirty&1&&t(1,i=(s=W1.find(o=>o.level==l))==null?void 0:s.label)},[l,i]}class Q1 extends ge{constructor(e){super(),_e(this,e,zv,Hv,me,{level:0})}}function Vv(n){let e,t=n[0].replace("Z"," UTC")+"",i,l,s;return{c(){e=b("span"),i=Y(t),p(e,"class","txt-nowrap")},m(o,r){w(o,e,r),k(e,i),l||(s=we(Le.call(null,e,n[1])),l=!0)},p(o,[r]){r&1&&t!==(t=o[0].replace("Z"," UTC")+"")&&re(i,t)},i:Q,o:Q,d(o){o&&v(e),l=!1,s()}}}function Bv(n,e,t){let{date:i}=e;const l={get text(){return H.formatToLocalDate(i,"yyyy-MM-dd HH:mm:ss.SSS")+" Local"}};return n.$$set=s=>{"date"in s&&t(0,i=s.date)},[i,l]}class x1 extends ge{constructor(e){super(),_e(this,e,Bv,Vv,me,{date:0})}}function Xf(n,e,t){var o;const i=n.slice();i[31]=e[t];const l=((o=i[31].data)==null?void 0:o.type)=="request";i[32]=l;const s=t2(i[31]);return i[33]=s,i}function Qf(n,e,t){const i=n.slice();return i[36]=e[t],i}function Uv(n){let e,t,i,l,s,o,r;return{c(){e=b("div"),t=b("input"),l=O(),s=b("label"),p(t,"type","checkbox"),p(t,"id","checkbox_0"),t.disabled=i=!n[3].length,t.checked=n[8],p(s,"for","checkbox_0"),p(e,"class","form-field")},m(a,f){w(a,e,f),k(e,t),k(e,l),k(e,s),o||(r=K(t,"change",n[18]),o=!0)},p(a,f){f[0]&8&&i!==(i=!a[3].length)&&(t.disabled=i),f[0]&256&&(t.checked=a[8])},d(a){a&&v(e),o=!1,r()}}}function Wv(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function Yv(n){let e;return{c(){e=b("div"),e.innerHTML=' level',p(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function Kv(n){let e;return{c(){e=b("div"),e.innerHTML=' message',p(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function Jv(n){let e;return{c(){e=b("div"),e.innerHTML=` created`,p(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function xf(n){let e;function t(s,o){return s[7]?Gv:Zv}let i=t(n),l=i(n);return{c(){l.c(),e=ye()},m(s,o){l.m(s,o),w(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&v(e),l.d(s)}}}function Zv(n){var r;let e,t,i,l,s,o=((r=n[0])==null?void 0:r.length)&&eu(n);return{c(){e=b("tr"),t=b("td"),i=b("h6"),i.textContent="No logs found.",l=O(),o&&o.c(),s=O(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,f){w(a,e,f),k(e,t),k(t,i),k(t,l),o&&o.m(t,null),k(e,s)},p(a,f){var u;(u=a[0])!=null&&u.length?o?o.p(a,f):(o=eu(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&v(e),o&&o.d()}}}function Gv(n){let e;return{c(){e=b("tr"),e.innerHTML=' '},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function eu(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(l,s){w(l,e,s),t||(i=K(e,"click",n[25]),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function tu(n){let e,t=de(n[33]),i=[];for(let l=0;l',R=O(),p(s,"type","checkbox"),p(s,"id",o="checkbox_"+e[31].id),s.checked=r=e[4][e[31].id],p(f,"for",u="checkbox_"+e[31].id),p(l,"class","form-field"),p(i,"class","bulk-select-col min-width"),p(d,"class","col-type-text col-field-level min-width svelte-91v05h"),p(y,"class","txt-ellipsis"),p(g,"class","flex flex-gap-10"),p(_,"class","col-type-text col-field-message svelte-91v05h"),p(M,"class","col-type-date col-field-created"),p(L,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(U,Z){w(U,t,Z),k(t,i),k(i,l),k(l,s),k(l,a),k(l,f),k(t,c),k(t,d),z(m,d,null),k(t,h),k(t,_),k(_,g),k(g,y),k(y,T),k(_,$),q&&q.m(_,null),k(t,C),k(t,M),z(D,M,null),k(t,I),k(t,L),k(t,R),F=!0,N||(P=[K(s,"change",j),K(l,"click",cn(e[17])),K(t,"click",W),K(t,"keydown",G)],N=!0)},p(U,Z){e=U,(!F||Z[0]&8&&o!==(o="checkbox_"+e[31].id))&&p(s,"id",o),(!F||Z[0]&24&&r!==(r=e[4][e[31].id]))&&(s.checked=r),(!F||Z[0]&8&&u!==(u="checkbox_"+e[31].id))&&p(f,"for",u);const le={};Z[0]&8&&(le.level=e[31].level),m.$set(le),(!F||Z[0]&8)&&S!==(S=e[31].message+"")&&re(T,S),e[33].length?q?q.p(e,Z):(q=tu(e),q.c(),q.m(_,null)):q&&(q.d(1),q=null);const ne={};Z[0]&8&&(ne.date=e[31].created),D.$set(ne)},i(U){F||(E(m.$$.fragment,U),E(D.$$.fragment,U),F=!0)},o(U){A(m.$$.fragment,U),A(D.$$.fragment,U),F=!1},d(U){U&&v(t),V(m),q&&q.d(),V(D),N=!1,ve(P)}}}function xv(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S=[],T=new Map,$;function C(G,U){return G[7]?Wv:Uv}let M=C(n),D=M(n);function I(G){n[19](G)}let L={disable:!0,class:"col-field-level min-width",name:"level",$$slots:{default:[Yv]},$$scope:{ctx:n}};n[1]!==void 0&&(L.sort=n[1]),o=new $n({props:L}),ee.push(()=>be(o,"sort",I));function R(G){n[20](G)}let F={disable:!0,class:"col-type-text col-field-message",name:"data",$$slots:{default:[Kv]},$$scope:{ctx:n}};n[1]!==void 0&&(F.sort=n[1]),f=new $n({props:F}),ee.push(()=>be(f,"sort",R));function N(G){n[21](G)}let P={disable:!0,class:"col-type-date col-field-created",name:"created",$$slots:{default:[Jv]},$$scope:{ctx:n}};n[1]!==void 0&&(P.sort=n[1]),d=new $n({props:P}),ee.push(()=>be(d,"sort",N));let j=de(n[3]);const q=G=>G[31].id;for(let G=0;Gr=!1)),o.$set(Z);const le={};U[1]&256&&(le.$$scope={dirty:U,ctx:G}),!u&&U[0]&2&&(u=!0,le.sort=G[1],ke(()=>u=!1)),f.$set(le);const ne={};U[1]&256&&(ne.$$scope={dirty:U,ctx:G}),!m&&U[0]&2&&(m=!0,ne.sort=G[1],ke(()=>m=!1)),d.$set(ne),U[0]&9369&&(j=de(G[3]),se(),S=at(S,U,q,1,G,j,T,y,Mt,iu,null,Xf),oe(),!j.length&&W?W.p(G,U):j.length?W&&(W.d(1),W=null):(W=xf(G),W.c(),W.m(y,null))),(!$||U[0]&128)&&x(e,"table-loading",G[7])},i(G){if(!$){E(o.$$.fragment,G),E(f.$$.fragment,G),E(d.$$.fragment,G);for(let U=0;ULoad more',p(t,"type","button"),p(t,"class","btn btn-lg btn-secondary btn-expanded"),x(t,"btn-loading",n[7]),x(t,"btn-disabled",n[7]),p(e,"class","block txt-center m-t-sm")},m(s,o){w(s,e,o),k(e,t),i||(l=K(t,"click",n[26]),i=!0)},p(s,o){o[0]&128&&x(t,"btn-loading",s[7]),o[0]&128&&x(t,"btn-disabled",s[7])},d(s){s&&v(e),i=!1,l()}}}function su(n){let e,t,i,l,s,o,r=n[5]===1?"log":"logs",a,f,u,c,d,m,h,_,g,y,S;return{c(){e=b("div"),t=b("div"),i=Y("Selected "),l=b("strong"),s=Y(n[5]),o=O(),a=Y(r),f=O(),u=b("button"),u.innerHTML='Reset',c=O(),d=b("div"),m=O(),h=b("button"),h.innerHTML='Download as JSON',p(t,"class","txt"),p(u,"type","button"),p(u,"class","btn btn-xs btn-transparent btn-outline p-l-5 p-r-5"),p(d,"class","flex-fill"),p(h,"type","button"),p(h,"class","btn btn-sm"),p(e,"class","bulkbar svelte-91v05h")},m(T,$){w(T,e,$),k(e,t),k(t,i),k(t,l),k(l,s),k(t,o),k(t,a),k(e,f),k(e,u),k(e,c),k(e,d),k(e,m),k(e,h),g=!0,y||(S=[K(u,"click",n[27]),K(h,"click",n[14])],y=!0)},p(T,$){(!g||$[0]&32)&&re(s,T[5]),(!g||$[0]&32)&&r!==(r=T[5]===1?"log":"logs")&&re(a,r)},i(T){g||(T&&Ye(()=>{g&&(_||(_=Ne(e,Pn,{duration:150,y:5},!0)),_.run(1))}),g=!0)},o(T){T&&(_||(_=Ne(e,Pn,{duration:150,y:5},!1)),_.run(0)),g=!1},d(T){T&&v(e),T&&_&&_.end(),y=!1,ve(S)}}}function e2(n){let e,t,i,l,s;e=new Go({props:{class:"table-wrapper",$$slots:{default:[xv]},$$scope:{ctx:n}}});let o=n[3].length&&n[9]&&lu(n),r=n[5]&&su(n);return{c(){B(e.$$.fragment),t=O(),o&&o.c(),i=O(),r&&r.c(),l=ye()},m(a,f){z(e,a,f),w(a,t,f),o&&o.m(a,f),w(a,i,f),r&&r.m(a,f),w(a,l,f),s=!0},p(a,f){const u={};f[0]&411|f[1]&256&&(u.$$scope={dirty:f,ctx:a}),e.$set(u),a[3].length&&a[9]?o?o.p(a,f):(o=lu(a),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null),a[5]?r?(r.p(a,f),f[0]&32&&E(r,1)):(r=su(a),r.c(),E(r,1),r.m(l.parentNode,l)):r&&(se(),A(r,1,1,()=>{r=null}),oe())},i(a){s||(E(e.$$.fragment,a),E(r),s=!0)},o(a){A(e.$$.fragment,a),A(r),s=!1},d(a){a&&(v(t),v(i),v(l)),V(e,a),o&&o.d(a),r&&r.d(a)}}}const ou=50,dr=/[-:\. ]/gi;function t2(n){let e=[];if(!n.data)return e;if(n.data.type=="request"){const t=["status","execTime","auth","userIp"];for(let i of t)typeof n.data[i]<"u"&&e.push({key:i});n.data.referer&&!n.data.referer.includes(window.location.host)&&e.push({key:"referer"})}else{const t=Object.keys(n.data);for(const i of t)i!="error"&&i!="details"&&e.length<6&&e.push({key:i})}return n.data.error&&e.push({key:"error",label:"label-danger"}),n.data.details&&e.push({key:"details",label:"label-warning"}),e}function n2(n,e,t){let i,l,s;const o=st();let{filter:r=""}=e,{presets:a=""}=e,{sort:f="-rowid"}=e,u=[],c=1,d=0,m=!1,h=0,_={};async function g(U=1,Z=!0){t(7,m=!0);const le=[a,H.normalizeLogsFilter(r)].filter(Boolean).join("&&");return fe.logs.getList(U,ou,{sort:f,skipTotal:1,filter:le}).then(async ne=>{var Ae;U<=1&&y();const he=H.toArray(ne.items);if(t(7,m=!1),t(6,c=ne.page),t(16,d=((Ae=ne.items)==null?void 0:Ae.length)||0),o("load",u.concat(he)),Z){const He=++h;for(;he.length&&h==He;){const Ge=he.splice(0,10);for(let xe of Ge)H.pushOrReplaceByKey(u,xe);t(3,u),await H.yieldToMain()}}else{for(let He of he)H.pushOrReplaceByKey(u,He);t(3,u)}}).catch(ne=>{ne!=null&&ne.isAbort||(t(7,m=!1),console.warn(ne),y(),fe.error(ne,!le||(ne==null?void 0:ne.status)!=400))})}function y(){t(3,u=[]),t(4,_={}),t(6,c=1),t(16,d=0)}function S(){s?T():$()}function T(){t(4,_={})}function $(){for(const U of u)t(4,_[U.id]=U,_);t(4,_)}function C(U){_[U.id]?delete _[U.id]:t(4,_[U.id]=U,_),t(4,_)}function M(){const U=Object.values(_).sort((ne,he)=>ne.createdhe.created?-1:0);if(!U.length)return;if(U.length==1)return H.downloadJson(U[0],"log_"+U[0].created.replaceAll(dr,"")+".json");const Z=U[0].created.replaceAll(dr,""),le=U[U.length-1].created.replaceAll(dr,"");return H.downloadJson(U,`${U.length}_logs_${le}_to_${Z}.json`)}function D(U){Te.call(this,n,U)}const I=()=>S();function L(U){f=U,t(1,f)}function R(U){f=U,t(1,f)}function F(U){f=U,t(1,f)}const N=U=>C(U),P=U=>o("select",U),j=(U,Z)=>{Z.code==="Enter"&&(Z.preventDefault(),o("select",U))},q=()=>t(0,r=""),W=()=>g(c+1),G=()=>T();return n.$$set=U=>{"filter"in U&&t(0,r=U.filter),"presets"in U&&t(15,a=U.presets),"sort"in U&&t(1,f=U.sort)},n.$$.update=()=>{n.$$.dirty[0]&32771&&(typeof f<"u"||typeof r<"u"||typeof a<"u")&&(y(),g(1)),n.$$.dirty[0]&65536&&t(9,i=d>=ou),n.$$.dirty[0]&16&&t(5,l=Object.keys(_).length),n.$$.dirty[0]&40&&t(8,s=u.length&&l===u.length)},[r,f,g,u,_,l,c,m,s,i,o,S,T,C,M,a,d,D,I,L,R,F,N,P,j,q,W,G]}class i2 extends ge{constructor(e){super(),_e(this,e,n2,e2,me,{filter:0,presets:15,sort:1,load:2},null,[-1,-1])}get load(){return this.$$.ctx[2]}}/*! +`)})},i(a){s||(a&&Ye(()=>{s&&(l||(l=Ne(t,Ut,{duration:150,start:.7},!0)),l.run(1))}),s=!0)},o(a){a&&(l||(l=Ne(t,Ut,{duration:150,start:.7},!1)),l.run(0)),s=!1},d(a){a&&v(e),a&&l&&l.end(),o=!1,r()}}}function Uf(n){let e,t,i=Co(n[12])+"",l,s,o,r;return{c(){e=b("div"),t=b("pre"),l=Y(i),s=O(),p(e,"class","help-block help-block-error")},m(a,f){w(a,e,f),k(e,t),k(t,l),k(e,s),r=!0},p(a,f){(!r||f&8)&&i!==(i=Co(a[12])+"")&&re(l,i)},i(a){r||(a&&Ye(()=>{r&&(o||(o=Ne(e,et,{duration:150},!0)),o.run(1))}),r=!0)},o(a){a&&(o||(o=Ne(e,et,{duration:150},!1)),o.run(0)),r=!1},d(a){a&&v(e),a&&o&&o.end()}}}function _v(n){let e,t,i,l,s,o,r;const a=n[9].default,f=vt(a,n,n[8],Bf),u=[hv,mv],c=[];function d(m,h){return m[0]&&m[3].length?0:1}return i=d(n),l=c[i]=u[i](n),{c(){e=b("div"),f&&f.c(),t=O(),l.c(),p(e,"class",n[1]),x(e,"error",n[3].length)},m(m,h){w(m,e,h),f&&f.m(e,null),k(e,t),c[i].m(e,null),n[11](e),s=!0,o||(r=K(e,"click",n[10]),o=!0)},p(m,[h]){f&&f.p&&(!s||h&256)&&St(f,a,m,m[8],s?wt(a,m[8],h,pv):$t(m[8]),Bf);let _=i;i=d(m),i===_?c[i].p(m,h):(se(),A(c[_],1,1,()=>{c[_]=null}),oe(),l=c[i],l?l.p(m,h):(l=c[i]=u[i](m),l.c()),E(l,1),l.m(e,null)),(!s||h&2)&&p(e,"class",m[1]),(!s||h&10)&&x(e,"error",m[3].length)},i(m){s||(E(f,m),E(l),s=!0)},o(m){A(f,m),A(l),s=!1},d(m){m&&v(e),f&&f.d(m),c[i].d(),n[11](null),o=!1,r()}}}const Wf="Invalid value";function Co(n){return typeof n=="object"?(n==null?void 0:n.message)||(n==null?void 0:n.code)||Wf:n||Wf}function gv(n,e,t){let i;Ue(n,mi,_=>t(7,i=_));let{$$slots:l={},$$scope:s}=e;const o="field_"+H.randomString(7);let{name:r=""}=e,{inlineError:a=!1}=e,{class:f=void 0}=e,u,c=[];function d(){li(r)}jt(()=>(u.addEventListener("input",d),u.addEventListener("change",d),()=>{u.removeEventListener("input",d),u.removeEventListener("change",d)}));function m(_){Te.call(this,n,_)}function h(_){ee[_?"unshift":"push"](()=>{u=_,t(2,u)})}return n.$$set=_=>{"name"in _&&t(5,r=_.name),"inlineError"in _&&t(0,a=_.inlineError),"class"in _&&t(1,f=_.class),"$$scope"in _&&t(8,s=_.$$scope)},n.$$.update=()=>{n.$$.dirty&160&&t(3,c=H.toArray(H.getNestedVal(i,r)))},[a,f,u,c,o,r,d,i,s,l,m,h]}class pe extends ge{constructor(e){super(),_e(this,e,gv,_v,me,{name:5,inlineError:0,class:1,changed:6})}get changed(){return this.$$.ctx[6]}}function bv(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Email"),l=O(),s=b("input"),p(e,"for",i=n[9]),p(s,"type","email"),p(s,"autocomplete","off"),p(s,"id",o=n[9]),s.required=!0,s.autofocus=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0]),s.focus(),r||(a=K(s,"input",n[5]),r=!0)},p(f,u){u&512&&i!==(i=f[9])&&p(e,"for",i),u&512&&o!==(o=f[9])&&p(s,"id",o),u&1&&s.value!==f[0]&&ae(s,f[0])},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function kv(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=Y("Password"),l=O(),s=b("input"),r=O(),a=b("div"),a.textContent="Minimum 10 characters.",p(e,"for",i=n[9]),p(s,"type","password"),p(s,"autocomplete","new-password"),p(s,"minlength","10"),p(s,"id",o=n[9]),s.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),k(e,t),w(c,l,d),w(c,s,d),ae(s,n[1]),w(c,r,d),w(c,a,d),f||(u=K(s,"input",n[6]),f=!0)},p(c,d){d&512&&i!==(i=c[9])&&p(e,"for",i),d&512&&o!==(o=c[9])&&p(s,"id",o),d&2&&s.value!==c[1]&&ae(s,c[1])},d(c){c&&(v(e),v(l),v(s),v(r),v(a)),f=!1,u()}}}function yv(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Password confirm"),l=O(),s=b("input"),p(e,"for",i=n[9]),p(s,"type","password"),p(s,"minlength","10"),p(s,"id",o=n[9]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[2]),r||(a=K(s,"input",n[7]),r=!0)},p(f,u){u&512&&i!==(i=f[9])&&p(e,"for",i),u&512&&o!==(o=f[9])&&p(s,"id",o),u&4&&s.value!==f[2]&&ae(s,f[2])},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function vv(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;return l=new pe({props:{class:"form-field required",name:"email",$$slots:{default:[bv,({uniqueId:h})=>({9:h}),({uniqueId:h})=>h?512:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field required",name:"password",$$slots:{default:[kv,({uniqueId:h})=>({9:h}),({uniqueId:h})=>h?512:0]},$$scope:{ctx:n}}}),a=new pe({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[yv,({uniqueId:h})=>({9:h}),({uniqueId:h})=>h?512:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),t=b("div"),t.innerHTML="

Create your first admin account in order to continue

",i=O(),B(l.$$.fragment),s=O(),B(o.$$.fragment),r=O(),B(a.$$.fragment),f=O(),u=b("button"),u.innerHTML='Create and login ',p(t,"class","content txt-center m-b-base"),p(u,"type","submit"),p(u,"class","btn btn-lg btn-block btn-next"),x(u,"btn-disabled",n[3]),x(u,"btn-loading",n[3]),p(e,"class","block"),p(e,"autocomplete","off")},m(h,_){w(h,e,_),k(e,t),k(e,i),z(l,e,null),k(e,s),z(o,e,null),k(e,r),z(a,e,null),k(e,f),k(e,u),c=!0,d||(m=K(e,"submit",Be(n[4])),d=!0)},p(h,[_]){const g={};_&1537&&(g.$$scope={dirty:_,ctx:h}),l.$set(g);const y={};_&1538&&(y.$$scope={dirty:_,ctx:h}),o.$set(y);const S={};_&1540&&(S.$$scope={dirty:_,ctx:h}),a.$set(S),(!c||_&8)&&x(u,"btn-disabled",h[3]),(!c||_&8)&&x(u,"btn-loading",h[3])},i(h){c||(E(l.$$.fragment,h),E(o.$$.fragment,h),E(a.$$.fragment,h),c=!0)},o(h){A(l.$$.fragment,h),A(o.$$.fragment,h),A(a.$$.fragment,h),c=!1},d(h){h&&v(e),V(l),V(o),V(a),d=!1,m()}}}function wv(n,e,t){const i=st();let l="",s="",o="",r=!1;async function a(){if(!r){t(3,r=!0);try{await fe.admins.create({email:l,password:s,passwordConfirm:o}),await fe.admins.authWithPassword(l,s),i("submit")}catch(d){fe.error(d)}t(3,r=!1)}}function f(){l=this.value,t(0,l)}function u(){s=this.value,t(1,s)}function c(){o=this.value,t(2,o)}return[l,s,o,r,a,f,u,c]}class Sv extends ge{constructor(e){super(),_e(this,e,wv,vv,me,{})}}function Yf(n){let e,t;return e=new G1({props:{$$slots:{default:[$v]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&9&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function $v(n){let e,t;return e=new Sv({}),e.$on("submit",n[1]),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p:Q,i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Tv(n){let e,t,i=n[0]&&Yf(n);return{c(){i&&i.c(),e=ye()},m(l,s){i&&i.m(l,s),w(l,e,s),t=!0},p(l,[s]){l[0]?i?(i.p(l,s),s&1&&E(i,1)):(i=Yf(l),i.c(),E(i,1),i.m(e.parentNode,e)):i&&(se(),A(i,1,1,()=>{i=null}),oe())},i(l){t||(E(i),t=!0)},o(l){A(i),t=!1},d(l){l&&v(e),i&&i.d(l)}}}function Cv(n,e,t){let i=!1;l();function l(){if(t(0,i=!1),new URLSearchParams(window.location.search).has("installer")){fe.logout(!1),t(0,i=!0);return}fe.authStore.isValid?tl("/collections"):fe.logout()}return[i,async()=>{t(0,i=!1),await Xt(),window.location.search=""}]}class Ov extends ge{constructor(e){super(),_e(this,e,Cv,Tv,me,{})}}const Dt=Cn(""),Oo=Cn(""),Xi=Cn(!1);function Mv(n){let e,t,i,l;return{c(){e=b("input"),p(e,"type","text"),p(e,"id",n[8]),p(e,"placeholder",t=n[0]||n[1])},m(s,o){w(s,e,o),n[13](e),ae(e,n[7]),i||(l=K(e,"input",n[14]),i=!0)},p(s,o){o&3&&t!==(t=s[0]||s[1])&&p(e,"placeholder",t),o&128&&e.value!==s[7]&&ae(e,s[7])},i:Q,o:Q,d(s){s&&v(e),n[13](null),i=!1,l()}}}function Dv(n){let e,t,i,l;function s(a){n[12](a)}var o=n[4];function r(a,f){let u={id:a[8],singleLine:!0,disableRequestKeys:!0,disableCollectionJoinKeys:!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=Ot(o,r(n)),ee.push(()=>be(e,"value",s)),e.$on("submit",n[10])),{c(){e&&B(e.$$.fragment),i=ye()},m(a,f){e&&z(e,a,f),w(a,i,f),l=!0},p(a,f){if(f&16&&o!==(o=a[4])){if(e){se();const u=e;A(u.$$.fragment,1,0,()=>{V(u,1)}),oe()}o?(e=Ot(o,r(a)),ee.push(()=>be(e,"value",s)),e.$on("submit",a[10]),B(e.$$.fragment),E(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else if(o){const u={};f&8&&(u.extraAutocompleteKeys=a[3]),f&4&&(u.baseCollection=a[2]),f&3&&(u.placeholder=a[0]||a[1]),!t&&f&128&&(t=!0,u.value=a[7],ke(()=>t=!1)),e.$set(u)}},i(a){l||(e&&E(e.$$.fragment,a),l=!0)},o(a){e&&A(e.$$.fragment,a),l=!1},d(a){a&&v(i),e&&V(e,a)}}}function Kf(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='Search',p(e,"type","submit"),p(e,"class","btn btn-expanded-sm btn-sm btn-warning")},m(l,s){w(l,e,s),i=!0},i(l){i||(l&&Ye(()=>{i&&(t||(t=Ne(e,Pn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(l){l&&(t||(t=Ne(e,Pn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(l){l&&v(e),l&&t&&t.end()}}}function Jf(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='Clear',p(e,"type","button"),p(e,"class","btn btn-transparent btn-sm btn-hint p-l-xs p-r-xs m-l-10")},m(o,r){w(o,e,r),i=!0,l||(s=K(e,"click",n[15]),l=!0)},p:Q,i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Pn,{duration:150,x:5},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Pn,{duration:150,x:5},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function Ev(n){let e,t,i,l,s,o,r,a,f,u,c;const d=[Dv,Mv],m=[];function h(y,S){return y[4]&&!y[5]?0:1}s=h(n),o=m[s]=d[s](n);let _=(n[0].length||n[7].length)&&n[7]!=n[0]&&Kf(),g=(n[0].length||n[7].length)&&Jf(n);return{c(){e=b("form"),t=b("label"),i=b("i"),l=O(),o.c(),r=O(),_&&_.c(),a=O(),g&&g.c(),p(i,"class","ri-search-line"),p(t,"for",n[8]),p(t,"class","m-l-10 txt-xl"),p(e,"class","searchbar")},m(y,S){w(y,e,S),k(e,t),k(t,i),k(e,l),m[s].m(e,null),k(e,r),_&&_.m(e,null),k(e,a),g&&g.m(e,null),f=!0,u||(c=[K(e,"click",cn(n[11])),K(e,"submit",Be(n[10]))],u=!0)},p(y,[S]){let T=s;s=h(y),s===T?m[s].p(y,S):(se(),A(m[T],1,1,()=>{m[T]=null}),oe(),o=m[s],o?o.p(y,S):(o=m[s]=d[s](y),o.c()),E(o,1),o.m(e,r)),(y[0].length||y[7].length)&&y[7]!=y[0]?_?S&129&&E(_,1):(_=Kf(),_.c(),E(_,1),_.m(e,a)):_&&(se(),A(_,1,1,()=>{_=null}),oe()),y[0].length||y[7].length?g?(g.p(y,S),S&129&&E(g,1)):(g=Jf(y),g.c(),E(g,1),g.m(e,null)):g&&(se(),A(g,1,1,()=>{g=null}),oe())},i(y){f||(E(o),E(_),E(g),f=!0)},o(y){A(o),A(_),A(g),f=!1},d(y){y&&v(e),m[s].d(),_&&_.d(),g&&g.d(),u=!1,ve(c)}}}function Iv(n,e,t){const i=st(),l="search_"+H.randomString(7);let{value:s=""}=e,{placeholder:o='Search term or filter like created > "2022-01-01"...'}=e,{autocompleteCollection:r=H.initCollection()}=e,{extraAutocompleteKeys:a=[]}=e,f,u=!1,c,d="";function m(C=!0){t(7,d=""),C&&(c==null||c.focus()),i("clear")}function h(){t(0,s=d),i("submit",s)}async function _(){f||u||(t(5,u=!0),t(4,f=(await nt(()=>import("./FilterAutocompleteInput-ywiKWbDQ.js"),__vite__mapDeps([0,1]),import.meta.url)).default),t(5,u=!1))}jt(()=>{_()});function g(C){Te.call(this,n,C)}function y(C){d=C,t(7,d),t(0,s)}function S(C){ee[C?"unshift":"push"](()=>{c=C,t(6,c)})}function T(){d=this.value,t(7,d),t(0,s)}const $=()=>{m(!1),h()};return n.$$set=C=>{"value"in C&&t(0,s=C.value),"placeholder"in C&&t(1,o=C.placeholder),"autocompleteCollection"in C&&t(2,r=C.autocompleteCollection),"extraAutocompleteKeys"in C&&t(3,a=C.extraAutocompleteKeys)},n.$$.update=()=>{n.$$.dirty&1&&typeof s=="string"&&t(7,d=s)},[s,o,r,a,f,u,c,d,l,m,h,g,y,S,T,$]}class $s extends ge{constructor(e){super(),_e(this,e,Iv,Ev,me,{value:0,placeholder:1,autocompleteCollection:2,extraAutocompleteKeys:3})}}function Av(n){let e,t,i,l,s,o;return{c(){e=b("button"),t=b("i"),p(t,"class","ri-refresh-line svelte-1bvelc2"),p(e,"type","button"),p(e,"aria-label","Refresh"),p(e,"class",i="btn btn-transparent btn-circle "+n[1]+" svelte-1bvelc2"),x(e,"refreshing",n[2])},m(r,a){w(r,e,a),k(e,t),s||(o=[we(l=Le.call(null,e,n[0])),K(e,"click",n[3])],s=!0)},p(r,[a]){a&2&&i!==(i="btn btn-transparent btn-circle "+r[1]+" svelte-1bvelc2")&&p(e,"class",i),l&&Tt(l.update)&&a&1&&l.update.call(null,r[0]),a&6&&x(e,"refreshing",r[2])},i:Q,o:Q,d(r){r&&v(e),s=!1,ve(o)}}}function Lv(n,e,t){const i=st();let{tooltip:l={text:"Refresh",position:"right"}}=e,{class:s=""}=e,o=null;function r(){i("refresh");const a=l;t(0,l=null),clearTimeout(o),t(2,o=setTimeout(()=>{t(2,o=null),t(0,l=a)},150))}return jt(()=>()=>clearTimeout(o)),n.$$set=a=>{"tooltip"in a&&t(0,l=a.tooltip),"class"in a&&t(1,s=a.class)},[l,s,o,r]}class Zo extends ge{constructor(e){super(),_e(this,e,Lv,Av,me,{tooltip:0,class:1})}}function Nv(n){let e,t,i,l,s;const o=n[6].default,r=vt(o,n,n[5],null);return{c(){e=b("th"),r&&r.c(),p(e,"tabindex","0"),p(e,"title",n[2]),p(e,"class",t="col-sort "+n[1]),x(e,"col-sort-disabled",n[3]),x(e,"sort-active",n[0]==="-"+n[2]||n[0]==="+"+n[2]),x(e,"sort-desc",n[0]==="-"+n[2]),x(e,"sort-asc",n[0]==="+"+n[2])},m(a,f){w(a,e,f),r&&r.m(e,null),i=!0,l||(s=[K(e,"click",n[7]),K(e,"keydown",n[8])],l=!0)},p(a,[f]){r&&r.p&&(!i||f&32)&&St(r,o,a,a[5],i?wt(o,a[5],f,null):$t(a[5]),null),(!i||f&4)&&p(e,"title",a[2]),(!i||f&2&&t!==(t="col-sort "+a[1]))&&p(e,"class",t),(!i||f&10)&&x(e,"col-sort-disabled",a[3]),(!i||f&7)&&x(e,"sort-active",a[0]==="-"+a[2]||a[0]==="+"+a[2]),(!i||f&7)&&x(e,"sort-desc",a[0]==="-"+a[2]),(!i||f&7)&&x(e,"sort-asc",a[0]==="+"+a[2])},i(a){i||(E(r,a),i=!0)},o(a){A(r,a),i=!1},d(a){a&&v(e),r&&r.d(a),l=!1,ve(s)}}}function Pv(n,e,t){let{$$slots:i={},$$scope:l}=e,{class:s=""}=e,{name:o}=e,{sort:r=""}=e,{disable:a=!1}=e;function f(){a||("-"+o===r?t(0,r="+"+o):t(0,r="-"+o))}const u=()=>f(),c=d=>{(d.code==="Enter"||d.code==="Space")&&(d.preventDefault(),f())};return n.$$set=d=>{"class"in d&&t(1,s=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,l=d.$$scope)},[r,s,o,a,f,l,i,u,c]}class $n extends ge{constructor(e){super(),_e(this,e,Pv,Nv,me,{class:1,name:2,sort:0,disable:3})}}const Fv=n=>({}),Zf=n=>({}),Rv=n=>({}),Gf=n=>({});function qv(n){let e,t,i,l,s,o,r,a;const f=n[11].before,u=vt(f,n,n[10],Gf),c=n[11].default,d=vt(c,n,n[10],null),m=n[11].after,h=vt(m,n,n[10],Zf);return{c(){e=b("div"),u&&u.c(),t=O(),i=b("div"),d&&d.c(),s=O(),h&&h.c(),p(i,"class",l="scroller "+n[0]+" "+n[3]+" svelte-3a0gfs"),p(e,"class","scroller-wrapper svelte-3a0gfs")},m(_,g){w(_,e,g),u&&u.m(e,null),k(e,t),k(e,i),d&&d.m(i,null),n[12](i),k(e,s),h&&h.m(e,null),o=!0,r||(a=[K(window,"resize",n[1]),K(i,"scroll",n[1])],r=!0)},p(_,[g]){u&&u.p&&(!o||g&1024)&&St(u,f,_,_[10],o?wt(f,_[10],g,Rv):$t(_[10]),Gf),d&&d.p&&(!o||g&1024)&&St(d,c,_,_[10],o?wt(c,_[10],g,null):$t(_[10]),null),(!o||g&9&&l!==(l="scroller "+_[0]+" "+_[3]+" svelte-3a0gfs"))&&p(i,"class",l),h&&h.p&&(!o||g&1024)&&St(h,m,_,_[10],o?wt(m,_[10],g,Fv):$t(_[10]),Zf)},i(_){o||(E(u,_),E(d,_),E(h,_),o=!0)},o(_){A(u,_),A(d,_),A(h,_),o=!1},d(_){_&&v(e),u&&u.d(_),d&&d.d(_),n[12](null),h&&h.d(_),r=!1,ve(a)}}}function jv(n,e,t){let{$$slots:i={},$$scope:l}=e;const s=st();let{class:o=""}=e,{vThreshold:r=0}=e,{hThreshold:a=0}=e,{dispatchOnNoScroll:f=!0}=e,u=null,c="",d=null,m,h,_,g,y;function S(){u&&t(2,u.scrollTop=0,u)}function T(){u&&t(2,u.scrollLeft=0,u)}function $(){u&&(t(3,c=""),_=u.clientWidth+2,g=u.clientHeight+2,m=u.scrollWidth-_,h=u.scrollHeight-g,h>0?(t(3,c+=" v-scroll"),r>=g&&t(4,r=0),u.scrollTop-r<=0&&(t(3,c+=" v-scroll-start"),s("vScrollStart")),u.scrollTop+r>=h&&(t(3,c+=" v-scroll-end"),s("vScrollEnd"))):f&&s("vScrollEnd"),m>0?(t(3,c+=" h-scroll"),a>=_&&t(5,a=0),u.scrollLeft-a<=0&&(t(3,c+=" h-scroll-start"),s("hScrollStart")),u.scrollLeft+a>=m&&(t(3,c+=" h-scroll-end"),s("hScrollEnd"))):f&&s("hScrollEnd"))}function C(){d||(d=setTimeout(()=>{$(),d=null},150))}jt(()=>(C(),y=new MutationObserver(C),y.observe(u,{attributeFilter:["width","height"],childList:!0,subtree:!0}),()=>{y==null||y.disconnect(),clearTimeout(d)}));function M(D){ee[D?"unshift":"push"](()=>{u=D,t(2,u)})}return n.$$set=D=>{"class"in D&&t(0,o=D.class),"vThreshold"in D&&t(4,r=D.vThreshold),"hThreshold"in D&&t(5,a=D.hThreshold),"dispatchOnNoScroll"in D&&t(6,f=D.dispatchOnNoScroll),"$$scope"in D&&t(10,l=D.$$scope)},[o,C,u,c,r,a,f,S,T,$,l,i,M]}class Go extends ge{constructor(e){super(),_e(this,e,jv,qv,me,{class:0,vThreshold:4,hThreshold:5,dispatchOnNoScroll:6,resetVerticalScroll:7,resetHorizontalScroll:8,refresh:9,throttleRefresh:1})}get resetVerticalScroll(){return this.$$.ctx[7]}get resetHorizontalScroll(){return this.$$.ctx[8]}get refresh(){return this.$$.ctx[9]}get throttleRefresh(){return this.$$.ctx[1]}}function Hv(n){let e,t,i=(n[1]||"UNKN")+"",l,s,o,r,a;return{c(){e=b("div"),t=b("span"),l=Y(i),s=Y(" ("),o=Y(n[0]),r=Y(")"),p(t,"class","txt"),p(e,"class",a="label log-level-label level-"+n[0]+" svelte-ha6hme")},m(f,u){w(f,e,u),k(e,t),k(t,l),k(t,s),k(t,o),k(t,r)},p(f,[u]){u&2&&i!==(i=(f[1]||"UNKN")+"")&&re(l,i),u&1&&re(o,f[0]),u&1&&a!==(a="label log-level-label level-"+f[0]+" svelte-ha6hme")&&p(e,"class",a)},i:Q,o:Q,d(f){f&&v(e)}}}function zv(n,e,t){let i,{level:l}=e;return n.$$set=s=>{"level"in s&&t(0,l=s.level)},n.$$.update=()=>{var s;n.$$.dirty&1&&t(1,i=(s=W1.find(o=>o.level==l))==null?void 0:s.label)},[l,i]}class Q1 extends ge{constructor(e){super(),_e(this,e,zv,Hv,me,{level:0})}}function Vv(n){let e,t=n[0].replace("Z"," UTC")+"",i,l,s;return{c(){e=b("span"),i=Y(t),p(e,"class","txt-nowrap")},m(o,r){w(o,e,r),k(e,i),l||(s=we(Le.call(null,e,n[1])),l=!0)},p(o,[r]){r&1&&t!==(t=o[0].replace("Z"," UTC")+"")&&re(i,t)},i:Q,o:Q,d(o){o&&v(e),l=!1,s()}}}function Bv(n,e,t){let{date:i}=e;const l={get text(){return H.formatToLocalDate(i,"yyyy-MM-dd HH:mm:ss.SSS")+" Local"}};return n.$$set=s=>{"date"in s&&t(0,i=s.date)},[i,l]}class x1 extends ge{constructor(e){super(),_e(this,e,Bv,Vv,me,{date:0})}}function Xf(n,e,t){var o;const i=n.slice();i[31]=e[t];const l=((o=i[31].data)==null?void 0:o.type)=="request";i[32]=l;const s=t2(i[31]);return i[33]=s,i}function Qf(n,e,t){const i=n.slice();return i[36]=e[t],i}function Uv(n){let e,t,i,l,s,o,r;return{c(){e=b("div"),t=b("input"),l=O(),s=b("label"),p(t,"type","checkbox"),p(t,"id","checkbox_0"),t.disabled=i=!n[3].length,t.checked=n[8],p(s,"for","checkbox_0"),p(e,"class","form-field")},m(a,f){w(a,e,f),k(e,t),k(e,l),k(e,s),o||(r=K(t,"change",n[18]),o=!0)},p(a,f){f[0]&8&&i!==(i=!a[3].length)&&(t.disabled=i),f[0]&256&&(t.checked=a[8])},d(a){a&&v(e),o=!1,r()}}}function Wv(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function Yv(n){let e;return{c(){e=b("div"),e.innerHTML=' level',p(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function Kv(n){let e;return{c(){e=b("div"),e.innerHTML=' message',p(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function Jv(n){let e;return{c(){e=b("div"),e.innerHTML=` created`,p(e,"class","col-header-content")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function xf(n){let e;function t(s,o){return s[7]?Gv:Zv}let i=t(n),l=i(n);return{c(){l.c(),e=ye()},m(s,o){l.m(s,o),w(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&v(e),l.d(s)}}}function Zv(n){var r;let e,t,i,l,s,o=((r=n[0])==null?void 0:r.length)&&eu(n);return{c(){e=b("tr"),t=b("td"),i=b("h6"),i.textContent="No logs found.",l=O(),o&&o.c(),s=O(),p(t,"colspan","99"),p(t,"class","txt-center txt-hint p-xs")},m(a,f){w(a,e,f),k(e,t),k(t,i),k(t,l),o&&o.m(t,null),k(e,s)},p(a,f){var u;(u=a[0])!=null&&u.length?o?o.p(a,f):(o=eu(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&v(e),o&&o.d()}}}function Gv(n){let e;return{c(){e=b("tr"),e.innerHTML=' '},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function eu(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='Clear filters',p(e,"type","button"),p(e,"class","btn btn-hint btn-expanded m-t-sm")},m(l,s){w(l,e,s),t||(i=K(e,"click",n[25]),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function tu(n){let e,t=de(n[33]),i=[];for(let l=0;l',R=O(),p(s,"type","checkbox"),p(s,"id",o="checkbox_"+e[31].id),s.checked=r=e[4][e[31].id],p(f,"for",u="checkbox_"+e[31].id),p(l,"class","form-field"),p(i,"class","bulk-select-col min-width"),p(d,"class","col-type-text col-field-level min-width svelte-91v05h"),p(y,"class","txt-ellipsis"),p(g,"class","flex flex-gap-10"),p(_,"class","col-type-text col-field-message svelte-91v05h"),p(M,"class","col-type-date col-field-created"),p(L,"class","col-type-action min-width"),p(t,"tabindex","0"),p(t,"class","row-handle"),this.first=t},m(U,Z){w(U,t,Z),k(t,i),k(i,l),k(l,s),k(l,a),k(l,f),k(t,c),k(t,d),z(m,d,null),k(t,h),k(t,_),k(_,g),k(g,y),k(y,T),k(_,$),q&&q.m(_,null),k(t,C),k(t,M),z(D,M,null),k(t,I),k(t,L),k(t,R),F=!0,N||(P=[K(s,"change",j),K(l,"click",cn(e[17])),K(t,"click",W),K(t,"keydown",G)],N=!0)},p(U,Z){e=U,(!F||Z[0]&8&&o!==(o="checkbox_"+e[31].id))&&p(s,"id",o),(!F||Z[0]&24&&r!==(r=e[4][e[31].id]))&&(s.checked=r),(!F||Z[0]&8&&u!==(u="checkbox_"+e[31].id))&&p(f,"for",u);const le={};Z[0]&8&&(le.level=e[31].level),m.$set(le),(!F||Z[0]&8)&&S!==(S=e[31].message+"")&&re(T,S),e[33].length?q?q.p(e,Z):(q=tu(e),q.c(),q.m(_,null)):q&&(q.d(1),q=null);const ne={};Z[0]&8&&(ne.date=e[31].created),D.$set(ne)},i(U){F||(E(m.$$.fragment,U),E(D.$$.fragment,U),F=!0)},o(U){A(m.$$.fragment,U),A(D.$$.fragment,U),F=!1},d(U){U&&v(t),V(m),q&&q.d(),V(D),N=!1,ve(P)}}}function xv(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S=[],T=new Map,$;function C(G,U){return G[7]?Wv:Uv}let M=C(n),D=M(n);function I(G){n[19](G)}let L={disable:!0,class:"col-field-level min-width",name:"level",$$slots:{default:[Yv]},$$scope:{ctx:n}};n[1]!==void 0&&(L.sort=n[1]),o=new $n({props:L}),ee.push(()=>be(o,"sort",I));function R(G){n[20](G)}let F={disable:!0,class:"col-type-text col-field-message",name:"data",$$slots:{default:[Kv]},$$scope:{ctx:n}};n[1]!==void 0&&(F.sort=n[1]),f=new $n({props:F}),ee.push(()=>be(f,"sort",R));function N(G){n[21](G)}let P={disable:!0,class:"col-type-date col-field-created",name:"created",$$slots:{default:[Jv]},$$scope:{ctx:n}};n[1]!==void 0&&(P.sort=n[1]),d=new $n({props:P}),ee.push(()=>be(d,"sort",N));let j=de(n[3]);const q=G=>G[31].id;for(let G=0;Gr=!1)),o.$set(Z);const le={};U[1]&256&&(le.$$scope={dirty:U,ctx:G}),!u&&U[0]&2&&(u=!0,le.sort=G[1],ke(()=>u=!1)),f.$set(le);const ne={};U[1]&256&&(ne.$$scope={dirty:U,ctx:G}),!m&&U[0]&2&&(m=!0,ne.sort=G[1],ke(()=>m=!1)),d.$set(ne),U[0]&9369&&(j=de(G[3]),se(),S=at(S,U,q,1,G,j,T,y,Mt,iu,null,Xf),oe(),!j.length&&W?W.p(G,U):j.length?W&&(W.d(1),W=null):(W=xf(G),W.c(),W.m(y,null))),(!$||U[0]&128)&&x(e,"table-loading",G[7])},i(G){if(!$){E(o.$$.fragment,G),E(f.$$.fragment,G),E(d.$$.fragment,G);for(let U=0;ULoad more',p(t,"type","button"),p(t,"class","btn btn-lg btn-secondary btn-expanded"),x(t,"btn-loading",n[7]),x(t,"btn-disabled",n[7]),p(e,"class","block txt-center m-t-sm")},m(s,o){w(s,e,o),k(e,t),i||(l=K(t,"click",n[26]),i=!0)},p(s,o){o[0]&128&&x(t,"btn-loading",s[7]),o[0]&128&&x(t,"btn-disabled",s[7])},d(s){s&&v(e),i=!1,l()}}}function su(n){let e,t,i,l,s,o,r=n[5]===1?"log":"logs",a,f,u,c,d,m,h,_,g,y,S;return{c(){e=b("div"),t=b("div"),i=Y("Selected "),l=b("strong"),s=Y(n[5]),o=O(),a=Y(r),f=O(),u=b("button"),u.innerHTML='Reset',c=O(),d=b("div"),m=O(),h=b("button"),h.innerHTML='Download as JSON',p(t,"class","txt"),p(u,"type","button"),p(u,"class","btn btn-xs btn-transparent btn-outline p-l-5 p-r-5"),p(d,"class","flex-fill"),p(h,"type","button"),p(h,"class","btn btn-sm"),p(e,"class","bulkbar svelte-91v05h")},m(T,$){w(T,e,$),k(e,t),k(t,i),k(t,l),k(l,s),k(t,o),k(t,a),k(e,f),k(e,u),k(e,c),k(e,d),k(e,m),k(e,h),g=!0,y||(S=[K(u,"click",n[27]),K(h,"click",n[14])],y=!0)},p(T,$){(!g||$[0]&32)&&re(s,T[5]),(!g||$[0]&32)&&r!==(r=T[5]===1?"log":"logs")&&re(a,r)},i(T){g||(T&&Ye(()=>{g&&(_||(_=Ne(e,Pn,{duration:150,y:5},!0)),_.run(1))}),g=!0)},o(T){T&&(_||(_=Ne(e,Pn,{duration:150,y:5},!1)),_.run(0)),g=!1},d(T){T&&v(e),T&&_&&_.end(),y=!1,ve(S)}}}function e2(n){let e,t,i,l,s;e=new Go({props:{class:"table-wrapper",$$slots:{default:[xv]},$$scope:{ctx:n}}});let o=n[3].length&&n[9]&&lu(n),r=n[5]&&su(n);return{c(){B(e.$$.fragment),t=O(),o&&o.c(),i=O(),r&&r.c(),l=ye()},m(a,f){z(e,a,f),w(a,t,f),o&&o.m(a,f),w(a,i,f),r&&r.m(a,f),w(a,l,f),s=!0},p(a,f){const u={};f[0]&411|f[1]&256&&(u.$$scope={dirty:f,ctx:a}),e.$set(u),a[3].length&&a[9]?o?o.p(a,f):(o=lu(a),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null),a[5]?r?(r.p(a,f),f[0]&32&&E(r,1)):(r=su(a),r.c(),E(r,1),r.m(l.parentNode,l)):r&&(se(),A(r,1,1,()=>{r=null}),oe())},i(a){s||(E(e.$$.fragment,a),E(r),s=!0)},o(a){A(e.$$.fragment,a),A(r),s=!1},d(a){a&&(v(t),v(i),v(l)),V(e,a),o&&o.d(a),r&&r.d(a)}}}const ou=50,dr=/[-:\. ]/gi;function t2(n){let e=[];if(!n.data)return e;if(n.data.type=="request"){const t=["status","execTime","auth","userIp"];for(let i of t)typeof n.data[i]<"u"&&e.push({key:i});n.data.referer&&!n.data.referer.includes(window.location.host)&&e.push({key:"referer"})}else{const t=Object.keys(n.data);for(const i of t)i!="error"&&i!="details"&&e.length<6&&e.push({key:i})}return n.data.error&&e.push({key:"error",label:"label-danger"}),n.data.details&&e.push({key:"details",label:"label-warning"}),e}function n2(n,e,t){let i,l,s;const o=st();let{filter:r=""}=e,{presets:a=""}=e,{sort:f="-rowid"}=e,u=[],c=1,d=0,m=!1,h=0,_={};async function g(U=1,Z=!0){t(7,m=!0);const le=[a,H.normalizeLogsFilter(r)].filter(Boolean).join("&&");return fe.logs.getList(U,ou,{sort:f,skipTotal:1,filter:le}).then(async ne=>{var Ae;U<=1&&y();const he=H.toArray(ne.items);if(t(7,m=!1),t(6,c=ne.page),t(16,d=((Ae=ne.items)==null?void 0:Ae.length)||0),o("load",u.concat(he)),Z){const He=++h;for(;he.length&&h==He;){const Ge=he.splice(0,10);for(let xe of Ge)H.pushOrReplaceByKey(u,xe);t(3,u),await H.yieldToMain()}}else{for(let He of he)H.pushOrReplaceByKey(u,He);t(3,u)}}).catch(ne=>{ne!=null&&ne.isAbort||(t(7,m=!1),console.warn(ne),y(),fe.error(ne,!le||(ne==null?void 0:ne.status)!=400))})}function y(){t(3,u=[]),t(4,_={}),t(6,c=1),t(16,d=0)}function S(){s?T():$()}function T(){t(4,_={})}function $(){for(const U of u)t(4,_[U.id]=U,_);t(4,_)}function C(U){_[U.id]?delete _[U.id]:t(4,_[U.id]=U,_),t(4,_)}function M(){const U=Object.values(_).sort((ne,he)=>ne.createdhe.created?-1:0);if(!U.length)return;if(U.length==1)return H.downloadJson(U[0],"log_"+U[0].created.replaceAll(dr,"")+".json");const Z=U[0].created.replaceAll(dr,""),le=U[U.length-1].created.replaceAll(dr,"");return H.downloadJson(U,`${U.length}_logs_${le}_to_${Z}.json`)}function D(U){Te.call(this,n,U)}const I=()=>S();function L(U){f=U,t(1,f)}function R(U){f=U,t(1,f)}function F(U){f=U,t(1,f)}const N=U=>C(U),P=U=>o("select",U),j=(U,Z)=>{Z.code==="Enter"&&(Z.preventDefault(),o("select",U))},q=()=>t(0,r=""),W=()=>g(c+1),G=()=>T();return n.$$set=U=>{"filter"in U&&t(0,r=U.filter),"presets"in U&&t(15,a=U.presets),"sort"in U&&t(1,f=U.sort)},n.$$.update=()=>{n.$$.dirty[0]&32771&&(typeof f<"u"||typeof r<"u"||typeof a<"u")&&(y(),g(1)),n.$$.dirty[0]&65536&&t(9,i=d>=ou),n.$$.dirty[0]&16&&t(5,l=Object.keys(_).length),n.$$.dirty[0]&40&&t(8,s=u.length&&l===u.length)},[r,f,g,u,_,l,c,m,s,i,o,S,T,C,M,a,d,D,I,L,R,F,N,P,j,q,W,G]}class i2 extends ge{constructor(e){super(),_e(this,e,n2,e2,me,{filter:0,presets:15,sort:1,load:2},null,[-1,-1])}get load(){return this.$$.ctx[2]}}/*! * @kurkle/color v0.3.2 * https://github.com/kurkle/color#readme * (c) 2023 Jukka Kurkela @@ -34,7 +34,7 @@ var a0=Object.defineProperty;var f0=(n,e,t)=>e in n?a0(n,e,{enumerable:!0,config * (c) 2023 chartjs-adapter-luxon Contributors * Released under the MIT license */const fS={datetime:je.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:je.TIME_WITH_SECONDS,minute:je.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};Sb._date.override({_id:"luxon",_create:function(n){return je.fromMillis(n,this.options)},init(n){this.options.locale||(this.options.locale=n.locale)},formats:function(){return fS},parse:function(n,e){const t=this.options,i=typeof n;return n===null||i==="undefined"?null:(i==="number"?n=this._create(n):i==="string"?typeof e=="string"?n=je.fromFormat(n,e,t):n=je.fromISO(n,t):n instanceof Date?n=je.fromJSDate(n,t):i==="object"&&!(n instanceof je)&&(n=je.fromObject(n,t)),n.isValid?n.valueOf():null)},format:function(n,e){const t=this._create(n);return typeof e=="string"?t.toFormat(e):t.toLocaleString(e)},add:function(n,e,t){const i={};return i[t]=e,this._create(n).plus(i).valueOf()},diff:function(n,e,t){return this._create(n).diff(this._create(e)).as(t).valueOf()},startOf:function(n,e,t){if(e==="isoWeek"){t=Math.trunc(Math.min(Math.max(0,t),6));const i=this._create(n);return i.minus({days:(i.weekday-t+7)%7}).startOf("day").valueOf()}return e?this._create(n).startOf(e).valueOf():n},endOf:function(n,e){return this._create(n).endOf(e).valueOf()}});function Sc(n){let e,t,i;return{c(){e=b("div"),p(e,"class","chart-loader loader svelte-12c378i")},m(l,s){w(l,e,s),i=!0},i(l){i||(l&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150},!0)),t.run(1))}),i=!0)},o(l){l&&(t||(t=Ne(e,Ut,{duration:150},!1)),t.run(0)),i=!1},d(l){l&&v(e),l&&t&&t.end()}}}function uS(n){let e,t,i,l,s,o=n[1]==1?"log":"logs",r,a,f,u,c=n[2]&&Sc();return{c(){e=b("div"),t=b("div"),i=Y("Found "),l=Y(n[1]),s=O(),r=Y(o),a=O(),c&&c.c(),f=O(),u=b("canvas"),p(t,"class","total-logs entrance-right svelte-12c378i"),x(t,"hidden",n[2]),p(u,"class","chart-canvas svelte-12c378i"),p(e,"class","chart-wrapper svelte-12c378i"),x(e,"loading",n[2])},m(d,m){w(d,e,m),k(e,t),k(t,i),k(t,l),k(t,s),k(t,r),k(e,a),c&&c.m(e,null),k(e,f),k(e,u),n[8](u)},p(d,[m]){m&2&&re(l,d[1]),m&2&&o!==(o=d[1]==1?"log":"logs")&&re(r,o),m&4&&x(t,"hidden",d[2]),d[2]?c?m&4&&E(c,1):(c=Sc(),c.c(),E(c,1),c.m(e,f)):c&&(se(),A(c,1,1,()=>{c=null}),oe()),m&4&&x(e,"loading",d[2])},i(d){E(c)},o(d){A(c)},d(d){d&&v(e),c&&c.d(),n[8](null)}}}function cS(n,e,t){let{filter:i=""}=e,{presets:l=""}=e,s,o,r=[],a=0,f=!1;async function u(){t(2,f=!0);const m=[l,H.normalizeLogsFilter(i)].filter(Boolean).join("&&");return fe.logs.getStats({filter:m}).then(h=>{c(),h=H.toArray(h);for(let _ of h)r.push({x:new Date(_.date),y:_.total}),t(1,a+=_.total)}).catch(h=>{h!=null&&h.isAbort||(c(),console.warn(h),fe.error(h,!m||(h==null?void 0:h.status)!=400))}).finally(()=>{t(2,f=!1)})}function c(){t(7,r=[]),t(1,a=0)}jt(()=>(ci.register(Ti,mo,uo,la,ps,Z4,iS),t(6,o=new ci(s,{type:"line",data:{datasets:[{label:"Total requests",data:r,borderColor:"#e34562",pointBackgroundColor:"#e34562",backgroundColor:"rgb(239,69,101,0.05)",borderWidth:2,pointRadius:1,pointBorderWidth:0,fill:!0}]},options:{resizeDelay:250,maintainAspectRatio:!1,animation:!1,interaction:{intersect:!1,mode:"index"},scales:{y:{beginAtZero:!0,grid:{color:"#edf0f3"},border:{color:"#e4e9ec"},ticks:{precision:0,maxTicksLimit:4,autoSkip:!0,color:"#666f75"}},x:{type:"time",time:{unit:"hour",tooltipFormat:"DD h a"},grid:{color:m=>{var h;return(h=m.tick)!=null&&h.major?"#edf0f3":""}},color:"#e4e9ec",ticks:{maxTicksLimit:15,autoSkip:!0,maxRotation:0,major:{enabled:!0},color:m=>{var h;return(h=m.tick)!=null&&h.major?"#16161a":"#666f75"}}}},plugins:{legend:{display:!1}}}})),()=>o==null?void 0:o.destroy()));function d(m){ee[m?"unshift":"push"](()=>{s=m,t(0,s)})}return n.$$set=m=>{"filter"in m&&t(3,i=m.filter),"presets"in m&&t(4,l=m.presets)},n.$$.update=()=>{n.$$.dirty&24&&(typeof i<"u"||typeof l<"u")&&u(),n.$$.dirty&192&&typeof r<"u"&&o&&(t(6,o.data.datasets[0].data=r,o),o.update())},[s,a,f,i,l,u,o,r,d]}class dS extends ge{constructor(e){super(),_e(this,e,cS,uS,me,{filter:3,presets:4,load:5})}get load(){return this.$$.ctx[5]}}function pS(n){let e,t,i;return{c(){e=b("div"),t=b("code"),p(t,"class","svelte-10s5tkd"),p(e,"class",i="code-wrapper prism-light "+n[0]+" svelte-10s5tkd")},m(l,s){w(l,e,s),k(e,t),t.innerHTML=n[1]},p(l,[s]){s&2&&(t.innerHTML=l[1]),s&1&&i!==(i="code-wrapper prism-light "+l[0]+" svelte-10s5tkd")&&p(e,"class",i)},i:Q,o:Q,d(l){l&&v(e)}}}function mS(n,e,t){let{content:i=""}=e,{language:l="javascript"}=e,{class:s=""}=e,o="";function r(a){return a=typeof a=="string"?a:"",a=Prism.plugins.NormalizeWhitespace.normalize(a,{"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0}),Prism.highlight(a,Prism.languages[l]||Prism.languages.javascript,l)}return n.$$set=a=>{"content"in a&&t(2,i=a.content),"language"in a&&t(3,l=a.language),"class"in a&&t(0,s=a.class)},n.$$.update=()=>{n.$$.dirty&4&&typeof Prism<"u"&&i&&t(1,o=r(i))},[s,o,i,l]}class za extends ge{constructor(e){super(),_e(this,e,mS,pS,me,{content:2,language:3,class:0})}}const hS=n=>({}),$c=n=>({}),_S=n=>({}),Tc=n=>({});function Cc(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T=n[4]&&!n[2]&&Oc(n);const $=n[19].header,C=vt($,n,n[18],Tc);let M=n[4]&&n[2]&&Mc(n);const D=n[19].default,I=vt(D,n,n[18],null),L=n[19].footer,R=vt(L,n,n[18],$c);return{c(){e=b("div"),t=b("div"),l=O(),s=b("div"),o=b("div"),T&&T.c(),r=O(),C&&C.c(),a=O(),M&&M.c(),f=O(),u=b("div"),I&&I.c(),c=O(),d=b("div"),R&&R.c(),p(t,"class","overlay"),p(o,"class","overlay-panel-section panel-header"),p(u,"class","overlay-panel-section panel-content"),p(d,"class","overlay-panel-section panel-footer"),p(s,"class",m="overlay-panel "+n[1]+" "+n[8]),x(s,"popup",n[2]),p(e,"class","overlay-panel-container"),x(e,"padded",n[2]),x(e,"active",n[0])},m(F,N){w(F,e,N),k(e,t),k(e,l),k(e,s),k(s,o),T&&T.m(o,null),k(o,r),C&&C.m(o,null),k(o,a),M&&M.m(o,null),k(s,f),k(s,u),I&&I.m(u,null),n[21](u),k(s,c),k(s,d),R&&R.m(d,null),g=!0,y||(S=[K(t,"click",Be(n[20])),K(u,"scroll",n[22])],y=!0)},p(F,N){n=F,n[4]&&!n[2]?T?(T.p(n,N),N[0]&20&&E(T,1)):(T=Oc(n),T.c(),E(T,1),T.m(o,r)):T&&(se(),A(T,1,1,()=>{T=null}),oe()),C&&C.p&&(!g||N[0]&262144)&&St(C,$,n,n[18],g?wt($,n[18],N,_S):$t(n[18]),Tc),n[4]&&n[2]?M?M.p(n,N):(M=Mc(n),M.c(),M.m(o,null)):M&&(M.d(1),M=null),I&&I.p&&(!g||N[0]&262144)&&St(I,D,n,n[18],g?wt(D,n[18],N,null):$t(n[18]),null),R&&R.p&&(!g||N[0]&262144)&&St(R,L,n,n[18],g?wt(L,n[18],N,hS):$t(n[18]),$c),(!g||N[0]&258&&m!==(m="overlay-panel "+n[1]+" "+n[8]))&&p(s,"class",m),(!g||N[0]&262)&&x(s,"popup",n[2]),(!g||N[0]&4)&&x(e,"padded",n[2]),(!g||N[0]&1)&&x(e,"active",n[0])},i(F){g||(F&&Ye(()=>{g&&(i||(i=Ne(t,rs,{duration:wi,opacity:0},!0)),i.run(1))}),E(T),E(C,F),E(I,F),E(R,F),F&&Ye(()=>{g&&(_&&_.end(1),h=Fg(s,Pn,n[2]?{duration:wi,y:-10}:{duration:wi,x:50}),h.start())}),g=!0)},o(F){F&&(i||(i=Ne(t,rs,{duration:wi,opacity:0},!1)),i.run(0)),A(T),A(C,F),A(I,F),A(R,F),h&&h.invalidate(),F&&(_=ca(s,Pn,n[2]?{duration:wi,y:10}:{duration:wi,x:50})),g=!1},d(F){F&&v(e),F&&i&&i.end(),T&&T.d(),C&&C.d(F),M&&M.d(),I&&I.d(F),n[21](null),R&&R.d(F),F&&_&&_.end(),y=!1,ve(S)}}}function Oc(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","overlay-close")},m(o,r){w(o,e,r),i=!0,l||(s=K(e,"click",Be(n[5])),l=!0)},p(o,r){n=o},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,rs,{duration:wi},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,rs,{duration:wi},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function Mc(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-transparent btn-close m-l-auto")},m(l,s){w(l,e,s),t||(i=K(e,"click",Be(n[5])),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function gS(n){let e,t,i,l,s=n[0]&&Cc(n);return{c(){e=b("div"),s&&s.c(),p(e,"class","overlay-panel-wrapper"),p(e,"tabindex","-1")},m(o,r){w(o,e,r),s&&s.m(e,null),n[23](e),t=!0,i||(l=[K(window,"resize",n[10]),K(window,"keydown",n[9])],i=!0)},p(o,r){o[0]?s?(s.p(o,r),r[0]&1&&E(s,1)):(s=Cc(o),s.c(),E(s,1),s.m(e,null)):s&&(se(),A(s,1,1,()=>{s=null}),oe())},i(o){t||(E(s),t=!0)},o(o){A(s),t=!1},d(o){o&&v(e),s&&s.d(),n[23](null),i=!1,ve(l)}}}let Hi,Sr=[];function qb(){return Hi=Hi||document.querySelector(".overlays"),Hi||(Hi=document.createElement("div"),Hi.classList.add("overlays"),document.body.appendChild(Hi)),Hi}let wi=150;function Dc(){return 1e3+qb().querySelectorAll(".overlay-panel-container.active").length}function bS(n,e,t){let{$$slots:i={},$$scope:l}=e,{class:s=""}=e,{active:o=!1}=e,{popup:r=!1}=e,{overlayClose:a=!0}=e,{btnClose:f=!0}=e,{escClose:u=!0}=e,{beforeOpen:c=void 0}=e,{beforeHide:d=void 0}=e;const m=st(),h="op_"+H.randomString(10);let _,g,y,S,T="",$=o;function C(){typeof c=="function"&&c()===!1||t(0,o=!0)}function M(){typeof d=="function"&&d()===!1||t(0,o=!1)}function D(){return o}async function I(Z){t(17,$=Z),Z?(y=document.activeElement,m("show"),_==null||_.focus()):(clearTimeout(S),m("hide"),y==null||y.focus()),await Xt(),L()}function L(){_&&(o?t(6,_.style.zIndex=Dc(),_):t(6,_.style="",_))}function R(){H.pushUnique(Sr,h),document.body.classList.add("overlay-active")}function F(){H.removeByValue(Sr,h),Sr.length||document.body.classList.remove("overlay-active")}function N(Z){o&&u&&Z.code=="Escape"&&!H.isInput(Z.target)&&_&&_.style.zIndex==Dc()&&(Z.preventDefault(),M())}function P(Z){o&&j(g)}function j(Z,le){le&&t(8,T=""),!(!Z||S)&&(S=setTimeout(()=>{if(clearTimeout(S),S=null,!Z)return;if(Z.scrollHeight-Z.offsetHeight>0)t(8,T="scrollable");else{t(8,T="");return}Z.scrollTop==0?t(8,T+=" scroll-top-reached"):Z.scrollTop+Z.offsetHeight==Z.scrollHeight&&t(8,T+=" scroll-bottom-reached")},100))}jt(()=>(qb().appendChild(_),()=>{var Z;clearTimeout(S),F(),(Z=_==null?void 0:_.classList)==null||Z.add("hidden"),setTimeout(()=>{_==null||_.remove()},0)}));const q=()=>a?M():!0;function W(Z){ee[Z?"unshift":"push"](()=>{g=Z,t(7,g)})}const G=Z=>j(Z.target);function U(Z){ee[Z?"unshift":"push"](()=>{_=Z,t(6,_)})}return n.$$set=Z=>{"class"in Z&&t(1,s=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,f=Z.btnClose),"escClose"in Z&&t(12,u=Z.escClose),"beforeOpen"in Z&&t(13,c=Z.beforeOpen),"beforeHide"in Z&&t(14,d=Z.beforeHide),"$$scope"in Z&&t(18,l=Z.$$scope)},n.$$.update=()=>{n.$$.dirty[0]&131073&&$!=o&&I(o),n.$$.dirty[0]&128&&j(g,!0),n.$$.dirty[0]&64&&_&&L(),n.$$.dirty[0]&1&&(o?R():F())},[o,s,r,a,f,M,_,g,T,N,P,j,u,c,d,C,D,$,l,i,q,W,G,U]}class Zt extends ge{constructor(e){super(),_e(this,e,bS,gS,me,{class:1,active:0,popup:2,overlayClose:3,btnClose:4,escClose:12,beforeOpen:13,beforeHide:14,show:15,hide:5,isActive:16},null,[-1,-1])}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[5]}get isActive(){return this.$$.ctx[16]}}function kS(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class",t=n[3]?n[2]:n[1]),p(e,"aria-label","Copy to clipboard")},m(o,r){w(o,e,r),l||(s=[we(i=Le.call(null,e,n[3]?void 0:n[0])),K(e,"click",cn(n[4]))],l=!0)},p(o,[r]){r&14&&t!==(t=o[3]?o[2]:o[1])&&p(e,"class",t),i&&Tt(i.update)&&r&9&&i.update.call(null,o[3]?void 0:o[0])},i:Q,o:Q,d(o){o&&v(e),l=!1,ve(s)}}}function yS(n,e,t){let{value:i=""}=e,{tooltip:l="Copy"}=e,{idleClasses:s="ri-file-copy-line txt-sm link-hint"}=e,{successClasses:o="ri-check-line txt-sm txt-success"}=e,{successDuration:r=500}=e,a;function f(){i&&(H.copyToClipboard(i),clearTimeout(a),t(3,a=setTimeout(()=>{clearTimeout(a),t(3,a=null)},r)))}return jt(()=>()=>{a&&clearTimeout(a)}),n.$$set=u=>{"value"in u&&t(5,i=u.value),"tooltip"in u&&t(0,l=u.tooltip),"idleClasses"in u&&t(1,s=u.idleClasses),"successClasses"in u&&t(2,o=u.successClasses),"successDuration"in u&&t(6,r=u.successDuration)},[l,s,o,a,f,i,r]}class sl extends ge{constructor(e){super(),_e(this,e,yS,kS,me,{value:5,tooltip:0,idleClasses:1,successClasses:2,successDuration:6})}}function Ec(n,e,t){const i=n.slice();i[16]=e[t];const l=i[1].data[i[16]];i[17]=l;const s=i[17]!==null&&typeof i[17]=="object";return i[18]=s,i}function vS(n){let e,t,i,l,s,o,r,a,f,u,c=n[1].id+"",d,m,h,_,g,y,S,T,$,C,M,D,I,L,R,F;a=new sl({props:{value:n[1].id}}),S=new Q1({props:{level:n[1].level}}),I=new x1({props:{date:n[1].created}});let N=!n[4]&&Ic(n),P=de(n[5](n[1].data)),j=[];for(let W=0;WA(j[W],1,1,()=>{j[W]=null});return{c(){e=b("table"),t=b("tbody"),i=b("tr"),l=b("td"),l.textContent="id",s=O(),o=b("td"),r=b("div"),B(a.$$.fragment),f=O(),u=b("div"),d=Y(c),m=O(),h=b("tr"),_=b("td"),_.textContent="level",g=O(),y=b("td"),B(S.$$.fragment),T=O(),$=b("tr"),C=b("td"),C.textContent="created",M=O(),D=b("td"),B(I.$$.fragment),L=O(),N&&N.c(),R=O();for(let W=0;W',p(e,"class","block txt-center")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function Ic(n){let e,t,i,l;function s(a,f){return a[1].message?$S:SS}let o=s(n),r=o(n);return{c(){e=b("tr"),t=b("td"),t.textContent="message",i=O(),l=b("td"),r.c(),p(t,"class","min-width txt-hint txt-bold")},m(a,f){w(a,e,f),k(e,t),k(e,i),k(e,l),r.m(l,null)},p(a,f){o===(o=s(a))&&r?r.p(a,f):(r.d(1),r=o(a),r&&(r.c(),r.m(l,null)))},d(a){a&&v(e),r.d()}}}function SS(n){let e;return{c(){e=b("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function $S(n){let e,t=n[1].message+"",i;return{c(){e=b("span"),i=Y(t),p(e,"class","txt")},m(l,s){w(l,e,s),k(e,i)},p(l,s){s&2&&t!==(t=l[1].message+"")&&re(i,t)},d(l){l&&v(e)}}}function TS(n){let e,t=n[17]+"",i,l=n[4]&&n[16]=="execTime"?"ms":"",s;return{c(){e=b("span"),i=Y(t),s=Y(l),p(e,"class","txt")},m(o,r){w(o,e,r),k(e,i),k(e,s)},p(o,r){r&2&&t!==(t=o[17]+"")&&re(i,t),r&18&&l!==(l=o[4]&&o[16]=="execTime"?"ms":"")&&re(s,l)},i:Q,o:Q,d(o){o&&v(e)}}}function CS(n){let e,t;return e=new za({props:{content:n[17],language:"html"}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.content=i[17]),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function OS(n){let e,t=n[17]+"",i;return{c(){e=b("span"),i=Y(t),p(e,"class","label label-danger log-error-label svelte-144j2mz")},m(l,s){w(l,e,s),k(e,i)},p(l,s){s&2&&t!==(t=l[17]+"")&&re(i,t)},i:Q,o:Q,d(l){l&&v(e)}}}function MS(n){let e,t;return e=new za({props:{content:JSON.stringify(n[17],null,2)}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.content=JSON.stringify(i[17],null,2)),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function DS(n){let e;return{c(){e=b("span"),e.textContent="N/A",p(e,"class","txt txt-hint")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function Ac(n){let e,t,i,l=n[16]+"",s,o,r,a,f,u,c,d;const m=[DS,MS,OS,CS,TS],h=[];function _(g,y){return y&2&&(a=null),a==null&&(a=!!H.isEmpty(g[17])),a?0:g[18]?1:g[16]=="error"?2:g[16]=="details"?3:4}return f=_(n,-1),u=h[f]=m[f](n),{c(){e=b("tr"),t=b("td"),i=Y("data."),s=Y(l),o=O(),r=b("td"),u.c(),c=O(),p(t,"class","min-width txt-hint txt-bold"),x(t,"v-align-top",n[18])},m(g,y){w(g,e,y),k(e,t),k(t,i),k(t,s),k(e,o),k(e,r),h[f].m(r,null),k(e,c),d=!0},p(g,y){(!d||y&2)&&l!==(l=g[16]+"")&&re(s,l),(!d||y&34)&&x(t,"v-align-top",g[18]);let S=f;f=_(g,y),f===S?h[f].p(g,y):(se(),A(h[S],1,1,()=>{h[S]=null}),oe(),u=h[f],u?u.p(g,y):(u=h[f]=m[f](g),u.c()),E(u,1),u.m(r,null))},i(g){d||(E(u),d=!0)},o(g){A(u),d=!1},d(g){g&&v(e),h[f].d()}}}function ES(n){let e,t,i,l;const s=[wS,vS],o=[];function r(a,f){var u;return a[3]?0:(u=a[1])!=null&&u.id?1:-1}return~(e=r(n))&&(t=o[e]=s[e](n)),{c(){t&&t.c(),i=ye()},m(a,f){~e&&o[e].m(a,f),w(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?~e&&o[e].p(a,f):(t&&(se(),A(o[u],1,1,()=>{o[u]=null}),oe()),~e?(t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),E(t,1),t.m(i.parentNode,i)):t=null)},i(a){l||(E(t),l=!0)},o(a){A(t),l=!1},d(a){a&&v(i),~e&&o[e].d(a)}}}function IS(n){let e;return{c(){e=b("h4"),e.textContent="Request log"},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function AS(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),e.innerHTML='Close',t=O(),i=b("button"),l=b("i"),s=O(),o=b("span"),o.textContent="Download as JSON",p(e,"type","button"),p(e,"class","btn btn-transparent"),p(l,"class","ri-download-line"),p(o,"class","txt"),p(i,"type","button"),p(i,"class","btn btn-primary"),i.disabled=n[3]},m(f,u){w(f,e,u),w(f,t,u),w(f,i,u),k(i,l),k(i,s),k(i,o),r||(a=[K(e,"click",n[9]),K(i,"click",n[10])],r=!0)},p(f,u){u&8&&(i.disabled=f[3])},d(f){f&&(v(e),v(t),v(i)),r=!1,ve(a)}}}function LS(n){let e,t,i={class:"overlay-panel-lg log-panel",$$slots:{footer:[AS],header:[IS],default:[ES]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[11](e),e.$on("hide",n[7]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&2097178&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[11](null),V(e,l)}}}const Lc="log_view";function NS(n,e,t){let i;const l=st();let s,o={},r=!1;function a(T){return u(T).then($=>{t(1,o=$),h()}),s==null?void 0:s.show()}function f(){return fe.cancelRequest(Lc),s==null?void 0:s.hide()}async function u(T){if(T&&typeof T!="string")return t(3,r=!1),T;t(3,r=!0);let $={};try{$=await fe.logs.getOne(T,{requestKey:Lc})}catch(C){C.isAbort||(f(),console.warn("resolveModel:",C),ii(`Unable to load log with id "${T}"`))}return t(3,r=!1),$}const c=["execTime","type","auth","status","method","url","referer","remoteIp","userIp","userAgent","error","details"];function d(T){if(!T)return[];let $=[];for(let M of c)typeof T[M]<"u"&&$.push(M);const C=Object.keys(T);for(let M of C)$.includes(M)||$.push(M);return $}function m(){H.downloadJson(o,"log_"+o.created.replaceAll(/[-:\. ]/gi,"")+".json")}function h(){l("show",o)}function _(){l("hide",o),t(1,o={})}const g=()=>f(),y=()=>m();function S(T){ee[T?"unshift":"push"](()=>{s=T,t(2,s)})}return n.$$.update=()=>{var T;n.$$.dirty&2&&t(4,i=((T=o.data)==null?void 0:T.type)=="request")},[f,o,s,r,i,d,m,_,a,g,y,S]}class PS extends ge{constructor(e){super(),_e(this,e,NS,LS,me,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function FS(n,e,t){const i=n.slice();return i[1]=e[t],i}function RS(n){let e;return{c(){e=b("code"),e.textContent=`${n[1].level}:${n[1].label}`,p(e,"class","txt-xs")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function qS(n){let e,t,i,l=de(W1),s=[];for(let o=0;o{"class"in l&&t(0,i=l.class)},[i]}class jb extends ge{constructor(e){super(),_e(this,e,jS,qS,me,{class:0})}}function HS(n){let e,t,i,l,s,o,r,a,f;return t=new pe({props:{class:"form-field required",name:"logs.maxDays",$$slots:{default:[VS,({uniqueId:u})=>({22:u}),({uniqueId:u})=>u?4194304:0]},$$scope:{ctx:n}}}),l=new pe({props:{class:"form-field",name:"logs.minLevel",$$slots:{default:[BS,({uniqueId:u})=>({22:u}),({uniqueId:u})=>u?4194304:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field form-field-toggle",name:"logs.logIp",$$slots:{default:[US,({uniqueId:u})=>({22:u}),({uniqueId:u})=>u?4194304:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),B(t.$$.fragment),i=O(),B(l.$$.fragment),s=O(),B(o.$$.fragment),p(e,"id",n[6]),p(e,"class","grid"),p(e,"autocomplete","off")},m(u,c){w(u,e,c),z(t,e,null),k(e,i),z(l,e,null),k(e,s),z(o,e,null),r=!0,a||(f=K(e,"submit",Be(n[7])),a=!0)},p(u,c){const d={};c&12582914&&(d.$$scope={dirty:c,ctx:u}),t.$set(d);const m={};c&12582914&&(m.$$scope={dirty:c,ctx:u}),l.$set(m);const h={};c&12582914&&(h.$$scope={dirty:c,ctx:u}),o.$set(h)},i(u){r||(E(t.$$.fragment,u),E(l.$$.fragment,u),E(o.$$.fragment,u),r=!0)},o(u){A(t.$$.fragment,u),A(l.$$.fragment,u),A(o.$$.fragment,u),r=!1},d(u){u&&v(e),V(t),V(l),V(o),a=!1,f()}}}function zS(n){let e;return{c(){e=b("div"),e.innerHTML='
',p(e,"class","block txt-center")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function VS(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=Y("Max days retention"),l=O(),s=b("input"),r=O(),a=b("div"),a.innerHTML="Set to 0 to disable logs persistence.",p(e,"for",i=n[22]),p(s,"type","number"),p(s,"id",o=n[22]),s.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),k(e,t),w(c,l,d),w(c,s,d),ae(s,n[1].logs.maxDays),w(c,r,d),w(c,a,d),f||(u=K(s,"input",n[11]),f=!0)},p(c,d){d&4194304&&i!==(i=c[22])&&p(e,"for",i),d&4194304&&o!==(o=c[22])&&p(s,"id",o),d&2&<(s.value)!==c[1].logs.maxDays&&ae(s,c[1].logs.maxDays)},d(c){c&&(v(e),v(l),v(s),v(r),v(a)),f=!1,u()}}}function BS(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;return u=new jb({}),{c(){e=b("label"),t=Y("Min log level"),l=O(),s=b("input"),o=O(),r=b("div"),a=b("p"),a.textContent="Logs with level below the minimum will be ignored.",f=O(),B(u.$$.fragment),p(e,"for",i=n[22]),p(s,"type","number"),s.required=!0,p(s,"min","-100"),p(s,"max","100"),p(r,"class","help-block")},m(h,_){w(h,e,_),k(e,t),w(h,l,_),w(h,s,_),ae(s,n[1].logs.minLevel),w(h,o,_),w(h,r,_),k(r,a),k(r,f),z(u,r,null),c=!0,d||(m=K(s,"input",n[12]),d=!0)},p(h,_){(!c||_&4194304&&i!==(i=h[22]))&&p(e,"for",i),_&2&<(s.value)!==h[1].logs.minLevel&&ae(s,h[1].logs.minLevel)},i(h){c||(E(u.$$.fragment,h),c=!0)},o(h){A(u.$$.fragment,h),c=!1},d(h){h&&(v(e),v(l),v(s),v(o),v(r)),V(u),d=!1,m()}}}function US(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Enable IP logging"),p(e,"type","checkbox"),p(e,"id",t=n[22]),p(l,"for",o=n[22])},m(f,u){w(f,e,u),e.checked=n[1].logs.logIp,w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[13]),r=!0)},p(f,u){u&4194304&&t!==(t=f[22])&&p(e,"id",t),u&2&&(e.checked=f[1].logs.logIp),u&4194304&&o!==(o=f[22])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function WS(n){let e,t,i,l;const s=[zS,HS],o=[];function r(a,f){return a[4]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ye()},m(a,f){o[e].m(a,f),w(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),A(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){l||(E(t),l=!0)},o(a){A(t),l=!1},d(a){a&&v(i),o[e].d(a)}}}function YS(n){let e;return{c(){e=b("h4"),e.textContent="Logs settings"},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function KS(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=O(),l=b("button"),s=b("span"),s.textContent="Save changes",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[3],p(s,"class","txt"),p(l,"type","submit"),p(l,"form",n[6]),p(l,"class","btn btn-expanded"),l.disabled=o=!n[5]||n[3],x(l,"btn-loading",n[3])},m(f,u){w(f,e,u),k(e,t),w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"click",n[0]),r=!0)},p(f,u){u&8&&(e.disabled=f[3]),u&40&&o!==(o=!f[5]||f[3])&&(l.disabled=o),u&8&&x(l,"btn-loading",f[3])},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function JS(n){let e,t,i={popup:!0,class:"admin-panel",beforeHide:n[14],$$slots:{footer:[KS],header:[YS],default:[WS]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[15](e),e.$on("hide",n[16]),e.$on("show",n[17]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&8&&(o.beforeHide=l[14]),s&8388666&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[15](null),V(e,l)}}}function ZS(n,e,t){let i,l;const s=st(),o="logs_settings_"+H.randomString(3);let r,a=!1,f=!1,u={},c={};function d(){return h(),_(),r==null?void 0:r.show()}function m(){return r==null?void 0:r.hide()}function h(){Jt(),t(9,u={}),t(1,c=JSON.parse(JSON.stringify(u||{})))}async function _(){t(4,f=!0);try{const L=await fe.settings.getAll()||{};y(L)}catch(L){fe.error(L)}t(4,f=!1)}async function g(){if(l){t(3,a=!0);try{const L=await fe.settings.update(H.filterRedactedProps(c));y(L),t(3,a=!1),m(),At("Successfully saved logs settings."),s("save",L)}catch(L){t(3,a=!1),fe.error(L)}}}function y(L={}){t(1,c={logs:(L==null?void 0:L.logs)||{}}),t(9,u=JSON.parse(JSON.stringify(c)))}function S(){c.logs.maxDays=lt(this.value),t(1,c)}function T(){c.logs.minLevel=lt(this.value),t(1,c)}function $(){c.logs.logIp=this.checked,t(1,c)}const C=()=>!a;function M(L){ee[L?"unshift":"push"](()=>{r=L,t(2,r)})}function D(L){Te.call(this,n,L)}function I(L){Te.call(this,n,L)}return n.$$.update=()=>{n.$$.dirty&512&&t(10,i=JSON.stringify(u)),n.$$.dirty&1026&&t(5,l=i!=JSON.stringify(c))},[m,c,r,a,f,l,o,g,d,u,i,S,T,$,C,M,D,I]}class GS extends ge{constructor(e){super(),_e(this,e,ZS,JS,me,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function XS(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Include requests by admins"),p(e,"type","checkbox"),p(e,"id",t=n[22]),p(l,"for",o=n[22])},m(f,u){w(f,e,u),e.checked=n[2],w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[11]),r=!0)},p(f,u){u&4194304&&t!==(t=f[22])&&p(e,"id",t),u&4&&(e.checked=f[2]),u&4194304&&o!==(o=f[22])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function Nc(n){let e,t;return e=new dS({props:{filter:n[1],presets:n[5]}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.filter=i[1]),l&32&&(s.presets=i[5]),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Pc(n){let e,t,i;function l(o){n[13](o)}let s={presets:n[5]};return n[1]!==void 0&&(s.filter=n[1]),e=new i2({props:s}),ee.push(()=>be(e,"filter",l)),e.$on("select",n[14]),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&32&&(a.presets=o[5]),!t&&r&2&&(t=!0,a.filter=o[1],ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function QS(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$=n[4],C,M=n[4],D,I,L,R;f=new Zo({}),f.$on("refresh",n[10]),h=new pe({props:{class:"form-field form-field-toggle m-0",$$slots:{default:[XS,({uniqueId:P})=>({22:P}),({uniqueId:P})=>P?4194304:0]},$$scope:{ctx:n}}}),g=new $s({props:{value:n[1],placeholder:"Search term or filter like `level > 0 && data.auth = 'guest'`",extraAutocompleteKeys:["level","message","data."]}}),g.$on("submit",n[12]),S=new jb({props:{class:"block txt-sm txt-hint m-t-xs m-b-base"}});let F=Nc(n),N=Pc(n);return{c(){e=b("div"),t=b("header"),i=b("nav"),l=b("div"),s=Y(n[6]),o=O(),r=b("button"),r.innerHTML='',a=O(),B(f.$$.fragment),u=O(),c=b("div"),d=O(),m=b("div"),B(h.$$.fragment),_=O(),B(g.$$.fragment),y=O(),B(S.$$.fragment),T=O(),F.c(),C=O(),N.c(),D=ye(),p(l,"class","breadcrumb-item"),p(i,"class","breadcrumbs"),p(r,"type","button"),p(r,"aria-label","Logs settings"),p(r,"class","btn btn-transparent btn-circle"),p(c,"class","flex-fill"),p(m,"class","inline-flex"),p(t,"class","page-header"),p(e,"class","page-header-wrapper m-b-0")},m(P,j){w(P,e,j),k(e,t),k(t,i),k(i,l),k(l,s),k(t,o),k(t,r),k(t,a),z(f,t,null),k(t,u),k(t,c),k(t,d),k(t,m),z(h,m,null),k(e,_),z(g,e,null),k(e,y),z(S,e,null),k(e,T),F.m(e,null),w(P,C,j),N.m(P,j),w(P,D,j),I=!0,L||(R=[we(Le.call(null,r,{text:"Logs settings",position:"right"})),K(r,"click",n[9])],L=!0)},p(P,j){(!I||j&64)&&re(s,P[6]);const q={};j&12582916&&(q.$$scope={dirty:j,ctx:P}),h.$set(q);const W={};j&2&&(W.value=P[1]),g.$set(W),j&16&&me($,$=P[4])?(se(),A(F,1,1,Q),oe(),F=Nc(P),F.c(),E(F,1),F.m(e,null)):F.p(P,j),j&16&&me(M,M=P[4])?(se(),A(N,1,1,Q),oe(),N=Pc(P),N.c(),E(N,1),N.m(D.parentNode,D)):N.p(P,j)},i(P){I||(E(f.$$.fragment,P),E(h.$$.fragment,P),E(g.$$.fragment,P),E(S.$$.fragment,P),E(F),E(N),I=!0)},o(P){A(f.$$.fragment,P),A(h.$$.fragment,P),A(g.$$.fragment,P),A(S.$$.fragment,P),A(F),A(N),I=!1},d(P){P&&(v(e),v(C),v(D)),V(f),V(h),V(g),V(S),F.d(P),N.d(P),L=!1,ve(R)}}}function xS(n){let e,t,i,l,s,o;e=new kn({props:{$$slots:{default:[QS]},$$scope:{ctx:n}}});let r={};i=new PS({props:r}),n[15](i),i.$on("show",n[16]),i.$on("hide",n[17]);let a={};return s=new GS({props:a}),n[18](s),s.$on("save",n[7]),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment),l=O(),B(s.$$.fragment)},m(f,u){z(e,f,u),w(f,t,u),z(i,f,u),w(f,l,u),z(s,f,u),o=!0},p(f,[u]){const c={};u&8388735&&(c.$$scope={dirty:u,ctx:f}),e.$set(c);const d={};i.$set(d);const m={};s.$set(m)},i(f){o||(E(e.$$.fragment,f),E(i.$$.fragment,f),E(s.$$.fragment,f),o=!0)},o(f){A(e.$$.fragment,f),A(i.$$.fragment,f),A(s.$$.fragment,f),o=!1},d(f){f&&(v(t),v(l)),V(e,f),n[15](null),V(i,f),n[18](null),V(s,f)}}}const xs="logId",Fc="adminRequests",Rc="adminLogRequests";function e$(n,e,t){var L;let i,l,s;Ue(n,jo,R=>t(19,l=R)),Ue(n,Dt,R=>t(6,s=R)),xt(Dt,s="Logs",s);const o=new URLSearchParams(l);let r,a,f=1,u=o.get("filter")||"",c=(o.get(Fc)||((L=window.localStorage)==null?void 0:L.getItem(Rc)))<<0,d=c;function m(){t(4,f++,f)}function h(R={}){let F={};F.filter=u||null,F[Fc]=c<<0||null,H.replaceHashQueryParams(Object.assign(F,R))}const _=()=>a==null?void 0:a.show(),g=()=>m();function y(){c=this.checked,t(2,c)}const S=R=>t(1,u=R.detail);function T(R){u=R,t(1,u)}const $=R=>r==null?void 0:r.show(R==null?void 0:R.detail);function C(R){ee[R?"unshift":"push"](()=>{r=R,t(0,r)})}const M=R=>{var N;let F={};F[xs]=((N=R.detail)==null?void 0:N.id)||null,H.replaceHashQueryParams(F)},D=()=>{let R={};R[xs]=null,H.replaceHashQueryParams(R)};function I(R){ee[R?"unshift":"push"](()=>{a=R,t(3,a)})}return n.$$.update=()=>{var R;n.$$.dirty&1&&o.get(xs)&&r&&r.show(o.get(xs)),n.$$.dirty&4&&t(5,i=c?"":'data.auth!="admin"'),n.$$.dirty&260&&d!=c&&(t(8,d=c),(R=window.localStorage)==null||R.setItem(Rc,c<<0),h()),n.$$.dirty&2&&typeof u<"u"&&h()},[r,u,c,a,f,i,s,m,d,_,g,y,S,T,$,C,M,D,I]}class t$ extends ge{constructor(e){super(),_e(this,e,e$,xS,me,{})}}function n$(n){let e,t,i;return{c(){e=b("span"),p(e,"class","dragline svelte-1g2t3dj"),x(e,"dragging",n[1])},m(l,s){w(l,e,s),n[4](e),t||(i=[K(e,"mousedown",n[5]),K(e,"touchstart",n[2])],t=!0)},p(l,[s]){s&2&&x(e,"dragging",l[1])},i:Q,o:Q,d(l){l&&v(e),n[4](null),t=!1,ve(i)}}}function i$(n,e,t){const i=st();let{tolerance:l=0}=e,s,o=0,r=0,a=0,f=0,u=!1;function c(g){g.stopPropagation(),o=g.clientX,r=g.clientY,a=g.clientX-s.offsetLeft,f=g.clientY-s.offsetTop,document.addEventListener("touchmove",m),document.addEventListener("mousemove",m),document.addEventListener("touchend",d),document.addEventListener("mouseup",d)}function d(g){u&&(g.preventDefault(),t(1,u=!1),s.classList.remove("no-pointer-events"),i("dragstop",{event:g,elem:s})),document.removeEventListener("touchmove",m),document.removeEventListener("mousemove",m),document.removeEventListener("touchend",d),document.removeEventListener("mouseup",d)}function m(g){let y=g.clientX-o,S=g.clientY-r,T=g.clientX-a,$=g.clientY-f;!u&&Math.abs(T-s.offsetLeft){s=g,t(0,s)})}const _=g=>{g.button==0&&c(g)};return n.$$set=g=>{"tolerance"in g&&t(3,l=g.tolerance)},[s,u,c,l,h,_]}class l$ extends ge{constructor(e){super(),_e(this,e,i$,n$,me,{tolerance:3})}}function s$(n){let e,t,i,l,s;const o=n[5].default,r=vt(o,n,n[4],null);return l=new l$({}),l.$on("dragstart",n[7]),l.$on("dragging",n[8]),l.$on("dragstop",n[9]),{c(){e=b("aside"),r&&r.c(),i=O(),B(l.$$.fragment),p(e,"class",t="page-sidebar "+n[0])},m(a,f){w(a,e,f),r&&r.m(e,null),n[6](e),w(a,i,f),z(l,a,f),s=!0},p(a,[f]){r&&r.p&&(!s||f&16)&&St(r,o,a,a[4],s?wt(o,a[4],f,null):$t(a[4]),null),(!s||f&1&&t!==(t="page-sidebar "+a[0]))&&p(e,"class",t)},i(a){s||(E(r,a),E(l.$$.fragment,a),s=!0)},o(a){A(r,a),A(l.$$.fragment,a),s=!1},d(a){a&&(v(e),v(i)),r&&r.d(a),n[6](null),V(l,a)}}}const qc="@adminSidebarWidth";function o$(n,e,t){let{$$slots:i={},$$scope:l}=e,{class:s=""}=e,o,r,a=localStorage.getItem(qc)||null;function f(m){ee[m?"unshift":"push"](()=>{o=m,t(1,o),t(2,a)})}const u=()=>{t(3,r=o.offsetWidth)},c=m=>{t(2,a=r+m.detail.diffX+"px")},d=()=>{H.triggerResize()};return n.$$set=m=>{"class"in m&&t(0,s=m.class),"$$scope"in m&&t(4,l=m.$$scope)},n.$$.update=()=>{n.$$.dirty&6&&a&&o&&(t(1,o.style.width=a,o),localStorage.setItem(qc,a))},[s,o,a,r,l,i,f,u,c,d]}class Hb extends ge{constructor(e){super(),_e(this,e,o$,s$,me,{class:0})}}const Va=Cn({});function fn(n,e,t){Va.set({text:n,yesCallback:e,noCallback:t})}function zb(){Va.set({})}function jc(n){let e,t,i;const l=n[17].default,s=vt(l,n,n[16],null);return{c(){e=b("div"),s&&s.c(),p(e,"class",n[1]),x(e,"active",n[0])},m(o,r){w(o,e,r),s&&s.m(e,null),n[18](e),i=!0},p(o,r){s&&s.p&&(!i||r&65536)&&St(s,l,o,o[16],i?wt(l,o[16],r,null):$t(o[16]),null),(!i||r&2)&&p(e,"class",o[1]),(!i||r&3)&&x(e,"active",o[0])},i(o){i||(E(s,o),o&&Ye(()=>{i&&(t||(t=Ne(e,Pn,{duration:150,y:3},!0)),t.run(1))}),i=!0)},o(o){A(s,o),o&&(t||(t=Ne(e,Pn,{duration:150,y:3},!1)),t.run(0)),i=!1},d(o){o&&v(e),s&&s.d(o),n[18](null),o&&t&&t.end()}}}function r$(n){let e,t,i,l,s=n[0]&&jc(n);return{c(){e=b("div"),s&&s.c(),p(e,"class","toggler-container"),p(e,"tabindex","-1")},m(o,r){w(o,e,r),s&&s.m(e,null),n[19](e),t=!0,i||(l=[K(window,"mousedown",n[5]),K(window,"click",n[6]),K(window,"keydown",n[4]),K(window,"focusin",n[7])],i=!0)},p(o,[r]){o[0]?s?(s.p(o,r),r&1&&E(s,1)):(s=jc(o),s.c(),E(s,1),s.m(e,null)):s&&(se(),A(s,1,1,()=>{s=null}),oe())},i(o){t||(E(s),t=!0)},o(o){A(s),t=!1},d(o){o&&v(e),s&&s.d(),n[19](null),i=!1,ve(l)}}}function a$(n,e,t){let{$$slots:i={},$$scope:l}=e,{trigger:s=void 0}=e,{active:o=!1}=e,{escClose:r=!0}=e,{autoScroll:a=!0}=e,{closableClass:f="closable"}=e,{class:u=""}=e,c,d,m,h,_=!1;const g=st();function y(){t(0,o=!1),_=!1,clearTimeout(h)}function S(){t(0,o=!0),clearTimeout(h),h=setTimeout(()=>{a&&(d!=null&&d.scrollIntoViewIfNeeded?d==null||d.scrollIntoViewIfNeeded():d!=null&&d.scrollIntoView&&(d==null||d.scrollIntoView({behavior:"smooth",block:"nearest"})))},180)}function T(){o?y():S()}function $(q){return!c||q.classList.contains(f)||(m==null?void 0:m.contains(q))&&!c.contains(q)||c.contains(q)&&q.closest&&q.closest("."+f)}function C(q){(!o||$(q.target))&&(q.preventDefault(),q.stopPropagation(),T())}function M(q){(q.code==="Enter"||q.code==="Space")&&(!o||$(q.target))&&(q.preventDefault(),q.stopPropagation(),T())}function D(q){o&&r&&q.code==="Escape"&&(q.preventDefault(),y())}function I(q){o&&!(c!=null&&c.contains(q.target))?_=!0:_&&(_=!1)}function L(q){var W;o&&_&&!(c!=null&&c.contains(q.target))&&!(m!=null&&m.contains(q.target))&&!((W=q.target)!=null&&W.closest(".flatpickr-calendar"))&&y()}function R(q){I(q),L(q)}function F(q){N(),c==null||c.addEventListener("click",C),t(15,m=q||(c==null?void 0:c.parentNode)),m==null||m.addEventListener("click",C),m==null||m.addEventListener("keydown",M)}function N(){clearTimeout(h),c==null||c.removeEventListener("click",C),m==null||m.removeEventListener("click",C),m==null||m.removeEventListener("keydown",M)}jt(()=>(F(),()=>N()));function P(q){ee[q?"unshift":"push"](()=>{d=q,t(3,d)})}function j(q){ee[q?"unshift":"push"](()=>{c=q,t(2,c)})}return n.$$set=q=>{"trigger"in q&&t(8,s=q.trigger),"active"in q&&t(0,o=q.active),"escClose"in q&&t(9,r=q.escClose),"autoScroll"in q&&t(10,a=q.autoScroll),"closableClass"in q&&t(11,f=q.closableClass),"class"in q&&t(1,u=q.class),"$$scope"in q&&t(16,l=q.$$scope)},n.$$.update=()=>{var q,W;n.$$.dirty&260&&c&&F(s),n.$$.dirty&32769&&(o?((q=m==null?void 0:m.classList)==null||q.add("active"),g("show")):((W=m==null?void 0:m.classList)==null||W.remove("active"),g("hide")))},[o,u,c,d,D,I,L,R,s,r,a,f,y,S,T,m,l,i,P,j]}class On extends ge{constructor(e){super(),_e(this,e,a$,r$,me,{trigger:8,active:0,escClose:9,autoScroll:10,closableClass:11,class:1,hide:12,show:13,toggle:14})}get hide(){return this.$$.ctx[12]}get show(){return this.$$.ctx[13]}get toggle(){return this.$$.ctx[14]}}function Hc(n,e,t){const i=n.slice();return i[27]=e[t],i}function f$(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("input"),l=O(),s=b("label"),o=Y("Unique"),p(e,"type","checkbox"),p(e,"id",t=n[30]),e.checked=i=n[3].unique,p(s,"for",r=n[30])},m(u,c){w(u,e,c),w(u,l,c),w(u,s,c),k(s,o),a||(f=K(e,"change",n[19]),a=!0)},p(u,c){c[0]&1073741824&&t!==(t=u[30])&&p(e,"id",t),c[0]&8&&i!==(i=u[3].unique)&&(e.checked=i),c[0]&1073741824&&r!==(r=u[30])&&p(s,"for",r)},d(u){u&&(v(e),v(l),v(s)),a=!1,f()}}}function u$(n){let e,t,i,l;function s(a){n[20](a)}var o=n[7];function r(a,f){var c;let u={id:a[30],placeholder:`eg. CREATE INDEX idx_test on ${(c=a[0])==null?void 0:c.name} (created)`,language:"sql-create-index",minHeight:"85"};return a[2]!==void 0&&(u.value=a[2]),{props:u}}return o&&(e=Ot(o,r(n)),ee.push(()=>be(e,"value",s))),{c(){e&&B(e.$$.fragment),i=ye()},m(a,f){e&&z(e,a,f),w(a,i,f),l=!0},p(a,f){var u;if(f[0]&128&&o!==(o=a[7])){if(e){se();const c=e;A(c.$$.fragment,1,0,()=>{V(c,1)}),oe()}o?(e=Ot(o,r(a)),ee.push(()=>be(e,"value",s)),B(e.$$.fragment),E(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else if(o){const c={};f[0]&1073741824&&(c.id=a[30]),f[0]&1&&(c.placeholder=`eg. CREATE INDEX idx_test on ${(u=a[0])==null?void 0:u.name} (created)`),!t&&f[0]&4&&(t=!0,c.value=a[2],ke(()=>t=!1)),e.$set(c)}},i(a){l||(e&&E(e.$$.fragment,a),l=!0)},o(a){e&&A(e.$$.fragment,a),l=!1},d(a){a&&v(i),e&&V(e,a)}}}function c$(n){let e;return{c(){e=b("textarea"),e.disabled=!0,p(e,"rows","7"),p(e,"placeholder","Loading...")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function d$(n){let e,t,i,l;const s=[c$,u$],o=[];function r(a,f){return a[8]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ye()},m(a,f){o[e].m(a,f),w(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),A(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){l||(E(t),l=!0)},o(a){A(t),l=!1},d(a){a&&v(i),o[e].d(a)}}}function zc(n){let e,t,i,l=de(n[10]),s=[];for(let o=0;o({30:a}),({uniqueId:a})=>[a?1073741824:0]]},$$scope:{ctx:n}}}),i=new pe({props:{class:"form-field required m-b-sm",name:`indexes.${n[6]||""}`,$$slots:{default:[d$,({uniqueId:a})=>({30:a}),({uniqueId:a})=>[a?1073741824:0]]},$$scope:{ctx:n}}});let r=n[10].length>0&&zc(n);return{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment),l=O(),r&&r.c(),s=ye()},m(a,f){z(e,a,f),w(a,t,f),z(i,a,f),w(a,l,f),r&&r.m(a,f),w(a,s,f),o=!0},p(a,f){const u={};f[0]&1073741837|f[1]&1&&(u.$$scope={dirty:f,ctx:a}),e.$set(u);const c={};f[0]&64&&(c.name=`indexes.${a[6]||""}`),f[0]&1073742213|f[1]&1&&(c.$$scope={dirty:f,ctx:a}),i.$set(c),a[10].length>0?r?r.p(a,f):(r=zc(a),r.c(),r.m(s.parentNode,s)):r&&(r.d(1),r=null)},i(a){o||(E(e.$$.fragment,a),E(i.$$.fragment,a),o=!0)},o(a){A(e.$$.fragment,a),A(i.$$.fragment,a),o=!1},d(a){a&&(v(t),v(l),v(s)),V(e,a),V(i,a),r&&r.d(a)}}}function m$(n){let e,t=n[5]?"Update":"Create",i,l;return{c(){e=b("h4"),i=Y(t),l=Y(" index")},m(s,o){w(s,e,o),k(e,i),k(e,l)},p(s,o){o[0]&32&&t!==(t=s[5]?"Update":"Create")&&re(i,t)},d(s){s&&v(e)}}}function Bc(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-hint btn-transparent m-r-auto")},m(l,s){w(l,e,s),t||(i=[we(Le.call(null,e,{text:"Delete",position:"top"})),K(e,"click",n[16])],t=!0)},p:Q,d(l){l&&v(e),t=!1,ve(i)}}}function h$(n){let e,t,i,l,s,o,r=n[5]!=""&&Bc(n);return{c(){r&&r.c(),e=O(),t=b("button"),t.innerHTML='Cancel',i=O(),l=b("button"),l.innerHTML='Set index',p(t,"type","button"),p(t,"class","btn btn-transparent"),p(l,"type","button"),p(l,"class","btn"),x(l,"btn-disabled",n[9].length<=0)},m(a,f){r&&r.m(a,f),w(a,e,f),w(a,t,f),w(a,i,f),w(a,l,f),s||(o=[K(t,"click",n[17]),K(l,"click",n[18])],s=!0)},p(a,f){a[5]!=""?r?r.p(a,f):(r=Bc(a),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null),f[0]&512&&x(l,"btn-disabled",a[9].length<=0)},d(a){a&&(v(e),v(t),v(i),v(l)),r&&r.d(a),s=!1,ve(o)}}}function _$(n){let e,t;const i=[{popup:!0},n[14]];let l={$$slots:{footer:[h$],header:[m$],default:[p$]},$$scope:{ctx:n}};for(let s=0;sU.name==q);G?H.removeByValue(W.columns,G):H.pushUnique(W.columns,{name:q}),t(2,d=H.buildIndex(W))}jt(async()=>{t(8,_=!0);try{t(7,h=(await nt(()=>import("./CodeEditor-f9FE6aAj.js"),__vite__mapDeps([2,1]),import.meta.url)).default)}catch(q){console.warn(q)}t(8,_=!1)});const M=()=>T(),D=()=>y(),I=()=>$(),L=q=>{t(3,l.unique=q.target.checked,l),t(3,l.tableName=l.tableName||(f==null?void 0:f.name),l),t(2,d=H.buildIndex(l))};function R(q){d=q,t(2,d)}const F=q=>C(q);function N(q){ee[q?"unshift":"push"](()=>{u=q,t(4,u)})}function P(q){Te.call(this,n,q)}function j(q){Te.call(this,n,q)}return n.$$set=q=>{e=Pe(Pe({},e),Wt(q)),t(14,r=Ze(e,o)),"collection"in q&&t(0,f=q.collection)},n.$$.update=()=>{var q,W,G;n.$$.dirty[0]&1&&t(10,i=(((W=(q=f==null?void 0:f.schema)==null?void 0:q.filter(U=>!U.toDelete))==null?void 0:W.map(U=>U.name))||[]).concat(["created","updated"])),n.$$.dirty[0]&4&&t(3,l=H.parseIndex(d)),n.$$.dirty[0]&8&&t(9,s=((G=l.columns)==null?void 0:G.map(U=>U.name))||[])},[f,y,d,l,u,c,m,h,_,s,i,T,$,C,r,g,M,D,I,L,R,F,N,P,j]}class b$ extends ge{constructor(e){super(),_e(this,e,g$,_$,me,{collection:0,show:15,hide:1},null,[-1,-1])}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[1]}}function Uc(n,e,t){const i=n.slice();i[10]=e[t],i[13]=t;const l=H.parseIndex(i[10]);return i[11]=l,i}function Wc(n){let e;return{c(){e=b("strong"),e.textContent="Unique:"},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Yc(n){var d;let e,t,i,l=((d=n[11].columns)==null?void 0:d.map(Kc).join(", "))+"",s,o,r,a,f,u=n[11].unique&&Wc();function c(){return n[4](n[10],n[13])}return{c(){var m,h;e=b("button"),u&&u.c(),t=O(),i=b("span"),s=Y(l),p(i,"class","txt"),p(e,"type","button"),p(e,"class",o="label link-primary "+((h=(m=n[2].indexes)==null?void 0:m[n[13]])!=null&&h.message?"label-danger":"")+" svelte-167lbwu")},m(m,h){var _,g;w(m,e,h),u&&u.m(e,null),k(e,t),k(e,i),k(i,s),a||(f=[we(r=Le.call(null,e,((g=(_=n[2].indexes)==null?void 0:_[n[13]])==null?void 0:g.message)||"")),K(e,"click",c)],a=!0)},p(m,h){var _,g,y,S,T;n=m,n[11].unique?u||(u=Wc(),u.c(),u.m(e,t)):u&&(u.d(1),u=null),h&1&&l!==(l=((_=n[11].columns)==null?void 0:_.map(Kc).join(", "))+"")&&re(s,l),h&4&&o!==(o="label link-primary "+((y=(g=n[2].indexes)==null?void 0:g[n[13]])!=null&&y.message?"label-danger":"")+" svelte-167lbwu")&&p(e,"class",o),r&&Tt(r.update)&&h&4&&r.update.call(null,((T=(S=n[2].indexes)==null?void 0:S[n[13]])==null?void 0:T.message)||"")},d(m){m&&v(e),u&&u.d(),a=!1,ve(f)}}}function k$(n){var $,C,M;let e,t,i=(((C=($=n[0])==null?void 0:$.indexes)==null?void 0:C.length)||0)+"",l,s,o,r,a,f,u,c,d,m,h,_,g=de(((M=n[0])==null?void 0:M.indexes)||[]),y=[];for(let D=0;Dbe(c,"collection",S)),c.$on("remove",n[8]),c.$on("submit",n[9]),{c(){e=b("div"),t=Y("Unique constraints and indexes ("),l=Y(i),s=Y(")"),o=O(),r=b("div");for(let D=0;D+ New index',u=O(),B(c.$$.fragment),p(e,"class","section-title"),p(f,"type","button"),p(f,"class","btn btn-xs btn-transparent btn-pill btn-outline"),p(r,"class","indexes-list svelte-167lbwu")},m(D,I){w(D,e,I),k(e,t),k(e,l),k(e,s),w(D,o,I),w(D,r,I);for(let L=0;Ld=!1)),c.$set(L)},i(D){m||(E(c.$$.fragment,D),m=!0)},o(D){A(c.$$.fragment,D),m=!1},d(D){D&&(v(e),v(o),v(r),v(u)),rt(y,D),n[6](null),V(c,D),h=!1,_()}}}const Kc=n=>n.name;function y$(n,e,t){let i;Ue(n,mi,m=>t(2,i=m));let{collection:l}=e,s;function o(m,h){for(let _=0;_s==null?void 0:s.show(m,h),a=()=>s==null?void 0:s.show();function f(m){ee[m?"unshift":"push"](()=>{s=m,t(1,s)})}function u(m){l=m,t(0,l)}const c=m=>{for(let h=0;h{o(m.detail.old,m.detail.new)};return n.$$set=m=>{"collection"in m&&t(0,l=m.collection)},[l,s,i,o,r,a,f,u,c,d]}class v$ extends ge{constructor(e){super(),_e(this,e,y$,k$,me,{collection:0})}}function Jc(n,e,t){const i=n.slice();return i[6]=e[t],i}function Zc(n){let e,t,i,l,s,o,r;function a(){return n[4](n[6])}function f(...u){return n[5](n[6],...u)}return{c(){e=b("div"),t=b("i"),i=O(),l=b("span"),l.textContent=`${n[6].label}`,s=O(),p(t,"class","icon "+n[6].icon+" svelte-1gz9b6p"),p(l,"class","txt"),p(e,"tabindex","0"),p(e,"class","dropdown-item closable svelte-1gz9b6p")},m(u,c){w(u,e,c),k(e,t),k(e,i),k(e,l),k(e,s),o||(r=[K(e,"click",cn(a)),K(e,"keydown",cn(f))],o=!0)},p(u,c){n=u},d(u){u&&v(e),o=!1,ve(r)}}}function w$(n){let e,t=de(n[2]),i=[];for(let l=0;l{o(f.value)},a=(f,u)=>{(u.code==="Enter"||u.code==="Space")&&o(f.value)};return n.$$set=f=>{"class"in f&&t(0,i=f.class)},[i,l,s,o,r,a]}class T$ extends ge{constructor(e){super(),_e(this,e,$$,S$,me,{class:0})}}const C$=n=>({interactive:n&64,hasErrors:n&32}),Gc=n=>({interactive:n[6],hasErrors:n[5]}),O$=n=>({interactive:n&64,hasErrors:n&32}),Xc=n=>({interactive:n[6],hasErrors:n[5]}),M$=n=>({interactive:n&64,hasErrors:n&32}),Qc=n=>({interactive:n[6],hasErrors:n[5]});function xc(n){let e;return{c(){e=b("div"),e.innerHTML='',p(e,"class","drag-handle-wrapper"),p(e,"draggable",!0),p(e,"aria-label","Sort")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function ed(n){let e,t,i;return{c(){e=b("div"),t=b("span"),i=Y(n[4]),p(t,"class","label label-success"),p(e,"class","field-labels")},m(l,s){w(l,e,s),k(e,t),k(t,i)},p(l,s){s&16&&re(i,l[4])},d(l){l&&v(e)}}}function D$(n){let e,t,i,l,s,o,r,a,f,u,c,d,m=n[0].required&&ed(n);return{c(){m&&m.c(),e=O(),t=b("div"),i=b("i"),s=O(),o=b("input"),p(i,"class",l=H.getFieldTypeIcon(n[0].type)),p(t,"class","form-field-addon prefix no-pointer-events field-type-icon"),x(t,"txt-disabled",!n[6]),p(o,"type","text"),o.required=!0,o.disabled=r=!n[6],o.readOnly=a=n[0].id&&n[0].system,p(o,"spellcheck","false"),o.autofocus=f=!n[0].id,p(o,"placeholder","Field name"),o.value=u=n[0].name},m(h,_){m&&m.m(h,_),w(h,e,_),w(h,t,_),k(t,i),w(h,s,_),w(h,o,_),n[15](o),n[0].id||o.focus(),c||(d=K(o,"input",n[16]),c=!0)},p(h,_){h[0].required?m?m.p(h,_):(m=ed(h),m.c(),m.m(e.parentNode,e)):m&&(m.d(1),m=null),_&1&&l!==(l=H.getFieldTypeIcon(h[0].type))&&p(i,"class",l),_&64&&x(t,"txt-disabled",!h[6]),_&64&&r!==(r=!h[6])&&(o.disabled=r),_&1&&a!==(a=h[0].id&&h[0].system)&&(o.readOnly=a),_&1&&f!==(f=!h[0].id)&&(o.autofocus=f),_&1&&u!==(u=h[0].name)&&o.value!==u&&(o.value=u)},d(h){h&&(v(e),v(t),v(s),v(o)),m&&m.d(h),n[15](null),c=!1,d()}}}function E$(n){let e;return{c(){e=b("span"),p(e,"class","separator")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function I$(n){let e,t,i,l,s;return{c(){e=b("button"),t=b("i"),p(t,"class","ri-settings-3-line"),p(e,"type","button"),p(e,"aria-label","Toggle field options"),p(e,"class",i="btn btn-sm btn-circle options-trigger "+(n[3]?"btn-secondary":"btn-transparent")),x(e,"btn-hint",!n[3]&&!n[5]),x(e,"btn-danger",n[5])},m(o,r){w(o,e,r),k(e,t),l||(s=K(e,"click",n[12]),l=!0)},p(o,r){r&8&&i!==(i="btn btn-sm btn-circle options-trigger "+(o[3]?"btn-secondary":"btn-transparent"))&&p(e,"class",i),r&40&&x(e,"btn-hint",!o[3]&&!o[5]),r&40&&x(e,"btn-danger",o[5])},d(o){o&&v(e),l=!1,s()}}}function A$(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-warning btn-transparent options-trigger"),p(e,"aria-label","Restore")},m(l,s){w(l,e,s),t||(i=[we(Le.call(null,e,"Restore")),K(e,"click",n[9])],t=!0)},p:Q,d(l){l&&v(e),t=!1,ve(i)}}}function td(n){let e,t,i,l,s,o,r,a,f,u,c;const d=n[14].options,m=vt(d,n,n[19],Xc);s=new pe({props:{class:"form-field form-field-toggle",name:"requried",$$slots:{default:[L$,({uniqueId:y})=>({25:y}),({uniqueId:y})=>y?33554432:0]},$$scope:{ctx:n}}}),r=new pe({props:{class:"form-field form-field-toggle",name:"presentable",$$slots:{default:[N$,({uniqueId:y})=>({25:y}),({uniqueId:y})=>y?33554432:0]},$$scope:{ctx:n}}});const h=n[14].optionsFooter,_=vt(h,n,n[19],Gc);let g=!n[0].toDelete&&nd(n);return{c(){e=b("div"),t=b("div"),m&&m.c(),i=O(),l=b("div"),B(s.$$.fragment),o=O(),B(r.$$.fragment),a=O(),_&&_.c(),f=O(),g&&g.c(),p(t,"class","hidden-empty m-b-sm"),p(l,"class","schema-field-options-footer"),p(e,"class","schema-field-options")},m(y,S){w(y,e,S),k(e,t),m&&m.m(t,null),k(e,i),k(e,l),z(s,l,null),k(l,o),z(r,l,null),k(l,a),_&&_.m(l,null),k(l,f),g&&g.m(l,null),c=!0},p(y,S){m&&m.p&&(!c||S&524384)&&St(m,d,y,y[19],c?wt(d,y[19],S,O$):$t(y[19]),Xc);const T={};S&34078737&&(T.$$scope={dirty:S,ctx:y}),s.$set(T);const $={};S&34078721&&($.$$scope={dirty:S,ctx:y}),r.$set($),_&&_.p&&(!c||S&524384)&&St(_,h,y,y[19],c?wt(h,y[19],S,C$):$t(y[19]),Gc),y[0].toDelete?g&&(se(),A(g,1,1,()=>{g=null}),oe()):g?(g.p(y,S),S&1&&E(g,1)):(g=nd(y),g.c(),E(g,1),g.m(l,null))},i(y){c||(E(m,y),E(s.$$.fragment,y),E(r.$$.fragment,y),E(_,y),E(g),y&&Ye(()=>{c&&(u||(u=Ne(e,et,{duration:150},!0)),u.run(1))}),c=!0)},o(y){A(m,y),A(s.$$.fragment,y),A(r.$$.fragment,y),A(_,y),A(g),y&&(u||(u=Ne(e,et,{duration:150},!1)),u.run(0)),c=!1},d(y){y&&v(e),m&&m.d(y),V(s),V(r),_&&_.d(y),g&&g.d(),y&&u&&u.end()}}}function L$(n){let e,t,i,l,s,o,r,a,f,u,c,d;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),o=Y(n[4]),r=O(),a=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[25]),p(s,"class","txt"),p(a,"class","ri-information-line link-hint"),p(l,"for",u=n[25])},m(m,h){w(m,e,h),e.checked=n[0].required,w(m,i,h),w(m,l,h),k(l,s),k(s,o),k(l,r),k(l,a),c||(d=[K(e,"change",n[17]),we(f=Le.call(null,a,{text:`Requires the field value NOT to be ${H.zeroDefaultStr(n[0])}.`}))],c=!0)},p(m,h){h&33554432&&t!==(t=m[25])&&p(e,"id",t),h&1&&(e.checked=m[0].required),h&16&&re(o,m[4]),f&&Tt(f.update)&&h&1&&f.update.call(null,{text:`Requires the field value NOT to be ${H.zeroDefaultStr(m[0])}.`}),h&33554432&&u!==(u=m[25])&&p(l,"for",u)},d(m){m&&(v(e),v(i),v(l)),c=!1,ve(d)}}}function N$(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.textContent="Presentable",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[25]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[25])},m(c,d){w(c,e,d),e.checked=n[0].presentable,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[18]),we(Le.call(null,r,{text:"Whether the field should be preferred in the Admin UI relation listings (default to auto)."}))],f=!0)},p(c,d){d&33554432&&t!==(t=c[25])&&p(e,"id",t),d&1&&(e.checked=c[0].presentable),d&33554432&&a!==(a=c[25])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function nd(n){let e,t,i,l,s,o,r;return o=new On({props:{class:"dropdown dropdown-sm dropdown-upside dropdown-right dropdown-nowrap no-min-width",$$slots:{default:[P$]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),i=b("div"),l=b("i"),s=O(),B(o.$$.fragment),p(l,"class","ri-more-line"),p(i,"tabindex","0"),p(i,"aria-label","More"),p(i,"class","btn btn-circle btn-sm btn-transparent"),p(t,"class","inline-flex flex-gap-sm flex-nowrap"),p(e,"class","m-l-auto txt-right")},m(a,f){w(a,e,f),k(e,t),k(t,i),k(i,l),k(i,s),z(o,i,null),r=!0},p(a,f){const u={};f&524288&&(u.$$scope={dirty:f,ctx:a}),o.$set(u)},i(a){r||(E(o.$$.fragment,a),r=!0)},o(a){A(o.$$.fragment,a),r=!1},d(a){a&&v(e),V(o)}}}function P$(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='Duplicate',t=O(),i=b("button"),i.innerHTML='Remove',p(e,"type","button"),p(e,"class","dropdown-item txt-right"),p(i,"type","button"),p(i,"class","dropdown-item txt-right")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),l||(s=[K(e,"click",Be(n[10])),K(i,"click",Be(n[8]))],l=!0)},p:Q,d(o){o&&(v(e),v(t),v(i)),l=!1,ve(s)}}}function F$(n){let e,t,i,l,s,o,r,a,f,u=n[6]&&xc();l=new pe({props:{class:"form-field required m-0 "+(n[6]?"":"disabled"),name:"schema."+n[1]+".name",inlineError:!0,$$slots:{default:[D$]},$$scope:{ctx:n}}});const c=n[14].default,d=vt(c,n,n[19],Qc),m=d||E$();function h(S,T){if(S[0].toDelete)return A$;if(S[6])return I$}let _=h(n),g=_&&_(n),y=n[6]&&n[3]&&td(n);return{c(){e=b("div"),t=b("div"),u&&u.c(),i=O(),B(l.$$.fragment),s=O(),m&&m.c(),o=O(),g&&g.c(),r=O(),y&&y.c(),p(t,"class","schema-field-header"),p(e,"class","schema-field"),x(e,"required",n[0].required),x(e,"expanded",n[6]&&n[3]),x(e,"deleted",n[0].toDelete)},m(S,T){w(S,e,T),k(e,t),u&&u.m(t,null),k(t,i),z(l,t,null),k(t,s),m&&m.m(t,null),k(t,o),g&&g.m(t,null),k(e,r),y&&y.m(e,null),f=!0},p(S,[T]){S[6]?u||(u=xc(),u.c(),u.m(t,i)):u&&(u.d(1),u=null);const $={};T&64&&($.class="form-field required m-0 "+(S[6]?"":"disabled")),T&2&&($.name="schema."+S[1]+".name"),T&524373&&($.$$scope={dirty:T,ctx:S}),l.$set($),d&&d.p&&(!f||T&524384)&&St(d,c,S,S[19],f?wt(c,S[19],T,M$):$t(S[19]),Qc),_===(_=h(S))&&g?g.p(S,T):(g&&g.d(1),g=_&&_(S),g&&(g.c(),g.m(t,null))),S[6]&&S[3]?y?(y.p(S,T),T&72&&E(y,1)):(y=td(S),y.c(),E(y,1),y.m(e,null)):y&&(se(),A(y,1,1,()=>{y=null}),oe()),(!f||T&1)&&x(e,"required",S[0].required),(!f||T&72)&&x(e,"expanded",S[6]&&S[3]),(!f||T&1)&&x(e,"deleted",S[0].toDelete)},i(S){f||(E(l.$$.fragment,S),E(m,S),E(y),S&&Ye(()=>{f&&(a||(a=Ne(e,et,{duration:150},!0)),a.run(1))}),f=!0)},o(S){A(l.$$.fragment,S),A(m,S),A(y),S&&(a||(a=Ne(e,et,{duration:150},!1)),a.run(0)),f=!1},d(S){S&&v(e),u&&u.d(),V(l),m&&m.d(S),g&&g.d(),y&&y.d(),S&&a&&a.end()}}}let $r=[];function R$(n,e,t){let i,l,s,o;Ue(n,mi,N=>t(13,o=N));let{$$slots:r={},$$scope:a}=e;const f="f_"+H.randomString(8),u=st(),c={bool:"Nonfalsey",number:"Nonzero"};let{key:d=""}=e,{field:m=H.initSchemaField()}=e,h,_=!1;function g(){m.id?t(0,m.toDelete=!0,m):(C(),u("remove"))}function y(){t(0,m.toDelete=!1,m),Jt({})}function S(){m.toDelete||(C(),u("duplicate"))}function T(N){return H.slugify(N)}function $(){t(3,_=!0),D()}function C(){t(3,_=!1)}function M(){_?C():$()}function D(){for(let N of $r)N.id!=f&&N.collapse()}jt(()=>($r.push({id:f,collapse:C}),m.onMountSelect&&(t(0,m.onMountSelect=!1,m),h==null||h.select()),()=>{H.removeByKey($r,"id",f)}));function I(N){ee[N?"unshift":"push"](()=>{h=N,t(2,h)})}const L=N=>{const P=m.name;t(0,m.name=T(N.target.value),m),N.target.value=m.name,u("rename",{oldName:P,newName:m.name})};function R(){m.required=this.checked,t(0,m)}function F(){m.presentable=this.checked,t(0,m)}return n.$$set=N=>{"key"in N&&t(1,d=N.key),"field"in N&&t(0,m=N.field),"$$scope"in N&&t(19,a=N.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&m.toDelete&&m.originalName&&m.name!==m.originalName&&t(0,m.name=m.originalName,m),n.$$.dirty&1&&!m.originalName&&m.name&&t(0,m.originalName=m.name,m),n.$$.dirty&1&&typeof m.toDelete>"u"&&t(0,m.toDelete=!1,m),n.$$.dirty&1&&m.required&&t(0,m.nullable=!1,m),n.$$.dirty&1&&t(6,i=!m.toDelete&&!(m.id&&m.system)),n.$$.dirty&8194&&t(5,l=!H.isEmpty(H.getNestedVal(o,`schema.${d}`))),n.$$.dirty&1&&t(4,s=c[m==null?void 0:m.type]||"Nonempty")},[m,d,h,_,s,l,i,u,g,y,S,T,M,o,r,I,L,R,F,a]}class si extends ge{constructor(e){super(),_e(this,e,R$,F$,me,{key:1,field:0})}}function q$(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Min length"),l=O(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10]),p(s,"step","1"),p(s,"min","0")},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].options.min),r||(a=K(s,"input",n[3]),r=!0)},p(f,u){u&1024&&i!==(i=f[10])&&p(e,"for",i),u&1024&&o!==(o=f[10])&&p(s,"id",o),u&1&<(s.value)!==f[0].options.min&&ae(s,f[0].options.min)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function j$(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("label"),t=Y("Max length"),l=O(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10]),p(s,"step","1"),p(s,"min",r=n[0].options.min||0)},m(u,c){w(u,e,c),k(e,t),w(u,l,c),w(u,s,c),ae(s,n[0].options.max),a||(f=K(s,"input",n[4]),a=!0)},p(u,c){c&1024&&i!==(i=u[10])&&p(e,"for",i),c&1024&&o!==(o=u[10])&&p(s,"id",o),c&1&&r!==(r=u[0].options.min||0)&&p(s,"min",r),c&1&<(s.value)!==u[0].options.max&&ae(s,u[0].options.max)},d(u){u&&(v(e),v(l),v(s)),a=!1,f()}}}function H$(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Regex pattern"),l=O(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","text"),p(s,"id",o=n[10]),p(s,"placeholder","Valid Go regular expression, eg. ^\\w+$")},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].options.pattern),r||(a=K(s,"input",n[5]),r=!0)},p(f,u){u&1024&&i!==(i=f[10])&&p(e,"for",i),u&1024&&o!==(o=f[10])&&p(s,"id",o),u&1&&s.value!==f[0].options.pattern&&ae(s,f[0].options.pattern)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function z$(n){let e,t,i,l,s,o,r,a,f,u;return i=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[q$,({uniqueId:c})=>({10:c}),({uniqueId:c})=>c?1024:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[j$,({uniqueId:c})=>({10:c}),({uniqueId:c})=>c?1024:0]},$$scope:{ctx:n}}}),f=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.pattern",$$slots:{default:[H$,({uniqueId:c})=>({10:c}),({uniqueId:c})=>c?1024:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),r=O(),a=b("div"),B(f.$$.fragment),p(t,"class","col-sm-3"),p(s,"class","col-sm-3"),p(a,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(c,d){w(c,e,d),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),k(e,r),k(e,a),z(f,a,null),u=!0},p(c,d){const m={};d&2&&(m.name="schema."+c[1]+".options.min"),d&3073&&(m.$$scope={dirty:d,ctx:c}),i.$set(m);const h={};d&2&&(h.name="schema."+c[1]+".options.max"),d&3073&&(h.$$scope={dirty:d,ctx:c}),o.$set(h);const _={};d&2&&(_.name="schema."+c[1]+".options.pattern"),d&3073&&(_.$$scope={dirty:d,ctx:c}),f.$set(_)},i(c){u||(E(i.$$.fragment,c),E(o.$$.fragment,c),E(f.$$.fragment,c),u=!0)},o(c){A(i.$$.fragment,c),A(o.$$.fragment,c),A(f.$$.fragment,c),u=!1},d(c){c&&v(e),V(i),V(o),V(f)}}}function V$(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[6](r)}let o={$$slots:{options:[z$]},$$scope:{ctx:n}};for(let r=0;rbe(e,"field",s)),e.$on("rename",n[7]),e.$on("remove",n[8]),e.$on("duplicate",n[9]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?ct(l,[a&2&&{key:r[1]},a&4&&Ct(r[2])]):{};a&2051&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ke(()=>t=!1)),e.$set(f)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function B$(n,e,t){const i=["field","key"];let l=Ze(e,i),{field:s}=e,{key:o=""}=e;function r(){s.options.min=lt(this.value),t(0,s)}function a(){s.options.max=lt(this.value),t(0,s)}function f(){s.options.pattern=this.value,t(0,s)}function u(h){s=h,t(0,s)}function c(h){Te.call(this,n,h)}function d(h){Te.call(this,n,h)}function m(h){Te.call(this,n,h)}return n.$$set=h=>{e=Pe(Pe({},e),Wt(h)),t(2,l=Ze(e,i)),"field"in h&&t(0,s=h.field),"key"in h&&t(1,o=h.key)},[s,o,l,r,a,f,u,c,d,m]}class U$ extends ge{constructor(e){super(),_e(this,e,B$,V$,me,{field:0,key:1})}}function W$(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Min"),l=O(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10])},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].options.min),r||(a=K(s,"input",n[4]),r=!0)},p(f,u){u&1024&&i!==(i=f[10])&&p(e,"for",i),u&1024&&o!==(o=f[10])&&p(s,"id",o),u&1&<(s.value)!==f[0].options.min&&ae(s,f[0].options.min)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function Y$(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("label"),t=Y("Max"),l=O(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10]),p(s,"min",r=n[0].options.min)},m(u,c){w(u,e,c),k(e,t),w(u,l,c),w(u,s,c),ae(s,n[0].options.max),a||(f=K(s,"input",n[5]),a=!0)},p(u,c){c&1024&&i!==(i=u[10])&&p(e,"for",i),c&1024&&o!==(o=u[10])&&p(s,"id",o),c&1&&r!==(r=u[0].options.min)&&p(s,"min",r),c&1&<(s.value)!==u[0].options.max&&ae(s,u[0].options.max)},d(u){u&&(v(e),v(l),v(s)),a=!1,f()}}}function K$(n){let e,t,i,l,s,o,r;return i=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[W$,({uniqueId:a})=>({10:a}),({uniqueId:a})=>a?1024:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[Y$,({uniqueId:a})=>({10:a}),({uniqueId:a})=>a?1024:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),p(t,"class","col-sm-6"),p(s,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(a,f){w(a,e,f),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),r=!0},p(a,f){const u={};f&2&&(u.name="schema."+a[1]+".options.min"),f&3073&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};f&2&&(c.name="schema."+a[1]+".options.max"),f&3073&&(c.$$scope={dirty:f,ctx:a}),o.$set(c)},i(a){r||(E(i.$$.fragment,a),E(o.$$.fragment,a),r=!0)},o(a){A(i.$$.fragment,a),A(o.$$.fragment,a),r=!1},d(a){a&&v(e),V(i),V(o)}}}function J$(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.textContent="No decimals",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[10]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[10])},m(c,d){w(c,e,d),e.checked=n[0].options.noDecimal,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[3]),we(Le.call(null,r,{text:"Existing decimal numbers will not be affected."}))],f=!0)},p(c,d){d&1024&&t!==(t=c[10])&&p(e,"id",t),d&1&&(e.checked=c[0].options.noDecimal),d&1024&&a!==(a=c[10])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function Z$(n){let e,t;return e=new pe({props:{class:"form-field form-field-toggle",name:"schema."+n[1]+".options.noDecimal",$$slots:{default:[J$,({uniqueId:i})=>({10:i}),({uniqueId:i})=>i?1024:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.name="schema."+i[1]+".options.noDecimal"),l&3073&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function G$(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[6](r)}let o={$$slots:{optionsFooter:[Z$],options:[K$]},$$scope:{ctx:n}};for(let r=0;rbe(e,"field",s)),e.$on("rename",n[7]),e.$on("remove",n[8]),e.$on("duplicate",n[9]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?ct(l,[a&2&&{key:r[1]},a&4&&Ct(r[2])]):{};a&2051&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ke(()=>t=!1)),e.$set(f)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function X$(n,e,t){const i=["field","key"];let l=Ze(e,i),{field:s}=e,{key:o=""}=e;function r(){s.options.noDecimal=this.checked,t(0,s)}function a(){s.options.min=lt(this.value),t(0,s)}function f(){s.options.max=lt(this.value),t(0,s)}function u(h){s=h,t(0,s)}function c(h){Te.call(this,n,h)}function d(h){Te.call(this,n,h)}function m(h){Te.call(this,n,h)}return n.$$set=h=>{e=Pe(Pe({},e),Wt(h)),t(2,l=Ze(e,i)),"field"in h&&t(0,s=h.field),"key"in h&&t(1,o=h.key)},[s,o,l,r,a,f,u,c,d,m]}class Q$ extends ge{constructor(e){super(),_e(this,e,X$,G$,me,{field:0,key:1})}}function x$(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[3](r)}let o={};for(let r=0;rbe(e,"field",s)),e.$on("rename",n[4]),e.$on("remove",n[5]),e.$on("duplicate",n[6]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?ct(l,[a&2&&{key:r[1]},a&4&&Ct(r[2])]):{};!t&&a&1&&(t=!0,f.field=r[0],ke(()=>t=!1)),e.$set(f)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function eT(n,e,t){const i=["field","key"];let l=Ze(e,i),{field:s}=e,{key:o=""}=e;function r(c){s=c,t(0,s)}function a(c){Te.call(this,n,c)}function f(c){Te.call(this,n,c)}function u(c){Te.call(this,n,c)}return n.$$set=c=>{e=Pe(Pe({},e),Wt(c)),t(2,l=Ze(e,i)),"field"in c&&t(0,s=c.field),"key"in c&&t(1,o=c.key)},[s,o,l,r,a,f,u]}class tT extends ge{constructor(e){super(),_e(this,e,eT,x$,me,{field:0,key:1})}}function nT(n){let e,t,i,l,s=[{type:t=n[5].type||"text"},{value:n[4]},{disabled:n[3]},{readOnly:n[2]},n[5]],o={};for(let r=0;r{t(0,o=H.splitNonEmpty(c.target.value,r))};return n.$$set=c=>{e=Pe(Pe({},e),Wt(c)),t(5,s=Ze(e,l)),"value"in c&&t(0,o=c.value),"separator"in c&&t(1,r=c.separator),"readonly"in c&&t(2,a=c.readonly),"disabled"in c&&t(3,f=c.disabled)},n.$$.update=()=>{n.$$.dirty&3&&t(4,i=H.joinNonEmpty(o,r+" "))},[o,r,a,f,i,s,u]}class Nl extends ge{constructor(e){super(),_e(this,e,iT,nT,me,{value:0,separator:1,readonly:2,disabled:3})}}function lT(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;function h(g){n[3](g)}let _={id:n[9],disabled:!H.isEmpty(n[0].options.onlyDomains)};return n[0].options.exceptDomains!==void 0&&(_.value=n[0].options.exceptDomains),r=new Nl({props:_}),ee.push(()=>be(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Except domains",i=O(),l=b("i"),o=O(),B(r.$$.fragment),f=O(),u=b("div"),u.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[9]),p(u,"class","help-block")},m(g,y){w(g,e,y),k(e,t),k(e,i),k(e,l),w(g,o,y),z(r,g,y),w(g,f,y),w(g,u,y),c=!0,d||(m=we(Le.call(null,l,{text:`List of domains that are NOT allowed. + `),i=b("div");for(let o=0;o{"class"in l&&t(0,i=l.class)},[i]}class jb extends ge{constructor(e){super(),_e(this,e,jS,qS,me,{class:0})}}function HS(n){let e,t,i,l,s,o,r,a,f;return t=new pe({props:{class:"form-field required",name:"logs.maxDays",$$slots:{default:[VS,({uniqueId:u})=>({22:u}),({uniqueId:u})=>u?4194304:0]},$$scope:{ctx:n}}}),l=new pe({props:{class:"form-field",name:"logs.minLevel",$$slots:{default:[BS,({uniqueId:u})=>({22:u}),({uniqueId:u})=>u?4194304:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field form-field-toggle",name:"logs.logIp",$$slots:{default:[US,({uniqueId:u})=>({22:u}),({uniqueId:u})=>u?4194304:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),B(t.$$.fragment),i=O(),B(l.$$.fragment),s=O(),B(o.$$.fragment),p(e,"id",n[6]),p(e,"class","grid"),p(e,"autocomplete","off")},m(u,c){w(u,e,c),z(t,e,null),k(e,i),z(l,e,null),k(e,s),z(o,e,null),r=!0,a||(f=K(e,"submit",Be(n[7])),a=!0)},p(u,c){const d={};c&12582914&&(d.$$scope={dirty:c,ctx:u}),t.$set(d);const m={};c&12582914&&(m.$$scope={dirty:c,ctx:u}),l.$set(m);const h={};c&12582914&&(h.$$scope={dirty:c,ctx:u}),o.$set(h)},i(u){r||(E(t.$$.fragment,u),E(l.$$.fragment,u),E(o.$$.fragment,u),r=!0)},o(u){A(t.$$.fragment,u),A(l.$$.fragment,u),A(o.$$.fragment,u),r=!1},d(u){u&&v(e),V(t),V(l),V(o),a=!1,f()}}}function zS(n){let e;return{c(){e=b("div"),e.innerHTML='
',p(e,"class","block txt-center")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function VS(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=Y("Max days retention"),l=O(),s=b("input"),r=O(),a=b("div"),a.innerHTML="Set to 0 to disable logs persistence.",p(e,"for",i=n[22]),p(s,"type","number"),p(s,"id",o=n[22]),s.required=!0,p(a,"class","help-block")},m(c,d){w(c,e,d),k(e,t),w(c,l,d),w(c,s,d),ae(s,n[1].logs.maxDays),w(c,r,d),w(c,a,d),f||(u=K(s,"input",n[11]),f=!0)},p(c,d){d&4194304&&i!==(i=c[22])&&p(e,"for",i),d&4194304&&o!==(o=c[22])&&p(s,"id",o),d&2&<(s.value)!==c[1].logs.maxDays&&ae(s,c[1].logs.maxDays)},d(c){c&&(v(e),v(l),v(s),v(r),v(a)),f=!1,u()}}}function BS(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;return u=new jb({}),{c(){e=b("label"),t=Y("Min log level"),l=O(),s=b("input"),o=O(),r=b("div"),a=b("p"),a.textContent="Logs with level below the minimum will be ignored.",f=O(),B(u.$$.fragment),p(e,"for",i=n[22]),p(s,"type","number"),s.required=!0,p(s,"min","-100"),p(s,"max","100"),p(r,"class","help-block")},m(h,_){w(h,e,_),k(e,t),w(h,l,_),w(h,s,_),ae(s,n[1].logs.minLevel),w(h,o,_),w(h,r,_),k(r,a),k(r,f),z(u,r,null),c=!0,d||(m=K(s,"input",n[12]),d=!0)},p(h,_){(!c||_&4194304&&i!==(i=h[22]))&&p(e,"for",i),_&2&<(s.value)!==h[1].logs.minLevel&&ae(s,h[1].logs.minLevel)},i(h){c||(E(u.$$.fragment,h),c=!0)},o(h){A(u.$$.fragment,h),c=!1},d(h){h&&(v(e),v(l),v(s),v(o),v(r)),V(u),d=!1,m()}}}function US(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Enable IP logging"),p(e,"type","checkbox"),p(e,"id",t=n[22]),p(l,"for",o=n[22])},m(f,u){w(f,e,u),e.checked=n[1].logs.logIp,w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[13]),r=!0)},p(f,u){u&4194304&&t!==(t=f[22])&&p(e,"id",t),u&2&&(e.checked=f[1].logs.logIp),u&4194304&&o!==(o=f[22])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function WS(n){let e,t,i,l;const s=[zS,HS],o=[];function r(a,f){return a[4]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ye()},m(a,f){o[e].m(a,f),w(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),A(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){l||(E(t),l=!0)},o(a){A(t),l=!1},d(a){a&&v(i),o[e].d(a)}}}function YS(n){let e;return{c(){e=b("h4"),e.textContent="Logs settings"},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function KS(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=O(),l=b("button"),s=b("span"),s.textContent="Save changes",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[3],p(s,"class","txt"),p(l,"type","submit"),p(l,"form",n[6]),p(l,"class","btn btn-expanded"),l.disabled=o=!n[5]||n[3],x(l,"btn-loading",n[3])},m(f,u){w(f,e,u),k(e,t),w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"click",n[0]),r=!0)},p(f,u){u&8&&(e.disabled=f[3]),u&40&&o!==(o=!f[5]||f[3])&&(l.disabled=o),u&8&&x(l,"btn-loading",f[3])},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function JS(n){let e,t,i={popup:!0,class:"admin-panel",beforeHide:n[14],$$slots:{footer:[KS],header:[YS],default:[WS]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[15](e),e.$on("hide",n[16]),e.$on("show",n[17]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&8&&(o.beforeHide=l[14]),s&8388666&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[15](null),V(e,l)}}}function ZS(n,e,t){let i,l;const s=st(),o="logs_settings_"+H.randomString(3);let r,a=!1,f=!1,u={},c={};function d(){return h(),_(),r==null?void 0:r.show()}function m(){return r==null?void 0:r.hide()}function h(){Jt(),t(9,u={}),t(1,c=JSON.parse(JSON.stringify(u||{})))}async function _(){t(4,f=!0);try{const L=await fe.settings.getAll()||{};y(L)}catch(L){fe.error(L)}t(4,f=!1)}async function g(){if(l){t(3,a=!0);try{const L=await fe.settings.update(H.filterRedactedProps(c));y(L),t(3,a=!1),m(),At("Successfully saved logs settings."),s("save",L)}catch(L){t(3,a=!1),fe.error(L)}}}function y(L={}){t(1,c={logs:(L==null?void 0:L.logs)||{}}),t(9,u=JSON.parse(JSON.stringify(c)))}function S(){c.logs.maxDays=lt(this.value),t(1,c)}function T(){c.logs.minLevel=lt(this.value),t(1,c)}function $(){c.logs.logIp=this.checked,t(1,c)}const C=()=>!a;function M(L){ee[L?"unshift":"push"](()=>{r=L,t(2,r)})}function D(L){Te.call(this,n,L)}function I(L){Te.call(this,n,L)}return n.$$.update=()=>{n.$$.dirty&512&&t(10,i=JSON.stringify(u)),n.$$.dirty&1026&&t(5,l=i!=JSON.stringify(c))},[m,c,r,a,f,l,o,g,d,u,i,S,T,$,C,M,D,I]}class GS extends ge{constructor(e){super(),_e(this,e,ZS,JS,me,{show:8,hide:0})}get show(){return this.$$.ctx[8]}get hide(){return this.$$.ctx[0]}}function XS(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Include requests by admins"),p(e,"type","checkbox"),p(e,"id",t=n[22]),p(l,"for",o=n[22])},m(f,u){w(f,e,u),e.checked=n[2],w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[11]),r=!0)},p(f,u){u&4194304&&t!==(t=f[22])&&p(e,"id",t),u&4&&(e.checked=f[2]),u&4194304&&o!==(o=f[22])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function Nc(n){let e,t;return e=new dS({props:{filter:n[1],presets:n[5]}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.filter=i[1]),l&32&&(s.presets=i[5]),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Pc(n){let e,t,i;function l(o){n[13](o)}let s={presets:n[5]};return n[1]!==void 0&&(s.filter=n[1]),e=new i2({props:s}),ee.push(()=>be(e,"filter",l)),e.$on("select",n[14]),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&32&&(a.presets=o[5]),!t&&r&2&&(t=!0,a.filter=o[1],ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function QS(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$=n[4],C,M=n[4],D,I,L,R;f=new Zo({}),f.$on("refresh",n[10]),h=new pe({props:{class:"form-field form-field-toggle m-0",$$slots:{default:[XS,({uniqueId:P})=>({22:P}),({uniqueId:P})=>P?4194304:0]},$$scope:{ctx:n}}}),g=new $s({props:{value:n[1],placeholder:"Search term or filter like `level > 0 && data.auth = 'guest'`",extraAutocompleteKeys:["level","message","data."]}}),g.$on("submit",n[12]),S=new jb({props:{class:"block txt-sm txt-hint m-t-xs m-b-base"}});let F=Nc(n),N=Pc(n);return{c(){e=b("div"),t=b("header"),i=b("nav"),l=b("div"),s=Y(n[6]),o=O(),r=b("button"),r.innerHTML='',a=O(),B(f.$$.fragment),u=O(),c=b("div"),d=O(),m=b("div"),B(h.$$.fragment),_=O(),B(g.$$.fragment),y=O(),B(S.$$.fragment),T=O(),F.c(),C=O(),N.c(),D=ye(),p(l,"class","breadcrumb-item"),p(i,"class","breadcrumbs"),p(r,"type","button"),p(r,"aria-label","Logs settings"),p(r,"class","btn btn-transparent btn-circle"),p(c,"class","flex-fill"),p(m,"class","inline-flex"),p(t,"class","page-header"),p(e,"class","page-header-wrapper m-b-0")},m(P,j){w(P,e,j),k(e,t),k(t,i),k(i,l),k(l,s),k(t,o),k(t,r),k(t,a),z(f,t,null),k(t,u),k(t,c),k(t,d),k(t,m),z(h,m,null),k(e,_),z(g,e,null),k(e,y),z(S,e,null),k(e,T),F.m(e,null),w(P,C,j),N.m(P,j),w(P,D,j),I=!0,L||(R=[we(Le.call(null,r,{text:"Logs settings",position:"right"})),K(r,"click",n[9])],L=!0)},p(P,j){(!I||j&64)&&re(s,P[6]);const q={};j&12582916&&(q.$$scope={dirty:j,ctx:P}),h.$set(q);const W={};j&2&&(W.value=P[1]),g.$set(W),j&16&&me($,$=P[4])?(se(),A(F,1,1,Q),oe(),F=Nc(P),F.c(),E(F,1),F.m(e,null)):F.p(P,j),j&16&&me(M,M=P[4])?(se(),A(N,1,1,Q),oe(),N=Pc(P),N.c(),E(N,1),N.m(D.parentNode,D)):N.p(P,j)},i(P){I||(E(f.$$.fragment,P),E(h.$$.fragment,P),E(g.$$.fragment,P),E(S.$$.fragment,P),E(F),E(N),I=!0)},o(P){A(f.$$.fragment,P),A(h.$$.fragment,P),A(g.$$.fragment,P),A(S.$$.fragment,P),A(F),A(N),I=!1},d(P){P&&(v(e),v(C),v(D)),V(f),V(h),V(g),V(S),F.d(P),N.d(P),L=!1,ve(R)}}}function xS(n){let e,t,i,l,s,o;e=new kn({props:{$$slots:{default:[QS]},$$scope:{ctx:n}}});let r={};i=new PS({props:r}),n[15](i),i.$on("show",n[16]),i.$on("hide",n[17]);let a={};return s=new GS({props:a}),n[18](s),s.$on("save",n[7]),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment),l=O(),B(s.$$.fragment)},m(f,u){z(e,f,u),w(f,t,u),z(i,f,u),w(f,l,u),z(s,f,u),o=!0},p(f,[u]){const c={};u&8388735&&(c.$$scope={dirty:u,ctx:f}),e.$set(c);const d={};i.$set(d);const m={};s.$set(m)},i(f){o||(E(e.$$.fragment,f),E(i.$$.fragment,f),E(s.$$.fragment,f),o=!0)},o(f){A(e.$$.fragment,f),A(i.$$.fragment,f),A(s.$$.fragment,f),o=!1},d(f){f&&(v(t),v(l)),V(e,f),n[15](null),V(i,f),n[18](null),V(s,f)}}}const xs="logId",Fc="adminRequests",Rc="adminLogRequests";function e$(n,e,t){var L;let i,l,s;Ue(n,jo,R=>t(19,l=R)),Ue(n,Dt,R=>t(6,s=R)),xt(Dt,s="Logs",s);const o=new URLSearchParams(l);let r,a,f=1,u=o.get("filter")||"",c=(o.get(Fc)||((L=window.localStorage)==null?void 0:L.getItem(Rc)))<<0,d=c;function m(){t(4,f++,f)}function h(R={}){let F={};F.filter=u||null,F[Fc]=c<<0||null,H.replaceHashQueryParams(Object.assign(F,R))}const _=()=>a==null?void 0:a.show(),g=()=>m();function y(){c=this.checked,t(2,c)}const S=R=>t(1,u=R.detail);function T(R){u=R,t(1,u)}const $=R=>r==null?void 0:r.show(R==null?void 0:R.detail);function C(R){ee[R?"unshift":"push"](()=>{r=R,t(0,r)})}const M=R=>{var N;let F={};F[xs]=((N=R.detail)==null?void 0:N.id)||null,H.replaceHashQueryParams(F)},D=()=>{let R={};R[xs]=null,H.replaceHashQueryParams(R)};function I(R){ee[R?"unshift":"push"](()=>{a=R,t(3,a)})}return n.$$.update=()=>{var R;n.$$.dirty&1&&o.get(xs)&&r&&r.show(o.get(xs)),n.$$.dirty&4&&t(5,i=c?"":'data.auth!="admin"'),n.$$.dirty&260&&d!=c&&(t(8,d=c),(R=window.localStorage)==null||R.setItem(Rc,c<<0),h()),n.$$.dirty&2&&typeof u<"u"&&h()},[r,u,c,a,f,i,s,m,d,_,g,y,S,T,$,C,M,D,I]}class t$ extends ge{constructor(e){super(),_e(this,e,e$,xS,me,{})}}function n$(n){let e,t,i;return{c(){e=b("span"),p(e,"class","dragline svelte-1g2t3dj"),x(e,"dragging",n[1])},m(l,s){w(l,e,s),n[4](e),t||(i=[K(e,"mousedown",n[5]),K(e,"touchstart",n[2])],t=!0)},p(l,[s]){s&2&&x(e,"dragging",l[1])},i:Q,o:Q,d(l){l&&v(e),n[4](null),t=!1,ve(i)}}}function i$(n,e,t){const i=st();let{tolerance:l=0}=e,s,o=0,r=0,a=0,f=0,u=!1;function c(g){g.stopPropagation(),o=g.clientX,r=g.clientY,a=g.clientX-s.offsetLeft,f=g.clientY-s.offsetTop,document.addEventListener("touchmove",m),document.addEventListener("mousemove",m),document.addEventListener("touchend",d),document.addEventListener("mouseup",d)}function d(g){u&&(g.preventDefault(),t(1,u=!1),s.classList.remove("no-pointer-events"),i("dragstop",{event:g,elem:s})),document.removeEventListener("touchmove",m),document.removeEventListener("mousemove",m),document.removeEventListener("touchend",d),document.removeEventListener("mouseup",d)}function m(g){let y=g.clientX-o,S=g.clientY-r,T=g.clientX-a,$=g.clientY-f;!u&&Math.abs(T-s.offsetLeft){s=g,t(0,s)})}const _=g=>{g.button==0&&c(g)};return n.$$set=g=>{"tolerance"in g&&t(3,l=g.tolerance)},[s,u,c,l,h,_]}class l$ extends ge{constructor(e){super(),_e(this,e,i$,n$,me,{tolerance:3})}}function s$(n){let e,t,i,l,s;const o=n[5].default,r=vt(o,n,n[4],null);return l=new l$({}),l.$on("dragstart",n[7]),l.$on("dragging",n[8]),l.$on("dragstop",n[9]),{c(){e=b("aside"),r&&r.c(),i=O(),B(l.$$.fragment),p(e,"class",t="page-sidebar "+n[0])},m(a,f){w(a,e,f),r&&r.m(e,null),n[6](e),w(a,i,f),z(l,a,f),s=!0},p(a,[f]){r&&r.p&&(!s||f&16)&&St(r,o,a,a[4],s?wt(o,a[4],f,null):$t(a[4]),null),(!s||f&1&&t!==(t="page-sidebar "+a[0]))&&p(e,"class",t)},i(a){s||(E(r,a),E(l.$$.fragment,a),s=!0)},o(a){A(r,a),A(l.$$.fragment,a),s=!1},d(a){a&&(v(e),v(i)),r&&r.d(a),n[6](null),V(l,a)}}}const qc="@adminSidebarWidth";function o$(n,e,t){let{$$slots:i={},$$scope:l}=e,{class:s=""}=e,o,r,a=localStorage.getItem(qc)||null;function f(m){ee[m?"unshift":"push"](()=>{o=m,t(1,o),t(2,a)})}const u=()=>{t(3,r=o.offsetWidth)},c=m=>{t(2,a=r+m.detail.diffX+"px")},d=()=>{H.triggerResize()};return n.$$set=m=>{"class"in m&&t(0,s=m.class),"$$scope"in m&&t(4,l=m.$$scope)},n.$$.update=()=>{n.$$.dirty&6&&a&&o&&(t(1,o.style.width=a,o),localStorage.setItem(qc,a))},[s,o,a,r,l,i,f,u,c,d]}class Hb extends ge{constructor(e){super(),_e(this,e,o$,s$,me,{class:0})}}const Va=Cn({});function fn(n,e,t){Va.set({text:n,yesCallback:e,noCallback:t})}function zb(){Va.set({})}function jc(n){let e,t,i;const l=n[17].default,s=vt(l,n,n[16],null);return{c(){e=b("div"),s&&s.c(),p(e,"class",n[1]),x(e,"active",n[0])},m(o,r){w(o,e,r),s&&s.m(e,null),n[18](e),i=!0},p(o,r){s&&s.p&&(!i||r&65536)&&St(s,l,o,o[16],i?wt(l,o[16],r,null):$t(o[16]),null),(!i||r&2)&&p(e,"class",o[1]),(!i||r&3)&&x(e,"active",o[0])},i(o){i||(E(s,o),o&&Ye(()=>{i&&(t||(t=Ne(e,Pn,{duration:150,y:3},!0)),t.run(1))}),i=!0)},o(o){A(s,o),o&&(t||(t=Ne(e,Pn,{duration:150,y:3},!1)),t.run(0)),i=!1},d(o){o&&v(e),s&&s.d(o),n[18](null),o&&t&&t.end()}}}function r$(n){let e,t,i,l,s=n[0]&&jc(n);return{c(){e=b("div"),s&&s.c(),p(e,"class","toggler-container"),p(e,"tabindex","-1")},m(o,r){w(o,e,r),s&&s.m(e,null),n[19](e),t=!0,i||(l=[K(window,"mousedown",n[5]),K(window,"click",n[6]),K(window,"keydown",n[4]),K(window,"focusin",n[7])],i=!0)},p(o,[r]){o[0]?s?(s.p(o,r),r&1&&E(s,1)):(s=jc(o),s.c(),E(s,1),s.m(e,null)):s&&(se(),A(s,1,1,()=>{s=null}),oe())},i(o){t||(E(s),t=!0)},o(o){A(s),t=!1},d(o){o&&v(e),s&&s.d(),n[19](null),i=!1,ve(l)}}}function a$(n,e,t){let{$$slots:i={},$$scope:l}=e,{trigger:s=void 0}=e,{active:o=!1}=e,{escClose:r=!0}=e,{autoScroll:a=!0}=e,{closableClass:f="closable"}=e,{class:u=""}=e,c,d,m,h,_=!1;const g=st();function y(){t(0,o=!1),_=!1,clearTimeout(h)}function S(){t(0,o=!0),clearTimeout(h),h=setTimeout(()=>{a&&(d!=null&&d.scrollIntoViewIfNeeded?d==null||d.scrollIntoViewIfNeeded():d!=null&&d.scrollIntoView&&(d==null||d.scrollIntoView({behavior:"smooth",block:"nearest"})))},180)}function T(){o?y():S()}function $(q){return!c||q.classList.contains(f)||(m==null?void 0:m.contains(q))&&!c.contains(q)||c.contains(q)&&q.closest&&q.closest("."+f)}function C(q){(!o||$(q.target))&&(q.preventDefault(),q.stopPropagation(),T())}function M(q){(q.code==="Enter"||q.code==="Space")&&(!o||$(q.target))&&(q.preventDefault(),q.stopPropagation(),T())}function D(q){o&&r&&q.code==="Escape"&&(q.preventDefault(),y())}function I(q){o&&!(c!=null&&c.contains(q.target))?_=!0:_&&(_=!1)}function L(q){var W;o&&_&&!(c!=null&&c.contains(q.target))&&!(m!=null&&m.contains(q.target))&&!((W=q.target)!=null&&W.closest(".flatpickr-calendar"))&&y()}function R(q){I(q),L(q)}function F(q){N(),c==null||c.addEventListener("click",C),t(15,m=q||(c==null?void 0:c.parentNode)),m==null||m.addEventListener("click",C),m==null||m.addEventListener("keydown",M)}function N(){clearTimeout(h),c==null||c.removeEventListener("click",C),m==null||m.removeEventListener("click",C),m==null||m.removeEventListener("keydown",M)}jt(()=>(F(),()=>N()));function P(q){ee[q?"unshift":"push"](()=>{d=q,t(3,d)})}function j(q){ee[q?"unshift":"push"](()=>{c=q,t(2,c)})}return n.$$set=q=>{"trigger"in q&&t(8,s=q.trigger),"active"in q&&t(0,o=q.active),"escClose"in q&&t(9,r=q.escClose),"autoScroll"in q&&t(10,a=q.autoScroll),"closableClass"in q&&t(11,f=q.closableClass),"class"in q&&t(1,u=q.class),"$$scope"in q&&t(16,l=q.$$scope)},n.$$.update=()=>{var q,W;n.$$.dirty&260&&c&&F(s),n.$$.dirty&32769&&(o?((q=m==null?void 0:m.classList)==null||q.add("active"),g("show")):((W=m==null?void 0:m.classList)==null||W.remove("active"),g("hide")))},[o,u,c,d,D,I,L,R,s,r,a,f,y,S,T,m,l,i,P,j]}class On extends ge{constructor(e){super(),_e(this,e,a$,r$,me,{trigger:8,active:0,escClose:9,autoScroll:10,closableClass:11,class:1,hide:12,show:13,toggle:14})}get hide(){return this.$$.ctx[12]}get show(){return this.$$.ctx[13]}get toggle(){return this.$$.ctx[14]}}function Hc(n,e,t){const i=n.slice();return i[27]=e[t],i}function f$(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("input"),l=O(),s=b("label"),o=Y("Unique"),p(e,"type","checkbox"),p(e,"id",t=n[30]),e.checked=i=n[3].unique,p(s,"for",r=n[30])},m(u,c){w(u,e,c),w(u,l,c),w(u,s,c),k(s,o),a||(f=K(e,"change",n[19]),a=!0)},p(u,c){c[0]&1073741824&&t!==(t=u[30])&&p(e,"id",t),c[0]&8&&i!==(i=u[3].unique)&&(e.checked=i),c[0]&1073741824&&r!==(r=u[30])&&p(s,"for",r)},d(u){u&&(v(e),v(l),v(s)),a=!1,f()}}}function u$(n){let e,t,i,l;function s(a){n[20](a)}var o=n[7];function r(a,f){var c;let u={id:a[30],placeholder:`eg. CREATE INDEX idx_test on ${(c=a[0])==null?void 0:c.name} (created)`,language:"sql-create-index",minHeight:"85"};return a[2]!==void 0&&(u.value=a[2]),{props:u}}return o&&(e=Ot(o,r(n)),ee.push(()=>be(e,"value",s))),{c(){e&&B(e.$$.fragment),i=ye()},m(a,f){e&&z(e,a,f),w(a,i,f),l=!0},p(a,f){var u;if(f[0]&128&&o!==(o=a[7])){if(e){se();const c=e;A(c.$$.fragment,1,0,()=>{V(c,1)}),oe()}o?(e=Ot(o,r(a)),ee.push(()=>be(e,"value",s)),B(e.$$.fragment),E(e.$$.fragment,1),z(e,i.parentNode,i)):e=null}else if(o){const c={};f[0]&1073741824&&(c.id=a[30]),f[0]&1&&(c.placeholder=`eg. CREATE INDEX idx_test on ${(u=a[0])==null?void 0:u.name} (created)`),!t&&f[0]&4&&(t=!0,c.value=a[2],ke(()=>t=!1)),e.$set(c)}},i(a){l||(e&&E(e.$$.fragment,a),l=!0)},o(a){e&&A(e.$$.fragment,a),l=!1},d(a){a&&v(i),e&&V(e,a)}}}function c$(n){let e;return{c(){e=b("textarea"),e.disabled=!0,p(e,"rows","7"),p(e,"placeholder","Loading...")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function d$(n){let e,t,i,l;const s=[c$,u$],o=[];function r(a,f){return a[8]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ye()},m(a,f){o[e].m(a,f),w(a,i,f),l=!0},p(a,f){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),A(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){l||(E(t),l=!0)},o(a){A(t),l=!1},d(a){a&&v(i),o[e].d(a)}}}function zc(n){let e,t,i,l=de(n[10]),s=[];for(let o=0;o({30:a}),({uniqueId:a})=>[a?1073741824:0]]},$$scope:{ctx:n}}}),i=new pe({props:{class:"form-field required m-b-sm",name:`indexes.${n[6]||""}`,$$slots:{default:[d$,({uniqueId:a})=>({30:a}),({uniqueId:a})=>[a?1073741824:0]]},$$scope:{ctx:n}}});let r=n[10].length>0&&zc(n);return{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment),l=O(),r&&r.c(),s=ye()},m(a,f){z(e,a,f),w(a,t,f),z(i,a,f),w(a,l,f),r&&r.m(a,f),w(a,s,f),o=!0},p(a,f){const u={};f[0]&1073741837|f[1]&1&&(u.$$scope={dirty:f,ctx:a}),e.$set(u);const c={};f[0]&64&&(c.name=`indexes.${a[6]||""}`),f[0]&1073742213|f[1]&1&&(c.$$scope={dirty:f,ctx:a}),i.$set(c),a[10].length>0?r?r.p(a,f):(r=zc(a),r.c(),r.m(s.parentNode,s)):r&&(r.d(1),r=null)},i(a){o||(E(e.$$.fragment,a),E(i.$$.fragment,a),o=!0)},o(a){A(e.$$.fragment,a),A(i.$$.fragment,a),o=!1},d(a){a&&(v(t),v(l),v(s)),V(e,a),V(i,a),r&&r.d(a)}}}function m$(n){let e,t=n[5]?"Update":"Create",i,l;return{c(){e=b("h4"),i=Y(t),l=Y(" index")},m(s,o){w(s,e,o),k(e,i),k(e,l)},p(s,o){o[0]&32&&t!==(t=s[5]?"Update":"Create")&&re(i,t)},d(s){s&&v(e)}}}function Bc(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-hint btn-transparent m-r-auto")},m(l,s){w(l,e,s),t||(i=[we(Le.call(null,e,{text:"Delete",position:"top"})),K(e,"click",n[16])],t=!0)},p:Q,d(l){l&&v(e),t=!1,ve(i)}}}function h$(n){let e,t,i,l,s,o,r=n[5]!=""&&Bc(n);return{c(){r&&r.c(),e=O(),t=b("button"),t.innerHTML='Cancel',i=O(),l=b("button"),l.innerHTML='Set index',p(t,"type","button"),p(t,"class","btn btn-transparent"),p(l,"type","button"),p(l,"class","btn"),x(l,"btn-disabled",n[9].length<=0)},m(a,f){r&&r.m(a,f),w(a,e,f),w(a,t,f),w(a,i,f),w(a,l,f),s||(o=[K(t,"click",n[17]),K(l,"click",n[18])],s=!0)},p(a,f){a[5]!=""?r?r.p(a,f):(r=Bc(a),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null),f[0]&512&&x(l,"btn-disabled",a[9].length<=0)},d(a){a&&(v(e),v(t),v(i),v(l)),r&&r.d(a),s=!1,ve(o)}}}function _$(n){let e,t;const i=[{popup:!0},n[14]];let l={$$slots:{footer:[h$],header:[m$],default:[p$]},$$scope:{ctx:n}};for(let s=0;sU.name==q);G?H.removeByValue(W.columns,G):H.pushUnique(W.columns,{name:q}),t(2,d=H.buildIndex(W))}jt(async()=>{t(8,_=!0);try{t(7,h=(await nt(()=>import("./CodeEditor-rvo5l1QW.js"),__vite__mapDeps([2,1]),import.meta.url)).default)}catch(q){console.warn(q)}t(8,_=!1)});const M=()=>T(),D=()=>y(),I=()=>$(),L=q=>{t(3,l.unique=q.target.checked,l),t(3,l.tableName=l.tableName||(f==null?void 0:f.name),l),t(2,d=H.buildIndex(l))};function R(q){d=q,t(2,d)}const F=q=>C(q);function N(q){ee[q?"unshift":"push"](()=>{u=q,t(4,u)})}function P(q){Te.call(this,n,q)}function j(q){Te.call(this,n,q)}return n.$$set=q=>{e=Pe(Pe({},e),Wt(q)),t(14,r=Ze(e,o)),"collection"in q&&t(0,f=q.collection)},n.$$.update=()=>{var q,W,G;n.$$.dirty[0]&1&&t(10,i=(((W=(q=f==null?void 0:f.schema)==null?void 0:q.filter(U=>!U.toDelete))==null?void 0:W.map(U=>U.name))||[]).concat(["created","updated"])),n.$$.dirty[0]&4&&t(3,l=H.parseIndex(d)),n.$$.dirty[0]&8&&t(9,s=((G=l.columns)==null?void 0:G.map(U=>U.name))||[])},[f,y,d,l,u,c,m,h,_,s,i,T,$,C,r,g,M,D,I,L,R,F,N,P,j]}class b$ extends ge{constructor(e){super(),_e(this,e,g$,_$,me,{collection:0,show:15,hide:1},null,[-1,-1])}get show(){return this.$$.ctx[15]}get hide(){return this.$$.ctx[1]}}function Uc(n,e,t){const i=n.slice();i[10]=e[t],i[13]=t;const l=H.parseIndex(i[10]);return i[11]=l,i}function Wc(n){let e;return{c(){e=b("strong"),e.textContent="Unique:"},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Yc(n){var d;let e,t,i,l=((d=n[11].columns)==null?void 0:d.map(Kc).join(", "))+"",s,o,r,a,f,u=n[11].unique&&Wc();function c(){return n[4](n[10],n[13])}return{c(){var m,h;e=b("button"),u&&u.c(),t=O(),i=b("span"),s=Y(l),p(i,"class","txt"),p(e,"type","button"),p(e,"class",o="label link-primary "+((h=(m=n[2].indexes)==null?void 0:m[n[13]])!=null&&h.message?"label-danger":"")+" svelte-167lbwu")},m(m,h){var _,g;w(m,e,h),u&&u.m(e,null),k(e,t),k(e,i),k(i,s),a||(f=[we(r=Le.call(null,e,((g=(_=n[2].indexes)==null?void 0:_[n[13]])==null?void 0:g.message)||"")),K(e,"click",c)],a=!0)},p(m,h){var _,g,y,S,T;n=m,n[11].unique?u||(u=Wc(),u.c(),u.m(e,t)):u&&(u.d(1),u=null),h&1&&l!==(l=((_=n[11].columns)==null?void 0:_.map(Kc).join(", "))+"")&&re(s,l),h&4&&o!==(o="label link-primary "+((y=(g=n[2].indexes)==null?void 0:g[n[13]])!=null&&y.message?"label-danger":"")+" svelte-167lbwu")&&p(e,"class",o),r&&Tt(r.update)&&h&4&&r.update.call(null,((T=(S=n[2].indexes)==null?void 0:S[n[13]])==null?void 0:T.message)||"")},d(m){m&&v(e),u&&u.d(),a=!1,ve(f)}}}function k$(n){var $,C,M;let e,t,i=(((C=($=n[0])==null?void 0:$.indexes)==null?void 0:C.length)||0)+"",l,s,o,r,a,f,u,c,d,m,h,_,g=de(((M=n[0])==null?void 0:M.indexes)||[]),y=[];for(let D=0;Dbe(c,"collection",S)),c.$on("remove",n[8]),c.$on("submit",n[9]),{c(){e=b("div"),t=Y("Unique constraints and indexes ("),l=Y(i),s=Y(")"),o=O(),r=b("div");for(let D=0;D+ New index',u=O(),B(c.$$.fragment),p(e,"class","section-title"),p(f,"type","button"),p(f,"class","btn btn-xs btn-transparent btn-pill btn-outline"),p(r,"class","indexes-list svelte-167lbwu")},m(D,I){w(D,e,I),k(e,t),k(e,l),k(e,s),w(D,o,I),w(D,r,I);for(let L=0;Ld=!1)),c.$set(L)},i(D){m||(E(c.$$.fragment,D),m=!0)},o(D){A(c.$$.fragment,D),m=!1},d(D){D&&(v(e),v(o),v(r),v(u)),rt(y,D),n[6](null),V(c,D),h=!1,_()}}}const Kc=n=>n.name;function y$(n,e,t){let i;Ue(n,mi,m=>t(2,i=m));let{collection:l}=e,s;function o(m,h){for(let _=0;_s==null?void 0:s.show(m,h),a=()=>s==null?void 0:s.show();function f(m){ee[m?"unshift":"push"](()=>{s=m,t(1,s)})}function u(m){l=m,t(0,l)}const c=m=>{for(let h=0;h{o(m.detail.old,m.detail.new)};return n.$$set=m=>{"collection"in m&&t(0,l=m.collection)},[l,s,i,o,r,a,f,u,c,d]}class v$ extends ge{constructor(e){super(),_e(this,e,y$,k$,me,{collection:0})}}function Jc(n,e,t){const i=n.slice();return i[6]=e[t],i}function Zc(n){let e,t,i,l,s,o,r;function a(){return n[4](n[6])}function f(...u){return n[5](n[6],...u)}return{c(){e=b("div"),t=b("i"),i=O(),l=b("span"),l.textContent=`${n[6].label}`,s=O(),p(t,"class","icon "+n[6].icon+" svelte-1gz9b6p"),p(l,"class","txt"),p(e,"tabindex","0"),p(e,"class","dropdown-item closable svelte-1gz9b6p")},m(u,c){w(u,e,c),k(e,t),k(e,i),k(e,l),k(e,s),o||(r=[K(e,"click",cn(a)),K(e,"keydown",cn(f))],o=!0)},p(u,c){n=u},d(u){u&&v(e),o=!1,ve(r)}}}function w$(n){let e,t=de(n[2]),i=[];for(let l=0;l{o(f.value)},a=(f,u)=>{(u.code==="Enter"||u.code==="Space")&&o(f.value)};return n.$$set=f=>{"class"in f&&t(0,i=f.class)},[i,l,s,o,r,a]}class T$ extends ge{constructor(e){super(),_e(this,e,$$,S$,me,{class:0})}}const C$=n=>({interactive:n&64,hasErrors:n&32}),Gc=n=>({interactive:n[6],hasErrors:n[5]}),O$=n=>({interactive:n&64,hasErrors:n&32}),Xc=n=>({interactive:n[6],hasErrors:n[5]}),M$=n=>({interactive:n&64,hasErrors:n&32}),Qc=n=>({interactive:n[6],hasErrors:n[5]});function xc(n){let e;return{c(){e=b("div"),e.innerHTML='',p(e,"class","drag-handle-wrapper"),p(e,"draggable",!0),p(e,"aria-label","Sort")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function ed(n){let e,t,i;return{c(){e=b("div"),t=b("span"),i=Y(n[4]),p(t,"class","label label-success"),p(e,"class","field-labels")},m(l,s){w(l,e,s),k(e,t),k(t,i)},p(l,s){s&16&&re(i,l[4])},d(l){l&&v(e)}}}function D$(n){let e,t,i,l,s,o,r,a,f,u,c,d,m=n[0].required&&ed(n);return{c(){m&&m.c(),e=O(),t=b("div"),i=b("i"),s=O(),o=b("input"),p(i,"class",l=H.getFieldTypeIcon(n[0].type)),p(t,"class","form-field-addon prefix no-pointer-events field-type-icon"),x(t,"txt-disabled",!n[6]),p(o,"type","text"),o.required=!0,o.disabled=r=!n[6],o.readOnly=a=n[0].id&&n[0].system,p(o,"spellcheck","false"),o.autofocus=f=!n[0].id,p(o,"placeholder","Field name"),o.value=u=n[0].name},m(h,_){m&&m.m(h,_),w(h,e,_),w(h,t,_),k(t,i),w(h,s,_),w(h,o,_),n[15](o),n[0].id||o.focus(),c||(d=K(o,"input",n[16]),c=!0)},p(h,_){h[0].required?m?m.p(h,_):(m=ed(h),m.c(),m.m(e.parentNode,e)):m&&(m.d(1),m=null),_&1&&l!==(l=H.getFieldTypeIcon(h[0].type))&&p(i,"class",l),_&64&&x(t,"txt-disabled",!h[6]),_&64&&r!==(r=!h[6])&&(o.disabled=r),_&1&&a!==(a=h[0].id&&h[0].system)&&(o.readOnly=a),_&1&&f!==(f=!h[0].id)&&(o.autofocus=f),_&1&&u!==(u=h[0].name)&&o.value!==u&&(o.value=u)},d(h){h&&(v(e),v(t),v(s),v(o)),m&&m.d(h),n[15](null),c=!1,d()}}}function E$(n){let e;return{c(){e=b("span"),p(e,"class","separator")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function I$(n){let e,t,i,l,s;return{c(){e=b("button"),t=b("i"),p(t,"class","ri-settings-3-line"),p(e,"type","button"),p(e,"aria-label","Toggle field options"),p(e,"class",i="btn btn-sm btn-circle options-trigger "+(n[3]?"btn-secondary":"btn-transparent")),x(e,"btn-hint",!n[3]&&!n[5]),x(e,"btn-danger",n[5])},m(o,r){w(o,e,r),k(e,t),l||(s=K(e,"click",n[12]),l=!0)},p(o,r){r&8&&i!==(i="btn btn-sm btn-circle options-trigger "+(o[3]?"btn-secondary":"btn-transparent"))&&p(e,"class",i),r&40&&x(e,"btn-hint",!o[3]&&!o[5]),r&40&&x(e,"btn-danger",o[5])},d(o){o&&v(e),l=!1,s()}}}function A$(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-sm btn-circle btn-warning btn-transparent options-trigger"),p(e,"aria-label","Restore")},m(l,s){w(l,e,s),t||(i=[we(Le.call(null,e,"Restore")),K(e,"click",n[9])],t=!0)},p:Q,d(l){l&&v(e),t=!1,ve(i)}}}function td(n){let e,t,i,l,s,o,r,a,f,u,c;const d=n[14].options,m=vt(d,n,n[19],Xc);s=new pe({props:{class:"form-field form-field-toggle",name:"requried",$$slots:{default:[L$,({uniqueId:y})=>({25:y}),({uniqueId:y})=>y?33554432:0]},$$scope:{ctx:n}}}),r=new pe({props:{class:"form-field form-field-toggle",name:"presentable",$$slots:{default:[N$,({uniqueId:y})=>({25:y}),({uniqueId:y})=>y?33554432:0]},$$scope:{ctx:n}}});const h=n[14].optionsFooter,_=vt(h,n,n[19],Gc);let g=!n[0].toDelete&&nd(n);return{c(){e=b("div"),t=b("div"),m&&m.c(),i=O(),l=b("div"),B(s.$$.fragment),o=O(),B(r.$$.fragment),a=O(),_&&_.c(),f=O(),g&&g.c(),p(t,"class","hidden-empty m-b-sm"),p(l,"class","schema-field-options-footer"),p(e,"class","schema-field-options")},m(y,S){w(y,e,S),k(e,t),m&&m.m(t,null),k(e,i),k(e,l),z(s,l,null),k(l,o),z(r,l,null),k(l,a),_&&_.m(l,null),k(l,f),g&&g.m(l,null),c=!0},p(y,S){m&&m.p&&(!c||S&524384)&&St(m,d,y,y[19],c?wt(d,y[19],S,O$):$t(y[19]),Xc);const T={};S&34078737&&(T.$$scope={dirty:S,ctx:y}),s.$set(T);const $={};S&34078721&&($.$$scope={dirty:S,ctx:y}),r.$set($),_&&_.p&&(!c||S&524384)&&St(_,h,y,y[19],c?wt(h,y[19],S,C$):$t(y[19]),Gc),y[0].toDelete?g&&(se(),A(g,1,1,()=>{g=null}),oe()):g?(g.p(y,S),S&1&&E(g,1)):(g=nd(y),g.c(),E(g,1),g.m(l,null))},i(y){c||(E(m,y),E(s.$$.fragment,y),E(r.$$.fragment,y),E(_,y),E(g),y&&Ye(()=>{c&&(u||(u=Ne(e,et,{duration:150},!0)),u.run(1))}),c=!0)},o(y){A(m,y),A(s.$$.fragment,y),A(r.$$.fragment,y),A(_,y),A(g),y&&(u||(u=Ne(e,et,{duration:150},!1)),u.run(0)),c=!1},d(y){y&&v(e),m&&m.d(y),V(s),V(r),_&&_.d(y),g&&g.d(),y&&u&&u.end()}}}function L$(n){let e,t,i,l,s,o,r,a,f,u,c,d;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),o=Y(n[4]),r=O(),a=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[25]),p(s,"class","txt"),p(a,"class","ri-information-line link-hint"),p(l,"for",u=n[25])},m(m,h){w(m,e,h),e.checked=n[0].required,w(m,i,h),w(m,l,h),k(l,s),k(s,o),k(l,r),k(l,a),c||(d=[K(e,"change",n[17]),we(f=Le.call(null,a,{text:`Requires the field value NOT to be ${H.zeroDefaultStr(n[0])}.`}))],c=!0)},p(m,h){h&33554432&&t!==(t=m[25])&&p(e,"id",t),h&1&&(e.checked=m[0].required),h&16&&re(o,m[4]),f&&Tt(f.update)&&h&1&&f.update.call(null,{text:`Requires the field value NOT to be ${H.zeroDefaultStr(m[0])}.`}),h&33554432&&u!==(u=m[25])&&p(l,"for",u)},d(m){m&&(v(e),v(i),v(l)),c=!1,ve(d)}}}function N$(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.textContent="Presentable",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[25]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[25])},m(c,d){w(c,e,d),e.checked=n[0].presentable,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[18]),we(Le.call(null,r,{text:"Whether the field should be preferred in the Admin UI relation listings (default to auto)."}))],f=!0)},p(c,d){d&33554432&&t!==(t=c[25])&&p(e,"id",t),d&1&&(e.checked=c[0].presentable),d&33554432&&a!==(a=c[25])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function nd(n){let e,t,i,l,s,o,r;return o=new On({props:{class:"dropdown dropdown-sm dropdown-upside dropdown-right dropdown-nowrap no-min-width",$$slots:{default:[P$]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),i=b("div"),l=b("i"),s=O(),B(o.$$.fragment),p(l,"class","ri-more-line"),p(i,"tabindex","0"),p(i,"aria-label","More"),p(i,"class","btn btn-circle btn-sm btn-transparent"),p(t,"class","inline-flex flex-gap-sm flex-nowrap"),p(e,"class","m-l-auto txt-right")},m(a,f){w(a,e,f),k(e,t),k(t,i),k(i,l),k(i,s),z(o,i,null),r=!0},p(a,f){const u={};f&524288&&(u.$$scope={dirty:f,ctx:a}),o.$set(u)},i(a){r||(E(o.$$.fragment,a),r=!0)},o(a){A(o.$$.fragment,a),r=!1},d(a){a&&v(e),V(o)}}}function P$(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='Duplicate',t=O(),i=b("button"),i.innerHTML='Remove',p(e,"type","button"),p(e,"class","dropdown-item txt-right"),p(i,"type","button"),p(i,"class","dropdown-item txt-right")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),l||(s=[K(e,"click",Be(n[10])),K(i,"click",Be(n[8]))],l=!0)},p:Q,d(o){o&&(v(e),v(t),v(i)),l=!1,ve(s)}}}function F$(n){let e,t,i,l,s,o,r,a,f,u=n[6]&&xc();l=new pe({props:{class:"form-field required m-0 "+(n[6]?"":"disabled"),name:"schema."+n[1]+".name",inlineError:!0,$$slots:{default:[D$]},$$scope:{ctx:n}}});const c=n[14].default,d=vt(c,n,n[19],Qc),m=d||E$();function h(S,T){if(S[0].toDelete)return A$;if(S[6])return I$}let _=h(n),g=_&&_(n),y=n[6]&&n[3]&&td(n);return{c(){e=b("div"),t=b("div"),u&&u.c(),i=O(),B(l.$$.fragment),s=O(),m&&m.c(),o=O(),g&&g.c(),r=O(),y&&y.c(),p(t,"class","schema-field-header"),p(e,"class","schema-field"),x(e,"required",n[0].required),x(e,"expanded",n[6]&&n[3]),x(e,"deleted",n[0].toDelete)},m(S,T){w(S,e,T),k(e,t),u&&u.m(t,null),k(t,i),z(l,t,null),k(t,s),m&&m.m(t,null),k(t,o),g&&g.m(t,null),k(e,r),y&&y.m(e,null),f=!0},p(S,[T]){S[6]?u||(u=xc(),u.c(),u.m(t,i)):u&&(u.d(1),u=null);const $={};T&64&&($.class="form-field required m-0 "+(S[6]?"":"disabled")),T&2&&($.name="schema."+S[1]+".name"),T&524373&&($.$$scope={dirty:T,ctx:S}),l.$set($),d&&d.p&&(!f||T&524384)&&St(d,c,S,S[19],f?wt(c,S[19],T,M$):$t(S[19]),Qc),_===(_=h(S))&&g?g.p(S,T):(g&&g.d(1),g=_&&_(S),g&&(g.c(),g.m(t,null))),S[6]&&S[3]?y?(y.p(S,T),T&72&&E(y,1)):(y=td(S),y.c(),E(y,1),y.m(e,null)):y&&(se(),A(y,1,1,()=>{y=null}),oe()),(!f||T&1)&&x(e,"required",S[0].required),(!f||T&72)&&x(e,"expanded",S[6]&&S[3]),(!f||T&1)&&x(e,"deleted",S[0].toDelete)},i(S){f||(E(l.$$.fragment,S),E(m,S),E(y),S&&Ye(()=>{f&&(a||(a=Ne(e,et,{duration:150},!0)),a.run(1))}),f=!0)},o(S){A(l.$$.fragment,S),A(m,S),A(y),S&&(a||(a=Ne(e,et,{duration:150},!1)),a.run(0)),f=!1},d(S){S&&v(e),u&&u.d(),V(l),m&&m.d(S),g&&g.d(),y&&y.d(),S&&a&&a.end()}}}let $r=[];function R$(n,e,t){let i,l,s,o;Ue(n,mi,N=>t(13,o=N));let{$$slots:r={},$$scope:a}=e;const f="f_"+H.randomString(8),u=st(),c={bool:"Nonfalsey",number:"Nonzero"};let{key:d=""}=e,{field:m=H.initSchemaField()}=e,h,_=!1;function g(){m.id?t(0,m.toDelete=!0,m):(C(),u("remove"))}function y(){t(0,m.toDelete=!1,m),Jt({})}function S(){m.toDelete||(C(),u("duplicate"))}function T(N){return H.slugify(N)}function $(){t(3,_=!0),D()}function C(){t(3,_=!1)}function M(){_?C():$()}function D(){for(let N of $r)N.id!=f&&N.collapse()}jt(()=>($r.push({id:f,collapse:C}),m.onMountSelect&&(t(0,m.onMountSelect=!1,m),h==null||h.select()),()=>{H.removeByKey($r,"id",f)}));function I(N){ee[N?"unshift":"push"](()=>{h=N,t(2,h)})}const L=N=>{const P=m.name;t(0,m.name=T(N.target.value),m),N.target.value=m.name,u("rename",{oldName:P,newName:m.name})};function R(){m.required=this.checked,t(0,m)}function F(){m.presentable=this.checked,t(0,m)}return n.$$set=N=>{"key"in N&&t(1,d=N.key),"field"in N&&t(0,m=N.field),"$$scope"in N&&t(19,a=N.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&m.toDelete&&m.originalName&&m.name!==m.originalName&&t(0,m.name=m.originalName,m),n.$$.dirty&1&&!m.originalName&&m.name&&t(0,m.originalName=m.name,m),n.$$.dirty&1&&typeof m.toDelete>"u"&&t(0,m.toDelete=!1,m),n.$$.dirty&1&&m.required&&t(0,m.nullable=!1,m),n.$$.dirty&1&&t(6,i=!m.toDelete&&!(m.id&&m.system)),n.$$.dirty&8194&&t(5,l=!H.isEmpty(H.getNestedVal(o,`schema.${d}`))),n.$$.dirty&1&&t(4,s=c[m==null?void 0:m.type]||"Nonempty")},[m,d,h,_,s,l,i,u,g,y,S,T,M,o,r,I,L,R,F,a]}class si extends ge{constructor(e){super(),_e(this,e,R$,F$,me,{key:1,field:0})}}function q$(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Min length"),l=O(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10]),p(s,"step","1"),p(s,"min","0")},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].options.min),r||(a=K(s,"input",n[3]),r=!0)},p(f,u){u&1024&&i!==(i=f[10])&&p(e,"for",i),u&1024&&o!==(o=f[10])&&p(s,"id",o),u&1&<(s.value)!==f[0].options.min&&ae(s,f[0].options.min)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function j$(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("label"),t=Y("Max length"),l=O(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10]),p(s,"step","1"),p(s,"min",r=n[0].options.min||0)},m(u,c){w(u,e,c),k(e,t),w(u,l,c),w(u,s,c),ae(s,n[0].options.max),a||(f=K(s,"input",n[4]),a=!0)},p(u,c){c&1024&&i!==(i=u[10])&&p(e,"for",i),c&1024&&o!==(o=u[10])&&p(s,"id",o),c&1&&r!==(r=u[0].options.min||0)&&p(s,"min",r),c&1&<(s.value)!==u[0].options.max&&ae(s,u[0].options.max)},d(u){u&&(v(e),v(l),v(s)),a=!1,f()}}}function H$(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Regex pattern"),l=O(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","text"),p(s,"id",o=n[10]),p(s,"placeholder","Valid Go regular expression, eg. ^\\w+$")},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].options.pattern),r||(a=K(s,"input",n[5]),r=!0)},p(f,u){u&1024&&i!==(i=f[10])&&p(e,"for",i),u&1024&&o!==(o=f[10])&&p(s,"id",o),u&1&&s.value!==f[0].options.pattern&&ae(s,f[0].options.pattern)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function z$(n){let e,t,i,l,s,o,r,a,f,u;return i=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[q$,({uniqueId:c})=>({10:c}),({uniqueId:c})=>c?1024:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[j$,({uniqueId:c})=>({10:c}),({uniqueId:c})=>c?1024:0]},$$scope:{ctx:n}}}),f=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.pattern",$$slots:{default:[H$,({uniqueId:c})=>({10:c}),({uniqueId:c})=>c?1024:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),r=O(),a=b("div"),B(f.$$.fragment),p(t,"class","col-sm-3"),p(s,"class","col-sm-3"),p(a,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(c,d){w(c,e,d),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),k(e,r),k(e,a),z(f,a,null),u=!0},p(c,d){const m={};d&2&&(m.name="schema."+c[1]+".options.min"),d&3073&&(m.$$scope={dirty:d,ctx:c}),i.$set(m);const h={};d&2&&(h.name="schema."+c[1]+".options.max"),d&3073&&(h.$$scope={dirty:d,ctx:c}),o.$set(h);const _={};d&2&&(_.name="schema."+c[1]+".options.pattern"),d&3073&&(_.$$scope={dirty:d,ctx:c}),f.$set(_)},i(c){u||(E(i.$$.fragment,c),E(o.$$.fragment,c),E(f.$$.fragment,c),u=!0)},o(c){A(i.$$.fragment,c),A(o.$$.fragment,c),A(f.$$.fragment,c),u=!1},d(c){c&&v(e),V(i),V(o),V(f)}}}function V$(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[6](r)}let o={$$slots:{options:[z$]},$$scope:{ctx:n}};for(let r=0;rbe(e,"field",s)),e.$on("rename",n[7]),e.$on("remove",n[8]),e.$on("duplicate",n[9]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?ct(l,[a&2&&{key:r[1]},a&4&&Ct(r[2])]):{};a&2051&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ke(()=>t=!1)),e.$set(f)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function B$(n,e,t){const i=["field","key"];let l=Ze(e,i),{field:s}=e,{key:o=""}=e;function r(){s.options.min=lt(this.value),t(0,s)}function a(){s.options.max=lt(this.value),t(0,s)}function f(){s.options.pattern=this.value,t(0,s)}function u(h){s=h,t(0,s)}function c(h){Te.call(this,n,h)}function d(h){Te.call(this,n,h)}function m(h){Te.call(this,n,h)}return n.$$set=h=>{e=Pe(Pe({},e),Wt(h)),t(2,l=Ze(e,i)),"field"in h&&t(0,s=h.field),"key"in h&&t(1,o=h.key)},[s,o,l,r,a,f,u,c,d,m]}class U$ extends ge{constructor(e){super(),_e(this,e,B$,V$,me,{field:0,key:1})}}function W$(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Min"),l=O(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10])},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].options.min),r||(a=K(s,"input",n[4]),r=!0)},p(f,u){u&1024&&i!==(i=f[10])&&p(e,"for",i),u&1024&&o!==(o=f[10])&&p(s,"id",o),u&1&<(s.value)!==f[0].options.min&&ae(s,f[0].options.min)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function Y$(n){let e,t,i,l,s,o,r,a,f;return{c(){e=b("label"),t=Y("Max"),l=O(),s=b("input"),p(e,"for",i=n[10]),p(s,"type","number"),p(s,"id",o=n[10]),p(s,"min",r=n[0].options.min)},m(u,c){w(u,e,c),k(e,t),w(u,l,c),w(u,s,c),ae(s,n[0].options.max),a||(f=K(s,"input",n[5]),a=!0)},p(u,c){c&1024&&i!==(i=u[10])&&p(e,"for",i),c&1024&&o!==(o=u[10])&&p(s,"id",o),c&1&&r!==(r=u[0].options.min)&&p(s,"min",r),c&1&<(s.value)!==u[0].options.max&&ae(s,u[0].options.max)},d(u){u&&(v(e),v(l),v(s)),a=!1,f()}}}function K$(n){let e,t,i,l,s,o,r;return i=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.min",$$slots:{default:[W$,({uniqueId:a})=>({10:a}),({uniqueId:a})=>a?1024:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.max",$$slots:{default:[Y$,({uniqueId:a})=>({10:a}),({uniqueId:a})=>a?1024:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),p(t,"class","col-sm-6"),p(s,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(a,f){w(a,e,f),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),r=!0},p(a,f){const u={};f&2&&(u.name="schema."+a[1]+".options.min"),f&3073&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};f&2&&(c.name="schema."+a[1]+".options.max"),f&3073&&(c.$$scope={dirty:f,ctx:a}),o.$set(c)},i(a){r||(E(i.$$.fragment,a),E(o.$$.fragment,a),r=!0)},o(a){A(i.$$.fragment,a),A(o.$$.fragment,a),r=!1},d(a){a&&v(e),V(i),V(o)}}}function J$(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.textContent="No decimals",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[10]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[10])},m(c,d){w(c,e,d),e.checked=n[0].options.noDecimal,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[3]),we(Le.call(null,r,{text:"Existing decimal numbers will not be affected."}))],f=!0)},p(c,d){d&1024&&t!==(t=c[10])&&p(e,"id",t),d&1&&(e.checked=c[0].options.noDecimal),d&1024&&a!==(a=c[10])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function Z$(n){let e,t;return e=new pe({props:{class:"form-field form-field-toggle",name:"schema."+n[1]+".options.noDecimal",$$slots:{default:[J$,({uniqueId:i})=>({10:i}),({uniqueId:i})=>i?1024:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.name="schema."+i[1]+".options.noDecimal"),l&3073&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function G$(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[6](r)}let o={$$slots:{optionsFooter:[Z$],options:[K$]},$$scope:{ctx:n}};for(let r=0;rbe(e,"field",s)),e.$on("rename",n[7]),e.$on("remove",n[8]),e.$on("duplicate",n[9]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?ct(l,[a&2&&{key:r[1]},a&4&&Ct(r[2])]):{};a&2051&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ke(()=>t=!1)),e.$set(f)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function X$(n,e,t){const i=["field","key"];let l=Ze(e,i),{field:s}=e,{key:o=""}=e;function r(){s.options.noDecimal=this.checked,t(0,s)}function a(){s.options.min=lt(this.value),t(0,s)}function f(){s.options.max=lt(this.value),t(0,s)}function u(h){s=h,t(0,s)}function c(h){Te.call(this,n,h)}function d(h){Te.call(this,n,h)}function m(h){Te.call(this,n,h)}return n.$$set=h=>{e=Pe(Pe({},e),Wt(h)),t(2,l=Ze(e,i)),"field"in h&&t(0,s=h.field),"key"in h&&t(1,o=h.key)},[s,o,l,r,a,f,u,c,d,m]}class Q$ extends ge{constructor(e){super(),_e(this,e,X$,G$,me,{field:0,key:1})}}function x$(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[3](r)}let o={};for(let r=0;rbe(e,"field",s)),e.$on("rename",n[4]),e.$on("remove",n[5]),e.$on("duplicate",n[6]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?ct(l,[a&2&&{key:r[1]},a&4&&Ct(r[2])]):{};!t&&a&1&&(t=!0,f.field=r[0],ke(()=>t=!1)),e.$set(f)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function eT(n,e,t){const i=["field","key"];let l=Ze(e,i),{field:s}=e,{key:o=""}=e;function r(c){s=c,t(0,s)}function a(c){Te.call(this,n,c)}function f(c){Te.call(this,n,c)}function u(c){Te.call(this,n,c)}return n.$$set=c=>{e=Pe(Pe({},e),Wt(c)),t(2,l=Ze(e,i)),"field"in c&&t(0,s=c.field),"key"in c&&t(1,o=c.key)},[s,o,l,r,a,f,u]}class tT extends ge{constructor(e){super(),_e(this,e,eT,x$,me,{field:0,key:1})}}function nT(n){let e,t,i,l,s=[{type:t=n[5].type||"text"},{value:n[4]},{disabled:n[3]},{readOnly:n[2]},n[5]],o={};for(let r=0;r{t(0,o=H.splitNonEmpty(c.target.value,r))};return n.$$set=c=>{e=Pe(Pe({},e),Wt(c)),t(5,s=Ze(e,l)),"value"in c&&t(0,o=c.value),"separator"in c&&t(1,r=c.separator),"readonly"in c&&t(2,a=c.readonly),"disabled"in c&&t(3,f=c.disabled)},n.$$.update=()=>{n.$$.dirty&3&&t(4,i=H.joinNonEmpty(o,r+" "))},[o,r,a,f,i,s,u]}class Nl extends ge{constructor(e){super(),_e(this,e,iT,nT,me,{value:0,separator:1,readonly:2,disabled:3})}}function lT(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;function h(g){n[3](g)}let _={id:n[9],disabled:!H.isEmpty(n[0].options.onlyDomains)};return n[0].options.exceptDomains!==void 0&&(_.value=n[0].options.exceptDomains),r=new Nl({props:_}),ee.push(()=>be(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Except domains",i=O(),l=b("i"),o=O(),B(r.$$.fragment),f=O(),u=b("div"),u.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[9]),p(u,"class","help-block")},m(g,y){w(g,e,y),k(e,t),k(e,i),k(e,l),w(g,o,y),z(r,g,y),w(g,f,y),w(g,u,y),c=!0,d||(m=we(Le.call(null,l,{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&512&&s!==(s=g[9]))&&p(e,"for",s);const S={};y&512&&(S.id=g[9]),y&1&&(S.disabled=!H.isEmpty(g[0].options.onlyDomains)),!a&&y&1&&(a=!0,S.value=g[0].options.exceptDomains,ke(()=>a=!1)),r.$set(S)},i(g){c||(E(r.$$.fragment,g),c=!0)},o(g){A(r.$$.fragment,g),c=!1},d(g){g&&(v(e),v(o),v(f),v(u)),V(r,g),d=!1,m()}}}function sT(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;function h(g){n[4](g)}let _={id:n[9]+".options.onlyDomains",disabled:!H.isEmpty(n[0].options.exceptDomains)};return n[0].options.onlyDomains!==void 0&&(_.value=n[0].options.onlyDomains),r=new Nl({props:_}),ee.push(()=>be(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Only domains",i=O(),l=b("i"),o=O(),B(r.$$.fragment),f=O(),u=b("div"),u.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[9]+".options.onlyDomains"),p(u,"class","help-block")},m(g,y){w(g,e,y),k(e,t),k(e,i),k(e,l),w(g,o,y),z(r,g,y),w(g,f,y),w(g,u,y),c=!0,d||(m=we(Le.call(null,l,{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&512&&s!==(s=g[9]+".options.onlyDomains"))&&p(e,"for",s);const S={};y&512&&(S.id=g[9]+".options.onlyDomains"),y&1&&(S.disabled=!H.isEmpty(g[0].options.exceptDomains)),!a&&y&1&&(a=!0,S.value=g[0].options.onlyDomains,ke(()=>a=!1)),r.$set(S)},i(g){c||(E(r.$$.fragment,g),c=!0)},o(g){A(r.$$.fragment,g),c=!1},d(g){g&&(v(e),v(o),v(f),v(u)),V(r,g),d=!1,m()}}}function oT(n){let e,t,i,l,s,o,r;return i=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.exceptDomains",$$slots:{default:[lT,({uniqueId:a})=>({9:a}),({uniqueId:a})=>a?512:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field",name:"schema."+n[1]+".options.onlyDomains",$$slots:{default:[sT,({uniqueId:a})=>({9:a}),({uniqueId:a})=>a?512:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),p(t,"class","col-sm-6"),p(s,"class","col-sm-6"),p(e,"class","grid grid-sm")},m(a,f){w(a,e,f),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),r=!0},p(a,f){const u={};f&2&&(u.name="schema."+a[1]+".options.exceptDomains"),f&1537&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};f&2&&(c.name="schema."+a[1]+".options.onlyDomains"),f&1537&&(c.$$scope={dirty:f,ctx:a}),o.$set(c)},i(a){r||(E(i.$$.fragment,a),E(o.$$.fragment,a),r=!0)},o(a){A(i.$$.fragment,a),A(o.$$.fragment,a),r=!1},d(a){a&&v(e),V(i),V(o)}}}function rT(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[5](r)}let o={$$slots:{options:[oT]},$$scope:{ctx:n}};for(let r=0;rbe(e,"field",s)),e.$on("rename",n[6]),e.$on("remove",n[7]),e.$on("duplicate",n[8]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?ct(l,[a&2&&{key:r[1]},a&4&&Ct(r[2])]):{};a&1027&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ke(()=>t=!1)),e.$set(f)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function aT(n,e,t){const i=["field","key"];let l=Ze(e,i),{field:s}=e,{key:o=""}=e;function r(m){n.$$.not_equal(s.options.exceptDomains,m)&&(s.options.exceptDomains=m,t(0,s))}function a(m){n.$$.not_equal(s.options.onlyDomains,m)&&(s.options.onlyDomains=m,t(0,s))}function f(m){s=m,t(0,s)}function u(m){Te.call(this,n,m)}function c(m){Te.call(this,n,m)}function d(m){Te.call(this,n,m)}return n.$$set=m=>{e=Pe(Pe({},e),Wt(m)),t(2,l=Ze(e,i)),"field"in m&&t(0,s=m.field),"key"in m&&t(1,o=m.key)},[s,o,l,r,a,f,u,c,d]}class Vb extends ge{constructor(e){super(),_e(this,e,aT,rT,me,{field:0,key:1})}}function fT(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[3](r)}let o={};for(let r=0;rbe(e,"field",s)),e.$on("rename",n[4]),e.$on("remove",n[5]),e.$on("duplicate",n[6]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?ct(l,[a&2&&{key:r[1]},a&4&&Ct(r[2])]):{};!t&&a&1&&(t=!0,f.field=r[0],ke(()=>t=!1)),e.$set(f)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function uT(n,e,t){const i=["field","key"];let l=Ze(e,i),{field:s}=e,{key:o=""}=e;function r(c){s=c,t(0,s)}function a(c){Te.call(this,n,c)}function f(c){Te.call(this,n,c)}function u(c){Te.call(this,n,c)}return n.$$set=c=>{e=Pe(Pe({},e),Wt(c)),t(2,l=Ze(e,i)),"field"in c&&t(0,s=c.field),"key"in c&&t(1,o=c.key)},[s,o,l,r,a,f,u]}class cT extends ge{constructor(e){super(),_e(this,e,uT,fT,me,{field:0,key:1})}}function dT(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.textContent="Strip urls domain",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[9]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[9])},m(c,d){w(c,e,d),e.checked=n[0].options.convertUrls,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[3]),we(Le.call(null,r,{text:"This could help making the editor content more portable between environments since there will be no local base url to replace."}))],f=!0)},p(c,d){d&512&&t!==(t=c[9])&&p(e,"id",t),d&1&&(e.checked=c[0].options.convertUrls),d&512&&a!==(a=c[9])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function pT(n){let e,t;return e=new pe({props:{class:"form-field form-field-toggle",name:"schema."+n[1]+".options.convertUrls",$$slots:{default:[dT,({uniqueId:i})=>({9:i}),({uniqueId:i})=>i?512:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&2&&(s.name="schema."+i[1]+".options.convertUrls"),l&1537&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function mT(n){let e,t,i;const l=[{key:n[1]},n[2]];function s(r){n[4](r)}let o={$$slots:{optionsFooter:[pT]},$$scope:{ctx:n}};for(let r=0;rbe(e,"field",s)),e.$on("rename",n[5]),e.$on("remove",n[6]),e.$on("duplicate",n[7]),{c(){B(e.$$.fragment)},m(r,a){z(e,r,a),i=!0},p(r,[a]){const f=a&6?ct(l,[a&2&&{key:r[1]},a&4&&Ct(r[2])]):{};a&1027&&(f.$$scope={dirty:a,ctx:r}),!t&&a&1&&(t=!0,f.field=r[0],ke(()=>t=!1)),e.$set(f)},i(r){i||(E(e.$$.fragment,r),i=!0)},o(r){A(e.$$.fragment,r),i=!1},d(r){V(e,r)}}}function hT(n,e,t){const i=["field","key"];let l=Ze(e,i),{field:s}=e,{key:o=""}=e;function r(){t(0,s.options={convertUrls:!1},s)}function a(){s.options.convertUrls=this.checked,t(0,s)}function f(m){s=m,t(0,s)}function u(m){Te.call(this,n,m)}function c(m){Te.call(this,n,m)}function d(m){Te.call(this,n,m)}return n.$$set=m=>{e=Pe(Pe({},e),Wt(m)),t(2,l=Ze(e,i)),"field"in m&&t(0,s=m.field),"key"in m&&t(1,o=m.key)},n.$$.update=()=>{n.$$.dirty&1&&H.isEmpty(s.options)&&r()},[s,o,l,a,f,u,c,d]}class _T extends ge{constructor(e){super(),_e(this,e,hT,mT,me,{field:0,key:1})}}var Tr=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],wl={_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},ms={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},mn=function(n,e){return e===void 0&&(e=2),("000"+n).slice(e*-1)},En=function(n){return n===!0?1:0};function id(n,e){var t;return function(){var i=this,l=arguments;clearTimeout(t),t=setTimeout(function(){return n.apply(i,l)},e)}}var Cr=function(n){return n instanceof Array?n:[n]};function an(n,e,t){if(t===!0)return n.classList.add(e);n.classList.remove(e)}function ut(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 Bb(n,e){if(e(n))return n;if(n.parentNode)return Bb(n.parentNode,e)}function to(n,e){var t=ut("div","numInputWrapper"),i=ut("input","numInput "+n),l=ut("span","arrowUp"),s=ut("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(l),t.appendChild(s),t}function vn(n){try{if(typeof n.composedPath=="function"){var e=n.composedPath();return e[0]}return n.target}catch{return n.target}}var Or=function(){},Po=function(n,e,t){return t.months[e?"shorthand":"longhand"][n]},gT={D:Or,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*En(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),l=new Date(n.getFullYear(),0,2+(i-1)*7,0,0,0,0);return l.setDate(l.getDate()-l.getDay()+t.firstDayOfWeek),l},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:Or,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:Or,y:function(n,e){n.setFullYear(2e3+parseFloat(e))}},Bi={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})"},ns={Z:function(n){return n.toISOString()},D:function(n,e,t){return e.weekdays.shorthand[ns.w(n,e,t)]},F:function(n,e,t){return Po(ns.n(n,e,t)-1,!1,e)},G:function(n,e,t){return mn(ns.h(n,e,t))},H:function(n){return mn(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[En(n.getHours()>11)]},M:function(n,e){return Po(n.getMonth(),!0,e)},S:function(n){return mn(n.getSeconds())},U:function(n){return n.getTime()/1e3},W:function(n,e,t){return t.getWeek(n)},Y:function(n){return mn(n.getFullYear(),4)},d:function(n){return mn(n.getDate())},h:function(n){return n.getHours()%12?n.getHours()%12:12},i:function(n){return mn(n.getMinutes())},j:function(n){return n.getDate()},l:function(n,e){return e.weekdays.longhand[n.getDay()]},m:function(n){return mn(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)}},Ub=function(n){var e=n.config,t=e===void 0?wl:e,i=n.l10n,l=i===void 0?ms:i,s=n.isMobile,o=s===void 0?!1:s;return function(r,a,f){var u=f||l;return t.formatDate!==void 0&&!o?t.formatDate(r,a,u):a.split("").map(function(c,d,m){return ns[c]&&m[d-1]!=="\\"?ns[c](r,u,t):c!=="\\"?c:""}).join("")}},sa=function(n){var e=n.config,t=e===void 0?wl:e,i=n.l10n,l=i===void 0?ms:i;return function(s,o,r,a){if(!(s!==0&&!s)){var f=a||l,u,c=s;if(s instanceof Date)u=new Date(s.getTime());else if(typeof s!="string"&&s.toFixed!==void 0)u=new Date(s);else if(typeof s=="string"){var d=o||(t||wl).dateFormat,m=String(s).trim();if(m==="today")u=new Date,r=!0;else if(t&&t.parseDate)u=t.parseDate(s,d);else if(/Z$/.test(m)||/GMT$/.test(m))u=new Date(s);else{for(var h=void 0,_=[],g=0,y=0,S="";gMath.min(e,t)&&n=0?new Date:new Date(t.config.minDate.getTime()),ie=Dr(t.config);X.setHours(ie.hours,ie.minutes,ie.seconds,X.getMilliseconds()),t.selectedDates=[X],t.latestSelectedDateObj=X}J!==void 0&&J.type!=="blur"&&oi(J);var ce=t._input.value;c(),Qt(),t._input.value!==ce&&t._debouncedChange()}function f(J,X){return J%12+12*En(X===t.l10n.amPM[1])}function u(J){switch(J%24){case 0:case 12:return 12;default:return J%12}}function c(){if(!(t.hourElement===void 0||t.minuteElement===void 0)){var J=(parseInt(t.hourElement.value.slice(-2),10)||0)%24,X=(parseInt(t.minuteElement.value,10)||0)%60,ie=t.secondElement!==void 0?(parseInt(t.secondElement.value,10)||0)%60:0;t.amPM!==void 0&&(J=f(J,t.amPM.textContent));var ce=t.config.minTime!==void 0||t.config.minDate&&t.minDateHasTime&&t.latestSelectedDateObj&&wn(t.latestSelectedDateObj,t.config.minDate,!0)===0,$e=t.config.maxTime!==void 0||t.config.maxDate&&t.maxDateHasTime&&t.latestSelectedDateObj&&wn(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=Mr(t.config.minTime.getHours(),t.config.minTime.getMinutes(),t.config.minTime.getSeconds()),Ke=Mr(t.config.maxTime.getHours(),t.config.maxTime.getMinutes(),t.config.maxTime.getSeconds()),qe=Mr(J,X,ie);if(qe>Ke&&qe=12)]),t.secondElement!==void 0&&(t.secondElement.value=mn(ie)))}function h(J){var X=vn(J),ie=parseInt(X.value)+(J.delta||0);(ie/1e3>1||J.key==="Enter"&&!/[^\d]/.test(ie.toString()))&&Et(ie)}function _(J,X,ie,ce){if(X instanceof Array)return X.forEach(function($e){return _(J,$e,ie,ce)});if(J instanceof Array)return J.forEach(function($e){return _($e,X,ie,ce)});J.addEventListener(X,ie,ce),t._handlers.push({remove:function(){return J.removeEventListener(X,ie,ce)}})}function g(){gt("onChange")}function y(){if(t.config.wrap&&["open","close","toggle","clear"].forEach(function(ie){Array.prototype.forEach.call(t.element.querySelectorAll("[data-"+ie+"]"),function(ce){return _(ce,"click",t[ie])})}),t.isMobile){al();return}var J=id(ze,50);if(t._debouncedChange=id(g,vT),t.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&_(t.daysContainer,"mouseover",function(ie){t.config.mode==="range"&&Ee(vn(ie))}),_(t._input,"keydown",Me),t.calendarContainer!==void 0&&_(t.calendarContainer,"keydown",Me),!t.config.inline&&!t.config.static&&_(window,"resize",J),window.ontouchstart!==void 0?_(window.document,"touchstart",xe):_(window.document,"mousedown",xe),_(window.document,"focus",xe,{capture:!0}),t.config.clickOpens===!0&&(_(t._input,"focus",t.open),_(t._input,"click",t.open)),t.daysContainer!==void 0&&(_(t.monthNav,"click",qn),_(t.monthNav,["keyup","increment"],h),_(t.daysContainer,"click",ol)),t.timeContainer!==void 0&&t.minuteElement!==void 0&&t.hourElement!==void 0){var X=function(ie){return vn(ie).select()};_(t.timeContainer,["increment"],a),_(t.timeContainer,"blur",a,{capture:!0}),_(t.timeContainer,"click",T),_([t.hourElement,t.minuteElement],["focus","click"],X),t.secondElement!==void 0&&_(t.secondElement,"focus",function(){return t.secondElement&&t.secondElement.select()}),t.amPM!==void 0&&_(t.amPM,"click",function(ie){a(ie)})}t.config.allowInput&&_(t._input,"blur",Gt)}function S(J,X){var ie=J!==void 0?t.parseDate(J):t.latestSelectedDateObj||(t.config.minDate&&t.config.minDate>t.now?t.config.minDate:t.config.maxDate&&t.config.maxDate1),t.calendarContainer.appendChild(J);var $e=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&&(!$e&&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=ut("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 M(J,X,ie,ce){var $e=dt(X,!0),Ie=ut("span",J,X.getDate().toString());return Ie.dateObj=X,Ie.$i=ce,Ie.setAttribute("aria-label",t.formatDate(X,t.config.ariaDateFormat)),J.indexOf("hidden")===-1&&wn(X,t.now)===0&&(t.todayDateElem=Ie,Ie.classList.add("today"),Ie.setAttribute("aria-current","date")),$e?(Ie.tabIndex=-1,Ce(X)&&(Ie.classList.add("selected"),t.selectedDateElem=Ie,t.config.mode==="range"&&(an(Ie,"startRange",t.selectedDates[0]&&wn(X,t.selectedDates[0],!0)===0),an(Ie,"endRange",t.selectedDates[1]&&wn(X,t.selectedDates[1],!0)===0),J==="nextMonthDay"&&Ie.classList.add("inRange")))):Ie.classList.add("flatpickr-disabled"),t.config.mode==="range"&&Xe(X)&&!Ce(X)&&Ie.classList.add("inRange"),t.weekNumbers&&t.config.showMonths===1&&J!=="prevMonthDay"&&ce%7===6&&t.weekNumbers.insertAdjacentHTML("beforeend",""+t.config.getWeek(X)+""),gt("onDayCreate",Ie),Ie}function D(J){J.focus(),t.config.mode==="range"&&Ee(J)}function I(J){for(var X=J>0?0:t.config.showMonths-1,ie=J>0?t.config.showMonths:-1,ce=X;ce!=ie;ce+=J)for(var $e=t.daysContainer.children[ce],Ie=J>0?0:$e.children.length-1,Ke=J>0?$e.children.length:-1,qe=Ie;qe!=Ke;qe+=J){var Qe=$e.children[qe];if(Qe.className.indexOf("hidden")===-1&&dt(Qe.dateObj))return Qe}}function L(J,X){for(var ie=J.className.indexOf("Month")===-1?J.dateObj.getMonth():t.currentMonth,ce=X>0?t.config.showMonths:-1,$e=X>0?1:-1,Ie=ie-t.currentMonth;Ie!=ce;Ie+=$e)for(var Ke=t.daysContainer.children[Ie],qe=ie-t.currentMonth===Ie?J.$i+X:X<0?Ke.children.length-1:0,Qe=Ke.children.length,Re=qe;Re>=0&&Re0?Qe:-1);Re+=$e){var Ve=Ke.children[Re];if(Ve.className.indexOf("hidden")===-1&&dt(Ve.dateObj)&&Math.abs(J.$i-Re)>=Math.abs(X))return D(Ve)}t.changeMonth($e),R(I($e),0)}function R(J,X){var ie=s(),ce=mt(ie||document.body),$e=J!==void 0?J:ce?ie:t.selectedDateElem!==void 0&&mt(t.selectedDateElem)?t.selectedDateElem:t.todayDateElem!==void 0&&mt(t.todayDateElem)?t.todayDateElem:I(X>0?1:-1);$e===void 0?t._input.focus():ce?L($e,X):D($e)}function F(J,X){for(var ie=(new Date(J,X,1).getDay()-t.l10n.firstDayOfWeek+7)%7,ce=t.utils.getDaysInMonth((X-1+12)%12,J),$e=t.utils.getDaysInMonth(X,J),Ie=window.document.createDocumentFragment(),Ke=t.config.showMonths>1,qe=Ke?"prevMonthDay hidden":"prevMonthDay",Qe=Ke?"nextMonthDay hidden":"nextMonthDay",Re=ce+1-ie,Ve=0;Re<=ce;Re++,Ve++)Ie.appendChild(M("flatpickr-day "+qe,new Date(J,X-1,Re),Re,Ve));for(Re=1;Re<=$e;Re++,Ve++)Ie.appendChild(M("flatpickr-day",new Date(J,X,Re),Re,Ve));for(var kt=$e+1;kt<=42-ie&&(t.config.showMonths===1||Ve%7!==0);kt++,Ve++)Ie.appendChild(M("flatpickr-day "+Qe,new Date(J,X+1,kt%$e),kt,Ve));var Zn=ut("div","dayContainer");return Zn.appendChild(Ie),Zn}function N(){if(t.daysContainer!==void 0){eo(t.daysContainer),t.weekNumbers&&eo(t.weekNumbers);for(var J=document.createDocumentFragment(),X=0;X1||t.config.monthSelectorType!=="dropdown")){var J=function(ce){return t.config.minDate!==void 0&&t.currentYear===t.config.minDate.getFullYear()&&cet.config.maxDate.getMonth())};t.monthsDropdownContainer.tabIndex=-1,t.monthsDropdownContainer.innerHTML="";for(var X=0;X<12;X++)if(J(X)){var ie=ut("option","flatpickr-monthDropdown-month");ie.value=new Date(t.currentYear,X).getMonth().toString(),ie.textContent=Po(X,t.config.shorthandCurrentMonth,t.l10n),ie.tabIndex=-1,t.currentMonth===X&&(ie.selected=!0),t.monthsDropdownContainer.appendChild(ie)}}}function j(){var J=ut("div","flatpickr-month"),X=window.document.createDocumentFragment(),ie;t.config.showMonths>1||t.config.monthSelectorType==="static"?ie=ut("span","cur-month"):(t.monthsDropdownContainer=ut("select","flatpickr-monthDropdown-months"),t.monthsDropdownContainer.setAttribute("aria-label",t.l10n.monthAriaLabel),_(t.monthsDropdownContainer,"change",function(Ke){var qe=vn(Ke),Qe=parseInt(qe.value,10);t.changeMonth(Qe-t.currentMonth),gt("onMonthChange")}),P(),ie=t.monthsDropdownContainer);var ce=to("cur-year",{tabindex:"-1"}),$e=ce.getElementsByTagName("input")[0];$e.setAttribute("aria-label",t.l10n.yearAriaLabel),t.config.minDate&&$e.setAttribute("min",t.config.minDate.getFullYear().toString()),t.config.maxDate&&($e.setAttribute("max",t.config.maxDate.getFullYear().toString()),$e.disabled=!!t.config.minDate&&t.config.minDate.getFullYear()===t.config.maxDate.getFullYear());var Ie=ut("div","flatpickr-current-month");return Ie.appendChild(ie),Ie.appendChild(ce),X.appendChild(Ie),J.appendChild(X),{container:J,yearElement:$e,monthElement:ie}}function q(){eo(t.monthNav),t.monthNav.appendChild(t.prevMonthNav),t.config.showMonths&&(t.yearElements=[],t.monthElements=[]);for(var J=t.config.showMonths;J--;){var X=j();t.yearElements.push(X.yearElement),t.monthElements.push(X.monthElement),t.monthNav.appendChild(X.container)}t.monthNav.appendChild(t.nextMonthNav)}function W(){return t.monthNav=ut("div","flatpickr-months"),t.yearElements=[],t.monthElements=[],t.prevMonthNav=ut("span","flatpickr-prev-month"),t.prevMonthNav.innerHTML=t.config.prevArrow,t.nextMonthNav=ut("span","flatpickr-next-month"),t.nextMonthNav.innerHTML=t.config.nextArrow,q(),Object.defineProperty(t,"_hidePrevMonthArrow",{get:function(){return t.__hidePrevMonthArrow},set:function(J){t.__hidePrevMonthArrow!==J&&(an(t.prevMonthNav,"flatpickr-disabled",J),t.__hidePrevMonthArrow=J)}}),Object.defineProperty(t,"_hideNextMonthArrow",{get:function(){return t.__hideNextMonthArrow},set:function(J){t.__hideNextMonthArrow!==J&&(an(t.nextMonthNav,"flatpickr-disabled",J),t.__hideNextMonthArrow=J)}}),t.currentYearElement=t.yearElements[0],Yt(),t.monthNav}function G(){t.calendarContainer.classList.add("hasTime"),t.config.noCalendar&&t.calendarContainer.classList.add("noCalendar");var J=Dr(t.config);t.timeContainer=ut("div","flatpickr-time"),t.timeContainer.tabIndex=-1;var X=ut("span","flatpickr-time-separator",":"),ie=to("flatpickr-hour",{"aria-label":t.l10n.hourAriaLabel});t.hourElement=ie.getElementsByTagName("input")[0];var ce=to("flatpickr-minute",{"aria-label":t.l10n.minuteAriaLabel});if(t.minuteElement=ce.getElementsByTagName("input")[0],t.hourElement.tabIndex=t.minuteElement.tabIndex=-1,t.hourElement.value=mn(t.latestSelectedDateObj?t.latestSelectedDateObj.getHours():t.config.time_24hr?J.hours:u(J.hours)),t.minuteElement.value=mn(t.latestSelectedDateObj?t.latestSelectedDateObj.getMinutes():J.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(X),t.timeContainer.appendChild(ce),t.config.time_24hr&&t.timeContainer.classList.add("time24hr"),t.config.enableSeconds){t.timeContainer.classList.add("hasSeconds");var $e=to("flatpickr-second");t.secondElement=$e.getElementsByTagName("input")[0],t.secondElement.value=mn(t.latestSelectedDateObj?t.latestSelectedDateObj.getSeconds():J.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(ut("span","flatpickr-time-separator",":")),t.timeContainer.appendChild($e)}return t.config.time_24hr||(t.amPM=ut("span","flatpickr-am-pm",t.l10n.amPM[En((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 U(){t.weekdayContainer?eo(t.weekdayContainer):t.weekdayContainer=ut("div","flatpickr-weekdays");for(var J=t.config.showMonths;J--;){var X=ut("div","flatpickr-weekdaycontainer");t.weekdayContainer.appendChild(X)}return Z(),t.weekdayContainer}function Z(){if(t.weekdayContainer){var J=t.l10n.firstDayOfWeek,X=ld(t.l10n.weekdays.shorthand);J>0&&J @@ -66,7 +66,7 @@ var a0=Object.defineProperty;var f0=(n,e,t)=>e in n?a0(n,e,{enumerable:!0,config `),l=b("code"),l.textContent="id",s=Y(` , `),o=b("code"),o.textContent="created",r=Y(` , `),a=b("code"),a.textContent="updated",f=O(),D&&D.c(),u=Y(` - .`),c=O(),d=b("div");for(let N=0;NC=!1)),$.$set(j)},i(N){if(!M){for(let P=0;PI.name===M))}function c(M){return i.findIndex(D=>D===M)}function d(M,D){var I,L;!((I=l==null?void 0:l.schema)!=null&&I.length)||M===D||!D||(L=l==null?void 0:l.schema)!=null&&L.find(R=>R.name==M&&!R.toDelete)||t(0,l.indexes=l.indexes.map(R=>H.replaceIndexColumn(R,M,D)),l)}function m(M,D,I,L){I[L]=M,t(0,l)}const h=M=>o(M),_=M=>r(M),g=M=>d(M.detail.oldName,M.detail.newName);function y(M){n.$$.not_equal(l.schema,M)&&(l.schema=M,t(0,l))}const S=M=>{if(!M.detail)return;const D=M.detail.target;D.style.opacity=0,setTimeout(()=>{var I;(I=D==null?void 0:D.style)==null||I.removeProperty("opacity")},0),M.detail.dataTransfer.setDragImage(D,0,0)},T=()=>{Jt({})},$=M=>a(M.detail);function C(M){l=M,t(0,l)}return n.$$set=M=>{"collection"in M&&t(0,l=M.collection)},n.$$.update=()=>{n.$$.dirty&1&&typeof l.schema>"u"&&t(0,l.schema=[],l),n.$$.dirty&1&&(i=l.schema.filter(M=>!M.toDelete)||[])},[l,s,o,r,a,c,d,m,h,_,g,y,S,T,$,C]}class UC extends ge{constructor(e){super(),_e(this,e,BC,VC,me,{collection:0})}}const WC=n=>({isAdminOnly:n&512}),Ad=n=>({isAdminOnly:n[9]}),YC=n=>({isAdminOnly:n&512}),Ld=n=>({isAdminOnly:n[9]}),KC=n=>({isAdminOnly:n&512}),Nd=n=>({isAdminOnly:n[9]});function JC(n){let e,t;return e=new pe({props:{class:"form-field rule-field "+(n[4]?"requied":"")+" "+(n[9]?"disabled":""),name:n[3],$$slots:{default:[GC,({uniqueId:i})=>({18:i}),({uniqueId:i})=>i?262144:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&528&&(s.class="form-field rule-field "+(i[4]?"requied":"")+" "+(i[9]?"disabled":"")),l&8&&(s.name=i[3]),l&295655&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function ZC(n){let e;return{c(){e=b("div"),e.innerHTML='',p(e,"class","txt-center")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function Pd(n){let e,t,i;return{c(){e=b("button"),e.innerHTML=' Set Admins only',p(e,"type","button"),p(e,"class","btn btn-sm btn-transparent btn-hint lock-toggle svelte-1akuazq")},m(l,s){w(l,e,s),t||(i=K(e,"click",n[11]),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function Fd(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='Unlock and set custom rule
',p(e,"type","button"),p(e,"class","unlock-overlay svelte-1akuazq"),p(e,"aria-label","Unlock and set custom rule")},m(o,r){w(o,e,r),i=!0,l||(s=K(e,"click",n[10]),l=!0)},p:Q,i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.98},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.98},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function GC(n){let e,t,i,l,s,o,r=n[9]?"- Admins only":"",a,f,u,c,d,m,h,_,g,y,S;const T=n[12].beforeLabel,$=vt(T,n,n[15],Nd),C=n[12].afterLabel,M=vt(C,n,n[15],Ld);let D=!n[9]&&Pd(n);function I(j){n[14](j)}var L=n[7];function R(j,q){let W={id:j[18],baseCollection:j[1],disabled:j[9],placeholder:j[9]?"":j[5]};return j[0]!==void 0&&(W.value=j[0]),{props:W}}L&&(m=Ot(L,R(n)),n[13](m),ee.push(()=>be(m,"value",I)));let F=n[9]&&Fd(n);const N=n[12].default,P=vt(N,n,n[15],Ad);return{c(){e=b("div"),t=b("label"),$&&$.c(),i=O(),l=b("span"),s=Y(n[2]),o=O(),a=Y(r),f=O(),M&&M.c(),u=O(),D&&D.c(),d=O(),m&&B(m.$$.fragment),_=O(),F&&F.c(),g=O(),y=b("div"),P&&P.c(),p(l,"class","txt"),x(l,"txt-hint",n[9]),p(t,"for",c=n[18]),p(e,"class","input-wrapper svelte-1akuazq"),p(y,"class","help-block")},m(j,q){w(j,e,q),k(e,t),$&&$.m(t,null),k(t,i),k(t,l),k(l,s),k(l,o),k(l,a),k(t,f),M&&M.m(t,null),k(t,u),D&&D.m(t,null),k(e,d),m&&z(m,e,null),k(e,_),F&&F.m(e,null),w(j,g,q),w(j,y,q),P&&P.m(y,null),S=!0},p(j,q){if($&&$.p&&(!S||q&33280)&&St($,T,j,j[15],S?wt(T,j[15],q,KC):$t(j[15]),Nd),(!S||q&4)&&re(s,j[2]),(!S||q&512)&&r!==(r=j[9]?"- Admins only":"")&&re(a,r),(!S||q&512)&&x(l,"txt-hint",j[9]),M&&M.p&&(!S||q&33280)&&St(M,C,j,j[15],S?wt(C,j[15],q,YC):$t(j[15]),Ld),j[9]?D&&(D.d(1),D=null):D?D.p(j,q):(D=Pd(j),D.c(),D.m(t,null)),(!S||q&262144&&c!==(c=j[18]))&&p(t,"for",c),q&128&&L!==(L=j[7])){if(m){se();const W=m;A(W.$$.fragment,1,0,()=>{V(W,1)}),oe()}L?(m=Ot(L,R(j)),j[13](m),ee.push(()=>be(m,"value",I)),B(m.$$.fragment),E(m.$$.fragment,1),z(m,e,_)):m=null}else if(L){const W={};q&262144&&(W.id=j[18]),q&2&&(W.baseCollection=j[1]),q&512&&(W.disabled=j[9]),q&544&&(W.placeholder=j[9]?"":j[5]),!h&&q&1&&(h=!0,W.value=j[0],ke(()=>h=!1)),m.$set(W)}j[9]?F?(F.p(j,q),q&512&&E(F,1)):(F=Fd(j),F.c(),E(F,1),F.m(e,null)):F&&(se(),A(F,1,1,()=>{F=null}),oe()),P&&P.p&&(!S||q&33280)&&St(P,N,j,j[15],S?wt(N,j[15],q,WC):$t(j[15]),Ad)},i(j){S||(E($,j),E(M,j),m&&E(m.$$.fragment,j),E(F),E(P,j),S=!0)},o(j){A($,j),A(M,j),m&&A(m.$$.fragment,j),A(F),A(P,j),S=!1},d(j){j&&(v(e),v(g),v(y)),$&&$.d(j),M&&M.d(j),D&&D.d(),n[13](null),m&&V(m),F&&F.d(),P&&P.d(j)}}}function XC(n){let e,t,i,l;const s=[ZC,JC],o=[];function r(a,f){return a[8]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ye()},m(a,f){o[e].m(a,f),w(a,i,f),l=!0},p(a,[f]){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),A(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){l||(E(t),l=!0)},o(a){A(t),l=!1},d(a){a&&v(i),o[e].d(a)}}}let Rd;function QC(n,e,t){let i,{$$slots:l={},$$scope:s}=e,{collection:o=null}=e,{rule:r=null}=e,{label:a="Rule"}=e,{formKey:f="rule"}=e,{required:u=!1}=e,{placeholder:c="Leave empty to grant everyone access..."}=e,d=null,m=null,h=Rd,_=!1;g();async function g(){h||_||(t(8,_=!0),t(7,h=(await nt(()=>import("./FilterAutocompleteInput-7N2kJXRh.js"),__vite__mapDeps([0,1]),import.meta.url)).default),Rd=h,t(8,_=!1))}async function y(){t(0,r=m||""),await Xt(),d==null||d.focus()}async function S(){m=r,t(0,r=null)}function T(C){ee[C?"unshift":"push"](()=>{d=C,t(6,d)})}function $(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,f=C.formKey),"required"in C&&t(4,u=C.required),"placeholder"in C&&t(5,c=C.placeholder),"$$scope"in C&&t(15,s=C.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&t(9,i=r===null)},[r,o,a,f,u,c,d,h,_,i,y,S,l,T,$,s]}class $l extends ge{constructor(e){super(),_e(this,e,QC,XC,me,{collection:1,rule:0,label:2,formKey:3,required:4,placeholder:5})}}function qd(n,e,t){const i=n.slice();return i[11]=e[t],i}function jd(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$,C,M,D,I,L=de(n[2]),R=[];for(let F=0;F@request
filter:",c=O(),d=b("div"),d.innerHTML="@request.headers.* @request.query.* @request.data.* @request.auth.*",m=O(),h=b("hr"),_=O(),g=b("p"),g.innerHTML="You could also add constraints and query other collections using the @collection filter:",y=O(),S=b("div"),S.innerHTML="@collection.ANY_COLLECTION_NAME.*",T=O(),$=b("hr"),C=O(),M=b("p"),M.innerHTML=`Example rule: + .`),c=O(),d=b("div");for(let N=0;NC=!1)),$.$set(j)},i(N){if(!M){for(let P=0;PI.name===M))}function c(M){return i.findIndex(D=>D===M)}function d(M,D){var I,L;!((I=l==null?void 0:l.schema)!=null&&I.length)||M===D||!D||(L=l==null?void 0:l.schema)!=null&&L.find(R=>R.name==M&&!R.toDelete)||t(0,l.indexes=l.indexes.map(R=>H.replaceIndexColumn(R,M,D)),l)}function m(M,D,I,L){I[L]=M,t(0,l)}const h=M=>o(M),_=M=>r(M),g=M=>d(M.detail.oldName,M.detail.newName);function y(M){n.$$.not_equal(l.schema,M)&&(l.schema=M,t(0,l))}const S=M=>{if(!M.detail)return;const D=M.detail.target;D.style.opacity=0,setTimeout(()=>{var I;(I=D==null?void 0:D.style)==null||I.removeProperty("opacity")},0),M.detail.dataTransfer.setDragImage(D,0,0)},T=()=>{Jt({})},$=M=>a(M.detail);function C(M){l=M,t(0,l)}return n.$$set=M=>{"collection"in M&&t(0,l=M.collection)},n.$$.update=()=>{n.$$.dirty&1&&typeof l.schema>"u"&&t(0,l.schema=[],l),n.$$.dirty&1&&(i=l.schema.filter(M=>!M.toDelete)||[])},[l,s,o,r,a,c,d,m,h,_,g,y,S,T,$,C]}class UC extends ge{constructor(e){super(),_e(this,e,BC,VC,me,{collection:0})}}const WC=n=>({isAdminOnly:n&512}),Ad=n=>({isAdminOnly:n[9]}),YC=n=>({isAdminOnly:n&512}),Ld=n=>({isAdminOnly:n[9]}),KC=n=>({isAdminOnly:n&512}),Nd=n=>({isAdminOnly:n[9]});function JC(n){let e,t;return e=new pe({props:{class:"form-field rule-field "+(n[4]?"requied":"")+" "+(n[9]?"disabled":""),name:n[3],$$slots:{default:[GC,({uniqueId:i})=>({18:i}),({uniqueId:i})=>i?262144:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&528&&(s.class="form-field rule-field "+(i[4]?"requied":"")+" "+(i[9]?"disabled":"")),l&8&&(s.name=i[3]),l&295655&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function ZC(n){let e;return{c(){e=b("div"),e.innerHTML='',p(e,"class","txt-center")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function Pd(n){let e,t,i;return{c(){e=b("button"),e.innerHTML=' Set Admins only',p(e,"type","button"),p(e,"class","btn btn-sm btn-transparent btn-hint lock-toggle svelte-1akuazq")},m(l,s){w(l,e,s),t||(i=K(e,"click",n[11]),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function Fd(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='Unlock and set custom rule
',p(e,"type","button"),p(e,"class","unlock-overlay svelte-1akuazq"),p(e,"aria-label","Unlock and set custom rule")},m(o,r){w(o,e,r),i=!0,l||(s=K(e,"click",n[10]),l=!0)},p:Q,i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.98},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.98},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function GC(n){let e,t,i,l,s,o,r=n[9]?"- Admins only":"",a,f,u,c,d,m,h,_,g,y,S;const T=n[12].beforeLabel,$=vt(T,n,n[15],Nd),C=n[12].afterLabel,M=vt(C,n,n[15],Ld);let D=!n[9]&&Pd(n);function I(j){n[14](j)}var L=n[7];function R(j,q){let W={id:j[18],baseCollection:j[1],disabled:j[9],placeholder:j[9]?"":j[5]};return j[0]!==void 0&&(W.value=j[0]),{props:W}}L&&(m=Ot(L,R(n)),n[13](m),ee.push(()=>be(m,"value",I)));let F=n[9]&&Fd(n);const N=n[12].default,P=vt(N,n,n[15],Ad);return{c(){e=b("div"),t=b("label"),$&&$.c(),i=O(),l=b("span"),s=Y(n[2]),o=O(),a=Y(r),f=O(),M&&M.c(),u=O(),D&&D.c(),d=O(),m&&B(m.$$.fragment),_=O(),F&&F.c(),g=O(),y=b("div"),P&&P.c(),p(l,"class","txt"),x(l,"txt-hint",n[9]),p(t,"for",c=n[18]),p(e,"class","input-wrapper svelte-1akuazq"),p(y,"class","help-block")},m(j,q){w(j,e,q),k(e,t),$&&$.m(t,null),k(t,i),k(t,l),k(l,s),k(l,o),k(l,a),k(t,f),M&&M.m(t,null),k(t,u),D&&D.m(t,null),k(e,d),m&&z(m,e,null),k(e,_),F&&F.m(e,null),w(j,g,q),w(j,y,q),P&&P.m(y,null),S=!0},p(j,q){if($&&$.p&&(!S||q&33280)&&St($,T,j,j[15],S?wt(T,j[15],q,KC):$t(j[15]),Nd),(!S||q&4)&&re(s,j[2]),(!S||q&512)&&r!==(r=j[9]?"- Admins only":"")&&re(a,r),(!S||q&512)&&x(l,"txt-hint",j[9]),M&&M.p&&(!S||q&33280)&&St(M,C,j,j[15],S?wt(C,j[15],q,YC):$t(j[15]),Ld),j[9]?D&&(D.d(1),D=null):D?D.p(j,q):(D=Pd(j),D.c(),D.m(t,null)),(!S||q&262144&&c!==(c=j[18]))&&p(t,"for",c),q&128&&L!==(L=j[7])){if(m){se();const W=m;A(W.$$.fragment,1,0,()=>{V(W,1)}),oe()}L?(m=Ot(L,R(j)),j[13](m),ee.push(()=>be(m,"value",I)),B(m.$$.fragment),E(m.$$.fragment,1),z(m,e,_)):m=null}else if(L){const W={};q&262144&&(W.id=j[18]),q&2&&(W.baseCollection=j[1]),q&512&&(W.disabled=j[9]),q&544&&(W.placeholder=j[9]?"":j[5]),!h&&q&1&&(h=!0,W.value=j[0],ke(()=>h=!1)),m.$set(W)}j[9]?F?(F.p(j,q),q&512&&E(F,1)):(F=Fd(j),F.c(),E(F,1),F.m(e,null)):F&&(se(),A(F,1,1,()=>{F=null}),oe()),P&&P.p&&(!S||q&33280)&&St(P,N,j,j[15],S?wt(N,j[15],q,WC):$t(j[15]),Ad)},i(j){S||(E($,j),E(M,j),m&&E(m.$$.fragment,j),E(F),E(P,j),S=!0)},o(j){A($,j),A(M,j),m&&A(m.$$.fragment,j),A(F),A(P,j),S=!1},d(j){j&&(v(e),v(g),v(y)),$&&$.d(j),M&&M.d(j),D&&D.d(),n[13](null),m&&V(m),F&&F.d(),P&&P.d(j)}}}function XC(n){let e,t,i,l;const s=[ZC,JC],o=[];function r(a,f){return a[8]?0:1}return e=r(n),t=o[e]=s[e](n),{c(){t.c(),i=ye()},m(a,f){o[e].m(a,f),w(a,i,f),l=!0},p(a,[f]){let u=e;e=r(a),e===u?o[e].p(a,f):(se(),A(o[u],1,1,()=>{o[u]=null}),oe(),t=o[e],t?t.p(a,f):(t=o[e]=s[e](a),t.c()),E(t,1),t.m(i.parentNode,i))},i(a){l||(E(t),l=!0)},o(a){A(t),l=!1},d(a){a&&v(i),o[e].d(a)}}}let Rd;function QC(n,e,t){let i,{$$slots:l={},$$scope:s}=e,{collection:o=null}=e,{rule:r=null}=e,{label:a="Rule"}=e,{formKey:f="rule"}=e,{required:u=!1}=e,{placeholder:c="Leave empty to grant everyone access..."}=e,d=null,m=null,h=Rd,_=!1;g();async function g(){h||_||(t(8,_=!0),t(7,h=(await nt(()=>import("./FilterAutocompleteInput-ywiKWbDQ.js"),__vite__mapDeps([0,1]),import.meta.url)).default),Rd=h,t(8,_=!1))}async function y(){t(0,r=m||""),await Xt(),d==null||d.focus()}async function S(){m=r,t(0,r=null)}function T(C){ee[C?"unshift":"push"](()=>{d=C,t(6,d)})}function $(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,f=C.formKey),"required"in C&&t(4,u=C.required),"placeholder"in C&&t(5,c=C.placeholder),"$$scope"in C&&t(15,s=C.$$scope)},n.$$.update=()=>{n.$$.dirty&1&&t(9,i=r===null)},[r,o,a,f,u,c,d,h,_,i,y,S,l,T,$,s]}class $l extends ge{constructor(e){super(),_e(this,e,QC,XC,me,{collection:1,rule:0,label:2,formKey:3,required:4,placeholder:5})}}function qd(n,e,t){const i=n.slice();return i[11]=e[t],i}function jd(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$,C,M,D,I,L=de(n[2]),R=[];for(let F=0;F@request filter:",c=O(),d=b("div"),d.innerHTML="@request.headers.* @request.query.* @request.data.* @request.auth.*",m=O(),h=b("hr"),_=O(),g=b("p"),g.innerHTML="You could also add constraints and query other collections using the @collection filter:",y=O(),S=b("div"),S.innerHTML="@collection.ANY_COLLECTION_NAME.*",T=O(),$=b("hr"),C=O(),M=b("p"),M.innerHTML=`Example rule:
@request.auth.id != "" && created > "2022-01-01 00:00:00"`,p(l,"class","m-b-0"),p(o,"class","inline-flex flex-gap-5"),p(a,"class","m-t-10 m-b-5"),p(u,"class","m-b-0"),p(d,"class","inline-flex flex-gap-5"),p(h,"class","m-t-10 m-b-5"),p(g,"class","m-b-0"),p(S,"class","inline-flex flex-gap-5"),p($,"class","m-t-10 m-b-5"),p(i,"class","content"),p(t,"class","alert alert-warning m-0")},m(F,N){w(F,e,N),k(e,t),k(t,i),k(i,l),k(i,s),k(i,o);for(let P=0;P{I&&(D||(D=Ne(e,et,{duration:150},!0)),D.run(1))}),I=!0)},o(F){F&&(D||(D=Ne(e,et,{duration:150},!1)),D.run(0)),I=!1},d(F){F&&v(e),rt(R,F),F&&D&&D.end()}}}function Hd(n){let e,t=n[11]+"",i;return{c(){e=b("code"),i=Y(t)},m(l,s){w(l,e,s),k(e,i)},p(l,s){s&4&&t!==(t=l[11]+"")&&re(i,t)},d(l){l&&v(e)}}}function zd(n){let e,t,i,l,s,o,r,a,f;function u(g){n[6](g)}let c={label:"Create rule",formKey:"createRule",collection:n[0],$$slots:{afterLabel:[xC,({isAdminOnly:g})=>({10:g}),({isAdminOnly:g})=>g?1024:0]},$$scope:{ctx:n}};n[0].createRule!==void 0&&(c.rule=n[0].createRule),e=new $l({props:c}),ee.push(()=>be(e,"rule",u));function d(g){n[7](g)}let m={label:"Update rule",formKey:"updateRule",collection:n[0]};n[0].updateRule!==void 0&&(m.rule=n[0].updateRule),l=new $l({props:m}),ee.push(()=>be(l,"rule",d));function h(g){n[8](g)}let _={label:"Delete rule",formKey:"deleteRule",collection:n[0]};return n[0].deleteRule!==void 0&&(_.rule=n[0].deleteRule),r=new $l({props:_}),ee.push(()=>be(r,"rule",h)),{c(){B(e.$$.fragment),i=O(),B(l.$$.fragment),o=O(),B(r.$$.fragment)},m(g,y){z(e,g,y),w(g,i,y),z(l,g,y),w(g,o,y),z(r,g,y),f=!0},p(g,y){const S={};y&1&&(S.collection=g[0]),y&17408&&(S.$$scope={dirty:y,ctx:g}),!t&&y&1&&(t=!0,S.rule=g[0].createRule,ke(()=>t=!1)),e.$set(S);const T={};y&1&&(T.collection=g[0]),!s&&y&1&&(s=!0,T.rule=g[0].updateRule,ke(()=>s=!1)),l.$set(T);const $={};y&1&&($.collection=g[0]),!a&&y&1&&(a=!0,$.rule=g[0].deleteRule,ke(()=>a=!1)),r.$set($)},i(g){f||(E(e.$$.fragment,g),E(l.$$.fragment,g),E(r.$$.fragment,g),f=!0)},o(g){A(e.$$.fragment,g),A(l.$$.fragment,g),A(r.$$.fragment,g),f=!1},d(g){g&&(v(i),v(o)),V(e,g),V(l,g),V(r,g)}}}function Vd(n){let e,t,i;return{c(){e=b("i"),p(e,"class","ri-information-line link-hint")},m(l,s){w(l,e,s),t||(i=we(Le.call(null,e,{text:'The Create rule is executed after a "dry save" of the submitted data, giving you access to the main record fields as in every other rule.',position:"top"})),t=!0)},d(l){l&&v(e),t=!1,i()}}}function xC(n){let e,t=!n[10]&&Vd();return{c(){t&&t.c(),e=ye()},m(i,l){t&&t.m(i,l),w(i,e,l)},p(i,l){i[10]?t&&(t.d(1),t=null):t||(t=Vd(),t.c(),t.m(e.parentNode,e))},d(i){i&&v(e),t&&t.d(i)}}}function Bd(n){let e,t,i;function l(o){n[9](o)}let s={label:"Manage rule",formKey:"options.manageRule",placeholder:"",required:n[0].options.manageRule!==null,collection:n[0],$$slots:{default:[e6]},$$scope:{ctx:n}};return n[0].options.manageRule!==void 0&&(s.rule=n[0].options.manageRule),e=new $l({props:s}),ee.push(()=>be(e,"rule",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};r&1&&(a.required=o[0].options.manageRule!==null),r&1&&(a.collection=o[0]),r&16384&&(a.$$scope={dirty:r,ctx:o}),!t&&r&1&&(t=!0,a.rule=o[0].options.manageRule,ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function e6(n){let e,t,i;return{c(){e=b("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=b("p"),i.innerHTML="This rule is executed in addition to the create and update API rules."},m(l,s){w(l,e,s),w(l,t,s),w(l,i,s)},p:Q,d(l){l&&(v(e),v(t),v(i))}}}function t6(n){var N,P;let e,t,i,l,s,o=n[1]?"Hide available fields":"Show available fields",r,a,f,u,c,d,m,h,_,g,y,S,T,$,C=n[1]&&jd(n);function M(j){n[4](j)}let D={label:"List/Search rule",formKey:"listRule",collection:n[0]};n[0].listRule!==void 0&&(D.rule=n[0].listRule),u=new $l({props:D}),ee.push(()=>be(u,"rule",M));function I(j){n[5](j)}let L={label:"View rule",formKey:"viewRule",collection:n[0]};n[0].viewRule!==void 0&&(L.rule=n[0].viewRule),m=new $l({props:L}),ee.push(()=>be(m,"rule",I));let R=((N=n[0])==null?void 0:N.type)!=="view"&&zd(n),F=((P=n[0])==null?void 0:P.type)==="auth"&&Bd(n);return{c(){e=b("div"),t=b("div"),i=b("p"),i.innerHTML=`All rules follow the @@ -75,7 +75,7 @@ var a0=Object.defineProperty;var f0=(n,e,t)=>e in n?a0(n,e,{enumerable:!0,config
If your query doesn't have a suitable one, you can use the universal (ROW_NUMBER() OVER()) as id.
  • Expressions must be aliased with a valid formatted field name (eg. - MAX(balance) as maxBalance).
  • `,f=O(),_&&_.c(),u=ye(),p(t,"class","txt"),p(e,"for",i=n[8]),p(a,"class","help-block")},m(g,y){w(g,e,y),k(e,t),w(g,l,y),m[s].m(g,y),w(g,r,y),w(g,a,y),w(g,f,y),_&&_.m(g,y),w(g,u,y),c=!0},p(g,y){(!c||y&256&&i!==(i=g[8]))&&p(e,"for",i);let S=s;s=h(g),s===S?m[s].p(g,y):(se(),A(m[S],1,1,()=>{m[S]=null}),oe(),o=m[s],o?o.p(g,y):(o=m[s]=d[s](g),o.c()),E(o,1),o.m(r.parentNode,r)),g[3].length?_?_.p(g,y):(_=Wd(g),_.c(),_.m(u.parentNode,u)):_&&(_.d(1),_=null)},i(g){c||(E(o),c=!0)},o(g){A(o),c=!1},d(g){g&&(v(e),v(l),v(r),v(a),v(f),v(u)),m[s].d(g),_&&_.d(g)}}}function r6(n){let e,t;return e=new pe({props:{class:"form-field required "+(n[3].length?"error":""),name:"options.query",$$slots:{default:[o6,({uniqueId:i})=>({8:i}),({uniqueId:i})=>i?256:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&8&&(s.class="form-field required "+(i[3].length?"error":"")),l&4367&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function a6(n,e,t){let i;Ue(n,mi,c=>t(4,i=c));let{collection:l}=e,s,o=!1,r=[];function a(c){var h;t(3,r=[]);const d=H.getNestedVal(c,"schema",null);if(H.isEmpty(d))return;if(d!=null&&d.message){r.push(d==null?void 0:d.message);return}const m=H.extractColumnsFromQuery((h=l==null?void 0:l.options)==null?void 0:h.query);H.removeByValue(m,"id"),H.removeByValue(m,"created"),H.removeByValue(m,"updated");for(let _ in d)for(let g in d[_]){const y=d[_][g].message,S=m[_]||_;r.push(H.sentenize(S+": "+y))}}jt(async()=>{t(2,o=!0);try{t(1,s=(await nt(()=>import("./CodeEditor-f9FE6aAj.js"),__vite__mapDeps([2,1]),import.meta.url)).default)}catch(c){console.warn(c)}t(2,o=!1)});function f(c){n.$$.not_equal(l.options.query,c)&&(l.options.query=c,t(0,l))}const u=()=>{r.length&&li("schema")};return n.$$set=c=>{"collection"in c&&t(0,l=c.collection)},n.$$.update=()=>{n.$$.dirty&16&&a(i)},[l,s,o,r,i,f,u]}class f6 extends ge{constructor(e){super(),_e(this,e,a6,r6,me,{collection:0})}}const u6=n=>({active:n&1}),Kd=n=>({active:n[0]});function Jd(n){let e,t,i;const l=n[15].default,s=vt(l,n,n[14],null);return{c(){e=b("div"),s&&s.c(),p(e,"class","accordion-content")},m(o,r){w(o,e,r),s&&s.m(e,null),i=!0},p(o,r){s&&s.p&&(!i||r&16384)&&St(s,l,o,o[14],i?wt(l,o[14],r,null):$t(o[14]),null)},i(o){i||(E(s,o),o&&Ye(()=>{i&&(t||(t=Ne(e,et,{duration:150},!0)),t.run(1))}),i=!0)},o(o){A(s,o),o&&(t||(t=Ne(e,et,{duration:150},!1)),t.run(0)),i=!1},d(o){o&&v(e),s&&s.d(o),o&&t&&t.end()}}}function c6(n){let e,t,i,l,s,o,r;const a=n[15].header,f=vt(a,n,n[14],Kd);let u=n[0]&&Jd(n);return{c(){e=b("div"),t=b("button"),f&&f.c(),i=O(),u&&u.c(),p(t,"type","button"),p(t,"class","accordion-header"),p(t,"draggable",n[2]),x(t,"interactive",n[3]),p(e,"class",l="accordion "+(n[7]?"drag-over":"")+" "+n[1]),x(e,"active",n[0])},m(c,d){w(c,e,d),k(e,t),f&&f.m(t,null),k(e,i),u&&u.m(e,null),n[22](e),s=!0,o||(r=[K(t,"click",Be(n[17])),K(t,"drop",Be(n[18])),K(t,"dragstart",n[19]),K(t,"dragenter",n[20]),K(t,"dragleave",n[21]),K(t,"dragover",Be(n[16]))],o=!0)},p(c,[d]){f&&f.p&&(!s||d&16385)&&St(f,a,c,c[14],s?wt(a,c[14],d,u6):$t(c[14]),Kd),(!s||d&4)&&p(t,"draggable",c[2]),(!s||d&8)&&x(t,"interactive",c[3]),c[0]?u?(u.p(c,d),d&1&&E(u,1)):(u=Jd(c),u.c(),E(u,1),u.m(e,null)):u&&(se(),A(u,1,1,()=>{u=null}),oe()),(!s||d&130&&l!==(l="accordion "+(c[7]?"drag-over":"")+" "+c[1]))&&p(e,"class",l),(!s||d&131)&&x(e,"active",c[0])},i(c){s||(E(f,c),E(u),s=!0)},o(c){A(f,c),A(u),s=!1},d(c){c&&v(e),f&&f.d(c),u&&u.d(),n[22](null),o=!1,ve(r)}}}function d6(n,e,t){let{$$slots:i={},$$scope:l}=e;const s=st();let o,r,{class:a=""}=e,{draggable:f=!1}=e,{active:u=!1}=e,{interactive:c=!0}=e,{single:d=!1}=e,m=!1;function h(){return!!u}function _(){S(),t(0,u=!0),s("expand")}function g(){t(0,u=!1),clearTimeout(r),s("collapse")}function y(){s("toggle"),u?g():_()}function S(){if(d&&o.closest(".accordions")){const R=o.closest(".accordions").querySelectorAll(".accordion.active .accordion-header.interactive");for(const F of R)F.click()}}jt(()=>()=>clearTimeout(r));function T(R){Te.call(this,n,R)}const $=()=>c&&y(),C=R=>{f&&(t(7,m=!1),S(),s("drop",R))},M=R=>f&&s("dragstart",R),D=R=>{f&&(t(7,m=!0),s("dragenter",R))},I=R=>{f&&(t(7,m=!1),s("dragleave",R))};function L(R){ee[R?"unshift":"push"](()=>{o=R,t(6,o)})}return n.$$set=R=>{"class"in R&&t(1,a=R.class),"draggable"in R&&t(2,f=R.draggable),"active"in R&&t(0,u=R.active),"interactive"in R&&t(3,c=R.interactive),"single"in R&&t(9,d=R.single),"$$scope"in R&&t(14,l=R.$$scope)},n.$$.update=()=>{n.$$.dirty&8257&&u&&(clearTimeout(r),t(13,r=setTimeout(()=>{o!=null&&o.scrollIntoViewIfNeeded?o.scrollIntoViewIfNeeded():o!=null&&o.scrollIntoView&&o.scrollIntoView({behavior:"smooth",block:"nearest"})},200)))},[u,a,f,c,y,S,o,m,s,d,h,_,g,r,l,i,T,$,C,M,D,I,L]}class ho extends ge{constructor(e){super(),_e(this,e,d6,c6,me,{class:1,draggable:2,active:0,interactive:3,single:9,isExpanded:10,expand:11,collapse:12,toggle:4,collapseSiblings:5})}get isExpanded(){return this.$$.ctx[10]}get expand(){return this.$$.ctx[11]}get collapse(){return this.$$.ctx[12]}get toggle(){return this.$$.ctx[4]}get collapseSiblings(){return this.$$.ctx[5]}}function p6(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){w(f,e,u),e.checked=n[0].options.allowUsernameAuth,w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[5]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].options.allowUsernameAuth),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function m6(n){let e,t;return e=new pe({props:{class:"form-field form-field-toggle m-b-0",name:"options.allowUsernameAuth",$$slots:{default:[p6,({uniqueId:i})=>({13:i}),({uniqueId:i})=>i?8192:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&24577&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function h6(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function _6(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Zd(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,l||(s=we(Le.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function g6(n){let e,t,i,l,s,o;function r(c,d){return c[0].options.allowUsernameAuth?_6:h6}let a=r(n),f=a(n),u=n[3]&&Zd();return{c(){e=b("div"),e.innerHTML=' Username/Password',t=O(),i=b("div"),l=O(),f.c(),s=O(),u&&u.c(),o=ye(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(c,d){w(c,e,d),w(c,t,d),w(c,i,d),w(c,l,d),f.m(c,d),w(c,s,d),u&&u.m(c,d),w(c,o,d)},p(c,d){a!==(a=r(c))&&(f.d(1),f=a(c),f&&(f.c(),f.m(s.parentNode,s))),c[3]?u?d&8&&E(u,1):(u=Zd(),u.c(),E(u,1),u.m(o.parentNode,o)):u&&(se(),A(u,1,1,()=>{u=null}),oe())},d(c){c&&(v(e),v(t),v(i),v(l),v(s),v(o)),f.d(c),u&&u.d(c)}}}function b6(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){w(f,e,u),e.checked=n[0].options.allowEmailAuth,w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[6]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].options.allowEmailAuth),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function Gd(n){let e,t,i,l,s,o,r,a;return i=new pe({props:{class:"form-field "+(H.isEmpty(n[0].options.onlyEmailDomains)?"":"disabled"),name:"options.exceptEmailDomains",$$slots:{default:[k6,({uniqueId:f})=>({13:f}),({uniqueId:f})=>f?8192:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field "+(H.isEmpty(n[0].options.exceptEmailDomains)?"":"disabled"),name:"options.onlyEmailDomains",$$slots:{default:[y6,({uniqueId:f})=>({13:f}),({uniqueId:f})=>f?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),p(t,"class","col-lg-6"),p(s,"class","col-lg-6"),p(e,"class","grid grid-sm p-t-sm")},m(f,u){w(f,e,u),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),a=!0},p(f,u){const c={};u&1&&(c.class="form-field "+(H.isEmpty(f[0].options.onlyEmailDomains)?"":"disabled")),u&24577&&(c.$$scope={dirty:u,ctx:f}),i.$set(c);const d={};u&1&&(d.class="form-field "+(H.isEmpty(f[0].options.exceptEmailDomains)?"":"disabled")),u&24577&&(d.$$scope={dirty:u,ctx:f}),o.$set(d)},i(f){a||(E(i.$$.fragment,f),E(o.$$.fragment,f),f&&Ye(()=>{a&&(r||(r=Ne(e,et,{duration:150},!0)),r.run(1))}),a=!0)},o(f){A(i.$$.fragment,f),A(o.$$.fragment,f),f&&(r||(r=Ne(e,et,{duration:150},!1)),r.run(0)),a=!1},d(f){f&&v(e),V(i),V(o),f&&r&&r.end()}}}function k6(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;function h(g){n[7](g)}let _={id:n[13],disabled:!H.isEmpty(n[0].options.onlyEmailDomains)};return n[0].options.exceptEmailDomains!==void 0&&(_.value=n[0].options.exceptEmailDomains),r=new Nl({props:_}),ee.push(()=>be(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Except domains",i=O(),l=b("i"),o=O(),B(r.$$.fragment),f=O(),u=b("div"),u.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[13]),p(u,"class","help-block")},m(g,y){w(g,e,y),k(e,t),k(e,i),k(e,l),w(g,o,y),z(r,g,y),w(g,f,y),w(g,u,y),c=!0,d||(m=we(Le.call(null,l,{text:`Email domains that are NOT allowed to sign up. + MAX(balance) as maxBalance).`,f=O(),_&&_.c(),u=ye(),p(t,"class","txt"),p(e,"for",i=n[8]),p(a,"class","help-block")},m(g,y){w(g,e,y),k(e,t),w(g,l,y),m[s].m(g,y),w(g,r,y),w(g,a,y),w(g,f,y),_&&_.m(g,y),w(g,u,y),c=!0},p(g,y){(!c||y&256&&i!==(i=g[8]))&&p(e,"for",i);let S=s;s=h(g),s===S?m[s].p(g,y):(se(),A(m[S],1,1,()=>{m[S]=null}),oe(),o=m[s],o?o.p(g,y):(o=m[s]=d[s](g),o.c()),E(o,1),o.m(r.parentNode,r)),g[3].length?_?_.p(g,y):(_=Wd(g),_.c(),_.m(u.parentNode,u)):_&&(_.d(1),_=null)},i(g){c||(E(o),c=!0)},o(g){A(o),c=!1},d(g){g&&(v(e),v(l),v(r),v(a),v(f),v(u)),m[s].d(g),_&&_.d(g)}}}function r6(n){let e,t;return e=new pe({props:{class:"form-field required "+(n[3].length?"error":""),name:"options.query",$$slots:{default:[o6,({uniqueId:i})=>({8:i}),({uniqueId:i})=>i?256:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&8&&(s.class="form-field required "+(i[3].length?"error":"")),l&4367&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function a6(n,e,t){let i;Ue(n,mi,c=>t(4,i=c));let{collection:l}=e,s,o=!1,r=[];function a(c){var h;t(3,r=[]);const d=H.getNestedVal(c,"schema",null);if(H.isEmpty(d))return;if(d!=null&&d.message){r.push(d==null?void 0:d.message);return}const m=H.extractColumnsFromQuery((h=l==null?void 0:l.options)==null?void 0:h.query);H.removeByValue(m,"id"),H.removeByValue(m,"created"),H.removeByValue(m,"updated");for(let _ in d)for(let g in d[_]){const y=d[_][g].message,S=m[_]||_;r.push(H.sentenize(S+": "+y))}}jt(async()=>{t(2,o=!0);try{t(1,s=(await nt(()=>import("./CodeEditor-rvo5l1QW.js"),__vite__mapDeps([2,1]),import.meta.url)).default)}catch(c){console.warn(c)}t(2,o=!1)});function f(c){n.$$.not_equal(l.options.query,c)&&(l.options.query=c,t(0,l))}const u=()=>{r.length&&li("schema")};return n.$$set=c=>{"collection"in c&&t(0,l=c.collection)},n.$$.update=()=>{n.$$.dirty&16&&a(i)},[l,s,o,r,i,f,u]}class f6 extends ge{constructor(e){super(),_e(this,e,a6,r6,me,{collection:0})}}const u6=n=>({active:n&1}),Kd=n=>({active:n[0]});function Jd(n){let e,t,i;const l=n[15].default,s=vt(l,n,n[14],null);return{c(){e=b("div"),s&&s.c(),p(e,"class","accordion-content")},m(o,r){w(o,e,r),s&&s.m(e,null),i=!0},p(o,r){s&&s.p&&(!i||r&16384)&&St(s,l,o,o[14],i?wt(l,o[14],r,null):$t(o[14]),null)},i(o){i||(E(s,o),o&&Ye(()=>{i&&(t||(t=Ne(e,et,{duration:150},!0)),t.run(1))}),i=!0)},o(o){A(s,o),o&&(t||(t=Ne(e,et,{duration:150},!1)),t.run(0)),i=!1},d(o){o&&v(e),s&&s.d(o),o&&t&&t.end()}}}function c6(n){let e,t,i,l,s,o,r;const a=n[15].header,f=vt(a,n,n[14],Kd);let u=n[0]&&Jd(n);return{c(){e=b("div"),t=b("button"),f&&f.c(),i=O(),u&&u.c(),p(t,"type","button"),p(t,"class","accordion-header"),p(t,"draggable",n[2]),x(t,"interactive",n[3]),p(e,"class",l="accordion "+(n[7]?"drag-over":"")+" "+n[1]),x(e,"active",n[0])},m(c,d){w(c,e,d),k(e,t),f&&f.m(t,null),k(e,i),u&&u.m(e,null),n[22](e),s=!0,o||(r=[K(t,"click",Be(n[17])),K(t,"drop",Be(n[18])),K(t,"dragstart",n[19]),K(t,"dragenter",n[20]),K(t,"dragleave",n[21]),K(t,"dragover",Be(n[16]))],o=!0)},p(c,[d]){f&&f.p&&(!s||d&16385)&&St(f,a,c,c[14],s?wt(a,c[14],d,u6):$t(c[14]),Kd),(!s||d&4)&&p(t,"draggable",c[2]),(!s||d&8)&&x(t,"interactive",c[3]),c[0]?u?(u.p(c,d),d&1&&E(u,1)):(u=Jd(c),u.c(),E(u,1),u.m(e,null)):u&&(se(),A(u,1,1,()=>{u=null}),oe()),(!s||d&130&&l!==(l="accordion "+(c[7]?"drag-over":"")+" "+c[1]))&&p(e,"class",l),(!s||d&131)&&x(e,"active",c[0])},i(c){s||(E(f,c),E(u),s=!0)},o(c){A(f,c),A(u),s=!1},d(c){c&&v(e),f&&f.d(c),u&&u.d(),n[22](null),o=!1,ve(r)}}}function d6(n,e,t){let{$$slots:i={},$$scope:l}=e;const s=st();let o,r,{class:a=""}=e,{draggable:f=!1}=e,{active:u=!1}=e,{interactive:c=!0}=e,{single:d=!1}=e,m=!1;function h(){return!!u}function _(){S(),t(0,u=!0),s("expand")}function g(){t(0,u=!1),clearTimeout(r),s("collapse")}function y(){s("toggle"),u?g():_()}function S(){if(d&&o.closest(".accordions")){const R=o.closest(".accordions").querySelectorAll(".accordion.active .accordion-header.interactive");for(const F of R)F.click()}}jt(()=>()=>clearTimeout(r));function T(R){Te.call(this,n,R)}const $=()=>c&&y(),C=R=>{f&&(t(7,m=!1),S(),s("drop",R))},M=R=>f&&s("dragstart",R),D=R=>{f&&(t(7,m=!0),s("dragenter",R))},I=R=>{f&&(t(7,m=!1),s("dragleave",R))};function L(R){ee[R?"unshift":"push"](()=>{o=R,t(6,o)})}return n.$$set=R=>{"class"in R&&t(1,a=R.class),"draggable"in R&&t(2,f=R.draggable),"active"in R&&t(0,u=R.active),"interactive"in R&&t(3,c=R.interactive),"single"in R&&t(9,d=R.single),"$$scope"in R&&t(14,l=R.$$scope)},n.$$.update=()=>{n.$$.dirty&8257&&u&&(clearTimeout(r),t(13,r=setTimeout(()=>{o!=null&&o.scrollIntoViewIfNeeded?o.scrollIntoViewIfNeeded():o!=null&&o.scrollIntoView&&o.scrollIntoView({behavior:"smooth",block:"nearest"})},200)))},[u,a,f,c,y,S,o,m,s,d,h,_,g,r,l,i,T,$,C,M,D,I,L]}class ho extends ge{constructor(e){super(),_e(this,e,d6,c6,me,{class:1,draggable:2,active:0,interactive:3,single:9,isExpanded:10,expand:11,collapse:12,toggle:4,collapseSiblings:5})}get isExpanded(){return this.$$.ctx[10]}get expand(){return this.$$.ctx[11]}get collapse(){return this.$$.ctx[12]}get toggle(){return this.$$.ctx[4]}get collapseSiblings(){return this.$$.ctx[5]}}function p6(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){w(f,e,u),e.checked=n[0].options.allowUsernameAuth,w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[5]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].options.allowUsernameAuth),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function m6(n){let e,t;return e=new pe({props:{class:"form-field form-field-toggle m-b-0",name:"options.allowUsernameAuth",$$slots:{default:[p6,({uniqueId:i})=>({13:i}),({uniqueId:i})=>i?8192:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&24577&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function h6(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function _6(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Zd(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,l||(s=we(Le.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function g6(n){let e,t,i,l,s,o;function r(c,d){return c[0].options.allowUsernameAuth?_6:h6}let a=r(n),f=a(n),u=n[3]&&Zd();return{c(){e=b("div"),e.innerHTML=' Username/Password',t=O(),i=b("div"),l=O(),f.c(),s=O(),u&&u.c(),o=ye(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(c,d){w(c,e,d),w(c,t,d),w(c,i,d),w(c,l,d),f.m(c,d),w(c,s,d),u&&u.m(c,d),w(c,o,d)},p(c,d){a!==(a=r(c))&&(f.d(1),f=a(c),f&&(f.c(),f.m(s.parentNode,s))),c[3]?u?d&8&&E(u,1):(u=Zd(),u.c(),E(u,1),u.m(o.parentNode,o)):u&&(se(),A(u,1,1,()=>{u=null}),oe())},d(c){c&&(v(e),v(t),v(i),v(l),v(s),v(o)),f.d(c),u&&u.d(c)}}}function b6(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){w(f,e,u),e.checked=n[0].options.allowEmailAuth,w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[6]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].options.allowEmailAuth),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function Gd(n){let e,t,i,l,s,o,r,a;return i=new pe({props:{class:"form-field "+(H.isEmpty(n[0].options.onlyEmailDomains)?"":"disabled"),name:"options.exceptEmailDomains",$$slots:{default:[k6,({uniqueId:f})=>({13:f}),({uniqueId:f})=>f?8192:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field "+(H.isEmpty(n[0].options.exceptEmailDomains)?"":"disabled"),name:"options.onlyEmailDomains",$$slots:{default:[y6,({uniqueId:f})=>({13:f}),({uniqueId:f})=>f?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),p(t,"class","col-lg-6"),p(s,"class","col-lg-6"),p(e,"class","grid grid-sm p-t-sm")},m(f,u){w(f,e,u),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),a=!0},p(f,u){const c={};u&1&&(c.class="form-field "+(H.isEmpty(f[0].options.onlyEmailDomains)?"":"disabled")),u&24577&&(c.$$scope={dirty:u,ctx:f}),i.$set(c);const d={};u&1&&(d.class="form-field "+(H.isEmpty(f[0].options.exceptEmailDomains)?"":"disabled")),u&24577&&(d.$$scope={dirty:u,ctx:f}),o.$set(d)},i(f){a||(E(i.$$.fragment,f),E(o.$$.fragment,f),f&&Ye(()=>{a&&(r||(r=Ne(e,et,{duration:150},!0)),r.run(1))}),a=!0)},o(f){A(i.$$.fragment,f),A(o.$$.fragment,f),f&&(r||(r=Ne(e,et,{duration:150},!1)),r.run(0)),a=!1},d(f){f&&v(e),V(i),V(o),f&&r&&r.end()}}}function k6(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;function h(g){n[7](g)}let _={id:n[13],disabled:!H.isEmpty(n[0].options.onlyEmailDomains)};return n[0].options.exceptEmailDomains!==void 0&&(_.value=n[0].options.exceptEmailDomains),r=new Nl({props:_}),ee.push(()=>be(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Except domains",i=O(),l=b("i"),o=O(),B(r.$$.fragment),f=O(),u=b("div"),u.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[13]),p(u,"class","help-block")},m(g,y){w(g,e,y),k(e,t),k(e,i),k(e,l),w(g,o,y),z(r,g,y),w(g,f,y),w(g,u,y),c=!0,d||(m=we(Le.call(null,l,{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&8192&&s!==(s=g[13]))&&p(e,"for",s);const S={};y&8192&&(S.id=g[13]),y&1&&(S.disabled=!H.isEmpty(g[0].options.onlyEmailDomains)),!a&&y&1&&(a=!0,S.value=g[0].options.exceptEmailDomains,ke(()=>a=!1)),r.$set(S)},i(g){c||(E(r.$$.fragment,g),c=!0)},o(g){A(r.$$.fragment,g),c=!1},d(g){g&&(v(e),v(o),v(f),v(u)),V(r,g),d=!1,m()}}}function y6(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;function h(g){n[8](g)}let _={id:n[13],disabled:!H.isEmpty(n[0].options.exceptEmailDomains)};return n[0].options.onlyEmailDomains!==void 0&&(_.value=n[0].options.onlyEmailDomains),r=new Nl({props:_}),ee.push(()=>be(r,"value",h)),{c(){e=b("label"),t=b("span"),t.textContent="Only domains",i=O(),l=b("i"),o=O(),B(r.$$.fragment),f=O(),u=b("div"),u.textContent="Use comma as separator.",p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[13]),p(u,"class","help-block")},m(g,y){w(g,e,y),k(e,t),k(e,i),k(e,l),w(g,o,y),z(r,g,y),w(g,f,y),w(g,u,y),c=!0,d||(m=we(Le.call(null,l,{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&8192&&s!==(s=g[13]))&&p(e,"for",s);const S={};y&8192&&(S.id=g[13]),y&1&&(S.disabled=!H.isEmpty(g[0].options.exceptEmailDomains)),!a&&y&1&&(a=!0,S.value=g[0].options.onlyEmailDomains,ke(()=>a=!1)),r.$set(S)},i(g){c||(E(r.$$.fragment,g),c=!0)},o(g){A(r.$$.fragment,g),c=!1},d(g){g&&(v(e),v(o),v(f),v(u)),V(r,g),d=!1,m()}}}function v6(n){let e,t,i,l;e=new pe({props:{class:"form-field form-field-toggle m-0",name:"options.allowEmailAuth",$$slots:{default:[b6,({uniqueId:o})=>({13:o}),({uniqueId:o})=>o?8192:0]},$$scope:{ctx:n}}});let s=n[0].options.allowEmailAuth&&Gd(n);return{c(){B(e.$$.fragment),t=O(),s&&s.c(),i=ye()},m(o,r){z(e,o,r),w(o,t,r),s&&s.m(o,r),w(o,i,r),l=!0},p(o,r){const a={};r&24577&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].options.allowEmailAuth?s?(s.p(o,r),r&1&&E(s,1)):(s=Gd(o),s.c(),E(s,1),s.m(i.parentNode,i)):s&&(se(),A(s,1,1,()=>{s=null}),oe())},i(o){l||(E(e.$$.fragment,o),E(s),l=!0)},o(o){A(e.$$.fragment,o),A(s),l=!1},d(o){o&&(v(t),v(i)),V(e,o),s&&s.d(o)}}}function w6(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function S6(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Xd(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,l||(s=we(Le.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function $6(n){let e,t,i,l,s,o;function r(c,d){return c[0].options.allowEmailAuth?S6:w6}let a=r(n),f=a(n),u=n[2]&&Xd();return{c(){e=b("div"),e.innerHTML=' Email/Password',t=O(),i=b("div"),l=O(),f.c(),s=O(),u&&u.c(),o=ye(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(c,d){w(c,e,d),w(c,t,d),w(c,i,d),w(c,l,d),f.m(c,d),w(c,s,d),u&&u.m(c,d),w(c,o,d)},p(c,d){a!==(a=r(c))&&(f.d(1),f=a(c),f&&(f.c(),f.m(s.parentNode,s))),c[2]?u?d&4&&E(u,1):(u=Xd(),u.c(),E(u,1),u.m(o.parentNode,o)):u&&(se(),A(u,1,1,()=>{u=null}),oe())},d(c){c&&(v(e),v(t),v(i),v(l),v(s),v(o)),f.d(c),u&&u.d(c)}}}function T6(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Enable"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){w(f,e,u),e.checked=n[0].options.allowOAuth2Auth,w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[9]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].options.allowOAuth2Auth),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function Qd(n){let e,t,i;return{c(){e=b("div"),e.innerHTML='
    ',p(e,"class","block")},m(l,s){w(l,e,s),i=!0},i(l){i||(l&&Ye(()=>{i&&(t||(t=Ne(e,et,{duration:150},!0)),t.run(1))}),i=!0)},o(l){l&&(t||(t=Ne(e,et,{duration:150},!1)),t.run(0)),i=!1},d(l){l&&v(e),l&&t&&t.end()}}}function C6(n){let e,t,i,l;e=new pe({props:{class:"form-field form-field-toggle m-b-0",name:"options.allowOAuth2Auth",$$slots:{default:[T6,({uniqueId:o})=>({13:o}),({uniqueId:o})=>o?8192:0]},$$scope:{ctx:n}}});let s=n[0].options.allowOAuth2Auth&&Qd();return{c(){B(e.$$.fragment),t=O(),s&&s.c(),i=ye()},m(o,r){z(e,o,r),w(o,t,r),s&&s.m(o,r),w(o,i,r),l=!0},p(o,r){const a={};r&24577&&(a.$$scope={dirty:r,ctx:o}),e.$set(a),o[0].options.allowOAuth2Auth?s?r&1&&E(s,1):(s=Qd(),s.c(),E(s,1),s.m(i.parentNode,i)):s&&(se(),A(s,1,1,()=>{s=null}),oe())},i(o){l||(E(e.$$.fragment,o),E(s),l=!0)},o(o){A(e.$$.fragment,o),A(s),l=!1},d(o){o&&(v(t),v(i)),V(e,o),s&&s.d(o)}}}function O6(n){let e;return{c(){e=b("span"),e.textContent="Disabled",p(e,"class","label")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function M6(n){let e;return{c(){e=b("span"),e.textContent="Enabled",p(e,"class","label label-success")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function xd(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,l||(s=we(Le.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function D6(n){let e,t,i,l,s,o;function r(c,d){return c[0].options.allowOAuth2Auth?M6:O6}let a=r(n),f=a(n),u=n[1]&&xd();return{c(){e=b("div"),e.innerHTML=' OAuth2',t=O(),i=b("div"),l=O(),f.c(),s=O(),u&&u.c(),o=ye(),p(e,"class","inline-flex"),p(i,"class","flex-fill")},m(c,d){w(c,e,d),w(c,t,d),w(c,i,d),w(c,l,d),f.m(c,d),w(c,s,d),u&&u.m(c,d),w(c,o,d)},p(c,d){a!==(a=r(c))&&(f.d(1),f=a(c),f&&(f.c(),f.m(s.parentNode,s))),c[1]?u?d&2&&E(u,1):(u=xd(),u.c(),E(u,1),u.m(o.parentNode,o)):u&&(se(),A(u,1,1,()=>{u=null}),oe())},d(c){c&&(v(e),v(t),v(i),v(l),v(s),v(o)),f.d(c),u&&u.d(c)}}}function E6(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Minimum password length"),l=O(),s=b("input"),p(e,"for",i=n[13]),p(s,"type","number"),p(s,"id",o=n[13]),s.required=!0,p(s,"min","6"),p(s,"max","72")},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].options.minPasswordLength),r||(a=K(s,"input",n[10]),r=!0)},p(f,u){u&8192&&i!==(i=f[13])&&p(e,"for",i),u&8192&&o!==(o=f[13])&&p(s,"id",o),u&1&<(s.value)!==f[0].options.minPasswordLength&&ae(s,f[0].options.minPasswordLength)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function I6(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.textContent="Always require email",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(s,"class","txt"),p(r,"class","ri-information-line txt-sm link-hint"),p(l,"for",a=n[13])},m(c,d){w(c,e,d),e.checked=n[0].options.requireEmail,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[11]),we(Le.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"}))],f=!0)},p(c,d){d&8192&&t!==(t=c[13])&&p(e,"id",t),d&1&&(e.checked=c[0].options.requireEmail),d&8192&&a!==(a=c[13])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function A6(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.textContent="Forbid authentication for unverified users",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(s,"class","txt"),p(r,"class","ri-information-line txt-sm link-hint"),p(l,"for",a=n[13])},m(c,d){w(c,e,d),e.checked=n[0].options.onlyVerified,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[12]),we(Le.call(null,r,{text:["If enabled, it returns 403 for new unverified user authentication requests.","If you need more granular control, don't enable this option and instead use the `@request.auth.verified = true` rule in the specific collection(s) you are targeting."].join(` @@ -83,9 +83,9 @@ Also note that some OAuth2 providers (like Twitter), don't return an email and t `),l=b("strong"),o=Y(s),r=O(),a=b("i"),f=O(),u=b("strong"),d=Y(c),p(l,"class","txt-strikethrough txt-hint"),p(a,"class","ri-arrow-right-line txt-sm"),p(u,"class","txt"),p(t,"class","inline-flex"),p(e,"class","svelte-xqpcsf")},m(_,g){w(_,e,g),k(e,t),k(t,i),k(t,l),k(l,o),k(t,r),k(t,a),k(t,f),k(t,u),k(u,d)},p(_,g){var y,S;g&2&&s!==(s=((y=_[1])==null?void 0:y.name)+"")&&re(o,s),g&4&&c!==(c=((S=_[2])==null?void 0:S.name)+"")&&re(d,c)},d(_){_&&v(e)}}}function op(n){let e,t,i,l=de(n[6]),s=[];for(let u=0;u',i=O(),l=b("div"),s=b("p"),s.textContent=`If any of the collection changes is part of another collection rule, filter or view query, - you'll have to update it manually!`,o=O(),f&&f.c(),r=O(),u&&u.c(),a=ye(),p(t,"class","icon"),p(l,"class","content txt-bold"),p(e,"class","alert alert-warning")},m(c,d){w(c,e,d),k(e,t),k(e,i),k(e,l),k(l,s),k(l,o),f&&f.m(l,null),w(c,r,d),u&&u.m(c,d),w(c,a,d)},p(c,d){c[7].length?f||(f=ip(),f.c(),f.m(l,null)):f&&(f.d(1),f=null),c[9]?u?u.p(c,d):(u=lp(c),u.c(),u.m(a.parentNode,a)):u&&(u.d(1),u=null)},d(c){c&&(v(e),v(r),v(a)),f&&f.d(),u&&u.d(c)}}}function R6(n){let e;return{c(){e=b("h4"),e.textContent="Confirm collection changes"},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function q6(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='Cancel',t=O(),i=b("button"),i.innerHTML='Confirm',e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-transparent"),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(),l||(s=[K(e,"click",n[12]),K(i,"click",n[13])],l=!0)},p:Q,d(o){o&&(v(e),v(t),v(i)),l=!1,ve(s)}}}function j6(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[q6],header:[R6],default:[F6]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[14](e),e.$on("hide",n[15]),e.$on("show",n[16]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&33555422&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[14](null),V(e,l)}}}function H6(n,e,t){let i,l,s,o,r,a;const f=st();let u,c,d;async function m(C,M){t(1,c=C),t(2,d=M),await Xt(),i||s.length||o.length||r.length?u==null||u.show():_()}function h(){u==null||u.hide()}function _(){h(),f("confirm")}const g=()=>h(),y=()=>_();function S(C){ee[C?"unshift":"push"](()=>{u=C,t(5,u)})}function T(C){Te.call(this,n,C)}function $(C){Te.call(this,n,C)}return n.$$.update=()=>{var C,M,D;n.$$.dirty&6&&t(3,i=(c==null?void 0:c.name)!=(d==null?void 0:d.name)),n.$$.dirty&4&&t(4,l=(d==null?void 0:d.type)==="view"),n.$$.dirty&4&&t(8,s=((C=d==null?void 0:d.schema)==null?void 0:C.filter(I=>I.id&&!I.toDelete&&I.originalName!=I.name))||[]),n.$$.dirty&4&&t(7,o=((M=d==null?void 0:d.schema)==null?void 0:M.filter(I=>I.id&&I.toDelete))||[]),n.$$.dirty&6&&t(6,r=((D=d==null?void 0:d.schema)==null?void 0:D.filter(I=>{var R,F,N;const L=(R=c==null?void 0:c.schema)==null?void 0:R.find(P=>P.id==I.id);return L?((F=L.options)==null?void 0:F.maxSelect)!=1&&((N=I.options)==null?void 0:N.maxSelect)==1:!1}))||[]),n.$$.dirty&24&&t(9,a=!l||i)},[h,c,d,i,l,u,r,o,s,a,_,m,g,y,S,T,$]}class z6 extends ge{constructor(e){super(),_e(this,e,H6,j6,me,{show:11,hide:0})}get show(){return this.$$.ctx[11]}get hide(){return this.$$.ctx[0]}}function up(n,e,t){const i=n.slice();return i[49]=e[t][0],i[50]=e[t][1],i}function V6(n){let e,t,i;function l(o){n[35](o)}let s={};return n[2]!==void 0&&(s.collection=n[2]),e=new UC({props:s}),ee.push(()=>be(e,"collection",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&4&&(t=!0,a.collection=o[2],ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function B6(n){let e,t,i;function l(o){n[34](o)}let s={};return n[2]!==void 0&&(s.collection=n[2]),e=new f6({props:s}),ee.push(()=>be(e,"collection",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&4&&(t=!0,a.collection=o[2],ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function cp(n){let e,t,i,l;function s(r){n[36](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new i6({props:o}),ee.push(()=>be(t,"collection",s)),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","tab-item active")},m(r,a){w(r,e,a),z(t,e,null),l=!0},p(r,a){const f={};!i&&a[0]&4&&(i=!0,f.collection=r[2],ke(()=>i=!1)),t.$set(f)},i(r){l||(E(t.$$.fragment,r),l=!0)},o(r){A(t.$$.fragment,r),l=!1},d(r){r&&v(e),V(t)}}}function dp(n){let e,t,i,l;function s(r){n[37](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new P6({props:o}),ee.push(()=>be(t,"collection",s)),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","tab-item"),x(e,"active",n[3]===Dl)},m(r,a){w(r,e,a),z(t,e,null),l=!0},p(r,a){const f={};!i&&a[0]&4&&(i=!0,f.collection=r[2],ke(()=>i=!1)),t.$set(f),(!l||a[0]&8)&&x(e,"active",r[3]===Dl)},i(r){l||(E(t.$$.fragment,r),l=!0)},o(r){A(t.$$.fragment,r),l=!1},d(r){r&&v(e),V(t)}}}function U6(n){let e,t,i,l,s,o,r;const a=[B6,V6],f=[];function u(m,h){return m[14]?0:1}i=u(n),l=f[i]=a[i](n);let c=n[3]===hs&&cp(n),d=n[15]&&dp(n);return{c(){e=b("div"),t=b("div"),l.c(),s=O(),c&&c.c(),o=O(),d&&d.c(),p(t,"class","tab-item"),x(t,"active",n[3]===Ci),p(e,"class","tabs-content svelte-12y0yzb")},m(m,h){w(m,e,h),k(e,t),f[i].m(t,null),k(e,s),c&&c.m(e,null),k(e,o),d&&d.m(e,null),r=!0},p(m,h){let _=i;i=u(m),i===_?f[i].p(m,h):(se(),A(f[_],1,1,()=>{f[_]=null}),oe(),l=f[i],l?l.p(m,h):(l=f[i]=a[i](m),l.c()),E(l,1),l.m(t,null)),(!r||h[0]&8)&&x(t,"active",m[3]===Ci),m[3]===hs?c?(c.p(m,h),h[0]&8&&E(c,1)):(c=cp(m),c.c(),E(c,1),c.m(e,o)):c&&(se(),A(c,1,1,()=>{c=null}),oe()),m[15]?d?(d.p(m,h),h[0]&32768&&E(d,1)):(d=dp(m),d.c(),E(d,1),d.m(e,null)):d&&(se(),A(d,1,1,()=>{d=null}),oe())},i(m){r||(E(l),E(c),E(d),r=!0)},o(m){A(l),A(c),A(d),r=!1},d(m){m&&v(e),f[i].d(),c&&c.d(),d&&d.d()}}}function pp(n){let e,t,i,l,s,o,r;return o=new On({props:{class:"dropdown dropdown-right m-t-5",$$slots:{default:[W6]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=O(),i=b("button"),l=b("i"),s=O(),B(o.$$.fragment),p(e,"class","flex-fill"),p(l,"class","ri-more-line"),p(i,"type","button"),p(i,"aria-label","More"),p(i,"class","btn btn-sm btn-circle btn-transparent flex-gap-0")},m(a,f){w(a,e,f),w(a,t,f),w(a,i,f),k(i,l),k(i,s),z(o,i,null),r=!0},p(a,f){const u={};f[1]&4194304&&(u.$$scope={dirty:f,ctx:a}),o.$set(u)},i(a){r||(E(o.$$.fragment,a),r=!0)},o(a){A(o.$$.fragment,a),r=!1},d(a){a&&(v(e),v(t),v(i)),V(o)}}}function W6(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML=' Duplicate',t=O(),i=b("button"),i.innerHTML=' Delete',p(e,"type","button"),p(e,"class","dropdown-item closable"),p(i,"type","button"),p(i,"class","dropdown-item txt-danger closable")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),l||(s=[K(e,"click",n[26]),K(i,"click",cn(Be(n[27])))],l=!0)},p:Q,d(o){o&&(v(e),v(t),v(i)),l=!1,ve(s)}}}function mp(n){let e,t,i,l;return i=new On({props:{class:"dropdown dropdown-right dropdown-nowrap m-t-5",$$slots:{default:[Y6]},$$scope:{ctx:n}}}),{c(){e=b("i"),t=O(),B(i.$$.fragment),p(e,"class","ri-arrow-down-s-fill")},m(s,o){w(s,e,o),w(s,t,o),z(i,s,o),l=!0},p(s,o){const r={};o[0]&68|o[1]&4194304&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(E(i.$$.fragment,s),l=!0)},o(s){A(i.$$.fragment,s),l=!1},d(s){s&&(v(e),v(t)),V(i,s)}}}function hp(n){let e,t,i,l,s,o=n[50]+"",r,a,f,u,c;function d(){return n[29](n[49])}return{c(){e=b("button"),t=b("i"),l=O(),s=b("span"),r=Y(o),a=Y(" collection"),f=O(),p(t,"class",i=Wn(H.getCollectionTypeIcon(n[49]))+" svelte-12y0yzb"),p(s,"class","txt"),p(e,"type","button"),p(e,"class","dropdown-item closable"),x(e,"selected",n[49]==n[2].type)},m(m,h){w(m,e,h),k(e,t),k(e,l),k(e,s),k(s,r),k(s,a),k(e,f),u||(c=K(e,"click",d),u=!0)},p(m,h){n=m,h[0]&64&&i!==(i=Wn(H.getCollectionTypeIcon(n[49]))+" svelte-12y0yzb")&&p(t,"class",i),h[0]&64&&o!==(o=n[50]+"")&&re(r,o),h[0]&68&&x(e,"selected",n[49]==n[2].type)},d(m){m&&v(e),u=!1,c()}}}function Y6(n){let e,t=de(Object.entries(n[6])),i=[];for(let l=0;l{F=null}),oe()):F?(F.p(P,j),j[0]&4&&E(F,1)):(F=mp(P),F.c(),E(F,1),F.m(d,null)),(!I||j[0]&4&&$!==($="btn btn-sm p-r-10 p-l-10 "+(P[2].id?"btn-transparent":"btn-outline")))&&p(d,"class",$),(!I||j[0]&4&&C!==(C=!!P[2].id))&&(d.disabled=C),P[2].system?N||(N=_p(),N.c(),N.m(D.parentNode,D)):N&&(N.d(1),N=null)},i(P){I||(E(F),I=!0)},o(P){A(F),I=!1},d(P){P&&(v(e),v(l),v(s),v(u),v(c),v(M),v(D)),F&&F.d(),N&&N.d(P),L=!1,R()}}}function gp(n){let e,t,i,l,s,o;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(r,a){w(r,e,a),l=!0,s||(o=we(t=Le.call(null,e,n[11])),s=!0)},p(r,a){t&&Tt(t.update)&&a[0]&2048&&t.update.call(null,r[11])},i(r){l||(r&&Ye(()=>{l&&(i||(i=Ne(e,Ut,{duration:150,start:.7},!0)),i.run(1))}),l=!0)},o(r){r&&(i||(i=Ne(e,Ut,{duration:150,start:.7},!1)),i.run(0)),l=!1},d(r){r&&v(e),r&&i&&i.end(),s=!1,o()}}}function bp(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,l||(s=we(Le.call(null,e,"Has errors")),l=!0)},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function kp(n){var a,f,u;let e,t,i,l=!H.isEmpty((a=n[5])==null?void 0:a.options)&&!((u=(f=n[5])==null?void 0:f.options)!=null&&u.manageRule),s,o,r=l&&yp();return{c(){e=b("button"),t=b("span"),t.textContent="Options",i=O(),r&&r.c(),p(t,"class","txt"),p(e,"type","button"),p(e,"class","tab-item"),x(e,"active",n[3]===Dl)},m(c,d){w(c,e,d),k(e,t),k(e,i),r&&r.m(e,null),s||(o=K(e,"click",n[33]),s=!0)},p(c,d){var m,h,_;d[0]&32&&(l=!H.isEmpty((m=c[5])==null?void 0:m.options)&&!((_=(h=c[5])==null?void 0:h.options)!=null&&_.manageRule)),l?r?d[0]&32&&E(r,1):(r=yp(),r.c(),E(r,1),r.m(e,null)):r&&(se(),A(r,1,1,()=>{r=null}),oe()),d[0]&8&&x(e,"active",c[3]===Dl)},d(c){c&&v(e),r&&r.d(),s=!1,o()}}}function yp(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,l||(s=we(Le.call(null,e,"Has errors")),l=!0)},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function J6(n){var q,W,G,U,Z,le,ne;let e,t=n[2].id?"Edit collection":"New collection",i,l,s,o,r,a,f,u,c,d,m,h=n[14]?"Query":"Fields",_,g,y=!H.isEmpty(n[11]),S,T,$,C,M=!H.isEmpty((q=n[5])==null?void 0:q.listRule)||!H.isEmpty((W=n[5])==null?void 0:W.viewRule)||!H.isEmpty((G=n[5])==null?void 0:G.createRule)||!H.isEmpty((U=n[5])==null?void 0:U.updateRule)||!H.isEmpty((Z=n[5])==null?void 0:Z.deleteRule)||!H.isEmpty((ne=(le=n[5])==null?void 0:le.options)==null?void 0:ne.manageRule),D,I,L,R,F=!!n[2].id&&!n[2].system&&pp(n);r=new pe({props:{class:"form-field collection-field-name required m-b-0 "+(n[13]?"disabled":""),name:"name",$$slots:{default:[K6,({uniqueId:he})=>({48:he}),({uniqueId:he})=>[0,he?131072:0]]},$$scope:{ctx:n}}});let N=y&&gp(n),P=M&&bp(),j=n[15]&&kp(n);return{c(){e=b("h4"),i=Y(t),l=O(),F&&F.c(),s=O(),o=b("form"),B(r.$$.fragment),a=O(),f=b("input"),u=O(),c=b("div"),d=b("button"),m=b("span"),_=Y(h),g=O(),N&&N.c(),S=O(),T=b("button"),$=b("span"),$.textContent="API Rules",C=O(),P&&P.c(),D=O(),j&&j.c(),p(e,"class","upsert-panel-title svelte-12y0yzb"),p(f,"type","submit"),p(f,"class","hidden"),p(f,"tabindex","-1"),p(o,"class","block"),p(m,"class","txt"),p(d,"type","button"),p(d,"class","tab-item"),x(d,"active",n[3]===Ci),p($,"class","txt"),p(T,"type","button"),p(T,"class","tab-item"),x(T,"active",n[3]===hs),p(c,"class","tabs-header stretched")},m(he,Ae){w(he,e,Ae),k(e,i),w(he,l,Ae),F&&F.m(he,Ae),w(he,s,Ae),w(he,o,Ae),z(r,o,null),k(o,a),k(o,f),w(he,u,Ae),w(he,c,Ae),k(c,d),k(d,m),k(m,_),k(d,g),N&&N.m(d,null),k(c,S),k(c,T),k(T,$),k(T,C),P&&P.m(T,null),k(c,D),j&&j.m(c,null),I=!0,L||(R=[K(o,"submit",Be(n[30])),K(d,"click",n[31]),K(T,"click",n[32])],L=!0)},p(he,Ae){var Ge,xe,Et,dt,mt,Gt,Me;(!I||Ae[0]&4)&&t!==(t=he[2].id?"Edit collection":"New collection")&&re(i,t),he[2].id&&!he[2].system?F?(F.p(he,Ae),Ae[0]&4&&E(F,1)):(F=pp(he),F.c(),E(F,1),F.m(s.parentNode,s)):F&&(se(),A(F,1,1,()=>{F=null}),oe());const He={};Ae[0]&8192&&(He.class="form-field collection-field-name required m-b-0 "+(he[13]?"disabled":"")),Ae[0]&41028|Ae[1]&4325376&&(He.$$scope={dirty:Ae,ctx:he}),r.$set(He),(!I||Ae[0]&16384)&&h!==(h=he[14]?"Query":"Fields")&&re(_,h),Ae[0]&2048&&(y=!H.isEmpty(he[11])),y?N?(N.p(he,Ae),Ae[0]&2048&&E(N,1)):(N=gp(he),N.c(),E(N,1),N.m(d,null)):N&&(se(),A(N,1,1,()=>{N=null}),oe()),(!I||Ae[0]&8)&&x(d,"active",he[3]===Ci),Ae[0]&32&&(M=!H.isEmpty((Ge=he[5])==null?void 0:Ge.listRule)||!H.isEmpty((xe=he[5])==null?void 0:xe.viewRule)||!H.isEmpty((Et=he[5])==null?void 0:Et.createRule)||!H.isEmpty((dt=he[5])==null?void 0:dt.updateRule)||!H.isEmpty((mt=he[5])==null?void 0:mt.deleteRule)||!H.isEmpty((Me=(Gt=he[5])==null?void 0:Gt.options)==null?void 0:Me.manageRule)),M?P?Ae[0]&32&&E(P,1):(P=bp(),P.c(),E(P,1),P.m(T,null)):P&&(se(),A(P,1,1,()=>{P=null}),oe()),(!I||Ae[0]&8)&&x(T,"active",he[3]===hs),he[15]?j?j.p(he,Ae):(j=kp(he),j.c(),j.m(c,null)):j&&(j.d(1),j=null)},i(he){I||(E(F),E(r.$$.fragment,he),E(N),E(P),I=!0)},o(he){A(F),A(r.$$.fragment,he),A(N),A(P),I=!1},d(he){he&&(v(e),v(l),v(s),v(o),v(u),v(c)),F&&F.d(he),V(r),N&&N.d(),P&&P.d(),j&&j.d(),L=!1,ve(R)}}}function Z6(n){let e,t,i,l,s,o=n[2].id?"Save changes":"Create",r,a,f,u;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=O(),l=b("button"),s=b("span"),r=Y(o),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[9],p(s,"class","txt"),p(l,"type","button"),p(l,"class","btn btn-expanded"),l.disabled=a=!n[12]||n[9],x(l,"btn-loading",n[9])},m(c,d){w(c,e,d),k(e,t),w(c,i,d),w(c,l,d),k(l,s),k(s,r),f||(u=[K(e,"click",n[24]),K(l,"click",n[25])],f=!0)},p(c,d){d[0]&512&&(e.disabled=c[9]),d[0]&4&&o!==(o=c[2].id?"Save changes":"Create")&&re(r,o),d[0]&4608&&a!==(a=!c[12]||c[9])&&(l.disabled=a),d[0]&512&&x(l,"btn-loading",c[9])},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function G6(n){let e,t,i,l,s={class:"overlay-panel-lg colored-header collection-panel",escClose:!1,overlayClose:!n[9],beforeHide:n[38],$$slots:{footer:[Z6],header:[J6],default:[U6]},$$scope:{ctx:n}};e=new Zt({props:s}),n[39](e),e.$on("hide",n[40]),e.$on("show",n[41]);let o={};return i=new z6({props:o}),n[42](i),i.$on("confirm",n[43]),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment)},m(r,a){z(e,r,a),w(r,t,a),z(i,r,a),l=!0},p(r,a){const f={};a[0]&512&&(f.overlayClose=!r[9]),a[0]&1040&&(f.beforeHide=r[38]),a[0]&64108|a[1]&4194304&&(f.$$scope={dirty:a,ctx:r}),e.$set(f);const u={};i.$set(u)},i(r){l||(E(e.$$.fragment,r),E(i.$$.fragment,r),l=!0)},o(r){A(e.$$.fragment,r),A(i.$$.fragment,r),l=!1},d(r){r&&v(t),n[39](null),V(e,r),n[42](null),V(i,r)}}}const Ci="schema",hs="api_rules",Dl="options",X6="base",vp="auth",wp="view";function Er(n){return JSON.stringify(n)}function Q6(n,e,t){let i,l,s,o,r,a;Ue(n,mi,te=>t(5,a=te));const f={};f[X6]="Base",f[wp]="View",f[vp]="Auth";const u=st();let c,d,m=null,h=H.initCollection(),_=!1,g=!1,y=Ci,S=Er(h),T="";function $(te){t(3,y=te)}function C(te){return D(te),t(10,g=!0),$(Ci),c==null?void 0:c.show()}function M(){return c==null?void 0:c.hide()}async function D(te){Jt({}),typeof te<"u"?(t(22,m=te),t(2,h=structuredClone(te))):(t(22,m=null),t(2,h=H.initCollection())),t(2,h.schema=h.schema||[],h),t(2,h.originalName=h.name||"",h),await Xt(),t(23,S=Er(h))}function I(){h.id?d==null||d.show(m,h):L()}function L(){if(_)return;t(9,_=!0);const te=R();let Fe;h.id?Fe=fe.collections.update(h.id,te):Fe=fe.collections.create(te),Fe.then(Se=>{wa(),iv(Se),t(10,g=!1),M(),At(h.id?"Successfully updated collection.":"Successfully created collection."),u("save",{isNew:!h.id,collection:Se})}).catch(Se=>{fe.error(Se)}).finally(()=>{t(9,_=!1)})}function R(){const te=Object.assign({},h);te.schema=te.schema.slice(0);for(let Fe=te.schema.length-1;Fe>=0;Fe--)te.schema[Fe].toDelete&&te.schema.splice(Fe,1);return te}function F(){m!=null&&m.id&&fn(`Do you really want to delete collection "${m.name}" and all its records?`,()=>fe.collections.delete(m.id).then(()=>{M(),At(`Successfully deleted collection "${m.name}".`),u("delete",m),lv(m)}).catch(te=>{fe.error(te)}))}function N(te){t(2,h.type=te,h),li("schema")}function P(){o?fn("You have unsaved changes. Do you really want to discard them?",()=>{j()}):j()}async function j(){const te=m?structuredClone(m):null;if(te){if(te.id="",te.created="",te.updated="",te.name+="_duplicate",!H.isEmpty(te.schema))for(const Fe of te.schema)Fe.id="";if(!H.isEmpty(te.indexes))for(let Fe=0;FeM(),W=()=>I(),G=()=>P(),U=()=>F(),Z=te=>{t(2,h.name=H.slugify(te.target.value),h),te.target.value=h.name},le=te=>N(te),ne=()=>{r&&I()},he=()=>$(Ci),Ae=()=>$(hs),He=()=>$(Dl);function Ge(te){h=te,t(2,h),t(22,m)}function xe(te){h=te,t(2,h),t(22,m)}function Et(te){h=te,t(2,h),t(22,m)}function dt(te){h=te,t(2,h),t(22,m)}const mt=()=>o&&g?(fn("You have unsaved changes. Do you really want to close the panel?",()=>{t(10,g=!1),M()}),!1):!0;function Gt(te){ee[te?"unshift":"push"](()=>{c=te,t(7,c)})}function Me(te){Te.call(this,n,te)}function Ee(te){Te.call(this,n,te)}function ze(te){ee[te?"unshift":"push"](()=>{d=te,t(8,d)})}const _t=()=>L();return n.$$.update=()=>{var te,Fe;n.$$.dirty[0]&4&&h.type==="view"&&(t(2,h.createRule=null,h),t(2,h.updateRule=null,h),t(2,h.deleteRule=null,h),t(2,h.indexes=[],h)),n.$$.dirty[0]&4194308&&h.name&&(m==null?void 0:m.name)!=h.name&&h.indexes.length>0&&t(2,h.indexes=(te=h.indexes)==null?void 0:te.map(Se=>H.replaceIndexTableName(Se,h.name)),h),n.$$.dirty[0]&4&&t(15,i=h.type===vp),n.$$.dirty[0]&4&&t(14,l=h.type===wp),n.$$.dirty[0]&32&&(a.schema||(Fe=a.options)!=null&&Fe.query?t(11,T=H.getNestedVal(a,"schema.message")||"Has errors"):t(11,T="")),n.$$.dirty[0]&4&&t(13,s=!!h.id&&h.system),n.$$.dirty[0]&8388612&&t(4,o=S!=Er(h)),n.$$.dirty[0]&20&&t(12,r=!h.id||o),n.$$.dirty[0]&12&&y===Dl&&h.type!=="auth"&&$(Ci)},[$,M,h,y,o,a,f,c,d,_,g,T,r,s,l,i,I,L,F,N,P,C,m,S,q,W,G,U,Z,le,ne,he,Ae,He,Ge,xe,Et,dt,mt,Gt,Me,Ee,ze,_t]}class Ua extends ge{constructor(e){super(),_e(this,e,Q6,G6,me,{changeTab:0,show:21,hide:1},null,[-1,-1])}get changeTab(){return this.$$.ctx[0]}get show(){return this.$$.ctx[21]}get hide(){return this.$$.ctx[1]}}function x6(n){let e;return{c(){e=b("i"),p(e,"class","ri-pushpin-line m-l-auto svelte-1u3ag8h")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function e5(n){let e;return{c(){e=b("i"),p(e,"class","ri-unpin-line svelte-1u3ag8h")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function t5(n){let e,t,i,l,s,o=n[0].name+"",r,a,f,u,c,d,m,h;function _(S,T){return S[1]?e5:x6}let g=_(n),y=g(n);return{c(){var S;e=b("a"),t=b("i"),l=O(),s=b("span"),r=Y(o),a=O(),f=b("span"),y.c(),p(t,"class",i=Wn(H.getCollectionTypeIcon(n[0].type))+" svelte-1u3ag8h"),p(s,"class","txt m-r-auto"),p(f,"class","btn btn-xs btn-circle btn-hint btn-transparent pin-collection svelte-1u3ag8h"),p(f,"aria-label","Pin collection"),p(e,"href",c="/collections?collectionId="+n[0].id),p(e,"class","sidebar-list-item svelte-1u3ag8h"),p(e,"title",d=n[0].name),x(e,"active",((S=n[2])==null?void 0:S.id)===n[0].id)},m(S,T){w(S,e,T),k(e,t),k(e,l),k(e,s),k(s,r),k(e,a),k(e,f),y.m(f,null),m||(h=[we(u=Le.call(null,f,{position:"right",text:(n[1]?"Unpin":"Pin")+" collection"})),K(f,"click",cn(Be(n[5]))),we(nn.call(null,e))],m=!0)},p(S,[T]){var $;T&1&&i!==(i=Wn(H.getCollectionTypeIcon(S[0].type))+" svelte-1u3ag8h")&&p(t,"class",i),T&1&&o!==(o=S[0].name+"")&&re(r,o),g!==(g=_(S))&&(y.d(1),y=g(S),y&&(y.c(),y.m(f,null))),u&&Tt(u.update)&&T&2&&u.update.call(null,{position:"right",text:(S[1]?"Unpin":"Pin")+" collection"}),T&1&&c!==(c="/collections?collectionId="+S[0].id)&&p(e,"href",c),T&1&&d!==(d=S[0].name)&&p(e,"title",d),T&5&&x(e,"active",(($=S[2])==null?void 0:$.id)===S[0].id)},i:Q,o:Q,d(S){S&&v(e),y.d(),m=!1,ve(h)}}}function n5(n,e,t){let i,l;Ue(n,Kn,f=>t(2,l=f));let{collection:s}=e,{pinnedIds:o}=e;function r(f){o.includes(f.id)?H.removeByValue(o,f.id):o.push(f.id),t(4,o)}const a=()=>r(s);return n.$$set=f=>{"collection"in f&&t(0,s=f.collection),"pinnedIds"in f&&t(4,o=f.pinnedIds)},n.$$.update=()=>{n.$$.dirty&17&&t(1,i=o.includes(s.id))},[s,i,l,r,o,a]}class Yb extends ge{constructor(e){super(),_e(this,e,n5,t5,me,{collection:0,pinnedIds:4})}}function Sp(n,e,t){const i=n.slice();return i[22]=e[t],i}function $p(n,e,t){const i=n.slice();return i[22]=e[t],i}function Tp(n){let e,t,i=[],l=new Map,s,o,r=de(n[6]);const a=f=>f[22].id;for(let f=0;fbe(i,"pinnedIds",o)),{key:n,first:null,c(){t=ye(),B(i.$$.fragment),this.first=t},m(a,f){w(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f&64&&(u.collection=e[22]),!l&&f&2&&(l=!0,u.pinnedIds=e[1],ke(()=>l=!1)),i.$set(u)},i(a){s||(E(i.$$.fragment,a),s=!0)},o(a){A(i.$$.fragment,a),s=!1},d(a){a&&v(t),V(i,a)}}}function Op(n){let e,t=[],i=new Map,l,s,o=n[6].length&&Mp(),r=de(n[5]);const a=f=>f[22].id;for(let f=0;fbe(i,"pinnedIds",o)),{key:n,first:null,c(){t=ye(),B(i.$$.fragment),this.first=t},m(a,f){w(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f&32&&(u.collection=e[22]),!l&&f&2&&(l=!0,u.pinnedIds=e[1],ke(()=>l=!1)),i.$set(u)},i(a){s||(E(i.$$.fragment,a),s=!0)},o(a){A(i.$$.fragment,a),s=!1},d(a){a&&v(t),V(i,a)}}}function Ep(n){let e;return{c(){e=b("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&&v(e)}}}function Ip(n){let e,t,i,l;return{c(){e=b("footer"),t=b("button"),t.innerHTML=' New collection',p(t,"type","button"),p(t,"class","btn btn-block btn-outline"),p(e,"class","sidebar-footer")},m(s,o){w(s,e,o),k(e,t),i||(l=K(t,"click",n[16]),i=!0)},p:Q,d(s){s&&v(e),i=!1,l()}}}function i5(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S=n[6].length&&Tp(n),T=n[5].length&&Op(n),$=n[3].length&&!n[2].length&&Ep(),C=!n[9]&&Ip(n);return{c(){e=b("header"),t=b("div"),i=b("div"),l=b("button"),l.innerHTML='',s=O(),o=b("input"),r=O(),a=b("hr"),f=O(),u=b("div"),S&&S.c(),c=O(),T&&T.c(),d=O(),$&&$.c(),m=O(),C&&C.c(),h=ye(),p(l,"type","button"),p(l,"class","btn btn-xs btn-transparent btn-circle btn-clear"),x(l,"hidden",!n[7]),p(i,"class","form-field-addon"),p(o,"type","text"),p(o,"placeholder","Search collections..."),p(o,"name","collections-search"),p(t,"class","form-field search"),x(t,"active",n[7]),p(e,"class","sidebar-header"),p(a,"class","m-t-5 m-b-xs"),p(u,"class","sidebar-content"),x(u,"fade",n[8]),x(u,"sidebar-content-compact",n[2].length>20)},m(M,D){w(M,e,D),k(e,t),k(t,i),k(i,l),k(t,s),k(t,o),ae(o,n[0]),w(M,r,D),w(M,a,D),w(M,f,D),w(M,u,D),S&&S.m(u,null),k(u,c),T&&T.m(u,null),k(u,d),$&&$.m(u,null),w(M,m,D),C&&C.m(M,D),w(M,h,D),_=!0,g||(y=[K(l,"click",n[12]),K(o,"input",n[13])],g=!0)},p(M,D){(!_||D&128)&&x(l,"hidden",!M[7]),D&1&&o.value!==M[0]&&ae(o,M[0]),(!_||D&128)&&x(t,"active",M[7]),M[6].length?S?(S.p(M,D),D&64&&E(S,1)):(S=Tp(M),S.c(),E(S,1),S.m(u,c)):S&&(se(),A(S,1,1,()=>{S=null}),oe()),M[5].length?T?(T.p(M,D),D&32&&E(T,1)):(T=Op(M),T.c(),E(T,1),T.m(u,d)):T&&(se(),A(T,1,1,()=>{T=null}),oe()),M[3].length&&!M[2].length?$||($=Ep(),$.c(),$.m(u,null)):$&&($.d(1),$=null),(!_||D&256)&&x(u,"fade",M[8]),(!_||D&4)&&x(u,"sidebar-content-compact",M[2].length>20),M[9]?C&&(C.d(1),C=null):C?C.p(M,D):(C=Ip(M),C.c(),C.m(h.parentNode,h))},i(M){_||(E(S),E(T),_=!0)},o(M){A(S),A(T),_=!1},d(M){M&&(v(e),v(r),v(a),v(f),v(u),v(m),v(h)),S&&S.d(),T&&T.d(),$&&$.d(),C&&C.d(M),g=!1,ve(y)}}}function l5(n){let e,t,i,l;e=new Hb({props:{class:"collection-sidebar",$$slots:{default:[i5]},$$scope:{ctx:n}}});let s={};return i=new Ua({props:s}),n[17](i),i.$on("save",n[18]),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment)},m(o,r){z(e,o,r),w(o,t,r),z(i,o,r),l=!0},p(o,[r]){const a={};r&134218751&&(a.$$scope={dirty:r,ctx:o}),e.$set(a);const f={};i.$set(f)},i(o){l||(E(e.$$.fragment,o),E(i.$$.fragment,o),l=!0)},o(o){A(e.$$.fragment,o),A(i.$$.fragment,o),l=!1},d(o){o&&v(t),V(e,o),n[17](null),V(i,o)}}}const Ap="@pinnedCollections";function s5(){setTimeout(()=>{const n=document.querySelector(".collection-sidebar .sidebar-list-item.active");n&&(n==null||n.scrollIntoView({block:"nearest"}))},0)}function o5(n,e,t){let i,l,s,o,r,a,f,u,c;Ue(n,Fn,L=>t(11,a=L)),Ue(n,Kn,L=>t(19,f=L)),Ue(n,To,L=>t(8,u=L)),Ue(n,Xi,L=>t(9,c=L));let d,m="",h=[];g();function _(L){xt(Kn,f=L,f)}function g(){t(1,h=[]);try{const L=localStorage.getItem(Ap);L&&t(1,h=JSON.parse(L)||[])}catch{}}function y(){t(1,h=h.filter(L=>!!a.find(R=>R.id==L)))}const S=()=>t(0,m="");function T(){m=this.value,t(0,m)}function $(L){h=L,t(1,h)}function C(L){h=L,t(1,h)}const M=()=>d==null?void 0:d.show();function D(L){ee[L?"unshift":"push"](()=>{d=L,t(4,d)})}const I=L=>{var R;(R=L.detail)!=null&&R.isNew&&L.detail.collection&&_(L.detail.collection)};return n.$$.update=()=>{n.$$.dirty&2048&&a&&(y(),s5()),n.$$.dirty&1&&t(3,i=m.replace(/\s+/g,"").toLowerCase()),n.$$.dirty&1&&t(7,l=m!==""),n.$$.dirty&2&&h&&localStorage.setItem(Ap,JSON.stringify(h)),n.$$.dirty&2057&&t(2,s=a.filter(L=>L.id==m||L.name.replace(/\s+/g,"").toLowerCase().includes(i))),n.$$.dirty&6&&t(6,o=s.filter(L=>h.includes(L.id))),n.$$.dirty&6&&t(5,r=s.filter(L=>!h.includes(L.id)))},[m,h,s,i,d,r,o,l,u,c,_,a,S,T,$,C,M,D,I]}class r5 extends ge{constructor(e){super(),_e(this,e,o5,l5,me,{})}}function Lp(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i}function Np(n){n[18]=n[19].default}function Pp(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i[21]=t,i}function Fp(n){let e;return{c(){e=b("hr"),p(e,"class","m-t-sm m-b-sm")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Rp(n,e){let t,i=e[21]===Object.keys(e[6]).length,l,s,o=e[15].label+"",r,a,f,u,c=i&&Fp();function d(){return e[9](e[14])}return{key:n,first:null,c(){t=ye(),c&&c.c(),l=O(),s=b("button"),r=Y(o),a=O(),p(s,"type","button"),p(s,"class","sidebar-item"),x(s,"active",e[5]===e[14]),this.first=t},m(m,h){w(m,t,h),c&&c.m(m,h),w(m,l,h),w(m,s,h),k(s,r),k(s,a),f||(u=K(s,"click",d),f=!0)},p(m,h){e=m,h&8&&(i=e[21]===Object.keys(e[6]).length),i?c||(c=Fp(),c.c(),c.m(l.parentNode,l)):c&&(c.d(1),c=null),h&8&&o!==(o=e[15].label+"")&&re(r,o),h&40&&x(s,"active",e[5]===e[14])},d(m){m&&(v(t),v(l),v(s)),c&&c.d(m),f=!1,u()}}}function qp(n){let e,t,i,l={ctx:n,current:null,token:null,hasCatch:!1,pending:u5,then:f5,catch:a5,value:19,blocks:[,,,]};return Qa(t=n[15].component,l),{c(){e=ye(),l.block.c()},m(s,o){w(s,e,o),l.block.m(s,l.anchor=o),l.mount=()=>e.parentNode,l.anchor=e,i=!0},p(s,o){n=s,l.ctx=n,o&8&&t!==(t=n[15].component)&&Qa(t,l)||C0(l,n,o)},i(s){i||(E(l.block),i=!0)},o(s){for(let o=0;o<3;o+=1){const r=l.blocks[o];A(r)}i=!1},d(s){s&&v(e),l.block.d(s),l.token=null,l=null}}}function a5(n){return{c:Q,m:Q,p:Q,i:Q,o:Q,d:Q}}function f5(n){Np(n);let e,t,i;return e=new n[18]({props:{collection:n[2]}}),{c(){B(e.$$.fragment),t=O()},m(l,s){z(e,l,s),w(l,t,s),i=!0},p(l,s){Np(l);const o={};s&4&&(o.collection=l[2]),e.$set(o)},i(l){i||(E(e.$$.fragment,l),i=!0)},o(l){A(e.$$.fragment,l),i=!1},d(l){l&&v(t),V(e,l)}}}function u5(n){return{c:Q,m:Q,p:Q,i:Q,o:Q,d:Q}}function jp(n,e){let t,i,l,s=e[5]===e[14]&&qp(e);return{key:n,first:null,c(){t=ye(),s&&s.c(),i=ye(),this.first=t},m(o,r){w(o,t,r),s&&s.m(o,r),w(o,i,r),l=!0},p(o,r){e=o,e[5]===e[14]?s?(s.p(e,r),r&40&&E(s,1)):(s=qp(e),s.c(),E(s,1),s.m(i.parentNode,i)):s&&(se(),A(s,1,1,()=>{s=null}),oe())},i(o){l||(E(s),l=!0)},o(o){A(s),l=!1},d(o){o&&(v(t),v(i)),s&&s.d(o)}}}function c5(n){let e,t,i,l=[],s=new Map,o,r,a=[],f=new Map,u,c=de(Object.entries(n[3]));const d=_=>_[14];for(let _=0;__[14];for(let _=0;_Close',p(e,"type","button"),p(e,"class","btn btn-transparent")},m(l,s){w(l,e,s),t||(i=K(e,"click",n[8]),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function p5(n){let e,t,i={class:"docs-panel",$$slots:{footer:[d5],default:[c5]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[10](e),e.$on("hide",n[11]),e.$on("show",n[12]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&4194348&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[10](null),V(e,l)}}}function m5(n,e,t){const i={list:{label:"List/Search",component:nt(()=>import("./ListApiDocs-NLRpQyTo.js"),__vite__mapDeps([3,4,5,6,7]),import.meta.url)},view:{label:"View",component:nt(()=>import("./ViewApiDocs-4M1eVMku.js"),__vite__mapDeps([8,4,5,6]),import.meta.url)},create:{label:"Create",component:nt(()=>import("./CreateApiDocs-uAZVKP8K.js"),__vite__mapDeps([9,4,5,6]),import.meta.url)},update:{label:"Update",component:nt(()=>import("./UpdateApiDocs-KIEJUGwi.js"),__vite__mapDeps([10,4,5,6]),import.meta.url)},delete:{label:"Delete",component:nt(()=>import("./DeleteApiDocs-fOXuOKIx.js"),__vite__mapDeps([11,4,5]),import.meta.url)},realtime:{label:"Realtime",component:nt(()=>import("./RealtimeApiDocs-QEFv858u.js"),__vite__mapDeps([12,4,5]),import.meta.url)}},l={"auth-with-password":{label:"Auth with password",component:nt(()=>import("./AuthWithPasswordDocs-i3lf_6b4.js"),__vite__mapDeps([13,4,5,6]),import.meta.url)},"auth-with-oauth2":{label:"Auth with OAuth2",component:nt(()=>import("./AuthWithOAuth2Docs-uhwAhOlg.js"),__vite__mapDeps([14,4,5,6]),import.meta.url)},refresh:{label:"Auth refresh",component:nt(()=>import("./AuthRefreshDocs-YwWPCwEU.js"),__vite__mapDeps([15,4,5,6]),import.meta.url)},"request-verification":{label:"Request verification",component:nt(()=>import("./RequestVerificationDocs-G73EyzMY.js"),__vite__mapDeps([16,4,5]),import.meta.url)},"confirm-verification":{label:"Confirm verification",component:nt(()=>import("./ConfirmVerificationDocs-JgU_hYvF.js"),__vite__mapDeps([17,4,5]),import.meta.url)},"request-password-reset":{label:"Request password reset",component:nt(()=>import("./RequestPasswordResetDocs-ueBKJVu4.js"),__vite__mapDeps([18,4,5]),import.meta.url)},"confirm-password-reset":{label:"Confirm password reset",component:nt(()=>import("./ConfirmPasswordResetDocs-AJWXIimi.js"),__vite__mapDeps([19,4,5]),import.meta.url)},"request-email-change":{label:"Request email change",component:nt(()=>import("./RequestEmailChangeDocs-OR_qP7_j.js"),__vite__mapDeps([20,4,5]),import.meta.url)},"confirm-email-change":{label:"Confirm email change",component:nt(()=>import("./ConfirmEmailChangeDocs-eRrlYV21.js"),__vite__mapDeps([21,4,5]),import.meta.url)},"list-auth-methods":{label:"List auth methods",component:nt(()=>import("./AuthMethodsDocs-nJCAd_pk.js"),__vite__mapDeps([22,4,5,6]),import.meta.url)},"list-linked-accounts":{label:"List OAuth2 accounts",component:nt(()=>import("./ListExternalAuthsDocs-EllSY0vK.js"),__vite__mapDeps([23,4,5,6]),import.meta.url)},"unlink-account":{label:"Unlink OAuth2 account",component:nt(()=>import("./UnlinkExternalAuthDocs-52aa8RZW.js"),__vite__mapDeps([24,4,5]),import.meta.url)}};let s,o={},r,a=[];a.length&&(r=Object.keys(a)[0]);function f(y){return t(2,o=y),c(Object.keys(a)[0]),s==null?void 0:s.show()}function u(){return s==null?void 0:s.hide()}function c(y){t(5,r=y)}const d=()=>u(),m=y=>c(y);function h(y){ee[y?"unshift":"push"](()=>{s=y,t(4,s)})}function _(y){Te.call(this,n,y)}function g(y){Te.call(this,n,y)}return n.$$.update=()=>{n.$$.dirty&12&&(o.type==="auth"?(t(3,a=Object.assign({},i,l)),!o.options.allowUsernameAuth&&!o.options.allowEmailAuth&&delete a["auth-with-password"],o.options.allowOAuth2Auth||delete a["auth-with-oauth2"]):o.type==="view"?(t(3,a=Object.assign({},i)),delete a.create,delete a.update,delete a.delete,delete a.realtime):t(3,a=Object.assign({},i)))},[u,c,o,a,s,r,i,f,d,m,h,_,g]}class h5 extends ge{constructor(e){super(),_e(this,e,m5,p5,me,{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 _5(n){let e,t,i,l;return{c(){e=b("i"),p(e,"class","ri-calendar-event-line txt-disabled")},m(s,o){w(s,e,o),i||(l=we(t=Le.call(null,e,{text:n[0].join(` + you'll have to update it manually!`,o=O(),f&&f.c(),r=O(),u&&u.c(),a=ye(),p(t,"class","icon"),p(l,"class","content txt-bold"),p(e,"class","alert alert-warning")},m(c,d){w(c,e,d),k(e,t),k(e,i),k(e,l),k(l,s),k(l,o),f&&f.m(l,null),w(c,r,d),u&&u.m(c,d),w(c,a,d)},p(c,d){c[7].length?f||(f=ip(),f.c(),f.m(l,null)):f&&(f.d(1),f=null),c[9]?u?u.p(c,d):(u=lp(c),u.c(),u.m(a.parentNode,a)):u&&(u.d(1),u=null)},d(c){c&&(v(e),v(r),v(a)),f&&f.d(),u&&u.d(c)}}}function R6(n){let e;return{c(){e=b("h4"),e.textContent="Confirm collection changes"},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function q6(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML='Cancel',t=O(),i=b("button"),i.innerHTML='Confirm',e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-transparent"),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(),l||(s=[K(e,"click",n[12]),K(i,"click",n[13])],l=!0)},p:Q,d(o){o&&(v(e),v(t),v(i)),l=!1,ve(s)}}}function j6(n){let e,t,i={class:"confirm-changes-panel",popup:!0,$$slots:{footer:[q6],header:[R6],default:[F6]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[14](e),e.$on("hide",n[15]),e.$on("show",n[16]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&33555422&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[14](null),V(e,l)}}}function H6(n,e,t){let i,l,s,o,r,a;const f=st();let u,c,d;async function m(C,M){t(1,c=C),t(2,d=M),await Xt(),i||s.length||o.length||r.length?u==null||u.show():_()}function h(){u==null||u.hide()}function _(){h(),f("confirm")}const g=()=>h(),y=()=>_();function S(C){ee[C?"unshift":"push"](()=>{u=C,t(5,u)})}function T(C){Te.call(this,n,C)}function $(C){Te.call(this,n,C)}return n.$$.update=()=>{var C,M,D;n.$$.dirty&6&&t(3,i=(c==null?void 0:c.name)!=(d==null?void 0:d.name)),n.$$.dirty&4&&t(4,l=(d==null?void 0:d.type)==="view"),n.$$.dirty&4&&t(8,s=((C=d==null?void 0:d.schema)==null?void 0:C.filter(I=>I.id&&!I.toDelete&&I.originalName!=I.name))||[]),n.$$.dirty&4&&t(7,o=((M=d==null?void 0:d.schema)==null?void 0:M.filter(I=>I.id&&I.toDelete))||[]),n.$$.dirty&6&&t(6,r=((D=d==null?void 0:d.schema)==null?void 0:D.filter(I=>{var R,F,N;const L=(R=c==null?void 0:c.schema)==null?void 0:R.find(P=>P.id==I.id);return L?((F=L.options)==null?void 0:F.maxSelect)!=1&&((N=I.options)==null?void 0:N.maxSelect)==1:!1}))||[]),n.$$.dirty&24&&t(9,a=!l||i)},[h,c,d,i,l,u,r,o,s,a,_,m,g,y,S,T,$]}class z6 extends ge{constructor(e){super(),_e(this,e,H6,j6,me,{show:11,hide:0})}get show(){return this.$$.ctx[11]}get hide(){return this.$$.ctx[0]}}function up(n,e,t){const i=n.slice();return i[49]=e[t][0],i[50]=e[t][1],i}function V6(n){let e,t,i;function l(o){n[35](o)}let s={};return n[2]!==void 0&&(s.collection=n[2]),e=new UC({props:s}),ee.push(()=>be(e,"collection",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&4&&(t=!0,a.collection=o[2],ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function B6(n){let e,t,i;function l(o){n[34](o)}let s={};return n[2]!==void 0&&(s.collection=n[2]),e=new f6({props:s}),ee.push(()=>be(e,"collection",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&4&&(t=!0,a.collection=o[2],ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function cp(n){let e,t,i,l;function s(r){n[36](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new i6({props:o}),ee.push(()=>be(t,"collection",s)),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","tab-item active")},m(r,a){w(r,e,a),z(t,e,null),l=!0},p(r,a){const f={};!i&&a[0]&4&&(i=!0,f.collection=r[2],ke(()=>i=!1)),t.$set(f)},i(r){l||(E(t.$$.fragment,r),l=!0)},o(r){A(t.$$.fragment,r),l=!1},d(r){r&&v(e),V(t)}}}function dp(n){let e,t,i,l;function s(r){n[37](r)}let o={};return n[2]!==void 0&&(o.collection=n[2]),t=new P6({props:o}),ee.push(()=>be(t,"collection",s)),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","tab-item"),x(e,"active",n[3]===Dl)},m(r,a){w(r,e,a),z(t,e,null),l=!0},p(r,a){const f={};!i&&a[0]&4&&(i=!0,f.collection=r[2],ke(()=>i=!1)),t.$set(f),(!l||a[0]&8)&&x(e,"active",r[3]===Dl)},i(r){l||(E(t.$$.fragment,r),l=!0)},o(r){A(t.$$.fragment,r),l=!1},d(r){r&&v(e),V(t)}}}function U6(n){let e,t,i,l,s,o,r;const a=[B6,V6],f=[];function u(m,h){return m[14]?0:1}i=u(n),l=f[i]=a[i](n);let c=n[3]===hs&&cp(n),d=n[15]&&dp(n);return{c(){e=b("div"),t=b("div"),l.c(),s=O(),c&&c.c(),o=O(),d&&d.c(),p(t,"class","tab-item"),x(t,"active",n[3]===Ci),p(e,"class","tabs-content svelte-12y0yzb")},m(m,h){w(m,e,h),k(e,t),f[i].m(t,null),k(e,s),c&&c.m(e,null),k(e,o),d&&d.m(e,null),r=!0},p(m,h){let _=i;i=u(m),i===_?f[i].p(m,h):(se(),A(f[_],1,1,()=>{f[_]=null}),oe(),l=f[i],l?l.p(m,h):(l=f[i]=a[i](m),l.c()),E(l,1),l.m(t,null)),(!r||h[0]&8)&&x(t,"active",m[3]===Ci),m[3]===hs?c?(c.p(m,h),h[0]&8&&E(c,1)):(c=cp(m),c.c(),E(c,1),c.m(e,o)):c&&(se(),A(c,1,1,()=>{c=null}),oe()),m[15]?d?(d.p(m,h),h[0]&32768&&E(d,1)):(d=dp(m),d.c(),E(d,1),d.m(e,null)):d&&(se(),A(d,1,1,()=>{d=null}),oe())},i(m){r||(E(l),E(c),E(d),r=!0)},o(m){A(l),A(c),A(d),r=!1},d(m){m&&v(e),f[i].d(),c&&c.d(),d&&d.d()}}}function pp(n){let e,t,i,l,s,o,r;return o=new On({props:{class:"dropdown dropdown-right m-t-5",$$slots:{default:[W6]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=O(),i=b("button"),l=b("i"),s=O(),B(o.$$.fragment),p(e,"class","flex-fill"),p(l,"class","ri-more-line"),p(i,"type","button"),p(i,"aria-label","More"),p(i,"class","btn btn-sm btn-circle btn-transparent flex-gap-0")},m(a,f){w(a,e,f),w(a,t,f),w(a,i,f),k(i,l),k(i,s),z(o,i,null),r=!0},p(a,f){const u={};f[1]&4194304&&(u.$$scope={dirty:f,ctx:a}),o.$set(u)},i(a){r||(E(o.$$.fragment,a),r=!0)},o(a){A(o.$$.fragment,a),r=!1},d(a){a&&(v(e),v(t),v(i)),V(o)}}}function W6(n){let e,t,i,l,s;return{c(){e=b("button"),e.innerHTML=' Duplicate',t=O(),i=b("button"),i.innerHTML=' Delete',p(e,"type","button"),p(e,"class","dropdown-item closable"),p(i,"type","button"),p(i,"class","dropdown-item txt-danger closable")},m(o,r){w(o,e,r),w(o,t,r),w(o,i,r),l||(s=[K(e,"click",n[26]),K(i,"click",cn(Be(n[27])))],l=!0)},p:Q,d(o){o&&(v(e),v(t),v(i)),l=!1,ve(s)}}}function mp(n){let e,t,i,l;return i=new On({props:{class:"dropdown dropdown-right dropdown-nowrap m-t-5",$$slots:{default:[Y6]},$$scope:{ctx:n}}}),{c(){e=b("i"),t=O(),B(i.$$.fragment),p(e,"class","ri-arrow-down-s-fill")},m(s,o){w(s,e,o),w(s,t,o),z(i,s,o),l=!0},p(s,o){const r={};o[0]&68|o[1]&4194304&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(E(i.$$.fragment,s),l=!0)},o(s){A(i.$$.fragment,s),l=!1},d(s){s&&(v(e),v(t)),V(i,s)}}}function hp(n){let e,t,i,l,s,o=n[50]+"",r,a,f,u,c;function d(){return n[29](n[49])}return{c(){e=b("button"),t=b("i"),l=O(),s=b("span"),r=Y(o),a=Y(" collection"),f=O(),p(t,"class",i=Wn(H.getCollectionTypeIcon(n[49]))+" svelte-12y0yzb"),p(s,"class","txt"),p(e,"type","button"),p(e,"class","dropdown-item closable"),x(e,"selected",n[49]==n[2].type)},m(m,h){w(m,e,h),k(e,t),k(e,l),k(e,s),k(s,r),k(s,a),k(e,f),u||(c=K(e,"click",d),u=!0)},p(m,h){n=m,h[0]&64&&i!==(i=Wn(H.getCollectionTypeIcon(n[49]))+" svelte-12y0yzb")&&p(t,"class",i),h[0]&64&&o!==(o=n[50]+"")&&re(r,o),h[0]&68&&x(e,"selected",n[49]==n[2].type)},d(m){m&&v(e),u=!1,c()}}}function Y6(n){let e,t=de(Object.entries(n[6])),i=[];for(let l=0;l{F=null}),oe()):F?(F.p(P,j),j[0]&4&&E(F,1)):(F=mp(P),F.c(),E(F,1),F.m(d,null)),(!I||j[0]&4&&$!==($="btn btn-sm p-r-10 p-l-10 "+(P[2].id?"btn-transparent":"btn-outline")))&&p(d,"class",$),(!I||j[0]&4&&C!==(C=!!P[2].id))&&(d.disabled=C),P[2].system?N||(N=_p(),N.c(),N.m(D.parentNode,D)):N&&(N.d(1),N=null)},i(P){I||(E(F),I=!0)},o(P){A(F),I=!1},d(P){P&&(v(e),v(l),v(s),v(u),v(c),v(M),v(D)),F&&F.d(),N&&N.d(P),L=!1,R()}}}function gp(n){let e,t,i,l,s,o;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(r,a){w(r,e,a),l=!0,s||(o=we(t=Le.call(null,e,n[11])),s=!0)},p(r,a){t&&Tt(t.update)&&a[0]&2048&&t.update.call(null,r[11])},i(r){l||(r&&Ye(()=>{l&&(i||(i=Ne(e,Ut,{duration:150,start:.7},!0)),i.run(1))}),l=!0)},o(r){r&&(i||(i=Ne(e,Ut,{duration:150,start:.7},!1)),i.run(0)),l=!1},d(r){r&&v(e),r&&i&&i.end(),s=!1,o()}}}function bp(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,l||(s=we(Le.call(null,e,"Has errors")),l=!0)},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function kp(n){var a,f,u;let e,t,i,l=!H.isEmpty((a=n[5])==null?void 0:a.options)&&!((u=(f=n[5])==null?void 0:f.options)!=null&&u.manageRule),s,o,r=l&&yp();return{c(){e=b("button"),t=b("span"),t.textContent="Options",i=O(),r&&r.c(),p(t,"class","txt"),p(e,"type","button"),p(e,"class","tab-item"),x(e,"active",n[3]===Dl)},m(c,d){w(c,e,d),k(e,t),k(e,i),r&&r.m(e,null),s||(o=K(e,"click",n[33]),s=!0)},p(c,d){var m,h,_;d[0]&32&&(l=!H.isEmpty((m=c[5])==null?void 0:m.options)&&!((_=(h=c[5])==null?void 0:h.options)!=null&&_.manageRule)),l?r?d[0]&32&&E(r,1):(r=yp(),r.c(),E(r,1),r.m(e,null)):r&&(se(),A(r,1,1,()=>{r=null}),oe()),d[0]&8&&x(e,"active",c[3]===Dl)},d(c){c&&v(e),r&&r.d(),s=!1,o()}}}function yp(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,l||(s=we(Le.call(null,e,"Has errors")),l=!0)},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function J6(n){var q,W,G,U,Z,le,ne;let e,t=n[2].id?"Edit collection":"New collection",i,l,s,o,r,a,f,u,c,d,m,h=n[14]?"Query":"Fields",_,g,y=!H.isEmpty(n[11]),S,T,$,C,M=!H.isEmpty((q=n[5])==null?void 0:q.listRule)||!H.isEmpty((W=n[5])==null?void 0:W.viewRule)||!H.isEmpty((G=n[5])==null?void 0:G.createRule)||!H.isEmpty((U=n[5])==null?void 0:U.updateRule)||!H.isEmpty((Z=n[5])==null?void 0:Z.deleteRule)||!H.isEmpty((ne=(le=n[5])==null?void 0:le.options)==null?void 0:ne.manageRule),D,I,L,R,F=!!n[2].id&&!n[2].system&&pp(n);r=new pe({props:{class:"form-field collection-field-name required m-b-0 "+(n[13]?"disabled":""),name:"name",$$slots:{default:[K6,({uniqueId:he})=>({48:he}),({uniqueId:he})=>[0,he?131072:0]]},$$scope:{ctx:n}}});let N=y&&gp(n),P=M&&bp(),j=n[15]&&kp(n);return{c(){e=b("h4"),i=Y(t),l=O(),F&&F.c(),s=O(),o=b("form"),B(r.$$.fragment),a=O(),f=b("input"),u=O(),c=b("div"),d=b("button"),m=b("span"),_=Y(h),g=O(),N&&N.c(),S=O(),T=b("button"),$=b("span"),$.textContent="API Rules",C=O(),P&&P.c(),D=O(),j&&j.c(),p(e,"class","upsert-panel-title svelte-12y0yzb"),p(f,"type","submit"),p(f,"class","hidden"),p(f,"tabindex","-1"),p(o,"class","block"),p(m,"class","txt"),p(d,"type","button"),p(d,"class","tab-item"),x(d,"active",n[3]===Ci),p($,"class","txt"),p(T,"type","button"),p(T,"class","tab-item"),x(T,"active",n[3]===hs),p(c,"class","tabs-header stretched")},m(he,Ae){w(he,e,Ae),k(e,i),w(he,l,Ae),F&&F.m(he,Ae),w(he,s,Ae),w(he,o,Ae),z(r,o,null),k(o,a),k(o,f),w(he,u,Ae),w(he,c,Ae),k(c,d),k(d,m),k(m,_),k(d,g),N&&N.m(d,null),k(c,S),k(c,T),k(T,$),k(T,C),P&&P.m(T,null),k(c,D),j&&j.m(c,null),I=!0,L||(R=[K(o,"submit",Be(n[30])),K(d,"click",n[31]),K(T,"click",n[32])],L=!0)},p(he,Ae){var Ge,xe,Et,dt,mt,Gt,Me;(!I||Ae[0]&4)&&t!==(t=he[2].id?"Edit collection":"New collection")&&re(i,t),he[2].id&&!he[2].system?F?(F.p(he,Ae),Ae[0]&4&&E(F,1)):(F=pp(he),F.c(),E(F,1),F.m(s.parentNode,s)):F&&(se(),A(F,1,1,()=>{F=null}),oe());const He={};Ae[0]&8192&&(He.class="form-field collection-field-name required m-b-0 "+(he[13]?"disabled":"")),Ae[0]&41028|Ae[1]&4325376&&(He.$$scope={dirty:Ae,ctx:he}),r.$set(He),(!I||Ae[0]&16384)&&h!==(h=he[14]?"Query":"Fields")&&re(_,h),Ae[0]&2048&&(y=!H.isEmpty(he[11])),y?N?(N.p(he,Ae),Ae[0]&2048&&E(N,1)):(N=gp(he),N.c(),E(N,1),N.m(d,null)):N&&(se(),A(N,1,1,()=>{N=null}),oe()),(!I||Ae[0]&8)&&x(d,"active",he[3]===Ci),Ae[0]&32&&(M=!H.isEmpty((Ge=he[5])==null?void 0:Ge.listRule)||!H.isEmpty((xe=he[5])==null?void 0:xe.viewRule)||!H.isEmpty((Et=he[5])==null?void 0:Et.createRule)||!H.isEmpty((dt=he[5])==null?void 0:dt.updateRule)||!H.isEmpty((mt=he[5])==null?void 0:mt.deleteRule)||!H.isEmpty((Me=(Gt=he[5])==null?void 0:Gt.options)==null?void 0:Me.manageRule)),M?P?Ae[0]&32&&E(P,1):(P=bp(),P.c(),E(P,1),P.m(T,null)):P&&(se(),A(P,1,1,()=>{P=null}),oe()),(!I||Ae[0]&8)&&x(T,"active",he[3]===hs),he[15]?j?j.p(he,Ae):(j=kp(he),j.c(),j.m(c,null)):j&&(j.d(1),j=null)},i(he){I||(E(F),E(r.$$.fragment,he),E(N),E(P),I=!0)},o(he){A(F),A(r.$$.fragment,he),A(N),A(P),I=!1},d(he){he&&(v(e),v(l),v(s),v(o),v(u),v(c)),F&&F.d(he),V(r),N&&N.d(),P&&P.d(),j&&j.d(),L=!1,ve(R)}}}function Z6(n){let e,t,i,l,s,o=n[2].id?"Save changes":"Create",r,a,f,u;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=O(),l=b("button"),s=b("span"),r=Y(o),p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[9],p(s,"class","txt"),p(l,"type","button"),p(l,"class","btn btn-expanded"),l.disabled=a=!n[12]||n[9],x(l,"btn-loading",n[9])},m(c,d){w(c,e,d),k(e,t),w(c,i,d),w(c,l,d),k(l,s),k(s,r),f||(u=[K(e,"click",n[24]),K(l,"click",n[25])],f=!0)},p(c,d){d[0]&512&&(e.disabled=c[9]),d[0]&4&&o!==(o=c[2].id?"Save changes":"Create")&&re(r,o),d[0]&4608&&a!==(a=!c[12]||c[9])&&(l.disabled=a),d[0]&512&&x(l,"btn-loading",c[9])},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function G6(n){let e,t,i,l,s={class:"overlay-panel-lg colored-header collection-panel",escClose:!1,overlayClose:!n[9],beforeHide:n[38],$$slots:{footer:[Z6],header:[J6],default:[U6]},$$scope:{ctx:n}};e=new Zt({props:s}),n[39](e),e.$on("hide",n[40]),e.$on("show",n[41]);let o={};return i=new z6({props:o}),n[42](i),i.$on("confirm",n[43]),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment)},m(r,a){z(e,r,a),w(r,t,a),z(i,r,a),l=!0},p(r,a){const f={};a[0]&512&&(f.overlayClose=!r[9]),a[0]&1040&&(f.beforeHide=r[38]),a[0]&64108|a[1]&4194304&&(f.$$scope={dirty:a,ctx:r}),e.$set(f);const u={};i.$set(u)},i(r){l||(E(e.$$.fragment,r),E(i.$$.fragment,r),l=!0)},o(r){A(e.$$.fragment,r),A(i.$$.fragment,r),l=!1},d(r){r&&v(t),n[39](null),V(e,r),n[42](null),V(i,r)}}}const Ci="schema",hs="api_rules",Dl="options",X6="base",vp="auth",wp="view";function Er(n){return JSON.stringify(n)}function Q6(n,e,t){let i,l,s,o,r,a;Ue(n,mi,te=>t(5,a=te));const f={};f[X6]="Base",f[wp]="View",f[vp]="Auth";const u=st();let c,d,m=null,h=H.initCollection(),_=!1,g=!1,y=Ci,S=Er(h),T="";function $(te){t(3,y=te)}function C(te){return D(te),t(10,g=!0),$(Ci),c==null?void 0:c.show()}function M(){return c==null?void 0:c.hide()}async function D(te){Jt({}),typeof te<"u"?(t(22,m=te),t(2,h=structuredClone(te))):(t(22,m=null),t(2,h=H.initCollection())),t(2,h.schema=h.schema||[],h),t(2,h.originalName=h.name||"",h),await Xt(),t(23,S=Er(h))}function I(){h.id?d==null||d.show(m,h):L()}function L(){if(_)return;t(9,_=!0);const te=R();let Fe;h.id?Fe=fe.collections.update(h.id,te):Fe=fe.collections.create(te),Fe.then(Se=>{wa(),iv(Se),t(10,g=!1),M(),At(h.id?"Successfully updated collection.":"Successfully created collection."),u("save",{isNew:!h.id,collection:Se})}).catch(Se=>{fe.error(Se)}).finally(()=>{t(9,_=!1)})}function R(){const te=Object.assign({},h);te.schema=te.schema.slice(0);for(let Fe=te.schema.length-1;Fe>=0;Fe--)te.schema[Fe].toDelete&&te.schema.splice(Fe,1);return te}function F(){m!=null&&m.id&&fn(`Do you really want to delete collection "${m.name}" and all its records?`,()=>fe.collections.delete(m.id).then(()=>{M(),At(`Successfully deleted collection "${m.name}".`),u("delete",m),lv(m)}).catch(te=>{fe.error(te)}))}function N(te){t(2,h.type=te,h),li("schema")}function P(){o?fn("You have unsaved changes. Do you really want to discard them?",()=>{j()}):j()}async function j(){const te=m?structuredClone(m):null;if(te){if(te.id="",te.created="",te.updated="",te.name+="_duplicate",!H.isEmpty(te.schema))for(const Fe of te.schema)Fe.id="";if(!H.isEmpty(te.indexes))for(let Fe=0;FeM(),W=()=>I(),G=()=>P(),U=()=>F(),Z=te=>{t(2,h.name=H.slugify(te.target.value),h),te.target.value=h.name},le=te=>N(te),ne=()=>{r&&I()},he=()=>$(Ci),Ae=()=>$(hs),He=()=>$(Dl);function Ge(te){h=te,t(2,h),t(22,m)}function xe(te){h=te,t(2,h),t(22,m)}function Et(te){h=te,t(2,h),t(22,m)}function dt(te){h=te,t(2,h),t(22,m)}const mt=()=>o&&g?(fn("You have unsaved changes. Do you really want to close the panel?",()=>{t(10,g=!1),M()}),!1):!0;function Gt(te){ee[te?"unshift":"push"](()=>{c=te,t(7,c)})}function Me(te){Te.call(this,n,te)}function Ee(te){Te.call(this,n,te)}function ze(te){ee[te?"unshift":"push"](()=>{d=te,t(8,d)})}const _t=()=>L();return n.$$.update=()=>{var te,Fe;n.$$.dirty[0]&4&&h.type==="view"&&(t(2,h.createRule=null,h),t(2,h.updateRule=null,h),t(2,h.deleteRule=null,h),t(2,h.indexes=[],h)),n.$$.dirty[0]&4194308&&h.name&&(m==null?void 0:m.name)!=h.name&&h.indexes.length>0&&t(2,h.indexes=(te=h.indexes)==null?void 0:te.map(Se=>H.replaceIndexTableName(Se,h.name)),h),n.$$.dirty[0]&4&&t(15,i=h.type===vp),n.$$.dirty[0]&4&&t(14,l=h.type===wp),n.$$.dirty[0]&32&&(a.schema||(Fe=a.options)!=null&&Fe.query?t(11,T=H.getNestedVal(a,"schema.message")||"Has errors"):t(11,T="")),n.$$.dirty[0]&4&&t(13,s=!!h.id&&h.system),n.$$.dirty[0]&8388612&&t(4,o=S!=Er(h)),n.$$.dirty[0]&20&&t(12,r=!h.id||o),n.$$.dirty[0]&12&&y===Dl&&h.type!=="auth"&&$(Ci)},[$,M,h,y,o,a,f,c,d,_,g,T,r,s,l,i,I,L,F,N,P,C,m,S,q,W,G,U,Z,le,ne,he,Ae,He,Ge,xe,Et,dt,mt,Gt,Me,Ee,ze,_t]}class Ua extends ge{constructor(e){super(),_e(this,e,Q6,G6,me,{changeTab:0,show:21,hide:1},null,[-1,-1])}get changeTab(){return this.$$.ctx[0]}get show(){return this.$$.ctx[21]}get hide(){return this.$$.ctx[1]}}function x6(n){let e;return{c(){e=b("i"),p(e,"class","ri-pushpin-line m-l-auto svelte-1u3ag8h")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function e5(n){let e;return{c(){e=b("i"),p(e,"class","ri-unpin-line svelte-1u3ag8h")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function t5(n){let e,t,i,l,s,o=n[0].name+"",r,a,f,u,c,d,m,h;function _(S,T){return S[1]?e5:x6}let g=_(n),y=g(n);return{c(){var S;e=b("a"),t=b("i"),l=O(),s=b("span"),r=Y(o),a=O(),f=b("span"),y.c(),p(t,"class",i=Wn(H.getCollectionTypeIcon(n[0].type))+" svelte-1u3ag8h"),p(s,"class","txt m-r-auto"),p(f,"class","btn btn-xs btn-circle btn-hint btn-transparent pin-collection svelte-1u3ag8h"),p(f,"aria-label","Pin collection"),p(e,"href",c="/collections?collectionId="+n[0].id),p(e,"class","sidebar-list-item svelte-1u3ag8h"),p(e,"title",d=n[0].name),x(e,"active",((S=n[2])==null?void 0:S.id)===n[0].id)},m(S,T){w(S,e,T),k(e,t),k(e,l),k(e,s),k(s,r),k(e,a),k(e,f),y.m(f,null),m||(h=[we(u=Le.call(null,f,{position:"right",text:(n[1]?"Unpin":"Pin")+" collection"})),K(f,"click",cn(Be(n[5]))),we(nn.call(null,e))],m=!0)},p(S,[T]){var $;T&1&&i!==(i=Wn(H.getCollectionTypeIcon(S[0].type))+" svelte-1u3ag8h")&&p(t,"class",i),T&1&&o!==(o=S[0].name+"")&&re(r,o),g!==(g=_(S))&&(y.d(1),y=g(S),y&&(y.c(),y.m(f,null))),u&&Tt(u.update)&&T&2&&u.update.call(null,{position:"right",text:(S[1]?"Unpin":"Pin")+" collection"}),T&1&&c!==(c="/collections?collectionId="+S[0].id)&&p(e,"href",c),T&1&&d!==(d=S[0].name)&&p(e,"title",d),T&5&&x(e,"active",(($=S[2])==null?void 0:$.id)===S[0].id)},i:Q,o:Q,d(S){S&&v(e),y.d(),m=!1,ve(h)}}}function n5(n,e,t){let i,l;Ue(n,Kn,f=>t(2,l=f));let{collection:s}=e,{pinnedIds:o}=e;function r(f){o.includes(f.id)?H.removeByValue(o,f.id):o.push(f.id),t(4,o)}const a=()=>r(s);return n.$$set=f=>{"collection"in f&&t(0,s=f.collection),"pinnedIds"in f&&t(4,o=f.pinnedIds)},n.$$.update=()=>{n.$$.dirty&17&&t(1,i=o.includes(s.id))},[s,i,l,r,o,a]}class Yb extends ge{constructor(e){super(),_e(this,e,n5,t5,me,{collection:0,pinnedIds:4})}}function Sp(n,e,t){const i=n.slice();return i[22]=e[t],i}function $p(n,e,t){const i=n.slice();return i[22]=e[t],i}function Tp(n){let e,t,i=[],l=new Map,s,o,r=de(n[6]);const a=f=>f[22].id;for(let f=0;fbe(i,"pinnedIds",o)),{key:n,first:null,c(){t=ye(),B(i.$$.fragment),this.first=t},m(a,f){w(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f&64&&(u.collection=e[22]),!l&&f&2&&(l=!0,u.pinnedIds=e[1],ke(()=>l=!1)),i.$set(u)},i(a){s||(E(i.$$.fragment,a),s=!0)},o(a){A(i.$$.fragment,a),s=!1},d(a){a&&v(t),V(i,a)}}}function Op(n){let e,t=[],i=new Map,l,s,o=n[6].length&&Mp(),r=de(n[5]);const a=f=>f[22].id;for(let f=0;fbe(i,"pinnedIds",o)),{key:n,first:null,c(){t=ye(),B(i.$$.fragment),this.first=t},m(a,f){w(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f&32&&(u.collection=e[22]),!l&&f&2&&(l=!0,u.pinnedIds=e[1],ke(()=>l=!1)),i.$set(u)},i(a){s||(E(i.$$.fragment,a),s=!0)},o(a){A(i.$$.fragment,a),s=!1},d(a){a&&v(t),V(i,a)}}}function Ep(n){let e;return{c(){e=b("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&&v(e)}}}function Ip(n){let e,t,i,l;return{c(){e=b("footer"),t=b("button"),t.innerHTML=' New collection',p(t,"type","button"),p(t,"class","btn btn-block btn-outline"),p(e,"class","sidebar-footer")},m(s,o){w(s,e,o),k(e,t),i||(l=K(t,"click",n[16]),i=!0)},p:Q,d(s){s&&v(e),i=!1,l()}}}function i5(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S=n[6].length&&Tp(n),T=n[5].length&&Op(n),$=n[3].length&&!n[2].length&&Ep(),C=!n[9]&&Ip(n);return{c(){e=b("header"),t=b("div"),i=b("div"),l=b("button"),l.innerHTML='',s=O(),o=b("input"),r=O(),a=b("hr"),f=O(),u=b("div"),S&&S.c(),c=O(),T&&T.c(),d=O(),$&&$.c(),m=O(),C&&C.c(),h=ye(),p(l,"type","button"),p(l,"class","btn btn-xs btn-transparent btn-circle btn-clear"),x(l,"hidden",!n[7]),p(i,"class","form-field-addon"),p(o,"type","text"),p(o,"placeholder","Search collections..."),p(o,"name","collections-search"),p(t,"class","form-field search"),x(t,"active",n[7]),p(e,"class","sidebar-header"),p(a,"class","m-t-5 m-b-xs"),p(u,"class","sidebar-content"),x(u,"fade",n[8]),x(u,"sidebar-content-compact",n[2].length>20)},m(M,D){w(M,e,D),k(e,t),k(t,i),k(i,l),k(t,s),k(t,o),ae(o,n[0]),w(M,r,D),w(M,a,D),w(M,f,D),w(M,u,D),S&&S.m(u,null),k(u,c),T&&T.m(u,null),k(u,d),$&&$.m(u,null),w(M,m,D),C&&C.m(M,D),w(M,h,D),_=!0,g||(y=[K(l,"click",n[12]),K(o,"input",n[13])],g=!0)},p(M,D){(!_||D&128)&&x(l,"hidden",!M[7]),D&1&&o.value!==M[0]&&ae(o,M[0]),(!_||D&128)&&x(t,"active",M[7]),M[6].length?S?(S.p(M,D),D&64&&E(S,1)):(S=Tp(M),S.c(),E(S,1),S.m(u,c)):S&&(se(),A(S,1,1,()=>{S=null}),oe()),M[5].length?T?(T.p(M,D),D&32&&E(T,1)):(T=Op(M),T.c(),E(T,1),T.m(u,d)):T&&(se(),A(T,1,1,()=>{T=null}),oe()),M[3].length&&!M[2].length?$||($=Ep(),$.c(),$.m(u,null)):$&&($.d(1),$=null),(!_||D&256)&&x(u,"fade",M[8]),(!_||D&4)&&x(u,"sidebar-content-compact",M[2].length>20),M[9]?C&&(C.d(1),C=null):C?C.p(M,D):(C=Ip(M),C.c(),C.m(h.parentNode,h))},i(M){_||(E(S),E(T),_=!0)},o(M){A(S),A(T),_=!1},d(M){M&&(v(e),v(r),v(a),v(f),v(u),v(m),v(h)),S&&S.d(),T&&T.d(),$&&$.d(),C&&C.d(M),g=!1,ve(y)}}}function l5(n){let e,t,i,l;e=new Hb({props:{class:"collection-sidebar",$$slots:{default:[i5]},$$scope:{ctx:n}}});let s={};return i=new Ua({props:s}),n[17](i),i.$on("save",n[18]),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment)},m(o,r){z(e,o,r),w(o,t,r),z(i,o,r),l=!0},p(o,[r]){const a={};r&134218751&&(a.$$scope={dirty:r,ctx:o}),e.$set(a);const f={};i.$set(f)},i(o){l||(E(e.$$.fragment,o),E(i.$$.fragment,o),l=!0)},o(o){A(e.$$.fragment,o),A(i.$$.fragment,o),l=!1},d(o){o&&v(t),V(e,o),n[17](null),V(i,o)}}}const Ap="@pinnedCollections";function s5(){setTimeout(()=>{const n=document.querySelector(".collection-sidebar .sidebar-list-item.active");n&&(n==null||n.scrollIntoView({block:"nearest"}))},0)}function o5(n,e,t){let i,l,s,o,r,a,f,u,c;Ue(n,Fn,L=>t(11,a=L)),Ue(n,Kn,L=>t(19,f=L)),Ue(n,To,L=>t(8,u=L)),Ue(n,Xi,L=>t(9,c=L));let d,m="",h=[];g();function _(L){xt(Kn,f=L,f)}function g(){t(1,h=[]);try{const L=localStorage.getItem(Ap);L&&t(1,h=JSON.parse(L)||[])}catch{}}function y(){t(1,h=h.filter(L=>!!a.find(R=>R.id==L)))}const S=()=>t(0,m="");function T(){m=this.value,t(0,m)}function $(L){h=L,t(1,h)}function C(L){h=L,t(1,h)}const M=()=>d==null?void 0:d.show();function D(L){ee[L?"unshift":"push"](()=>{d=L,t(4,d)})}const I=L=>{var R;(R=L.detail)!=null&&R.isNew&&L.detail.collection&&_(L.detail.collection)};return n.$$.update=()=>{n.$$.dirty&2048&&a&&(y(),s5()),n.$$.dirty&1&&t(3,i=m.replace(/\s+/g,"").toLowerCase()),n.$$.dirty&1&&t(7,l=m!==""),n.$$.dirty&2&&h&&localStorage.setItem(Ap,JSON.stringify(h)),n.$$.dirty&2057&&t(2,s=a.filter(L=>L.id==m||L.name.replace(/\s+/g,"").toLowerCase().includes(i))),n.$$.dirty&6&&t(6,o=s.filter(L=>h.includes(L.id))),n.$$.dirty&6&&t(5,r=s.filter(L=>!h.includes(L.id)))},[m,h,s,i,d,r,o,l,u,c,_,a,S,T,$,C,M,D,I]}class r5 extends ge{constructor(e){super(),_e(this,e,o5,l5,me,{})}}function Lp(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i}function Np(n){n[18]=n[19].default}function Pp(n,e,t){const i=n.slice();return i[14]=e[t][0],i[15]=e[t][1],i[21]=t,i}function Fp(n){let e;return{c(){e=b("hr"),p(e,"class","m-t-sm m-b-sm")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Rp(n,e){let t,i=e[21]===Object.keys(e[6]).length,l,s,o=e[15].label+"",r,a,f,u,c=i&&Fp();function d(){return e[9](e[14])}return{key:n,first:null,c(){t=ye(),c&&c.c(),l=O(),s=b("button"),r=Y(o),a=O(),p(s,"type","button"),p(s,"class","sidebar-item"),x(s,"active",e[5]===e[14]),this.first=t},m(m,h){w(m,t,h),c&&c.m(m,h),w(m,l,h),w(m,s,h),k(s,r),k(s,a),f||(u=K(s,"click",d),f=!0)},p(m,h){e=m,h&8&&(i=e[21]===Object.keys(e[6]).length),i?c||(c=Fp(),c.c(),c.m(l.parentNode,l)):c&&(c.d(1),c=null),h&8&&o!==(o=e[15].label+"")&&re(r,o),h&40&&x(s,"active",e[5]===e[14])},d(m){m&&(v(t),v(l),v(s)),c&&c.d(m),f=!1,u()}}}function qp(n){let e,t,i,l={ctx:n,current:null,token:null,hasCatch:!1,pending:u5,then:f5,catch:a5,value:19,blocks:[,,,]};return Qa(t=n[15].component,l),{c(){e=ye(),l.block.c()},m(s,o){w(s,e,o),l.block.m(s,l.anchor=o),l.mount=()=>e.parentNode,l.anchor=e,i=!0},p(s,o){n=s,l.ctx=n,o&8&&t!==(t=n[15].component)&&Qa(t,l)||C0(l,n,o)},i(s){i||(E(l.block),i=!0)},o(s){for(let o=0;o<3;o+=1){const r=l.blocks[o];A(r)}i=!1},d(s){s&&v(e),l.block.d(s),l.token=null,l=null}}}function a5(n){return{c:Q,m:Q,p:Q,i:Q,o:Q,d:Q}}function f5(n){Np(n);let e,t,i;return e=new n[18]({props:{collection:n[2]}}),{c(){B(e.$$.fragment),t=O()},m(l,s){z(e,l,s),w(l,t,s),i=!0},p(l,s){Np(l);const o={};s&4&&(o.collection=l[2]),e.$set(o)},i(l){i||(E(e.$$.fragment,l),i=!0)},o(l){A(e.$$.fragment,l),i=!1},d(l){l&&v(t),V(e,l)}}}function u5(n){return{c:Q,m:Q,p:Q,i:Q,o:Q,d:Q}}function jp(n,e){let t,i,l,s=e[5]===e[14]&&qp(e);return{key:n,first:null,c(){t=ye(),s&&s.c(),i=ye(),this.first=t},m(o,r){w(o,t,r),s&&s.m(o,r),w(o,i,r),l=!0},p(o,r){e=o,e[5]===e[14]?s?(s.p(e,r),r&40&&E(s,1)):(s=qp(e),s.c(),E(s,1),s.m(i.parentNode,i)):s&&(se(),A(s,1,1,()=>{s=null}),oe())},i(o){l||(E(s),l=!0)},o(o){A(s),l=!1},d(o){o&&(v(t),v(i)),s&&s.d(o)}}}function c5(n){let e,t,i,l=[],s=new Map,o,r,a=[],f=new Map,u,c=de(Object.entries(n[3]));const d=_=>_[14];for(let _=0;__[14];for(let _=0;_Close',p(e,"type","button"),p(e,"class","btn btn-transparent")},m(l,s){w(l,e,s),t||(i=K(e,"click",n[8]),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function p5(n){let e,t,i={class:"docs-panel",$$slots:{footer:[d5],default:[c5]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[10](e),e.$on("hide",n[11]),e.$on("show",n[12]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&4194348&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[10](null),V(e,l)}}}function m5(n,e,t){const i={list:{label:"List/Search",component:nt(()=>import("./ListApiDocs-Ej5naqCg.js"),__vite__mapDeps([3,4,5,6,7]),import.meta.url)},view:{label:"View",component:nt(()=>import("./ViewApiDocs-EPId3tA7.js"),__vite__mapDeps([8,4,5,6]),import.meta.url)},create:{label:"Create",component:nt(()=>import("./CreateApiDocs-5RxIhvO0.js"),__vite__mapDeps([9,4,5,6]),import.meta.url)},update:{label:"Update",component:nt(()=>import("./UpdateApiDocs-GDKV_HSc.js"),__vite__mapDeps([10,4,5,6]),import.meta.url)},delete:{label:"Delete",component:nt(()=>import("./DeleteApiDocs-j_NJpd0u.js"),__vite__mapDeps([11,4,5]),import.meta.url)},realtime:{label:"Realtime",component:nt(()=>import("./RealtimeApiDocs-2yYxyEgN.js"),__vite__mapDeps([12,4,5]),import.meta.url)}},l={"auth-with-password":{label:"Auth with password",component:nt(()=>import("./AuthWithPasswordDocs-Sqq2A_xb.js"),__vite__mapDeps([13,4,5,6]),import.meta.url)},"auth-with-oauth2":{label:"Auth with OAuth2",component:nt(()=>import("./AuthWithOAuth2Docs-N1wT5-Tm.js"),__vite__mapDeps([14,4,5,6]),import.meta.url)},refresh:{label:"Auth refresh",component:nt(()=>import("./AuthRefreshDocs-JfV5JCoS.js"),__vite__mapDeps([15,4,5,6]),import.meta.url)},"request-verification":{label:"Request verification",component:nt(()=>import("./RequestVerificationDocs-LGhIAfd9.js"),__vite__mapDeps([16,4,5]),import.meta.url)},"confirm-verification":{label:"Confirm verification",component:nt(()=>import("./ConfirmVerificationDocs-iIwWOJ-8.js"),__vite__mapDeps([17,4,5]),import.meta.url)},"request-password-reset":{label:"Request password reset",component:nt(()=>import("./RequestPasswordResetDocs-CDKXdjxv.js"),__vite__mapDeps([18,4,5]),import.meta.url)},"confirm-password-reset":{label:"Confirm password reset",component:nt(()=>import("./ConfirmPasswordResetDocs-XG9DX7jk.js"),__vite__mapDeps([19,4,5]),import.meta.url)},"request-email-change":{label:"Request email change",component:nt(()=>import("./RequestEmailChangeDocs-J7AVBZVY.js"),__vite__mapDeps([20,4,5]),import.meta.url)},"confirm-email-change":{label:"Confirm email change",component:nt(()=>import("./ConfirmEmailChangeDocs-z2cifBOn.js"),__vite__mapDeps([21,4,5]),import.meta.url)},"list-auth-methods":{label:"List auth methods",component:nt(()=>import("./AuthMethodsDocs-YXCf-w6f.js"),__vite__mapDeps([22,4,5,6]),import.meta.url)},"list-linked-accounts":{label:"List OAuth2 accounts",component:nt(()=>import("./ListExternalAuthsDocs-0k6rNNq4.js"),__vite__mapDeps([23,4,5,6]),import.meta.url)},"unlink-account":{label:"Unlink OAuth2 account",component:nt(()=>import("./UnlinkExternalAuthDocs-Qe14c8ks.js"),__vite__mapDeps([24,4,5]),import.meta.url)}};let s,o={},r,a=[];a.length&&(r=Object.keys(a)[0]);function f(y){return t(2,o=y),c(Object.keys(a)[0]),s==null?void 0:s.show()}function u(){return s==null?void 0:s.hide()}function c(y){t(5,r=y)}const d=()=>u(),m=y=>c(y);function h(y){ee[y?"unshift":"push"](()=>{s=y,t(4,s)})}function _(y){Te.call(this,n,y)}function g(y){Te.call(this,n,y)}return n.$$.update=()=>{n.$$.dirty&12&&(o.type==="auth"?(t(3,a=Object.assign({},i,l)),!o.options.allowUsernameAuth&&!o.options.allowEmailAuth&&delete a["auth-with-password"],o.options.allowOAuth2Auth||delete a["auth-with-oauth2"]):o.type==="view"?(t(3,a=Object.assign({},i)),delete a.create,delete a.update,delete a.delete,delete a.realtime):t(3,a=Object.assign({},i)))},[u,c,o,a,s,r,i,f,d,m,h,_,g]}class h5 extends ge{constructor(e){super(),_e(this,e,m5,p5,me,{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 _5(n){let e,t,i,l;return{c(){e=b("i"),p(e,"class","ri-calendar-event-line txt-disabled")},m(s,o){w(s,e,o),i||(l=we(t=Le.call(null,e,{text:n[0].join(` `),position:"left"})),i=!0)},p(s,[o]){t&&Tt(t.update)&&o&1&&t.update.call(null,{text:s[0].join(` -`),position:"left"})},i:Q,o:Q,d(s){s&&v(e),i=!1,l()}}}const Hp="yyyy-MM-dd HH:mm:ss.SSS";function g5(n,e,t){let{model:i}=e,l=[];function s(){t(0,l=[]),i.created&&l.push("Created: "+H.formatToLocalDate(i.created,Hp)+" Local"),i.updated&&l.push("Updated: "+H.formatToLocalDate(i.updated,Hp)+" Local")}return n.$$set=o=>{"model"in o&&t(1,i=o.model)},n.$$.update=()=>{n.$$.dirty&2&&i&&s()},[l,i]}class Kb extends ge{constructor(e){super(),_e(this,e,g5,_5,me,{model:1})}}function b5(n){let e,t,i,l,s,o,r,a,f,u;return s=new sl({props:{value:n[1]}}),{c(){e=b("div"),t=b("span"),i=Y(n[1]),l=O(),B(s.$$.fragment),o=O(),r=b("i"),p(t,"class","secret svelte-1md8247"),p(r,"class","ri-refresh-line txt-sm link-hint"),p(r,"aria-label","Refresh"),p(e,"class","flex flex-gap-5 p-5")},m(c,d){w(c,e,d),k(e,t),k(t,i),n[6](t),k(e,l),z(s,e,null),k(e,o),k(e,r),a=!0,f||(u=[we(Le.call(null,r,"Refresh")),K(r,"click",n[4])],f=!0)},p(c,d){(!a||d&2)&&re(i,c[1]);const m={};d&2&&(m.value=c[1]),s.$set(m)},i(c){a||(E(s.$$.fragment,c),a=!0)},o(c){A(s.$$.fragment,c),a=!1},d(c){c&&v(e),n[6](null),V(s),f=!1,ve(u)}}}function k5(n){let e,t,i,l,s,o,r,a,f,u;function c(m){n[7](m)}let d={class:"dropdown dropdown-upside dropdown-center dropdown-nowrap",$$slots:{default:[b5]},$$scope:{ctx:n}};return n[3]!==void 0&&(d.active=n[3]),l=new On({props:d}),ee.push(()=>be(l,"active",c)),l.$on("show",n[4]),{c(){e=b("button"),t=b("i"),i=O(),B(l.$$.fragment),p(t,"class","ri-sparkling-line"),p(e,"tabindex","-1"),p(e,"type","button"),p(e,"aria-label","Generate"),p(e,"class",o="btn btn-circle "+n[0]+" svelte-1md8247")},m(m,h){w(m,e,h),k(e,t),k(e,i),z(l,e,null),a=!0,f||(u=we(r=Le.call(null,e,n[3]?"":"Generate")),f=!0)},p(m,[h]){const _={};h&518&&(_.$$scope={dirty:h,ctx:m}),!s&&h&8&&(s=!0,_.active=m[3],ke(()=>s=!1)),l.$set(_),(!a||h&1&&o!==(o="btn btn-circle "+m[0]+" svelte-1md8247"))&&p(e,"class",o),r&&Tt(r.update)&&h&8&&r.update.call(null,m[3]?"":"Generate")},i(m){a||(E(l.$$.fragment,m),a=!0)},o(m){A(l.$$.fragment,m),a=!1},d(m){m&&v(e),V(l),f=!1,u()}}}function y5(n,e,t){const i=st();let{class:l="btn-sm btn-hint btn-transparent"}=e,{length:s=32}=e,o="",r,a=!1;async function f(){if(t(1,o=H.randomSecret(s)),i("generate",o),await Xt(),r){let d=document.createRange();d.selectNode(r),window.getSelection().removeAllRanges(),window.getSelection().addRange(d)}}function u(d){ee[d?"unshift":"push"](()=>{r=d,t(2,r)})}function c(d){a=d,t(3,a)}return n.$$set=d=>{"class"in d&&t(0,l=d.class),"length"in d&&t(5,s=d.length)},[l,o,r,a,f,s,u,c]}class Jb extends ge{constructor(e){super(),_e(this,e,y5,k5,me,{class:0,length:5})}}function v5(n){let e,t,i,l,s,o,r,a,f,u,c,d;return{c(){e=b("label"),t=b("i"),i=O(),l=b("span"),l.textContent="Username",o=O(),r=b("input"),p(t,"class",H.getFieldTypeIcon("user")),p(l,"class","txt"),p(e,"for",s=n[13]),p(r,"type","text"),p(r,"requried",a=!n[2]),p(r,"placeholder",f=n[2]?"Leave empty to auto generate...":n[4]),p(r,"id",u=n[13])},m(m,h){w(m,e,h),k(e,t),k(e,i),k(e,l),w(m,o,h),w(m,r,h),ae(r,n[0].username),c||(d=K(r,"input",n[5]),c=!0)},p(m,h){h&8192&&s!==(s=m[13])&&p(e,"for",s),h&4&&a!==(a=!m[2])&&p(r,"requried",a),h&4&&f!==(f=m[2]?"Leave empty to auto generate...":m[4])&&p(r,"placeholder",f),h&8192&&u!==(u=m[13])&&p(r,"id",u),h&1&&r.value!==m[0].username&&ae(r,m[0].username)},d(m){m&&(v(e),v(o),v(r)),c=!1,d()}}}function w5(n){let e,t,i,l,s,o,r,a,f,u,c=n[0].emailVisibility?"On":"Off",d,m,h,_,g,y,S,T;return{c(){var $;e=b("label"),t=b("i"),i=O(),l=b("span"),l.textContent="Email",o=O(),r=b("div"),a=b("button"),f=b("span"),u=Y("Public: "),d=Y(c),h=O(),_=b("input"),p(t,"class",H.getFieldTypeIcon("email")),p(l,"class","txt"),p(e,"for",s=n[13]),p(f,"class","txt"),p(a,"type","button"),p(a,"class",m="btn btn-sm btn-transparent "+(n[0].emailVisibility?"btn-success":"btn-hint")),p(r,"class","form-field-addon email-visibility-addon svelte-1751a4d"),p(_,"type","email"),_.autofocus=n[2],p(_,"autocomplete","off"),p(_,"id",g=n[13]),_.required=y=($=n[1].options)==null?void 0:$.requireEmail,p(_,"class","svelte-1751a4d")},m($,C){w($,e,C),k(e,t),k(e,i),k(e,l),w($,o,C),w($,r,C),k(r,a),k(a,f),k(f,u),k(f,d),w($,h,C),w($,_,C),ae(_,n[0].email),n[2]&&_.focus(),S||(T=[we(Le.call(null,a,{text:"Make email public or private",position:"top-right"})),K(a,"click",Be(n[6])),K(_,"input",n[7])],S=!0)},p($,C){var M;C&8192&&s!==(s=$[13])&&p(e,"for",s),C&1&&c!==(c=$[0].emailVisibility?"On":"Off")&&re(d,c),C&1&&m!==(m="btn btn-sm btn-transparent "+($[0].emailVisibility?"btn-success":"btn-hint"))&&p(a,"class",m),C&4&&(_.autofocus=$[2]),C&8192&&g!==(g=$[13])&&p(_,"id",g),C&2&&y!==(y=(M=$[1].options)==null?void 0:M.requireEmail)&&(_.required=y),C&1&&_.value!==$[0].email&&ae(_,$[0].email)},d($){$&&(v(e),v(o),v(r),v(h),v(_)),S=!1,ve(T)}}}function zp(n){let e,t;return e=new pe({props:{class:"form-field form-field-toggle",name:"verified",$$slots:{default:[S5,({uniqueId:i})=>({13:i}),({uniqueId:i})=>i?8192:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&24584&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function S5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Change password"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){w(f,e,u),e.checked=n[3],w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[8]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&8&&(e.checked=f[3]),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function Vp(n){let e,t,i,l,s,o,r,a,f;return l=new pe({props:{class:"form-field required",name:"password",$$slots:{default:[$5,({uniqueId:u})=>({13:u}),({uniqueId:u})=>u?8192:0]},$$scope:{ctx:n}}}),r=new pe({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[T5,({uniqueId:u})=>({13:u}),({uniqueId:u})=>u?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),i=b("div"),B(l.$$.fragment),s=O(),o=b("div"),B(r.$$.fragment),p(i,"class","col-sm-6"),p(o,"class","col-sm-6"),p(t,"class","grid"),x(t,"p-t-xs",n[3]),p(e,"class","block")},m(u,c){w(u,e,c),k(e,t),k(t,i),z(l,i,null),k(t,s),k(t,o),z(r,o,null),f=!0},p(u,c){const d={};c&24579&&(d.$$scope={dirty:c,ctx:u}),l.$set(d);const m={};c&24577&&(m.$$scope={dirty:c,ctx:u}),r.$set(m),(!f||c&8)&&x(t,"p-t-xs",u[3])},i(u){f||(E(l.$$.fragment,u),E(r.$$.fragment,u),u&&Ye(()=>{f&&(a||(a=Ne(e,et,{duration:150},!0)),a.run(1))}),f=!0)},o(u){A(l.$$.fragment,u),A(r.$$.fragment,u),u&&(a||(a=Ne(e,et,{duration:150},!1)),a.run(0)),f=!1},d(u){u&&v(e),V(l),V(r),u&&a&&a.end()}}}function $5(n){var _,g;let e,t,i,l,s,o,r,a,f,u,c,d,m,h;return c=new Jb({props:{length:Math.max(15,((g=(_=n[1])==null?void 0:_.options)==null?void 0:g.minPasswordLength)||0)}}),{c(){e=b("label"),t=b("i"),i=O(),l=b("span"),l.textContent="Password",o=O(),r=b("input"),f=O(),u=b("div"),B(c.$$.fragment),p(t,"class","ri-lock-line"),p(l,"class","txt"),p(e,"for",s=n[13]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[13]),r.required=!0,p(u,"class","form-field-addon")},m(y,S){w(y,e,S),k(e,t),k(e,i),k(e,l),w(y,o,S),w(y,r,S),ae(r,n[0].password),w(y,f,S),w(y,u,S),z(c,u,null),d=!0,m||(h=K(r,"input",n[9]),m=!0)},p(y,S){var $,C;(!d||S&8192&&s!==(s=y[13]))&&p(e,"for",s),(!d||S&8192&&a!==(a=y[13]))&&p(r,"id",a),S&1&&r.value!==y[0].password&&ae(r,y[0].password);const T={};S&2&&(T.length=Math.max(15,((C=($=y[1])==null?void 0:$.options)==null?void 0:C.minPasswordLength)||0)),c.$set(T)},i(y){d||(E(c.$$.fragment,y),d=!0)},o(y){A(c.$$.fragment,y),d=!1},d(y){y&&(v(e),v(o),v(r),v(f),v(u)),V(c),m=!1,h()}}}function T5(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=b("i"),i=O(),l=b("span"),l.textContent="Password confirm",o=O(),r=b("input"),p(t,"class","ri-lock-line"),p(l,"class","txt"),p(e,"for",s=n[13]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[13]),r.required=!0},m(c,d){w(c,e,d),k(e,t),k(e,i),k(e,l),w(c,o,d),w(c,r,d),ae(r,n[0].passwordConfirm),f||(u=K(r,"input",n[10]),f=!0)},p(c,d){d&8192&&s!==(s=c[13])&&p(e,"for",s),d&8192&&a!==(a=c[13])&&p(r,"id",a),d&1&&r.value!==c[0].passwordConfirm&&ae(r,c[0].passwordConfirm)},d(c){c&&(v(e),v(o),v(r)),f=!1,u()}}}function C5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Verified"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){w(f,e,u),e.checked=n[0].verified,w(f,i,u),w(f,l,u),k(l,s),r||(a=[K(e,"change",n[11]),K(e,"change",Be(n[12]))],r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].verified),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,ve(a)}}}function O5(n){var g;let e,t,i,l,s,o,r,a,f,u,c,d,m;i=new pe({props:{class:"form-field "+(n[2]?"":"required"),name:"username",$$slots:{default:[v5,({uniqueId:y})=>({13:y}),({uniqueId:y})=>y?8192:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field "+((g=n[1].options)!=null&&g.requireEmail?"required":""),name:"email",$$slots:{default:[w5,({uniqueId:y})=>({13:y}),({uniqueId:y})=>y?8192:0]},$$scope:{ctx:n}}});let h=!n[2]&&zp(n),_=(n[2]||n[3])&&Vp(n);return d=new pe({props:{class:"form-field form-field-toggle",name:"verified",$$slots:{default:[C5,({uniqueId:y})=>({13:y}),({uniqueId:y})=>y?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),r=O(),a=b("div"),h&&h.c(),f=O(),_&&_.c(),u=O(),c=b("div"),B(d.$$.fragment),p(t,"class","col-lg-6"),p(s,"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,S){w(y,e,S),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),k(e,r),k(e,a),h&&h.m(a,null),k(a,f),_&&_.m(a,null),k(e,u),k(e,c),z(d,c,null),m=!0},p(y,[S]){var M;const T={};S&4&&(T.class="form-field "+(y[2]?"":"required")),S&24581&&(T.$$scope={dirty:S,ctx:y}),i.$set(T);const $={};S&2&&($.class="form-field "+((M=y[1].options)!=null&&M.requireEmail?"required":"")),S&24583&&($.$$scope={dirty:S,ctx:y}),o.$set($),y[2]?h&&(se(),A(h,1,1,()=>{h=null}),oe()):h?(h.p(y,S),S&4&&E(h,1)):(h=zp(y),h.c(),E(h,1),h.m(a,f)),y[2]||y[3]?_?(_.p(y,S),S&12&&E(_,1)):(_=Vp(y),_.c(),E(_,1),_.m(a,null)):_&&(se(),A(_,1,1,()=>{_=null}),oe());const C={};S&24581&&(C.$$scope={dirty:S,ctx:y}),d.$set(C)},i(y){m||(E(i.$$.fragment,y),E(o.$$.fragment,y),E(h),E(_),E(d.$$.fragment,y),m=!0)},o(y){A(i.$$.fragment,y),A(o.$$.fragment,y),A(h),A(_),A(d.$$.fragment,y),m=!1},d(y){y&&v(e),V(i),V(o),h&&h.d(),_&&_.d(),V(d)}}}function M5(n,e,t){let{record:i}=e,{collection:l}=e,{isNew:s=!(i!=null&&i.id)}=e,o=i.username||null,r=!1;function a(){i.username=this.value,t(0,i),t(3,r)}const f=()=>t(0,i.emailVisibility=!i.emailVisibility,i);function u(){i.email=this.value,t(0,i),t(3,r)}function c(){r=this.checked,t(3,r)}function d(){i.password=this.value,t(0,i),t(3,r)}function m(){i.passwordConfirm=this.value,t(0,i),t(3,r)}function h(){i.verified=this.checked,t(0,i),t(3,r)}const _=g=>{s||fn("Do you really want to manually change the verified account state?",()=>{},()=>{t(0,i.verified=!g.target.checked,i)})};return n.$$set=g=>{"record"in g&&t(0,i=g.record),"collection"in g&&t(1,l=g.collection),"isNew"in g&&t(2,s=g.isNew)},n.$$.update=()=>{n.$$.dirty&1&&!i.username&&i.username!==null&&t(0,i.username=null,i),n.$$.dirty&8&&(r||(t(0,i.password=null,i),t(0,i.passwordConfirm=null,i),li("password"),li("passwordConfirm")))},[i,l,s,r,o,a,f,u,c,d,m,h,_]}class D5 extends ge{constructor(e){super(),_e(this,e,M5,O5,me,{record:0,collection:1,isNew:2})}}function E5(n){let e,t,i,l=[n[3]],s={};for(let o=0;o{r&&(t(1,r.style.height="",r),t(1,r.style.height=Math.min(r.scrollHeight,o)+"px",r))},0)}function u(m){if((m==null?void 0:m.code)==="Enter"&&!(m!=null&&m.shiftKey)&&!(m!=null&&m.isComposing)){m.preventDefault();const h=r.closest("form");h!=null&&h.requestSubmit&&h.requestSubmit()}}jt(()=>(f(),()=>clearTimeout(a)));function c(m){ee[m?"unshift":"push"](()=>{r=m,t(1,r)})}function d(){s=this.value,t(0,s)}return n.$$set=m=>{e=Pe(Pe({},e),Wt(m)),t(3,l=Ze(e,i)),"value"in m&&t(0,s=m.value),"maxHeight"in m&&t(4,o=m.maxHeight)},n.$$.update=()=>{n.$$.dirty&1&&typeof s!==void 0&&f()},[s,r,u,l,o,c,d]}class A5 extends ge{constructor(e){super(),_e(this,e,I5,E5,me,{value:0,maxHeight:4})}}function L5(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d;function m(_){n[2](_)}let h={id:n[3],required:n[1].required};return n[0]!==void 0&&(h.value=n[0]),u=new A5({props:h}),ee.push(()=>be(u,"value",m)),{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),f=O(),B(u.$$.fragment),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3])},m(_,g){w(_,e,g),k(e,t),k(e,l),k(e,s),k(s,r),w(_,f,g),z(u,_,g),d=!0},p(_,g){(!d||g&2&&i!==(i=H.getFieldTypeIcon(_[1].type)))&&p(t,"class",i),(!d||g&2)&&o!==(o=_[1].name+"")&&re(r,o),(!d||g&8&&a!==(a=_[3]))&&p(e,"for",a);const y={};g&8&&(y.id=_[3]),g&2&&(y.required=_[1].required),!c&&g&1&&(c=!0,y.value=_[0],ke(()=>c=!1)),u.$set(y)},i(_){d||(E(u.$$.fragment,_),d=!0)},o(_){A(u.$$.fragment,_),d=!1},d(_){_&&(v(e),v(f)),V(u,_)}}}function N5(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[L5,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function P5(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(o){l=o,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class F5 extends ge{constructor(e){super(),_e(this,e,P5,N5,me,{field:1,value:0})}}function R5(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h,_,g;return{c(){var y,S;e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),f=O(),u=b("input"),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3]),p(u,"type","number"),p(u,"id",c=n[3]),u.required=d=n[1].required,p(u,"min",m=(y=n[1].options)==null?void 0:y.min),p(u,"max",h=(S=n[1].options)==null?void 0:S.max),p(u,"step","any")},m(y,S){w(y,e,S),k(e,t),k(e,l),k(e,s),k(s,r),w(y,f,S),w(y,u,S),ae(u,n[0]),_||(g=K(u,"input",n[2]),_=!0)},p(y,S){var T,$;S&2&&i!==(i=H.getFieldTypeIcon(y[1].type))&&p(t,"class",i),S&2&&o!==(o=y[1].name+"")&&re(r,o),S&8&&a!==(a=y[3])&&p(e,"for",a),S&8&&c!==(c=y[3])&&p(u,"id",c),S&2&&d!==(d=y[1].required)&&(u.required=d),S&2&&m!==(m=(T=y[1].options)==null?void 0:T.min)&&p(u,"min",m),S&2&&h!==(h=($=y[1].options)==null?void 0:$.max)&&p(u,"max",h),S&1&<(u.value)!==y[0]&&ae(u,y[0])},d(y){y&&(v(e),v(f),v(u)),_=!1,g()}}}function q5(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[R5,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function j5(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(){l=lt(this.value),t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class H5 extends ge{constructor(e){super(),_e(this,e,j5,q5,me,{field:1,value:0})}}function z5(n){let e,t,i,l,s=n[1].name+"",o,r,a,f;return{c(){e=b("input"),i=O(),l=b("label"),o=Y(s),p(e,"type","checkbox"),p(e,"id",t=n[3]),p(l,"for",r=n[3])},m(u,c){w(u,e,c),e.checked=n[0],w(u,i,c),w(u,l,c),k(l,o),a||(f=K(e,"change",n[2]),a=!0)},p(u,c){c&8&&t!==(t=u[3])&&p(e,"id",t),c&1&&(e.checked=u[0]),c&2&&s!==(s=u[1].name+"")&&re(o,s),c&8&&r!==(r=u[3])&&p(l,"for",r)},d(u){u&&(v(e),v(i),v(l)),a=!1,f()}}}function V5(n){let e,t;return e=new pe({props:{class:"form-field form-field-toggle "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[z5,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field form-field-toggle "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function B5(n,e,t){let{field:i}=e,{value:l=!1}=e;function s(){l=this.checked,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class U5 extends ge{constructor(e){super(),_e(this,e,B5,V5,me,{field:1,value:0})}}function W5(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h;return{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),f=O(),u=b("input"),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3]),p(u,"type","email"),p(u,"id",c=n[3]),u.required=d=n[1].required},m(_,g){w(_,e,g),k(e,t),k(e,l),k(e,s),k(s,r),w(_,f,g),w(_,u,g),ae(u,n[0]),m||(h=K(u,"input",n[2]),m=!0)},p(_,g){g&2&&i!==(i=H.getFieldTypeIcon(_[1].type))&&p(t,"class",i),g&2&&o!==(o=_[1].name+"")&&re(r,o),g&8&&a!==(a=_[3])&&p(e,"for",a),g&8&&c!==(c=_[3])&&p(u,"id",c),g&2&&d!==(d=_[1].required)&&(u.required=d),g&1&&u.value!==_[0]&&ae(u,_[0])},d(_){_&&(v(e),v(f),v(u)),m=!1,h()}}}function Y5(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[W5,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function K5(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(){l=this.value,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class J5 extends ge{constructor(e){super(),_e(this,e,K5,Y5,me,{field:1,value:0})}}function Z5(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h;return{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),f=O(),u=b("input"),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3]),p(u,"type","url"),p(u,"id",c=n[3]),u.required=d=n[1].required},m(_,g){w(_,e,g),k(e,t),k(e,l),k(e,s),k(s,r),w(_,f,g),w(_,u,g),ae(u,n[0]),m||(h=K(u,"input",n[2]),m=!0)},p(_,g){g&2&&i!==(i=H.getFieldTypeIcon(_[1].type))&&p(t,"class",i),g&2&&o!==(o=_[1].name+"")&&re(r,o),g&8&&a!==(a=_[3])&&p(e,"for",a),g&8&&c!==(c=_[3])&&p(u,"id",c),g&2&&d!==(d=_[1].required)&&(u.required=d),g&1&&u.value!==_[0]&&ae(u,_[0])},d(_){_&&(v(e),v(f),v(u)),m=!1,h()}}}function G5(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[Z5,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function X5(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(){l=this.value,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class Q5 extends ge{constructor(e){super(),_e(this,e,X5,G5,me,{field:1,value:0})}}function Bp(n){let e,t,i,l;return{c(){e=b("div"),t=b("button"),t.innerHTML='',p(t,"type","button"),p(t,"class","link-hint clear-btn svelte-11df51y"),p(e,"class","form-field-addon")},m(s,o){w(s,e,o),k(e,t),i||(l=[we(Le.call(null,t,"Clear")),K(t,"click",n[5])],i=!0)},p:Q,d(s){s&&v(e),i=!1,ve(l)}}}function x5(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h,_,g=n[0]&&!n[1].required&&Bp(n);function y($){n[6]($)}function S($){n[7]($)}let T={id:n[8],options:H.defaultFlatpickrOptions()};return n[2]!==void 0&&(T.value=n[2]),n[0]!==void 0&&(T.formattedValue=n[0]),d=new Ba({props:T}),ee.push(()=>be(d,"value",y)),ee.push(()=>be(d,"formattedValue",S)),d.$on("close",n[3]),{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),a=Y(" (UTC)"),u=O(),g&&g.c(),c=O(),B(d.$$.fragment),p(t,"class",i=Wn(H.getFieldTypeIcon(n[1].type))+" svelte-11df51y"),p(s,"class","txt"),p(e,"for",f=n[8])},m($,C){w($,e,C),k(e,t),k(e,l),k(e,s),k(s,r),k(s,a),w($,u,C),g&&g.m($,C),w($,c,C),z(d,$,C),_=!0},p($,C){(!_||C&2&&i!==(i=Wn(H.getFieldTypeIcon($[1].type))+" svelte-11df51y"))&&p(t,"class",i),(!_||C&2)&&o!==(o=$[1].name+"")&&re(r,o),(!_||C&256&&f!==(f=$[8]))&&p(e,"for",f),$[0]&&!$[1].required?g?g.p($,C):(g=Bp($),g.c(),g.m(c.parentNode,c)):g&&(g.d(1),g=null);const M={};C&256&&(M.id=$[8]),!m&&C&4&&(m=!0,M.value=$[2],ke(()=>m=!1)),!h&&C&1&&(h=!0,M.formattedValue=$[0],ke(()=>h=!1)),d.$set(M)},i($){_||(E(d.$$.fragment,$),_=!0)},o($){A(d.$$.fragment,$),_=!1},d($){$&&(v(e),v(u),v(c)),g&&g.d($),V(d,$)}}}function eO(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[x5,({uniqueId:i})=>({8:i}),({uniqueId:i})=>i?256:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&775&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function tO(n,e,t){let{field:i}=e,{value:l=void 0}=e,s=l;function o(c){c.detail&&c.detail.length==3&&t(0,l=c.detail[1])}function r(){t(0,l="")}const a=()=>r();function f(c){s=c,t(2,s),t(0,l)}function u(c){l=c,t(0,l)}return n.$$set=c=>{"field"in c&&t(1,i=c.field),"value"in c&&t(0,l=c.value)},n.$$.update=()=>{n.$$.dirty&1&&l&&l.length>19&&t(0,l=l.substring(0,19)),n.$$.dirty&5&&s!=l&&t(2,s=l)},[l,i,s,o,r,a,f,u]}class nO extends ge{constructor(e){super(),_e(this,e,tO,eO,me,{field:1,value:0})}}function Up(n){let e,t,i=n[1].options.maxSelect+"",l,s;return{c(){e=b("div"),t=Y("Select up to "),l=Y(i),s=Y(" items."),p(e,"class","help-block")},m(o,r){w(o,e,r),k(e,t),k(e,l),k(e,s)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&re(l,i)},d(o){o&&v(e)}}}function iO(n){var S,T,$,C,M,D;let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h;function _(I){n[3](I)}let g={id:n[4],toggle:!n[1].required||n[2],multiple:n[2],closable:!n[2]||((S=n[0])==null?void 0:S.length)>=((T=n[1].options)==null?void 0:T.maxSelect),items:($=n[1].options)==null?void 0:$.values,searchable:((M=(C=n[1].options)==null?void 0:C.values)==null?void 0:M.length)>5};n[0]!==void 0&&(g.selected=n[0]),u=new Wb({props:g}),ee.push(()=>be(u,"selected",_));let y=((D=n[1].options)==null?void 0:D.maxSelect)>1&&Up(n);return{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),f=O(),B(u.$$.fragment),d=O(),y&&y.c(),m=ye(),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[4])},m(I,L){w(I,e,L),k(e,t),k(e,l),k(e,s),k(s,r),w(I,f,L),z(u,I,L),w(I,d,L),y&&y.m(I,L),w(I,m,L),h=!0},p(I,L){var F,N,P,j,q,W;(!h||L&2&&i!==(i=H.getFieldTypeIcon(I[1].type)))&&p(t,"class",i),(!h||L&2)&&o!==(o=I[1].name+"")&&re(r,o),(!h||L&16&&a!==(a=I[4]))&&p(e,"for",a);const R={};L&16&&(R.id=I[4]),L&6&&(R.toggle=!I[1].required||I[2]),L&4&&(R.multiple=I[2]),L&7&&(R.closable=!I[2]||((F=I[0])==null?void 0:F.length)>=((N=I[1].options)==null?void 0:N.maxSelect)),L&2&&(R.items=(P=I[1].options)==null?void 0:P.values),L&2&&(R.searchable=((q=(j=I[1].options)==null?void 0:j.values)==null?void 0:q.length)>5),!c&&L&1&&(c=!0,R.selected=I[0],ke(()=>c=!1)),u.$set(R),((W=I[1].options)==null?void 0:W.maxSelect)>1?y?y.p(I,L):(y=Up(I),y.c(),y.m(m.parentNode,m)):y&&(y.d(1),y=null)},i(I){h||(E(u.$$.fragment,I),h=!0)},o(I){A(u.$$.fragment,I),h=!1},d(I){I&&(v(e),v(f),v(d),v(m)),V(u,I),y&&y.d(I)}}}function lO(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[iO,({uniqueId:i})=>({4:i}),({uniqueId:i})=>i?16:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&55&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function sO(n,e,t){let i,{field:l}=e,{value:s=void 0}=e;function o(r){s=r,t(0,s),t(2,i),t(1,l)}return n.$$set=r=>{"field"in r&&t(1,l=r.field),"value"in r&&t(0,s=r.value)},n.$$.update=()=>{var r;n.$$.dirty&2&&t(2,i=((r=l.options)==null?void 0:r.maxSelect)>1),n.$$.dirty&5&&typeof s>"u"&&t(0,s=i?[]:""),n.$$.dirty&7&&i&&Array.isArray(s)&&s.length>l.options.maxSelect&&t(0,s=s.slice(s.length-l.options.maxSelect))},[s,l,i,o]}class oO extends ge{constructor(e){super(),_e(this,e,sO,lO,me,{field:1,value:0})}}function rO(n){let e;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function aO(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-fill txt-success")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function fO(n){let e;return{c(){e=b("input"),p(e,"type","text"),p(e,"class","txt-mono"),e.value="Loading...",e.disabled=!0},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function uO(n){let e,t,i;var l=n[3];function s(o,r){return{props:{id:o[6],maxHeight:"500",language:"json",value:o[2]}}}return l&&(e=Ot(l,s(n)),e.$on("change",n[5])),{c(){e&&B(e.$$.fragment),t=ye()},m(o,r){e&&z(e,o,r),w(o,t,r),i=!0},p(o,r){if(r&8&&l!==(l=o[3])){if(e){se();const a=e;A(a.$$.fragment,1,0,()=>{V(a,1)}),oe()}l?(e=Ot(l,s(o)),e.$on("change",o[5]),B(e.$$.fragment),E(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(l){const a={};r&64&&(a.id=o[6]),r&4&&(a.value=o[2]),e.$set(a)}},i(o){i||(e&&E(e.$$.fragment,o),i=!0)},o(o){e&&A(e.$$.fragment,o),i=!1},d(o){o&&v(t),e&&V(e,o)}}}function cO(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h,_,g,y,S;function T(L,R){return L[4]?aO:rO}let $=T(n),C=$(n);const M=[uO,fO],D=[];function I(L,R){return L[3]?0:1}return m=I(n),h=D[m]=M[m](n),{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),a=O(),f=b("span"),C.c(),d=O(),h.c(),_=ye(),p(t,"class",i=Wn(H.getFieldTypeIcon(n[1].type))+" svelte-p6ecb8"),p(s,"class","txt"),p(f,"class","json-state svelte-p6ecb8"),p(e,"for",c=n[6])},m(L,R){w(L,e,R),k(e,t),k(e,l),k(e,s),k(s,r),k(e,a),k(e,f),C.m(f,null),w(L,d,R),D[m].m(L,R),w(L,_,R),g=!0,y||(S=we(u=Le.call(null,f,{position:"left",text:n[4]?"Valid JSON":"Invalid JSON"})),y=!0)},p(L,R){(!g||R&2&&i!==(i=Wn(H.getFieldTypeIcon(L[1].type))+" svelte-p6ecb8"))&&p(t,"class",i),(!g||R&2)&&o!==(o=L[1].name+"")&&re(r,o),$!==($=T(L))&&(C.d(1),C=$(L),C&&(C.c(),C.m(f,null))),u&&Tt(u.update)&&R&16&&u.update.call(null,{position:"left",text:L[4]?"Valid JSON":"Invalid JSON"}),(!g||R&64&&c!==(c=L[6]))&&p(e,"for",c);let F=m;m=I(L),m===F?D[m].p(L,R):(se(),A(D[F],1,1,()=>{D[F]=null}),oe(),h=D[m],h?h.p(L,R):(h=D[m]=M[m](L),h.c()),E(h,1),h.m(_.parentNode,_))},i(L){g||(E(h),g=!0)},o(L){A(h),g=!1},d(L){L&&(v(e),v(d),v(_)),C.d(),D[m].d(L),y=!1,S()}}}function dO(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[cO,({uniqueId:i})=>({6:i}),({uniqueId:i})=>i?64:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&223&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Wp(n){return JSON.stringify(typeof n>"u"?null:n,null,2)}function pO(n){try{return JSON.parse(n===""?null:n),!0}catch{}return!1}function mO(n,e,t){let i,{field:l}=e,{value:s=void 0}=e,o,r=Wp(s);jt(async()=>{try{t(3,o=(await nt(()=>import("./CodeEditor-f9FE6aAj.js"),__vite__mapDeps([2,1]),import.meta.url)).default)}catch(f){console.warn(f)}});const a=f=>{t(2,r=f.detail),t(0,s=r.trim())};return n.$$set=f=>{"field"in f&&t(1,l=f.field),"value"in f&&t(0,s=f.value)},n.$$.update=()=>{n.$$.dirty&5&&s!==(r==null?void 0:r.trim())&&(t(2,r=Wp(s)),t(0,s=r)),n.$$.dirty&4&&t(4,i=pO(r))},[s,l,r,o,i,a]}class hO extends ge{constructor(e){super(),_e(this,e,mO,dO,me,{field:1,value:0})}}function _O(n){let e,t;return{c(){e=b("i"),p(e,"class","ri-file-line"),p(e,"alt",t=n[0].name)},m(i,l){w(i,e,l)},p(i,l){l&1&&t!==(t=i[0].name)&&p(e,"alt",t)},d(i){i&&v(e)}}}function gO(n){let e,t,i;return{c(){e=b("img"),p(e,"draggable",!1),en(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(l,s){w(l,e,s)},p(l,s){s&4&&!en(e.src,t=l[2])&&p(e,"src",t),s&2&&p(e,"width",l[1]),s&2&&p(e,"height",l[1]),s&1&&i!==(i=l[0].name)&&p(e,"alt",i)},d(l){l&&v(e)}}}function bO(n){let e;function t(s,o){return s[2]?gO:_O}let i=t(n),l=i(n);return{c(){l.c(),e=ye()},m(s,o){l.m(s,o),w(s,e,o)},p(s,[o]){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},i:Q,o:Q,d(s){s&&v(e),l.d(s)}}}function kO(n,e,t){let i,{file:l}=e,{size:s=50}=e;function o(){H.hasImageExtension(l==null?void 0:l.name)?H.generateThumb(l,s,s).then(r=>{t(2,i=r)}).catch(r=>{t(2,i=""),console.warn("Unable to generate thumb: ",r)}):t(2,i="")}return n.$$set=r=>{"file"in r&&t(0,l=r.file),"size"in r&&t(1,s=r.size)},n.$$.update=()=>{n.$$.dirty&1&&typeof l<"u"&&o()},t(2,i=""),[l,s,i]}class yO extends ge{constructor(e){super(),_e(this,e,kO,bO,me,{file:0,size:1})}}function Yp(n){let e;function t(s,o){return s[4]==="image"?wO:vO}let i=t(n),l=i(n);return{c(){l.c(),e=ye()},m(s,o){l.m(s,o),w(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&v(e),l.d(s)}}}function vO(n){let e,t;return{c(){e=b("object"),t=Y("Cannot preview the file."),p(e,"title",n[2]),p(e,"data",n[1])},m(i,l){w(i,e,l),k(e,t)},p(i,l){l&4&&p(e,"title",i[2]),l&2&&p(e,"data",i[1])},d(i){i&&v(e)}}}function wO(n){let e,t,i;return{c(){e=b("img"),en(e.src,t=n[1])||p(e,"src",t),p(e,"alt",i="Preview "+n[2])},m(l,s){w(l,e,s)},p(l,s){s&2&&!en(e.src,t=l[1])&&p(e,"src",t),s&4&&i!==(i="Preview "+l[2])&&p(e,"alt",i)},d(l){l&&v(e)}}}function SO(n){var l;let e=(l=n[3])==null?void 0:l.isActive(),t,i=e&&Yp(n);return{c(){i&&i.c(),t=ye()},m(s,o){i&&i.m(s,o),w(s,t,o)},p(s,o){var r;o&8&&(e=(r=s[3])==null?void 0:r.isActive()),e?i?i.p(s,o):(i=Yp(s),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null)},d(s){s&&v(t),i&&i.d(s)}}}function $O(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","overlay-close")},m(l,s){w(l,e,s),t||(i=K(e,"click",Be(n[0])),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function TO(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("a"),t=Y(n[2]),i=O(),l=b("i"),s=O(),o=b("div"),r=O(),a=b("button"),a.textContent="Close",p(l,"class","ri-external-link-line"),p(e,"href",n[1]),p(e,"title",n[2]),p(e,"target","_blank"),p(e,"rel","noreferrer noopener"),p(e,"class","link-hint txt-ellipsis inline-flex"),p(o,"class","flex-fill"),p(a,"type","button"),p(a,"class","btn btn-transparent")},m(c,d){w(c,e,d),k(e,t),k(e,i),k(e,l),w(c,s,d),w(c,o,d),w(c,r,d),w(c,a,d),f||(u=K(a,"click",n[0]),f=!0)},p(c,d){d&4&&re(t,c[2]),d&2&&p(e,"href",c[1]),d&4&&p(e,"title",c[2])},d(c){c&&(v(e),v(s),v(o),v(r),v(a)),f=!1,u()}}}function CO(n){let e,t,i={class:"preview preview-"+n[4],btnClose:!1,popup:!0,$$slots:{footer:[TO],header:[$O],default:[SO]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[7](e),e.$on("show",n[8]),e.$on("hide",n[9]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&16&&(o.class="preview preview-"+l[4]),s&1054&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[7](null),V(e,l)}}}function OO(n,e,t){let i,l,s,o,r="";function a(m){m!==""&&(t(1,r=m),o==null||o.show())}function f(){return o==null?void 0:o.hide()}function u(m){ee[m?"unshift":"push"](()=>{o=m,t(3,o)})}function c(m){Te.call(this,n,m)}function d(m){Te.call(this,n,m)}return n.$$.update=()=>{n.$$.dirty&2&&t(6,i=r.indexOf("?")),n.$$.dirty&66&&t(2,l=r.substring(r.lastIndexOf("/")+1,i>0?i:void 0)),n.$$.dirty&4&&t(4,s=H.getFileType(l))},[f,r,l,o,s,a,i,u,c,d]}class MO extends ge{constructor(e){super(),_e(this,e,OO,CO,me,{show:5,hide:0})}get show(){return this.$$.ctx[5]}get hide(){return this.$$.ctx[0]}}function DO(n){let e,t,i,l,s;function o(f,u){return f[3]==="image"?LO:f[3]==="video"||f[3]==="audio"?AO:IO}let r=o(n),a=r(n);return{c(){e=b("a"),a.c(),p(e,"draggable",!1),p(e,"class",t="thumb "+(n[1]?`thumb-${n[1]}`:"")),p(e,"href",n[6]),p(e,"target","_blank"),p(e,"rel","noreferrer"),p(e,"title",i=(n[7]?"Preview":"Download")+" "+n[0])},m(f,u){w(f,e,u),a.m(e,null),l||(s=K(e,"click",cn(n[11])),l=!0)},p(f,u){r===(r=o(f))&&a?a.p(f,u):(a.d(1),a=r(f),a&&(a.c(),a.m(e,null))),u&2&&t!==(t="thumb "+(f[1]?`thumb-${f[1]}`:""))&&p(e,"class",t),u&64&&p(e,"href",f[6]),u&129&&i!==(i=(f[7]?"Preview":"Download")+" "+f[0])&&p(e,"title",i)},d(f){f&&v(e),a.d(),l=!1,s()}}}function EO(n){let e,t;return{c(){e=b("div"),p(e,"class",t="thumb "+(n[1]?`thumb-${n[1]}`:""))},m(i,l){w(i,e,l)},p(i,l){l&2&&t!==(t="thumb "+(i[1]?`thumb-${i[1]}`:""))&&p(e,"class",t)},d(i){i&&v(e)}}}function IO(n){let e;return{c(){e=b("i"),p(e,"class","ri-file-3-line")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function AO(n){let e;return{c(){e=b("i"),p(e,"class","ri-video-line")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function LO(n){let e,t,i,l,s;return{c(){e=b("img"),p(e,"draggable",!1),p(e,"loading","lazy"),en(e.src,t=n[5])||p(e,"src",t),p(e,"alt",n[0]),p(e,"title",i="Preview "+n[0])},m(o,r){w(o,e,r),l||(s=K(e,"error",n[8]),l=!0)},p(o,r){r&32&&!en(e.src,t=o[5])&&p(e,"src",t),r&1&&p(e,"alt",o[0]),r&1&&i!==(i="Preview "+o[0])&&p(e,"title",i)},d(o){o&&v(e),l=!1,s()}}}function Kp(n){let e,t,i={};return e=new MO({props:i}),n[12](e),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,s){const o={};e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[12](null),V(e,l)}}}function NO(n){let e,t,i;function l(a,f){return a[2]?EO:DO}let s=l(n),o=s(n),r=n[7]&&Kp(n);return{c(){o.c(),e=O(),r&&r.c(),t=ye()},m(a,f){o.m(a,f),w(a,e,f),r&&r.m(a,f),w(a,t,f),i=!0},p(a,[f]){s===(s=l(a))&&o?o.p(a,f):(o.d(1),o=s(a),o&&(o.c(),o.m(e.parentNode,e))),a[7]?r?(r.p(a,f),f&128&&E(r,1)):(r=Kp(a),r.c(),E(r,1),r.m(t.parentNode,t)):r&&(se(),A(r,1,1,()=>{r=null}),oe())},i(a){i||(E(r),i=!0)},o(a){A(r),i=!1},d(a){a&&(v(e),v(t)),o.d(a),r&&r.d(a)}}}function PO(n,e,t){let i,l,{record:s=null}=e,{filename:o=""}=e,{size:r=""}=e,a,f="",u="",c="",d=!0;m();async function m(){t(2,d=!0);try{t(10,c=await fe.getAdminFileToken(s.collectionId))}catch(y){console.warn("File token failure:",y)}t(2,d=!1)}function h(){t(5,f="")}const _=y=>{l&&(y.preventDefault(),a==null||a.show(u))};function g(y){ee[y?"unshift":"push"](()=>{a=y,t(4,a)})}return n.$$set=y=>{"record"in y&&t(9,s=y.record),"filename"in y&&t(0,o=y.filename),"size"in y&&t(1,r=y.size)},n.$$.update=()=>{n.$$.dirty&1&&t(3,i=H.getFileType(o)),n.$$.dirty&9&&t(7,l=["image","audio","video"].includes(i)||o.endsWith(".pdf")),n.$$.dirty&1541&&t(6,u=d?"":fe.files.getUrl(s,o,{token:c})),n.$$.dirty&1541&&t(5,f=d?"":fe.files.getUrl(s,o,{thumb:"100x100",token:c}))},[o,r,d,i,a,f,u,l,h,s,c,_,g]}class Wa extends ge{constructor(e){super(),_e(this,e,PO,NO,me,{record:9,filename:0,size:1})}}function Jp(n,e,t){const i=n.slice();return i[29]=e[t],i[31]=t,i}function Zp(n,e,t){const i=n.slice();i[34]=e[t],i[31]=t;const l=i[2].includes(i[34]);return i[35]=l,i}function FO(n){let e,t,i;function l(){return n[17](n[34])}return{c(){e=b("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-transparent btn-hint btn-sm btn-circle btn-remove")},m(s,o){w(s,e,o),t||(i=[we(Le.call(null,e,"Remove file")),K(e,"click",l)],t=!0)},p(s,o){n=s},d(s){s&&v(e),t=!1,ve(i)}}}function RO(n){let e,t,i;function l(){return n[16](n[34])}return{c(){e=b("button"),e.innerHTML='Restore',p(e,"type","button"),p(e,"class","btn btn-sm btn-danger btn-transparent")},m(s,o){w(s,e,o),t||(i=K(e,"click",l),t=!0)},p(s,o){n=s},d(s){s&&v(e),t=!1,i()}}}function qO(n){let e,t,i,l,s,o,r=n[34]+"",a,f,u,c,d,m;i=new Wa({props:{record:n[3],filename:n[34]}});function h(y,S){return y[35]?RO:FO}let _=h(n),g=_(n);return{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),o=b("a"),a=Y(r),c=O(),d=b("div"),g.c(),x(t,"fade",n[35]),p(o,"draggable",!1),p(o,"href",f=fe.files.getUrl(n[3],n[34],{token:n[10]})),p(o,"class",u="txt-ellipsis "+(n[35]?"txt-strikethrough txt-hint":"link-primary")),p(o,"title","Download"),p(o,"target","_blank"),p(o,"rel","noopener noreferrer"),p(s,"class","content"),p(d,"class","actions"),p(e,"class","list-item"),x(e,"dragging",n[32]),x(e,"dragover",n[33])},m(y,S){w(y,e,S),k(e,t),z(i,t,null),k(e,l),k(e,s),k(s,o),k(o,a),k(e,c),k(e,d),g.m(d,null),m=!0},p(y,S){const T={};S[0]&8&&(T.record=y[3]),S[0]&32&&(T.filename=y[34]),i.$set(T),(!m||S[0]&36)&&x(t,"fade",y[35]),(!m||S[0]&32)&&r!==(r=y[34]+"")&&re(a,r),(!m||S[0]&1064&&f!==(f=fe.files.getUrl(y[3],y[34],{token:y[10]})))&&p(o,"href",f),(!m||S[0]&36&&u!==(u="txt-ellipsis "+(y[35]?"txt-strikethrough txt-hint":"link-primary")))&&p(o,"class",u),_===(_=h(y))&&g?g.p(y,S):(g.d(1),g=_(y),g&&(g.c(),g.m(d,null))),(!m||S[1]&2)&&x(e,"dragging",y[32]),(!m||S[1]&4)&&x(e,"dragover",y[33])},i(y){m||(E(i.$$.fragment,y),m=!0)},o(y){A(i.$$.fragment,y),m=!1},d(y){y&&v(e),V(i),g.d()}}}function Gp(n,e){let t,i,l,s;function o(a){e[18](a)}let r={group:e[4].name+"_uploaded",index:e[31],disabled:!e[6],$$slots:{default:[qO,({dragging:a,dragover:f})=>({32:a,33:f}),({dragging:a,dragover:f})=>[0,(a?2:0)|(f?4:0)]]},$$scope:{ctx:e}};return e[0]!==void 0&&(r.list=e[0]),i=new Ms({props:r}),ee.push(()=>be(i,"list",o)),{key:n,first:null,c(){t=ye(),B(i.$$.fragment),this.first=t},m(a,f){w(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f[0]&16&&(u.group=e[4].name+"_uploaded"),f[0]&32&&(u.index=e[31]),f[0]&64&&(u.disabled=!e[6]),f[0]&1068|f[1]&70&&(u.$$scope={dirty:f,ctx:e}),!l&&f[0]&1&&(l=!0,u.list=e[0],ke(()=>l=!1)),i.$set(u)},i(a){s||(E(i.$$.fragment,a),s=!0)},o(a){A(i.$$.fragment,a),s=!1},d(a){a&&v(t),V(i,a)}}}function jO(n){let e,t,i,l,s,o,r,a,f=n[29].name+"",u,c,d,m,h,_,g;i=new yO({props:{file:n[29]}});function y(){return n[19](n[31])}return{c(){e=b("div"),t=b("figure"),B(i.$$.fragment),l=O(),s=b("div"),o=b("small"),o.textContent="New",r=O(),a=b("span"),u=Y(f),d=O(),m=b("button"),m.innerHTML='',p(t,"class","thumb"),p(o,"class","label label-success m-r-5"),p(a,"class","txt"),p(s,"class","filename m-r-auto"),p(s,"title",c=n[29].name),p(m,"type","button"),p(m,"class","btn btn-transparent btn-hint btn-sm btn-circle btn-remove"),p(e,"class","list-item"),x(e,"dragging",n[32]),x(e,"dragover",n[33])},m(S,T){w(S,e,T),k(e,t),z(i,t,null),k(e,l),k(e,s),k(s,o),k(s,r),k(s,a),k(a,u),k(e,d),k(e,m),h=!0,_||(g=[we(Le.call(null,m,"Remove file")),K(m,"click",y)],_=!0)},p(S,T){n=S;const $={};T[0]&2&&($.file=n[29]),i.$set($),(!h||T[0]&2)&&f!==(f=n[29].name+"")&&re(u,f),(!h||T[0]&2&&c!==(c=n[29].name))&&p(s,"title",c),(!h||T[1]&2)&&x(e,"dragging",n[32]),(!h||T[1]&4)&&x(e,"dragover",n[33])},i(S){h||(E(i.$$.fragment,S),h=!0)},o(S){A(i.$$.fragment,S),h=!1},d(S){S&&v(e),V(i),_=!1,ve(g)}}}function Xp(n,e){let t,i,l,s;function o(a){e[20](a)}let r={group:e[4].name+"_new",index:e[31],disabled:!e[6],$$slots:{default:[jO,({dragging:a,dragover:f})=>({32:a,33:f}),({dragging:a,dragover:f})=>[0,(a?2:0)|(f?4:0)]]},$$scope:{ctx:e}};return e[1]!==void 0&&(r.list=e[1]),i=new Ms({props:r}),ee.push(()=>be(i,"list",o)),{key:n,first:null,c(){t=ye(),B(i.$$.fragment),this.first=t},m(a,f){w(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f[0]&16&&(u.group=e[4].name+"_new"),f[0]&2&&(u.index=e[31]),f[0]&64&&(u.disabled=!e[6]),f[0]&2|f[1]&70&&(u.$$scope={dirty:f,ctx:e}),!l&&f[0]&2&&(l=!0,u.list=e[1],ke(()=>l=!1)),i.$set(u)},i(a){s||(E(i.$$.fragment,a),s=!0)},o(a){A(i.$$.fragment,a),s=!1},d(a){a&&v(t),V(i,a)}}}function HO(n){let e,t,i,l,s,o=n[4].name+"",r,a,f,u,c=[],d=new Map,m,h=[],_=new Map,g,y,S,T,$,C,M,D,I,L,R,F,N=de(n[5]);const P=W=>W[34]+W[3].id;for(let W=0;WW[29].name+W[31];for(let W=0;W{"model"in o&&t(1,i=o.model)},n.$$.update=()=>{n.$$.dirty&2&&i&&s()},[l,i]}class Kb extends ge{constructor(e){super(),_e(this,e,g5,_5,me,{model:1})}}function b5(n){let e,t,i,l,s,o,r,a,f,u;return s=new sl({props:{value:n[1]}}),{c(){e=b("div"),t=b("span"),i=Y(n[1]),l=O(),B(s.$$.fragment),o=O(),r=b("i"),p(t,"class","secret svelte-1md8247"),p(r,"class","ri-refresh-line txt-sm link-hint"),p(r,"aria-label","Refresh"),p(e,"class","flex flex-gap-5 p-5")},m(c,d){w(c,e,d),k(e,t),k(t,i),n[6](t),k(e,l),z(s,e,null),k(e,o),k(e,r),a=!0,f||(u=[we(Le.call(null,r,"Refresh")),K(r,"click",n[4])],f=!0)},p(c,d){(!a||d&2)&&re(i,c[1]);const m={};d&2&&(m.value=c[1]),s.$set(m)},i(c){a||(E(s.$$.fragment,c),a=!0)},o(c){A(s.$$.fragment,c),a=!1},d(c){c&&v(e),n[6](null),V(s),f=!1,ve(u)}}}function k5(n){let e,t,i,l,s,o,r,a,f,u;function c(m){n[7](m)}let d={class:"dropdown dropdown-upside dropdown-center dropdown-nowrap",$$slots:{default:[b5]},$$scope:{ctx:n}};return n[3]!==void 0&&(d.active=n[3]),l=new On({props:d}),ee.push(()=>be(l,"active",c)),l.$on("show",n[4]),{c(){e=b("button"),t=b("i"),i=O(),B(l.$$.fragment),p(t,"class","ri-sparkling-line"),p(e,"tabindex","-1"),p(e,"type","button"),p(e,"aria-label","Generate"),p(e,"class",o="btn btn-circle "+n[0]+" svelte-1md8247")},m(m,h){w(m,e,h),k(e,t),k(e,i),z(l,e,null),a=!0,f||(u=we(r=Le.call(null,e,n[3]?"":"Generate")),f=!0)},p(m,[h]){const _={};h&518&&(_.$$scope={dirty:h,ctx:m}),!s&&h&8&&(s=!0,_.active=m[3],ke(()=>s=!1)),l.$set(_),(!a||h&1&&o!==(o="btn btn-circle "+m[0]+" svelte-1md8247"))&&p(e,"class",o),r&&Tt(r.update)&&h&8&&r.update.call(null,m[3]?"":"Generate")},i(m){a||(E(l.$$.fragment,m),a=!0)},o(m){A(l.$$.fragment,m),a=!1},d(m){m&&v(e),V(l),f=!1,u()}}}function y5(n,e,t){const i=st();let{class:l="btn-sm btn-hint btn-transparent"}=e,{length:s=32}=e,o="",r,a=!1;async function f(){if(t(1,o=H.randomSecret(s)),i("generate",o),await Xt(),r){let d=document.createRange();d.selectNode(r),window.getSelection().removeAllRanges(),window.getSelection().addRange(d)}}function u(d){ee[d?"unshift":"push"](()=>{r=d,t(2,r)})}function c(d){a=d,t(3,a)}return n.$$set=d=>{"class"in d&&t(0,l=d.class),"length"in d&&t(5,s=d.length)},[l,o,r,a,f,s,u,c]}class Jb extends ge{constructor(e){super(),_e(this,e,y5,k5,me,{class:0,length:5})}}function v5(n){let e,t,i,l,s,o,r,a,f,u,c,d;return{c(){e=b("label"),t=b("i"),i=O(),l=b("span"),l.textContent="Username",o=O(),r=b("input"),p(t,"class",H.getFieldTypeIcon("user")),p(l,"class","txt"),p(e,"for",s=n[13]),p(r,"type","text"),p(r,"requried",a=!n[2]),p(r,"placeholder",f=n[2]?"Leave empty to auto generate...":n[4]),p(r,"id",u=n[13])},m(m,h){w(m,e,h),k(e,t),k(e,i),k(e,l),w(m,o,h),w(m,r,h),ae(r,n[0].username),c||(d=K(r,"input",n[5]),c=!0)},p(m,h){h&8192&&s!==(s=m[13])&&p(e,"for",s),h&4&&a!==(a=!m[2])&&p(r,"requried",a),h&4&&f!==(f=m[2]?"Leave empty to auto generate...":m[4])&&p(r,"placeholder",f),h&8192&&u!==(u=m[13])&&p(r,"id",u),h&1&&r.value!==m[0].username&&ae(r,m[0].username)},d(m){m&&(v(e),v(o),v(r)),c=!1,d()}}}function w5(n){let e,t,i,l,s,o,r,a,f,u,c=n[0].emailVisibility?"On":"Off",d,m,h,_,g,y,S,T;return{c(){var $;e=b("label"),t=b("i"),i=O(),l=b("span"),l.textContent="Email",o=O(),r=b("div"),a=b("button"),f=b("span"),u=Y("Public: "),d=Y(c),h=O(),_=b("input"),p(t,"class",H.getFieldTypeIcon("email")),p(l,"class","txt"),p(e,"for",s=n[13]),p(f,"class","txt"),p(a,"type","button"),p(a,"class",m="btn btn-sm btn-transparent "+(n[0].emailVisibility?"btn-success":"btn-hint")),p(r,"class","form-field-addon email-visibility-addon svelte-1751a4d"),p(_,"type","email"),_.autofocus=n[2],p(_,"autocomplete","off"),p(_,"id",g=n[13]),_.required=y=($=n[1].options)==null?void 0:$.requireEmail,p(_,"class","svelte-1751a4d")},m($,C){w($,e,C),k(e,t),k(e,i),k(e,l),w($,o,C),w($,r,C),k(r,a),k(a,f),k(f,u),k(f,d),w($,h,C),w($,_,C),ae(_,n[0].email),n[2]&&_.focus(),S||(T=[we(Le.call(null,a,{text:"Make email public or private",position:"top-right"})),K(a,"click",Be(n[6])),K(_,"input",n[7])],S=!0)},p($,C){var M;C&8192&&s!==(s=$[13])&&p(e,"for",s),C&1&&c!==(c=$[0].emailVisibility?"On":"Off")&&re(d,c),C&1&&m!==(m="btn btn-sm btn-transparent "+($[0].emailVisibility?"btn-success":"btn-hint"))&&p(a,"class",m),C&4&&(_.autofocus=$[2]),C&8192&&g!==(g=$[13])&&p(_,"id",g),C&2&&y!==(y=(M=$[1].options)==null?void 0:M.requireEmail)&&(_.required=y),C&1&&_.value!==$[0].email&&ae(_,$[0].email)},d($){$&&(v(e),v(o),v(r),v(h),v(_)),S=!1,ve(T)}}}function zp(n){let e,t;return e=new pe({props:{class:"form-field form-field-toggle",name:"verified",$$slots:{default:[S5,({uniqueId:i})=>({13:i}),({uniqueId:i})=>i?8192:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,l){const s={};l&24584&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function S5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Change password"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){w(f,e,u),e.checked=n[3],w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[8]),r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&8&&(e.checked=f[3]),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function Vp(n){let e,t,i,l,s,o,r,a,f;return l=new pe({props:{class:"form-field required",name:"password",$$slots:{default:[$5,({uniqueId:u})=>({13:u}),({uniqueId:u})=>u?8192:0]},$$scope:{ctx:n}}}),r=new pe({props:{class:"form-field required",name:"passwordConfirm",$$slots:{default:[T5,({uniqueId:u})=>({13:u}),({uniqueId:u})=>u?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),i=b("div"),B(l.$$.fragment),s=O(),o=b("div"),B(r.$$.fragment),p(i,"class","col-sm-6"),p(o,"class","col-sm-6"),p(t,"class","grid"),x(t,"p-t-xs",n[3]),p(e,"class","block")},m(u,c){w(u,e,c),k(e,t),k(t,i),z(l,i,null),k(t,s),k(t,o),z(r,o,null),f=!0},p(u,c){const d={};c&24579&&(d.$$scope={dirty:c,ctx:u}),l.$set(d);const m={};c&24577&&(m.$$scope={dirty:c,ctx:u}),r.$set(m),(!f||c&8)&&x(t,"p-t-xs",u[3])},i(u){f||(E(l.$$.fragment,u),E(r.$$.fragment,u),u&&Ye(()=>{f&&(a||(a=Ne(e,et,{duration:150},!0)),a.run(1))}),f=!0)},o(u){A(l.$$.fragment,u),A(r.$$.fragment,u),u&&(a||(a=Ne(e,et,{duration:150},!1)),a.run(0)),f=!1},d(u){u&&v(e),V(l),V(r),u&&a&&a.end()}}}function $5(n){var _,g;let e,t,i,l,s,o,r,a,f,u,c,d,m,h;return c=new Jb({props:{length:Math.max(15,((g=(_=n[1])==null?void 0:_.options)==null?void 0:g.minPasswordLength)||0)}}),{c(){e=b("label"),t=b("i"),i=O(),l=b("span"),l.textContent="Password",o=O(),r=b("input"),f=O(),u=b("div"),B(c.$$.fragment),p(t,"class","ri-lock-line"),p(l,"class","txt"),p(e,"for",s=n[13]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[13]),r.required=!0,p(u,"class","form-field-addon")},m(y,S){w(y,e,S),k(e,t),k(e,i),k(e,l),w(y,o,S),w(y,r,S),ae(r,n[0].password),w(y,f,S),w(y,u,S),z(c,u,null),d=!0,m||(h=K(r,"input",n[9]),m=!0)},p(y,S){var $,C;(!d||S&8192&&s!==(s=y[13]))&&p(e,"for",s),(!d||S&8192&&a!==(a=y[13]))&&p(r,"id",a),S&1&&r.value!==y[0].password&&ae(r,y[0].password);const T={};S&2&&(T.length=Math.max(15,((C=($=y[1])==null?void 0:$.options)==null?void 0:C.minPasswordLength)||0)),c.$set(T)},i(y){d||(E(c.$$.fragment,y),d=!0)},o(y){A(c.$$.fragment,y),d=!1},d(y){y&&(v(e),v(o),v(r),v(f),v(u)),V(c),m=!1,h()}}}function T5(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=b("i"),i=O(),l=b("span"),l.textContent="Password confirm",o=O(),r=b("input"),p(t,"class","ri-lock-line"),p(l,"class","txt"),p(e,"for",s=n[13]),p(r,"type","password"),p(r,"autocomplete","new-password"),p(r,"id",a=n[13]),r.required=!0},m(c,d){w(c,e,d),k(e,t),k(e,i),k(e,l),w(c,o,d),w(c,r,d),ae(r,n[0].passwordConfirm),f||(u=K(r,"input",n[10]),f=!0)},p(c,d){d&8192&&s!==(s=c[13])&&p(e,"for",s),d&8192&&a!==(a=c[13])&&p(r,"id",a),d&1&&r.value!==c[0].passwordConfirm&&ae(r,c[0].passwordConfirm)},d(c){c&&(v(e),v(o),v(r)),f=!1,u()}}}function C5(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y("Verified"),p(e,"type","checkbox"),p(e,"id",t=n[13]),p(l,"for",o=n[13])},m(f,u){w(f,e,u),e.checked=n[0].verified,w(f,i,u),w(f,l,u),k(l,s),r||(a=[K(e,"change",n[11]),K(e,"change",Be(n[12]))],r=!0)},p(f,u){u&8192&&t!==(t=f[13])&&p(e,"id",t),u&1&&(e.checked=f[0].verified),u&8192&&o!==(o=f[13])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,ve(a)}}}function O5(n){var g;let e,t,i,l,s,o,r,a,f,u,c,d,m;i=new pe({props:{class:"form-field "+(n[2]?"":"required"),name:"username",$$slots:{default:[v5,({uniqueId:y})=>({13:y}),({uniqueId:y})=>y?8192:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field "+((g=n[1].options)!=null&&g.requireEmail?"required":""),name:"email",$$slots:{default:[w5,({uniqueId:y})=>({13:y}),({uniqueId:y})=>y?8192:0]},$$scope:{ctx:n}}});let h=!n[2]&&zp(n),_=(n[2]||n[3])&&Vp(n);return d=new pe({props:{class:"form-field form-field-toggle",name:"verified",$$slots:{default:[C5,({uniqueId:y})=>({13:y}),({uniqueId:y})=>y?8192:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),r=O(),a=b("div"),h&&h.c(),f=O(),_&&_.c(),u=O(),c=b("div"),B(d.$$.fragment),p(t,"class","col-lg-6"),p(s,"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,S){w(y,e,S),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),k(e,r),k(e,a),h&&h.m(a,null),k(a,f),_&&_.m(a,null),k(e,u),k(e,c),z(d,c,null),m=!0},p(y,[S]){var M;const T={};S&4&&(T.class="form-field "+(y[2]?"":"required")),S&24581&&(T.$$scope={dirty:S,ctx:y}),i.$set(T);const $={};S&2&&($.class="form-field "+((M=y[1].options)!=null&&M.requireEmail?"required":"")),S&24583&&($.$$scope={dirty:S,ctx:y}),o.$set($),y[2]?h&&(se(),A(h,1,1,()=>{h=null}),oe()):h?(h.p(y,S),S&4&&E(h,1)):(h=zp(y),h.c(),E(h,1),h.m(a,f)),y[2]||y[3]?_?(_.p(y,S),S&12&&E(_,1)):(_=Vp(y),_.c(),E(_,1),_.m(a,null)):_&&(se(),A(_,1,1,()=>{_=null}),oe());const C={};S&24581&&(C.$$scope={dirty:S,ctx:y}),d.$set(C)},i(y){m||(E(i.$$.fragment,y),E(o.$$.fragment,y),E(h),E(_),E(d.$$.fragment,y),m=!0)},o(y){A(i.$$.fragment,y),A(o.$$.fragment,y),A(h),A(_),A(d.$$.fragment,y),m=!1},d(y){y&&v(e),V(i),V(o),h&&h.d(),_&&_.d(),V(d)}}}function M5(n,e,t){let{record:i}=e,{collection:l}=e,{isNew:s=!(i!=null&&i.id)}=e,o=i.username||null,r=!1;function a(){i.username=this.value,t(0,i),t(3,r)}const f=()=>t(0,i.emailVisibility=!i.emailVisibility,i);function u(){i.email=this.value,t(0,i),t(3,r)}function c(){r=this.checked,t(3,r)}function d(){i.password=this.value,t(0,i),t(3,r)}function m(){i.passwordConfirm=this.value,t(0,i),t(3,r)}function h(){i.verified=this.checked,t(0,i),t(3,r)}const _=g=>{s||fn("Do you really want to manually change the verified account state?",()=>{},()=>{t(0,i.verified=!g.target.checked,i)})};return n.$$set=g=>{"record"in g&&t(0,i=g.record),"collection"in g&&t(1,l=g.collection),"isNew"in g&&t(2,s=g.isNew)},n.$$.update=()=>{n.$$.dirty&1&&!i.username&&i.username!==null&&t(0,i.username=null,i),n.$$.dirty&8&&(r||(t(0,i.password=null,i),t(0,i.passwordConfirm=null,i),li("password"),li("passwordConfirm")))},[i,l,s,r,o,a,f,u,c,d,m,h,_]}class D5 extends ge{constructor(e){super(),_e(this,e,M5,O5,me,{record:0,collection:1,isNew:2})}}function E5(n){let e,t,i,l=[n[3]],s={};for(let o=0;o{r&&(t(1,r.style.height="",r),t(1,r.style.height=Math.min(r.scrollHeight,o)+"px",r))},0)}function u(m){if((m==null?void 0:m.code)==="Enter"&&!(m!=null&&m.shiftKey)&&!(m!=null&&m.isComposing)){m.preventDefault();const h=r.closest("form");h!=null&&h.requestSubmit&&h.requestSubmit()}}jt(()=>(f(),()=>clearTimeout(a)));function c(m){ee[m?"unshift":"push"](()=>{r=m,t(1,r)})}function d(){s=this.value,t(0,s)}return n.$$set=m=>{e=Pe(Pe({},e),Wt(m)),t(3,l=Ze(e,i)),"value"in m&&t(0,s=m.value),"maxHeight"in m&&t(4,o=m.maxHeight)},n.$$.update=()=>{n.$$.dirty&1&&typeof s!==void 0&&f()},[s,r,u,l,o,c,d]}class A5 extends ge{constructor(e){super(),_e(this,e,I5,E5,me,{value:0,maxHeight:4})}}function L5(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d;function m(_){n[2](_)}let h={id:n[3],required:n[1].required};return n[0]!==void 0&&(h.value=n[0]),u=new A5({props:h}),ee.push(()=>be(u,"value",m)),{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),f=O(),B(u.$$.fragment),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3])},m(_,g){w(_,e,g),k(e,t),k(e,l),k(e,s),k(s,r),w(_,f,g),z(u,_,g),d=!0},p(_,g){(!d||g&2&&i!==(i=H.getFieldTypeIcon(_[1].type)))&&p(t,"class",i),(!d||g&2)&&o!==(o=_[1].name+"")&&re(r,o),(!d||g&8&&a!==(a=_[3]))&&p(e,"for",a);const y={};g&8&&(y.id=_[3]),g&2&&(y.required=_[1].required),!c&&g&1&&(c=!0,y.value=_[0],ke(()=>c=!1)),u.$set(y)},i(_){d||(E(u.$$.fragment,_),d=!0)},o(_){A(u.$$.fragment,_),d=!1},d(_){_&&(v(e),v(f)),V(u,_)}}}function N5(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[L5,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function P5(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(o){l=o,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class F5 extends ge{constructor(e){super(),_e(this,e,P5,N5,me,{field:1,value:0})}}function R5(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h,_,g;return{c(){var y,S;e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),f=O(),u=b("input"),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3]),p(u,"type","number"),p(u,"id",c=n[3]),u.required=d=n[1].required,p(u,"min",m=(y=n[1].options)==null?void 0:y.min),p(u,"max",h=(S=n[1].options)==null?void 0:S.max),p(u,"step","any")},m(y,S){w(y,e,S),k(e,t),k(e,l),k(e,s),k(s,r),w(y,f,S),w(y,u,S),ae(u,n[0]),_||(g=K(u,"input",n[2]),_=!0)},p(y,S){var T,$;S&2&&i!==(i=H.getFieldTypeIcon(y[1].type))&&p(t,"class",i),S&2&&o!==(o=y[1].name+"")&&re(r,o),S&8&&a!==(a=y[3])&&p(e,"for",a),S&8&&c!==(c=y[3])&&p(u,"id",c),S&2&&d!==(d=y[1].required)&&(u.required=d),S&2&&m!==(m=(T=y[1].options)==null?void 0:T.min)&&p(u,"min",m),S&2&&h!==(h=($=y[1].options)==null?void 0:$.max)&&p(u,"max",h),S&1&<(u.value)!==y[0]&&ae(u,y[0])},d(y){y&&(v(e),v(f),v(u)),_=!1,g()}}}function q5(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[R5,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function j5(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(){l=lt(this.value),t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class H5 extends ge{constructor(e){super(),_e(this,e,j5,q5,me,{field:1,value:0})}}function z5(n){let e,t,i,l,s=n[1].name+"",o,r,a,f;return{c(){e=b("input"),i=O(),l=b("label"),o=Y(s),p(e,"type","checkbox"),p(e,"id",t=n[3]),p(l,"for",r=n[3])},m(u,c){w(u,e,c),e.checked=n[0],w(u,i,c),w(u,l,c),k(l,o),a||(f=K(e,"change",n[2]),a=!0)},p(u,c){c&8&&t!==(t=u[3])&&p(e,"id",t),c&1&&(e.checked=u[0]),c&2&&s!==(s=u[1].name+"")&&re(o,s),c&8&&r!==(r=u[3])&&p(l,"for",r)},d(u){u&&(v(e),v(i),v(l)),a=!1,f()}}}function V5(n){let e,t;return e=new pe({props:{class:"form-field form-field-toggle "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[z5,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field form-field-toggle "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function B5(n,e,t){let{field:i}=e,{value:l=!1}=e;function s(){l=this.checked,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class U5 extends ge{constructor(e){super(),_e(this,e,B5,V5,me,{field:1,value:0})}}function W5(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h;return{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),f=O(),u=b("input"),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3]),p(u,"type","email"),p(u,"id",c=n[3]),u.required=d=n[1].required},m(_,g){w(_,e,g),k(e,t),k(e,l),k(e,s),k(s,r),w(_,f,g),w(_,u,g),ae(u,n[0]),m||(h=K(u,"input",n[2]),m=!0)},p(_,g){g&2&&i!==(i=H.getFieldTypeIcon(_[1].type))&&p(t,"class",i),g&2&&o!==(o=_[1].name+"")&&re(r,o),g&8&&a!==(a=_[3])&&p(e,"for",a),g&8&&c!==(c=_[3])&&p(u,"id",c),g&2&&d!==(d=_[1].required)&&(u.required=d),g&1&&u.value!==_[0]&&ae(u,_[0])},d(_){_&&(v(e),v(f),v(u)),m=!1,h()}}}function Y5(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[W5,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function K5(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(){l=this.value,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class J5 extends ge{constructor(e){super(),_e(this,e,K5,Y5,me,{field:1,value:0})}}function Z5(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h;return{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),f=O(),u=b("input"),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[3]),p(u,"type","url"),p(u,"id",c=n[3]),u.required=d=n[1].required},m(_,g){w(_,e,g),k(e,t),k(e,l),k(e,s),k(s,r),w(_,f,g),w(_,u,g),ae(u,n[0]),m||(h=K(u,"input",n[2]),m=!0)},p(_,g){g&2&&i!==(i=H.getFieldTypeIcon(_[1].type))&&p(t,"class",i),g&2&&o!==(o=_[1].name+"")&&re(r,o),g&8&&a!==(a=_[3])&&p(e,"for",a),g&8&&c!==(c=_[3])&&p(u,"id",c),g&2&&d!==(d=_[1].required)&&(u.required=d),g&1&&u.value!==_[0]&&ae(u,_[0])},d(_){_&&(v(e),v(f),v(u)),m=!1,h()}}}function G5(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[Z5,({uniqueId:i})=>({3:i}),({uniqueId:i})=>i?8:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&27&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function X5(n,e,t){let{field:i}=e,{value:l=void 0}=e;function s(){l=this.value,t(0,l)}return n.$$set=o=>{"field"in o&&t(1,i=o.field),"value"in o&&t(0,l=o.value)},[l,i,s]}class Q5 extends ge{constructor(e){super(),_e(this,e,X5,G5,me,{field:1,value:0})}}function Bp(n){let e,t,i,l;return{c(){e=b("div"),t=b("button"),t.innerHTML='',p(t,"type","button"),p(t,"class","link-hint clear-btn svelte-11df51y"),p(e,"class","form-field-addon")},m(s,o){w(s,e,o),k(e,t),i||(l=[we(Le.call(null,t,"Clear")),K(t,"click",n[5])],i=!0)},p:Q,d(s){s&&v(e),i=!1,ve(l)}}}function x5(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h,_,g=n[0]&&!n[1].required&&Bp(n);function y($){n[6]($)}function S($){n[7]($)}let T={id:n[8],options:H.defaultFlatpickrOptions()};return n[2]!==void 0&&(T.value=n[2]),n[0]!==void 0&&(T.formattedValue=n[0]),d=new Ba({props:T}),ee.push(()=>be(d,"value",y)),ee.push(()=>be(d,"formattedValue",S)),d.$on("close",n[3]),{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),a=Y(" (UTC)"),u=O(),g&&g.c(),c=O(),B(d.$$.fragment),p(t,"class",i=Wn(H.getFieldTypeIcon(n[1].type))+" svelte-11df51y"),p(s,"class","txt"),p(e,"for",f=n[8])},m($,C){w($,e,C),k(e,t),k(e,l),k(e,s),k(s,r),k(s,a),w($,u,C),g&&g.m($,C),w($,c,C),z(d,$,C),_=!0},p($,C){(!_||C&2&&i!==(i=Wn(H.getFieldTypeIcon($[1].type))+" svelte-11df51y"))&&p(t,"class",i),(!_||C&2)&&o!==(o=$[1].name+"")&&re(r,o),(!_||C&256&&f!==(f=$[8]))&&p(e,"for",f),$[0]&&!$[1].required?g?g.p($,C):(g=Bp($),g.c(),g.m(c.parentNode,c)):g&&(g.d(1),g=null);const M={};C&256&&(M.id=$[8]),!m&&C&4&&(m=!0,M.value=$[2],ke(()=>m=!1)),!h&&C&1&&(h=!0,M.formattedValue=$[0],ke(()=>h=!1)),d.$set(M)},i($){_||(E(d.$$.fragment,$),_=!0)},o($){A(d.$$.fragment,$),_=!1},d($){$&&(v(e),v(u),v(c)),g&&g.d($),V(d,$)}}}function eO(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[x5,({uniqueId:i})=>({8:i}),({uniqueId:i})=>i?256:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&775&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function tO(n,e,t){let{field:i}=e,{value:l=void 0}=e,s=l;function o(c){c.detail&&c.detail.length==3&&t(0,l=c.detail[1])}function r(){t(0,l="")}const a=()=>r();function f(c){s=c,t(2,s),t(0,l)}function u(c){l=c,t(0,l)}return n.$$set=c=>{"field"in c&&t(1,i=c.field),"value"in c&&t(0,l=c.value)},n.$$.update=()=>{n.$$.dirty&1&&l&&l.length>19&&t(0,l=l.substring(0,19)),n.$$.dirty&5&&s!=l&&t(2,s=l)},[l,i,s,o,r,a,f,u]}class nO extends ge{constructor(e){super(),_e(this,e,tO,eO,me,{field:1,value:0})}}function Up(n){let e,t,i=n[1].options.maxSelect+"",l,s;return{c(){e=b("div"),t=Y("Select up to "),l=Y(i),s=Y(" items."),p(e,"class","help-block")},m(o,r){w(o,e,r),k(e,t),k(e,l),k(e,s)},p(o,r){r&2&&i!==(i=o[1].options.maxSelect+"")&&re(l,i)},d(o){o&&v(e)}}}function iO(n){var S,T,$,C,M,D;let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h;function _(I){n[3](I)}let g={id:n[4],toggle:!n[1].required||n[2],multiple:n[2],closable:!n[2]||((S=n[0])==null?void 0:S.length)>=((T=n[1].options)==null?void 0:T.maxSelect),items:($=n[1].options)==null?void 0:$.values,searchable:((M=(C=n[1].options)==null?void 0:C.values)==null?void 0:M.length)>5};n[0]!==void 0&&(g.selected=n[0]),u=new Wb({props:g}),ee.push(()=>be(u,"selected",_));let y=((D=n[1].options)==null?void 0:D.maxSelect)>1&&Up(n);return{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),f=O(),B(u.$$.fragment),d=O(),y&&y.c(),m=ye(),p(t,"class",i=H.getFieldTypeIcon(n[1].type)),p(s,"class","txt"),p(e,"for",a=n[4])},m(I,L){w(I,e,L),k(e,t),k(e,l),k(e,s),k(s,r),w(I,f,L),z(u,I,L),w(I,d,L),y&&y.m(I,L),w(I,m,L),h=!0},p(I,L){var F,N,P,j,q,W;(!h||L&2&&i!==(i=H.getFieldTypeIcon(I[1].type)))&&p(t,"class",i),(!h||L&2)&&o!==(o=I[1].name+"")&&re(r,o),(!h||L&16&&a!==(a=I[4]))&&p(e,"for",a);const R={};L&16&&(R.id=I[4]),L&6&&(R.toggle=!I[1].required||I[2]),L&4&&(R.multiple=I[2]),L&7&&(R.closable=!I[2]||((F=I[0])==null?void 0:F.length)>=((N=I[1].options)==null?void 0:N.maxSelect)),L&2&&(R.items=(P=I[1].options)==null?void 0:P.values),L&2&&(R.searchable=((q=(j=I[1].options)==null?void 0:j.values)==null?void 0:q.length)>5),!c&&L&1&&(c=!0,R.selected=I[0],ke(()=>c=!1)),u.$set(R),((W=I[1].options)==null?void 0:W.maxSelect)>1?y?y.p(I,L):(y=Up(I),y.c(),y.m(m.parentNode,m)):y&&(y.d(1),y=null)},i(I){h||(E(u.$$.fragment,I),h=!0)},o(I){A(u.$$.fragment,I),h=!1},d(I){I&&(v(e),v(f),v(d),v(m)),V(u,I),y&&y.d(I)}}}function lO(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[iO,({uniqueId:i})=>({4:i}),({uniqueId:i})=>i?16:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&55&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function sO(n,e,t){let i,{field:l}=e,{value:s=void 0}=e;function o(r){s=r,t(0,s),t(2,i),t(1,l)}return n.$$set=r=>{"field"in r&&t(1,l=r.field),"value"in r&&t(0,s=r.value)},n.$$.update=()=>{var r;n.$$.dirty&2&&t(2,i=((r=l.options)==null?void 0:r.maxSelect)>1),n.$$.dirty&5&&typeof s>"u"&&t(0,s=i?[]:""),n.$$.dirty&7&&i&&Array.isArray(s)&&s.length>l.options.maxSelect&&t(0,s=s.slice(s.length-l.options.maxSelect))},[s,l,i,o]}class oO extends ge{constructor(e){super(),_e(this,e,sO,lO,me,{field:1,value:0})}}function rO(n){let e;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function aO(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-fill txt-success")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function fO(n){let e;return{c(){e=b("input"),p(e,"type","text"),p(e,"class","txt-mono"),e.value="Loading...",e.disabled=!0},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function uO(n){let e,t,i;var l=n[3];function s(o,r){return{props:{id:o[6],maxHeight:"500",language:"json",value:o[2]}}}return l&&(e=Ot(l,s(n)),e.$on("change",n[5])),{c(){e&&B(e.$$.fragment),t=ye()},m(o,r){e&&z(e,o,r),w(o,t,r),i=!0},p(o,r){if(r&8&&l!==(l=o[3])){if(e){se();const a=e;A(a.$$.fragment,1,0,()=>{V(a,1)}),oe()}l?(e=Ot(l,s(o)),e.$on("change",o[5]),B(e.$$.fragment),E(e.$$.fragment,1),z(e,t.parentNode,t)):e=null}else if(l){const a={};r&64&&(a.id=o[6]),r&4&&(a.value=o[2]),e.$set(a)}},i(o){i||(e&&E(e.$$.fragment,o),i=!0)},o(o){e&&A(e.$$.fragment,o),i=!1},d(o){o&&v(t),e&&V(e,o)}}}function cO(n){let e,t,i,l,s,o=n[1].name+"",r,a,f,u,c,d,m,h,_,g,y,S;function T(L,R){return L[4]?aO:rO}let $=T(n),C=$(n);const M=[uO,fO],D=[];function I(L,R){return L[3]?0:1}return m=I(n),h=D[m]=M[m](n),{c(){e=b("label"),t=b("i"),l=O(),s=b("span"),r=Y(o),a=O(),f=b("span"),C.c(),d=O(),h.c(),_=ye(),p(t,"class",i=Wn(H.getFieldTypeIcon(n[1].type))+" svelte-p6ecb8"),p(s,"class","txt"),p(f,"class","json-state svelte-p6ecb8"),p(e,"for",c=n[6])},m(L,R){w(L,e,R),k(e,t),k(e,l),k(e,s),k(s,r),k(e,a),k(e,f),C.m(f,null),w(L,d,R),D[m].m(L,R),w(L,_,R),g=!0,y||(S=we(u=Le.call(null,f,{position:"left",text:n[4]?"Valid JSON":"Invalid JSON"})),y=!0)},p(L,R){(!g||R&2&&i!==(i=Wn(H.getFieldTypeIcon(L[1].type))+" svelte-p6ecb8"))&&p(t,"class",i),(!g||R&2)&&o!==(o=L[1].name+"")&&re(r,o),$!==($=T(L))&&(C.d(1),C=$(L),C&&(C.c(),C.m(f,null))),u&&Tt(u.update)&&R&16&&u.update.call(null,{position:"left",text:L[4]?"Valid JSON":"Invalid JSON"}),(!g||R&64&&c!==(c=L[6]))&&p(e,"for",c);let F=m;m=I(L),m===F?D[m].p(L,R):(se(),A(D[F],1,1,()=>{D[F]=null}),oe(),h=D[m],h?h.p(L,R):(h=D[m]=M[m](L),h.c()),E(h,1),h.m(_.parentNode,_))},i(L){g||(E(h),g=!0)},o(L){A(h),g=!1},d(L){L&&(v(e),v(d),v(_)),C.d(),D[m].d(L),y=!1,S()}}}function dO(n){let e,t;return e=new pe({props:{class:"form-field "+(n[1].required?"required":""),name:n[1].name,$$slots:{default:[cO,({uniqueId:i})=>({6:i}),({uniqueId:i})=>i?64:0]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment)},m(i,l){z(e,i,l),t=!0},p(i,[l]){const s={};l&2&&(s.class="form-field "+(i[1].required?"required":"")),l&2&&(s.name=i[1].name),l&223&&(s.$$scope={dirty:l,ctx:i}),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){A(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function Wp(n){return JSON.stringify(typeof n>"u"?null:n,null,2)}function pO(n){try{return JSON.parse(n===""?null:n),!0}catch{}return!1}function mO(n,e,t){let i,{field:l}=e,{value:s=void 0}=e,o,r=Wp(s);jt(async()=>{try{t(3,o=(await nt(()=>import("./CodeEditor-rvo5l1QW.js"),__vite__mapDeps([2,1]),import.meta.url)).default)}catch(f){console.warn(f)}});const a=f=>{t(2,r=f.detail),t(0,s=r.trim())};return n.$$set=f=>{"field"in f&&t(1,l=f.field),"value"in f&&t(0,s=f.value)},n.$$.update=()=>{n.$$.dirty&5&&s!==(r==null?void 0:r.trim())&&(t(2,r=Wp(s)),t(0,s=r)),n.$$.dirty&4&&t(4,i=pO(r))},[s,l,r,o,i,a]}class hO extends ge{constructor(e){super(),_e(this,e,mO,dO,me,{field:1,value:0})}}function _O(n){let e,t;return{c(){e=b("i"),p(e,"class","ri-file-line"),p(e,"alt",t=n[0].name)},m(i,l){w(i,e,l)},p(i,l){l&1&&t!==(t=i[0].name)&&p(e,"alt",t)},d(i){i&&v(e)}}}function gO(n){let e,t,i;return{c(){e=b("img"),p(e,"draggable",!1),en(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(l,s){w(l,e,s)},p(l,s){s&4&&!en(e.src,t=l[2])&&p(e,"src",t),s&2&&p(e,"width",l[1]),s&2&&p(e,"height",l[1]),s&1&&i!==(i=l[0].name)&&p(e,"alt",i)},d(l){l&&v(e)}}}function bO(n){let e;function t(s,o){return s[2]?gO:_O}let i=t(n),l=i(n);return{c(){l.c(),e=ye()},m(s,o){l.m(s,o),w(s,e,o)},p(s,[o]){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},i:Q,o:Q,d(s){s&&v(e),l.d(s)}}}function kO(n,e,t){let i,{file:l}=e,{size:s=50}=e;function o(){H.hasImageExtension(l==null?void 0:l.name)?H.generateThumb(l,s,s).then(r=>{t(2,i=r)}).catch(r=>{t(2,i=""),console.warn("Unable to generate thumb: ",r)}):t(2,i="")}return n.$$set=r=>{"file"in r&&t(0,l=r.file),"size"in r&&t(1,s=r.size)},n.$$.update=()=>{n.$$.dirty&1&&typeof l<"u"&&o()},t(2,i=""),[l,s,i]}class yO extends ge{constructor(e){super(),_e(this,e,kO,bO,me,{file:0,size:1})}}function Yp(n){let e;function t(s,o){return s[4]==="image"?wO:vO}let i=t(n),l=i(n);return{c(){l.c(),e=ye()},m(s,o){l.m(s,o),w(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&v(e),l.d(s)}}}function vO(n){let e,t;return{c(){e=b("object"),t=Y("Cannot preview the file."),p(e,"title",n[2]),p(e,"data",n[1])},m(i,l){w(i,e,l),k(e,t)},p(i,l){l&4&&p(e,"title",i[2]),l&2&&p(e,"data",i[1])},d(i){i&&v(e)}}}function wO(n){let e,t,i;return{c(){e=b("img"),en(e.src,t=n[1])||p(e,"src",t),p(e,"alt",i="Preview "+n[2])},m(l,s){w(l,e,s)},p(l,s){s&2&&!en(e.src,t=l[1])&&p(e,"src",t),s&4&&i!==(i="Preview "+l[2])&&p(e,"alt",i)},d(l){l&&v(e)}}}function SO(n){var l;let e=(l=n[3])==null?void 0:l.isActive(),t,i=e&&Yp(n);return{c(){i&&i.c(),t=ye()},m(s,o){i&&i.m(s,o),w(s,t,o)},p(s,o){var r;o&8&&(e=(r=s[3])==null?void 0:r.isActive()),e?i?i.p(s,o):(i=Yp(s),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null)},d(s){s&&v(t),i&&i.d(s)}}}function $O(n){let e,t,i;return{c(){e=b("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","overlay-close")},m(l,s){w(l,e,s),t||(i=K(e,"click",Be(n[0])),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function TO(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("a"),t=Y(n[2]),i=O(),l=b("i"),s=O(),o=b("div"),r=O(),a=b("button"),a.textContent="Close",p(l,"class","ri-external-link-line"),p(e,"href",n[1]),p(e,"title",n[2]),p(e,"target","_blank"),p(e,"rel","noreferrer noopener"),p(e,"class","link-hint txt-ellipsis inline-flex"),p(o,"class","flex-fill"),p(a,"type","button"),p(a,"class","btn btn-transparent")},m(c,d){w(c,e,d),k(e,t),k(e,i),k(e,l),w(c,s,d),w(c,o,d),w(c,r,d),w(c,a,d),f||(u=K(a,"click",n[0]),f=!0)},p(c,d){d&4&&re(t,c[2]),d&2&&p(e,"href",c[1]),d&4&&p(e,"title",c[2])},d(c){c&&(v(e),v(s),v(o),v(r),v(a)),f=!1,u()}}}function CO(n){let e,t,i={class:"preview preview-"+n[4],btnClose:!1,popup:!0,$$slots:{footer:[TO],header:[$O],default:[SO]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[7](e),e.$on("show",n[8]),e.$on("hide",n[9]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&16&&(o.class="preview preview-"+l[4]),s&1054&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[7](null),V(e,l)}}}function OO(n,e,t){let i,l,s,o,r="";function a(m){m!==""&&(t(1,r=m),o==null||o.show())}function f(){return o==null?void 0:o.hide()}function u(m){ee[m?"unshift":"push"](()=>{o=m,t(3,o)})}function c(m){Te.call(this,n,m)}function d(m){Te.call(this,n,m)}return n.$$.update=()=>{n.$$.dirty&2&&t(6,i=r.indexOf("?")),n.$$.dirty&66&&t(2,l=r.substring(r.lastIndexOf("/")+1,i>0?i:void 0)),n.$$.dirty&4&&t(4,s=H.getFileType(l))},[f,r,l,o,s,a,i,u,c,d]}class MO extends ge{constructor(e){super(),_e(this,e,OO,CO,me,{show:5,hide:0})}get show(){return this.$$.ctx[5]}get hide(){return this.$$.ctx[0]}}function DO(n){let e,t,i,l,s;function o(f,u){return f[3]==="image"?LO:f[3]==="video"||f[3]==="audio"?AO:IO}let r=o(n),a=r(n);return{c(){e=b("a"),a.c(),p(e,"draggable",!1),p(e,"class",t="thumb "+(n[1]?`thumb-${n[1]}`:"")),p(e,"href",n[6]),p(e,"target","_blank"),p(e,"rel","noreferrer"),p(e,"title",i=(n[7]?"Preview":"Download")+" "+n[0])},m(f,u){w(f,e,u),a.m(e,null),l||(s=K(e,"click",cn(n[11])),l=!0)},p(f,u){r===(r=o(f))&&a?a.p(f,u):(a.d(1),a=r(f),a&&(a.c(),a.m(e,null))),u&2&&t!==(t="thumb "+(f[1]?`thumb-${f[1]}`:""))&&p(e,"class",t),u&64&&p(e,"href",f[6]),u&129&&i!==(i=(f[7]?"Preview":"Download")+" "+f[0])&&p(e,"title",i)},d(f){f&&v(e),a.d(),l=!1,s()}}}function EO(n){let e,t;return{c(){e=b("div"),p(e,"class",t="thumb "+(n[1]?`thumb-${n[1]}`:""))},m(i,l){w(i,e,l)},p(i,l){l&2&&t!==(t="thumb "+(i[1]?`thumb-${i[1]}`:""))&&p(e,"class",t)},d(i){i&&v(e)}}}function IO(n){let e;return{c(){e=b("i"),p(e,"class","ri-file-3-line")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function AO(n){let e;return{c(){e=b("i"),p(e,"class","ri-video-line")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function LO(n){let e,t,i,l,s;return{c(){e=b("img"),p(e,"draggable",!1),p(e,"loading","lazy"),en(e.src,t=n[5])||p(e,"src",t),p(e,"alt",n[0]),p(e,"title",i="Preview "+n[0])},m(o,r){w(o,e,r),l||(s=K(e,"error",n[8]),l=!0)},p(o,r){r&32&&!en(e.src,t=o[5])&&p(e,"src",t),r&1&&p(e,"alt",o[0]),r&1&&i!==(i="Preview "+o[0])&&p(e,"title",i)},d(o){o&&v(e),l=!1,s()}}}function Kp(n){let e,t,i={};return e=new MO({props:i}),n[12](e),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,s){const o={};e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[12](null),V(e,l)}}}function NO(n){let e,t,i;function l(a,f){return a[2]?EO:DO}let s=l(n),o=s(n),r=n[7]&&Kp(n);return{c(){o.c(),e=O(),r&&r.c(),t=ye()},m(a,f){o.m(a,f),w(a,e,f),r&&r.m(a,f),w(a,t,f),i=!0},p(a,[f]){s===(s=l(a))&&o?o.p(a,f):(o.d(1),o=s(a),o&&(o.c(),o.m(e.parentNode,e))),a[7]?r?(r.p(a,f),f&128&&E(r,1)):(r=Kp(a),r.c(),E(r,1),r.m(t.parentNode,t)):r&&(se(),A(r,1,1,()=>{r=null}),oe())},i(a){i||(E(r),i=!0)},o(a){A(r),i=!1},d(a){a&&(v(e),v(t)),o.d(a),r&&r.d(a)}}}function PO(n,e,t){let i,l,{record:s=null}=e,{filename:o=""}=e,{size:r=""}=e,a,f="",u="",c="",d=!0;m();async function m(){t(2,d=!0);try{t(10,c=await fe.getAdminFileToken(s.collectionId))}catch(y){console.warn("File token failure:",y)}t(2,d=!1)}function h(){t(5,f="")}const _=y=>{l&&(y.preventDefault(),a==null||a.show(u))};function g(y){ee[y?"unshift":"push"](()=>{a=y,t(4,a)})}return n.$$set=y=>{"record"in y&&t(9,s=y.record),"filename"in y&&t(0,o=y.filename),"size"in y&&t(1,r=y.size)},n.$$.update=()=>{n.$$.dirty&1&&t(3,i=H.getFileType(o)),n.$$.dirty&9&&t(7,l=["image","audio","video"].includes(i)||o.endsWith(".pdf")),n.$$.dirty&1541&&t(6,u=d?"":fe.files.getUrl(s,o,{token:c})),n.$$.dirty&1541&&t(5,f=d?"":fe.files.getUrl(s,o,{thumb:"100x100",token:c}))},[o,r,d,i,a,f,u,l,h,s,c,_,g]}class Wa extends ge{constructor(e){super(),_e(this,e,PO,NO,me,{record:9,filename:0,size:1})}}function Jp(n,e,t){const i=n.slice();return i[29]=e[t],i[31]=t,i}function Zp(n,e,t){const i=n.slice();i[34]=e[t],i[31]=t;const l=i[2].includes(i[34]);return i[35]=l,i}function FO(n){let e,t,i;function l(){return n[17](n[34])}return{c(){e=b("button"),e.innerHTML='',p(e,"type","button"),p(e,"class","btn btn-transparent btn-hint btn-sm btn-circle btn-remove")},m(s,o){w(s,e,o),t||(i=[we(Le.call(null,e,"Remove file")),K(e,"click",l)],t=!0)},p(s,o){n=s},d(s){s&&v(e),t=!1,ve(i)}}}function RO(n){let e,t,i;function l(){return n[16](n[34])}return{c(){e=b("button"),e.innerHTML='Restore',p(e,"type","button"),p(e,"class","btn btn-sm btn-danger btn-transparent")},m(s,o){w(s,e,o),t||(i=K(e,"click",l),t=!0)},p(s,o){n=s},d(s){s&&v(e),t=!1,i()}}}function qO(n){let e,t,i,l,s,o,r=n[34]+"",a,f,u,c,d,m;i=new Wa({props:{record:n[3],filename:n[34]}});function h(y,S){return y[35]?RO:FO}let _=h(n),g=_(n);return{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),o=b("a"),a=Y(r),c=O(),d=b("div"),g.c(),x(t,"fade",n[35]),p(o,"draggable",!1),p(o,"href",f=fe.files.getUrl(n[3],n[34],{token:n[10]})),p(o,"class",u="txt-ellipsis "+(n[35]?"txt-strikethrough txt-hint":"link-primary")),p(o,"title","Download"),p(o,"target","_blank"),p(o,"rel","noopener noreferrer"),p(s,"class","content"),p(d,"class","actions"),p(e,"class","list-item"),x(e,"dragging",n[32]),x(e,"dragover",n[33])},m(y,S){w(y,e,S),k(e,t),z(i,t,null),k(e,l),k(e,s),k(s,o),k(o,a),k(e,c),k(e,d),g.m(d,null),m=!0},p(y,S){const T={};S[0]&8&&(T.record=y[3]),S[0]&32&&(T.filename=y[34]),i.$set(T),(!m||S[0]&36)&&x(t,"fade",y[35]),(!m||S[0]&32)&&r!==(r=y[34]+"")&&re(a,r),(!m||S[0]&1064&&f!==(f=fe.files.getUrl(y[3],y[34],{token:y[10]})))&&p(o,"href",f),(!m||S[0]&36&&u!==(u="txt-ellipsis "+(y[35]?"txt-strikethrough txt-hint":"link-primary")))&&p(o,"class",u),_===(_=h(y))&&g?g.p(y,S):(g.d(1),g=_(y),g&&(g.c(),g.m(d,null))),(!m||S[1]&2)&&x(e,"dragging",y[32]),(!m||S[1]&4)&&x(e,"dragover",y[33])},i(y){m||(E(i.$$.fragment,y),m=!0)},o(y){A(i.$$.fragment,y),m=!1},d(y){y&&v(e),V(i),g.d()}}}function Gp(n,e){let t,i,l,s;function o(a){e[18](a)}let r={group:e[4].name+"_uploaded",index:e[31],disabled:!e[6],$$slots:{default:[qO,({dragging:a,dragover:f})=>({32:a,33:f}),({dragging:a,dragover:f})=>[0,(a?2:0)|(f?4:0)]]},$$scope:{ctx:e}};return e[0]!==void 0&&(r.list=e[0]),i=new Ms({props:r}),ee.push(()=>be(i,"list",o)),{key:n,first:null,c(){t=ye(),B(i.$$.fragment),this.first=t},m(a,f){w(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f[0]&16&&(u.group=e[4].name+"_uploaded"),f[0]&32&&(u.index=e[31]),f[0]&64&&(u.disabled=!e[6]),f[0]&1068|f[1]&70&&(u.$$scope={dirty:f,ctx:e}),!l&&f[0]&1&&(l=!0,u.list=e[0],ke(()=>l=!1)),i.$set(u)},i(a){s||(E(i.$$.fragment,a),s=!0)},o(a){A(i.$$.fragment,a),s=!1},d(a){a&&v(t),V(i,a)}}}function jO(n){let e,t,i,l,s,o,r,a,f=n[29].name+"",u,c,d,m,h,_,g;i=new yO({props:{file:n[29]}});function y(){return n[19](n[31])}return{c(){e=b("div"),t=b("figure"),B(i.$$.fragment),l=O(),s=b("div"),o=b("small"),o.textContent="New",r=O(),a=b("span"),u=Y(f),d=O(),m=b("button"),m.innerHTML='',p(t,"class","thumb"),p(o,"class","label label-success m-r-5"),p(a,"class","txt"),p(s,"class","filename m-r-auto"),p(s,"title",c=n[29].name),p(m,"type","button"),p(m,"class","btn btn-transparent btn-hint btn-sm btn-circle btn-remove"),p(e,"class","list-item"),x(e,"dragging",n[32]),x(e,"dragover",n[33])},m(S,T){w(S,e,T),k(e,t),z(i,t,null),k(e,l),k(e,s),k(s,o),k(s,r),k(s,a),k(a,u),k(e,d),k(e,m),h=!0,_||(g=[we(Le.call(null,m,"Remove file")),K(m,"click",y)],_=!0)},p(S,T){n=S;const $={};T[0]&2&&($.file=n[29]),i.$set($),(!h||T[0]&2)&&f!==(f=n[29].name+"")&&re(u,f),(!h||T[0]&2&&c!==(c=n[29].name))&&p(s,"title",c),(!h||T[1]&2)&&x(e,"dragging",n[32]),(!h||T[1]&4)&&x(e,"dragover",n[33])},i(S){h||(E(i.$$.fragment,S),h=!0)},o(S){A(i.$$.fragment,S),h=!1},d(S){S&&v(e),V(i),_=!1,ve(g)}}}function Xp(n,e){let t,i,l,s;function o(a){e[20](a)}let r={group:e[4].name+"_new",index:e[31],disabled:!e[6],$$slots:{default:[jO,({dragging:a,dragover:f})=>({32:a,33:f}),({dragging:a,dragover:f})=>[0,(a?2:0)|(f?4:0)]]},$$scope:{ctx:e}};return e[1]!==void 0&&(r.list=e[1]),i=new Ms({props:r}),ee.push(()=>be(i,"list",o)),{key:n,first:null,c(){t=ye(),B(i.$$.fragment),this.first=t},m(a,f){w(a,t,f),z(i,a,f),s=!0},p(a,f){e=a;const u={};f[0]&16&&(u.group=e[4].name+"_new"),f[0]&2&&(u.index=e[31]),f[0]&64&&(u.disabled=!e[6]),f[0]&2|f[1]&70&&(u.$$scope={dirty:f,ctx:e}),!l&&f[0]&2&&(l=!0,u.list=e[1],ke(()=>l=!1)),i.$set(u)},i(a){s||(E(i.$$.fragment,a),s=!0)},o(a){A(i.$$.fragment,a),s=!1},d(a){a&&v(t),V(i,a)}}}function HO(n){let e,t,i,l,s,o=n[4].name+"",r,a,f,u,c=[],d=new Map,m,h=[],_=new Map,g,y,S,T,$,C,M,D,I,L,R,F,N=de(n[5]);const P=W=>W[34]+W[3].id;for(let W=0;WW[29].name+W[31];for(let W=0;W{M[R]=null}),oe(),o=M[s],o?o.p(I,L):(o=M[s]=C[s](I),o.c()),E(o,1),o.m(r.parentNode,r))},i(I){S||(E(o),S=!0)},o(I){A(o),S=!1},d(I){I&&(v(e),v(l),v(r),v(a)),M[s].d(I),T=!1,ve($)}}}function tI(n){let e,t,i,l,s,o;return e=new pe({props:{class:"form-field required",name:n[1]+".subject",$$slots:{default:[GE,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),i=new pe({props:{class:"form-field required",name:n[1]+".actionUrl",$$slots:{default:[XE,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),s=new pe({props:{class:"form-field m-0 required",name:n[1]+".body",$$slots:{default:[eI,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment),l=O(),B(s.$$.fragment)},m(r,a){z(e,r,a),w(r,t,a),z(i,r,a),w(r,l,a),z(s,r,a),o=!0},p(r,a){const f={};a[0]&2&&(f.name=r[1]+".subject"),a[0]&1|a[1]&3&&(f.$$scope={dirty:a,ctx:r}),e.$set(f);const u={};a[0]&2&&(u.name=r[1]+".actionUrl"),a[0]&1|a[1]&3&&(u.$$scope={dirty:a,ctx:r}),i.$set(u);const c={};a[0]&2&&(c.name=r[1]+".body"),a[0]&49|a[1]&3&&(c.$$scope={dirty:a,ctx:r}),s.$set(c)},i(r){o||(E(e.$$.fragment,r),E(i.$$.fragment,r),E(s.$$.fragment,r),o=!0)},o(r){A(e.$$.fragment,r),A(i.$$.fragment,r),A(s.$$.fragment,r),o=!1},d(r){r&&(v(t),v(l)),V(e,r),V(i,r),V(s,r)}}}function Xh(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,l||(s=we(Le.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function nI(n){let e,t,i,l,s,o,r,a,f,u=n[6]&&Xh();return{c(){e=b("div"),t=b("i"),i=O(),l=b("span"),s=Y(n[2]),o=O(),r=b("div"),a=O(),u&&u.c(),f=ye(),p(t,"class","ri-draft-line"),p(l,"class","txt"),p(e,"class","inline-flex"),p(r,"class","flex-fill")},m(c,d){w(c,e,d),k(e,t),k(e,i),k(e,l),k(l,s),w(c,o,d),w(c,r,d),w(c,a,d),u&&u.m(c,d),w(c,f,d)},p(c,d){d[0]&4&&re(s,c[2]),c[6]?u?d[0]&64&&E(u,1):(u=Xh(),u.c(),E(u,1),u.m(f.parentNode,f)):u&&(se(),A(u,1,1,()=>{u=null}),oe())},d(c){c&&(v(e),v(o),v(r),v(a),v(f)),u&&u.d(c)}}}function iI(n){let e,t;const i=[n[8]];let l={$$slots:{header:[nI],default:[tI]},$$scope:{ctx:n}};for(let s=0;st(12,o=Z));let{key:r}=e,{title:a}=e,{config:f={}}=e,u,c=Qh,d=!1;function m(){u==null||u.expand()}function h(){u==null||u.collapse()}function _(){u==null||u.collapseSiblings()}async function g(){c||d||(t(5,d=!0),t(4,c=(await nt(()=>import("./CodeEditor-f9FE6aAj.js"),__vite__mapDeps([2,1]),import.meta.url)).default),Qh=c,t(5,d=!1))}function y(Z){H.copyToClipboard(Z),$o(`Copied ${Z} to clipboard`,2e3)}g();function S(){f.subject=this.value,t(0,f)}const T=()=>y("{APP_NAME}"),$=()=>y("{APP_URL}");function C(){f.actionUrl=this.value,t(0,f)}const M=()=>y("{APP_NAME}"),D=()=>y("{APP_URL}"),I=()=>y("{TOKEN}");function L(Z){n.$$.not_equal(f.body,Z)&&(f.body=Z,t(0,f))}function R(){f.body=this.value,t(0,f)}const F=()=>y("{APP_NAME}"),N=()=>y("{APP_URL}"),P=()=>y("{TOKEN}"),j=()=>y("{ACTION_URL}");function q(Z){ee[Z?"unshift":"push"](()=>{u=Z,t(3,u)})}function W(Z){Te.call(this,n,Z)}function G(Z){Te.call(this,n,Z)}function U(Z){Te.call(this,n,Z)}return n.$$set=Z=>{e=Pe(Pe({},e),Wt(Z)),t(8,s=Ze(e,l)),"key"in Z&&t(1,r=Z.key),"title"in Z&&t(2,a=Z.title),"config"in Z&&t(0,f=Z.config)},n.$$.update=()=>{n.$$.dirty[0]&4098&&t(6,i=!H.isEmpty(H.getNestedVal(o,r))),n.$$.dirty[0]&3&&(f.enabled||li(r))},[f,r,a,u,c,d,i,y,s,m,h,_,o,S,T,$,C,M,D,I,L,R,F,N,P,j,q,W,G,U]}class Za extends ge{constructor(e){super(),_e(this,e,lI,iI,me,{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 xh(n,e,t){const i=n.slice();return i[21]=e[t],i}function e_(n,e){let t,i,l,s,o,r=e[21].label+"",a,f,u,c,d,m;return c=h0(e[11][0]),{key:n,first:null,c(){t=b("div"),i=b("input"),s=O(),o=b("label"),a=Y(r),u=O(),p(i,"type","radio"),p(i,"name","template"),p(i,"id",l=e[20]+e[21].value),i.__value=e[21].value,ae(i,i.__value),p(o,"for",f=e[20]+e[21].value),p(t,"class","form-field-block"),c.p(i),this.first=t},m(h,_){w(h,t,_),k(t,i),i.checked=i.__value===e[2],k(t,s),k(t,o),k(o,a),k(t,u),d||(m=K(i,"change",e[10]),d=!0)},p(h,_){e=h,_&1048576&&l!==(l=e[20]+e[21].value)&&p(i,"id",l),_&4&&(i.checked=i.__value===e[2]),_&1048576&&f!==(f=e[20]+e[21].value)&&p(o,"for",f)},d(h){h&&v(t),c.r(),d=!1,m()}}}function sI(n){let e=[],t=new Map,i,l=de(n[7]);const s=o=>o[21].value;for(let o=0;o({20:a}),({uniqueId:a})=>a?1048576:0]},$$scope:{ctx:n}}}),l=new pe({props:{class:"form-field required m-0",name:"email",$$slots:{default:[oI,({uniqueId:a})=>({20:a}),({uniqueId:a})=>a?1048576:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),B(t.$$.fragment),i=O(),B(l.$$.fragment),p(e,"id",n[6]),p(e,"autocomplete","off")},m(a,f){w(a,e,f),z(t,e,null),k(e,i),z(l,e,null),s=!0,o||(r=K(e,"submit",Be(n[13])),o=!0)},p(a,f){const u={};f&17825796&&(u.$$scope={dirty:f,ctx:a}),t.$set(u);const c={};f&17825794&&(c.$$scope={dirty:f,ctx:a}),l.$set(c)},i(a){s||(E(t.$$.fragment,a),E(l.$$.fragment,a),s=!0)},o(a){A(t.$$.fragment,a),A(l.$$.fragment,a),s=!1},d(a){a&&v(e),V(t),V(l),o=!1,r()}}}function aI(n){let e;return{c(){e=b("h4"),e.textContent="Send test email",p(e,"class","center txt-break")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function fI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("button"),t=Y("Close"),i=O(),l=b("button"),s=b("i"),o=O(),r=b("span"),r.textContent="Send",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[4],p(s,"class","ri-mail-send-line"),p(r,"class","txt"),p(l,"type","submit"),p(l,"form",n[6]),p(l,"class","btn btn-expanded"),l.disabled=a=!n[5]||n[4],x(l,"btn-loading",n[4])},m(c,d){w(c,e,d),k(e,t),w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=K(e,"click",n[0]),f=!0)},p(c,d){d&16&&(e.disabled=c[4]),d&48&&a!==(a=!c[5]||c[4])&&(l.disabled=a),d&16&&x(l,"btn-loading",c[4])},d(c){c&&(v(e),v(i),v(l)),f=!1,u()}}}function uI(n){let e,t,i={class:"overlay-panel-sm email-test-popup",overlayClose:!n[4],escClose:!n[4],beforeHide:n[14],popup:!0,$$slots:{footer:[fI],header:[aI],default:[rI]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[15](e),e.$on("show",n[16]),e.$on("hide",n[17]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&16&&(o.overlayClose=!l[4]),s&16&&(o.escClose=!l[4]),s&16&&(o.beforeHide=l[14]),s&16777270&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[15](null),V(e,l)}}}const Nr="last_email_test",t_="email_test_request";function cI(n,e,t){let i;const l=st(),s="email_test_"+H.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(Nr),f=o[0].value,u=!1,c=null;function d(D="",I=""){t(1,a=D||localStorage.getItem(Nr)),t(2,f=I||o[0].value),Jt({}),r==null||r.show()}function m(){return clearTimeout(c),r==null?void 0:r.hide()}async function h(){if(!(!i||u)){t(4,u=!0),localStorage==null||localStorage.setItem(Nr,a),clearTimeout(c),c=setTimeout(()=>{fe.cancelRequest(t_),ii("Test email send timeout.")},3e4);try{await fe.settings.testEmail(a,f,{$cancelKey:t_}),At("Successfully sent test email."),l("submit"),t(4,u=!1),await Xt(),m()}catch(D){t(4,u=!1),fe.error(D)}clearTimeout(c)}}const _=[[]];function g(){f=this.__value,t(2,f)}function y(){a=this.value,t(1,a)}const S=()=>h(),T=()=>!u;function $(D){ee[D?"unshift":"push"](()=>{r=D,t(3,r)})}function C(D){Te.call(this,n,D)}function M(D){Te.call(this,n,D)}return n.$$.update=()=>{n.$$.dirty&6&&t(5,i=!!a&&!!f)},[m,a,f,r,u,i,s,o,h,d,g,_,y,S,T,$,C,M]}class dI extends ge{constructor(e){super(),_e(this,e,cI,uI,me,{show:9,hide:0})}get show(){return this.$$.ctx[9]}get hide(){return this.$$.ctx[0]}}function pI(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$;i=new pe({props:{class:"form-field required",name:"meta.senderName",$$slots:{default:[hI,({uniqueId:N})=>({34:N}),({uniqueId:N})=>[0,N?8:0]]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field required",name:"meta.senderAddress",$$slots:{default:[_I,({uniqueId:N})=>({34:N}),({uniqueId:N})=>[0,N?8:0]]},$$scope:{ctx:n}}});let C=!n[0].meta.verificationTemplate.hidden&&n_(n),M=!n[0].meta.resetPasswordTemplate.hidden&&i_(n),D=!n[0].meta.confirmEmailChangeTemplate.hidden&&l_(n);h=new pe({props:{class:"form-field form-field-toggle m-b-sm",$$slots:{default:[gI,({uniqueId:N})=>({34:N}),({uniqueId:N})=>[0,N?8:0]]},$$scope:{ctx:n}}});let I=n[0].smtp.enabled&&s_(n);function L(N,P){return N[5]?MI:OI}let R=L(n),F=R(n);return{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),r=O(),a=b("div"),C&&C.c(),f=O(),M&&M.c(),u=O(),D&&D.c(),c=O(),d=b("hr"),m=O(),B(h.$$.fragment),_=O(),I&&I.c(),g=O(),y=b("div"),S=b("div"),T=O(),F.c(),p(t,"class","col-lg-6"),p(s,"class","col-lg-6"),p(e,"class","grid m-b-base"),p(a,"class","accordions"),p(S,"class","flex-fill"),p(y,"class","flex")},m(N,P){w(N,e,P),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),w(N,r,P),w(N,a,P),C&&C.m(a,null),k(a,f),M&&M.m(a,null),k(a,u),D&&D.m(a,null),w(N,c,P),w(N,d,P),w(N,m,P),z(h,N,P),w(N,_,P),I&&I.m(N,P),w(N,g,P),w(N,y,P),k(y,S),k(y,T),F.m(y,null),$=!0},p(N,P){const j={};P[0]&1|P[1]&24&&(j.$$scope={dirty:P,ctx:N}),i.$set(j);const q={};P[0]&1|P[1]&24&&(q.$$scope={dirty:P,ctx:N}),o.$set(q),N[0].meta.verificationTemplate.hidden?C&&(se(),A(C,1,1,()=>{C=null}),oe()):C?(C.p(N,P),P[0]&1&&E(C,1)):(C=n_(N),C.c(),E(C,1),C.m(a,f)),N[0].meta.resetPasswordTemplate.hidden?M&&(se(),A(M,1,1,()=>{M=null}),oe()):M?(M.p(N,P),P[0]&1&&E(M,1)):(M=i_(N),M.c(),E(M,1),M.m(a,u)),N[0].meta.confirmEmailChangeTemplate.hidden?D&&(se(),A(D,1,1,()=>{D=null}),oe()):D?(D.p(N,P),P[0]&1&&E(D,1)):(D=l_(N),D.c(),E(D,1),D.m(a,null));const W={};P[0]&1|P[1]&24&&(W.$$scope={dirty:P,ctx:N}),h.$set(W),N[0].smtp.enabled?I?(I.p(N,P),P[0]&1&&E(I,1)):(I=s_(N),I.c(),E(I,1),I.m(g.parentNode,g)):I&&(se(),A(I,1,1,()=>{I=null}),oe()),R===(R=L(N))&&F?F.p(N,P):(F.d(1),F=R(N),F&&(F.c(),F.m(y,null)))},i(N){$||(E(i.$$.fragment,N),E(o.$$.fragment,N),E(C),E(M),E(D),E(h.$$.fragment,N),E(I),$=!0)},o(N){A(i.$$.fragment,N),A(o.$$.fragment,N),A(C),A(M),A(D),A(h.$$.fragment,N),A(I),$=!1},d(N){N&&(v(e),v(r),v(a),v(c),v(d),v(m),v(_),v(g),v(y)),V(i),V(o),C&&C.d(),M&&M.d(),D&&D.d(),V(h,N),I&&I.d(N),F.d()}}}function mI(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function hI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Sender name"),l=O(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","text"),p(s,"id",o=n[34]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].meta.senderName),r||(a=K(s,"input",n[13]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].meta.senderName&&ae(s,f[0].meta.senderName)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function _I(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Sender address"),l=O(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","email"),p(s,"id",o=n[34]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].meta.senderAddress),r||(a=K(s,"input",n[14]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].meta.senderAddress&&ae(s,f[0].meta.senderAddress)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function n_(n){let e,t,i;function l(o){n[15](o)}let s={single:!0,key:"meta.verificationTemplate",title:'Default "Verification" email template'};return n[0].meta.verificationTemplate!==void 0&&(s.config=n[0].meta.verificationTemplate),e=new Za({props:s}),ee.push(()=>be(e,"config",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&1&&(t=!0,a.config=o[0].meta.verificationTemplate,ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function i_(n){let e,t,i;function l(o){n[16](o)}let s={single:!0,key:"meta.resetPasswordTemplate",title:'Default "Password reset" email template'};return n[0].meta.resetPasswordTemplate!==void 0&&(s.config=n[0].meta.resetPasswordTemplate),e=new Za({props:s}),ee.push(()=>be(e,"config",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&1&&(t=!0,a.config=o[0].meta.resetPasswordTemplate,ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function l_(n){let e,t,i;function l(o){n[17](o)}let s={single:!0,key:"meta.confirmEmailChangeTemplate",title:'Default "Confirm email change" email template'};return n[0].meta.confirmEmailChangeTemplate!==void 0&&(s.config=n[0].meta.confirmEmailChangeTemplate),e=new Za({props:s}),ee.push(()=>be(e,"config",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&1&&(t=!0,a.config=o[0].meta.confirmEmailChangeTemplate,ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function gI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.innerHTML="Use SMTP mail server (recommended)",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[34]),e.required=!0,p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[34])},m(c,d){w(c,e,d),e.checked=n[0].smtp.enabled,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[18]),we(Le.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"}))],f=!0)},p(c,d){d[1]&8&&t!==(t=c[34])&&p(e,"id",t),d[0]&1&&(e.checked=c[0].smtp.enabled),d[1]&8&&a!==(a=c[34])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function s_(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$;l=new pe({props:{class:"form-field required",name:"smtp.host",$$slots:{default:[bI,({uniqueId:L})=>({34:L}),({uniqueId:L})=>[0,L?8:0]]},$$scope:{ctx:n}}}),r=new pe({props:{class:"form-field required",name:"smtp.port",$$slots:{default:[kI,({uniqueId:L})=>({34:L}),({uniqueId:L})=>[0,L?8:0]]},$$scope:{ctx:n}}}),u=new pe({props:{class:"form-field",name:"smtp.username",$$slots:{default:[yI,({uniqueId:L})=>({34:L}),({uniqueId:L})=>[0,L?8:0]]},$$scope:{ctx:n}}}),m=new pe({props:{class:"form-field",name:"smtp.password",$$slots:{default:[vI,({uniqueId:L})=>({34:L}),({uniqueId:L})=>[0,L?8:0]]},$$scope:{ctx:n}}});function C(L,R){return L[4]?SI:wI}let M=C(n),D=M(n),I=n[4]&&o_(n);return{c(){e=b("div"),t=b("div"),i=b("div"),B(l.$$.fragment),s=O(),o=b("div"),B(r.$$.fragment),a=O(),f=b("div"),B(u.$$.fragment),c=O(),d=b("div"),B(m.$$.fragment),h=O(),_=b("button"),D.c(),g=O(),I&&I.c(),p(i,"class","col-lg-4"),p(o,"class","col-lg-2"),p(f,"class","col-lg-3"),p(d,"class","col-lg-3"),p(t,"class","grid"),p(_,"type","button"),p(_,"class","btn btn-sm btn-secondary m-t-sm m-b-sm")},m(L,R){w(L,e,R),k(e,t),k(t,i),z(l,i,null),k(t,s),k(t,o),z(r,o,null),k(t,a),k(t,f),z(u,f,null),k(t,c),k(t,d),z(m,d,null),k(e,h),k(e,_),D.m(_,null),k(e,g),I&&I.m(e,null),S=!0,T||($=K(_,"click",Be(n[23])),T=!0)},p(L,R){const F={};R[0]&1|R[1]&24&&(F.$$scope={dirty:R,ctx:L}),l.$set(F);const N={};R[0]&1|R[1]&24&&(N.$$scope={dirty:R,ctx:L}),r.$set(N);const P={};R[0]&1|R[1]&24&&(P.$$scope={dirty:R,ctx:L}),u.$set(P);const j={};R[0]&1|R[1]&24&&(j.$$scope={dirty:R,ctx:L}),m.$set(j),M!==(M=C(L))&&(D.d(1),D=M(L),D&&(D.c(),D.m(_,null))),L[4]?I?(I.p(L,R),R[0]&16&&E(I,1)):(I=o_(L),I.c(),E(I,1),I.m(e,null)):I&&(se(),A(I,1,1,()=>{I=null}),oe())},i(L){S||(E(l.$$.fragment,L),E(r.$$.fragment,L),E(u.$$.fragment,L),E(m.$$.fragment,L),E(I),L&&Ye(()=>{S&&(y||(y=Ne(e,et,{duration:150},!0)),y.run(1))}),S=!0)},o(L){A(l.$$.fragment,L),A(r.$$.fragment,L),A(u.$$.fragment,L),A(m.$$.fragment,L),A(I),L&&(y||(y=Ne(e,et,{duration:150},!1)),y.run(0)),S=!1},d(L){L&&v(e),V(l),V(r),V(u),V(m),D.d(),I&&I.d(),L&&y&&y.end(),T=!1,$()}}}function bI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("SMTP server host"),l=O(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","text"),p(s,"id",o=n[34]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].smtp.host),r||(a=K(s,"input",n[19]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].smtp.host&&ae(s,f[0].smtp.host)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function kI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Port"),l=O(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","number"),p(s,"id",o=n[34]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].smtp.port),r||(a=K(s,"input",n[20]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&<(s.value)!==f[0].smtp.port&&ae(s,f[0].smtp.port)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function yI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Username"),l=O(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","text"),p(s,"id",o=n[34])},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].smtp.username),r||(a=K(s,"input",n[21]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].smtp.username&&ae(s,f[0].smtp.username)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function vI(n){let e,t,i,l,s,o,r;function a(u){n[22](u)}let f={id:n[34]};return n[0].smtp.password!==void 0&&(f.value=n[0].smtp.password),s=new Ja({props:f}),ee.push(()=>be(s,"value",a)),{c(){e=b("label"),t=Y("Password"),l=O(),B(s.$$.fragment),p(e,"for",i=n[34])},m(u,c){w(u,e,c),k(e,t),w(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c[1]&8&&i!==(i=u[34]))&&p(e,"for",i);const d={};c[1]&8&&(d.id=u[34]),!o&&c[0]&1&&(o=!0,d.value=u[0].smtp.password,ke(()=>o=!1)),s.$set(d)},i(u){r||(E(s.$$.fragment,u),r=!0)},o(u){A(s.$$.fragment,u),r=!1},d(u){u&&(v(e),v(l)),V(s,u)}}}function wI(n){let e,t,i;return{c(){e=b("span"),e.textContent="Show more options",t=O(),i=b("i"),p(e,"class","txt"),p(i,"class","ri-arrow-down-s-line")},m(l,s){w(l,e,s),w(l,t,s),w(l,i,s)},d(l){l&&(v(e),v(t),v(i))}}}function SI(n){let e,t,i;return{c(){e=b("span"),e.textContent="Hide more options",t=O(),i=b("i"),p(e,"class","txt"),p(i,"class","ri-arrow-up-s-line")},m(l,s){w(l,e,s),w(l,t,s),w(l,i,s)},d(l){l&&(v(e),v(t),v(i))}}}function o_(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;return i=new pe({props:{class:"form-field",name:"smtp.tls",$$slots:{default:[$I,({uniqueId:h})=>({34:h}),({uniqueId:h})=>[0,h?8:0]]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field",name:"smtp.authMethod",$$slots:{default:[TI,({uniqueId:h})=>({34:h}),({uniqueId:h})=>[0,h?8:0]]},$$scope:{ctx:n}}}),f=new pe({props:{class:"form-field",name:"smtp.localName",$$slots:{default:[CI,({uniqueId:h})=>({34:h}),({uniqueId:h})=>[0,h?8:0]]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),r=O(),a=b("div"),B(f.$$.fragment),u=O(),c=b("div"),p(t,"class","col-lg-3"),p(s,"class","col-lg-3"),p(a,"class","col-lg-6"),p(c,"class","col-lg-12"),p(e,"class","grid")},m(h,_){w(h,e,_),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),k(e,r),k(e,a),z(f,a,null),k(e,u),k(e,c),m=!0},p(h,_){const g={};_[0]&1|_[1]&24&&(g.$$scope={dirty:_,ctx:h}),i.$set(g);const y={};_[0]&1|_[1]&24&&(y.$$scope={dirty:_,ctx:h}),o.$set(y);const S={};_[0]&1|_[1]&24&&(S.$$scope={dirty:_,ctx:h}),f.$set(S)},i(h){m||(E(i.$$.fragment,h),E(o.$$.fragment,h),E(f.$$.fragment,h),h&&Ye(()=>{m&&(d||(d=Ne(e,et,{duration:150},!0)),d.run(1))}),m=!0)},o(h){A(i.$$.fragment,h),A(o.$$.fragment,h),A(f.$$.fragment,h),h&&(d||(d=Ne(e,et,{duration:150},!1)),d.run(0)),m=!1},d(h){h&&v(e),V(i),V(o),V(f),h&&d&&d.end()}}}function $I(n){let e,t,i,l,s,o,r;function a(u){n[24](u)}let f={id:n[34],items:n[7]};return n[0].smtp.tls!==void 0&&(f.keyOfSelected=n[0].smtp.tls),s=new hi({props:f}),ee.push(()=>be(s,"keyOfSelected",a)),{c(){e=b("label"),t=Y("TLS encryption"),l=O(),B(s.$$.fragment),p(e,"for",i=n[34])},m(u,c){w(u,e,c),k(e,t),w(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c[1]&8&&i!==(i=u[34]))&&p(e,"for",i);const d={};c[1]&8&&(d.id=u[34]),!o&&c[0]&1&&(o=!0,d.keyOfSelected=u[0].smtp.tls,ke(()=>o=!1)),s.$set(d)},i(u){r||(E(s.$$.fragment,u),r=!0)},o(u){A(s.$$.fragment,u),r=!1},d(u){u&&(v(e),v(l)),V(s,u)}}}function TI(n){let e,t,i,l,s,o,r;function a(u){n[25](u)}let f={id:n[34],items:n[8]};return n[0].smtp.authMethod!==void 0&&(f.keyOfSelected=n[0].smtp.authMethod),s=new hi({props:f}),ee.push(()=>be(s,"keyOfSelected",a)),{c(){e=b("label"),t=Y("AUTH method"),l=O(),B(s.$$.fragment),p(e,"for",i=n[34])},m(u,c){w(u,e,c),k(e,t),w(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c[1]&8&&i!==(i=u[34]))&&p(e,"for",i);const d={};c[1]&8&&(d.id=u[34]),!o&&c[0]&1&&(o=!0,d.keyOfSelected=u[0].smtp.authMethod,ke(()=>o=!1)),s.$set(d)},i(u){r||(E(s.$$.fragment,u),r=!0)},o(u){A(s.$$.fragment,u),r=!1},d(u){u&&(v(e),v(l)),V(s,u)}}}function CI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=b("span"),t.textContent="EHLO/HELO domain",i=O(),l=b("i"),o=O(),r=b("input"),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[34]),p(r,"type","text"),p(r,"id",a=n[34]),p(r,"placeholder","Default to localhost")},m(c,d){w(c,e,d),k(e,t),k(e,i),k(e,l),w(c,o,d),w(c,r,d),ae(r,n[0].smtp.localName),f||(u=[we(Le.call(null,l,{text:"Some SMTP servers, such as the Gmail SMTP-relay, requires a proper domain name in the inital EHLO/HELO exchange and will reject attempts to use localhost.",position:"top"})),K(r,"input",n[26])],f=!0)},p(c,d){d[1]&8&&s!==(s=c[34])&&p(e,"for",s),d[1]&8&&a!==(a=c[34])&&p(r,"id",a),d[0]&1&&r.value!==c[0].smtp.localName&&ae(r,c[0].smtp.localName)},d(c){c&&(v(e),v(o),v(r)),f=!1,ve(u)}}}function OI(n){let e,t,i;return{c(){e=b("button"),e.innerHTML=' Send test email',p(e,"type","button"),p(e,"class","btn btn-expanded btn-outline")},m(l,s){w(l,e,s),t||(i=K(e,"click",n[29]),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function MI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=O(),l=b("button"),s=b("span"),s.textContent="Save changes",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent btn-hint"),e.disabled=n[3],p(s,"class","txt"),p(l,"type","submit"),p(l,"class","btn btn-expanded"),l.disabled=o=!n[5]||n[3],x(l,"btn-loading",n[3])},m(f,u){w(f,e,u),k(e,t),w(f,i,u),w(f,l,u),k(l,s),r||(a=[K(e,"click",n[27]),K(l,"click",n[28])],r=!0)},p(f,u){u[0]&8&&(e.disabled=f[3]),u[0]&40&&o!==(o=!f[5]||f[3])&&(l.disabled=o),u[0]&8&&x(l,"btn-loading",f[3])},d(f){f&&(v(e),v(i),v(l)),r=!1,ve(a)}}}function DI(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g;const y=[mI,pI],S=[];function T($,C){return $[2]?0:1}return d=T(n),m=S[d]=y[d](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=O(),s=b("div"),o=Y(n[6]),r=O(),a=b("div"),f=b("form"),u=b("div"),u.innerHTML="

    Configure common settings for sending emails.

    ",c=O(),m.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","content txt-xl m-b-base"),p(f,"class","panel"),p(f,"autocomplete","off"),p(a,"class","wrapper")},m($,C){w($,e,C),k(e,t),k(t,i),k(t,l),k(t,s),k(s,o),w($,r,C),w($,a,C),k(a,f),k(f,u),k(f,c),S[d].m(f,null),h=!0,_||(g=K(f,"submit",Be(n[30])),_=!0)},p($,C){(!h||C[0]&64)&&re(o,$[6]);let M=d;d=T($),d===M?S[d].p($,C):(se(),A(S[M],1,1,()=>{S[M]=null}),oe(),m=S[d],m?m.p($,C):(m=S[d]=y[d]($),m.c()),E(m,1),m.m(f,null))},i($){h||(E(m),h=!0)},o($){A(m),h=!1},d($){$&&(v(e),v(r),v(a)),S[d].d(),_=!1,g()}}}function EI(n){let e,t,i,l,s,o;e=new _i({}),i=new kn({props:{$$slots:{default:[DI]},$$scope:{ctx:n}}});let r={};return s=new dI({props:r}),n[31](s),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment),l=O(),B(s.$$.fragment)},m(a,f){z(e,a,f),w(a,t,f),z(i,a,f),w(a,l,f),z(s,a,f),o=!0},p(a,f){const u={};f[0]&127|f[1]&16&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};s.$set(c)},i(a){o||(E(e.$$.fragment,a),E(i.$$.fragment,a),E(s.$$.fragment,a),o=!0)},o(a){A(e.$$.fragment,a),A(i.$$.fragment,a),A(s.$$.fragment,a),o=!1},d(a){a&&(v(t),v(l)),V(e,a),V(i,a),n[31](null),V(s,a)}}}function II(n,e,t){let i,l,s;Ue(n,Dt,ne=>t(6,s=ne));const o=[{label:"Auto (StartTLS)",value:!1},{label:"Always",value:!0}],r=[{label:"PLAIN (default)",value:"PLAIN"},{label:"LOGIN",value:"LOGIN"}];xt(Dt,s="Mail settings",s);let a,f={},u={},c=!1,d=!1,m=!1;h();async function h(){t(2,c=!0);try{const ne=await fe.settings.getAll()||{};g(ne)}catch(ne){fe.error(ne)}t(2,c=!1)}async function _(){if(!(d||!l)){t(3,d=!0);try{const ne=await fe.settings.update(H.filterRedactedProps(u));g(ne),Jt({}),At("Successfully saved mail settings.")}catch(ne){fe.error(ne)}t(3,d=!1)}}function g(ne={}){t(0,u={meta:(ne==null?void 0:ne.meta)||{},smtp:(ne==null?void 0:ne.smtp)||{}}),u.smtp.authMethod||t(0,u.smtp.authMethod=r[0].value,u),t(11,f=JSON.parse(JSON.stringify(u)))}function y(){t(0,u=JSON.parse(JSON.stringify(f||{})))}function S(){u.meta.senderName=this.value,t(0,u)}function T(){u.meta.senderAddress=this.value,t(0,u)}function $(ne){n.$$.not_equal(u.meta.verificationTemplate,ne)&&(u.meta.verificationTemplate=ne,t(0,u))}function C(ne){n.$$.not_equal(u.meta.resetPasswordTemplate,ne)&&(u.meta.resetPasswordTemplate=ne,t(0,u))}function M(ne){n.$$.not_equal(u.meta.confirmEmailChangeTemplate,ne)&&(u.meta.confirmEmailChangeTemplate=ne,t(0,u))}function D(){u.smtp.enabled=this.checked,t(0,u)}function I(){u.smtp.host=this.value,t(0,u)}function L(){u.smtp.port=lt(this.value),t(0,u)}function R(){u.smtp.username=this.value,t(0,u)}function F(ne){n.$$.not_equal(u.smtp.password,ne)&&(u.smtp.password=ne,t(0,u))}const N=()=>{t(4,m=!m)};function P(ne){n.$$.not_equal(u.smtp.tls,ne)&&(u.smtp.tls=ne,t(0,u))}function j(ne){n.$$.not_equal(u.smtp.authMethod,ne)&&(u.smtp.authMethod=ne,t(0,u))}function q(){u.smtp.localName=this.value,t(0,u)}const W=()=>y(),G=()=>_(),U=()=>a==null?void 0:a.show(),Z=()=>_();function le(ne){ee[ne?"unshift":"push"](()=>{a=ne,t(1,a)})}return n.$$.update=()=>{n.$$.dirty[0]&2048&&t(12,i=JSON.stringify(f)),n.$$.dirty[0]&4097&&t(5,l=i!=JSON.stringify(u))},[u,a,c,d,m,l,s,o,r,_,y,f,i,S,T,$,C,M,D,I,L,R,F,N,P,j,q,W,G,U,Z,le]}class AI extends ge{constructor(e){super(),_e(this,e,II,EI,me,{},null,[-1,-1])}}const LI=n=>({isTesting:n&4,testError:n&2,enabled:n&1}),r_=n=>({isTesting:n[2],testError:n[1],enabled:n[0].enabled});function NI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y(n[4]),p(e,"type","checkbox"),p(e,"id",t=n[20]),e.required=!0,p(l,"for",o=n[20])},m(f,u){w(f,e,u),e.checked=n[0].enabled,w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[8]),r=!0)},p(f,u){u&1048576&&t!==(t=f[20])&&p(e,"id",t),u&1&&(e.checked=f[0].enabled),u&16&&re(s,f[4]),u&1048576&&o!==(o=f[20])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function a_(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$,C,M;return i=new pe({props:{class:"form-field required",name:n[3]+".endpoint",$$slots:{default:[PI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field required",name:n[3]+".bucket",$$slots:{default:[FI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),f=new pe({props:{class:"form-field required",name:n[3]+".region",$$slots:{default:[RI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),d=new pe({props:{class:"form-field required",name:n[3]+".accessKey",$$slots:{default:[qI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),_=new pe({props:{class:"form-field required",name:n[3]+".secret",$$slots:{default:[jI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),S=new pe({props:{class:"form-field",name:n[3]+".forcePathStyle",$$slots:{default:[HI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),r=O(),a=b("div"),B(f.$$.fragment),u=O(),c=b("div"),B(d.$$.fragment),m=O(),h=b("div"),B(_.$$.fragment),g=O(),y=b("div"),B(S.$$.fragment),T=O(),$=b("div"),p(t,"class","col-lg-6"),p(s,"class","col-lg-3"),p(a,"class","col-lg-3"),p(c,"class","col-lg-6"),p(h,"class","col-lg-6"),p(y,"class","col-lg-12"),p($,"class","col-lg-12"),p(e,"class","grid")},m(D,I){w(D,e,I),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),k(e,r),k(e,a),z(f,a,null),k(e,u),k(e,c),z(d,c,null),k(e,m),k(e,h),z(_,h,null),k(e,g),k(e,y),z(S,y,null),k(e,T),k(e,$),M=!0},p(D,I){const L={};I&8&&(L.name=D[3]+".endpoint"),I&1081345&&(L.$$scope={dirty:I,ctx:D}),i.$set(L);const R={};I&8&&(R.name=D[3]+".bucket"),I&1081345&&(R.$$scope={dirty:I,ctx:D}),o.$set(R);const F={};I&8&&(F.name=D[3]+".region"),I&1081345&&(F.$$scope={dirty:I,ctx:D}),f.$set(F);const N={};I&8&&(N.name=D[3]+".accessKey"),I&1081345&&(N.$$scope={dirty:I,ctx:D}),d.$set(N);const P={};I&8&&(P.name=D[3]+".secret"),I&1081345&&(P.$$scope={dirty:I,ctx:D}),_.$set(P);const j={};I&8&&(j.name=D[3]+".forcePathStyle"),I&1081345&&(j.$$scope={dirty:I,ctx:D}),S.$set(j)},i(D){M||(E(i.$$.fragment,D),E(o.$$.fragment,D),E(f.$$.fragment,D),E(d.$$.fragment,D),E(_.$$.fragment,D),E(S.$$.fragment,D),D&&Ye(()=>{M&&(C||(C=Ne(e,et,{duration:150},!0)),C.run(1))}),M=!0)},o(D){A(i.$$.fragment,D),A(o.$$.fragment,D),A(f.$$.fragment,D),A(d.$$.fragment,D),A(_.$$.fragment,D),A(S.$$.fragment,D),D&&(C||(C=Ne(e,et,{duration:150},!1)),C.run(0)),M=!1},d(D){D&&v(e),V(i),V(o),V(f),V(d),V(_),V(S),D&&C&&C.end()}}}function PI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Endpoint"),l=O(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].endpoint),r||(a=K(s,"input",n[9]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].endpoint&&ae(s,f[0].endpoint)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function FI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Bucket"),l=O(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].bucket),r||(a=K(s,"input",n[10]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].bucket&&ae(s,f[0].bucket)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function RI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Region"),l=O(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].region),r||(a=K(s,"input",n[11]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].region&&ae(s,f[0].region)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function qI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Access key"),l=O(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].accessKey),r||(a=K(s,"input",n[12]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].accessKey&&ae(s,f[0].accessKey)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function jI(n){let e,t,i,l,s,o,r;function a(u){n[13](u)}let f={id:n[20],required:!0};return n[0].secret!==void 0&&(f.value=n[0].secret),s=new Ja({props:f}),ee.push(()=>be(s,"value",a)),{c(){e=b("label"),t=Y("Secret"),l=O(),B(s.$$.fragment),p(e,"for",i=n[20])},m(u,c){w(u,e,c),k(e,t),w(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c&1048576&&i!==(i=u[20]))&&p(e,"for",i);const d={};c&1048576&&(d.id=u[20]),!o&&c&1&&(o=!0,d.value=u[0].secret,ke(()=>o=!1)),s.$set(d)},i(u){r||(E(s.$$.fragment,u),r=!0)},o(u){A(s.$$.fragment,u),r=!1},d(u){u&&(v(e),v(l)),V(s,u)}}}function HI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.textContent="Force path-style addressing",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[20]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[20])},m(c,d){w(c,e,d),e.checked=n[0].forcePathStyle,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[14]),we(Le.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"}))],f=!0)},p(c,d){d&1048576&&t!==(t=c[20])&&p(e,"id",t),d&1&&(e.checked=c[0].forcePathStyle),d&1048576&&a!==(a=c[20])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function zI(n){let e,t,i,l,s;e=new pe({props:{class:"form-field form-field-toggle",$$slots:{default:[NI,({uniqueId:f})=>({20:f}),({uniqueId:f})=>f?1048576:0]},$$scope:{ctx:n}}});const o=n[7].default,r=vt(o,n,n[15],r_);let a=n[0].enabled&&a_(n);return{c(){B(e.$$.fragment),t=O(),r&&r.c(),i=O(),a&&a.c(),l=ye()},m(f,u){z(e,f,u),w(f,t,u),r&&r.m(f,u),w(f,i,u),a&&a.m(f,u),w(f,l,u),s=!0},p(f,[u]){const c={};u&1081361&&(c.$$scope={dirty:u,ctx:f}),e.$set(c),r&&r.p&&(!s||u&32775)&&St(r,o,f,f[15],s?wt(o,f[15],u,LI):$t(f[15]),r_),f[0].enabled?a?(a.p(f,u),u&1&&E(a,1)):(a=a_(f),a.c(),E(a,1),a.m(l.parentNode,l)):a&&(se(),A(a,1,1,()=>{a=null}),oe())},i(f){s||(E(e.$$.fragment,f),E(r,f),E(a),s=!0)},o(f){A(e.$$.fragment,f),A(r,f),A(a),s=!1},d(f){f&&(v(t),v(i),v(l)),V(e,f),r&&r.d(f),a&&a.d(f)}}}const Pr="s3_test_request";function VI(n,e,t){let{$$slots:i={},$$scope:l}=e,{originalConfig:s={}}=e,{config:o={}}=e,{configKey:r="s3"}=e,{toggleLabel:a="Enable S3"}=e,{testFilesystem:f="storage"}=e,{testError:u=null}=e,{isTesting:c=!1}=e,d=null,m=null;function h(D){t(2,c=!0),clearTimeout(m),m=setTimeout(()=>{_()},D)}async function _(){if(t(1,u=null),!o.enabled)return t(2,c=!1),u;fe.cancelRequest(Pr),clearTimeout(d),d=setTimeout(()=>{fe.cancelRequest(Pr),t(1,u=new Error("S3 test connection timeout.")),t(2,c=!1)},3e4),t(2,c=!0);let D;try{await fe.settings.testS3(f,{$cancelKey:Pr})}catch(I){D=I}return D!=null&&D.isAbort||(t(1,u=D),t(2,c=!1),clearTimeout(d)),u}jt(()=>()=>{clearTimeout(d),clearTimeout(m)});function g(){o.enabled=this.checked,t(0,o)}function y(){o.endpoint=this.value,t(0,o)}function S(){o.bucket=this.value,t(0,o)}function T(){o.region=this.value,t(0,o)}function $(){o.accessKey=this.value,t(0,o)}function C(D){n.$$.not_equal(o.secret,D)&&(o.secret=D,t(0,o))}function M(){o.forcePathStyle=this.checked,t(0,o)}return n.$$set=D=>{"originalConfig"in D&&t(5,s=D.originalConfig),"config"in D&&t(0,o=D.config),"configKey"in D&&t(3,r=D.configKey),"toggleLabel"in D&&t(4,a=D.toggleLabel),"testFilesystem"in D&&t(6,f=D.testFilesystem),"testError"in D&&t(1,u=D.testError),"isTesting"in D&&t(2,c=D.isTesting),"$$scope"in D&&t(15,l=D.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&s!=null&&s.enabled&&h(100),n.$$.dirty&9&&(o.enabled||li(r))},[o,u,c,r,a,s,f,i,g,y,S,T,$,C,M,l]}class Gb extends ge{constructor(e){super(),_e(this,e,VI,zI,me,{originalConfig:5,config:0,configKey:3,toggleLabel:4,testFilesystem:6,testError:1,isTesting:2})}}function BI(n){var D;let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g;function y(I){n[11](I)}function S(I){n[12](I)}function T(I){n[13](I)}let $={toggleLabel:"Use S3 storage",originalConfig:n[0].s3,$$slots:{default:[WI]},$$scope:{ctx:n}};n[1].s3!==void 0&&($.config=n[1].s3),n[4]!==void 0&&($.isTesting=n[4]),n[5]!==void 0&&($.testError=n[5]),e=new Gb({props:$}),ee.push(()=>be(e,"config",y)),ee.push(()=>be(e,"isTesting",S)),ee.push(()=>be(e,"testError",T));let C=((D=n[1].s3)==null?void 0:D.enabled)&&!n[6]&&!n[3]&&u_(n),M=n[6]&&c_(n);return{c(){B(e.$$.fragment),s=O(),o=b("div"),r=b("div"),a=O(),C&&C.c(),f=O(),M&&M.c(),u=O(),c=b("button"),d=b("span"),d.textContent="Save changes",p(r,"class","flex-fill"),p(d,"class","txt"),p(c,"type","submit"),p(c,"class","btn btn-expanded"),c.disabled=m=!n[6]||n[3],x(c,"btn-loading",n[3]),p(o,"class","flex")},m(I,L){z(e,I,L),w(I,s,L),w(I,o,L),k(o,r),k(o,a),C&&C.m(o,null),k(o,f),M&&M.m(o,null),k(o,u),k(o,c),k(c,d),h=!0,_||(g=K(c,"click",n[15]),_=!0)},p(I,L){var F;const R={};L&1&&(R.originalConfig=I[0].s3),L&524291&&(R.$$scope={dirty:L,ctx:I}),!t&&L&2&&(t=!0,R.config=I[1].s3,ke(()=>t=!1)),!i&&L&16&&(i=!0,R.isTesting=I[4],ke(()=>i=!1)),!l&&L&32&&(l=!0,R.testError=I[5],ke(()=>l=!1)),e.$set(R),(F=I[1].s3)!=null&&F.enabled&&!I[6]&&!I[3]?C?C.p(I,L):(C=u_(I),C.c(),C.m(o,f)):C&&(C.d(1),C=null),I[6]?M?M.p(I,L):(M=c_(I),M.c(),M.m(o,u)):M&&(M.d(1),M=null),(!h||L&72&&m!==(m=!I[6]||I[3]))&&(c.disabled=m),(!h||L&8)&&x(c,"btn-loading",I[3])},i(I){h||(E(e.$$.fragment,I),h=!0)},o(I){A(e.$$.fragment,I),h=!1},d(I){I&&(v(s),v(o)),V(e,I),C&&C.d(),M&&M.d(),_=!1,g()}}}function UI(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function f_(n){var L;let e,t,i,l,s,o,r,a=(L=n[0].s3)!=null&&L.enabled?"S3 storage":"local file system",f,u,c,d=n[1].s3.enabled?"S3 storage":"local file system",m,h,_,g,y,S,T,$,C,M,D,I;return{c(){e=b("div"),t=b("div"),i=b("div"),i.innerHTML='',l=O(),s=b("div"),o=Y(`If you have existing uploaded files, you'll have to migrate them manually + `),g=b("button"),g.textContent="{ACTION_URL} ",y=Y("."),p(e,"for",i=n[31]),p(u,"type","button"),p(u,"class","label label-sm link-primary txt-mono"),p(d,"type","button"),p(d,"class","label label-sm link-primary txt-mono"),p(h,"type","button"),p(h,"class","label label-sm link-primary txt-mono"),p(g,"type","button"),p(g,"class","label label-sm link-primary txt-mono"),p(g,"title","Required parameter"),p(a,"class","help-block")},m(I,L){w(I,e,L),k(e,t),w(I,l,L),M[s].m(I,L),w(I,r,L),w(I,a,L),k(a,f),k(a,u),k(a,c),k(a,d),k(a,m),k(a,h),k(a,_),k(a,g),k(a,y),S=!0,T||($=[K(u,"click",n[22]),K(d,"click",n[23]),K(h,"click",n[24]),K(g,"click",n[25])],T=!0)},p(I,L){(!S||L[1]&1&&i!==(i=I[31]))&&p(e,"for",i);let R=s;s=D(I),s===R?M[s].p(I,L):(se(),A(M[R],1,1,()=>{M[R]=null}),oe(),o=M[s],o?o.p(I,L):(o=M[s]=C[s](I),o.c()),E(o,1),o.m(r.parentNode,r))},i(I){S||(E(o),S=!0)},o(I){A(o),S=!1},d(I){I&&(v(e),v(l),v(r),v(a)),M[s].d(I),T=!1,ve($)}}}function tI(n){let e,t,i,l,s,o;return e=new pe({props:{class:"form-field required",name:n[1]+".subject",$$slots:{default:[GE,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),i=new pe({props:{class:"form-field required",name:n[1]+".actionUrl",$$slots:{default:[XE,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),s=new pe({props:{class:"form-field m-0 required",name:n[1]+".body",$$slots:{default:[eI,({uniqueId:r})=>({31:r}),({uniqueId:r})=>[0,r?1:0]]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment),l=O(),B(s.$$.fragment)},m(r,a){z(e,r,a),w(r,t,a),z(i,r,a),w(r,l,a),z(s,r,a),o=!0},p(r,a){const f={};a[0]&2&&(f.name=r[1]+".subject"),a[0]&1|a[1]&3&&(f.$$scope={dirty:a,ctx:r}),e.$set(f);const u={};a[0]&2&&(u.name=r[1]+".actionUrl"),a[0]&1|a[1]&3&&(u.$$scope={dirty:a,ctx:r}),i.$set(u);const c={};a[0]&2&&(c.name=r[1]+".body"),a[0]&49|a[1]&3&&(c.$$scope={dirty:a,ctx:r}),s.$set(c)},i(r){o||(E(e.$$.fragment,r),E(i.$$.fragment,r),E(s.$$.fragment,r),o=!0)},o(r){A(e.$$.fragment,r),A(i.$$.fragment,r),A(s.$$.fragment,r),o=!1},d(r){r&&(v(t),v(l)),V(e,r),V(i,r),V(s,r)}}}function Xh(n){let e,t,i,l,s;return{c(){e=b("i"),p(e,"class","ri-error-warning-fill txt-danger")},m(o,r){w(o,e,r),i=!0,l||(s=we(Le.call(null,e,{text:"Has errors",position:"left"})),l=!0)},i(o){i||(o&&Ye(()=>{i&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!0)),t.run(1))}),i=!0)},o(o){o&&(t||(t=Ne(e,Ut,{duration:150,start:.7},!1)),t.run(0)),i=!1},d(o){o&&v(e),o&&t&&t.end(),l=!1,s()}}}function nI(n){let e,t,i,l,s,o,r,a,f,u=n[6]&&Xh();return{c(){e=b("div"),t=b("i"),i=O(),l=b("span"),s=Y(n[2]),o=O(),r=b("div"),a=O(),u&&u.c(),f=ye(),p(t,"class","ri-draft-line"),p(l,"class","txt"),p(e,"class","inline-flex"),p(r,"class","flex-fill")},m(c,d){w(c,e,d),k(e,t),k(e,i),k(e,l),k(l,s),w(c,o,d),w(c,r,d),w(c,a,d),u&&u.m(c,d),w(c,f,d)},p(c,d){d[0]&4&&re(s,c[2]),c[6]?u?d[0]&64&&E(u,1):(u=Xh(),u.c(),E(u,1),u.m(f.parentNode,f)):u&&(se(),A(u,1,1,()=>{u=null}),oe())},d(c){c&&(v(e),v(o),v(r),v(a),v(f)),u&&u.d(c)}}}function iI(n){let e,t;const i=[n[8]];let l={$$slots:{header:[nI],default:[tI]},$$scope:{ctx:n}};for(let s=0;st(12,o=Z));let{key:r}=e,{title:a}=e,{config:f={}}=e,u,c=Qh,d=!1;function m(){u==null||u.expand()}function h(){u==null||u.collapse()}function _(){u==null||u.collapseSiblings()}async function g(){c||d||(t(5,d=!0),t(4,c=(await nt(()=>import("./CodeEditor-rvo5l1QW.js"),__vite__mapDeps([2,1]),import.meta.url)).default),Qh=c,t(5,d=!1))}function y(Z){H.copyToClipboard(Z),$o(`Copied ${Z} to clipboard`,2e3)}g();function S(){f.subject=this.value,t(0,f)}const T=()=>y("{APP_NAME}"),$=()=>y("{APP_URL}");function C(){f.actionUrl=this.value,t(0,f)}const M=()=>y("{APP_NAME}"),D=()=>y("{APP_URL}"),I=()=>y("{TOKEN}");function L(Z){n.$$.not_equal(f.body,Z)&&(f.body=Z,t(0,f))}function R(){f.body=this.value,t(0,f)}const F=()=>y("{APP_NAME}"),N=()=>y("{APP_URL}"),P=()=>y("{TOKEN}"),j=()=>y("{ACTION_URL}");function q(Z){ee[Z?"unshift":"push"](()=>{u=Z,t(3,u)})}function W(Z){Te.call(this,n,Z)}function G(Z){Te.call(this,n,Z)}function U(Z){Te.call(this,n,Z)}return n.$$set=Z=>{e=Pe(Pe({},e),Wt(Z)),t(8,s=Ze(e,l)),"key"in Z&&t(1,r=Z.key),"title"in Z&&t(2,a=Z.title),"config"in Z&&t(0,f=Z.config)},n.$$.update=()=>{n.$$.dirty[0]&4098&&t(6,i=!H.isEmpty(H.getNestedVal(o,r))),n.$$.dirty[0]&3&&(f.enabled||li(r))},[f,r,a,u,c,d,i,y,s,m,h,_,o,S,T,$,C,M,D,I,L,R,F,N,P,j,q,W,G,U]}class Za extends ge{constructor(e){super(),_e(this,e,lI,iI,me,{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 xh(n,e,t){const i=n.slice();return i[21]=e[t],i}function e_(n,e){let t,i,l,s,o,r=e[21].label+"",a,f,u,c,d,m;return c=h0(e[11][0]),{key:n,first:null,c(){t=b("div"),i=b("input"),s=O(),o=b("label"),a=Y(r),u=O(),p(i,"type","radio"),p(i,"name","template"),p(i,"id",l=e[20]+e[21].value),i.__value=e[21].value,ae(i,i.__value),p(o,"for",f=e[20]+e[21].value),p(t,"class","form-field-block"),c.p(i),this.first=t},m(h,_){w(h,t,_),k(t,i),i.checked=i.__value===e[2],k(t,s),k(t,o),k(o,a),k(t,u),d||(m=K(i,"change",e[10]),d=!0)},p(h,_){e=h,_&1048576&&l!==(l=e[20]+e[21].value)&&p(i,"id",l),_&4&&(i.checked=i.__value===e[2]),_&1048576&&f!==(f=e[20]+e[21].value)&&p(o,"for",f)},d(h){h&&v(t),c.r(),d=!1,m()}}}function sI(n){let e=[],t=new Map,i,l=de(n[7]);const s=o=>o[21].value;for(let o=0;o({20:a}),({uniqueId:a})=>a?1048576:0]},$$scope:{ctx:n}}}),l=new pe({props:{class:"form-field required m-0",name:"email",$$slots:{default:[oI,({uniqueId:a})=>({20:a}),({uniqueId:a})=>a?1048576:0]},$$scope:{ctx:n}}}),{c(){e=b("form"),B(t.$$.fragment),i=O(),B(l.$$.fragment),p(e,"id",n[6]),p(e,"autocomplete","off")},m(a,f){w(a,e,f),z(t,e,null),k(e,i),z(l,e,null),s=!0,o||(r=K(e,"submit",Be(n[13])),o=!0)},p(a,f){const u={};f&17825796&&(u.$$scope={dirty:f,ctx:a}),t.$set(u);const c={};f&17825794&&(c.$$scope={dirty:f,ctx:a}),l.$set(c)},i(a){s||(E(t.$$.fragment,a),E(l.$$.fragment,a),s=!0)},o(a){A(t.$$.fragment,a),A(l.$$.fragment,a),s=!1},d(a){a&&v(e),V(t),V(l),o=!1,r()}}}function aI(n){let e;return{c(){e=b("h4"),e.textContent="Send test email",p(e,"class","center txt-break")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function fI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("button"),t=Y("Close"),i=O(),l=b("button"),s=b("i"),o=O(),r=b("span"),r.textContent="Send",p(e,"type","button"),p(e,"class","btn btn-transparent"),e.disabled=n[4],p(s,"class","ri-mail-send-line"),p(r,"class","txt"),p(l,"type","submit"),p(l,"form",n[6]),p(l,"class","btn btn-expanded"),l.disabled=a=!n[5]||n[4],x(l,"btn-loading",n[4])},m(c,d){w(c,e,d),k(e,t),w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=K(e,"click",n[0]),f=!0)},p(c,d){d&16&&(e.disabled=c[4]),d&48&&a!==(a=!c[5]||c[4])&&(l.disabled=a),d&16&&x(l,"btn-loading",c[4])},d(c){c&&(v(e),v(i),v(l)),f=!1,u()}}}function uI(n){let e,t,i={class:"overlay-panel-sm email-test-popup",overlayClose:!n[4],escClose:!n[4],beforeHide:n[14],popup:!0,$$slots:{footer:[fI],header:[aI],default:[rI]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[15](e),e.$on("show",n[16]),e.$on("hide",n[17]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&16&&(o.overlayClose=!l[4]),s&16&&(o.escClose=!l[4]),s&16&&(o.beforeHide=l[14]),s&16777270&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[15](null),V(e,l)}}}const Nr="last_email_test",t_="email_test_request";function cI(n,e,t){let i;const l=st(),s="email_test_"+H.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(Nr),f=o[0].value,u=!1,c=null;function d(D="",I=""){t(1,a=D||localStorage.getItem(Nr)),t(2,f=I||o[0].value),Jt({}),r==null||r.show()}function m(){return clearTimeout(c),r==null?void 0:r.hide()}async function h(){if(!(!i||u)){t(4,u=!0),localStorage==null||localStorage.setItem(Nr,a),clearTimeout(c),c=setTimeout(()=>{fe.cancelRequest(t_),ii("Test email send timeout.")},3e4);try{await fe.settings.testEmail(a,f,{$cancelKey:t_}),At("Successfully sent test email."),l("submit"),t(4,u=!1),await Xt(),m()}catch(D){t(4,u=!1),fe.error(D)}clearTimeout(c)}}const _=[[]];function g(){f=this.__value,t(2,f)}function y(){a=this.value,t(1,a)}const S=()=>h(),T=()=>!u;function $(D){ee[D?"unshift":"push"](()=>{r=D,t(3,r)})}function C(D){Te.call(this,n,D)}function M(D){Te.call(this,n,D)}return n.$$.update=()=>{n.$$.dirty&6&&t(5,i=!!a&&!!f)},[m,a,f,r,u,i,s,o,h,d,g,_,y,S,T,$,C,M]}class dI extends ge{constructor(e){super(),_e(this,e,cI,uI,me,{show:9,hide:0})}get show(){return this.$$.ctx[9]}get hide(){return this.$$.ctx[0]}}function pI(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$;i=new pe({props:{class:"form-field required",name:"meta.senderName",$$slots:{default:[hI,({uniqueId:N})=>({34:N}),({uniqueId:N})=>[0,N?8:0]]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field required",name:"meta.senderAddress",$$slots:{default:[_I,({uniqueId:N})=>({34:N}),({uniqueId:N})=>[0,N?8:0]]},$$scope:{ctx:n}}});let C=!n[0].meta.verificationTemplate.hidden&&n_(n),M=!n[0].meta.resetPasswordTemplate.hidden&&i_(n),D=!n[0].meta.confirmEmailChangeTemplate.hidden&&l_(n);h=new pe({props:{class:"form-field form-field-toggle m-b-sm",$$slots:{default:[gI,({uniqueId:N})=>({34:N}),({uniqueId:N})=>[0,N?8:0]]},$$scope:{ctx:n}}});let I=n[0].smtp.enabled&&s_(n);function L(N,P){return N[5]?MI:OI}let R=L(n),F=R(n);return{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),r=O(),a=b("div"),C&&C.c(),f=O(),M&&M.c(),u=O(),D&&D.c(),c=O(),d=b("hr"),m=O(),B(h.$$.fragment),_=O(),I&&I.c(),g=O(),y=b("div"),S=b("div"),T=O(),F.c(),p(t,"class","col-lg-6"),p(s,"class","col-lg-6"),p(e,"class","grid m-b-base"),p(a,"class","accordions"),p(S,"class","flex-fill"),p(y,"class","flex")},m(N,P){w(N,e,P),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),w(N,r,P),w(N,a,P),C&&C.m(a,null),k(a,f),M&&M.m(a,null),k(a,u),D&&D.m(a,null),w(N,c,P),w(N,d,P),w(N,m,P),z(h,N,P),w(N,_,P),I&&I.m(N,P),w(N,g,P),w(N,y,P),k(y,S),k(y,T),F.m(y,null),$=!0},p(N,P){const j={};P[0]&1|P[1]&24&&(j.$$scope={dirty:P,ctx:N}),i.$set(j);const q={};P[0]&1|P[1]&24&&(q.$$scope={dirty:P,ctx:N}),o.$set(q),N[0].meta.verificationTemplate.hidden?C&&(se(),A(C,1,1,()=>{C=null}),oe()):C?(C.p(N,P),P[0]&1&&E(C,1)):(C=n_(N),C.c(),E(C,1),C.m(a,f)),N[0].meta.resetPasswordTemplate.hidden?M&&(se(),A(M,1,1,()=>{M=null}),oe()):M?(M.p(N,P),P[0]&1&&E(M,1)):(M=i_(N),M.c(),E(M,1),M.m(a,u)),N[0].meta.confirmEmailChangeTemplate.hidden?D&&(se(),A(D,1,1,()=>{D=null}),oe()):D?(D.p(N,P),P[0]&1&&E(D,1)):(D=l_(N),D.c(),E(D,1),D.m(a,null));const W={};P[0]&1|P[1]&24&&(W.$$scope={dirty:P,ctx:N}),h.$set(W),N[0].smtp.enabled?I?(I.p(N,P),P[0]&1&&E(I,1)):(I=s_(N),I.c(),E(I,1),I.m(g.parentNode,g)):I&&(se(),A(I,1,1,()=>{I=null}),oe()),R===(R=L(N))&&F?F.p(N,P):(F.d(1),F=R(N),F&&(F.c(),F.m(y,null)))},i(N){$||(E(i.$$.fragment,N),E(o.$$.fragment,N),E(C),E(M),E(D),E(h.$$.fragment,N),E(I),$=!0)},o(N){A(i.$$.fragment,N),A(o.$$.fragment,N),A(C),A(M),A(D),A(h.$$.fragment,N),A(I),$=!1},d(N){N&&(v(e),v(r),v(a),v(c),v(d),v(m),v(_),v(g),v(y)),V(i),V(o),C&&C.d(),M&&M.d(),D&&D.d(),V(h,N),I&&I.d(N),F.d()}}}function mI(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function hI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Sender name"),l=O(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","text"),p(s,"id",o=n[34]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].meta.senderName),r||(a=K(s,"input",n[13]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].meta.senderName&&ae(s,f[0].meta.senderName)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function _I(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Sender address"),l=O(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","email"),p(s,"id",o=n[34]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].meta.senderAddress),r||(a=K(s,"input",n[14]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].meta.senderAddress&&ae(s,f[0].meta.senderAddress)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function n_(n){let e,t,i;function l(o){n[15](o)}let s={single:!0,key:"meta.verificationTemplate",title:'Default "Verification" email template'};return n[0].meta.verificationTemplate!==void 0&&(s.config=n[0].meta.verificationTemplate),e=new Za({props:s}),ee.push(()=>be(e,"config",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&1&&(t=!0,a.config=o[0].meta.verificationTemplate,ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function i_(n){let e,t,i;function l(o){n[16](o)}let s={single:!0,key:"meta.resetPasswordTemplate",title:'Default "Password reset" email template'};return n[0].meta.resetPasswordTemplate!==void 0&&(s.config=n[0].meta.resetPasswordTemplate),e=new Za({props:s}),ee.push(()=>be(e,"config",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&1&&(t=!0,a.config=o[0].meta.resetPasswordTemplate,ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function l_(n){let e,t,i;function l(o){n[17](o)}let s={single:!0,key:"meta.confirmEmailChangeTemplate",title:'Default "Confirm email change" email template'};return n[0].meta.confirmEmailChangeTemplate!==void 0&&(s.config=n[0].meta.confirmEmailChangeTemplate),e=new Za({props:s}),ee.push(()=>be(e,"config",l)),{c(){B(e.$$.fragment)},m(o,r){z(e,o,r),i=!0},p(o,r){const a={};!t&&r[0]&1&&(t=!0,a.config=o[0].meta.confirmEmailChangeTemplate,ke(()=>t=!1)),e.$set(a)},i(o){i||(E(e.$$.fragment,o),i=!0)},o(o){A(e.$$.fragment,o),i=!1},d(o){V(e,o)}}}function gI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.innerHTML="Use SMTP mail server (recommended)",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[34]),e.required=!0,p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[34])},m(c,d){w(c,e,d),e.checked=n[0].smtp.enabled,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[18]),we(Le.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"}))],f=!0)},p(c,d){d[1]&8&&t!==(t=c[34])&&p(e,"id",t),d[0]&1&&(e.checked=c[0].smtp.enabled),d[1]&8&&a!==(a=c[34])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function s_(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$;l=new pe({props:{class:"form-field required",name:"smtp.host",$$slots:{default:[bI,({uniqueId:L})=>({34:L}),({uniqueId:L})=>[0,L?8:0]]},$$scope:{ctx:n}}}),r=new pe({props:{class:"form-field required",name:"smtp.port",$$slots:{default:[kI,({uniqueId:L})=>({34:L}),({uniqueId:L})=>[0,L?8:0]]},$$scope:{ctx:n}}}),u=new pe({props:{class:"form-field",name:"smtp.username",$$slots:{default:[yI,({uniqueId:L})=>({34:L}),({uniqueId:L})=>[0,L?8:0]]},$$scope:{ctx:n}}}),m=new pe({props:{class:"form-field",name:"smtp.password",$$slots:{default:[vI,({uniqueId:L})=>({34:L}),({uniqueId:L})=>[0,L?8:0]]},$$scope:{ctx:n}}});function C(L,R){return L[4]?SI:wI}let M=C(n),D=M(n),I=n[4]&&o_(n);return{c(){e=b("div"),t=b("div"),i=b("div"),B(l.$$.fragment),s=O(),o=b("div"),B(r.$$.fragment),a=O(),f=b("div"),B(u.$$.fragment),c=O(),d=b("div"),B(m.$$.fragment),h=O(),_=b("button"),D.c(),g=O(),I&&I.c(),p(i,"class","col-lg-4"),p(o,"class","col-lg-2"),p(f,"class","col-lg-3"),p(d,"class","col-lg-3"),p(t,"class","grid"),p(_,"type","button"),p(_,"class","btn btn-sm btn-secondary m-t-sm m-b-sm")},m(L,R){w(L,e,R),k(e,t),k(t,i),z(l,i,null),k(t,s),k(t,o),z(r,o,null),k(t,a),k(t,f),z(u,f,null),k(t,c),k(t,d),z(m,d,null),k(e,h),k(e,_),D.m(_,null),k(e,g),I&&I.m(e,null),S=!0,T||($=K(_,"click",Be(n[23])),T=!0)},p(L,R){const F={};R[0]&1|R[1]&24&&(F.$$scope={dirty:R,ctx:L}),l.$set(F);const N={};R[0]&1|R[1]&24&&(N.$$scope={dirty:R,ctx:L}),r.$set(N);const P={};R[0]&1|R[1]&24&&(P.$$scope={dirty:R,ctx:L}),u.$set(P);const j={};R[0]&1|R[1]&24&&(j.$$scope={dirty:R,ctx:L}),m.$set(j),M!==(M=C(L))&&(D.d(1),D=M(L),D&&(D.c(),D.m(_,null))),L[4]?I?(I.p(L,R),R[0]&16&&E(I,1)):(I=o_(L),I.c(),E(I,1),I.m(e,null)):I&&(se(),A(I,1,1,()=>{I=null}),oe())},i(L){S||(E(l.$$.fragment,L),E(r.$$.fragment,L),E(u.$$.fragment,L),E(m.$$.fragment,L),E(I),L&&Ye(()=>{S&&(y||(y=Ne(e,et,{duration:150},!0)),y.run(1))}),S=!0)},o(L){A(l.$$.fragment,L),A(r.$$.fragment,L),A(u.$$.fragment,L),A(m.$$.fragment,L),A(I),L&&(y||(y=Ne(e,et,{duration:150},!1)),y.run(0)),S=!1},d(L){L&&v(e),V(l),V(r),V(u),V(m),D.d(),I&&I.d(),L&&y&&y.end(),T=!1,$()}}}function bI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("SMTP server host"),l=O(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","text"),p(s,"id",o=n[34]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].smtp.host),r||(a=K(s,"input",n[19]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].smtp.host&&ae(s,f[0].smtp.host)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function kI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Port"),l=O(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","number"),p(s,"id",o=n[34]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].smtp.port),r||(a=K(s,"input",n[20]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&<(s.value)!==f[0].smtp.port&&ae(s,f[0].smtp.port)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function yI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Username"),l=O(),s=b("input"),p(e,"for",i=n[34]),p(s,"type","text"),p(s,"id",o=n[34])},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].smtp.username),r||(a=K(s,"input",n[21]),r=!0)},p(f,u){u[1]&8&&i!==(i=f[34])&&p(e,"for",i),u[1]&8&&o!==(o=f[34])&&p(s,"id",o),u[0]&1&&s.value!==f[0].smtp.username&&ae(s,f[0].smtp.username)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function vI(n){let e,t,i,l,s,o,r;function a(u){n[22](u)}let f={id:n[34]};return n[0].smtp.password!==void 0&&(f.value=n[0].smtp.password),s=new Ja({props:f}),ee.push(()=>be(s,"value",a)),{c(){e=b("label"),t=Y("Password"),l=O(),B(s.$$.fragment),p(e,"for",i=n[34])},m(u,c){w(u,e,c),k(e,t),w(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c[1]&8&&i!==(i=u[34]))&&p(e,"for",i);const d={};c[1]&8&&(d.id=u[34]),!o&&c[0]&1&&(o=!0,d.value=u[0].smtp.password,ke(()=>o=!1)),s.$set(d)},i(u){r||(E(s.$$.fragment,u),r=!0)},o(u){A(s.$$.fragment,u),r=!1},d(u){u&&(v(e),v(l)),V(s,u)}}}function wI(n){let e,t,i;return{c(){e=b("span"),e.textContent="Show more options",t=O(),i=b("i"),p(e,"class","txt"),p(i,"class","ri-arrow-down-s-line")},m(l,s){w(l,e,s),w(l,t,s),w(l,i,s)},d(l){l&&(v(e),v(t),v(i))}}}function SI(n){let e,t,i;return{c(){e=b("span"),e.textContent="Hide more options",t=O(),i=b("i"),p(e,"class","txt"),p(i,"class","ri-arrow-up-s-line")},m(l,s){w(l,e,s),w(l,t,s),w(l,i,s)},d(l){l&&(v(e),v(t),v(i))}}}function o_(n){let e,t,i,l,s,o,r,a,f,u,c,d,m;return i=new pe({props:{class:"form-field",name:"smtp.tls",$$slots:{default:[$I,({uniqueId:h})=>({34:h}),({uniqueId:h})=>[0,h?8:0]]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field",name:"smtp.authMethod",$$slots:{default:[TI,({uniqueId:h})=>({34:h}),({uniqueId:h})=>[0,h?8:0]]},$$scope:{ctx:n}}}),f=new pe({props:{class:"form-field",name:"smtp.localName",$$slots:{default:[CI,({uniqueId:h})=>({34:h}),({uniqueId:h})=>[0,h?8:0]]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),r=O(),a=b("div"),B(f.$$.fragment),u=O(),c=b("div"),p(t,"class","col-lg-3"),p(s,"class","col-lg-3"),p(a,"class","col-lg-6"),p(c,"class","col-lg-12"),p(e,"class","grid")},m(h,_){w(h,e,_),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),k(e,r),k(e,a),z(f,a,null),k(e,u),k(e,c),m=!0},p(h,_){const g={};_[0]&1|_[1]&24&&(g.$$scope={dirty:_,ctx:h}),i.$set(g);const y={};_[0]&1|_[1]&24&&(y.$$scope={dirty:_,ctx:h}),o.$set(y);const S={};_[0]&1|_[1]&24&&(S.$$scope={dirty:_,ctx:h}),f.$set(S)},i(h){m||(E(i.$$.fragment,h),E(o.$$.fragment,h),E(f.$$.fragment,h),h&&Ye(()=>{m&&(d||(d=Ne(e,et,{duration:150},!0)),d.run(1))}),m=!0)},o(h){A(i.$$.fragment,h),A(o.$$.fragment,h),A(f.$$.fragment,h),h&&(d||(d=Ne(e,et,{duration:150},!1)),d.run(0)),m=!1},d(h){h&&v(e),V(i),V(o),V(f),h&&d&&d.end()}}}function $I(n){let e,t,i,l,s,o,r;function a(u){n[24](u)}let f={id:n[34],items:n[7]};return n[0].smtp.tls!==void 0&&(f.keyOfSelected=n[0].smtp.tls),s=new hi({props:f}),ee.push(()=>be(s,"keyOfSelected",a)),{c(){e=b("label"),t=Y("TLS encryption"),l=O(),B(s.$$.fragment),p(e,"for",i=n[34])},m(u,c){w(u,e,c),k(e,t),w(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c[1]&8&&i!==(i=u[34]))&&p(e,"for",i);const d={};c[1]&8&&(d.id=u[34]),!o&&c[0]&1&&(o=!0,d.keyOfSelected=u[0].smtp.tls,ke(()=>o=!1)),s.$set(d)},i(u){r||(E(s.$$.fragment,u),r=!0)},o(u){A(s.$$.fragment,u),r=!1},d(u){u&&(v(e),v(l)),V(s,u)}}}function TI(n){let e,t,i,l,s,o,r;function a(u){n[25](u)}let f={id:n[34],items:n[8]};return n[0].smtp.authMethod!==void 0&&(f.keyOfSelected=n[0].smtp.authMethod),s=new hi({props:f}),ee.push(()=>be(s,"keyOfSelected",a)),{c(){e=b("label"),t=Y("AUTH method"),l=O(),B(s.$$.fragment),p(e,"for",i=n[34])},m(u,c){w(u,e,c),k(e,t),w(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c[1]&8&&i!==(i=u[34]))&&p(e,"for",i);const d={};c[1]&8&&(d.id=u[34]),!o&&c[0]&1&&(o=!0,d.keyOfSelected=u[0].smtp.authMethod,ke(()=>o=!1)),s.$set(d)},i(u){r||(E(s.$$.fragment,u),r=!0)},o(u){A(s.$$.fragment,u),r=!1},d(u){u&&(v(e),v(l)),V(s,u)}}}function CI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("label"),t=b("span"),t.textContent="EHLO/HELO domain",i=O(),l=b("i"),o=O(),r=b("input"),p(t,"class","txt"),p(l,"class","ri-information-line link-hint"),p(e,"for",s=n[34]),p(r,"type","text"),p(r,"id",a=n[34]),p(r,"placeholder","Default to localhost")},m(c,d){w(c,e,d),k(e,t),k(e,i),k(e,l),w(c,o,d),w(c,r,d),ae(r,n[0].smtp.localName),f||(u=[we(Le.call(null,l,{text:"Some SMTP servers, such as the Gmail SMTP-relay, requires a proper domain name in the inital EHLO/HELO exchange and will reject attempts to use localhost.",position:"top"})),K(r,"input",n[26])],f=!0)},p(c,d){d[1]&8&&s!==(s=c[34])&&p(e,"for",s),d[1]&8&&a!==(a=c[34])&&p(r,"id",a),d[0]&1&&r.value!==c[0].smtp.localName&&ae(r,c[0].smtp.localName)},d(c){c&&(v(e),v(o),v(r)),f=!1,ve(u)}}}function OI(n){let e,t,i;return{c(){e=b("button"),e.innerHTML=' Send test email',p(e,"type","button"),p(e,"class","btn btn-expanded btn-outline")},m(l,s){w(l,e,s),t||(i=K(e,"click",n[29]),t=!0)},p:Q,d(l){l&&v(e),t=!1,i()}}}function MI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("button"),t=b("span"),t.textContent="Cancel",i=O(),l=b("button"),s=b("span"),s.textContent="Save changes",p(t,"class","txt"),p(e,"type","button"),p(e,"class","btn btn-transparent btn-hint"),e.disabled=n[3],p(s,"class","txt"),p(l,"type","submit"),p(l,"class","btn btn-expanded"),l.disabled=o=!n[5]||n[3],x(l,"btn-loading",n[3])},m(f,u){w(f,e,u),k(e,t),w(f,i,u),w(f,l,u),k(l,s),r||(a=[K(e,"click",n[27]),K(l,"click",n[28])],r=!0)},p(f,u){u[0]&8&&(e.disabled=f[3]),u[0]&40&&o!==(o=!f[5]||f[3])&&(l.disabled=o),u[0]&8&&x(l,"btn-loading",f[3])},d(f){f&&(v(e),v(i),v(l)),r=!1,ve(a)}}}function DI(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g;const y=[mI,pI],S=[];function T($,C){return $[2]?0:1}return d=T(n),m=S[d]=y[d](n),{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=O(),s=b("div"),o=Y(n[6]),r=O(),a=b("div"),f=b("form"),u=b("div"),u.innerHTML="

    Configure common settings for sending emails.

    ",c=O(),m.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(u,"class","content txt-xl m-b-base"),p(f,"class","panel"),p(f,"autocomplete","off"),p(a,"class","wrapper")},m($,C){w($,e,C),k(e,t),k(t,i),k(t,l),k(t,s),k(s,o),w($,r,C),w($,a,C),k(a,f),k(f,u),k(f,c),S[d].m(f,null),h=!0,_||(g=K(f,"submit",Be(n[30])),_=!0)},p($,C){(!h||C[0]&64)&&re(o,$[6]);let M=d;d=T($),d===M?S[d].p($,C):(se(),A(S[M],1,1,()=>{S[M]=null}),oe(),m=S[d],m?m.p($,C):(m=S[d]=y[d]($),m.c()),E(m,1),m.m(f,null))},i($){h||(E(m),h=!0)},o($){A(m),h=!1},d($){$&&(v(e),v(r),v(a)),S[d].d(),_=!1,g()}}}function EI(n){let e,t,i,l,s,o;e=new _i({}),i=new kn({props:{$$slots:{default:[DI]},$$scope:{ctx:n}}});let r={};return s=new dI({props:r}),n[31](s),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment),l=O(),B(s.$$.fragment)},m(a,f){z(e,a,f),w(a,t,f),z(i,a,f),w(a,l,f),z(s,a,f),o=!0},p(a,f){const u={};f[0]&127|f[1]&16&&(u.$$scope={dirty:f,ctx:a}),i.$set(u);const c={};s.$set(c)},i(a){o||(E(e.$$.fragment,a),E(i.$$.fragment,a),E(s.$$.fragment,a),o=!0)},o(a){A(e.$$.fragment,a),A(i.$$.fragment,a),A(s.$$.fragment,a),o=!1},d(a){a&&(v(t),v(l)),V(e,a),V(i,a),n[31](null),V(s,a)}}}function II(n,e,t){let i,l,s;Ue(n,Dt,ne=>t(6,s=ne));const o=[{label:"Auto (StartTLS)",value:!1},{label:"Always",value:!0}],r=[{label:"PLAIN (default)",value:"PLAIN"},{label:"LOGIN",value:"LOGIN"}];xt(Dt,s="Mail settings",s);let a,f={},u={},c=!1,d=!1,m=!1;h();async function h(){t(2,c=!0);try{const ne=await fe.settings.getAll()||{};g(ne)}catch(ne){fe.error(ne)}t(2,c=!1)}async function _(){if(!(d||!l)){t(3,d=!0);try{const ne=await fe.settings.update(H.filterRedactedProps(u));g(ne),Jt({}),At("Successfully saved mail settings.")}catch(ne){fe.error(ne)}t(3,d=!1)}}function g(ne={}){t(0,u={meta:(ne==null?void 0:ne.meta)||{},smtp:(ne==null?void 0:ne.smtp)||{}}),u.smtp.authMethod||t(0,u.smtp.authMethod=r[0].value,u),t(11,f=JSON.parse(JSON.stringify(u)))}function y(){t(0,u=JSON.parse(JSON.stringify(f||{})))}function S(){u.meta.senderName=this.value,t(0,u)}function T(){u.meta.senderAddress=this.value,t(0,u)}function $(ne){n.$$.not_equal(u.meta.verificationTemplate,ne)&&(u.meta.verificationTemplate=ne,t(0,u))}function C(ne){n.$$.not_equal(u.meta.resetPasswordTemplate,ne)&&(u.meta.resetPasswordTemplate=ne,t(0,u))}function M(ne){n.$$.not_equal(u.meta.confirmEmailChangeTemplate,ne)&&(u.meta.confirmEmailChangeTemplate=ne,t(0,u))}function D(){u.smtp.enabled=this.checked,t(0,u)}function I(){u.smtp.host=this.value,t(0,u)}function L(){u.smtp.port=lt(this.value),t(0,u)}function R(){u.smtp.username=this.value,t(0,u)}function F(ne){n.$$.not_equal(u.smtp.password,ne)&&(u.smtp.password=ne,t(0,u))}const N=()=>{t(4,m=!m)};function P(ne){n.$$.not_equal(u.smtp.tls,ne)&&(u.smtp.tls=ne,t(0,u))}function j(ne){n.$$.not_equal(u.smtp.authMethod,ne)&&(u.smtp.authMethod=ne,t(0,u))}function q(){u.smtp.localName=this.value,t(0,u)}const W=()=>y(),G=()=>_(),U=()=>a==null?void 0:a.show(),Z=()=>_();function le(ne){ee[ne?"unshift":"push"](()=>{a=ne,t(1,a)})}return n.$$.update=()=>{n.$$.dirty[0]&2048&&t(12,i=JSON.stringify(f)),n.$$.dirty[0]&4097&&t(5,l=i!=JSON.stringify(u))},[u,a,c,d,m,l,s,o,r,_,y,f,i,S,T,$,C,M,D,I,L,R,F,N,P,j,q,W,G,U,Z,le]}class AI extends ge{constructor(e){super(),_e(this,e,II,EI,me,{},null,[-1,-1])}}const LI=n=>({isTesting:n&4,testError:n&2,enabled:n&1}),r_=n=>({isTesting:n[2],testError:n[1],enabled:n[0].enabled});function NI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("input"),i=O(),l=b("label"),s=Y(n[4]),p(e,"type","checkbox"),p(e,"id",t=n[20]),e.required=!0,p(l,"for",o=n[20])},m(f,u){w(f,e,u),e.checked=n[0].enabled,w(f,i,u),w(f,l,u),k(l,s),r||(a=K(e,"change",n[8]),r=!0)},p(f,u){u&1048576&&t!==(t=f[20])&&p(e,"id",t),u&1&&(e.checked=f[0].enabled),u&16&&re(s,f[4]),u&1048576&&o!==(o=f[20])&&p(l,"for",o)},d(f){f&&(v(e),v(i),v(l)),r=!1,a()}}}function a_(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$,C,M;return i=new pe({props:{class:"form-field required",name:n[3]+".endpoint",$$slots:{default:[PI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),o=new pe({props:{class:"form-field required",name:n[3]+".bucket",$$slots:{default:[FI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),f=new pe({props:{class:"form-field required",name:n[3]+".region",$$slots:{default:[RI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),d=new pe({props:{class:"form-field required",name:n[3]+".accessKey",$$slots:{default:[qI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),_=new pe({props:{class:"form-field required",name:n[3]+".secret",$$slots:{default:[jI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),S=new pe({props:{class:"form-field",name:n[3]+".forcePathStyle",$$slots:{default:[HI,({uniqueId:D})=>({20:D}),({uniqueId:D})=>D?1048576:0]},$$scope:{ctx:n}}}),{c(){e=b("div"),t=b("div"),B(i.$$.fragment),l=O(),s=b("div"),B(o.$$.fragment),r=O(),a=b("div"),B(f.$$.fragment),u=O(),c=b("div"),B(d.$$.fragment),m=O(),h=b("div"),B(_.$$.fragment),g=O(),y=b("div"),B(S.$$.fragment),T=O(),$=b("div"),p(t,"class","col-lg-6"),p(s,"class","col-lg-3"),p(a,"class","col-lg-3"),p(c,"class","col-lg-6"),p(h,"class","col-lg-6"),p(y,"class","col-lg-12"),p($,"class","col-lg-12"),p(e,"class","grid")},m(D,I){w(D,e,I),k(e,t),z(i,t,null),k(e,l),k(e,s),z(o,s,null),k(e,r),k(e,a),z(f,a,null),k(e,u),k(e,c),z(d,c,null),k(e,m),k(e,h),z(_,h,null),k(e,g),k(e,y),z(S,y,null),k(e,T),k(e,$),M=!0},p(D,I){const L={};I&8&&(L.name=D[3]+".endpoint"),I&1081345&&(L.$$scope={dirty:I,ctx:D}),i.$set(L);const R={};I&8&&(R.name=D[3]+".bucket"),I&1081345&&(R.$$scope={dirty:I,ctx:D}),o.$set(R);const F={};I&8&&(F.name=D[3]+".region"),I&1081345&&(F.$$scope={dirty:I,ctx:D}),f.$set(F);const N={};I&8&&(N.name=D[3]+".accessKey"),I&1081345&&(N.$$scope={dirty:I,ctx:D}),d.$set(N);const P={};I&8&&(P.name=D[3]+".secret"),I&1081345&&(P.$$scope={dirty:I,ctx:D}),_.$set(P);const j={};I&8&&(j.name=D[3]+".forcePathStyle"),I&1081345&&(j.$$scope={dirty:I,ctx:D}),S.$set(j)},i(D){M||(E(i.$$.fragment,D),E(o.$$.fragment,D),E(f.$$.fragment,D),E(d.$$.fragment,D),E(_.$$.fragment,D),E(S.$$.fragment,D),D&&Ye(()=>{M&&(C||(C=Ne(e,et,{duration:150},!0)),C.run(1))}),M=!0)},o(D){A(i.$$.fragment,D),A(o.$$.fragment,D),A(f.$$.fragment,D),A(d.$$.fragment,D),A(_.$$.fragment,D),A(S.$$.fragment,D),D&&(C||(C=Ne(e,et,{duration:150},!1)),C.run(0)),M=!1},d(D){D&&v(e),V(i),V(o),V(f),V(d),V(_),V(S),D&&C&&C.end()}}}function PI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Endpoint"),l=O(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].endpoint),r||(a=K(s,"input",n[9]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].endpoint&&ae(s,f[0].endpoint)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function FI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Bucket"),l=O(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].bucket),r||(a=K(s,"input",n[10]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].bucket&&ae(s,f[0].bucket)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function RI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Region"),l=O(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].region),r||(a=K(s,"input",n[11]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].region&&ae(s,f[0].region)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function qI(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Access key"),l=O(),s=b("input"),p(e,"for",i=n[20]),p(s,"type","text"),p(s,"id",o=n[20]),s.required=!0},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[0].accessKey),r||(a=K(s,"input",n[12]),r=!0)},p(f,u){u&1048576&&i!==(i=f[20])&&p(e,"for",i),u&1048576&&o!==(o=f[20])&&p(s,"id",o),u&1&&s.value!==f[0].accessKey&&ae(s,f[0].accessKey)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function jI(n){let e,t,i,l,s,o,r;function a(u){n[13](u)}let f={id:n[20],required:!0};return n[0].secret!==void 0&&(f.value=n[0].secret),s=new Ja({props:f}),ee.push(()=>be(s,"value",a)),{c(){e=b("label"),t=Y("Secret"),l=O(),B(s.$$.fragment),p(e,"for",i=n[20])},m(u,c){w(u,e,c),k(e,t),w(u,l,c),z(s,u,c),r=!0},p(u,c){(!r||c&1048576&&i!==(i=u[20]))&&p(e,"for",i);const d={};c&1048576&&(d.id=u[20]),!o&&c&1&&(o=!0,d.value=u[0].secret,ke(()=>o=!1)),s.$set(d)},i(u){r||(E(s.$$.fragment,u),r=!0)},o(u){A(s.$$.fragment,u),r=!1},d(u){u&&(v(e),v(l)),V(s,u)}}}function HI(n){let e,t,i,l,s,o,r,a,f,u;return{c(){e=b("input"),i=O(),l=b("label"),s=b("span"),s.textContent="Force path-style addressing",o=O(),r=b("i"),p(e,"type","checkbox"),p(e,"id",t=n[20]),p(s,"class","txt"),p(r,"class","ri-information-line link-hint"),p(l,"for",a=n[20])},m(c,d){w(c,e,d),e.checked=n[0].forcePathStyle,w(c,i,d),w(c,l,d),k(l,s),k(l,o),k(l,r),f||(u=[K(e,"change",n[14]),we(Le.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"}))],f=!0)},p(c,d){d&1048576&&t!==(t=c[20])&&p(e,"id",t),d&1&&(e.checked=c[0].forcePathStyle),d&1048576&&a!==(a=c[20])&&p(l,"for",a)},d(c){c&&(v(e),v(i),v(l)),f=!1,ve(u)}}}function zI(n){let e,t,i,l,s;e=new pe({props:{class:"form-field form-field-toggle",$$slots:{default:[NI,({uniqueId:f})=>({20:f}),({uniqueId:f})=>f?1048576:0]},$$scope:{ctx:n}}});const o=n[7].default,r=vt(o,n,n[15],r_);let a=n[0].enabled&&a_(n);return{c(){B(e.$$.fragment),t=O(),r&&r.c(),i=O(),a&&a.c(),l=ye()},m(f,u){z(e,f,u),w(f,t,u),r&&r.m(f,u),w(f,i,u),a&&a.m(f,u),w(f,l,u),s=!0},p(f,[u]){const c={};u&1081361&&(c.$$scope={dirty:u,ctx:f}),e.$set(c),r&&r.p&&(!s||u&32775)&&St(r,o,f,f[15],s?wt(o,f[15],u,LI):$t(f[15]),r_),f[0].enabled?a?(a.p(f,u),u&1&&E(a,1)):(a=a_(f),a.c(),E(a,1),a.m(l.parentNode,l)):a&&(se(),A(a,1,1,()=>{a=null}),oe())},i(f){s||(E(e.$$.fragment,f),E(r,f),E(a),s=!0)},o(f){A(e.$$.fragment,f),A(r,f),A(a),s=!1},d(f){f&&(v(t),v(i),v(l)),V(e,f),r&&r.d(f),a&&a.d(f)}}}const Pr="s3_test_request";function VI(n,e,t){let{$$slots:i={},$$scope:l}=e,{originalConfig:s={}}=e,{config:o={}}=e,{configKey:r="s3"}=e,{toggleLabel:a="Enable S3"}=e,{testFilesystem:f="storage"}=e,{testError:u=null}=e,{isTesting:c=!1}=e,d=null,m=null;function h(D){t(2,c=!0),clearTimeout(m),m=setTimeout(()=>{_()},D)}async function _(){if(t(1,u=null),!o.enabled)return t(2,c=!1),u;fe.cancelRequest(Pr),clearTimeout(d),d=setTimeout(()=>{fe.cancelRequest(Pr),t(1,u=new Error("S3 test connection timeout.")),t(2,c=!1)},3e4),t(2,c=!0);let D;try{await fe.settings.testS3(f,{$cancelKey:Pr})}catch(I){D=I}return D!=null&&D.isAbort||(t(1,u=D),t(2,c=!1),clearTimeout(d)),u}jt(()=>()=>{clearTimeout(d),clearTimeout(m)});function g(){o.enabled=this.checked,t(0,o)}function y(){o.endpoint=this.value,t(0,o)}function S(){o.bucket=this.value,t(0,o)}function T(){o.region=this.value,t(0,o)}function $(){o.accessKey=this.value,t(0,o)}function C(D){n.$$.not_equal(o.secret,D)&&(o.secret=D,t(0,o))}function M(){o.forcePathStyle=this.checked,t(0,o)}return n.$$set=D=>{"originalConfig"in D&&t(5,s=D.originalConfig),"config"in D&&t(0,o=D.config),"configKey"in D&&t(3,r=D.configKey),"toggleLabel"in D&&t(4,a=D.toggleLabel),"testFilesystem"in D&&t(6,f=D.testFilesystem),"testError"in D&&t(1,u=D.testError),"isTesting"in D&&t(2,c=D.isTesting),"$$scope"in D&&t(15,l=D.$$scope)},n.$$.update=()=>{n.$$.dirty&32&&s!=null&&s.enabled&&h(100),n.$$.dirty&9&&(o.enabled||li(r))},[o,u,c,r,a,s,f,i,g,y,S,T,$,C,M,l]}class Gb extends ge{constructor(e){super(),_e(this,e,VI,zI,me,{originalConfig:5,config:0,configKey:3,toggleLabel:4,testFilesystem:6,testError:1,isTesting:2})}}function BI(n){var D;let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g;function y(I){n[11](I)}function S(I){n[12](I)}function T(I){n[13](I)}let $={toggleLabel:"Use S3 storage",originalConfig:n[0].s3,$$slots:{default:[WI]},$$scope:{ctx:n}};n[1].s3!==void 0&&($.config=n[1].s3),n[4]!==void 0&&($.isTesting=n[4]),n[5]!==void 0&&($.testError=n[5]),e=new Gb({props:$}),ee.push(()=>be(e,"config",y)),ee.push(()=>be(e,"isTesting",S)),ee.push(()=>be(e,"testError",T));let C=((D=n[1].s3)==null?void 0:D.enabled)&&!n[6]&&!n[3]&&u_(n),M=n[6]&&c_(n);return{c(){B(e.$$.fragment),s=O(),o=b("div"),r=b("div"),a=O(),C&&C.c(),f=O(),M&&M.c(),u=O(),c=b("button"),d=b("span"),d.textContent="Save changes",p(r,"class","flex-fill"),p(d,"class","txt"),p(c,"type","submit"),p(c,"class","btn btn-expanded"),c.disabled=m=!n[6]||n[3],x(c,"btn-loading",n[3]),p(o,"class","flex")},m(I,L){z(e,I,L),w(I,s,L),w(I,o,L),k(o,r),k(o,a),C&&C.m(o,null),k(o,f),M&&M.m(o,null),k(o,u),k(o,c),k(c,d),h=!0,_||(g=K(c,"click",n[15]),_=!0)},p(I,L){var F;const R={};L&1&&(R.originalConfig=I[0].s3),L&524291&&(R.$$scope={dirty:L,ctx:I}),!t&&L&2&&(t=!0,R.config=I[1].s3,ke(()=>t=!1)),!i&&L&16&&(i=!0,R.isTesting=I[4],ke(()=>i=!1)),!l&&L&32&&(l=!0,R.testError=I[5],ke(()=>l=!1)),e.$set(R),(F=I[1].s3)!=null&&F.enabled&&!I[6]&&!I[3]?C?C.p(I,L):(C=u_(I),C.c(),C.m(o,f)):C&&(C.d(1),C=null),I[6]?M?M.p(I,L):(M=c_(I),M.c(),M.m(o,u)):M&&(M.d(1),M=null),(!h||L&72&&m!==(m=!I[6]||I[3]))&&(c.disabled=m),(!h||L&8)&&x(c,"btn-loading",I[3])},i(I){h||(E(e.$$.fragment,I),h=!0)},o(I){A(e.$$.fragment,I),h=!1},d(I){I&&(v(s),v(o)),V(e,I),C&&C.d(),M&&M.d(),_=!1,g()}}}function UI(n){let e;return{c(){e=b("div"),p(e,"class","loader")},m(t,i){w(t,e,i)},p:Q,i:Q,o:Q,d(t){t&&v(e)}}}function f_(n){var L;let e,t,i,l,s,o,r,a=(L=n[0].s3)!=null&&L.enabled?"S3 storage":"local file system",f,u,c,d=n[1].s3.enabled?"S3 storage":"local file system",m,h,_,g,y,S,T,$,C,M,D,I;return{c(){e=b("div"),t=b("div"),i=b("div"),i.innerHTML='',l=O(),s=b("div"),o=Y(`If you have existing uploaded files, you'll have to migrate them manually from the `),r=b("strong"),f=Y(a),u=Y(` to the @@ -148,10 +148,10 @@ Also note that some OAuth2 providers (like Twitter), don't return an email and t @weekly @daily @midnight -@hourly`))],L=!0)},p(F,N){var j,q;(!I||N[1]&1&&i!==(i=F[31]))&&p(e,"for",i),(!I||N[1]&1&&o!==(o=F[31]))&&p(s,"id",o),(!I||N[0]&1&&r!==(r=!((q=(j=F[0])==null?void 0:j.backups)!=null&&q.cron)))&&(s.autofocus=r),N[0]&2&&s.value!==F[1].backups.cron&&ae(s,F[1].backups.cron);const P={};N[0]&2|N[1]&2&&(P.$$scope={dirty:N,ctx:F}),_.$set(P)},i(F){I||(E(_.$$.fragment,F),I=!0)},o(F){A(_.$$.fragment,F),I=!1},d(F){F&&(v(e),v(l),v(s),v(a),v(f),v(g),v(y)),V(_),L=!1,ve(R)}}}function DL(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Max @auto backups to keep"),l=O(),s=b("input"),p(e,"for",i=n[31]),p(s,"type","number"),p(s,"id",o=n[31]),p(s,"min","1")},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[1].backups.cronMaxKeep),r||(a=K(s,"input",n[23]),r=!0)},p(f,u){u[1]&1&&i!==(i=f[31])&&p(e,"for",i),u[1]&1&&o!==(o=f[31])&&p(s,"id",o),u[0]&2&<(s.value)!==f[1].backups.cronMaxKeep&&ae(s,f[1].backups.cronMaxKeep)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function yg(n){let e;function t(s,o){return s[7]?AL:s[8]?IL:EL}let i=t(n),l=i(n);return{c(){l.c(),e=ye()},m(s,o){l.m(s,o),w(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&v(e),l.d(s)}}}function EL(n){let e;return{c(){e=b("div"),e.innerHTML=' S3 connected successfully',p(e,"class","label label-sm label-success entrance-right")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function IL(n){let e,t,i,l;return{c(){e=b("div"),e.innerHTML=' Failed to establish S3 connection',p(e,"class","label label-sm label-warning entrance-right")},m(s,o){var r;w(s,e,o),i||(l=we(t=Le.call(null,e,(r=n[8].data)==null?void 0:r.message)),i=!0)},p(s,o){var r;t&&Tt(t.update)&&o[0]&256&&t.update.call(null,(r=s[8].data)==null?void 0:r.message)},d(s){s&&v(e),i=!1,l()}}}function AL(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function vg(n){let e,t,i,l,s;return{c(){e=b("button"),t=b("span"),t.textContent="Reset",p(t,"class","txt"),p(e,"type","submit"),p(e,"class","btn btn-hint btn-transparent"),e.disabled=i=!n[9]||n[5]},m(o,r){w(o,e,r),k(e,t),l||(s=K(e,"click",n[27]),l=!0)},p(o,r){r[0]&544&&i!==(i=!o[9]||o[5])&&(e.disabled=i)},d(o){o&&v(e),l=!1,s()}}}function LL(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$,C,M,D,I,L,R,F;m=new Zo({props:{class:"btn-sm",tooltip:"Refresh"}}),m.$on("refresh",n[13]),_=new SL({props:{class:"btn-sm"}}),_.$on("success",n[13]);let N={};y=new yL({props:N}),n[15](y);function P(G,U){return G[6]?TL:$L}let j=P(n),q=j(n),W=n[6]&&!n[4]&&bg(n);return{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=O(),s=b("div"),o=Y(n[10]),r=O(),a=b("div"),f=b("div"),u=b("div"),c=b("span"),c.textContent="Backup and restore your PocketBase data",d=O(),B(m.$$.fragment),h=O(),B(_.$$.fragment),g=O(),B(y.$$.fragment),S=O(),T=b("hr"),$=O(),C=b("button"),M=b("span"),M.textContent="Backups options",D=O(),q.c(),I=O(),W&&W.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(c,"class","txt-xl"),p(u,"class","flex m-b-sm flex-gap-10"),p(M,"class","txt"),p(C,"type","button"),p(C,"class","btn btn-secondary"),C.disabled=n[4],x(C,"btn-loading",n[4]),p(f,"class","panel"),p(f,"autocomplete","off"),p(a,"class","wrapper")},m(G,U){w(G,e,U),k(e,t),k(t,i),k(t,l),k(t,s),k(s,o),w(G,r,U),w(G,a,U),k(a,f),k(f,u),k(u,c),k(u,d),z(m,u,null),k(u,h),z(_,u,null),k(f,g),z(y,f,null),k(f,S),k(f,T),k(f,$),k(f,C),k(C,M),k(C,D),q.m(C,null),k(f,I),W&&W.m(f,null),L=!0,R||(F=[K(C,"click",n[16]),K(f,"submit",Be(n[11]))],R=!0)},p(G,U){(!L||U[0]&1024)&&re(o,G[10]);const Z={};y.$set(Z),j!==(j=P(G))&&(q.d(1),q=j(G),q&&(q.c(),q.m(C,null))),(!L||U[0]&16)&&(C.disabled=G[4]),(!L||U[0]&16)&&x(C,"btn-loading",G[4]),G[6]&&!G[4]?W?(W.p(G,U),U[0]&80&&E(W,1)):(W=bg(G),W.c(),E(W,1),W.m(f,null)):W&&(se(),A(W,1,1,()=>{W=null}),oe())},i(G){L||(E(m.$$.fragment,G),E(_.$$.fragment,G),E(y.$$.fragment,G),E(W),L=!0)},o(G){A(m.$$.fragment,G),A(_.$$.fragment,G),A(y.$$.fragment,G),A(W),L=!1},d(G){G&&(v(e),v(r),v(a)),V(m),V(_),n[15](null),V(y),q.d(),W&&W.d(),R=!1,ve(F)}}}function NL(n){let e,t,i,l;return e=new _i({}),i=new kn({props:{$$slots:{default:[LL]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment)},m(s,o){z(e,s,o),w(s,t,o),z(i,s,o),l=!0},p(s,o){const r={};o[0]&2047|o[1]&2&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(E(e.$$.fragment,s),E(i.$$.fragment,s),l=!0)},o(s){A(e.$$.fragment,s),A(i.$$.fragment,s),l=!1},d(s){s&&v(t),V(e,s),V(i,s)}}}function PL(n,e,t){let i,l;Ue(n,Dt,U=>t(10,l=U)),xt(Dt,l="Backups",l);let s,o={},r={},a=!1,f=!1,u="",c=!1,d=!1,m=!1,h=null;_();async function _(){t(4,a=!0);try{const U=await fe.settings.getAll()||{};y(U)}catch(U){fe.error(U)}t(4,a=!1)}async function g(){if(!(f||!i)){t(5,f=!0);try{const U=await fe.settings.update(H.filterRedactedProps(r));await T(),y(U),At("Successfully saved application settings.")}catch(U){fe.error(U)}t(5,f=!1)}}function y(U={}){t(1,r={backups:(U==null?void 0:U.backups)||{}}),t(2,c=r.backups.cron!=""),t(0,o=JSON.parse(JSON.stringify(r)))}function S(){t(1,r=JSON.parse(JSON.stringify(o||{backups:{}}))),t(2,c=r.backups.cron!="")}async function T(){return s==null?void 0:s.loadBackups()}function $(U){ee[U?"unshift":"push"](()=>{s=U,t(3,s)})}const C=()=>t(6,d=!d);function M(){c=this.checked,t(2,c)}function D(){r.backups.cron=this.value,t(1,r),t(2,c)}const I=()=>{t(1,r.backups.cron="0 0 * * *",r)},L=()=>{t(1,r.backups.cron="0 0 * * 0",r)},R=()=>{t(1,r.backups.cron="0 0 * * 1,3",r)},F=()=>{t(1,r.backups.cron="0 0 1 * *",r)};function N(){r.backups.cronMaxKeep=lt(this.value),t(1,r),t(2,c)}function P(U){n.$$.not_equal(r.backups.s3,U)&&(r.backups.s3=U,t(1,r),t(2,c))}function j(U){m=U,t(7,m)}function q(U){h=U,t(8,h)}const W=()=>S(),G=()=>g();return n.$$.update=()=>{var U;n.$$.dirty[0]&1&&t(14,u=JSON.stringify(o)),n.$$.dirty[0]&6&&!c&&(U=r==null?void 0:r.backups)!=null&&U.cron&&(li("backups.cron"),t(1,r.backups.cron="",r)),n.$$.dirty[0]&16386&&t(9,i=u!=JSON.stringify(r))},[o,r,c,s,a,f,d,m,h,i,l,g,S,T,u,$,C,M,D,I,L,R,F,N,P,j,q,W,G]}class FL extends ge{constructor(e){super(),_e(this,e,PL,NL,me,{},null,[-1,-1])}}const Nt=[async n=>{const e=new URLSearchParams(window.location.search);return n.location!=="/"&&e.has("installer")?tl("/"):!0}],RL={"/login":It({component:FE,conditions:Nt.concat([n=>!fe.authStore.isValid]),userData:{showAppSidebar:!1}}),"/request-password-reset":It({asyncComponent:()=>nt(()=>import("./PageAdminRequestPasswordReset-iIhRW4sL.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt.concat([n=>!fe.authStore.isValid]),userData:{showAppSidebar:!1}}),"/confirm-password-reset/:token":It({asyncComponent:()=>nt(()=>import("./PageAdminConfirmPasswordReset-s0lBz81f.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt.concat([n=>!fe.authStore.isValid]),userData:{showAppSidebar:!1}}),"/collections":It({component:iE,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/logs":It({component:t$,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings":It({component:WE,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/admins":It({component:EE,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/mail":It({component:AI,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/storage":It({component:xI,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/auth-providers":It({component:_A,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/tokens":It({component:TA,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/export-collections":It({component:LA,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/import-collections":It({component:xA,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/backups":It({component:FL,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/users/confirm-password-reset/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmPasswordReset-q0EEKRPk.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/auth/confirm-password-reset/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmPasswordReset-q0EEKRPk.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/users/confirm-verification/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmVerification-hH1chnUs.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/auth/confirm-verification/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmVerification-hH1chnUs.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/users/confirm-email-change/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmEmailChange-TP7r406s.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/auth/confirm-email-change/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmEmailChange-TP7r406s.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/auth/oauth2-redirect-success":It({asyncComponent:()=>nt(()=>import("./PageOAuth2RedirectSuccess-N-jghl3J.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/auth/oauth2-redirect-failure":It({asyncComponent:()=>nt(()=>import("./PageOAuth2RedirectFailure-GoHDOiB1.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"*":It({component:Ov,userData:{showAppSidebar:!1}})};function qL(n,{from:e,to:t},i={}){const l=getComputedStyle(n),s=l.transform==="none"?"":l.transform,[o,r]=l.transformOrigin.split(" ").map(parseFloat),a=e.left+e.width*o/t.width-(t.left+o),f=e.top+e.height*r/t.height-(t.top+r),{delay:u=0,duration:c=m=>Math.sqrt(m)*120,easing:d=Jo}=i;return{delay:u,duration:Tt(c)?c(Math.sqrt(a*a+f*f)):c,easing:d,css:(m,h)=>{const _=h*a,g=h*f,y=m+h*e.width/t.width,S=m+h*e.height/t.height;return`transform: ${s} translate(${_}px, ${g}px) scale(${y}, ${S});`}}}function wg(n,e,t){const i=n.slice();return i[2]=e[t],i}function jL(n){let e;return{c(){e=b("i"),p(e,"class","ri-alert-line")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function HL(n){let e;return{c(){e=b("i"),p(e,"class","ri-error-warning-line")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function zL(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-line")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function VL(n){let e;return{c(){e=b("i"),p(e,"class","ri-information-line")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Sg(n,e){let t,i,l,s,o=e[2].message+"",r,a,f,u,c,d,m,h=Q,_,g,y;function S(M,D){return M[2].type==="info"?VL:M[2].type==="success"?zL:M[2].type==="warning"?HL:jL}let T=S(e),$=T(e);function C(){return e[1](e[2])}return{key:n,first:null,c(){t=b("div"),i=b("div"),$.c(),l=O(),s=b("div"),r=Y(o),a=O(),f=b("button"),f.innerHTML='',u=O(),p(i,"class","icon"),p(s,"class","content"),p(f,"type","button"),p(f,"class","close"),p(t,"class","alert txt-break"),x(t,"alert-info",e[2].type=="info"),x(t,"alert-success",e[2].type=="success"),x(t,"alert-danger",e[2].type=="error"),x(t,"alert-warning",e[2].type=="warning"),this.first=t},m(M,D){w(M,t,D),k(t,i),$.m(i,null),k(t,l),k(t,s),k(s,r),k(t,a),k(t,f),k(t,u),_=!0,g||(y=K(f,"click",Be(C)),g=!0)},p(M,D){e=M,T!==(T=S(e))&&($.d(1),$=T(e),$&&($.c(),$.m(i,null))),(!_||D&1)&&o!==(o=e[2].message+"")&&re(r,o),(!_||D&1)&&x(t,"alert-info",e[2].type=="info"),(!_||D&1)&&x(t,"alert-success",e[2].type=="success"),(!_||D&1)&&x(t,"alert-danger",e[2].type=="error"),(!_||D&1)&&x(t,"alert-warning",e[2].type=="warning")},r(){m=t.getBoundingClientRect()},f(){w0(t),h(),Lg(t,m)},a(){h(),h=v0(t,m,qL,{duration:150})},i(M){_||(M&&Ye(()=>{_&&(d&&d.end(1),c=Fg(t,et,{duration:150}),c.start())}),_=!0)},o(M){c&&c.invalidate(),M&&(d=ca(t,rs,{duration:150})),_=!1},d(M){M&&v(t),$.d(),M&&d&&d.end(),g=!1,y()}}}function BL(n){let e,t=[],i=new Map,l,s=de(n[0]);const o=r=>r[2].message;for(let r=0;rt(0,i=s)),[i,s=>Y1(s)]}class WL extends ge{constructor(e){super(),_e(this,e,UL,BL,me,{})}}function YL(n){var l;let e,t=((l=n[1])==null?void 0:l.text)+"",i;return{c(){e=b("h4"),i=Y(t),p(e,"class","block center txt-break"),p(e,"slot","header")},m(s,o){w(s,e,o),k(e,i)},p(s,o){var r;o&2&&t!==(t=((r=s[1])==null?void 0:r.text)+"")&&re(i,t)},d(s){s&&v(e)}}}function KL(n){let e,t,i,l,s,o,r;return{c(){e=b("button"),t=b("span"),t.textContent="No",i=O(),l=b("button"),s=b("span"),s.textContent="Yes",p(t,"class","txt"),e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-transparent btn-expanded-sm"),e.disabled=n[2],p(s,"class","txt"),p(l,"type","button"),p(l,"class","btn btn-danger btn-expanded"),l.disabled=n[2],x(l,"btn-loading",n[2])},m(a,f){w(a,e,f),k(e,t),w(a,i,f),w(a,l,f),k(l,s),e.focus(),o||(r=[K(e,"click",n[4]),K(l,"click",n[5])],o=!0)},p(a,f){f&4&&(e.disabled=a[2]),f&4&&(l.disabled=a[2]),f&4&&x(l,"btn-loading",a[2])},d(a){a&&(v(e),v(i),v(l)),o=!1,ve(r)}}}function JL(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:[KL],header:[YL]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[6](e),e.$on("hide",n[7]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&4&&(o.overlayClose=!l[2]),s&4&&(o.escClose=!l[2]),s&271&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[6](null),V(e,l)}}}function ZL(n,e,t){let i;Ue(n,Va,c=>t(1,i=c));let l,s=!1,o=!1;const r=()=>{t(3,o=!1),l==null||l.hide()},a=async()=>{i!=null&&i.yesCallback&&(t(2,s=!0),await Promise.resolve(i.yesCallback()),t(2,s=!1)),t(3,o=!0),l==null||l.hide()};function f(c){ee[c?"unshift":"push"](()=>{l=c,t(0,l)})}const u=async()=>{!o&&(i!=null&&i.noCallback)&&i.noCallback(),await Xt(),t(3,o=!1),zb()};return n.$$.update=()=>{n.$$.dirty&3&&i!=null&&i.text&&(t(3,o=!1),l==null||l.show())},[l,i,s,o,r,a,f,u]}class GL extends ge{constructor(e){super(),_e(this,e,ZL,JL,me,{})}}function $g(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S;return _=new On({props:{class:"dropdown dropdown-nowrap dropdown-upside dropdown-left",$$slots:{default:[XL]},$$scope:{ctx:n}}}),{c(){var T;e=b("aside"),t=b("a"),t.innerHTML='PocketBase logo',i=O(),l=b("nav"),s=b("a"),s.innerHTML='',o=O(),r=b("a"),r.innerHTML='',a=O(),f=b("a"),f.innerHTML='',u=O(),c=b("figure"),d=b("img"),h=O(),B(_.$$.fragment),p(t,"href","/"),p(t,"class","logo logo-sm"),p(s,"href","/collections"),p(s,"class","menu-item"),p(s,"aria-label","Collections"),p(r,"href","/logs"),p(r,"class","menu-item"),p(r,"aria-label","Logs"),p(f,"href","/settings"),p(f,"class","menu-item"),p(f,"aria-label","Settings"),p(l,"class","main-menu"),en(d.src,m="./images/avatars/avatar"+(((T=n[0])==null?void 0:T.avatar)||0)+".svg")||p(d,"src",m),p(d,"alt","Avatar"),p(c,"class","thumb thumb-circle link-hint closable"),p(e,"class","app-sidebar")},m(T,$){w(T,e,$),k(e,t),k(e,i),k(e,l),k(l,s),k(l,o),k(l,r),k(l,a),k(l,f),k(e,u),k(e,c),k(c,d),k(c,h),z(_,c,null),g=!0,y||(S=[we(nn.call(null,t)),we(nn.call(null,s)),we(An.call(null,s,{path:"/collections/?.*",className:"current-route"})),we(Le.call(null,s,{text:"Collections",position:"right"})),we(nn.call(null,r)),we(An.call(null,r,{path:"/logs/?.*",className:"current-route"})),we(Le.call(null,r,{text:"Logs",position:"right"})),we(nn.call(null,f)),we(An.call(null,f,{path:"/settings/?.*",className:"current-route"})),we(Le.call(null,f,{text:"Settings",position:"right"}))],y=!0)},p(T,$){var M;(!g||$&1&&!en(d.src,m="./images/avatars/avatar"+(((M=T[0])==null?void 0:M.avatar)||0)+".svg"))&&p(d,"src",m);const C={};$&4096&&(C.$$scope={dirty:$,ctx:T}),_.$set(C)},i(T){g||(E(_.$$.fragment,T),g=!0)},o(T){A(_.$$.fragment,T),g=!1},d(T){T&&v(e),V(_),y=!1,ve(S)}}}function XL(n){let e,t,i,l,s,o,r;return{c(){e=b("a"),e.innerHTML=' Manage admins',t=O(),i=b("hr"),l=O(),s=b("button"),s.innerHTML=' Logout',p(e,"href","/settings/admins"),p(e,"class","dropdown-item closable"),p(s,"type","button"),p(s,"class","dropdown-item closable")},m(a,f){w(a,e,f),w(a,t,f),w(a,i,f),w(a,l,f),w(a,s,f),o||(r=[we(nn.call(null,e)),K(s,"click",n[7])],o=!0)},p:Q,d(a){a&&(v(e),v(t),v(i),v(l),v(s)),o=!1,ve(r)}}}function Tg(n){let e,t,i;return t=new Ya({props:{conf:H.defaultEditorOptions()}}),t.$on("init",n[8]),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","tinymce-preloader hidden")},m(l,s){w(l,e,s),z(t,e,null),i=!0},p:Q,i(l){i||(E(t.$$.fragment,l),i=!0)},o(l){A(t.$$.fragment,l),i=!1},d(l){l&&v(e),V(t)}}}function QL(n){var g;let e,t,i,l,s,o,r,a,f,u,c,d,m;document.title=e=H.joinNonEmpty([n[4],n[3],"PocketBase"]," - ");let h=((g=n[0])==null?void 0:g.id)&&n[1]&&$g(n);o=new F0({props:{routes:RL}}),o.$on("routeLoading",n[5]),o.$on("conditionsFailed",n[6]),a=new WL({}),u=new GL({});let _=n[1]&&!n[2]&&Tg(n);return{c(){t=O(),i=b("div"),h&&h.c(),l=O(),s=b("div"),B(o.$$.fragment),r=O(),B(a.$$.fragment),f=O(),B(u.$$.fragment),c=O(),_&&_.c(),d=ye(),p(s,"class","app-body"),p(i,"class","app-layout")},m(y,S){w(y,t,S),w(y,i,S),h&&h.m(i,null),k(i,l),k(i,s),z(o,s,null),k(s,r),z(a,s,null),w(y,f,S),z(u,y,S),w(y,c,S),_&&_.m(y,S),w(y,d,S),m=!0},p(y,[S]){var T;(!m||S&24)&&e!==(e=H.joinNonEmpty([y[4],y[3],"PocketBase"]," - "))&&(document.title=e),(T=y[0])!=null&&T.id&&y[1]?h?(h.p(y,S),S&3&&E(h,1)):(h=$g(y),h.c(),E(h,1),h.m(i,l)):h&&(se(),A(h,1,1,()=>{h=null}),oe()),y[1]&&!y[2]?_?(_.p(y,S),S&6&&E(_,1)):(_=Tg(y),_.c(),E(_,1),_.m(d.parentNode,d)):_&&(se(),A(_,1,1,()=>{_=null}),oe())},i(y){m||(E(h),E(o.$$.fragment,y),E(a.$$.fragment,y),E(u.$$.fragment,y),E(_),m=!0)},o(y){A(h),A(o.$$.fragment,y),A(a.$$.fragment,y),A(u.$$.fragment,y),A(_),m=!1},d(y){y&&(v(t),v(i),v(f),v(c),v(d)),h&&h.d(),V(o),V(a),V(u,y),_&&_.d(y)}}}function xL(n,e,t){let i,l,s,o;Ue(n,Xi,_=>t(10,i=_)),Ue(n,Oo,_=>t(3,l=_)),Ue(n,$a,_=>t(0,s=_)),Ue(n,Dt,_=>t(4,o=_));let r,a=!1,f=!1;function u(_){var g,y,S,T;((g=_==null?void 0:_.detail)==null?void 0:g.location)!==r&&(t(1,a=!!((S=(y=_==null?void 0:_.detail)==null?void 0:y.userData)!=null&&S.showAppSidebar)),r=(T=_==null?void 0:_.detail)==null?void 0:T.location,xt(Dt,o="",o),Jt({}),zb())}function c(){tl("/")}async function d(){var _,g;if(s!=null&&s.id)try{const y=await fe.settings.getAll({$cancelKey:"initialAppSettings"});xt(Oo,l=((_=y==null?void 0:y.meta)==null?void 0:_.appName)||"",l),xt(Xi,i=!!((g=y==null?void 0:y.meta)!=null&&g.hideControls),i)}catch(y){y!=null&&y.isAbort||console.warn("Failed to load app settings.",y)}}function m(){fe.logout()}const h=()=>{t(2,f=!0)};return n.$$.update=()=>{n.$$.dirty&1&&s!=null&&s.id&&d()},[s,a,f,l,o,u,c,m,h]}class eN extends ge{constructor(e){super(),_e(this,e,xL,QL,me,{})}}new eN({target:document.getElementById("app")});export{fe as A,At as B,H as C,tl as D,ye as E,G1 as F,Ho as G,so as H,jt as I,Ue as J,Fn as K,st as L,ee as M,za as N,de as O,at as P,Ii as Q,Mt as R,ge as S,rt as T,g0 as U,A as a,O as b,B as c,V as d,b as e,p as f,w as g,k as h,_e as i,we as j,se as k,nn as l,z as m,oe as n,v as o,pe as p,x as q,K as r,me as s,E as t,Be as u,Y as v,re as w,Q as x,ae as y,ve as z}; +@hourly`))],L=!0)},p(F,N){var j,q;(!I||N[1]&1&&i!==(i=F[31]))&&p(e,"for",i),(!I||N[1]&1&&o!==(o=F[31]))&&p(s,"id",o),(!I||N[0]&1&&r!==(r=!((q=(j=F[0])==null?void 0:j.backups)!=null&&q.cron)))&&(s.autofocus=r),N[0]&2&&s.value!==F[1].backups.cron&&ae(s,F[1].backups.cron);const P={};N[0]&2|N[1]&2&&(P.$$scope={dirty:N,ctx:F}),_.$set(P)},i(F){I||(E(_.$$.fragment,F),I=!0)},o(F){A(_.$$.fragment,F),I=!1},d(F){F&&(v(e),v(l),v(s),v(a),v(f),v(g),v(y)),V(_),L=!1,ve(R)}}}function DL(n){let e,t,i,l,s,o,r,a;return{c(){e=b("label"),t=Y("Max @auto backups to keep"),l=O(),s=b("input"),p(e,"for",i=n[31]),p(s,"type","number"),p(s,"id",o=n[31]),p(s,"min","1")},m(f,u){w(f,e,u),k(e,t),w(f,l,u),w(f,s,u),ae(s,n[1].backups.cronMaxKeep),r||(a=K(s,"input",n[23]),r=!0)},p(f,u){u[1]&1&&i!==(i=f[31])&&p(e,"for",i),u[1]&1&&o!==(o=f[31])&&p(s,"id",o),u[0]&2&<(s.value)!==f[1].backups.cronMaxKeep&&ae(s,f[1].backups.cronMaxKeep)},d(f){f&&(v(e),v(l),v(s)),r=!1,a()}}}function yg(n){let e;function t(s,o){return s[7]?AL:s[8]?IL:EL}let i=t(n),l=i(n);return{c(){l.c(),e=ye()},m(s,o){l.m(s,o),w(s,e,o)},p(s,o){i===(i=t(s))&&l?l.p(s,o):(l.d(1),l=i(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&v(e),l.d(s)}}}function EL(n){let e;return{c(){e=b("div"),e.innerHTML=' S3 connected successfully',p(e,"class","label label-sm label-success entrance-right")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function IL(n){let e,t,i,l;return{c(){e=b("div"),e.innerHTML=' Failed to establish S3 connection',p(e,"class","label label-sm label-warning entrance-right")},m(s,o){var r;w(s,e,o),i||(l=we(t=Le.call(null,e,(r=n[8].data)==null?void 0:r.message)),i=!0)},p(s,o){var r;t&&Tt(t.update)&&o[0]&256&&t.update.call(null,(r=s[8].data)==null?void 0:r.message)},d(s){s&&v(e),i=!1,l()}}}function AL(n){let e;return{c(){e=b("span"),p(e,"class","loader loader-sm")},m(t,i){w(t,e,i)},p:Q,d(t){t&&v(e)}}}function vg(n){let e,t,i,l,s;return{c(){e=b("button"),t=b("span"),t.textContent="Reset",p(t,"class","txt"),p(e,"type","submit"),p(e,"class","btn btn-hint btn-transparent"),e.disabled=i=!n[9]||n[5]},m(o,r){w(o,e,r),k(e,t),l||(s=K(e,"click",n[27]),l=!0)},p(o,r){r[0]&544&&i!==(i=!o[9]||o[5])&&(e.disabled=i)},d(o){o&&v(e),l=!1,s()}}}function LL(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S,T,$,C,M,D,I,L,R,F;m=new Zo({props:{class:"btn-sm",tooltip:"Refresh"}}),m.$on("refresh",n[13]),_=new SL({props:{class:"btn-sm"}}),_.$on("success",n[13]);let N={};y=new yL({props:N}),n[15](y);function P(G,U){return G[6]?TL:$L}let j=P(n),q=j(n),W=n[6]&&!n[4]&&bg(n);return{c(){e=b("header"),t=b("nav"),i=b("div"),i.textContent="Settings",l=O(),s=b("div"),o=Y(n[10]),r=O(),a=b("div"),f=b("div"),u=b("div"),c=b("span"),c.textContent="Backup and restore your PocketBase data",d=O(),B(m.$$.fragment),h=O(),B(_.$$.fragment),g=O(),B(y.$$.fragment),S=O(),T=b("hr"),$=O(),C=b("button"),M=b("span"),M.textContent="Backups options",D=O(),q.c(),I=O(),W&&W.c(),p(i,"class","breadcrumb-item"),p(s,"class","breadcrumb-item"),p(t,"class","breadcrumbs"),p(e,"class","page-header"),p(c,"class","txt-xl"),p(u,"class","flex m-b-sm flex-gap-10"),p(M,"class","txt"),p(C,"type","button"),p(C,"class","btn btn-secondary"),C.disabled=n[4],x(C,"btn-loading",n[4]),p(f,"class","panel"),p(f,"autocomplete","off"),p(a,"class","wrapper")},m(G,U){w(G,e,U),k(e,t),k(t,i),k(t,l),k(t,s),k(s,o),w(G,r,U),w(G,a,U),k(a,f),k(f,u),k(u,c),k(u,d),z(m,u,null),k(u,h),z(_,u,null),k(f,g),z(y,f,null),k(f,S),k(f,T),k(f,$),k(f,C),k(C,M),k(C,D),q.m(C,null),k(f,I),W&&W.m(f,null),L=!0,R||(F=[K(C,"click",n[16]),K(f,"submit",Be(n[11]))],R=!0)},p(G,U){(!L||U[0]&1024)&&re(o,G[10]);const Z={};y.$set(Z),j!==(j=P(G))&&(q.d(1),q=j(G),q&&(q.c(),q.m(C,null))),(!L||U[0]&16)&&(C.disabled=G[4]),(!L||U[0]&16)&&x(C,"btn-loading",G[4]),G[6]&&!G[4]?W?(W.p(G,U),U[0]&80&&E(W,1)):(W=bg(G),W.c(),E(W,1),W.m(f,null)):W&&(se(),A(W,1,1,()=>{W=null}),oe())},i(G){L||(E(m.$$.fragment,G),E(_.$$.fragment,G),E(y.$$.fragment,G),E(W),L=!0)},o(G){A(m.$$.fragment,G),A(_.$$.fragment,G),A(y.$$.fragment,G),A(W),L=!1},d(G){G&&(v(e),v(r),v(a)),V(m),V(_),n[15](null),V(y),q.d(),W&&W.d(),R=!1,ve(F)}}}function NL(n){let e,t,i,l;return e=new _i({}),i=new kn({props:{$$slots:{default:[LL]},$$scope:{ctx:n}}}),{c(){B(e.$$.fragment),t=O(),B(i.$$.fragment)},m(s,o){z(e,s,o),w(s,t,o),z(i,s,o),l=!0},p(s,o){const r={};o[0]&2047|o[1]&2&&(r.$$scope={dirty:o,ctx:s}),i.$set(r)},i(s){l||(E(e.$$.fragment,s),E(i.$$.fragment,s),l=!0)},o(s){A(e.$$.fragment,s),A(i.$$.fragment,s),l=!1},d(s){s&&v(t),V(e,s),V(i,s)}}}function PL(n,e,t){let i,l;Ue(n,Dt,U=>t(10,l=U)),xt(Dt,l="Backups",l);let s,o={},r={},a=!1,f=!1,u="",c=!1,d=!1,m=!1,h=null;_();async function _(){t(4,a=!0);try{const U=await fe.settings.getAll()||{};y(U)}catch(U){fe.error(U)}t(4,a=!1)}async function g(){if(!(f||!i)){t(5,f=!0);try{const U=await fe.settings.update(H.filterRedactedProps(r));await T(),y(U),At("Successfully saved application settings.")}catch(U){fe.error(U)}t(5,f=!1)}}function y(U={}){t(1,r={backups:(U==null?void 0:U.backups)||{}}),t(2,c=r.backups.cron!=""),t(0,o=JSON.parse(JSON.stringify(r)))}function S(){t(1,r=JSON.parse(JSON.stringify(o||{backups:{}}))),t(2,c=r.backups.cron!="")}async function T(){return s==null?void 0:s.loadBackups()}function $(U){ee[U?"unshift":"push"](()=>{s=U,t(3,s)})}const C=()=>t(6,d=!d);function M(){c=this.checked,t(2,c)}function D(){r.backups.cron=this.value,t(1,r),t(2,c)}const I=()=>{t(1,r.backups.cron="0 0 * * *",r)},L=()=>{t(1,r.backups.cron="0 0 * * 0",r)},R=()=>{t(1,r.backups.cron="0 0 * * 1,3",r)},F=()=>{t(1,r.backups.cron="0 0 1 * *",r)};function N(){r.backups.cronMaxKeep=lt(this.value),t(1,r),t(2,c)}function P(U){n.$$.not_equal(r.backups.s3,U)&&(r.backups.s3=U,t(1,r),t(2,c))}function j(U){m=U,t(7,m)}function q(U){h=U,t(8,h)}const W=()=>S(),G=()=>g();return n.$$.update=()=>{var U;n.$$.dirty[0]&1&&t(14,u=JSON.stringify(o)),n.$$.dirty[0]&6&&!c&&(U=r==null?void 0:r.backups)!=null&&U.cron&&(li("backups.cron"),t(1,r.backups.cron="",r)),n.$$.dirty[0]&16386&&t(9,i=u!=JSON.stringify(r))},[o,r,c,s,a,f,d,m,h,i,l,g,S,T,u,$,C,M,D,I,L,R,F,N,P,j,q,W,G]}class FL extends ge{constructor(e){super(),_e(this,e,PL,NL,me,{},null,[-1,-1])}}const Nt=[async n=>{const e=new URLSearchParams(window.location.search);return n.location!=="/"&&e.has("installer")?tl("/"):!0}],RL={"/login":It({component:FE,conditions:Nt.concat([n=>!fe.authStore.isValid]),userData:{showAppSidebar:!1}}),"/request-password-reset":It({asyncComponent:()=>nt(()=>import("./PageAdminRequestPasswordReset-FK_-0PXf.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt.concat([n=>!fe.authStore.isValid]),userData:{showAppSidebar:!1}}),"/confirm-password-reset/:token":It({asyncComponent:()=>nt(()=>import("./PageAdminConfirmPasswordReset-QtrIhv_d.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt.concat([n=>!fe.authStore.isValid]),userData:{showAppSidebar:!1}}),"/collections":It({component:iE,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/logs":It({component:t$,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings":It({component:WE,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/admins":It({component:EE,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/mail":It({component:AI,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/storage":It({component:xI,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/auth-providers":It({component:_A,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/tokens":It({component:TA,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/export-collections":It({component:LA,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/import-collections":It({component:xA,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/settings/backups":It({component:FL,conditions:Nt.concat([n=>fe.authStore.isValid]),userData:{showAppSidebar:!0}}),"/users/confirm-password-reset/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmPasswordReset-XkhUeLt2.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/auth/confirm-password-reset/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmPasswordReset-XkhUeLt2.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/users/confirm-verification/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmVerification-bo85WeJ2.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/auth/confirm-verification/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmVerification-bo85WeJ2.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/users/confirm-email-change/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmEmailChange--1lZH6Oc.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/auth/confirm-email-change/:token":It({asyncComponent:()=>nt(()=>import("./PageRecordConfirmEmailChange--1lZH6Oc.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/auth/oauth2-redirect-success":It({asyncComponent:()=>nt(()=>import("./PageOAuth2RedirectSuccess-T7Wnqyzu.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"/auth/oauth2-redirect-failure":It({asyncComponent:()=>nt(()=>import("./PageOAuth2RedirectFailure-OjogN9-X.js"),__vite__mapDeps([]),import.meta.url),conditions:Nt,userData:{showAppSidebar:!1}}),"*":It({component:Ov,userData:{showAppSidebar:!1}})};function qL(n,{from:e,to:t},i={}){const l=getComputedStyle(n),s=l.transform==="none"?"":l.transform,[o,r]=l.transformOrigin.split(" ").map(parseFloat),a=e.left+e.width*o/t.width-(t.left+o),f=e.top+e.height*r/t.height-(t.top+r),{delay:u=0,duration:c=m=>Math.sqrt(m)*120,easing:d=Jo}=i;return{delay:u,duration:Tt(c)?c(Math.sqrt(a*a+f*f)):c,easing:d,css:(m,h)=>{const _=h*a,g=h*f,y=m+h*e.width/t.width,S=m+h*e.height/t.height;return`transform: ${s} translate(${_}px, ${g}px) scale(${y}, ${S});`}}}function wg(n,e,t){const i=n.slice();return i[2]=e[t],i}function jL(n){let e;return{c(){e=b("i"),p(e,"class","ri-alert-line")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function HL(n){let e;return{c(){e=b("i"),p(e,"class","ri-error-warning-line")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function zL(n){let e;return{c(){e=b("i"),p(e,"class","ri-checkbox-circle-line")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function VL(n){let e;return{c(){e=b("i"),p(e,"class","ri-information-line")},m(t,i){w(t,e,i)},d(t){t&&v(e)}}}function Sg(n,e){let t,i,l,s,o=e[2].message+"",r,a,f,u,c,d,m,h=Q,_,g,y;function S(M,D){return M[2].type==="info"?VL:M[2].type==="success"?zL:M[2].type==="warning"?HL:jL}let T=S(e),$=T(e);function C(){return e[1](e[2])}return{key:n,first:null,c(){t=b("div"),i=b("div"),$.c(),l=O(),s=b("div"),r=Y(o),a=O(),f=b("button"),f.innerHTML='',u=O(),p(i,"class","icon"),p(s,"class","content"),p(f,"type","button"),p(f,"class","close"),p(t,"class","alert txt-break"),x(t,"alert-info",e[2].type=="info"),x(t,"alert-success",e[2].type=="success"),x(t,"alert-danger",e[2].type=="error"),x(t,"alert-warning",e[2].type=="warning"),this.first=t},m(M,D){w(M,t,D),k(t,i),$.m(i,null),k(t,l),k(t,s),k(s,r),k(t,a),k(t,f),k(t,u),_=!0,g||(y=K(f,"click",Be(C)),g=!0)},p(M,D){e=M,T!==(T=S(e))&&($.d(1),$=T(e),$&&($.c(),$.m(i,null))),(!_||D&1)&&o!==(o=e[2].message+"")&&re(r,o),(!_||D&1)&&x(t,"alert-info",e[2].type=="info"),(!_||D&1)&&x(t,"alert-success",e[2].type=="success"),(!_||D&1)&&x(t,"alert-danger",e[2].type=="error"),(!_||D&1)&&x(t,"alert-warning",e[2].type=="warning")},r(){m=t.getBoundingClientRect()},f(){w0(t),h(),Lg(t,m)},a(){h(),h=v0(t,m,qL,{duration:150})},i(M){_||(M&&Ye(()=>{_&&(d&&d.end(1),c=Fg(t,et,{duration:150}),c.start())}),_=!0)},o(M){c&&c.invalidate(),M&&(d=ca(t,rs,{duration:150})),_=!1},d(M){M&&v(t),$.d(),M&&d&&d.end(),g=!1,y()}}}function BL(n){let e,t=[],i=new Map,l,s=de(n[0]);const o=r=>r[2].message;for(let r=0;rt(0,i=s)),[i,s=>Y1(s)]}class WL extends ge{constructor(e){super(),_e(this,e,UL,BL,me,{})}}function YL(n){var l;let e,t=((l=n[1])==null?void 0:l.text)+"",i;return{c(){e=b("h4"),i=Y(t),p(e,"class","block center txt-break"),p(e,"slot","header")},m(s,o){w(s,e,o),k(e,i)},p(s,o){var r;o&2&&t!==(t=((r=s[1])==null?void 0:r.text)+"")&&re(i,t)},d(s){s&&v(e)}}}function KL(n){let e,t,i,l,s,o,r;return{c(){e=b("button"),t=b("span"),t.textContent="No",i=O(),l=b("button"),s=b("span"),s.textContent="Yes",p(t,"class","txt"),e.autofocus=!0,p(e,"type","button"),p(e,"class","btn btn-transparent btn-expanded-sm"),e.disabled=n[2],p(s,"class","txt"),p(l,"type","button"),p(l,"class","btn btn-danger btn-expanded"),l.disabled=n[2],x(l,"btn-loading",n[2])},m(a,f){w(a,e,f),k(e,t),w(a,i,f),w(a,l,f),k(l,s),e.focus(),o||(r=[K(e,"click",n[4]),K(l,"click",n[5])],o=!0)},p(a,f){f&4&&(e.disabled=a[2]),f&4&&(l.disabled=a[2]),f&4&&x(l,"btn-loading",a[2])},d(a){a&&(v(e),v(i),v(l)),o=!1,ve(r)}}}function JL(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:[KL],header:[YL]},$$scope:{ctx:n}};return e=new Zt({props:i}),n[6](e),e.$on("hide",n[7]),{c(){B(e.$$.fragment)},m(l,s){z(e,l,s),t=!0},p(l,[s]){const o={};s&4&&(o.overlayClose=!l[2]),s&4&&(o.escClose=!l[2]),s&271&&(o.$$scope={dirty:s,ctx:l}),e.$set(o)},i(l){t||(E(e.$$.fragment,l),t=!0)},o(l){A(e.$$.fragment,l),t=!1},d(l){n[6](null),V(e,l)}}}function ZL(n,e,t){let i;Ue(n,Va,c=>t(1,i=c));let l,s=!1,o=!1;const r=()=>{t(3,o=!1),l==null||l.hide()},a=async()=>{i!=null&&i.yesCallback&&(t(2,s=!0),await Promise.resolve(i.yesCallback()),t(2,s=!1)),t(3,o=!0),l==null||l.hide()};function f(c){ee[c?"unshift":"push"](()=>{l=c,t(0,l)})}const u=async()=>{!o&&(i!=null&&i.noCallback)&&i.noCallback(),await Xt(),t(3,o=!1),zb()};return n.$$.update=()=>{n.$$.dirty&3&&i!=null&&i.text&&(t(3,o=!1),l==null||l.show())},[l,i,s,o,r,a,f,u]}class GL extends ge{constructor(e){super(),_e(this,e,ZL,JL,me,{})}}function $g(n){let e,t,i,l,s,o,r,a,f,u,c,d,m,h,_,g,y,S;return _=new On({props:{class:"dropdown dropdown-nowrap dropdown-upside dropdown-left",$$slots:{default:[XL]},$$scope:{ctx:n}}}),{c(){var T;e=b("aside"),t=b("a"),t.innerHTML='PocketBase logo',i=O(),l=b("nav"),s=b("a"),s.innerHTML='',o=O(),r=b("a"),r.innerHTML='',a=O(),f=b("a"),f.innerHTML='',u=O(),c=b("figure"),d=b("img"),h=O(),B(_.$$.fragment),p(t,"href","/"),p(t,"class","logo logo-sm"),p(s,"href","/collections"),p(s,"class","menu-item"),p(s,"aria-label","Collections"),p(r,"href","/logs"),p(r,"class","menu-item"),p(r,"aria-label","Logs"),p(f,"href","/settings"),p(f,"class","menu-item"),p(f,"aria-label","Settings"),p(l,"class","main-menu"),en(d.src,m="./images/avatars/avatar"+(((T=n[0])==null?void 0:T.avatar)||0)+".svg")||p(d,"src",m),p(d,"alt","Avatar"),p(c,"class","thumb thumb-circle link-hint closable"),p(e,"class","app-sidebar")},m(T,$){w(T,e,$),k(e,t),k(e,i),k(e,l),k(l,s),k(l,o),k(l,r),k(l,a),k(l,f),k(e,u),k(e,c),k(c,d),k(c,h),z(_,c,null),g=!0,y||(S=[we(nn.call(null,t)),we(nn.call(null,s)),we(An.call(null,s,{path:"/collections/?.*",className:"current-route"})),we(Le.call(null,s,{text:"Collections",position:"right"})),we(nn.call(null,r)),we(An.call(null,r,{path:"/logs/?.*",className:"current-route"})),we(Le.call(null,r,{text:"Logs",position:"right"})),we(nn.call(null,f)),we(An.call(null,f,{path:"/settings/?.*",className:"current-route"})),we(Le.call(null,f,{text:"Settings",position:"right"}))],y=!0)},p(T,$){var M;(!g||$&1&&!en(d.src,m="./images/avatars/avatar"+(((M=T[0])==null?void 0:M.avatar)||0)+".svg"))&&p(d,"src",m);const C={};$&4096&&(C.$$scope={dirty:$,ctx:T}),_.$set(C)},i(T){g||(E(_.$$.fragment,T),g=!0)},o(T){A(_.$$.fragment,T),g=!1},d(T){T&&v(e),V(_),y=!1,ve(S)}}}function XL(n){let e,t,i,l,s,o,r;return{c(){e=b("a"),e.innerHTML=' Manage admins',t=O(),i=b("hr"),l=O(),s=b("button"),s.innerHTML=' Logout',p(e,"href","/settings/admins"),p(e,"class","dropdown-item closable"),p(s,"type","button"),p(s,"class","dropdown-item closable")},m(a,f){w(a,e,f),w(a,t,f),w(a,i,f),w(a,l,f),w(a,s,f),o||(r=[we(nn.call(null,e)),K(s,"click",n[7])],o=!0)},p:Q,d(a){a&&(v(e),v(t),v(i),v(l),v(s)),o=!1,ve(r)}}}function Tg(n){let e,t,i;return t=new Ya({props:{conf:H.defaultEditorOptions()}}),t.$on("init",n[8]),{c(){e=b("div"),B(t.$$.fragment),p(e,"class","tinymce-preloader hidden")},m(l,s){w(l,e,s),z(t,e,null),i=!0},p:Q,i(l){i||(E(t.$$.fragment,l),i=!0)},o(l){A(t.$$.fragment,l),i=!1},d(l){l&&v(e),V(t)}}}function QL(n){var g;let e,t,i,l,s,o,r,a,f,u,c,d,m;document.title=e=H.joinNonEmpty([n[4],n[3],"PocketBase"]," - ");let h=((g=n[0])==null?void 0:g.id)&&n[1]&&$g(n);o=new F0({props:{routes:RL}}),o.$on("routeLoading",n[5]),o.$on("conditionsFailed",n[6]),a=new WL({}),u=new GL({});let _=n[1]&&!n[2]&&Tg(n);return{c(){t=O(),i=b("div"),h&&h.c(),l=O(),s=b("div"),B(o.$$.fragment),r=O(),B(a.$$.fragment),f=O(),B(u.$$.fragment),c=O(),_&&_.c(),d=ye(),p(s,"class","app-body"),p(i,"class","app-layout")},m(y,S){w(y,t,S),w(y,i,S),h&&h.m(i,null),k(i,l),k(i,s),z(o,s,null),k(s,r),z(a,s,null),w(y,f,S),z(u,y,S),w(y,c,S),_&&_.m(y,S),w(y,d,S),m=!0},p(y,[S]){var T;(!m||S&24)&&e!==(e=H.joinNonEmpty([y[4],y[3],"PocketBase"]," - "))&&(document.title=e),(T=y[0])!=null&&T.id&&y[1]?h?(h.p(y,S),S&3&&E(h,1)):(h=$g(y),h.c(),E(h,1),h.m(i,l)):h&&(se(),A(h,1,1,()=>{h=null}),oe()),y[1]&&!y[2]?_?(_.p(y,S),S&6&&E(_,1)):(_=Tg(y),_.c(),E(_,1),_.m(d.parentNode,d)):_&&(se(),A(_,1,1,()=>{_=null}),oe())},i(y){m||(E(h),E(o.$$.fragment,y),E(a.$$.fragment,y),E(u.$$.fragment,y),E(_),m=!0)},o(y){A(h),A(o.$$.fragment,y),A(a.$$.fragment,y),A(u.$$.fragment,y),A(_),m=!1},d(y){y&&(v(t),v(i),v(f),v(c),v(d)),h&&h.d(),V(o),V(a),V(u,y),_&&_.d(y)}}}function xL(n,e,t){let i,l,s,o;Ue(n,Xi,_=>t(10,i=_)),Ue(n,Oo,_=>t(3,l=_)),Ue(n,$a,_=>t(0,s=_)),Ue(n,Dt,_=>t(4,o=_));let r,a=!1,f=!1;function u(_){var g,y,S,T;((g=_==null?void 0:_.detail)==null?void 0:g.location)!==r&&(t(1,a=!!((S=(y=_==null?void 0:_.detail)==null?void 0:y.userData)!=null&&S.showAppSidebar)),r=(T=_==null?void 0:_.detail)==null?void 0:T.location,xt(Dt,o="",o),Jt({}),zb())}function c(){tl("/")}async function d(){var _,g;if(s!=null&&s.id)try{const y=await fe.settings.getAll({$cancelKey:"initialAppSettings"});xt(Oo,l=((_=y==null?void 0:y.meta)==null?void 0:_.appName)||"",l),xt(Xi,i=!!((g=y==null?void 0:y.meta)!=null&&g.hideControls),i)}catch(y){y!=null&&y.isAbort||console.warn("Failed to load app settings.",y)}}function m(){fe.logout()}const h=()=>{t(2,f=!0)};return n.$$.update=()=>{n.$$.dirty&1&&s!=null&&s.id&&d()},[s,a,f,l,o,u,c,m,h]}class eN extends ge{constructor(e){super(),_e(this,e,xL,QL,me,{})}}new eN({target:document.getElementById("app")});export{fe as A,At as B,H as C,tl as D,ye as E,G1 as F,Ho as G,so as H,jt as I,Ue as J,Fn as K,st as L,ee as M,za as N,de as O,at as P,Ii as Q,Mt as R,ge as S,rt as T,g0 as U,A as a,O as b,B as c,V as d,b as e,p as f,w as g,k as h,_e as i,we as j,se as k,nn as l,z as m,oe as n,v as o,pe as p,x as q,K as r,me as s,E as t,Be as u,Y as v,re as w,Q as x,ae as y,ve as z}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["./FilterAutocompleteInput-7N2kJXRh.js","./index-u64XbdBO.js","./CodeEditor-f9FE6aAj.js","./ListApiDocs-NLRpQyTo.js","./SdkTabs-O6auDA6S.js","./SdkTabs-JQVpi1cs.css","./FieldsQueryParam--b6rO4n1.js","./ListApiDocs-4XQLQO2L.css","./ViewApiDocs-4M1eVMku.js","./CreateApiDocs-uAZVKP8K.js","./UpdateApiDocs-KIEJUGwi.js","./DeleteApiDocs-fOXuOKIx.js","./RealtimeApiDocs-QEFv858u.js","./AuthWithPasswordDocs-i3lf_6b4.js","./AuthWithOAuth2Docs-uhwAhOlg.js","./AuthRefreshDocs-YwWPCwEU.js","./RequestVerificationDocs-G73EyzMY.js","./ConfirmVerificationDocs-JgU_hYvF.js","./RequestPasswordResetDocs-ueBKJVu4.js","./ConfirmPasswordResetDocs-AJWXIimi.js","./RequestEmailChangeDocs-OR_qP7_j.js","./ConfirmEmailChangeDocs-eRrlYV21.js","./AuthMethodsDocs-nJCAd_pk.js","./ListExternalAuthsDocs-EllSY0vK.js","./UnlinkExternalAuthDocs-52aa8RZW.js"] + __vite__mapDeps.viteFileDeps = ["./FilterAutocompleteInput-ywiKWbDQ.js","./index-8bZ4r7AC.js","./CodeEditor-rvo5l1QW.js","./ListApiDocs-Ej5naqCg.js","./SdkTabs-gnoMubZE.js","./SdkTabs-JQVpi1cs.css","./FieldsQueryParam-QduFX_Q6.js","./ListApiDocs-4XQLQO2L.css","./ViewApiDocs-EPId3tA7.js","./CreateApiDocs-5RxIhvO0.js","./UpdateApiDocs-GDKV_HSc.js","./DeleteApiDocs-j_NJpd0u.js","./RealtimeApiDocs-2yYxyEgN.js","./AuthWithPasswordDocs-Sqq2A_xb.js","./AuthWithOAuth2Docs-N1wT5-Tm.js","./AuthRefreshDocs-JfV5JCoS.js","./RequestVerificationDocs-LGhIAfd9.js","./ConfirmVerificationDocs-iIwWOJ-8.js","./RequestPasswordResetDocs-CDKXdjxv.js","./ConfirmPasswordResetDocs-XG9DX7jk.js","./RequestEmailChangeDocs-J7AVBZVY.js","./ConfirmEmailChangeDocs-z2cifBOn.js","./AuthMethodsDocs-YXCf-w6f.js","./ListExternalAuthsDocs-0k6rNNq4.js","./UnlinkExternalAuthDocs-Qe14c8ks.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } diff --git a/ui/dist/index.html b/ui/dist/index.html index a98b2ec5..315cff42 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -47,7 +47,7 @@ window.Prism = window.Prism || {}; window.Prism.manual = true; - + diff --git a/ui/src/autocomplete.worker.js b/ui/src/autocomplete.worker.js new file mode 100644 index 00000000..9708654a --- /dev/null +++ b/ui/src/autocomplete.worker.js @@ -0,0 +1,39 @@ +import CommonHelper from "@/utils/CommonHelper"; + +const maxKeys = 11000; + +onmessage = (e) => { + if (!e.data.collections) { + return; + } + + const result = {}; + + result.baseKeys = CommonHelper.getCollectionAutocompleteKeys(e.data.collections, e.data.baseCollection?.name); + result.baseKeys = limitArray(result.baseKeys.sort(keysSort), maxKeys); + + if (!e.data.disableRequestKeys) { + result.requestKeys = CommonHelper.getRequestAutocompleteKeys(e.data.collections, e.data.baseCollection?.name); + result.requestKeys = limitArray(result.requestKeys.sort(keysSort), maxKeys); + } + + if (!e.data.disableCollectionJoinKeys) { + result.collectionJoinKeys = CommonHelper.getCollectionJoinAutocompleteKeys(e.data.collections); + result.collectionJoinKeys = limitArray(result.collectionJoinKeys.sort(keysSort), maxKeys); + } + + postMessage(result); +}; + +// sort shorter keys first +function keysSort(a, b) { + return a.length - b.length; +} + +function limitArray(arr, max) { + if (arr.length > max) { + return arr.slice(0, max); + } + + return arr; +} diff --git a/ui/src/components/base/FilterAutocompleteInput.svelte b/ui/src/components/base/FilterAutocompleteInput.svelte index 48d98bc0..22b19ad7 100644 --- a/ui/src/components/base/FilterAutocompleteInput.svelte +++ b/ui/src/components/base/FilterAutocompleteInput.svelte @@ -34,6 +34,7 @@ import { onMount, createEventDispatcher } from "svelte"; import { collections } from "@/stores/collections"; import CommonHelper from "@/utils/CommonHelper"; + import AutocompleteWorker from "@/autocomplete.worker.js?worker"; // code mirror imports // --- import { @@ -54,7 +55,7 @@ StreamLanguage, syntaxTree, } from "@codemirror/language"; - import { defaultKeymap, history, historyKeymap } from "@codemirror/commands"; + import { defaultKeymap, indentWithTab, history, historyKeymap } from "@codemirror/commands"; import { searchKeymap, highlightSelectionMatches } from "@codemirror/search"; import { autocompletion, @@ -75,7 +76,7 @@ export let singleLine = false; export let extraAutocompleteKeys = []; // eg. ["test1", "test2"] export let disableRequestKeys = false; - export let disableIndirectCollectionsKeys = false; + export let disableCollectionJoinKeys = false; let editor; let container; @@ -84,10 +85,10 @@ let editableCompartment = new Compartment(); let readOnlyCompartment = new Compartment(); let placeholderCompartment = new Compartment(); + let autocompleteWorker = new AutocompleteWorker(); - let cachedCollections = []; let cachedRequestKeys = []; - let cachedIndirectCollectionKeys = []; + let cachedCollectionJoinKeys = []; let cachedBaseKeys = []; let baseKeysChangeHash = ""; let oldBaseKeysChangeHash = ""; @@ -98,7 +99,7 @@ !disabled && (oldBaseKeysChangeHash != baseKeysChangeHash || disableRequestKeys !== -1 || - disableIndirectCollectionsKeys !== -1) + disableCollectionJoinKeys !== -1) ) { oldBaseKeysChangeHash = baseKeysChangeHash; refreshCachedKeys(); @@ -146,18 +147,28 @@ editor?.focus(); } + // Refresh the cached autocomplete keys. + // --- let refreshDebounceId = null; - // Refresh the cached autocomplete keys. + autocompleteWorker.onmessage = (e) => { + cachedBaseKeys = e.data.baseKeys || []; + cachedRequestKeys = e.data.requestKeys || []; + cachedCollectionJoinKeys = e.data.collectionJoinKeys || []; + }; + function refreshCachedKeys() { clearTimeout(refreshDebounceId); refreshDebounceId = setTimeout(() => { - cachedCollections = concatWithBaseCollection($collections); - cachedBaseKeys = getBaseKeys(); - cachedRequestKeys = !disableRequestKeys ? getRequestKeys() : []; - cachedIndirectCollectionKeys = !disableIndirectCollectionsKeys ? getIndirectCollectionKeys() : []; - }, 300); + autocompleteWorker.postMessage({ + baseCollection: baseCollection, + collections: concatWithBaseCollection($collections), + disableRequestKeys: disableRequestKeys, + disableCollectionJoinKeys: disableCollectionJoinKeys, + }); + }, 250); } + // --- // Return a collection keys hash string that can be used to compare with previous states. function getCollectionKeysChangeHash(collection) { @@ -211,129 +222,8 @@ } } - // Returns a list with all collection field keys recursively. - function getCollectionFieldKeys(nameOrId, prefix = "", level = 0) { - let collection = cachedCollections.find((item) => item.name == nameOrId || item.id == nameOrId); - if (!collection || level >= 4) { - return []; - } - collection.schema = collection.schema || []; - - let result = CommonHelper.getAllCollectionIdentifiers(collection, prefix); - - for (const field of collection.schema) { - const key = prefix + field.name; - - // add relation fields - if (field.type === "relation" && field.options?.collectionId) { - const subKeys = getCollectionFieldKeys(field.options.collectionId, key + ".", level + 1); - if (subKeys.length) { - result = result.concat(subKeys); - } - } - - // add ":each" field modifier - if (field.type === "select" && field.options?.maxSelect != 1) { - result.push(key + ":each"); - } - - // add ":length" field modifier to arrayble fields - if (field.options?.maxSelect != 1 && ["select", "file", "relation"].includes(field.type)) { - result.push(key + ":length"); - } - } - - // add back relations - for (const ref of cachedCollections) { - ref.schema = ref.schema || []; - for (const field of ref.schema) { - if (field.type == "relation" && field.options?.collectionId == collection.id) { - const key = prefix + ref.name + "_via_" + field.name; - const subKeys = getCollectionFieldKeys(ref.id, key + ".", level + 2); // +2 to reduce the recursive results - if (subKeys.length) { - result = result.concat(subKeys); - } - } - } - } - - return result; - } - - // Returns baseCollection keys. - function getBaseKeys() { - return getCollectionFieldKeys(baseCollection?.name); - } - - // Returns @request.* keys. - function getRequestKeys() { - const result = []; - - result.push("@request.context"); - result.push("@request.method"); - result.push("@request.query."); - result.push("@request.data."); - result.push("@request.headers."); - result.push("@request.auth.id"); - result.push("@request.auth.collectionId"); - result.push("@request.auth.collectionName"); - result.push("@request.auth.verified"); - result.push("@request.auth.username"); - result.push("@request.auth.email"); - result.push("@request.auth.emailVisibility"); - result.push("@request.auth.created"); - result.push("@request.auth.updated"); - - // load auth collection fields - const authCollections = cachedCollections.filter((collection) => collection.type === "auth"); - for (const collection of authCollections) { - const authKeys = getCollectionFieldKeys(collection.id, "@request.auth."); - for (const k of authKeys) { - CommonHelper.pushUnique(result, k); - } - } - - // load base collection fields into @request.data.* - const issetExcludeList = ["created", "updated"]; - if (baseCollection?.id) { - const keys = getCollectionFieldKeys(baseCollection.name, "@request.data."); - for (const key of keys) { - result.push(key); - - // add ":isset" modifier to non-base keys - const parts = key.split("."); - if ( - parts.length === 3 && - // doesn't contain another modifier - parts[2].indexOf(":") === -1 && - // is not from the exclude list - !issetExcludeList.includes(parts[2]) - ) { - result.push(key + ":isset"); - } - } - } - - return result; - } - - // Returns @collection.* keys. - function getIndirectCollectionKeys() { - const result = []; - - for (const collection of cachedCollections) { - const prefix = "@collection." + collection.name + "."; - const keys = getCollectionFieldKeys(collection.name, prefix); - for (const key of keys) { - result.push(key); - } - } - - return result; - } - // Returns an array with all the supported keys. - function getAllKeys(includeRequestKeys = true, includeIndirectCollectionsKeys = true) { + function getAllKeys(includeRequestKeys = true, includeCollectionJoinKeys = true) { let result = [].concat(extraAutocompleteKeys); // add base keys @@ -344,16 +234,11 @@ result = result.concat(cachedRequestKeys || []); } - // add @collections.* keys - if (includeIndirectCollectionsKeys) { - result = result.concat(cachedIndirectCollectionKeys || []); + // add @collection.* keys + if (includeCollectionJoinKeys) { + result = result.concat(cachedCollectionJoinKeys || []); } - // sort shorter keys first - result.sort(function (a, b) { - return a.length - b.length; - }); - return result; } @@ -389,15 +274,20 @@ { label: "@yearEnd" }, ]; - if (!disableIndirectCollectionsKeys) { + if (!disableCollectionJoinKeys) { options.push({ label: "@collection.*", apply: "@collection." }); } - const keys = getAllKeys(!disableRequestKeys, !disableRequestKeys && word.text.startsWith("@c")); + let keys = getAllKeys( + !disableRequestKeys && word.text.startsWith("@r"), + !disableCollectionJoinKeys && word.text.startsWith("@c"), + ); + for (const key of keys) { options.push({ label: key.endsWith(".") ? key + "*" : key, apply: key, + boost: key.indexOf("_via_") > 0 ? -1 : 0, // deprioritize _via_ keys }); } @@ -498,6 +388,7 @@ searchKeymap.find((item) => item.key === "Mod-d"), ...historyKeymap, ...completionKeymap, + indentWithTab, ]), EditorView.lineWrapping, autocompletion({ @@ -533,6 +424,7 @@ clearTimeout(refreshDebounceId); removeLabelListeners(); editor?.destroy(); + autocompleteWorker.terminate(); }; }); diff --git a/ui/src/components/base/Searchbar.svelte b/ui/src/components/base/Searchbar.svelte index 2bc0bf2b..3d3aec5e 100644 --- a/ui/src/components/base/Searchbar.svelte +++ b/ui/src/components/base/Searchbar.svelte @@ -66,7 +66,7 @@ id={uniqueId} singleLine disableRequestKeys - disableIndirectCollectionsKeys + disableCollectionJoinKeys {extraAutocompleteKeys} baseCollection={autocompleteCollection} placeholder={value || placeholder} diff --git a/ui/src/utils/CommonHelper.js b/ui/src/utils/CommonHelper.js index 3501680b..6b2fbbc5 100644 --- a/ui/src/utils/CommonHelper.js +++ b/ui/src/utils/CommonHelper.js @@ -1745,6 +1745,142 @@ export default class CommonHelper { return result; } + /** + * Generates recursively a list with all the autocomplete field keys + * for the collectionNameOrId collection. + * + * @param {Array} collections + * @param {String} collectionNameOrId + * @param {String} [prefix] + * @param {Number} [level] + * @return {Array} + */ + static getCollectionAutocompleteKeys(collections, collectionNameOrId, prefix = "", level = 0) { + let collection = collections.find((item) => item.name == collectionNameOrId || item.id == collectionNameOrId); + if (!collection || level >= 4) { + return []; + } + collection.schema = collection.schema || []; + + let result = CommonHelper.getAllCollectionIdentifiers(collection, prefix); + + for (const field of collection.schema) { + const key = prefix + field.name; + + // add relation fields + if (field.type == "relation" && field.options?.collectionId) { + const subKeys = CommonHelper.getCollectionAutocompleteKeys(collections, field.options.collectionId, key + ".", level + 1); + if (subKeys.length) { + result = result.concat(subKeys); + } + } + + // add ":each" field modifier + if (field.type == "select" && field.options?.maxSelect != 1) { + result.push(key + ":each"); + } + + // add ":length" field modifier to arrayble fields + if (field.options?.maxSelect != 1 && ["select", "file", "relation"].includes(field.type)) { + result.push(key + ":length"); + } + } + + // add back relations + for (const ref of collections) { + ref.schema = ref.schema || []; + for (const field of ref.schema) { + if (field.type == "relation" && field.options?.collectionId == collection.id) { + const key = prefix + ref.name + "_via_" + field.name; + const subKeys = CommonHelper.getCollectionAutocompleteKeys(collections, ref.id, key + ".", level + 2); // +2 to reduce the recursive results + if (subKeys.length) { + result = result.concat(subKeys); + } + } + } + } + + return result; + } + + /** + * Generates a list with all @collection.* autocomplete field keys. + * + * @param {Array} collections + * @return {Array} + */ + static getCollectionJoinAutocompleteKeys(collections) { + const result = []; + + for (const collection of collections) { + const prefix = "@collection." + collection.name + "."; + const keys = CommonHelper.getCollectionAutocompleteKeys(collections, collection.name, prefix); + for (const key of keys) { + result.push(key); + } + } + + return result; + } + + /** + * Generates a list with all @request.* autocomplete field keys. + * + * @param {Array} collections + * @param {String} baseCollectionName (used for the `@request.data.*` fields) + * @return {Array} + */ + static getRequestAutocompleteKeys(collections, baseCollectionName) { + const result = []; + + result.push("@request.context"); + result.push("@request.method"); + result.push("@request.query."); + result.push("@request.data."); + result.push("@request.headers."); + result.push("@request.auth.id"); + result.push("@request.auth.collectionId"); + result.push("@request.auth.collectionName"); + result.push("@request.auth.verified"); + result.push("@request.auth.username"); + result.push("@request.auth.email"); + result.push("@request.auth.emailVisibility"); + result.push("@request.auth.created"); + result.push("@request.auth.updated"); + + // load auth collection fields + const authCollections = collections.filter((collection) => collection.type === "auth"); + for (const collection of authCollections) { + const authKeys = CommonHelper.getCollectionAutocompleteKeys(collections, collection.id, "@request.auth."); + for (const k of authKeys) { + CommonHelper.pushUnique(result, k); + } + } + + // load base collection fields into @request.data.* + if (baseCollectionName) { + const issetExcludeList = ["created", "updated"]; + const keys = CommonHelper.getCollectionAutocompleteKeys(collections, baseCollectionName, "@request.data."); + for (const key of keys) { + result.push(key); + + // add ":isset" modifier to non-base keys + const parts = key.split("."); + if ( + parts.length === 3 && + // doesn't contain another modifier + parts[2].indexOf(":") === -1 && + // is not from the exclude list + !issetExcludeList.includes(parts[2]) + ) { + result.push(key + ":isset"); + } + } + } + + return result; + } + /** * Parses the specified SQL index and returns an object with its components. *