diff --git a/CHANGELOG.md b/CHANGELOG.md index 75392d0..af29237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.5.5] - 2026-06-02 + +### Fixed + +- **`actionError` swallowed non-`Error` throws** — when an action threw a plain object (e.g. an HTTP error response), `actionError` was set to `undefined` instead of wrapping the value; it now reads `.message` then `.body.message` from the thrown object and wraps the result in a proper `Error`, so callers always receive a usable error or `undefined` + ## [1.5.4] - 2026-06-02 ### Changed diff --git a/CLAUDE.md b/CLAUDE.md index 442f722..736709c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -112,7 +112,7 @@ const { data, execute, state, rollback, rollbackTo, reset, destroy } = createSvS - `isDirty: Readable` - Whether state has been modified (derived from `isDirtyByField`) - `isDirtyByField: Readable` - Per-field dirty tracking; keys are dot-notation property paths. When a nested field changes, all parent paths are also marked dirty (e.g., changing `customer.address.street` marks `customer.address` and `customer` as dirty). Cleared on `reset()`, `rollback()`, and successful action (respecting `resetDirtyOnAction`). - `actionInProgress: Readable` - Action execution status - - `actionError: Readable` - Last action error + - `actionError: Readable` - Last action error; non-`Error` thrown objects are wrapped by reading `.message` then `.body.message` before falling back to `String()` - `snapshots: Readable[]>` - Snapshot history for undo - `asyncErrors: Readable` - Async validation errors (keyed by property path) - `hasAsyncErrors: Readable` - Whether any async validation errors exist diff --git a/demo/package-lock.json b/demo/package-lock.json index 3ffac47..0e4d1cd 100644 --- a/demo/package-lock.json +++ b/demo/package-lock.json @@ -8,31 +8,31 @@ "name": "svstate-demo", "version": "1.0.0", "dependencies": { - "svelte": "^5.55.1", - "zod": "^4.3.6" + "svelte": "^5.56.1", + "zod": "^4.4.3" }, "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^7.0.0", - "@tailwindcss/postcss": "^4.2.2", - "@tailwindcss/vite": "^4.2.2", + "@sveltejs/vite-plugin-svelte": "^7.1.2", + "@tailwindcss/postcss": "^4.3.0", + "@tailwindcss/vite": "^4.3.0", "@tsconfig/svelte": "^5.0.8", - "@typescript-eslint/eslint-plugin": "^8.58.0", - "@typescript-eslint/parser": "^8.58.0", - "eslint": "^10.1.0", + "@typescript-eslint/eslint-plugin": "^8.60.1", + "@typescript-eslint/parser": "^8.60.1", + "eslint": "^10.4.1", "eslint-config-prettier": "^10.1.8", - "eslint-plugin-simple-import-sort": "^12.1.1", - "eslint-plugin-svelte": "^3.16.0", + "eslint-plugin-simple-import-sort": "^13.0.0", + "eslint-plugin-svelte": "^3.19.0", "eslint-plugin-unicorn": "^64.0.0", - "postcss": "^8.5.8", - "prettier": "^3.8.1", - "prettier-plugin-svelte": "^3.5.1", - "svelte-check": "^4.4.6", - "svelte-eslint-parser": "^1.6.0", - "svelte-preprocess": "^6.0.3", - "tailwindcss": "^4.2.2", + "postcss": "^8.5.15", + "prettier": "^3.8.3", + "prettier-plugin-svelte": "^4.1.0", + "svelte-check": "^4.5.0", + "svelte-eslint-parser": "^1.7.1", + "svelte-preprocess": "^6.0.5", + "tailwindcss": "^4.3.0", "tslib": "^2.8.1", - "typescript": "^5.9.3", - "vite": "^8.0.3" + "typescript": "^6.0.3", + "vite": "^8.0.16" }, "engines": { "node": ">=20", @@ -63,21 +63,21 @@ } }, "node_modules/@emnapi/core": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.1.tgz", - "integrity": "sha512-mukuNALVsoix/w1BJwFzwXBN/dHeejQtuVzcDsfOEsdpCumXb/E9j8w11h5S54tT1xhifGfbbSm/ICrObRb3KA==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz", + "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==", "dev": true, "license": "MIT", "optional": true, "dependencies": { - "@emnapi/wasi-threads": "1.2.0", + "@emnapi/wasi-threads": "1.2.1", "tslib": "^2.4.0" } }, "node_modules/@emnapi/runtime": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.9.1.tgz", - "integrity": "sha512-VYi5+ZVLhpgK4hQ0TAjiQiZ6ol0oe4mBx7mVv7IflsiEp0OWoVsp/+f9Vc1hOhE0TtkORVrI1GvzyreqpgWtkA==", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz", + "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==", "dev": true, "license": "MIT", "optional": true, @@ -86,9 +86,9 @@ } }, "node_modules/@emnapi/wasi-threads": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.0.tgz", - "integrity": "sha512-N10dEJNSsUx41Z6pZsXU8FjPjpBEplgH24sfkmITrBED1/U2Esum9F3lfLrMjKHHjmi557zQn7kR9R+XWXu5Rg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz", + "integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==", "dev": true, "license": "MIT", "optional": true, @@ -126,13 +126,13 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.23.3", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.3.tgz", - "integrity": "sha512-j+eEWmB6YYLwcNOdlwQ6L2OsptI/LO6lNBuLIqe5R7RetD658HLoF+Mn7LzYmAWWNNzdC6cqP+L6r8ujeYXWLw==", + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/object-schema": "^3.0.3", + "@eslint/object-schema": "^3.0.5", "debug": "^4.3.1", "minimatch": "^10.2.4" }, @@ -141,22 +141,22 @@ } }, "node_modules/@eslint/config-helpers": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.5.3.tgz", - "integrity": "sha512-lzGN0onllOZCGroKJmRwY6QcEHxbjBw1gwB8SgRSqK8YbbtEXMvKynsXc3553ckIEBxsbMBU7oOZXKIPGZNeZw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.6.0.tgz", + "integrity": "sha512-ii6Bw9jJ2zi2cWA2Z+9/QZ/+3DX6kwaV5Q986D/CdP3Lap3w/pgQZ373FV7byY/i7L4IRH/G43I5dz1ClsCbpA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^1.1.1" + "@eslint/core": "^1.2.1" }, "engines": { "node": "^20.19.0 || ^22.13.0 || >=24" } }, "node_modules/@eslint/core": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.1.1.tgz", - "integrity": "sha512-QUPblTtE51/7/Zhfv8BDwO0qkkzQL7P/aWWbqcf4xWLEYn1oKjdO0gglQBB4GAsu7u6wjijbCmzsUTy6mnk6oQ==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -167,9 +167,9 @@ } }, "node_modules/@eslint/object-schema": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.3.tgz", - "integrity": "sha512-iM869Pugn9Nsxbh/YHRqYiqd23AmIbxJOcpUMOuWCVNdoQJ5ZtwL6h3t0bcZzJUlC3Dq9jCFCESBZnX0GTv7iQ==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", "dev": true, "license": "Apache-2.0", "engines": { @@ -177,13 +177,13 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.6.1.tgz", - "integrity": "sha512-iH1B076HoAshH1mLpHMgwdGeTs0CYwL0SPMkGuSebZrwBp16v415e9NZXg2jtrqPVQjf6IANe2Vtlr5KswtcZQ==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.2.tgz", + "integrity": "sha512-+CNAzxglkrpNf/kKywqQfk74QjtceuOE7Qm+AF8miRvPF/wmmK5+OJOgVh3AVTT3RP2mH3+FOaxlE5v72owk0A==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@eslint/core": "^1.1.1", + "@eslint/core": "^1.2.1", "levn": "^0.4.1" }, "engines": { @@ -288,9 +288,9 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.2.tgz", - "integrity": "sha512-sNXv5oLJ7ob93xkZ1XnxisYhGYXfaG9f65/ZgYuAu3qt7b3NadcOEhLvx28hv31PgX8SZJRYrAIPQilQmFpLVw==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.4.tgz", + "integrity": "sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow==", "dev": true, "license": "MIT", "optional": true, @@ -307,9 +307,9 @@ } }, "node_modules/@oxc-project/types": { - "version": "0.122.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.122.0.tgz", - "integrity": "sha512-oLAl5kBpV4w69UtFZ9xqcmTi+GENWOcPF7FCrczTiBbmC0ibXxCwyvZGbO39rCVEuLGAZM84DH0pUIyyv/YJzA==", + "version": "0.133.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.133.0.tgz", + "integrity": "sha512-KzkdCd6Uxqnf6l3HOw1xfatAlUURA0g14cvBYFyJ5SaNOQbOUvBr9PKArcPcrNIeRsBdgcUzOGrhKveVpvOIGA==", "dev": true, "license": "MIT", "funding": { @@ -317,9 +317,9 @@ } }, "node_modules/@rolldown/binding-android-arm64": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-rc.12.tgz", - "integrity": "sha512-pv1y2Fv0JybcykuiiD3qBOBdz6RteYojRFY1d+b95WVuzx211CRh+ytI/+9iVyWQ6koTh5dawe4S/yRfOFjgaA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.3.tgz", + "integrity": "sha512-454rs7jHngixp/NMxd5srYD57OnzSlZ/eFTETjORQHLwJG1lRtmNOJcBerZlfu4GjKqeq8aCCIQrMdHyhI51Hw==", "cpu": [ "arm64" ], @@ -334,9 +334,9 @@ } }, "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-rc.12.tgz", - "integrity": "sha512-cFYr6zTG/3PXXF3pUO+umXxt1wkRK/0AYT8lDwuqvRC+LuKYWSAQAQZjCWDQpAH172ZV6ieYrNnFzVVcnSflAg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.3.tgz", + "integrity": "sha512-PcAhP+ynjURNyy8SKGl5DQP94aGuB/7JrXJb/t7P+hanXvQVMWzUvRRhBAcg/lNRadBhoUPqSoP4xw5tR/KBEA==", "cpu": [ "arm64" ], @@ -351,9 +351,9 @@ } }, "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0-rc.12.tgz", - "integrity": "sha512-ZCsYknnHzeXYps0lGBz8JrF37GpE9bFVefrlmDrAQhOEi4IOIlcoU1+FwHEtyXGx2VkYAvhu7dyBf75EJQffBw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.3.tgz", + "integrity": "sha512-9YpfeUvSE2RS7wysJ81uOZkXJz7f7Q55H2Gvp3VEw/EsahqDtrphrZ0EwDLK5vvKOzaCrBsjF8JmnMLcUt78Gg==", "cpu": [ "x64" ], @@ -368,9 +368,9 @@ } }, "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0-rc.12.tgz", - "integrity": "sha512-dMLeprcVsyJsKolRXyoTH3NL6qtsT0Y2xeuEA8WQJquWFXkEC4bcu1rLZZSnZRMtAqwtrF/Ib9Ddtpa/Gkge9Q==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.3.tgz", + "integrity": "sha512-yB1IlAsSNHncV6SCTL27/MVGR5htvQsoGxIv5KMGXALp+Ll1wYsn+x98M9MW7qa+NdSbvrrY7ANI4wLJ0n1e6g==", "cpu": [ "x64" ], @@ -385,9 +385,9 @@ } }, "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0-rc.12.tgz", - "integrity": "sha512-YqWjAgGC/9M1lz3GR1r1rP79nMgo3mQiiA+Hfo+pvKFK1fAJ1bCi0ZQVh8noOqNacuY1qIcfyVfP6HoyBRZ85Q==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.3.tgz", + "integrity": "sha512-Yi30IVAAfLUCy2MseFjbB1jAMDl1VMCAas5StnYp8da9+CKvMd2H2cbEjWcw5NPaPqzvYkVIaF1nNUG+b7u/sw==", "cpu": [ "arm" ], @@ -402,9 +402,9 @@ } }, "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-rc.12.tgz", - "integrity": "sha512-/I5AS4cIroLpslsmzXfwbe5OmWvSsrFuEw3mwvbQ1kDxJ822hFHIx+vsN/TAzNVyepI/j/GSzrtCIwQPeKCLIg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.3.tgz", + "integrity": "sha512-jsO7R8To+AdlYgUmN5sHSCZbfhtMBkO0WUx8iORQnPcMMdgr7qM2DQmMwgabs3GhNztdmoKkMKQFHD6DTMCIQw==", "cpu": [ "arm64" ], @@ -419,9 +419,9 @@ } }, "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-rc.12.tgz", - "integrity": "sha512-V6/wZztnBqlx5hJQqNWwFdxIKN0m38p8Jas+VoSfgH54HSj9tKTt1dZvG6JRHcjh6D7TvrJPWFGaY9UBVOaWPw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.3.tgz", + "integrity": "sha512-VWkUHwWriDciit80wleYwKILoR/KMvxh/IdwS/paX+ZgpuRpCrKLUdadJbc0NpBEiyhpYawsJ73j9aCvOH+f7Q==", "cpu": [ "arm64" ], @@ -436,9 +436,9 @@ } }, "node_modules/@rolldown/binding-linux-ppc64-gnu": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.0-rc.12.tgz", - "integrity": "sha512-AP3E9BpcUYliZCxa3w5Kwj9OtEVDYK6sVoUzy4vTOJsjPOgdaJZKFmN4oOlX0Wp0RPV2ETfmIra9x1xuayFB7g==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.3.tgz", + "integrity": "sha512-5f1laC0SlIR0yDbFCd8acUhvJIag6N3zC5P7oUPN6wX0aOma+uKJ0wBDH5aq7I1PVI2ttTlhJwzwRIBnLiSGEg==", "cpu": [ "ppc64" ], @@ -453,9 +453,9 @@ } }, "node_modules/@rolldown/binding-linux-s390x-gnu": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.0-rc.12.tgz", - "integrity": "sha512-nWwpvUSPkoFmZo0kQazZYOrT7J5DGOJ/+QHHzjvNlooDZED8oH82Yg67HvehPPLAg5fUff7TfWFHQS8IV1n3og==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.3.tgz", + "integrity": "sha512-Iq4ko0r4XsgbrF/LunNgHtAGLRRVE2kXonAXQ/MV0mC6jQpMOhW1SvtZja2EhC/kd05++bP78dsqBeIQyYJ6Yg==", "cpu": [ "s390x" ], @@ -470,9 +470,9 @@ } }, "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-rc.12.tgz", - "integrity": "sha512-RNrafz5bcwRy+O9e6P8Z/OCAJW/A+qtBczIqVYwTs14pf4iV1/+eKEjdOUta93q2TsT/FI0XYDP3TCky38LMAg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.3.tgz", + "integrity": "sha512-B8m6tD5+/N5FeNQFbKlLA/2yVq9ycQP1SeedyEYYKWBNR3ZQbkvIUcNnDNM03lO1l5F2roiiFJGgvoLLyZXtSg==", "cpu": [ "x64" ], @@ -487,9 +487,9 @@ } }, "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-rc.12.tgz", - "integrity": "sha512-Jpw/0iwoKWx3LJ2rc1yjFrj+T7iHZn2JDg1Yny1ma0luviFS4mhAIcd1LFNxK3EYu3DHWCps0ydXQ5i/rrJ2ig==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.3.tgz", + "integrity": "sha512-pSdpdUJHkuCxun9LE7jvgUB9qsRgaiyNNCX7m/AvHTcq67AiT/Yhoxvw5zPfhrM8k/BfP8ce/hMOpthKDpEUow==", "cpu": [ "x64" ], @@ -504,9 +504,9 @@ } }, "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0-rc.12.tgz", - "integrity": "sha512-vRugONE4yMfVn0+7lUKdKvN4D5YusEiPilaoO2sgUWpCvrncvWgPMzK00ZFFJuiPgLwgFNP5eSiUlv2tfc+lpA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.3.tgz", + "integrity": "sha512-OXXS3RKJgX2uLwM+gYyuH5omcH8fL1LJs96pZGgtetVCahON57+d4SJHzTgZiOjxgGkSnpXpOsWuPDGAKAigEg==", "cpu": [ "arm64" ], @@ -521,9 +521,9 @@ } }, "node_modules/@rolldown/binding-wasm32-wasi": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0-rc.12.tgz", - "integrity": "sha512-ykGiLr/6kkiHc0XnBfmFJuCjr5ZYKKofkx+chJWDjitX+KsJuAmrzWhwyOMSHzPhzOHOy7u9HlFoa5MoAOJ/Zg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.3.tgz", + "integrity": "sha512-JTtb8BWFynicNSoPrehsCzBtOKjZ6jhMiPFEmOiuXg1Fl8dn2KHQob+GuPSGR0dryQa1PQJbzjF3dqO/whhjLg==", "cpu": [ "wasm32" ], @@ -531,16 +531,18 @@ "license": "MIT", "optional": true, "dependencies": { - "@napi-rs/wasm-runtime": "^1.1.1" + "@emnapi/core": "1.10.0", + "@emnapi/runtime": "1.10.0", + "@napi-rs/wasm-runtime": "^1.1.4" }, "engines": { - "node": ">=14.0.0" + "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-rc.12.tgz", - "integrity": "sha512-5eOND4duWkwx1AzCxadcOrNeighiLwMInEADT0YM7xeEOOFcovWZCq8dadXgcRHSf3Ulh1kFo/qvzoFiCLOL1Q==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.3.tgz", + "integrity": "sha512-gEdFFEN70A/jxb2svrWsN3aDL7OUtmvlOy+6fa2jxG8K0wQ1ZbdeLGnidov6Yu5/733dI5ySfzFlQ/cb0bSz1g==", "cpu": [ "arm64" ], @@ -555,9 +557,9 @@ } }, "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-rc.12.tgz", - "integrity": "sha512-PyqoipaswDLAZtot351MLhrlrh6lcZPo2LSYE+VDxbVk24LVKAGOuE4hb8xZQmrPAuEtTZW8E6D2zc5EUZX4Lw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.3.tgz", + "integrity": "sha512-eXB7CHuaQdqmJcc3koCNtNPmT/bj2gc999kUFgBxG8Ac0NdgXc4rkCHhqrgrhN3zddvvvrgzj1e90SuSfmyIXA==", "cpu": [ "x64" ], @@ -572,25 +574,25 @@ } }, "node_modules/@rolldown/pluginutils": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.12.tgz", - "integrity": "sha512-HHMwmarRKvoFsJorqYlFeFRzXZqCt2ETQlEDOb9aqssrnVBB1/+xgTGtuTrIk5vzLNX1MjMtTf7W9z3tsSbrxw==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", "dev": true, "license": "MIT" }, "node_modules/@sveltejs/acorn-typescript": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.9.tgz", - "integrity": "sha512-lVJX6qEgs/4DOcRTpo56tmKzVPtoWAaVbL4hfO7t7NVwl9AAXzQR6cihesW1BmNMPl+bK6dreu2sOKBP2Q9CIA==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.10.tgz", + "integrity": "sha512-4WfKk68eTih+MiJD4fSbxN7E8kVBmTMPWHUPYjvl2N0rMs53YLTT8/YjKU5Dtnz5LqDjl7LEw4U7lXR2W3J5WA==", "license": "MIT", "peerDependencies": { "acorn": "^8.9.0" } }, "node_modules/@sveltejs/vite-plugin-svelte": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-7.0.0.tgz", - "integrity": "sha512-ILXmxC7HAsnkK2eslgPetrqqW1BKSL7LktsFgqzNj83MaivMGZzluWq32m25j2mDOjmSKX7GGWahePhuEs7P/g==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-7.1.2.tgz", + "integrity": "sha512-DrUBA2UXRfDmUX/ZTiEopd3X40yavsJF1FX2RygcuIScHL7o5YX1fMvoYnDhjeJQC4weCOklirpNWlcb2NiSeA==", "dev": true, "license": "MIT", "dependencies": { @@ -608,49 +610,49 @@ } }, "node_modules/@tailwindcss/node": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.2.2.tgz", - "integrity": "sha512-pXS+wJ2gZpVXqFaUEjojq7jzMpTGf8rU6ipJz5ovJV6PUGmlJ+jvIwGrzdHdQ80Sg+wmQxUFuoW1UAAwHNEdFA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.0.tgz", + "integrity": "sha512-aFb4gUhFOgdh9AXo4IzBEOzBkkAxm9VigwDJnMIYv3lcfXCJVesNfbEaBl4BNgVRyid92AmdviqwBUBRKSeY3g==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/remapping": "^2.3.5", - "enhanced-resolve": "^5.19.0", + "enhanced-resolve": "^5.21.0", "jiti": "^2.6.1", "lightningcss": "1.32.0", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", - "tailwindcss": "4.2.2" + "tailwindcss": "4.3.0" } }, "node_modules/@tailwindcss/oxide": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.2.2.tgz", - "integrity": "sha512-qEUA07+E5kehxYp9BVMpq9E8vnJuBHfJEC0vPC5e7iL/hw7HR61aDKoVoKzrG+QKp56vhNZe4qwkRmMC0zDLvg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.0.tgz", + "integrity": "sha512-F7HZGBeN9I0/AuuJS5PwcD8xayx5ri5GhjYUDBEVYUkexyA/giwbDNjRVrxSezE3T250OU2K/wp/ltWx3UOefg==", "dev": true, "license": "MIT", "engines": { "node": ">= 20" }, "optionalDependencies": { - "@tailwindcss/oxide-android-arm64": "4.2.2", - "@tailwindcss/oxide-darwin-arm64": "4.2.2", - "@tailwindcss/oxide-darwin-x64": "4.2.2", - "@tailwindcss/oxide-freebsd-x64": "4.2.2", - "@tailwindcss/oxide-linux-arm-gnueabihf": "4.2.2", - "@tailwindcss/oxide-linux-arm64-gnu": "4.2.2", - "@tailwindcss/oxide-linux-arm64-musl": "4.2.2", - "@tailwindcss/oxide-linux-x64-gnu": "4.2.2", - "@tailwindcss/oxide-linux-x64-musl": "4.2.2", - "@tailwindcss/oxide-wasm32-wasi": "4.2.2", - "@tailwindcss/oxide-win32-arm64-msvc": "4.2.2", - "@tailwindcss/oxide-win32-x64-msvc": "4.2.2" + "@tailwindcss/oxide-android-arm64": "4.3.0", + "@tailwindcss/oxide-darwin-arm64": "4.3.0", + "@tailwindcss/oxide-darwin-x64": "4.3.0", + "@tailwindcss/oxide-freebsd-x64": "4.3.0", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.0", + "@tailwindcss/oxide-linux-arm64-gnu": "4.3.0", + "@tailwindcss/oxide-linux-arm64-musl": "4.3.0", + "@tailwindcss/oxide-linux-x64-gnu": "4.3.0", + "@tailwindcss/oxide-linux-x64-musl": "4.3.0", + "@tailwindcss/oxide-wasm32-wasi": "4.3.0", + "@tailwindcss/oxide-win32-arm64-msvc": "4.3.0", + "@tailwindcss/oxide-win32-x64-msvc": "4.3.0" } }, "node_modules/@tailwindcss/oxide-android-arm64": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.2.2.tgz", - "integrity": "sha512-dXGR1n+P3B6748jZO/SvHZq7qBOqqzQ+yFrXpoOWWALWndF9MoSKAT3Q0fYgAzYzGhxNYOoysRvYlpixRBBoDg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.0.tgz", + "integrity": "sha512-TJPiq67tKlLuObP6RkwvVGDoxCMBVtDgKkLfa/uyj7/FyxvQwHS+UOnVrXXgbEsfUaMgiVvC4KbJnRr26ho4Ng==", "cpu": [ "arm64" ], @@ -665,9 +667,9 @@ } }, "node_modules/@tailwindcss/oxide-darwin-arm64": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.2.2.tgz", - "integrity": "sha512-iq9Qjr6knfMpZHj55/37ouZeykwbDqF21gPFtfnhCCKGDcPI/21FKC9XdMO/XyBM7qKORx6UIhGgg6jLl7BZlg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.0.tgz", + "integrity": "sha512-oMN/WZRb+SO37BmUElEgeEWuU8E/HXRkiODxJxLe1UTHVXLrdVSgfaJV7pSlhRGMSOiXLuxTIjfsF3wYvz8cgQ==", "cpu": [ "arm64" ], @@ -682,9 +684,9 @@ } }, "node_modules/@tailwindcss/oxide-darwin-x64": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.2.2.tgz", - "integrity": "sha512-BlR+2c3nzc8f2G639LpL89YY4bdcIdUmiOOkv2GQv4/4M0vJlpXEa0JXNHhCHU7VWOKWT/CjqHdTP8aUuDJkuw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.0.tgz", + "integrity": "sha512-N6CUmu4a6bKVADfw77p+iw6Yd9Q3OBhe0veaDX+QazfuVYlQsHfDgxBrsjQ/IW+zywL8mTrNd0SdJT/zgtvMdA==", "cpu": [ "x64" ], @@ -699,9 +701,9 @@ } }, "node_modules/@tailwindcss/oxide-freebsd-x64": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.2.2.tgz", - "integrity": "sha512-YUqUgrGMSu2CDO82hzlQ5qSb5xmx3RUrke/QgnoEx7KvmRJHQuZHZmZTLSuuHwFf0DJPybFMXMYf+WJdxHy/nQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.0.tgz", + "integrity": "sha512-zDL5hBkQdH5C6MpqbK3gQAgP80tsMwSI26vjOzjJtNCMUo0lFgOItzHKBIupOZNQxt3ouPH7RPhvNhiTfCe5CQ==", "cpu": [ "x64" ], @@ -716,9 +718,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.2.2.tgz", - "integrity": "sha512-FPdhvsW6g06T9BWT0qTwiVZYE2WIFo2dY5aCSpjG/S/u1tby+wXoslXS0kl3/KXnULlLr1E3NPRRw0g7t2kgaQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.0.tgz", + "integrity": "sha512-R06HdNi7A7OEoMsf6d4tjZ71RCWnZQPHj2mnotSFURjNLdBC+cIgXQ7l81CqeoiQftjf6OOblxXMInMgN2VzMA==", "cpu": [ "arm" ], @@ -733,9 +735,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.2.2.tgz", - "integrity": "sha512-4og1V+ftEPXGttOO7eCmW7VICmzzJWgMx+QXAJRAhjrSjumCwWqMfkDrNu1LXEQzNAwz28NCUpucgQPrR4S2yw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.0.tgz", + "integrity": "sha512-qTJHELX8jetjhRQHCLilkVLmybpzNQAtaI/gaoVoidn/ufbNDbAo8KlK2J+yPoc8wQxvDxCmh/5lr8nC1+lTbg==", "cpu": [ "arm64" ], @@ -750,9 +752,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm64-musl": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.2.2.tgz", - "integrity": "sha512-oCfG/mS+/+XRlwNjnsNLVwnMWYH7tn/kYPsNPh+JSOMlnt93mYNCKHYzylRhI51X+TbR+ufNhhKKzm6QkqX8ag==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.0.tgz", + "integrity": "sha512-Z6sukiQsngnWO+l39X4pPbiWT81IC+PLKF+PHxIlyZbGNb9MODfYlXEVlFvej5BOZInWX01kVyzeLvHsXhfczQ==", "cpu": [ "arm64" ], @@ -767,9 +769,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-x64-gnu": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.2.2.tgz", - "integrity": "sha512-rTAGAkDgqbXHNp/xW0iugLVmX62wOp2PoE39BTCGKjv3Iocf6AFbRP/wZT/kuCxC9QBh9Pu8XPkv/zCZB2mcMg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.0.tgz", + "integrity": "sha512-DRNdQRpSGzRGfARVuVkxvM8Q12nh19l4BF/G7zGA1oe+9wcC6saFBHTISrpIcKzhiXtSrlSrluCfvMuledoCTQ==", "cpu": [ "x64" ], @@ -784,9 +786,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-x64-musl": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.2.2.tgz", - "integrity": "sha512-XW3t3qwbIwiSyRCggeO2zxe3KWaEbM0/kW9e8+0XpBgyKU4ATYzcVSMKteZJ1iukJ3HgHBjbg9P5YPRCVUxlnQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.0.tgz", + "integrity": "sha512-Z0IADbDo8bh6I7h2IQMx601AdXBLfFpEdUotft86evd/8ZPflZe9COPO8Q1vw+pfLWIUo9zN/JGZvwuAJqduqg==", "cpu": [ "x64" ], @@ -801,9 +803,9 @@ } }, "node_modules/@tailwindcss/oxide-wasm32-wasi": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.2.2.tgz", - "integrity": "sha512-eKSztKsmEsn1O5lJ4ZAfyn41NfG7vzCg496YiGtMDV86jz1q/irhms5O0VrY6ZwTUkFy/EKG3RfWgxSI3VbZ8Q==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.0.tgz", + "integrity": "sha512-HNZGOUxEmElksYR7S6sC5jTeNGpobAsy9u7Gu0AskJ8/20FR9GqebUyB+HBcU/ax6BHuiuJi+Oda4B+YX6H1yA==", "bundleDependencies": [ "@napi-rs/wasm-runtime", "@emnapi/core", @@ -819,10 +821,10 @@ "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "^1.8.1", - "@emnapi/runtime": "^1.8.1", - "@emnapi/wasi-threads": "^1.1.0", - "@napi-rs/wasm-runtime": "^1.1.1", + "@emnapi/core": "^1.10.0", + "@emnapi/runtime": "^1.10.0", + "@emnapi/wasi-threads": "^1.2.1", + "@napi-rs/wasm-runtime": "^1.1.4", "@tybys/wasm-util": "^0.10.1", "tslib": "^2.8.1" }, @@ -831,9 +833,9 @@ } }, "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.2.2.tgz", - "integrity": "sha512-qPmaQM4iKu5mxpsrWZMOZRgZv1tOZpUm+zdhhQP0VhJfyGGO3aUKdbh3gDZc/dPLQwW4eSqWGrrcWNBZWUWaXQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.0.tgz", + "integrity": "sha512-Pe+RPVTi1T+qymuuRpcdvwSVZjnll/f7n8gBxMMh3xLTctMDKqpdfGimbMyioqtLhUYZxdJ9wGNhV7MKHvgZsQ==", "cpu": [ "arm64" ], @@ -848,9 +850,9 @@ } }, "node_modules/@tailwindcss/oxide-win32-x64-msvc": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.2.2.tgz", - "integrity": "sha512-1T/37VvI7WyH66b+vqHj/cLwnCxt7Qt3WFu5Q8hk65aOvlwAhs7rAp1VkulBJw/N4tMirXjVnylTR72uI0HGcA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.0.tgz", + "integrity": "sha512-Mvrf2kXW/yeW/OTezZlCGOirXRcUuLIBx/5Y12BaPM7wJoryG6dfS/NJL8aBPqtTEx/Vm4T4vKzFUcKDT+TKUA==", "cpu": [ "x64" ], @@ -865,29 +867,29 @@ } }, "node_modules/@tailwindcss/postcss": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/postcss/-/postcss-4.2.2.tgz", - "integrity": "sha512-n4goKQbW8RVXIbNKRB/45LzyUqN451deQK0nzIeauVEqjlI49slUlgKYJM2QyUzap/PcpnS7kzSUmPb1sCRvYQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/postcss/-/postcss-4.3.0.tgz", + "integrity": "sha512-Jm05Tjx+9yCLGv5qw1c+84Psds8MnyrEQYCB+FFk2lgGiUjlRqdxke4mVTuYrj2xnVZqKim2Apr5ySuQRYAw/w==", "dev": true, "license": "MIT", "dependencies": { "@alloc/quick-lru": "^5.2.0", - "@tailwindcss/node": "4.2.2", - "@tailwindcss/oxide": "4.2.2", - "postcss": "^8.5.6", - "tailwindcss": "4.2.2" + "@tailwindcss/node": "4.3.0", + "@tailwindcss/oxide": "4.3.0", + "postcss": "^8.5.10", + "tailwindcss": "4.3.0" } }, "node_modules/@tailwindcss/vite": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.2.2.tgz", - "integrity": "sha512-mEiF5HO1QqCLXoNEfXVA1Tzo+cYsrqV7w9Juj2wdUFyW07JRenqMG225MvPwr3ZD9N1bFQj46X7r33iHxLUW0w==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.3.0.tgz", + "integrity": "sha512-t6J3OrB5Fc0ExuhohouH0fWUGMYL6PTLhW+E7zIk/pdbnJARZDCwjBznFnkh5ynRnIRSI4YjtTH0t6USjJISrw==", "dev": true, "license": "MIT", "dependencies": { - "@tailwindcss/node": "4.2.2", - "@tailwindcss/oxide": "4.2.2", - "tailwindcss": "4.2.2" + "@tailwindcss/node": "4.3.0", + "@tailwindcss/oxide": "4.3.0", + "tailwindcss": "4.3.0" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7 || ^8" @@ -901,9 +903,9 @@ "license": "MIT" }, "node_modules/@tybys/wasm-util": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz", - "integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==", + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz", + "integrity": "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==", "dev": true, "license": "MIT", "optional": true, @@ -938,17 +940,17 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.58.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.58.0.tgz", - "integrity": "sha512-RLkVSiNuUP1C2ROIWfqX+YcUfLaSnxGE/8M+Y57lopVwg9VTYYfhuz15Yf1IzCKgZj6/rIbYTmJCUSqr76r0Wg==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.60.1.tgz", + "integrity": "sha512-JQ4S5GB0tfjO8BuJ4fcX+HodkzJjYBV+7OJ+wLygaX7OGQ7FudyHL4NSCA6ob+w3Yn+5MkKIozOwQhXeM7opVg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.58.0", - "@typescript-eslint/type-utils": "8.58.0", - "@typescript-eslint/utils": "8.58.0", - "@typescript-eslint/visitor-keys": "8.58.0", + "@typescript-eslint/scope-manager": "8.60.1", + "@typescript-eslint/type-utils": "8.60.1", + "@typescript-eslint/utils": "8.60.1", + "@typescript-eslint/visitor-keys": "8.60.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.5.0" @@ -961,22 +963,22 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.58.0", + "@typescript-eslint/parser": "^8.60.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/parser": { - "version": "8.58.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.58.0.tgz", - "integrity": "sha512-rLoGZIf9afaRBYsPUMtvkDWykwXwUPL60HebR4JgTI8mxfFe2cQTu3AGitANp4b9B2QlVru6WzjgB2IzJKiCSA==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.60.1.tgz", + "integrity": "sha512-A0M6ua6H252bVjPvvtSgl2QA4+ET9S5Mtkb2GDyTxIhH/C4qDItT7RQNO5PhMC6NXGYXOR9dIalcDDgBKT7oFA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.58.0", - "@typescript-eslint/types": "8.58.0", - "@typescript-eslint/typescript-estree": "8.58.0", - "@typescript-eslint/visitor-keys": "8.58.0", + "@typescript-eslint/scope-manager": "8.60.1", + "@typescript-eslint/types": "8.60.1", + "@typescript-eslint/typescript-estree": "8.60.1", + "@typescript-eslint/visitor-keys": "8.60.1", "debug": "^4.4.3" }, "engines": { @@ -992,14 +994,14 @@ } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.58.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.58.0.tgz", - "integrity": "sha512-8Q/wBPWLQP1j16NxoPNIKpDZFMaxl7yWIoqXWYeWO+Bbd2mjgvoF0dxP2jKZg5+x49rgKdf7Ck473M8PC3V9lg==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.60.1.tgz", + "integrity": "sha512-eXkTH2bxmXlqD1RnOPmLZ9ZM9D3VwSx04JOwBnP9RQ+yUA5a2Mu7SfW8uaV2Aon53NJzZlZYuX7tn91Izf+xaw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.58.0", - "@typescript-eslint/types": "^8.58.0", + "@typescript-eslint/tsconfig-utils": "^8.60.1", + "@typescript-eslint/types": "^8.60.1", "debug": "^4.4.3" }, "engines": { @@ -1014,14 +1016,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.58.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.58.0.tgz", - "integrity": "sha512-W1Lur1oF50FxSnNdGp3Vs6P+yBRSmZiw4IIjEeYxd8UQJwhUF0gDgDD/W/Tgmh73mxgEU3qX0Bzdl/NGuSPEpQ==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.60.1.tgz", + "integrity": "sha512-gvI5OQoptnxQnchOirukCuQ55svJSTuD/4k5+pC267xyBtYry748R9/c3tYUzb/iE6RZfllRz2lVulLCHkTm4w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.58.0", - "@typescript-eslint/visitor-keys": "8.58.0" + "@typescript-eslint/types": "8.60.1", + "@typescript-eslint/visitor-keys": "8.60.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1032,9 +1034,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.58.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.58.0.tgz", - "integrity": "sha512-doNSZEVJsWEu4htiVC+PR6NpM+pa+a4ClH9INRWOWCUzMst/VA9c4gXq92F8GUD1rwhNvRLkgjfYtFXegXQF7A==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.60.1.tgz", + "integrity": "sha512-nh8w4qAteiKuZu3pSSzG/yGKpw0OlkrKnzFmbVRenKaD4qc+7i1GrmZaLVkr8rk4uipiPGMOW4YsM6WmKZ5CvA==", "dev": true, "license": "MIT", "engines": { @@ -1049,15 +1051,15 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.58.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.58.0.tgz", - "integrity": "sha512-aGsCQImkDIqMyx1u4PrVlbi/krmDsQUs4zAcCV6M7yPcPev+RqVlndsJy9kJ8TLihW9TZ0kbDAzctpLn5o+lOg==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.60.1.tgz", + "integrity": "sha512-sdwTrpjosW7ANQYJ39ZBF1ZyEMEGVB2UsikrserVM/30a/F1dTLnu9bGxEdosugyu5caigjLrR2qiD11asjI1A==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.58.0", - "@typescript-eslint/typescript-estree": "8.58.0", - "@typescript-eslint/utils": "8.58.0", + "@typescript-eslint/types": "8.60.1", + "@typescript-eslint/typescript-estree": "8.60.1", + "@typescript-eslint/utils": "8.60.1", "debug": "^4.4.3", "ts-api-utils": "^2.5.0" }, @@ -1074,9 +1076,10 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.58.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.58.0.tgz", - "integrity": "sha512-O9CjxypDT89fbHxRfETNoAnHj/i6IpRK0CvbVN3qibxlLdo5p5hcLmUuCCrHMpxiWSwKyI8mCP7qRNYuOJ0Uww==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.60.1.tgz", + "integrity": "sha512-4h0tY8ppCkdCzcrl2YM5M3my0xsE1Tf8om3owEu5oPWmXwkKRmk0j0LGDzYBGUcAlesEbxBhazqu/K4cu3Ug7w==", + "devOptional": true, "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1087,16 +1090,16 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.58.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.58.0.tgz", - "integrity": "sha512-7vv5UWbHqew/dvs+D3e1RvLv1v2eeZ9txRHPnEEBUgSNLx5ghdzjHa0sgLWYVKssH+lYmV0JaWdoubo0ncGYLA==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.60.1.tgz", + "integrity": "sha512-alpRkfG8hlVE5kdJW2GkfgDgXxold3e8e4l6EnmhRmRLbekgAPCCGDVD++sABy9FcgPFroq+uFcCSM1vR57Cew==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.58.0", - "@typescript-eslint/tsconfig-utils": "8.58.0", - "@typescript-eslint/types": "8.58.0", - "@typescript-eslint/visitor-keys": "8.58.0", + "@typescript-eslint/project-service": "8.60.1", + "@typescript-eslint/tsconfig-utils": "8.60.1", + "@typescript-eslint/types": "8.60.1", + "@typescript-eslint/visitor-keys": "8.60.1", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", @@ -1115,16 +1118,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.58.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.58.0.tgz", - "integrity": "sha512-RfeSqcFeHMHlAWzt4TBjWOAtoW9lnsAGiP3GbaX9uVgTYYrMbVnGONEfUCiSss+xMHFl+eHZiipmA8WkQ7FuNA==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.60.1.tgz", + "integrity": "sha512-h2MPBLoNtjc3qZWfY3Tl51yPorQ2McHn8pJfcMNTcIvrrZrr90Ykffit0yjrPFWQcRcUxzH20+6OcVdW4yHtUg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", - "@typescript-eslint/scope-manager": "8.58.0", - "@typescript-eslint/types": "8.58.0", - "@typescript-eslint/typescript-estree": "8.58.0" + "@typescript-eslint/scope-manager": "8.60.1", + "@typescript-eslint/types": "8.60.1", + "@typescript-eslint/typescript-estree": "8.60.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1139,13 +1142,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.58.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.58.0.tgz", - "integrity": "sha512-XJ9UD9+bbDo4a4epraTwG3TsNPeiB9aShrUneAVXy8q4LuwowN+qu89/6ByLMINqvIMeI9H9hOHQtg/ijrYXzQ==", + "version": "8.60.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.60.1.tgz", + "integrity": "sha512-EbGRQg4FhrmwLodl+t3JNAnXHWVr9Vp+Zl1QBZVPY4ByfkzIT8cX3K6QWODHtkIZqqJVEWvhHSx3v5PDHsaQag==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.58.0", + "@typescript-eslint/types": "8.60.1", "eslint-visitor-keys": "^5.0.0" }, "engines": { @@ -1250,9 +1253,9 @@ } }, "node_modules/brace-expansion": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz", - "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==", + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", + "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", "dev": true, "license": "MIT", "dependencies": { @@ -1489,9 +1492,9 @@ } }, "node_modules/devalue": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.6.4.tgz", - "integrity": "sha512-Gp6rDldRsFh/7XuouDbxMH3Mx8GMCcgzIb1pDTvNyn8pZGQ22u+Wa+lGV9dQCltFQ7uVw0MhRyb8XDskNFOReA==", + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.8.1.tgz", + "integrity": "sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw==", "license": "MIT" }, "node_modules/electron-to-chromium": { @@ -1502,14 +1505,14 @@ "license": "ISC" }, "node_modules/enhanced-resolve": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.20.1.tgz", - "integrity": "sha512-Qohcme7V1inbAfvjItgw0EaxVX5q2rdVEZHRBrEQdRZTssLDGsL8Lwrznl8oQ/6kuTJONLaDcGjkNP247XEhcA==", + "version": "5.22.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.22.1.tgz", + "integrity": "sha512-6QEuw3zoX1SJQc7b87aBXke/no+mG2bTBgw29gWMQonLmpEkWoCAVkl+M49e48AZlWzxiDzDZzYdp6kobcyLww==", "dev": true, "license": "MIT", "dependencies": { "graceful-fs": "^4.2.4", - "tapable": "^2.3.0" + "tapable": "^2.3.3" }, "engines": { "node": ">=10.13.0" @@ -1539,18 +1542,18 @@ } }, "node_modules/eslint": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.1.0.tgz", - "integrity": "sha512-S9jlY/ELKEUwwQnqWDO+f+m6sercqOPSqXM5Go94l7DOmxHVDgmSFGWEzeE/gwgTAr0W103BWt0QLe/7mabIvA==", + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.4.1.tgz", + "integrity": "sha512-AyIKhnOBuOAdueD7RB3xB+YeAWScb9jHsJBgH2Hcde8InP5JYhqrRR6iTMHyTEwgENK54Cp44e4v8BwNhsuHuw==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", - "@eslint/config-array": "^0.23.3", - "@eslint/config-helpers": "^0.5.3", - "@eslint/core": "^1.1.1", - "@eslint/plugin-kit": "^0.6.1", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.6.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.2", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", @@ -1611,9 +1614,9 @@ } }, "node_modules/eslint-plugin-simple-import-sort": { - "version": "12.1.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-12.1.1.tgz", - "integrity": "sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-13.0.0.tgz", + "integrity": "sha512-McAc+/Nlvcg4byY/CABGH8kqnefWBj8s3JA2okEtz8ixbECQgU46p0HkTUKa4YS7wvgGceimlc34p1nXqbWqtA==", "dev": true, "license": "MIT", "peerDependencies": { @@ -1621,9 +1624,9 @@ } }, "node_modules/eslint-plugin-svelte": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-3.16.0.tgz", - "integrity": "sha512-DJXxqpYZUxcE0SfYo8EJzV2ZC+zAD7fJp1n1HwcEMRR1cOEUYvjT9GuzJeNghMjgb7uxuK3IJAzI+x6zzUxO5A==", + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-3.19.0.tgz", + "integrity": "sha512-t3rNaZeXz4d2gG4uJyMEYfJCFKf22+SWbSizIIXIWKu4wM+XPLiMWuSSr/C5821JmFeN9ogK+eExbG+z+twyxw==", "dev": true, "license": "MIT", "dependencies": { @@ -1636,7 +1639,7 @@ "postcss-load-config": "^3.1.4", "postcss-safe-parser": "^7.0.0", "semver": "^7.6.3", - "svelte-eslint-parser": "^1.4.0" + "svelte-eslint-parser": "^1.7.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1807,13 +1810,20 @@ } }, "node_modules/esrap": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/esrap/-/esrap-2.2.4.tgz", - "integrity": "sha512-suICpxAmZ9A8bzJjEl/+rLJiDKC0X4gYWUxT6URAWBLvlXmtbZd5ySMu/N2ZGEtMCAmflUDPSehrP9BQcsGcSg==", + "version": "2.2.10", + "resolved": "https://registry.npmjs.org/esrap/-/esrap-2.2.10.tgz", + "integrity": "sha512-HUTyxhhAQBl1hhsyLlHD1sh9xF6o6vaejzLxK5sge+LzrdEflQPQaNhC+n98d+OVB8v3LCCF+y80x/4bACjjJw==", "license": "MIT", "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15", + "@jridgewell/sourcemap-codec": "^1.4.15" + }, + "peerDependencies": { "@typescript-eslint/types": "^8.2.0" + }, + "peerDependenciesMeta": { + "@typescript-eslint/types": { + "optional": true + } } }, "node_modules/esrecurse": { @@ -2499,9 +2509,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", "dev": true, "funding": [ { @@ -2643,9 +2653,9 @@ } }, "node_modules/postcss": { - "version": "8.5.8", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", - "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", "dev": true, "funding": [ { @@ -2663,7 +2673,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.11", + "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -2790,9 +2800,9 @@ } }, "node_modules/prettier": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.1.tgz", - "integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==", + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz", + "integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==", "dev": true, "license": "MIT", "bin": { @@ -2806,14 +2816,17 @@ } }, "node_modules/prettier-plugin-svelte": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.5.1.tgz", - "integrity": "sha512-65+fr5+cgIKWKiqM1Doum4uX6bY8iFCdztvvp2RcF+AJoieaw9kJOFMNcJo/bkmKYsxFaM9OsVZK/gWauG/5mg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-4.1.0.tgz", + "integrity": "sha512-YZkhA2Q9oOerFFG9tq+2f98WYT7Z2JgrybJrAyrB78jpsH9i/DdgplXemehuFPgsldetFNCcR/yCcYlDjPy94Q==", "dev": true, "license": "MIT", + "engines": { + "node": ">=20" + }, "peerDependencies": { "prettier": "^3.0.0", - "svelte": "^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0" + "svelte": "^5.0.0" } }, "node_modules/punycode": { @@ -2864,14 +2877,14 @@ } }, "node_modules/rolldown": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.0-rc.12.tgz", - "integrity": "sha512-yP4USLIMYrwpPHEFB5JGH1uxhcslv6/hL0OyvTuY+3qlOSJvZ7ntYnoWpehBxufkgN0cvXxppuTu5hHa/zPh+A==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.3.tgz", + "integrity": "sha512-i00lAJ2ks1BYr7rjNjKC7BcqAS7nVfiT3QX1SI5aY+AFHblCmaUf9OE9dbdzDvW6dJxbi2ZCZiy9v3CcwOiX3g==", "dev": true, "license": "MIT", "dependencies": { - "@oxc-project/types": "=0.122.0", - "@rolldown/pluginutils": "1.0.0-rc.12" + "@oxc-project/types": "=0.133.0", + "@rolldown/pluginutils": "^1.0.0" }, "bin": { "rolldown": "bin/cli.mjs" @@ -2880,21 +2893,21 @@ "node": "^20.19.0 || >=22.12.0" }, "optionalDependencies": { - "@rolldown/binding-android-arm64": "1.0.0-rc.12", - "@rolldown/binding-darwin-arm64": "1.0.0-rc.12", - "@rolldown/binding-darwin-x64": "1.0.0-rc.12", - "@rolldown/binding-freebsd-x64": "1.0.0-rc.12", - "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.12", - "@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.12", - "@rolldown/binding-linux-arm64-musl": "1.0.0-rc.12", - "@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.12", - "@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.12", - "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.12", - "@rolldown/binding-linux-x64-musl": "1.0.0-rc.12", - "@rolldown/binding-openharmony-arm64": "1.0.0-rc.12", - "@rolldown/binding-wasm32-wasi": "1.0.0-rc.12", - "@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.12", - "@rolldown/binding-win32-x64-msvc": "1.0.0-rc.12" + "@rolldown/binding-android-arm64": "1.0.3", + "@rolldown/binding-darwin-arm64": "1.0.3", + "@rolldown/binding-darwin-x64": "1.0.3", + "@rolldown/binding-freebsd-x64": "1.0.3", + "@rolldown/binding-linux-arm-gnueabihf": "1.0.3", + "@rolldown/binding-linux-arm64-gnu": "1.0.3", + "@rolldown/binding-linux-arm64-musl": "1.0.3", + "@rolldown/binding-linux-ppc64-gnu": "1.0.3", + "@rolldown/binding-linux-s390x-gnu": "1.0.3", + "@rolldown/binding-linux-x64-gnu": "1.0.3", + "@rolldown/binding-linux-x64-musl": "1.0.3", + "@rolldown/binding-openharmony-arm64": "1.0.3", + "@rolldown/binding-wasm32-wasi": "1.0.3", + "@rolldown/binding-win32-arm64-msvc": "1.0.3", + "@rolldown/binding-win32-x64-msvc": "1.0.3" } }, "node_modules/sade": { @@ -2970,23 +2983,23 @@ } }, "node_modules/svelte": { - "version": "5.55.1", - "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.55.1.tgz", - "integrity": "sha512-QjvU7EFemf6mRzdMGlAFttMWtAAVXrax61SZYHdkD6yoVGQ89VeyKfZD4H1JrV1WLmJBxWhFch9H6ig/87VGjw==", + "version": "5.56.1", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.56.1.tgz", + "integrity": "sha512-eArsJmvl3xZVuTYD852PzIEdg2wgDdIZ1NEsIPbzAukHwi284B18No4nK2rCO9AwsWUDza4Cjvmoa4HaojTl5g==", "license": "MIT", "dependencies": { "@jridgewell/remapping": "^2.3.4", "@jridgewell/sourcemap-codec": "^1.5.0", - "@sveltejs/acorn-typescript": "^1.0.5", + "@sveltejs/acorn-typescript": "^1.0.10", "@types/estree": "^1.0.5", "@types/trusted-types": "^2.0.7", "acorn": "^8.12.1", "aria-query": "5.3.1", "axobject-query": "^4.1.0", "clsx": "^2.1.1", - "devalue": "^5.6.4", + "devalue": "^5.8.1", "esm-env": "^1.2.1", - "esrap": "^2.2.4", + "esrap": "^2.2.9", "is-reference": "^3.0.3", "locate-character": "^3.0.0", "magic-string": "^0.30.11", @@ -2997,9 +3010,9 @@ } }, "node_modules/svelte-check": { - "version": "4.4.6", - "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.4.6.tgz", - "integrity": "sha512-kP1zG81EWaFe9ZyTv4ZXv44Csi6Pkdpb7S3oj6m+K2ec/IcDg/a8LsFsnVLqm2nxtkSwsd5xPj/qFkTBgXHXjg==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.5.0.tgz", + "integrity": "sha512-9lNwPxCLWniFvQIcEv1LFqjIxcFtO3smb5+5BKbRJ3ttL4o2lXCej5rLF4DAnfLPI66oaA81vAxw6ILdIWI7kA==", "dev": true, "license": "MIT", "dependencies": { @@ -3021,9 +3034,9 @@ } }, "node_modules/svelte-eslint-parser": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-1.6.0.tgz", - "integrity": "sha512-qoB1ehychT6OxEtQAqc/guSqLS20SlA53Uijl7x375s8nlUT0lb9ol/gzraEEatQwsyPTJo87s2CmKL9Xab+Uw==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-1.7.1.tgz", + "integrity": "sha512-mmwwKL9L/MB0QyBKdfyWxGjDuQfEyzxWy5S9Kkd0O/V5XD57MQ33KQtXrO6vKLuP6PIt8CRozvOX1mxpcRTqUg==", "dev": true, "license": "MIT", "dependencies": { @@ -3037,7 +3050,7 @@ }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0", - "pnpm": "10.30.3" + "pnpm": "10.34.1" }, "funding": { "url": "https://github.com/sponsors/ota-meshi" @@ -3100,9 +3113,9 @@ } }, "node_modules/svelte-preprocess": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-6.0.3.tgz", - "integrity": "sha512-PLG2k05qHdhmRG7zR/dyo5qKvakhm8IJ+hD2eFRQmMLHp7X3eJnjeupUtvuRpbNiF31RjVw45W+abDwHEmP5OA==", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-6.0.5.tgz", + "integrity": "sha512-sgwew5yV/2eMeQobIWgAxCNarKwiTUDIc3siAUbq3sp0G6ONtzk0W+wJihMdqjbYb3iGU3ubpGv0usnnuXT3qg==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -3120,7 +3133,7 @@ "stylus": ">=0.55", "sugarss": "^2.0.0 || ^3.0.0 || ^4.0.0", "svelte": "^4.0.0 || ^5.0.0-next.100 || ^5.0.0", - "typescript": "^5.0.0" + "typescript": "^5.0.0 || ^6.0.0" }, "peerDependenciesMeta": { "@babel/core": { @@ -3156,16 +3169,16 @@ } }, "node_modules/tailwindcss": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.2.2.tgz", - "integrity": "sha512-KWBIxs1Xb6NoLdMVqhbhgwZf2PGBpPEiwOqgI4pFIYbNTfBXiKYyWoTsXgBQ9WFg/OlhnvHaY+AEpW7wSmFo2Q==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.0.tgz", + "integrity": "sha512-y6nxMGB1nMW9R6k96e5gdIFzcfL/gTJRNaqGes1YvkLnPVXzWgbqFF2yLC0T8G774n24cx3Pe8XrKoniCOAH+Q==", "dev": true, "license": "MIT" }, "node_modules/tapable": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.2.tgz", - "integrity": "sha512-1MOpMXuhGzGL5TTCZFItxCc0AARf1EZFQkGqMm7ERKj8+Hgr5oLvJOVFcC+lRmR8hCe2S3jC4T5D7Vg/d7/fhA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz", + "integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==", "dev": true, "license": "MIT", "engines": { @@ -3177,14 +3190,14 @@ } }, "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "dev": true, "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.3" + "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" @@ -3227,9 +3240,9 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -3289,17 +3302,17 @@ "license": "MIT" }, "node_modules/vite": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-8.0.3.tgz", - "integrity": "sha512-B9ifbFudT1TFhfltfaIPgjo9Z3mDynBTJSUYxTjOQruf/zHH+ezCQKcoqO+h7a9Pw9Nm/OtlXAiGT1axBgwqrQ==", + "version": "8.0.16", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.0.16.tgz", + "integrity": "sha512-h9bXPmJichP5fLmVQo3PyaGSDE2n3aPuomeAlVRm0JLmt4rY6zmPKd59HYI4LNW8oTK7tlTsuC7l/m7awx9Jcw==", "dev": true, "license": "MIT", "dependencies": { "lightningcss": "^1.32.0", "picomatch": "^4.0.4", - "postcss": "^8.5.8", - "rolldown": "1.0.0-rc.12", - "tinyglobby": "^0.2.15" + "postcss": "^8.5.15", + "rolldown": "1.0.3", + "tinyglobby": "^0.2.17" }, "bin": { "vite": "bin/vite.js" @@ -3315,8 +3328,8 @@ }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", - "@vitejs/devtools": "^0.1.0", - "esbuild": "^0.27.0", + "@vitejs/devtools": "^0.1.18", + "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", @@ -3432,9 +3445,9 @@ "license": "MIT" }, "node_modules/zod": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", - "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/demo/package.json b/demo/package.json index 66fde3a..14fd34b 100644 --- a/demo/package.json +++ b/demo/package.json @@ -19,30 +19,30 @@ "all": "node --run format:fix && node --run lint:fix && node --run ts:check && node --run build" }, "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^7.0.0", - "@tailwindcss/postcss": "^4.2.2", - "@tailwindcss/vite": "^4.2.2", + "@sveltejs/vite-plugin-svelte": "^7.1.2", + "@tailwindcss/postcss": "^4.3.0", + "@tailwindcss/vite": "^4.3.0", "@tsconfig/svelte": "^5.0.8", - "@typescript-eslint/eslint-plugin": "^8.58.0", - "@typescript-eslint/parser": "^8.58.0", - "eslint": "^10.1.0", + "@typescript-eslint/eslint-plugin": "^8.60.1", + "@typescript-eslint/parser": "^8.60.1", + "eslint": "^10.4.1", "eslint-config-prettier": "^10.1.8", - "eslint-plugin-simple-import-sort": "^12.1.1", - "eslint-plugin-svelte": "^3.16.0", + "eslint-plugin-simple-import-sort": "^13.0.0", + "eslint-plugin-svelte": "^3.19.0", "eslint-plugin-unicorn": "^64.0.0", - "postcss": "^8.5.8", - "prettier": "^3.8.1", - "prettier-plugin-svelte": "^3.5.1", - "svelte-check": "^4.4.6", - "svelte-eslint-parser": "^1.6.0", - "svelte-preprocess": "^6.0.3", - "tailwindcss": "^4.2.2", + "postcss": "^8.5.15", + "prettier": "^3.8.3", + "prettier-plugin-svelte": "^4.1.0", + "svelte-check": "^4.5.0", + "svelte-eslint-parser": "^1.7.1", + "svelte-preprocess": "^6.0.5", + "tailwindcss": "^4.3.0", "tslib": "^2.8.1", - "typescript": "^5.9.3", - "vite": "^8.0.3" + "typescript": "^6.0.3", + "vite": "^8.0.16" }, "dependencies": { - "svelte": "^5.55.1", - "zod": "^4.3.6" + "svelte": "^5.56.1", + "zod": "^4.4.3" } } diff --git a/demo/src/app.d.ts b/demo/src/app.d.ts index 46e712a..ff19f50 100644 --- a/demo/src/app.d.ts +++ b/demo/src/app.d.ts @@ -1,3 +1,8 @@ +declare module '*.postcss' { + const content: string; + export default content; +} + declare global { namespace App { // interface Error {} diff --git a/docs/assets/index-BxuovIe5.js b/docs/assets/index-BxuovIe5.js new file mode 100644 index 0000000..cc5562f --- /dev/null +++ b/docs/assets/index-BxuovIe5.js @@ -0,0 +1,537 @@ +(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible,d=()=>{};function f(e){return e()}function p(e){for(var t=0;t{e=n,t=r}),resolve:e,reject:t}}var h=1024,g=2048,_=4096,v=8192,y=16384,b=32768,x=1<<25,S=65536,C=1<<19,w=1<<20,T=1<<25,E=65536,ee=1<<21,te=1<<22,ne=1<<23,re=Symbol(`$state`),ie=Symbol(`legacy props`),ae=Symbol(``),oe=Symbol(`attributes`),se=Symbol(`class`),ce=Symbol(`style`),le=Symbol(`text`),ue=Symbol(`form reset`),de=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},fe=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function pe(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function me(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function he(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function ge(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function _e(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function ve(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function ye(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function be(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function xe(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Se(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Ce(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var we={},Te=Symbol(`uninitialized`),Ee=`http://www.w3.org/1999/xhtml`;function De(){console.warn(`https://svelte.dev/e/derived_inert`)}function Oe(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ke(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function Ae(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var D=!1;function je(e){D=e}var O;function Me(e){if(e===null)throw Oe(),we;return O=e}function Ne(){return Me(Sn(O))}function k(e){if(D){if(Sn(O)!==null)throw Oe(),we;O=e}}function Pe(e=1){if(D){for(var t=e,n=O;t--;)n=Sn(n);O=n}}function Fe(e=!0){for(var t=0,n=O;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else (r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=Sn(n);e&&n.remove(),n=i}}function Ie(e){if(!e||e.nodeType!==8)throw Oe(),we;return e.data}function Le(e){return e===this.v}function Re(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function ze(e){return!Re(e,this.v)}var Be=!1,Ve=!1;function He(){Ve=!0}var Ue=null;function We(e){Ue=e}function Ge(e,t=!1,n){Ue={p:Ue,i:!1,c:null,e:null,s:e,x:null,r:B,l:Ve&&!t?{s:null,u:null,$:[]}:null}}function Ke(e){var t=Ue,n=t.e;if(n!==null){t.e=null;for(var r of n)Rn(r)}return e!==void 0&&(t.x=e),t.i=!0,Ue=t.p,e??{}}function qe(){return!Ve||Ue!==null&&Ue.l===null}var Je=[];function Ye(){var e=Je;Je=[],p(e)}function Xe(e){if(Je.length===0&&!xt){var t=Je;queueMicrotask(()=>{t===Je&&Ye()})}Je.push(e)}function Ze(){for(;Je.length>0;)Ye()}function Qe(e){var t=B;if(t===null)return z.f|=ne,e;if(!(t.f&32768)&&!(t.f&4))throw e;$e(e,t)}function $e(e,t){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}var et=~(g|_|h);function tt(e,t){e.f=e.f&et|t}function nt(e){e.f&512||e.deps===null?tt(e,h):tt(e,_)}function rt(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=E,rt(t.deps))}function it(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),rt(e.deps),tt(e,h)}function at(e,t,n){if(e==null)return t(void 0),n&&n(void 0),d;let r=Ar(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}var ot=[];function st(e,t){return{subscribe:ct(e,t).subscribe}}function ct(e,t=d){let n=null,r=new Set;function i(t){if(Re(e,t)&&(e=t,n)){let t=!ot.length;for(let t of r)t[1](),ot.push(t,e);if(t){for(let e=0;e{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:o}}function lt(e,t,n){let r=!Array.isArray(e),i=r?[e]:e;if(!i.every(Boolean))throw Error(`derived() expects stores as input, got a falsy value`);let a=t.length<2;return st(n,(e,n)=>{let o=!1,s=[],c=0,l=d,u=()=>{if(c)return;l();let i=t(r?s[0]:s,e,n);a?e(i):l=typeof i==`function`?i:d},f=i.map((e,t)=>at(e,e=>{s[t]=e,c&=~(1<{c|=1<t=e)(),t}var dt=!1,ft=!1,pt=Symbol(`unmounted`);function A(e,t,n){let r=n[t]??={store:null,source:an(void 0),unsubscribe:d};if(r.store!==e&&!(pt in n))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=d;else{var i=!0;r.unsubscribe=at(e,e=>{i?r.source.v=e:P(r.source,e)}),i=!1}return e&&pt in n?ut(e):V(r.source)}function mt(){let e={};function t(){In(()=>{for(var t in e)e[t].unsubscribe();i(e,pt,{enumerable:!1,value:!0})})}return[e,t]}function ht(e){var t=ft;try{return ft=!1,[e(),ft]}finally{ft=t}}var gt=null,_t=null,j=null,vt=null,yt=null,bt=null,xt=!1,St=!1,Ct=null,wt=null,Tt=0,Et=1,Dt=class e{id=Et++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){_t===null?gt=_t=this:(_t.#n=this,this.#t=_t),_t=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)tt(r,g),t(r);for(r of n.m)tt(r,_),t(r)}this.#p.add(e)}#g(){this.#e=!0,Tt++>1e3&&(this.#S(),kt());for(let e of this.#u)this.#d.delete(e),tt(e,g),this.schedule(e);for(let e of this.#d)tt(e,_),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=Ct=[],r=[],i=wt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw It(e),this.#h()||this.discard(),t}if(j=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(Ct=null,wt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Ft(e,t);i.length>0&&j.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),vt=this,jt(r),jt(n),vt=null,this.#s?.resolve();var s=j;if(this.#a===0&&(this.#c.length===0||s!==null)&&(this.#S(),Be&&(this.#x(),j=s)),this.#c.length>0)if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this;s!==null&&s.#g()}#_(e,t,n){e.f^=h;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=h:i&4?t.push(r):Be&&i&16777224?n.push(r):xr(r)&&(i&16&&this.#d.add(r),Er(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null)for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),tt(i,g),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),j=this,this.#g()}#b(e){for(var t=0;t!l.current.get(e)[1]&&!this.current.has(e));if(r.length===0)e&&l.discard();else if(t.length>0){if(e)for(let e of this.#p)l.unskip_effect(e,e=>{e.f&4194320?l.schedule(e):l.#b([e])});l.activate();var i=new Set,a=new Map;for(var o of t)Mt(o,r,i,a);a=new Map;var s=[...l.current].filter(([e,t])=>{let n=this.current.get(e);return n?n[0]!==t[0]||n[1]!==t[1]:!0}).map(([e])=>e);if(s.length>0)for(let e of this.#l)!(e.f&155648)&&Nt(e,s,a)&&(e.f&4194320?(tt(e,g),l.schedule(e)):l.#u.add(e));if(l.#c.length>0&&!l.#m){l.apply();for(var c of l.#c)l.#_(c,[],[]);l.#c=[]}l.deactivate()}}}}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,Xe(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=m()).promise}static ensure(){if(j===null){let t=j=new e;!St&&!xt&&Xe(()=>{t.#e||t.flush()})}return j}apply(){if(!Be||!this.is_fork&&this.#t===null&&this.#n===null){yt=null;return}yt=new Map;for(let[e,[t]]of this.current)yt.set(e,t);for(let t=gt;t!==null;t=t.#n)if(!(t===this||t.is_fork)){var e=!1;if(t.id0)){tn.clear();for(let e of At){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)At.has(n)&&(At.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Er(n)}}At.clear()}}At=null}}function Mt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?Mt(i,t,n,r):e&4194320&&!(e&2048)&&Nt(i,t,r)&&(tt(i,g),Pt(i))}}function Nt(e,t,r){let i=r.get(e);if(i!==void 0)return i;if(e.deps!==null)for(let i of e.deps){if(n.call(t,i))return!0;if(i.f&2&&Nt(i,t,r))return r.set(i,!0),!0}return r.set(e,!1),!1}function Pt(e){j.schedule(e)}function Ft(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),tt(e,h);for(var n=e.first;n!==null;)Ft(n,t),n=n.next}}function It(e){tt(e,h);for(var t=e.first;t!==null;)It(t),t=t.next}function Lt(e){let t=0,n=rn(0),r;return()=>{Fn()&&(V(n),Un(()=>(t===0&&(r=Ar(()=>e(()=>un(n)))),t+=1,()=>{Xe(()=>{--t,t===0&&(r?.(),r=void 0,un(n))})})))}}var Rt=S|C;function zt(e,t,n,r){new Bt(e,t,n,r)}var Bt=class{parent;is_pending=!1;transform_error;#e;#t=D?O:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Lt(()=>(this.#m=rn(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=B;t.b=this,t.f|=128,n(e)},this.parent=B.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Wn(()=>{if(D){let e=this.#t;Ne();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},Rt),D&&(this.#e=O)}#g(){try{this.#a=Gn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=Gn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Gn(()=>e(this.#e)),Xe(()=>{var e=this.#c=document.createDocumentFragment(),t=bn();e.append(t),this.#a=this.#x(()=>Gn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,Qn(this.#o,()=>{this.#o=null}),this.#b(j))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Gn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();nr(this.#a,e);let t=this.#n.pending;this.#o=Gn(()=>t(this.#e))}else this.#b(j)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){it(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=B,n=z,r=Ue;lr(this.#i),cr(this.#i),We(this.#i.ctx);try{return Dt.ensure(),e()}catch(e){return Qe(e),null}finally{lr(t),cr(n),We(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&Qn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Xe(()=>{this.#d=!1,this.#m&&sn(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),V(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;j?.is_fork?(this.#a&&j.skip_effect(this.#a),this.#o&&j.skip_effect(this.#o),this.#s&&j.skip_effect(this.#s),j.oncommit(()=>{this.#C(e)})):this.#C(e)}#C(e){this.#a&&=(Yn(this.#a),null),this.#o&&=(Yn(this.#o),null),this.#s&&=(Yn(this.#s),null),D&&(Me(this.#t),Pe(),Me(Fe()));var t=this.#n.onerror;let n=this.#n.failed;var r=!1,i=!1;let a=()=>{if(r){Ae();return}r=!0,i&&Ce(),this.#s!==null&&Qn(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){$e(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return Gn(()=>{var t=B;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return $e(e,this.#i.parent),null}}))};Xe(()=>{var t;try{t=this.transform_error(e)}catch(e){$e(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>$e(e,this.#i&&this.#i.parent)):o(t)})}};function Vt(e,t,n,r){let i=qe()?Gt:Jt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=B,c=Ht(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){$e(e,s)}Ut()}}var d=Wt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>qt(e))).then(u).catch(e=>$e(e,s)).finally(d)}l?l.then(()=>{c(),f(),Ut()}):f()}function Ht(){var e=B,t=z,n=Ue,r=j;return function(i=!0){lr(e),cr(t),We(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function Ut(e=!0){lr(null),cr(null),We(null),e&&j?.deactivate()}function Wt(){var e=B,t=e.b,n=j,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function Gt(e){var t=2|g;return B!==null&&(B.f|=C),{ctx:Ue,deps:null,effects:null,equals:Le,f:t,fn:e,reactions:null,rv:0,v:Te,wv:0,parent:B,ac:null}}var Kt=Symbol(`obsolete`);function qt(e,t,n){let r=B;r===null&&pe();var i=void 0,a=rn(Te),o=!z,s=new Set;return Hn(()=>{var t=B,n=m();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==de&&n.reject(e)}).finally(Ut)}catch(e){n.reject(e),Ut()}var c=j;if(o){if(t.f&32768)var l=Wt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(Kt);else for(let e of s.values())e.reject(Kt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==Kt&&(c.activate(),t?(a.f|=ne,sn(a,t)):(a.f&8388608&&(a.f^=ne),sn(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),In(()=>{for(let e of s)e.reject(Kt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function M(e){let t=Gt(e);return Be||dr(t),t}function Jt(e){let t=Gt(e);return t.equals=ze,t}function Yt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;nV(e))),t}function P(e,t,n=!1){return z!==null&&(!sr||z.f&131072)&&qe()&&z.f&4325394&&(ur===null||!ur.has(e))&&Se(),sn(e,n?fn(t):t,wt)}function sn(e,t,n=null){if(!e.equals(t)){tn.set(e,ar?t:e.v);var r=Dt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&Xt(t),yt===null&&nt(t)}e.wv=br(),dn(e,g,n),qe()&&B!==null&&B.f&1024&&!(B.f&96)&&(mr===null?hr([e]):mr.push(e)),!r.is_fork&&en.size>0&&!nn&&cn()}return t}function cn(){nn=!1;for(let e of en){e.f&1024&&tt(e,_);let t;try{t=xr(e)}catch{t=!0}t&&Er(e)}en.clear()}function ln(e,t=1){var n=V(e),r=t===1?n++:n--;return P(e,n),r}function un(e){P(e,e.v+1)}function dn(e,t,n){var r=e.reactions;if(r!==null)for(var i=qe(),a=r.length,o=0;o{if(vr===d)return e();var t=z,n=vr;cr(null),yr(d);var r=e();return cr(t),yr(n),r};return i&&r.set(`length`,N(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&be();var i=r.get(t);return i===void 0?f(()=>{var e=N(n.value,u);return r.set(t,e),e}):P(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>N(Te,u));r.set(t,e),un(o)}}else P(n,Te),un(o);return!0},get(e,n,i){if(n===re)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>N(fn(s?e[n]:Te),u)),r.set(n,o)),o!==void 0){var c=V(o);return c===Te?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=V(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==Te)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===re)return!0;var n=r.get(t),i=n!==void 0&&n.v!==Te||Reflect.has(e,t);return(n!==void 0||B!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>N(i?fn(e[t]):Te,u)),r.set(t,n)),V(n)===Te)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dN(Te,u)),r.set(d+``,p)):P(p,Te)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>N(void 0,u)),P(c,fn(n)),r.set(t,c));else{l=c.v!==Te;var m=f(()=>fn(n));P(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&P(g,_+1)}un(o)}return!0},ownKeys(e){V(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==Te});for(var[n,i]of r)i.v!==Te&&!(n in e)&&t.push(n);return t},setPrototypeOf(){xe()}})}function pn(e){try{if(typeof e==`object`&&e&&re in e)return e[re]}catch{}return e}function mn(e,t){return Object.is(pn(e),pn(t))}new Set([`copyWithin`,`fill`,`pop`,`push`,`reverse`,`shift`,`sort`,`splice`,`unshift`]);var hn,gn,_n,vn;function yn(){if(hn===void 0){hn=window,gn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;_n=a(t,`firstChild`).get,vn=a(t,`nextSibling`).get,u(e)&&(e[se]=void 0,e[oe]=null,e[ce]=void 0,e.__e=void 0),u(n)&&(n[le]=void 0)}}function bn(e=``){return document.createTextNode(e)}function xn(e){return _n.call(e)}function Sn(e){return vn.call(e)}function F(e,t){if(!D)return xn(e);var n=xn(O);if(n===null)n=O.appendChild(bn());else if(t&&n.nodeType!==3){var r=bn();return n?.before(r),Me(r),r}return t&&En(n),Me(n),n}function I(e,t=!1){if(!D){var n=xn(e);return n instanceof Comment&&n.data===``?Sn(n):n}if(t){if(O?.nodeType!==3){var r=bn();return O?.before(r),Me(r),r}En(O)}return O}function L(e,t=1,n=!1){let r=D?O:e;for(var i;t--;)i=r,r=Sn(r);if(!D)return r;if(n){if(r?.nodeType!==3){var a=bn();return r===null?i?.after(a):r.before(a),Me(a),a}En(r)}return Me(r),r}function Cn(e){e.textContent=``}function wn(){return!Be||At!==null?!1:(B.f&b)!==0}function Tn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function En(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Dn(e){D&&xn(e)!==null&&Cn(e)}var On=!1;function kn(){On||(On=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[ue]?.()})},{capture:!0}))}function An(e){var t=z,n=B;cr(null),lr(null);try{return e()}finally{cr(t),lr(n)}}function jn(e,t,n,r=n){e.addEventListener(t,()=>An(n));let i=e[ue];i?e[ue]=()=>{i(),r(!0)}:e[ue]=()=>r(!0),kn()}function Mn(e){B===null&&(z===null&&_e(e),ge()),ar&&he(e)}function Nn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Pn(e,t){var n=B;n!==null&&n.f&8192&&(e|=v);var r={ctx:Ue,deps:null,nodes:null,f:e|g|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};j?.register_created_effect(r);var i=r;if(e&4)Ct===null?Dt.ensure().schedule(r):Ct.push(r);else if(t!==null){try{Er(r)}catch(e){throw Yn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=S))}if(i!==null&&(i.parent=n,n!==null&&Nn(i,n),z!==null&&z.f&2&&!(e&64))){var a=z;(a.effects??=[]).push(i)}return r}function Fn(){return z!==null&&!sr}function In(e){let t=Pn(8,null);return tt(t,h),t.teardown=e,t}function Ln(e){Mn(`$effect`);var t=B.f;if(!z&&t&32&&Ue!==null&&!Ue.i){var n=Ue;(n.e??=[]).push(e)}else return Rn(e)}function Rn(e){return Pn(4|w,e)}function zn(e){return Mn(`$effect.pre`),Pn(8|w,e)}function Bn(e){Dt.ensure();let t=Pn(64|C,e);return(e={})=>new Promise(n=>{e.outro?Qn(t,()=>{Yn(t),n(void 0)}):(Yn(t),n(void 0))})}function Vn(e){return Pn(4,e)}function Hn(e){return Pn(te|C,e)}function Un(e,t=0){return Pn(8|t,e)}function R(e,t=[],n=[],r=[]){Vt(r,t,n,t=>{Pn(8,()=>{e(...t.map(V))})})}function Wn(e,t=0){return Pn(16|t,e)}function Gn(e){return Pn(32|C,e)}function Kn(e){var t=e.teardown;if(t!==null){let e=ar,n=z;or(!0),cr(null);try{t.call(null)}finally{or(e),cr(n)}}}function qn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&An(()=>{e.abort(de)});var r=n.next;n.f&64?n.parent=null:Yn(n,t),n=r}}function Jn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Yn(t),t=n}}function Yn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Xn(e.nodes.start,e.nodes.end),n=!0),e.f|=x,qn(e,t&&!n),Tr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Kn(e),e.f^=x,e.f|=y;var i=e.parent;i!==null&&i.first!==null&&Zn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Xn(e,t){for(;e!==null;){var n=e===t?null:Sn(e);e.remove(),e=n}}function Zn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Qn(e,t,n=!0){var r=[];$n(e,r,!0);var i=()=>{n&&Yn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function $n(e,t,n){if(!(e.f&8192)){e.f^=v;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;$n(i,t,o?n:!1)}i=a}}}function er(e){tr(e,!0)}function tr(e,t){if(e.f&8192){e.f^=v,e.f&1024||(tt(e,g),Dt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;tr(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function nr(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Sn(n);t.append(n),n=i}}var rr=null,ir=!1,ar=!1;function or(e){ar=e}var z=null,sr=!1;function cr(e){z=e}var B=null;function lr(e){B=e}var ur=null;function dr(e){z!==null&&(!Be||z.f&2)&&(ur??=new Set).add(e)}var fr=null,pr=0,mr=null;function hr(e){mr=e}var gr=1,_r=0,vr=_r;function yr(e){vr=e}function br(){return++gr}function xr(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~E),t&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&yt===null&&tt(e,h)}return!1}function Sr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(!Be&&ur!==null&&ur.has(e)))for(var i=0;i{e.ac.abort(de)}),e.ac=null);try{e.f|=ee;var u=e.fn,d=u();e.f|=b;var f=e.deps,p=j?.is_fork;if(fr!==null){var m;if(p||Tr(e,pr),f!==null&&pr>0)for(f.length=pr+fr.length,m=0;m{requestAnimationFrame(()=>e()),setTimeout(()=>e())});await Promise.resolve(),Ot()}function V(e){var t=(e.f&2)!=0;if(rr?.add(e),z!==null&&!sr&&!(B!==null&&B.f&16384)&&(ur===null||!ur.has(e))){var r=z.deps;if(z.f&2097152)e.rv<_r&&(e.rv=_r,fr===null&&r!==null&&r[pr]===e?pr++:fr===null?fr=[e]:fr.push(e));else{z.deps??=[],n.call(z.deps,e)||z.deps.push(e);var i=e.reactions;i===null?e.reactions=[z]:n.call(i,z)||i.push(z)}}if(ar&&tn.has(e))return tn.get(e);if(t){var a=e;if(ar){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||kr(a))&&(o=Xt(a)),tn.set(a,o),o}var s=(a.f&512)==0&&!sr&&z!==null&&(ir||(z.f&512)!=0),c=(a.f&b)===0;xr(a)&&(s&&(a.f|=512),Zt(a)),s&&!c&&($t(a),Or(a))}if(yt?.has(e))return yt.get(e);if(e.f&8388608)throw e.v;return e.v}function Or(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&($t(t),Or(t))}function kr(e){if(e.v===Te)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(tn.has(t)||t.f&2&&kr(t))return!0;return!1}function Ar(e){var t=sr;try{return sr=!0,e()}finally{sr=t}}function jr(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(re in e)Mr(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&re in n&&Mr(n)}}}function Mr(e,t=new Set){if(typeof e==`object`&&e&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{Mr(e[n],t)}catch{}let n=l(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){let t=o(n);for(let n in t){let r=t[n].get;if(r)try{r.call(e)}catch{}}}}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var Nr=[`touchstart`,`touchmove`];function Pr(e){return Nr.includes(e)}var Fr=Symbol(`events`),Ir=new Set,Lr=new Set;function H(e,t,n){(t[Fr]??={})[e]=n}function Rr(e){for(var t=0;t{throw e});throw p}}finally{e[Fr]=t,delete e.currentTarget,cr(d),lr(f)}}}var Vr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Hr(e){return Vr?.createHTML(e)??e}function Ur(e){var t=Tn(`template`);return t.innerHTML=Hr(e.replaceAll(``,``)),t.content}function Wr(e,t){var n=B;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function U(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(``);return()=>{if(D)return Wr(O,null),O;i===void 0&&(i=Ur(a?e:``+e),n||(i=xn(i)));var t=r||gn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=xn(t),s=t.lastChild;Wr(o,s)}else Wr(t,t);return t}}function Gr(e=``){if(!D){var t=bn(e+``);return Wr(t,t),t}var n=O;return n.nodeType===3?En(n):(n.before(n=bn()),Me(n)),Wr(n,n),n}function Kr(){if(D)return Wr(O,null),O;var e=document.createDocumentFragment(),t=document.createComment(``),n=bn();return e.append(t,n),Wr(t,n),e}function W(e,t){if(D){var n=B;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=O),Ne();return}e!==null&&e.before(t)}function G(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[le]??=e.nodeValue)&&(e[le]=n,e.nodeValue=`${n}`)}function qr(e,t){return Yr(e,t)}var Jr=new Map;function Yr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){yn();var l=void 0,u=Bn(()=>{var s=n??t.appendChild(bn());zt(s,{pending:()=>{}},t=>{Ge({});var n=Ue;if(o&&(n.c=o),a&&(i.$$events=a),D&&Wr(t,null),l=e(t,i)||{},D&&(B.nodes.end=O,O===null||O.nodeType!==8||O.data!==`]`))throw Oe(),we;Ke()},c);var u=new Set,d=e=>{for(var n=0;n{for(var e of u)for(let n of[t,document]){var r=Jr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Br),r.delete(e),r.size===0&&Jr.delete(n)):r.set(e,i)}Lr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Xr.set(l,u),l}var Xr=new WeakMap,Zr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)er(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(er(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(Yn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();nr(r,t),t.append(bn()),this.#n.set(e,{effect:r,fragment:t})}else Yn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Qn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(Yn(n.effect),this.#n.delete(e))};ensure(e,t){var n=j,r=wn();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=bn();i.append(a),this.#n.set(e,{effect:Gn(()=>t(a)),fragment:i})}else this.#t.set(e,Gn(()=>t(this.anchor)));if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else D&&(this.anchor=O),this.#a(n)}};function K(e,t,n=!1){var r;D&&(r=O,Ne());var i=new Zr(e),a=n?S:0;function o(e,t){if(D){var n=Ie(r);if(e!==parseInt(n.substring(1))){var a=Fe();Me(a),i.anchor=a,je(!1),i.ensure(e,t),je(!0);return}}i.ensure(e,t)}Wn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Qr=Symbol(`NaN`);function $r(e,t,n){D&&Ne();var r=new Zr(e),i=!qe();Wn(()=>{var e=t();e!==e&&(e=Qr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function ei(e,t){return t}function ti(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;ni(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else --s},!1)}if(s===0){var l=i.length===0&&n!==null;if(l){var u=n,d=u.parentNode;Cn(d),d.append(u),e.items.clear()}ni(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function ni(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,oi(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=T,ci(d,null,c)):er(d):Qn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:Wn(()=>{p=V(f);var e=p.length;let t=!1;D&&Ie(c)===`[!`!=(e===0)&&(c=Fe(),Me(c),je(!1),t=!0);for(var r=new Set,u=j,v=wn(),y=0;ys(c)):(d=Gn(()=>s(ri??=bn())),d.f|=T)),e>r.size&&me(``,``,``),D&&e>0&&Me(Fe()),!h)if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u);t&&je(!0),V(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,D&&(c=O)}function ai(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function oi(e,t,n,i,a){var o=(i&8)!=0,s=t.length,c=e.items,l=ai(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v0){var ee=i&4&&s===0?n:null;if(o){for(v=0;v{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function si(e,t,n,r,i,a,o,s){var c=o&1?o&16?rn(n):an(n,!1,!1):null,l=o&2?rn(i):null;return{v:c,i:l,e:Gn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function ci(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=Sn(r);if(a.before(r),r===i)return;r=o}}function li(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function ui(e,t,...n){var r=new Zr(e);Wn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},S)}var di=[...` +\r\f\xA0\v`];function fi(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||di.includes(r[o-1]))&&(s===r.length||di.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function pi(e,t,n,r,i,a){var o=e[se];if(D||o!==n||o===void 0){var s=fi(n,r,a);(!D||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[se]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function mi(t,n,r=!1){if(t.multiple){if(n==null)return;if(!e(n))return ke();for(var i of t.options)i.selected=n.includes(_i(i));return}for(i of t.options)if(mn(_i(i),n)){i.selected=!0;return}(!r||n!==void 0)&&(t.selectedIndex=-1)}function hi(e){var t=new MutationObserver(()=>{mi(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),In(()=>{t.disconnect()})}function gi(e,t,n=t){var r=new WeakSet,i=!0;jn(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),_i);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&_i(o)}n(a),e.__value=a,j!==null&&r.add(j)}),Vn(()=>{var a=t();if(e===document.activeElement){var o=Be?vt:j;if(r.has(o))return}if(mi(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=_i(s),n(a))}e.__value=a,i=!1}),hi(e)}function _i(e){return`__value`in e?e.__value:e.value}var vi=Symbol(`is custom element`),yi=Symbol(`is html`),bi=fe?`link`:`LINK`;function xi(e){if(D){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Si(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Si(e,`checked`,null),e.checked=r}}};e[ue]=n,Xe(n),kn()}}function Si(e,t,n,r){var i=Ci(e);D&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===bi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ae]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ti(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Ci(e){return e[oe]??={[vi]:e.nodeName.includes(`-`),[yi]:e.namespaceURI===Ee}}var wi=new Map;function Ti(e){var t=e.getAttribute(`is`)||e.nodeName,n=wi.get(t);if(n)return n;wi.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.push(s);i=l(i)}return n}function Ei(e,t,n=t){var r=new WeakSet;jn(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Oi(e)?ki(a):a,n(a),j!==null&&r.add(j),await Dr(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(D&&e.defaultValue!==e.value||Ar(t)==null&&e.value)&&(n(Oi(e)?ki(e.value):e.value),j!==null&&r.add(j)),Un(()=>{var n=t();if(e===document.activeElement){var i=Be?vt:j;if(r.has(i))return}Oi(e)&&n===ki(e.value)||e.type===`date`&&!n&&!e.value||n!==e.value&&(e.value=n??``)})}function Di(e,t,n=t){jn(e,`change`,t=>{n(t?e.defaultChecked:e.checked)}),(D&&e.defaultChecked!==e.checked||Ar(t)==null)&&n(e.checked),Un(()=>{e.checked=!!t()})}function Oi(e){var t=e.type;return t===`number`||t===`range`}function ki(e){return e===``?null:+e}function Ai(e=!1){let t=Ue,n=t.l.u;if(!n)return;let r=()=>jr(t.s);if(e){let e=0,n={},i=Gt(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>V(i)}n.b.length&&zn(()=>{ji(t,r),p(n.b)}),Ln(()=>{let e=Ar(()=>n.m.map(f));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&Ln(()=>{ji(t,r),p(n.a)})}function ji(e,t){if(e.l.s)for(let t of e.l.s)V(t);t()}function Mi(e,t,n,r){var i=!Ve||(n&2)!=0,o=(n&8)!=0,s=(n&16)!=0,c=r,l=!0,u=void 0,d=()=>s&&i?(u??=Gt(r),V(u)):(l&&(l=!1,c=s?Ar(r):r),c);let f;if(o){var p=re in e||ie in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=ht(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&ye(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?Gt:Jt)(()=>(v=!1,g()));o&&V(y);var b=B;return(function(e,t){if(arguments.length>0){let n=t?V(y):i&&o?fn(e):e;return P(y,n),v=!0,c!==void 0&&(c=n),e}return ar&&v||b.f&16384?y.v:V(y)})}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Ni(e){let t=e.batchSize??20,n=e.flushInterval??5e3,r=e.include,i=[],a,o=e=>!r||r.includes(e),s=(e,n)=>{o(e)&&(i.push({type:e,timestamp:Date.now(),detail:n}),i.length>=t&&c())},c=()=>{if(i.length===0)return;let t=i.splice(0);e.onFlush(t)};return{name:`analytics`,onInit(){n>0&&(a=setInterval(c,n))},onChange(t){let n=e.redact?.includes(t.property);s(`change`,{property:t.property,currentValue:n?`[redacted]`:t.currentValue,oldValue:n?`[redacted]`:t.oldValue})},onValidation(e){s(`validation`,{hasErrors:e!==void 0})},onSnapshot(e){s(`snapshot`,{title:e.title})},onAction(e){s(`action`,{phase:e.phase,error:e.error?.message})},onRollback(e){s(`rollback`,{title:e.title})},onReset(){s(`reset`,{})},destroy(){a!==void 0&&clearInterval(a),c()},flush(){c()},eventCount(){return i.length}}}function Pi(e){let t=e.idle??1e3,n=e.interval??0,r=e.saveOnDestroy??!0,i=e.onlyWhenDirty??!0,a,o,s,c=!1,l=!1,u=async()=>{if(a&&!(i&&!ut(a.state.isDirty))&&!c){c=!0;try{await e.save(a.data)}catch(t){e.onError?.(t)}finally{c=!1}}},d=()=>{clearTimeout(o),o=setTimeout(u,t)},f=()=>{typeof document<`u`&&document.visibilityState===`hidden`&&u()};return{name:`autosave`,onInit(t){a=t,n>0&&(s=setInterval(u,n)),e.onVisibilityHidden&&typeof document<`u`&&document.addEventListener(`visibilitychange`,f)},onChange(){d()},onAction(e){e.phase===`after`&&!e.error&&clearTimeout(o)},destroy(){if(l=!0,clearTimeout(o),s!==void 0&&clearInterval(s),typeof document<`u`&&document.removeEventListener(`visibilitychange`,f),r&&a&&(c=!1,!i||ut(a.state.isDirty)))try{let t=e.save(a.data);t instanceof Promise&&t.catch(t=>e.onError?.(t))}catch(t){e.onError?.(t)}},async saveNow(){l||(clearTimeout(o),c=!1,await u())},isSaving(){return c}}}var Fi=()=>{try{return import.meta.env?.PROD===!0}catch{return!1}};function Ii(e){let t=e?.name??`svstate`,n=e?.collapsed??!0,r=e?.logValidation??!1,i=e?.logValues??!1,a=e?.enabled??!Fi(),o=(e,...r)=>{if(!a)return;let i=new Date().toISOString().slice(11,23);(n?console.groupCollapsed:console.group)(`[${t}] ${e} (${i})`);for(let e of r)console.log(e);console.groupEnd()};return{name:`devtools`,onChange(e){i?o(`change`,{property:e.property,from:e.oldValue,to:e.currentValue}):o(`change`,{property:e.property})},onValidation(e){r&&o(`validation`,e)},onSnapshot(e){o(`snapshot`,{title:e.title})},onAction(e){e.error?o(`action:${e.phase}`,{params:e.params,error:e.error.message}):o(`action:${e.phase}`,{params:e.params})},onRollback(e){o(`rollback`,{title:e.title})},onReset(){o(`reset`)}}}var Li=new Set([`__proto__`,`constructor`,`prototype`]),Ri=e=>typeof e==`object`&&!!e&&!Array.isArray(e),zi=e=>Ri(e)&&typeof e.version==`number`&&Ri(e.data),Bi=(e,t)=>{for(let n of Object.keys(t))Li.has(n)||(e[n]=t[n])},Vi=(e,t)=>{let n=t.split(`.`),r=e;for(let e of n){if(r==null)return;r=r[e]}return r},Hi=(e,t,n)=>{let r=t.split(`.`),i=e;for(let e=0;e{if(t){let n={};for(let r of t){let t=Vi(e,r);t!==void 0&&Hi(n,r,t)}return n}if(n){let t={...e};for(let e of n){let n=e.split(`.`);if(n.length===1)delete t[e];else{let e=t;for(let t=0;t`u`?void 0:localStorage),n=e.throttle??300,r=e.version??1,i=!1,a,o,s=()=>{if(!t||!o)return;let n={version:r,data:Ui(o,e.include,e.exclude)};t.setItem(e.key,JSON.stringify(n))},c=()=>{clearTimeout(a),a=setTimeout(s,n)};return{name:`persist`,onInit(n){if(o=n.data,!t)return;let a=t.getItem(e.key);if(a)try{let t=JSON.parse(a);if(!zi(t))return;let o=t;if(e.migrate&&o.version!==r){let t=e.migrate(o.data,o.version);if(!Ri(t))return;o={version:r,data:t}}Bi(n.data,o.data),i=!0}catch{}},onChange(){c()},onReset(){s()},destroy(){a!==void 0&&(clearTimeout(a),s())},clearPersistedState(){t?.removeItem(e.key)},isRestored(){return i}}}var Gi=new Set([`__proto__`,`constructor`,`prototype`]),Ki=e=>typeof e==`object`&&!!e&&!Array.isArray(e),qi=10,Ji=(e,t=0)=>t>qi?!1:Ki(e)?Object.values(e).every(e=>Ji(e,t+1)):!0,Yi=(e,t)=>{for(let n of Object.keys(t))Gi.has(n)||(e[n]=t[n])};function Xi(e){let t=e.throttle??100,n=e.merge??`overwrite`,r,i,a=!1,o,s=0,c=()=>{if(!r||!i)return;let e=JSON.parse(JSON.stringify(i.data));r.postMessage({type:`sync`,data:e})},l=()=>{clearTimeout(o),o=setTimeout(c,t)},u=()=>{clearTimeout(o),r&&=(r.close(),void 0)};return{name:`sync`,onInit(o){i=o,!(typeof BroadcastChannel>`u`)&&(r=new BroadcastChannel(e.key),r.addEventListener(`message`,e=>{if(!i||n===`ignore`||e.data?.type!==`sync`)return;let r=Date.now();r-s{if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return e.map(e=>o(e));let t=Object.create(Object.getPrototypeOf(e));for(let n of Object.keys(e))t[n]=o(e[n]);return t};return{name:`undo-redo`,redoStack:{subscribe:t.subscribe},onInit(e){r=e,i=e.state.snapshots.subscribe(e=>{e.length0&&(a=n.at(-1)),n=e})},onRollback(){a&&=(t.update(t=>{let n=[...t,a],r=e?.maxRedoStack;return r&&r>0?n.slice(-r):n}),void 0)},onChange(){t.set([])},onReset(){t.set([])},redo(){if(!r)return;let e=ut(t);if(e.length===0)return;let n=e.at(-1);t.set(e.slice(0,-1)),r.snapshot(`Undo`),Object.assign(r.data,o(n.data))},canRedo(){return ut(t).length>0},destroy(){i?.()}}}var Qi=e=>typeof e==`object`&&!!e&&!(e instanceof Date)&&!(e instanceof Map)&&!(e instanceof Set)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof RegExp)&&!(e instanceof Error)&&!(e instanceof Promise),$i=(e,t)=>{let n=(e,i)=>new Proxy(e,{get(e,t){if(typeof t==`symbol`)return e[t];let r=e[t];if(Qi(r)){let e=Number.isInteger(Number(t))?``:String(t);return n(r,e?i?`${i}.${e}`:e:i)}return r},set(e,n,a){if(typeof n==`symbol`)return e[n]=a,!0;let o=e[n];if(o!==a){e[n]=a;let s=Number.isInteger(Number(n))?``:String(n);t(r,s?i?`${i}.${s}`:s:i,a,o)}return!0}}),r=n(e,``);return r},ea=e=>Object.values(e).some(e=>typeof e==`string`?!!e:ea(e)),ta=e=>!!e&&ea(e),na=new Set([`__proto__`,`constructor`,`prototype`]),ra=e=>{if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return e.map(e=>ra(e));let t=Object.create(Object.getPrototypeOf(e));for(let n of Object.keys(e))na.has(n)||(t[n]=ra(e[n]));return t},ia=(e,t)=>{let n=t.split(`.`),r=e;for(let e of n){if(r==null)return;r=r[e]}return r},aa=(e,t)=>{if(!e)return``;let n=t.split(`.`),r=e;for(let e of n){if(typeof r==`string`||r[e]===void 0)return``;r=r[e]}return typeof r==`string`?r:``},oa=(e,t)=>{let n=[];for(let r of Object.keys(e))(r===t||r.startsWith(t+`.`)||t.startsWith(r+`.`))&&n.push(r);return n},sa={resetDirtyOnAction:!0,debounceValidation:0,allowConcurrentActions:!1,persistActionError:!1,debounceAsyncValidation:300,runAsyncValidationOnInit:!1,clearAsyncErrorsOnChange:!0,maxConcurrentAsyncValidations:4,maxSnapshots:50,plugins:[]};function ca(e,t,n){let r={...sa,...n},{validator:i,effect:a,asyncValidator:o}=t??{},s=ct(),c=lt(s,ta),l=ct({}),u=lt(l,e=>Object.keys(e).length>0),d=ct(!1),f=ct(),p=ct([{title:`Initial`,data:ra(e)}]),m=ct({}),h=ct(new Set),g=lt(h,e=>[...e]),_=lt(m,e=>Object.values(e).some(e=>!!e)),v=lt([c,_],([e,t])=>e||t),y=new Map,b=[],x=e=>{l.update(t=>{let n={...t,[e]:!0},r=e.split(`.`);for(let e=1;e{for(let n of C){let r=n[e];typeof r==`function`&&r.call(n,...t)}},T=()=>{if(!i)return;let e=i(ue);s.set(e),w(`onValidation`,e)},E=(e,t=!0)=>{let n=ut(p),i={title:e,data:ra(S)},a=n.at(-1),o=t&&a&&a.title===e?[...n.slice(0,-1),i]:[...n,i];if(r.maxSnapshots>0&&o.length>r.maxSnapshots){let e=o.length-r.maxSnapshots;o=[o[0],...o.slice(1+e)]}p.set(o),w(`onSnapshot`,i)},ee=!1,te,ne=()=>{if(i)if(r.debounceValidation>0)clearTimeout(te),te=setTimeout(()=>{T()},r.debounceValidation);else{if(ee)return;ee=!0,queueMicrotask(()=>{T(),ee=!1})}},re=e=>{let t=b.indexOf(e);t!==-1&&b.splice(t,1)},ie=e=>{re(e);let t=y.get(e);t&&(clearTimeout(t.timeoutId),t.controller.abort(),y.delete(e),h.update(t=>(t.delete(e),new Set(t))))},ae=()=>{b.length=0;for(let e of y.keys())ie(e);m.set({})},oe=async(e,t)=>{if(!o){t();return}let n=o[e];if(!n){t();return}if(aa(ut(s),e)){t();return}let r=new AbortController;y.set(e,{controller:r,timeoutId:0}),h.update(t=>new Set([...t,e]));try{let t=await n(ia(ue,e),ue,r.signal);r.signal.aborted||m.update(n=>({...n,[e]:t}))}catch(t){if(t instanceof Error&&t.name===`AbortError`)return;if(!r.signal.aborted){let n=t instanceof Error?t.message:`Async validation error`;m.update(t=>({...t,[e]:n}))}}finally{y.delete(e),h.update(t=>(t.delete(e),new Set(t))),t()}},se=()=>{for(;b.length>0&&!(ut(h).size>=r.maxConcurrentAsyncValidations);){let e=b.shift();e&&oe(e,se)}},ce=e=>{if(!o||!o[e])return;ie(e),r.clearAsyncErrorsOnChange&&m.update(t=>{let n={...t};return delete n[e],n});let t=new AbortController,n=setTimeout(()=>{y.delete(e),ut(h).size{if(!o)return;let t=oa(o,e);for(let e of t)ce(e)},ue=$i(S,(e,t,n,i)=>{if(r.persistActionError||f.set(void 0),x(t),a?.({snapshot:E,target:e,property:t,currentValue:n,oldValue:i})instanceof Promise)throw Error(`svstate: effect callback must be synchronous. Use action for async operations.`);w(`onChange`,{target:e,property:t,currentValue:n,oldValue:i}),ne(),le(t)});if(T(),o&&r.runAsyncValidationOnInit)for(let e of Object.keys(o))ce(e);let de=async e=>{if(!(!r.allowConcurrentActions&&ut(d))){w(`onAction`,{phase:`before`,params:e}),f.set(void 0),d.set(!0);try{await t?.action?.(e),r.resetDirtyOnAction&&l.set({}),p.set([{title:`Initial`,data:ra(S)}]),await t?.actionCompleted?.(),w(`onAction`,{phase:`after`,params:e})}catch(n){await t?.actionCompleted?.(n);let r=n instanceof Error?n:n&&typeof n==`object`?Error(String(n.message??n.body?.message??n)):void 0;f.set(r),w(`onAction`,{phase:`after`,params:e,error:r})}finally{d.set(!1)}}},fe=(e,t)=>{let n=t[e];if(n)return ae(),l.set({}),Object.assign(S,ra(n.data)),p.set(t.slice(0,e+1)),T(),n},pe=(e=1)=>{let t=ut(p);if(t.length<=1)return;let n=fe(Math.max(0,t.length-1-e),t);n&&w(`onRollback`,n)},me=e=>{let t=ut(p);if(t.length<=1)return!1;for(let n=t.length-1;n>=0;n--)if(t[n].title===e){let e=fe(n,t);return e&&w(`onRollback`,e),!0}return!1},he=()=>{let e=ut(p);e[0]&&(fe(0,e),w(`onReset`))},ge={errors:s,hasErrors:c,isDirty:u,isDirtyByField:l,actionInProgress:d,actionError:f,snapshots:p,asyncErrors:m,hasAsyncErrors:_,asyncValidating:g,hasCombinedErrors:v};return w(`onInit`,{data:ue,state:ge,options:r,snapshot:E}),{data:ue,execute:de,state:ge,rollback:pe,rollbackTo:me,reset:he,destroy:()=>{for(let e=C.length-1;e>=0;e--)C[e]?.destroy?.()}}}var la={trim:e=>e.trim(),normalize:e=>e.replaceAll(/\s{2,}/g,` `),upper:e=>e.toUpperCase(),lower:e=>e.toLowerCase(),localeUpper:e=>e.toLocaleUpperCase(),localeLower:e=>e.toLocaleLowerCase()};function q(e){let t=``,n=e==null,r=e??``,i=e=>{t||=e},a={prepare(...e){return r=e.reduce((e,t)=>la[t](e),r),a},required(){return!t&&(n||!r)&&i(`Required`),a},requiredIf(e){return e&&!t&&(n||!r)&&i(`Required`),a},noSpace(){return n||!t&&r.includes(` `)&&i(`No space allowed`),a},notBlank(){return n||!t&&r.length>0&&r.trim().length===0&&i(`Must not be blank`),a},minLength(e){return n||!t&&r.lengthe&&i(`Max length ${e}`),a},uppercase(){return n||!t&&r!==r.toUpperCase()&&i(`Uppercase only`),a},lowercase(){return n||!t&&r!==r.toLowerCase()&&i(`Lowercase only`),a},startsWith(e){if(t)return a;let n=Array.isArray(e)?e:[e];return r&&!n.some(e=>r.startsWith(e))&&i(`Must start with ${n.join(`, `)}`),a},regexp(e,n){return!t&&r&&!e.test(r)&&i(n??`Not allowed chars`),a},in(e){if(t)return a;let n=Array.isArray(e)?e:Object.keys(e);return r&&!n.includes(r)&&i(`Must be one of: ${n.join(`, `)}`),a},notIn(e){if(t)return a;let n=Array.isArray(e)?e:Object.keys(e);return r&&n.includes(r)&&i(`Must not be one of: ${n.join(`, `)}`),a},email(){return!t&&r&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)&&i(`Invalid email format`),a},website(e=`optional`){if(t||!r||e===`optional`)return a;let n=/^https?:\/\//.test(r);return e===`required`&&!n?i(`Must start with http:// or https://`):e===`forbidden`&&n&&i(`Must not start with http:// or https://`),a},endsWith(e){if(t||!r)return a;let n=Array.isArray(e)?e:[e];return n.some(e=>r.endsWith(e))||i(`Must end with ${n.join(`, `)}`),a},contains(e){return!t&&r&&!r.includes(e)&&i(`Must contain "${e}"`),a},alphanumeric(){return!t&&r&&!/^[\dA-Za-z]+$/.test(r)&&i(`Only letters and numbers allowed`),a},numeric(){return!t&&r&&!/^\d+$/.test(r)&&i(`Only numbers allowed`),a},slug(){return!t&&r&&!/^[\da-z-]+$/.test(r)&&i(`Invalid slug format`),a},identifier(){return!t&&r&&!/^[A-Z_a-z]\w*$/.test(r)&&i(`Invalid identifier format`),a},getError(){return t}};return a}function ua(e){let t=``,n=e==null,r=e=>{t||=e},i={required(){return!t&&(n||Number.isNaN(e))&&r(`Required`),i},requiredIf(a){return a&&!t&&(n||Number.isNaN(e))&&r(`Required`),i},min(a){return n||!t&&ea&&r(`Maximum ${a}`),i},between(a,o){return n||!t&&(eo)&&r(`Must be between ${a} and ${o}`),i},integer(){return n||!t&&!Number.isInteger(e)&&r(`Must be an integer`),i},positive(){return n||!t&&e<=0&&r(`Must be positive`),i},negative(){return n||!t&&e>=0&&r(`Must be negative`),i},nonNegative(){return n||!t&&e<0&&r(`Must be non-negative`),i},notZero(){return n||!t&&e===0&&r(`Must not be zero`),i},multipleOf(a){return n||!t&&e%a!==0&&r(`Must be a multiple of ${a}`),i},step(a){return n||!t&&e%a!==0&&r(`Must be a multiple of ${a}`),i},decimal(a){return n||t||Number.isNaN(e)||(String(e).split(`.`)[1]?.length??0)>a&&r(`Maximum ${a} decimal places`),i},percentage(){return n||!t&&(e<0||e>100)&&r(`Must be between 0 and 100`),i},getError(){return t}};return i}function da(e){let t=``,n=e==null,r=e??[],i=e=>{t||=e},a={required(){return!t&&(n||r.length===0)&&i(`Required`),a},requiredIf(e){return e&&!t&&(n||r.length===0)&&i(`Required`),a},minLength(e){return n||!t&&r.lengthe&&i(`Maximum ${e} items`),a},unique(){if(n||t)return a;let e=new Set;for(let t of r){let n=typeof t==`object`?JSON.stringify(t):String(t);if(e.has(n)){i(`Items must be unique`);break}e.add(n)}return a},ofLength(e){return n||!t&&r.length!==e&&i(`Must have exactly ${e} items`),a},includes(e){if(n||t)return a;let o=typeof e==`object`?JSON.stringify(e):String(e);return r.some(e=>(typeof e==`object`?JSON.stringify(e):String(e))===o)||i(`Must include ${o}`),a},includesAny(e){if(n||t)return a;let o=e.map(e=>typeof e==`object`?JSON.stringify(e):String(e));return r.some(e=>{let t=typeof e==`object`?JSON.stringify(e):String(e);return o.includes(t)})||i(`Must include at least one of: ${o.join(`, `)}`),a},includesAll(e){if(n||t)return a;let o=new Set(r.map(e=>typeof e==`object`?JSON.stringify(e):String(e))),s=e.filter(e=>{let t=typeof e==`object`?JSON.stringify(e):String(e);return!o.has(t)});return s.length>0&&i(`Missing required items: ${s.map(e=>typeof e==`object`?JSON.stringify(e):String(e)).join(`, `)}`),a},getError(){return t}};return a}var fa=U(`
`),pa=U(`
 
`);function J(e,t){var n=pa(),r=F(n),i=e=>{var n=fa(),r=F(n,!0);k(n),R(()=>G(r,t.title)),W(e,n)};K(r,e=>{t.title&&e(i)});var a=L(r,2),o=F(a,!0);k(a),k(n),R(()=>G(o,t.code)),W(e,n)}var ma=U(`
Dirty Fields
 
`),ha=U(`
State Object
 
State Info
isDirty:
hasErrors:
Errors
 
`);function ga(e,t){Ge(t,!0);let n=Mi(t,`width`,3,`xl:w-80`);var r=ha(),i=F(r),a=L(F(i),2),o=F(a,!0);k(a),k(i);var s=L(i,2),c=L(F(s),2),l=F(c),u=L(F(l));k(l);var d=L(l,2),f=L(F(d));k(d),k(c),k(s);var p=L(s,2),m=e=>{var n=ma(),r=L(F(n),2),i=F(r,!0);k(r),k(n),R(e=>G(i,e),[()=>JSON.stringify(t.isDirtyByField,Object.keys(t.isDirtyByField).toSorted(),2)]),W(e,n)};K(p,e=>{t.isDirtyByField&&e(m)});var h=L(p,2),g=L(F(h),2),_=F(g,!0);k(g),k(h);var v=L(h,2);k(r),R((e,i)=>{pi(r,1,`w-full ${n()??``} flex-shrink-0 space-y-4`),G(o,e),G(u,` ${t.isDirty??``}`),G(f,` ${t.hasErrors??``}`),G(_,i)},[()=>JSON.stringify(t.data,void 0,2),()=>JSON.stringify(t.errors,void 0,2)]),H(`click`,v,function(...e){t.onFill?.apply(this,e)}),W(e,r),Ke()}Rr([`click`]);var _a=U(`

`);function va(e,t){var n=Kr(),r=I(n),i=e=>{var n=_a(),r=F(n,!0);k(n),R(()=>G(r,t.error)),W(e,n)};K(r,e=>{t.error&&e(i)}),W(e,n)}var ya=U(``),ba=U(`
`);function Y(e,t){Ge(t,!0);let n=Mi(t,`type`,3,`text`),r=Mi(t,`placeholder`,3,``),i=Mi(t,`value`,15),a=Mi(t,`error`,3,``),o=Mi(t,`required`,3,!0),s=Mi(t,`disabled`,3,!1),c=Mi(t,`variant`,3,`default`),l=M(()=>c()===`nested`?`bg-white`:`bg-gray-50`);var u=ba(),d=F(u),f=F(d),p=L(f),m=e=>{W(e,ya())};K(p,e=>{t.isDirty&&e(m)}),k(d);var h=L(d,2);xi(h);var g=L(h,2);{let e=M(()=>a()??``);va(g,{get error(){return V(e)}})}k(u),R(()=>{pi(d,1,`mb-2 block text-sm text-gray-900 ${o()?`font-bold`:``}`),Si(d,`for`,t.id),G(f,`${t.label??``} `),Si(h,`id`,t.id),pi(h,1,`block w-full rounded-lg border p-2.5 text-sm ${a()?`border-red-500 bg-red-50 text-red-900 placeholder-red-400 focus:border-red-500 focus:ring-red-500`:`border-gray-300 ${V(l)} text-gray-900 focus:border-blue-500 focus:ring-blue-500`} ${s()?`cursor-not-allowed opacity-50`:``}`),h.disabled=s(),Si(h,`max`,t.max),Si(h,`min`,t.min),Si(h,`placeholder`,r()),Si(h,`step`,t.step),Si(h,`type`,n())}),Ei(h,i),W(e,u),Ke()}var xa=U(`

`),Sa=U(`
`),Ca=U(`
`,1);function wa(e,t){var n=Ca(),r=I(n),i=F(r),a=F(i),o=F(a,!0);k(a);var s=L(a,2),c=e=>{var n=xa(),r=F(n,!0);k(n),R(()=>G(r,t.description)),W(e,n)},l=e=>{W(e,Sa())};K(s,e=>{t.description?e(c):e(l,-1)}),ui(L(s,2),()=>t.main),k(i),ui(L(i,2),()=>t.sidebar),k(r);var u=L(r,2),d=e=>{var n=Kr();ui(I(n),()=>t.sourceCode),W(e,n)};K(u,e=>{t.sourceCode&&e(d)}),R(()=>G(o,t.title)),W(e,n)}var Ta=U(`
`),Ea=U(`
`);function Da(e,t){let n=N(!1);var r=Ea(),i=F(r),a=L(F(i),2);k(i);var o=L(i,2),s=e=>{var n=Ta();ui(F(n),()=>t.children),k(n),W(e,n)};K(o,e=>{V(n)&&e(s)}),k(r),R(()=>{pi(i,1,`flex w-full cursor-pointer items-center justify-between px-4 py-3 text-left text-sm font-medium text-gray-900 hover:bg-gray-50 ${V(n)?`border-b border-gray-200`:``}`),pi(a,0,`h-5 w-5 transform transition-transform ${V(n)?`rotate-180`:``}`)}),H(`click`,i,()=>P(n,!V(n))),W(e,r)}Rr([`click`]);var Oa=U(`
`);function ka(e,t){var n=Oa(),r=F(n),i=F(r,!0);k(r);var a=L(r,2),o=F(a,!0);k(a),k(n),R(()=>{pi(r,1,`rounded px-2.5 py-0.5 text-xs font-medium ${t.hasErrors?`bg-red-100 text-red-800`:`bg-green-100 text-green-800`}`),G(i,t.hasErrors?`Has Errors`:`Valid`),pi(a,1,`rounded px-2.5 py-0.5 text-xs font-medium ${t.isDirty?`bg-yellow-100 text-yellow-800`:`bg-gray-100 text-gray-800`}`),G(o,t.isDirty?`Modified`:`Clean`)}),W(e,n)}var X=()=>Math.random().toString(36).slice(2,8),Aa=(e,t)=>Math.floor(Math.random()*(t-e+1))+e,ja=U(`
`),Ma=U(`
`),Na=U(` Submitting...`),Pa=U(`
`,1),Fa=U(`
Action State
actionInProgress:
actionError:
`),Ia=U(` `,1);function La(e,t){Ge(t,!0);let n=()=>A(h,`$hasErrors`,s),r=()=>A(g,`$isDirty`,s),i=()=>A(_,`$actionInProgress`,s),a=()=>A(m,`$errors`,s),o=()=>A(v,`$actionError`,s),[s,c]=mt(),l={title:`Task ${X()}`,description:`This is a sample task description with ID ${X()}`},u=N(!1),d=N(void 0),{data:f,execute:p,state:{errors:m,hasErrors:h,isDirty:g,actionInProgress:_,actionError:v}}=ca(l,{validator:e=>({title:q(e.title).prepare(`trim`).required().minLength(3).maxLength(50).getError(),description:q(e.description).prepare(`trim`).required().minLength(10).maxLength(200).getError()}),action:async()=>{let e=Aa(100,1e3);if(await new Promise(t=>setTimeout(t,e)),V(u))throw Error(`Simulated server error after ${e}ms`);P(d,`Submitted successfully in ${e}ms!`)},actionCompleted:e=>{e&&P(d,void 0)}}),y=()=>{f.title=`Task ${X()}`,f.description=`This is a sample task description with ID ${X()}`},b=()=>{P(d,void 0),p()};wa(e,{description:`Demonstrates async action execution with loading states and error handling.`,title:`Action Demo`,main:e=>{var t=Pa(),s=I(t);ka(s,{get hasErrors(){return n()},get isDirty(){return r()}});var c=L(s,2),l=F(c),p=F(l,!0);k(l),k(c);var m=L(c,2),h=F(m);{let e=M(()=>a()?.title);Y(h,{id:`title`,get disabled(){return i()},get error(){return V(e)},label:`Title`,placeholder:`Enter task title`,get value(){return f.title},set value(e){f.title=e}})}var g=L(h,2);{let e=M(()=>a()?.description);Y(g,{id:`description`,get disabled(){return i()},get error(){return V(e)},label:`Description`,placeholder:`Enter task description (min 10 characters)`,get value(){return f.description},set value(e){f.description=e}})}var _=L(g,2),v=F(_);xi(v),Pe(2),k(_),k(m);var y=L(m,2),x=e=>{var t=ja(),n=F(t),r=L(F(n),2),i=F(r,!0);k(r),k(n),k(t),R(()=>G(i,o().message)),W(e,t)};K(y,e=>{o()&&e(x)});var S=L(y,2),C=e=>{var t=Ma(),n=F(t),r=L(F(n),2),i=F(r,!0);k(r),k(n),k(t),R(()=>G(i,V(d))),W(e,t)};K(S,e=>{V(d)&&e(C)});var w=L(S,2),T=F(w),E=F(T),ee=e=>{W(e,Na())},te=e=>{W(e,Gr(`Submit`))};K(E,e=>{i()?e(ee):e(te,-1)}),k(T),k(w),R(()=>{pi(l,1,`rounded px-2.5 py-0.5 text-xs font-medium ${i()?`bg-blue-100 text-blue-800`:`bg-gray-100 text-gray-800`}`),G(p,i()?`In Progress`:`Idle`),v.disabled=i(),T.disabled=n()||i()}),Di(v,()=>V(u),e=>P(u,e)),H(`click`,T,b),W(e,t)},sidebar:e=>{var t=Fa(),s=F(t);ga(s,{get data(){return f},get errors(){return a()},get hasErrors(){return n()},get isDirty(){return r()},onFill:y});var c=L(s,2),l=L(F(c),2),u=F(l),d=L(F(u));k(u);var p=L(u,2),m=L(F(p));k(p),k(l),k(c),k(t),R(()=>{G(d,` ${i()??``}`),G(m,` ${o()?.message??`none`??``}`)}),W(e,t)},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=Ia(),r=I(n);J(r,{code:`const { data, execute, state: { errors, hasErrors, isDirty, actionInProgress, actionError } } = + createSvState(sourceData, { + validator: (source) => ({ + title: stringValidator(source.title).prepare('trim').required().minLength(3).maxLength(50).getError(), + description: stringValidator(source.description).prepare('trim').required().minLength(10).getError() + }), + action: async () => { + // Simulate API call with 100-1000ms delay + const delay = randomInt(100, 1000); + await new Promise((resolve) => setTimeout(resolve, delay)); + + if (shouldFail) { + throw new Error('Simulated server error'); + } + }, + actionCompleted: (error) => { + // Called after action completes (success or failure) + console.log(error ? 'Action failed' : 'Action succeeded'); + } + });`,title:`State Setup with Action`});var i=L(r,2);J(i,{code:`// Execute the action + + +// With parameters (if action accepts them) +execute({ userId: 123 });`,title:`Execute Action`}),J(L(i,2),{code:`// Display action error +{#if $actionError} +
+ {$actionError.message} +
+{/if} + +// Check if action is in progress +{#if $actionInProgress} +
Submitting...
+{/if}`,title:`Error & Loading States`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),c()}Rr([`click`]);var Ra=U(`
`);function za(e,t){let n=Mi(t,`label`,3,`Item`);var r=Ra(),i=F(r),a=F(i),o=F(a);k(a);var s=L(a,2);k(i),ui(L(i,2),()=>t.children),k(r),R(()=>G(o,`${n()??``} #${t.index+1}`)),H(`click`,s,function(...e){t.onRemove?.apply(this,e)}),W(e,r)}Rr([`click`]);var Ba=U(`

`);function Va(e,t){var n=Ba(),r=F(n),i=F(r,!0);k(r),k(n),R(()=>G(i,t.message)),W(e,n)}var Ha=U(`
`),Ua=U(`
`),Wa=U(`
`),Ga=U(`
Contacts
`,1),Ka=U(` `,1);function qa(e,t){Ge(t,!0);let n=()=>A(l,`$hasErrors`,a),r=()=>A(u,`$isDirty`,a),i=()=>A(c,`$errors`,a),[a,o]=mt(),{data:s,state:{errors:c,hasErrors:l,isDirty:u}}=ca({listName:``,items:[]},{validator:e=>({listName:q(e.listName).prepare(`trim`).required().minLength(2).getError(),items:da(e.items).required().minLength(1).getError(),...Object.fromEntries(e.items.map((e,t)=>[`item_${t}`,{name:q(e.name).prepare(`trim`).required().minLength(2).getError(),email:q(e.email).prepare(`trim`).required().email().getError()}]))})}),d=()=>{s.items=[...s.items,{name:``,email:``}]},f=e=>{s.items=s.items.filter((t,n)=>n!==e)},p=()=>{s.listName=`Contact List ${X()}`,s.items=[{name:`John Doe`,email:`john@example.com`},{name:`Jane Smith`,email:`jane@example.com`},{name:`Bob Wilson`,email:`bob@example.com`}]};wa(e,{description:`Shows how to validate dynamic arrays with per-item validation using indexed error keys.`,title:`Array Property Demo`,main:e=>{var t=Ga(),a=I(t);ka(a,{get hasErrors(){return n()},get isDirty(){return r()}});var o=L(a,2),c=F(o);{let e=M(()=>i()?.listName);Y(c,{id:`listName`,get error(){return V(e)},label:`List Name`,placeholder:`Enter list name`,get value(){return s.listName},set value(e){s.listName=e}})}var l=L(c,2),u=F(l),p=F(u),m=L(F(p)),h=F(m);k(m),k(p);var g=L(p,2);k(u);var _=L(u,2),v=e=>{var t=Ha();va(F(t),{get error(){return i().items}}),k(t),W(e,t)};K(_,e=>{i()?.items&&e(v)});var y=L(_,2),b=e=>{Va(e,{message:`No contacts yet. Click "Add Contact" to get started.`})},x=e=>{var t=Wa();ii(t,21,()=>s.items,ei,(e,t,n)=>{za(e,{index:n,label:`Contact`,onRemove:()=>f(n),children:(e,r)=>{var a=Ua(),o=F(a),s=F(o);Si(s,`for`,`item-name-${n}`);var c=L(s,2);xi(c),Si(c,`id`,`item-name-${n}`);var l=L(c,2);{let e=M(()=>i()?.[`item_${n}`]?.name??``);va(l,{get error(){return V(e)}})}k(o);var u=L(o,2),d=F(u);Si(d,`for`,`item-email-${n}`);var f=L(d,2);xi(f),Si(f,`id`,`item-email-${n}`);var p=L(f,2);{let e=M(()=>i()?.[`item_${n}`]?.email??``);va(p,{get error(){return V(e)}})}k(u),k(a),R(()=>{pi(c,1,`block w-full rounded-lg border p-2 text-sm ${i()?.[`item_${n}`]?.name?`border-red-500 bg-red-50 text-red-900 placeholder-red-400`:`border-gray-300 bg-white text-gray-900`}`),pi(f,1,`block w-full rounded-lg border p-2 text-sm ${i()?.[`item_${n}`]?.email?`border-red-500 bg-red-50 text-red-900 placeholder-red-400`:`border-gray-300 bg-white text-gray-900`}`)}),Ei(c,()=>V(t).name,e=>V(t).name=e),Ei(f,()=>V(t).email,e=>V(t).email=e),W(e,a)},$$slots:{default:!0}})}),k(t),W(e,t)};K(y,e=>{s.items.length===0?e(b):e(x,-1)}),k(l),k(o),R(()=>G(h,`${s.items.length??``} items`)),H(`click`,g,d),W(e,t)},sidebar:e=>{ga(e,{get data(){return s},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:p,width:`xl:w-96`})},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=Ka(),r=I(n);J(r,{code:`const sourceData = { + listName: '', + items: [] as { name: string; email: string }[] +}; + +const { data, state: { errors, hasErrors, isDirty } } = createSvState(sourceData, { + validator: (source) => ({ + listName: stringValidator(source.listName).prepare('trim').required().minLength(2).getError(), + items: arrayValidator(source.items).required().minLength(1).getError(), + // Per-item validation using indexed keys + ...Object.fromEntries( + source.items.map((item, index) => [ + \`item_\${index}\`, + { + name: stringValidator(item.name).prepare('trim').required().minLength(2).getError(), + email: stringValidator(item.email).prepare('trim').required().email().getError() + } + ]) + ) + }) +});`,title:`State Setup with Array Item Validation`}),J(L(r,2),{code:`// Define type for item errors +type ItemErrors = Record; + +{#each data.items as item, index} + + + + + +{/each}`,title:`Array Form Binding Examples`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),o()}Rr([`click`]),He();var Ja=U(`
`),Ya=U(` Validating...`),Xa=U(`
Taken usernames:
Taken emails:
Taken slugs:
Concurrency limit: maxConcurrentAsyncValidations = 2
Only 2 async validations run simultaneously. Try filling all 3 fields at once to see queuing in action.
`,1),Za=U(`
Quick Fill
Async Validation State
asyncValidating:
hasAsyncErrors:
hasCombinedErrors:
Async Errors
 
`),Qa=U(` `,1);function $a(e,t){Ge(t,!1);let n=()=>A(_,`$hasErrors`,l),r=()=>A(v,`$isDirty`,l),i=()=>A(b,`$hasAsyncErrors`,l),a=()=>A(S,`$hasCombinedErrors`,l),o=()=>A(g,`$errors`,l),s=()=>A(y,`$asyncErrors`,l),c=()=>A(x,`$asyncValidating`,l),[l,u]=mt(),d=[`admin`,`user`,`test`,`demo`,`root`],f=[`admin@example.com`,`test@example.com`,`user@example.com`],p=[`admin`,`about`,`contact`,`help`,`support`],m=ca({username:``,email:``,slug:``},{validator:e=>({username:q(e.username).prepare(`trim`).required().minLength(3).maxLength(20).noSpace().getError(),email:q(e.email).prepare(`trim`).required().email().getError(),slug:q(e.slug).prepare(`trim`).required().minLength(2).slug().getError()}),asyncValidator:{username:async(e,t,n)=>{await new Promise((e,t)=>{let r=setTimeout(e,500);n.addEventListener(`abort`,()=>{clearTimeout(r),t(new DOMException(`Aborted`,`AbortError`))})});let r=String(e).toLowerCase();return d.includes(r)?`Username is already taken`:``},email:async(e,t,n)=>{await new Promise((e,t)=>{let r=setTimeout(e,400);n.addEventListener(`abort`,()=>{clearTimeout(r),t(new DOMException(`Aborted`,`AbortError`))})});let r=String(e).toLowerCase();return f.includes(r)?`Email is already registered`:``},slug:async(e,t,n)=>{await new Promise((e,t)=>{let r=setTimeout(e,600);n.addEventListener(`abort`,()=>{clearTimeout(r),t(new DOMException(`Aborted`,`AbortError`))})});let r=String(e).toLowerCase();return p.includes(r)?`URL slug is already in use`:``}}},{maxConcurrentAsyncValidations:2}),h=an(m.data),g=m.state.errors,_=m.state.hasErrors,v=m.state.isDirty,y=m.state.asyncErrors,b=m.state.hasAsyncErrors,x=m.state.asyncValidating,S=m.state.hasCombinedErrors,C=()=>{on(h,V(h).username=`newuser${X()}`),on(h,V(h).email=`${X()}@example.com`),on(h,V(h).slug=`my-page-${X()}`)},w=()=>{on(h,V(h).username=`admin`),on(h,V(h).email=`admin@example.com`),on(h,V(h).slug=`about`)};Ai(),wa(e,{description:`Demonstrates async validation with simulated API calls for username and email uniqueness checks.`,title:`Async Validation Demo`,main:e=>{var t=Xa(),l=I(t);ka(l,{get hasErrors(){return n()},get isDirty(){return r()}});var u=L(l,2),m=F(u),g=F(m);k(m);var _=L(m,2),v=F(_);k(_),k(u);var y=L(u,2),b=F(y),x=F(b);{let e=Jt(()=>o()?.username||s().username);Y(x,{id:`username`,get error(){return V(e)},label:`Username`,placeholder:`Enter username (try 'admin', 'user', 'test')`,get value(){return V(h).username},set value(e){on(h,V(h).username=e)},$$legacy:!0})}var S=L(x,2),C=e=>{W(e,Ja())},w=M(()=>c().includes(`username`));K(S,e=>{V(w)&&e(C)}),k(b);var T=L(b,2),E=F(T);{let e=Jt(()=>o()?.email||s().email);Y(E,{id:`email`,get error(){return V(e)},label:`Email`,placeholder:`Enter email (try 'admin@example.com')`,type:`email`,get value(){return V(h).email},set value(e){on(h,V(h).email=e)},$$legacy:!0})}var ee=L(E,2),te=e=>{W(e,Ja())},ne=M(()=>c().includes(`email`));K(ee,e=>{V(ne)&&e(te)}),k(T);var re=L(T,2),ie=F(re);{let e=Jt(()=>o()?.slug||s().slug);Y(ie,{id:`slug`,get error(){return V(e)},label:`URL Slug`,placeholder:`Enter slug (try 'admin', 'about', 'contact')`,get value(){return V(h).slug},set value(e){on(h,V(h).slug=e)},$$legacy:!0})}var ae=L(ie,2),oe=e=>{W(e,Ja())},se=M(()=>c().includes(`slug`));K(ae,e=>{V(se)&&e(oe)}),k(re),k(y);var ce=L(y,2),le=F(ce),ue=L(F(le));k(le);var de=L(le,2),fe=L(F(de));k(de);var pe=L(de,2),me=L(F(pe));k(pe),k(ce);var he=L(ce,4),ge=F(he),_e=F(ge),ve=e=>{W(e,Ya())},ye=e=>{W(e,Gr(`Submit`))};K(_e,e=>{c().length>0?e(ve):e(ye,-1)}),k(ge),k(he),R((e,t,n)=>{pi(m,1,`rounded px-2.5 py-0.5 text-xs font-medium ${i()?`bg-red-100 text-red-800`:`bg-gray-100 text-gray-800`}`),G(g,`Async Errors: ${i()?`Yes`:`No`}`),pi(_,1,`rounded px-2.5 py-0.5 text-xs font-medium ${a()?`bg-red-100 text-red-800`:`bg-green-100 text-green-800`}`),G(v,`Combined: ${a()?`Has Errors`:`Valid`}`),G(ue,` ${e??``}`),G(fe,` ${t??``}`),G(me,` ${n??``}`),ge.disabled=a()||c().length>0},[()=>d.join(`, `),()=>f.join(`, `),()=>p.join(`, `)]),W(e,t)},sidebar:e=>{var t=Za(),l=F(t);ga(l,{get data(){return V(h)},get errors(){return o()},get hasErrors(){return n()},get isDirty(){return r()},onFill:C});var u=L(l,2),d=L(F(u),2);k(u);var f=L(u,2),p=L(F(f),2),m=F(p),g=L(F(m));k(m);var _=L(m,2),v=L(F(_));k(_);var y=L(_,2),b=L(F(y));k(y),k(p),k(f);var x=L(f,2),S=L(F(x),2),T=F(S,!0);k(S),k(x),k(t),R((e,t)=>{G(g,` [${e??``}]`),G(v,` ${i()??``}`),G(b,` ${a()??``}`),G(T,t)},[()=>c().join(`, `),()=>JSON.stringify(s(),void 0,2)]),H(`click`,d,w),W(e,t)},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=Qa(),r=I(n);J(r,{code:`const { data, state: { errors, asyncErrors, asyncValidating, hasCombinedErrors } } = + createSvState(sourceData, { + validator: (source) => ({ + username: stringValidator(source.username).required().minLength(3).noSpace().getError(), + email: stringValidator(source.email).required().email().getError(), + slug: stringValidator(source.slug).required().minLength(2).slug().getError() + }), + asyncValidator: { + username: async (value, source, signal) => { + const res = await fetch(\`/api/check-username?u=\${value}\`, { signal }); + return (await res.json()).available ? '' : 'Username already taken'; + }, + email: async (value, source, signal) => { + const res = await fetch(\`/api/check-email?e=\${value}\`, { signal }); + return (await res.json()).available ? '' : 'Email already registered'; + }, + slug: async (value, source, signal) => { + const res = await fetch(\`/api/check-slug?s=\${value}\`, { signal }); + return (await res.json()).available ? '' : 'URL slug already in use'; + } + } + }, + { maxConcurrentAsyncValidations: 2 } // Only 2 async validations run at a time +);`,title:`State Setup with Async Validators`});var i=L(r,2);J(i,{code:` +{#if $asyncValidating.includes('username')} + ... +{/if} + + +{#if $asyncErrors.username} + {$asyncErrors.username} +{/if} + + +`,title:`Template Usage`}),J(L(i,2),{code:`// Available stores for async validation: +$errors // Sync validation errors (nested object) +$hasErrors // true if any sync errors + +$asyncErrors // Async validation errors (flat map by path) +$hasAsyncErrors // true if any async errors + +$asyncValidating // Array of paths currently being validated +$hasCombinedErrors // hasErrors || hasAsyncErrors`,title:`Available Stores`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),u()}Rr([`click`]);var eo=U(``),to=U(`
`);function no(e,t){Ge(t,!0);let n=Mi(t,`placeholder`,3,``),r=Mi(t,`value`,15),i=Mi(t,`error`,3,``),a=Mi(t,`required`,3,!1),o=Mi(t,`rows`,3,3);var s=to(),c=F(s),l=F(c),u=L(l),d=e=>{W(e,eo())};K(u,e=>{t.isDirty&&e(d)}),k(c);var f=L(c,2);Dn(f);var p=L(f,2);{let e=M(()=>i()??``);va(p,{get error(){return V(e)}})}k(s),R(()=>{pi(c,1,`mb-2 block text-sm text-gray-900 ${a()?`font-bold`:``}`),Si(c,`for`,t.id),G(l,`${t.label??``} `),Si(f,`id`,t.id),pi(f,1,`block w-full rounded-lg border p-2.5 text-sm ${i()?`border-red-500 bg-red-50 text-red-900 placeholder-red-400 focus:border-red-500 focus:ring-red-500`:`border-gray-300 bg-gray-50 text-gray-900 focus:border-blue-500 focus:ring-blue-500`}`),Si(f,`placeholder`,n()),Si(f,`rows`,o())}),Ei(f,r),W(e,s),Ke()}var ro=U(`
`,1),io=U(` `,1);function ao(e,t){Ge(t,!0);let n=()=>A(u,`$hasErrors`,o),r=()=>A(d,`$isDirty`,o),i=()=>A(l,`$errors`,o),a=()=>A(f,`$isDirtyByField`,o),[o,s]=mt(),{data:c,state:{errors:l,hasErrors:u,isDirty:d,isDirtyByField:f}}=ca({username:``,email:``,age:0,bio:``,website:``},{validator:e=>({username:q(e.username).prepare(`trim`).required().minLength(3).maxLength(20).noSpace().getError(),email:q(e.email).prepare(`trim`).required().email().getError(),age:ua(e.age).required().min(18).max(120).integer().getError(),bio:q(e.bio).maxLength(200).getError(),website:q(e.website).prepare(`trim`).website(`required`).getError()})}),p=()=>{c.username=`user${X()}`,c.email=`${X()}@example.com`,c.age=Aa(18,65),c.bio=`Hello, I am a demo user!`,c.website=`https://${X()}.com`};wa(e,{description:`Demonstrates form validation with string, number, and email validators using the fluent API.`,title:`Basic Validation Demo`,main:e=>{var t=ro(),o=I(t);ka(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),l=F(s);{let e=M(()=>i()?.username);Y(l,{id:`username`,get error(){return V(e)},get isDirty(){return a().username},label:`Username`,placeholder:`Enter username`,get value(){return c.username},set value(e){c.username=e}})}var u=L(l,2);{let e=M(()=>i()?.email);Y(u,{id:`email`,get error(){return V(e)},get isDirty(){return a().email},label:`Email`,placeholder:`Enter email`,type:`email`,get value(){return c.email},set value(e){c.email=e}})}var d=L(u,2);{let e=M(()=>i()?.age);Y(d,{id:`age`,get error(){return V(e)},get isDirty(){return a().age},label:`Age`,placeholder:`Enter age`,type:`number`,get value(){return c.age},set value(e){c.age=e}})}var f=L(d,2);{let e=M(()=>i()?.bio);no(f,{id:`bio`,get error(){return V(e)},get isDirty(){return a().bio},label:`Bio`,placeholder:`Tell us about yourself`,get value(){return c.bio},set value(e){c.bio=e}})}var p=L(f,2);{let e=M(()=>i()?.website);Y(p,{id:`website`,get error(){return V(e)},get isDirty(){return a().website},label:`Website`,placeholder:`https://example.com`,required:!1,get value(){return c.website},set value(e){c.website=e}})}k(s),W(e,t)},sidebar:e=>{ga(e,{get data(){return c},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},get isDirtyByField(){return a()},onFill:p})},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=io(),r=I(n);J(r,{code:`const sourceData = { + username: '', + email: '', + age: 0, + bio: '', + website: '' +}; + +const { data, state: { errors, hasErrors, isDirty, isDirtyByField } } = createSvState(sourceData, { + validator: (source) => ({ + username: stringValidator(source.username).prepare('trim').required().minLength(3).maxLength(20).noSpace().getError(), + email: stringValidator(source.email).prepare('trim').required().email().getError(), + age: numberValidator(source.age).required().min(18).max(120).integer().getError(), + bio: stringValidator(source.bio).maxLength(200).getError(), + website: stringValidator(source.website).prepare('trim').website('required').getError() + }) +});`,title:`State Setup`}),J(L(r,2),{code:` +`,title:`Form Binding Example`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),s()}var oo=U(` `),so=U(`
`);function co(e,t){var n=so(),r=F(n),i=L(r),a=e=>{var n=oo(),r=F(n);k(n),R(()=>G(r,`(${t.subtitle??``})`)),W(e,n)};K(i,e=>{t.subtitle&&e(a)});var o=L(i,2),s=e=>{var n=Kr();ui(I(n),()=>t.children),W(e,n)};K(o,e=>{t.children&&e(s)}),k(n),R(()=>G(r,`${t.title??``} `)),W(e,n)}var lo=U(`
Subtotal:
Tax (8%):
Total:

Values formatted using methods on state: data.formatCurrency() and data.formatTotal()

`,1),uo=U(` `,1);function fo(e,t){Ge(t,!0);let n=()=>A(l,`$hasErrors`,a),r=()=>A(u,`$isDirty`,a),i=()=>A(c,`$errors`,a),[a,o]=mt(),{data:s,state:{errors:c,hasErrors:l,isDirty:u}}=ca({productName:`Widget ${X()}`,item:{unitPrice:0,quantity:1},subtotal:0,tax:0,total:0,formatTotal(){return`$${this.total.toFixed(2)}`},formatCurrency(e){return`$${e.toFixed(2)}`},calculateTotals(e=.08){this.subtotal=this.item.unitPrice*this.item.quantity,this.tax=this.subtotal*e,this.total=this.subtotal+this.tax}},{validator:e=>({productName:q(e.productName).prepare(`trim`).required().minLength(2).getError(),item:{unitPrice:ua(e.item.unitPrice).required().positive().getError(),quantity:ua(e.item.quantity).required().integer().min(1).max(100).getError()}}),effect:({property:e})=>{(e===`item.unitPrice`||e===`item.quantity`)&&s.calculateTotals()}}),d=()=>{s.productName=`Widget ${X()}`,s.item.unitPrice=Aa(10,100),s.item.quantity=Aa(1,10)};wa(e,{description:`Demonstrates using objects with methods as state. The effect callback can call methods directly on the state object.`,title:`State with Methods Demo`,main:e=>{var t=lo(),a=I(t);ka(a,{get hasErrors(){return n()},get isDirty(){return r()}});var o=L(a,2),c=F(o);{let e=M(()=>i()?.productName);Y(c,{id:`productName`,get error(){return V(e)},label:`Product Name`,placeholder:`Enter product name`,get value(){return s.productName},set value(e){s.productName=e}})}var l=L(c,2),u=F(l);co(u,{subtitle:`nested object`,title:`Item Details`});var d=L(u,2),f=F(d);{let e=M(()=>i()?.item?.unitPrice);Y(f,{id:`unitPrice`,get error(){return V(e)},label:`Unit Price ($)`,min:0,placeholder:`0.00`,step:.01,type:`number`,get value(){return s.item.unitPrice},set value(e){s.item.unitPrice=e}})}var p=L(f,2);{let e=M(()=>i()?.item?.quantity);Y(p,{id:`quantity`,get error(){return V(e)},label:`Quantity`,max:100,min:1,placeholder:`1`,type:`number`,get value(){return s.item.quantity},set value(e){s.item.quantity=e}})}k(d),k(l);var m=L(l,2),h=F(m);co(h,{subtitle:`computed by method`,title:`Calculated Totals`});var g=L(h,2),_=F(g),v=F(_),y=L(F(v),2),b=F(y,!0);k(y),k(v);var x=L(v,2),S=L(F(x),2),C=F(S,!0);k(S),k(x);var w=L(x,2),T=L(F(w),2),E=F(T,!0);k(T),k(w),k(_),k(g),Pe(2),k(m),k(o),R((e,t,n)=>{G(b,e),G(C,t),G(E,n)},[()=>s.formatCurrency(s.subtotal),()=>s.formatCurrency(s.tax),()=>s.formatTotal()]),W(e,t)},sidebar:e=>{ga(e,{get data(){return s},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:d})},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=uo(),r=I(n);J(r,{code:`// Define state type with methods +type SourceData = { + productName: string; + item: { unitPrice: number; quantity: number }; + subtotal: number; + tax: number; + total: number; + formatTotal: () => string; + formatCurrency: (value: number) => string; + calculateTotals: (taxRate?: number) => void; +}; + +// Create initial state as object with methods +const createSourceData = (): SourceData => ({ + productName: '', + item: { unitPrice: 0, quantity: 1 }, + subtotal: 0, + tax: 0, + total: 0, + formatTotal() { + return \`$\${this.total.toFixed(2)}\`; + }, + formatCurrency(value: number) { + return \`$\${value.toFixed(2)}\`; + }, + calculateTotals(taxRate: number = 0.08) { + this.subtotal = this.item.unitPrice * this.item.quantity; + this.tax = this.subtotal * taxRate; + this.total = this.subtotal + this.tax; + } +});`,title:`Class Definition`});var i=L(r,2);J(i,{code:`const { data, state: { errors, hasErrors, isDirty } } = createSvState(createSourceData(), { + validator: (source) => ({ + productName: stringValidator(source.productName).prepare('trim').required().minLength(2).getError(), + item: { + unitPrice: numberValidator(source.item.unitPrice).required().positive().getError(), + quantity: numberValidator(source.item.quantity).required().integer().min(1).max(100).getError() + } + }), + effect: ({ property }) => { + if (property === 'item.unitPrice' || property === 'item.quantity') { + data.calculateTotals(); // Call method on state object! + } + } +});`,title:`State Setup with Class Instance`}),J(L(i,2),{code:` +{data.formatCurrency(data.subtotal)} +{data.formatTotal()}`,title:`Template Usage`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),o()}var po=U(`
Subtotal:
Tax (8%):
Total:
`,1),mo=U(` `,1);function ho(e,t){Ge(t,!0);let n=()=>A(l,`$hasErrors`,a),r=()=>A(u,`$isDirty`,a),i=()=>A(c,`$errors`,a),[a,o]=mt(),{data:s,state:{errors:c,hasErrors:l,isDirty:u}}=ca({productName:`Widget ${X()}`,item:{unitPrice:0,quantity:1},subtotal:0,tax:0,total:0},{validator:e=>({productName:q(e.productName).prepare(`trim`).required().minLength(2).getError(),item:{unitPrice:ua(e.item.unitPrice).required().positive().getError(),quantity:ua(e.item.quantity).required().integer().min(1).max(100).getError()}}),effect:({property:e})=>{(e===`item.unitPrice`||e===`item.quantity`)&&(s.subtotal=s.item.unitPrice*s.item.quantity,s.tax=s.subtotal*.08,s.total=s.subtotal+s.tax)}}),d=()=>{s.productName=`Widget ${X()}`,s.item.unitPrice=Aa(10,100),s.item.quantity=Aa(1,10)},f=e=>`$${e.toFixed(2)}`;wa(e,{description:`Uses the effect callback to automatically compute derived values like subtotals, taxes, and totals.`,title:`Calculated Fields Demo`,main:e=>{var t=po(),a=I(t);ka(a,{get hasErrors(){return n()},get isDirty(){return r()}});var o=L(a,2),c=F(o);{let e=M(()=>i()?.productName);Y(c,{id:`productName`,get error(){return V(e)},label:`Product Name`,placeholder:`Enter product name`,get value(){return s.productName},set value(e){s.productName=e}})}var l=L(c,2),u=F(l);co(u,{subtitle:`nested object`,title:`Item Details`});var d=L(u,2),p=F(d);{let e=M(()=>i()?.item?.unitPrice);Y(p,{id:`unitPrice`,get error(){return V(e)},label:`Unit Price ($)`,min:0,placeholder:`0.00`,step:.01,type:`number`,get value(){return s.item.unitPrice},set value(e){s.item.unitPrice=e}})}var m=L(p,2);{let e=M(()=>i()?.item?.quantity);Y(m,{id:`quantity`,get error(){return V(e)},label:`Quantity`,max:100,min:1,placeholder:`1`,type:`number`,get value(){return s.item.quantity},set value(e){s.item.quantity=e}})}k(d),k(l);var h=L(l,2),g=F(h);co(g,{subtitle:`computed by effect`,title:`Calculated Totals`});var _=L(g,2),v=F(_),y=F(v),b=L(F(y),2),x=F(b,!0);k(b),k(y);var S=L(y,2),C=L(F(S),2),w=F(C,!0);k(C),k(S);var T=L(S,2),E=L(F(T),2),ee=F(E,!0);k(E),k(T),k(v),k(_),k(h),k(o),R((e,t,n)=>{G(x,e),G(w,t),G(ee,n)},[()=>f(s.subtotal),()=>f(s.tax),()=>f(s.total)]),W(e,t)},sidebar:e=>{ga(e,{get data(){return s},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:d})},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=mo(),r=I(n);J(r,{code:`const sourceData = { + productName: '', + item: { unitPrice: 0, quantity: 1 }, + subtotal: 0, tax: 0, total: 0 // Calculated fields (set by effect) +}; + +const TAX_RATE = 0.08; + +const { data, state: { errors, hasErrors, isDirty } } = createSvState(sourceData, { + validator: (source) => ({ + productName: stringValidator(source.productName).prepare('trim').required().minLength(2).getError(), + item: { + unitPrice: numberValidator(source.item.unitPrice).required().positive().getError(), + quantity: numberValidator(source.item.quantity).required().integer().min(1).max(100).getError() + } + }), + effect: ({ property }) => { + if (property === 'item.unitPrice' || property === 'item.quantity') { + data.subtotal = data.item.unitPrice * data.item.quantity; + data.tax = data.subtotal * TAX_RATE; + data.total = data.subtotal + data.tax; + } + } +});`,title:`State Setup with Effect`}),J(L(r,2),{code:`effect: ({ property }) => { + if (property === 'item.unitPrice' || property === 'item.quantity') { + data.subtotal = data.item.unitPrice * data.item.quantity; + data.tax = data.subtotal * TAX_RATE; + data.total = data.subtotal + data.tax; + } +}`,title:`Effect Function`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),o()}var go=U(` `),_o=U(``),vo=U(`
`);function yo(e,t){var n=vo(),r=F(n),i=F(r),a=L(i),o=e=>{var n=go(),r=F(n);k(n),R(()=>G(r,`(${t.subtitle??``})`)),W(e,n)};K(a,e=>{t.subtitle&&e(o)});var s=L(a,2),c=e=>{W(e,_o())};K(s,e=>{t.isDirty&&e(c)}),k(r),ui(L(r,2),()=>t.children),k(n),R(()=>G(i,`${t.title??``} `)),W(e,n)}var bo=U(``),xo=U(`
`),So=U(`
`,1),Co=U(` `,1);function wo(e,t){Ge(t,!0);let n=()=>A(u,`$hasErrors`,o),r=()=>A(d,`$isDirty`,o),i=()=>A(f,`$isDirtyByField`,o),a=()=>A(l,`$errors`,o),[o,s]=mt(),{data:c,state:{errors:l,hasErrors:u,isDirty:d,isDirtyByField:f}}=ca({name:``,address:{street:``,city:``,zip:``},company:{name:``,department:``,contact:{phone:``,email:``}}},{validator:e=>({name:q(e.name).prepare(`trim`).required().minLength(2).maxLength(50).getError(),address:{street:q(e.address.street).prepare(`trim`).required().minLength(5).getError(),city:q(e.address.city).prepare(`trim`).required().minLength(2).getError(),zip:q(e.address.zip).prepare(`trim`).required().minLength(5).maxLength(10).getError()},company:{name:q(e.company.name).prepare(`trim`).required().minLength(2).getError(),department:q(e.company.department).prepare(`trim`).maxLength(50).getError(),contact:{phone:q(e.company.contact.phone).prepare(`trim`).required().minLength(10).getError(),email:q(e.company.contact.email).prepare(`trim`).required().email().getError()}}})}),p=()=>{c.name=`John ${X()}`,c.address.street=`${Aa(100,9999)} Main Street`,c.address.city=`New York`,c.address.zip=`${Aa(1e4,99999)}`,c.company.name=`Acme ${X()} Inc`,c.company.department=`Engineering`,c.company.contact.phone=`555-${Aa(100,999)}-${Aa(1e3,9999)}`,c.company.contact.email=`contact@${X()}.com`};wa(e,{description:`Illustrates validating deeply nested object structures with multi-level property paths.`,title:`Nested Objects Demo`,main:e=>{var t=So(),o=I(t);ka(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),l=F(s),u=F(l);co(u,{title:`Personal Info`,children:(e,t)=>{var n=Kr(),r=I(n),a=e=>{W(e,bo())};K(r,e=>{i().name&&e(a)}),W(e,n)},$$slots:{default:!0}});var d=L(u,2);{let e=M(()=>a()?.name);Y(d,{id:`name`,get error(){return V(e)},label:`Full Name`,placeholder:`Enter your full name`,get value(){return c.name},set value(e){c.name=e}})}k(l);var f=L(l,2),p=F(f);co(p,{subtitle:`2-level nested`,title:`Address`,children:(e,t)=>{var n=Kr(),r=I(n),a=e=>{W(e,bo())};K(r,e=>{i().address&&e(a)}),W(e,n)},$$slots:{default:!0}});var m=L(p,2),h=F(m);{let e=M(()=>a()?.address?.street);Y(h,{id:`street`,get error(){return V(e)},label:`Street`,placeholder:`Enter street address`,get value(){return c.address.street},set value(e){c.address.street=e}})}var g=L(h,2),_=F(g);{let e=M(()=>a()?.address?.city);Y(_,{id:`city`,get error(){return V(e)},label:`City`,placeholder:`Enter city`,get value(){return c.address.city},set value(e){c.address.city=e}})}var v=L(_,2);{let e=M(()=>a()?.address?.zip);Y(v,{id:`zip`,get error(){return V(e)},label:`ZIP Code`,placeholder:`Enter ZIP`,get value(){return c.address.zip},set value(e){c.address.zip=e}})}k(g),k(m),k(f);var y=L(f,2),b=F(y);co(b,{subtitle:`3-level nested`,title:`Company`,children:(e,t)=>{var n=Kr(),r=I(n),a=e=>{W(e,bo())};K(r,e=>{i().company&&e(a)}),W(e,n)},$$slots:{default:!0}});var x=L(b,2),S=F(x),C=F(S);{let e=M(()=>a()?.company?.name);Y(C,{id:`company-name`,get error(){return V(e)},label:`Company Name`,placeholder:`Enter company name`,get value(){return c.company.name},set value(e){c.company.name=e}})}var w=L(C,2);{let e=M(()=>a()?.company?.department);Y(w,{id:`department`,get error(){return V(e)},label:`Department`,placeholder:`Enter department`,required:!1,get value(){return c.company.department},set value(e){c.company.department=e}})}k(S),yo(L(S,2),{get isDirty(){return i()[`company.contact`]},subtitle:`3rd level`,title:`Contact Info`,children:(e,t)=>{var n=xo(),r=F(n);{let e=M(()=>a()?.company?.contact?.phone);Y(r,{id:`contact-phone`,get error(){return V(e)},label:`Phone`,placeholder:`Enter phone number`,variant:`nested`,get value(){return c.company.contact.phone},set value(e){c.company.contact.phone=e}})}var i=L(r,2);{let e=M(()=>a()?.company?.contact?.email);Y(i,{id:`contact-email`,get error(){return V(e)},label:`Email`,placeholder:`Enter email address`,type:`email`,variant:`nested`,get value(){return c.company.contact.email},set value(e){c.company.contact.email=e}})}k(n),W(e,n)},$$slots:{default:!0}}),k(x),k(y),k(s),W(e,t)},sidebar:e=>{ga(e,{get data(){return c},get errors(){return a()},get hasErrors(){return n()},get isDirty(){return r()},get isDirtyByField(){return i()},onFill:p,width:`xl:w-96`})},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=Co(),r=I(n);J(r,{code:`const sourceData = { + name: '', + address: { street: '', city: '', zip: '' }, // 2-level nested + company: { // 3-level nested + name: '', + department: '', + contact: { phone: '', email: '' } + } +}; + +const { data, state: { errors, hasErrors, isDirty, isDirtyByField } } = createSvState(sourceData, { + validator: (source) => ({ + name: stringValidator(source.name).prepare('trim').required().minLength(2).maxLength(50).getError(), + address: { + street: stringValidator(source.address.street).prepare('trim').required().minLength(5).getError(), + city: stringValidator(source.address.city).prepare('trim').required().minLength(2).getError(), + zip: stringValidator(source.address.zip).prepare('trim').required().minLength(5).maxLength(10).getError() + }, + company: { + name: stringValidator(source.company.name).prepare('trim').required().minLength(2).getError(), + department: stringValidator(source.company.department).prepare('trim').maxLength(50).getError(), + contact: { + phone: stringValidator(source.company.contact.phone).prepare('trim').required().minLength(10).getError(), + email: stringValidator(source.company.contact.email).prepare('trim').required().email().getError() + } + } + }) +});`,title:`State Setup with Nested Validation`}),J(L(r,2),{code:` + + + + + +`,title:`Nested Form Binding Examples`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),s()}var To=U(`
Effect triggered:
`),Eo=U(`
`),Do=U(`
`),Oo=U(` Submitting...`),ko=U(`
`,1),Ao=U(`
Options

Reset isDirty after successful action

Try 500ms and type quickly

Keep errors until next action

Current Options
`),jo=U(` `,1);function Mo(e,t){Ge(t,!0);let n=()=>A(V(x),`$hasErrors`,s),r=()=>A(V(S),`$isDirty`,s),i=()=>A(V(C),`$actionInProgress`,s),a=()=>A(V(b),`$errors`,s),o=()=>A(V(w),`$actionError`,s),[s,c]=mt(),l=N(!0),u=N(0),d=N(!1),f=N(0),p=N(!1),m=N(void 0),h=N(void 0),g=()=>({name:`User ${X()}`,email:`${X()}@example.com`}),_=e=>ca(g(),{validator:e=>({name:q(e.name).prepare(`trim`).required().minLength(2).maxLength(50).getError(),email:q(e.email).prepare(`trim`).required().email().getError()}),effect:({property:e})=>{P(h,e,!0)},action:async()=>{let e=Aa(100,800);if(await new Promise(t=>setTimeout(t,e)),V(p))throw Error(`Simulated error after ${e}ms`);P(m,`Submitted successfully in ${e}ms!`)},actionCompleted:e=>{e&&P(m,void 0)}},e),v=N(fn(_({resetDirtyOnAction:!0,debounceValidation:0,persistActionError:!1}))),y=()=>{P(h,void 0),P(m,void 0),P(v,_({resetDirtyOnAction:V(l),debounceValidation:V(u),persistActionError:V(d)}),!0),ln(f)},b=M(()=>V(v).state.errors),x=M(()=>V(v).state.hasErrors),S=M(()=>V(v).state.isDirty),C=M(()=>V(v).state.actionInProgress),w=M(()=>V(v).state.actionError),T=()=>{V(v).data.name=`User ${X()}`,V(v).data.email=`${X()}@example.com`},E=()=>{P(m,void 0),V(v).execute()};wa(e,{description:`Interactive playground for configuring createSvState options like debouncing and error persistence.`,title:`Options Demo`,main:e=>{var t=Kr();$r(I(t),()=>V(f),e=>{var t=ko(),s=I(t);ka(s,{get hasErrors(){return n()},get isDirty(){return r()}});var c=L(s,2),l=e=>{var t=To(),n=F(t),r=L(F(n));k(n),k(t),R(()=>G(r,` property "${V(h)??``}" changed`)),W(e,t)};K(c,e=>{V(h)&&e(l)});var u=L(c,2),d=F(u);{let e=M(()=>a()?.name);Y(d,{id:`name`,get disabled(){return i()},get error(){return V(e)},label:`Name`,placeholder:`Enter name`,get value(){return V(v).data.name},set value(e){V(v).data.name=e}})}var f=L(d,2);{let e=M(()=>a()?.email);Y(f,{id:`email`,get disabled(){return i()},get error(){return V(e)},label:`Email`,placeholder:`Enter email`,type:`email`,get value(){return V(v).data.email},set value(e){V(v).data.email=e}})}var g=L(f,2),_=F(g);xi(_),Pe(2),k(g),k(u);var y=L(u,2),b=e=>{var t=Eo(),n=F(t),r=L(F(n),2),i=F(r,!0);k(r),k(n),k(t),R(()=>G(i,o().message)),W(e,t)};K(y,e=>{o()&&e(b)});var x=L(y,2),S=e=>{var t=Do(),n=F(t),r=L(F(n),2),i=F(r,!0);k(r),k(n),k(t),R(()=>G(i,V(m))),W(e,t)};K(x,e=>{V(m)&&e(S)});var C=L(x,2),w=F(C),T=F(w),ee=e=>{W(e,Oo())},te=e=>{W(e,Gr(`Submit`))};K(T,e=>{i()?e(ee):e(te,-1)}),k(w),k(C),R(()=>{_.disabled=i(),w.disabled=n()||i()}),Di(_,()=>V(p),e=>P(p,e)),H(`click`,w,E),W(e,t)}),W(e,t)},sidebar:e=>{var t=Ao(),i=F(t);ga(i,{get data(){return V(v).data},get errors(){return a()},get hasErrors(){return n()},get isDirty(){return r()},onFill:T});var o=L(i,2),s=L(F(o),2),c=F(s),f=F(c),p=F(f);xi(p),Pe(2),k(f),Pe(2),k(c);var m=L(c,2),h=L(F(m),2);xi(h),Pe(2),k(m);var g=L(m,2),_=F(g),b=F(_);xi(b),Pe(2),k(_),Pe(2),k(g);var x=L(g,2);k(s),k(o);var S=L(o,2),C=L(F(S),2),w=F(C),E=F(w);k(w);var ee=L(w,2),te=F(ee);k(ee);var ne=L(ee,2),re=F(ne);k(ne),k(C),k(S),k(t),R(()=>{G(E,`resetDirtyOnAction: ${V(l)??``}`),G(te,`debounceValidation: ${V(u)??``}`),G(re,`persistActionError: ${V(d)??``}`)}),Di(p,()=>V(l),e=>P(l,e)),Ei(h,()=>V(u),e=>P(u,e)),Di(b,()=>V(d),e=>P(d,e)),H(`click`,x,y),W(e,t)},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=jo(),r=I(n);J(r,{code:`const { data, execute, state } = createSvState( + sourceData, + { validator, effect, action }, + { + // Reset isDirty to false after successful action + resetDirtyOnAction: true, // default: true + + // Debounce validation by N milliseconds + debounceValidation: 0, // default: 0 (uses queueMicrotask) + + // Keep action errors until next action (not cleared on data change) + persistActionError: false // default: false + } +);`,title:`Options Overview`});var i=L(r,2);J(i,{code:`// With resetDirtyOnAction: true (default) +await execute(); +// isDirty is now false + +// With resetDirtyOnAction: false +await execute(); +// isDirty remains true`,title:`resetDirtyOnAction`});var a=L(i,2);J(a,{code:`// With debounceValidation: 0 (default) +// Validation runs via queueMicrotask after each change + +// With debounceValidation: 500 +// Validation runs 500ms after the last change +// Useful for expensive validators or rapid typing`,title:`debounceValidation`}),J(L(a,2),{code:`// With persistActionError: false (default) +data.name = 'new value'; +// actionError is cleared immediately + +// With persistActionError: true +data.name = 'new value'; +// actionError remains until next execute() call`,title:`persistActionError`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),c()}Rr([`click`]);var No=U(`Saving...`),Po=U(``),Fo=U(`
Auto-save triggers 2 seconds after the last change. Analytics events buffer and flush at 10 events or every 10 + seconds.
`,1),Io=U(`

No saves yet — edit the form and wait 2s

`),Lo=U(`
  • save
  • `),Ro=U(`
      `),zo=U(`

      No flushes yet

      `),Bo=U(`
    • flush
    • `),Vo=U(`
      Autosave Log
      Analytics Buffer
      Buffered:
      Batch size: 10
      Flush interval: 10s
      Tracked: change, action, snapshot
      Flush History
      `),Ho=U(` `,1);function Uo(e,t){Ge(t,!0);let n=()=>A(_,`$hasErrors`,o),r=()=>A(v,`$isDirty`,o),i=()=>A(g,`$errors`,o),a=()=>A(y,`$actionInProgress`,o),[o,s]=mt(),c=N(fn([])),l=N(fn([])),u=N(0),d=Pi({save:async e=>{await new Promise(e=>setTimeout(e,300));let t=new Date().toISOString().slice(11,23);P(c,[...V(c),{id:X(),timestamp:t,data:`${e.title} (${e.category})`}],!0)},idle:2e3,onlyWhenDirty:!0}),f=Ni({onFlush:e=>{let t=new Date().toISOString().slice(11,23),n={};for(let t of e)n[t.type]=(n[t.type]??0)+1;let r=Object.entries(n).map(([e,t])=>`${e}:${t}`).join(`, `);P(l,[...V(l),{id:X(),timestamp:t,eventCount:e.length,types:r}],!0)},batchSize:10,flushInterval:1e4,include:[`change`,`action`,`snapshot`]}),{data:p,execute:m,reset:h,state:{errors:g,hasErrors:_,isDirty:v,actionInProgress:y}}=ca({title:``,category:`general`,notes:``},{validator:e=>({title:q(e.title).prepare(`trim`).required().minLength(2).maxLength(100).getError(),category:``,notes:q(e.notes).maxLength(500).getError()}),effect:({snapshot:e,property:t})=>{e(`Changed ${t.charAt(0).toUpperCase()+t.slice(1)}`)},action:async()=>{await new Promise(e=>setTimeout(e,500))}},{plugins:[d,f]}),b=()=>{p.title=`Article ${X()}`,p.category=`tech`,p.notes=`Some interesting notes about the topic that should pass validation.`};Ln(()=>{let e=setInterval(()=>{P(u,f.eventCount(),!0)},500);return()=>clearInterval(e)}),wa(e,{description:`Auto-save with idle timer (autosavePlugin) and batched event analytics (analyticsPlugin).`,title:`Plugin: Autosave & Analytics`,main:e=>{var t=Fo(),o=I(t);ka(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),l=F(s),g=F(l);k(l);var _=L(l,2),v=F(_);k(_);var y=L(_,2),b=e=>{W(e,No())},x=M(()=>d.isSaving());K(y,e=>{V(x)&&e(b)}),k(s);var S=L(s,4),C=F(S);{let e=M(()=>i()?.title);Y(C,{id:`title`,get error(){return V(e)},label:`Title`,placeholder:`Enter article title`,get value(){return p.title},set value(e){p.title=e}})}var w=L(C,2),T=L(F(w),2),E=F(T);E.value=E.__value=`general`;var ee=L(E);ee.value=ee.__value=`tech`;var te=L(ee);te.value=te.__value=`science`;var ne=L(te);ne.value=ne.__value=`culture`,k(T),k(w);var re=L(w,2);{let e=M(()=>i()?.notes);no(re,{id:`notes`,get error(){return V(e)},label:`Notes`,placeholder:`Write your notes (max 500 chars)`,rows:4,get value(){return p.notes},set value(e){p.notes=e}})}k(S);var ie=L(S,2),ae=F(ie),oe=F(ae,!0);k(ae);var se=L(ae,2),ce=L(se,2),le=L(ce,2),ue=e=>{var t=Po();H(`click`,t,h),W(e,t)};K(le,e=>{r()&&e(ue)}),k(ie),R(()=>{G(g,`${V(c).length??``} Save${V(c).length===1?``:`s`}`),G(v,`${V(u)??``} Buffered Event${V(u)===1?``:`s`}`),ae.disabled=n()||a(),G(oe,a()?`Submitting...`:`Submit`)}),gi(T,()=>p.category,e=>p.category=e),H(`click`,ae,()=>m()),H(`click`,se,()=>d.saveNow()),H(`click`,ce,()=>f.flush()),W(e,t)},sidebar:e=>{var t=Vo(),a=F(t);ga(a,{get data(){return p},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:b,width:`xl:w-96`});var o=L(a,2),s=L(F(o),2),d=e=>{W(e,Io())},f=e=>{var t=Ro();ii(t,21,()=>V(c),e=>e.id,(e,t)=>{var n=Lo(),r=L(F(n),2),i=F(r,!0);k(r);var a=L(r,2),o=F(a,!0);k(a),k(n),R(()=>{G(i,V(t).data),G(o,V(t).timestamp)}),W(e,n)}),k(t),W(e,t)};K(s,e=>{V(c).length===0?e(d):e(f,-1)}),k(o);var m=L(o,2),h=L(F(m),2),g=F(h),_=L(F(g));k(g),Pe(6),k(h),k(m);var v=L(m,2),y=L(F(v),2),x=e=>{W(e,zo())},S=e=>{var t=Ro();ii(t,21,()=>V(l),e=>e.id,(e,t)=>{var n=Bo(),r=L(F(n),2),i=F(r);k(r);var a=L(r,2),o=F(a,!0);k(a),k(n),R(()=>{G(i,`${V(t).eventCount??``} event${V(t).eventCount===1?``:`s`} (${V(t).types??``})`),G(o,V(t).timestamp)}),W(e,n)}),k(t),W(e,t)};K(y,e=>{V(l).length===0?e(x):e(S,-1)}),k(v),k(t),R(()=>G(_,` ${V(u)??``} event${V(u)===1?``:`s`}`)),W(e,t)},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=Ho(),r=I(n);J(r,{code:`import { createSvState, autosavePlugin, analyticsPlugin } from 'svstate'; + +const autosave = autosavePlugin({ + save: async (data) => { + await fetch('/api/save', { + method: 'POST', + body: JSON.stringify(data) + }); + }, + idle: 2000, // Save 2s after last change + onlyWhenDirty: true // Skip save if nothing changed +}); + +const analytics = analyticsPlugin({ + onFlush: (events) => { + sendToAnalytics(events); // Your analytics endpoint + }, + batchSize: 10, // Flush after 10 events + flushInterval: 10000, // Or every 10 seconds + include: ['change', 'action', 'snapshot'] // Filter event types +}); + +const { data, execute, state } = createSvState( + initialData, actuators, + { plugins: [autosave, analytics] } +);`,title:`autosavePlugin + analyticsPlugin Setup`}),J(L(r,2),{code:`// autosavePlugin API +autosave.saveNow(); // Force immediate save +autosave.isSaving(); // Check if currently saving + +// analyticsPlugin API +analytics.flush(); // Force flush buffered events +analytics.eventCount(); // Number of buffered events`,title:`Plugin API`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),s()}Rr([`click`]);var Wo=U(``),Go=U(`
      `,1),Ko=U(`

      No events yet — interact with the form

      `),qo=U(`
    • `),Jo=U(`
        `),Yo=U(`
        Event Log
        `),Xo=U(` `,1);function Zo(e,t){Ge(t,!0);let n=()=>A(g,`$hasErrors`,s),r=()=>A(_,`$isDirty`,s),i=()=>A(h,`$errors`,s),a=()=>A(y,`$actionInProgress`,s),o=()=>A(v,`$snapshots`,s),[s,c]=mt(),l=N(fn([])),u=(e,t)=>{let n=new Date().toISOString().slice(11,23);P(l,[...V(l),{id:X(),type:e,message:t,timestamp:n}],!0)},{data:d,execute:f,reset:p,rollback:m,state:{errors:h,hasErrors:g,isDirty:_,snapshots:v,actionInProgress:y}}=ca({name:``,email:``,message:``},{validator:e=>({name:q(e.name).prepare(`trim`).required().minLength(2).maxLength(50).getError(),email:q(e.email).prepare(`trim`).required().email().getError(),message:q(e.message).prepare(`trim`).required().minLength(5).getError()}),effect:({snapshot:e,property:t})=>{e(`Changed ${t.charAt(0).toUpperCase()+t.slice(1)}`)},action:async()=>{await new Promise(e=>setTimeout(e,500))}},{plugins:[Ii({name:`demo-devtools`,enabled:!0,logValidation:!0}),{name:`log-mirror`,onChange(e){u(`change`,`${e.property}: "${e.oldValue}" → "${e.currentValue}"`)},onValidation(e){u(`validation`,e?`Has errors`:`Valid`)},onSnapshot(e){u(`snapshot`,e.title)},onAction(e){e.phase===`before`?u(`action`,`Action started`):u(`action`,e.error?`Action failed: ${e.error.message}`:`Action completed`)},onRollback(e){u(`rollback`,`Rolled back to: ${e.title}`)},onReset(){u(`reset`,`State reset to initial`)}}]}),b=()=>{d.name=`John Doe ${X()}`,d.email=`john.${X()}@example.com`,d.message=`Hello, this is a test message for the devtools demo.`},x=()=>{P(l,[],!0)},S={change:`bg-blue-100 text-blue-800`,validation:`bg-yellow-100 text-yellow-800`,snapshot:`bg-purple-100 text-purple-800`,action:`bg-green-100 text-green-800`,rollback:`bg-amber-100 text-amber-800`,reset:`bg-red-100 text-red-800`};wa(e,{description:`Shows devtoolsPlugin console logging and a custom log-mirror plugin that captures all events in-page.`,title:`Plugin: Devtools`,main:e=>{var t=Go(),s=I(t);ka(s,{get hasErrors(){return n()},get isDirty(){return r()}});var c=L(s,2),l=F(c);{let e=M(()=>i()?.name);Y(l,{id:`name`,get error(){return V(e)},label:`Name`,placeholder:`Enter your name`,get value(){return d.name},set value(e){d.name=e}})}var u=L(l,2);{let e=M(()=>i()?.email);Y(u,{id:`email`,get error(){return V(e)},label:`Email`,placeholder:`Enter your email`,type:`email`,get value(){return d.email},set value(e){d.email=e}})}var h=L(u,2);{let e=M(()=>i()?.message);no(h,{id:`message`,get error(){return V(e)},label:`Message`,placeholder:`Enter a message (min 5 chars)`,required:!0,get value(){return d.message},set value(e){d.message=e}})}k(c);var g=L(c,2),_=F(g),v=F(_,!0);k(_);var y=L(_,2),b=L(y,2),x=e=>{var t=Wo();H(`click`,t,p),W(e,t)};K(b,e=>{r()&&e(x)}),k(g),R(()=>{_.disabled=n()||a(),G(v,a()?`Submitting...`:`Submit`),y.disabled=o().length<=1}),H(`click`,_,()=>f()),H(`click`,y,()=>m()),W(e,t)},sidebar:e=>{var t=Yo(),a=F(t);ga(a,{get data(){return d},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:b,width:`xl:w-96`});var o=L(a,2),s=F(o),c=L(F(s),2);k(s);var u=L(s,2),f=e=>{W(e,Ko())},p=e=>{var t=Jo();ii(t,21,()=>V(l),e=>e.id,(e,t)=>{var n=qo(),r=F(n),i=F(r,!0);k(r);var a=L(r,2),o=F(a,!0);k(a);var s=L(a,2),c=F(s,!0);k(s),k(n),R(()=>{pi(r,1,`mt-0.5 flex-shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium ${S[V(t).type]??``}`),G(i,V(t).type),G(o,V(t).message),G(c,V(t).timestamp)}),W(e,n)}),k(t),W(e,t)};K(u,e=>{V(l).length===0?e(f):e(p,-1)}),k(o),k(t),H(`click`,c,x),W(e,t)},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=Xo(),r=I(n);J(r,{code:`import { createSvState, devtoolsPlugin } from 'svstate'; + +const { data, execute, reset, rollback, state } = createSvState( + { name: '', email: '', message: '' }, + { + validator: (source) => ({ /* ... */ }), + effect: ({ snapshot, property }) => { + snapshot(\`Changed \${property}\`); + }, + action: async () => { await saveToServer(); } + }, + { + plugins: [ + devtoolsPlugin({ + name: 'my-form', // Label in console + enabled: true, // Auto-disabled in production + collapsed: true, // Console groups collapsed + logValidation: true // Also log validation events + }) + ] + } +);`,title:`devtoolsPlugin Setup`}),J(L(r,2),{code:`// devtoolsPlugin logs these events to the console: +// - onChange: property changes with old/new values +// - onValidation: validation results (if logValidation: true) +// - onSnapshot: snapshot creation with title +// - onAction: action start/complete/error +// - onRollback: rollback with target snapshot title +// - onReset: state reset events`,title:`What Gets Logged`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),c()}Rr([`click`]);var Qo=U(`Restored from storage`),$o=U(`Fresh state`),es=U(``),ts=U(`
        Try: Reload the page to see persistence. Open this page in another tab to see cross-tab sync.
        `,1),ns=U(`
        Persistence Info
        Restored:
        Key: svstate-demo-settings
        Excluded: notifications
        Raw localStorage
         
        Sync Info
        Channel: svstate-demo-sync
        Throttle: 200ms
        Merge: overwrite (default)
        `),rs=U(` `,1);function is(e,t){Ge(t,!0);let n=()=>A(d,`$hasErrors`,a),r=()=>A(f,`$isDirty`,a),i=()=>A(u,`$errors`,a),[a,o]=mt(),s=Wi({key:`svstate-demo-settings`,throttle:300,exclude:[`notifications`]}),{data:c,reset:l,state:{errors:u,hasErrors:d,isDirty:f}}=ca({username:``,theme:`light`,fontSize:14,notifications:!0},{validator:e=>({username:q(e.username).prepare(`trim`).required().minLength(2).maxLength(30).getError(),theme:``,fontSize:``,notifications:``})},{plugins:[s,Xi({key:`svstate-demo-sync`,throttle:200})]}),p=s.isRestored(),m=()=>{s.clearPersistedState(),l()},h=()=>{c.username=`demo_user`,c.theme=`dark`,c.fontSize=16,c.notifications=!1},g=N(``);Ln(()=>{c.username,c.theme,c.fontSize,c.notifications;let e=setTimeout(()=>{P(g,localStorage.getItem(`svstate-demo-settings`)??`(empty)`,!0)},500);return()=>clearTimeout(e)}),wa(e,{description:`Settings form with persistPlugin (localStorage) and syncPlugin (cross-tab sync via BroadcastChannel).`,title:`Plugin: Persist & Sync`,main:e=>{var t=ts(),a=I(t);ka(a,{get hasErrors(){return n()},get isDirty(){return r()}});var o=L(a,2),s=F(o),u=e=>{W(e,Qo())},d=e=>{W(e,$o())};K(s,e=>{p?e(u):e(d,-1)}),k(o);var f=L(o,4),h=F(f);{let e=M(()=>i()?.username);Y(h,{id:`username`,get error(){return V(e)},label:`Username`,placeholder:`Enter username`,get value(){return c.username},set value(e){c.username=e}})}var g=L(h,2),_=L(F(g),2),v=F(_);v.value=v.__value=`light`;var y=L(v);y.value=y.__value=`dark`;var b=L(y);b.value=b.__value=`system`,k(_),k(g);var x=L(g,2);Y(x,{id:`fontSize`,label:`Font Size`,max:32,min:8,step:1,type:`number`,get value(){return c.fontSize},set value(e){c.fontSize=e}});var S=L(x,2),C=F(S),w=F(C);xi(w),Pe(4),k(C),k(S),k(f);var T=L(f,2),E=F(T),ee=L(E,2),te=e=>{var t=es();H(`click`,t,l),W(e,t)};K(ee,e=>{r()&&e(te)}),k(T),gi(_,()=>c.theme,e=>c.theme=e),Di(w,()=>c.notifications,e=>c.notifications=e),H(`click`,E,m),W(e,t)},sidebar:e=>{var t=ns(),a=F(t);ga(a,{get data(){return c},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:h,width:`xl:w-96`});var o=L(a,2),s=L(F(o),2),l=F(s),u=L(F(l));k(l),Pe(4),k(s),k(o);var d=L(o,2),f=L(F(d),2),m=F(f,!0);k(f),k(d),Pe(2),k(t),R(()=>{G(u,` ${p??``}`),G(m,V(g))}),W(e,t)},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=rs(),r=I(n);J(r,{code:`import { createSvState, persistPlugin, syncPlugin } from 'svstate'; + +const persist = persistPlugin({ + key: 'svstate-demo-settings', + throttle: 300, + exclude: ['notifications'] // Don't persist this field +}); + +const sync = syncPlugin({ + key: 'svstate-demo-sync', + throttle: 200 +}); + +const { data, reset, state } = createSvState( + { username: '', theme: 'light', fontSize: 14, notifications: true }, + { validator: (source) => ({ /* ... */ }) }, + { plugins: [persist, sync] } +);`,title:`persistPlugin + syncPlugin Setup`}),J(L(r,2),{code:`// persistPlugin API +persist.isRestored(); // true if data was loaded from storage +persist.clearPersistedState(); // Remove stored data + +// syncPlugin: automatic cross-tab sync via BroadcastChannel +// Changes in one tab appear in all other tabs with same key`,title:`Plugin API`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),o()}Rr([`click`]);var as=U(``),os=U(`
        Max: 10
        `,1),ss=U(`

        No snapshots yet

        `),cs=U(`
      • `),ls=U(`
          `),us=U(`

          No redo entries — undo something first

          `),ds=U(`
        • `),fs=U(`
          Snapshot History
          Redo Stack
          `),ps=U(` `,1);function ms(e,t){Ge(t,!0);let n=()=>A(m,`$hasErrors`,o),r=()=>A(h,`$isDirty`,o),i=()=>A(g,`$snapshots`,o),a=()=>A(p,`$errors`,o),[o,s]=mt(),c=Zi(),l=e=>e.charAt(0).toUpperCase()+e.slice(1).replaceAll(/([A-Z])/g,` $1`),{data:u,reset:d,rollback:f,state:{errors:p,hasErrors:m,isDirty:h,snapshots:g}}=ca({title:`My Document`,content:``,priority:`medium`},{validator:e=>({title:q(e.title).prepare(`trim`).required().minLength(2).maxLength(100).getError(),content:q(e.content).prepare(`trim`).required().minLength(10).getError(),priority:``}),effect:({snapshot:e,property:t})=>{e(`Changed ${l(t)}`)}},{maxSnapshots:10,plugins:[c]}),_=()=>{u.title=`Project Report ${X()}`,u.content=`This is a detailed document with enough content to pass validation requirements.`,u.priority=`high`},v=N(fn(ut(c.redoStack)));Ln(()=>c.redoStack.subscribe(e=>{P(v,e,!0)})),wa(e,{description:`Combines the built-in snapshot/rollback system with the undoRedoPlugin for full undo/redo support.`,title:`Plugin: Undo/Redo`,main:e=>{var t=os(),o=I(t);ka(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),l=F(s),p=F(l);k(l);var m=L(l,2),h=F(m);k(m),Pe(2),k(s);var g=L(s,2),_=F(g);{let e=M(()=>a()?.title);Y(_,{id:`title`,get error(){return V(e)},label:`Title`,placeholder:`Enter document title`,get value(){return u.title},set value(e){u.title=e}})}var y=L(_,2);{let e=M(()=>a()?.content);no(y,{id:`content`,get error(){return V(e)},label:`Content`,placeholder:`Write your document content (min 10 chars)`,required:!0,rows:4,get value(){return u.content},set value(e){u.content=e}})}var b=L(y,2),x=L(F(b),2),S=F(x);S.value=S.__value=`low`;var C=L(S);C.value=C.__value=`medium`;var w=L(C);w.value=w.__value=`high`;var T=L(w);T.value=T.__value=`critical`,k(x),k(b),k(g);var E=L(g,2),ee=F(E),te=L(ee,2),ne=L(te,2),re=e=>{var t=as();H(`click`,t,d),W(e,t)};K(ne,e=>{r()&&e(re)}),k(E),R(()=>{G(p,`${i().length??``} Snapshot${i().length===1?``:`s`}`),G(h,`${V(v).length??``} Redo${V(v).length===1?``:`s`}`),ee.disabled=i().length<=1,te.disabled=V(v).length===0}),gi(x,()=>u.priority,e=>u.priority=e),H(`click`,ee,()=>f()),H(`click`,te,()=>c.redo()),W(e,t)},sidebar:e=>{var t=fs(),o=F(t);ga(o,{get data(){return u},get errors(){return a()},get hasErrors(){return n()},get isDirty(){return r()},onFill:_,width:`xl:w-96`});var s=L(o,2),c=L(F(s),2),l=e=>{W(e,ss())},d=e=>{var t=ls();ii(t,5,i,ei,(e,t,n)=>{var r=cs(),i=F(r);i.textContent=n+1;var a=L(i,2),o=F(a,!0);k(a),k(r),R(()=>G(o,V(t).title)),W(e,r)}),k(t),W(e,t)};K(c,e=>{i().length===0?e(l):e(d,-1)}),k(s);var f=L(s,2),p=L(F(f),2),m=e=>{W(e,us())},h=e=>{var t=ls();ii(t,21,()=>V(v),ei,(e,t,n)=>{var r=ds(),i=F(r);i.textContent=n+1;var a=L(i,2),o=F(a,!0);k(a),k(r),R(()=>G(o,V(t).title)),W(e,r)}),k(t),W(e,t)};K(p,e=>{V(v).length===0?e(m):e(h,-1)}),k(f),k(t),W(e,t)},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=ps(),r=I(n);J(r,{code:`import { createSvState, undoRedoPlugin } from 'svstate'; + +const undoRedo = undoRedoPlugin(); + +const { data, reset, rollback, state } = createSvState( + { title: 'My Document', content: '', priority: 'medium' }, + { + validator: (source) => ({ /* ... */ }), + effect: ({ snapshot, property }) => { + snapshot(\`Changed \${property}\`); + } + }, + { maxSnapshots: 10, plugins: [undoRedo] } +);`,title:`Setup with undoRedoPlugin`}),J(L(r,2),{code:`// Undo (built-in rollback) +rollback(); + +// Redo (from undoRedoPlugin) +undoRedo.redo(); + +// Check if redo is available +undoRedo.canRedo(); // boolean + +// Subscribe to redo stack +undoRedo.redoStack; // Readable`,title:`Undo/Redo Usage`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),s()}Rr([`click`]);var hs=U(`
          `),gs=U(`
          `,1),_s=U(` `,1);function vs(e,t){Ge(t,!0);let n=()=>A(u,`$hasErrors`,a),r=()=>A(d,`$isDirty`,a),i=()=>A(l,`$errors`,a),[a,o]=mt(),{data:s,reset:c,state:{errors:l,hasErrors:u,isDirty:d}}=ca({firstName:`Alice`,lastName:`Smith`,email:`alice.smith@example.com`,phone:``,bio:``},{validator:e=>({firstName:q(e.firstName).prepare(`trim`).required().minLength(2).maxLength(30).getError(),lastName:q(e.lastName).prepare(`trim`).required().minLength(2).maxLength(30).getError(),email:q(e.email).prepare(`trim`).required().email().getError(),phone:q(e.phone).prepare(`trim`).required().minLength(10).getError(),bio:q(e.bio).maxLength(200).getError()})}),f=()=>{s.firstName=`John`,s.lastName=`Doe${X()}`,s.email=`john.doe.${X()}@example.com`,s.phone=`555-${X().slice(0,3)}-${X().slice(0,4)}`,s.bio=`Software developer with a passion for clean code.`};wa(e,{description:`Demonstrates the reset() function to restore state back to its initial values.`,title:`Reset Demo`,main:e=>{var t=gs(),a=I(t);ka(a,{get hasErrors(){return n()},get isDirty(){return r()}});var o=L(a,2),l=F(o);{let e=M(()=>i()?.firstName);Y(l,{id:`firstName`,get error(){return V(e)},label:`First Name`,placeholder:`Enter first name`,get value(){return s.firstName},set value(e){s.firstName=e}})}var u=L(l,2);{let e=M(()=>i()?.lastName);Y(u,{id:`lastName`,get error(){return V(e)},label:`Last Name`,placeholder:`Enter last name`,get value(){return s.lastName},set value(e){s.lastName=e}})}var d=L(u,2);{let e=M(()=>i()?.email);Y(d,{id:`email`,get error(){return V(e)},label:`Email`,placeholder:`Enter email`,type:`email`,get value(){return s.email},set value(e){s.email=e}})}var f=L(d,2);{let e=M(()=>i()?.phone);Y(f,{id:`phone`,get error(){return V(e)},label:`Phone`,placeholder:`555-123-4567`,get value(){return s.phone},set value(e){s.phone=e}})}var p=L(f,2);{let e=M(()=>i()?.bio);no(p,{id:`bio`,get error(){return V(e)},label:`Bio`,placeholder:`Tell us about yourself`,required:!1,get value(){return s.bio},set value(e){s.bio=e}})}k(o);var m=L(o,2),h=e=>{var t=hs(),n=F(t);k(t),H(`click`,n,c),W(e,t)};K(m,e=>{r()&&e(h)}),W(e,t)},sidebar:e=>{ga(e,{get data(){return s},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:f})},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=_s(),r=I(n);J(r,{code:`const sourceData = { + firstName: 'Alice', + lastName: 'Smith', + email: 'alice.smith@example.com', + phone: '', + bio: '' +}; + +const { data, reset, state: { errors, hasErrors, isDirty } } = createSvState(sourceData, { + validator: (source) => ({ + firstName: stringValidator(source.firstName).prepare('trim').required().minLength(2).maxLength(30).getError(), + lastName: stringValidator(source.lastName).prepare('trim').required().minLength(2).maxLength(30).getError(), + email: stringValidator(source.email).prepare('trim').required().email().getError(), + phone: stringValidator(source.phone).prepare('trim').required().minLength(10).getError(), + bio: stringValidator(source.bio).maxLength(200).getError() + }) +});`,title:`State Setup with Reset`}),J(L(r,2),{code:` +{#if $isDirty} + +{/if} + + +`,title:`Conditional Reset Button`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),o()}Rr([`click`]);var ys=U(``),bs=U(`
          Max: 5
          `,1),xs=U(`

          No snapshots yet

          `),Ss=U(`
        • `),Cs=U(`
            `),ws=U(`
            Snapshot History
            `),Ts=U(` `,1);function Es(e,t){Ge(t,!0);let n=()=>A(h,`$hasErrors`,o),r=()=>A(g,`$isDirty`,o),i=()=>A(_,`$snapshots`,o),a=()=>A(m,`$errors`,o),[o,s]=mt(),c={firstName:`Alice`,lastName:`Smith`,email:`alice.smith@example.com`,phone:``,bio:``},l=e=>e.charAt(0).toUpperCase()+e.slice(1).replaceAll(/([A-Z])/g,` $1`),{data:u,reset:d,rollback:f,rollbackTo:p,state:{errors:m,hasErrors:h,isDirty:g,snapshots:_}}=ca(c,{validator:e=>({firstName:q(e.firstName).prepare(`trim`).required().minLength(2).maxLength(30).getError(),lastName:q(e.lastName).prepare(`trim`).required().minLength(2).maxLength(30).getError(),email:q(e.email).prepare(`trim`).required().email().getError(),phone:q(e.phone).prepare(`trim`).required().minLength(10).getError(),bio:q(e.bio).maxLength(200).getError()}),effect:({snapshot:e,property:t})=>{e(`Changed ${l(t)}`)}},{maxSnapshots:5}),v=()=>{u.firstName=`John`,u.lastName=`Doe${X()}`,u.email=`john.doe.${X()}@example.com`,u.phone=`555-${X().slice(0,3)}-${X().slice(0,4)}`,u.bio=`Software developer with a passion for clean code.`};wa(e,{description:`Shows snapshot creation for undo functionality with rollback(), rollbackTo(), and maxSnapshots support.`,title:`Snapshot & Rollback Demo`,main:e=>{var t=bs(),o=I(t);ka(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),c=F(s),l=F(c);k(c),Pe(2),k(s);var m=L(s,2),h=F(m);{let e=M(()=>a()?.firstName);Y(h,{id:`firstName`,get error(){return V(e)},label:`First Name`,placeholder:`Enter first name`,get value(){return u.firstName},set value(e){u.firstName=e}})}var g=L(h,2);{let e=M(()=>a()?.lastName);Y(g,{id:`lastName`,get error(){return V(e)},label:`Last Name`,placeholder:`Enter last name`,get value(){return u.lastName},set value(e){u.lastName=e}})}var _=L(g,2);{let e=M(()=>a()?.email);Y(_,{id:`email`,get error(){return V(e)},label:`Email`,placeholder:`Enter email`,type:`email`,get value(){return u.email},set value(e){u.email=e}})}var v=L(_,2);{let e=M(()=>a()?.phone);Y(v,{id:`phone`,get error(){return V(e)},label:`Phone`,placeholder:`555-123-4567`,get value(){return u.phone},set value(e){u.phone=e}})}var y=L(v,2);{let e=M(()=>a()?.bio);no(y,{id:`bio`,get error(){return V(e)},label:`Bio`,placeholder:`Tell us about yourself`,required:!1,get value(){return u.bio},set value(e){u.bio=e}})}k(m);var b=L(m,2),x=F(b),S=L(x,2),C=L(S,2),w=e=>{var t=ys();H(`click`,t,d),W(e,t)};K(C,e=>{r()&&e(w)}),k(b),R(()=>{G(l,`${i().length??``} Snapshot${i().length===1?``:`s`}`),x.disabled=i().length<=1,S.disabled=i().length<=1}),H(`click`,x,()=>f()),H(`click`,S,()=>p(`Initial`)),W(e,t)},sidebar:e=>{var t=ws(),o=F(t);ga(o,{get data(){return u},get errors(){return a()},get hasErrors(){return n()},get isDirty(){return r()},onFill:v,width:`xl:w-96`});var s=L(o,2),c=L(F(s),2),l=e=>{W(e,xs())},d=e=>{var t=Cs();ii(t,5,i,ei,(e,t,n)=>{var r=Ss(),a=F(r);a.textContent=n+1;var o=L(a,2),s=F(o,!0);k(o),k(r),R(()=>{o.disabled=i().length<=1,G(s,V(t).title)}),H(`click`,o,()=>p(V(t).title)),W(e,r)}),k(t),W(e,t)};K(c,e=>{i().length===0?e(l):e(d,-1)}),k(s),k(t),W(e,t)},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=Ts(),r=I(n);J(r,{code:`const sourceData = { + firstName: 'Alice', lastName: 'Smith', email: 'alice.smith@example.com', phone: '', bio: '' +}; + +const { data, reset, rollback, rollbackTo, state: { errors, hasErrors, isDirty, snapshots } } = + createSvState(sourceData, { + validator: (source) => ({ /* validation rules */ }), + effect: ({ snapshot, property }) => { + snapshot(\`Changed \${formatFieldName(property)}\`); + } + }, { maxSnapshots: 5 });`,title:`State Setup with Snapshots & maxSnapshots`});var i=L(r,2);J(i,{code:`// Effect callback creates snapshots on each change +effect: ({ snapshot, property }) => { + snapshot(\`Changed \${property}\`); // Creates undo point + // If same title, replaces last snapshot (debouncing) + // Use snapshot(title, false) to always create new +}`,title:`Effect with Snapshot Creation`}),J(L(i,2),{code:`// Undo last change +rollback(); + +// Undo 3 changes at once +rollback(3); + +// Roll back to a named snapshot (returns true if found) +rollbackTo('Changed First Name'); + +// Roll back to initial state +rollbackTo('Initial'); + +// Reset to initial state (clears all snapshots) +reset();`,title:`Rollback, RollbackTo & Reset Usage`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),s()}Rr([`click`]);var Ds;function Z(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Os=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ks=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ds=globalThis).__zod_globalConfig??(Ds.__zod_globalConfig={});var As=globalThis.__zod_globalConfig;function js(e){return e&&Object.assign(As,e),As}function Ms(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ns(e,t){return typeof t==`bigint`?t.toString():t}function Ps(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Fs(e){return e==null}function Is(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ls(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r){};function Ws(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Gs=Ps(()=>{if(As.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ks(e){if(Ws(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Ws(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function qs(e){return Ks(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Js=new Set([`string`,`number`,`symbol`]);function Ys(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Xs(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function $(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Zs(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Qs={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function $s(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Xs(e,Bs(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return zs(this,`shape`,e),e},checks:[]}))}function ec(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Xs(e,Bs(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return zs(this,`shape`,r),r},checks:[]}))}function tc(e,t){if(!Ks(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Xs(e,Bs(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return zs(this,`shape`,n),n}}))}function nc(e,t){if(!Ks(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Xs(e,Bs(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return zs(this,`shape`,n),n}}))}function rc(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Xs(e,Bs(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return zs(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ic(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Xs(t,Bs(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return zs(this,`shape`,i),i},checks:[]}))}function ac(e,t,n){return Xs(t,Bs(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return zs(this,`shape`,i),i}}))}function oc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function lc(e){return typeof e==`string`?e:e?.message}function uc(e,t,n){let r=e.message?e.message:lc(e.inst?._zod.def?.error?.(e))??lc(t?.error?.(e))??lc(n.customError?.(e))??lc(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function dc(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function fc(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var pc=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ns,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},mc=Z(`$ZodError`,pc),hc=Z(`$ZodError`,pc,{Parent:Error});function gc(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function _c(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Os;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>uc(e,a,js())));throw Us(t,i?.callee),t}return o.value},yc=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>uc(e,a,js())));throw Us(t,i?.callee),t}return o.value},bc=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Os;return a.issues.length?{success:!1,error:new(e??mc)(a.issues.map(e=>uc(e,i,js())))}:{success:!0,data:a.value}},xc=bc(hc),Sc=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>uc(e,i,js())))}:{success:!0,data:a.value}},Cc=Sc(hc),wc=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return vc(e)(t,n,i)},Tc=e=>(t,n,r)=>vc(e)(t,n,r),Ec=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return yc(e)(t,n,i)},Dc=e=>async(t,n,r)=>yc(e)(t,n,r),Oc=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return bc(e)(t,n,i)},kc=e=>(t,n,r)=>bc(e)(t,n,r),Ac=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Sc(e)(t,n,i)},jc=e=>async(t,n,r)=>Sc(e)(t,n,r),Mc=/^[cC][0-9a-z]{6,}$/,Nc=/^[0-9a-z]+$/,Pc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Fc=/^[0-9a-vA-V]{20}$/,Ic=/^[A-Za-z0-9]{27}$/,Lc=/^[a-zA-Z0-9_-]{21}$/,Rc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Bc=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Vc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Hc=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Uc(){return new RegExp(Hc,`u`)}var Wc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Kc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,qc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yc=/^[A-Za-z0-9_-]*$/,Xc=/^https?$/,Zc=/^\+[1-9]\d{6,14}$/,Qc=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,$c=RegExp(`^${Qc}$`);function el(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function tl(e){return RegExp(`^${el(e)}$`)}function nl(e){let t=el({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Qc}T(?:${r})$`)}var rl=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},il=/^-?\d+$/,al=/^-?\d+(?:\.\d+)?$/,ol=/^[^A-Z]*$/,sl=/^[^a-z]*$/,cl=Z(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ll={number:`number`,bigint:`bigint`,object:`date`},ul=Z(`$ZodCheckLessThan`,(e,t)=>{cl.init(e,t);let n=ll[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{cl.init(e,t);let n=ll[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fl=Z(`$ZodCheckMultipleOf`,(e,t)=>{cl.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ls(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),pl=Z(`$ZodCheckNumberFormat`,(e,t)=>{cl.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Qs[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=il)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),ml=Z(`$ZodCheckMaxLength`,(e,t)=>{var n;cl.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Fs(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=dc(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),hl=Z(`$ZodCheckMinLength`,(e,t)=>{var n;cl.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Fs(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=dc(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gl=Z(`$ZodCheckLengthEquals`,(e,t)=>{var n;cl.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Fs(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=dc(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),_l=Z(`$ZodCheckStringFormat`,(e,t)=>{var n,r;cl.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),vl=Z(`$ZodCheckRegex`,(e,t)=>{_l.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),yl=Z(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ol,_l.init(e,t)}),bl=Z(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=sl,_l.init(e,t)}),xl=Z(`$ZodCheckIncludes`,(e,t)=>{cl.init(e,t);let n=Ys(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Sl=Z(`$ZodCheckStartsWith`,(e,t)=>{cl.init(e,t);let n=RegExp(`^${Ys(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Cl=Z(`$ZodCheckEndsWith`,(e,t)=>{cl.init(e,t);let n=RegExp(`.*${Ys(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),wl=Z(`$ZodCheckOverwrite`,(e,t)=>{cl.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Tl=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` +`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(` +`))}},El={major:4,minor:4,patch:3},Dl=Z(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=El;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=oc(e),i;for(let a of t){if(a._zod.def.when){if(sc(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Os;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=oc(e,t))});else{if(e.issues.length===t)continue;r||=oc(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(oc(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Os;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Os;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Q(e,`~standard`,()=>({validate:t=>{try{let n=xc(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Cc(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ol=Z(`$ZodString`,(e,t)=>{Dl.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??rl(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),kl=Z(`$ZodStringFormat`,(e,t)=>{_l.init(e,t),Ol.init(e,t)}),Al=Z(`$ZodGUID`,(e,t)=>{t.pattern??=zc,kl.init(e,t)}),jl=Z(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Bc(e)}else t.pattern??=Bc();kl.init(e,t)}),Ml=Z(`$ZodEmail`,(e,t)=>{t.pattern??=Vc,kl.init(e,t)}),Nl=Z(`$ZodURL`,(e,t)=>{kl.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Xc.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Pl=Z(`$ZodEmoji`,(e,t)=>{t.pattern??=Uc(),kl.init(e,t)}),Fl=Z(`$ZodNanoID`,(e,t)=>{t.pattern??=Lc,kl.init(e,t)}),Il=Z(`$ZodCUID`,(e,t)=>{t.pattern??=Mc,kl.init(e,t)}),Ll=Z(`$ZodCUID2`,(e,t)=>{t.pattern??=Nc,kl.init(e,t)}),Rl=Z(`$ZodULID`,(e,t)=>{t.pattern??=Pc,kl.init(e,t)}),zl=Z(`$ZodXID`,(e,t)=>{t.pattern??=Fc,kl.init(e,t)}),Bl=Z(`$ZodKSUID`,(e,t)=>{t.pattern??=Ic,kl.init(e,t)}),Vl=Z(`$ZodISODateTime`,(e,t)=>{t.pattern??=nl(t),kl.init(e,t)}),Hl=Z(`$ZodISODate`,(e,t)=>{t.pattern??=$c,kl.init(e,t)}),Ul=Z(`$ZodISOTime`,(e,t)=>{t.pattern??=tl(t),kl.init(e,t)}),Wl=Z(`$ZodISODuration`,(e,t)=>{t.pattern??=Rc,kl.init(e,t)}),Gl=Z(`$ZodIPv4`,(e,t)=>{t.pattern??=Wc,kl.init(e,t),e._zod.bag.format=`ipv4`}),Kl=Z(`$ZodIPv6`,(e,t)=>{t.pattern??=Gc,kl.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),ql=Z(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Kc,kl.init(e,t)}),Jl=Z(`$ZodCIDRv6`,(e,t)=>{t.pattern??=qc,kl.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Yl(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Xl=Z(`$ZodBase64`,(e,t)=>{t.pattern??=Jc,kl.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Yl(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Zl(e){if(!Yc.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Yl(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ql=Z(`$ZodBase64URL`,(e,t)=>{t.pattern??=Yc,kl.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Zl(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),$l=Z(`$ZodE164`,(e,t)=>{t.pattern??=Zc,kl.init(e,t)});function eu(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var tu=Z(`$ZodJWT`,(e,t)=>{kl.init(e,t),e._zod.check=n=>{eu(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),nu=Z(`$ZodNumber`,(e,t)=>{Dl.init(e,t),e._zod.pattern=e._zod.bag.pattern??al,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),ru=Z(`$ZodNumberFormat`,(e,t)=>{pl.init(e,t),nu.init(e,t)}),iu=Z(`$ZodUnknown`,(e,t)=>{Dl.init(e,t),e._zod.parse=e=>e}),au=Z(`$ZodNever`,(e,t)=>{Dl.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function ou(e,t,n){e.issues.length&&t.issues.push(...cc(n,e.issues)),t.value[n]=e.value}var su=Z(`$ZodArray`,(e,t)=>{Dl.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;eou(t,n,e))):ou(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function cu(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...cc(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function lu(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Zs(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function uu(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>cu(e,n,i,t,u,d))):cu(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var du=Z(`$ZodObject`,(e,t)=>{if(Dl.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Ps(()=>lu(t));Q(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Ws,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>cu(n,t,e,s,r,i))):cu(a,t,e,s,r,i)}return i?uu(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),fu=Z(`$ZodObjectJIT`,(e,t)=>{du.init(e,t);let n=e._zod.parse,r=Ps(()=>lu(t)),i=e=>{let t=new Tl([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Vs(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Vs(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(` + if (${n}.issues.length) { + if (${o} in input) { + payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${o}, ...iss.path] : [${o}] + }))); + } + } + + if (${n}.value === undefined) { + if (${o} in input) { + newResult[${o}] = undefined; + } + } else { + newResult[${o}] = ${n}.value; + } + + `):c?t.write(` + if (${n}.issues.length) { + payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${o}, ...iss.path] : [${o}] + }))); + } + + if (${n}.value === undefined) { + if (${o} in input) { + newResult[${o}] = undefined; + } + } else { + newResult[${o}] = ${n}.value; + } + + `):t.write(` + const ${n}_present = ${o} in input; + if (${n}.issues.length) { + payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${o}, ...iss.path] : [${o}] + }))); + } + if (!${n}_present && !${n}.issues.length) { + payload.issues.push({ + code: "invalid_type", + expected: "nonoptional", + input: undefined, + path: [${o}] + }); + } + + if (${n}_present) { + if (${n}.value === undefined) { + newResult[${o}] = undefined; + } else { + newResult[${o}] = ${n}.value; + } + } + + `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Ws,s=!As.jitless,c=s&&Gs.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?uu([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function pu(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!oc(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>uc(e,r,js())))}),t)}var mu=Z(`$ZodUnion`,(e,t)=>{Dl.init(e,t),Q(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Q(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Q(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Q(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Is(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>pu(t,r,e,i)):pu(o,r,e,i)}}),hu=Z(`$ZodIntersection`,(e,t)=>{Dl.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>_u(e,t,n)):_u(e,i,a)}});function gu(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ks(e)&&Ks(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=gu(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;re.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),oc(e))return e;let o=gu(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var vu=Z(`$ZodEnum`,(e,t)=>{Dl.init(e,t);let n=Ms(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Js.has(typeof e)).map(e=>typeof e==`string`?Ys(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),yu=Z(`$ZodLiteral`,(e,t)=>{if(Dl.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Ys(e):e?Ys(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),bu=Z(`$ZodTransform`,(e,t)=>{Dl.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ks(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Os;return n.value=i,n.fallback=!0,n}});function xu(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Su=Z(`$ZodOptional`,(e,t)=>{Dl.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Q(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Q(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Is(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>xu(e,r)):xu(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Cu=Z(`$ZodExactOptional`,(e,t)=>{Su.init(e,t),Q(e._zod,`values`,()=>t.innerType._zod.values),Q(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),wu=Z(`$ZodNullable`,(e,t)=>{Dl.init(e,t),Q(e._zod,`optin`,()=>t.innerType._zod.optin),Q(e._zod,`optout`,()=>t.innerType._zod.optout),Q(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Is(e.source)}|null)$`):void 0}),Q(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Tu=Z(`$ZodDefault`,(e,t)=>{Dl.init(e,t),e._zod.optin=`optional`,Q(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Eu(e,t)):Eu(r,t)}});function Eu(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Du=Z(`$ZodPrefault`,(e,t)=>{Dl.init(e,t),e._zod.optin=`optional`,Q(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ou=Z(`$ZodNonOptional`,(e,t)=>{Dl.init(e,t),Q(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ku(t,e)):ku(i,e)}});function ku(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Au=Z(`$ZodCatch`,(e,t)=>{Dl.init(e,t),e._zod.optin=`optional`,Q(e._zod,`optout`,()=>t.innerType._zod.optout),Q(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>uc(e,n,js()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>uc(e,n,js()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),ju=Z(`$ZodPipe`,(e,t)=>{Dl.init(e,t),Q(e._zod,`values`,()=>t.in._zod.values),Q(e._zod,`optin`,()=>t.in._zod.optin),Q(e._zod,`optout`,()=>t.out._zod.optout),Q(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Mu(e,t.in,n)):Mu(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Mu(e,t.out,n)):Mu(r,t.out,n)}});function Mu(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Nu=Z(`$ZodReadonly`,(e,t)=>{Dl.init(e,t),Q(e._zod,`propValues`,()=>t.innerType._zod.propValues),Q(e._zod,`values`,()=>t.innerType._zod.values),Q(e._zod,`optin`,()=>t.innerType?._zod?.optin),Q(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Pu):Pu(r)}});function Pu(e){return e.value=Object.freeze(e.value),e}var Fu=Z(`$ZodCustom`,(e,t)=>{cl.init(e,t),Dl.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Iu(t,n,r,e));Iu(i,n,r,e)}});function Iu(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(fc(e))}}var Lu,Ru=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function zu(){return new Ru}(Lu=globalThis).__zod_globalRegistry??(Lu.__zod_globalRegistry=zu());var Bu=globalThis.__zod_globalRegistry;function Vu(e,t){return new e({type:`string`,...$(t)})}function Hu(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...$(t)})}function Uu(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...$(t)})}function Wu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...$(t)})}function Gu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...$(t)})}function Ku(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...$(t)})}function qu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...$(t)})}function Ju(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...$(t)})}function Yu(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...$(t)})}function Xu(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...$(t)})}function Zu(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...$(t)})}function Qu(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...$(t)})}function $u(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...$(t)})}function ed(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...$(t)})}function td(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...$(t)})}function nd(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...$(t)})}function rd(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...$(t)})}function id(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...$(t)})}function ad(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...$(t)})}function od(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...$(t)})}function sd(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...$(t)})}function cd(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...$(t)})}function ld(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...$(t)})}function ud(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...$(t)})}function dd(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...$(t)})}function fd(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...$(t)})}function pd(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...$(t)})}function md(e,t){return new e({type:`number`,checks:[],...$(t)})}function hd(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...$(t)})}function gd(e){return new e({type:`unknown`})}function _d(e,t){return new e({type:`never`,...$(t)})}function vd(e,t){return new ul({check:`less_than`,...$(t),value:e,inclusive:!1})}function yd(e,t){return new ul({check:`less_than`,...$(t),value:e,inclusive:!0})}function bd(e,t){return new dl({check:`greater_than`,...$(t),value:e,inclusive:!1})}function xd(e,t){return new dl({check:`greater_than`,...$(t),value:e,inclusive:!0})}function Sd(e,t){return new fl({check:`multiple_of`,...$(t),value:e})}function Cd(e,t){return new ml({check:`max_length`,...$(t),maximum:e})}function wd(e,t){return new hl({check:`min_length`,...$(t),minimum:e})}function Td(e,t){return new gl({check:`length_equals`,...$(t),length:e})}function Ed(e,t){return new vl({check:`string_format`,format:`regex`,...$(t),pattern:e})}function Dd(e){return new yl({check:`string_format`,format:`lowercase`,...$(e)})}function Od(e){return new bl({check:`string_format`,format:`uppercase`,...$(e)})}function kd(e,t){return new xl({check:`string_format`,format:`includes`,...$(t),includes:e})}function Ad(e,t){return new Sl({check:`string_format`,format:`starts_with`,...$(t),prefix:e})}function jd(e,t){return new Cl({check:`string_format`,format:`ends_with`,...$(t),suffix:e})}function Md(e){return new wl({check:`overwrite`,tx:e})}function Nd(e){return Md(t=>t.normalize(e))}function Pd(){return Md(e=>e.trim())}function Fd(){return Md(e=>e.toLowerCase())}function Id(){return Md(e=>e.toUpperCase())}function Ld(){return Md(e=>Hs(e))}function Rd(e,t,n){return new e({type:`array`,element:t,...$(n)})}function zd(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...$(n)})}function Bd(e,t){let n=Vd(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(fc(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(fc(r))}},e(t.value,t)),t);return n}function Vd(e,t){let n=new cl({check:`custom`,...$(t)});return n._zod.check=e,n}function Hd(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Bu,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Ud(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Ud(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Kd(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Wd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Gd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Jd(t,`input`,e.processors),output:Jd(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Kd(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Kd(r.element,n);if(r.type===`set`)return Kd(r.valueType,n);if(r.type===`lazy`)return Kd(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Kd(r.innerType,n);if(r.type===`intersection`)return Kd(r.left,n)||Kd(r.right,n);if(r.type===`record`||r.type===`map`)return Kd(r.keyType,n)||Kd(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Kd(r.in,n)||Kd(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Kd(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Kd(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Kd(e,n))return!0;return!!(r.rest&&Kd(r.rest,n))}return!1}var qd=(e,t={})=>n=>{let r=Hd({...n,processors:t});return Ud(e,r),Wd(r,e),Gd(r,e)},Jd=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Hd({...i??{},target:a,io:t,processors:n});return Ud(e,o),Wd(o,e),Gd(o,e)},Yd={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Xd=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Yd[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Zd=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Qd=(e,t,n,r)=>{n.not={}},$d=(e,t,n,r)=>{let i=e._zod.def,a=Ms(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ef=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},tf=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},nf=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},rf=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ud(a.element,t,{...r,path:[...r.path,`items`]})},af=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ud(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ud(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},of=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ud(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},sf=(e,t,n,r)=>{let i=e._zod.def,a=Ud(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ud(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},cf=(e,t,n,r)=>{let i=e._zod.def,a=Ud(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},lf=(e,t,n,r)=>{let i=e._zod.def;Ud(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},uf=(e,t,n,r)=>{let i=e._zod.def;Ud(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},df=(e,t,n,r)=>{let i=e._zod.def;Ud(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ff=(e,t,n,r)=>{let i=e._zod.def;Ud(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},pf=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Ud(o,t,r);let s=t.seen.get(e);s.ref=o},mf=(e,t,n,r)=>{let i=e._zod.def;Ud(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},hf=(e,t,n,r)=>{let i=e._zod.def;Ud(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},gf=Z(`ZodISODateTime`,(e,t)=>{Vl.init(e,t),Uf.init(e,t)});function _f(e){return ud(gf,e)}var vf=Z(`ZodISODate`,(e,t)=>{Hl.init(e,t),Uf.init(e,t)});function yf(e){return dd(vf,e)}var bf=Z(`ZodISOTime`,(e,t)=>{Ul.init(e,t),Uf.init(e,t)});function xf(e){return fd(bf,e)}var Sf=Z(`ZodISODuration`,(e,t)=>{Wl.init(e,t),Uf.init(e,t)});function Cf(e){return pd(Sf,e)}var wf=Z(`ZodError`,(e,t)=>{mc.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>_c(e,t)},flatten:{value:t=>gc(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ns,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ns,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Tf=vc(wf),Ef=yc(wf),Df=bc(wf),Of=Sc(wf),kf=wc(wf),Af=Tc(wf),jf=Ec(wf),Mf=Dc(wf),Nf=Oc(wf),Pf=kc(wf),Ff=Ac(wf),If=jc(wf),Lf=new WeakMap;function Rf(e,t,n){let r=Object.getPrototypeOf(e),i=Lf.get(r);if(i||(i=new Set,Lf.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var zf=Z(`ZodType`,(e,t)=>(Dl.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Jd(e,`input`),output:Jd(e,`output`)}}),e.toJSONSchema=qd(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Tf(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Df(e,t,n),e.parseAsync=async(t,n)=>Ef(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Of(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>kf(e,t,n),e.decode=(t,n)=>Af(e,t,n),e.encodeAsync=async(t,n)=>jf(e,t,n),e.decodeAsync=async(t,n)=>Mf(e,t,n),e.safeEncode=(t,n)=>Nf(e,t,n),e.safeDecode=(t,n)=>Pf(e,t,n),e.safeEncodeAsync=async(t,n)=>Ff(e,t,n),e.safeDecodeAsync=async(t,n)=>If(e,t,n),Rf(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Bs(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Xs(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Xp(e,t))},superRefine(e,t){return this.check(Zp(e,t))},overwrite(e){return this.check(Md(e))},optional(){return Mp(this)},exactOptional(){return Pp(this)},nullable(){return Ip(this)},nullish(){return Mp(Ip(this))},nonoptional(e){return Hp(this,e)},array(){return vp(this)},or(e){return Sp([this,e])},and(e){return wp(this,e)},transform(e){return Kp(this,Ap(e))},default(e){return Rp(this,e)},prefault(e){return Bp(this,e)},catch(e){return Wp(this,e)},pipe(e){return Kp(this,e)},readonly(){return Jp(this)},describe(e){let t=this.clone();return Bu.add(t,{description:e}),t},meta(...e){if(e.length===0)return Bu.get(this);let t=this.clone();return Bu.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Bu.get(e)?.description},configurable:!0}),e)),Bf=Z(`_ZodString`,(e,t)=>{Ol.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xd(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Rf(e,`_ZodString`,{regex(...e){return this.check(Ed(...e))},includes(...e){return this.check(kd(...e))},startsWith(...e){return this.check(Ad(...e))},endsWith(...e){return this.check(jd(...e))},min(...e){return this.check(wd(...e))},max(...e){return this.check(Cd(...e))},length(...e){return this.check(Td(...e))},nonempty(...e){return this.check(wd(1,...e))},lowercase(e){return this.check(Dd(e))},uppercase(e){return this.check(Od(e))},trim(){return this.check(Pd())},normalize(...e){return this.check(Nd(...e))},toLowerCase(){return this.check(Fd())},toUpperCase(){return this.check(Id())},slugify(){return this.check(Ld())}})}),Vf=Z(`ZodString`,(e,t)=>{Ol.init(e,t),Bf.init(e,t),e.email=t=>e.check(Hu(Wf,t)),e.url=t=>e.check(Ju(qf,t)),e.jwt=t=>e.check(ld(cp,t)),e.emoji=t=>e.check(Yu(Jf,t)),e.guid=t=>e.check(Uu(Gf,t)),e.uuid=t=>e.check(Wu(Kf,t)),e.uuidv4=t=>e.check(Gu(Kf,t)),e.uuidv6=t=>e.check(Ku(Kf,t)),e.uuidv7=t=>e.check(qu(Kf,t)),e.nanoid=t=>e.check(Xu(Yf,t)),e.guid=t=>e.check(Uu(Gf,t)),e.cuid=t=>e.check(Zu(Xf,t)),e.cuid2=t=>e.check(Qu(Zf,t)),e.ulid=t=>e.check($u(Qf,t)),e.base64=t=>e.check(od(ap,t)),e.base64url=t=>e.check(sd(op,t)),e.xid=t=>e.check(ed($f,t)),e.ksuid=t=>e.check(td(ep,t)),e.ipv4=t=>e.check(nd(tp,t)),e.ipv6=t=>e.check(rd(np,t)),e.cidrv4=t=>e.check(id(rp,t)),e.cidrv6=t=>e.check(ad(ip,t)),e.e164=t=>e.check(cd(sp,t)),e.datetime=t=>e.check(_f(t)),e.date=t=>e.check(yf(t)),e.time=t=>e.check(xf(t)),e.duration=t=>e.check(Cf(t))});function Hf(e){return Vu(Vf,e)}var Uf=Z(`ZodStringFormat`,(e,t)=>{kl.init(e,t),Bf.init(e,t)}),Wf=Z(`ZodEmail`,(e,t)=>{Ml.init(e,t),Uf.init(e,t)}),Gf=Z(`ZodGUID`,(e,t)=>{Al.init(e,t),Uf.init(e,t)}),Kf=Z(`ZodUUID`,(e,t)=>{jl.init(e,t),Uf.init(e,t)}),qf=Z(`ZodURL`,(e,t)=>{Nl.init(e,t),Uf.init(e,t)}),Jf=Z(`ZodEmoji`,(e,t)=>{Pl.init(e,t),Uf.init(e,t)}),Yf=Z(`ZodNanoID`,(e,t)=>{Fl.init(e,t),Uf.init(e,t)}),Xf=Z(`ZodCUID`,(e,t)=>{Il.init(e,t),Uf.init(e,t)}),Zf=Z(`ZodCUID2`,(e,t)=>{Ll.init(e,t),Uf.init(e,t)}),Qf=Z(`ZodULID`,(e,t)=>{Rl.init(e,t),Uf.init(e,t)}),$f=Z(`ZodXID`,(e,t)=>{zl.init(e,t),Uf.init(e,t)}),ep=Z(`ZodKSUID`,(e,t)=>{Bl.init(e,t),Uf.init(e,t)}),tp=Z(`ZodIPv4`,(e,t)=>{Gl.init(e,t),Uf.init(e,t)}),np=Z(`ZodIPv6`,(e,t)=>{Kl.init(e,t),Uf.init(e,t)}),rp=Z(`ZodCIDRv4`,(e,t)=>{ql.init(e,t),Uf.init(e,t)}),ip=Z(`ZodCIDRv6`,(e,t)=>{Jl.init(e,t),Uf.init(e,t)}),ap=Z(`ZodBase64`,(e,t)=>{Xl.init(e,t),Uf.init(e,t)}),op=Z(`ZodBase64URL`,(e,t)=>{Ql.init(e,t),Uf.init(e,t)}),sp=Z(`ZodE164`,(e,t)=>{$l.init(e,t),Uf.init(e,t)}),cp=Z(`ZodJWT`,(e,t)=>{tu.init(e,t),Uf.init(e,t)}),lp=Z(`ZodNumber`,(e,t)=>{nu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zd(e,t,n,r),Rf(e,`ZodNumber`,{gt(e,t){return this.check(bd(e,t))},gte(e,t){return this.check(xd(e,t))},min(e,t){return this.check(xd(e,t))},lt(e,t){return this.check(vd(e,t))},lte(e,t){return this.check(yd(e,t))},max(e,t){return this.check(yd(e,t))},int(e){return this.check(fp(e))},safe(e){return this.check(fp(e))},positive(e){return this.check(bd(0,e))},nonnegative(e){return this.check(xd(0,e))},negative(e){return this.check(vd(0,e))},nonpositive(e){return this.check(yd(0,e))},multipleOf(e,t){return this.check(Sd(e,t))},step(e,t){return this.check(Sd(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function up(e){return md(lp,e)}var dp=Z(`ZodNumberFormat`,(e,t)=>{ru.init(e,t),lp.init(e,t)});function fp(e){return hd(dp,e)}var pp=Z(`ZodUnknown`,(e,t)=>{iu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function mp(){return gd(pp)}var hp=Z(`ZodNever`,(e,t)=>{au.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qd(e,t,n,r)});function gp(e){return _d(hp,e)}var _p=Z(`ZodArray`,(e,t)=>{su.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rf(e,t,n,r),e.element=t.element,Rf(e,`ZodArray`,{min(e,t){return this.check(wd(e,t))},nonempty(e){return this.check(wd(1,e))},max(e,t){return this.check(Cd(e,t))},length(e,t){return this.check(Td(e,t))},unwrap(){return this.element}})});function vp(e,t){return Rd(_p,e,t)}var yp=Z(`ZodObject`,(e,t)=>{fu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>af(e,t,n,r),Q(e,`shape`,()=>t.shape),Rf(e,`ZodObject`,{keyof(){return Ep(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:mp()})},loose(){return this.clone({...this._zod.def,catchall:mp()})},strict(){return this.clone({...this._zod.def,catchall:gp()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return tc(this,e)},safeExtend(e){return nc(this,e)},merge(e){return rc(this,e)},pick(e){return $s(this,e)},omit(e){return ec(this,e)},partial(...e){return ic(jp,this,e[0])},required(...e){return ac(Vp,this,e[0])}})});function bp(e,t){return new yp({type:`object`,shape:e??{},...$(t)})}var xp=Z(`ZodUnion`,(e,t)=>{mu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>of(e,t,n,r),e.options=t.options});function Sp(e,t){return new xp({type:`union`,options:e,...$(t)})}var Cp=Z(`ZodIntersection`,(e,t)=>{hu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sf(e,t,n,r)});function wp(e,t){return new Cp({type:`intersection`,left:e,right:t})}var Tp=Z(`ZodEnum`,(e,t)=>{vu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$d(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Tp({...t,checks:[],...$(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Tp({...t,checks:[],...$(r),entries:i})}});function Ep(e,t){return new Tp({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...$(t)})}var Dp=Z(`ZodLiteral`,(e,t)=>{yu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ef(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Op(e,t){return new Dp({type:`literal`,values:Array.isArray(e)?e:[e],...$(t)})}var kp=Z(`ZodTransform`,(e,t)=>{bu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nf(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ks(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(fc(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(fc(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ap(e){return new kp({type:`transform`,transform:e})}var jp=Z(`ZodOptional`,(e,t)=>{Su.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mp(e){return new jp({type:`optional`,innerType:e})}var Np=Z(`ZodExactOptional`,(e,t)=>{Cu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Pp(e){return new Np({type:`optional`,innerType:e})}var Fp=Z(`ZodNullable`,(e,t)=>{wu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ip(e){return new Fp({type:`nullable`,innerType:e})}var Lp=Z(`ZodDefault`,(e,t)=>{Tu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Rp(e,t){return new Lp({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():qs(t)}})}var zp=Z(`ZodPrefault`,(e,t)=>{Du.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>df(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bp(e,t){return new zp({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():qs(t)}})}var Vp=Z(`ZodNonOptional`,(e,t)=>{Ou.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hp(e,t){return new Vp({type:`nonoptional`,innerType:e,...$(t)})}var Up=Z(`ZodCatch`,(e,t)=>{Au.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ff(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Wp(e,t){return new Up({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Gp=Z(`ZodPipe`,(e,t)=>{ju.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pf(e,t,n,r),e.in=t.in,e.out=t.out});function Kp(e,t){return new Gp({type:`pipe`,in:e,out:t})}var qp=Z(`ZodReadonly`,(e,t)=>{Nu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jp(e){return new qp({type:`readonly`,innerType:e})}var Yp=Z(`ZodCustom`,(e,t)=>{Fu.init(e,t),zf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tf(e,t,n,r)});function Xp(e,t={}){return zd(Yp,e,t)}function Zp(e,t){return Bd(e,t)}var Qp=U(`
            `,1),$p=U(` `,1);function em(e,t){Ge(t,!0);let n=()=>A(g,`$hasErrors`,o),r=()=>A(_,`$isDirty`,o),i=()=>A(h,`$errors`,o),a=()=>A(v,`$isDirtyByField`,o),[o,s]=mt(),c=bp({username:Hf().min(3).max(20).regex(/^\S+$/,`Must not contain spaces`),email:Hf().min(1,`Required`).email(),age:up().int().min(18).max(120),website:Hf().url().optional().or(Op(``)),bio:Hf().max(200).optional()});function l(e,t,n){let r=e.safeParse(t);if(r.success)return Object.fromEntries(n.map(e=>[e,``]));let i={};for(let e of r.error.issues){let t=String(e.path[0]);i[t]||(i[t]=e.message)}return Object.fromEntries(n.map(e=>[e,i[e]??``]))}let u=c.pick({username:!0,email:!0,age:!0,website:!0}),d=Object.keys(u.shape),f=[...d,`bio`],p={username:{label:`Username`,placeholder:`Enter username`,type:`text`},email:{label:`Email`,placeholder:`Enter email`,type:`email`},age:{label:`Age`,placeholder:`Enter age`,type:`number`},website:{label:`Website`,placeholder:`https://example.com`,type:`text`}},{data:m,state:{errors:h,hasErrors:g,isDirty:_,isDirtyByField:v}}=ca({username:``,email:``,age:0,website:``,bio:``},{validator:e=>l(c,e,f)}),y=()=>{m.username=`user${X()}`,m.email=`${X()}@example.com`,m.age=Aa(18,65),m.bio=`Hello, I am a demo user!`,m.website=`https://${X()}.com`},b=String.raw`import { z } from 'zod'; + +const userSchema = z.object({ + username: z.string().min(3).max(20).regex(/^\S+$/, 'Must not contain spaces'), + email: z.string().min(1, 'Required').email(), + age: z.number().int().min(18).max(120), + website: z.string().url().optional().or(z.literal('')), + bio: z.string().max(200).optional() +});`;wa(e,{description:`Demonstrates using Zod schemas for validation with svstate, including dynamic form rendering via z.pick() shape keys.`,title:`Zod Integration Demo`,main:e=>{var t=Qp(),o=I(t);ka(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),c=F(s);ii(c,16,()=>d,e=>e,(e,t)=>{let n=M(()=>p[t]);{let r=M(()=>i()?.[t]),o=M(()=>t!==`website`);Y(e,{get id(){return t},get error(){return V(r)},get isDirty(){return a()[t]},get label(){return V(n).label},get placeholder(){return V(n).placeholder},get required(){return V(o)},get type(){return V(n).type},get value(){return m[t]},set value(e){m[t]=e}})}});var l=L(c,2);{let e=M(()=>i()?.bio);no(l,{id:`bio`,get error(){return V(e)},get isDirty(){return a().bio},label:`Bio`,placeholder:`Tell us about yourself (not in pick subset)`,get value(){return m.bio},set value(e){m.bio=e}})}k(s),W(e,t)},sidebar:e=>{ga(e,{get data(){return m},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},get isDirtyByField(){return a()},onFill:y})},sourceCode:e=>{Da(e,{children:(e,t)=>{var n=$p(),r=I(n);J(r,{get code(){return b},title:`Zod Schema Definition`});var i=L(r,2);J(i,{code:`function zodToSvstateErrors(schema, source, fields) { + const result = schema.safeParse(source); + if (result.success) + return Object.fromEntries(fields.map(f => [f, ''])); + + const errorMap = {}; + for (const issue of result.error.issues) { + const key = String(issue.path[0]); + if (!errorMap[key]) errorMap[key] = issue.message; + } + return Object.fromEntries( + fields.map(f => [f, errorMap[f] ?? '']) + ); +} + +const { data, state: { errors, hasErrors } } = createSvState(sourceData, { + validator: (source) => zodToSvstateErrors(userSchema, source, allFields) +});`,title:`Bridge Function (Zod → svstate)`}),J(L(i,2),{code:`// Pick a subset of fields for dynamic rendering +const pickedSchema = userSchema.pick({ username: true, email: true, age: true, website: true }); +const dynamicFields = Object.keys(pickedSchema.shape); + +const fieldMeta = { + username: { label: 'Username', placeholder: 'Enter username', type: 'text' }, + email: { label: 'Email', placeholder: 'Enter email', type: 'email' }, + age: { label: 'Age', placeholder: 'Enter age', type: 'number' }, + website: { label: 'Website', placeholder: 'https://...', type: 'text' }, +}; + +// In template: +{#each dynamicFields as field} + +{/each} + + +`,title:`Dynamic Rendering via z.pick()`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Ke(),s()}var tm=U(``),nm=U(`
            svstate logo

            svstate

            A Svelte 5 library that provides a supercharged $state() with deep reactive proxies, validation, snapshot/undo, + and side effects — built for complex, real-world applications.

            $ npm i svstate
            `);function rm(e){let t=[{value:`basic-validation`,name:`Basic Validation`},{value:`nested-objects`,name:`Nested Objects`},{value:`array-property`,name:`Array Property`},{value:`calculated-fields`,name:`Calculated Fields`},{value:`calculated-class`,name:`State with Methods`},{value:`reset-demo`,name:`Reset`},{value:`snapshot-demo`,name:`Snapshot & Rollback`},{value:`action-demo`,name:`Action & Error`},{value:`async-validation`,name:`Async Validation`},{value:`options-demo`,name:`Options`},{value:`zod-validation`,name:`Zod Integration`},{value:`plugin-devtools`,name:`Plugin: Devtools`},{value:`plugin-persist-sync`,name:`Plugin: Persist & Sync`},{value:`plugin-undo-redo`,name:`Plugin: Undo/Redo`},{value:`plugin-autosave-analytics`,name:`Plugin: Autosave & Analytics`}],n=N(`basic-validation`),r=`1.5.5`,i=`/svstate`;var a=nm(),o=F(a),s=F(o),c=L(s,2),l=F(c),u=L(F(l),2),d=F(u);k(u),k(l);var f=L(l,4),p=L(F(f),4);k(f);var m=L(f,2);k(c),k(o);var h=L(o,2),g=F(h),_=F(g),v=L(F(_),2);ii(v,21,()=>t,ei,(e,t)=>{var n=tm(),r=F(n,!0);k(n);var i={};R(()=>{G(r,V(t).name),i!==(i=V(t).value)&&(n.value=(n.__value=V(t).value)??``)}),W(e,n)}),k(v),k(_),k(g);var y=L(g,2),b=F(y),x=e=>{ao(e,{})},S=e=>{wo(e,{})},C=e=>{qa(e,{})},w=e=>{ho(e,{})},T=e=>{fo(e,{})},E=e=>{vs(e,{})},ee=e=>{Es(e,{})},te=e=>{La(e,{})},ne=e=>{$a(e,{})},re=e=>{Mo(e,{})},ie=e=>{em(e,{})},ae=e=>{Zo(e,{})},oe=e=>{is(e,{})},se=e=>{ms(e,{})},ce=e=>{Uo(e,{})};K(b,e=>{V(n)===`basic-validation`?e(x):V(n)===`nested-objects`?e(S,1):V(n)===`array-property`?e(C,2):V(n)===`calculated-fields`?e(w,3):V(n)===`calculated-class`?e(T,4):V(n)===`reset-demo`?e(E,5):V(n)===`snapshot-demo`?e(ee,6):V(n)===`action-demo`?e(te,7):V(n)===`async-validation`?e(ne,8):V(n)===`options-demo`?e(re,9):V(n)===`zod-validation`?e(ie,10):V(n)===`plugin-devtools`?e(ae,11):V(n)===`plugin-persist-sync`?e(oe,12):V(n)===`plugin-undo-redo`?e(se,13):V(n)===`plugin-autosave-analytics`&&e(ce,14)}),k(y),k(h),k(a),R(()=>{Si(s,`src`,`${i}/favicon.png`),G(d,`v${r}`),Si(m,`href`,`${i}/llms.txt`)}),H(`click`,p,()=>navigator.clipboard.writeText(`npm i svstate@${r}`)),gi(v,()=>V(n),e=>P(n,e)),W(e,a)}Rr([`click`]),qr(rm,{target:document.querySelector(`#app`)}); \ No newline at end of file diff --git a/docs/assets/index-CXrV2wig.js b/docs/assets/index-CXrV2wig.js deleted file mode 100644 index 42212b9..0000000 --- a/docs/assets/index-CXrV2wig.js +++ /dev/null @@ -1,512 +0,0 @@ -(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible,d=()=>{};function f(e){return e()}function p(e){for(var t=0;t{e=n,t=r}),resolve:e,reject:t}}var h=1024,g=2048,_=4096,v=8192,y=16384,b=32768,x=1<<25,S=65536,C=1<<19,w=1<<20,T=1<<25,E=65536,ee=1<<21,te=1<<22,ne=1<<23,re=Symbol(`$state`),ie=Symbol(`legacy props`),ae=Symbol(``),oe=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},se=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function ce(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function le(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function ue(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function de(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function fe(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function pe(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function me(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function he(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function ge(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function _e(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function ve(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var ye={},be=Symbol(),xe=`http://www.w3.org/1999/xhtml`;function Se(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function Ce(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function we(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var D=!1;function Te(e){D=e}var O;function Ee(e){if(e===null)throw Se(),ye;return O=e}function De(){return Ee(hn(O))}function k(e){if(D){if(hn(O)!==null)throw Se(),ye;O=e}}function Oe(e=1){if(D){for(var t=e,n=O;t--;)n=hn(n);O=n}}function ke(e=!0){for(var t=0,n=O;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else (r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=hn(n);e&&n.remove(),n=i}}function Ae(e){if(!e||e.nodeType!==8)throw Se(),ye;return e.data}function je(e){return e===this.v}function Me(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ne(e){return!Me(e,this.v)}var Pe=!1,Fe=!1;function Ie(){Fe=!0}var Le=null;function Re(e){Le=e}function ze(e,t=!1,n){Le={p:Le,i:!1,c:null,e:null,s:e,x:null,r:B,l:Fe&&!t?{s:null,u:null,$:[]}:null}}function Be(e){var t=Le,n=t.e;if(n!==null){t.e=null;for(var r of n)jn(r)}return e!==void 0&&(t.x=e),t.i=!0,Le=t.p,e??{}}function Ve(){return!Fe||Le!==null&&Le.l===null}var He=[];function Ue(){var e=He;He=[],p(e)}function We(e){if(He.length===0&&!mt){var t=He;queueMicrotask(()=>{t===He&&Ue()})}He.push(e)}function Ge(){for(;He.length>0;)Ue()}function Ke(e){var t=B;if(t===null)return z.f|=ne,e;if(!(t.f&32768)&&!(t.f&4))throw e;qe(e,t)}function qe(e,t){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}var Je=~(g|_|h);function Ye(e,t){e.f=e.f&Je|t}function Xe(e){e.f&512||e.deps===null?Ye(e,h):Ye(e,_)}function Ze(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=E,Ze(t.deps))}function Qe(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),Ze(e.deps),Ye(e,h)}function $e(e,t,n){if(e==null)return t(void 0),n&&n(void 0),d;let r=Cr(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}var et=[];function tt(e,t){return{subscribe:nt(e,t).subscribe}}function nt(e,t=d){let n=null,r=new Set;function i(t){if(Me(e,t)&&(e=t,n)){let t=!et.length;for(let t of r)t[1](),et.push(t,e);if(t){for(let e=0;e{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:o}}function rt(e,t,n){let r=!Array.isArray(e),i=r?[e]:e;if(!i.every(Boolean))throw Error(`derived() expects stores as input, got a falsy value`);let a=t.length<2;return tt(n,(e,n)=>{let o=!1,s=[],c=0,l=d,u=()=>{if(c)return;l();let i=t(r?s[0]:s,e,n);a?e(i):l=typeof i==`function`?i:d},f=i.map((e,t)=>$e(e,e=>{s[t]=e,c&=~(1<{c|=1<t=e)(),t}var at=!1,ot=!1,st=Symbol();function A(e,t,n){let r=n[t]??={store:null,source:Zt(void 0),unsubscribe:d};if(r.store!==e&&!(st in n))if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=d;else{var i=!0;r.unsubscribe=$e(e,e=>{i?r.source.v=e:P(r.source,e)}),i=!1}return e&&st in n?it(e):V(r.source)}function ct(){let e={};function t(){kn(()=>{for(var t in e)e[t].unsubscribe();i(e,st,{enumerable:!1,value:!0})})}return[e,t]}function lt(e){var t=ot;try{return ot=!1,[e(),ot]}finally{ot=t}}var ut=new Set,j=null,dt=null,ft=null,pt=null,mt=!1,ht=!1,gt=null,_t=null,vt=0,yt=1,bt=class e{id=yt++;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=new Map;#r=new Map;#i=null;#a=[];#o=[];#s=new Set;#c=new Set;#l=new Map;is_fork=!1;#u=!1;#d=new Set;#f(){return this.is_fork||this.#r.size>0}#p(){for(let n of this.#d)for(let r of n.#r.keys()){for(var e=!1,t=r;t.parent!==null;){if(this.#l.has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}skip_effect(e){this.#l.has(e)||this.#l.set(e,{d:[],m:[]})}unskip_effect(e){var t=this.#l.get(e);if(t){this.#l.delete(e);for(var n of t.d)Ye(n,g),this.schedule(n);for(n of t.m)Ye(n,_),this.schedule(n)}}#m(){if(vt++>1e3&&(ut.delete(this),St()),!this.#f()){for(let e of this.#s)this.#c.delete(e),Ye(e,g),this.schedule(e);for(let e of this.#c)Ye(e,_),this.schedule(e)}let t=this.#a;this.#a=[],this.apply();var n=gt=[],r=[],i=_t=[];for(let e of t)try{this.#h(e,n,r)}catch(t){throw kt(e),t}if(j=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(gt=null,_t=null,this.#f()||this.#p()){this.#g(r),this.#g(n);for(let[e,t]of this.#l)Ot(e,t)}else{this.#n.size===0&&ut.delete(this),this.#s.clear(),this.#c.clear();for(let e of this.#e)e(this);this.#e.clear(),dt=this,wt(r),wt(n),dt=null,this.#i?.resolve()}var o=j;if(this.#a.length>0){let e=o??=this;e.#a.push(...this.#a.filter(t=>!e.#a.includes(t)))}o!==null&&(ut.add(o),o.#m()),ut.has(this)||this.#_()}#h(e,t,n){e.f^=h;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#l.has(r))&&r.fn!==null){a?r.f^=h:i&4?t.push(r):Pe&&i&16777224?n.push(r):mr(r)&&(i&16&&this.#c.add(r),yr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#g(e){for(var t=0;t!this.current.has(e));if(r.length===0)e&&l.discard();else if(t.length>0){l.activate();var i=new Set,a=new Map;for(var o of t)Tt(o,r,i,a);a=new Map;var s=[...l.current.keys()].filter(e=>this.current.has(e)?this.current.get(e)[0]!==e:!0);for(let e of this.#o)!(e.f&155648)&&Et(e,s,a)&&(e.f&4194320?(Ye(e,g),l.schedule(e)):l.#s.add(e));if(l.#a.length>0){l.apply();for(var c of l.#a)l.#h(c,[],[]);l.#a=[]}l.deactivate()}}for(let e of ut)e.#d.has(this)&&(e.#d.delete(this),e.#d.size===0&&!e.#f()&&(e.activate(),e.#m()))}increment(e,t){let n=this.#n.get(t)??0;if(this.#n.set(t,n+1),e){let e=this.#r.get(t)??0;this.#r.set(t,e+1)}}decrement(e,t,n){let r=this.#n.get(t)??0;if(r===1?this.#n.delete(t):this.#n.set(t,r-1),e){let e=this.#r.get(t)??0;e===1?this.#r.delete(t):this.#r.set(t,e-1)}this.#u||n||(this.#u=!0,We(()=>{this.#u=!1,this.flush()}))}transfer_effects(e,t){for(let t of e)this.#s.add(t);for(let e of t)this.#c.add(e);e.clear(),t.clear()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}settled(){return(this.#i??=m()).promise}static ensure(){if(j===null){let t=j=new e;ht||(ut.add(j),mt||We(()=>{j===t&&t.flush()}))}return j}apply(){if(!Pe||!this.is_fork&&ut.size===1){ft=null;return}ft=new Map;for(let[e,[t]]of this.current)ft.set(e,t);for(let n of ut)if(!(n===this||n.is_fork)){var e=!1,t=!1;if(n.id0)){Jt.clear();for(let e of Ct){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Ct.has(n)&&(Ct.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||yr(n)}}Ct.clear()}}Ct=null}}function Tt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?Tt(i,t,n,r):e&4194320&&!(e&2048)&&Et(i,t,r)&&(Ye(i,g),Dt(i))}}function Et(e,t,r){let i=r.get(e);if(i!==void 0)return i;if(e.deps!==null)for(let i of e.deps){if(n.call(t,i))return!0;if(i.f&2&&Et(i,t,r))return r.set(i,!0),!0}return r.set(e,!1),!1}function Dt(e){j.schedule(e)}function Ot(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),Ye(e,h);for(var n=e.first;n!==null;)Ot(n,t),n=n.next}}function kt(e){Ye(e,h);for(var t=e.first;t!==null;)kt(t),t=t.next}function At(e){let t=0,n=Xt(0),r;return()=>{On()&&(V(n),In(()=>(t===0&&(r=Cr(()=>e(()=>nn(n)))),t+=1,()=>{We(()=>{--t,t===0&&(r?.(),r=void 0,nn(n))})})))}}var jt=S|C;function Mt(e,t,n,r){new Nt(e,t,n,r)}var Nt=class{parent;is_pending=!1;transform_error;#e;#t=D?O:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=At(()=>(this.#m=Xt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=B;t.b=this,t.f|=128,n(e)},this.parent=B.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Ln(()=>{if(D){let e=this.#t;De();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},jt),D&&(this.#e=O)}#g(){try{this.#a=Rn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=Rn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Rn(()=>e(this.#e)),We(()=>{var e=this.#c=document.createDocumentFragment(),t=pn();e.append(t),this.#a=this.#x(()=>Rn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,Gn(this.#o,()=>{this.#o=null}),this.#b(j))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Rn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Yn(this.#a,e);let t=this.#n.pending;this.#o=Rn(()=>t(this.#e))}else this.#b(j)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){Qe(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=B,n=z,r=Le;nr(this.#i),tr(this.#i),Re(this.#i.ctx);try{return bt.ensure(),e()}catch(e){return Ke(e),null}finally{nr(t),tr(n),Re(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&Gn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,We(()=>{this.#d=!1,this.#m&&$t(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),V(this.#m)}error(e){var t=this.#n.onerror;let n=this.#n.failed;if(!t&&!n)throw e;this.#a&&=(Hn(this.#a),null),this.#o&&=(Hn(this.#o),null),this.#s&&=(Hn(this.#s),null),D&&(Ee(this.#t),Oe(),Ee(ke()));var r=!1,i=!1;let a=()=>{if(r){we();return}r=!0,i&&ve(),this.#s!==null&&Gn(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){qe(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return Rn(()=>{var t=B;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return qe(e,this.#i.parent),null}}))};We(()=>{var t;try{t=this.transform_error(e)}catch(e){qe(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>qe(e,this.#i&&this.#i.parent)):o(t)})}};function Pt(e,t,n,r){let i=Ve()?Rt:Bt;var a=e.filter(e=>!e.settled);if(n.length===0&&a.length===0){r(t.map(i));return}var o=B,s=Ft(),c=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function l(e){s();try{r(e)}catch(e){o.f&16384||qe(e,o)}It()}if(n.length===0){c.then(()=>l(t.map(i)));return}var u=Lt();function d(){Promise.all(n.map(e=>zt(e))).then(e=>l([...t.map(i),...e])).catch(e=>qe(e,o)).finally(()=>u())}c?c.then(()=>{s(),d(),It()}):d()}function Ft(){var e=B,t=z,n=Le,r=j;return function(i=!0){nr(e),tr(t),Re(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function It(e=!0){nr(null),tr(null),Re(null),e&&j?.deactivate()}function Lt(){var e=B,t=e.b,n=j,r=t.is_rendered();return t.update_pending_count(1,n),n.increment(r,e),(i=!1)=>{t.update_pending_count(-1,n),n.decrement(r,e,i)}}function Rt(e){var t=2|g,n=z!==null&&z.f&2?z:null;return B!==null&&(B.f|=C),{ctx:Le,deps:null,effects:null,equals:je,f:t,fn:e,reactions:null,rv:0,v:be,wv:0,parent:n??B,ac:null}}function zt(e,t,n){let r=B;r===null&&ce();var i=void 0,a=Xt(be),o=!z,s=new Map;return Fn(()=>{var t=B,n=m();i=n.promise;try{Promise.resolve(e()).then(n.resolve,n.reject).finally(It)}catch(e){n.reject(e),It()}var c=j;if(o){if(t.f&32768)var l=Lt();if(r.b.is_rendered())s.get(c)?.reject(oe),s.delete(c);else{for(let e of s.values())e.reject(oe);s.clear()}s.set(c,n)}let u=(e,n=void 0)=>{if(l&&l(n===oe),!(n===oe||t.f&16384)){if(c.activate(),n)a.f|=ne,$t(a,n);else{a.f&8388608&&(a.f^=ne),$t(a,e);for(let[e,t]of s){if(s.delete(e),e===c)break;t.reject(oe)}}c.deactivate()}};n.promise.then(u,e=>u(null,e||`unknown`))}),kn(()=>{for(let e of s.values())e.reject(oe)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function M(e){let t=Rt(e);return Pe||ir(t),t}function Bt(e){let t=Rt(e);return t.equals=Ne,t}function Vt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;nV(e))),t}function P(e,t,r=!1){return z!==null&&(!er||z.f&131072)&&Ve()&&z.f&4325394&&(rr===null||!n.call(rr,e))&&_e(),$t(e,r?an(t):t,_t)}function $t(e,t,n=null){if(!e.equals(t)){var r=e.v;Qn?Jt.set(e,t):Jt.set(e,r),e.v=t;var i=bt.ensure();if(i.capture(e,r),e.f&2){let t=e;e.f&2048&&Ut(t),ft===null&&Xe(t)}e.wv=pr(),rn(e,g,n),Ve()&&B!==null&&B.f&1024&&!(B.f&96)&&(sr===null?cr([e]):sr.push(e)),!i.is_fork&&qt.size>0&&!Yt&&en()}return t}function en(){Yt=!1;for(let e of qt)e.f&1024&&Ye(e,_),mr(e)&&yr(e);qt.clear()}function tn(e,t=1){var n=V(e),r=t===1?n++:n--;return P(e,n),r}function nn(e){P(e,e.v+1)}function rn(e,t,n){var r=e.reactions;if(r!==null)for(var i=Ve(),a=r.length,o=0;o{if(dr===d)return e();var t=z,n=dr;tr(null),fr(d);var r=e();return tr(t),fr(n),r};return i&&r.set(`length`,N(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&he();var i=r.get(t);return i===void 0?f(()=>{var e=N(n.value,u);return r.set(t,e),e}):P(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>N(be,u));r.set(t,e),nn(o)}}else P(n,be),nn(o);return!0},get(e,n,i){if(n===re)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>N(an(s?e[n]:be),u)),r.set(n,o)),o!==void 0){var c=V(o);return c===be?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=V(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==be)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===re)return!0;var n=r.get(t),i=n!==void 0&&n.v!==be||Reflect.has(e,t);return(n!==void 0||B!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>N(i?an(e[t]):be,u)),r.set(t,n)),V(n)===be)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dN(be,u)),r.set(d+``,p)):P(p,be)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>N(void 0,u)),P(c,an(n)),r.set(t,c));else{l=c.v!==be;var m=f(()=>an(n));P(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&P(g,_+1)}nn(o)}return!0},ownKeys(e){V(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==be});for(var[n,i]of r)i.v!==be&&!(n in e)&&t.push(n);return t},setPrototypeOf(){ge()}})}function on(e){try{if(typeof e==`object`&&e&&re in e)return e[re]}catch{}return e}function sn(e,t){return Object.is(on(e),on(t))}var cn,ln,un,dn;function fn(){if(cn===void 0){cn=window,ln=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;un=a(t,`firstChild`).get,dn=a(t,`nextSibling`).get,u(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),u(n)&&(n.__t=void 0)}}function pn(e=``){return document.createTextNode(e)}function mn(e){return un.call(e)}function hn(e){return dn.call(e)}function F(e,t){if(!D)return mn(e);var n=mn(O);if(n===null)n=O.appendChild(pn());else if(t&&n.nodeType!==3){var r=pn();return n?.before(r),Ee(r),r}return t&&yn(n),Ee(n),n}function I(e,t=!1){if(!D){var n=mn(e);return n instanceof Comment&&n.data===``?hn(n):n}if(t){if(O?.nodeType!==3){var r=pn();return O?.before(r),Ee(r),r}yn(O)}return O}function L(e,t=1,n=!1){let r=D?O:e;for(var i;t--;)i=r,r=hn(r);if(!D)return r;if(n){if(r?.nodeType!==3){var a=pn();return r===null?i?.after(a):r.before(a),Ee(a),a}yn(r)}return Ee(r),r}function gn(e){e.textContent=``}function _n(){return!Pe||Ct!==null?!1:(B.f&b)!==0}function vn(e,t,n){let r=n?{is:n}:void 0;return document.createElementNS(t??`http://www.w3.org/1999/xhtml`,e,r)}function yn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function bn(e){D&&mn(e)!==null&&gn(e)}var xn=!1;function Sn(){xn||(xn=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function Cn(e){var t=z,n=B;tr(null),nr(null);try{return e()}finally{tr(t),nr(n)}}function wn(e,t,n,r=n){e.addEventListener(t,()=>Cn(n));let i=e.__on_r;i?e.__on_r=()=>{i(),r(!0)}:e.__on_r=()=>r(!0),Sn()}function Tn(e){B===null&&(z===null&&fe(e),de()),Qn&&ue(e)}function En(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Dn(e,t){var n=B;n!==null&&n.f&8192&&(e|=v);var r={ctx:Le,deps:null,nodes:null,f:e|g|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};j?.register_created_effect(r);var i=r;if(e&4)gt===null?bt.ensure().schedule(r):gt.push(r);else if(t!==null){try{yr(r)}catch(e){throw Hn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=S))}if(i!==null&&(i.parent=n,n!==null&&En(i,n),z!==null&&z.f&2&&!(e&64))){var a=z;(a.effects??=[]).push(i)}return r}function On(){return z!==null&&!er}function kn(e){let t=Dn(8,null);return Ye(t,h),t.teardown=e,t}function An(e){Tn(`$effect`);var t=B.f;if(!z&&t&32&&!(t&32768)){var n=Le;(n.e??=[]).push(e)}else return jn(e)}function jn(e){return Dn(4|w,e)}function Mn(e){return Tn(`$effect.pre`),Dn(8|w,e)}function Nn(e){bt.ensure();let t=Dn(64|C,e);return(e={})=>new Promise(n=>{e.outro?Gn(t,()=>{Hn(t),n(void 0)}):(Hn(t),n(void 0))})}function Pn(e){return Dn(4,e)}function Fn(e){return Dn(te|C,e)}function In(e,t=0){return Dn(8|t,e)}function R(e,t=[],n=[],r=[]){Pt(r,t,n,t=>{Dn(8,()=>e(...t.map(V)))})}function Ln(e,t=0){return Dn(16|t,e)}function Rn(e){return Dn(32|C,e)}function zn(e){var t=e.teardown;if(t!==null){let e=Qn,n=z;$n(!0),tr(null);try{t.call(null)}finally{$n(e),tr(n)}}}function Bn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&Cn(()=>{e.abort(oe)});var r=n.next;n.f&64?n.parent=null:Hn(n,t),n=r}}function Vn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Hn(t),t=n}}function Hn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Un(e.nodes.start,e.nodes.end),n=!0),Ye(e,x),Bn(e,t&&!n),vr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();zn(e),e.f^=x,e.f|=y;var i=e.parent;i!==null&&i.first!==null&&Wn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Un(e,t){for(;e!==null;){var n=e===t?null:hn(e);e.remove(),e=n}}function Wn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Gn(e,t,n=!0){var r=[];Kn(e,r,!0);var i=()=>{n&&Hn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Kn(e,t,n){if(!(e.f&8192)){e.f^=v;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next,o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;Kn(i,t,o?n:!1),i=a}}}function qn(e){Jn(e,!0)}function Jn(e,t){if(e.f&8192){e.f^=v,e.f&1024||(Ye(e,g),bt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;Jn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Yn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:hn(n);t.append(n),n=i}}var Xn=null,Zn=!1,Qn=!1;function $n(e){Qn=e}var z=null,er=!1;function tr(e){z=e}var B=null;function nr(e){B=e}var rr=null;function ir(e){z!==null&&(!Pe||z.f&2)&&(rr===null?rr=[e]:rr.push(e))}var ar=null,or=0,sr=null;function cr(e){sr=e}var lr=1,ur=0,dr=ur;function fr(e){dr=e}function pr(){return++lr}function mr(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~E),t&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&ft===null&&Ye(e,h)}return!1}function hr(e,t,r=!0){var i=e.reactions;if(i!==null&&!(!Pe&&rr!==null&&n.call(rr,e)))for(var a=0;a{e.ac.abort(oe)}),e.ac=null);try{e.f|=ee;var u=e.fn,d=u();e.f|=b;var f=e.deps,p=j?.is_fork;if(ar!==null){var m;if(p||vr(e,or),f!==null&&or>0)for(f.length=or+ar.length,m=0;m{requestAnimationFrame(()=>e()),setTimeout(()=>e())});await Promise.resolve(),xt()}function V(e){var t=(e.f&2)!=0;if(Xn?.add(e),z!==null&&!er&&!(B!==null&&B.f&16384)&&(rr===null||!n.call(rr,e))){var r=z.deps;if(z.f&2097152)e.rv{throw e});throw p}}finally{e[Or]=t,delete e.currentTarget,tr(d),nr(f)}}}var Pr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Fr(e){return Pr?.createHTML(e)??e}function Ir(e){var t=vn(`template`);return t.innerHTML=Fr(e.replaceAll(``,``)),t.content}function Lr(e,t){var n=B;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function U(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(``);return()=>{if(D)return Lr(O,null),O;i===void 0&&(i=Ir(a?e:``+e),n||(i=mn(i)));var t=r||ln?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=mn(t),s=t.lastChild;Lr(o,s)}else Lr(t,t);return t}}function Rr(e=``){if(!D){var t=pn(e+``);return Lr(t,t),t}var n=O;return n.nodeType===3?yn(n):(n.before(n=pn()),Ee(n)),Lr(n,n),n}function zr(){if(D)return Lr(O,null),O;var e=document.createDocumentFragment(),t=document.createComment(``),n=pn();return e.append(t,n),Lr(t,n),e}function W(e,t){if(D){var n=B;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=O),De();return}e!==null&&e.before(t)}function G(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=`${n}`)}function Br(e,t){return Hr(e,t)}var Vr=new Map;function Hr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){fn();var l=void 0,u=Nn(()=>{var s=n??t.appendChild(pn());Mt(s,{pending:()=>{}},t=>{ze({});var n=Le;if(o&&(n.c=o),a&&(i.$$events=a),D&&Lr(t,null),l=e(t,i)||{},D&&(B.nodes.end=O,O===null||O.nodeType!==8||O.data!==`]`))throw Se(),ye;Be()},c);var u=new Set,d=e=>{for(var n=0;n{for(var e of u)for(let n of[t,document]){var r=Vr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Nr),r.delete(e),r.size===0&&Vr.delete(n)):r.set(e,i)}Ar.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Ur.set(l,u),l}var Ur=new WeakMap,Wr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)qn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(Hn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();Yn(r,t),t.append(pn()),this.#n.set(e,{effect:r,fragment:t})}else Hn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Gn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(Hn(n.effect),this.#n.delete(e))};ensure(e,t){var n=j,r=_n();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=pn();i.append(a),this.#n.set(e,{effect:Rn(()=>t(a)),fragment:i})}else this.#t.set(e,Rn(()=>t(this.anchor)));if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else D&&(this.anchor=O),this.#a(n)}};function K(e,t,n=!1){var r;D&&(r=O,De());var i=new Wr(e),a=n?S:0;function o(e,t){if(D){var n=Ae(r);if(e!==parseInt(n.substring(1))){var a=ke();Ee(a),i.anchor=a,Te(!1),i.ensure(e,t),Te(!0);return}}i.ensure(e,t)}Ln(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Gr=Symbol(`NaN`);function Kr(e,t,n){D&&De();var r=new Wr(e),i=!Ve();Ln(()=>{var e=t();e!==e&&(e=Gr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function qr(e,t){return t}function Jr(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Yr(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else --s},!1)}if(s===0){var l=i.length===0&&n!==null;if(l){var u=n,d=u.parentNode;gn(d),d.append(u),e.items.clear()}Yr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Yr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,$r(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=T,ti(d,null,c)):qn(d):Gn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:Ln(()=>{p=V(f);var e=p.length;let t=!1;D&&Ae(c)===`[!`!=(e===0)&&(c=ke(),Ee(c),Te(!1),t=!0);for(var r=new Set,u=j,v=_n(),y=0;ys(c)):(d=Rn(()=>s(Xr??=pn())),d.f|=T)),e>r.size&&le(``,``,``),D&&e>0&&Ee(ke()),!h)if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u);t&&Te(!0),V(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,D&&(c=O)}function Qr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function $r(e,t,n,i,a){var o=(i&8)!=0,s=t.length,c=e.items,l=Qr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v0){var ee=i&4&&s===0?n:null;if(o){for(v=0;v{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function ei(e,t,n,r,i,a,o,s){var c=o&1?o&16?Xt(n):Zt(n,!1,!1):null,l=o&2?Xt(i):null;return{v:c,i:l,e:Rn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function ti(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=hn(r);if(a.before(r),r===i)return;r=o}}function ni(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function ri(e,t,...n){var r=new Wr(e);Ln(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},S)}var ii=[...` -\r\f\xA0\v`];function ai(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||ii.includes(r[o-1]))&&(s===r.length||ii.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function oi(e,t,n,r,i,a){var o=e.__className;if(D||o!==n||o===void 0){var s=ai(n,r,a);(!D||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e.__className=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function si(t,n,r=!1){if(t.multiple){if(n==null)return;if(!e(n))return Ce();for(var i of t.options)i.selected=n.includes(ui(i));return}for(i of t.options)if(sn(ui(i),n)){i.selected=!0;return}(!r||n!==void 0)&&(t.selectedIndex=-1)}function ci(e){var t=new MutationObserver(()=>{si(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),kn(()=>{t.disconnect()})}function li(e,t,n=t){var r=new WeakSet,i=!0;wn(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),ui);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&ui(o)}n(a),e.__value=a,j!==null&&r.add(j)}),Pn(()=>{var a=t();if(e===document.activeElement){var o=Pe?dt:j;if(r.has(o))return}if(si(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=ui(s),n(a))}e.__value=a,i=!1}),ci(e)}function ui(e){return`__value`in e?e.__value:e.value}var di=Symbol(`is custom element`),fi=Symbol(`is html`),pi=se?`link`:`LINK`;function mi(e){if(D){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;hi(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;hi(e,`checked`,null),e.checked=r}}};e.__on_r=n,We(n),Sn()}}function hi(e,t,n,r){var i=gi(e);D&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===pi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ae]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&vi(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function gi(e){return e.__attributes??={[di]:e.nodeName.includes(`-`),[fi]:e.namespaceURI===xe}}var _i=new Map;function vi(e){var t=e.getAttribute(`is`)||e.nodeName,n=_i.get(t);if(n)return n;_i.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&n.push(s);i=l(i)}return n}function yi(e,t,n=t){var r=new WeakSet;wn(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=xi(e)?Si(a):a,n(a),j!==null&&r.add(j),await br(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(D&&e.defaultValue!==e.value||Cr(t)==null&&e.value)&&(n(xi(e)?Si(e.value):e.value),j!==null&&r.add(j)),In(()=>{var n=t();if(e===document.activeElement){var i=Pe?dt:j;if(r.has(i))return}xi(e)&&n===Si(e.value)||e.type===`date`&&!n&&!e.value||n!==e.value&&(e.value=n??``)})}function bi(e,t,n=t){wn(e,`change`,t=>{n(t?e.defaultChecked:e.checked)}),(D&&e.defaultChecked!==e.checked||Cr(t)==null)&&n(e.checked),In(()=>{e.checked=!!t()})}function xi(e){var t=e.type;return t===`number`||t===`range`}function Si(e){return e===``?null:+e}function Ci(e=!1){let t=Le,n=t.l.u;if(!n)return;let r=()=>wr(t.s);if(e){let e=0,n={},i=Rt(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>V(i)}n.b.length&&Mn(()=>{wi(t,r),p(n.b)}),An(()=>{let e=Cr(()=>n.m.map(f));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&An(()=>{wi(t,r),p(n.a)})}function wi(e,t){if(e.l.s)for(let t of e.l.s)V(t);t()}function Ti(e,t,n,r){var i=!Fe||(n&2)!=0,o=(n&8)!=0,s=(n&16)!=0,c=r,l=!0,u=()=>(l&&(l=!1,c=s?Cr(r):r),c);let d;if(o){var f=re in e||ie in e;d=a(e,t)?.set??(f&&t in e?n=>e[t]=n:void 0)}var p,m=!1;o?[p,m]=lt(()=>e[t]):p=e[t],p===void 0&&r!==void 0&&(p=u(),d&&(i&&me(t),d(p)));var h=i?()=>{var n=e[t];return n===void 0?u():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return h;if(d){var g=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||g||m)&&d(t?h():e),e):h()})}var _=!1,v=(n&1?Rt:Bt)(()=>(_=!1,h()));o&&V(v);var y=B;return(function(e,t){if(arguments.length>0){let n=t?V(v):i&&o?an(e):e;return P(v,n),_=!0,c!==void 0&&(c=n),e}return Qn&&_||y.f&16384?v.v:V(v)})}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Ei(e){let t=e.batchSize??20,n=e.flushInterval??5e3,r=e.include,i=[],a,o=e=>!r||r.includes(e),s=(e,n)=>{o(e)&&(i.push({type:e,timestamp:Date.now(),detail:n}),i.length>=t&&c())},c=()=>{if(i.length===0)return;let t=i.splice(0);e.onFlush(t)};return{name:`analytics`,onInit(){n>0&&(a=setInterval(c,n))},onChange(t){let n=e.redact?.includes(t.property);s(`change`,{property:t.property,currentValue:n?`[redacted]`:t.currentValue,oldValue:n?`[redacted]`:t.oldValue})},onValidation(e){s(`validation`,{hasErrors:e!==void 0})},onSnapshot(e){s(`snapshot`,{title:e.title})},onAction(e){s(`action`,{phase:e.phase,error:e.error?.message})},onRollback(e){s(`rollback`,{title:e.title})},onReset(){s(`reset`,{})},destroy(){a!==void 0&&clearInterval(a),c()},flush(){c()},eventCount(){return i.length}}}function Di(e){let t=e.idle??1e3,n=e.interval??0,r=e.saveOnDestroy??!0,i=e.onlyWhenDirty??!0,a,o,s,c=!1,l=!1,u=async()=>{if(a&&!(i&&!it(a.state.isDirty))&&!c){c=!0;try{await e.save(a.data)}catch(t){e.onError?.(t)}finally{c=!1}}},d=()=>{clearTimeout(o),o=setTimeout(u,t)},f=()=>{typeof document<`u`&&document.visibilityState===`hidden`&&u()};return{name:`autosave`,onInit(t){a=t,n>0&&(s=setInterval(u,n)),e.onVisibilityHidden&&typeof document<`u`&&document.addEventListener(`visibilitychange`,f)},onChange(){d()},onAction(e){e.phase===`after`&&!e.error&&clearTimeout(o)},destroy(){if(l=!0,clearTimeout(o),s!==void 0&&clearInterval(s),typeof document<`u`&&document.removeEventListener(`visibilitychange`,f),r&&a&&(c=!1,!i||it(a.state.isDirty)))try{let t=e.save(a.data);t instanceof Promise&&t.catch(t=>e.onError?.(t))}catch(t){e.onError?.(t)}},async saveNow(){l||(clearTimeout(o),c=!1,await u())},isSaving(){return c}}}var Oi=()=>{try{return import.meta.env?.PROD===!0}catch{return!1}};function ki(e){let t=e?.name??`svstate`,n=e?.collapsed??!0,r=e?.logValidation??!1,i=e?.logValues??!1,a=e?.enabled??!Oi(),o=(e,...r)=>{if(!a)return;let i=new Date().toISOString().slice(11,23);(n?console.groupCollapsed:console.group)(`[${t}] ${e} (${i})`);for(let e of r)console.log(e);console.groupEnd()};return{name:`devtools`,onChange(e){i?o(`change`,{property:e.property,from:e.oldValue,to:e.currentValue}):o(`change`,{property:e.property})},onValidation(e){r&&o(`validation`,e)},onSnapshot(e){o(`snapshot`,{title:e.title})},onAction(e){e.error?o(`action:${e.phase}`,{params:e.params,error:e.error.message}):o(`action:${e.phase}`,{params:e.params})},onRollback(e){o(`rollback`,{title:e.title})},onReset(){o(`reset`)}}}var Ai=new Set([`__proto__`,`constructor`,`prototype`]),ji=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Mi=e=>ji(e)&&typeof e.version==`number`&&ji(e.data),Ni=(e,t)=>{for(let n of Object.keys(t))Ai.has(n)||(e[n]=t[n])},Pi=(e,t)=>{let n=t.split(`.`),r=e;for(let e of n){if(r==null)return;r=r[e]}return r},Fi=(e,t,n)=>{let r=t.split(`.`),i=e;for(let e=0;e{if(t){let n={};for(let r of t){let t=Pi(e,r);t!==void 0&&Fi(n,r,t)}return n}if(n){let t={...e};for(let e of n){let n=e.split(`.`);if(n.length===1)delete t[e];else{let e=t;for(let t=0;t`u`?void 0:localStorage),n=e.throttle??300,r=e.version??1,i=!1,a,o,s=()=>{if(!t||!o)return;let n={version:r,data:Ii(o,e.include,e.exclude)};t.setItem(e.key,JSON.stringify(n))},c=()=>{clearTimeout(a),a=setTimeout(s,n)};return{name:`persist`,onInit(n){if(o=n.data,!t)return;let a=t.getItem(e.key);if(a)try{let t=JSON.parse(a);if(!Mi(t))return;let o=t;if(e.migrate&&o.version!==r){let t=e.migrate(o.data,o.version);if(!ji(t))return;o={version:r,data:t}}Ni(n.data,o.data),i=!0}catch{}},onChange(){c()},onReset(){s()},destroy(){a!==void 0&&(clearTimeout(a),s())},clearPersistedState(){t?.removeItem(e.key)},isRestored(){return i}}}var Ri=new Set([`__proto__`,`constructor`,`prototype`]),zi=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Bi=10,Vi=(e,t=0)=>t>Bi?!1:zi(e)?Object.values(e).every(e=>Vi(e,t+1)):!0,Hi=(e,t)=>{for(let n of Object.keys(t))Ri.has(n)||(e[n]=t[n])};function Ui(e){let t=e.throttle??100,n=e.merge??`overwrite`,r,i,a=!1,o,s=0,c=()=>{if(!r||!i)return;let e=JSON.parse(JSON.stringify(i.data));r.postMessage({type:`sync`,data:e})},l=()=>{clearTimeout(o),o=setTimeout(c,t)},u=()=>{clearTimeout(o),r&&=(r.close(),void 0)};return{name:`sync`,onInit(o){i=o,!(typeof BroadcastChannel>`u`)&&(r=new BroadcastChannel(e.key),r.addEventListener(`message`,e=>{if(!i||n===`ignore`||e.data?.type!==`sync`)return;let r=Date.now();r-s{if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return e.map(e=>o(e));let t=Object.create(Object.getPrototypeOf(e));for(let n of Object.keys(e))t[n]=o(e[n]);return t};return{name:`undo-redo`,redoStack:{subscribe:t.subscribe},onInit(e){r=e,i=e.state.snapshots.subscribe(e=>{e.length0&&(a=n.at(-1)),n=e})},onRollback(){a&&=(t.update(t=>{let n=[...t,a],r=e?.maxRedoStack;return r&&r>0?n.slice(-r):n}),void 0)},onChange(){t.set([])},onReset(){t.set([])},redo(){if(!r)return;let e=it(t);if(e.length===0)return;let n=e.at(-1);t.set(e.slice(0,-1)),r.snapshot(`Undo`),Object.assign(r.data,o(n.data))},canRedo(){return it(t).length>0},destroy(){i?.()}}}var Gi=e=>typeof e==`object`&&!!e&&!(e instanceof Date)&&!(e instanceof Map)&&!(e instanceof Set)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof RegExp)&&!(e instanceof Error)&&!(e instanceof Promise),Ki=(e,t)=>{let n=(e,i)=>new Proxy(e,{get(e,t){if(typeof t==`symbol`)return e[t];let r=e[t];if(Gi(r)){let e=Number.isInteger(Number(t))?``:String(t);return n(r,e?i?`${i}.${e}`:e:i)}return r},set(e,n,a){if(typeof n==`symbol`)return e[n]=a,!0;let o=e[n];if(o!==a){e[n]=a;let s=Number.isInteger(Number(n))?``:String(n);t(r,s?i?`${i}.${s}`:s:i,a,o)}return!0}}),r=n(e,``);return r},qi=e=>Object.values(e).some(e=>typeof e==`string`?!!e:qi(e)),Ji=e=>!!e&&qi(e),Yi=new Set([`__proto__`,`constructor`,`prototype`]),Xi=e=>{if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return e.map(e=>Xi(e));let t=Object.create(Object.getPrototypeOf(e));for(let n of Object.keys(e))Yi.has(n)||(t[n]=Xi(e[n]));return t},Zi=(e,t)=>{let n=t.split(`.`),r=e;for(let e of n){if(r==null)return;r=r[e]}return r},Qi=(e,t)=>{if(!e)return``;let n=t.split(`.`),r=e;for(let e of n){if(typeof r==`string`||r[e]===void 0)return``;r=r[e]}return typeof r==`string`?r:``},$i=(e,t)=>{let n=[];for(let r of Object.keys(e))(r===t||r.startsWith(t+`.`)||t.startsWith(r+`.`))&&n.push(r);return n},ea={resetDirtyOnAction:!0,debounceValidation:0,allowConcurrentActions:!1,persistActionError:!1,debounceAsyncValidation:300,runAsyncValidationOnInit:!1,clearAsyncErrorsOnChange:!0,maxConcurrentAsyncValidations:4,maxSnapshots:50,plugins:[]};function ta(e,t,n){let r={...ea,...n},{validator:i,effect:a,asyncValidator:o}=t??{},s=nt(),c=rt(s,Ji),l=nt({}),u=rt(l,e=>Object.keys(e).length>0),d=nt(!1),f=nt(),p=nt([{title:`Initial`,data:Xi(e)}]),m=nt({}),h=nt(new Set),g=rt(h,e=>[...e]),_=rt(m,e=>Object.values(e).some(e=>!!e)),v=rt([c,_],([e,t])=>e||t),y=new Map,b=[],x=e=>{l.update(t=>{let n={...t,[e]:!0},r=e.split(`.`);for(let e=1;e{for(let n of C){let r=n[e];typeof r==`function`&&r.call(n,...t)}},T=()=>{if(!i)return;let e=i(ue);s.set(e),w(`onValidation`,e)},E=(e,t=!0)=>{let n=it(p),i={title:e,data:Xi(S)},a=n.at(-1),o=t&&a&&a.title===e?[...n.slice(0,-1),i]:[...n,i];if(r.maxSnapshots>0&&o.length>r.maxSnapshots){let e=o.length-r.maxSnapshots;o=[o[0],...o.slice(1+e)]}p.set(o),w(`onSnapshot`,i)},ee=!1,te,ne=()=>{if(i)if(r.debounceValidation>0)clearTimeout(te),te=setTimeout(()=>{T()},r.debounceValidation);else{if(ee)return;ee=!0,queueMicrotask(()=>{T(),ee=!1})}},re=e=>{let t=b.indexOf(e);t!==-1&&b.splice(t,1)},ie=e=>{re(e);let t=y.get(e);t&&(clearTimeout(t.timeoutId),t.controller.abort(),y.delete(e),h.update(t=>(t.delete(e),new Set(t))))},ae=()=>{b.length=0;for(let e of y.keys())ie(e);m.set({})},oe=async(e,t)=>{if(!o){t();return}let n=o[e];if(!n){t();return}if(Qi(it(s),e)){t();return}let r=new AbortController;y.set(e,{controller:r,timeoutId:0}),h.update(t=>new Set([...t,e]));try{let t=await n(Zi(ue,e),ue,r.signal);r.signal.aborted||m.update(n=>({...n,[e]:t}))}catch(t){if(t instanceof Error&&t.name===`AbortError`)return;if(!r.signal.aborted){let n=t instanceof Error?t.message:`Async validation error`;m.update(t=>({...t,[e]:n}))}}finally{y.delete(e),h.update(t=>(t.delete(e),new Set(t))),t()}},se=()=>{for(;b.length>0&&!(it(h).size>=r.maxConcurrentAsyncValidations);){let e=b.shift();e&&oe(e,se)}},ce=e=>{if(!o||!o[e])return;ie(e),r.clearAsyncErrorsOnChange&&m.update(t=>{let n={...t};return delete n[e],n});let t=new AbortController,n=setTimeout(()=>{y.delete(e),it(h).size{if(!o)return;let t=$i(o,e);for(let e of t)ce(e)},ue=Ki(S,(e,t,n,i)=>{if(r.persistActionError||f.set(void 0),x(t),a?.({snapshot:E,target:e,property:t,currentValue:n,oldValue:i})instanceof Promise)throw Error(`svstate: effect callback must be synchronous. Use action for async operations.`);w(`onChange`,{target:e,property:t,currentValue:n,oldValue:i}),ne(),le(t)});if(T(),o&&r.runAsyncValidationOnInit)for(let e of Object.keys(o))ce(e);let de=async e=>{if(!(!r.allowConcurrentActions&&it(d))){w(`onAction`,{phase:`before`,params:e}),f.set(void 0),d.set(!0);try{await t?.action?.(e),r.resetDirtyOnAction&&l.set({}),p.set([{title:`Initial`,data:Xi(S)}]),await t?.actionCompleted?.(),w(`onAction`,{phase:`after`,params:e})}catch(n){await t?.actionCompleted?.(n);let r=n instanceof Error?n:void 0;f.set(r),w(`onAction`,{phase:`after`,params:e,error:r})}finally{d.set(!1)}}},fe=(e,t)=>{let n=t[e];if(n)return ae(),l.set({}),Object.assign(S,Xi(n.data)),p.set(t.slice(0,e+1)),T(),n},pe=(e=1)=>{let t=it(p);if(t.length<=1)return;let n=fe(Math.max(0,t.length-1-e),t);n&&w(`onRollback`,n)},me=e=>{let t=it(p);if(t.length<=1)return!1;for(let n=t.length-1;n>=0;n--)if(t[n].title===e){let e=fe(n,t);return e&&w(`onRollback`,e),!0}return!1},he=()=>{let e=it(p);e[0]&&(fe(0,e),w(`onReset`))},ge={errors:s,hasErrors:c,isDirty:u,isDirtyByField:l,actionInProgress:d,actionError:f,snapshots:p,asyncErrors:m,hasAsyncErrors:_,asyncValidating:g,hasCombinedErrors:v};return w(`onInit`,{data:ue,state:ge,options:r,snapshot:E}),{data:ue,execute:de,state:ge,rollback:pe,rollbackTo:me,reset:he,destroy:()=>{for(let e=C.length-1;e>=0;e--)C[e]?.destroy?.()}}}var na={trim:e=>e.trim(),normalize:e=>e.replaceAll(/\s{2,}/g,` `),upper:e=>e.toUpperCase(),lower:e=>e.toLowerCase(),localeUpper:e=>e.toLocaleUpperCase(),localeLower:e=>e.toLocaleLowerCase()};function q(e){let t=``,n=e==null,r=e??``,i=e=>{t||=e},a={prepare(...e){return r=e.reduce((e,t)=>na[t](e),r),a},required(){return!t&&(n||!r)&&i(`Required`),a},requiredIf(e){return e&&!t&&(n||!r)&&i(`Required`),a},noSpace(){return n||!t&&r.includes(` `)&&i(`No space allowed`),a},notBlank(){return n||!t&&r.length>0&&r.trim().length===0&&i(`Must not be blank`),a},minLength(e){return n||!t&&r.lengthe&&i(`Max length ${e}`),a},uppercase(){return n||!t&&r!==r.toUpperCase()&&i(`Uppercase only`),a},lowercase(){return n||!t&&r!==r.toLowerCase()&&i(`Lowercase only`),a},startsWith(e){if(t)return a;let n=Array.isArray(e)?e:[e];return r&&!n.some(e=>r.startsWith(e))&&i(`Must start with ${n.join(`, `)}`),a},regexp(e,n){return!t&&r&&!e.test(r)&&i(n??`Not allowed chars`),a},in(e){if(t)return a;let n=Array.isArray(e)?e:Object.keys(e);return r&&!n.includes(r)&&i(`Must be one of: ${n.join(`, `)}`),a},notIn(e){if(t)return a;let n=Array.isArray(e)?e:Object.keys(e);return r&&n.includes(r)&&i(`Must not be one of: ${n.join(`, `)}`),a},email(){return!t&&r&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)&&i(`Invalid email format`),a},website(e=`optional`){if(t||!r||e===`optional`)return a;let n=/^https?:\/\//.test(r);return e===`required`&&!n?i(`Must start with http:// or https://`):e===`forbidden`&&n&&i(`Must not start with http:// or https://`),a},endsWith(e){if(t||!r)return a;let n=Array.isArray(e)?e:[e];return n.some(e=>r.endsWith(e))||i(`Must end with ${n.join(`, `)}`),a},contains(e){return!t&&r&&!r.includes(e)&&i(`Must contain "${e}"`),a},alphanumeric(){return!t&&r&&!/^[\dA-Za-z]+$/.test(r)&&i(`Only letters and numbers allowed`),a},numeric(){return!t&&r&&!/^\d+$/.test(r)&&i(`Only numbers allowed`),a},slug(){return!t&&r&&!/^[\da-z-]+$/.test(r)&&i(`Invalid slug format`),a},identifier(){return!t&&r&&!/^[A-Z_a-z]\w*$/.test(r)&&i(`Invalid identifier format`),a},getError(){return t}};return a}function ra(e){let t=``,n=e==null,r=e=>{t||=e},i={required(){return!t&&(n||Number.isNaN(e))&&r(`Required`),i},requiredIf(a){return a&&!t&&(n||Number.isNaN(e))&&r(`Required`),i},min(a){return n||!t&&ea&&r(`Maximum ${a}`),i},between(a,o){return n||!t&&(eo)&&r(`Must be between ${a} and ${o}`),i},integer(){return n||!t&&!Number.isInteger(e)&&r(`Must be an integer`),i},positive(){return n||!t&&e<=0&&r(`Must be positive`),i},negative(){return n||!t&&e>=0&&r(`Must be negative`),i},nonNegative(){return n||!t&&e<0&&r(`Must be non-negative`),i},notZero(){return n||!t&&e===0&&r(`Must not be zero`),i},multipleOf(a){return n||!t&&e%a!==0&&r(`Must be a multiple of ${a}`),i},step(a){return n||!t&&e%a!==0&&r(`Must be a multiple of ${a}`),i},decimal(a){return n||t||Number.isNaN(e)||(String(e).split(`.`)[1]?.length??0)>a&&r(`Maximum ${a} decimal places`),i},percentage(){return n||!t&&(e<0||e>100)&&r(`Must be between 0 and 100`),i},getError(){return t}};return i}function ia(e){let t=``,n=e==null,r=e??[],i=e=>{t||=e},a={required(){return!t&&(n||r.length===0)&&i(`Required`),a},requiredIf(e){return e&&!t&&(n||r.length===0)&&i(`Required`),a},minLength(e){return n||!t&&r.lengthe&&i(`Maximum ${e} items`),a},unique(){if(n||t)return a;let e=new Set;for(let t of r){let n=typeof t==`object`?JSON.stringify(t):String(t);if(e.has(n)){i(`Items must be unique`);break}e.add(n)}return a},ofLength(e){return n||!t&&r.length!==e&&i(`Must have exactly ${e} items`),a},includes(e){if(n||t)return a;let o=typeof e==`object`?JSON.stringify(e):String(e);return r.some(e=>(typeof e==`object`?JSON.stringify(e):String(e))===o)||i(`Must include ${o}`),a},includesAny(e){if(n||t)return a;let o=e.map(e=>typeof e==`object`?JSON.stringify(e):String(e));return r.some(e=>{let t=typeof e==`object`?JSON.stringify(e):String(e);return o.includes(t)})||i(`Must include at least one of: ${o.join(`, `)}`),a},includesAll(e){if(n||t)return a;let o=new Set(r.map(e=>typeof e==`object`?JSON.stringify(e):String(e))),s=e.filter(e=>{let t=typeof e==`object`?JSON.stringify(e):String(e);return!o.has(t)});return s.length>0&&i(`Missing required items: ${s.map(e=>typeof e==`object`?JSON.stringify(e):String(e)).join(`, `)}`),a},getError(){return t}};return a}var aa=U(`
            `),oa=U(`
             
            `);function J(e,t){var n=oa(),r=F(n),i=e=>{var n=aa(),r=F(n,!0);k(n),R(()=>G(r,t.title)),W(e,n)};K(r,e=>{t.title&&e(i)});var a=L(r,2),o=F(a,!0);k(a),k(n),R(()=>G(o,t.code)),W(e,n)}var sa=U(`
            Dirty Fields
             
            `),ca=U(`
            State Object
             
            State Info
            isDirty:
            hasErrors:
            Errors
             
            `);function la(e,t){ze(t,!0);let n=Ti(t,`width`,3,`xl:w-80`);var r=ca(),i=F(r),a=L(F(i),2),o=F(a,!0);k(a),k(i);var s=L(i,2),c=L(F(s),2),l=F(c),u=L(F(l));k(l);var d=L(l,2),f=L(F(d));k(d),k(c),k(s);var p=L(s,2),m=e=>{var n=sa(),r=L(F(n),2),i=F(r,!0);k(r),k(n),R(e=>G(i,e),[()=>JSON.stringify(t.isDirtyByField,Object.keys(t.isDirtyByField).toSorted(),2)]),W(e,n)};K(p,e=>{t.isDirtyByField&&e(m)});var h=L(p,2),g=L(F(h),2),_=F(g,!0);k(g),k(h);var v=L(h,2);k(r),R((e,i)=>{oi(r,1,`w-full ${n()??``} flex-shrink-0 space-y-4`),G(o,e),G(u,` ${t.isDirty??``}`),G(f,` ${t.hasErrors??``}`),G(_,i)},[()=>JSON.stringify(t.data,void 0,2),()=>JSON.stringify(t.errors,void 0,2)]),H(`click`,v,function(...e){t.onFill?.apply(this,e)}),W(e,r),Be()}jr([`click`]);var ua=U(`

            `);function da(e,t){var n=zr(),r=I(n),i=e=>{var n=ua(),r=F(n,!0);k(n),R(()=>G(r,t.error)),W(e,n)};K(r,e=>{t.error&&e(i)}),W(e,n)}var fa=U(``),pa=U(`
            `);function Y(e,t){ze(t,!0);let n=Ti(t,`type`,3,`text`),r=Ti(t,`placeholder`,3,``),i=Ti(t,`value`,15),a=Ti(t,`error`,3,``),o=Ti(t,`required`,3,!0),s=Ti(t,`disabled`,3,!1),c=Ti(t,`variant`,3,`default`),l=M(()=>c()===`nested`?`bg-white`:`bg-gray-50`);var u=pa(),d=F(u),f=F(d),p=L(f),m=e=>{W(e,fa())};K(p,e=>{t.isDirty&&e(m)}),k(d);var h=L(d,2);mi(h);var g=L(h,2);{let e=M(()=>a()??``);da(g,{get error(){return V(e)}})}k(u),R(()=>{oi(d,1,`mb-2 block text-sm text-gray-900 ${o()?`font-bold`:``}`),hi(d,`for`,t.id),G(f,`${t.label??``} `),hi(h,`id`,t.id),oi(h,1,`block w-full rounded-lg border p-2.5 text-sm ${a()?`border-red-500 bg-red-50 text-red-900 placeholder-red-400 focus:border-red-500 focus:ring-red-500`:`border-gray-300 ${V(l)} text-gray-900 focus:border-blue-500 focus:ring-blue-500`} ${s()?`cursor-not-allowed opacity-50`:``}`),h.disabled=s(),hi(h,`max`,t.max),hi(h,`min`,t.min),hi(h,`placeholder`,r()),hi(h,`step`,t.step),hi(h,`type`,n())}),yi(h,i),W(e,u),Be()}var ma=U(`

            `),ha=U(`
            `),ga=U(`
            `,1);function _a(e,t){var n=ga(),r=I(n),i=F(r),a=F(i),o=F(a,!0);k(a);var s=L(a,2),c=e=>{var n=ma(),r=F(n,!0);k(n),R(()=>G(r,t.description)),W(e,n)},l=e=>{W(e,ha())};K(s,e=>{t.description?e(c):e(l,-1)}),ri(L(s,2),()=>t.main),k(i),ri(L(i,2),()=>t.sidebar),k(r);var u=L(r,2),d=e=>{var n=zr();ri(I(n),()=>t.sourceCode),W(e,n)};K(u,e=>{t.sourceCode&&e(d)}),R(()=>G(o,t.title)),W(e,n)}var va=U(`
            `),ya=U(`
            `);function ba(e,t){let n=N(!1);var r=ya(),i=F(r),a=L(F(i),2);k(i);var o=L(i,2),s=e=>{var n=va();ri(F(n),()=>t.children),k(n),W(e,n)};K(o,e=>{V(n)&&e(s)}),k(r),R(()=>{oi(i,1,`flex w-full cursor-pointer items-center justify-between px-4 py-3 text-left text-sm font-medium text-gray-900 hover:bg-gray-50 ${V(n)?`border-b border-gray-200`:``}`),oi(a,0,`h-5 w-5 transform transition-transform ${V(n)?`rotate-180`:``}`)}),H(`click`,i,()=>P(n,!V(n))),W(e,r)}jr([`click`]);var xa=U(`
            `);function Sa(e,t){var n=xa(),r=F(n),i=F(r,!0);k(r);var a=L(r,2),o=F(a,!0);k(a),k(n),R(()=>{oi(r,1,`rounded px-2.5 py-0.5 text-xs font-medium ${t.hasErrors?`bg-red-100 text-red-800`:`bg-green-100 text-green-800`}`),G(i,t.hasErrors?`Has Errors`:`Valid`),oi(a,1,`rounded px-2.5 py-0.5 text-xs font-medium ${t.isDirty?`bg-yellow-100 text-yellow-800`:`bg-gray-100 text-gray-800`}`),G(o,t.isDirty?`Modified`:`Clean`)}),W(e,n)}var X=()=>Math.random().toString(36).slice(2,8),Ca=(e,t)=>Math.floor(Math.random()*(t-e+1))+e,wa=U(`
            `),Ta=U(`
            `),Ea=U(` Submitting...`),Da=U(`
            `,1),Oa=U(`
            Action State
            actionInProgress:
            actionError:
            `),ka=U(` `,1);function Aa(e,t){ze(t,!0);let n=()=>A(h,`$hasErrors`,s),r=()=>A(g,`$isDirty`,s),i=()=>A(_,`$actionInProgress`,s),a=()=>A(m,`$errors`,s),o=()=>A(v,`$actionError`,s),[s,c]=ct(),l={title:`Task ${X()}`,description:`This is a sample task description with ID ${X()}`},u=N(!1),d=N(void 0),{data:f,execute:p,state:{errors:m,hasErrors:h,isDirty:g,actionInProgress:_,actionError:v}}=ta(l,{validator:e=>({title:q(e.title).prepare(`trim`).required().minLength(3).maxLength(50).getError(),description:q(e.description).prepare(`trim`).required().minLength(10).maxLength(200).getError()}),action:async()=>{let e=Ca(100,1e3);if(await new Promise(t=>setTimeout(t,e)),V(u))throw Error(`Simulated server error after ${e}ms`);P(d,`Submitted successfully in ${e}ms!`)},actionCompleted:e=>{e&&P(d,void 0)}}),y=()=>{f.title=`Task ${X()}`,f.description=`This is a sample task description with ID ${X()}`},b=()=>{P(d,void 0),p()};_a(e,{description:`Demonstrates async action execution with loading states and error handling.`,title:`Action Demo`,main:e=>{var t=Da(),s=I(t);Sa(s,{get hasErrors(){return n()},get isDirty(){return r()}});var c=L(s,2),l=F(c),p=F(l,!0);k(l),k(c);var m=L(c,2),h=F(m);{let e=M(()=>a()?.title);Y(h,{id:`title`,get disabled(){return i()},get error(){return V(e)},label:`Title`,placeholder:`Enter task title`,get value(){return f.title},set value(e){f.title=e}})}var g=L(h,2);{let e=M(()=>a()?.description);Y(g,{id:`description`,get disabled(){return i()},get error(){return V(e)},label:`Description`,placeholder:`Enter task description (min 10 characters)`,get value(){return f.description},set value(e){f.description=e}})}var _=L(g,2),v=F(_);mi(v),Oe(2),k(_),k(m);var y=L(m,2),x=e=>{var t=wa(),n=F(t),r=L(F(n),2),i=F(r,!0);k(r),k(n),k(t),R(()=>G(i,o().message)),W(e,t)};K(y,e=>{o()&&e(x)});var S=L(y,2),C=e=>{var t=Ta(),n=F(t),r=L(F(n),2),i=F(r,!0);k(r),k(n),k(t),R(()=>G(i,V(d))),W(e,t)};K(S,e=>{V(d)&&e(C)});var w=L(S,2),T=F(w),E=F(T),ee=e=>{W(e,Ea())},te=e=>{W(e,Rr(`Submit`))};K(E,e=>{i()?e(ee):e(te,-1)}),k(T),k(w),R(()=>{oi(l,1,`rounded px-2.5 py-0.5 text-xs font-medium ${i()?`bg-blue-100 text-blue-800`:`bg-gray-100 text-gray-800`}`),G(p,i()?`In Progress`:`Idle`),v.disabled=i(),T.disabled=n()||i()}),bi(v,()=>V(u),e=>P(u,e)),H(`click`,T,b),W(e,t)},sidebar:e=>{var t=Oa(),s=F(t);la(s,{get data(){return f},get errors(){return a()},get hasErrors(){return n()},get isDirty(){return r()},onFill:y});var c=L(s,2),l=L(F(c),2),u=F(l),d=L(F(u));k(u);var p=L(u,2),m=L(F(p));k(p),k(l),k(c),k(t),R(()=>{G(d,` ${i()??``}`),G(m,` ${o()?.message??`none`??``}`)}),W(e,t)},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=ka(),r=I(n);J(r,{code:`const { data, execute, state: { errors, hasErrors, isDirty, actionInProgress, actionError } } = - createSvState(sourceData, { - validator: (source) => ({ - title: stringValidator(source.title).prepare('trim').required().minLength(3).maxLength(50).getError(), - description: stringValidator(source.description).prepare('trim').required().minLength(10).getError() - }), - action: async () => { - // Simulate API call with 100-1000ms delay - const delay = randomInt(100, 1000); - await new Promise((resolve) => setTimeout(resolve, delay)); - - if (shouldFail) { - throw new Error('Simulated server error'); - } - }, - actionCompleted: (error) => { - // Called after action completes (success or failure) - console.log(error ? 'Action failed' : 'Action succeeded'); - } - });`,title:`State Setup with Action`});var i=L(r,2);J(i,{code:`// Execute the action - - -// With parameters (if action accepts them) -execute({ userId: 123 });`,title:`Execute Action`}),J(L(i,2),{code:`// Display action error -{#if $actionError} -
            - {$actionError.message} -
            -{/if} - -// Check if action is in progress -{#if $actionInProgress} -
            Submitting...
            -{/if}`,title:`Error & Loading States`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),c()}jr([`click`]);var ja=U(`
            `);function Ma(e,t){let n=Ti(t,`label`,3,`Item`);var r=ja(),i=F(r),a=F(i),o=F(a);k(a);var s=L(a,2);k(i),ri(L(i,2),()=>t.children),k(r),R(()=>G(o,`${n()??``} #${t.index+1}`)),H(`click`,s,function(...e){t.onRemove?.apply(this,e)}),W(e,r)}jr([`click`]);var Na=U(`

            `);function Pa(e,t){var n=Na(),r=F(n),i=F(r,!0);k(r),k(n),R(()=>G(i,t.message)),W(e,n)}var Fa=U(`
            `),Ia=U(`
            `),La=U(`
            `),Ra=U(`
            Contacts
            `,1),za=U(` `,1);function Ba(e,t){ze(t,!0);let n=()=>A(l,`$hasErrors`,a),r=()=>A(u,`$isDirty`,a),i=()=>A(c,`$errors`,a),[a,o]=ct(),{data:s,state:{errors:c,hasErrors:l,isDirty:u}}=ta({listName:``,items:[]},{validator:e=>({listName:q(e.listName).prepare(`trim`).required().minLength(2).getError(),items:ia(e.items).required().minLength(1).getError(),...Object.fromEntries(e.items.map((e,t)=>[`item_${t}`,{name:q(e.name).prepare(`trim`).required().minLength(2).getError(),email:q(e.email).prepare(`trim`).required().email().getError()}]))})}),d=()=>{s.items=[...s.items,{name:``,email:``}]},f=e=>{s.items=s.items.filter((t,n)=>n!==e)},p=()=>{s.listName=`Contact List ${X()}`,s.items=[{name:`John Doe`,email:`john@example.com`},{name:`Jane Smith`,email:`jane@example.com`},{name:`Bob Wilson`,email:`bob@example.com`}]};_a(e,{description:`Shows how to validate dynamic arrays with per-item validation using indexed error keys.`,title:`Array Property Demo`,main:e=>{var t=Ra(),a=I(t);Sa(a,{get hasErrors(){return n()},get isDirty(){return r()}});var o=L(a,2),c=F(o);{let e=M(()=>i()?.listName);Y(c,{id:`listName`,get error(){return V(e)},label:`List Name`,placeholder:`Enter list name`,get value(){return s.listName},set value(e){s.listName=e}})}var l=L(c,2),u=F(l),p=F(u),m=L(F(p)),h=F(m);k(m),k(p);var g=L(p,2);k(u);var _=L(u,2),v=e=>{var t=Fa();da(F(t),{get error(){return i().items}}),k(t),W(e,t)};K(_,e=>{i()?.items&&e(v)});var y=L(_,2),b=e=>{Pa(e,{message:`No contacts yet. Click "Add Contact" to get started.`})},x=e=>{var t=La();Zr(t,21,()=>s.items,qr,(e,t,n)=>{Ma(e,{index:n,label:`Contact`,onRemove:()=>f(n),children:(e,r)=>{var a=Ia(),o=F(a),s=F(o);hi(s,`for`,`item-name-${n}`);var c=L(s,2);mi(c),hi(c,`id`,`item-name-${n}`);var l=L(c,2);{let e=M(()=>i()?.[`item_${n}`]?.name??``);da(l,{get error(){return V(e)}})}k(o);var u=L(o,2),d=F(u);hi(d,`for`,`item-email-${n}`);var f=L(d,2);mi(f),hi(f,`id`,`item-email-${n}`);var p=L(f,2);{let e=M(()=>i()?.[`item_${n}`]?.email??``);da(p,{get error(){return V(e)}})}k(u),k(a),R(()=>{oi(c,1,`block w-full rounded-lg border p-2 text-sm ${i()?.[`item_${n}`]?.name?`border-red-500 bg-red-50 text-red-900 placeholder-red-400`:`border-gray-300 bg-white text-gray-900`}`),oi(f,1,`block w-full rounded-lg border p-2 text-sm ${i()?.[`item_${n}`]?.email?`border-red-500 bg-red-50 text-red-900 placeholder-red-400`:`border-gray-300 bg-white text-gray-900`}`)}),yi(c,()=>V(t).name,e=>V(t).name=e),yi(f,()=>V(t).email,e=>V(t).email=e),W(e,a)},$$slots:{default:!0}})}),k(t),W(e,t)};K(y,e=>{s.items.length===0?e(b):e(x,-1)}),k(l),k(o),R(()=>G(h,`${s.items.length??``} items`)),H(`click`,g,d),W(e,t)},sidebar:e=>{la(e,{get data(){return s},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:p,width:`xl:w-96`})},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=za(),r=I(n);J(r,{code:`const sourceData = { - listName: '', - items: [] as { name: string; email: string }[] -}; - -const { data, state: { errors, hasErrors, isDirty } } = createSvState(sourceData, { - validator: (source) => ({ - listName: stringValidator(source.listName).prepare('trim').required().minLength(2).getError(), - items: arrayValidator(source.items).required().minLength(1).getError(), - // Per-item validation using indexed keys - ...Object.fromEntries( - source.items.map((item, index) => [ - \`item_\${index}\`, - { - name: stringValidator(item.name).prepare('trim').required().minLength(2).getError(), - email: stringValidator(item.email).prepare('trim').required().email().getError() - } - ]) - ) - }) -});`,title:`State Setup with Array Item Validation`}),J(L(r,2),{code:`// Define type for item errors -type ItemErrors = Record; - -{#each data.items as item, index} - - - - - -{/each}`,title:`Array Form Binding Examples`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),o()}jr([`click`]),Ie();var Va=U(`
            `),Ha=U(`
            `),Ua=U(`
            `),Wa=U(` Validating...`),Ga=U(`
            Taken usernames:
            Taken emails:
            Taken slugs:
            Concurrency limit: maxConcurrentAsyncValidations = 2
            Only 2 async validations run simultaneously. Try filling all 3 fields at once to see queuing in action.
            `,1),Ka=U(`
            Quick Fill
            Async Validation State
            asyncValidating:
            hasAsyncErrors:
            hasCombinedErrors:
            Async Errors
             
            `),qa=U(` `,1);function Ja(e,t){ze(t,!1);let n=()=>A(_,`$hasErrors`,l),r=()=>A(v,`$isDirty`,l),i=()=>A(b,`$hasAsyncErrors`,l),a=()=>A(S,`$hasCombinedErrors`,l),o=()=>A(g,`$errors`,l),s=()=>A(y,`$asyncErrors`,l),c=()=>A(x,`$asyncValidating`,l),[l,u]=ct(),d=[`admin`,`user`,`test`,`demo`,`root`],f=[`admin@example.com`,`test@example.com`,`user@example.com`],p=[`admin`,`about`,`contact`,`help`,`support`],m=ta({username:``,email:``,slug:``},{validator:e=>({username:q(e.username).prepare(`trim`).required().minLength(3).maxLength(20).noSpace().getError(),email:q(e.email).prepare(`trim`).required().email().getError(),slug:q(e.slug).prepare(`trim`).required().minLength(2).slug().getError()}),asyncValidator:{username:async(e,t,n)=>{await new Promise((e,t)=>{let r=setTimeout(e,500);n.addEventListener(`abort`,()=>{clearTimeout(r),t(new DOMException(`Aborted`,`AbortError`))})});let r=String(e).toLowerCase();return d.includes(r)?`Username is already taken`:``},email:async(e,t,n)=>{await new Promise((e,t)=>{let r=setTimeout(e,400);n.addEventListener(`abort`,()=>{clearTimeout(r),t(new DOMException(`Aborted`,`AbortError`))})});let r=String(e).toLowerCase();return f.includes(r)?`Email is already registered`:``},slug:async(e,t,n)=>{await new Promise((e,t)=>{let r=setTimeout(e,600);n.addEventListener(`abort`,()=>{clearTimeout(r),t(new DOMException(`Aborted`,`AbortError`))})});let r=String(e).toLowerCase();return p.includes(r)?`URL slug is already in use`:``}}},{maxConcurrentAsyncValidations:2}),h=Zt(m.data),g=m.state.errors,_=m.state.hasErrors,v=m.state.isDirty,y=m.state.asyncErrors,b=m.state.hasAsyncErrors,x=m.state.asyncValidating,S=m.state.hasCombinedErrors,C=()=>{Qt(h,V(h).username=`newuser${X()}`),Qt(h,V(h).email=`${X()}@example.com`),Qt(h,V(h).slug=`my-page-${X()}`)},w=()=>{Qt(h,V(h).username=`admin`),Qt(h,V(h).email=`admin@example.com`),Qt(h,V(h).slug=`about`)};Ci(),_a(e,{description:`Demonstrates async validation with simulated API calls for username and email uniqueness checks.`,title:`Async Validation Demo`,main:e=>{var t=Ga(),l=I(t);Sa(l,{get hasErrors(){return n()},get isDirty(){return r()}});var u=L(l,2),m=F(u),g=F(m);k(m);var _=L(m,2),v=F(_);k(_),k(u);var y=L(u,2),b=F(y),x=F(b);{let e=Bt(()=>o()?.username||s().username);Y(x,{id:`username`,get error(){return V(e)},label:`Username`,placeholder:`Enter username (try 'admin', 'user', 'test')`,get value(){return V(h).username},set value(e){Qt(h,V(h).username=e)},$$legacy:!0})}var S=L(x,2),C=e=>{W(e,Va())},w=M(()=>c().includes(`username`));K(S,e=>{V(w)&&e(C)}),k(b);var T=L(b,2),E=F(T);{let e=Bt(()=>o()?.email||s().email);Y(E,{id:`email`,get error(){return V(e)},label:`Email`,placeholder:`Enter email (try 'admin@example.com')`,type:`email`,get value(){return V(h).email},set value(e){Qt(h,V(h).email=e)},$$legacy:!0})}var ee=L(E,2),te=e=>{W(e,Ha())},ne=M(()=>c().includes(`email`));K(ee,e=>{V(ne)&&e(te)}),k(T);var re=L(T,2),ie=F(re);{let e=Bt(()=>o()?.slug||s().slug);Y(ie,{id:`slug`,get error(){return V(e)},label:`URL Slug`,placeholder:`Enter slug (try 'admin', 'about', 'contact')`,get value(){return V(h).slug},set value(e){Qt(h,V(h).slug=e)},$$legacy:!0})}var ae=L(ie,2),oe=e=>{W(e,Ua())},se=M(()=>c().includes(`slug`));K(ae,e=>{V(se)&&e(oe)}),k(re),k(y);var ce=L(y,2),le=F(ce),ue=L(F(le));k(le);var de=L(le,2),fe=L(F(de));k(de);var pe=L(de,2),me=L(F(pe));k(pe),k(ce);var he=L(ce,4),ge=F(he),_e=F(ge),ve=e=>{W(e,Wa())},ye=e=>{W(e,Rr(`Submit`))};K(_e,e=>{c().length>0?e(ve):e(ye,-1)}),k(ge),k(he),R((e,t,n)=>{oi(m,1,`rounded px-2.5 py-0.5 text-xs font-medium ${i()?`bg-red-100 text-red-800`:`bg-gray-100 text-gray-800`}`),G(g,`Async Errors: ${i()?`Yes`:`No`}`),oi(_,1,`rounded px-2.5 py-0.5 text-xs font-medium ${a()?`bg-red-100 text-red-800`:`bg-green-100 text-green-800`}`),G(v,`Combined: ${a()?`Has Errors`:`Valid`}`),G(ue,` ${e??``}`),G(fe,` ${t??``}`),G(me,` ${n??``}`),ge.disabled=a()||c().length>0},[()=>d.join(`, `),()=>f.join(`, `),()=>p.join(`, `)]),W(e,t)},sidebar:e=>{var t=Ka(),l=F(t);la(l,{get data(){return V(h)},get errors(){return o()},get hasErrors(){return n()},get isDirty(){return r()},onFill:C});var u=L(l,2),d=L(F(u),2);k(u);var f=L(u,2),p=L(F(f),2),m=F(p),g=L(F(m));k(m);var _=L(m,2),v=L(F(_));k(_);var y=L(_,2),b=L(F(y));k(y),k(p),k(f);var x=L(f,2),S=L(F(x),2),T=F(S,!0);k(S),k(x),k(t),R((e,t)=>{G(g,` [${e??``}]`),G(v,` ${i()??``}`),G(b,` ${a()??``}`),G(T,t)},[()=>c().join(`, `),()=>JSON.stringify(s(),void 0,2)]),H(`click`,d,w),W(e,t)},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=qa(),r=I(n);J(r,{code:`const { data, state: { errors, asyncErrors, asyncValidating, hasCombinedErrors } } = - createSvState(sourceData, { - validator: (source) => ({ - username: stringValidator(source.username).required().minLength(3).noSpace().getError(), - email: stringValidator(source.email).required().email().getError(), - slug: stringValidator(source.slug).required().minLength(2).slug().getError() - }), - asyncValidator: { - username: async (value, source, signal) => { - const res = await fetch(\`/api/check-username?u=\${value}\`, { signal }); - return (await res.json()).available ? '' : 'Username already taken'; - }, - email: async (value, source, signal) => { - const res = await fetch(\`/api/check-email?e=\${value}\`, { signal }); - return (await res.json()).available ? '' : 'Email already registered'; - }, - slug: async (value, source, signal) => { - const res = await fetch(\`/api/check-slug?s=\${value}\`, { signal }); - return (await res.json()).available ? '' : 'URL slug already in use'; - } - } - }, - { maxConcurrentAsyncValidations: 2 } // Only 2 async validations run at a time -);`,title:`State Setup with Async Validators`});var i=L(r,2);J(i,{code:` -{#if $asyncValidating.includes('username')} - ... -{/if} - - -{#if $asyncErrors.username} - {$asyncErrors.username} -{/if} - - -`,title:`Template Usage`}),J(L(i,2),{code:`// Available stores for async validation: -$errors // Sync validation errors (nested object) -$hasErrors // true if any sync errors - -$asyncErrors // Async validation errors (flat map by path) -$hasAsyncErrors // true if any async errors - -$asyncValidating // Array of paths currently being validated -$hasCombinedErrors // hasErrors || hasAsyncErrors`,title:`Available Stores`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),u()}jr([`click`]);var Ya=U(``),Xa=U(`
            `);function Za(e,t){ze(t,!0);let n=Ti(t,`placeholder`,3,``),r=Ti(t,`value`,15),i=Ti(t,`error`,3,``),a=Ti(t,`required`,3,!1),o=Ti(t,`rows`,3,3);var s=Xa(),c=F(s),l=F(c),u=L(l),d=e=>{W(e,Ya())};K(u,e=>{t.isDirty&&e(d)}),k(c);var f=L(c,2);bn(f);var p=L(f,2);{let e=M(()=>i()??``);da(p,{get error(){return V(e)}})}k(s),R(()=>{oi(c,1,`mb-2 block text-sm text-gray-900 ${a()?`font-bold`:``}`),hi(c,`for`,t.id),G(l,`${t.label??``} `),hi(f,`id`,t.id),oi(f,1,`block w-full rounded-lg border p-2.5 text-sm ${i()?`border-red-500 bg-red-50 text-red-900 placeholder-red-400 focus:border-red-500 focus:ring-red-500`:`border-gray-300 bg-gray-50 text-gray-900 focus:border-blue-500 focus:ring-blue-500`}`),hi(f,`placeholder`,n()),hi(f,`rows`,o())}),yi(f,r),W(e,s),Be()}var Qa=U(`
            `,1),$a=U(` `,1);function eo(e,t){ze(t,!0);let n=()=>A(u,`$hasErrors`,o),r=()=>A(d,`$isDirty`,o),i=()=>A(l,`$errors`,o),a=()=>A(f,`$isDirtyByField`,o),[o,s]=ct(),{data:c,state:{errors:l,hasErrors:u,isDirty:d,isDirtyByField:f}}=ta({username:``,email:``,age:0,bio:``,website:``},{validator:e=>({username:q(e.username).prepare(`trim`).required().minLength(3).maxLength(20).noSpace().getError(),email:q(e.email).prepare(`trim`).required().email().getError(),age:ra(e.age).required().min(18).max(120).integer().getError(),bio:q(e.bio).maxLength(200).getError(),website:q(e.website).prepare(`trim`).website(`required`).getError()})}),p=()=>{c.username=`user${X()}`,c.email=`${X()}@example.com`,c.age=Ca(18,65),c.bio=`Hello, I am a demo user!`,c.website=`https://${X()}.com`};_a(e,{description:`Demonstrates form validation with string, number, and email validators using the fluent API.`,title:`Basic Validation Demo`,main:e=>{var t=Qa(),o=I(t);Sa(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),l=F(s);{let e=M(()=>i()?.username);Y(l,{id:`username`,get error(){return V(e)},get isDirty(){return a().username},label:`Username`,placeholder:`Enter username`,get value(){return c.username},set value(e){c.username=e}})}var u=L(l,2);{let e=M(()=>i()?.email);Y(u,{id:`email`,get error(){return V(e)},get isDirty(){return a().email},label:`Email`,placeholder:`Enter email`,type:`email`,get value(){return c.email},set value(e){c.email=e}})}var d=L(u,2);{let e=M(()=>i()?.age);Y(d,{id:`age`,get error(){return V(e)},get isDirty(){return a().age},label:`Age`,placeholder:`Enter age`,type:`number`,get value(){return c.age},set value(e){c.age=e}})}var f=L(d,2);{let e=M(()=>i()?.bio);Za(f,{id:`bio`,get error(){return V(e)},get isDirty(){return a().bio},label:`Bio`,placeholder:`Tell us about yourself`,get value(){return c.bio},set value(e){c.bio=e}})}var p=L(f,2);{let e=M(()=>i()?.website);Y(p,{id:`website`,get error(){return V(e)},get isDirty(){return a().website},label:`Website`,placeholder:`https://example.com`,required:!1,get value(){return c.website},set value(e){c.website=e}})}k(s),W(e,t)},sidebar:e=>{la(e,{get data(){return c},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},get isDirtyByField(){return a()},onFill:p})},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=$a(),r=I(n);J(r,{code:`const sourceData = { - username: '', - email: '', - age: 0, - bio: '', - website: '' -}; - -const { data, state: { errors, hasErrors, isDirty, isDirtyByField } } = createSvState(sourceData, { - validator: (source) => ({ - username: stringValidator(source.username).prepare('trim').required().minLength(3).maxLength(20).noSpace().getError(), - email: stringValidator(source.email).prepare('trim').required().email().getError(), - age: numberValidator(source.age).required().min(18).max(120).integer().getError(), - bio: stringValidator(source.bio).maxLength(200).getError(), - website: stringValidator(source.website).prepare('trim').website('required').getError() - }) -});`,title:`State Setup`}),J(L(r,2),{code:` -`,title:`Form Binding Example`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),s()}var to=U(` `),no=U(`
            `);function ro(e,t){var n=no(),r=F(n),i=L(r),a=e=>{var n=to(),r=F(n);k(n),R(()=>G(r,`(${t.subtitle??``})`)),W(e,n)};K(i,e=>{t.subtitle&&e(a)});var o=L(i,2),s=e=>{var n=zr();ri(I(n),()=>t.children),W(e,n)};K(o,e=>{t.children&&e(s)}),k(n),R(()=>G(r,`${t.title??``} `)),W(e,n)}var io=U(`
            Subtotal:
            Tax (8%):
            Total:

            Values formatted using methods on state: data.formatCurrency() and data.formatTotal()

            `,1),ao=U(` `,1);function oo(e,t){ze(t,!0);let n=()=>A(l,`$hasErrors`,a),r=()=>A(u,`$isDirty`,a),i=()=>A(c,`$errors`,a),[a,o]=ct(),{data:s,state:{errors:c,hasErrors:l,isDirty:u}}=ta({productName:`Widget ${X()}`,item:{unitPrice:0,quantity:1},subtotal:0,tax:0,total:0,formatTotal(){return`$${this.total.toFixed(2)}`},formatCurrency(e){return`$${e.toFixed(2)}`},calculateTotals(e=.08){this.subtotal=this.item.unitPrice*this.item.quantity,this.tax=this.subtotal*e,this.total=this.subtotal+this.tax}},{validator:e=>({productName:q(e.productName).prepare(`trim`).required().minLength(2).getError(),item:{unitPrice:ra(e.item.unitPrice).required().positive().getError(),quantity:ra(e.item.quantity).required().integer().min(1).max(100).getError()}}),effect:({property:e})=>{(e===`item.unitPrice`||e===`item.quantity`)&&s.calculateTotals()}}),d=()=>{s.productName=`Widget ${X()}`,s.item.unitPrice=Ca(10,100),s.item.quantity=Ca(1,10)};_a(e,{description:`Demonstrates using objects with methods as state. The effect callback can call methods directly on the state object.`,title:`State with Methods Demo`,main:e=>{var t=io(),a=I(t);Sa(a,{get hasErrors(){return n()},get isDirty(){return r()}});var o=L(a,2),c=F(o);{let e=M(()=>i()?.productName);Y(c,{id:`productName`,get error(){return V(e)},label:`Product Name`,placeholder:`Enter product name`,get value(){return s.productName},set value(e){s.productName=e}})}var l=L(c,2),u=F(l);ro(u,{subtitle:`nested object`,title:`Item Details`});var d=L(u,2),f=F(d);{let e=M(()=>i()?.item?.unitPrice);Y(f,{id:`unitPrice`,get error(){return V(e)},label:`Unit Price ($)`,min:0,placeholder:`0.00`,step:.01,type:`number`,get value(){return s.item.unitPrice},set value(e){s.item.unitPrice=e}})}var p=L(f,2);{let e=M(()=>i()?.item?.quantity);Y(p,{id:`quantity`,get error(){return V(e)},label:`Quantity`,max:100,min:1,placeholder:`1`,type:`number`,get value(){return s.item.quantity},set value(e){s.item.quantity=e}})}k(d),k(l);var m=L(l,2),h=F(m);ro(h,{subtitle:`computed by method`,title:`Calculated Totals`});var g=L(h,2),_=F(g),v=F(_),y=L(F(v),2),b=F(y,!0);k(y),k(v);var x=L(v,2),S=L(F(x),2),C=F(S,!0);k(S),k(x);var w=L(x,2),T=L(F(w),2),E=F(T,!0);k(T),k(w),k(_),k(g),Oe(2),k(m),k(o),R((e,t,n)=>{G(b,e),G(C,t),G(E,n)},[()=>s.formatCurrency(s.subtotal),()=>s.formatCurrency(s.tax),()=>s.formatTotal()]),W(e,t)},sidebar:e=>{la(e,{get data(){return s},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:d})},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=ao(),r=I(n);J(r,{code:`// Define state type with methods -type SourceData = { - productName: string; - item: { unitPrice: number; quantity: number }; - subtotal: number; - tax: number; - total: number; - formatTotal: () => string; - formatCurrency: (value: number) => string; - calculateTotals: (taxRate?: number) => void; -}; - -// Create initial state as object with methods -const createSourceData = (): SourceData => ({ - productName: '', - item: { unitPrice: 0, quantity: 1 }, - subtotal: 0, - tax: 0, - total: 0, - formatTotal() { - return \`$\${this.total.toFixed(2)}\`; - }, - formatCurrency(value: number) { - return \`$\${value.toFixed(2)}\`; - }, - calculateTotals(taxRate: number = 0.08) { - this.subtotal = this.item.unitPrice * this.item.quantity; - this.tax = this.subtotal * taxRate; - this.total = this.subtotal + this.tax; - } -});`,title:`Class Definition`});var i=L(r,2);J(i,{code:`const { data, state: { errors, hasErrors, isDirty } } = createSvState(createSourceData(), { - validator: (source) => ({ - productName: stringValidator(source.productName).prepare('trim').required().minLength(2).getError(), - item: { - unitPrice: numberValidator(source.item.unitPrice).required().positive().getError(), - quantity: numberValidator(source.item.quantity).required().integer().min(1).max(100).getError() - } - }), - effect: ({ property }) => { - if (property === 'item.unitPrice' || property === 'item.quantity') { - data.calculateTotals(); // Call method on state object! - } - } -});`,title:`State Setup with Class Instance`}),J(L(i,2),{code:` -{data.formatCurrency(data.subtotal)} -{data.formatTotal()}`,title:`Template Usage`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),o()}var so=U(`
            Subtotal:
            Tax (8%):
            Total:
            `,1),co=U(` `,1);function lo(e,t){ze(t,!0);let n=()=>A(l,`$hasErrors`,a),r=()=>A(u,`$isDirty`,a),i=()=>A(c,`$errors`,a),[a,o]=ct(),{data:s,state:{errors:c,hasErrors:l,isDirty:u}}=ta({productName:`Widget ${X()}`,item:{unitPrice:0,quantity:1},subtotal:0,tax:0,total:0},{validator:e=>({productName:q(e.productName).prepare(`trim`).required().minLength(2).getError(),item:{unitPrice:ra(e.item.unitPrice).required().positive().getError(),quantity:ra(e.item.quantity).required().integer().min(1).max(100).getError()}}),effect:({property:e})=>{(e===`item.unitPrice`||e===`item.quantity`)&&(s.subtotal=s.item.unitPrice*s.item.quantity,s.tax=s.subtotal*.08,s.total=s.subtotal+s.tax)}}),d=()=>{s.productName=`Widget ${X()}`,s.item.unitPrice=Ca(10,100),s.item.quantity=Ca(1,10)},f=e=>`$${e.toFixed(2)}`;_a(e,{description:`Uses the effect callback to automatically compute derived values like subtotals, taxes, and totals.`,title:`Calculated Fields Demo`,main:e=>{var t=so(),a=I(t);Sa(a,{get hasErrors(){return n()},get isDirty(){return r()}});var o=L(a,2),c=F(o);{let e=M(()=>i()?.productName);Y(c,{id:`productName`,get error(){return V(e)},label:`Product Name`,placeholder:`Enter product name`,get value(){return s.productName},set value(e){s.productName=e}})}var l=L(c,2),u=F(l);ro(u,{subtitle:`nested object`,title:`Item Details`});var d=L(u,2),p=F(d);{let e=M(()=>i()?.item?.unitPrice);Y(p,{id:`unitPrice`,get error(){return V(e)},label:`Unit Price ($)`,min:0,placeholder:`0.00`,step:.01,type:`number`,get value(){return s.item.unitPrice},set value(e){s.item.unitPrice=e}})}var m=L(p,2);{let e=M(()=>i()?.item?.quantity);Y(m,{id:`quantity`,get error(){return V(e)},label:`Quantity`,max:100,min:1,placeholder:`1`,type:`number`,get value(){return s.item.quantity},set value(e){s.item.quantity=e}})}k(d),k(l);var h=L(l,2),g=F(h);ro(g,{subtitle:`computed by effect`,title:`Calculated Totals`});var _=L(g,2),v=F(_),y=F(v),b=L(F(y),2),x=F(b,!0);k(b),k(y);var S=L(y,2),C=L(F(S),2),w=F(C,!0);k(C),k(S);var T=L(S,2),E=L(F(T),2),ee=F(E,!0);k(E),k(T),k(v),k(_),k(h),k(o),R((e,t,n)=>{G(x,e),G(w,t),G(ee,n)},[()=>f(s.subtotal),()=>f(s.tax),()=>f(s.total)]),W(e,t)},sidebar:e=>{la(e,{get data(){return s},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:d})},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=co(),r=I(n);J(r,{code:`const sourceData = { - productName: '', - item: { unitPrice: 0, quantity: 1 }, - subtotal: 0, tax: 0, total: 0 // Calculated fields (set by effect) -}; - -const TAX_RATE = 0.08; - -const { data, state: { errors, hasErrors, isDirty } } = createSvState(sourceData, { - validator: (source) => ({ - productName: stringValidator(source.productName).prepare('trim').required().minLength(2).getError(), - item: { - unitPrice: numberValidator(source.item.unitPrice).required().positive().getError(), - quantity: numberValidator(source.item.quantity).required().integer().min(1).max(100).getError() - } - }), - effect: ({ property }) => { - if (property === 'item.unitPrice' || property === 'item.quantity') { - data.subtotal = data.item.unitPrice * data.item.quantity; - data.tax = data.subtotal * TAX_RATE; - data.total = data.subtotal + data.tax; - } - } -});`,title:`State Setup with Effect`}),J(L(r,2),{code:`effect: ({ property }) => { - if (property === 'item.unitPrice' || property === 'item.quantity') { - data.subtotal = data.item.unitPrice * data.item.quantity; - data.tax = data.subtotal * TAX_RATE; - data.total = data.subtotal + data.tax; - } -}`,title:`Effect Function`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),o()}var uo=U(` `),fo=U(``),po=U(`
            `);function mo(e,t){var n=po(),r=F(n),i=F(r),a=L(i),o=e=>{var n=uo(),r=F(n);k(n),R(()=>G(r,`(${t.subtitle??``})`)),W(e,n)};K(a,e=>{t.subtitle&&e(o)});var s=L(a,2),c=e=>{W(e,fo())};K(s,e=>{t.isDirty&&e(c)}),k(r),ri(L(r,2),()=>t.children),k(n),R(()=>G(i,`${t.title??``} `)),W(e,n)}var ho=U(``),go=U(``),_o=U(``),vo=U(`
            `),yo=U(`
            `,1),bo=U(` `,1);function xo(e,t){ze(t,!0);let n=()=>A(u,`$hasErrors`,o),r=()=>A(d,`$isDirty`,o),i=()=>A(f,`$isDirtyByField`,o),a=()=>A(l,`$errors`,o),[o,s]=ct(),{data:c,state:{errors:l,hasErrors:u,isDirty:d,isDirtyByField:f}}=ta({name:``,address:{street:``,city:``,zip:``},company:{name:``,department:``,contact:{phone:``,email:``}}},{validator:e=>({name:q(e.name).prepare(`trim`).required().minLength(2).maxLength(50).getError(),address:{street:q(e.address.street).prepare(`trim`).required().minLength(5).getError(),city:q(e.address.city).prepare(`trim`).required().minLength(2).getError(),zip:q(e.address.zip).prepare(`trim`).required().minLength(5).maxLength(10).getError()},company:{name:q(e.company.name).prepare(`trim`).required().minLength(2).getError(),department:q(e.company.department).prepare(`trim`).maxLength(50).getError(),contact:{phone:q(e.company.contact.phone).prepare(`trim`).required().minLength(10).getError(),email:q(e.company.contact.email).prepare(`trim`).required().email().getError()}}})}),p=()=>{c.name=`John ${X()}`,c.address.street=`${Ca(100,9999)} Main Street`,c.address.city=`New York`,c.address.zip=`${Ca(1e4,99999)}`,c.company.name=`Acme ${X()} Inc`,c.company.department=`Engineering`,c.company.contact.phone=`555-${Ca(100,999)}-${Ca(1e3,9999)}`,c.company.contact.email=`contact@${X()}.com`};_a(e,{description:`Illustrates validating deeply nested object structures with multi-level property paths.`,title:`Nested Objects Demo`,main:e=>{var t=yo(),o=I(t);Sa(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),l=F(s),u=F(l);ro(u,{title:`Personal Info`,children:(e,t)=>{var n=zr(),r=I(n),a=e=>{W(e,ho())};K(r,e=>{i().name&&e(a)}),W(e,n)},$$slots:{default:!0}});var d=L(u,2);{let e=M(()=>a()?.name);Y(d,{id:`name`,get error(){return V(e)},label:`Full Name`,placeholder:`Enter your full name`,get value(){return c.name},set value(e){c.name=e}})}k(l);var f=L(l,2),p=F(f);ro(p,{subtitle:`2-level nested`,title:`Address`,children:(e,t)=>{var n=zr(),r=I(n),a=e=>{W(e,go())};K(r,e=>{i().address&&e(a)}),W(e,n)},$$slots:{default:!0}});var m=L(p,2),h=F(m);{let e=M(()=>a()?.address?.street);Y(h,{id:`street`,get error(){return V(e)},label:`Street`,placeholder:`Enter street address`,get value(){return c.address.street},set value(e){c.address.street=e}})}var g=L(h,2),_=F(g);{let e=M(()=>a()?.address?.city);Y(_,{id:`city`,get error(){return V(e)},label:`City`,placeholder:`Enter city`,get value(){return c.address.city},set value(e){c.address.city=e}})}var v=L(_,2);{let e=M(()=>a()?.address?.zip);Y(v,{id:`zip`,get error(){return V(e)},label:`ZIP Code`,placeholder:`Enter ZIP`,get value(){return c.address.zip},set value(e){c.address.zip=e}})}k(g),k(m),k(f);var y=L(f,2),b=F(y);ro(b,{subtitle:`3-level nested`,title:`Company`,children:(e,t)=>{var n=zr(),r=I(n),a=e=>{W(e,_o())};K(r,e=>{i().company&&e(a)}),W(e,n)},$$slots:{default:!0}});var x=L(b,2),S=F(x),C=F(S);{let e=M(()=>a()?.company?.name);Y(C,{id:`company-name`,get error(){return V(e)},label:`Company Name`,placeholder:`Enter company name`,get value(){return c.company.name},set value(e){c.company.name=e}})}var w=L(C,2);{let e=M(()=>a()?.company?.department);Y(w,{id:`department`,get error(){return V(e)},label:`Department`,placeholder:`Enter department`,required:!1,get value(){return c.company.department},set value(e){c.company.department=e}})}k(S),mo(L(S,2),{get isDirty(){return i()[`company.contact`]},subtitle:`3rd level`,title:`Contact Info`,children:(e,t)=>{var n=vo(),r=F(n);{let e=M(()=>a()?.company?.contact?.phone);Y(r,{id:`contact-phone`,get error(){return V(e)},label:`Phone`,placeholder:`Enter phone number`,variant:`nested`,get value(){return c.company.contact.phone},set value(e){c.company.contact.phone=e}})}var i=L(r,2);{let e=M(()=>a()?.company?.contact?.email);Y(i,{id:`contact-email`,get error(){return V(e)},label:`Email`,placeholder:`Enter email address`,type:`email`,variant:`nested`,get value(){return c.company.contact.email},set value(e){c.company.contact.email=e}})}k(n),W(e,n)},$$slots:{default:!0}}),k(x),k(y),k(s),W(e,t)},sidebar:e=>{la(e,{get data(){return c},get errors(){return a()},get hasErrors(){return n()},get isDirty(){return r()},get isDirtyByField(){return i()},onFill:p,width:`xl:w-96`})},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=bo(),r=I(n);J(r,{code:`const sourceData = { - name: '', - address: { street: '', city: '', zip: '' }, // 2-level nested - company: { // 3-level nested - name: '', - department: '', - contact: { phone: '', email: '' } - } -}; - -const { data, state: { errors, hasErrors, isDirty, isDirtyByField } } = createSvState(sourceData, { - validator: (source) => ({ - name: stringValidator(source.name).prepare('trim').required().minLength(2).maxLength(50).getError(), - address: { - street: stringValidator(source.address.street).prepare('trim').required().minLength(5).getError(), - city: stringValidator(source.address.city).prepare('trim').required().minLength(2).getError(), - zip: stringValidator(source.address.zip).prepare('trim').required().minLength(5).maxLength(10).getError() - }, - company: { - name: stringValidator(source.company.name).prepare('trim').required().minLength(2).getError(), - department: stringValidator(source.company.department).prepare('trim').maxLength(50).getError(), - contact: { - phone: stringValidator(source.company.contact.phone).prepare('trim').required().minLength(10).getError(), - email: stringValidator(source.company.contact.email).prepare('trim').required().email().getError() - } - } - }) -});`,title:`State Setup with Nested Validation`}),J(L(r,2),{code:` - - - - - -`,title:`Nested Form Binding Examples`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),s()}var So=U(`
            Effect triggered:
            `),Co=U(`
            `),wo=U(`
            `),To=U(` Submitting...`),Eo=U(`
            `,1),Do=U(`
            Options

            Reset isDirty after successful action

            Try 500ms and type quickly

            Keep errors until next action

            Current Options
            `),Oo=U(` `,1);function ko(e,t){ze(t,!0);let n=()=>A(V(x),`$hasErrors`,s),r=()=>A(V(S),`$isDirty`,s),i=()=>A(V(C),`$actionInProgress`,s),a=()=>A(V(b),`$errors`,s),o=()=>A(V(w),`$actionError`,s),[s,c]=ct(),l=N(!0),u=N(0),d=N(!1),f=N(0),p=N(!1),m=N(void 0),h=N(void 0),g=()=>({name:`User ${X()}`,email:`${X()}@example.com`}),_=e=>ta(g(),{validator:e=>({name:q(e.name).prepare(`trim`).required().minLength(2).maxLength(50).getError(),email:q(e.email).prepare(`trim`).required().email().getError()}),effect:({property:e})=>{P(h,e,!0)},action:async()=>{let e=Ca(100,800);if(await new Promise(t=>setTimeout(t,e)),V(p))throw Error(`Simulated error after ${e}ms`);P(m,`Submitted successfully in ${e}ms!`)},actionCompleted:e=>{e&&P(m,void 0)}},e),v=N(an(_({resetDirtyOnAction:!0,debounceValidation:0,persistActionError:!1}))),y=()=>{P(h,void 0),P(m,void 0),P(v,_({resetDirtyOnAction:V(l),debounceValidation:V(u),persistActionError:V(d)}),!0),tn(f)},b=M(()=>V(v).state.errors),x=M(()=>V(v).state.hasErrors),S=M(()=>V(v).state.isDirty),C=M(()=>V(v).state.actionInProgress),w=M(()=>V(v).state.actionError),T=()=>{V(v).data.name=`User ${X()}`,V(v).data.email=`${X()}@example.com`},E=()=>{P(m,void 0),V(v).execute()};_a(e,{description:`Interactive playground for configuring createSvState options like debouncing and error persistence.`,title:`Options Demo`,main:e=>{var t=zr();Kr(I(t),()=>V(f),e=>{var t=Eo(),s=I(t);Sa(s,{get hasErrors(){return n()},get isDirty(){return r()}});var c=L(s,2),l=e=>{var t=So(),n=F(t),r=L(F(n));k(n),k(t),R(()=>G(r,` property "${V(h)??``}" changed`)),W(e,t)};K(c,e=>{V(h)&&e(l)});var u=L(c,2),d=F(u);{let e=M(()=>a()?.name);Y(d,{id:`name`,get disabled(){return i()},get error(){return V(e)},label:`Name`,placeholder:`Enter name`,get value(){return V(v).data.name},set value(e){V(v).data.name=e}})}var f=L(d,2);{let e=M(()=>a()?.email);Y(f,{id:`email`,get disabled(){return i()},get error(){return V(e)},label:`Email`,placeholder:`Enter email`,type:`email`,get value(){return V(v).data.email},set value(e){V(v).data.email=e}})}var g=L(f,2),_=F(g);mi(_),Oe(2),k(g),k(u);var y=L(u,2),b=e=>{var t=Co(),n=F(t),r=L(F(n),2),i=F(r,!0);k(r),k(n),k(t),R(()=>G(i,o().message)),W(e,t)};K(y,e=>{o()&&e(b)});var x=L(y,2),S=e=>{var t=wo(),n=F(t),r=L(F(n),2),i=F(r,!0);k(r),k(n),k(t),R(()=>G(i,V(m))),W(e,t)};K(x,e=>{V(m)&&e(S)});var C=L(x,2),w=F(C),T=F(w),ee=e=>{W(e,To())},te=e=>{W(e,Rr(`Submit`))};K(T,e=>{i()?e(ee):e(te,-1)}),k(w),k(C),R(()=>{_.disabled=i(),w.disabled=n()||i()}),bi(_,()=>V(p),e=>P(p,e)),H(`click`,w,E),W(e,t)}),W(e,t)},sidebar:e=>{var t=Do(),i=F(t);la(i,{get data(){return V(v).data},get errors(){return a()},get hasErrors(){return n()},get isDirty(){return r()},onFill:T});var o=L(i,2),s=L(F(o),2),c=F(s),f=F(c),p=F(f);mi(p),Oe(2),k(f),Oe(2),k(c);var m=L(c,2),h=L(F(m),2);mi(h),Oe(2),k(m);var g=L(m,2),_=F(g),b=F(_);mi(b),Oe(2),k(_),Oe(2),k(g);var x=L(g,2);k(s),k(o);var S=L(o,2),C=L(F(S),2),w=F(C),E=F(w);k(w);var ee=L(w,2),te=F(ee);k(ee);var ne=L(ee,2),re=F(ne);k(ne),k(C),k(S),k(t),R(()=>{G(E,`resetDirtyOnAction: ${V(l)??``}`),G(te,`debounceValidation: ${V(u)??``}`),G(re,`persistActionError: ${V(d)??``}`)}),bi(p,()=>V(l),e=>P(l,e)),yi(h,()=>V(u),e=>P(u,e)),bi(b,()=>V(d),e=>P(d,e)),H(`click`,x,y),W(e,t)},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=Oo(),r=I(n);J(r,{code:`const { data, execute, state } = createSvState( - sourceData, - { validator, effect, action }, - { - // Reset isDirty to false after successful action - resetDirtyOnAction: true, // default: true - - // Debounce validation by N milliseconds - debounceValidation: 0, // default: 0 (uses queueMicrotask) - - // Keep action errors until next action (not cleared on data change) - persistActionError: false // default: false - } -);`,title:`Options Overview`});var i=L(r,2);J(i,{code:`// With resetDirtyOnAction: true (default) -await execute(); -// isDirty is now false - -// With resetDirtyOnAction: false -await execute(); -// isDirty remains true`,title:`resetDirtyOnAction`});var a=L(i,2);J(a,{code:`// With debounceValidation: 0 (default) -// Validation runs via queueMicrotask after each change - -// With debounceValidation: 500 -// Validation runs 500ms after the last change -// Useful for expensive validators or rapid typing`,title:`debounceValidation`}),J(L(a,2),{code:`// With persistActionError: false (default) -data.name = 'new value'; -// actionError is cleared immediately - -// With persistActionError: true -data.name = 'new value'; -// actionError remains until next execute() call`,title:`persistActionError`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),c()}jr([`click`]);var Ao=U(`Saving...`),jo=U(``),Mo=U(`
            Auto-save triggers 2 seconds after the last change. Analytics events buffer and flush at 10 events or every 10 - seconds.
            `,1),No=U(`

            No saves yet — edit the form and wait 2s

            `),Po=U(`
          • save
          • `),Fo=U(`
              `),Io=U(`

              No flushes yet

              `),Lo=U(`
            • flush
            • `),Ro=U(`
                `),zo=U(`
                Autosave Log
                Analytics Buffer
                Buffered:
                Batch size: 10
                Flush interval: 10s
                Tracked: change, action, snapshot
                Flush History
                `),Bo=U(` `,1);function Vo(e,t){ze(t,!0);let n=()=>A(_,`$hasErrors`,o),r=()=>A(v,`$isDirty`,o),i=()=>A(g,`$errors`,o),a=()=>A(y,`$actionInProgress`,o),[o,s]=ct(),c=N(an([])),l=N(an([])),u=N(0),d=Di({save:async e=>{await new Promise(e=>setTimeout(e,300));let t=new Date().toISOString().slice(11,23);P(c,[...V(c),{id:X(),timestamp:t,data:`${e.title} (${e.category})`}],!0)},idle:2e3,onlyWhenDirty:!0}),f=Ei({onFlush:e=>{let t=new Date().toISOString().slice(11,23),n={};for(let t of e)n[t.type]=(n[t.type]??0)+1;let r=Object.entries(n).map(([e,t])=>`${e}:${t}`).join(`, `);P(l,[...V(l),{id:X(),timestamp:t,eventCount:e.length,types:r}],!0)},batchSize:10,flushInterval:1e4,include:[`change`,`action`,`snapshot`]}),{data:p,execute:m,reset:h,state:{errors:g,hasErrors:_,isDirty:v,actionInProgress:y}}=ta({title:``,category:`general`,notes:``},{validator:e=>({title:q(e.title).prepare(`trim`).required().minLength(2).maxLength(100).getError(),category:``,notes:q(e.notes).maxLength(500).getError()}),effect:({snapshot:e,property:t})=>{e(`Changed ${t.charAt(0).toUpperCase()+t.slice(1)}`)},action:async()=>{await new Promise(e=>setTimeout(e,500))}},{plugins:[d,f]}),b=()=>{p.title=`Article ${X()}`,p.category=`tech`,p.notes=`Some interesting notes about the topic that should pass validation.`};An(()=>{let e=setInterval(()=>{P(u,f.eventCount(),!0)},500);return()=>clearInterval(e)}),_a(e,{description:`Auto-save with idle timer (autosavePlugin) and batched event analytics (analyticsPlugin).`,title:`Plugin: Autosave & Analytics`,main:e=>{var t=Mo(),o=I(t);Sa(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),l=F(s),g=F(l);k(l);var _=L(l,2),v=F(_);k(_);var y=L(_,2),b=e=>{W(e,Ao())},x=M(()=>d.isSaving());K(y,e=>{V(x)&&e(b)}),k(s);var S=L(s,4),C=F(S);{let e=M(()=>i()?.title);Y(C,{id:`title`,get error(){return V(e)},label:`Title`,placeholder:`Enter article title`,get value(){return p.title},set value(e){p.title=e}})}var w=L(C,2),T=L(F(w),2),E=F(T);E.value=E.__value=`general`;var ee=L(E);ee.value=ee.__value=`tech`;var te=L(ee);te.value=te.__value=`science`;var ne=L(te);ne.value=ne.__value=`culture`,k(T),k(w);var re=L(w,2);{let e=M(()=>i()?.notes);Za(re,{id:`notes`,get error(){return V(e)},label:`Notes`,placeholder:`Write your notes (max 500 chars)`,rows:4,get value(){return p.notes},set value(e){p.notes=e}})}k(S);var ie=L(S,2),ae=F(ie),oe=F(ae,!0);k(ae);var se=L(ae,2),ce=L(se,2),le=L(ce,2),ue=e=>{var t=jo();H(`click`,t,h),W(e,t)};K(le,e=>{r()&&e(ue)}),k(ie),R(()=>{G(g,`${V(c).length??``} Save${V(c).length===1?``:`s`}`),G(v,`${V(u)??``} Buffered Event${V(u)===1?``:`s`}`),ae.disabled=n()||a(),G(oe,a()?`Submitting...`:`Submit`)}),li(T,()=>p.category,e=>p.category=e),H(`click`,ae,()=>m()),H(`click`,se,()=>d.saveNow()),H(`click`,ce,()=>f.flush()),W(e,t)},sidebar:e=>{var t=zo(),a=F(t);la(a,{get data(){return p},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:b,width:`xl:w-96`});var o=L(a,2),s=L(F(o),2),d=e=>{W(e,No())},f=e=>{var t=Fo();Zr(t,21,()=>V(c),e=>e.id,(e,t)=>{var n=Po(),r=L(F(n),2),i=F(r,!0);k(r);var a=L(r,2),o=F(a,!0);k(a),k(n),R(()=>{G(i,V(t).data),G(o,V(t).timestamp)}),W(e,n)}),k(t),W(e,t)};K(s,e=>{V(c).length===0?e(d):e(f,-1)}),k(o);var m=L(o,2),h=L(F(m),2),g=F(h),_=L(F(g));k(g),Oe(6),k(h),k(m);var v=L(m,2),y=L(F(v),2),x=e=>{W(e,Io())},S=e=>{var t=Ro();Zr(t,21,()=>V(l),e=>e.id,(e,t)=>{var n=Lo(),r=L(F(n),2),i=F(r);k(r);var a=L(r,2),o=F(a,!0);k(a),k(n),R(()=>{G(i,`${V(t).eventCount??``} event${V(t).eventCount===1?``:`s`} (${V(t).types??``})`),G(o,V(t).timestamp)}),W(e,n)}),k(t),W(e,t)};K(y,e=>{V(l).length===0?e(x):e(S,-1)}),k(v),k(t),R(()=>G(_,` ${V(u)??``} event${V(u)===1?``:`s`}`)),W(e,t)},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=Bo(),r=I(n);J(r,{code:`import { createSvState, autosavePlugin, analyticsPlugin } from 'svstate'; - -const autosave = autosavePlugin({ - save: async (data) => { - await fetch('/api/save', { - method: 'POST', - body: JSON.stringify(data) - }); - }, - idle: 2000, // Save 2s after last change - onlyWhenDirty: true // Skip save if nothing changed -}); - -const analytics = analyticsPlugin({ - onFlush: (events) => { - sendToAnalytics(events); // Your analytics endpoint - }, - batchSize: 10, // Flush after 10 events - flushInterval: 10000, // Or every 10 seconds - include: ['change', 'action', 'snapshot'] // Filter event types -}); - -const { data, execute, state } = createSvState( - initialData, actuators, - { plugins: [autosave, analytics] } -);`,title:`autosavePlugin + analyticsPlugin Setup`}),J(L(r,2),{code:`// autosavePlugin API -autosave.saveNow(); // Force immediate save -autosave.isSaving(); // Check if currently saving - -// analyticsPlugin API -analytics.flush(); // Force flush buffered events -analytics.eventCount(); // Number of buffered events`,title:`Plugin API`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),s()}jr([`click`]);var Ho=U(``),Uo=U(`
                `,1),Wo=U(`

                No events yet — interact with the form

                `),Go=U(`
              • `),Ko=U(`
                  `),qo=U(`
                  Event Log
                  `),Jo=U(` `,1);function Yo(e,t){ze(t,!0);let n=()=>A(g,`$hasErrors`,s),r=()=>A(_,`$isDirty`,s),i=()=>A(h,`$errors`,s),a=()=>A(y,`$actionInProgress`,s),o=()=>A(v,`$snapshots`,s),[s,c]=ct(),l=N(an([])),u=(e,t)=>{let n=new Date().toISOString().slice(11,23);P(l,[...V(l),{id:X(),type:e,message:t,timestamp:n}],!0)},{data:d,execute:f,reset:p,rollback:m,state:{errors:h,hasErrors:g,isDirty:_,snapshots:v,actionInProgress:y}}=ta({name:``,email:``,message:``},{validator:e=>({name:q(e.name).prepare(`trim`).required().minLength(2).maxLength(50).getError(),email:q(e.email).prepare(`trim`).required().email().getError(),message:q(e.message).prepare(`trim`).required().minLength(5).getError()}),effect:({snapshot:e,property:t})=>{e(`Changed ${t.charAt(0).toUpperCase()+t.slice(1)}`)},action:async()=>{await new Promise(e=>setTimeout(e,500))}},{plugins:[ki({name:`demo-devtools`,enabled:!0,logValidation:!0}),{name:`log-mirror`,onChange(e){u(`change`,`${e.property}: "${e.oldValue}" → "${e.currentValue}"`)},onValidation(e){u(`validation`,e?`Has errors`:`Valid`)},onSnapshot(e){u(`snapshot`,e.title)},onAction(e){e.phase===`before`?u(`action`,`Action started`):u(`action`,e.error?`Action failed: ${e.error.message}`:`Action completed`)},onRollback(e){u(`rollback`,`Rolled back to: ${e.title}`)},onReset(){u(`reset`,`State reset to initial`)}}]}),b=()=>{d.name=`John Doe ${X()}`,d.email=`john.${X()}@example.com`,d.message=`Hello, this is a test message for the devtools demo.`},x=()=>{P(l,[],!0)},S={change:`bg-blue-100 text-blue-800`,validation:`bg-yellow-100 text-yellow-800`,snapshot:`bg-purple-100 text-purple-800`,action:`bg-green-100 text-green-800`,rollback:`bg-amber-100 text-amber-800`,reset:`bg-red-100 text-red-800`};_a(e,{description:`Shows devtoolsPlugin console logging and a custom log-mirror plugin that captures all events in-page.`,title:`Plugin: Devtools`,main:e=>{var t=Uo(),s=I(t);Sa(s,{get hasErrors(){return n()},get isDirty(){return r()}});var c=L(s,2),l=F(c);{let e=M(()=>i()?.name);Y(l,{id:`name`,get error(){return V(e)},label:`Name`,placeholder:`Enter your name`,get value(){return d.name},set value(e){d.name=e}})}var u=L(l,2);{let e=M(()=>i()?.email);Y(u,{id:`email`,get error(){return V(e)},label:`Email`,placeholder:`Enter your email`,type:`email`,get value(){return d.email},set value(e){d.email=e}})}var h=L(u,2);{let e=M(()=>i()?.message);Za(h,{id:`message`,get error(){return V(e)},label:`Message`,placeholder:`Enter a message (min 5 chars)`,required:!0,get value(){return d.message},set value(e){d.message=e}})}k(c);var g=L(c,2),_=F(g),v=F(_,!0);k(_);var y=L(_,2),b=L(y,2),x=e=>{var t=Ho();H(`click`,t,p),W(e,t)};K(b,e=>{r()&&e(x)}),k(g),R(()=>{_.disabled=n()||a(),G(v,a()?`Submitting...`:`Submit`),y.disabled=o().length<=1}),H(`click`,_,()=>f()),H(`click`,y,()=>m()),W(e,t)},sidebar:e=>{var t=qo(),a=F(t);la(a,{get data(){return d},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:b,width:`xl:w-96`});var o=L(a,2),s=F(o),c=L(F(s),2);k(s);var u=L(s,2),f=e=>{W(e,Wo())},p=e=>{var t=Ko();Zr(t,21,()=>V(l),e=>e.id,(e,t)=>{var n=Go(),r=F(n),i=F(r,!0);k(r);var a=L(r,2),o=F(a,!0);k(a);var s=L(a,2),c=F(s,!0);k(s),k(n),R(()=>{oi(r,1,`mt-0.5 flex-shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium ${S[V(t).type]??``}`),G(i,V(t).type),G(o,V(t).message),G(c,V(t).timestamp)}),W(e,n)}),k(t),W(e,t)};K(u,e=>{V(l).length===0?e(f):e(p,-1)}),k(o),k(t),H(`click`,c,x),W(e,t)},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=Jo(),r=I(n);J(r,{code:`import { createSvState, devtoolsPlugin } from 'svstate'; - -const { data, execute, reset, rollback, state } = createSvState( - { name: '', email: '', message: '' }, - { - validator: (source) => ({ /* ... */ }), - effect: ({ snapshot, property }) => { - snapshot(\`Changed \${property}\`); - }, - action: async () => { await saveToServer(); } - }, - { - plugins: [ - devtoolsPlugin({ - name: 'my-form', // Label in console - enabled: true, // Auto-disabled in production - collapsed: true, // Console groups collapsed - logValidation: true // Also log validation events - }) - ] - } -);`,title:`devtoolsPlugin Setup`}),J(L(r,2),{code:`// devtoolsPlugin logs these events to the console: -// - onChange: property changes with old/new values -// - onValidation: validation results (if logValidation: true) -// - onSnapshot: snapshot creation with title -// - onAction: action start/complete/error -// - onRollback: rollback with target snapshot title -// - onReset: state reset events`,title:`What Gets Logged`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),c()}jr([`click`]);var Xo=U(`Restored from storage`),Zo=U(`Fresh state`),Qo=U(``),$o=U(`
                  Try: Reload the page to see persistence. Open this page in another tab to see cross-tab sync.
                  `,1),es=U(`
                  Persistence Info
                  Restored:
                  Key: svstate-demo-settings
                  Excluded: notifications
                  Raw localStorage
                   
                  Sync Info
                  Channel: svstate-demo-sync
                  Throttle: 200ms
                  Merge: overwrite (default)
                  `),ts=U(` `,1);function ns(e,t){ze(t,!0);let n=()=>A(d,`$hasErrors`,a),r=()=>A(f,`$isDirty`,a),i=()=>A(u,`$errors`,a),[a,o]=ct(),s=Li({key:`svstate-demo-settings`,throttle:300,exclude:[`notifications`]}),{data:c,reset:l,state:{errors:u,hasErrors:d,isDirty:f}}=ta({username:``,theme:`light`,fontSize:14,notifications:!0},{validator:e=>({username:q(e.username).prepare(`trim`).required().minLength(2).maxLength(30).getError(),theme:``,fontSize:``,notifications:``})},{plugins:[s,Ui({key:`svstate-demo-sync`,throttle:200})]}),p=s.isRestored(),m=()=>{s.clearPersistedState(),l()},h=()=>{c.username=`demo_user`,c.theme=`dark`,c.fontSize=16,c.notifications=!1},g=N(``);An(()=>{c.username,c.theme,c.fontSize,c.notifications;let e=setTimeout(()=>{P(g,localStorage.getItem(`svstate-demo-settings`)??`(empty)`,!0)},500);return()=>clearTimeout(e)}),_a(e,{description:`Settings form with persistPlugin (localStorage) and syncPlugin (cross-tab sync via BroadcastChannel).`,title:`Plugin: Persist & Sync`,main:e=>{var t=$o(),a=I(t);Sa(a,{get hasErrors(){return n()},get isDirty(){return r()}});var o=L(a,2),s=F(o),u=e=>{W(e,Xo())},d=e=>{W(e,Zo())};K(s,e=>{p?e(u):e(d,-1)}),k(o);var f=L(o,4),h=F(f);{let e=M(()=>i()?.username);Y(h,{id:`username`,get error(){return V(e)},label:`Username`,placeholder:`Enter username`,get value(){return c.username},set value(e){c.username=e}})}var g=L(h,2),_=L(F(g),2),v=F(_);v.value=v.__value=`light`;var y=L(v);y.value=y.__value=`dark`;var b=L(y);b.value=b.__value=`system`,k(_),k(g);var x=L(g,2);Y(x,{id:`fontSize`,label:`Font Size`,max:32,min:8,step:1,type:`number`,get value(){return c.fontSize},set value(e){c.fontSize=e}});var S=L(x,2),C=F(S),w=F(C);mi(w),Oe(4),k(C),k(S),k(f);var T=L(f,2),E=F(T),ee=L(E,2),te=e=>{var t=Qo();H(`click`,t,l),W(e,t)};K(ee,e=>{r()&&e(te)}),k(T),li(_,()=>c.theme,e=>c.theme=e),bi(w,()=>c.notifications,e=>c.notifications=e),H(`click`,E,m),W(e,t)},sidebar:e=>{var t=es(),a=F(t);la(a,{get data(){return c},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:h,width:`xl:w-96`});var o=L(a,2),s=L(F(o),2),l=F(s),u=L(F(l));k(l),Oe(4),k(s),k(o);var d=L(o,2),f=L(F(d),2),m=F(f,!0);k(f),k(d),Oe(2),k(t),R(()=>{G(u,` ${p??``}`),G(m,V(g))}),W(e,t)},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=ts(),r=I(n);J(r,{code:`import { createSvState, persistPlugin, syncPlugin } from 'svstate'; - -const persist = persistPlugin({ - key: 'svstate-demo-settings', - throttle: 300, - exclude: ['notifications'] // Don't persist this field -}); - -const sync = syncPlugin({ - key: 'svstate-demo-sync', - throttle: 200 -}); - -const { data, reset, state } = createSvState( - { username: '', theme: 'light', fontSize: 14, notifications: true }, - { validator: (source) => ({ /* ... */ }) }, - { plugins: [persist, sync] } -);`,title:`persistPlugin + syncPlugin Setup`}),J(L(r,2),{code:`// persistPlugin API -persist.isRestored(); // true if data was loaded from storage -persist.clearPersistedState(); // Remove stored data - -// syncPlugin: automatic cross-tab sync via BroadcastChannel -// Changes in one tab appear in all other tabs with same key`,title:`Plugin API`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),o()}jr([`click`]);var rs=U(``),is=U(`
                  Max: 10
                  `,1),as=U(`

                  No snapshots yet

                  `),os=U(`
                • `),ss=U(`
                    `),cs=U(`

                    No redo entries — undo something first

                    `),ls=U(`
                  • `),us=U(`
                      `),ds=U(`
                      Snapshot History
                      Redo Stack
                      `),fs=U(` `,1);function ps(e,t){ze(t,!0);let n=()=>A(m,`$hasErrors`,o),r=()=>A(h,`$isDirty`,o),i=()=>A(g,`$snapshots`,o),a=()=>A(p,`$errors`,o),[o,s]=ct(),c=Wi(),l=e=>e.charAt(0).toUpperCase()+e.slice(1).replaceAll(/([A-Z])/g,` $1`),{data:u,reset:d,rollback:f,state:{errors:p,hasErrors:m,isDirty:h,snapshots:g}}=ta({title:`My Document`,content:``,priority:`medium`},{validator:e=>({title:q(e.title).prepare(`trim`).required().minLength(2).maxLength(100).getError(),content:q(e.content).prepare(`trim`).required().minLength(10).getError(),priority:``}),effect:({snapshot:e,property:t})=>{e(`Changed ${l(t)}`)}},{maxSnapshots:10,plugins:[c]}),_=()=>{u.title=`Project Report ${X()}`,u.content=`This is a detailed document with enough content to pass validation requirements.`,u.priority=`high`},v=N(an(it(c.redoStack)));An(()=>c.redoStack.subscribe(e=>{P(v,e,!0)})),_a(e,{description:`Combines the built-in snapshot/rollback system with the undoRedoPlugin for full undo/redo support.`,title:`Plugin: Undo/Redo`,main:e=>{var t=is(),o=I(t);Sa(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),l=F(s),p=F(l);k(l);var m=L(l,2),h=F(m);k(m),Oe(2),k(s);var g=L(s,2),_=F(g);{let e=M(()=>a()?.title);Y(_,{id:`title`,get error(){return V(e)},label:`Title`,placeholder:`Enter document title`,get value(){return u.title},set value(e){u.title=e}})}var y=L(_,2);{let e=M(()=>a()?.content);Za(y,{id:`content`,get error(){return V(e)},label:`Content`,placeholder:`Write your document content (min 10 chars)`,required:!0,rows:4,get value(){return u.content},set value(e){u.content=e}})}var b=L(y,2),x=L(F(b),2),S=F(x);S.value=S.__value=`low`;var C=L(S);C.value=C.__value=`medium`;var w=L(C);w.value=w.__value=`high`;var T=L(w);T.value=T.__value=`critical`,k(x),k(b),k(g);var E=L(g,2),ee=F(E),te=L(ee,2),ne=L(te,2),re=e=>{var t=rs();H(`click`,t,d),W(e,t)};K(ne,e=>{r()&&e(re)}),k(E),R(()=>{G(p,`${i().length??``} Snapshot${i().length===1?``:`s`}`),G(h,`${V(v).length??``} Redo${V(v).length===1?``:`s`}`),ee.disabled=i().length<=1,te.disabled=V(v).length===0}),li(x,()=>u.priority,e=>u.priority=e),H(`click`,ee,()=>f()),H(`click`,te,()=>c.redo()),W(e,t)},sidebar:e=>{var t=ds(),o=F(t);la(o,{get data(){return u},get errors(){return a()},get hasErrors(){return n()},get isDirty(){return r()},onFill:_,width:`xl:w-96`});var s=L(o,2),c=L(F(s),2),l=e=>{W(e,as())},d=e=>{var t=ss();Zr(t,5,i,qr,(e,t,n)=>{var r=os(),i=F(r);i.textContent=n+1;var a=L(i,2),o=F(a,!0);k(a),k(r),R(()=>G(o,V(t).title)),W(e,r)}),k(t),W(e,t)};K(c,e=>{i().length===0?e(l):e(d,-1)}),k(s);var f=L(s,2),p=L(F(f),2),m=e=>{W(e,cs())},h=e=>{var t=us();Zr(t,21,()=>V(v),qr,(e,t,n)=>{var r=ls(),i=F(r);i.textContent=n+1;var a=L(i,2),o=F(a,!0);k(a),k(r),R(()=>G(o,V(t).title)),W(e,r)}),k(t),W(e,t)};K(p,e=>{V(v).length===0?e(m):e(h,-1)}),k(f),k(t),W(e,t)},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=fs(),r=I(n);J(r,{code:`import { createSvState, undoRedoPlugin } from 'svstate'; - -const undoRedo = undoRedoPlugin(); - -const { data, reset, rollback, state } = createSvState( - { title: 'My Document', content: '', priority: 'medium' }, - { - validator: (source) => ({ /* ... */ }), - effect: ({ snapshot, property }) => { - snapshot(\`Changed \${property}\`); - } - }, - { maxSnapshots: 10, plugins: [undoRedo] } -);`,title:`Setup with undoRedoPlugin`}),J(L(r,2),{code:`// Undo (built-in rollback) -rollback(); - -// Redo (from undoRedoPlugin) -undoRedo.redo(); - -// Check if redo is available -undoRedo.canRedo(); // boolean - -// Subscribe to redo stack -undoRedo.redoStack; // Readable`,title:`Undo/Redo Usage`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),s()}jr([`click`]);var ms=U(`
                      `),hs=U(`
                      `,1),gs=U(` `,1);function _s(e,t){ze(t,!0);let n=()=>A(u,`$hasErrors`,a),r=()=>A(d,`$isDirty`,a),i=()=>A(l,`$errors`,a),[a,o]=ct(),{data:s,reset:c,state:{errors:l,hasErrors:u,isDirty:d}}=ta({firstName:`Alice`,lastName:`Smith`,email:`alice.smith@example.com`,phone:``,bio:``},{validator:e=>({firstName:q(e.firstName).prepare(`trim`).required().minLength(2).maxLength(30).getError(),lastName:q(e.lastName).prepare(`trim`).required().minLength(2).maxLength(30).getError(),email:q(e.email).prepare(`trim`).required().email().getError(),phone:q(e.phone).prepare(`trim`).required().minLength(10).getError(),bio:q(e.bio).maxLength(200).getError()})}),f=()=>{s.firstName=`John`,s.lastName=`Doe${X()}`,s.email=`john.doe.${X()}@example.com`,s.phone=`555-${X().slice(0,3)}-${X().slice(0,4)}`,s.bio=`Software developer with a passion for clean code.`};_a(e,{description:`Demonstrates the reset() function to restore state back to its initial values.`,title:`Reset Demo`,main:e=>{var t=hs(),a=I(t);Sa(a,{get hasErrors(){return n()},get isDirty(){return r()}});var o=L(a,2),l=F(o);{let e=M(()=>i()?.firstName);Y(l,{id:`firstName`,get error(){return V(e)},label:`First Name`,placeholder:`Enter first name`,get value(){return s.firstName},set value(e){s.firstName=e}})}var u=L(l,2);{let e=M(()=>i()?.lastName);Y(u,{id:`lastName`,get error(){return V(e)},label:`Last Name`,placeholder:`Enter last name`,get value(){return s.lastName},set value(e){s.lastName=e}})}var d=L(u,2);{let e=M(()=>i()?.email);Y(d,{id:`email`,get error(){return V(e)},label:`Email`,placeholder:`Enter email`,type:`email`,get value(){return s.email},set value(e){s.email=e}})}var f=L(d,2);{let e=M(()=>i()?.phone);Y(f,{id:`phone`,get error(){return V(e)},label:`Phone`,placeholder:`555-123-4567`,get value(){return s.phone},set value(e){s.phone=e}})}var p=L(f,2);{let e=M(()=>i()?.bio);Za(p,{id:`bio`,get error(){return V(e)},label:`Bio`,placeholder:`Tell us about yourself`,required:!1,get value(){return s.bio},set value(e){s.bio=e}})}k(o);var m=L(o,2),h=e=>{var t=ms(),n=F(t);k(t),H(`click`,n,c),W(e,t)};K(m,e=>{r()&&e(h)}),W(e,t)},sidebar:e=>{la(e,{get data(){return s},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},onFill:f})},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=gs(),r=I(n);J(r,{code:`const sourceData = { - firstName: 'Alice', - lastName: 'Smith', - email: 'alice.smith@example.com', - phone: '', - bio: '' -}; - -const { data, reset, state: { errors, hasErrors, isDirty } } = createSvState(sourceData, { - validator: (source) => ({ - firstName: stringValidator(source.firstName).prepare('trim').required().minLength(2).maxLength(30).getError(), - lastName: stringValidator(source.lastName).prepare('trim').required().minLength(2).maxLength(30).getError(), - email: stringValidator(source.email).prepare('trim').required().email().getError(), - phone: stringValidator(source.phone).prepare('trim').required().minLength(10).getError(), - bio: stringValidator(source.bio).maxLength(200).getError() - }) -});`,title:`State Setup with Reset`}),J(L(r,2),{code:` -{#if $isDirty} - -{/if} - - -`,title:`Conditional Reset Button`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),o()}jr([`click`]);var vs=U(``),ys=U(`
                      Max: 5
                      `,1),bs=U(`

                      No snapshots yet

                      `),xs=U(`
                    • `),Ss=U(`
                        `),Cs=U(`
                        Snapshot History
                        `),ws=U(` `,1);function Ts(e,t){ze(t,!0);let n=()=>A(h,`$hasErrors`,o),r=()=>A(g,`$isDirty`,o),i=()=>A(_,`$snapshots`,o),a=()=>A(m,`$errors`,o),[o,s]=ct(),c={firstName:`Alice`,lastName:`Smith`,email:`alice.smith@example.com`,phone:``,bio:``},l=e=>e.charAt(0).toUpperCase()+e.slice(1).replaceAll(/([A-Z])/g,` $1`),{data:u,reset:d,rollback:f,rollbackTo:p,state:{errors:m,hasErrors:h,isDirty:g,snapshots:_}}=ta(c,{validator:e=>({firstName:q(e.firstName).prepare(`trim`).required().minLength(2).maxLength(30).getError(),lastName:q(e.lastName).prepare(`trim`).required().minLength(2).maxLength(30).getError(),email:q(e.email).prepare(`trim`).required().email().getError(),phone:q(e.phone).prepare(`trim`).required().minLength(10).getError(),bio:q(e.bio).maxLength(200).getError()}),effect:({snapshot:e,property:t})=>{e(`Changed ${l(t)}`)}},{maxSnapshots:5}),v=()=>{u.firstName=`John`,u.lastName=`Doe${X()}`,u.email=`john.doe.${X()}@example.com`,u.phone=`555-${X().slice(0,3)}-${X().slice(0,4)}`,u.bio=`Software developer with a passion for clean code.`};_a(e,{description:`Shows snapshot creation for undo functionality with rollback(), rollbackTo(), and maxSnapshots support.`,title:`Snapshot & Rollback Demo`,main:e=>{var t=ys(),o=I(t);Sa(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),c=F(s),l=F(c);k(c),Oe(2),k(s);var m=L(s,2),h=F(m);{let e=M(()=>a()?.firstName);Y(h,{id:`firstName`,get error(){return V(e)},label:`First Name`,placeholder:`Enter first name`,get value(){return u.firstName},set value(e){u.firstName=e}})}var g=L(h,2);{let e=M(()=>a()?.lastName);Y(g,{id:`lastName`,get error(){return V(e)},label:`Last Name`,placeholder:`Enter last name`,get value(){return u.lastName},set value(e){u.lastName=e}})}var _=L(g,2);{let e=M(()=>a()?.email);Y(_,{id:`email`,get error(){return V(e)},label:`Email`,placeholder:`Enter email`,type:`email`,get value(){return u.email},set value(e){u.email=e}})}var v=L(_,2);{let e=M(()=>a()?.phone);Y(v,{id:`phone`,get error(){return V(e)},label:`Phone`,placeholder:`555-123-4567`,get value(){return u.phone},set value(e){u.phone=e}})}var y=L(v,2);{let e=M(()=>a()?.bio);Za(y,{id:`bio`,get error(){return V(e)},label:`Bio`,placeholder:`Tell us about yourself`,required:!1,get value(){return u.bio},set value(e){u.bio=e}})}k(m);var b=L(m,2),x=F(b),S=L(x,2),C=L(S,2),w=e=>{var t=vs();H(`click`,t,d),W(e,t)};K(C,e=>{r()&&e(w)}),k(b),R(()=>{G(l,`${i().length??``} Snapshot${i().length===1?``:`s`}`),x.disabled=i().length<=1,S.disabled=i().length<=1}),H(`click`,x,()=>f()),H(`click`,S,()=>p(`Initial`)),W(e,t)},sidebar:e=>{var t=Cs(),o=F(t);la(o,{get data(){return u},get errors(){return a()},get hasErrors(){return n()},get isDirty(){return r()},onFill:v,width:`xl:w-96`});var s=L(o,2),c=L(F(s),2),l=e=>{W(e,bs())},d=e=>{var t=Ss();Zr(t,5,i,qr,(e,t,n)=>{var r=xs(),a=F(r);a.textContent=n+1;var o=L(a,2),s=F(o,!0);k(o),k(r),R(()=>{o.disabled=i().length<=1,G(s,V(t).title)}),H(`click`,o,()=>p(V(t).title)),W(e,r)}),k(t),W(e,t)};K(c,e=>{i().length===0?e(l):e(d,-1)}),k(s),k(t),W(e,t)},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=ws(),r=I(n);J(r,{code:`const sourceData = { - firstName: 'Alice', lastName: 'Smith', email: 'alice.smith@example.com', phone: '', bio: '' -}; - -const { data, reset, rollback, rollbackTo, state: { errors, hasErrors, isDirty, snapshots } } = - createSvState(sourceData, { - validator: (source) => ({ /* validation rules */ }), - effect: ({ snapshot, property }) => { - snapshot(\`Changed \${formatFieldName(property)}\`); - } - }, { maxSnapshots: 5 });`,title:`State Setup with Snapshots & maxSnapshots`});var i=L(r,2);J(i,{code:`// Effect callback creates snapshots on each change -effect: ({ snapshot, property }) => { - snapshot(\`Changed \${property}\`); // Creates undo point - // If same title, replaces last snapshot (debouncing) - // Use snapshot(title, false) to always create new -}`,title:`Effect with Snapshot Creation`}),J(L(i,2),{code:`// Undo last change -rollback(); - -// Undo 3 changes at once -rollback(3); - -// Roll back to a named snapshot (returns true if found) -rollbackTo('Changed First Name'); - -// Roll back to initial state -rollbackTo('Initial'); - -// Reset to initial state (clears all snapshots) -reset();`,title:`Rollback, RollbackTo & Reset Usage`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),s()}jr([`click`]),Object.freeze({status:`aborted`});function Z(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Es=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ds=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Os={};function ks(e){return e&&Object.assign(Os,e),Os}function As(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function js(e,t){return typeof t==`bigint`?t.toString():t}function Ms(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Ns(e){return e==null}function Ps(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Fs(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var Is=Symbol(`evaluating`);function Q(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Is)return r===void 0&&(r=Is,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ls(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Rs(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function zs(e){return JSON.stringify(e)}function Bs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Vs=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Hs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Us=Ms(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ws(e){if(Hs(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Hs(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Gs(e){return Ws(e)?{...e}:Array.isArray(e)?[...e]:e}var Ks=new Set([`string`,`number`,`symbol`]);function qs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Js(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function $(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ys(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Xs={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Zs(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Js(e,Rs(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ls(this,`shape`,e),e},checks:[]}))}function Qs(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Js(e,Rs(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ls(this,`shape`,r),r},checks:[]}))}function $s(e,t){if(!Ws(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Js(e,Rs(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ls(this,`shape`,n),n}}))}function ec(e,t){if(!Ws(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Js(e,Rs(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ls(this,`shape`,n),n}}))}function tc(e,t){return Js(e,Rs(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ls(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function nc(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Js(t,Rs(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ls(this,`shape`,i),i},checks:[]}))}function rc(e,t,n){return Js(t,Rs(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ls(this,`shape`,i),i}}))}function ic(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function oc(e){return typeof e==`string`?e:e?.message}function sc(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=oc(e.inst?._zod.def?.error?.(e))??oc(t?.error?.(e))??oc(n.customError?.(e))??oc(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function cc(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function lc(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var uc=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,js,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},dc=Z(`$ZodError`,uc),fc=Z(`$ZodError`,uc,{Parent:Error});function pc(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function mc(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Es;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>sc(e,a,ks())));throw Vs(t,i?.callee),t}return o.value},gc=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>sc(e,a,ks())));throw Vs(t,i?.callee),t}return o.value},_c=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Es;return a.issues.length?{success:!1,error:new(e??dc)(a.issues.map(e=>sc(e,i,ks())))}:{success:!0,data:a.value}},vc=_c(fc),yc=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>sc(e,i,ks())))}:{success:!0,data:a.value}},bc=yc(fc),xc=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return hc(e)(t,n,i)},Sc=e=>(t,n,r)=>hc(e)(t,n,r),Cc=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return gc(e)(t,n,i)},wc=e=>async(t,n,r)=>gc(e)(t,n,r),Tc=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return _c(e)(t,n,i)},Ec=e=>(t,n,r)=>_c(e)(t,n,r),Dc=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return yc(e)(t,n,i)},Oc=e=>async(t,n,r)=>yc(e)(t,n,r),kc=/^[cC][^\s-]{8,}$/,Ac=/^[0-9a-z]+$/,jc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Mc=/^[0-9a-vA-V]{20}$/,Nc=/^[A-Za-z0-9]{27}$/,Pc=/^[a-zA-Z0-9_-]{21}$/,Fc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ic=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Lc=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Rc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,zc=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Bc(){return new RegExp(zc,`u`)}var Vc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Hc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Uc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Wc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Gc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Kc=/^[A-Za-z0-9_-]*$/,qc=/^\+[1-9]\d{6,14}$/,Jc=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Yc=RegExp(`^${Jc}$`);function Xc(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Zc(e){return RegExp(`^${Xc(e)}$`)}function Qc(e){let t=Xc({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Jc}T(?:${r})$`)}var $c=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},el=/^-?\d+$/,tl=/^-?\d+(?:\.\d+)?$/,nl=/^[^A-Z]*$/,rl=/^[^a-z]*$/,il=Z(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),al={number:`number`,bigint:`bigint`,object:`date`},ol=Z(`$ZodCheckLessThan`,(e,t)=>{il.init(e,t);let n=al[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value{(t.inclusive?r.value<=t.value:r.value{il.init(e,t);let n=al[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cl=Z(`$ZodCheckMultipleOf`,(e,t)=>{il.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Fs(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ll=Z(`$ZodCheckNumberFormat`,(e,t)=>{il.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Xs[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=el)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}sa&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),ul=Z(`$ZodCheckMaxLength`,(e,t)=>{var n;il.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ns(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum{let r=n.value;if(r.length<=t.maximum)return;let i=cc(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dl=Z(`$ZodCheckMinLength`,(e,t)=>{var n;il.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ns(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=cc(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fl=Z(`$ZodCheckLengthEquals`,(e,t)=>{var n;il.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Ns(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=cc(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pl=Z(`$ZodCheckStringFormat`,(e,t)=>{var n,r;il.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ml=Z(`$ZodCheckRegex`,(e,t)=>{pl.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hl=Z(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=nl,pl.init(e,t)}),gl=Z(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=rl,pl.init(e,t)}),_l=Z(`$ZodCheckIncludes`,(e,t)=>{il.init(e,t);let n=qs(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vl=Z(`$ZodCheckStartsWith`,(e,t)=>{il.init(e,t);let n=RegExp(`^${qs(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yl=Z(`$ZodCheckEndsWith`,(e,t)=>{il.init(e,t);let n=RegExp(`.*${qs(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),bl=Z(`$ZodCheckOverwrite`,(e,t)=>{il.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),xl=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(` -`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(` -`))}},Sl={major:4,minor:3,patch:6},Cl=Z(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Sl;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ic(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Es;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ic(e,t))});else{if(e.issues.length===t)continue;r||=ic(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ic(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Es;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Es;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Q(e,`~standard`,()=>({validate:t=>{try{let n=vc(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return bc(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),wl=Z(`$ZodString`,(e,t)=>{Cl.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$c(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Tl=Z(`$ZodStringFormat`,(e,t)=>{pl.init(e,t),wl.init(e,t)}),El=Z(`$ZodGUID`,(e,t)=>{t.pattern??=Ic,Tl.init(e,t)}),Dl=Z(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Lc(e)}else t.pattern??=Lc();Tl.init(e,t)}),Ol=Z(`$ZodEmail`,(e,t)=>{t.pattern??=Rc,Tl.init(e,t)}),kl=Z(`$ZodURL`,(e,t)=>{Tl.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Al=Z(`$ZodEmoji`,(e,t)=>{t.pattern??=Bc(),Tl.init(e,t)}),jl=Z(`$ZodNanoID`,(e,t)=>{t.pattern??=Pc,Tl.init(e,t)}),Ml=Z(`$ZodCUID`,(e,t)=>{t.pattern??=kc,Tl.init(e,t)}),Nl=Z(`$ZodCUID2`,(e,t)=>{t.pattern??=Ac,Tl.init(e,t)}),Pl=Z(`$ZodULID`,(e,t)=>{t.pattern??=jc,Tl.init(e,t)}),Fl=Z(`$ZodXID`,(e,t)=>{t.pattern??=Mc,Tl.init(e,t)}),Il=Z(`$ZodKSUID`,(e,t)=>{t.pattern??=Nc,Tl.init(e,t)}),Ll=Z(`$ZodISODateTime`,(e,t)=>{t.pattern??=Qc(t),Tl.init(e,t)}),Rl=Z(`$ZodISODate`,(e,t)=>{t.pattern??=Yc,Tl.init(e,t)}),zl=Z(`$ZodISOTime`,(e,t)=>{t.pattern??=Zc(t),Tl.init(e,t)}),Bl=Z(`$ZodISODuration`,(e,t)=>{t.pattern??=Fc,Tl.init(e,t)}),Vl=Z(`$ZodIPv4`,(e,t)=>{t.pattern??=Vc,Tl.init(e,t),e._zod.bag.format=`ipv4`}),Hl=Z(`$ZodIPv6`,(e,t)=>{t.pattern??=Hc,Tl.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Ul=Z(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Uc,Tl.init(e,t)}),Wl=Z(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Wc,Tl.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Gl(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Kl=Z(`$ZodBase64`,(e,t)=>{t.pattern??=Gc,Tl.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Gl(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ql(e){if(!Kc.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Gl(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Jl=Z(`$ZodBase64URL`,(e,t)=>{t.pattern??=Kc,Tl.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ql(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Yl=Z(`$ZodE164`,(e,t)=>{t.pattern??=qc,Tl.init(e,t)});function Xl(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Zl=Z(`$ZodJWT`,(e,t)=>{Tl.init(e,t),e._zod.check=n=>{Xl(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Ql=Z(`$ZodNumber`,(e,t)=>{Cl.init(e,t),e._zod.pattern=e._zod.bag.pattern??tl,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),$l=Z(`$ZodNumberFormat`,(e,t)=>{ll.init(e,t),Ql.init(e,t)}),eu=Z(`$ZodUnknown`,(e,t)=>{Cl.init(e,t),e._zod.parse=e=>e}),tu=Z(`$ZodNever`,(e,t)=>{Cl.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function nu(e,t,n){e.issues.length&&t.issues.push(...ac(n,e.issues)),t.value[n]=e.value}var ru=Z(`$ZodArray`,(e,t)=>{Cl.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;enu(t,n,e))):nu(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function iu(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...ac(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function au(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Ys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ou(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>iu(e,n,i,t,u))):iu(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var su=Z(`$ZodObject`,(e,t)=>{if(Cl.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Ms(()=>au(t));Q(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Hs,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>iu(n,t,e,s,r))):iu(i,t,e,s,r)}return i?ou(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),cu=Z(`$ZodObjectJIT`,(e,t)=>{su.init(e,t);let n=e._zod.parse,r=Ms(()=>au(t)),i=e=>{let t=new xl([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=zs(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=zs(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(` - if (${n}.issues.length) { - if (${o} in input) { - payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${o}, ...iss.path] : [${o}] - }))); - } - } - - if (${n}.value === undefined) { - if (${o} in input) { - newResult[${o}] = undefined; - } - } else { - newResult[${o}] = ${n}.value; - } - - `):t.write(` - if (${n}.issues.length) { - payload.issues = payload.issues.concat(${n}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${o}, ...iss.path] : [${o}] - }))); - } - - if (${n}.value === undefined) { - if (${o} in input) { - newResult[${o}] = undefined; - } - } else { - newResult[${o}] = ${n}.value; - } - - `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Hs,s=!Os.jitless,c=s&&Us.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?ou([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function lu(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ic(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>sc(e,r,ks())))}),t)}var uu=Z(`$ZodUnion`,(e,t)=>{Cl.init(e,t),Q(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Q(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Q(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Q(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Ps(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>lu(t,i,e,a)):lu(s,i,e,a)}}),du=Z(`$ZodIntersection`,(e,t)=>{Cl.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>pu(e,t,n)):pu(e,i,a)}});function fu(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ws(e)&&Ws(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=fu(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;re.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ic(e))return e;let o=fu(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var mu=Z(`$ZodEnum`,(e,t)=>{Cl.init(e,t);let n=As(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ks.has(typeof e)).map(e=>typeof e==`string`?qs(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),hu=Z(`$ZodLiteral`,(e,t)=>{if(Cl.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?qs(e):e?qs(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),gu=Z(`$ZodTransform`,(e,t)=>{Cl.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ds(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Es;return n.value=i,n}});function _u(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var vu=Z(`$ZodOptional`,(e,t)=>{Cl.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Q(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Q(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ps(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>_u(t,e.value)):_u(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),yu=Z(`$ZodExactOptional`,(e,t)=>{vu.init(e,t),Q(e._zod,`values`,()=>t.innerType._zod.values),Q(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),bu=Z(`$ZodNullable`,(e,t)=>{Cl.init(e,t),Q(e._zod,`optin`,()=>t.innerType._zod.optin),Q(e._zod,`optout`,()=>t.innerType._zod.optout),Q(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ps(e.source)}|null)$`):void 0}),Q(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),xu=Z(`$ZodDefault`,(e,t)=>{Cl.init(e,t),e._zod.optin=`optional`,Q(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Su(e,t)):Su(r,t)}});function Su(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Cu=Z(`$ZodPrefault`,(e,t)=>{Cl.init(e,t),e._zod.optin=`optional`,Q(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),wu=Z(`$ZodNonOptional`,(e,t)=>{Cl.init(e,t),Q(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Tu(t,e)):Tu(i,e)}});function Tu(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Eu=Z(`$ZodCatch`,(e,t)=>{Cl.init(e,t),Q(e._zod,`optin`,()=>t.innerType._zod.optin),Q(e._zod,`optout`,()=>t.innerType._zod.optout),Q(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>sc(e,n,ks()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>sc(e,n,ks()))},input:e.value}),e.issues=[]),e)}}),Du=Z(`$ZodPipe`,(e,t)=>{Cl.init(e,t),Q(e._zod,`values`,()=>t.in._zod.values),Q(e._zod,`optin`,()=>t.in._zod.optin),Q(e._zod,`optout`,()=>t.out._zod.optout),Q(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ou(e,t.in,n)):Ou(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ou(e,t.out,n)):Ou(r,t.out,n)}});function Ou(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ku=Z(`$ZodReadonly`,(e,t)=>{Cl.init(e,t),Q(e._zod,`propValues`,()=>t.innerType._zod.propValues),Q(e._zod,`values`,()=>t.innerType._zod.values),Q(e._zod,`optin`,()=>t.innerType?._zod?.optin),Q(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Au):Au(r)}});function Au(e){return e.value=Object.freeze(e.value),e}var ju=Z(`$ZodCustom`,(e,t)=>{il.init(e,t),Cl.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Mu(t,n,r,e));Mu(i,n,r,e)}});function Mu(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(lc(e))}}var Nu,Pu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Fu(){return new Pu}(Nu=globalThis).__zod_globalRegistry??(Nu.__zod_globalRegistry=Fu());var Iu=globalThis.__zod_globalRegistry;function Lu(e,t){return new e({type:`string`,...$(t)})}function Ru(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...$(t)})}function zu(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...$(t)})}function Bu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...$(t)})}function Vu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...$(t)})}function Hu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...$(t)})}function Uu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...$(t)})}function Wu(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...$(t)})}function Gu(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...$(t)})}function Ku(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...$(t)})}function qu(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...$(t)})}function Ju(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...$(t)})}function Yu(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...$(t)})}function Xu(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...$(t)})}function Zu(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...$(t)})}function Qu(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...$(t)})}function $u(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...$(t)})}function ed(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...$(t)})}function td(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...$(t)})}function nd(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...$(t)})}function rd(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...$(t)})}function id(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...$(t)})}function ad(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...$(t)})}function od(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...$(t)})}function sd(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...$(t)})}function cd(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...$(t)})}function ld(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...$(t)})}function ud(e,t){return new e({type:`number`,checks:[],...$(t)})}function dd(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...$(t)})}function fd(e){return new e({type:`unknown`})}function pd(e,t){return new e({type:`never`,...$(t)})}function md(e,t){return new ol({check:`less_than`,...$(t),value:e,inclusive:!1})}function hd(e,t){return new ol({check:`less_than`,...$(t),value:e,inclusive:!0})}function gd(e,t){return new sl({check:`greater_than`,...$(t),value:e,inclusive:!1})}function _d(e,t){return new sl({check:`greater_than`,...$(t),value:e,inclusive:!0})}function vd(e,t){return new cl({check:`multiple_of`,...$(t),value:e})}function yd(e,t){return new ul({check:`max_length`,...$(t),maximum:e})}function bd(e,t){return new dl({check:`min_length`,...$(t),minimum:e})}function xd(e,t){return new fl({check:`length_equals`,...$(t),length:e})}function Sd(e,t){return new ml({check:`string_format`,format:`regex`,...$(t),pattern:e})}function Cd(e){return new hl({check:`string_format`,format:`lowercase`,...$(e)})}function wd(e){return new gl({check:`string_format`,format:`uppercase`,...$(e)})}function Td(e,t){return new _l({check:`string_format`,format:`includes`,...$(t),includes:e})}function Ed(e,t){return new vl({check:`string_format`,format:`starts_with`,...$(t),prefix:e})}function Dd(e,t){return new yl({check:`string_format`,format:`ends_with`,...$(t),suffix:e})}function Od(e){return new bl({check:`overwrite`,tx:e})}function kd(e){return Od(t=>t.normalize(e))}function Ad(){return Od(e=>e.trim())}function jd(){return Od(e=>e.toLowerCase())}function Md(){return Od(e=>e.toUpperCase())}function Nd(){return Od(e=>Bs(e))}function Pd(e,t,n){return new e({type:`array`,element:t,...$(n)})}function Fd(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...$(n)})}function Id(e){let t=Ld(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(lc(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(lc(r))}},e(n.value,n)));return t}function Ld(e,t){let n=new il({check:`custom`,...$(t)});return n._zod.check=e,n}function Rd(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Iu,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function zd(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,zd(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Hd(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Bd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/ - -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Vd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:Wd(t,`input`,e.processors),output:Wd(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Hd(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Hd(r.element,n);if(r.type===`set`)return Hd(r.valueType,n);if(r.type===`lazy`)return Hd(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Hd(r.innerType,n);if(r.type===`intersection`)return Hd(r.left,n)||Hd(r.right,n);if(r.type===`record`||r.type===`map`)return Hd(r.keyType,n)||Hd(r.valueType,n);if(r.type===`pipe`)return Hd(r.in,n)||Hd(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Hd(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Hd(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Hd(e,n))return!0;return!!(r.rest&&Hd(r.rest,n))}return!1}var Ud=(e,t={})=>n=>{let r=Rd({...n,processors:t});return zd(e,r),Bd(r,e),Vd(r,e)},Wd=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Rd({...i??{},target:a,io:t,processors:n});return zd(e,o),Bd(o,e),Vd(o,e)},Gd={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Kd=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Gd[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},qd=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Jd=(e,t,n,r)=>{n.not={}},Yd=(e,t,n,r)=>{let i=e._zod.def,a=As(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Xd=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Zd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Qd=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},$d=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=zd(a.element,t,{...r,path:[...r.path,`items`]})},ef=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=zd(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=zd(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},tf=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>zd(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},nf=(e,t,n,r)=>{let i=e._zod.def,a=zd(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=zd(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},rf=(e,t,n,r)=>{let i=e._zod.def,a=zd(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},af=(e,t,n,r)=>{let i=e._zod.def;zd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},of=(e,t,n,r)=>{let i=e._zod.def;zd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},sf=(e,t,n,r)=>{let i=e._zod.def;zd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},cf=(e,t,n,r)=>{let i=e._zod.def;zd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},lf=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;zd(a,t,r);let o=t.seen.get(e);o.ref=a},uf=(e,t,n,r)=>{let i=e._zod.def;zd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},df=(e,t,n,r)=>{let i=e._zod.def;zd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ff=Z(`ZodISODateTime`,(e,t)=>{Ll.init(e,t),Rf.init(e,t)});function pf(e){return od(ff,e)}var mf=Z(`ZodISODate`,(e,t)=>{Rl.init(e,t),Rf.init(e,t)});function hf(e){return sd(mf,e)}var gf=Z(`ZodISOTime`,(e,t)=>{zl.init(e,t),Rf.init(e,t)});function _f(e){return cd(gf,e)}var vf=Z(`ZodISODuration`,(e,t)=>{Bl.init(e,t),Rf.init(e,t)});function yf(e){return ld(vf,e)}var bf=(e,t)=>{dc.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>mc(e,t)},flatten:{value:t=>pc(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,js,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,js,2)}},isEmpty:{get(){return e.issues.length===0}}})};Z(`ZodError`,bf);var xf=Z(`ZodError`,bf,{Parent:Error}),Sf=hc(xf),Cf=gc(xf),wf=_c(xf),Tf=yc(xf),Ef=xc(xf),Df=Sc(xf),Of=Cc(xf),kf=wc(xf),Af=Tc(xf),jf=Ec(xf),Mf=Dc(xf),Nf=Oc(xf),Pf=Z(`ZodType`,(e,t)=>(Cl.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Wd(e,`input`),output:Wd(e,`output`)}}),e.toJSONSchema=Ud(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(Rs(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Js(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Sf(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>wf(e,t,n),e.parseAsync=async(t,n)=>Cf(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Tf(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ef(e,t,n),e.decode=(t,n)=>Df(e,t,n),e.encodeAsync=async(t,n)=>Of(e,t,n),e.decodeAsync=async(t,n)=>kf(e,t,n),e.safeEncode=(t,n)=>Af(e,t,n),e.safeDecode=(t,n)=>jf(e,t,n),e.safeEncodeAsync=async(t,n)=>Mf(e,t,n),e.safeDecodeAsync=async(t,n)=>Nf(e,t,n),e.refine=(t,n)=>e.check(Gp(t,n)),e.superRefine=t=>e.check(Kp(t)),e.overwrite=t=>e.check(Od(t)),e.optional=()=>Dp(e),e.exactOptional=()=>kp(e),e.nullable=()=>jp(e),e.nullish=()=>Dp(jp(e)),e.nonoptional=t=>Lp(e,t),e.array=()=>pp(e),e.or=t=>_p([e,t]),e.and=t=>yp(e,t),e.transform=t=>Vp(e,Tp(t)),e.default=t=>Np(e,t),e.prefault=t=>Fp(e,t),e.catch=t=>zp(e,t),e.pipe=t=>Vp(e,t),e.readonly=()=>Up(e),e.describe=t=>{let n=e.clone();return Iu.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Iu.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Iu.get(e);let n=e.clone();return Iu.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Ff=Z(`_ZodString`,(e,t)=>{wl.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kd(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Sd(...t)),e.includes=(...t)=>e.check(Td(...t)),e.startsWith=(...t)=>e.check(Ed(...t)),e.endsWith=(...t)=>e.check(Dd(...t)),e.min=(...t)=>e.check(bd(...t)),e.max=(...t)=>e.check(yd(...t)),e.length=(...t)=>e.check(xd(...t)),e.nonempty=(...t)=>e.check(bd(1,...t)),e.lowercase=t=>e.check(Cd(t)),e.uppercase=t=>e.check(wd(t)),e.trim=()=>e.check(Ad()),e.normalize=(...t)=>e.check(kd(...t)),e.toLowerCase=()=>e.check(jd()),e.toUpperCase=()=>e.check(Md()),e.slugify=()=>e.check(Nd())}),If=Z(`ZodString`,(e,t)=>{wl.init(e,t),Ff.init(e,t),e.email=t=>e.check(Ru(zf,t)),e.url=t=>e.check(Wu(Hf,t)),e.jwt=t=>e.check(ad(rp,t)),e.emoji=t=>e.check(Gu(Uf,t)),e.guid=t=>e.check(zu(Bf,t)),e.uuid=t=>e.check(Bu(Vf,t)),e.uuidv4=t=>e.check(Vu(Vf,t)),e.uuidv6=t=>e.check(Hu(Vf,t)),e.uuidv7=t=>e.check(Uu(Vf,t)),e.nanoid=t=>e.check(Ku(Wf,t)),e.guid=t=>e.check(zu(Bf,t)),e.cuid=t=>e.check(qu(Gf,t)),e.cuid2=t=>e.check(Ju(Kf,t)),e.ulid=t=>e.check(Yu(qf,t)),e.base64=t=>e.check(nd(ep,t)),e.base64url=t=>e.check(rd(tp,t)),e.xid=t=>e.check(Xu(Jf,t)),e.ksuid=t=>e.check(Zu(Yf,t)),e.ipv4=t=>e.check(Qu(Xf,t)),e.ipv6=t=>e.check($u(Zf,t)),e.cidrv4=t=>e.check(ed(Qf,t)),e.cidrv6=t=>e.check(td($f,t)),e.e164=t=>e.check(id(np,t)),e.datetime=t=>e.check(pf(t)),e.date=t=>e.check(hf(t)),e.time=t=>e.check(_f(t)),e.duration=t=>e.check(yf(t))});function Lf(e){return Lu(If,e)}var Rf=Z(`ZodStringFormat`,(e,t)=>{Tl.init(e,t),Ff.init(e,t)}),zf=Z(`ZodEmail`,(e,t)=>{Ol.init(e,t),Rf.init(e,t)}),Bf=Z(`ZodGUID`,(e,t)=>{El.init(e,t),Rf.init(e,t)}),Vf=Z(`ZodUUID`,(e,t)=>{Dl.init(e,t),Rf.init(e,t)}),Hf=Z(`ZodURL`,(e,t)=>{kl.init(e,t),Rf.init(e,t)}),Uf=Z(`ZodEmoji`,(e,t)=>{Al.init(e,t),Rf.init(e,t)}),Wf=Z(`ZodNanoID`,(e,t)=>{jl.init(e,t),Rf.init(e,t)}),Gf=Z(`ZodCUID`,(e,t)=>{Ml.init(e,t),Rf.init(e,t)}),Kf=Z(`ZodCUID2`,(e,t)=>{Nl.init(e,t),Rf.init(e,t)}),qf=Z(`ZodULID`,(e,t)=>{Pl.init(e,t),Rf.init(e,t)}),Jf=Z(`ZodXID`,(e,t)=>{Fl.init(e,t),Rf.init(e,t)}),Yf=Z(`ZodKSUID`,(e,t)=>{Il.init(e,t),Rf.init(e,t)}),Xf=Z(`ZodIPv4`,(e,t)=>{Vl.init(e,t),Rf.init(e,t)}),Zf=Z(`ZodIPv6`,(e,t)=>{Hl.init(e,t),Rf.init(e,t)}),Qf=Z(`ZodCIDRv4`,(e,t)=>{Ul.init(e,t),Rf.init(e,t)}),$f=Z(`ZodCIDRv6`,(e,t)=>{Wl.init(e,t),Rf.init(e,t)}),ep=Z(`ZodBase64`,(e,t)=>{Kl.init(e,t),Rf.init(e,t)}),tp=Z(`ZodBase64URL`,(e,t)=>{Jl.init(e,t),Rf.init(e,t)}),np=Z(`ZodE164`,(e,t)=>{Yl.init(e,t),Rf.init(e,t)}),rp=Z(`ZodJWT`,(e,t)=>{Zl.init(e,t),Rf.init(e,t)}),ip=Z(`ZodNumber`,(e,t)=>{Ql.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qd(e,t,n,r),e.gt=(t,n)=>e.check(gd(t,n)),e.gte=(t,n)=>e.check(_d(t,n)),e.min=(t,n)=>e.check(_d(t,n)),e.lt=(t,n)=>e.check(md(t,n)),e.lte=(t,n)=>e.check(hd(t,n)),e.max=(t,n)=>e.check(hd(t,n)),e.int=t=>e.check(sp(t)),e.safe=t=>e.check(sp(t)),e.positive=t=>e.check(gd(0,t)),e.nonnegative=t=>e.check(_d(0,t)),e.negative=t=>e.check(md(0,t)),e.nonpositive=t=>e.check(hd(0,t)),e.multipleOf=(t,n)=>e.check(vd(t,n)),e.step=(t,n)=>e.check(vd(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ap(e){return ud(ip,e)}var op=Z(`ZodNumberFormat`,(e,t)=>{$l.init(e,t),ip.init(e,t)});function sp(e){return dd(op,e)}var cp=Z(`ZodUnknown`,(e,t)=>{eu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function lp(){return fd(cp)}var up=Z(`ZodNever`,(e,t)=>{tu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jd(e,t,n,r)});function dp(e){return pd(up,e)}var fp=Z(`ZodArray`,(e,t)=>{ru.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$d(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(bd(t,n)),e.nonempty=t=>e.check(bd(1,t)),e.max=(t,n)=>e.check(yd(t,n)),e.length=(t,n)=>e.check(xd(t,n)),e.unwrap=()=>e.element});function pp(e,t){return Pd(fp,e,t)}var mp=Z(`ZodObject`,(e,t)=>{cu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ef(e,t,n,r),Q(e,`shape`,()=>t.shape),e.keyof=()=>xp(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:lp()}),e.loose=()=>e.clone({...e._zod.def,catchall:lp()}),e.strict=()=>e.clone({...e._zod.def,catchall:dp()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>$s(e,t),e.safeExtend=t=>ec(e,t),e.merge=t=>tc(e,t),e.pick=t=>Zs(e,t),e.omit=t=>Qs(e,t),e.partial=(...t)=>nc(Ep,e,t[0]),e.required=(...t)=>rc(Ip,e,t[0])});function hp(e,t){return new mp({type:`object`,shape:e??{},...$(t)})}var gp=Z(`ZodUnion`,(e,t)=>{uu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tf(e,t,n,r),e.options=t.options});function _p(e,t){return new gp({type:`union`,options:e,...$(t)})}var vp=Z(`ZodIntersection`,(e,t)=>{du.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nf(e,t,n,r)});function yp(e,t){return new vp({type:`intersection`,left:e,right:t})}var bp=Z(`ZodEnum`,(e,t)=>{mu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yd(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new bp({...t,checks:[],...$(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new bp({...t,checks:[],...$(r),entries:i})}});function xp(e,t){return new bp({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...$(t)})}var Sp=Z(`ZodLiteral`,(e,t)=>{hu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xd(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Cp(e,t){return new Sp({type:`literal`,values:Array.isArray(e)?e:[e],...$(t)})}var wp=Z(`ZodTransform`,(e,t)=>{gu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qd(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ds(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(lc(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(lc(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Tp(e){return new wp({type:`transform`,transform:e})}var Ep=Z(`ZodOptional`,(e,t)=>{vu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>df(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dp(e){return new Ep({type:`optional`,innerType:e})}var Op=Z(`ZodExactOptional`,(e,t)=>{yu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>df(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kp(e){return new Op({type:`optional`,innerType:e})}var Ap=Z(`ZodNullable`,(e,t)=>{bu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jp(e){return new Ap({type:`nullable`,innerType:e})}var Mp=Z(`ZodDefault`,(e,t)=>{xu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>of(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Np(e,t){return new Mp({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Gs(t)}})}var Pp=Z(`ZodPrefault`,(e,t)=>{Cu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fp(e,t){return new Pp({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Gs(t)}})}var Ip=Z(`ZodNonOptional`,(e,t)=>{wu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>af(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lp(e,t){return new Ip({type:`nonoptional`,innerType:e,...$(t)})}var Rp=Z(`ZodCatch`,(e,t)=>{Eu.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zp(e,t){return new Rp({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Bp=Z(`ZodPipe`,(e,t)=>{Du.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lf(e,t,n,r),e.in=t.in,e.out=t.out});function Vp(e,t){return new Bp({type:`pipe`,in:e,out:t})}var Hp=Z(`ZodReadonly`,(e,t)=>{ku.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Up(e){return new Hp({type:`readonly`,innerType:e})}var Wp=Z(`ZodCustom`,(e,t)=>{ju.init(e,t),Pf.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zd(e,t,n,r)});function Gp(e,t={}){return Fd(Wp,e,t)}function Kp(e){return Id(e)}var qp=U(`
                        `,1),Jp=U(` `,1);function Yp(e,t){ze(t,!0);let n=()=>A(g,`$hasErrors`,o),r=()=>A(_,`$isDirty`,o),i=()=>A(h,`$errors`,o),a=()=>A(v,`$isDirtyByField`,o),[o,s]=ct(),c=hp({username:Lf().min(3).max(20).regex(/^\S+$/,`Must not contain spaces`),email:Lf().min(1,`Required`).email(),age:ap().int().min(18).max(120),website:Lf().url().optional().or(Cp(``)),bio:Lf().max(200).optional()});function l(e,t,n){let r=e.safeParse(t);if(r.success)return Object.fromEntries(n.map(e=>[e,``]));let i={};for(let e of r.error.issues){let t=String(e.path[0]);i[t]||(i[t]=e.message)}return Object.fromEntries(n.map(e=>[e,i[e]??``]))}let u=c.pick({username:!0,email:!0,age:!0,website:!0}),d=Object.keys(u.shape),f=[...d,`bio`],p={username:{label:`Username`,placeholder:`Enter username`,type:`text`},email:{label:`Email`,placeholder:`Enter email`,type:`email`},age:{label:`Age`,placeholder:`Enter age`,type:`number`},website:{label:`Website`,placeholder:`https://example.com`,type:`text`}},{data:m,state:{errors:h,hasErrors:g,isDirty:_,isDirtyByField:v}}=ta({username:``,email:``,age:0,website:``,bio:``},{validator:e=>l(c,e,f)}),y=()=>{m.username=`user${X()}`,m.email=`${X()}@example.com`,m.age=Ca(18,65),m.bio=`Hello, I am a demo user!`,m.website=`https://${X()}.com`},b=String.raw`import { z } from 'zod'; - -const userSchema = z.object({ - username: z.string().min(3).max(20).regex(/^\S+$/, 'Must not contain spaces'), - email: z.string().min(1, 'Required').email(), - age: z.number().int().min(18).max(120), - website: z.string().url().optional().or(z.literal('')), - bio: z.string().max(200).optional() -});`;_a(e,{description:`Demonstrates using Zod schemas for validation with svstate, including dynamic form rendering via z.pick() shape keys.`,title:`Zod Integration Demo`,main:e=>{var t=qp(),o=I(t);Sa(o,{get hasErrors(){return n()},get isDirty(){return r()}});var s=L(o,2),c=F(s);Zr(c,16,()=>d,e=>e,(e,t)=>{let n=M(()=>p[t]);{let r=M(()=>i()?.[t]),o=M(()=>t!==`website`);Y(e,{get id(){return t},get error(){return V(r)},get isDirty(){return a()[t]},get label(){return V(n).label},get placeholder(){return V(n).placeholder},get required(){return V(o)},get type(){return V(n).type},get value(){return m[t]},set value(e){m[t]=e}})}});var l=L(c,2);{let e=M(()=>i()?.bio);Za(l,{id:`bio`,get error(){return V(e)},get isDirty(){return a().bio},label:`Bio`,placeholder:`Tell us about yourself (not in pick subset)`,get value(){return m.bio},set value(e){m.bio=e}})}k(s),W(e,t)},sidebar:e=>{la(e,{get data(){return m},get errors(){return i()},get hasErrors(){return n()},get isDirty(){return r()},get isDirtyByField(){return a()},onFill:y})},sourceCode:e=>{ba(e,{children:(e,t)=>{var n=Jp(),r=I(n);J(r,{get code(){return b},title:`Zod Schema Definition`});var i=L(r,2);J(i,{code:`function zodToSvstateErrors(schema, source, fields) { - const result = schema.safeParse(source); - if (result.success) - return Object.fromEntries(fields.map(f => [f, ''])); - - const errorMap = {}; - for (const issue of result.error.issues) { - const key = String(issue.path[0]); - if (!errorMap[key]) errorMap[key] = issue.message; - } - return Object.fromEntries( - fields.map(f => [f, errorMap[f] ?? '']) - ); -} - -const { data, state: { errors, hasErrors } } = createSvState(sourceData, { - validator: (source) => zodToSvstateErrors(userSchema, source, allFields) -});`,title:`Bridge Function (Zod → svstate)`}),J(L(i,2),{code:`// Pick a subset of fields for dynamic rendering -const pickedSchema = userSchema.pick({ username: true, email: true, age: true, website: true }); -const dynamicFields = Object.keys(pickedSchema.shape); - -const fieldMeta = { - username: { label: 'Username', placeholder: 'Enter username', type: 'text' }, - email: { label: 'Email', placeholder: 'Enter email', type: 'email' }, - age: { label: 'Age', placeholder: 'Enter age', type: 'number' }, - website: { label: 'Website', placeholder: 'https://...', type: 'text' }, -}; - -// In template: -{#each dynamicFields as field} - -{/each} - - -`,title:`Dynamic Rendering via z.pick()`}),W(e,n)},$$slots:{default:!0}})},$$slots:{main:!0,sidebar:!0,sourceCode:!0}}),Be(),s()}var Xp=U(``),Zp=U(`
                        svstate logo

                        svstate

                        A Svelte 5 library that provides a supercharged $state() with deep reactive proxies, validation, snapshot/undo, - and side effects — built for complex, real-world applications.

                        $ npm i svstate
                        `);function Qp(e){let t=[{value:`basic-validation`,name:`Basic Validation`},{value:`nested-objects`,name:`Nested Objects`},{value:`array-property`,name:`Array Property`},{value:`calculated-fields`,name:`Calculated Fields`},{value:`calculated-class`,name:`State with Methods`},{value:`reset-demo`,name:`Reset`},{value:`snapshot-demo`,name:`Snapshot & Rollback`},{value:`action-demo`,name:`Action & Error`},{value:`async-validation`,name:`Async Validation`},{value:`options-demo`,name:`Options`},{value:`zod-validation`,name:`Zod Integration`},{value:`plugin-devtools`,name:`Plugin: Devtools`},{value:`plugin-persist-sync`,name:`Plugin: Persist & Sync`},{value:`plugin-undo-redo`,name:`Plugin: Undo/Redo`},{value:`plugin-autosave-analytics`,name:`Plugin: Autosave & Analytics`}],n=N(`basic-validation`),r=`1.5.3`,i=`/svstate`;var a=Zp(),o=F(a),s=F(o),c=L(s,2),l=F(c),u=L(F(l),2),d=F(u);k(u),k(l);var f=L(l,4),p=L(F(f),4);k(f);var m=L(f,2);k(c),k(o);var h=L(o,2),g=F(h),_=F(g),v=L(F(_),2);Zr(v,21,()=>t,qr,(e,t)=>{var n=Xp(),r=F(n,!0);k(n);var i={};R(()=>{G(r,V(t).name),i!==(i=V(t).value)&&(n.value=(n.__value=V(t).value)??``)}),W(e,n)}),k(v),k(_),k(g);var y=L(g,2),b=F(y),x=e=>{eo(e,{})},S=e=>{xo(e,{})},C=e=>{Ba(e,{})},w=e=>{lo(e,{})},T=e=>{oo(e,{})},E=e=>{_s(e,{})},ee=e=>{Ts(e,{})},te=e=>{Aa(e,{})},ne=e=>{Ja(e,{})},re=e=>{ko(e,{})},ie=e=>{Yp(e,{})},ae=e=>{Yo(e,{})},oe=e=>{ns(e,{})},se=e=>{ps(e,{})},ce=e=>{Vo(e,{})};K(b,e=>{V(n)===`basic-validation`?e(x):V(n)===`nested-objects`?e(S,1):V(n)===`array-property`?e(C,2):V(n)===`calculated-fields`?e(w,3):V(n)===`calculated-class`?e(T,4):V(n)===`reset-demo`?e(E,5):V(n)===`snapshot-demo`?e(ee,6):V(n)===`action-demo`?e(te,7):V(n)===`async-validation`?e(ne,8):V(n)===`options-demo`?e(re,9):V(n)===`zod-validation`?e(ie,10):V(n)===`plugin-devtools`?e(ae,11):V(n)===`plugin-persist-sync`?e(oe,12):V(n)===`plugin-undo-redo`?e(se,13):V(n)===`plugin-autosave-analytics`&&e(ce,14)}),k(y),k(h),k(a),R(()=>{hi(s,`src`,`${i}/favicon.png`),G(d,`v${r??``}`),hi(m,`href`,`${i}/llms.txt`)}),H(`click`,p,()=>navigator.clipboard.writeText(`npm i svstate@${r}`)),li(v,()=>V(n),e=>P(n,e)),W(e,a)}jr([`click`]),Br(Qp,{target:document.querySelector(`#app`)}); \ No newline at end of file diff --git a/docs/assets/index-Ck8pee3s.css b/docs/assets/index-GOI4QFiT.css similarity index 99% rename from docs/assets/index-Ck8pee3s.css rename to docs/assets/index-GOI4QFiT.css index da85bc7..93efd97 100644 --- a/docs/assets/index-Ck8pee3s.css +++ b/docs/assets/index-GOI4QFiT.css @@ -1,2 +1,2 @@ -/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */ +/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-700:oklch(55.3% .195 38.402);--color-orange-800:oklch(47% .157 37.304);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-800:oklch(47.6% .114 61.907);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-emerald-800:oklch(43.2% .095 166.913);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-indigo-800:oklch(39.8% .195 277.366);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-purple-800:oklch(43.8% .218 303.724);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--radius-md:.375rem;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.absolute{position:absolute}.relative{position:relative}.top-9{top:calc(var(--spacing) * 9)}.right-3{right:calc(var(--spacing) * 3)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-2{height:calc(var(--spacing) * 2)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-20{height:calc(var(--spacing) * 20)}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.min-h-screen{min-height:100vh}.w-2{width:calc(var(--spacing) * 2)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-20{width:calc(var(--spacing) * 20)}.w-full{width:100%}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-blue-200{border-color:var(--color-blue-200)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-green-200{border-color:var(--color-green-200)}.border-purple-200{border-color:var(--color-purple-200)}.border-red-200{border-color:var(--color-red-200)}.border-red-500{border-color:var(--color-red-500)}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-600{background-color:var(--color-amber-600)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-200{background-color:var(--color-blue-200)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-600{background-color:var(--color-green-600)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-orange-600{background-color:var(--color-orange-600)}.bg-purple-50{background-color:var(--color-purple-50)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-purple-200{background-color:var(--color-purple-200)}.bg-purple-600{background-color:var(--color-purple-600)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-600{background-color:var(--color-red-600)}.bg-white{background-color:var(--color-white)}.bg-yellow-100{background-color:var(--color-yellow-100)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-800{color:var(--color-blue-800)}.text-blue-900{color:var(--color-blue-900)}.text-emerald-800{color:var(--color-emerald-800)}.text-gray-100{color:var(--color-gray-100)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-green-800{color:var(--color-green-800)}.text-indigo-800{color:var(--color-indigo-800)}.text-orange-800{color:var(--color-orange-800)}.text-purple-600{color:var(--color-purple-600)}.text-purple-800{color:var(--color-purple-800)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-800{color:var(--color-red-800)}.text-red-900{color:var(--color-red-900)}.text-white{color:var(--color-white)}.text-yellow-800{color:var(--color-yellow-800)}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.placeholder-red-400::placeholder{color:var(--color-red-400)}.opacity-25{opacity:.25}.opacity-50{opacity:.5}.opacity-75{opacity:.75}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.hover\:bg-amber-700:hover{background-color:var(--color-amber-700)}.hover\:bg-blue-700:hover{background-color:var(--color-blue-700)}.hover\:bg-emerald-700:hover{background-color:var(--color-emerald-700)}.hover\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\:bg-gray-300:hover{background-color:var(--color-gray-300)}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}.hover\:bg-orange-200:hover{background-color:var(--color-orange-200)}.hover\:bg-orange-700:hover{background-color:var(--color-orange-700)}.hover\:bg-purple-700:hover{background-color:var(--color-purple-700)}.hover\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:text-gray-700:hover{color:var(--color-gray-700)}.hover\:text-gray-900:hover{color:var(--color-gray-900)}.hover\:text-purple-700:hover{color:var(--color-purple-700)}.hover\:text-red-700:hover{color:var(--color-red-700)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}}.focus\:border-blue-500:focus{border-color:var(--color-blue-500)}.focus\:border-red-500:focus{border-color:var(--color-red-500)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-amber-500:focus{--tw-ring-color:var(--color-amber-500)}.focus\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.focus\:ring-emerald-500:focus{--tw-ring-color:var(--color-emerald-500)}.focus\:ring-green-500:focus{--tw-ring-color:var(--color-green-500)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}.focus\:ring-orange-500:focus{--tw-ring-color:var(--color-orange-500)}.focus\:ring-purple-500:focus{--tw-ring-color:var(--color-purple-500)}.focus\:ring-red-500:focus{--tw-ring-color:var(--color-red-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:no-underline:disabled{text-decoration-line:none}.disabled\:opacity-50:disabled{opacity:.5}@media (hover:hover){.disabled\:hover\:text-gray-600:disabled:hover{color:var(--color-gray-600)}}@media (width>=40rem){.sm\:mb-8{margin-bottom:calc(var(--spacing) * 8)}.sm\:inline-flex{display:inline-flex}.sm\:h-5{height:calc(var(--spacing) * 5)}.sm\:h-32{height:calc(var(--spacing) * 32)}.sm\:w-5{width:calc(var(--spacing) * 5)}.sm\:w-32{width:calc(var(--spacing) * 32)}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:p-6{padding:calc(var(--spacing) * 6)}.sm\:text-left{text-align:left}.sm\:text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.sm\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.sm\:text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}}@media (width>=48rem){.md\:p-8{padding:calc(var(--spacing) * 8)}}@media (width>=64rem){.lg\:w-64{width:calc(var(--spacing) * 64)}.lg\:flex-shrink-0{flex-shrink:0}.lg\:flex-row{flex-direction:row}.lg\:gap-6{gap:calc(var(--spacing) * 6)}}@media (width>=80rem){.xl\:w-80{width:calc(var(--spacing) * 80)}.xl\:w-96{width:calc(var(--spacing) * 96)}.xl\:flex-row{flex-direction:row}.xl\:gap-6{gap:calc(var(--spacing) * 6)}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/docs/index.html b/docs/index.html index a13927a..47358dc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,8 +5,8 @@ svstate demo - - + + diff --git a/package-lock.json b/package-lock.json index 47d374b..0f4aef5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "svstate", - "version": "1.5.4", + "version": "1.5.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "svstate", - "version": "1.5.4", + "version": "1.5.5", "license": "ISC", "devDependencies": { "@eslint/eslintrc": "^3.3.5", diff --git a/package.json b/package.json index e38da09..fae67ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "svstate", - "version": "1.5.4", + "version": "1.5.5", "description": "Supercharged $state() for Svelte 5: deep reactive proxy with validation, cross-field rules, computed & side-effects", "author": "BCsabaEngine", "license": "ISC", diff --git a/src/state.svelte.ts b/src/state.svelte.ts index 2a5808f..cd3b8f5 100644 --- a/src/state.svelte.ts +++ b/src/state.svelte.ts @@ -406,7 +406,20 @@ export function createSvState, V extends Valid callPlugins('onAction', { phase: 'after', params: parameters }); } catch (caughtError) { await actuators?.actionCompleted?.(caughtError); - const actionError_ = caughtError instanceof Error ? caughtError : undefined; + const actionError_ = + caughtError instanceof Error + ? caughtError + : caughtError && typeof caughtError === 'object' + ? new Error( + String( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (caughtError as any).message ?? + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (caughtError as any).body?.message ?? + caughtError + ) + ) + : undefined; actionError.set(actionError_); callPlugins('onAction', { phase: 'after', params: parameters, error: actionError_ }); } finally {