diff options
| author | Felix Hanley <felix@userspace.com.au> | 2025-11-02 23:56:53 +0000 |
|---|---|---|
| committer | Felix Hanley <felix@userspace.com.au> | 2025-11-02 23:56:53 +0000 |
| commit | 5e830c3f70570b8ca92f7d3637f5877329d9206e (patch) | |
| tree | 2f80d47119f853f8adeb18e1fef97b406f18b079 | |
| parent | 02e6f97cd04cbcd7505e1da9a781df4321463640 (diff) | |
| download | caddy-master.tar.gz caddy-master.tar.bz2 | |
160 files changed, 49 insertions, 17404 deletions
@@ -5,7 +5,6 @@ go 1.25.0 require ( github.com/aksdb/caddy-cgi/v2 v2.2.6 github.com/caddyserver/caddy/v2 v2.10.2 - github.com/sjtug/cerberus v0.4.3 ) require ( @@ -22,7 +21,6 @@ require ( github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/Masterminds/sprig/v3 v3.3.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/a-h/templ v0.3.943 // indirect github.com/alecthomas/chroma/v2 v2.20.0 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b // indirect @@ -30,7 +28,6 @@ require ( github.com/caddyserver/certmagic v0.24.0 // indirect github.com/caddyserver/zerossl v0.1.3 // indirect github.com/ccoveille/go-safecast v1.6.1 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -44,7 +41,6 @@ require ( github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da // indirect github.com/dlclark/regexp2 v1.11.5 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/elastic/go-freelru v0.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/francoispqt/gojay v1.2.13 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect @@ -54,15 +50,12 @@ require ( github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-sql-driver/mysql v1.9.3 // indirect - github.com/go-task/slim-sprig/v3 v3.0.0 // indirect - github.com/golang-jwt/jwt/v5 v5.3.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v1.0.0 // indirect github.com/google/cel-go v0.26.1 // indirect github.com/google/certificate-transparency-go v1.3.2 // indirect github.com/google/go-tpm v0.9.5 // indirect github.com/google/go-tspi v0.3.0 // indirect - github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect github.com/google/s2a-go v0.1.9 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect @@ -70,8 +63,6 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/invopop/ctxi18n v0.9.0 // indirect - github.com/invopop/yaml v0.3.1 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/pgx/v5 v5.7.5 // indirect @@ -89,7 +80,6 @@ require ( github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/onsi/ginkgo/v2 v2.25.1 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pires/go-proxyproto v0.8.1 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -122,8 +112,8 @@ require ( github.com/x448/float16 v0.8.4 // indirect github.com/yuin/goldmark v1.7.13 // indirect github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc // indirect + github.com/zeebo/assert v1.3.0 // indirect github.com/zeebo/blake3 v0.2.4 // indirect - github.com/zeebo/xxh3 v1.0.2 // indirect go.etcd.io/bbolt v1.4.3 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect @@ -6,23 +6,18 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= cloud.google.com/go v0.120.0 h1:wc6bgG9DHyKqF5/vQvX1CiZrtHnxJjBlKUyF9nP6meA= cloud.google.com/go v0.120.0/go.mod h1:/beW32s8/pGRuj4IILWQNd4uuebeT4dkOhKmkfit64Q= -cloud.google.com/go/auth v0.16.1 h1:XrXauHMd30LhQYVRHLGvJiYeczweKQXZxsTbV9TiguU= -cloud.google.com/go/auth v0.16.1/go.mod h1:1howDHJ5IETh/LwYs3ZxvlkXF48aSqqJUM+5o02dNOI= cloud.google.com/go/auth v0.16.5 h1:mFWNQ2FEVWAliEQWpAdH80omXFokmrnbDhUS9cBywsI= cloud.google.com/go/auth v0.16.5/go.mod h1:utzRfHMP+Vv0mpOkTRQoWD2q3BatTOoWbA7gCc2dUhQ= cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= -cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= -cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= -cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= cloud.google.com/go/compute/metadata v0.8.0 h1:HxMRIbao8w17ZX6wBnjhcDkW6lTFpgcaobyVfZWqRLA= cloud.google.com/go/compute/metadata v0.8.0/go.mod h1:sYOGTp851OV9bOFJ9CH7elVvyzopvWQFNNghtDQ/Biw= -cloud.google.com/go/iam v1.5.0 h1:QlLcVMhbLGOjRcGe6VTGGTyQib8dRLK2B/kYNV0+2xs= -cloud.google.com/go/iam v1.5.0/go.mod h1:U+DOtKQltF/LxPEtcDLoobcsZMilSRwR7mgNL7knOpo= -cloud.google.com/go/kms v1.21.2 h1:c/PRUSMNQ8zXrc1sdAUnsenWWaNXN+PzTXfXOcSFdoE= -cloud.google.com/go/kms v1.21.2/go.mod h1:8wkMtHV/9Z8mLXEXr1GK7xPSBdi6knuLXIhqjuWcI6w= -cloud.google.com/go/longrunning v0.6.6 h1:XJNDo5MUfMM05xK3ewpbSdmt7R2Zw+aQEMbdQR65Rbw= -cloud.google.com/go/longrunning v0.6.6/go.mod h1:hyeGJUrPHcx0u2Uu1UFSoYZLn4lkMrccJig0t4FI7yw= +cloud.google.com/go/iam v1.5.2 h1:qgFRAGEmd8z6dJ/qyEchAuL9jpswyODjA2lS+w234g8= +cloud.google.com/go/iam v1.5.2/go.mod h1:SE1vg0N81zQqLzQEwxL2WI6yhetBdbNQuTvIKCSkUHE= +cloud.google.com/go/kms v1.22.0 h1:dBRIj7+GDeeEvatJeTB19oYZNV0aj6wEqSIT/7gLqtk= +cloud.google.com/go/kms v1.22.0/go.mod h1:U7mf8Sva5jpOb4bxYZdtw/9zsbIjrklYwPcvMk34AL8= +cloud.google.com/go/longrunning v0.6.7 h1:IGtfDWHhQCgCjwQjV9iiLnUta9LBCo8R9QmAFsS/PrE= +cloud.google.com/go/longrunning v0.6.7/go.mod h1:EAFV3IZAKmM56TyiE6VAP3VoTzhZzySwI/YI1s/nRsY= dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= @@ -35,18 +30,12 @@ git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGy github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= -github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/KimMachineGun/automemlimit v0.7.2 h1:DyfHI7zLWmZPn2Wqdy2AgTiUvrGPmnYWgwhHXtAegX4= -github.com/KimMachineGun/automemlimit v0.7.2/go.mod h1:QZxpHaGOQoYvFhv/r4u3U0JTC2ZcOwbSr11UZF46UBM= github.com/KimMachineGun/automemlimit v0.7.4 h1:UY7QYOIfrr3wjjOAqahFmC3IaQCLWvur9nmfIn6LnWk= github.com/KimMachineGun/automemlimit v0.7.4/go.mod h1:QZxpHaGOQoYvFhv/r4u3U0JTC2ZcOwbSr11UZF46UBM= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4= -github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs= @@ -56,77 +45,63 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/a-h/templ v0.3.865 h1:nYn5EWm9EiXaDgWcMQaKiKvrydqgxDUtT1+4zU2C43A= -github.com/a-h/templ v0.3.865/go.mod h1:oLBbZVQ6//Q6zpvSMPTuBK0F3qOtBdFBcGRspcT+VNQ= -github.com/a-h/templ v0.3.943 h1:o+mT/4yqhZ33F3ootBiHwaY4HM5EVaOJfIshvd5UNTY= -github.com/a-h/templ v0.3.943/go.mod h1:oCZcnKRf5jjsGpf2yELzQfodLphd2mwecwG4Crk5HBo= github.com/aksdb/caddy-cgi/v2 v2.2.6 h1:9esJzRs3l8AmKKfeAUo2BsMvaUuNwlqJSyoOx833y2U= github.com/aksdb/caddy-cgi/v2 v2.2.6/go.mod h1:+YHS3pRT7Y0YsgjLpE0ZyWJfzckkxSFCbYbuWHCqPrE= github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0= github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/chroma/v2 v2.2.0/go.mod h1:vf4zrexSH54oEjJ7EdB65tGNHmH3pGZmVkgTP5RHvAs= -github.com/alecthomas/chroma/v2 v2.15.0 h1:LxXTQHFoYrstG2nnV9y2X5O94sOBzf0CIUpSTbpxvMc= -github.com/alecthomas/chroma/v2 v2.15.0/go.mod h1:gUhVLrPDXPtp/f+L1jo9xepo9gL4eLwRuGAunSZMkio= github.com/alecthomas/chroma/v2 v2.20.0 h1:sfIHpxPyR07/Oylvmcai3X/exDlE8+FA820NTz+9sGw= github.com/alecthomas/chroma/v2 v2.20.0/go.mod h1:e7tViK0xh/Nf4BYHl00ycY6rV7b8iXBksI9E359yNmA= github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8= -github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= -github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/alecthomas/repr v0.5.1 h1:E3G4t2QbHTSNpPKBgMTln5KLkZHLOcU7r37J4pXBuIg= +github.com/alecthomas/repr v0.5.1/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b h1:uUXgbcPDK3KpW29o4iy7GtuappbWT0l5NaMo9H9pJDw= github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/aws/aws-sdk-go-v2 v1.36.3 h1:mJoei2CxPutQVxaATCzDUjcZEjVRdpsiiXi2o38yqWM= -github.com/aws/aws-sdk-go-v2 v1.36.3/go.mod h1:LLXuLpgzEbD766Z5ECcRmi8AzSwfZItDtmABVkRLGzg= -github.com/aws/aws-sdk-go-v2/config v1.29.14 h1:f+eEi/2cKCg9pqKBoAIwRGzVb70MRKqWX4dg1BDcSJM= -github.com/aws/aws-sdk-go-v2/config v1.29.14/go.mod h1:wVPHWcIFv3WO89w0rE10gzf17ZYy+UVS1Geq8Iei34g= -github.com/aws/aws-sdk-go-v2/credentials v1.17.67 h1:9KxtdcIA/5xPNQyZRgUSpYOE6j9Bc4+D7nZua0KGYOM= -github.com/aws/aws-sdk-go-v2/credentials v1.17.67/go.mod h1:p3C44m+cfnbv763s52gCqrjaqyPikj9Sg47kUVaNZQQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 h1:x793wxmUWVDhshP8WW2mlnXuFrO4cOd3HLBroh1paFw= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30/go.mod h1:Jpne2tDnYiFascUEs2AWHJL9Yp7A5ZVy3TNyxaAjD6M= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 h1:ZK5jHhnrioRkUNOc+hOgQKlUL5JeC3S6JgLxtQ+Rm0Q= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34/go.mod h1:p4VfIceZokChbA9FzMbRGz5OV+lekcVtHlPKEO0gSZY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 h1:SZwFm17ZUNNg5Np0ioo/gq8Mn6u9w19Mri8DnJ15Jf0= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34/go.mod h1:dFZsC0BLo346mvKQLWmoJxT+Sjp+qcVR1tRVHQGOH9Q= +github.com/aws/aws-sdk-go-v2 v1.38.0 h1:UCRQ5mlqcFk9HJDIqENSLR3wiG1VTWlyUfLDEvY7RxU= +github.com/aws/aws-sdk-go-v2 v1.38.0/go.mod h1:9Q0OoGQoboYIAJyslFyF1f5K1Ryddop8gqMhWx/n4Wg= +github.com/aws/aws-sdk-go-v2/config v1.31.0 h1:9yH0xiY5fUnVNLRWO0AtayqwU1ndriZdN78LlhruJR4= +github.com/aws/aws-sdk-go-v2/config v1.31.0/go.mod h1:VeV3K72nXnhbe4EuxxhzsDc/ByrCSlZwUnWH52Nde/I= +github.com/aws/aws-sdk-go-v2/credentials v1.18.4 h1:IPd0Algf1b+Qy9BcDp0sCUcIWdCQPSzDoMK3a8pcbUM= +github.com/aws/aws-sdk-go-v2/credentials v1.18.4/go.mod h1:nwg78FjH2qvsRM1EVZlX9WuGUJOL5od+0qvm0adEzHk= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.3 h1:GicIdnekoJsjq9wqnvyi2elW6CGMSYKhdozE7/Svh78= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.3/go.mod h1:R7BIi6WNC5mc1kfRM7XM/VHC3uRWkjc396sfabq4iOo= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.3 h1:o9RnO+YZ4X+kt5Z7Nvcishlz0nksIt2PIzDglLMP0vA= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.3/go.mod h1:+6aLJzOG1fvMOyzIySYjOFjcguGvVRL68R+uoRencN4= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.3 h1:joyyUFhiTQQmVK6ImzNU9TQSNRNeD9kOklqTzyk5v6s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.3/go.mod h1:+vNIyZQP3b3B1tSLI0lxvrU9cfM7gpdRXMFfm67ZcPc= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 h1:bIqFDwgGXXN1Kpp99pDOdKMTTb5d2KyU5X/BZxjOkRo= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3/go.mod h1:H5O/EsxDWyU+LP/V8i5sm8cxoZgc2fdNR9bxlOFrQTo= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 h1:eAh2A4b5IzM/lum78bZ590jy36+d/aFLgKF/4Vd1xPE= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3/go.mod h1:0yKJC/kb8sAnmlYa6Zs3QVYqaC8ug2AbnNChv5Ox3uA= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 h1:dM9/92u2F1JbDaGooxTq18wmmFzbJRfXfVfy96/1CXM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15/go.mod h1:SwFBy2vjtA0vZbjjaFtfN045boopadnoVPhu4Fv66vY= -github.com/aws/aws-sdk-go-v2/service/kms v1.38.3 h1:RivOtUH3eEu6SWnUMFHKAW4MqDOzWn1vGQ3S38Y5QMg= -github.com/aws/aws-sdk-go-v2/service/kms v1.38.3/go.mod h1:cQn6tAF77Di6m4huxovNM7NVAozWTZLsDRp9t8Z/WYk= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.0 h1:6+lZi2JeGKtCraAj1rpoZfKqnQ9SptseRZioejfUOLM= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.0/go.mod h1:eb3gfbVIxIoGgJsi9pGne19dhCBpK6opTYpQqAmdy44= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.3 h1:ieRzyHXypu5ByllM7Sp4hC5f/1Fy5wqxqY0yB85hC7s= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.3/go.mod h1:O5ROz8jHiOAKAwx179v+7sHMhfobFVi6nZt8DEyiYoM= github.com/aws/aws-sdk-go-v2/service/kms v1.44.0 h1:Z95XCqqSnwXr0AY7PgsiOUBhUG2GoDM5getw6RfD1Lg= -github.com/aws/aws-sdk-go-v2/service/sso v1.25.3 h1:1Gw+9ajCV1jogloEv1RRnvfRFia2cL6c9cuKV2Ps+G8= -github.com/aws/aws-sdk-go-v2/service/sso v1.25.3/go.mod h1:qs4a9T5EMLl/Cajiw2TcbNt2UNo/Hqlyp+GiuG4CFDI= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.1 h1:hXmVKytPfTy5axZ+fYbR5d0cFmC3JvwLm5kM83luako= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.1/go.mod h1:MlYRNmYu/fGPoxBQVvBYr9nyr948aY/WLUvwBMBJubs= -github.com/aws/aws-sdk-go-v2/service/sts v1.33.19 h1:1XuUZ8mYJw9B6lzAkXhqHlJd/XvaX32evhproijJEZY= -github.com/aws/aws-sdk-go-v2/service/sts v1.33.19/go.mod h1:cQnB8CUnxbMU82JvlqjKR2HBOm3fe9pWorWBza6MBJ4= -github.com/aws/smithy-go v1.22.2 h1:6D9hW43xKFrRx/tXXfAlIZc4JI+yQe6snnWcQyxSyLQ= -github.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= +github.com/aws/aws-sdk-go-v2/service/kms v1.44.0/go.mod h1:DqcSngL7jJeU1fOzh5Ll5rSvX/MlMV6OZlE4mVdFAQc= +github.com/aws/aws-sdk-go-v2/service/sso v1.28.0 h1:Mc/MKBf2m4VynyJkABoVEN+QzkfLqGj0aiJuEe7cMeM= +github.com/aws/aws-sdk-go-v2/service/sso v1.28.0/go.mod h1:iS5OmxEcN4QIPXARGhavH7S8kETNL11kym6jhoS7IUQ= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.33.0 h1:6csaS/aJmqZQbKhi1EyEMM7yBW653Wy/B9hnBofW+sw= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.33.0/go.mod h1:59qHWaY5B+Rs7HGTuVGaC32m0rdpQ68N8QCN3khYiqs= +github.com/aws/aws-sdk-go-v2/service/sts v1.37.0 h1:MG9VFW43M4A8BYeAfaJJZWrroinxeTi2r3+SnmLQfSA= +github.com/aws/aws-sdk-go-v2/service/sts v1.37.0/go.mod h1:JdeBDPgpJfuS6rU/hNglmOigKhyEZtBmbraLE4GK1J8= +github.com/aws/smithy-go v1.22.5 h1:P9ATCXPMb2mPjYBgueqJNCA5S9UfktsW0tTxi+a7eqw= +github.com/aws/smithy-go v1.22.5/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/caddyserver/caddy/v2 v2.10.0 h1:fonubSaQKF1YANl8TXqGcn4IbIRUDdfAkpcsfI/vX5U= -github.com/caddyserver/caddy/v2 v2.10.0/go.mod h1:q+dgBS3xtIJJGYI2H5Nyh9+4BvhQQ9yCGmECv4Ubdjo= github.com/caddyserver/caddy/v2 v2.10.2 h1:g/gTYjGMD0dec+UgMw8SnfmJ3I9+M2TdvoRL/Ovu6U8= github.com/caddyserver/caddy/v2 v2.10.2/go.mod h1:TXLQHx+ev4HDpkO6PnVVHUbL6OXt6Dfe7VcIBdQnPL0= -github.com/caddyserver/certmagic v0.23.0 h1:CfpZ/50jMfG4+1J/u2LV6piJq4HOfO6ppOnOf7DkFEU= -github.com/caddyserver/certmagic v0.23.0/go.mod h1:9mEZIWqqWoI+Gf+4Trh04MOVPD0tGSxtqsxg87hAIH4= github.com/caddyserver/certmagic v0.24.0 h1:EfXTWpxHAUKgDfOj6MHImJN8Jm4AMFfMT6ITuKhrDF0= github.com/caddyserver/certmagic v0.24.0/go.mod h1:xPT7dC1DuHHnS2yuEQCEyks+b89sUkMENh8dJF+InLE= github.com/caddyserver/zerossl v0.1.3 h1:onS+pxp3M8HnHpN5MMbOMyNjmTheJyWRaZYwn+YTAyA= github.com/caddyserver/zerossl v0.1.3/go.mod h1:CxA0acn7oEGO6//4rtrRjYgEoa4MFw/XofZnrYwGqG4= github.com/ccoveille/go-safecast v1.6.1 h1:Nb9WMDR8PqhnKCVs2sCB+OqhohwO5qaXtCviZkIff5Q= github.com/ccoveille/go-safecast v1.6.1/go.mod h1:QqwNjxQ7DAqY0C721OIO9InMk9zCwcsO7tnRuHytad8= -github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= -github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= @@ -147,21 +122,18 @@ github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-oidc/v3 v3.14.1 h1:9ePWwfdwC4QKRlCXsJGou56adA/owXczOzwKdOumLqk= -github.com/coreos/go-oidc/v3 v3.14.1/go.mod h1:HaZ3szPaZ0e4r6ebqvsLWlk2Tn+aejfmrfah6hnSYEU= github.com/coreos/go-oidc/v3 v3.15.0 h1:R6Oz8Z4bqWR7VFQ+sPSvZPQv4x8M+sJkDO5ojgwlyAg= github.com/coreos/go-oidc/v3 v3.15.0/go.mod h1:HaZ3szPaZ0e4r6ebqvsLWlk2Tn+aejfmrfah6hnSYEU= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgraph-io/badger v1.6.2 h1:mNw0qs90GVgGGWylh0umH5iag1j6n/PeJtNvL6KY/x8= github.com/dgraph-io/badger v1.6.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrVH//y2UQE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= @@ -175,15 +147,11 @@ github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa5 github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= -github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ= github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/elastic/go-freelru v0.16.0 h1:gG2HJ1WXN2tNl5/p40JS/l59HjvjRhjyAa+oFTRArYs= -github.com/elastic/go-freelru v0.16.0/go.mod h1:bSdWT4M0lW79K8QbX6XY2heQYSCqD7THoYf82pT/H3I= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= @@ -192,41 +160,25 @@ github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiD github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= -github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-chi/chi/v5 v5.2.1 h1:KOIHODQj58PmL80G2Eak4WdvUzjSJSm0vG72crDCqb8= -github.com/go-chi/chi/v5 v5.2.1/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops= github.com/go-chi/chi/v5 v5.2.3 h1:WQIt9uxdsAbgIYgid+BpYc+liqQZGMHRaUwp0JUcvdE= github.com/go-chi/chi/v5 v5.2.3/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY= github.com/go-jose/go-jose/v3 v3.0.4/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ= -github.com/go-jose/go-jose/v4 v4.1.0 h1:cYSYxd3pw5zd2FSXk2vGdn9igQU2PS8MuxrCOCl0FdY= -github.com/go-jose/go-jose/v4 v4.1.0/go.mod h1:GG/vqmYm3Von2nYiB2vGTXzdoNKE5tix5tuc6iAd+sw= github.com/go-jose/go-jose/v4 v4.1.2 h1:TK/7NqRQZfgAh+Td8AlsrvtPoUyiHh0LqVvokh+1vHI= github.com/go-jose/go-jose/v4 v4.1.2/go.mod h1:22cg9HWM1pOlnRiY+9cQYJ9XHmya1bYW8OeDM6Ku6Oo= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-sql-driver/mysql v1.9.2 h1:4cNKDYQ1I84SXslGddlsrMhc8k4LeDVj6Ad6WRjiHuU= -github.com/go-sql-driver/mysql v1.9.2/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= -github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= -github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= -github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -239,15 +191,11 @@ github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/cel-go v0.25.0 h1:jsFw9Fhn+3y2kBbltZR4VEz5xKkcIFRPDnuEzAGv5GY= -github.com/google/cel-go v0.25.0/go.mod h1:hjEb6r5SuOSlhCHmFoLzu8HGCERvIsDAbxDAyNU/MmI= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ= github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= -github.com/google/certificate-transparency-go v1.1.8-0.20240110162603-74a5dd331745 h1:heyoXNxkRT155x4jTAiSv5BVSVkueifPUm+Q8LUXMRo= -github.com/google/certificate-transparency-go v1.1.8-0.20240110162603-74a5dd331745/go.mod h1:zN0wUQgV9LjwLZeFHnrAbQi8hzMVvEWePyk+MhPOk7k= github.com/google/certificate-transparency-go v1.3.2 h1:9ahSNZF2o7SYMaKaXhAumVEzXB2QaayzII9C8rv7v+A= github.com/google/certificate-transparency-go v1.3.2/go.mod h1:H5FpMUaGa5Ab2+KCYsxg6sELw3Flkl7pGZzWdBoYLXs= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -265,28 +213,19 @@ github.com/google/go-tspi v0.3.0 h1:ADtq8RKfP+jrTyIWIZDIYcKOMecRqNJFOew2IT0Inus= github.com/google/go-tspi v0.3.0/go.mod h1:xfMGI3G0PhxCdNVcYr1C4C+EizojDg/TXuX5by8CiHI= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20250501235452-c0086092b71a h1:rDA3FfmxwXR+BVKKdz55WwMJ1pD2hJQNW31d+l3mPk4= -github.com/google/pprof v0.0.0-20250501235452-c0086092b71a/go.mod h1:5hDyRhoBCxViHszMt12TnOpEI4VVi+U8Gm9iphldiMA= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 h1:EEHtgt9IwisQ2AZ4pIsMjahcegHh6rmhqxzIRQIyepY= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U= github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU9uHLo7OnF5tL52HFAgMmyrf4= github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA= -github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= -github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q= -github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA= github.com/googleapis/gax-go/v2 v2.15.0 h1:SyjDc1mGgZU5LncH8gimWo9lW1DtIfPibOG81vgd/bo= github.com/googleapis/gax-go/v2 v2.15.0/go.mod h1:zVVkkxAQHa1RQpg9z2AUCMnKhi0Qld9rcmyfL1OZhoc= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -297,10 +236,6 @@ github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/invopop/ctxi18n v0.9.0 h1:BIia4u4OngaHVn/7gvK0w6lccOXVtad8xU0KgJ+mnVA= -github.com/invopop/ctxi18n v0.9.0/go.mod h1:1Osw+JGYA+anHt0Z4reF36r5FtGHYjGQ+m1X7keIhPc= -github.com/invopop/yaml v0.3.1 h1:f0+ZpmhfBSS4MhG+4HYseMdJhoeeopbSKbq5Rpeelso= -github.com/invopop/yaml v0.3.1/go.mod h1:PMOp3nn4/12yEZUFfmOuNHJsZToEEOwoWsT+D81KkeA= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= @@ -317,8 +252,6 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= -github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= -github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -349,8 +282,6 @@ github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyex github.com/mholt/acmez/v3 v3.1.2 h1:auob8J/0FhmdClQicvJvuDavgd5ezwLBfKuYmynhYzc= github.com/mholt/acmez/v3 v3.1.2/go.mod h1:L1wOU06KKvq7tswuMDwKdcHeKpFFgkppZy/y0DFxagQ= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= -github.com/miekg/dns v1.1.66 h1:FeZXOS3VCVsKnEAd+wBkjMC3D2K+ww66Cq3VnCINuJE= -github.com/miekg/dns v1.1.66/go.mod h1:jGFzBsSNbJw6z1HYut1RKBKHA9PBdxeHrZG8J+gC2WE= github.com/miekg/dns v1.1.68 h1:jsSRkNozw7G/mnmXULynzMNIsgY2dHC8LO6U6Ij2JEA= github.com/miekg/dns v1.1.68/go.mod h1:fujopn7TB3Pu3JM69XaawiU0wqjpL9/8xGop5UrTPps= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -367,51 +298,36 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= -github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus= -github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8= -github.com/onsi/ginkgo/v2 v2.25.1 h1:Fwp6crTREKM+oA6Cz4MsO8RhKQzs2/gOIVOUscMAfZY= -github.com/onsi/ginkgo/v2 v2.25.1/go.mod h1:ppTWQ1dh9KM/F1XgpeRqelR+zHVwV81DGRSDnFxK7Sk= -github.com/onsi/gomega v1.36.3 h1:hID7cr8t3Wp26+cYnfcjR6HpJ00fdogN6dqZ1t6IylU= -github.com/onsi/gomega v1.36.3/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv/v3 v3.0.1 h1:x06SQA46+PKIUftmEujdwSEpIx8kR+M9eLYsUxeYveU= github.com/peterbourgon/diskv/v3 v3.0.1/go.mod h1:kJ5Ny7vLdARGU3WUuy6uzO6T0nb/2gWcT1JiBvRmb5o= -github.com/pires/go-proxyproto v0.7.1-0.20240628150027-b718e7ce4964 h1:ct/vxNBgHpASQ4sT8NaBX9LtsEtluZqaUJydLG50U3E= -github.com/pires/go-proxyproto v0.7.1-0.20240628150027-b718e7ce4964/go.mod h1:iknsfgnH8EkjrMeMyvfKByp9TiBZCKZM0jx2xmKqnVY= github.com/pires/go-proxyproto v0.8.1 h1:9KEixbdJfhrbtjpz/ZwCdWDD2Xem0NZ38qMYaASJgp0= github.com/pires/go-proxyproto v0.8.1/go.mod h1:ZKAAyp3cgy5Y5Mo4n9AlScrkCZwUy0g3Jf+slqQVcuU= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q= -github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0= github.com/prometheus/client_golang v1.23.0 h1:ust4zpdl9r4trLY/gSjlm07PuiBq2ynaXXlptpfy8Uc= github.com/prometheus/client_golang v1.23.0/go.mod h1:i/o0R9ByOnHX0McrTMTyhYvKE4haaf2mW08I+jGAjEE= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.64.0 h1:pdZeA+g617P7oGv1CzdTzyeShxAGrTBsolKNOLQPGO4= -github.com/prometheus/common v0.64.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE= github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= -github.com/quic-go/quic-go v0.52.0 h1:/SlHrCRElyaU6MaEPKqKr9z83sBg2v4FLLvWM+Z47pA= -github.com/quic-go/quic-go v0.52.0/go.mod h1:MFlGGpcpJqRAfmYi6NC2cptDPSxRWTOGNuP4wqrWmzQ= github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg= github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= @@ -453,22 +369,14 @@ github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5k github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/sjtug/cerberus v0.4.3 h1:uuPZPPvoeqZ42PB25JPSE1Y1DxCa/pH8WHQM99/futE= -github.com/sjtug/cerberus v0.4.3/go.mod h1:iSV+yngA5bZwn7jQ/pqJuM3VzE7ROIEf042RvxINoyo= -github.com/slackhq/nebula v1.9.5 h1:ZrxcvP/lxwFglaijmiwXLuCSkybZMJnqSYI1S8DtGnY= -github.com/slackhq/nebula v1.9.5/go.mod h1:1+4q4wd3dDAjO8rKCttSb9JIVbklQhuJiBp5I0lbIsQ= github.com/slackhq/nebula v1.9.6 h1:Fl0LE2dHDeVEK3R+un59Z3V4ZzbZ6q2e/zF4ClaD5yo= github.com/slackhq/nebula v1.9.6/go.mod h1:1+4q4wd3dDAjO8rKCttSb9JIVbklQhuJiBp5I0lbIsQ= github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262 h1:unQFBIznI+VYD1/1fApl1A+9VcBk+9dcqGfnePY87LY= github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262/go.mod h1:MyOHs9Po2fbM1LHej6sBUT8ozbxmMOFG+E+rx/GSGuc= -github.com/smallstep/certificates v0.28.3 h1:rcMh1TAs8m2emP3aDJxKLkE9jriAtcFtCuj2gttnpmI= -github.com/smallstep/certificates v0.28.3/go.mod h1:P/IjGTvRCem3YZ7d1XtUxpvK/8dfFsJn7gaVLpMXbJw= github.com/smallstep/certificates v0.28.4 h1:JTU6/A5Xes6m+OsR6fw1RACSA362vJc9SOFVG7poBEw= github.com/smallstep/certificates v0.28.4/go.mod h1:LUqo+7mKZE7FZldlTb0zhU4A0bq4G4+akieFMcTaWvA= github.com/smallstep/cli-utils v0.12.1 h1:D9QvfbFqiKq3snGZ2xDcXEFrdFJ1mQfPHZMq/leerpE= github.com/smallstep/cli-utils v0.12.1/go.mod h1:skV2Neg8qjiKPu2fphM89H9bIxNpKiiRTnX9Q6Lc+20= -github.com/smallstep/go-attestation v0.4.4-0.20240109183208-413678f90935 h1:kjYvkvS/Wdy0PVRDUAA0gGJIVSEZYhiAJtfwYgOYoGA= -github.com/smallstep/go-attestation v0.4.4-0.20240109183208-413678f90935/go.mod h1:vNAduivU014fubg6ewygkAvQC0IQVXqdc8vaGl/0er4= github.com/smallstep/go-attestation v0.4.4-0.20241119153605-2306d5b464ca h1:VX8L0r8vybH0bPeaIxh4NQzafKQiqvlOn8pmOXbFLO4= github.com/smallstep/go-attestation v0.4.4-0.20241119153605-2306d5b464ca/go.mod h1:vNAduivU014fubg6ewygkAvQC0IQVXqdc8vaGl/0er4= github.com/smallstep/linkedca v0.23.0 h1:5W/7EudlK1HcCIdZM68dJlZ7orqCCCyv6bm2l/0JmLU= @@ -488,8 +396,6 @@ github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0b github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.8.0 h1:gEN9K4b8Xws4EX0+a0reLmhq8moKn7ntRlQYgjPeCDk= -github.com/spf13/cast v1.8.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE= github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= @@ -497,13 +403,10 @@ github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M= github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= -github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs= github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -518,15 +421,12 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tailscale/tscert v0.0.0-20240608151842-d3f834017e53 h1:uxMgm0C+EjytfAqyfBG55ZONKQ7mvd7x4YYCWsf8QHQ= github.com/tailscale/tscert v0.0.0-20240608151842-d3f834017e53/go.mod h1:kNGUQ3VESx3VZwRwA9MSCUegIl6+saPL8Noq82ozCaU= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/urfave/cli v1.22.16 h1:MH0k6uJxdwdeWQTwhSO42Pwr4YLrNLwBtg1MRgTqPdQ= -github.com/urfave/cli v1.22.16/go.mod h1:EeJR6BKodywf4zciqrdw6hpCPk68JO9z5LazXZMn5Po= github.com/urfave/cli v1.22.17 h1:SYzXoiPfQjHBbkYxbew5prZHS1TOLT3ierW8SYLqtVQ= github.com/urfave/cli v1.22.17/go.mod h1:b0ht0aqgH/6pBYzzxURyrM4xXNgsoT/n2ZzwQiEhNVo= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= @@ -536,8 +436,6 @@ github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcY github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.4.15/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic= -github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark v1.7.13 h1:GPddIs617DnBLFFVJFgpo1aBfe/4xcvMc3SB5t/D0pA= github.com/yuin/goldmark v1.7.13/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc h1:+IAOyRda+RLrxa1WC7umKOZRsGq4QrFFMYApOeHzQwQ= @@ -548,81 +446,47 @@ github.com/zeebo/blake3 v0.2.4 h1:KYQPkhpRtcqh0ssGYcKLG1JYvddkEA8QwCM/yBqhaZI= github.com/zeebo/blake3 v0.2.4/go.mod h1:7eeQ6d2iXWRGF6npfaxl2CU+xy2Fjo2gxeyZGCRUjcE= github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo= github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= -github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= -github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk= -go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk= go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo= go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 h1:x7wzEgXfnzJcHDwStJT+mxOz4etr2EcexjqhBvmoakw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0/go.mod h1:rg+RlpR5dKwaS95IyyZqj5Wd4E13lk/msnTS0Xl9lJM= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 h1:sbiXRNDSWJOTobXh5HyQKjq6wUC5tNybqjIqDpAY4CU= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 h1:q4XOmH/0opmeuJtPsbFNivyl7bCt7yRBbeEm2sC/XtQ= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0/go.mod h1:snMWehoOh2wsEwnvvwtDyFCxVeDAODenXHtn5vzrKjo= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 h1:Hf9xI/XLML9ElpiHVDNwvqI0hIFlzV8dgIr35kV1kRU= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0/go.mod h1:NfchwuyNoMcZ5MLHwPrODwUF1HWCXWrL31s8gSAdIKY= -go.opentelemetry.io/contrib/propagators/autoprop v0.42.0 h1:s2RzYOAqHVgG23q8fPWYChobUoZM6rJZ98EnylJr66w= -go.opentelemetry.io/contrib/propagators/autoprop v0.42.0/go.mod h1:Mv/tWNtZn+NbALDb2XcItP0OM3lWWZjAfSroINxfW+Y= go.opentelemetry.io/contrib/propagators/autoprop v0.62.0 h1:1+EHlhAe/tukctfePZRrDruB9vn7MdwyC+rf36nUSPM= go.opentelemetry.io/contrib/propagators/autoprop v0.62.0/go.mod h1:skzESZBY3IYcqJgImc+fwXQWflvVe+jZxoA/uw60NaI= -go.opentelemetry.io/contrib/propagators/aws v1.17.0 h1:IX8d7l2uRw61BlmZBOTQFaK+y22j6vytMVTs9wFrO+c= -go.opentelemetry.io/contrib/propagators/aws v1.17.0/go.mod h1:pAlCYRWff4uGqRXOVn3WP8pDZ5E0K56bEoG7a1VSL4k= go.opentelemetry.io/contrib/propagators/aws v1.37.0 h1:cp8AFiM/qjBm10C/ATIRnEDXpD5MBknrA0ANw4T2/ss= go.opentelemetry.io/contrib/propagators/aws v1.37.0/go.mod h1:Cy8Hk2E2iSGEbsLnPUdeigrexaAOAGIAmBFK919EQs0= -go.opentelemetry.io/contrib/propagators/b3 v1.17.0 h1:ImOVvHnku8jijXqkwCSyYKRDt2YrnGXD4BbhcpfbfJo= -go.opentelemetry.io/contrib/propagators/b3 v1.17.0/go.mod h1:IkfUfMpKWmynvvE0264trz0sf32NRTZL4nuAN9AbWRc= go.opentelemetry.io/contrib/propagators/b3 v1.37.0 h1:0aGKdIuVhy5l4GClAjl72ntkZJhijf2wg1S7b5oLoYA= go.opentelemetry.io/contrib/propagators/b3 v1.37.0/go.mod h1:nhyrxEJEOQdwR15zXrCKI6+cJK60PXAkJ/jRyfhr2mg= -go.opentelemetry.io/contrib/propagators/jaeger v1.17.0 h1:Zbpbmwav32Ea5jSotpmkWEl3a6Xvd4tw/3xxGO1i05Y= -go.opentelemetry.io/contrib/propagators/jaeger v1.17.0/go.mod h1:tcTUAlmO8nuInPDSBVfG+CP6Mzjy5+gNV4mPxMbL0IA= go.opentelemetry.io/contrib/propagators/jaeger v1.37.0 h1:pW+qDVo0jB0rLsNeaP85xLuz20cvsECUcN7TE+D8YTM= go.opentelemetry.io/contrib/propagators/jaeger v1.37.0/go.mod h1:x7bd+t034hxLTve1hF9Yn9qQJlO/pP8H5pWIt7+gsFM= -go.opentelemetry.io/contrib/propagators/ot v1.17.0 h1:ufo2Vsz8l76eI47jFjuVyjyB3Ae2DmfiCV/o6Vc8ii0= -go.opentelemetry.io/contrib/propagators/ot v1.17.0/go.mod h1:SbKPj5XGp8K/sGm05XblaIABgMgw2jDczP8gGeuaVLk= go.opentelemetry.io/contrib/propagators/ot v1.37.0 h1:tVjnBF6EiTDMXoq2Xuc2vK0I7MTbEs05II/0j9mMK+E= go.opentelemetry.io/contrib/propagators/ot v1.37.0/go.mod h1:MQjyNXtxAC8PGN9gzPtO4GY5zuP+RI3XX53uWbCTvEQ= -go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ= -go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y= go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 h1:Ahq7pZmv87yiyn3jeFz/LekZmPLLdKejuO3NcK9MssM= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0/go.mod h1:MJTqhM0im3mRLw1i8uGHnCvUEeS7VwRyxlLC78PA18M= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0/go.mod h1:TMu73/k1CP8nBUpDLc71Wj/Kf7ZS9FK5b53VapRsP9o= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 h1:EtFWSnwW9hGObjkIdmlnWSydO+Qs8OwzfzXLUPg4xOc= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0/go.mod h1:QjUEoiGCPkvFZ/MjK6ZZfNOS6mfVEVKYE99dFhuN2LI= -go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M= -go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE= go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= -go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= -go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o= -go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w= -go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs= -go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc= +go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc= +go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps= go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= -go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= -go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= -go.step.sm/crypto v0.64.0 h1:tZ2k9Am6v3Y7cZCn89uTt77BYYXqvw+5WekUX3WZiXQ= -go.step.sm/crypto v0.64.0/go.mod h1:EEY+UgKKqsvydv4mvtSpW2fqu2ezvPcAzkC80DwxmrI= go.step.sm/crypto v0.70.0 h1:Q9Ft7N637mucyZcHZd1+0VVQJVwDCKqcb9CYcYi7cds= go.step.sm/crypto v0.70.0/go.mod h1:pzfUhS5/ue7ev64PLlEgXvhx1opwbhFCjkvlhsxVds0= go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko= -go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o= go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -642,17 +506,11 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= -golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= -golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= -golang.org/x/crypto/x509roots/fallback v0.0.0-20250515174705-ebc8e4631531 h1:uEZjxClB4DwZIRL2pFsPPv0Y1rBtHvoqDVg96PJf30Y= -golang.org/x/crypto/x509roots/fallback v0.0.0-20250515174705-ebc8e4631531/go.mod h1:lxN5T34bK4Z/i6cMaU7frUU57VkDXFD4Kamfl/cp9oU= golang.org/x/crypto/x509roots/fallback v0.0.0-20250826074233-8f580defa01d h1:earVicuMOnaYH+t9T1PeRhC0LHHPGXXTDD7NEEP/Pb4= golang.org/x/crypto/x509roots/fallback v0.0.0-20250826074233-8f580defa01d/go.mod h1:MEIPiCnxvQEjA4astfaKItNwEVZA5Ki+3+nyGbJ5N18= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI= -golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ= golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b h1:DXr+pvt3nC887026GRP39Ej11UATqWDmWuS99x26cD0= golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -663,8 +521,6 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= -golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -683,8 +539,6 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= -golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -705,8 +559,6 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= -golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -731,8 +583,6 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= -golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= @@ -744,8 +594,6 @@ golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= -golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= -golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -758,14 +606,10 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= -golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= -golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= -golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -778,16 +622,14 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= -golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= -google.golang.org/api v0.232.0 h1:qGnmaIMf7KcuwHOlF3mERVzChloDYwRfOJOrHt8YC3I= -google.golang.org/api v0.232.0/go.mod h1:p9QCfBWZk1IJETUdbTKloR5ToFdKbYh2fkjsUL6vNoY= google.golang.org/api v0.248.0 h1:hUotakSkcwGdYUqzCRc5yGYsg4wXxpkKlW5ryVqvC1Y= google.golang.org/api v0.248.0/go.mod h1:yAFUAF56Li7IuIQbTFoLwXTCI6XCFKueOlS7S9e4F9k= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -799,28 +641,20 @@ google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb h1:ITgPrl429bc6+2ZraNSzMDk3I95nmQln2fuPstKwFDE= -google.golang.org/genproto v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:sAo5UzpjUwgFBCzupwhcLcxHVDK7vG5IqI30YnwX2eE= -google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237 h1:Kog3KlB4xevJlAcbbbzPfRG0+X9fdoGM+UBRKVz6Wr0= -google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237/go.mod h1:ezi0AVyMKDWy5xAncvjLWH7UcLBB5n7y2fQ8MzjJcto= +google.golang.org/genproto v0.0.0-20250603155806-513f23925822 h1:rHWScKit0gvAPuOnu87KpaYtjK5zBMLcULh7gxkCXu4= +google.golang.org/genproto v0.0.0-20250603155806-513f23925822/go.mod h1:HubltRL7rMh0LfnQPkMH4NPDFEWp0jw3vixw7jEM53s= google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1 h1:APHvLLYBhtZvsbnpkfknDZ7NyH4z5+ub/I0u8L3Oz6g= google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1/go.mod h1:xUjFWUnWDpZ/C0Gu0qloASKFb6f8/QXiiXhSPFsD668= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 h1:cJfm9zPbe1e873mHJzmQ1nwVEeRDU/T1wXDK2kUSU34= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1 h1:pmJpJEvT846VzausCQ5d7KreSROcDqmO388w5YbnltA= google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA= -google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4= google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA= -google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -843,7 +677,5 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM= howett.net/plist v1.0.1/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= -pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk= -pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= @@ -5,7 +5,6 @@ import ( _ "github.com/aksdb/caddy-cgi/v2" _ "github.com/caddyserver/caddy/v2/modules/standard" - _ "github.com/sjtug/cerberus" ) func main() { diff --git a/vendor/github.com/a-h/templ/.dockerignore b/vendor/github.com/a-h/templ/.dockerignore deleted file mode 100644 index 17896fe..0000000 --- a/vendor/github.com/a-h/templ/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -.git -Dockerfile -.dockerignore diff --git a/vendor/github.com/a-h/templ/.envrc b/vendor/github.com/a-h/templ/.envrc deleted file mode 100644 index 8392d15..0000000 --- a/vendor/github.com/a-h/templ/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake
\ No newline at end of file diff --git a/vendor/github.com/a-h/templ/.gitignore b/vendor/github.com/a-h/templ/.gitignore deleted file mode 100644 index 8318e77..0000000 --- a/vendor/github.com/a-h/templ/.gitignore +++ /dev/null @@ -1,36 +0,0 @@ -# Output. -cmd/templ/templ - -# Logs. -cmd/templ/lspcmd/*log.txt - -# Go code coverage. -coverage.out -coverage - -# Mac filesystem jank. -.DS_Store - -# Docusaurus. -docs/build/ -docs/resources/_gen/ -node_modules/ -dist/ - -# Nix artifacts. -result - -# Editors -## nvim -.null-ls* -# vscode -.vscode/ - -# Go workspace. -go.work - -# direnv -.direnv - -# templ txt files. -*_templ.txt diff --git a/vendor/github.com/a-h/templ/.goreleaser.yaml b/vendor/github.com/a-h/templ/.goreleaser.yaml deleted file mode 100644 index 456187c..0000000 --- a/vendor/github.com/a-h/templ/.goreleaser.yaml +++ /dev/null @@ -1,72 +0,0 @@ -builds: - - env: - - CGO_ENABLED=0 - dir: cmd/templ - mod_timestamp: '{{ .CommitTimestamp }}' - flags: - - -trimpath - ldflags: - - -s -w - goos: - - linux - - windows - - darwin - -checksum: - name_template: 'checksums.txt' - -signs: - - id: checksums - cmd: cosign - stdin: '{{ .Env.COSIGN_PASSWORD }}' - output: true - artifacts: checksum - args: - - sign-blob - - --yes - - --key - - env://COSIGN_PRIVATE_KEY - - '--output-certificate=${certificate}' - - '--output-signature=${signature}' - - '${artifact}' - -archives: - - format: tar.gz - name_template: >- - {{ .ProjectName }}_ - {{- title .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 - {{- else if eq .Arch "386" }}i386 - {{- else }}{{ .Arch }}{{ end }} - {{- if .Arm }}v{{ .Arm }}{{ end }} - -kos: - - repository: ghcr.io/a-h/templ - platforms: - - linux/amd64 - - linux/arm64 - tags: - - latest - - '{{.Tag}}' - bare: true - -docker_signs: - - cmd: cosign - artifacts: all - output: true - args: - - sign - - --yes - - --key - - env://COSIGN_PRIVATE_KEY - - '${artifact}' - -snapshot: - name_template: "{{ incpatch .Version }}-next" - -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' diff --git a/vendor/github.com/a-h/templ/.ignore b/vendor/github.com/a-h/templ/.ignore deleted file mode 100644 index 9377535..0000000 --- a/vendor/github.com/a-h/templ/.ignore +++ /dev/null @@ -1,9 +0,0 @@ -*_templ.go -examples/integration-ct/static/index.js -examples/counter/assets/css/bulma.* -examples/counter/assets/js/htmx.min.js -examples/counter-basic/assets/css/bulma.* -examples/typescript/assets/index.js -package-lock.json -go.sum -docs/static/llms.md diff --git a/vendor/github.com/a-h/templ/.version b/vendor/github.com/a-h/templ/.version deleted file mode 100644 index 83f1712..0000000 --- a/vendor/github.com/a-h/templ/.version +++ /dev/null @@ -1 +0,0 @@ -0.3.943
\ No newline at end of file diff --git a/vendor/github.com/a-h/templ/CODE_OF_CONDUCT.md b/vendor/github.com/a-h/templ/CODE_OF_CONDUCT.md deleted file mode 100644 index 08340d3..0000000 --- a/vendor/github.com/a-h/templ/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,128 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, religion, or sexual identity -and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the - overall community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or - advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email - address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces, and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account, or acting as an appointed -representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -adrianhesketh@hushail.com. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series -of actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or -permanent ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any sort of interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any sort of public interaction within -the community. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 2.0, available at -https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. - -Community Impact Guidelines were inspired by [Mozilla's code of conduct -enforcement ladder](https://github.com/mozilla/diversity). - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see the FAQ at -https://www.contributor-covenant.org/faq. Translations are available at -https://www.contributor-covenant.org/translations. diff --git a/vendor/github.com/a-h/templ/CONTRIBUTING.md b/vendor/github.com/a-h/templ/CONTRIBUTING.md deleted file mode 100644 index 2726471..0000000 --- a/vendor/github.com/a-h/templ/CONTRIBUTING.md +++ /dev/null @@ -1,247 +0,0 @@ -# Contributing to templ - -## Vision - -Enable Go developers to build strongly typed, component-based HTML user interfaces with first-class developer tooling, and a short learning curve. - -## Come up with a design and share it - -Before starting work on any major pull requests or code changes, start a discussion at https://github.com/a-h/templ/discussions or raise an issue. - -We don't want you to spend time on a PR or feature that ultimately doesn't get merged because it doesn't fit with the project goals, or the design doesn't work for some reason. - -For issues, it really helps if you provide a reproduction repo, or can create a failing unit test to describe the behaviour. - -In designs, we need to consider: - -* Backwards compatibility - Not changing the public API between releases, introducing gradual deprecation - don't break people's code. -* Correctness over time - How can we reduce the risk of defects both now, and in future releases? -* Threat model - How could each change be used to inject vulnerabilities into web pages? -* Go version - We target the oldest supported version of Go as per https://go.dev/doc/devel/release -* Automatic migration - If we need to force through a change. -* Compile time vs runtime errors - Prefer compile time. -* Documentation - New features are only useful if people can understand the new feature, what would the documentation look like? -* Examples - How will we demonstrate the feature? - -## Project structure - -templ is structured into a few areas: - -### Parser `./parser` - -The parser directory currently contains both v1 and v2 parsers. - -The v1 parser is not maintained, it's only used to migrate v1 code over to the v2 syntax. - -The parser is responsible for parsing templ files into an object model. The types that make up the object model are in `types.go`. Automatic formatting of the types is tested in `types_test.go`. - -A templ file is parsed into the `TemplateFile` struct object model. - -```go -type TemplateFile struct { - // Header contains comments or whitespace at the top of the file. - Header []GoExpression - // Package expression. - Package Package - // Nodes in the file. - Nodes []TemplateFileNode -} -``` - -Parsers are individually tested using two types of unit test. - -One test covers the successful parsing of text into an object. For example, the `HTMLCommentParser` test checks for successful patterns. - -```go -func TestHTMLCommentParser(t *testing.T) { - var tests = []struct { - name string - input string - expected HTMLComment - }{ - { - name: "comment - single line", - input: `<!-- single line comment -->`, - expected: HTMLComment{ - Contents: " single line comment ", - }, - }, - { - name: "comment - no whitespace", - input: `<!--no whitespace between sequence open and close-->`, - expected: HTMLComment{ - Contents: "no whitespace between sequence open and close", - }, - }, - { - name: "comment - multiline", - input: `<!-- multiline - comment - -->`, - expected: HTMLComment{ - Contents: ` multiline - comment - `, - }, - }, - { - name: "comment - with tag", - input: `<!-- <p class="test">tag</p> -->`, - expected: HTMLComment{ - Contents: ` <p class="test">tag</p> `, - }, - }, - { - name: "comments can contain tags", - input: `<!-- <div> hello world </div> -->`, - expected: HTMLComment{ - Contents: ` <div> hello world </div> `, - }, - }, - } - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - input := parse.NewInput(tt.input) - result, ok, err := htmlComment.Parse(input) - if err != nil { - t.Fatalf("parser error: %v", err) - } - if !ok { - t.Fatalf("failed to parse at %d", input.Index()) - } - if diff := cmp.Diff(tt.expected, result); diff != "" { - t.Errorf(diff) - } - }) - } -} -``` - -Alongside each success test, is a similar test to check that invalid syntax is detected. - -```go -func TestHTMLCommentParserErrors(t *testing.T) { - var tests = []struct { - name string - input string - expected error - }{ - { - name: "unclosed HTML comment", - input: `<!-- unclosed HTML comment`, - expected: parse.Error("expected end comment literal '-->' not found", - parse.Position{ - Index: 26, - Line: 0, - Col: 26, - }), - }, - { - name: "comment in comment", - input: `<!-- <-- other --> -->`, - expected: parse.Error("comment contains invalid sequence '--'", parse.Position{ - Index: 8, - Line: 0, - Col: 8, - }), - }, - } - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - input := parse.NewInput(tt.input) - _, _, err := htmlComment.Parse(input) - if diff := cmp.Diff(tt.expected, err); diff != "" { - t.Error(diff) - } - }) - } -} -``` - -### Generator - -The generator takes the object model and writes out Go code that produces the expected output. Any changes to Go code output by templ are made in this area. - -Testing of the generator is carried out by creating a templ file, and a matching expected output file. - -For example, `./generator/test-a-href` contains a templ file of: - -```templ -package testahref - -templ render() { - <a href="javascript:alert('unaffected');">Ignored</a> - <a href={ templ.URL("javascript:alert('should be sanitized')") }>Sanitized</a> - <a href={ templ.SafeURL("javascript:alert('should not be sanitized')") }>Unsanitized</a> -} -``` - -It also contains an expected output file. - -```html -<a href="javascript:alert('unaffected');">Ignored</a> -<a href="about:invalid#TemplFailedSanitizationURL">Sanitized</a> -<a href="javascript:alert('should not be sanitized')">Unsanitized</a> -``` - -These tests contribute towards the code coverage metrics by building an instrumented test CLI program. See the `test-cover` task in the `README.md` file. - -### CLI - -The command line interface for templ is used to generate Go code from templ files, format templ files, and run the LSP. - -The code for this is at `./cmd/templ`. - -Testing of the templ command line is done with unit tests to check the argument parsing. - -The `templ generate` command is tested by generating templ files in the project, and testing that the expected output HTML is present. - -### Runtime - -The runtime is used by generated code, and by template authors, to serve template content over HTTP, and to carry out various operations. - -It is in the root directory of the project at `./runtime.go`. The runtime is unit tested, as well as being tested as part of the `generate` tests. - -### LSP - -The LSP is structured within the command line interface, and proxies commands through to the `gopls` LSP. - -### Docs - -The docs are a Docusaurus project at `./docs`. - -## Coding - -### Build tasks - -templ uses the `xc` task runner - https://github.com/joerdav/xc - -If you run `xc` you can get see a list of the development tasks that can be run, or you can read the `README.md` file and see the `Tasks` section. - -The most useful tasks for local development are: - -* `install-snapshot` - this builds the templ CLI and installs it into `~/bin`. Ensure that this is in your path. -* `test` - this regenerates all templates, and runs the unit tests. -* `fmt` - run the `gofmt` tool to format all Go code. -* `lint` - run the same linting as run in the CI process. -* `docs-run` - run the Docusaurus documentation site. - -### Commit messages - -The project using https://www.conventionalcommits.org/en/v1.0.0/ - -Examples: - -* `feat: support Go comments in templates, fixes #234"` - -### Coding style - -* Reduce nesting - i.e. prefer early returns over an `else` block, as per https://danp.net/posts/reducing-go-nesting/ or https://go.dev/doc/effective_go#if -* Use line breaks to separate "paragraphs" of code - don't use line breaks in between lines, or at the start/end of functions etc. -* Use the `fmt` and `lint` build tasks to format and lint your code before submitting a PR. - -### LLM instructions - -See additional coding standards at `.github/copilot-instructions.md` diff --git a/vendor/github.com/a-h/templ/LICENSE b/vendor/github.com/a-h/templ/LICENSE deleted file mode 100644 index 15e6fb8..0000000 --- a/vendor/github.com/a-h/templ/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 Adrian Hesketh - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/a-h/templ/README.md b/vendor/github.com/a-h/templ/README.md deleted file mode 100644 index 9bb25e6..0000000 --- a/vendor/github.com/a-h/templ/README.md +++ /dev/null @@ -1,194 +0,0 @@ - - -## An HTML templating language for Go that has great developer tooling. - - - - -## Documentation - -See user documentation at https://templ.guide - -<p align="center"> -<a href="https://pkg.go.dev/github.com/a-h/templ"><img src="https://pkg.go.dev/badge/github.com/a-h/templ.svg" alt="Go Reference" /></a> -<a href="https://xcfile.dev"><img src="https://xcfile.dev/badge.svg" alt="xc compatible" /></a> -<a href="https://raw.githack.com/wiki/a-h/templ/coverage.html"><img src="https://github.com/a-h/templ/wiki/coverage.svg" alt="Go Coverage" /></a> -<a href="https://goreportcard.com/report/github.com/a-h/templ"><img src="https://goreportcard.com/badge/github.com/a-h/templ" alt="Go Report Card" /></a> -</p> - -## Tasks - -### version-set - -Set the version of templ to the current version. - -```sh -version set --template="0.3.%d" -``` - -### build - -Build a local version. - -```sh -version set --template="0.3.%d" -cd cmd/templ -go build -``` - -### install-snapshot - -Build and install current version. - -```sh -# Remove templ from the non-standard ~/bin/templ path -# that this command previously used. -rm -f ~/bin/templ -# Clear LSP logs. -rm -f cmd/templ/lspcmd/*.txt -# Update version. -version set --template="0.3.%d" -# Install to $GOPATH/bin or $HOME/go/bin -cd cmd/templ && go install -``` - -### build-snapshot - -Use goreleaser to build the command line binary using goreleaser. - -```sh -goreleaser build --snapshot --clean -``` - -### generate - -Run templ generate using local version. - -```sh -go run ./cmd/templ generate -include-version=false -``` - -### test - -Run Go tests. - -```sh -version set --template="0.3.%d" -go run ./cmd/templ generate -include-version=false -go test ./... -``` - -### test-short - -Run Go tests. - -```sh -version set --template="0.3.%d" -go run ./cmd/templ generate -include-version=false -go test ./... -short -``` - -### test-cover - -Run Go tests. - -```sh -# Create test profile directories. -mkdir -p coverage/fmt -mkdir -p coverage/generate -mkdir -p coverage/version -mkdir -p coverage/unit -# Build the test binary. -go build -cover -o ./coverage/templ-cover ./cmd/templ -# Run the covered generate command. -GOCOVERDIR=coverage/fmt ./coverage/templ-cover fmt . -GOCOVERDIR=coverage/generate ./coverage/templ-cover generate -include-version=false -GOCOVERDIR=coverage/version ./coverage/templ-cover version -# Run the unit tests. -go test -cover ./... -coverpkg ./... -args -test.gocoverdir="$PWD/coverage/unit" -# Display the combined percentage. -go tool covdata percent -i=./coverage/fmt,./coverage/generate,./coverage/version,./coverage/unit -# Generate a text coverage profile for tooling to use. -go tool covdata textfmt -i=./coverage/fmt,./coverage/generate,./coverage/version,./coverage/unit -o coverage.out -# Print total -go tool cover -func coverage.out | grep total -``` - -### test-cover-watch - -interactive: true - -```sh -gotestsum --watch -- -coverprofile=coverage.out -``` - -### test-fuzz - -```sh -./parser/v2/fuzz.sh -./parser/v2/goexpression/fuzz.sh -``` - -### benchmark - -Run benchmarks. - -```sh -go run ./cmd/templ generate -include-version=false && go test ./... -bench=. -benchmem -``` - -### fmt - -Format all Go and templ code. - -```sh -gofmt -s -w . -go run ./cmd/templ fmt . -``` - -### lint - -Run the lint operations that are run as part of the CI. - -```sh -golangci-lint run --verbose -``` - -### ensure-generated - -Ensure that templ files have been generated with the local version of templ, and that those files have been added to git. - -Requires: generate - -```sh -git diff --exit-code -``` - -### push-release-tag - -Push a semantic version number to GitHub to trigger the release process. - -```sh -version push --template="0.3.%d" --prefix="v" -``` - -### docs-run - -Run the development server. - -Directory: docs - -```sh -npm run start -``` - -### docs-build - -Build production docs site. - -Directory: docs - -```sh -npm run build -``` - diff --git a/vendor/github.com/a-h/templ/SECURITY.md b/vendor/github.com/a-h/templ/SECURITY.md deleted file mode 100644 index e8c820e..0000000 --- a/vendor/github.com/a-h/templ/SECURITY.md +++ /dev/null @@ -1,9 +0,0 @@ -# Security Policy - -## Supported Versions - -The latest version of templ is supported. - -## Reporting a Vulnerability - -Use the "Security" tab in GitHub and fill out the "Report a vulnerability" form. diff --git a/vendor/github.com/a-h/templ/cosign.pub b/vendor/github.com/a-h/templ/cosign.pub deleted file mode 100644 index 9d7967b..0000000 --- a/vendor/github.com/a-h/templ/cosign.pub +++ /dev/null @@ -1,4 +0,0 @@ ------BEGIN PUBLIC KEY----- -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEqHp75uAj8XqKrLO2YvY0M2EddckH -evQnNAj+0GmBptqdf3NJcUCjL6w4z2Ikh/Zb8lh6b13akAwO/dJQaMLoMA== ------END PUBLIC KEY----- diff --git a/vendor/github.com/a-h/templ/flake.lock b/vendor/github.com/a-h/templ/flake.lock deleted file mode 100644 index 10dde36..0000000 --- a/vendor/github.com/a-h/templ/flake.lock +++ /dev/null @@ -1,124 +0,0 @@ -{ - "nodes": { - "flake-utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1754937576, - "narHash": "sha256-3sWA5WJybUE16kIMZ3+uxcxKZY/JRR4DFBqLdSLBo7w=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ddae11e58c0c345bf66efbddbf2192ed0e58f896", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-25.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1755027561, - "narHash": "sha256-IVft239Bc8p8Dtvf7UAACMG5P3ZV+3/aO28gXpGtMXI=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "005433b926e16227259a1843015b5b2b7f7d1fc3", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "gitignore": "gitignore", - "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable", - "version": "version", - "xc": "xc" - } - }, - "version": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1749991223, - "narHash": "sha256-K6OM2m+Bdkbq7MvTIwI1t0aPIwmkLUDeUfev5VHpiwg=", - "owner": "a-h", - "repo": "version", - "rev": "da721166410c6e7e2bea37cf3dee3948b5d0c83f", - "type": "github" - }, - "original": { - "owner": "a-h", - "ref": "0.0.10", - "repo": "version", - "type": "github" - } - }, - "xc": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1737995220, - "narHash": "sha256-1BTm0vPG6H7Xb6aGzA+v0Bv6+ONZm/kOebI4iKoZkSE=", - "owner": "joerdav", - "repo": "xc", - "rev": "85ad0fa8b705f290b050d93ae6be65d994d15528", - "type": "github" - }, - "original": { - "owner": "joerdav", - "repo": "xc", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/vendor/github.com/a-h/templ/flake.nix b/vendor/github.com/a-h/templ/flake.nix deleted file mode 100644 index 1c18f12..0000000 --- a/vendor/github.com/a-h/templ/flake.nix +++ /dev/null @@ -1,104 +0,0 @@ -{ - description = "templ"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; - nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; - gitignore = { - url = "github:hercules-ci/gitignore.nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - version = { - url = "github:a-h/version/0.0.10"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - xc = { - url = "github:joerdav/xc"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; - - outputs = { self, nixpkgs, nixpkgs-unstable, gitignore, version, xc }: - let - allSystems = [ - "x86_64-linux" # 64-bit Intel/AMD Linux - "aarch64-linux" # 64-bit ARM Linux - "x86_64-darwin" # 64-bit Intel macOS - "aarch64-darwin" # 64-bit ARM macOS - ]; - forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f { - inherit system; - pkgs = - let - pkgs-unstable = import nixpkgs-unstable { inherit system; }; - in - import nixpkgs { - inherit system; - overlays = [ - (final: prev: { - gopls = pkgs-unstable.gopls; - version = version.packages.${system}.default; # Used to apply version numbers to the repo. - xc = xc.packages.${system}.xc; - }) - ]; - }; - }); - in - { - packages = forAllSystems ({ pkgs, ... }: - rec { - default = templ; - - templ = pkgs.buildGo124Module { - name = "templ"; - subPackages = [ "cmd/templ" ]; - src = gitignore.lib.gitignoreSource ./.; - vendorHash = "sha256-pVZjZCXT/xhBCMyZdR7kEmB9jqhTwRISFp63bQf6w5A="; - env = { - CGO_ENABLED = 0; - }; - flags = [ - "-trimpath" - ]; - ldflags = [ - "-s" - "-w" - "-extldflags -static" - ]; - }; - }); - - # `nix develop` provides a shell containing development tools. - devShell = forAllSystems ({ pkgs, ... }: - pkgs.mkShell { - buildInputs = [ - pkgs.golangci-lint - pkgs.cosign # Used to sign container images. - pkgs.esbuild # Used to package JS examples. - pkgs.go - pkgs.gopls - pkgs.goreleaser - pkgs.gotestsum - pkgs.ko # Used to build Docker images. - pkgs.nodejs # Used to build templ-docs. - pkgs.nodePackages.prettier # Used for formatting JS and CSS. - pkgs.version - pkgs.xc - ]; - }); - - # This flake outputs an overlay that can be used to add templ and - # templ-docs to nixpkgs as per https://templ.guide/quick-start/installation/#nix - # - # Example usage: - # - # nixpkgs.overlays = [ - # inputs.templ.overlays.default - # ]; - overlays.default = final: prev: { - templ = self.packages.${final.stdenv.system}.templ; - templ-docs = self.packages.${final.stdenv.system}.templ-docs; - }; - }; -} - diff --git a/vendor/github.com/a-h/templ/flush.go b/vendor/github.com/a-h/templ/flush.go deleted file mode 100644 index 56d7d3a..0000000 --- a/vendor/github.com/a-h/templ/flush.go +++ /dev/null @@ -1,36 +0,0 @@ -package templ - -import ( - "context" - "io" -) - -// Flush flushes the output buffer after all its child components have been rendered. -func Flush() FlushComponent { - return FlushComponent{} -} - -type FlushComponent struct { -} - -type flusherError interface { - Flush() error -} - -type flusher interface { - Flush() -} - -func (f FlushComponent) Render(ctx context.Context, w io.Writer) (err error) { - if err = GetChildren(ctx).Render(ctx, w); err != nil { - return err - } - switch w := w.(type) { - case flusher: - w.Flush() - return nil - case flusherError: - return w.Flush() - } - return nil -} diff --git a/vendor/github.com/a-h/templ/fragment.go b/vendor/github.com/a-h/templ/fragment.go deleted file mode 100644 index 0b8624d..0000000 --- a/vendor/github.com/a-h/templ/fragment.go +++ /dev/null @@ -1,70 +0,0 @@ -package templ - -import ( - "context" - "io" - "slices" -) - -// RenderFragments renders the specified fragments to w. -func RenderFragments(ctx context.Context, w io.Writer, c Component, ids ...any) error { - ctx = context.WithValue(ctx, fragmentContextKey, &FragmentContext{ - W: w, - IDs: ids, - }) - return c.Render(ctx, io.Discard) -} - -type fragmentContextKeyType int - -const fragmentContextKey fragmentContextKeyType = iota - -// FragmentContext is used to control rendering of fragments within a template. -type FragmentContext struct { - W io.Writer - IDs []any - Active bool -} - -// Fragment defines a fragment within a template that can be rendered conditionally based on the id. -// You can use it to render a specific part of a page, e.g. to reduce the amount of HTML returned from a HTMX-initiated request. -// Any non-matching contents of the template are rendered, but discarded by the FramentWriter. -func Fragment(id any) Component { - return &fragment{ - ID: id, - } -} - -type fragment struct { - ID any -} - -func (f *fragment) Render(ctx context.Context, w io.Writer) (err error) { - // If not in a fragment context, if we're a child fragment, or in a mismatching fragment context, render children normally. - fragmentCtx := getFragmentContext(ctx) - if fragmentCtx == nil || fragmentCtx.Active || !slices.Contains(fragmentCtx.IDs, f.ID) { - return GetChildren(ctx).Render(ctx, w) - } - - // Instruct child fragments to render their contents normally, because the writer - // passed to them is already the FragmentContext's writer. - fragmentCtx.Active = true - defer func() { - fragmentCtx.Active = false - }() - return GetChildren(ctx).Render(ctx, fragmentCtx.W) -} - -// getFragmentContext retrieves the FragmentContext from the provided context. It returns nil if no -// FragmentContext is found or if the context value is of an unexpected type. -func getFragmentContext(ctx context.Context) *FragmentContext { - ctxValue := ctx.Value(fragmentContextKey) - if ctxValue == nil { - return nil - } - v, ok := ctxValue.(*FragmentContext) - if !ok { - return nil - } - return v -} diff --git a/vendor/github.com/a-h/templ/handler.go b/vendor/github.com/a-h/templ/handler.go deleted file mode 100644 index ae1552b..0000000 --- a/vendor/github.com/a-h/templ/handler.go +++ /dev/null @@ -1,163 +0,0 @@ -package templ - -import ( - "net/http" -) - -// ComponentHandler is a http.Handler that renders components. -type ComponentHandler struct { - Component Component - Status int - ContentType string - ErrorHandler func(r *http.Request, err error) http.Handler - StreamResponse bool - FragmentIDs []any -} - -const componentHandlerErrorMessage = "templ: failed to render template" - -func (ch *ComponentHandler) handleRenderErr(w http.ResponseWriter, r *http.Request, err error) { - if ch.ErrorHandler != nil { - w.Header().Set("Content-Type", ch.ContentType) - ch.ErrorHandler(r, err).ServeHTTP(w, r) - return - } - http.Error(w, componentHandlerErrorMessage, http.StatusInternalServerError) -} - -func (ch *ComponentHandler) ServeHTTPBufferedFragment(w http.ResponseWriter, r *http.Request) { - // Since the component may error, write to a buffer first. - // This prevents partial responses from being written to the client. - buf := GetBuffer() - defer ReleaseBuffer(buf) - - // Render the component into io.Discard, but use the buffer for fragments. - if err := RenderFragments(r.Context(), buf, ch.Component, ch.FragmentIDs...); err != nil { - ch.handleRenderErr(w, r, err) - return - } - - // The component rendered successfully, we can write the Content-Type and Status. - w.Header().Set("Content-Type", ch.ContentType) - if ch.Status != 0 { - w.WriteHeader(ch.Status) - } - // Ignore write error like http.Error() does, because there is - // no way to recover at this point. - _, _ = w.Write(buf.Bytes()) -} - -func (ch *ComponentHandler) ServeHTTPBufferedComplete(w http.ResponseWriter, r *http.Request) { - // Since the component may error, write to a buffer first. - // This prevents partial responses from being written to the client. - buf := GetBuffer() - defer ReleaseBuffer(buf) - - // Render the component into the buffer. - if err := ch.Component.Render(r.Context(), buf); err != nil { - ch.handleRenderErr(w, r, err) - return - } - - // The component rendered successfully, we can write the Content-Type and Status. - w.Header().Set("Content-Type", ch.ContentType) - if ch.Status != 0 { - w.WriteHeader(ch.Status) - } - // Ignore write error like http.Error() does, because there is - // no way to recover at this point. - _, _ = w.Write(buf.Bytes()) -} - -func (ch *ComponentHandler) ServeHTTPBuffered(w http.ResponseWriter, r *http.Request) { - // If fragments are specified, render only those. - if len(ch.FragmentIDs) > 0 { - ch.ServeHTTPBufferedFragment(w, r) - return - } - - // Otherwise, render the complete component. - ch.ServeHTTPBufferedComplete(w, r) -} - -func (ch *ComponentHandler) ServeHTTPStreamed(w http.ResponseWriter, r *http.Request) { - // If streaming, we do not buffer the response, so set the headers immediately. - w.Header().Set("Content-Type", ch.ContentType) - if ch.Status != 0 { - w.WriteHeader(ch.Status) - } - - // Pass fragment names to the context if specified. - if len(ch.FragmentIDs) > 0 { - - // Render the component into io.Discard, but use the buffer for fragments. - if err := RenderFragments(r.Context(), w, ch.Component, ch.FragmentIDs...); err != nil { - ch.handleRenderErr(w, r, err) - return - } - return - } - - // Render the component into the buffer. - if err := ch.Component.Render(r.Context(), w); err != nil { - ch.handleRenderErr(w, r, err) - return - } -} - -// ServeHTTP implements the http.Handler interface. -func (ch ComponentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if ch.StreamResponse { - ch.ServeHTTPStreamed(w, r) - return - } - ch.ServeHTTPBuffered(w, r) -} - -// Handler creates a http.Handler that renders the template. -func Handler(c Component, options ...func(*ComponentHandler)) *ComponentHandler { - ch := &ComponentHandler{ - Component: c, - ContentType: "text/html; charset=utf-8", - } - for _, o := range options { - o(ch) - } - return ch -} - -// WithStatus sets the HTTP status code returned by the ComponentHandler. -func WithStatus(status int) func(*ComponentHandler) { - return func(ch *ComponentHandler) { - ch.Status = status - } -} - -// WithContentType sets the Content-Type header returned by the ComponentHandler. -func WithContentType(contentType string) func(*ComponentHandler) { - return func(ch *ComponentHandler) { - ch.ContentType = contentType - } -} - -// WithErrorHandler sets the error handler used if rendering fails. -func WithErrorHandler(eh func(r *http.Request, err error) http.Handler) func(*ComponentHandler) { - return func(ch *ComponentHandler) { - ch.ErrorHandler = eh - } -} - -// WithStreaming sets the ComponentHandler to stream the response instead of buffering it. -func WithStreaming() func(*ComponentHandler) { - return func(ch *ComponentHandler) { - ch.StreamResponse = true - } -} - -// WithFragments sets the ids of the fragments to render. -// If not set, all content is rendered. -func WithFragments(ids ...any) func(*ComponentHandler) { - return func(ch *ComponentHandler) { - ch.FragmentIDs = ids - } -} diff --git a/vendor/github.com/a-h/templ/ide-demo.gif b/vendor/github.com/a-h/templ/ide-demo.gif Binary files differdeleted file mode 100644 index e35fd68..0000000 --- a/vendor/github.com/a-h/templ/ide-demo.gif +++ /dev/null diff --git a/vendor/github.com/a-h/templ/join.go b/vendor/github.com/a-h/templ/join.go deleted file mode 100644 index a809359..0000000 --- a/vendor/github.com/a-h/templ/join.go +++ /dev/null @@ -1,19 +0,0 @@ -package templ - -import ( - "context" - "io" -) - -// Join returns a single `templ.Component` that will render provided components in order. -// If any of the components return an error the Join component will immediately return with the error. -func Join(components ...Component) Component { - return ComponentFunc(func(ctx context.Context, w io.Writer) (err error) { - for _, c := range components { - if err = c.Render(ctx, w); err != nil { - return err - } - } - return nil - }) -} diff --git a/vendor/github.com/a-h/templ/js.go b/vendor/github.com/a-h/templ/js.go deleted file mode 100644 index f07f7ff..0000000 --- a/vendor/github.com/a-h/templ/js.go +++ /dev/null @@ -1,40 +0,0 @@ -package templ - -import ( - "crypto/sha256" - "encoding/hex" - "html" -) - -// JSUnsafeFuncCall calls arbitrary JavaScript in the js parameter. -// -// Use of this function presents a security risk - the JavaScript must come -// from a trusted source, because it will be included as-is in the output. -func JSUnsafeFuncCall[T ~string](js T) ComponentScript { - sum := sha256.Sum256([]byte(js)) - return ComponentScript{ - Name: "jsUnsafeFuncCall_" + hex.EncodeToString(sum[:]), - // Function is empty because the body of the function is defined elsewhere, - // e.g. in a <script> tag within a templ.Once block. - Function: "", - Call: html.EscapeString(string(js)), - CallInline: string(js), - } -} - -// JSFuncCall calls a JavaScript function with the given arguments. -// -// It can be used in event handlers, e.g. onclick, onhover, etc. or -// directly in HTML. -func JSFuncCall[T ~string](functionName T, args ...any) ComponentScript { - call := SafeScript(string(functionName), args...) - sum := sha256.Sum256([]byte(call)) - return ComponentScript{ - Name: "jsFuncCall_" + hex.EncodeToString(sum[:]), - // Function is empty because the body of the function is defined elsewhere, - // e.g. in a <script> tag within a templ.Once block. - Function: "", - Call: call, - CallInline: SafeScriptInline(string(functionName), args...), - } -} diff --git a/vendor/github.com/a-h/templ/jsonscript.go b/vendor/github.com/a-h/templ/jsonscript.go deleted file mode 100644 index 6e88174..0000000 --- a/vendor/github.com/a-h/templ/jsonscript.go +++ /dev/null @@ -1,85 +0,0 @@ -package templ - -import ( - "context" - "encoding/json" - "fmt" - "io" -) - -var _ Component = JSONScriptElement{} - -// JSONScript renders a JSON object inside a script element. -// e.g. <script type="application/json">{"foo":"bar"}</script> -func JSONScript(id string, data any) JSONScriptElement { - return JSONScriptElement{ - ID: id, - Type: "application/json", - Data: data, - Nonce: GetNonce, - } -} - -// WithType sets the value of the type attribute of the script element. -func (j JSONScriptElement) WithType(t string) JSONScriptElement { - j.Type = t - return j -} - -// WithNonceFromString sets the value of the nonce attribute of the script element to the given string. -func (j JSONScriptElement) WithNonceFromString(nonce string) JSONScriptElement { - j.Nonce = func(context.Context) string { - return nonce - } - return j -} - -// WithNonceFrom sets the value of the nonce attribute of the script element to the value returned by the given function. -func (j JSONScriptElement) WithNonceFrom(f func(context.Context) string) JSONScriptElement { - j.Nonce = f - return j -} - -type JSONScriptElement struct { - // ID of the element in the DOM. - ID string - // Type of the script element, defaults to "application/json". - Type string - // Data that will be encoded as JSON. - Data any - // Nonce is a function that returns a CSP nonce. - // Defaults to CSPNonceFromContext. - // See https://content-security-policy.com/nonce for more information. - Nonce func(ctx context.Context) string -} - -func (j JSONScriptElement) Render(ctx context.Context, w io.Writer) (err error) { - if _, err = io.WriteString(w, "<script"); err != nil { - return err - } - if j.ID != "" { - if _, err = fmt.Fprintf(w, " id=\"%s\"", EscapeString(j.ID)); err != nil { - return err - } - } - if j.Type != "" { - if _, err = fmt.Fprintf(w, " type=\"%s\"", EscapeString(j.Type)); err != nil { - return err - } - } - if nonce := j.Nonce(ctx); nonce != "" { - if _, err = fmt.Fprintf(w, " nonce=\"%s\"", EscapeString(nonce)); err != nil { - return err - } - } - if _, err = io.WriteString(w, ">"); err != nil { - return err - } - if err = json.NewEncoder(w).Encode(j.Data); err != nil { - return err - } - if _, err = io.WriteString(w, "</script>"); err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/a-h/templ/jsonstring.go b/vendor/github.com/a-h/templ/jsonstring.go deleted file mode 100644 index 425e4e8..0000000 --- a/vendor/github.com/a-h/templ/jsonstring.go +++ /dev/null @@ -1,14 +0,0 @@ -package templ - -import ( - "encoding/json" -) - -// JSONString returns a JSON encoded string of v. -func JSONString(v any) (string, error) { - b, err := json.Marshal(v) - if err != nil { - return "", err - } - return string(b), nil -} diff --git a/vendor/github.com/a-h/templ/once.go b/vendor/github.com/a-h/templ/once.go deleted file mode 100644 index 7860ab8..0000000 --- a/vendor/github.com/a-h/templ/once.go +++ /dev/null @@ -1,64 +0,0 @@ -package templ - -import ( - "context" - "io" - "sync/atomic" -) - -// onceHandleIndex is used to identify unique once handles in a program run. -var onceHandleIndex int64 - -type OnceOpt func(*OnceHandle) - -// WithOnceComponent sets the component to be rendered once per context. -// This can be used instead of setting the children of the `Once` method, -// for example, if creating a code component outside of a templ HTML template. -func WithComponent(c Component) OnceOpt { - return func(o *OnceHandle) { - o.c = c - } -} - -// NewOnceHandle creates a OnceHandle used to ensure that the children of its -// `Once` method are only rendered once per context. -func NewOnceHandle(opts ...OnceOpt) *OnceHandle { - oh := &OnceHandle{ - id: atomic.AddInt64(&onceHandleIndex, 1), - } - for _, opt := range opts { - opt(oh) - } - return oh -} - -// OnceHandle is used to ensure that the children of its `Once` method are are only -// rendered once per context. -type OnceHandle struct { - // id is used to identify which instance of the OnceHandle is being used. - // The OnceHandle can't be an empty struct, because: - // - // | Two distinct zero-size variables may - // | have the same address in memory - // - // https://go.dev/ref/spec#Size_and_alignment_guarantees - id int64 - // c is the component to be rendered once per context. - // if c is nil, the children of the `Once` method are rendered. - c Component -} - -// Once returns a component that renders its children once per context. -func (o *OnceHandle) Once() Component { - return ComponentFunc(func(ctx context.Context, w io.Writer) (err error) { - _, v := getContext(ctx) - if v.getHasBeenRendered(o) { - return nil - } - v.setHasBeenRendered(o) - if o.c != nil { - return o.c.Render(ctx, w) - } - return GetChildren(ctx).Render(ctx, w) - }) -} diff --git a/vendor/github.com/a-h/templ/runtime.go b/vendor/github.com/a-h/templ/runtime.go deleted file mode 100644 index c804b08..0000000 --- a/vendor/github.com/a-h/templ/runtime.go +++ /dev/null @@ -1,714 +0,0 @@ -package templ - -import ( - "bytes" - "context" - "crypto/sha256" - "encoding/hex" - "errors" - "fmt" - "html" - "html/template" - "io" - "net/http" - "reflect" - "sort" - "strings" - "sync" - - "github.com/a-h/templ/safehtml" -) - -// Types exposed by all components. - -// Component is the interface that all templates implement. -type Component interface { - // Render the template. - Render(ctx context.Context, w io.Writer) error -} - -// ComponentFunc converts a function that matches the Component interface's -// Render method into a Component. -type ComponentFunc func(ctx context.Context, w io.Writer) error - -// Render the template. -func (cf ComponentFunc) Render(ctx context.Context, w io.Writer) error { - return cf(ctx, w) -} - -// WithNonce sets a CSP nonce on the context and returns it. -func WithNonce(ctx context.Context, nonce string) context.Context { - ctx, v := getContext(ctx) - v.nonce = nonce - return ctx -} - -// GetNonce returns the CSP nonce value set with WithNonce, or an -// empty string if none has been set. -func GetNonce(ctx context.Context) (nonce string) { - if ctx == nil { - return "" - } - _, v := getContext(ctx) - return v.nonce -} - -func WithChildren(ctx context.Context, children Component) context.Context { - ctx, v := getContext(ctx) - v.children = &children - return ctx -} - -func ClearChildren(ctx context.Context) context.Context { - _, v := getContext(ctx) - v.children = nil - return ctx -} - -// NopComponent is a component that doesn't render anything. -var NopComponent = ComponentFunc(func(ctx context.Context, w io.Writer) error { return nil }) - -// GetChildren from the context. -func GetChildren(ctx context.Context) Component { - _, v := getContext(ctx) - if v.children == nil { - return NopComponent - } - return *v.children -} - -// EscapeString escapes HTML text within templates. -func EscapeString[T ~string](s T) string { - return html.EscapeString(string(s)) -} - -// Bool attribute value. -func Bool(value bool) bool { - return value -} - -// Classes for CSS. -// Supported types are string, ConstantCSSClass, ComponentCSSClass, map[string]bool. -func Classes(classes ...any) CSSClasses { - return CSSClasses(classes) -} - -// CSSClasses is a slice of CSS classes. -type CSSClasses []any - -// String returns the names of all CSS classes. -func (classes CSSClasses) String() string { - if len(classes) == 0 { - return "" - } - cp := newCSSProcessor() - for _, v := range classes { - cp.Add(v) - } - return cp.String() -} - -func newCSSProcessor() *cssProcessor { - return &cssProcessor{ - classNameToEnabled: make(map[string]bool), - } -} - -type cssProcessor struct { - classNameToEnabled map[string]bool - orderedNames []string -} - -func (cp *cssProcessor) Add(item any) { - switch c := item.(type) { - case []string: - for _, className := range c { - cp.AddClassName(className, true) - } - case string: - cp.AddClassName(c, true) - case ConstantCSSClass: - cp.AddClassName(c.ClassName(), true) - case ComponentCSSClass: - cp.AddClassName(c.ClassName(), true) - case map[string]bool: - // In Go, map keys are iterated in a randomized order. - // So the keys in the map must be sorted to produce consistent output. - keys := make([]string, len(c)) - var i int - for key := range c { - keys[i] = key - i++ - } - sort.Strings(keys) - for _, className := range keys { - cp.AddClassName(className, c[className]) - } - case []KeyValue[string, bool]: - for _, kv := range c { - cp.AddClassName(kv.Key, kv.Value) - } - case KeyValue[string, bool]: - cp.AddClassName(c.Key, c.Value) - case []KeyValue[CSSClass, bool]: - for _, kv := range c { - cp.AddClassName(kv.Key.ClassName(), kv.Value) - } - case KeyValue[CSSClass, bool]: - cp.AddClassName(c.Key.ClassName(), c.Value) - case CSSClasses: - for _, item := range c { - cp.Add(item) - } - case []CSSClass: - for _, item := range c { - cp.Add(item) - } - case func() CSSClass: - cp.AddClassName(c().ClassName(), true) - default: - cp.AddClassName(unknownTypeClassName, true) - } -} - -func (cp *cssProcessor) AddClassName(className string, enabled bool) { - cp.classNameToEnabled[className] = enabled - cp.orderedNames = append(cp.orderedNames, className) -} - -func (cp *cssProcessor) String() string { - // Order the outputs according to how they were input, and remove disabled names. - rendered := make(map[string]any, len(cp.classNameToEnabled)) - var names []string - for _, name := range cp.orderedNames { - if enabled := cp.classNameToEnabled[name]; !enabled { - continue - } - if _, hasBeenRendered := rendered[name]; hasBeenRendered { - continue - } - names = append(names, name) - rendered[name] = struct{}{} - } - - return strings.Join(names, " ") -} - -// KeyValue is a key and value pair. -type KeyValue[TKey comparable, TValue any] struct { - Key TKey `json:"name"` - Value TValue `json:"value"` -} - -// KV creates a new key/value pair from the input key and value. -func KV[TKey comparable, TValue any](key TKey, value TValue) KeyValue[TKey, TValue] { - return KeyValue[TKey, TValue]{ - Key: key, - Value: value, - } -} - -const unknownTypeClassName = "--templ-css-class-unknown-type" - -// Class returns a CSS class name. -// Deprecated: use a string instead. -func Class(name string) CSSClass { - return SafeClass(name) -} - -// SafeClass bypasses CSS class name validation. -// Deprecated: use a string instead. -func SafeClass(name string) CSSClass { - return ConstantCSSClass(name) -} - -// CSSClass provides a class name. -type CSSClass interface { - ClassName() string -} - -// ConstantCSSClass is a string constant of a CSS class name. -// Deprecated: use a string instead. -type ConstantCSSClass string - -// ClassName of the CSS class. -func (css ConstantCSSClass) ClassName() string { - return string(css) -} - -// ComponentCSSClass is a templ.CSS -type ComponentCSSClass struct { - // ID of the class, will be autogenerated. - ID string - // Definition of the CSS. - Class SafeCSS -} - -// ClassName of the CSS class. -func (css ComponentCSSClass) ClassName() string { - return css.ID -} - -// CSSID calculates an ID. -func CSSID(name string, css string) string { - sum := sha256.Sum256([]byte(css)) - hs := hex.EncodeToString(sum[:])[0:8] // NOTE: See issue #978. Minimum recommended hs length is 6. - // Benchmarking showed this was fastest, and with fewest allocations (1). - // Using strings.Builder (2 allocs). - // Using fmt.Sprintf (3 allocs). - return name + "_" + hs -} - -// NewCSSMiddleware creates HTTP middleware that renders a global stylesheet of ComponentCSSClass -// CSS if the request path matches, or updates the HTTP context to ensure that any handlers that -// use templ.Components skip rendering <style> elements for classes that are included in the global -// stylesheet. By default, the stylesheet path is /styles/templ.css -func NewCSSMiddleware(next http.Handler, classes ...CSSClass) CSSMiddleware { - return CSSMiddleware{ - Path: "/styles/templ.css", - CSSHandler: NewCSSHandler(classes...), - Next: next, - } -} - -// CSSMiddleware renders a global stylesheet. -type CSSMiddleware struct { - Path string - CSSHandler CSSHandler - Next http.Handler -} - -func (cssm CSSMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if r.URL.Path == cssm.Path { - cssm.CSSHandler.ServeHTTP(w, r) - return - } - // Add registered classes to the context. - ctx, v := getContext(r.Context()) - for _, c := range cssm.CSSHandler.Classes { - v.addClass(c.ID) - } - // Serve the request. Templ components will use the updated context - // to know to skip rendering <style> elements for any component CSS - // classes that have been included in the global stylesheet. - cssm.Next.ServeHTTP(w, r.WithContext(ctx)) -} - -// NewCSSHandler creates a handler that serves a stylesheet containing the CSS of the -// classes passed in. This is used by the CSSMiddleware to provide global stylesheets -// for templ components. -func NewCSSHandler(classes ...CSSClass) CSSHandler { - ccssc := make([]ComponentCSSClass, 0, len(classes)) - for _, c := range classes { - ccss, ok := c.(ComponentCSSClass) - if !ok { - continue - } - ccssc = append(ccssc, ccss) - } - return CSSHandler{ - Classes: ccssc, - } -} - -// CSSHandler is a HTTP handler that serves CSS. -type CSSHandler struct { - Logger func(err error) - Classes []ComponentCSSClass -} - -func (cssh CSSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "text/css") - for _, c := range cssh.Classes { - _, err := w.Write([]byte(c.Class)) - if err != nil && cssh.Logger != nil { - cssh.Logger(err) - } - } -} - -// RenderCSSItems renders the CSS to the writer, if the items haven't already been rendered. -func RenderCSSItems(ctx context.Context, w io.Writer, classes ...any) (err error) { - if len(classes) == 0 { - return nil - } - _, v := getContext(ctx) - sb := new(strings.Builder) - renderCSSItemsToBuilder(sb, v, classes...) - if sb.Len() == 0 { - return nil - } - if _, err = io.WriteString(w, `<style type="text/css"`); err != nil { - return err - } - if v.nonce != "" { - if err = writeStrings(w, ` nonce="`, EscapeString(v.nonce), `"`); err != nil { - return err - } - } - return writeStrings(w, `>`, sb.String(), `</style>`) -} - -func renderCSSItemsToBuilder(sb *strings.Builder, v *contextValue, classes ...any) { - for _, c := range classes { - switch ccc := c.(type) { - case ComponentCSSClass: - if !v.hasClassBeenRendered(ccc.ID) { - sb.WriteString(string(ccc.Class)) - v.addClass(ccc.ID) - } - case KeyValue[ComponentCSSClass, bool]: - if !ccc.Value { - continue - } - renderCSSItemsToBuilder(sb, v, ccc.Key) - case KeyValue[CSSClass, bool]: - if !ccc.Value { - continue - } - renderCSSItemsToBuilder(sb, v, ccc.Key) - case CSSClasses: - renderCSSItemsToBuilder(sb, v, ccc...) - case []CSSClass: - for _, item := range ccc { - renderCSSItemsToBuilder(sb, v, item) - } - case func() CSSClass: - renderCSSItemsToBuilder(sb, v, ccc()) - case []string: - // Skip. These are class names, not CSS classes. - case string: - // Skip. This is a class name, not a CSS class. - case ConstantCSSClass: - // Skip. This is a class name, not a CSS class. - case CSSClass: - // Skip. This is a class name, not a CSS class. - case map[string]bool: - // Skip. These are class names, not CSS classes. - case KeyValue[string, bool]: - // Skip. These are class names, not CSS classes. - case []KeyValue[string, bool]: - // Skip. These are class names, not CSS classes. - case KeyValue[ConstantCSSClass, bool]: - // Skip. These are class names, not CSS classes. - case []KeyValue[ConstantCSSClass, bool]: - // Skip. These are class names, not CSS classes. - } - } -} - -// SafeCSS is CSS that has been sanitized. -type SafeCSS string - -type SafeCSSProperty string - -var safeCSSPropertyType = reflect.TypeOf(SafeCSSProperty("")) - -// SanitizeCSS sanitizes CSS properties to ensure that they are safe. -func SanitizeCSS[T ~string](property string, value T) SafeCSS { - if reflect.TypeOf(value) == safeCSSPropertyType { - return SafeCSS(safehtml.SanitizeCSSProperty(property) + ":" + string(value) + ";") - } - p, v := safehtml.SanitizeCSS(property, string(value)) - return SafeCSS(p + ":" + v + ";") -} - -type Attributer interface { - Items() []KeyValue[string, any] -} - -// Attributes is an alias to map[string]any made for spread attributes. -type Attributes map[string]any - -var _ Attributer = Attributes{} - -// Returns the items of the attributes map in key sorted order. -func (a Attributes) Items() []KeyValue[string, any] { - var ( - items = make([]KeyValue[string, any], len(a)) - i int - ) - for k, v := range a { - items[i] = KeyValue[string, any]{Key: k, Value: v} - i++ - } - sort.Slice(items, func(i, j int) bool { - return items[i].Key < items[j].Key - }) - return items -} - -// OrderedAttributes stores attributes in order of insertion. -type OrderedAttributes []KeyValue[string, any] - -var _ Attributer = OrderedAttributes{} - -func (a OrderedAttributes) Items() []KeyValue[string, any] { - return a -} - -func writeStrings(w io.Writer, ss ...string) (err error) { - for _, s := range ss { - if _, err = io.WriteString(w, s); err != nil { - return err - } - } - return nil -} - -func RenderAttributes(ctx context.Context, w io.Writer, attributes Attributer) (err error) { - for _, item := range attributes.Items() { - key := item.Key - value := item.Value - switch value := value.(type) { - case string: - if err = writeStrings(w, ` `, EscapeString(key), `="`, EscapeString(value), `"`); err != nil { - return err - } - case *string: - if value == nil { - continue - } - if err = writeStrings(w, ` `, EscapeString(key), `="`, EscapeString(*value), `"`); err != nil { - return err - } - case bool: - if !value { - continue - } - if err = writeStrings(w, ` `, EscapeString(key)); err != nil { - return err - } - case *bool: - if value == nil || !*value { - continue - } - if err = writeStrings(w, ` `, EscapeString(key)); err != nil { - return err - } - case int, int8, int16, int32, int64, - uint, uint8, uint16, uint32, uint64, uintptr, - float32, float64, complex64, complex128: - if err = writeStrings(w, ` `, EscapeString(key), `="`, EscapeString(fmt.Sprint(value)), `"`); err != nil { - return err - } - case *int, *int8, *int16, *int32, *int64, - *uint, *uint8, *uint16, *uint32, *uint64, *uintptr, - *float32, *float64, *complex64, *complex128: - value = ptrValue(value) - if value == nil { - continue - } - if err = writeStrings(w, ` `, EscapeString(key), `="`, EscapeString(fmt.Sprint(value)), `"`); err != nil { - return err - } - case KeyValue[string, bool]: - if !value.Value { - continue - } - if err = writeStrings(w, ` `, EscapeString(key), `="`, EscapeString(value.Key), `"`); err != nil { - return err - } - case KeyValue[bool, bool]: - if !value.Value || !value.Key { - continue - } - if err = writeStrings(w, ` `, EscapeString(key)); err != nil { - return err - } - case func() bool: - if !value() { - continue - } - if err = writeStrings(w, ` `, EscapeString(key)); err != nil { - return err - } - } - } - return nil -} - -func ptrValue(v any) any { - if v == nil { - return nil - } - rv := reflect.ValueOf(v) - if rv.Kind() != reflect.Ptr { - return v - } - if rv.IsNil() { - return nil - } - return rv.Elem().Interface() -} - -// Context. - -type contextKeyType int - -const contextKey = contextKeyType(0) - -type contextValue struct { - ss map[string]struct{} - onceHandles map[*OnceHandle]struct{} - children *Component - nonce string -} - -func (v *contextValue) setHasBeenRendered(h *OnceHandle) { - if v.onceHandles == nil { - v.onceHandles = map[*OnceHandle]struct{}{} - } - v.onceHandles[h] = struct{}{} -} - -func (v *contextValue) getHasBeenRendered(h *OnceHandle) (ok bool) { - if v.onceHandles == nil { - v.onceHandles = map[*OnceHandle]struct{}{} - } - _, ok = v.onceHandles[h] - return -} - -func (v *contextValue) addScript(s string) { - if v.ss == nil { - v.ss = map[string]struct{}{} - } - v.ss["script_"+s] = struct{}{} -} - -func (v *contextValue) hasScriptBeenRendered(s string) (ok bool) { - if v.ss == nil { - v.ss = map[string]struct{}{} - } - _, ok = v.ss["script_"+s] - return -} - -func (v *contextValue) addClass(s string) { - if v.ss == nil { - v.ss = map[string]struct{}{} - } - v.ss["class_"+s] = struct{}{} -} - -func (v *contextValue) hasClassBeenRendered(s string) (ok bool) { - if v.ss == nil { - v.ss = map[string]struct{}{} - } - _, ok = v.ss["class_"+s] - return -} - -// InitializeContext initializes context used to store internal state used during rendering. -func InitializeContext(ctx context.Context) context.Context { - if _, ok := ctx.Value(contextKey).(*contextValue); ok { - return ctx - } - v := &contextValue{} - ctx = context.WithValue(ctx, contextKey, v) - return ctx -} - -func getContext(ctx context.Context) (context.Context, *contextValue) { - v, ok := ctx.Value(contextKey).(*contextValue) - if !ok { - ctx = InitializeContext(ctx) - v = ctx.Value(contextKey).(*contextValue) - } - return ctx, v -} - -var bufferPool = sync.Pool{ - New: func() any { - return new(bytes.Buffer) - }, -} - -func GetBuffer() *bytes.Buffer { - return bufferPool.Get().(*bytes.Buffer) -} - -func ReleaseBuffer(b *bytes.Buffer) { - b.Reset() - bufferPool.Put(b) -} - -type ints interface { - ~int | ~int8 | ~int16 | ~int32 | ~int64 -} - -type uints interface { - ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr -} - -type floats interface { - ~float32 | ~float64 -} - -type complexNumbers interface { - ~complex64 | ~complex128 -} - -type stringable interface { - ints | uints | floats | complexNumbers | ~string | ~bool -} - -// JoinStringErrs joins an optional list of errors. -func JoinStringErrs[T stringable](s T, errs ...error) (string, error) { - return fmt.Sprint(s), errors.Join(errs...) -} - -// Error returned during template rendering. -type Error struct { - Err error - // FileName of the template file. - FileName string - // Line index of the error. - Line int - // Col index of the error. - Col int -} - -func (e Error) Error() string { - if e.FileName == "" { - e.FileName = "templ" - } - return fmt.Sprintf("%s: error at line %d, col %d: %v", e.FileName, e.Line, e.Col, e.Err) -} - -func (e Error) Unwrap() error { - return e.Err -} - -// Raw renders the input HTML to the output without applying HTML escaping. -// -// Use of this component presents a security risk - the HTML should come from -// a trusted source, because it will be included as-is in the output. -func Raw[T ~string](html T, errs ...error) Component { - return ComponentFunc(func(ctx context.Context, w io.Writer) (err error) { - if err = errors.Join(errs...); err != nil { - return err - } - _, err = io.WriteString(w, string(html)) - return err - }) -} - -// FromGoHTML creates a templ Component from a Go html/template template. -func FromGoHTML(t *template.Template, data any) Component { - return ComponentFunc(func(ctx context.Context, w io.Writer) (err error) { - return t.Execute(w, data) - }) -} - -// ToGoHTML renders the component to a Go html/template template.HTML string. -func ToGoHTML(ctx context.Context, c Component) (s template.HTML, err error) { - b := GetBuffer() - defer ReleaseBuffer(b) - if err = c.Render(ctx, b); err != nil { - return - } - s = template.HTML(b.String()) - return -} diff --git a/vendor/github.com/a-h/templ/runtime/buffer.go b/vendor/github.com/a-h/templ/runtime/buffer.go deleted file mode 100644 index 63e4acd..0000000 --- a/vendor/github.com/a-h/templ/runtime/buffer.go +++ /dev/null @@ -1,62 +0,0 @@ -package runtime - -import ( - "bufio" - "io" - "net/http" -) - -// DefaultBufferSize is the default size of buffers. It is set to 4KB by default, which is the -// same as the default buffer size of bufio.Writer. -var DefaultBufferSize = 4 * 1024 // 4KB - -// Buffer is a wrapper around bufio.Writer that enables flushing and closing of -// the underlying writer. -type Buffer struct { - Underlying io.Writer - b *bufio.Writer -} - -// Write the contents of p into the buffer. -func (b *Buffer) Write(p []byte) (n int, err error) { - return b.b.Write(p) -} - -// Flush writes any buffered data to the underlying io.Writer and -// calls the Flush method of the underlying http.Flusher if it implements it. -func (b *Buffer) Flush() error { - if err := b.b.Flush(); err != nil { - return err - } - if f, ok := b.Underlying.(http.Flusher); ok { - f.Flush() - } - return nil -} - -// Close closes the buffer and the underlying io.Writer if it implements io.Closer. -func (b *Buffer) Close() error { - if c, ok := b.Underlying.(io.Closer); ok { - return c.Close() - } - return nil -} - -// Reset sets the underlying io.Writer to w and resets the buffer. -func (b *Buffer) Reset(w io.Writer) { - if b.b == nil { - b.b = bufio.NewWriterSize(b, DefaultBufferSize) - } - b.Underlying = w - b.b.Reset(w) -} - -// Size returns the size of the underlying buffer in bytes. -func (b *Buffer) Size() int { - return b.b.Size() -} - -// WriteString writes the contents of s into the buffer. -func (b *Buffer) WriteString(s string) (n int, err error) { - return b.b.WriteString(s) -} diff --git a/vendor/github.com/a-h/templ/runtime/bufferpool.go b/vendor/github.com/a-h/templ/runtime/bufferpool.go deleted file mode 100644 index ca2a131..0000000 --- a/vendor/github.com/a-h/templ/runtime/bufferpool.go +++ /dev/null @@ -1,38 +0,0 @@ -package runtime - -import ( - "io" - "sync" -) - -var bufferPool = sync.Pool{ - New: func() any { - return new(Buffer) - }, -} - -// GetBuffer creates and returns a new buffer if the writer is not already a buffer, -// or returns the existing buffer if it is. -func GetBuffer(w io.Writer) (b *Buffer, existing bool) { - if w == nil { - return nil, false - } - b, ok := w.(*Buffer) - if ok { - return b, true - } - b = bufferPool.Get().(*Buffer) - b.Reset(w) - return b, false -} - -// ReleaseBuffer flushes the buffer and returns it to the pool. -func ReleaseBuffer(w io.Writer) (err error) { - b, ok := w.(*Buffer) - if !ok { - return nil - } - err = b.Flush() - bufferPool.Put(b) - return err -} diff --git a/vendor/github.com/a-h/templ/runtime/builder.go b/vendor/github.com/a-h/templ/runtime/builder.go deleted file mode 100644 index 0f4c9d4..0000000 --- a/vendor/github.com/a-h/templ/runtime/builder.go +++ /dev/null @@ -1,8 +0,0 @@ -package runtime - -import "strings" - -// GetBuilder returns a strings.Builder. -func GetBuilder() (sb strings.Builder) { - return sb -} diff --git a/vendor/github.com/a-h/templ/runtime/runtime.go b/vendor/github.com/a-h/templ/runtime/runtime.go deleted file mode 100644 index aaa4a2c..0000000 --- a/vendor/github.com/a-h/templ/runtime/runtime.go +++ /dev/null @@ -1,21 +0,0 @@ -package runtime - -import ( - "context" - "io" - - "github.com/a-h/templ" -) - -// GeneratedComponentInput is used to avoid generated code needing to import the `context` and `io` packages. -type GeneratedComponentInput struct { - Context context.Context - Writer io.Writer -} - -// GeneratedTemplate is used to avoid generated code needing to import the `context` and `io` packages. -func GeneratedTemplate(f func(GeneratedComponentInput) error) templ.Component { - return templ.ComponentFunc(func(ctx context.Context, w io.Writer) error { - return f(GeneratedComponentInput{ctx, w}) - }) -} diff --git a/vendor/github.com/a-h/templ/runtime/scriptelement.go b/vendor/github.com/a-h/templ/runtime/scriptelement.go deleted file mode 100644 index a742e93..0000000 --- a/vendor/github.com/a-h/templ/runtime/scriptelement.go +++ /dev/null @@ -1,107 +0,0 @@ -package runtime - -import ( - "encoding/json" - "errors" - "strings" - "unicode/utf8" -) - -func ScriptContentInsideStringLiteral[T any](v T, errs ...error) (string, error) { - return scriptContent(v, true, errs...) -} - -func ScriptContentOutsideStringLiteral[T any](v T, errs ...error) (string, error) { - return scriptContent(v, false, errs...) -} - -func scriptContent[T any](v T, insideStringLiteral bool, errs ...error) (string, error) { - if errors.Join(errs...) != nil { - return "", errors.Join(errs...) - } - if vs, ok := any(v).(string); ok && insideStringLiteral { - return replace(vs, jsStrReplacementTable), nil - } - jd, err := json.Marshal(v) - if err != nil { - return "", err - } - if insideStringLiteral { - return replace(string(jd), jsStrReplacementTable), nil - } - return string(jd), nil -} - -// See https://cs.opensource.google/go/go/+/refs/tags/go1.23.6:src/html/template/js.go - -// replace replaces each rune r of s with replacementTable[r], provided that -// r < len(replacementTable). If replacementTable[r] is the empty string then -// no replacement is made. -// It also replaces runes U+2028 and U+2029 with the raw strings `\u2028` and -// `\u2029`. -func replace(s string, replacementTable []string) string { - var b strings.Builder - r, w, written := rune(0), 0, 0 - for i := 0; i < len(s); i += w { - // See comment in htmlEscaper. - r, w = utf8.DecodeRuneInString(s[i:]) - var repl string - switch { - case int(r) < len(lowUnicodeReplacementTable): - repl = lowUnicodeReplacementTable[r] - case int(r) < len(replacementTable) && replacementTable[r] != "": - repl = replacementTable[r] - case r == '\u2028': - repl = `\u2028` - case r == '\u2029': - repl = `\u2029` - default: - continue - } - if written == 0 { - b.Grow(len(s)) - } - b.WriteString(s[written:i]) - b.WriteString(repl) - written = i + w - } - if written == 0 { - return s - } - b.WriteString(s[written:]) - return b.String() -} - -var lowUnicodeReplacementTable = []string{ - 0: `\u0000`, 1: `\u0001`, 2: `\u0002`, 3: `\u0003`, 4: `\u0004`, 5: `\u0005`, 6: `\u0006`, - '\a': `\u0007`, - '\b': `\u0008`, - '\t': `\t`, - '\n': `\n`, - '\v': `\u000b`, // "\v" == "v" on IE 6. - '\f': `\f`, - '\r': `\r`, - 0xe: `\u000e`, 0xf: `\u000f`, 0x10: `\u0010`, 0x11: `\u0011`, 0x12: `\u0012`, 0x13: `\u0013`, - 0x14: `\u0014`, 0x15: `\u0015`, 0x16: `\u0016`, 0x17: `\u0017`, 0x18: `\u0018`, 0x19: `\u0019`, - 0x1a: `\u001a`, 0x1b: `\u001b`, 0x1c: `\u001c`, 0x1d: `\u001d`, 0x1e: `\u001e`, 0x1f: `\u001f`, -} - -var jsStrReplacementTable = []string{ - 0: `\u0000`, - '\t': `\t`, - '\n': `\n`, - '\v': `\u000b`, // "\v" == "v" on IE 6. - '\f': `\f`, - '\r': `\r`, - // Encode HTML specials as hex so the output can be embedded - // in HTML attributes without further encoding. - '"': `\u0022`, - '`': `\u0060`, - '&': `\u0026`, - '\'': `\u0027`, - '+': `\u002b`, - '/': `\/`, - '<': `\u003c`, - '>': `\u003e`, - '\\': `\\`, -} diff --git a/vendor/github.com/a-h/templ/runtime/styleattribute.go b/vendor/github.com/a-h/templ/runtime/styleattribute.go deleted file mode 100644 index c94f4e3..0000000 --- a/vendor/github.com/a-h/templ/runtime/styleattribute.go +++ /dev/null @@ -1,217 +0,0 @@ -package runtime - -import ( - "errors" - "fmt" - "html" - "maps" - "reflect" - "slices" - "strings" - - "github.com/a-h/templ" - "github.com/a-h/templ/safehtml" -) - -// SanitizeStyleAttributeValues renders a style attribute value. -// The supported types are: -// - string -// - templ.SafeCSS -// - map[string]string -// - map[string]templ.SafeCSSProperty -// - templ.KeyValue[string, string] - A map of key/values where the key is the CSS property name and the value is the CSS property value. -// - templ.KeyValue[string, templ.SafeCSSProperty] - A map of key/values where the key is the CSS property name and the value is the CSS property value. -// - templ.KeyValue[string, bool] - The bool determines whether the value should be included. -// - templ.KeyValue[templ.SafeCSS, bool] - The bool determines whether the value should be included. -// - func() (anyOfTheAboveTypes) -// - func() (anyOfTheAboveTypes, error) -// - []anyOfTheAboveTypes -// -// In the above, templ.SafeCSS and templ.SafeCSSProperty are types that are used to indicate that the value is safe to render as CSS without sanitization. -// All other types are sanitized before rendering. -// -// If an error is returned by any function, or a non-nil error is included in the input, the error is returned. -func SanitizeStyleAttributeValues(values ...any) (string, error) { - if err := getJoinedErrorsFromValues(values...); err != nil { - return "", err - } - sb := new(strings.Builder) - for _, v := range values { - if v == nil { - continue - } - if err := sanitizeStyleAttributeValue(sb, v); err != nil { - return "", err - } - } - return sb.String(), nil -} - -func sanitizeStyleAttributeValue(sb *strings.Builder, v any) error { - // Process concrete types. - switch v := v.(type) { - case string: - return processString(sb, v) - - case templ.SafeCSS: - return processSafeCSS(sb, v) - - case map[string]string: - return processStringMap(sb, v) - - case map[string]templ.SafeCSSProperty: - return processSafeCSSPropertyMap(sb, v) - - case templ.KeyValue[string, string]: - return processStringKV(sb, v) - - case templ.KeyValue[string, bool]: - if v.Value { - return processString(sb, v.Key) - } - return nil - - case templ.KeyValue[templ.SafeCSS, bool]: - if v.Value { - return processSafeCSS(sb, v.Key) - } - return nil - } - - // Fall back to reflection. - - // Handle functions first using reflection. - if handled, err := handleFuncWithReflection(sb, v); handled { - return err - } - - // Handle slices using reflection before concrete types. - if handled, err := handleSliceWithReflection(sb, v); handled { - return err - } - - _, err := sb.WriteString(TemplUnsupportedStyleAttributeValue) - return err -} - -func processSafeCSS(sb *strings.Builder, v templ.SafeCSS) error { - if v == "" { - return nil - } - sb.WriteString(html.EscapeString(string(v))) - if !strings.HasSuffix(string(v), ";") { - sb.WriteRune(';') - } - return nil -} - -func processString(sb *strings.Builder, v string) error { - if v == "" { - return nil - } - sanitized := strings.TrimSpace(safehtml.SanitizeStyleValue(v)) - sb.WriteString(html.EscapeString(sanitized)) - if !strings.HasSuffix(sanitized, ";") { - sb.WriteRune(';') - } - return nil -} - -var ErrInvalidStyleAttributeFunctionSignature = errors.New("invalid function signature, should be in the form func() (string, error)") - -// handleFuncWithReflection handles functions using reflection. -func handleFuncWithReflection(sb *strings.Builder, v any) (bool, error) { - rv := reflect.ValueOf(v) - if rv.Kind() != reflect.Func { - return false, nil - } - - t := rv.Type() - if t.NumIn() != 0 || (t.NumOut() != 1 && t.NumOut() != 2) { - return false, ErrInvalidStyleAttributeFunctionSignature - } - - // Check the types of the return values - if t.NumOut() == 2 { - // Ensure the second return value is of type `error` - secondReturnType := t.Out(1) - if !secondReturnType.Implements(reflect.TypeOf((*error)(nil)).Elem()) { - return false, fmt.Errorf("second return value must be of type error, got %v", secondReturnType) - } - } - - results := rv.Call(nil) - - if t.NumOut() == 2 { - // Check if the second return value is an error - if errVal := results[1].Interface(); errVal != nil { - if err, ok := errVal.(error); ok && err != nil { - return true, err - } - } - } - - return true, sanitizeStyleAttributeValue(sb, results[0].Interface()) -} - -// handleSliceWithReflection handles slices using reflection. -func handleSliceWithReflection(sb *strings.Builder, v any) (bool, error) { - rv := reflect.ValueOf(v) - if rv.Kind() != reflect.Slice { - return false, nil - } - for i := range rv.Len() { - elem := rv.Index(i).Interface() - if err := sanitizeStyleAttributeValue(sb, elem); err != nil { - return true, err - } - } - return true, nil -} - -// processStringMap processes a map[string]string. -func processStringMap(sb *strings.Builder, m map[string]string) error { - for _, name := range slices.Sorted(maps.Keys(m)) { - name, value := safehtml.SanitizeCSS(name, m[name]) - sb.WriteString(html.EscapeString(name)) - sb.WriteRune(':') - sb.WriteString(html.EscapeString(value)) - sb.WriteRune(';') - } - return nil -} - -// processSafeCSSPropertyMap processes a map[string]templ.SafeCSSProperty. -func processSafeCSSPropertyMap(sb *strings.Builder, m map[string]templ.SafeCSSProperty) error { - for _, name := range slices.Sorted(maps.Keys(m)) { - sb.WriteString(html.EscapeString(safehtml.SanitizeCSSProperty(name))) - sb.WriteRune(':') - sb.WriteString(html.EscapeString(string(m[name]))) - sb.WriteRune(';') - } - return nil -} - -// processStringKV processes a templ.KeyValue[string, string]. -func processStringKV(sb *strings.Builder, kv templ.KeyValue[string, string]) error { - name, value := safehtml.SanitizeCSS(kv.Key, kv.Value) - sb.WriteString(html.EscapeString(name)) - sb.WriteRune(':') - sb.WriteString(html.EscapeString(value)) - sb.WriteRune(';') - return nil -} - -// getJoinedErrorsFromValues collects and joins errors from the input values. -func getJoinedErrorsFromValues(values ...any) error { - var errs []error - for _, v := range values { - if err, ok := v.(error); ok { - errs = append(errs, err) - } - } - return errors.Join(errs...) -} - -// TemplUnsupportedStyleAttributeValue is the default value returned for unsupported types. -var TemplUnsupportedStyleAttributeValue = "zTemplUnsupportedStyleAttributeValue:Invalid;" diff --git a/vendor/github.com/a-h/templ/runtime/watchmode.go b/vendor/github.com/a-h/templ/runtime/watchmode.go deleted file mode 100644 index b083eb0..0000000 --- a/vendor/github.com/a-h/templ/runtime/watchmode.go +++ /dev/null @@ -1,148 +0,0 @@ -package runtime - -import ( - "crypto/sha256" - "encoding/hex" - "errors" - "fmt" - "io" - "os" - "path/filepath" - "runtime" - "strconv" - "strings" - "sync" - "time" -) - -var developmentMode = os.Getenv("TEMPL_DEV_MODE") == "true" - -func GetDevModeTextFileName(templFileName string) string { - if strings.HasSuffix(templFileName, "_templ.go") { - templFileName = strings.TrimSuffix(templFileName, "_templ.go") + ".templ" - } - absFileName, err := filepath.Abs(templFileName) - if err != nil { - absFileName = templFileName - } - absFileName, err = filepath.EvalSymlinks(absFileName) - if err != nil { - absFileName = templFileName - } - absFileName = normalizePath(absFileName) - - hashedFileName := sha256.Sum256([]byte(absFileName)) - outputFileName := fmt.Sprintf("templ_%s.txt", hex.EncodeToString(hashedFileName[:])) - - root := os.TempDir() - if os.Getenv("TEMPL_DEV_MODE_ROOT") != "" { - root = os.Getenv("TEMPL_DEV_MODE_ROOT") - } - - return filepath.Join(root, outputFileName) -} - -// normalizePath converts Windows paths to Unix style paths. -func normalizePath(p string) string { - p = strings.ReplaceAll(filepath.Clean(p), `\`, `/`) - parts := strings.SplitN(p, ":", 2) - if len(parts) == 2 && len(parts[0]) == 1 { - drive := strings.ToLower(parts[0]) - p = "/" + drive + parts[1] - } - return p -} - -// WriteString writes the string to the writer. If development mode is enabled -// s is replaced with the string at the index in the _templ.txt file. -func WriteString(w io.Writer, index int, s string) (err error) { - if developmentMode { - _, path, _, _ := runtime.Caller(1) - if !strings.HasSuffix(path, "_templ.go") { - return errors.New("templ: attempt to use WriteString from a non templ file") - } - path, err := filepath.EvalSymlinks(path) - if err != nil { - return fmt.Errorf("templ: failed to eval symlinks for %q: %w", path, err) - } - - txtFilePath := GetDevModeTextFileName(path) - literals, err := getWatchedStrings(txtFilePath) - if err != nil { - return fmt.Errorf("templ: failed to get watched strings for %q: %w", path, err) - } - if index > len(literals) { - return fmt.Errorf("templ: failed to find line %d in %s", index, txtFilePath) - } - - s, err = strconv.Unquote(`"` + literals[index-1] + `"`) - if err != nil { - return err - } - } - _, err = io.WriteString(w, s) - return err -} - -var ( - watchModeCache = map[string]watchState{} - watchStateMutex sync.Mutex -) - -type watchState struct { - modTime time.Time - strings []string -} - -func getWatchedStrings(txtFilePath string) ([]string, error) { - watchStateMutex.Lock() - defer watchStateMutex.Unlock() - - state, cached := watchModeCache[txtFilePath] - if !cached { - return cacheStrings(txtFilePath) - } - - if time.Since(state.modTime) < time.Millisecond*100 { - return state.strings, nil - } - - info, err := os.Stat(txtFilePath) - if err != nil { - return nil, fmt.Errorf("templ: failed to stat %s: %w", txtFilePath, err) - } - - if !info.ModTime().After(state.modTime) { - return state.strings, nil - } - - return cacheStrings(txtFilePath) -} - -func cacheStrings(txtFilePath string) ([]string, error) { - txtFile, err := os.Open(txtFilePath) - if err != nil { - return nil, fmt.Errorf("templ: failed to open %s: %w", txtFilePath, err) - } - defer func() { - _ = txtFile.Close() - }() - - info, err := txtFile.Stat() - if err != nil { - return nil, fmt.Errorf("templ: failed to stat %s: %w", txtFilePath, err) - } - - all, err := io.ReadAll(txtFile) - if err != nil { - return nil, fmt.Errorf("templ: failed to read %s: %w", txtFilePath, err) - } - - literals := strings.Split(string(all), "\n") - watchModeCache[txtFilePath] = watchState{ - modTime: info.ModTime(), - strings: literals, - } - - return literals, nil -} diff --git a/vendor/github.com/a-h/templ/safehtml/style.go b/vendor/github.com/a-h/templ/safehtml/style.go deleted file mode 100644 index 174c3c4..0000000 --- a/vendor/github.com/a-h/templ/safehtml/style.go +++ /dev/null @@ -1,199 +0,0 @@ -// Adapted from https://raw.githubusercontent.com/google/safehtml/3c4cd5b5d8c9a6c5882fba099979e9f50b65c876/style.go - -// Copyright (c) 2017 The Go Authors. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -package safehtml - -import ( - "bytes" - "fmt" - "net/url" - "regexp" - "strings" -) - -// SanitizeCSS attempts to sanitize CSS properties. -func SanitizeCSS(property, value string) (string, string) { - property = SanitizeCSSProperty(property) - if property == InnocuousPropertyName { - return InnocuousPropertyName, InnocuousPropertyValue - } - return property, SanitizeCSSValue(property, value) -} - -func SanitizeCSSValue(property, value string) string { - if sanitizer, ok := cssPropertyNameToValueSanitizer[property]; ok { - return sanitizer(value) - } - return sanitizeRegular(value) -} - -func SanitizeCSSProperty(property string) string { - if !identifierPattern.MatchString(property) { - return InnocuousPropertyName - } - return strings.ToLower(property) -} - -// identifierPattern matches a subset of valid <ident-token> values defined in -// https://www.w3.org/TR/css-syntax-3/#ident-token-diagram. This pattern matches all generic family name -// keywords defined in https://drafts.csswg.org/css-fonts-3/#family-name-value. -var identifierPattern = regexp.MustCompile(`^[-a-zA-Z]+$`) - -var cssPropertyNameToValueSanitizer = map[string]func(string) string{ - "background-image": sanitizeBackgroundImage, - "font-family": sanitizeFontFamily, - "display": sanitizeEnum, - "background-color": sanitizeRegular, - "background-position": sanitizeRegular, - "background-repeat": sanitizeRegular, - "background-size": sanitizeRegular, - "color": sanitizeRegular, - "height": sanitizeRegular, - "width": sanitizeRegular, - "left": sanitizeRegular, - "right": sanitizeRegular, - "top": sanitizeRegular, - "bottom": sanitizeRegular, - "font-weight": sanitizeRegular, - "padding": sanitizeRegular, - "z-index": sanitizeRegular, -} - -var validURLPrefixes = []string{ - `url("`, - `url('`, - `url(`, -} - -var validURLSuffixes = []string{ - `")`, - `')`, - `)`, -} - -func sanitizeBackgroundImage(v string) string { - // Check for <> as per https://github.com/google/safehtml/blob/be23134998433fcf0135dda53593fc8f8bf4df7c/style.go#L87C2-L89C3 - if strings.ContainsAny(v, "<>") { - return InnocuousPropertyValue - } - for _, u := range strings.Split(v, ",") { - u = strings.TrimSpace(u) - var found bool - for i, prefix := range validURLPrefixes { - if strings.HasPrefix(u, prefix) && strings.HasSuffix(u, validURLSuffixes[i]) { - found = true - u = strings.TrimPrefix(u, validURLPrefixes[i]) - u = strings.TrimSuffix(u, validURLSuffixes[i]) - break - } - } - if !found || !urlIsSafe(u) { - return InnocuousPropertyValue - } - } - return v -} - -func urlIsSafe(s string) bool { - u, err := url.Parse(s) - if err != nil { - return false - } - if u.IsAbs() { - if strings.EqualFold(u.Scheme, "http") || strings.EqualFold(u.Scheme, "https") || strings.EqualFold(u.Scheme, "mailto") { - return true - } - return false - } - return true -} - -var genericFontFamilyName = regexp.MustCompile(`^[a-zA-Z][- a-zA-Z]+$`) - -func sanitizeFontFamily(s string) string { - for _, f := range strings.Split(s, ",") { - f = strings.TrimSpace(f) - if strings.HasPrefix(f, `"`) { - if !strings.HasSuffix(f, `"`) { - return InnocuousPropertyValue - } - continue - } - if !genericFontFamilyName.MatchString(f) { - return InnocuousPropertyValue - } - } - return s -} - -func sanitizeEnum(s string) string { - if !safeEnumPropertyValuePattern.MatchString(s) { - return InnocuousPropertyValue - } - return s -} - -func sanitizeRegular(s string) string { - if !safeRegularPropertyValuePattern.MatchString(s) { - return InnocuousPropertyValue - } - return s -} - -// InnocuousPropertyName is an innocuous property generated by a sanitizer when its input is unsafe. -const InnocuousPropertyName = "zTemplUnsafeCSSPropertyName" - -// InnocuousPropertyValue is an innocuous property generated by a sanitizer when its input is unsafe. -const InnocuousPropertyValue = "zTemplUnsafeCSSPropertyValue" - -// safeRegularPropertyValuePattern matches strings that are safe to use as property values. -// Specifically, it matches string where every '*' or '/' is followed by end-of-text or a safe rune -// (i.e. alphanumerics or runes in the set [+-.!#%_ \t]). This regex ensures that the following -// are disallowed: -// - "/*" and "*/", which are CSS comment markers. -// - "//", even though this is not a comment marker in the CSS specification. Disallowing -// this string minimizes the chance that browser peculiarities or parsing bugs will allow -// sanitization to be bypassed. -// - '(' and ')', which can be used to call functions. -// - ',', since it can be used to inject extra values into a property. -// - Runes which could be matched on CSS error recovery of a previously malformed token, such as '@' -// and ':'. See http://www.w3.org/TR/css3-syntax/#error-handling. -var safeRegularPropertyValuePattern = regexp.MustCompile(`^(?:[*/]?(?:[0-9a-zA-Z+-.!#%_ \t]|$))*$`) - -// safeEnumPropertyValuePattern matches strings that are safe to use as enumerated property values. -// Specifically, it matches strings that contain only alphabetic and '-' runes. -var safeEnumPropertyValuePattern = regexp.MustCompile(`^[a-zA-Z-]*$`) - -// SanitizeStyleValue escapes s so that it is safe to put between "" to form a CSS <string-token>. -// See syntax at https://www.w3.org/TR/css-syntax-3/#string-token-diagram. -// -// On top of the escape sequences required in <string-token>, this function also escapes -// control runes to minimize the risk of these runes triggering browser-specific bugs. -// Taken from cssEscapeString in safehtml package. -func SanitizeStyleValue(s string) string { - var b bytes.Buffer - b.Grow(len(s)) - for _, c := range s { - switch { - case c == '\u0000': - // Replace the NULL byte according to https://www.w3.org/TR/css-syntax-3/#input-preprocessing. - // We take this extra precaution in case the user agent fails to handle NULL properly. - b.WriteString("\uFFFD") - case c == '<', // Prevents breaking out of a style element with `</style>`. Escape this in case the Style user forgets to. - c == '"', c == '\\', // Must be CSS-escaped in <string-token>. U+000A line feed is handled in the next case. - c <= '\u001F', c == '\u007F', // C0 control codes - c >= '\u0080' && c <= '\u009F', // C1 control codes - c == '\u2028', c == '\u2029': // Unicode newline characters - // See CSS escape sequence syntax at https://www.w3.org/TR/css-syntax-3/#escape-diagram. - fmt.Fprintf(&b, "\\%06X", c) - default: - b.WriteRune(c) - } - } - return b.String() -} diff --git a/vendor/github.com/a-h/templ/scripttemplate.go b/vendor/github.com/a-h/templ/scripttemplate.go deleted file mode 100644 index 0aafa0b..0000000 --- a/vendor/github.com/a-h/templ/scripttemplate.go +++ /dev/null @@ -1,151 +0,0 @@ -package templ - -import ( - "context" - "encoding/json" - "fmt" - "html" - "io" - "regexp" - "strings" -) - -// ComponentScript is a templ Script template. -type ComponentScript struct { - // Name of the script, e.g. print. - Name string - // Function to render. - Function string - // Call of the function in JavaScript syntax, including parameters, and - // ensures parameters are HTML escaped; useful for injecting into HTML - // attributes like onclick, onhover, etc. - // - // Given: - // functionName("some string",12345) - // It would render: - // __templ_functionName_sha("some string",12345)) - // - // This is can be injected into HTML attributes: - // <button onClick="__templ_functionName_sha("some string",12345))">Click Me</button> - Call string - // Call of the function in JavaScript syntax, including parameters. It - // does not HTML escape parameters; useful for directly calling in script - // elements. - // - // Given: - // functionName("some string",12345) - // It would render: - // __templ_functionName_sha("some string",12345)) - // - // This is can be used to call the function inside a script tag: - // <script>__templ_functionName_sha("some string",12345))</script> - CallInline string -} - -var _ Component = ComponentScript{} - -func writeScriptHeader(ctx context.Context, w io.Writer) (err error) { - var nonceAttr string - if nonce := GetNonce(ctx); nonce != "" { - nonceAttr = " nonce=\"" + EscapeString(nonce) + "\"" - } - _, err = fmt.Fprintf(w, `<script%s>`, nonceAttr) - return err -} - -func (c ComponentScript) Render(ctx context.Context, w io.Writer) error { - err := RenderScriptItems(ctx, w, c) - if err != nil { - return err - } - if len(c.Call) > 0 { - if err = writeScriptHeader(ctx, w); err != nil { - return err - } - if _, err = io.WriteString(w, c.CallInline); err != nil { - return err - } - if _, err = io.WriteString(w, `</script>`); err != nil { - return err - } - } - return nil -} - -// RenderScriptItems renders a <script> element, if the script has not already been rendered. -func RenderScriptItems(ctx context.Context, w io.Writer, scripts ...ComponentScript) (err error) { - if len(scripts) == 0 { - return nil - } - _, v := getContext(ctx) - sb := new(strings.Builder) - for _, s := range scripts { - if !v.hasScriptBeenRendered(s.Name) { - sb.WriteString(s.Function) - v.addScript(s.Name) - } - } - if sb.Len() > 0 { - if err = writeScriptHeader(ctx, w); err != nil { - return err - } - if _, err = io.WriteString(w, sb.String()); err != nil { - return err - } - if _, err = io.WriteString(w, `</script>`); err != nil { - return err - } - } - return nil -} - -// JSExpression represents a JavaScript expression intended for use as an argument for script templates. -// The string value of JSExpression will be inserted directly as JavaScript code in function call arguments. -type JSExpression string - -// SafeScript encodes unknown parameters for safety for inside HTML attributes. -func SafeScript(functionName string, params ...any) string { - if !jsFunctionName.MatchString(functionName) { - functionName = "__templ_invalid_js_function_name" - } - sb := new(strings.Builder) - sb.WriteString(html.EscapeString(functionName)) - sb.WriteRune('(') - for i, p := range params { - sb.WriteString(EscapeString(jsonEncodeParam(p))) - if i < len(params)-1 { - sb.WriteRune(',') - } - } - sb.WriteRune(')') - return sb.String() -} - -// SafeScript encodes unknown parameters for safety for inline scripts. -func SafeScriptInline(functionName string, params ...any) string { - if !jsFunctionName.MatchString(functionName) { - functionName = "__templ_invalid_js_function_name" - } - sb := new(strings.Builder) - sb.WriteString(functionName) - sb.WriteRune('(') - for i, p := range params { - sb.WriteString(jsonEncodeParam(p)) - if i < len(params)-1 { - sb.WriteRune(',') - } - } - sb.WriteRune(')') - return sb.String() -} - -func jsonEncodeParam(param any) string { - if val, ok := param.(JSExpression); ok { - return string(val) - } - enc, _ := json.Marshal(param) - return string(enc) -} - -// isValidJSFunctionName returns true if the given string is a valid JavaScript function name, e.g. console.log, alert, etc. -var jsFunctionName = regexp.MustCompile(`^([$_a-zA-Z][$_a-zA-Z0-9]+\.?)+$`) diff --git a/vendor/github.com/a-h/templ/templ.png b/vendor/github.com/a-h/templ/templ.png Binary files differdeleted file mode 100644 index 1c4bc2f..0000000 --- a/vendor/github.com/a-h/templ/templ.png +++ /dev/null diff --git a/vendor/github.com/a-h/templ/url.go b/vendor/github.com/a-h/templ/url.go deleted file mode 100644 index 860323d..0000000 --- a/vendor/github.com/a-h/templ/url.go +++ /dev/null @@ -1,31 +0,0 @@ -package templ - -import ( - "errors" - "strings" -) - -// FailedSanitizationURL is returned if a URL fails sanitization checks. -const FailedSanitizationURL = SafeURL("about:invalid#TemplFailedSanitizationURL") - -// URL sanitizes the input string s and returns a SafeURL. -func URL(s string) SafeURL { - if i := strings.IndexRune(s, ':'); i >= 0 && !strings.ContainsRune(s[:i], '/') { - protocol := s[:i] - if !strings.EqualFold(protocol, "http") && !strings.EqualFold(protocol, "https") && !strings.EqualFold(protocol, "mailto") && !strings.EqualFold(protocol, "tel") && !strings.EqualFold(protocol, "ftp") && !strings.EqualFold(protocol, "ftps") { - return FailedSanitizationURL - } - } - return SafeURL(s) -} - -// SafeURL is a URL that has been sanitized. -type SafeURL string - -// JoinURLErrs joins an optional list of errors and returns a sanitized SafeURL. -func JoinURLErrs[T ~string](s T, errs ...error) (SafeURL, error) { - if safeURL, ok := any(s).(SafeURL); ok { - return safeURL, errors.Join(errs...) - } - return URL(string(s)), errors.Join(errs...) -} diff --git a/vendor/github.com/a-h/templ/version.go b/vendor/github.com/a-h/templ/version.go deleted file mode 100644 index b7fbb6f..0000000 --- a/vendor/github.com/a-h/templ/version.go +++ /dev/null @@ -1,10 +0,0 @@ -package templ - -import _ "embed" - -//go:embed .version -var version string - -func Version() string { - return "v" + version -} diff --git a/vendor/github.com/a-h/templ/watchmode.go b/vendor/github.com/a-h/templ/watchmode.go deleted file mode 100644 index a94dab2..0000000 --- a/vendor/github.com/a-h/templ/watchmode.go +++ /dev/null @@ -1,105 +0,0 @@ -package templ - -import ( - "errors" - "fmt" - "io" - "os" - "runtime" - "strconv" - "strings" - "sync" - "time" -) - -// WriteWatchModeString is used when rendering templates in development mode. -// the generator would have written non-go code to the _templ.txt file, which -// is then read by this function and written to the output. -// -// Deprecated: since templ v0.3.x generated code uses WriteString. -func WriteWatchModeString(w io.Writer, lineNum int) error { - _, path, _, _ := runtime.Caller(1) - if !strings.HasSuffix(path, "_templ.go") { - return errors.New("templ: WriteWatchModeString can only be called from _templ.go") - } - txtFilePath := strings.Replace(path, "_templ.go", "_templ.txt", 1) - - literals, err := getWatchedStrings(txtFilePath) - if err != nil { - return fmt.Errorf("templ: failed to cache strings: %w", err) - } - - if lineNum > len(literals) { - return fmt.Errorf("templ: failed to find line %d in %s", lineNum, txtFilePath) - } - - s, err := strconv.Unquote(`"` + literals[lineNum-1] + `"`) - if err != nil { - return err - } - _, err = io.WriteString(w, s) - return err -} - -var ( - watchModeCache = map[string]watchState{} - watchStateMutex sync.Mutex -) - -type watchState struct { - modTime time.Time - strings []string -} - -func getWatchedStrings(txtFilePath string) ([]string, error) { - watchStateMutex.Lock() - defer watchStateMutex.Unlock() - - state, cached := watchModeCache[txtFilePath] - if !cached { - return cacheStrings(txtFilePath) - } - - if time.Since(state.modTime) < time.Millisecond*100 { - return state.strings, nil - } - - info, err := os.Stat(txtFilePath) - if err != nil { - return nil, fmt.Errorf("templ: failed to stat %s: %w", txtFilePath, err) - } - - if !info.ModTime().After(state.modTime) { - return state.strings, nil - } - - return cacheStrings(txtFilePath) -} - -func cacheStrings(txtFilePath string) ([]string, error) { - txtFile, err := os.Open(txtFilePath) - if err != nil { - return nil, fmt.Errorf("templ: failed to open %s: %w", txtFilePath, err) - } - defer func() { - _ = txtFile.Close() - }() - - info, err := txtFile.Stat() - if err != nil { - return nil, fmt.Errorf("templ: failed to stat %s: %w", txtFilePath, err) - } - - all, err := io.ReadAll(txtFile) - if err != nil { - return nil, fmt.Errorf("templ: failed to read %s: %w", txtFilePath, err) - } - - literals := strings.Split(string(all), "\n") - watchModeCache[txtFilePath] = watchState{ - modTime: info.ModTime(), - strings: literals, - } - - return literals, nil -} diff --git a/vendor/github.com/elastic/go-freelru/.gitignore b/vendor/github.com/elastic/go-freelru/.gitignore deleted file mode 100644 index 1ecfb24..0000000 --- a/vendor/github.com/elastic/go-freelru/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.test - -#jetBrains editors -.idea diff --git a/vendor/github.com/elastic/go-freelru/.golangci.yml b/vendor/github.com/elastic/go-freelru/.golangci.yml deleted file mode 100644 index 5099e2f..0000000 --- a/vendor/github.com/elastic/go-freelru/.golangci.yml +++ /dev/null @@ -1,138 +0,0 @@ -service: - golangci-lint-version: 1.48.x - -issues: - exclude-dirs: - - artifacts - - build-targets - - design - - docker-images - - docs - - etc - - experiments - - infrastructure - - legal - - libpf-rs - - mocks - - pf-code-indexing-service/cibackend/gomock_* - - pf-debug-metadata-service/dmsbackend/gomock_* - - pf-host-agent/support/ci-kernels - - pf-storage-backend/storagebackend/gomock_* - - scratch - - systemtests/benchmarks/_outdata - - target - - virt-tests - - vm-images - -linters: - enable-all: true - disable: - # Disabled because of - # - too many non-sensical warnings - # - not relevant for us - # - false positives - # - # "might be worth fixing" means we should investigate/fix in the mid term - - containedctx # might be worth fixing - - contextcheck # might be worth fixing - - cyclop - - depguard - - dupword - - durationcheck # might be worth fixing - - err113 - - errname # might be worth fixing - - errorlint # might be worth fixing - - exhaustive - - exhaustruct - - forcetypeassert # might be worth fixing - - funlen - - gci # might be worth fixing - - gochecknoglobals - - gochecknoinits - - gocognit - - gocyclo - - godot - - godox # complains about TODO etc - - gofumpt - - goimports # might be worth fixing - - gomnd - - gomoddirectives - - interfacebloat - - ireturn - - maintidx - - makezero - - mnd - - nestif - - nilerr # might be worth fixing - - nilnil - - nlreturn - - noctx # might be worth fixing - - nolintlint - - nonamedreturns - - paralleltest - - sqlclosecheck # might be worth fixing - - tagalign - - tagliatelle - - testableexamples # might be worth fixing - - testpackage - - tparallel # might be worth fixing - - thelper - - varnamelen - - wastedassign - - wsl - - wrapcheck - - forbidigo - # the following linters are deprecated - - execinquery - # we don't want to change code to Go 1.22+ yet - - intrange - - copyloopvar - -linters-settings: - goconst: - min-len: 2 - min-occurrences: 2 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - - wrapperFunc - - sloppyReassign - - uncheckedInlineErr # Experimental rule with high false positive rate. - - # Broken with Go 1.18 feature (https://github.com/golangci/golangci-lint/issues/2649): - - hugeParam - - rangeValCopy - - typeDefFirst - - paramTypeCombine - gocyclo: - min-complexity: 15 - govet: - enable-all: true - disable: - - fieldalignment - settings: - printf: # analyzer name, run `go tool vet help` to see all analyzers - funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer - - debug,debugf,debugln - - error,errorf,errorln - - fatal,fatalf,fataln - - info,infof,infoln - - log,logf,logln - - warn,warnf,warnln - - print,printf,println,sprint,sprintf,sprintln,fprint,fprintf,fprintln - lll: - line-length: 120 - tab-width: 4 - maligned: - suggest-new: true - misspell: - locale: US diff --git a/vendor/github.com/elastic/go-freelru/CODE_OF_CONDUCT.md b/vendor/github.com/elastic/go-freelru/CODE_OF_CONDUCT.md deleted file mode 100644 index c286a31..0000000 --- a/vendor/github.com/elastic/go-freelru/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,3 +0,0 @@ -303 See Other - -Location: https://www.elastic.co/community/codeofconduct diff --git a/vendor/github.com/elastic/go-freelru/LICENSE b/vendor/github.com/elastic/go-freelru/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/vendor/github.com/elastic/go-freelru/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/elastic/go-freelru/Makefile b/vendor/github.com/elastic/go-freelru/Makefile deleted file mode 100644 index 7454ac7..0000000 --- a/vendor/github.com/elastic/go-freelru/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -.PHONY: bench check tests clean - -tests: check - -check: - @go test ./... -benchmem -race - -clean: - @rm *.test */*.test - -bench: - @(cd bench; go test -bench=. -run XXX) - -GOLANGCI_LINT_VERSION = "v1.60.1" -lint: - @go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run diff --git a/vendor/github.com/elastic/go-freelru/NOTICE b/vendor/github.com/elastic/go-freelru/NOTICE deleted file mode 100644 index 9b1c877..0000000 --- a/vendor/github.com/elastic/go-freelru/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -Go LRU Hashmap -Copyright 2022 Elasticsearch B.V. diff --git a/vendor/github.com/elastic/go-freelru/README.md b/vendor/github.com/elastic/go-freelru/README.md deleted file mode 100644 index 04fa9b7..0000000 --- a/vendor/github.com/elastic/go-freelru/README.md +++ /dev/null @@ -1,305 +0,0 @@ -[](https://pkg.go.dev/github.com/elastic/go-freelru) -[](https://goreportcard.com/report/github.com/elastic/go-freelru) -[](https://coveralls.io/github/elastic/go-freelru?branch=main) -[](https://github.com/avelino/awesome-go) - - -# FreeLRU - A GC-less, fast and generic LRU hashmap library for Go - -FreeLRU allows you to cache objects without introducing GC overhead. -It uses Go generics for simplicity, type-safety and performance over interface types. -It performs better than other LRU implementations in the Go benchmarks provided. -The API is simple in order to ease migrations from other LRU implementations. -The function to calculate hashes from the keys needs to be provided by the caller. - -## `LRU`: Single-threaded LRU hashmap - -`LRU` is a single-threaded LRU hashmap implementation. -It uses a fast exact LRU algorithm and has no locking overhead. -It has been developed for low-GC overhead and type-safety. -For thread-safety, pick one of `SyncedLRU` or `ShardedLRU` or do locking by yourself. - -### Comparison with other single-threaded LRU implementations -Get (key and value are both of type `int`) -``` -BenchmarkFreeLRUGet 73456962 15.17 ns/op 0 B/op 0 allocs/op -BenchmarkSimpleLRUGet 91878808 12.09 ns/op 0 B/op 0 allocs/op -BenchmarkMapGet 173823274 6.884 ns/op 0 B/op 0 allocs/op -``` -Add -``` -BenchmarkFreeLRUAdd_int_int 39446706 30.04 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_int_int128 39622722 29.71 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_uint32_uint64 43750496 26.97 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_string_uint64 25839464 39.31 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_int_string 37269870 30.55 ns/op 0 B/op 0 allocs/op - -BenchmarkSimpleLRUAdd_int_int 12471030 86.33 ns/op 48 B/op 1 allocs/op -BenchmarkSimpleLRUAdd_int_int128 11981545 85.70 ns/op 48 B/op 1 allocs/op -BenchmarkSimpleLRUAdd_uint32_uint64 11506755 87.52 ns/op 48 B/op 1 allocs/op -BenchmarkSimpleLRUAdd_string_uint64 8674652 142.8 ns/op 49 B/op 1 allocs/op -BenchmarkSimpleLRUAdd_int_string 12267968 87.77 ns/op 48 B/op 1 allocs/op - -BenchmarkMapAdd_int_int 34951609 48.08 ns/op 0 B/op 0 allocs/op -BenchmarkMapAdd_int_int128 31082216 47.05 ns/op 0 B/op 0 allocs/op -BenchmarkMapAdd_uint32_uint64 36277005 48.08 ns/op 0 B/op 0 allocs/op -BenchmarkMapAdd_string_uint64 29380040 49.37 ns/op 0 B/op 0 allocs/op -BenchmarkMapAdd_int_string 30325861 47.35 ns/op 0 B/op 0 allocs/op -``` - -The comparison with Map is just for reference - Go maps don't implement LRU functionality and thus should -be significantly faster than LRU implementations. - -## `SyncedLRU`: Concurrent LRU hashmap for low concurrency. - -`SyncedLRU` is a concurrency-safe LRU hashmap implementation wrapped around `LRU`. -It is best used in low-concurrency environments where lock contention isn't a thing to worry about. -It uses an exact LRU algorithm. - -## `ShardedLRU`: Concurrent LRU hashmap for high concurrency - -`ShardedLRU` is a sharded, concurrency-safe LRU hashmap implementation. -It is best used in high-concurrency environments where lock contention is a thing. -Due to the sharded nature, it uses an approximate LRU algorithm. - -FreeLRU is for single-threaded use only. -For thread-safety, the locking of operations needs to be controlled by the caller. - -### Comparison with other multithreaded LRU implementations -Add with `GOMAXPROCS=1` -``` -BenchmarkParallelSyncedFreeLRUAdd_int_int128 42022706 28.27 ns/op 0 B/op 0 allocs/op -BenchmarkParallelShardedFreeLRUAdd_int_int128 35353412 33.33 ns/op 0 B/op 0 allocs/op -BenchmarkParallelFreeCacheAdd_int_int128 14825518 79.58 ns/op 0 B/op 0 allocs/op -BenchmarkParallelRistrettoAdd_int_int128 5565997 206.1 ns/op 121 B/op 3 allocs/op -BenchmarkParallelPhusluAdd_int_int128 28041186 41.26 ns/op 0 B/op 0 allocs/op -BenchmarkParallelCloudflareAdd_int_int128 6300747 185.0 ns/op 48 B/op 2 allocs/op -``` -Add with `GOMAXPROCS=1000` -``` -BenchmarkParallelSyncedFreeLRUAdd_int_int128-1000 12251070 138.9 ns/op 0 B/op 0 allocs/op -BenchmarkParallelShardedFreeLRUAdd_int_int128-1000 112706306 10.59 ns/op 0 B/op 0 allocs/op -BenchmarkParallelFreeCacheAdd_int_int128-1000 47873679 24.14 ns/op 0 B/op 0 allocs/op -BenchmarkParallelRistrettoAdd_int_int128-1000 69838436 16.93 ns/op 104 B/op 3 allocs/op -BenchmarkParallelOracamanMapAdd_int_int128-1000 25694386 40.48 ns/op 37 B/op 0 allocs/op -BenchmarkParallelPhusluAdd_int_int128-1000 89379122 14.19 ns/op 0 B/op 0 allocs/op -``` -`Ristretto` offloads the LRU functionality of `Add()` to a separate goroutine, which is why it is relatively fast. But the -separate goroutine doesn't show up in the benchmarks, so the numbers are not directly comparable. - -`Oracaman` is not an LRU implementation, just a thread-safety wrapper around `map`. - -Get with `GOMAXPROCS=1` -``` -BenchmarkParallelSyncedGet 43031780 27.35 ns/op 0 B/op 0 allocs/op -BenchmarkParallelShardedGet 51807500 22.86 ns/op 0 B/op 0 allocs/op -BenchmarkParallelFreeCacheGet 21948183 53.52 ns/op 16 B/op 1 allocs/op -BenchmarkParallelRistrettoGet 30343872 33.82 ns/op 7 B/op 0 allocs/op -BenchmarkParallelBigCacheGet 21073627 51.08 ns/op 16 B/op 2 allocs/op -BenchmarkParallelPhusluGet 59487482 20.02 ns/op 0 B/op 0 allocs/op -BenchmarkParallelCloudflareGet 17011405 67.11 ns/op 8 B/op 1 allocs/op -``` -Get with `GOMAXPROCS=1000` -``` -BenchmarkParallelSyncedGet-1000 10867552 151.0 ns/op 0 B/op 0 allocs/op -BenchmarkParallelShardedGet-1000 287238988 4.061 ns/op 0 B/op 0 allocs/op -BenchmarkParallelFreeCacheGet-1000 78045916 15.33 ns/op 16 B/op 1 allocs/op -BenchmarkParallelRistrettoGet-1000 214839645 6.060 ns/op 7 B/op 0 allocs/op -BenchmarkParallelBigCacheGet-1000 163672804 7.282 ns/op 16 B/op 2 allocs/op -BenchmarkParallelPhusluGet-1000 200133655 6.039 ns/op 0 B/op 0 allocs/op -BenchmarkParallelCloudflareGet-1000 100000000 11.26 ns/op 8 B/op 1 allocs/op -``` -`Cloudflare` and `BigCache` only accept `string` as the key type. -So the ser/deser of `int` to `string` is part of the benchmarks for a fair comparison - -Here you can see that `SyncedLRU` badly suffers from lock contention. -`ShardedLRU` is ~37x faster than `SyncedLRU` in a high-concurrency situation and the second -fastest LRU implementation (`Ristretto` and `Phuslu`) is 50% slower. - -### Merging hashmap and ringbuffer - -Most LRU implementations combine Go's `map` for the key/value lookup and their own implementation of -a circular doubly-linked list for keeping track of the recent-ness of objects. -This requires one additional heap allocation for the list element. A second downside is that the list -elements are not contiguous in memory, which causes more (expensive) CPU cache misses for accesses. - -FreeLRU addresses both issues by merging hashmap and ringbuffer into a contiguous array of elements. -Each element contains key, value and two indices to keep the cached objects ordered by recent-ness. - -### Avoiding GC overhead - -The contiguous array of elements is allocated on cache creation time. -So there is only a single memory object instead of possibly millions that the GC needs to iterate during -a garbage collection phase. -The GC overhead can be quite large in comparison with the overall CPU usage of an application. -Especially long-running and low-CPU applications with lots of cached objects suffer from the GC overhead. - -### Type safety by using generics - -Using generics allows type-checking at compile time, so type conversions are not needed at runtime. -The interface type or `any` requires type conversions at runtime, which may fail. - -### Reducing memory allocations by using generics - -The interface types (aka `any`) is a pointer type and thus require a heap allocation when being stored. -This is true even if you just need an integer to integer lookup or translation. - -With generics, the two allocations for key and value can be avoided: as long as the key and value types do not contain -pointer types, no allocations will take place when adding such objects to the cache. - -### Overcommitting of hashtable memory - -Each hashtable implementation tries to avoid hash collisions because collisions are expensive. -FreeLRU allows allocating more elements than the maximum number of elements stored. -This value is configurable and can be increased to reduce the likeliness of collisions. -The performance of the LRU operations will generally become faster by doing so. -Setting the size of LRU to a value of 2^N is recognized to replace slow divisions by fast bitwise AND operations. - -## Benchmarks - -Below we compare FreeLRU with SimpleLRU, FreeCache and Go map. -The comparison with FreeCache is just for reference - it is thread-safe and comes with a mutex/locking overhead. -The comparison with Go map is also just for reference - Go maps don't implement LRU functionality and thus should -be significantly faster than FreeLRU. It turns out, the opposite is the case. - -The numbers are from my laptop (Intel(R) Core(TM) i7-12800H @ 2800 MHz). - -The key and value types are part of the benchmark name, e.g. `int_int` means key and value are of type `int`. -`int128` is a struct type made of two `uint64` fields. - -To run the benchmarks -``` -make benchmarks -``` - -### Adding objects - -FreeLRU is ~3.5x faster than SimpleLRU, no surprise. -But it is also significantly faster than Go maps, which is a bit of a surprise. - -This is with 0% memory overcommitment (default) and a capacity of 8192. - ``` -BenchmarkFreeLRUAdd_int_int-20 43097347 27.41 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_int_int128-20 42129165 28.38 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_uint32_uint64-20 98322132 11.74 ns/op 0 B/op 0 allocs/op (*) -BenchmarkFreeLRUAdd_string_uint64-20 39122446 31.12 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_int_string-20 81920673 14.00 ns/op 0 B/op 0 allocs/op (*) -BenchmarkSimpleLRUAdd_int_int-20 12253708 93.85 ns/op 48 B/op 1 allocs/op -BenchmarkSimpleLRUAdd_int_int128-20 12095150 94.26 ns/op 48 B/op 1 allocs/op -BenchmarkSimpleLRUAdd_uint32_uint64-20 12367568 92.60 ns/op 48 B/op 1 allocs/op -BenchmarkSimpleLRUAdd_string_uint64-20 10395525 119.0 ns/op 49 B/op 1 allocs/op -BenchmarkSimpleLRUAdd_int_string-20 12373900 94.40 ns/op 48 B/op 1 allocs/op -BenchmarkFreeCacheAdd_int_int-20 9691870 122.9 ns/op 1 B/op 0 allocs/op -BenchmarkFreeCacheAdd_int_int128-20 9240273 125.6 ns/op 1 B/op 0 allocs/op -BenchmarkFreeCacheAdd_uint32_uint64-20 8140896 132.1 ns/op 1 B/op 0 allocs/op -BenchmarkFreeCacheAdd_string_uint64-20 8248917 137.9 ns/op 1 B/op 0 allocs/op -BenchmarkFreeCacheAdd_int_string-20 8079253 145.0 ns/op 64 B/op 1 allocs/op -BenchmarkRistrettoAdd_int_int-20 11102623 100.1 ns/op 109 B/op 2 allocs/op -BenchmarkRistrettoAdd_int128_int-20 10317686 113.5 ns/op 129 B/op 4 allocs/op -BenchmarkRistrettoAdd_uint32_uint64-20 12892147 94.28 ns/op 104 B/op 2 allocs/op -BenchmarkRistrettoAdd_string_uint64-20 11266416 105.8 ns/op 122 B/op 3 allocs/op -BenchmarkRistrettoAdd_int_string-20 10360814 107.4 ns/op 129 B/op 4 allocs/op -BenchmarkMapAdd_int_int-20 35306983 46.29 ns/op 0 B/op 0 allocs/op -BenchmarkMapAdd_int_int128-20 30986126 45.16 ns/op 0 B/op 0 allocs/op -BenchmarkMapAdd_string_uint64-20 28406497 49.35 ns/op 0 B/op 0 allocs/op -``` -(*) -There is an interesting affect when using increasing number (0..N) as keys in combination with FNV1a(). -The number of collisions is strongly reduced here, thus the high performance. -Exchanging the sequential numbers with random numbers results in roughly the same performance as the other results. - -Just to give you an idea for 100% memory overcommitment: -Performance increased by ~20%. -``` -BenchmarkFreeLRUAdd_int_int-20 53473030 21.52 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_int_int128-20 52852280 22.10 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_uint32_uint64-20 100000000 10.15 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_string_uint64-20 49477594 24.55 ns/op 0 B/op 0 allocs/op -BenchmarkFreeLRUAdd_int_string-20 85288306 12.10 ns/op 0 B/op 0 allocs/op -``` - -### Getting objects - -This is with 0% memory overcommitment (default) and a capacity of 8192. -``` -BenchmarkFreeLRUGet-20 83158561 13.80 ns/op 0 B/op 0 allocs/op -BenchmarkSimpleLRUGet-20 146248706 8.199 ns/op 0 B/op 0 allocs/op -BenchmarkFreeCacheGet-20 58229779 19.56 ns/op 0 B/op 0 allocs/op -BenchmarkRistrettoGet-20 31157457 35.37 ns/op 10 B/op 1 allocs/op -BenchmarkPhusluGet-20 55071919 20.63 ns/op 0 B/op 0 allocs/op -BenchmarkMapGet-20 195464706 6.031 ns/op 0 B/op 0 allocs/op -``` - -## Example usage - -```go -package main - -import ( - "fmt" - - "github.com/cespare/xxhash/v2" - - "github.com/elastic/go-freelru" -) - -// more hash function in https://github.com/elastic/go-freelru/blob/main/bench/hash.go -func hashStringXXHASH(s string) uint32 { - return uint32(xxhash.Sum64String(s)) -} - -func main() { - lru, err := freelru.New[string, uint64](8192, hashStringXXHASH) - if err != nil { - panic(err) - } - - key := "go-freelru" - val := uint64(999) - lru.Add(key, val) - - if v, ok := lru.Get(key); ok { - fmt.Printf("found %v=%v\n", key, v) - } - - // Output: - // found go-freelru=999 -} -``` - -The function `hashInt(int) uint32` will be called to calculate a hash value of the key. -Please take a look into `bench/` directory to find examples of hash functions. -Here you will also find an amd64 version of the Go internal hash function, which uses AESENC features -of the CPU. - -In case you already have a hash that you want to use as the key, you have to provide an "identity" function. - -## Comparison of hash functions -Hashing `int` -``` -BenchmarkHashInt_MapHash-20 181521530 6.806 ns/op 0 B/op 0 allocs/op -BenchmarkHashInt_MapHasher-20 727805824 1.595 ns/op 0 B/op 0 allocs/op -BenchmarkHashInt_FNV1A-20 621439513 1.919 ns/op 0 B/op 0 allocs/op -BenchmarkHashInt_FNV1AUnsafe-20 706583145 1.699 ns/op 0 B/op 0 allocs/op -BenchmarkHashInt_AESENC-20 1000000000 0.9659 ns/op 0 B/op 0 allocs/op -BenchmarkHashInt_XXHASH-20 516779404 2.341 ns/op 0 B/op 0 allocs/op -BenchmarkHashInt_XXH3HASH-20 562645186 2.127 ns/op 0 B/op 0 allocs/op -``` -Hashing `string` -``` -BenchmarkHashString_MapHash-20 72106830 15.80 ns/op 0 B/op 0 allocs/op -BenchmarkHashString_MapHasher-20 385338830 2.868 ns/op 0 B/op 0 allocs/op -BenchmarkHashString_FNV1A-20 60162328 19.33 ns/op 0 B/op 0 allocs/op -BenchmarkHashString_AESENC-20 475896514 2.472 ns/op 0 B/op 0 allocs/op -BenchmarkHashString_XXHASH-20 185842404 6.476 ns/op 0 B/op 0 allocs/op -BenchmarkHashString_XXH3HASH-20 375255375 3.182 ns/op 0 B/op 0 allocs/op -``` -As you can see, the speed depends on the object type to hash. I think, it mostly boils down to the size of the object. -`MapHasher` is dangerous to use because it is not guaranteed to be stable across Go versions. -`AESENC` uses the AES CPU extensions on X86-64. In theory, it should work on ARM64 as well (not tested by me). - -For a small number of bytes, `FNV1A` is the fastest. -Otherwise, `XXH3` looks like a good choice. - -## License -The code is licensed under the Apache 2.0 license. See the `LICENSE` file for details. diff --git a/vendor/github.com/elastic/go-freelru/cache.go b/vendor/github.com/elastic/go-freelru/cache.go deleted file mode 100644 index 8f159af..0000000 --- a/vendor/github.com/elastic/go-freelru/cache.go +++ /dev/null @@ -1,90 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package freelru - -import "time" - -type Cache[K comparable, V any] interface { - // SetLifetime sets the default lifetime of LRU elements. - // Lifetime 0 means "forever". - SetLifetime(lifetime time.Duration) - - // SetOnEvict sets the OnEvict callback function. - // The onEvict function is called for each evicted lru entry. - SetOnEvict(onEvict OnEvictCallback[K, V]) - - // Len returns the number of elements stored in the cache. - Len() int - - // AddWithLifetime adds a key:value to the cache with a lifetime. - // Returns true, true if key was updated and eviction occurred. - AddWithLifetime(key K, value V, lifetime time.Duration) (evicted bool) - - // Add adds a key:value to the cache. - // Returns true, true if key was updated and eviction occurred. - Add(key K, value V) (evicted bool) - - // Get returns the value associated with the key, setting it as the most - // recently used item. - // If the found cache item is already expired, the evict function is called - // and the return value indicates that the key was not found. - Get(key K) (V, bool) - - // GetAndRefresh returns the value associated with the key, setting it as the most - // recently used item. - // The lifetime of the found cache item is refreshed, even if it was already expired. - GetAndRefresh(key K, lifetime time.Duration) (V, bool) - - // Peek looks up a key's value from the cache, without changing its recent-ness. - // If the found entry is already expired, the evict function is called. - Peek(key K) (V, bool) - - // Contains checks for the existence of a key, without changing its recent-ness. - // If the found entry is already expired, the evict function is called. - Contains(key K) bool - - // Remove removes the key from the cache. - // The return value indicates whether the key existed or not. - // The evict function is called for the removed entry. - Remove(key K) bool - - // RemoveOldest removes the oldest entry from the cache. - // Key, value and an indicator of whether the entry has been removed is returned. - // The evict function is called for the removed entry. - RemoveOldest() (key K, value V, removed bool) - - // Keys returns a slice of the keys in the cache, from oldest to newest. - // Expired entries are not included. - // The evict function is called for each expired item. - Keys() []K - - // Purge purges all data (key and value) from the LRU. - // The evict function is called for each expired item. - // The LRU metrics are reset. - Purge() - - // PurgeExpired purges all expired items from the LRU. - // The evict function is called for each expired item. - PurgeExpired() - - // Metrics returns the metrics of the cache. - Metrics() Metrics - - // ResetMetrics resets the metrics of the cache and returns the previous state. - ResetMetrics() Metrics -} diff --git a/vendor/github.com/elastic/go-freelru/lru.go b/vendor/github.com/elastic/go-freelru/lru.go deleted file mode 100644 index b4f5769..0000000 --- a/vendor/github.com/elastic/go-freelru/lru.go +++ /dev/null @@ -1,641 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package freelru - -import ( - "errors" - "fmt" - "math" - "math/bits" - "time" -) - -// OnEvictCallback is the type for the eviction function. -type OnEvictCallback[K comparable, V any] func(K, V) - -// HashKeyCallback is the function that creates a hash from the passed key. -type HashKeyCallback[K comparable] func(K) uint32 - -type element[K comparable, V any] struct { - key K - value V - - // bucketNext and bucketPrev are indexes in the space-dimension doubly-linked list of elements. - // That is to add/remove items to the collision bucket without re-allocations and with O(1) - // complexity. - // To simplify the implementation, internally a list l is implemented - // as a ring, such that &l.latest.prev is last element and - // &l.last.next is the latest element. - nextBucket, prevBucket uint32 - - // bucketPos is the bucket that an element belongs to. - bucketPos uint32 - - // next and prev are indexes in the time-dimension doubly-linked list of elements. - // To simplify the implementation, internally a list l is implemented - // as a ring, such that &l.latest.prev is last element and - // &l.last.next is the latest element. - next, prev uint32 - - // expire is the point in time when the element expires. - // Its value is Unix milliseconds since epoch. - expire int64 -} - -const emptyBucket = math.MaxUint32 - -// LRU implements a non-thread safe fixed size LRU cache. -type LRU[K comparable, V any] struct { - buckets []uint32 // contains positions of bucket lists or 'emptyBucket' - elements []element[K, V] - onEvict OnEvictCallback[K, V] - hash HashKeyCallback[K] - lifetime time.Duration - metrics Metrics - - // used for element clearing after removal or expiration - emptyKey K - emptyValue V - - head uint32 // index of the newest element in the cache - len uint32 // current number of elements in the cache - cap uint32 // max number of elements in the cache - size uint32 // size of the element array (X% larger than cap) - mask uint32 // bitmask to avoid the costly idiv in hashToPos() if size is a 2^n value -} - -// Metrics contains metrics about the cache. -type Metrics struct { - Inserts uint64 - Collisions uint64 - Evictions uint64 - Removals uint64 - Hits uint64 - Misses uint64 -} - -var _ Cache[int, int] = (*LRU[int, int])(nil) - -// SetLifetime sets the default lifetime of LRU elements. -// Lifetime 0 means "forever". -func (lru *LRU[K, V]) SetLifetime(lifetime time.Duration) { - lru.lifetime = lifetime -} - -// SetOnEvict sets the OnEvict callback function. -// The onEvict function is called for each evicted lru entry. -// Eviction happens -// - when the cache is full and a new entry is added (oldest entry is evicted) -// - when an entry is removed by Remove() or RemoveOldest() -// - when an entry is recognized as expired -// - when Purge() is called -func (lru *LRU[K, V]) SetOnEvict(onEvict OnEvictCallback[K, V]) { - lru.onEvict = onEvict -} - -// New constructs an LRU with the given capacity of elements. -// The hash function calculates a hash value from the keys. -func New[K comparable, V any](capacity uint32, hash HashKeyCallback[K]) (*LRU[K, V], error) { - return NewWithSize[K, V](capacity, capacity, hash) -} - -// NewWithSize constructs an LRU with the given capacity and size. -// The hash function calculates a hash value from the keys. -// A size greater than the capacity increases memory consumption and decreases the CPU consumption -// by reducing the chance of collisions. -// Size must not be lower than the capacity. -func NewWithSize[K comparable, V any](capacity, size uint32, hash HashKeyCallback[K]) ( - *LRU[K, V], error) { - if capacity == 0 { - return nil, errors.New("capacity must be positive") - } - if size == emptyBucket { - return nil, fmt.Errorf("size must not be %#X", size) - } - if size < capacity { - return nil, fmt.Errorf("size (%d) is smaller than capacity (%d)", size, capacity) - } - if hash == nil { - return nil, errors.New("hash function must be set") - } - - buckets := make([]uint32, size) - elements := make([]element[K, V], size) - - var lru LRU[K, V] - initLRU(&lru, capacity, size, hash, buckets, elements) - - return &lru, nil -} - -func initLRU[K comparable, V any](lru *LRU[K, V], capacity, size uint32, hash HashKeyCallback[K], - buckets []uint32, elements []element[K, V]) { - lru.cap = capacity - lru.size = size - lru.hash = hash - lru.buckets = buckets - lru.elements = elements - - // If the size is 2^N, we can avoid costly divisions. - if bits.OnesCount32(lru.size) == 1 { - lru.mask = lru.size - 1 - } - - // Mark all slots as free. - for i := range lru.buckets { - lru.buckets[i] = emptyBucket - } -} - -// hashToBucketPos converts a hash value into a position in the elements array. -func (lru *LRU[K, V]) hashToBucketPos(hash uint32) uint32 { - if lru.mask != 0 { - return hash & lru.mask - } - return fastModulo(hash, lru.size) -} - -// fastModulo calculates x % n without using the modulo operator (~4x faster). -// Reference: https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ -func fastModulo(x, n uint32) uint32 { - return uint32((uint64(x) * uint64(n)) >> 32) //nolint:gosec -} - -// hashToPos converts a key into a position in the elements array. -func (lru *LRU[K, V]) hashToPos(hash uint32) (bucketPos, elemPos uint32) { - bucketPos = lru.hashToBucketPos(hash) - elemPos = lru.buckets[bucketPos] - return -} - -// setHead links the element as the head into the list. -func (lru *LRU[K, V]) setHead(pos uint32) { - // Both calls to setHead() check beforehand that pos != lru.head. - // So if you run into this situation, you likely use FreeLRU in a concurrent situation - // without proper locking. It requires a write lock, even around Get(). - // But better use SyncedLRU or SharedLRU in such a case. - if pos == lru.head { - panic(pos) - } - - lru.elements[pos].prev = lru.head - lru.elements[pos].next = lru.elements[lru.head].next - lru.elements[lru.elements[lru.head].next].prev = pos - lru.elements[lru.head].next = pos - lru.head = pos -} - -// unlinkElement removes the element from the elements list. -func (lru *LRU[K, V]) unlinkElement(pos uint32) { - lru.elements[lru.elements[pos].prev].next = lru.elements[pos].next - lru.elements[lru.elements[pos].next].prev = lru.elements[pos].prev -} - -// unlinkBucket removes the element from the buckets list. -func (lru *LRU[K, V]) unlinkBucket(pos uint32) { - prevBucket := lru.elements[pos].prevBucket - nextBucket := lru.elements[pos].nextBucket - if prevBucket == nextBucket && prevBucket == pos { //nolint:gocritic - // The element references itself, so it's the only bucket entry - lru.buckets[lru.elements[pos].bucketPos] = emptyBucket - return - } - lru.elements[prevBucket].nextBucket = nextBucket - lru.elements[nextBucket].prevBucket = prevBucket - lru.buckets[lru.elements[pos].bucketPos] = nextBucket -} - -// evict evicts the element at the given position. -func (lru *LRU[K, V]) evict(pos uint32) { - if pos == lru.head { - lru.head = lru.elements[pos].prev - } - - lru.unlinkElement(pos) - lru.unlinkBucket(pos) - lru.len-- - - if lru.onEvict != nil { - // Save k/v for the eviction function. - key := lru.elements[pos].key - value := lru.elements[pos].value - lru.onEvict(key, value) - } -} - -// Move element from position 'from' to position 'to'. -// That avoids 'gaps' and new elements can always be simply appended. -func (lru *LRU[K, V]) move(to, from uint32) { - if to == from { - return - } - if from == lru.head { - lru.head = to - } - - prev := lru.elements[from].prev - next := lru.elements[from].next - lru.elements[prev].next = to - lru.elements[next].prev = to - - prev = lru.elements[from].prevBucket - next = lru.elements[from].nextBucket - lru.elements[prev].nextBucket = to - lru.elements[next].prevBucket = to - - lru.elements[to] = lru.elements[from] - - if lru.buckets[lru.elements[to].bucketPos] == from { - lru.buckets[lru.elements[to].bucketPos] = to - } -} - -// insert stores the k/v at pos. -// It updates the head to point to this position. -func (lru *LRU[K, V]) insert(pos uint32, key K, value V, lifetime time.Duration) { - lru.elements[pos].key = key - lru.elements[pos].value = value - lru.elements[pos].expire = expire(lifetime) - - if lru.len == 0 { - lru.elements[pos].prev = pos - lru.elements[pos].next = pos - lru.head = pos - } else if pos != lru.head { - lru.setHead(pos) - } - lru.len++ - lru.metrics.Inserts++ -} - -func now() int64 { - return time.Now().UnixMilli() -} - -func expire(lifetime time.Duration) int64 { - if lifetime == 0 { - return 0 - } - return now() + lifetime.Milliseconds() -} - -// clearKeyAndValue clears stale data to avoid memory leaks -func (lru *LRU[K, V]) clearKeyAndValue(pos uint32) { - lru.elements[pos].key = lru.emptyKey - lru.elements[pos].value = lru.emptyValue -} - -func (lru *LRU[K, V]) findKey(hash uint32, key K) (uint32, bool) { - _, startPos := lru.hashToPos(hash) - if startPos == emptyBucket { - return emptyBucket, false - } - - pos := startPos - for { - if key == lru.elements[pos].key { - if lru.elements[pos].expire != 0 && lru.elements[pos].expire <= now() { - lru.removeAt(pos) - return emptyBucket, false - } - return pos, true - } - - pos = lru.elements[pos].nextBucket - if pos == startPos { - // Key not found - return emptyBucket, false - } - } -} - -func (lru *LRU[K, V]) findKeyNoExpire(hash uint32, key K) (uint32, bool) { - _, startPos := lru.hashToPos(hash) - if startPos == emptyBucket { - return emptyBucket, false - } - - pos := startPos - for { - if key == lru.elements[pos].key { - return pos, true - } - - pos = lru.elements[pos].nextBucket - if pos == startPos { - // Key not found - return emptyBucket, false - } - } -} - -// Len returns the number of elements stored in the cache. -func (lru *LRU[K, V]) Len() int { - return int(lru.len) -} - -// AddWithLifetime adds a key:value to the cache with a lifetime. -// Returns true, true if key was updated and eviction occurred. -func (lru *LRU[K, V]) AddWithLifetime(key K, value V, lifetime time.Duration) (evicted bool) { - return lru.addWithLifetime(lru.hash(key), key, value, lifetime) -} - -func (lru *LRU[K, V]) addWithLifetime(hash uint32, key K, value V, - lifetime time.Duration) (evicted bool) { - bucketPos, startPos := lru.hashToPos(hash) - if startPos == emptyBucket { - pos := lru.len - - if pos == lru.cap { - // Capacity reached, evict the oldest entry and - // store the new entry at evicted position. - pos = lru.elements[lru.head].next - lru.evict(pos) - lru.metrics.Evictions++ - evicted = true - } - - // insert new (first) entry into the bucket - lru.buckets[bucketPos] = pos - lru.elements[pos].bucketPos = bucketPos - - lru.elements[pos].nextBucket = pos - lru.elements[pos].prevBucket = pos - lru.insert(pos, key, value, lifetime) - return evicted - } - - // Walk through the bucket list to see whether key already exists. - pos := startPos - for { - if lru.elements[pos].key == key { - // Key exists, replace the value and update element to be the head element. - lru.elements[pos].value = value - lru.elements[pos].expire = expire(lifetime) - - if pos != lru.head { - lru.unlinkElement(pos) - lru.setHead(pos) - } - // count as insert, even if it's just an update - lru.metrics.Inserts++ - return false - } - - pos = lru.elements[pos].nextBucket - if pos == startPos { - // Key not found - break - } - } - - pos = lru.len - if pos == lru.cap { - // Capacity reached, evict the oldest entry and - // store the new entry at evicted position. - pos = lru.elements[lru.head].next - lru.evict(pos) - lru.metrics.Evictions++ - evicted = true - startPos = lru.buckets[bucketPos] - if startPos == emptyBucket { - startPos = pos - } - } - - // insert new entry into the existing bucket before startPos - lru.buckets[bucketPos] = pos - lru.elements[pos].bucketPos = bucketPos - - lru.elements[pos].nextBucket = startPos - lru.elements[pos].prevBucket = lru.elements[startPos].prevBucket - lru.elements[lru.elements[startPos].prevBucket].nextBucket = pos - lru.elements[startPos].prevBucket = pos - lru.insert(pos, key, value, lifetime) - - if lru.elements[pos].prevBucket != pos { - // The bucket now contains more than 1 element. - // That means we have a collision. - lru.metrics.Collisions++ - } - return evicted -} - -// Add adds a key:value to the cache. -// Returns true, true if key was updated and eviction occurred. -func (lru *LRU[K, V]) Add(key K, value V) (evicted bool) { - return lru.addWithLifetime(lru.hash(key), key, value, lru.lifetime) -} - -func (lru *LRU[K, V]) add(hash uint32, key K, value V) (evicted bool) { - return lru.addWithLifetime(hash, key, value, lru.lifetime) -} - -// Get returns the value associated with the key, setting it as the most -// recently used item. -// If the found cache item is already expired, the evict function is called -// and the return value indicates that the key was not found. -func (lru *LRU[K, V]) Get(key K) (value V, ok bool) { - return lru.get(lru.hash(key), key) -} - -func (lru *LRU[K, V]) get(hash uint32, key K) (value V, ok bool) { - if pos, ok := lru.findKey(hash, key); ok { - if pos != lru.head { - lru.unlinkElement(pos) - lru.setHead(pos) - } - lru.metrics.Hits++ - return lru.elements[pos].value, ok - } - - lru.metrics.Misses++ - return -} - -// GetAndRefresh returns the value associated with the key, setting it as the most -// recently used item. -// The lifetime of the found cache item is refreshed, even if it was already expired. -func (lru *LRU[K, V]) GetAndRefresh(key K, lifetime time.Duration) (V, bool) { - return lru.getAndRefresh(lru.hash(key), key, lifetime) -} - -func (lru *LRU[K, V]) getAndRefresh(hash uint32, key K, lifetime time.Duration) (value V, ok bool) { - if pos, ok := lru.findKeyNoExpire(hash, key); ok { - if pos != lru.head { - lru.unlinkElement(pos) - lru.setHead(pos) - } - lru.metrics.Hits++ - lru.elements[pos].expire = expire(lifetime) - return lru.elements[pos].value, ok - } - - lru.metrics.Misses++ - return -} - -// Peek looks up a key's value from the cache, without changing its recent-ness. -// If the found entry is already expired, the evict function is called. -func (lru *LRU[K, V]) Peek(key K) (value V, ok bool) { - return lru.peek(lru.hash(key), key) -} - -func (lru *LRU[K, V]) peek(hash uint32, key K) (value V, ok bool) { - if pos, ok := lru.findKey(hash, key); ok { - return lru.elements[pos].value, ok - } - - return -} - -// Contains checks for the existence of a key, without changing its recent-ness. -// If the found entry is already expired, the evict function is called. -func (lru *LRU[K, V]) Contains(key K) (ok bool) { - _, ok = lru.peek(lru.hash(key), key) - return -} - -func (lru *LRU[K, V]) contains(hash uint32, key K) (ok bool) { - _, ok = lru.peek(hash, key) - return -} - -// Remove removes the key from the cache. -// The return value indicates whether the key existed or not. -// The evict function is called for the removed entry. -func (lru *LRU[K, V]) Remove(key K) (removed bool) { - return lru.remove(lru.hash(key), key) -} - -func (lru *LRU[K, V]) remove(hash uint32, key K) (removed bool) { - if pos, ok := lru.findKeyNoExpire(hash, key); ok { - lru.removeAt(pos) - return ok - } - - return -} - -func (lru *LRU[K, V]) removeAt(pos uint32) { - lru.evict(pos) - lru.move(pos, lru.len) - lru.metrics.Removals++ - - // remove stale data to avoid memory leaks - lru.clearKeyAndValue(lru.len) -} - -// RemoveOldest removes the oldest entry from the cache. -// Key, value and an indicator of whether the entry has been removed is returned. -// The evict function is called for the removed entry. -func (lru *LRU[K, V]) RemoveOldest() (key K, value V, removed bool) { - if lru.len == 0 { - return lru.emptyKey, lru.emptyValue, false - } - pos := lru.elements[lru.head].next - key = lru.elements[pos].key - value = lru.elements[pos].value - lru.removeAt(pos) - return key, value, true -} - -// Keys returns a slice of the keys in the cache, from oldest to newest. -// Expired entries are not included. -// The evict function is called for each expired item. -func (lru *LRU[K, V]) Keys() []K { - lru.PurgeExpired() - - keys := make([]K, 0, lru.len) - pos := lru.elements[lru.head].next - for i := uint32(0); i < lru.len; i++ { - keys = append(keys, lru.elements[pos].key) - pos = lru.elements[pos].next - } - return keys -} - -// Purge purges all data (key and value) from the LRU. -// The evict function is called for each expired item. -// The LRU metrics are reset. -func (lru *LRU[K, V]) Purge() { - l := lru.len - for i := uint32(0); i < l; i++ { - _, _, _ = lru.RemoveOldest() - } - - lru.metrics = Metrics{} -} - -// PurgeExpired purges all expired items from the LRU. -// The evict function is called for each expired item. -func (lru *LRU[K, V]) PurgeExpired() { - l := lru.len - for i := uint32(0); i < l; i++ { - pos := lru.elements[lru.head].next - if lru.elements[pos].expire != 0 { - if lru.elements[pos].expire > now() { - return // no more expired items - } - lru.removeAt(pos) - } - } -} - -// Metrics returns the metrics of the cache. -func (lru *LRU[K, V]) Metrics() Metrics { - return lru.metrics -} - -// ResetMetrics resets the metrics of the cache and returns the previous state. -func (lru *LRU[K, V]) ResetMetrics() Metrics { - metrics := lru.metrics - lru.metrics = Metrics{} - return metrics -} - -// just used for debugging -func (lru *LRU[K, V]) dump() { - fmt.Printf("head %d len %d cap %d size %d mask 0x%X\n", - lru.head, lru.len, lru.cap, lru.size, lru.mask) - - for i := range lru.buckets { - if lru.buckets[i] == emptyBucket { - continue - } - fmt.Printf(" bucket[%d] -> %d\n", i, lru.buckets[i]) - pos := lru.buckets[i] - for { - e := &lru.elements[pos] - fmt.Printf(" pos %d bucketPos %d prevBucket %d nextBucket %d prev %d next %d k %v v %v\n", - pos, e.bucketPos, e.prevBucket, e.nextBucket, e.prev, e.next, e.key, e.value) - pos = e.nextBucket - if pos == lru.buckets[i] { - break - } - } - } -} - -func (lru *LRU[K, V]) PrintStats() { - m := &lru.metrics - fmt.Printf("Inserts: %d Collisions: %d (%.2f%%) Evictions: %d Removals: %d Hits: %d (%.2f%%) Misses: %d\n", - m.Inserts, m.Collisions, float64(m.Collisions)/float64(m.Inserts)*100, - m.Evictions, m.Removals, - m.Hits, float64(m.Hits)/float64(m.Hits+m.Misses)*100, m.Misses) -} diff --git a/vendor/github.com/elastic/go-freelru/renovate.json b/vendor/github.com/elastic/go-freelru/renovate.json deleted file mode 100644 index 591ec64..0000000 --- a/vendor/github.com/elastic/go-freelru/renovate.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "local>elastic/renovate-config" - ] -} diff --git a/vendor/github.com/elastic/go-freelru/shardedlru.go b/vendor/github.com/elastic/go-freelru/shardedlru.go deleted file mode 100644 index 7cdea74..0000000 --- a/vendor/github.com/elastic/go-freelru/shardedlru.go +++ /dev/null @@ -1,329 +0,0 @@ -package freelru - -import ( - "errors" - "fmt" - "math/bits" - "runtime" - "sync" - "time" -) - -// ShardedLRU is a thread-safe, sharded, fixed size LRU cache. -// Sharding is used to reduce lock contention on high concurrency. -// The downside is that exact LRU behavior is not given (as for the LRU and SynchedLRU types). -type ShardedLRU[K comparable, V any] struct { - lrus []LRU[K, V] - mus []sync.RWMutex - hash HashKeyCallback[K] - shards uint32 - mask uint32 -} - -var _ Cache[int, int] = (*ShardedLRU[int, int])(nil) - -// SetLifetime sets the default lifetime of LRU elements. -// Lifetime 0 means "forever". -func (lru *ShardedLRU[K, V]) SetLifetime(lifetime time.Duration) { - for shard := range lru.lrus { - lru.mus[shard].Lock() - lru.lrus[shard].SetLifetime(lifetime) - lru.mus[shard].Unlock() - } -} - -// SetOnEvict sets the OnEvict callback function. -// The onEvict function is called for each evicted lru entry. -func (lru *ShardedLRU[K, V]) SetOnEvict(onEvict OnEvictCallback[K, V]) { - for shard := range lru.lrus { - lru.mus[shard].Lock() - lru.lrus[shard].SetOnEvict(onEvict) - lru.mus[shard].Unlock() - } -} - -func nextPowerOfTwo(val uint32) uint32 { - if bits.OnesCount32(val) != 1 { - return 1 << bits.Len32(val) - } - return val -} - -// NewSharded creates a new thread-safe sharded LRU hashmap with the given capacity. -func NewSharded[K comparable, V any](capacity uint32, hash HashKeyCallback[K]) (*ShardedLRU[K, V], - error) { - size := uint32(float64(capacity) * 1.25) // 25% extra space for fewer collisions - - return NewShardedWithSize[K, V](uint32(runtime.GOMAXPROCS(0)*16), capacity, size, hash) -} - -func NewShardedWithSize[K comparable, V any](shards, capacity, size uint32, - hash HashKeyCallback[K]) ( - *ShardedLRU[K, V], error) { - if capacity == 0 { - return nil, errors.New("capacity must be positive") - } - if size < capacity { - return nil, fmt.Errorf("size (%d) is smaller than capacity (%d)", size, capacity) - } - - if size < 1<<31 { - size = nextPowerOfTwo(size) // next power of 2 so the LRUs can avoid costly divisions - } else { - size = 1 << 31 // the highest 2^N value that fits in a uint32 - } - - shards = nextPowerOfTwo(shards) // next power of 2 so we can avoid costly division for sharding - - for shards > size/16 { - shards /= 16 - } - if shards == 0 { - shards = 1 - } - - size /= shards // size per LRU - if size == 0 { - size = 1 - } - - capacity = (capacity + shards - 1) / shards // size per LRU - if capacity == 0 { - capacity = 1 - } - - lrus := make([]LRU[K, V], shards) - buckets := make([]uint32, size*shards) - elements := make([]element[K, V], size*shards) - - from := 0 - to := int(size) - for i := range lrus { - initLRU(&lrus[i], capacity, size, hash, buckets[from:to], elements[from:to]) - from = to - to += int(size) - } - - return &ShardedLRU[K, V]{ - lrus: lrus, - mus: make([]sync.RWMutex, shards), - hash: hash, - shards: shards, - mask: shards - 1, - }, nil -} - -// Len returns the number of elements stored in the cache. -func (lru *ShardedLRU[K, V]) Len() (length int) { - for shard := range lru.lrus { - lru.mus[shard].RLock() - length += lru.lrus[shard].Len() - lru.mus[shard].RUnlock() - } - return -} - -// AddWithLifetime adds a key:value to the cache with a lifetime. -// Returns true, true if key was updated and eviction occurred. -func (lru *ShardedLRU[K, V]) AddWithLifetime(key K, value V, - lifetime time.Duration) (evicted bool) { - hash := lru.hash(key) - shard := (hash >> 16) & lru.mask - - lru.mus[shard].Lock() - evicted = lru.lrus[shard].addWithLifetime(hash, key, value, lifetime) - lru.mus[shard].Unlock() - - return -} - -// Add adds a key:value to the cache. -// Returns true, true if key was updated and eviction occurred. -func (lru *ShardedLRU[K, V]) Add(key K, value V) (evicted bool) { - hash := lru.hash(key) - shard := (hash >> 16) & lru.mask - - lru.mus[shard].Lock() - evicted = lru.lrus[shard].add(hash, key, value) - lru.mus[shard].Unlock() - - return -} - -// Get returns the value associated with the key, setting it as the most -// recently used item. -// If the found cache item is already expired, the evict function is called -// and the return value indicates that the key was not found. -func (lru *ShardedLRU[K, V]) Get(key K) (value V, ok bool) { - hash := lru.hash(key) - shard := (hash >> 16) & lru.mask - - lru.mus[shard].Lock() - value, ok = lru.lrus[shard].get(hash, key) - lru.mus[shard].Unlock() - - return -} - -// GetAndRefresh returns the value associated with the key, setting it as the most -// recently used item. -// The lifetime of the found cache item is refreshed, even if it was already expired. -func (lru *ShardedLRU[K, V]) GetAndRefresh(key K, lifetime time.Duration) (value V, ok bool) { - hash := lru.hash(key) - shard := (hash >> 16) & lru.mask - - lru.mus[shard].Lock() - value, ok = lru.lrus[shard].getAndRefresh(hash, key, lifetime) - lru.mus[shard].Unlock() - - return -} - -// Peek looks up a key's value from the cache, without changing its recent-ness. -// If the found entry is already expired, the evict function is called. -func (lru *ShardedLRU[K, V]) Peek(key K) (value V, ok bool) { - hash := lru.hash(key) - shard := (hash >> 16) & lru.mask - - lru.mus[shard].Lock() - value, ok = lru.lrus[shard].peek(hash, key) - lru.mus[shard].Unlock() - - return -} - -// Contains checks for the existence of a key, without changing its recent-ness. -// If the found entry is already expired, the evict function is called. -func (lru *ShardedLRU[K, V]) Contains(key K) (ok bool) { - hash := lru.hash(key) - shard := (hash >> 16) & lru.mask - - lru.mus[shard].Lock() - ok = lru.lrus[shard].contains(hash, key) - lru.mus[shard].Unlock() - - return -} - -// Remove removes the key from the cache. -// The return value indicates whether the key existed or not. -// The evict function is called for the removed entry. -func (lru *ShardedLRU[K, V]) Remove(key K) (removed bool) { - hash := lru.hash(key) - shard := (hash >> 16) & lru.mask - - lru.mus[shard].Lock() - removed = lru.lrus[shard].remove(hash, key) - lru.mus[shard].Unlock() - - return -} - -// RemoveOldest removes the oldest entry from the cache. -// Key, value and an indicator of whether the entry has been removed is returned. -// The evict function is called for the removed entry. -func (lru *ShardedLRU[K, V]) RemoveOldest() (key K, value V, removed bool) { - hash := lru.hash(key) - shard := (hash >> 16) & lru.mask - - lru.mus[shard].Lock() - key, value, removed = lru.lrus[shard].RemoveOldest() - lru.mus[shard].Unlock() - - return -} - -// Keys returns a slice of the keys in the cache, from oldest to newest. -// Expired entries are not included. -// The evict function is called for each expired item. -func (lru *ShardedLRU[K, V]) Keys() []K { - keys := make([]K, 0, lru.shards*lru.lrus[0].cap) - for shard := range lru.lrus { - lru.mus[shard].Lock() - keys = append(keys, lru.lrus[shard].Keys()...) - lru.mus[shard].Unlock() - } - - return keys -} - -// Purge purges all data (key and value) from the LRU. -// The evict function is called for each expired item. -// The LRU metrics are reset. -func (lru *ShardedLRU[K, V]) Purge() { - for shard := range lru.lrus { - lru.mus[shard].Lock() - lru.lrus[shard].Purge() - lru.mus[shard].Unlock() - } -} - -// PurgeExpired purges all expired items from the LRU. -// The evict function is called for each expired item. -func (lru *ShardedLRU[K, V]) PurgeExpired() { - for shard := range lru.lrus { - lru.mus[shard].Lock() - lru.lrus[shard].PurgeExpired() - lru.mus[shard].Unlock() - } -} - -// Metrics returns the metrics of the cache. -func (lru *ShardedLRU[K, V]) Metrics() Metrics { - metrics := Metrics{} - - for shard := range lru.lrus { - lru.mus[shard].Lock() - m := lru.lrus[shard].Metrics() - lru.mus[shard].Unlock() - - addMetrics(&metrics, m) - } - - return metrics -} - -// ResetMetrics resets the metrics of the cache and returns the previous state. -func (lru *ShardedLRU[K, V]) ResetMetrics() Metrics { - metrics := Metrics{} - - for shard := range lru.lrus { - lru.mus[shard].Lock() - m := lru.lrus[shard].ResetMetrics() - lru.mus[shard].Unlock() - - addMetrics(&metrics, m) - } - - return metrics -} - -func addMetrics(dst *Metrics, src Metrics) { - dst.Inserts += src.Inserts - dst.Collisions += src.Collisions - dst.Evictions += src.Evictions - dst.Removals += src.Removals - dst.Hits += src.Hits - dst.Misses += src.Misses -} - -// just used for debugging -func (lru *ShardedLRU[K, V]) dump() { - for shard := range lru.lrus { - fmt.Printf("Shard %d:\n", shard) - lru.mus[shard].RLock() - lru.lrus[shard].dump() - lru.mus[shard].RUnlock() - fmt.Println("") - } -} - -func (lru *ShardedLRU[K, V]) PrintStats() { - for shard := range lru.lrus { - fmt.Printf("Shard %d:\n", shard) - lru.mus[shard].RLock() - lru.lrus[shard].PrintStats() - lru.mus[shard].RUnlock() - fmt.Println("") - } -} diff --git a/vendor/github.com/elastic/go-freelru/syncedlru.go b/vendor/github.com/elastic/go-freelru/syncedlru.go deleted file mode 100644 index 0e3d591..0000000 --- a/vendor/github.com/elastic/go-freelru/syncedlru.go +++ /dev/null @@ -1,209 +0,0 @@ -package freelru - -import ( - "sync" - "time" -) - -type SyncedLRU[K comparable, V any] struct { - mu sync.RWMutex - lru *LRU[K, V] -} - -var _ Cache[int, int] = (*SyncedLRU[int, int])(nil) - -// SetLifetime sets the default lifetime of LRU elements. -// Lifetime 0 means "forever". -func (lru *SyncedLRU[K, V]) SetLifetime(lifetime time.Duration) { - lru.mu.Lock() - lru.lru.SetLifetime(lifetime) - lru.mu.Unlock() -} - -// SetOnEvict sets the OnEvict callback function. -// The onEvict function is called for each evicted lru entry. -func (lru *SyncedLRU[K, V]) SetOnEvict(onEvict OnEvictCallback[K, V]) { - lru.mu.Lock() - lru.lru.SetOnEvict(onEvict) - lru.mu.Unlock() -} - -// NewSynced creates a new thread-safe LRU hashmap with the given capacity. -func NewSynced[K comparable, V any](capacity uint32, hash HashKeyCallback[K]) (*SyncedLRU[K, V], - error) { - return NewSyncedWithSize[K, V](capacity, capacity, hash) -} - -func NewSyncedWithSize[K comparable, V any](capacity, size uint32, - hash HashKeyCallback[K]) (*SyncedLRU[K, V], error) { - lru, err := NewWithSize[K, V](capacity, size, hash) - if err != nil { - return nil, err - } - return &SyncedLRU[K, V]{lru: lru}, nil -} - -// Len returns the number of elements stored in the cache. -func (lru *SyncedLRU[K, V]) Len() (length int) { - lru.mu.RLock() - length = lru.lru.Len() - lru.mu.RUnlock() - - return -} - -// AddWithLifetime adds a key:value to the cache with a lifetime. -// Returns true, true if key was updated and eviction occurred. -func (lru *SyncedLRU[K, V]) AddWithLifetime(key K, value V, lifetime time.Duration) (evicted bool) { - hash := lru.lru.hash(key) - - lru.mu.Lock() - evicted = lru.lru.addWithLifetime(hash, key, value, lifetime) - lru.mu.Unlock() - - return -} - -// Add adds a key:value to the cache. -// Returns true, true if key was updated and eviction occurred. -func (lru *SyncedLRU[K, V]) Add(key K, value V) (evicted bool) { - hash := lru.lru.hash(key) - - lru.mu.Lock() - evicted = lru.lru.add(hash, key, value) - lru.mu.Unlock() - - return -} - -// Get returns the value associated with the key, setting it as the most -// recently used item. -// If the found cache item is already expired, the evict function is called -// and the return value indicates that the key was not found. -func (lru *SyncedLRU[K, V]) Get(key K) (value V, ok bool) { - hash := lru.lru.hash(key) - - lru.mu.Lock() - value, ok = lru.lru.get(hash, key) - lru.mu.Unlock() - - return -} - -// GetAndRefresh returns the value associated with the key, setting it as the most -// recently used item. -// The lifetime of the found cache item is refreshed, even if it was already expired. -func (lru *SyncedLRU[K, V]) GetAndRefresh(key K, lifetime time.Duration) (value V, ok bool) { - hash := lru.lru.hash(key) - - lru.mu.Lock() - value, ok = lru.lru.getAndRefresh(hash, key, lifetime) - lru.mu.Unlock() - - return -} - -// Peek looks up a key's value from the cache, without changing its recent-ness. -// If the found entry is already expired, the evict function is called. -func (lru *SyncedLRU[K, V]) Peek(key K) (value V, ok bool) { - hash := lru.lru.hash(key) - - lru.mu.Lock() - value, ok = lru.lru.peek(hash, key) - lru.mu.Unlock() - - return -} - -// Contains checks for the existence of a key, without changing its recent-ness. -// If the found entry is already expired, the evict function is called. -func (lru *SyncedLRU[K, V]) Contains(key K) (ok bool) { - hash := lru.lru.hash(key) - - lru.mu.Lock() - ok = lru.lru.contains(hash, key) - lru.mu.Unlock() - - return -} - -// Remove removes the key from the cache. -// The return value indicates whether the key existed or not. -// The evict function is being called if the key existed. -func (lru *SyncedLRU[K, V]) Remove(key K) (removed bool) { - hash := lru.lru.hash(key) - - lru.mu.Lock() - removed = lru.lru.remove(hash, key) - lru.mu.Unlock() - - return -} - -// RemoveOldest removes the oldest entry from the cache. -// Key, value and an indicator of whether the entry has been removed is returned. -// The evict function is called for the removed entry. -func (lru *SyncedLRU[K, V]) RemoveOldest() (key K, value V, removed bool) { - lru.mu.Lock() - key, value, removed = lru.lru.RemoveOldest() - lru.mu.Unlock() - - return -} - -// Keys returns a slice of the keys in the cache, from oldest to newest. -// Expired entries are not included. -// The evict function is called for each expired item. -func (lru *SyncedLRU[K, V]) Keys() (keys []K) { - lru.mu.Lock() - keys = lru.lru.Keys() - lru.mu.Unlock() - - return -} - -// Purge purges all data (key and value) from the LRU. -// The evict function is called for each expired item. -// The LRU metrics are reset. -func (lru *SyncedLRU[K, V]) Purge() { - lru.mu.Lock() - lru.lru.Purge() - lru.mu.Unlock() -} - -// PurgeExpired purges all expired items from the LRU. -// The evict function is called for each expired item. -func (lru *SyncedLRU[K, V]) PurgeExpired() { - lru.mu.Lock() - lru.lru.PurgeExpired() - lru.mu.Unlock() -} - -// Metrics returns the metrics of the cache. -func (lru *SyncedLRU[K, V]) Metrics() Metrics { - lru.mu.Lock() - metrics := lru.lru.Metrics() - lru.mu.Unlock() - return metrics -} - -// ResetMetrics resets the metrics of the cache and returns the previous state. -func (lru *SyncedLRU[K, V]) ResetMetrics() Metrics { - lru.mu.Lock() - metrics := lru.lru.ResetMetrics() - lru.mu.Unlock() - return metrics -} - -// just used for debugging -func (lru *SyncedLRU[K, V]) dump() { - lru.mu.RLock() - lru.lru.dump() - lru.mu.RUnlock() -} - -func (lru *SyncedLRU[K, V]) PrintStats() { - lru.mu.RLock() - lru.lru.PrintStats() - lru.mu.RUnlock() -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/.gitignore b/vendor/github.com/golang-jwt/jwt/v5/.gitignore deleted file mode 100644 index 09573e0..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -bin -.idea/ - diff --git a/vendor/github.com/golang-jwt/jwt/v5/LICENSE b/vendor/github.com/golang-jwt/jwt/v5/LICENSE deleted file mode 100644 index 35dbc25..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -Copyright (c) 2012 Dave Grijalva -Copyright (c) 2021 golang-jwt maintainers - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md b/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md deleted file mode 100644 index b3178e7..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md +++ /dev/null @@ -1,195 +0,0 @@ -# Migration Guide (v5.0.0) - -Version `v5` contains a major rework of core functionalities in the `jwt-go` -library. This includes support for several validation options as well as a -re-design of the `Claims` interface. Lastly, we reworked how errors work under -the hood, which should provide a better overall developer experience. - -Starting from [v5.0.0](https://github.com/golang-jwt/jwt/releases/tag/v5.0.0), -the import path will be: - - "github.com/golang-jwt/jwt/v5" - -For most users, changing the import path *should* suffice. However, since we -intentionally changed and cleaned some of the public API, existing programs -might need to be updated. The following sections describe significant changes -and corresponding updates for existing programs. - -## Parsing and Validation Options - -Under the hood, a new `Validator` struct takes care of validating the claims. A -long awaited feature has been the option to fine-tune the validation of tokens. -This is now possible with several `ParserOption` functions that can be appended -to most `Parse` functions, such as `ParseWithClaims`. The most important options -and changes are: - * Added `WithLeeway` to support specifying the leeway that is allowed when - validating time-based claims, such as `exp` or `nbf`. - * Changed default behavior to not check the `iat` claim. Usage of this claim - is OPTIONAL according to the JWT RFC. The claim itself is also purely - informational according to the RFC, so a strict validation failure is not - recommended. If you want to check for sensible values in these claims, - please use the `WithIssuedAt` parser option. - * Added `WithAudience`, `WithSubject` and `WithIssuer` to support checking for - expected `aud`, `sub` and `iss`. - * Added `WithStrictDecoding` and `WithPaddingAllowed` options to allow - previously global settings to enable base64 strict encoding and the parsing - of base64 strings with padding. The latter is strictly speaking against the - standard, but unfortunately some of the major identity providers issue some - of these incorrect tokens. Both options are disabled by default. - -## Changes to the `Claims` interface - -### Complete Restructuring - -Previously, the claims interface was satisfied with an implementation of a -`Valid() error` function. This had several issues: - * The different claim types (struct claims, map claims, etc.) then contained - similar (but not 100 % identical) code of how this validation was done. This - lead to a lot of (almost) duplicate code and was hard to maintain - * It was not really semantically close to what a "claim" (or a set of claims) - really is; which is a list of defined key/value pairs with a certain - semantic meaning. - -Since all the validation functionality is now extracted into the validator, all -`VerifyXXX` and `Valid` functions have been removed from the `Claims` interface. -Instead, the interface now represents a list of getters to retrieve values with -a specific meaning. This allows us to completely decouple the validation logic -with the underlying storage representation of the claim, which could be a -struct, a map or even something stored in a database. - -```go -type Claims interface { - GetExpirationTime() (*NumericDate, error) - GetIssuedAt() (*NumericDate, error) - GetNotBefore() (*NumericDate, error) - GetIssuer() (string, error) - GetSubject() (string, error) - GetAudience() (ClaimStrings, error) -} -``` - -Users that previously directly called the `Valid` function on their claims, -e.g., to perform validation independently of parsing/verifying a token, can now -use the `jwt.NewValidator` function to create a `Validator` independently of the -`Parser`. - -```go -var v = jwt.NewValidator(jwt.WithLeeway(5*time.Second)) -v.Validate(myClaims) -``` - -### Supported Claim Types and Removal of `StandardClaims` - -The two standard claim types supported by this library, `MapClaims` and -`RegisteredClaims` both implement the necessary functions of this interface. The -old `StandardClaims` struct, which has already been deprecated in `v4` is now -removed. - -Users using custom claims, in most cases, will not experience any changes in the -behavior as long as they embedded `RegisteredClaims`. If they created a new -claim type from scratch, they now need to implemented the proper getter -functions. - -### Migrating Application Specific Logic of the old `Valid` - -Previously, users could override the `Valid` method in a custom claim, for -example to extend the validation with application-specific claims. However, this -was always very dangerous, since once could easily disable the standard -validation and signature checking. - -In order to avoid that, while still supporting the use-case, a new -`ClaimsValidator` interface has been introduced. This interface consists of the -`Validate() error` function. If the validator sees, that a `Claims` struct -implements this interface, the errors returned to the `Validate` function will -be *appended* to the regular standard validation. It is not possible to disable -the standard validation anymore (even only by accident). - -Usage examples can be found in [example_test.go](./example_test.go), to build -claims structs like the following. - -```go -// MyCustomClaims includes all registered claims, plus Foo. -type MyCustomClaims struct { - Foo string `json:"foo"` - jwt.RegisteredClaims -} - -// Validate can be used to execute additional application-specific claims -// validation. -func (m MyCustomClaims) Validate() error { - if m.Foo != "bar" { - return errors.New("must be foobar") - } - - return nil -} -``` - -## Changes to the `Token` and `Parser` struct - -The previously global functions `DecodeSegment` and `EncodeSegment` were moved -to the `Parser` and `Token` struct respectively. This will allow us in the -future to configure the behavior of these two based on options supplied on the -parser or the token (creation). This also removes two previously global -variables and moves them to parser options `WithStrictDecoding` and -`WithPaddingAllowed`. - -In order to do that, we had to adjust the way signing methods work. Previously -they were given a base64 encoded signature in `Verify` and were expected to -return a base64 encoded version of the signature in `Sign`, both as a `string`. -However, this made it necessary to have `DecodeSegment` and `EncodeSegment` -global and was a less than perfect design because we were repeating -encoding/decoding steps for all signing methods. Now, `Sign` and `Verify` -operate on a decoded signature as a `[]byte`, which feels more natural for a -cryptographic operation anyway. Lastly, `Parse` and `SignedString` take care of -the final encoding/decoding part. - -In addition to that, we also changed the `Signature` field on `Token` from a -`string` to `[]byte` and this is also now populated with the decoded form. This -is also more consistent, because the other parts of the JWT, mainly `Header` and -`Claims` were already stored in decoded form in `Token`. Only the signature was -stored in base64 encoded form, which was redundant with the information in the -`Raw` field, which contains the complete token as base64. - -```go -type Token struct { - Raw string // Raw contains the raw token - Method SigningMethod // Method is the signing method used or to be used - Header map[string]any // Header is the first segment of the token in decoded form - Claims Claims // Claims is the second segment of the token in decoded form - Signature []byte // Signature is the third segment of the token in decoded form - Valid bool // Valid specifies if the token is valid -} -``` - -Most (if not all) of these changes should not impact the normal usage of this -library. Only users directly accessing the `Signature` field as well as -developers of custom signing methods should be affected. - -# Migration Guide (v4.0.0) - -Starting from [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0), -the import path will be: - - "github.com/golang-jwt/jwt/v4" - -The `/v4` version will be backwards compatible with existing `v3.x.y` tags in -this repo, as well as `github.com/dgrijalva/jwt-go`. For most users this should -be a drop-in replacement, if you're having troubles migrating, please open an -issue. - -You can replace all occurrences of `github.com/dgrijalva/jwt-go` or -`github.com/golang-jwt/jwt` with `github.com/golang-jwt/jwt/v4`, either manually -or by using tools such as `sed` or `gofmt`. - -And then you'd typically run: - -``` -go get github.com/golang-jwt/jwt/v4 -go mod tidy -``` - -# Older releases (before v3.2.0) - -The original migration guide for older releases can be found at -https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md. diff --git a/vendor/github.com/golang-jwt/jwt/v5/README.md b/vendor/github.com/golang-jwt/jwt/v5/README.md deleted file mode 100644 index 0bb636f..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/README.md +++ /dev/null @@ -1,167 +0,0 @@ -# jwt-go - -[](https://github.com/golang-jwt/jwt/actions/workflows/build.yml) -[](https://pkg.go.dev/github.com/golang-jwt/jwt/v5) -[](https://coveralls.io/github/golang-jwt/jwt?branch=main) - -A [go](http://www.golang.org) (or 'golang' for search engine friendliness) -implementation of [JSON Web -Tokens](https://datatracker.ietf.org/doc/html/rfc7519). - -Starting with [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0) -this project adds Go module support, but maintains backward compatibility with -older `v3.x.y` tags and upstream `github.com/dgrijalva/jwt-go`. See the -[`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information. Version -v5.0.0 introduces major improvements to the validation of tokens, but is not -entirely backward compatible. - -> After the original author of the library suggested migrating the maintenance -> of `jwt-go`, a dedicated team of open source maintainers decided to clone the -> existing library into this repository. See -> [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a -> detailed discussion on this topic. - - -**SECURITY NOTICE:** Some older versions of Go have a security issue in the -crypto/elliptic. The recommendation is to upgrade to at least 1.15 See issue -[dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more -detail. - -**SECURITY NOTICE:** It's important that you [validate the `alg` presented is -what you -expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/). -This library attempts to make it easy to do the right thing by requiring key -types to match the expected alg, but you should take the extra step to verify it in -your usage. See the examples provided. - -### Supported Go versions - -Our support of Go versions is aligned with Go's [version release -policy](https://golang.org/doc/devel/release#policy). So we will support a major -version of Go until there are two newer major releases. We no longer support -building jwt-go with unsupported Go versions, as these contain security -vulnerabilities that will not be fixed. - -## What the heck is a JWT? - -JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web -Tokens. - -In short, it's a signed JSON object that does something useful (for example, -authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is -made of three parts, separated by `.`'s. The first two parts are JSON objects, -that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648) -encoded. The last part is the signature, encoded the same way. - -The first part is called the header. It contains the necessary information for -verifying the last part, the signature. For example, which encryption method -was used for signing and what key was used. - -The part in the middle is the interesting bit. It's called the Claims and -contains the actual stuff you care about. Refer to [RFC -7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about -reserved keys and the proper way to add your own. - -## What's in the box? - -This library supports the parsing and verification as well as the generation and -signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, -RSA-PSS, and ECDSA, though hooks are present for adding your own. - -## Installation Guidelines - -1. To install the jwt package, you first need to have - [Go](https://go.dev/doc/install) installed, then you can use the command - below to add `jwt-go` as a dependency in your Go program. - -```sh -go get -u github.com/golang-jwt/jwt/v5 -``` - -2. Import it in your code: - -```go -import "github.com/golang-jwt/jwt/v5" -``` - -## Usage - -A detailed usage guide, including how to sign and verify tokens can be found on -our [documentation website](https://golang-jwt.github.io/jwt/usage/create/). - -## Examples - -See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt/v5) -for examples of usage: - -* [Simple example of parsing and validating a - token](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#example-Parse-Hmac) -* [Simple example of building and signing a - token](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#example-New-Hmac) -* [Directory of - Examples](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#pkg-examples) - -## Compliance - -This library was last reviewed to comply with [RFC -7519](https://datatracker.ietf.org/doc/html/rfc7519) dated May 2015 with a few -notable differences: - -* In order to protect against accidental use of [Unsecured - JWTs](https://datatracker.ietf.org/doc/html/rfc7519#section-6), tokens using - `alg=none` will only be accepted if the constant - `jwt.UnsafeAllowNoneSignatureType` is provided as the key. - -## Project Status & Versioning - -This library is considered production ready. Feedback and feature requests are -appreciated. The API should be considered stable. There should be very few -backward-incompatible changes outside of major version updates (and only with -good reason). - -This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull -requests will land on `main`. Periodically, versions will be tagged from -`main`. You can find all the releases on [the project releases -page](https://github.com/golang-jwt/jwt/releases). - -**BREAKING CHANGES:** A full list of breaking changes is available in -`VERSION_HISTORY.md`. See [`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information on updating -your code. - -## Extensions - -This library publishes all the necessary components for adding your own signing -methods or key functions. Simply implement the `SigningMethod` interface and -register a factory method using `RegisterSigningMethod` or provide a -`jwt.Keyfunc`. - -A common use case would be integrating with different 3rd party signature -providers, like key management services from various cloud providers or Hardware -Security Modules (HSMs) or to implement additional standards. - -| Extension | Purpose | Repo | -| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------ | -| GCP | Integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS) | https://github.com/someone1/gcp-jwt-go | -| AWS | Integrates with AWS Key Management Service, KMS | https://github.com/matelang/jwt-go-aws-kms | -| JWKS | Provides support for JWKS ([RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517)) as a `jwt.Keyfunc` | https://github.com/MicahParks/keyfunc | - -*Disclaimer*: Unless otherwise specified, these integrations are maintained by -third parties and should not be considered as a primary offer by any of the -mentioned cloud providers - -## More - -Go package documentation can be found [on -pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt/v5). Additional -documentation can be found on [our project -page](https://golang-jwt.github.io/jwt/). - -The command line utility included in this project (cmd/jwt) provides a -straightforward example of token creation and parsing as well as a useful tool -for debugging your own integration. You'll also find several implementation -examples in the documentation. - -[golang-jwt](https://github.com/orgs/golang-jwt) incorporates a modified version -of the JWT logo, which is distributed under the terms of the [MIT -License](https://github.com/jsonwebtoken/jsonwebtoken.github.io/blob/master/LICENSE.txt). diff --git a/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md b/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md deleted file mode 100644 index 2740597..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md +++ /dev/null @@ -1,19 +0,0 @@ -# Security Policy - -## Supported Versions - -As of November 2024 (and until this document is updated), the latest version `v5` is supported. In critical cases, we might supply back-ported patches for `v4`. - -## Reporting a Vulnerability - -If you think you found a vulnerability, and even if you are not sure, please report it a [GitHub Security Advisory](https://github.com/golang-jwt/jwt/security/advisories/new). Please try be explicit, describe steps to reproduce the security issue with code example(s). - -You will receive a response within a timely manner. If the issue is confirmed, we will do our best to release a patch as soon as possible given the complexity of the problem. - -## Public Discussions - -Please avoid publicly discussing a potential security vulnerability. - -Let's take this offline and find a solution first, this limits the potential impact as much as possible. - -We appreciate your help! diff --git a/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md b/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md deleted file mode 100644 index b5039e4..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md +++ /dev/null @@ -1,137 +0,0 @@ -# `jwt-go` Version History - -The following version history is kept for historic purposes. To retrieve the current changes of each version, please refer to the change-log of the specific release versions on https://github.com/golang-jwt/jwt/releases. - -## 4.0.0 - -* Introduces support for Go modules. The `v4` version will be backwards compatible with `v3.x.y`. - -## 3.2.2 - -* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)). -* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)). -* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)). -* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)). - -## 3.2.1 - -* **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code - * Changed the import path from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt` -* Fixed type confusing issue between `string` and `[]string` in `VerifyAudience` ([#12](https://github.com/golang-jwt/jwt/pull/12)). This fixes CVE-2020-26160 - -#### 3.2.0 - -* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation -* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate -* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before. -* Deprecated `ParseFromRequestWithClaims` to simplify API in the future. - -#### 3.1.0 - -* Improvements to `jwt` command line tool -* Added `SkipClaimsValidation` option to `Parser` -* Documentation updates - -#### 3.0.0 - -* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code - * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods. - * `ParseFromRequest` has been moved to `request` subpackage and usage has changed - * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims. -* Other Additions and Changes - * Added `Claims` interface type to allow users to decode the claims into a custom type - * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into. - * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage - * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims` - * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`. - * Added several new, more specific, validation errors to error type bitmask - * Moved examples from README to executable example files - * Signing method registry is now thread safe - * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser) - -#### 2.7.0 - -This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes. - -* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying -* Error text for expired tokens includes how long it's been expired -* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM` -* Documentation updates - -#### 2.6.0 - -* Exposed inner error within ValidationError -* Fixed validation errors when using UseJSONNumber flag -* Added several unit tests - -#### 2.5.0 - -* Added support for signing method none. You shouldn't use this. The API tries to make this clear. -* Updated/fixed some documentation -* Added more helpful error message when trying to parse tokens that begin with `BEARER ` - -#### 2.4.0 - -* Added new type, Parser, to allow for configuration of various parsing parameters - * You can now specify a list of valid signing methods. Anything outside this set will be rejected. - * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON -* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go) -* Fixed some bugs with ECDSA parsing - -#### 2.3.0 - -* Added support for ECDSA signing methods -* Added support for RSA PSS signing methods (requires go v1.4) - -#### 2.2.0 - -* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic. - -#### 2.1.0 - -Backwards compatible API change that was missed in 2.0.0. - -* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte` - -#### 2.0.0 - -There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change. - -The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`. - -It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`. - -* **Compatibility Breaking Changes** - * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct` - * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct` - * `KeyFunc` now returns `interface{}` instead of `[]byte` - * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key - * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key -* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type. - * Added public package global `SigningMethodHS256` - * Added public package global `SigningMethodHS384` - * Added public package global `SigningMethodHS512` -* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type. - * Added public package global `SigningMethodRS256` - * Added public package global `SigningMethodRS384` - * Added public package global `SigningMethodRS512` -* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged. -* Refactored the RSA implementation to be easier to read -* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM` - -## 1.0.2 - -* Fixed bug in parsing public keys from certificates -* Added more tests around the parsing of keys for RS256 -* Code refactoring in RS256 implementation. No functional changes - -## 1.0.1 - -* Fixed panic if RS256 signing method was passed an invalid key - -## 1.0.0 - -* First versioned release -* API stabilized -* Supports creating, signing, parsing, and validating JWT tokens -* Supports RS256 and HS256 signing methods diff --git a/vendor/github.com/golang-jwt/jwt/v5/claims.go b/vendor/github.com/golang-jwt/jwt/v5/claims.go deleted file mode 100644 index d50ff3d..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/claims.go +++ /dev/null @@ -1,16 +0,0 @@ -package jwt - -// Claims represent any form of a JWT Claims Set according to -// https://datatracker.ietf.org/doc/html/rfc7519#section-4. In order to have a -// common basis for validation, it is required that an implementation is able to -// supply at least the claim names provided in -// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 namely `exp`, -// `iat`, `nbf`, `iss`, `sub` and `aud`. -type Claims interface { - GetExpirationTime() (*NumericDate, error) - GetIssuedAt() (*NumericDate, error) - GetNotBefore() (*NumericDate, error) - GetIssuer() (string, error) - GetSubject() (string, error) - GetAudience() (ClaimStrings, error) -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/doc.go b/vendor/github.com/golang-jwt/jwt/v5/doc.go deleted file mode 100644 index a86dc1a..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html -// -// See README.md for more info. -package jwt diff --git a/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go b/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go deleted file mode 100644 index 06cd94d..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go +++ /dev/null @@ -1,134 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rand" - "errors" - "math/big" -) - -var ( - // Sadly this is missing from crypto/ecdsa compared to crypto/rsa - ErrECDSAVerification = errors.New("crypto/ecdsa: verification error") -) - -// SigningMethodECDSA implements the ECDSA family of signing methods. -// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification -type SigningMethodECDSA struct { - Name string - Hash crypto.Hash - KeySize int - CurveBits int -} - -// Specific instances for EC256 and company -var ( - SigningMethodES256 *SigningMethodECDSA - SigningMethodES384 *SigningMethodECDSA - SigningMethodES512 *SigningMethodECDSA -) - -func init() { - // ES256 - SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256} - RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod { - return SigningMethodES256 - }) - - // ES384 - SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384} - RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod { - return SigningMethodES384 - }) - - // ES512 - SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521} - RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod { - return SigningMethodES512 - }) -} - -func (m *SigningMethodECDSA) Alg() string { - return m.Name -} - -// Verify implements token verification for the SigningMethod. -// For this verify method, key must be an ecdsa.PublicKey struct -func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key any) error { - // Get the key - var ecdsaKey *ecdsa.PublicKey - switch k := key.(type) { - case *ecdsa.PublicKey: - ecdsaKey = k - default: - return newError("ECDSA verify expects *ecdsa.PublicKey", ErrInvalidKeyType) - } - - if len(sig) != 2*m.KeySize { - return ErrECDSAVerification - } - - r := big.NewInt(0).SetBytes(sig[:m.KeySize]) - s := big.NewInt(0).SetBytes(sig[m.KeySize:]) - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Verify the signature - if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus { - return nil - } - - return ErrECDSAVerification -} - -// Sign implements token signing for the SigningMethod. -// For this signing method, key must be an ecdsa.PrivateKey struct -func (m *SigningMethodECDSA) Sign(signingString string, key any) ([]byte, error) { - // Get the key - var ecdsaKey *ecdsa.PrivateKey - switch k := key.(type) { - case *ecdsa.PrivateKey: - ecdsaKey = k - default: - return nil, newError("ECDSA sign expects *ecdsa.PrivateKey", ErrInvalidKeyType) - } - - // Create the hasher - if !m.Hash.Available() { - return nil, ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return r, s - if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil { - curveBits := ecdsaKey.Curve.Params().BitSize - - if m.CurveBits != curveBits { - return nil, ErrInvalidKey - } - - keyBytes := curveBits / 8 - if curveBits%8 > 0 { - keyBytes += 1 - } - - // We serialize the outputs (r and s) into big-endian byte arrays - // padded with zeros on the left to make sure the sizes work out. - // Output must be 2*keyBytes long. - out := make([]byte, 2*keyBytes) - r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output. - s.FillBytes(out[keyBytes:]) // s is assigned to the second half of output. - - return out, nil - } else { - return nil, err - } -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go b/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go deleted file mode 100644 index 44a3b7a..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go +++ /dev/null @@ -1,69 +0,0 @@ -package jwt - -import ( - "crypto/ecdsa" - "crypto/x509" - "encoding/pem" - "errors" -) - -var ( - ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key") - ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key") -) - -// ParseECPrivateKeyFromPEM parses a PEM encoded Elliptic Curve Private Key Structure -func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey any - if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { - if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { - return nil, err - } - } - - var pkey *ecdsa.PrivateKey - var ok bool - if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { - return nil, ErrNotECPrivateKey - } - - return pkey, nil -} - -// ParseECPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key -func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey any - if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { - if cert, err := x509.ParseCertificate(block.Bytes); err == nil { - parsedKey = cert.PublicKey - } else { - return nil, err - } - } - - var pkey *ecdsa.PublicKey - var ok bool - if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { - return nil, ErrNotECPublicKey - } - - return pkey, nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519.go deleted file mode 100644 index 4159e57..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/ed25519.go +++ /dev/null @@ -1,79 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/ed25519" - "crypto/rand" - "errors" -) - -var ( - ErrEd25519Verification = errors.New("ed25519: verification error") -) - -// SigningMethodEd25519 implements the EdDSA family. -// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification -type SigningMethodEd25519 struct{} - -// Specific instance for EdDSA -var ( - SigningMethodEdDSA *SigningMethodEd25519 -) - -func init() { - SigningMethodEdDSA = &SigningMethodEd25519{} - RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod { - return SigningMethodEdDSA - }) -} - -func (m *SigningMethodEd25519) Alg() string { - return "EdDSA" -} - -// Verify implements token verification for the SigningMethod. -// For this verify method, key must be an ed25519.PublicKey -func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key any) error { - var ed25519Key ed25519.PublicKey - var ok bool - - if ed25519Key, ok = key.(ed25519.PublicKey); !ok { - return newError("Ed25519 verify expects ed25519.PublicKey", ErrInvalidKeyType) - } - - if len(ed25519Key) != ed25519.PublicKeySize { - return ErrInvalidKey - } - - // Verify the signature - if !ed25519.Verify(ed25519Key, []byte(signingString), sig) { - return ErrEd25519Verification - } - - return nil -} - -// Sign implements token signing for the SigningMethod. -// For this signing method, key must be an ed25519.PrivateKey -func (m *SigningMethodEd25519) Sign(signingString string, key any) ([]byte, error) { - var ed25519Key crypto.Signer - var ok bool - - if ed25519Key, ok = key.(crypto.Signer); !ok { - return nil, newError("Ed25519 sign expects crypto.Signer", ErrInvalidKeyType) - } - - if _, ok := ed25519Key.Public().(ed25519.PublicKey); !ok { - return nil, ErrInvalidKey - } - - // Sign the string and return the result. ed25519 performs a two-pass hash - // as part of its algorithm. Therefore, we need to pass a non-prehashed - // message into the Sign function, as indicated by crypto.Hash(0) - sig, err := ed25519Key.Sign(rand.Reader, []byte(signingString), crypto.Hash(0)) - if err != nil { - return nil, err - } - - return sig, nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go deleted file mode 100644 index 6f46e88..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go +++ /dev/null @@ -1,64 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/ed25519" - "crypto/x509" - "encoding/pem" - "errors" -) - -var ( - ErrNotEdPrivateKey = errors.New("key is not a valid Ed25519 private key") - ErrNotEdPublicKey = errors.New("key is not a valid Ed25519 public key") -) - -// ParseEdPrivateKeyFromPEM parses a PEM-encoded Edwards curve private key -func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey any - if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { - return nil, err - } - - var pkey ed25519.PrivateKey - var ok bool - if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok { - return nil, ErrNotEdPrivateKey - } - - return pkey, nil -} - -// ParseEdPublicKeyFromPEM parses a PEM-encoded Edwards curve public key -func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey any - if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { - return nil, err - } - - var pkey ed25519.PublicKey - var ok bool - if pkey, ok = parsedKey.(ed25519.PublicKey); !ok { - return nil, ErrNotEdPublicKey - } - - return pkey, nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors.go b/vendor/github.com/golang-jwt/jwt/v5/errors.go deleted file mode 100644 index 14e0075..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/errors.go +++ /dev/null @@ -1,89 +0,0 @@ -package jwt - -import ( - "errors" - "fmt" - "strings" -) - -var ( - ErrInvalidKey = errors.New("key is invalid") - ErrInvalidKeyType = errors.New("key is of invalid type") - ErrHashUnavailable = errors.New("the requested hash function is unavailable") - ErrTokenMalformed = errors.New("token is malformed") - ErrTokenUnverifiable = errors.New("token is unverifiable") - ErrTokenSignatureInvalid = errors.New("token signature is invalid") - ErrTokenRequiredClaimMissing = errors.New("token is missing required claim") - ErrTokenInvalidAudience = errors.New("token has invalid audience") - ErrTokenExpired = errors.New("token is expired") - ErrTokenUsedBeforeIssued = errors.New("token used before issued") - ErrTokenInvalidIssuer = errors.New("token has invalid issuer") - ErrTokenInvalidSubject = errors.New("token has invalid subject") - ErrTokenNotValidYet = errors.New("token is not valid yet") - ErrTokenInvalidId = errors.New("token has invalid id") - ErrTokenInvalidClaims = errors.New("token has invalid claims") - ErrInvalidType = errors.New("invalid type for claim") -) - -// joinedError is an error type that works similar to what [errors.Join] -// produces, with the exception that it has a nice error string; mainly its -// error messages are concatenated using a comma, rather than a newline. -type joinedError struct { - errs []error -} - -func (je joinedError) Error() string { - msg := []string{} - for _, err := range je.errs { - msg = append(msg, err.Error()) - } - - return strings.Join(msg, ", ") -} - -// joinErrors joins together multiple errors. Useful for scenarios where -// multiple errors next to each other occur, e.g., in claims validation. -func joinErrors(errs ...error) error { - return &joinedError{ - errs: errs, - } -} - -// Unwrap implements the multiple error unwrapping for this error type, which is -// possible in Go 1.20. -func (je joinedError) Unwrap() []error { - return je.errs -} - -// newError creates a new error message with a detailed error message. The -// message will be prefixed with the contents of the supplied error type. -// Additionally, more errors, that provide more context can be supplied which -// will be appended to the message. This makes use of Go 1.20's possibility to -// include more than one %w formatting directive in [fmt.Errorf]. -// -// For example, -// -// newError("no keyfunc was provided", ErrTokenUnverifiable) -// -// will produce the error string -// -// "token is unverifiable: no keyfunc was provided" -func newError(message string, err error, more ...error) error { - var format string - var args []any - if message != "" { - format = "%w: %s" - args = []any{err, message} - } else { - format = "%w" - args = []any{err} - } - - for _, e := range more { - format += ": %w" - args = append(args, e) - } - - err = fmt.Errorf(format, args...) - return err -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/hmac.go b/vendor/github.com/golang-jwt/jwt/v5/hmac.go deleted file mode 100644 index 1bef138..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/hmac.go +++ /dev/null @@ -1,104 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/hmac" - "errors" -) - -// SigningMethodHMAC implements the HMAC-SHA family of signing methods. -// Expects key type of []byte for both signing and validation -type SigningMethodHMAC struct { - Name string - Hash crypto.Hash -} - -// Specific instances for HS256 and company -var ( - SigningMethodHS256 *SigningMethodHMAC - SigningMethodHS384 *SigningMethodHMAC - SigningMethodHS512 *SigningMethodHMAC - ErrSignatureInvalid = errors.New("signature is invalid") -) - -func init() { - // HS256 - SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256} - RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod { - return SigningMethodHS256 - }) - - // HS384 - SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384} - RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod { - return SigningMethodHS384 - }) - - // HS512 - SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512} - RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod { - return SigningMethodHS512 - }) -} - -func (m *SigningMethodHMAC) Alg() string { - return m.Name -} - -// Verify implements token verification for the SigningMethod. Returns nil if -// the signature is valid. Key must be []byte. -// -// Note it is not advised to provide a []byte which was converted from a 'human -// readable' string using a subset of ASCII characters. To maximize entropy, you -// should ideally be providing a []byte key which was produced from a -// cryptographically random source, e.g. crypto/rand. Additional information -// about this, and why we intentionally are not supporting string as a key can -// be found on our usage guide -// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types. -func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key any) error { - // Verify the key is the right type - keyBytes, ok := key.([]byte) - if !ok { - return newError("HMAC verify expects []byte", ErrInvalidKeyType) - } - - // Can we use the specified hashing method? - if !m.Hash.Available() { - return ErrHashUnavailable - } - - // This signing method is symmetric, so we validate the signature - // by reproducing the signature from the signing string and key, then - // comparing that against the provided signature. - hasher := hmac.New(m.Hash.New, keyBytes) - hasher.Write([]byte(signingString)) - if !hmac.Equal(sig, hasher.Sum(nil)) { - return ErrSignatureInvalid - } - - // No validation errors. Signature is good. - return nil -} - -// Sign implements token signing for the SigningMethod. Key must be []byte. -// -// Note it is not advised to provide a []byte which was converted from a 'human -// readable' string using a subset of ASCII characters. To maximize entropy, you -// should ideally be providing a []byte key which was produced from a -// cryptographically random source, e.g. crypto/rand. Additional information -// about this, and why we intentionally are not supporting string as a key can -// be found on our usage guide https://golang-jwt.github.io/jwt/usage/signing_methods/. -func (m *SigningMethodHMAC) Sign(signingString string, key any) ([]byte, error) { - if keyBytes, ok := key.([]byte); ok { - if !m.Hash.Available() { - return nil, ErrHashUnavailable - } - - hasher := hmac.New(m.Hash.New, keyBytes) - hasher.Write([]byte(signingString)) - - return hasher.Sum(nil), nil - } - - return nil, newError("HMAC sign expects []byte", ErrInvalidKeyType) -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/map_claims.go b/vendor/github.com/golang-jwt/jwt/v5/map_claims.go deleted file mode 100644 index 3b92052..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/map_claims.go +++ /dev/null @@ -1,109 +0,0 @@ -package jwt - -import ( - "encoding/json" - "fmt" -) - -// MapClaims is a claims type that uses the map[string]any for JSON -// decoding. This is the default claims type if you don't supply one -type MapClaims map[string]any - -// GetExpirationTime implements the Claims interface. -func (m MapClaims) GetExpirationTime() (*NumericDate, error) { - return m.parseNumericDate("exp") -} - -// GetNotBefore implements the Claims interface. -func (m MapClaims) GetNotBefore() (*NumericDate, error) { - return m.parseNumericDate("nbf") -} - -// GetIssuedAt implements the Claims interface. -func (m MapClaims) GetIssuedAt() (*NumericDate, error) { - return m.parseNumericDate("iat") -} - -// GetAudience implements the Claims interface. -func (m MapClaims) GetAudience() (ClaimStrings, error) { - return m.parseClaimsString("aud") -} - -// GetIssuer implements the Claims interface. -func (m MapClaims) GetIssuer() (string, error) { - return m.parseString("iss") -} - -// GetSubject implements the Claims interface. -func (m MapClaims) GetSubject() (string, error) { - return m.parseString("sub") -} - -// parseNumericDate tries to parse a key in the map claims type as a number -// date. This will succeed, if the underlying type is either a [float64] or a -// [json.Number]. Otherwise, nil will be returned. -func (m MapClaims) parseNumericDate(key string) (*NumericDate, error) { - v, ok := m[key] - if !ok { - return nil, nil - } - - switch exp := v.(type) { - case float64: - if exp == 0 { - return nil, nil - } - - return newNumericDateFromSeconds(exp), nil - case json.Number: - v, _ := exp.Float64() - - return newNumericDateFromSeconds(v), nil - } - - return nil, newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) -} - -// parseClaimsString tries to parse a key in the map claims type as a -// [ClaimsStrings] type, which can either be a string or an array of string. -func (m MapClaims) parseClaimsString(key string) (ClaimStrings, error) { - var cs []string - switch v := m[key].(type) { - case string: - cs = append(cs, v) - case []string: - cs = v - case []any: - for _, a := range v { - vs, ok := a.(string) - if !ok { - return nil, newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) - } - cs = append(cs, vs) - } - } - - return cs, nil -} - -// parseString tries to parse a key in the map claims type as a [string] type. -// If the key does not exist, an empty string is returned. If the key has the -// wrong type, an error is returned. -func (m MapClaims) parseString(key string) (string, error) { - var ( - ok bool - raw any - iss string - ) - raw, ok = m[key] - if !ok { - return "", nil - } - - iss, ok = raw.(string) - if !ok { - return "", newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) - } - - return iss, nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/none.go b/vendor/github.com/golang-jwt/jwt/v5/none.go deleted file mode 100644 index 624ad55..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/none.go +++ /dev/null @@ -1,50 +0,0 @@ -package jwt - -// SigningMethodNone implements the none signing method. This is required by the spec -// but you probably should never use it. -var SigningMethodNone *signingMethodNone - -const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed" - -var NoneSignatureTypeDisallowedError error - -type signingMethodNone struct{} -type unsafeNoneMagicConstant string - -func init() { - SigningMethodNone = &signingMethodNone{} - NoneSignatureTypeDisallowedError = newError("'none' signature type is not allowed", ErrTokenUnverifiable) - - RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod { - return SigningMethodNone - }) -} - -func (m *signingMethodNone) Alg() string { - return "none" -} - -// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key -func (m *signingMethodNone) Verify(signingString string, sig []byte, key any) (err error) { - // Key must be UnsafeAllowNoneSignatureType to prevent accidentally - // accepting 'none' signing method - if _, ok := key.(unsafeNoneMagicConstant); !ok { - return NoneSignatureTypeDisallowedError - } - // If signing method is none, signature must be an empty string - if len(sig) != 0 { - return newError("'none' signing method with non-empty signature", ErrTokenUnverifiable) - } - - // Accept 'none' signing method. - return nil -} - -// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key -func (m *signingMethodNone) Sign(signingString string, key any) ([]byte, error) { - if _, ok := key.(unsafeNoneMagicConstant); ok { - return []byte{}, nil - } - - return nil, NoneSignatureTypeDisallowedError -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/parser.go b/vendor/github.com/golang-jwt/jwt/v5/parser.go deleted file mode 100644 index 054c7eb..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/parser.go +++ /dev/null @@ -1,268 +0,0 @@ -package jwt - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "fmt" - "strings" -) - -const tokenDelimiter = "." - -type Parser struct { - // If populated, only these methods will be considered valid. - validMethods []string - - // Use JSON Number format in JSON decoder. - useJSONNumber bool - - // Skip claims validation during token parsing. - skipClaimsValidation bool - - validator *Validator - - decodeStrict bool - - decodePaddingAllowed bool -} - -// NewParser creates a new Parser with the specified options -func NewParser(options ...ParserOption) *Parser { - p := &Parser{ - validator: &Validator{}, - } - - // Loop through our parsing options and apply them - for _, option := range options { - option(p) - } - - return p -} - -// Parse parses, validates, verifies the signature and returns the parsed token. -// keyFunc will receive the parsed token and should return the key for validating. -func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { - return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc) -} - -// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims -// interface. This provides default values which can be overridden and allows a caller to use their own type, rather -// than the default MapClaims implementation of Claims. -// -// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims), -// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the -// proper memory for it before passing in the overall claims, otherwise you might run into a panic. -func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { - token, parts, err := p.ParseUnverified(tokenString, claims) - if err != nil { - return token, err - } - - // Verify signing method is in the required set - if p.validMethods != nil { - var signingMethodValid = false - var alg = token.Method.Alg() - for _, m := range p.validMethods { - if m == alg { - signingMethodValid = true - break - } - } - if !signingMethodValid { - // signing method is not in the listed set - return token, newError(fmt.Sprintf("signing method %v is invalid", alg), ErrTokenSignatureInvalid) - } - } - - // Decode signature - token.Signature, err = p.DecodeSegment(parts[2]) - if err != nil { - return token, newError("could not base64 decode signature", ErrTokenMalformed, err) - } - text := strings.Join(parts[0:2], ".") - - // Lookup key(s) - if keyFunc == nil { - // keyFunc was not provided. short circuiting validation - return token, newError("no keyfunc was provided", ErrTokenUnverifiable) - } - - got, err := keyFunc(token) - if err != nil { - return token, newError("error while executing keyfunc", ErrTokenUnverifiable, err) - } - - switch have := got.(type) { - case VerificationKeySet: - if len(have.Keys) == 0 { - return token, newError("keyfunc returned empty verification key set", ErrTokenUnverifiable) - } - // Iterate through keys and verify signature, skipping the rest when a match is found. - // Return the last error if no match is found. - for _, key := range have.Keys { - if err = token.Method.Verify(text, token.Signature, key); err == nil { - break - } - } - default: - err = token.Method.Verify(text, token.Signature, have) - } - if err != nil { - return token, newError("", ErrTokenSignatureInvalid, err) - } - - // Validate Claims - if !p.skipClaimsValidation { - // Make sure we have at least a default validator - if p.validator == nil { - p.validator = NewValidator() - } - - if err := p.validator.Validate(claims); err != nil { - return token, newError("", ErrTokenInvalidClaims, err) - } - } - - // No errors so far, token is valid. - token.Valid = true - - return token, nil -} - -// ParseUnverified parses the token but doesn't validate the signature. -// -// WARNING: Don't use this method unless you know what you're doing. -// -// It's only ever useful in cases where you know the signature is valid (since it has already -// been or will be checked elsewhere in the stack) and you want to extract values from it. -func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) { - var ok bool - parts, ok = splitToken(tokenString) - if !ok { - return nil, nil, newError("token contains an invalid number of segments", ErrTokenMalformed) - } - - token = &Token{Raw: tokenString} - - // parse Header - var headerBytes []byte - if headerBytes, err = p.DecodeSegment(parts[0]); err != nil { - return token, parts, newError("could not base64 decode header", ErrTokenMalformed, err) - } - if err = json.Unmarshal(headerBytes, &token.Header); err != nil { - return token, parts, newError("could not JSON decode header", ErrTokenMalformed, err) - } - - // parse Claims - token.Claims = claims - - claimBytes, err := p.DecodeSegment(parts[1]) - if err != nil { - return token, parts, newError("could not base64 decode claim", ErrTokenMalformed, err) - } - - // If `useJSONNumber` is enabled then we must use *json.Decoder to decode - // the claims. However, this comes with a performance penalty so only use - // it if we must and, otherwise, simple use json.Unmarshal. - if !p.useJSONNumber { - // JSON Unmarshal. Special case for map type to avoid weird pointer behavior. - if c, ok := token.Claims.(MapClaims); ok { - err = json.Unmarshal(claimBytes, &c) - } else { - err = json.Unmarshal(claimBytes, &claims) - } - } else { - dec := json.NewDecoder(bytes.NewBuffer(claimBytes)) - dec.UseNumber() - // JSON Decode. Special case for map type to avoid weird pointer behavior. - if c, ok := token.Claims.(MapClaims); ok { - err = dec.Decode(&c) - } else { - err = dec.Decode(&claims) - } - } - if err != nil { - return token, parts, newError("could not JSON decode claim", ErrTokenMalformed, err) - } - - // Lookup signature method - if method, ok := token.Header["alg"].(string); ok { - if token.Method = GetSigningMethod(method); token.Method == nil { - return token, parts, newError("signing method (alg) is unavailable", ErrTokenUnverifiable) - } - } else { - return token, parts, newError("signing method (alg) is unspecified", ErrTokenUnverifiable) - } - - return token, parts, nil -} - -// splitToken splits a token string into three parts: header, claims, and signature. It will only -// return true if the token contains exactly two delimiters and three parts. In all other cases, it -// will return nil parts and false. -func splitToken(token string) ([]string, bool) { - parts := make([]string, 3) - header, remain, ok := strings.Cut(token, tokenDelimiter) - if !ok { - return nil, false - } - parts[0] = header - claims, remain, ok := strings.Cut(remain, tokenDelimiter) - if !ok { - return nil, false - } - parts[1] = claims - // One more cut to ensure the signature is the last part of the token and there are no more - // delimiters. This avoids an issue where malicious input could contain additional delimiters - // causing unecessary overhead parsing tokens. - signature, _, unexpected := strings.Cut(remain, tokenDelimiter) - if unexpected { - return nil, false - } - parts[2] = signature - - return parts, true -} - -// DecodeSegment decodes a JWT specific base64url encoding. This function will -// take into account whether the [Parser] is configured with additional options, -// such as [WithStrictDecoding] or [WithPaddingAllowed]. -func (p *Parser) DecodeSegment(seg string) ([]byte, error) { - encoding := base64.RawURLEncoding - - if p.decodePaddingAllowed { - if l := len(seg) % 4; l > 0 { - seg += strings.Repeat("=", 4-l) - } - encoding = base64.URLEncoding - } - - if p.decodeStrict { - encoding = encoding.Strict() - } - return encoding.DecodeString(seg) -} - -// Parse parses, validates, verifies the signature and returns the parsed token. -// keyFunc will receive the parsed token and should return the cryptographic key -// for verifying the signature. The caller is strongly encouraged to set the -// WithValidMethods option to validate the 'alg' claim in the token matches the -// expected algorithm. For more details about the importance of validating the -// 'alg' claim, see -// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/ -func Parse(tokenString string, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { - return NewParser(options...).Parse(tokenString, keyFunc) -} - -// ParseWithClaims is a shortcut for NewParser().ParseWithClaims(). -// -// Note: If you provide a custom claim implementation that embeds one of the -// standard claims (such as RegisteredClaims), make sure that a) you either -// embed a non-pointer version of the claims or b) if you are using a pointer, -// allocate the proper memory for it before passing in the overall claims, -// otherwise you might run into a panic. -func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { - return NewParser(options...).ParseWithClaims(tokenString, claims, keyFunc) -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/parser_option.go b/vendor/github.com/golang-jwt/jwt/v5/parser_option.go deleted file mode 100644 index 4315735..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/parser_option.go +++ /dev/null @@ -1,145 +0,0 @@ -package jwt - -import "time" - -// ParserOption is used to implement functional-style options that modify the -// behavior of the parser. To add new options, just create a function (ideally -// beginning with With or Without) that returns an anonymous function that takes -// a *Parser type as input and manipulates its configuration accordingly. -type ParserOption func(*Parser) - -// WithValidMethods is an option to supply algorithm methods that the parser -// will check. Only those methods will be considered valid. It is heavily -// encouraged to use this option in order to prevent attacks such as -// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/. -func WithValidMethods(methods []string) ParserOption { - return func(p *Parser) { - p.validMethods = methods - } -} - -// WithJSONNumber is an option to configure the underlying JSON parser with -// UseNumber. -func WithJSONNumber() ParserOption { - return func(p *Parser) { - p.useJSONNumber = true - } -} - -// WithoutClaimsValidation is an option to disable claims validation. This -// option should only be used if you exactly know what you are doing. -func WithoutClaimsValidation() ParserOption { - return func(p *Parser) { - p.skipClaimsValidation = true - } -} - -// WithLeeway returns the ParserOption for specifying the leeway window. -func WithLeeway(leeway time.Duration) ParserOption { - return func(p *Parser) { - p.validator.leeway = leeway - } -} - -// WithTimeFunc returns the ParserOption for specifying the time func. The -// primary use-case for this is testing. If you are looking for a way to account -// for clock-skew, WithLeeway should be used instead. -func WithTimeFunc(f func() time.Time) ParserOption { - return func(p *Parser) { - p.validator.timeFunc = f - } -} - -// WithIssuedAt returns the ParserOption to enable verification -// of issued-at. -func WithIssuedAt() ParserOption { - return func(p *Parser) { - p.validator.verifyIat = true - } -} - -// WithExpirationRequired returns the ParserOption to make exp claim required. -// By default exp claim is optional. -func WithExpirationRequired() ParserOption { - return func(p *Parser) { - p.validator.requireExp = true - } -} - -// WithAudience configures the validator to require any of the specified -// audiences in the `aud` claim. Validation will fail if the audience is not -// listed in the token or the `aud` claim is missing. -// -// NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is -// application-specific. Since this validation API is helping developers in -// writing secure application, we decided to REQUIRE the existence of the claim, -// if an audience is expected. -func WithAudience(aud ...string) ParserOption { - return func(p *Parser) { - p.validator.expectedAud = aud - } -} - -// WithAllAudiences configures the validator to require all the specified -// audiences in the `aud` claim. Validation will fail if the specified audiences -// are not listed in the token or the `aud` claim is missing. Duplicates within -// the list are de-duplicated since internally, we use a map to look up the -// audiences. -// -// NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is -// application-specific. Since this validation API is helping developers in -// writing secure application, we decided to REQUIRE the existence of the claim, -// if an audience is expected. -func WithAllAudiences(aud ...string) ParserOption { - return func(p *Parser) { - p.validator.expectedAud = aud - p.validator.expectAllAud = true - } -} - -// WithIssuer configures the validator to require the specified issuer in the -// `iss` claim. Validation will fail if a different issuer is specified in the -// token or the `iss` claim is missing. -// -// NOTE: While the `iss` claim is OPTIONAL in a JWT, the handling of it is -// application-specific. Since this validation API is helping developers in -// writing secure application, we decided to REQUIRE the existence of the claim, -// if an issuer is expected. -func WithIssuer(iss string) ParserOption { - return func(p *Parser) { - p.validator.expectedIss = iss - } -} - -// WithSubject configures the validator to require the specified subject in the -// `sub` claim. Validation will fail if a different subject is specified in the -// token or the `sub` claim is missing. -// -// NOTE: While the `sub` claim is OPTIONAL in a JWT, the handling of it is -// application-specific. Since this validation API is helping developers in -// writing secure application, we decided to REQUIRE the existence of the claim, -// if a subject is expected. -func WithSubject(sub string) ParserOption { - return func(p *Parser) { - p.validator.expectedSub = sub - } -} - -// WithPaddingAllowed will enable the codec used for decoding JWTs to allow -// padding. Note that the JWS RFC7515 states that the tokens will utilize a -// Base64url encoding with no padding. Unfortunately, some implementations of -// JWT are producing non-standard tokens, and thus require support for decoding. -func WithPaddingAllowed() ParserOption { - return func(p *Parser) { - p.decodePaddingAllowed = true - } -} - -// WithStrictDecoding will switch the codec used for decoding JWTs into strict -// mode. In this mode, the decoder requires that trailing padding bits are zero, -// as described in RFC 4648 section 3.5. -func WithStrictDecoding() ParserOption { - return func(p *Parser) { - p.decodeStrict = true - } -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go b/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go deleted file mode 100644 index 77951a5..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go +++ /dev/null @@ -1,63 +0,0 @@ -package jwt - -// RegisteredClaims are a structured version of the JWT Claims Set, -// restricted to Registered Claim Names, as referenced at -// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 -// -// This type can be used on its own, but then additional private and -// public claims embedded in the JWT will not be parsed. The typical use-case -// therefore is to embedded this in a user-defined claim type. -// -// See examples for how to use this with your own claim types. -type RegisteredClaims struct { - // the `iss` (Issuer) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1 - Issuer string `json:"iss,omitempty"` - - // the `sub` (Subject) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2 - Subject string `json:"sub,omitempty"` - - // the `aud` (Audience) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3 - Audience ClaimStrings `json:"aud,omitempty"` - - // the `exp` (Expiration Time) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4 - ExpiresAt *NumericDate `json:"exp,omitempty"` - - // the `nbf` (Not Before) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.5 - NotBefore *NumericDate `json:"nbf,omitempty"` - - // the `iat` (Issued At) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.6 - IssuedAt *NumericDate `json:"iat,omitempty"` - - // the `jti` (JWT ID) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.7 - ID string `json:"jti,omitempty"` -} - -// GetExpirationTime implements the Claims interface. -func (c RegisteredClaims) GetExpirationTime() (*NumericDate, error) { - return c.ExpiresAt, nil -} - -// GetNotBefore implements the Claims interface. -func (c RegisteredClaims) GetNotBefore() (*NumericDate, error) { - return c.NotBefore, nil -} - -// GetIssuedAt implements the Claims interface. -func (c RegisteredClaims) GetIssuedAt() (*NumericDate, error) { - return c.IssuedAt, nil -} - -// GetAudience implements the Claims interface. -func (c RegisteredClaims) GetAudience() (ClaimStrings, error) { - return c.Audience, nil -} - -// GetIssuer implements the Claims interface. -func (c RegisteredClaims) GetIssuer() (string, error) { - return c.Issuer, nil -} - -// GetSubject implements the Claims interface. -func (c RegisteredClaims) GetSubject() (string, error) { - return c.Subject, nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa.go b/vendor/github.com/golang-jwt/jwt/v5/rsa.go deleted file mode 100644 index 98b960a..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/rsa.go +++ /dev/null @@ -1,93 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/rand" - "crypto/rsa" -) - -// SigningMethodRSA implements the RSA family of signing methods. -// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation -type SigningMethodRSA struct { - Name string - Hash crypto.Hash -} - -// Specific instances for RS256 and company -var ( - SigningMethodRS256 *SigningMethodRSA - SigningMethodRS384 *SigningMethodRSA - SigningMethodRS512 *SigningMethodRSA -) - -func init() { - // RS256 - SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256} - RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod { - return SigningMethodRS256 - }) - - // RS384 - SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384} - RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod { - return SigningMethodRS384 - }) - - // RS512 - SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512} - RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod { - return SigningMethodRS512 - }) -} - -func (m *SigningMethodRSA) Alg() string { - return m.Name -} - -// Verify implements token verification for the SigningMethod -// For this signing method, must be an *rsa.PublicKey structure. -func (m *SigningMethodRSA) Verify(signingString string, sig []byte, key any) error { - var rsaKey *rsa.PublicKey - var ok bool - - if rsaKey, ok = key.(*rsa.PublicKey); !ok { - return newError("RSA verify expects *rsa.PublicKey", ErrInvalidKeyType) - } - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Verify the signature - return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig) -} - -// Sign implements token signing for the SigningMethod -// For this signing method, must be an *rsa.PrivateKey structure. -func (m *SigningMethodRSA) Sign(signingString string, key any) ([]byte, error) { - var rsaKey *rsa.PrivateKey - var ok bool - - // Validate type of key - if rsaKey, ok = key.(*rsa.PrivateKey); !ok { - return nil, newError("RSA sign expects *rsa.PrivateKey", ErrInvalidKeyType) - } - - // Create the hasher - if !m.Hash.Available() { - return nil, ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return the encoded bytes - if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil { - return sigBytes, nil - } else { - return nil, err - } -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go deleted file mode 100644 index f17590c..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go +++ /dev/null @@ -1,132 +0,0 @@ -package jwt - -import ( - "crypto" - "crypto/rand" - "crypto/rsa" -) - -// SigningMethodRSAPSS implements the RSAPSS family of signing methods signing methods -type SigningMethodRSAPSS struct { - *SigningMethodRSA - Options *rsa.PSSOptions - // VerifyOptions is optional. If set overrides Options for rsa.VerifyPPS. - // Used to accept tokens signed with rsa.PSSSaltLengthAuto, what doesn't follow - // https://tools.ietf.org/html/rfc7518#section-3.5 but was used previously. - // See https://github.com/dgrijalva/jwt-go/issues/285#issuecomment-437451244 for details. - VerifyOptions *rsa.PSSOptions -} - -// Specific instances for RS/PS and company. -var ( - SigningMethodPS256 *SigningMethodRSAPSS - SigningMethodPS384 *SigningMethodRSAPSS - SigningMethodPS512 *SigningMethodRSAPSS -) - -func init() { - // PS256 - SigningMethodPS256 = &SigningMethodRSAPSS{ - SigningMethodRSA: &SigningMethodRSA{ - Name: "PS256", - Hash: crypto.SHA256, - }, - Options: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthEqualsHash, - }, - VerifyOptions: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - }, - } - RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod { - return SigningMethodPS256 - }) - - // PS384 - SigningMethodPS384 = &SigningMethodRSAPSS{ - SigningMethodRSA: &SigningMethodRSA{ - Name: "PS384", - Hash: crypto.SHA384, - }, - Options: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthEqualsHash, - }, - VerifyOptions: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - }, - } - RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod { - return SigningMethodPS384 - }) - - // PS512 - SigningMethodPS512 = &SigningMethodRSAPSS{ - SigningMethodRSA: &SigningMethodRSA{ - Name: "PS512", - Hash: crypto.SHA512, - }, - Options: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthEqualsHash, - }, - VerifyOptions: &rsa.PSSOptions{ - SaltLength: rsa.PSSSaltLengthAuto, - }, - } - RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod { - return SigningMethodPS512 - }) -} - -// Verify implements token verification for the SigningMethod. -// For this verify method, key must be an rsa.PublicKey struct -func (m *SigningMethodRSAPSS) Verify(signingString string, sig []byte, key any) error { - var rsaKey *rsa.PublicKey - switch k := key.(type) { - case *rsa.PublicKey: - rsaKey = k - default: - return newError("RSA-PSS verify expects *rsa.PublicKey", ErrInvalidKeyType) - } - - // Create hasher - if !m.Hash.Available() { - return ErrHashUnavailable - } - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - opts := m.Options - if m.VerifyOptions != nil { - opts = m.VerifyOptions - } - - return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, opts) -} - -// Sign implements token signing for the SigningMethod. -// For this signing method, key must be an rsa.PrivateKey struct -func (m *SigningMethodRSAPSS) Sign(signingString string, key any) ([]byte, error) { - var rsaKey *rsa.PrivateKey - - switch k := key.(type) { - case *rsa.PrivateKey: - rsaKey = k - default: - return nil, newError("RSA-PSS sign expects *rsa.PrivateKey", ErrInvalidKeyType) - } - - // Create the hasher - if !m.Hash.Available() { - return nil, ErrHashUnavailable - } - - hasher := m.Hash.New() - hasher.Write([]byte(signingString)) - - // Sign the string and return the encoded bytes - if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil { - return sigBytes, nil - } else { - return nil, err - } -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go b/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go deleted file mode 100644 index f22c3d0..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go +++ /dev/null @@ -1,107 +0,0 @@ -package jwt - -import ( - "crypto/rsa" - "crypto/x509" - "encoding/pem" - "errors" -) - -var ( - ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") - ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key") - ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key") -) - -// ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key -func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - var parsedKey any - if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { - if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { - return nil, err - } - } - - var pkey *rsa.PrivateKey - var ok bool - if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { - return nil, ErrNotRSAPrivateKey - } - - return pkey, nil -} - -// ParseRSAPrivateKeyFromPEMWithPassword parses a PEM encoded PKCS1 or PKCS8 private key protected with password -// -// Deprecated: This function is deprecated and should not be used anymore. It uses the deprecated x509.DecryptPEMBlock -// function, which was deprecated since RFC 1423 is regarded insecure by design. Unfortunately, there is no alternative -// in the Go standard library for now. See https://github.com/golang/go/issues/8860. -func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - var parsedKey any - - var blockDecrypted []byte - if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil { - return nil, err - } - - if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil { - if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil { - return nil, err - } - } - - var pkey *rsa.PrivateKey - var ok bool - if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { - return nil, ErrNotRSAPrivateKey - } - - return pkey, nil -} - -// ParseRSAPublicKeyFromPEM parses a certificate or a PEM encoded PKCS1 or PKIX public key -func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { - var err error - - // Parse PEM block - var block *pem.Block - if block, _ = pem.Decode(key); block == nil { - return nil, ErrKeyMustBePEMEncoded - } - - // Parse the key - var parsedKey any - if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { - if cert, err := x509.ParseCertificate(block.Bytes); err == nil { - parsedKey = cert.PublicKey - } else { - if parsedKey, err = x509.ParsePKCS1PublicKey(block.Bytes); err != nil { - return nil, err - } - } - } - - var pkey *rsa.PublicKey - var ok bool - if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { - return nil, ErrNotRSAPublicKey - } - - return pkey, nil -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/signing_method.go b/vendor/github.com/golang-jwt/jwt/v5/signing_method.go deleted file mode 100644 index 096d0ed..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/signing_method.go +++ /dev/null @@ -1,49 +0,0 @@ -package jwt - -import ( - "sync" -) - -var signingMethods = map[string]func() SigningMethod{} -var signingMethodLock = new(sync.RWMutex) - -// SigningMethod can be used add new methods for signing or verifying tokens. It -// takes a decoded signature as an input in the Verify function and produces a -// signature in Sign. The signature is then usually base64 encoded as part of a -// JWT. -type SigningMethod interface { - Verify(signingString string, sig []byte, key any) error // Returns nil if signature is valid - Sign(signingString string, key any) ([]byte, error) // Returns signature or error - Alg() string // returns the alg identifier for this method (example: 'HS256') -} - -// RegisterSigningMethod registers the "alg" name and a factory function for signing method. -// This is typically done during init() in the method's implementation -func RegisterSigningMethod(alg string, f func() SigningMethod) { - signingMethodLock.Lock() - defer signingMethodLock.Unlock() - - signingMethods[alg] = f -} - -// GetSigningMethod retrieves a signing method from an "alg" string -func GetSigningMethod(alg string) (method SigningMethod) { - signingMethodLock.RLock() - defer signingMethodLock.RUnlock() - - if methodF, ok := signingMethods[alg]; ok { - method = methodF() - } - return -} - -// GetAlgorithms returns a list of registered "alg" names -func GetAlgorithms() (algs []string) { - signingMethodLock.RLock() - defer signingMethodLock.RUnlock() - - for alg := range signingMethods { - algs = append(algs, alg) - } - return -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf b/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf deleted file mode 100644 index 53745d5..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf +++ /dev/null @@ -1 +0,0 @@ -checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1023"] diff --git a/vendor/github.com/golang-jwt/jwt/v5/token.go b/vendor/github.com/golang-jwt/jwt/v5/token.go deleted file mode 100644 index 3f71558..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/token.go +++ /dev/null @@ -1,100 +0,0 @@ -package jwt - -import ( - "crypto" - "encoding/base64" - "encoding/json" -) - -// Keyfunc will be used by the Parse methods as a callback function to supply -// the key for verification. The function receives the parsed, but unverified -// Token. This allows you to use properties in the Header of the token (such as -// `kid`) to identify which key to use. -// -// The returned any may be a single key or a VerificationKeySet containing -// multiple keys. -type Keyfunc func(*Token) (any, error) - -// VerificationKey represents a public or secret key for verifying a token's signature. -type VerificationKey interface { - crypto.PublicKey | []uint8 -} - -// VerificationKeySet is a set of public or secret keys. It is used by the parser to verify a token. -type VerificationKeySet struct { - Keys []VerificationKey -} - -// Token represents a JWT Token. Different fields will be used depending on -// whether you're creating or parsing/verifying a token. -type Token struct { - Raw string // Raw contains the raw token. Populated when you [Parse] a token - Method SigningMethod // Method is the signing method used or to be used - Header map[string]any // Header is the first segment of the token in decoded form - Claims Claims // Claims is the second segment of the token in decoded form - Signature []byte // Signature is the third segment of the token in decoded form. Populated when you Parse a token - Valid bool // Valid specifies if the token is valid. Populated when you Parse/Verify a token -} - -// New creates a new [Token] with the specified signing method and an empty map -// of claims. Additional options can be specified, but are currently unused. -func New(method SigningMethod, opts ...TokenOption) *Token { - return NewWithClaims(method, MapClaims{}, opts...) -} - -// NewWithClaims creates a new [Token] with the specified signing method and -// claims. Additional options can be specified, but are currently unused. -func NewWithClaims(method SigningMethod, claims Claims, opts ...TokenOption) *Token { - return &Token{ - Header: map[string]any{ - "typ": "JWT", - "alg": method.Alg(), - }, - Claims: claims, - Method: method, - } -} - -// SignedString creates and returns a complete, signed JWT. The token is signed -// using the SigningMethod specified in the token. Please refer to -// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types -// for an overview of the different signing methods and their respective key -// types. -func (t *Token) SignedString(key any) (string, error) { - sstr, err := t.SigningString() - if err != nil { - return "", err - } - - sig, err := t.Method.Sign(sstr, key) - if err != nil { - return "", err - } - - return sstr + "." + t.EncodeSegment(sig), nil -} - -// SigningString generates the signing string. This is the most expensive part -// of the whole deal. Unless you need this for something special, just go -// straight for the SignedString. -func (t *Token) SigningString() (string, error) { - h, err := json.Marshal(t.Header) - if err != nil { - return "", err - } - - c, err := json.Marshal(t.Claims) - if err != nil { - return "", err - } - - return t.EncodeSegment(h) + "." + t.EncodeSegment(c), nil -} - -// EncodeSegment encodes a JWT specific base64url encoding with padding -// stripped. In the future, this function might take into account a -// [TokenOption]. Therefore, this function exists as a method of [Token], rather -// than a global function. -func (*Token) EncodeSegment(seg []byte) string { - return base64.RawURLEncoding.EncodeToString(seg) -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/token_option.go b/vendor/github.com/golang-jwt/jwt/v5/token_option.go deleted file mode 100644 index b4ae3ba..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/token_option.go +++ /dev/null @@ -1,5 +0,0 @@ -package jwt - -// TokenOption is a reserved type, which provides some forward compatibility, -// if we ever want to introduce token creation-related options. -type TokenOption func(*Token) diff --git a/vendor/github.com/golang-jwt/jwt/v5/types.go b/vendor/github.com/golang-jwt/jwt/v5/types.go deleted file mode 100644 index a3e0ef1..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/types.go +++ /dev/null @@ -1,149 +0,0 @@ -package jwt - -import ( - "encoding/json" - "fmt" - "math" - "strconv" - "time" -) - -// TimePrecision sets the precision of times and dates within this library. This -// has an influence on the precision of times when comparing expiry or other -// related time fields. Furthermore, it is also the precision of times when -// serializing. -// -// For backwards compatibility the default precision is set to seconds, so that -// no fractional timestamps are generated. -var TimePrecision = time.Second - -// MarshalSingleStringAsArray modifies the behavior of the ClaimStrings type, -// especially its MarshalJSON function. -// -// If it is set to true (the default), it will always serialize the type as an -// array of strings, even if it just contains one element, defaulting to the -// behavior of the underlying []string. If it is set to false, it will serialize -// to a single string, if it contains one element. Otherwise, it will serialize -// to an array of strings. -var MarshalSingleStringAsArray = true - -// NumericDate represents a JSON numeric date value, as referenced at -// https://datatracker.ietf.org/doc/html/rfc7519#section-2. -type NumericDate struct { - time.Time -} - -// NewNumericDate constructs a new *NumericDate from a standard library time.Time struct. -// It will truncate the timestamp according to the precision specified in TimePrecision. -func NewNumericDate(t time.Time) *NumericDate { - return &NumericDate{t.Truncate(TimePrecision)} -} - -// newNumericDateFromSeconds creates a new *NumericDate out of a float64 representing a -// UNIX epoch with the float fraction representing non-integer seconds. -func newNumericDateFromSeconds(f float64) *NumericDate { - round, frac := math.Modf(f) - return NewNumericDate(time.Unix(int64(round), int64(frac*1e9))) -} - -// MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch -// represented in NumericDate to a byte array, using the precision specified in TimePrecision. -func (date NumericDate) MarshalJSON() (b []byte, err error) { - var prec int - if TimePrecision < time.Second { - prec = int(math.Log10(float64(time.Second) / float64(TimePrecision))) - } - truncatedDate := date.Truncate(TimePrecision) - - // For very large timestamps, UnixNano would overflow an int64, but this - // function requires nanosecond level precision, so we have to use the - // following technique to get round the issue: - // - // 1. Take the normal unix timestamp to form the whole number part of the - // output, - // 2. Take the result of the Nanosecond function, which returns the offset - // within the second of the particular unix time instance, to form the - // decimal part of the output - // 3. Concatenate them to produce the final result - seconds := strconv.FormatInt(truncatedDate.Unix(), 10) - nanosecondsOffset := strconv.FormatFloat(float64(truncatedDate.Nanosecond())/float64(time.Second), 'f', prec, 64) - - output := append([]byte(seconds), []byte(nanosecondsOffset)[1:]...) - - return output, nil -} - -// UnmarshalJSON is an implementation of the json.RawMessage interface and -// deserializes a [NumericDate] from a JSON representation, i.e. a -// [json.Number]. This number represents an UNIX epoch with either integer or -// non-integer seconds. -func (date *NumericDate) UnmarshalJSON(b []byte) (err error) { - var ( - number json.Number - f float64 - ) - - if err = json.Unmarshal(b, &number); err != nil { - return fmt.Errorf("could not parse NumericData: %w", err) - } - - if f, err = number.Float64(); err != nil { - return fmt.Errorf("could not convert json number value to float: %w", err) - } - - n := newNumericDateFromSeconds(f) - *date = *n - - return nil -} - -// ClaimStrings is basically just a slice of strings, but it can be either -// serialized from a string array or just a string. This type is necessary, -// since the "aud" claim can either be a single string or an array. -type ClaimStrings []string - -func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) { - var value any - - if err = json.Unmarshal(data, &value); err != nil { - return err - } - - var aud []string - - switch v := value.(type) { - case string: - aud = append(aud, v) - case []string: - aud = ClaimStrings(v) - case []any: - for _, vv := range v { - vs, ok := vv.(string) - if !ok { - return ErrInvalidType - } - aud = append(aud, vs) - } - case nil: - return nil - default: - return ErrInvalidType - } - - *s = aud - - return -} - -func (s ClaimStrings) MarshalJSON() (b []byte, err error) { - // This handles a special case in the JWT RFC. If the string array, e.g. - // used by the "aud" field, only contains one element, it MAY be serialized - // as a single string. This may or may not be desired based on the ecosystem - // of other JWT library used, so we make it configurable by the variable - // MarshalSingleStringAsArray. - if len(s) == 1 && !MarshalSingleStringAsArray { - return json.Marshal(s[0]) - } - - return json.Marshal([]string(s)) -} diff --git a/vendor/github.com/golang-jwt/jwt/v5/validator.go b/vendor/github.com/golang-jwt/jwt/v5/validator.go deleted file mode 100644 index 92b5c05..0000000 --- a/vendor/github.com/golang-jwt/jwt/v5/validator.go +++ /dev/null @@ -1,326 +0,0 @@ -package jwt - -import ( - "fmt" - "slices" - "time" -) - -// ClaimsValidator is an interface that can be implemented by custom claims who -// wish to execute any additional claims validation based on -// application-specific logic. The Validate function is then executed in -// addition to the regular claims validation and any error returned is appended -// to the final validation result. -// -// type MyCustomClaims struct { -// Foo string `json:"foo"` -// jwt.RegisteredClaims -// } -// -// func (m MyCustomClaims) Validate() error { -// if m.Foo != "bar" { -// return errors.New("must be foobar") -// } -// return nil -// } -type ClaimsValidator interface { - Claims - Validate() error -} - -// Validator is the core of the new Validation API. It is automatically used by -// a [Parser] during parsing and can be modified with various parser options. -// -// The [NewValidator] function should be used to create an instance of this -// struct. -type Validator struct { - // leeway is an optional leeway that can be provided to account for clock skew. - leeway time.Duration - - // timeFunc is used to supply the current time that is needed for - // validation. If unspecified, this defaults to time.Now. - timeFunc func() time.Time - - // requireExp specifies whether the exp claim is required - requireExp bool - - // verifyIat specifies whether the iat (Issued At) claim will be verified. - // According to https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6 this - // only specifies the age of the token, but no validation check is - // necessary. However, if wanted, it can be checked if the iat is - // unrealistic, i.e., in the future. - verifyIat bool - - // expectedAud contains the audience this token expects. Supplying an empty - // slice will disable aud checking. - expectedAud []string - - // expectAllAud specifies whether all expected audiences must be present in - // the token. If false, only one of the expected audiences must be present. - expectAllAud bool - - // expectedIss contains the issuer this token expects. Supplying an empty - // string will disable iss checking. - expectedIss string - - // expectedSub contains the subject this token expects. Supplying an empty - // string will disable sub checking. - expectedSub string -} - -// NewValidator can be used to create a stand-alone validator with the supplied -// options. This validator can then be used to validate already parsed claims. -// -// Note: Under normal circumstances, explicitly creating a validator is not -// needed and can potentially be dangerous; instead functions of the [Parser] -// class should be used. -// -// The [Validator] is only checking the *validity* of the claims, such as its -// expiration time, but it does NOT perform *signature verification* of the -// token. -func NewValidator(opts ...ParserOption) *Validator { - p := NewParser(opts...) - return p.validator -} - -// Validate validates the given claims. It will also perform any custom -// validation if claims implements the [ClaimsValidator] interface. -// -// Note: It will NOT perform any *signature verification* on the token that -// contains the claims and expects that the [Claim] was already successfully -// verified. -func (v *Validator) Validate(claims Claims) error { - var ( - now time.Time - errs = make([]error, 0, 6) - err error - ) - - // Check, if we have a time func - if v.timeFunc != nil { - now = v.timeFunc() - } else { - now = time.Now() - } - - // We always need to check the expiration time, but usage of the claim - // itself is OPTIONAL by default. requireExp overrides this behavior - // and makes the exp claim mandatory. - if err = v.verifyExpiresAt(claims, now, v.requireExp); err != nil { - errs = append(errs, err) - } - - // We always need to check not-before, but usage of the claim itself is - // OPTIONAL. - if err = v.verifyNotBefore(claims, now, false); err != nil { - errs = append(errs, err) - } - - // Check issued-at if the option is enabled - if v.verifyIat { - if err = v.verifyIssuedAt(claims, now, false); err != nil { - errs = append(errs, err) - } - } - - // If we have an expected audience, we also require the audience claim - if len(v.expectedAud) > 0 { - if err = v.verifyAudience(claims, v.expectedAud, v.expectAllAud); err != nil { - errs = append(errs, err) - } - } - - // If we have an expected issuer, we also require the issuer claim - if v.expectedIss != "" { - if err = v.verifyIssuer(claims, v.expectedIss, true); err != nil { - errs = append(errs, err) - } - } - - // If we have an expected subject, we also require the subject claim - if v.expectedSub != "" { - if err = v.verifySubject(claims, v.expectedSub, true); err != nil { - errs = append(errs, err) - } - } - - // Finally, we want to give the claim itself some possibility to do some - // additional custom validation based on a custom Validate function. - cvt, ok := claims.(ClaimsValidator) - if ok { - if err := cvt.Validate(); err != nil { - errs = append(errs, err) - } - } - - if len(errs) == 0 { - return nil - } - - return joinErrors(errs...) -} - -// verifyExpiresAt compares the exp claim in claims against cmp. This function -// will succeed if cmp < exp. Additional leeway is taken into account. -// -// If exp is not set, it will succeed if the claim is not required, -// otherwise ErrTokenRequiredClaimMissing will be returned. -// -// Additionally, if any error occurs while retrieving the claim, e.g., when its -// the wrong type, an ErrTokenUnverifiable error will be returned. -func (v *Validator) verifyExpiresAt(claims Claims, cmp time.Time, required bool) error { - exp, err := claims.GetExpirationTime() - if err != nil { - return err - } - - if exp == nil { - return errorIfRequired(required, "exp") - } - - return errorIfFalse(cmp.Before((exp.Time).Add(+v.leeway)), ErrTokenExpired) -} - -// verifyIssuedAt compares the iat claim in claims against cmp. This function -// will succeed if cmp >= iat. Additional leeway is taken into account. -// -// If iat is not set, it will succeed if the claim is not required, -// otherwise ErrTokenRequiredClaimMissing will be returned. -// -// Additionally, if any error occurs while retrieving the claim, e.g., when its -// the wrong type, an ErrTokenUnverifiable error will be returned. -func (v *Validator) verifyIssuedAt(claims Claims, cmp time.Time, required bool) error { - iat, err := claims.GetIssuedAt() - if err != nil { - return err - } - - if iat == nil { - return errorIfRequired(required, "iat") - } - - return errorIfFalse(!cmp.Before(iat.Add(-v.leeway)), ErrTokenUsedBeforeIssued) -} - -// verifyNotBefore compares the nbf claim in claims against cmp. This function -// will return true if cmp >= nbf. Additional leeway is taken into account. -// -// If nbf is not set, it will succeed if the claim is not required, -// otherwise ErrTokenRequiredClaimMissing will be returned. -// -// Additionally, if any error occurs while retrieving the claim, e.g., when its -// the wrong type, an ErrTokenUnverifiable error will be returned. -func (v *Validator) verifyNotBefore(claims Claims, cmp time.Time, required bool) error { - nbf, err := claims.GetNotBefore() - if err != nil { - return err - } - - if nbf == nil { - return errorIfRequired(required, "nbf") - } - - return errorIfFalse(!cmp.Before(nbf.Add(-v.leeway)), ErrTokenNotValidYet) -} - -// verifyAudience compares the aud claim against cmp. -// -// If aud is not set or an empty list, it will succeed if the claim is not required, -// otherwise ErrTokenRequiredClaimMissing will be returned. -// -// Additionally, if any error occurs while retrieving the claim, e.g., when its -// the wrong type, an ErrTokenUnverifiable error will be returned. -func (v *Validator) verifyAudience(claims Claims, cmp []string, expectAllAud bool) error { - aud, err := claims.GetAudience() - if err != nil { - return err - } - - // Check that aud exists and is not empty. We only require the aud claim - // if we expect at least one audience to be present. - if len(aud) == 0 || len(aud) == 1 && aud[0] == "" { - required := len(v.expectedAud) > 0 - return errorIfRequired(required, "aud") - } - - if !expectAllAud { - for _, a := range aud { - // If we only expect one match, we can stop early if we find a match - if slices.Contains(cmp, a) { - return nil - } - } - - return ErrTokenInvalidAudience - } - - // Note that we are looping cmp here to ensure that all expected audiences - // are present in the aud claim. - for _, a := range cmp { - if !slices.Contains(aud, a) { - return ErrTokenInvalidAudience - } - } - - return nil -} - -// verifyIssuer compares the iss claim in claims against cmp. -// -// If iss is not set, it will succeed if the claim is not required, -// otherwise ErrTokenRequiredClaimMissing will be returned. -// -// Additionally, if any error occurs while retrieving the claim, e.g., when its -// the wrong type, an ErrTokenUnverifiable error will be returned. -func (v *Validator) verifyIssuer(claims Claims, cmp string, required bool) error { - iss, err := claims.GetIssuer() - if err != nil { - return err - } - - if iss == "" { - return errorIfRequired(required, "iss") - } - - return errorIfFalse(iss == cmp, ErrTokenInvalidIssuer) -} - -// verifySubject compares the sub claim against cmp. -// -// If sub is not set, it will succeed if the claim is not required, -// otherwise ErrTokenRequiredClaimMissing will be returned. -// -// Additionally, if any error occurs while retrieving the claim, e.g., when its -// the wrong type, an ErrTokenUnverifiable error will be returned. -func (v *Validator) verifySubject(claims Claims, cmp string, required bool) error { - sub, err := claims.GetSubject() - if err != nil { - return err - } - - if sub == "" { - return errorIfRequired(required, "sub") - } - - return errorIfFalse(sub == cmp, ErrTokenInvalidSubject) -} - -// errorIfFalse returns the error specified in err, if the value is true. -// Otherwise, nil is returned. -func errorIfFalse(value bool, err error) error { - if value { - return nil - } else { - return err - } -} - -// errorIfRequired returns an ErrTokenRequiredClaimMissing error if required is -// true. Otherwise, nil is returned. -func errorIfRequired(required bool, claim string) error { - if required { - return newError(fmt.Sprintf("%s claim is required", claim), ErrTokenRequiredClaimMissing) - } else { - return nil - } -} diff --git a/vendor/github.com/invopop/ctxi18n/.gitignore b/vendor/github.com/invopop/ctxi18n/.gitignore deleted file mode 100644 index 3b735ec..0000000 --- a/vendor/github.com/invopop/ctxi18n/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# If you prefer the allow list template instead of the deny list, see community template: -# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore -# -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ - -# Go workspace file -go.work diff --git a/vendor/github.com/invopop/ctxi18n/.golangci.yaml b/vendor/github.com/invopop/ctxi18n/.golangci.yaml deleted file mode 100644 index 1925251..0000000 --- a/vendor/github.com/invopop/ctxi18n/.golangci.yaml +++ /dev/null @@ -1,30 +0,0 @@ -run: - timeout: "120s" - -output: - formats: - - format: "colored-line-number" - -linters: - enable: - - "gocyclo" - - "unconvert" - - "goimports" - - "govet" - #- "misspell" # doesn't handle multilanguage well - - "nakedret" - - "revive" - - "goconst" - - "unparam" - - "gofmt" - - "errname" - - "zerologlint" - -linters-settings: - staticcheck: - # SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks - # Default: ["*"] - checks: ["all"] - -issues: - exclude-use-default: false diff --git a/vendor/github.com/invopop/ctxi18n/LICENSE b/vendor/github.com/invopop/ctxi18n/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/vendor/github.com/invopop/ctxi18n/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/invopop/ctxi18n/README.md b/vendor/github.com/invopop/ctxi18n/README.md deleted file mode 100644 index 61117b7..0000000 --- a/vendor/github.com/invopop/ctxi18n/README.md +++ /dev/null @@ -1,256 +0,0 @@ -# ctxi18n - -[](https://github.com/invopop/ctxi18n/actions/workflows/lint.yaml) -[](https://github.com/invopop/ctxi18n/actions/workflows/test.yaml) -[](https://goreportcard.com/report/github.com/invopop/ctxi18n) -[](https://codecov.io/gh/invopop/ctxi18n) -[](https://godoc.org/github.com/invopop/ctxi18n) - - -Go Context Internationalization - translating apps easily. - -## Introduction - -`ctxi18n` is heavily influenced by [internationalization in Ruby on Rails](https://guides.rubyonrails.org/i18n.html) and aims to make it just as straightforward in Go applications. - -As the name suggests, `ctxi18n` focusses on making i18n data available inside an application's context instances, but is sufficiently flexible to used directly if needed. - -Key Features: - -- Loads locale files written in YAML or JSON with a similar structure those in Ruby i18n. -- Makes it easy to add a locale object to the context. -- Supports `fs.FS` to load data. -- Short method names like `i18n.T()` or `i18n.N()`. -- Support for simple interpolation using keys, e.g. `Some %{key} text` -- Support for pluralization rules. -- Default values when translations are missing. - -## Usage - -Import the library with: - -```go -import "github.com/invopop/ctxi18n" -``` - -First you'll need to load YAML or JSON translation definitions. Files may be named and structured however you like, but the contents must always follow the same pattern of language and properties, for example: - -```yaml -en: - welcome: - title: "Welcome to our application!" - login: "Log in" - signup: "Sign up" - forgot-password: "Forgot Password?" -es: - welcome: - title: "¡Bienvenido a nuestra aplicación!" - login: "Ingresarse" - signup: "Registrarse" - forgot-password: "¿Olvidaste tu contraseña? -``` - -The first level of properties of the object **must** always define the locale that the rest of sub-object's contents will provide translations for. - -Files will all be deep-merged on top of each other so you can safely extend dictionaries from multiple sources. - -To load the dictionary run something like the following where the `asset.Content` is a package containing [embedded files](https://pkg.go.dev/embed): - -```go -if err := ctxi18n.Load(assets.Content); err != nil { - panic(err) -} -``` - -If you'd like to set a default base language to try to use for any missing translations, load the assets with a default: - -```go -if err := ctxi18n.LoadWithDefault(assets.Content, "en"); err != nil { - panic(err) -} -``` - -You'll now have a global set of locales prepared in memory and ready to use. Assuming your application uses some kind of context such as from an HTTP or gRPC request, you'll want to add a single locale to it: - -```go -ctx = ctxi18n.WithLocale(ctx, "en") -``` - -Locale selection is performed according to [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html) and the `Accept-Language` header, so you can pass in a code string and an attempt will be made to find the best match: - -```go -ctx = ctxi18n.WithLocale(ctx, "en-US,en;q=0.9,es;q=0.8") -``` - -In this example, the first locale to matched will be `en-US`, followed by just `en`, then `es`: - -Getting translations is straightforward, you have two options: - -1. call methods defined in the package with the context, or, -2. extract the locale from the context and use. - -To translate without extracting the locale, you'll need to load the `i18n` package which contains all the structures and methods used by the main `ctxi18n` without any globals: - -```go -import "github.com/invopop/ctxi18n/i18n" -``` - -Then use it with the context: - -```go -fmt.Println(i18n.T(ctx, "welcome.title")) -``` - -Notice in the example that `title` was previously defined inside the `welcome` object in the source YAML, and we're accessing it here by defining the path `welcome.title`. - -To use the `Locale` object directly, extract it from the context and call the methods: - -```go -l := ctxi18n.Locale(ctx) -fmt.Println(l.T("welcome.title")) -``` - -There is no preferred way on how to use this library, so please use whatever best first your application and coding style. Sometimes it makes sense to pass in the context in every call, other times the code can be shorter and more concise by extracting it. - -### Defaults - -If a translation is missing from the locale a "missing" text will be produced, for example: - -```go -fmt.Println(l.T("welcome.no.text")) -``` - -Will return a text that follows the `fmt.Sprintf` missing convention: - -``` -!(MISSING welcome.no.text) -``` - -This can be useful for translators to figure out which texts are missing, but sometimes a default value is more appropriate: - -```go -fmt.Println(i18n.T(ctx, "welcome.question", i18n.Default("Just ask!"))) -// output: "Just ask!" -code := "EUR" -fmt.Println(i18n.T(ctx, "currencies."+code, i18n.Default(code))) -// output: "EUR" -``` - -An alternative to using defaults is to check if the key exists using the `Has` method: - -```go -if !i18n.Has(ctx, "welcome.question") { - fmt.Println("Just ask!") -} -``` - -### Interpolation - -Go's default approach for interpolation using the `fmt.Sprintf` and related methods is good for simple use-cases. For example, given the following translation: - -```yaml -en: - welcome: - title: "Hi %s, welcome to our App!" -``` - -You can get the translated text and interpolate with: - -```go -i18n.T(ctx, "welcome.title", "Sam") -``` - -This however is an _anti-pattern_ when it comes to translating applications as translators may need to change the order of replaced words. To get around this, `ctxi18n` supports simple named interpolation as follows: - -```yaml -en: - welcome: - title: "Hi %{name}, welcome to our App!" -``` - -```go -i18n.T(ctx, "welcome.title", i18n.M{"name":"Sam"}) -``` - -The `i18n.M` map is used to perform a simple find and replace on the matching translation. The `fmt.Sprint` method is used to convert values into strings, so you don't need to worry about simple serialization like for numbers. - -Interpolation can also be used alongside default values: - -```go -i18n.T(ctx, "welcome.title", i18n.Default("Hi %{name}"), i18n.M{"name":"Sam"}) -``` - -## Pluralization - -When texts include references to numbers we need internationalization libraries like `ctxi18n` that help define multiple possible translations according to a number. Pluralized translations are defined like this: - -```yaml -en: - inbox: - emails: - zero: "You have no emails." - one: "You have %{count} email." - other: "You have %{count} emails. -``` - -The `inbox.emails` tag has a sub-object that defines all the translations we need according to the pluralization rules of the language. In the case of English which uses the default rule set, `zero` is an optional definition that will be used if provided and fallback on `other` if not. - -To use these translations, call the `i18n.N` method: - -```go -count := 2 -fmt.Println(i18n.N(ctx, "inbox.emails", count, i18n.M{"count": count})) -``` - -The output from this will be: "You have 2 emails." - -In the current implementation of `ctxi18n` there are very few pluralization rules defined, please submit PRs if your language is not covered! - -## Scopes - -As your application gets more complex, it can get repetitive having to use the same base keys. To get around this, use the `WithScope` helper method inside a context: - -```go -ctx := i18n.WithScope(ctx, "welcome") -i18n.T(ctx, ".title", i18n.M{"name":"Sam"}) -``` - -Anything with the `.` at the beginning will append the scope. You can continue to use any other key in the locale by not using the `.` at the front. - -## Templ - -[Templ](https://templ.guide/) is a templating library that helps you create components that render fragments of HTML and compose them to create screens, pages, documents or apps. - -The following "Hello World" example is taken from the [Templ Guide](https://templ.guide) and shows how you can quickly add translations the leverage the built-in `ctx` variable provided by Templ. - -```yaml -en: - welcome: - hello: "Hello, %{name}" -``` - -```go -package main - -import "github.com/invopop/ctxi18n/i18n" - -templ Hello(name string) { - <span class="hello"> - { i18n.T(ctx, "welcome.hello", i18n.M{"name": name}) } - </span> -} - -templ Greeting(person Person) { - <div class="greeting"> - @Hello(person.Name) - </div> -} -``` - -To save even more typing, it might be worth defining your own templ wrappers around those defined in the `i18n` package. Check out the [gobl.html `t` package](https://github.com/invopop/gobl.html/tree/main/components/t) for an example. - -# Examples - -The following is a list of Open Source projects using this library from which you can see working examples for your own solutions. Please send in a PR if you'd like to add your project! - -- [GOBL HTML](https://github.com/invopop/gobl.html) - generate HTML files like invoices from [GOBL](https://gobl.org) documents. diff --git a/vendor/github.com/invopop/ctxi18n/ctxi18n.go b/vendor/github.com/invopop/ctxi18n/ctxi18n.go deleted file mode 100644 index 26b6080..0000000 --- a/vendor/github.com/invopop/ctxi18n/ctxi18n.go +++ /dev/null @@ -1,74 +0,0 @@ -// Package ctxi18n is used to internationalize applications using the context -// for the locale. -package ctxi18n - -import ( - "context" - "errors" - "io/fs" - - "github.com/invopop/ctxi18n/i18n" -) - -var ( - // DefaultLocale defines the default or fallback locale code to use - // if no other match inside the packages list was found. - DefaultLocale i18n.Code = "en" -) - -var ( - locales *i18n.Locales -) - -var ( - // ErrMissingLocale implies that the requested locale was not found - // in the current index. - ErrMissingLocale = errors.New("locale not defined") -) - -func init() { - locales = new(i18n.Locales) -} - -// Load walks through all the files in provided File System and prepares -// an internal global list of locales ready to use. -func Load(fs fs.FS) error { - return locales.Load(fs) -} - -// LoadWithDefault performs the regular load operation, but will merge -// the default locale with every other locale, ensuring that every text -// has at least the value from the default locale. -func LoadWithDefault(fs fs.FS, locale i18n.Code) error { - return locales.LoadWithDefault(fs, locale) -} - -// Get provides the Locale object for the matching code. -func Get(code i18n.Code) *i18n.Locale { - return locales.Get(code) -} - -// Match attempts to find the best possible matching locale based on the -// locale string provided. The locale string is parsed according to the -// "Accept-Language" header format defined in RFC9110. -func Match(locale string) *i18n.Locale { - return locales.Match(locale) -} - -// WithLocale tries to match the provided code with a locale and ensures -// it is available inside the context. -func WithLocale(ctx context.Context, locale string) (context.Context, error) { - l := locales.Match(locale) - if l == nil { - l = locales.Get(DefaultLocale) - if l == nil { - return nil, ErrMissingLocale - } - } - return l.WithContext(ctx), nil -} - -// Locale provides the locale object currently stored in the context. -func Locale(ctx context.Context) *i18n.Locale { - return i18n.GetLocale(ctx) -} diff --git a/vendor/github.com/invopop/ctxi18n/i18n/code.go b/vendor/github.com/invopop/ctxi18n/i18n/code.go deleted file mode 100644 index f9f408e..0000000 --- a/vendor/github.com/invopop/ctxi18n/i18n/code.go +++ /dev/null @@ -1,41 +0,0 @@ -package i18n - -import "strings" - -// Code is used to represent a language code which follows the -// ISO 639-1 standard, with sub-tags aggregated with hyphens, -// as defined in [RFC5646](https://datatracker.ietf.org/doc/html/rfc5646). -// Examples include: -// -// fr, en-US, es-419, az-Arab, x-pig-latin, man-Nkoo-GN -type Code string - -// String returns the string variant of the code. -func (c Code) String() string { - return string(c) -} - -// Base returns the base language code, without any subtags. -func (c Code) Base() Code { - out := strings.SplitN(c.String(), "-", 2) - return Code(out[0]) -} - -// ParseAcceptLanguage provides an ordered set of codes extracted -// from an HTTP "Accept-Language" header as defined in RFC9110. -// Current implementation will ignore quality values and instead -// just assume the order of the provided codes is valid. -func ParseAcceptLanguage(txt string) []Code { - list := make([]Code, 0) - for _, s := range strings.Split(txt, ",") { - s = strings.TrimSpace(s) - - // Remove any quality values. - if i := strings.Index(s, ";"); i > 0 { - s = s[:i] - } - - list = append(list, Code(s)) - } - return list -} diff --git a/vendor/github.com/invopop/ctxi18n/i18n/dict.go b/vendor/github.com/invopop/ctxi18n/i18n/dict.go deleted file mode 100644 index 6ff32ba..0000000 --- a/vendor/github.com/invopop/ctxi18n/i18n/dict.go +++ /dev/null @@ -1,103 +0,0 @@ -package i18n - -import ( - "encoding/json" - "strings" -) - -// Dict holds the internationalization entries for a specific locale. -type Dict struct { - value string - entries map[string]*Dict -} - -// NewDict instantiates a new dict object. -func NewDict() *Dict { - return &Dict{ - entries: make(map[string]*Dict), - } -} - -// Add adds a new key value pair to the dictionary. -func (d *Dict) Add(key string, value any) { - switch v := value.(type) { - case string: - d.entries[key] = &Dict{value: v} - case map[string]any: - nd := NewDict() - for k, row := range v { - nd.Add(k, row) - } - d.entries[key] = nd - case *Dict: - d.entries[key] = v - default: - // ignore - } -} - -// Value returns the dictionary value or an empty string -// if the dictionary is nil. -func (d *Dict) Value() string { - if d == nil { - return "" - } - return d.value -} - -// Get recursively retrieves the dictionary at the provided key location. -func (d *Dict) Get(key string) *Dict { - if d == nil { - return nil - } - if key == "" { - return nil - } - n := strings.SplitN(key, ".", 2) - entry, ok := d.entries[n[0]] - if !ok { - return nil - } - if len(n) == 1 { - return entry - } - return entry.Get(n[1]) -} - -// Has is a convenience method to check if a key exists in the dictionary -// recursively, and is the equivalent of calling `Get` and checking if -// the result is not nil. -func (d *Dict) Has(key string) bool { - return d.Get(key) != nil -} - -// Merge combines the entries of the second dictionary into this one. If a -// key is duplicated in the second diction, the original value takes priority. -func (d *Dict) Merge(d2 *Dict) { - if d2 == nil { - return - } - if d.entries == nil { - d.entries = make(map[string]*Dict) - } - for k, v := range d2.entries { - if d.entries[k] == nil { - d.entries[k] = v - continue - } - d.entries[k].Merge(v) - } -} - -// UnmarshalJSON attempts to load the dictionary data from a JSON byte slice. -func (d *Dict) UnmarshalJSON(data []byte) error { - if len(data) == 0 { - return nil - } - if data[0] == '"' { - d.value = string(data[1 : len(data)-1]) - return nil - } - d.entries = make(map[string]*Dict) - return json.Unmarshal(data, &d.entries) -} diff --git a/vendor/github.com/invopop/ctxi18n/i18n/i18n.go b/vendor/github.com/invopop/ctxi18n/i18n/i18n.go deleted file mode 100644 index d056dce..0000000 --- a/vendor/github.com/invopop/ctxi18n/i18n/i18n.go +++ /dev/null @@ -1,86 +0,0 @@ -// Package i18n is responsible for keeping the key internationalization in one -// place. -package i18n - -import ( - "context" - "fmt" - "strings" -) - -const ( - missingLocaleOut = "!(MISSING LOCALE)" -) - -type scopeType string - -const ( - scopeKey scopeType = "scope" -) - -// M stands for map and is a simple helper to make it easier to work with -// internationalization maps. -type M map[string]any - -// T is responsible for translating a key into a string by extracting -// the local from the context. -func T(ctx context.Context, key string, args ...any) string { - l := GetLocale(ctx) - if l == nil { - return missingLocaleOut - } - key = ExpandKey(ctx, key) - return l.T(key, args...) -} - -// N returns the pluralized translation of the provided key using n -// as the count. -func N(ctx context.Context, key string, n int, args ...any) string { - l := GetLocale(ctx) - if l == nil { - return missingLocaleOut - } - key = ExpandKey(ctx, key) - return l.N(key, n, args...) -} - -// Has performs a check to see if the key exists in the locale. -func Has(ctx context.Context, key string) bool { - l := GetLocale(ctx) - if l == nil { - return false - } - key = ExpandKey(ctx, key) - return l.Has(key) -} - -// WithScope is used to add a new scope to the context. To use this, -// use a `.` at the beginning of keys. -func WithScope(ctx context.Context, key string) context.Context { - key = ExpandKey(ctx, key) - return context.WithValue(ctx, scopeKey, key) -} - -// ExpandKey extracts the current scope from the context and appends it -// to the start of the provided key. -func ExpandKey(ctx context.Context, key string) string { - if !strings.HasPrefix(key, ".") { - return key - } - scope, ok := ctx.Value(scopeKey).(string) - if !ok { - return key - } - return fmt.Sprintf("%s%s", scope, key) -} - -// Replace is used to interpolate the matched keys in the provided -// string with their values in the map. -// -// Interpolation is performed using the `%{key}` pattern. -func (m M) Replace(in string) string { - for k, v := range m { - in = strings.Replace(in, fmt.Sprintf("%%{%s}", k), fmt.Sprint(v), -1) - } - return in -} diff --git a/vendor/github.com/invopop/ctxi18n/i18n/locale.go b/vendor/github.com/invopop/ctxi18n/i18n/locale.go deleted file mode 100644 index 65dbd30..0000000 --- a/vendor/github.com/invopop/ctxi18n/i18n/locale.go +++ /dev/null @@ -1,129 +0,0 @@ -package i18n - -import ( - "context" - "encoding/json" - "fmt" -) - -// Locale holds the internationalization entries for a specific locale. -type Locale struct { - code Code - dict *Dict - rule PluralRule -} - -const ( - missingDictOut = "!(MISSING: %s)" - localeKey Code = "locale" -) - -// DefaultText when detected as an argument to a translation -// function will be used if no language match is found. -type DefaultText string - -// Default when used as an argument to a translation function -// ensure the provided txt is used as a default value if no -// language match is found. -func Default(txt string) DefaultText { - return DefaultText(txt) -} - -// NewLocale creates a new locale with the provided key and dictionary. -func NewLocale(code Code, dict *Dict) *Locale { - l := &Locale{ - code: code, - dict: dict, - } - l.rule = mapPluralRule(code) - return l - -} - -// Code returns the language code of the locale. -func (l *Locale) Code() Code { - return l.code -} - -// T provides the value from the dictionary stored by the locale. -func (l *Locale) T(key string, args ...any) string { - return interpolate(key, l.dict.Get(key), args...) -} - -// N uses the locale pluralization rules to determine which -// string value to provide based on the provided number. -func (l *Locale) N(key string, n int, args ...any) string { - d := l.dict.Get(key) - return interpolate(key, l.rule(d, n), args...) -} - -// Has performs a check to see if the key exists in the locale. -// This is useful for checking if a key exists before attempting -// to use it when the Default function cannot be used. -func (l *Locale) Has(key string) bool { - return l.dict.Has(key) -} - -// PluralRule provides the pluralization rule for the locale. -func (l *Locale) PluralRule() PluralRule { - return l.rule -} - -// UnmarshalJSON attempts to load the locale from a JSON byte slice. -func (l *Locale) UnmarshalJSON(data []byte) error { - if len(data) == 0 { - return nil - } - l.dict = new(Dict) - if err := json.Unmarshal(data, l.dict); err != nil { - return err - } - return nil -} - -// WithContext inserts the locale into the context so that it can be -// loaded later with `GetLocale`. -func (l *Locale) WithContext(ctx context.Context) context.Context { - return context.WithValue(ctx, localeKey, l) -} - -// GetLocale retrieves the locale from the context. -func GetLocale(ctx context.Context) *Locale { - if l, ok := ctx.Value(localeKey).(*Locale); ok { - return l - } - return nil -} - -func interpolate(key string, d *Dict, args ...any) string { - var s string - s, args = extractDefault(args) - if d != nil { - s = d.value - } - if s == "" { - return missing(key) - } - if len(args) > 0 { - switch arg := args[0].(type) { - case M: - return arg.Replace(s) - default: - return fmt.Sprintf(s, args...) - } - } - return s -} - -func extractDefault(args []any) (string, []any) { - for i, arg := range args { - if dt, ok := arg.(DefaultText); ok { - return string(dt), append(args[:i], args[i+1:]...) - } - } - return "", args -} - -func missing(key string) string { - return fmt.Sprintf(missingDictOut, key) -} diff --git a/vendor/github.com/invopop/ctxi18n/i18n/locales.go b/vendor/github.com/invopop/ctxi18n/i18n/locales.go deleted file mode 100644 index 43d5dcf..0000000 --- a/vendor/github.com/invopop/ctxi18n/i18n/locales.go +++ /dev/null @@ -1,120 +0,0 @@ -package i18n - -import ( - "encoding/json" - "fmt" - "io/fs" - "path/filepath" - - "github.com/invopop/yaml" -) - -// Locales is a map of language keys to their respective locale. -type Locales struct { - list []*Locale -} - -// Load walks through all the files in the provided File System -// and merges every one with the current list of locales. -func (ls *Locales) Load(src fs.FS) error { - return fs.WalkDir(src, ".", func(path string, _ fs.DirEntry, err error) error { - if err != nil { - return fmt.Errorf("walking directory: %w", err) - } - - switch filepath.Ext(path) { - case ".yaml", ".yml", ".json": - // good - default: - return nil - } - - data, err := fs.ReadFile(src, path) - if err != nil { - return fmt.Errorf("reading file '%s': %w", path, err) - } - - if err := yaml.Unmarshal(data, ls); err != nil { - return fmt.Errorf("unmarshalling file '%s': %w", path, err) - } - - return nil - }) -} - -// LoadWithDefault performs the regular load operation, but follows up with -// a second operation that will ensure that default dictionary is merged with -// every other locale, thus ensuring that every text will have a fallback. -func (ls *Locales) LoadWithDefault(src fs.FS, locale Code) error { - if err := ls.Load(src); err != nil { - return err - } - - l := ls.Get(locale) - if l == nil { - return fmt.Errorf("undefined default locale: %s", locale) - } - for _, loc := range ls.list { - if loc == l { - continue - } - loc.dict.Merge(l.dict) - } - - return nil -} - -// Get provides the define Locale object for the matching key. -func (ls *Locales) Get(code Code) *Locale { - for _, loc := range ls.list { - if loc.Code() == code { - return loc - } - } - return nil -} - -// Match attempts to find the best possible matching locale based on the -// locale string provided. The locale string is parsed according to the -// "Accept-Language" header format defined in RFC9110. -func (ls *Locales) Match(locale string) *Locale { - codes := ParseAcceptLanguage(locale) - for _, code := range codes { - for _, loc := range ls.list { - if loc.Code() == code { - return loc - } - } - } - return nil -} - -// Codes provides a list of locale codes defined in the -// list. -func (ls *Locales) Codes() []Code { - codes := make([]Code, len(ls.list)) - for i, l := range ls.list { - codes[i] = l.Code() - } - return codes -} - -// UnmarshalJSON attempts to load the locales from a JSON byte slice -// and merge them into any existing locales. -func (ls *Locales) UnmarshalJSON(data []byte) error { - if len(data) == 0 { - return nil - } - aux := make(map[Code]*Dict) - if err := json.Unmarshal(data, &aux); err != nil { - return err - } - for c, v := range aux { - if l := ls.Get(c); l != nil { - l.dict.Merge(v) - } else { - ls.list = append(ls.list, NewLocale(c, v)) - } - } - return nil -} diff --git a/vendor/github.com/invopop/ctxi18n/i18n/plural_rules.go b/vendor/github.com/invopop/ctxi18n/i18n/plural_rules.go deleted file mode 100644 index 108a31a..0000000 --- a/vendor/github.com/invopop/ctxi18n/i18n/plural_rules.go +++ /dev/null @@ -1,42 +0,0 @@ -package i18n - -// Standard pluralization rule keys. -const ( - DefaultRuleKey = "default" -) - -// PluralRule defines a simple method that expects a dictionary and number and -// will find a matching dictionary entry. -type PluralRule func(d *Dict, num int) *Dict - -const ( - zeroKey = "zero" - oneKey = "one" - otherKey = "other" -) - -var rules = map[string]PluralRule{ - // Most languages can use this rule - DefaultRuleKey: func(d *Dict, n int) *Dict { - if n == 0 { - v := d.Get(zeroKey) - if v != nil { - return v - } - } - if n == 1 { - return d.Get(oneKey) - } - return d.Get(otherKey) - }, -} - -// GetRule provides the PluralRule for the given key. -func GetRule(key string) PluralRule { - return rules[key] -} - -// mapPluralRule is used to map a language code into a pluralization rule. -func mapPluralRule(_ Code) PluralRule { - return rules[DefaultRuleKey] -} diff --git a/vendor/github.com/invopop/yaml/.gitignore b/vendor/github.com/invopop/yaml/.gitignore deleted file mode 100644 index e256a31..0000000 --- a/vendor/github.com/invopop/yaml/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -# OSX leaves these everywhere on SMB shares -._* - -# Eclipse files -.classpath -.project -.settings/** - -# Emacs save files -*~ - -# Vim-related files -[._]*.s[a-w][a-z] -[._]s[a-w][a-z] -*.un~ -Session.vim -.netrwhist - -# Go test binaries -*.test diff --git a/vendor/github.com/invopop/yaml/.golangci.toml b/vendor/github.com/invopop/yaml/.golangci.toml deleted file mode 100644 index 61b2b79..0000000 --- a/vendor/github.com/invopop/yaml/.golangci.toml +++ /dev/null @@ -1,16 +0,0 @@ -[run] -timeout = "120s" - -[output] -format = "colored-line-number" - -[linters] -enable = [ - "gocyclo", "unconvert", "goimports", "unused", "unused", - "vetshadow", "nakedret", "errcheck", "revive", "ineffassign", - "goconst", "vet", "unparam", "gofmt" -] - -[issues] -exclude-use-default = false - diff --git a/vendor/github.com/invopop/yaml/LICENSE b/vendor/github.com/invopop/yaml/LICENSE deleted file mode 100644 index 7805d36..0000000 --- a/vendor/github.com/invopop/yaml/LICENSE +++ /dev/null @@ -1,50 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Sam Ghods - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/invopop/yaml/README.md b/vendor/github.com/invopop/yaml/README.md deleted file mode 100644 index 2c33dfe..0000000 --- a/vendor/github.com/invopop/yaml/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# YAML marshaling and unmarshaling support for Go - -[](https://github.com/invopop/yaml/actions/workflows/lint.yaml) -[](https://github.com/invopop/yaml/actions/workflows/test.yaml) -[](https://goreportcard.com/report/github.com/invopop/yaml) - - -## Introduction - -A wrapper around [go-yaml](https://github.com/go-yaml/yaml) designed to enable a better way of handling YAML when marshaling to and from structs. - -This is a fork and split of the original [ghodss/yaml](https://github.com/ghodss/yaml) repository which no longer appears to be maintained. - -In short, this library first converts YAML to JSON using go-yaml and then uses `json.Marshal` and `json.Unmarshal` to convert to or from the struct. This means that it effectively reuses the JSON struct tags as well as the custom JSON methods `MarshalJSON` and `UnmarshalJSON` unlike go-yaml. For a detailed overview of the rationale behind this method, [see this blog post](https://web.archive.org/web/20150812020634/http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang/). - -## Compatibility - -This package uses [go-yaml](https://github.com/go-yaml/yaml) and therefore supports [everything go-yaml supports](https://github.com/go-yaml/yaml#compatibility). - -Tested against Go versions 1.14 and onwards. - -## Caveats - -**Caveat #1:** When using `yaml.Marshal` and `yaml.Unmarshal`, binary data should NOT be preceded with the `!!binary` YAML tag. If you do, go-yaml will convert the binary data from base64 to native binary data, which is not compatible with JSON. You can still use binary in your YAML files though - just store them without the `!!binary` tag and decode the base64 in your code (e.g. in the custom JSON methods `MarshalJSON` and `UnmarshalJSON`). This also has the benefit that your YAML and your JSON binary data will be decoded exactly the same way. As an example: - -``` -BAD: - exampleKey: !!binary gIGC - -GOOD: - exampleKey: gIGC -... and decode the base64 data in your code. -``` - -**Caveat #2:** When using `YAMLToJSON` directly, maps with keys that are maps will result in an error since this is not supported by JSON. This error will occur in `Unmarshal` as well since you can't unmarshal map keys anyways since struct fields can't be keys. - -## Installation and usage - -To install, run: - -``` -$ go get github.com/invopop/yaml -``` - -And import using: - -``` -import "github.com/invopop/yaml" -``` - -Usage is very similar to the JSON library: - -```go -package main - -import ( - "fmt" - - "github.com/invopop/yaml" -) - -type Person struct { - Name string `json:"name"` // Affects YAML field names too. - Age int `json:"age"` -} - -func main() { - // Marshal a Person struct to YAML. - p := Person{"John", 30} - y, err := yaml.Marshal(p) - if err != nil { - fmt.Printf("err: %v\n", err) - return - } - fmt.Println(string(y)) - /* Output: - age: 30 - name: John - */ - - // Unmarshal the YAML back into a Person struct. - var p2 Person - err = yaml.Unmarshal(y, &p2) - if err != nil { - fmt.Printf("err: %v\n", err) - return - } - fmt.Println(p2) - /* Output: - {John 30} - */ -} -``` - -`yaml.YAMLToJSON` and `yaml.JSONToYAML` methods are also available: - -```go -package main - -import ( - "fmt" - - "github.com/invopop/yaml" -) - -func main() { - j := []byte(`{"name": "John", "age": 30}`) - y, err := yaml.JSONToYAML(j) - if err != nil { - fmt.Printf("err: %v\n", err) - return - } - fmt.Println(string(y)) - /* Output: - name: John - age: 30 - */ - j2, err := yaml.YAMLToJSON(y) - if err != nil { - fmt.Printf("err: %v\n", err) - return - } - fmt.Println(string(j2)) - /* Output: - {"age":30,"name":"John"} - */ -} -``` diff --git a/vendor/github.com/invopop/yaml/fields.go b/vendor/github.com/invopop/yaml/fields.go deleted file mode 100644 index 3fe5f12..0000000 --- a/vendor/github.com/invopop/yaml/fields.go +++ /dev/null @@ -1,499 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package yaml - -import ( - "bytes" - "encoding" - "encoding/json" - "reflect" - "sort" - "strings" - "sync" - "unicode" - "unicode/utf8" -) - -// indirect walks down v allocating pointers as needed, -// until it gets to a non-pointer. -// if it encounters an Unmarshaler, indirect stops and returns that. -// if decodingNull is true, indirect stops at the last pointer so it can be set to nil. -func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) { - // If v is a named type and is addressable, - // start with its address, so that if the type has pointer methods, - // we find them. - if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { - v = v.Addr() - } - for { - // Load value from interface, but only if the result will be - // usefully addressable. - if v.Kind() == reflect.Interface && !v.IsNil() { - e := v.Elem() - if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { - v = e - continue - } - } - - if v.Kind() != reflect.Ptr { - break - } - - if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { - break - } - if v.IsNil() { - if v.CanSet() { - v.Set(reflect.New(v.Type().Elem())) - } else { - v = reflect.New(v.Type().Elem()) - } - } - if v.Type().NumMethod() > 0 { - if u, ok := v.Interface().(json.Unmarshaler); ok { - return u, nil, reflect.Value{} - } - if u, ok := v.Interface().(encoding.TextUnmarshaler); ok { - return nil, u, reflect.Value{} - } - } - v = v.Elem() - } - return nil, nil, v -} - -// A field represents a single field found in a struct. -type field struct { - name string - nameBytes []byte // []byte(name) - equalFold func(s, t []byte) bool // bytes.EqualFold or equivalent - - tag bool - index []int - typ reflect.Type - omitEmpty bool - quoted bool -} - -func fillField(f field) field { - f.nameBytes = []byte(f.name) - f.equalFold = foldFunc(f.nameBytes) - return f -} - -// byName sorts field by name, breaking ties with depth, -// then breaking ties with "name came from json tag", then -// breaking ties with index sequence. -type byName []field - -func (x byName) Len() int { return len(x) } - -func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] } - -func (x byName) Less(i, j int) bool { - if x[i].name != x[j].name { - return x[i].name < x[j].name - } - if len(x[i].index) != len(x[j].index) { - return len(x[i].index) < len(x[j].index) - } - if x[i].tag != x[j].tag { - return x[i].tag - } - return byIndex(x).Less(i, j) -} - -// byIndex sorts field by index sequence. -type byIndex []field - -func (x byIndex) Len() int { return len(x) } - -func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] } - -func (x byIndex) Less(i, j int) bool { - for k, xik := range x[i].index { - if k >= len(x[j].index) { - return false - } - if xik != x[j].index[k] { - return xik < x[j].index[k] - } - } - return len(x[i].index) < len(x[j].index) -} - -// typeFields returns a list of fields that JSON should recognize for the given type. -// The algorithm is breadth-first search over the set of structs to include - the top struct -// and then any reachable anonymous structs. -func typeFields(t reflect.Type) []field { - // Anonymous fields to explore at the current level and the next. - current := []field{} - next := []field{{typ: t}} - - // Count of queued names for current level and the next. - var count, nextCount map[reflect.Type]int - - // Types already visited at an earlier level. - visited := map[reflect.Type]bool{} - - // Fields found. - var fields []field - - for len(next) > 0 { - current, next = next, current[:0] - count, nextCount = nextCount, map[reflect.Type]int{} - - for _, f := range current { - if visited[f.typ] { - continue - } - visited[f.typ] = true - - // Scan f.typ for fields to include. - for i := 0; i < f.typ.NumField(); i++ { - sf := f.typ.Field(i) - if sf.PkgPath != "" { // unexported - continue - } - tag := sf.Tag.Get("json") - if tag == "-" { - continue - } - name, opts := parseTag(tag) - if !isValidTag(name) { - name = "" - } - index := make([]int, len(f.index)+1) - copy(index, f.index) - index[len(f.index)] = i - - ft := sf.Type - if ft.Name() == "" && ft.Kind() == reflect.Ptr { - // Follow pointer. - ft = ft.Elem() - } - - // Record found field and index sequence. - if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct { - tagged := name != "" - if name == "" { - name = sf.Name - } - fields = append(fields, fillField(field{ - name: name, - tag: tagged, - index: index, - typ: ft, - omitEmpty: opts.Contains("omitempty"), - quoted: opts.Contains("string"), - })) - if count[f.typ] > 1 { - // If there were multiple instances, add a second, - // so that the annihilation code will see a duplicate. - // It only cares about the distinction between 1 or 2, - // so don't bother generating any more copies. - fields = append(fields, fields[len(fields)-1]) - } - continue - } - - // Record new anonymous struct to explore in next round. - nextCount[ft]++ - if nextCount[ft] == 1 { - next = append(next, fillField(field{name: ft.Name(), index: index, typ: ft})) - } - } - } - } - - sort.Sort(byName(fields)) - - // Delete all fields that are hidden by the Go rules for embedded fields, - // except that fields with JSON tags are promoted. - - // The fields are sorted in primary order of name, secondary order - // of field index length. Loop over names; for each name, delete - // hidden fields by choosing the one dominant field that survives. - out := fields[:0] - for advance, i := 0, 0; i < len(fields); i += advance { - // One iteration per name. - // Find the sequence of fields with the name of this first field. - fi := fields[i] - name := fi.name - for advance = 1; i+advance < len(fields); advance++ { - fj := fields[i+advance] - if fj.name != name { - break - } - } - if advance == 1 { // Only one field with this name - out = append(out, fi) - continue - } - dominant, ok := dominantField(fields[i : i+advance]) - if ok { - out = append(out, dominant) - } - } - - fields = out - sort.Sort(byIndex(fields)) - - return fields -} - -// dominantField looks through the fields, all of which are known to -// have the same name, to find the single field that dominates the -// others using Go's embedding rules, modified by the presence of -// JSON tags. If there are multiple top-level fields, the boolean -// will be false: This condition is an error in Go and we skip all -// the fields. -func dominantField(fields []field) (field, bool) { - // The fields are sorted in increasing index-length order. The winner - // must therefore be one with the shortest index length. Drop all - // longer entries, which is easy: just truncate the slice. - length := len(fields[0].index) - tagged := -1 // Index of first tagged field. - for i, f := range fields { - if len(f.index) > length { - fields = fields[:i] - break - } - if f.tag { - if tagged >= 0 { - // Multiple tagged fields at the same level: conflict. - // Return no field. - return field{}, false - } - tagged = i - } - } - if tagged >= 0 { - return fields[tagged], true - } - // All remaining fields have the same length. If there's more than one, - // we have a conflict (two fields named "X" at the same level) and we - // return no field. - if len(fields) > 1 { - return field{}, false - } - return fields[0], true -} - -var fieldCache struct { - sync.RWMutex - m map[reflect.Type][]field -} - -// cachedTypeFields is like typeFields but uses a cache to avoid repeated work. -func cachedTypeFields(t reflect.Type) []field { - fieldCache.RLock() - f := fieldCache.m[t] - fieldCache.RUnlock() - if f != nil { - return f - } - - // Compute fields without lock. - // Might duplicate effort but won't hold other computations back. - f = typeFields(t) - if f == nil { - f = []field{} - } - - fieldCache.Lock() - if fieldCache.m == nil { - fieldCache.m = map[reflect.Type][]field{} - } - fieldCache.m[t] = f - fieldCache.Unlock() - return f -} - -func isValidTag(s string) bool { - if s == "" { - return false - } - for _, c := range s { - switch { - case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~ ", c): - // Backslash and quote chars are reserved, but - // otherwise any punctuation chars are allowed - // in a tag name. - default: - if !unicode.IsLetter(c) && !unicode.IsDigit(c) { - return false - } - } - } - return true -} - -const ( - caseMask = ^byte(0x20) // Mask to ignore case in ASCII. - kelvin = '\u212a' - smallLongEss = '\u017f' -) - -// foldFunc returns one of four different case folding equivalence -// functions, from most general (and slow) to fastest: -// -// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8 -// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S') -// 3) asciiEqualFold, no special, but includes non-letters (including _) -// 4) simpleLetterEqualFold, no specials, no non-letters. -// -// The letters S and K are special because they map to 3 runes, not just 2: -// - S maps to s and to U+017F 'ſ' Latin small letter long s -// - k maps to K and to U+212A 'K' Kelvin sign -// -// See http://play.golang.org/p/tTxjOc0OGo -// -// The returned function is specialized for matching against s and -// should only be given s. It's not curried for performance reasons. -func foldFunc(s []byte) func(s, t []byte) bool { - nonLetter := false - special := false // special letter - for _, b := range s { - if b >= utf8.RuneSelf { - return bytes.EqualFold - } - upper := b & caseMask - if upper < 'A' || upper > 'Z' { - nonLetter = true - } else if upper == 'K' || upper == 'S' { - // See above for why these letters are special. - special = true - } - } - if special { - return equalFoldRight - } - if nonLetter { - return asciiEqualFold - } - return simpleLetterEqualFold -} - -// equalFoldRight is a specialization of bytes.EqualFold when s is -// known to be all ASCII (including punctuation), but contains an 's', -// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t. -// See comments on foldFunc. -func equalFoldRight(s, t []byte) bool { - for _, sb := range s { - if len(t) == 0 { - return false - } - tb := t[0] - if tb < utf8.RuneSelf { - if sb != tb { - sbUpper := sb & caseMask - if 'A' <= sbUpper && sbUpper <= 'Z' { - if sbUpper != tb&caseMask { - return false - } - } else { - return false - } - } - t = t[1:] - continue - } - // sb is ASCII and t is not. t must be either kelvin - // sign or long s; sb must be s, S, k, or K. - tr, size := utf8.DecodeRune(t) - switch sb { - case 's', 'S': - if tr != smallLongEss { - return false - } - case 'k', 'K': - if tr != kelvin { - return false - } - default: - return false - } - t = t[size:] - - } - return len(t) <= 0 -} - -// asciiEqualFold is a specialization of bytes.EqualFold for use when -// s is all ASCII (but may contain non-letters) and contains no -// special-folding letters. -// See comments on foldFunc. -func asciiEqualFold(s, t []byte) bool { - if len(s) != len(t) { - return false - } - for i, sb := range s { - tb := t[i] - if sb == tb { - continue - } - if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') { - if sb&caseMask != tb&caseMask { - return false - } - } else { - return false - } - } - return true -} - -// simpleLetterEqualFold is a specialization of bytes.EqualFold for -// use when s is all ASCII letters (no underscores, etc) and also -// doesn't contain 'k', 'K', 's', or 'S'. -// See comments on foldFunc. -func simpleLetterEqualFold(s, t []byte) bool { - if len(s) != len(t) { - return false - } - for i, b := range s { - if b&caseMask != t[i]&caseMask { - return false - } - } - return true -} - -// tagOptions is the string following a comma in a struct field's "json" -// tag, or the empty string. It does not include the leading comma. -type tagOptions string - -// parseTag splits a struct field's json tag into its name and -// comma-separated options. -func parseTag(tag string) (string, tagOptions) { - if idx := strings.Index(tag, ","); idx != -1 { - return tag[:idx], tagOptions(tag[idx+1:]) - } - return tag, tagOptions("") -} - -// Contains reports whether a comma-separated list of options -// contains a particular substr flag. substr must be surrounded by a -// string boundary or commas. -func (o tagOptions) Contains(optionName string) bool { - if len(o) == 0 { - return false - } - s := string(o) - for s != "" { - var next string - i := strings.Index(s, ",") - if i >= 0 { - s, next = s[:i], s[i+1:] - } - if s == optionName { - return true - } - s = next - } - return false -} diff --git a/vendor/github.com/invopop/yaml/yaml.go b/vendor/github.com/invopop/yaml/yaml.go deleted file mode 100644 index d57dfb1..0000000 --- a/vendor/github.com/invopop/yaml/yaml.go +++ /dev/null @@ -1,312 +0,0 @@ -// Package yaml provides a wrapper around go-yaml designed to enable a better -// way of handling YAML when marshaling to and from structs. -// -// In short, this package first converts YAML to JSON using go-yaml and then -// uses json.Marshal and json.Unmarshal to convert to or from the struct. This -// means that it effectively reuses the JSON struct tags as well as the custom -// JSON methods MarshalJSON and UnmarshalJSON unlike go-yaml. -package yaml // import "github.com/invopop/yaml" - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "reflect" - "strconv" - - "gopkg.in/yaml.v3" -) - -// Marshal the object into JSON then converts JSON to YAML and returns the -// YAML. -func Marshal(o interface{}) ([]byte, error) { - j, err := json.Marshal(o) - if err != nil { - return nil, fmt.Errorf("error marshaling into JSON: %v", err) - } - - y, err := JSONToYAML(j) - if err != nil { - return nil, fmt.Errorf("error converting JSON to YAML: %v", err) - } - - return y, nil -} - -// JSONOpt is a decoding option for decoding from JSON format. -type JSONOpt func(*json.Decoder) *json.Decoder - -// Unmarshal converts YAML to JSON then uses JSON to unmarshal into an object, -// optionally configuring the behavior of the JSON unmarshal. -func Unmarshal(y []byte, o interface{}, opts ...JSONOpt) error { - dec := yaml.NewDecoder(bytes.NewReader(y)) - return unmarshal(dec, o, opts) -} - -func unmarshal(dec *yaml.Decoder, o interface{}, opts []JSONOpt) error { - vo := reflect.ValueOf(o) - j, err := yamlToJSON(dec, &vo) - if err != nil { - return fmt.Errorf("error converting YAML to JSON: %v", err) - } - - err = jsonUnmarshal(bytes.NewReader(j), o, opts...) - if err != nil { - return fmt.Errorf("error unmarshaling JSON: %v", err) - } - - return nil -} - -// jsonUnmarshal unmarshals the JSON byte stream from the given reader into the -// object, optionally applying decoder options prior to decoding. We are not -// using json.Unmarshal directly as we want the chance to pass in non-default -// options. -func jsonUnmarshal(r io.Reader, o interface{}, opts ...JSONOpt) error { - d := json.NewDecoder(r) - for _, opt := range opts { - d = opt(d) - } - if err := d.Decode(&o); err != nil { - return fmt.Errorf("while decoding JSON: %v", err) - } - return nil -} - -// JSONToYAML converts JSON to YAML. -func JSONToYAML(j []byte) ([]byte, error) { - // Convert the JSON to an object. - var jsonObj interface{} - // We are using yaml.Unmarshal here (instead of json.Unmarshal) because the - // Go JSON library doesn't try to pick the right number type (int, float, - // etc.) when unmarshalling to interface{}, it just picks float64 - // universally. go-yaml does go through the effort of picking the right - // number type, so we can preserve number type throughout this process. - err := yaml.Unmarshal(j, &jsonObj) - if err != nil { - return nil, err - } - - // Marshal this object into YAML. - return yaml.Marshal(jsonObj) -} - -// YAMLToJSON converts YAML to JSON. Since JSON is a subset of YAML, -// passing JSON through this method should be a no-op. -// -// Things YAML can do that are not supported by JSON: -// - In YAML you can have binary and null keys in your maps. These are invalid -// in JSON. (int and float keys are converted to strings.) -// - Binary data in YAML with the !!binary tag is not supported. If you want to -// use binary data with this library, encode the data as base64 as usual but do -// not use the !!binary tag in your YAML. This will ensure the original base64 -// encoded data makes it all the way through to the JSON. -func YAMLToJSON(y []byte) ([]byte, error) { //nolint:revive - dec := yaml.NewDecoder(bytes.NewReader(y)) - return yamlToJSON(dec, nil) -} - -func yamlToJSON(dec *yaml.Decoder, jsonTarget *reflect.Value) ([]byte, error) { - // Convert the YAML to an object. - var yamlObj interface{} - if err := dec.Decode(&yamlObj); err != nil { - // Functionality changed in v3 which means we need to ignore EOF error. - // See https://github.com/go-yaml/yaml/issues/639 - if !errors.Is(err, io.EOF) { - return nil, err - } - } - - // YAML objects are not completely compatible with JSON objects (e.g. you - // can have non-string keys in YAML). So, convert the YAML-compatible object - // to a JSON-compatible object, failing with an error if irrecoverable - // incompatibilities happen along the way. - jsonObj, err := convertToJSONableObject(yamlObj, jsonTarget) - if err != nil { - return nil, err - } - - // Convert this object to JSON and return the data. - return json.Marshal(jsonObj) -} - -func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) { //nolint:gocyclo - var err error - - // Resolve jsonTarget to a concrete value (i.e. not a pointer or an - // interface). We pass decodingNull as false because we're not actually - // decoding into the value, we're just checking if the ultimate target is a - // string. - if jsonTarget != nil { - ju, tu, pv := indirect(*jsonTarget, false) - // We have a JSON or Text Umarshaler at this level, so we can't be trying - // to decode into a string. - if ju != nil || tu != nil { - jsonTarget = nil - } else { - jsonTarget = &pv - } - } - - // go-yaml v3 changed from v2 and now will provide map[string]interface{} by - // default and map[interface{}]interface{} when none of the keys strings. - // To get around this, we run a pre-loop to convert the map. - // JSON only supports strings as keys, so we must convert. - - switch typedYAMLObj := yamlObj.(type) { - case map[interface{}]interface{}: - // From my reading of go-yaml v2 (specifically the resolve function), - // keys can only have the types string, int, int64, float64, binary - // (unsupported), or null (unsupported). - strMap := make(map[string]interface{}) - for k, v := range typedYAMLObj { - // Resolve the key to a string first. - var keyString string - switch typedKey := k.(type) { - case string: - keyString = typedKey - case int: - keyString = strconv.Itoa(typedKey) - case int64: - // go-yaml will only return an int64 as a key if the system - // architecture is 32-bit and the key's value is between 32-bit - // and 64-bit. Otherwise the key type will simply be int. - keyString = strconv.FormatInt(typedKey, 10) - case float64: - // Float64 is now supported in keys - keyString = strconv.FormatFloat(typedKey, 'g', -1, 64) - case bool: - if typedKey { - keyString = "true" - } else { - keyString = "false" - } - default: - return nil, fmt.Errorf("unsupported map key of type: %s, key: %+#v, value: %+#v", - reflect.TypeOf(k), k, v) - } - strMap[keyString] = v - } - // replace yamlObj with our new string map - yamlObj = strMap - } - - // If yamlObj is a number or a boolean, check if jsonTarget is a string - - // if so, coerce. Else return normal. - // If yamlObj is a map or array, find the field that each key is - // unmarshaling to, and when you recurse pass the reflect.Value for that - // field back into this function. - switch typedYAMLObj := yamlObj.(type) { - case map[string]interface{}: - for k, v := range typedYAMLObj { - - // jsonTarget should be a struct or a map. If it's a struct, find - // the field it's going to map to and pass its reflect.Value. If - // it's a map, find the element type of the map and pass the - // reflect.Value created from that type. If it's neither, just pass - // nil - JSON conversion will error for us if it's a real issue. - if jsonTarget != nil { - t := *jsonTarget - if t.Kind() == reflect.Struct { - keyBytes := []byte(k) - // Find the field that the JSON library would use. - var f *field - fields := cachedTypeFields(t.Type()) - for i := range fields { - ff := &fields[i] - if bytes.Equal(ff.nameBytes, keyBytes) { - f = ff - break - } - // Do case-insensitive comparison. - if f == nil && ff.equalFold(ff.nameBytes, keyBytes) { - f = ff - } - } - if f != nil { - // Find the reflect.Value of the most preferential - // struct field. - jtf := t.Field(f.index[0]) - typedYAMLObj[k], err = convertToJSONableObject(v, &jtf) - if err != nil { - return nil, err - } - continue - } - } else if t.Kind() == reflect.Map { - // Create a zero value of the map's element type to use as - // the JSON target. - jtv := reflect.Zero(t.Type().Elem()) - typedYAMLObj[k], err = convertToJSONableObject(v, &jtv) - if err != nil { - return nil, err - } - continue - } - } - typedYAMLObj[k], err = convertToJSONableObject(v, nil) - if err != nil { - return nil, err - } - } - return typedYAMLObj, nil - case []interface{}: - // We need to recurse into arrays in case there are any - // map[interface{}]interface{}'s inside and to convert any - // numbers to strings. - - // If jsonTarget is a slice (which it really should be), find the - // thing it's going to map to. If it's not a slice, just pass nil - // - JSON conversion will error for us if it's a real issue. - var jsonSliceElemValue *reflect.Value - if jsonTarget != nil { - t := *jsonTarget - if t.Kind() == reflect.Slice { - // By default slices point to nil, but we need a reflect.Value - // pointing to a value of the slice type, so we create one here. - ev := reflect.Indirect(reflect.New(t.Type().Elem())) - jsonSliceElemValue = &ev - } - } - - // Make and use a new array. - arr := make([]interface{}, len(typedYAMLObj)) - for i, v := range typedYAMLObj { - arr[i], err = convertToJSONableObject(v, jsonSliceElemValue) - if err != nil { - return nil, err - } - } - return arr, nil - default: - // If the target type is a string and the YAML type is a number, - // convert the YAML type to a string. - if jsonTarget != nil && (*jsonTarget).Kind() == reflect.String { - // Based on my reading of go-yaml, it may return int, int64, - // float64, or uint64. - var s string - switch typedVal := typedYAMLObj.(type) { - case int: - s = strconv.FormatInt(int64(typedVal), 10) - case int64: - s = strconv.FormatInt(typedVal, 10) - case float64: - s = strconv.FormatFloat(typedVal, 'g', -1, 64) - case uint64: - s = strconv.FormatUint(typedVal, 10) - case bool: - if typedVal { - s = "true" - } else { - s = "false" - } - } - if len(s) > 0 { - yamlObj = interface{}(s) - } - } - return yamlObj, nil - } -} diff --git a/vendor/github.com/sjtug/cerberus/.dist.gitignore b/vendor/github.com/sjtug/cerberus/.dist.gitignore deleted file mode 100644 index 9dfa488..0000000 --- a/vendor/github.com/sjtug/cerberus/.dist.gitignore +++ /dev/null @@ -1,41 +0,0 @@ -# Devenv -.devenv* -devenv.local.nix - -# direnv -.direnv - -# pre-commit -.pre-commit-config.yaml - -.idea/ - - -# If you prefer the allow list template instead of the deny list, see community template: -# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore -# -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ - -# Go workspace file -go.work -go.work.sum - -# env file -.env -caddy - -.parcel-cache
\ No newline at end of file diff --git a/vendor/github.com/sjtug/cerberus/.envrc b/vendor/github.com/sjtug/cerberus/.envrc deleted file mode 100644 index 30da14f..0000000 --- a/vendor/github.com/sjtug/cerberus/.envrc +++ /dev/null @@ -1,5 +0,0 @@ -export DIRENV_WARN_TIMEOUT=20s - -eval "$(devenv direnvrc)" - -use devenv diff --git a/vendor/github.com/sjtug/cerberus/.gitignore b/vendor/github.com/sjtug/cerberus/.gitignore deleted file mode 100644 index 9dfa488..0000000 --- a/vendor/github.com/sjtug/cerberus/.gitignore +++ /dev/null @@ -1,41 +0,0 @@ -# Devenv -.devenv* -devenv.local.nix - -# direnv -.direnv - -# pre-commit -.pre-commit-config.yaml - -.idea/ - - -# If you prefer the allow list template instead of the deny list, see community template: -# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore -# -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ - -# Go workspace file -go.work -go.work.sum - -# env file -.env -caddy - -.parcel-cache
\ No newline at end of file diff --git a/vendor/github.com/sjtug/cerberus/.golangci.yaml b/vendor/github.com/sjtug/cerberus/.golangci.yaml deleted file mode 100644 index 1c0d967..0000000 --- a/vendor/github.com/sjtug/cerberus/.golangci.yaml +++ /dev/null @@ -1,24 +0,0 @@ -version: "2" -linters: - default: standard - enable: - - gosec - - revive - exclusions: - generated: lax - presets: - - comments - - common-false-positives - - legacy - - std-error-handling - paths: - - third_party$ - - builtin$ - - examples$ -formatters: - exclusions: - generated: lax - paths: - - third_party$ - - builtin$ - - examples$ diff --git a/vendor/github.com/sjtug/cerberus/Caddyfile b/vendor/github.com/sjtug/cerberus/Caddyfile deleted file mode 100644 index b3d20f8..0000000 --- a/vendor/github.com/sjtug/cerberus/Caddyfile +++ /dev/null @@ -1,84 +0,0 @@ -{ - log default { - level DEBUG - } - - # Global configuration for cerberus. - cerberus { - # Challenge difficulty (number of leading zeroes in the hash). - difficulty 12 - # When set to true, the handler will drop the connection instead of returning a 403 if the IP is blocked. - # drop - # Ed25519 signing key file path. If not provided, a new key will be generated. - # ed25519_key_file "ed25519.key" - # MaxPending is the maximum number of pending (and failed) requests. - # Any IP block (prefix configured in prefix_cfg) with more than this number of pending requests will be blocked. - max_pending 128 - # AccessPerApproval is the number of requests allowed per successful challenge. We recommend a value greater than 8 to support parallel and resumable downloads. - access_per_approval 8 - # BlockTTL is the time to live for blocked IPs. - block_ttl "24h" - # PendingTTL is the time to live for pending requests when considering whether to block an IP. - pending_ttl "1h" - # ApprovalTTL is the time to live for approved requests. - approval_ttl "1h" - # MaxMemUsage is the maximum memory usage for the pending and blocklist caches. - max_mem_usage "512MiB" - # CookieName is the name of the cookie used to store signed certificate. - cookie_name "cerberus-auth" - # HeaderName is the name of the header used to store cerberus status ("PASS-BRIEF", "PASS-FULL", "BLOCK", "FAIL"). - header_name "X-Cerberus-Status" - # Title is the title of the challenge page. - title "Cerberus Challenge" - # Mail is the email address to contact for support. - mail "admin@example.com" - # PrefixCfg is to configure prefixes used to block users in these IP prefix blocks, e.g., /24 /64. - # The first argument is for IPv4 and the second is for IPv6. - prefix_cfg 20 64 - } -} - -localhost { - encode - - # You need to deploy a handler for each cerberus instance. - # This route will be used to serve challenge endpoints and static files. - handle_path /.cerberus/* { - cerberus_endpoint - } - - @cerberus { - path *.iso - header User-Agent *Mozilla* - } - - # This is the actual middleware that will be used to challenge requests. - # You can attach a named matcher to the cerberus directive. Only requests matching the matcher will be challenged. - cerberus @cerberus { - # The base URL for the challenge. It must be the same as the deployed endpoint route. - base_url "/.cerberus" - } - - @except_cerberus_endpoint { - not path /.cerberus/* - } - - # Block bad IPs except for the cerberus endpoint. - cerberus @except_cerberus_endpoint { - base_url "/.cerberus" - # Cerberus in block only mode doesn't perform any challenge. It only blocks known bad IPs. - block_only - } - - handle / { - respond "Hello, world!" - } - - handle /foo { - respond "Hello, foo!" - } - - handle /foo.iso { - respond "Hello, foo.iso!" - } -} diff --git a/vendor/github.com/sjtug/cerberus/LICENSE.anubis.md b/vendor/github.com/sjtug/cerberus/LICENSE.anubis.md deleted file mode 100644 index 1d2db09..0000000 --- a/vendor/github.com/sjtug/cerberus/LICENSE.anubis.md +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2025 Xe Iaso <me@xeiaso.net> - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE.
\ No newline at end of file diff --git a/vendor/github.com/sjtug/cerberus/LICENSE.md b/vendor/github.com/sjtug/cerberus/LICENSE.md deleted file mode 100644 index 1281fdf..0000000 --- a/vendor/github.com/sjtug/cerberus/LICENSE.md +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2025 Yanning Chen <self@lightquantum.me> - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - ---- - -This project includes code from [Anubis](https://github.com/TecharoHQ/anubis/) licensed under the MIT License: see [LICENSE.anubis.md](LICENSE.anubis.md).
\ No newline at end of file diff --git a/vendor/github.com/sjtug/cerberus/README.md b/vendor/github.com/sjtug/cerberus/README.md deleted file mode 100644 index 8cef5d2..0000000 --- a/vendor/github.com/sjtug/cerberus/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# Cerberus - -<center> - <img width=256 src="./web/img/mascot-puzzle.png" alt="A smiling chibi dark-skinned anthro jackal with brown hair and tall ears looking victorious with a thumbs-up" /> -</center> - -Cerberus guards the gates of open source infrastructure using a sha256 PoW challenge to protect them from unwanted traffic. It provides a Caddy handler that can be applied to existing Caddy servers. - -This project started as a Caddy port of [Anubis](https://github.com/TecharoHQ/anubis/) and is now a standalone project. While Anubis focuses on protecting websites from AI scrapers, Cerberus serves a different purpose: it's designed as a last line of defense to protect volunteer-run open source infrastructure from abusive traffic. We would do whatever it takes to stop them, even if it means sacrificing a few innocent cats. - -For now, the project is still mostly a re-implementation of Anubis, but it's actively developed, and will eventually employ more aggressive techniques. You can check the [Roadmap](#roadmap) section for more details. - -## Usage - -### Official Pre-built Binaries - -> Sometimes the official binaries are not up to date. In that case please build from source. - -1. Install Caddy with the plugin: - ```bash - caddy add-package github.com/sjtug/cerberus - ``` -2. Add the handler directive to your Caddyfile. Refer to the [Caddyfile](Caddyfile) for an example configuration. - -### Build from Source - -Please build against the **dist** branch or a release tag: - -```bash -# Build with a specific version -xcaddy build --with github.com/sjtug/cerberus@v1.0.0 - -# Or build with the latest dist branch -xcaddy build --with github.com/sjtug/cerberus@dist -``` - -## Comparison with Anubis - -- Anubis is a standalone server that can be used with any web server, while Cerberus is a Caddy plugin. -- No builtin anti-AI rules: use caddy matchers instead. -- Highly aggressive challenge policy: users need to solve a challenge for every few requests and new challenges are generated per request. For further details, see the [Aggressive challenge policy](#aggressive-challenge-policy) section. -- Can be set up to block IP subnets if there are too many failed challenge attempts to prevent abuse. -- ~~No custom UI or anime girls.~~ Now with an AI-generated placeholder mascot lol - -## Configuration - -Check [Caddyfile](Caddyfile) for an example configuration. - -## Roadmap - -- [x] More frequent challenges (each solution only grants a few accesses) -- [x] More frequent challenge rotation (per week -> per request) -- [ ] Configurable challenge difficulty for each route -- [x] "block_only" mode to serve as a blocklist even a route is not protected by PoW challenge -- [x] ~~RandomX PoW~~ unacceptably slow. Use blake3 (wasm) instead. -- [x] I18n -- [ ] Non-AI mascot - -## Aggressive challenge policy - -This is the first divergence from Anubis. Now, we require a user to repeat the challenge every few accesses. This is to ensure that we waste an attacker's computational resources to the extent that it becomes non-sustainable for the attacker to perform the attack. - -This will surely slow down legitimate users, but we believe that this is a necessary evil to protect our infrastructure. After all, a slow down is better than a complete outage. - -## Development - -You need to first generate necessary go files before developing: -```bash -$ devenv tasks run go:codegen -``` - -If you modified any web asset, you need to run the following command to build the dist files: -```bash -$ devenv tasks run dist:build -``` - -Please run tests and lints before submitting a PR: -```bash -$ direnv test # or go test -$ devenv tasks run go:lint -``` - -## Build Pipeline - -This repository uses a two-branch strategy: - -- **master branch**: Contains source code only (no generated artifacts) -- **dist branch**: Contains both source code and all generated artifacts - -### Release Process - -To create a release: - -1. Update the `Version` constant in `core/const.go`. -2. Go to "Actions" → "Build and Update Dist Branch" → "Run workflow". -3. Enter the version tag (e.g., "v1.0.0") and run the workflow.
\ No newline at end of file diff --git a/vendor/github.com/sjtug/cerberus/cerberus.go b/vendor/github.com/sjtug/cerberus/cerberus.go deleted file mode 100644 index 238d00c..0000000 --- a/vendor/github.com/sjtug/cerberus/cerberus.go +++ /dev/null @@ -1,25 +0,0 @@ -package cerberus - -import ( - "embed" - - "github.com/caddyserver/caddy/v2" - "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile" - "github.com/sjtug/cerberus/directives" -) - -//go:embed translations -var translations embed.FS - -func init() { - directives.LoadI18n(translations) - - caddy.RegisterModule(directives.App{}) - caddy.RegisterModule(directives.Middleware{}) - caddy.RegisterModule(directives.Endpoint{}) - httpcaddyfile.RegisterGlobalOption("cerberus", directives.ParseCaddyFileApp) - httpcaddyfile.RegisterHandlerDirective("cerberus", directives.ParseCaddyFileMiddleware) - httpcaddyfile.RegisterHandlerDirective("cerberus_endpoint", directives.ParseCaddyFileEndpoint) - httpcaddyfile.RegisterDirectiveOrder("cerberus", httpcaddyfile.Before, "invoke") - httpcaddyfile.RegisterDirectiveOrder("cerberus_endpoint", httpcaddyfile.Before, "invoke") -} diff --git a/vendor/github.com/sjtug/cerberus/core/config.go b/vendor/github.com/sjtug/cerberus/core/config.go deleted file mode 100644 index 470d6a3..0000000 --- a/vendor/github.com/sjtug/cerberus/core/config.go +++ /dev/null @@ -1,216 +0,0 @@ -package core - -import ( - "bytes" - "crypto/ed25519" - "encoding/hex" - "errors" - "fmt" - "os" - "time" - - "github.com/sjtug/cerberus/internal/ipblock" - "go.uber.org/zap" - "golang.org/x/crypto/ssh" -) - -const ( - DefaultCookieName = "cerberus-auth" - DefaultHeaderName = "X-Cerberus-Status" - DefaultDifficulty = 4 - DefaultMaxPending = 128 - DefaultAccessPerApproval = 8 - DefaultBlockTTL = time.Hour * 24 // 1 day - DefaultPendingTTL = time.Hour // 1 hour - DefaultApprovalTTL = time.Hour // 1 hour - DefaultMaxMemUsage = 1 << 29 // 512MB - DefaultTitle = "Cerberus Challenge" - DefaultDescription = "Making sure you're not a bot!" - DefaultIPV4Prefix = 32 - DefaultIPV6Prefix = 64 -) - -type Config struct { - // Challenge difficulty (number of leading zeroes in the hash). - Difficulty int `json:"difficulty,omitempty"` - // When set to true, the handler will drop the connection instead of returning a 403 if the IP is blocked. - Drop bool `json:"drop,omitempty"` - // Ed25519 signing key file path. If not provided, a new key will be generated. - Ed25519KeyFile string `json:"ed25519_key_file,omitempty"` - // Ed25519 signing key content. If not provided, a new key will be generated. - Ed25519Key string `json:"ed25519_key,omitempty"` - // MaxPending is the maximum number of pending (and failed) requests. - // Any IP block (prefix configured in prefix_cfg) with more than this number of pending requests will be blocked. - MaxPending int32 `json:"max_pending,omitempty"` - // AccessPerApproval is the number of requests allowed per successful challenge. - AccessPerApproval int32 `json:"access_per_approval,omitempty"` - // BlockTTL is the time to live for blocked IPs. - BlockTTL time.Duration `json:"block_ttl,omitempty"` - // PendingTTL is the time to live for pending requests when considering whether to block an IP. - PendingTTL time.Duration `json:"pending_ttl,omitempty"` - // ApprovalTTL is the time to live for approved requests. - ApprovalTTL time.Duration `json:"approval_ttl,omitempty"` - // MaxMemUsage is the maximum memory usage for the pending and blocklist caches. - MaxMemUsage int64 `json:"max_mem_usage,omitempty"` - // CookieName is the name of the cookie used to store signed certificate. - CookieName string `json:"cookie_name,omitempty"` - // HeaderName is the name of the header used to store cerberus status ("PASS", "CHALLENGE", "FAIL", "BLOCKED", "DISABLED"). - HeaderName string `json:"header_name,omitempty"` - // Title is the title of the challenge page. - Title string `json:"title,omitempty"` - // Mail is the email address to contact for support. - Mail string `json:"mail,omitempty"` - // PrefixCfg is to configure prefixes used to block users in these IP prefix blocks, e.g., /24 /64. - PrefixCfg ipblock.Config `json:"prefix_cfg,omitempty"` - - ed25519Key ed25519.PrivateKey - ed25519Pub ed25519.PublicKey -} - -func (c *Config) Provision(logger *zap.Logger) error { - if c.Difficulty == 0 { - c.Difficulty = DefaultDifficulty - } - if c.MaxPending == 0 { - c.MaxPending = DefaultMaxPending - } - if c.AccessPerApproval == 0 { - c.AccessPerApproval = DefaultAccessPerApproval - } - if c.BlockTTL == time.Duration(0) { - c.BlockTTL = DefaultBlockTTL - } - if c.PendingTTL == time.Duration(0) { - c.PendingTTL = DefaultPendingTTL - } - if c.ApprovalTTL == time.Duration(0) { - c.ApprovalTTL = DefaultApprovalTTL - } - if c.MaxMemUsage == 0 { - c.MaxMemUsage = DefaultMaxMemUsage - } - if c.CookieName == "" { - c.CookieName = DefaultCookieName - } - if c.HeaderName == "" { - c.HeaderName = DefaultHeaderName - } - if c.Title == "" { - c.Title = DefaultTitle - } - if c.PrefixCfg.IsEmpty() { - c.PrefixCfg = ipblock.Config{ - V4Prefix: DefaultIPV4Prefix, - V6Prefix: DefaultIPV6Prefix, - } - } - - if c.Ed25519KeyFile != "" || c.Ed25519Key != "" { - var raw []byte - var err error - if c.Ed25519KeyFile != "" { - logger.Info("loading ed25519 key from file", zap.String("path", c.Ed25519KeyFile)) - - raw, err = os.ReadFile(c.Ed25519KeyFile) - if err != nil { - return fmt.Errorf("failed to read ed25519 key file: %w", err) - } - } else { - raw = []byte(c.Ed25519Key) - } - - c.ed25519Key, err = LoadEd25519Key(raw) - if err != nil { - return fmt.Errorf("failed to load ed25519 key: %w", err) - } - - c.ed25519Pub = c.ed25519Key.Public().(ed25519.PublicKey) - } else { - logger.Info("generating new ed25519 key") - var err error - c.ed25519Pub, c.ed25519Key, err = ed25519.GenerateKey(nil) - if err != nil { - return fmt.Errorf("failed to generate ed25519 key: %w", err) - } - } - - return nil -} - -func (c *Config) Validate() error { - if c.Difficulty < 1 { - return errors.New("difficulty must be at least 1") - } - if c.MaxPending < 1 { - return errors.New("max_pending must be at least 1") - } - if c.AccessPerApproval < 1 { - return errors.New("access_per_approval must be at least 1") - } - if c.BlockTTL < 0 { - return errors.New("block_ttl must be a positive duration") - } - if c.PendingTTL < 0 { - return errors.New("pending_ttl must be a positive duration") - } - if c.ApprovalTTL < 0 { - return errors.New("approval_ttl must be a positive duration") - } - if c.MaxMemUsage < 1 { - return errors.New("max_mem_usage must be at least 1") - } - if c.Ed25519KeyFile != "" && c.Ed25519Key != "" { - return errors.New("ed25519_key_file and ed25519_key cannot both be set") - } - if err := ipblock.ValidateConfig(c.PrefixCfg); err != nil { - return fmt.Errorf("prefix_cfg: %w", err) - } - - return nil -} - -func (c *Config) StateCompatible(other *Config) bool { - return c.BlockTTL == other.BlockTTL && - c.PendingTTL == other.PendingTTL && - c.ApprovalTTL == other.ApprovalTTL && - c.AccessPerApproval == other.AccessPerApproval && - c.MaxMemUsage == other.MaxMemUsage && - c.PrefixCfg == other.PrefixCfg -} - -func (c *Config) GetPublicKey() ed25519.PublicKey { - return c.ed25519Pub -} - -func (c *Config) GetPrivateKey() ed25519.PrivateKey { - return c.ed25519Key -} - -func LoadEd25519Key(data []byte) (ed25519.PrivateKey, error) { - // First try to parse as openssh or x509 private key - if bytes.HasPrefix(data, []byte("-----BEGIN ")) { - raw, err := ssh.ParseRawPrivateKey(data) - if err != nil { - return nil, fmt.Errorf("failed to parse pem private key: %w", err) - } - if key, ok := raw.(ed25519.PrivateKey); ok { - return key, nil - } - if key, ok := raw.(*ed25519.PrivateKey); ok { - return *key, nil - } - return nil, errors.New("must be ed25519 private key") - } - - // Then try to parse as hex - raw, err := hex.DecodeString(string(data)) - if err != nil { - return nil, fmt.Errorf("failed to parse hex private key: %w", err) - } - if len(raw) != ed25519.SeedSize { - return nil, fmt.Errorf("invalid ed25519 private key: expected %d bytes, got %d", ed25519.SeedSize, len(raw)) - } - - key := ed25519.NewKeyFromSeed(raw) - return key, nil -} diff --git a/vendor/github.com/sjtug/cerberus/core/const.go b/vendor/github.com/sjtug/cerberus/core/const.go deleted file mode 100644 index 953cd9d..0000000 --- a/vendor/github.com/sjtug/cerberus/core/const.go +++ /dev/null @@ -1,11 +0,0 @@ -package core - -import "time" - -const ( - AppName = "cerberus" - VarIPBlock = "cerberus-block" - VarReqID = "cerberus-request-id" - Version = "v0.4.3" - NonceTTL = 2 * time.Minute -) diff --git a/vendor/github.com/sjtug/cerberus/core/instance.go b/vendor/github.com/sjtug/cerberus/core/instance.go deleted file mode 100644 index fa4962f..0000000 --- a/vendor/github.com/sjtug/cerberus/core/instance.go +++ /dev/null @@ -1,39 +0,0 @@ -package core - -import ( - "go.uber.org/zap" -) - -// Instance is the shared core of the cerberus module. -// There's only one instance of this struct in the entire Caddy runtime. -type Instance struct { - *InstanceState - Config -} - -// UpdateWithConfig updates the instance with a new config. -// If the config is incompatible with the current config, its internal state will be reset. -// User can pass in an optional logger to log basic metrics about the initialized state. -func (i *Instance) UpdateWithConfig(c Config, logger *zap.Logger) error { - logger.Info("updating cerberus instance config") - if i.StateCompatible(&c) { - // We only need to update the config. - i.Config = c - } else { - // We need to reset the state. - logger.Info("existing cerberus instance with incompatible config found, resetting state") - state, pendingElems, blocklistElems, approvalElems, err := NewInstanceState(c) - if err != nil { - return err - } - i.Config = c - i.Close() // Close the old state - i.InstanceState = state - logger.Info("cerberus state initialized", - zap.Int64("pending_elems", pendingElems), - zap.Int64("blocklist_elems", blocklistElems), - zap.Int64("approval_elems", approvalElems), - ) - } - return nil -} diff --git a/vendor/github.com/sjtug/cerberus/core/pool.go b/vendor/github.com/sjtug/cerberus/core/pool.go deleted file mode 100644 index 5d6268a..0000000 --- a/vendor/github.com/sjtug/cerberus/core/pool.go +++ /dev/null @@ -1,48 +0,0 @@ -package core - -import ( - "sync" - - "go.uber.org/zap" -) - -var ( - lock sync.RWMutex - instance *Instance -) - -// GetInstance returns an instance of given config. -// If there already exists an instance (during server reload), it will be updated with the new config. -// Otherwise, a new instance will be created. -// User can pass in an optional logger to log basic metrics about the initialized state. -func GetInstance(config Config, logger *zap.Logger) (*Instance, error) { - lock.Lock() - defer lock.Unlock() - - if instance == nil { - // Initialize a new instance. - state, pendingElems, blocklistElems, approvalElems, err := NewInstanceState(config) - if err != nil { - return nil, err - } - - logger.Info("cerberus state initialized", - zap.Int64("pending_elems", pendingElems), - zap.Int64("blocklist_elems", blocklistElems), - zap.Int64("approval_elems", approvalElems), - ) - instance = &Instance{ - Config: config, - InstanceState: state, - } - return instance, nil - } - - // Update the existing instance with the new config. - err := instance.UpdateWithConfig(config, logger) - if err != nil { - return nil, err - } - - return instance, nil -} diff --git a/vendor/github.com/sjtug/cerberus/core/state.go b/vendor/github.com/sjtug/cerberus/core/state.go deleted file mode 100644 index 597ea44..0000000 --- a/vendor/github.com/sjtug/cerberus/core/state.go +++ /dev/null @@ -1,231 +0,0 @@ -package core - -import ( - "sync/atomic" - "time" - "unsafe" - - "crypto/sha256" - "encoding/binary" - "encoding/hex" - - "github.com/elastic/go-freelru" - "github.com/google/uuid" - "github.com/sjtug/cerberus/internal/expiremap" - "github.com/sjtug/cerberus/internal/ipblock" - "github.com/zeebo/xxh3" -) - -const ( - FreeLRUInternalCost = 20 - PendingItemCost = FreeLRUInternalCost + int64(unsafe.Sizeof(ipblock.IPBlock{})) + int64(unsafe.Sizeof(&atomic.Int32{})) + int64(unsafe.Sizeof(atomic.Int32{})) - BlocklistItemCost = FreeLRUInternalCost + int64(unsafe.Sizeof(ipblock.IPBlock{})) - ApprovalItemCost = FreeLRUInternalCost + int64(unsafe.Sizeof(uuid.UUID{})) + int64(unsafe.Sizeof(&atomic.Int32{})) + int64(unsafe.Sizeof(atomic.Int32{})) -) - -func hashIPBlock(ip ipblock.IPBlock) uint32 { - data := ip.ToUint64() - - var buf [8]byte - binary.BigEndian.PutUint64(buf[:], data) - - hash := xxh3.Hash(buf[:]) - return uint32(hash) // #nosec G115 -- expected truncation -} - -func hashUUID(id uuid.UUID) uint32 { - hash := xxh3.Hash(id[:]) - return uint32(hash) // #nosec G115 -- expected truncation -} - -type InstanceState struct { - fp string - pending freelru.Cache[ipblock.IPBlock, *atomic.Int32] - blocklist freelru.Cache[ipblock.IPBlock, struct{}] - approval freelru.Cache[uuid.UUID, *atomic.Int32] - usedNonce *expiremap.ExpireMap[uint32, struct{}] - stop chan struct{} -} - -// initLRU creates and initializes an LRU cache with the given parameters -func initLRU[K comparable, V any]( - elems uint32, - hashFunc func(K) uint32, - ttl time.Duration, - stop chan struct{}, - purgeInterval time.Duration, -) (freelru.Cache[K, V], error) { - cache, err := freelru.NewSharded[K, V](elems, hashFunc) - if err != nil { - return nil, err - } - cache.SetLifetime(ttl) - - go func() { - for { - select { - case <-stop: - return - case <-time.After(purgeInterval): - cache.PurgeExpired() - } - } - }() - - return cache, nil -} - -// initUsedNonce creates and initializes an ExpireMap for tracking used nonces -func initUsedNonce(stop chan struct{}, purgeInterval time.Duration) *expiremap.ExpireMap[uint32, struct{}] { - usedNonce := expiremap.NewExpireMap[uint32, struct{}](func(x uint32) uint32 { - return x - }) - go func() { - for { - select { - case <-stop: - return - case <-time.After(purgeInterval): - usedNonce.PurgeExpired() - } - } - }() - return usedNonce -} - -func NewInstanceState(config Config) (*InstanceState, int64, int64, int64, error) { - uuid.EnableRandPool() - - stop := make(chan struct{}) - - pendingMaxMemUsage := config.MaxMemUsage / 10 - blocklistMaxMemUsage := config.MaxMemUsage / 10 - approvalMaxMemUsage := config.MaxMemUsage * 4 / 5 - - pendingElems := uint32(pendingMaxMemUsage / PendingItemCost) // #nosec G115 we trust config input - pending, err := initLRU[ipblock.IPBlock, *atomic.Int32]( - pendingElems, - hashIPBlock, - config.PendingTTL, - stop, - 37*time.Second, - ) - if err != nil { - return nil, 0, 0, 0, err - } - - blocklistElems := uint32(blocklistMaxMemUsage / BlocklistItemCost) // #nosec G115 we trust config input - blocklist, err := initLRU[ipblock.IPBlock, struct{}]( - blocklistElems, - hashIPBlock, - config.BlockTTL, - stop, - 61*time.Second, - ) - if err != nil { - return nil, 0, 0, 0, err - } - - approvalElems := uint32(approvalMaxMemUsage / ApprovalItemCost) // #nosec G115 we trust config input - approval, err := initLRU[uuid.UUID, *atomic.Int32]( - approvalElems, - hashUUID, - config.ApprovalTTL, - stop, - 43*time.Second, - ) - if err != nil { - return nil, 0, 0, 0, err - } - - usedNonce := initUsedNonce(stop, 41*time.Second) - - fp := sha256.Sum256(config.ed25519Key.Seed()) - - return &InstanceState{ - fp: hex.EncodeToString(fp[:]), - pending: pending, - blocklist: blocklist, - approval: approval, - usedNonce: usedNonce, - stop: stop, - }, int64(pendingElems), int64(blocklistElems), int64(approvalElems), nil -} - -func (s *InstanceState) GetFingerprint() string { - return s.fp -} - -func (s *InstanceState) IncPending(ip ipblock.IPBlock) int32 { - counter, ok := s.pending.Get(ip) - if ok { - return counter.Add(1) - } - - var newCounter atomic.Int32 - newCounter.Store(1) - s.pending.Add(ip, &newCounter) - return 1 -} - -func (s *InstanceState) DecPending(ip ipblock.IPBlock) int32 { - counter, ok := s.pending.Get(ip) - if ok { - count := counter.Add(-1) - if count <= 0 { - s.pending.Remove(ip) - return 0 - } - return count - } - - return 0 -} - -func (s *InstanceState) RemovePending(ip ipblock.IPBlock) bool { - return s.pending.Remove(ip) -} - -func (s *InstanceState) InsertBlocklist(ip ipblock.IPBlock) { - s.blocklist.Add(ip, struct{}{}) -} - -func (s *InstanceState) ContainsBlocklist(ip ipblock.IPBlock) bool { - _, ok := s.blocklist.Get(ip) - return ok -} - -// IssueApproval issues a new approval ID and returns it -func (s *InstanceState) IssueApproval(n int32) uuid.UUID { - id := uuid.New() - - var counter atomic.Int32 - counter.Store(n) - - s.approval.Add(id, &counter) - return id -} - -// DecApproval decrements the counter of the approval ID and returns whether the ID is still valid -func (s *InstanceState) DecApproval(id uuid.UUID) bool { - counter, ok := s.approval.Get(id) - if ok { - count := counter.Add(-1) - if count < 0 { - s.approval.Remove(id) - return false - } - return true - } - return false -} - -// InsertUsedNonce inserts a nonce into the usedNonce map. -// Returns true if the nonce was inserted, false if it was already present. -func (s *InstanceState) InsertUsedNonce(nonce uint32) bool { - return s.usedNonce.SetIfAbsent(nonce, struct{}{}, NonceTTL) -} - -func (s *InstanceState) Close() { - close(s.stop) -} diff --git a/vendor/github.com/sjtug/cerberus/devenv.lock b/vendor/github.com/sjtug/cerberus/devenv.lock deleted file mode 100644 index 3ef5ac0..0000000 --- a/vendor/github.com/sjtug/cerberus/devenv.lock +++ /dev/null @@ -1,103 +0,0 @@ -{ - "nodes": { - "devenv": { - "locked": { - "dir": "src/modules", - "lastModified": 1747717470, - "owner": "cachix", - "repo": "devenv", - "rev": "c7f2256ee4a4a4ee9cbf1e82a6e49b253c374995", - "type": "github" - }, - "original": { - "dir": "src/modules", - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1747046372, - "owner": "edolstra", - "repo": "flake-compat", - "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "git-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1747372754, - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "git-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1747885982, - "owner": "nixos", - "repo": "nixpkgs", - "rev": "a16efe5d2fc7455d7328a01f4692bfec152965b3", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "devenv": "devenv", - "git-hooks": "git-hooks", - "nixpkgs": "nixpkgs", - "pre-commit-hooks": [ - "git-hooks" - ] - } - } - }, - "root": "root", - "version": 7 -} diff --git a/vendor/github.com/sjtug/cerberus/devenv.nix b/vendor/github.com/sjtug/cerberus/devenv.nix deleted file mode 100644 index bfab98e..0000000 --- a/vendor/github.com/sjtug/cerberus/devenv.nix +++ /dev/null @@ -1,98 +0,0 @@ -{ pkgs, ... }: - -{ - # https://devenv.sh/packages/ - packages = with pkgs; [ - git - xcaddy - templ - esbuild - golangci-lint - tailwindcss_4 - pngquant - wasm-pack - ]; - - # https://devenv.sh/languages/ - languages.go = { - enable = true; - enableHardeningWorkaround = true; - }; - - tasks = - let - tailwindcss = "${pkgs.tailwindcss_4}/bin/tailwindcss"; - find = "${pkgs.findutils}/bin/find"; - xargs = "${pkgs.findutils}/bin/xargs"; - pngquant = "${pkgs.pngquant}/bin/pngquant"; - templ = "${pkgs.templ}/bin/templ"; - wasm-pack = "${pkgs.wasm-pack}/bin/wasm-pack"; - pnpm = "${pkgs.nodePackages.pnpm}/bin/pnpm"; - pnpx = "${pkgs.nodePackages.pnpm}/bin/pnpx"; - golangci-lint = "${pkgs.golangci-lint}/bin/golangci-lint"; - node = "${pkgs.nodejs}/bin/node"; - in - { - "css:build".exec = "${tailwindcss} -i ./web/global.css -o ./web/dist/global.css --minify"; - "wasm:build".exec = '' - ${wasm-pack} build --target web ./pow --no-default-features - ''; - "js:install" = { - exec = '' - cd web/js - ${pnpm} install - ''; - after = [ "wasm:build" ]; - }; - "js:bundle" = { - exec = '' - cd web/js - ${pnpx} parcel build --dist-dir ../dist/ - ''; - after = [ - "js:install" - "js:icu" - ]; - }; - "img:dist".exec = '' - mkdir -p ./web/dist/img - ${find} ./web/img -maxdepth 1 -name "*.png" -printf "%f\n" | ${xargs} -n 1 sh -c '${pngquant} --force --strip --quality 0-20 --speed 1 ./web/img/$0 -o ./web/dist/img/$0' - ''; - "go:codegen".exec = "${templ} generate"; - "js:icu" = { - exec = '' - cd web/js - mkdir -p icu - ${node} convert.js ../../translations icu/compiled.mjs - ''; - after = [ "js:install" ]; - }; - "dist:clean".exec = "rm -rf ./web/dist"; - "dist:build".after = [ - "css:build" - "js:bundle" - "img:dist" - "go:codegen" - ]; - "go:lint" = { - exec = "${golangci-lint} run"; - after = [ "go:codegen" ]; - }; - }; - - # tasks = { - # "myproj:setup".exec = "mytool build"; - # "devenv:enterShell".after = [ "myproj:setup" ]; - # }; - - # https://devenv.sh/tests/ - enterTest = '' - echo "Running tests" - go test ./... - ''; - - # https://devenv.sh/git-hooks/ - # git-hooks.hooks.shellcheck.enable = true; - - # See full reference at https://devenv.sh/reference/options/ -} diff --git a/vendor/github.com/sjtug/cerberus/devenv.yaml b/vendor/github.com/sjtug/cerberus/devenv.yaml deleted file mode 100644 index ec3f91a..0000000 --- a/vendor/github.com/sjtug/cerberus/devenv.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json -inputs: - nixpkgs: - url: github:nixos/nixpkgs/nixpkgs-unstable - -# If you're using non-OSS software, you can set allowUnfree to true. -# allowUnfree: true - -# If you're willing to use a package that's vulnerable -# permittedInsecurePackages: -# - "openssl-1.1.1w" - -# If you have more than one devenv you can merge them -#imports: -# - ./backend diff --git a/vendor/github.com/sjtug/cerberus/directives/app.go b/vendor/github.com/sjtug/cerberus/directives/app.go deleted file mode 100644 index 9b72632..0000000 --- a/vendor/github.com/sjtug/cerberus/directives/app.go +++ /dev/null @@ -1,60 +0,0 @@ -package directives - -import ( - "github.com/caddyserver/caddy/v2" - "github.com/sjtug/cerberus/core" -) - -// App is the global configuration for cerberus. -// There can only be one cerberus app in the entire Caddy runtime. -type App struct { - core.Config - instance *core.Instance -} - -func (c *App) GetInstance() *core.Instance { - return c.instance -} - -func (c *App) Provision(context caddy.Context) error { - err := c.Config.Provision(context.Logger()) - if err != nil { - return err - } - - context.Logger().Debug("cerberus instance provision") - - instance, err := core.GetInstance(c.Config, context.Logger()) - if err != nil { - return err - } - - c.instance = instance - - return nil -} - -func (c *App) Validate() error { - return c.Config.Validate() -} - -func (c *App) Start() error { - return nil -} - -func (c *App) Stop() error { - return nil -} - -func (App) CaddyModule() caddy.ModuleInfo { - return caddy.ModuleInfo{ - ID: "cerberus", - New: func() caddy.Module { return new(App) }, - } -} - -var ( - _ caddy.App = (*App)(nil) - _ caddy.Provisioner = (*App)(nil) - _ caddy.Validator = (*App)(nil) -) diff --git a/vendor/github.com/sjtug/cerberus/directives/caddyfile.go b/vendor/github.com/sjtug/cerberus/directives/caddyfile.go deleted file mode 100644 index af0ef64..0000000 --- a/vendor/github.com/sjtug/cerberus/directives/caddyfile.go +++ /dev/null @@ -1,237 +0,0 @@ -package directives - -import ( - "time" - - "github.com/caddyserver/caddy/v2/caddyconfig" - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" - "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile" - "github.com/caddyserver/caddy/v2/modules/caddyhttp" - "github.com/dustin/go-humanize" - "github.com/sjtug/cerberus/core" - "github.com/sjtug/cerberus/internal/ipblock" -) - -func (c *App) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { - d.Next() // consume the directive - - for nesting := d.Nesting(); d.NextBlock(nesting); { - switch d.Val() { - case "difficulty": - if !d.NextArg() { - return d.ArgErr() - } - difficulty, ok := d.ScalarVal().(int) - if !ok { - return d.Errf("difficulty must be an integer") - } - c.Difficulty = difficulty - case "drop": - if !d.NextArg() { - c.Drop = true - continue - } - drop, ok := d.ScalarVal().(bool) - if !ok { - return d.Errf("drop must be a boolean") - } - c.Drop = drop - case "ed25519_key_file": - if !d.NextArg() { - return d.ArgErr() - } - ed25519KeyFile, ok := d.ScalarVal().(string) - if !ok { - return d.Errf("ed25519_key_file must be a string") - } - c.Ed25519KeyFile = ed25519KeyFile - case "max_pending": - if !d.NextArg() { - return d.ArgErr() - } - maxPending, ok := d.ScalarVal().(int) - if !ok { - return d.Errf("max_pending must be an integer") - } - c.MaxPending = int32(maxPending) // #nosec G115 -- trusted input - case "access_per_approval": - if !d.NextArg() { - return d.ArgErr() - } - accessPerApproval, ok := d.ScalarVal().(int) - if !ok { - return d.Errf("access_per_approval must be an integer") - } - c.AccessPerApproval = int32(accessPerApproval) // #nosec G115 -- trusted input - case "block_ttl": - if !d.NextArg() { - return d.ArgErr() - } - blockTTLRaw, ok := d.ScalarVal().(string) - if !ok { - return d.Errf("block_ttl must be a string") - } - blockTTL, err := time.ParseDuration(blockTTLRaw) - if err != nil { - return d.Errf("block_ttl must be a valid duration: %v", err) - } - c.BlockTTL = blockTTL - case "pending_ttl": - if !d.NextArg() { - return d.ArgErr() - } - pendingTTLRaw, ok := d.ScalarVal().(string) - if !ok { - return d.Errf("pending_ttl must be a string") - } - pendingTTL, err := time.ParseDuration(pendingTTLRaw) - if err != nil { - return d.Errf("pending_ttl must be a valid duration: %v", err) - } - c.PendingTTL = pendingTTL - case "approval_ttl": - if !d.NextArg() { - return d.ArgErr() - } - approvalTTLRaw, ok := d.ScalarVal().(string) - if !ok { - return d.Errf("approval_ttl must be a string") - } - approvalTTL, err := time.ParseDuration(approvalTTLRaw) - if err != nil { - return d.Errf("approval_ttl must be a valid duration: %v", err) - } - c.ApprovalTTL = approvalTTL - case "max_mem_usage": - if !d.NextArg() { - return d.ArgErr() - } - maxMemUsageRaw, ok := d.ScalarVal().(string) - if !ok { - return d.Errf("max_mem_usage must be a string") - } - maxMemUsage, err := humanize.ParseBytes(maxMemUsageRaw) - if err != nil { - return d.Errf("max_mem_usage must be a valid size: %v", err) - } - c.MaxMemUsage = int64(maxMemUsage) // #nosec G115 -- trusted input - case "cookie_name": - if !d.NextArg() { - return d.ArgErr() - } - cookieName, ok := d.ScalarVal().(string) - if !ok { - return d.Errf("cookie_name must be a string") - } - c.CookieName = cookieName - case "header_name": - if !d.NextArg() { - return d.ArgErr() - } - headerName, ok := d.ScalarVal().(string) - if !ok { - return d.Errf("header_name must be a string") - } - c.HeaderName = headerName - case "title": - if !d.NextArg() { - return d.ArgErr() - } - title, ok := d.ScalarVal().(string) - if !ok { - return d.Errf("title must be a string") - } - c.Title = title - case "prefix_cfg": - if !d.NextArg() { - return d.ArgErr() - } - v4Prefix, ok := d.ScalarVal().(int) - if !ok { - return d.Errf("prefix_cfg must be followed by two integers") - } - if !d.NextArg() { - return d.ArgErr() - } - v6Prefix, ok := d.ScalarVal().(int) - if !ok { - return d.Errf("prefix_cfg must be followed by two integers") - } - c.PrefixCfg = ipblock.Config{ - V4Prefix: v4Prefix, - V6Prefix: v6Prefix, - } - case "mail": - if !d.NextArg() { - return d.ArgErr() - } - mail, ok := d.ScalarVal().(string) - if !ok { - return d.Errf("mail must be a string") - } - c.Mail = mail - default: - return d.Errf("unknown subdirective '%s'", d.Val()) - } - } - - return nil -} - -func ParseCaddyFileApp(d *caddyfile.Dispenser, _ any) (any, error) { - var c App - err := c.UnmarshalCaddyfile(d) - return httpcaddyfile.App{ - Name: core.AppName, - Value: caddyconfig.JSON(c, nil), - }, err -} - -func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { - d.Next() // consume the directive - - for nesting := d.Nesting(); d.NextBlock(nesting); { - switch d.Val() { - case "base_url": - if !d.NextArg() { - return d.ArgErr() - } - baseURL, ok := d.ScalarVal().(string) - if !ok { - return d.Errf("base_url must be a string") - } - m.BaseURL = baseURL - case "block_only": - if !d.NextArg() { - m.BlockOnly = true - continue - } - blockOnly, ok := d.ScalarVal().(bool) - if !ok { - return d.Errf("block_only must be a boolean") - } - m.BlockOnly = blockOnly - default: - return d.Errf("unknown subdirective '%s'", d.Val()) - } - } - return nil -} - -func ParseCaddyFileMiddleware(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) { - var m Middleware - err := m.UnmarshalCaddyfile(h.Dispenser) - return &m, err -} - -func (e *Endpoint) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { - d.Next() // consume the directive - - return nil -} - -func ParseCaddyFileEndpoint(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) { - var e Endpoint - err := e.UnmarshalCaddyfile(h.Dispenser) - return &e, err -} diff --git a/vendor/github.com/sjtug/cerberus/directives/common.go b/vendor/github.com/sjtug/cerberus/directives/common.go deleted file mode 100644 index 117fc73..0000000 --- a/vendor/github.com/sjtug/cerberus/directives/common.go +++ /dev/null @@ -1,176 +0,0 @@ -package directives - -import ( - "context" - "crypto/ed25519" - "encoding/hex" - "errors" - "fmt" - "net/http" - "time" - - "github.com/a-h/templ" - "github.com/caddyserver/caddy/v2/modules/caddyhttp" - "github.com/golang-jwt/jwt/v5" - "github.com/google/uuid" - "github.com/invopop/ctxi18n" - "github.com/invopop/ctxi18n/i18n" - "github.com/sjtug/cerberus/core" - "github.com/sjtug/cerberus/web" - "github.com/zeebo/blake3" -) - -const ( - IV1 = "/L4y6KgWa8vHEujU3O6JyI8osQxwh1nE0Eoay4nD3vw/y36eSFT0s/GTGfrngN6+" - IV2 = "KHo5hHR3ZfisR7xeG1gJwO3LSc1cYyDUQ5+StoAjV8jLhp01NBNi4joHYTWXDqF0" -) - -func clearCookie(w http.ResponseWriter, cookieName string) { - http.SetCookie(w, &http.Cookie{ - Name: cookieName, - Value: "", - Expires: time.Now().Add(-time.Hour), - MaxAge: -1, - SameSite: http.SameSiteLaxMode, - }) -} - -func validateCookie(cookie *http.Cookie) error { - if err := cookie.Valid(); err != nil { - return err - } - - if time.Now().After(cookie.Expires) && !cookie.Expires.IsZero() { - return errors.New("cookie expired") - } - - return nil -} - -func validateToken(token *jwt.Token) error { - if token == nil { - return fmt.Errorf("token is nil") - } - - if !token.Valid { - return fmt.Errorf("token is not valid") - } - - claims := token.Claims.(jwt.MapClaims) - - exp, ok := claims["exp"].(float64) - if !ok { - return fmt.Errorf("token does not contain exp claim") - } - - if exp := time.Unix(int64(exp), 0); exp.Before(time.Now()) { - return fmt.Errorf("token expired at %s", exp) - } - - return nil -} - -func blake3sum(text string) (string, error) { - hash := blake3.New() - _, err := hash.WriteString(text) - if err != nil { - return "", err - } - return hex.EncodeToString(hash.Sum(nil)), nil -} - -func challengeFor(r *http.Request, c *core.Instance) (string, error) { - fp := c.GetFingerprint() - - payload := fmt.Sprintf("Accept-Language=%s,X-Real-IP=%s,User-Agent=%s,Fingerprint=%s,Difficulty=%d,IV=%s", - r.Header.Get("Accept-Language"), - getClientIP(r), - r.Header.Get("User-Agent"), - fp, - c.Difficulty, - IV1, - ) - - return blake3sum(payload) -} - -func calcSignature(challenge string, nonce uint32, ts int64, c *core.Instance) string { - payload := fmt.Sprintf("Challenge=%s,Nonce=%d,TS=%d,IV=%s", challenge, nonce, ts, IV2) - - signature := ed25519.Sign(c.GetPrivateKey(), []byte(payload)) - return hex.EncodeToString(signature) -} - -func respondFailure(w http.ResponseWriter, r *http.Request, c *core.Config, msg string, blocked bool, status int, baseURL string) error { - // Do not cache failure responses. - w.Header().Set("Cache-Control", "no-cache") - - if blocked { - if c.Drop { - // Drop the connection - panic(http.ErrAbortHandler) - } - w.Header().Set(c.HeaderName, "BLOCKED") - // Close the connection to the client - r.Close = true - w.Header().Set("Connection", "close") - return renderTemplate(w, r, c, baseURL, - i18n.T(r.Context(), "error.access_restricted"), - web.Error( - i18n.T(r.Context(), "error.ip_blocked"), - i18n.T(r.Context(), "error.wait_before_retry"), - c.Mail, - ), - templ.WithStatus(status), - ) - } - - w.Header().Set(c.HeaderName, "FAIL") - return renderTemplate(w, r, c, baseURL, - i18n.T(r.Context(), "error.error_occurred"), - web.Error( - msg, - i18n.T(r.Context(), "error.browser_config_or_bug"), - c.Mail, - ), - templ.WithStatus(status), - ) -} - -func setupLocale(r *http.Request) (*http.Request, error) { - locale := r.Header.Get("Accept-Language") - if locale == "" { - locale = "en" - } - - ctx, err := ctxi18n.WithLocale(r.Context(), locale) - if err != nil { - return nil, err - } - - ctx = context.WithValue(ctx, web.LocaleCtxKey, locale) - - return r.WithContext(ctx), nil -} - -func setupRequestID(r *http.Request) *http.Request { - id := uuid.New().String() - caddyhttp.SetVar(r.Context(), core.VarReqID, id) - return r -} - -func renderTemplate(w http.ResponseWriter, r *http.Request, c *core.Config, baseURL string, header string, child templ.Component, opts ...func(*templ.ComponentHandler)) error { - ctx := templ.WithChildren( - context.WithValue( - context.WithValue(r.Context(), web.BaseURLCtxKey, baseURL), - web.VersionCtxKey, - core.Version, - ), - child, - ) - templ.Handler( - web.Base(c.Title, header), - opts..., - ).ServeHTTP(w, r.WithContext(ctx)) - return nil -} diff --git a/vendor/github.com/sjtug/cerberus/directives/endpoint.go b/vendor/github.com/sjtug/cerberus/directives/endpoint.go deleted file mode 100644 index 0fec02f..0000000 --- a/vendor/github.com/sjtug/cerberus/directives/endpoint.go +++ /dev/null @@ -1,238 +0,0 @@ -package directives - -import ( - "crypto/subtle" - "errors" - "fmt" - "net/http" - "strconv" - "strings" - "time" - - "github.com/caddyserver/caddy/v2" - "github.com/caddyserver/caddy/v2/modules/caddyhttp" - "github.com/golang-jwt/jwt/v5" - "github.com/sjtug/cerberus/core" - "github.com/sjtug/cerberus/internal/ipblock" - "github.com/sjtug/cerberus/web" - "go.uber.org/zap" -) - -// Endpoint is the handler that will be used to serve challenge endpoints and static files. -type Endpoint struct { - instance *core.Instance - logger *zap.Logger -} - -func checkAnswer(s string, difficulty int) bool { - nibbles := difficulty / 2 - remaining := difficulty % 2 - - if !strings.HasPrefix(s, strings.Repeat("0", nibbles)) { - return false - } - - if remaining == 0 { - return true - } - - return s[nibbles] < '8' -} - -func (e *Endpoint) answerHandle(w http.ResponseWriter, r *http.Request) error { - c := e.instance - - // Just to make sure the response is not cached, although this should be the default behavior for POST requests. - w.Header().Set("Cache-Control", "no-cache") - - nonceStr := r.FormValue("nonce") - if nonceStr == "" { - e.logger.Info("nonce is empty") - return respondFailure(w, r, &c.Config, "nonce is empty", false, http.StatusBadRequest, ".") - } - nonce64, err := strconv.ParseUint(nonceStr, 10, 32) - if err != nil { - e.logger.Debug("nonce is not an integer", zap.Error(err)) - return respondFailure(w, r, &c.Config, "nonce is not an integer", false, http.StatusBadRequest, ".") - } - nonce := uint32(nonce64) - if !c.InsertUsedNonce(nonce) { - e.logger.Info("nonce already used") - return respondFailure(w, r, &c.Config, "nonce already used", false, http.StatusBadRequest, ".") - } - - tsStr := r.FormValue("ts") - if tsStr == "" { - e.logger.Info("ts is empty") - return respondFailure(w, r, &c.Config, "ts is empty", false, http.StatusBadRequest, ".") - } - ts, err := strconv.ParseInt(tsStr, 10, 64) - if err != nil { - e.logger.Debug("ts is not a integer", zap.Error(err)) - return respondFailure(w, r, &c.Config, "ts is not a integer", false, http.StatusBadRequest, ".") - } - now := time.Now().Unix() - if ts < now-int64(core.NonceTTL) || ts > now { - e.logger.Info("invalid ts", zap.Int64("ts", ts), zap.Int64("now", now)) - return respondFailure(w, r, &c.Config, "invalid ts", false, http.StatusBadRequest, ".") - } - - signature := r.FormValue("signature") - if signature == "" { - e.logger.Info("signature is empty") - return respondFailure(w, r, &c.Config, "signature is empty", false, http.StatusBadRequest, ".") - } - - solutionStr := r.FormValue("solution") - if solutionStr == "" { - e.logger.Info("solution is empty") - return respondFailure(w, r, &c.Config, "solution is empty", false, http.StatusBadRequest, ".") - } - solution, err := strconv.Atoi(solutionStr) - if err != nil { - e.logger.Debug("solution is not a integer", zap.Error(err)) - return respondFailure(w, r, &c.Config, "solution is not a integer", false, http.StatusBadRequest, ".") - } - - response := r.FormValue("response") - redir := r.FormValue("redir") - - challenge, err := challengeFor(r, c) - if err != nil { - e.logger.Error("failed to calculate challenge", zap.Error(err)) - return err - } - - expectedSignature := calcSignature(challenge, nonce, ts, c) - if signature != expectedSignature { - e.logger.Debug("signature mismatch", zap.String("expected", expectedSignature), zap.String("actual", signature)) - return respondFailure(w, r, &c.Config, "signature mismatch", false, http.StatusForbidden, ".") - } - - answer, err := blake3sum(fmt.Sprintf("%s|%d|%d|%s|%d", challenge, nonce, ts, signature, solution)) - if err != nil { - e.logger.Error("failed to calculate answer", zap.Error(err)) - return err - } - - if !checkAnswer(response, c.Difficulty) { - clearCookie(w, c.CookieName) - e.logger.Error("wrong response", zap.String("response", response), zap.Int("difficulty", c.Difficulty)) - return respondFailure(w, r, &c.Config, "wrong response", false, http.StatusForbidden, ".") - } - - if subtle.ConstantTimeCompare([]byte(answer), []byte(response)) != 1 { - clearCookie(w, c.CookieName) - e.logger.Error("response mismatch", zap.String("expected", answer), zap.String("actual", response)) - return respondFailure(w, r, &c.Config, "response mismatch", false, http.StatusForbidden, ".") - } - - // Now we know the user passed the challenge, we issue an approval and sign the result. - approvalID := c.IssueApproval(c.AccessPerApproval) - token := jwt.NewWithClaims(jwt.SigningMethodEdDSA, jwt.MapClaims{ - "challenge": challenge, - "response": response, - "approval_id": approvalID, - "iat": time.Now().Unix(), - "nbf": time.Now().Add(-time.Minute).Unix(), - "exp": time.Now().Add(c.ApprovalTTL).Unix(), - }) - tokenStr, err := token.SignedString(c.GetPrivateKey()) - if err != nil { - e.logger.Error("failed to sign token", zap.Error(err)) - return err - } - - http.SetCookie(w, &http.Cookie{ - Name: c.CookieName, - Value: tokenStr, - Expires: time.Now().Add(c.ApprovalTTL), - SameSite: http.SameSiteLaxMode, - Path: "/", - }) - - e.logger.Debug("user passed the challenge") - - ipBlockRaw := caddyhttp.GetVar(r.Context(), core.VarIPBlock) - if ipBlockRaw != nil { - ipBlock := ipBlockRaw.(ipblock.IPBlock) - c.DecPending(ipBlock) - } - - w.Header().Set(c.HeaderName, "PASS") - http.Redirect(w, r, redir, http.StatusSeeOther) - return nil -} - -// tryServeFile serves static files from the dist directory. -func tryServeFile(w http.ResponseWriter, r *http.Request) bool { - if !strings.HasPrefix(r.URL.Path, "/static/") { - return false - } - - // Remove the /static/ prefix to get the actual file path - filePath := strings.TrimSuffix(caddyhttp.SanitizedPathJoin("/dist/", strings.TrimPrefix(r.URL.Path, "/static/")), "/") - - // Add cache control headers for static assets - w.Header().Set("Cache-Control", "public, max-age=31536000, immutable") // Cache for 1 year - w.Header().Set("Vary", "Accept-Encoding") - - // Create a new request with the modified path - req := *r - req.URL.Path = filePath - - // Serve the file using http.FileServer - http.FileServer(http.FS(web.Content)).ServeHTTP(w, &req) - return true -} - -func (e *Endpoint) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error { - r = setupRequestID(r) - r, err := setupLocale(r) - if err != nil { - return err - } - - if tryServeFile(w, r) { - return nil - } - - c := e.instance - - path := strings.TrimSuffix(r.URL.Path, "/") - if path == "/answer" && r.Method == http.MethodPost { - return e.answerHandle(w, r) - } - - return respondFailure(w, r, &c.Config, "Not found", false, http.StatusNotFound, ".") -} - -func (e *Endpoint) Provision(ctx caddy.Context) error { - e.logger = ctx.Logger() - - appRaw, err := ctx.App("cerberus") - if err != nil { - return err - } - app := appRaw.(*App) - - instance := app.GetInstance() - if instance == nil { - return errors.New("no global cerberus app found") - } - e.instance = instance - - return nil -} - -func (Endpoint) CaddyModule() caddy.ModuleInfo { - return caddy.ModuleInfo{ - ID: "http.handlers.cerberus_endpoint", - New: func() caddy.Module { return new(Endpoint) }, - } -} - -var ( - _ caddy.Provisioner = (*Endpoint)(nil) - _ caddyhttp.MiddlewareHandler = (*Endpoint)(nil) -) diff --git a/vendor/github.com/sjtug/cerberus/directives/i18n.go b/vendor/github.com/sjtug/cerberus/directives/i18n.go deleted file mode 100644 index f2c18ba..0000000 --- a/vendor/github.com/sjtug/cerberus/directives/i18n.go +++ /dev/null @@ -1,13 +0,0 @@ -package directives - -import ( - "io/fs" - - "github.com/invopop/ctxi18n" -) - -func LoadI18n(fs fs.FS) { - if err := ctxi18n.LoadWithDefault(fs, "en"); err != nil { - panic(err) - } -} diff --git a/vendor/github.com/sjtug/cerberus/directives/middleware.go b/vendor/github.com/sjtug/cerberus/directives/middleware.go deleted file mode 100644 index 0fa58e4..0000000 --- a/vendor/github.com/sjtug/cerberus/directives/middleware.go +++ /dev/null @@ -1,211 +0,0 @@ -package directives - -import ( - "errors" - "fmt" - "net" - "net/http" - "time" - - "github.com/caddyserver/caddy/v2" - "github.com/caddyserver/caddy/v2/modules/caddyhttp" - "github.com/golang-jwt/jwt/v5" - "github.com/google/uuid" - "github.com/invopop/ctxi18n/i18n" - "github.com/sjtug/cerberus/core" - "github.com/sjtug/cerberus/internal/ipblock" - "github.com/sjtug/cerberus/internal/randpool" - "github.com/sjtug/cerberus/web" - "go.uber.org/zap" -) - -// Middleware is the actual middleware that will be used to challenge requests. -type Middleware struct { - // The base URL for the challenge. It must be the same as the deployed endpoint route. - BaseURL string `json:"base_url,omitempty"` - // If true, the middleware will not perform any challenge. It will only block known bad IPs. - BlockOnly bool `json:"block_only,omitempty"` - - instance *core.Instance - logger *zap.Logger -} - -func getClientIP(r *http.Request) string { - address := caddyhttp.GetVar(r.Context(), caddyhttp.ClientIPVarKey).(string) - clientIP, _, err := net.SplitHostPort(address) - if err != nil { - clientIP = address // no port - } - - return clientIP -} - -func (m *Middleware) invokeAuth(w http.ResponseWriter, r *http.Request) error { - c := m.instance - - // Make sure the response is not cached so that users always see the latest challenge. - w.Header().Set("Cache-Control", "no-cache") - - ipBlockRaw := caddyhttp.GetVar(r.Context(), core.VarIPBlock) - if ipBlockRaw != nil { - ipBlock := ipBlockRaw.(ipblock.IPBlock) - - count := c.IncPending(ipBlock) - if count > c.MaxPending { - m.logger.Info( - "Max failed/active challenges reached for IP block, rejecting", - zap.String("ip", ipBlock.ToIPNet(c.PrefixCfg).String()), - ) - c.InsertBlocklist(ipBlock) - c.RemovePending(ipBlock) - - return respondFailure(w, r, &c.Config, "IP blocked", true, http.StatusForbidden, m.BaseURL) - } - } - - clearCookie(w, c.CookieName) - - challenge, err := challengeFor(r, c) - if err != nil { - m.logger.Error("failed to calculate challenge", zap.Error(err)) - return err - } - - nonce := randpool.ReadUint32() - ts := time.Now().Unix() - signature := calcSignature(challenge, nonce, ts, c) - - w.Header().Set(c.HeaderName, "CHALLENGE") - return renderTemplate(w, r, &c.Config, m.BaseURL, i18n.T(r.Context(), "challenge.title"), web.Challenge(challenge, c.Difficulty, nonce, ts, signature)) -} - -func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error { - r = setupRequestID(r) - r, err := setupLocale(r) - if err != nil { - return err - } - - c := m.instance - - if ipBlock, err := ipblock.NewIPBlock(net.ParseIP(getClientIP(r)), c.PrefixCfg); err == nil { - caddyhttp.SetVar(r.Context(), core.VarIPBlock, ipBlock) - if c.ContainsBlocklist(ipBlock) { - m.logger.Debug("IP is blocked", zap.String("ip", ipBlock.ToIPNet(c.PrefixCfg).String())) - return respondFailure(w, r, &c.Config, "", true, http.StatusForbidden, m.BaseURL) - } - } - - if m.BlockOnly { - // If block only mode is enabled, we don't need to perform any challenge. - // Continue to the next handler. - w.Header().Set(c.HeaderName, "DISABLED") - return next.ServeHTTP(w, r) - } - - // Get the "cerberus-auth" cookie - cookie, err := r.Cookie(c.CookieName) - if err != nil { - m.logger.Debug("cookie not found", zap.Error(err)) - return m.invokeAuth(w, r) - } - - if err := validateCookie(cookie); err != nil { - m.logger.Debug("invalid cookie", zap.Error(err)) - return m.invokeAuth(w, r) - } - - token, err := jwt.ParseWithClaims(cookie.Value, jwt.MapClaims{}, func(_ *jwt.Token) (interface{}, error) { - return c.GetPublicKey(), nil - }, jwt.WithValidMethods([]string{jwt.SigningMethodEdDSA.Alg()})) - if err != nil { - m.logger.Debug("invalid token", zap.Error(err)) - } - - if err := validateToken(token); err != nil { - m.logger.Debug("invalid token", zap.Error(err)) - return m.invokeAuth(w, r) - } - - // Metadata structure correct. Now we need to check the approval. - claims := token.Claims.(jwt.MapClaims) - - // First we check approval state. - approvalIDRaw, ok := claims["approval_id"].(string) - if !ok { - m.logger.Debug("token does not contain valid approval_id claim") - return m.invokeAuth(w, r) - } - - approvalID, err := uuid.Parse(approvalIDRaw) - if err != nil { - m.logger.Debug("invalid approval_id", zap.String("approval_id", approvalIDRaw), zap.Error(err)) - return m.invokeAuth(w, r) - } - - approved := c.DecApproval(approvalID) - if !approved { - m.logger.Debug("approval not found", zap.String("approval_id", approvalIDRaw)) - return m.invokeAuth(w, r) - } - - // Then we check user fingerprint matches the challenge to prevent cookie reuse. - challenge, ok := claims["challenge"].(string) - if !ok { - m.logger.Debug("token does not contain valid challenge claim") - return m.invokeAuth(w, r) - } - - expected, err := challengeFor(r, c) - if err != nil { - m.logger.Error("failed to calculate challenge", zap.Error(err)) - return err - } - - if challenge != expected { - m.logger.Debug("challenge mismatch", zap.String("expected", expected), zap.String("actual", challenge)) - return m.invokeAuth(w, r) - } - - // OK: Continue to the next handler - w.Header().Set(c.HeaderName, "PASS") - return next.ServeHTTP(w, r) -} - -func (m *Middleware) Provision(ctx caddy.Context) error { - m.logger = ctx.Logger() - - appRaw, err := ctx.App("cerberus") - if err != nil { - return err - } - app := appRaw.(*App) - - instance := app.GetInstance() - if instance == nil { - return errors.New("no global cerberus app found") - } - m.instance = instance - - return nil -} - -func (m *Middleware) Validate() error { - if m.BaseURL == "" { - return fmt.Errorf("base_url is required") - } - return nil -} - -func (Middleware) CaddyModule() caddy.ModuleInfo { - return caddy.ModuleInfo{ - ID: "http.handlers.cerberus", - New: func() caddy.Module { return new(Middleware) }, - } -} - -var ( - _ caddy.Provisioner = (*Middleware)(nil) - _ caddy.Validator = (*Middleware)(nil) - _ caddyhttp.MiddlewareHandler = (*Middleware)(nil) -) diff --git a/vendor/github.com/sjtug/cerberus/internal/expiremap/expiremap.go b/vendor/github.com/sjtug/cerberus/internal/expiremap/expiremap.go deleted file mode 100644 index 9a53715..0000000 --- a/vendor/github.com/sjtug/cerberus/internal/expiremap/expiremap.go +++ /dev/null @@ -1,92 +0,0 @@ -package expiremap - -import ( - "runtime" - "sync" - "time" -) - -var ( - numShards = runtime.GOMAXPROCS(0) * 16 -) - -type entry[V any] struct { - value V - expire time.Time -} - -type shard[K comparable, V any] struct { - mu sync.Mutex - store map[K]entry[V] -} - -type ExpireMap[K comparable, V any] struct { - shards []*shard[K, V] - hash func(K) uint32 -} - -// fastModulo calculates x % n without using the modulo operator (~4x faster). -// Reference: https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ -func fastModulo(x, n uint32) uint32 { - return uint32((uint64(x) * uint64(n)) >> 32) //nolint:gosec -} - -func NewExpireMap[K comparable, V any](hash func(K) uint32) *ExpireMap[K, V] { - shards := make([]*shard[K, V], numShards) - for i := range shards { - shards[i] = &shard[K, V]{store: make(map[K]entry[V])} - } - return &ExpireMap[K, V]{shards: shards, hash: hash} -} - -func (m *ExpireMap[K, V]) Get(key K) (*V, bool) { - shard := m.shards[fastModulo(m.hash(key), uint32(len(m.shards)))] // #nosec G115 we don't have so many cores - - shard.mu.Lock() - defer shard.mu.Unlock() - - value, ok := shard.store[key] - if !ok { - // Key not found - return nil, false - } - - if value.expire.Before(time.Now()) { - // Key expired, remove it - delete(shard.store, key) - return nil, false - } - - return &value.value, true -} - -// SetIfAbsent sets the value for the key if it is not already present. -// Returns true if the value was set, false if it was already present. -func (m *ExpireMap[K, V]) SetIfAbsent(key K, value V, ttl time.Duration) bool { - shard := m.shards[fastModulo(m.hash(key), uint32(len(m.shards)))] // #nosec G115 we don't have so many cores - - shard.mu.Lock() - defer shard.mu.Unlock() - - if _, ok := shard.store[key]; ok { - return false - } - - shard.store[key] = entry[V]{value: value, expire: time.Now().Add(ttl)} - return true -} - -func (m *ExpireMap[K, V]) PurgeExpired() { - now := time.Now() - - for _, shard := range m.shards { - shard.mu.Lock() - defer shard.mu.Unlock() - - for key, entry := range shard.store { - if entry.expire.Before(now) { - delete(shard.store, key) - } - } - } -} diff --git a/vendor/github.com/sjtug/cerberus/internal/ipblock/ipblock.go b/vendor/github.com/sjtug/cerberus/internal/ipblock/ipblock.go deleted file mode 100644 index 6abd469..0000000 --- a/vendor/github.com/sjtug/cerberus/internal/ipblock/ipblock.go +++ /dev/null @@ -1,86 +0,0 @@ -package ipblock - -import ( - "errors" - "fmt" - "net" -) - -// IPBlock represents either an IPv4 or IPv6 block -// Data representation: -// v6: Stored as first 8 bytes of the address -// v4: Stored as 2001:db8:<v4> -type IPBlock struct { - data uint64 -} - -// IPBlockConfig represents the configuration for an IPBlock. -// It's used to specify the prefix length for IPv4 and IPv6 blocks for IP blocking. -type Config struct { - // V4Prefix is the prefix length for IPv4 blocks - V4Prefix int `json:"v4_prefix"` - // V6Prefix is the prefix length for IPv6 blocks - V6Prefix int `json:"v6_prefix"` -} - -func (c Config) IsEmpty() bool { - return c.V4Prefix == 0 && c.V6Prefix == 0 -} - -func ValidateConfig(cfg Config) error { - if cfg.V4Prefix > 32 || cfg.V4Prefix < 1 { - return fmt.Errorf("v4_prefix must be between 1 and 32, got %d", cfg.V4Prefix) - } else if cfg.V6Prefix > 64 || cfg.V6Prefix < 1 { - // Due to uint64 size limitation, we only allow at most /64 for IPv6 - return fmt.Errorf("v6_prefix must be between 1 and 64, got %d", cfg.V6Prefix) - } - return nil -} - -// NewIPBlock creates a new IPBlock from an IP address -func NewIPBlock(ip net.IP, cfg Config) (IPBlock, error) { - if ip == nil { - return IPBlock{}, errors.New("invalid IP: nil") - } - - ip4 := ip.To4() - if ip4 != nil { - ip4 = ip4.Mask(net.CIDRMask(cfg.V4Prefix, 32)) - return IPBlock{ - data: 0x20010db800000000 | uint64(ip4[0])<<24 | uint64(ip4[1])<<16 | uint64(ip4[2])<<8 | uint64(ip4[3]), - }, nil - } - - ip6 := ip.To16() - if ip6 == nil { - return IPBlock{}, fmt.Errorf("invalid IP: %v", ip) - } - ip6 = ip6.Mask(net.CIDRMask(cfg.V6Prefix, 128)) - data := uint64(0) - for i := range 8 { - data = data<<8 | uint64(ip6[i]) - } - return IPBlock{data: data}, nil -} - -func (b IPBlock) ToUint64() uint64 { - return b.data -} - -func (b IPBlock) ToIPNet(cfg Config) *net.IPNet { - if b.data&0xffffffff00000000 == 0x20010db800000000 { - return &net.IPNet{ - IP: net.IPv4(byte(b.data>>24&0xff), byte(b.data>>16&0xff), byte(b.data>>8&0xff), byte(b.data&0xff)), - Mask: net.CIDRMask(cfg.V4Prefix, 32), - } - } - - ip := make(net.IP, 16) - for i := range 8 { - ip[7-i] = byte(b.data >> (8 * i)) - } - return &net.IPNet{ - IP: ip, - Mask: net.CIDRMask(cfg.V6Prefix, 128), - } -} diff --git a/vendor/github.com/sjtug/cerberus/internal/randpool/randpool.go b/vendor/github.com/sjtug/cerberus/internal/randpool/randpool.go deleted file mode 100644 index ef772fd..0000000 --- a/vendor/github.com/sjtug/cerberus/internal/randpool/randpool.go +++ /dev/null @@ -1,35 +0,0 @@ -package randpool - -import ( - "crypto/rand" - "encoding/binary" - "io" - "sync" -) - -const ( - poolSize = 16 * 16 -) - -var ( - poolMu sync.Mutex - pool [poolSize]byte - poolPos = poolSize -) - -func ReadUint32() uint32 { - poolMu.Lock() - defer poolMu.Unlock() - - if poolPos == poolSize { - _, err := io.ReadFull(rand.Reader, pool[:]) - if err != nil { - panic(err) - } - poolPos = 0 - } - - poolPos += 4 - - return binary.BigEndian.Uint32(pool[poolPos-4 : poolPos]) -} diff --git a/vendor/github.com/sjtug/cerberus/translations/en.yaml b/vendor/github.com/sjtug/cerberus/translations/en.yaml deleted file mode 100644 index e7746be..0000000 --- a/vendor/github.com/sjtug/cerberus/translations/en.yaml +++ /dev/null @@ -1,29 +0,0 @@ -en: - challenge: - title: "Making sure you're not a bot!" - calculating: "Performing browser checks..." - difficulty_speed: "Difficulty: %{difficulty}, Speed: %{speed}kH/s" - taking_longer: "This is taking longer than expected. Please do not refresh the page." - why_seeing: "Why am I seeing this?" - why_seeing_body: - part_1: >- - You are seeing this because the administrator of this website has set up %{cerberus} to protect the server against abusive traffic. This can and does cause downtime for the websites, which makes their resources inaccessible for everyone. - part_2: >- - If you're familiar with %{anubis} by %{techaro}, Cerberus is similar - it performs a PoW challenge to verify the request. While Anubis focuses on protecting websites from AI scrapers, Cerberus takes a much more aggressive approach to protect our open-source infrastructure. - part_3: >- - Please note that Cerberus requires the use of modern JavaScript features that plugins like %{jshelter} will disable. Please disable %{jshelter} or other such plugins for this domain. - must_enable_js: "You must enable JavaScript to proceed." - success: - title: "Success!" - verification_complete: "Verification Complete!" - took_time_iterations: "Took %{time}ms, %{iterations} iterations" - error: - error_occurred: "Error occurred while processing your request" - access_restricted: "Access has been restricted" - browser_config_or_bug: "There might be an issue with your browser configuration, or something is wrong on our side." - ip_blocked: "You (or your local network) have been blocked due to suspicious activity." - wait_before_retry: "Please wait a while before you try again; in some cases this may take a few hours." - contact_us: "If you believe this is an error, please contact us at %{mail}. Attach the request ID shown below to help us investigate." - footer: - author: Protected by %{cerberus} from %{sjtug}. - upstream: Heavily inspired by %{anubis} from %{techaro} in 🇨🇦. diff --git a/vendor/github.com/sjtug/cerberus/translations/zh.yaml b/vendor/github.com/sjtug/cerberus/translations/zh.yaml deleted file mode 100644 index 49e4192..0000000 --- a/vendor/github.com/sjtug/cerberus/translations/zh.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# I know I should split this into zh-Hans and zh-Hant, but @messageformat/convert only supports CLDR plural categories -zh: - challenge: - title: "验证您不是机器人" - calculating: "正在进行浏览器检查..." - difficulty_speed: "难度:%{difficulty},速度:%{speed}kH/s" - taking_longer: "验证时间超出预期,请勿刷新页面" - why_seeing: "为什么我会看到这个页面?" - why_seeing_body: - part_1: >- - 您看到这个页面是因为网站管理员启用了 %{cerberus} 来防御异常流量攻击。这类攻击可能导致网站服务中断,影响所有用户的正常访问。 - part_2: >- - 如果您了解 %{techaro} 开发的 %{anubis},那么 Cerberus 采用了类似的 PoW 验证技术。不同的是,Anubis 主要针对 AI 爬虫,而 Cerberus 则采用了更激进的策略来保护我们的开源基础设施。 - part_3: >- - 请注意,Cerberus 需要启用现代 JavaScript 功能,而 %{jshelter} 等插件会禁用这些功能。请为本域名禁用 %{jshelter} 或类似的插件。 - must_enable_js: "请启用 JavaScript 以继续访问" - success: - title: "验证成功" - verification_complete: "验证已完成" - took_time_iterations: "用时 %{time}ms,完成 %{iterations} 次迭代" - error: - error_occurred: "发生错误" - access_restricted: "访问受限" - browser_config_or_bug: "可能是浏览器配置问题,也可能是我们的系统出现了异常" - ip_blocked: "由于检测到可疑活动,您的 IP 地址或本地网络已被封禁" - wait_before_retry: "请稍后再试,某些情况下可能需要等待数小时" - contact_us: "如有问题,请通过 %{mail} 联系我们。请附上下方显示的 request ID,以便我们进行排查。" - footer: - author: "由 %{sjtug} 开发的 %{cerberus} 提供保护" - upstream: "灵感来源于 🇨🇦 %{techaro} 开发的 %{anubis}" diff --git a/vendor/github.com/sjtug/cerberus/web/dist/global.css b/vendor/github.com/sjtug/cerberus/web/dist/global.css deleted file mode 100644 index e72f5f1..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/global.css +++ /dev/null @@ -1,2 +0,0 @@ -/*! tailwindcss v4.1.7 | 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-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-duration:initial;--tw-ease:initial}}}@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-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--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-white:#fff;--spacing:.25rem;--container-2xl:42rem;--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-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-bold:700;--ease-out:cubic-bezier(0,0,.2,1);--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]){-webkit-text-decoration:underline dotted;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}:-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{.mx-auto{margin-inline:auto}.my-auto{margin-block:auto}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-4{margin-top:calc(var(--spacing)*4)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.flex{display:flex}.hidden{display:none}.h-6{height:calc(var(--spacing)*6)}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-48{width:calc(var(--spacing)*48)}.w-\[60\%\]{width:60%}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-64{max-width:calc(var(--spacing)*64)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}: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)))}.rounded-full{border-radius:3.40282e38px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-\[\#b79ecf\]{border-color:#b79ecf}.bg-\[\#b79ecf\]{background-color:#b79ecf}.bg-\[\#fff8e7\]{background-color:#fff8e7}.bg-white{background-color:var(--color-white)}.p-1{padding:calc(var(--spacing)*1)}.p-4{padding:calc(var(--spacing)*4)}.px-4{padding-inline:calc(var(--spacing)*4)}.pt-2{padding-top:calc(var(--spacing)*2)}.text-center{text-align:center}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--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))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.text-amber-600{color:var(--color-amber-600)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}@media (hover:hover){.hover\:text-amber-700:hover{color:var(--color-amber-700)}.hover\:text-gray-800:hover{color:var(--color-gray-800)}}}body{background-color:#f4e9d5}@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-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}
\ No newline at end of file diff --git a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-fail-bak.png b/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-fail-bak.png Binary files differdeleted file mode 100644 index a4aaa21..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-fail-bak.png +++ /dev/null diff --git a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-fail.png b/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-fail.png Binary files differdeleted file mode 100644 index 2926993..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-fail.png +++ /dev/null diff --git a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-pass-bak.png b/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-pass-bak.png Binary files differdeleted file mode 100644 index 5890879..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-pass-bak.png +++ /dev/null diff --git a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-pass.png b/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-pass.png Binary files differdeleted file mode 100644 index 0ae0c24..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-pass.png +++ /dev/null diff --git a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-puzzle-bak.png b/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-puzzle-bak.png Binary files differdeleted file mode 100644 index a0ba0fb..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-puzzle-bak.png +++ /dev/null diff --git a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-puzzle.png b/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-puzzle.png Binary files differdeleted file mode 100644 index 7ed2fc2..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/img/mascot-puzzle.png +++ /dev/null diff --git a/vendor/github.com/sjtug/cerberus/web/dist/main.js b/vendor/github.com/sjtug/cerberus/web/dist/main.js deleted file mode 100644 index b7ea2ff..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/main.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(){function e(e){if(e=a.i?.[e]||e,!t)try{throw Error()}catch(o){var r=(""+o.stack).match(/(https?|file|ftp|(chrome|moz|safari-web)-extension):\/\/[^)\n]+/g);if(!r)return n+e;t=r[0]}return new URL(n+e,t).toString()}var t,r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},n="./",o={},i={},a=r.parcelRequireec24;function s(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){r(e);return}s.done?t(u):Promise.resolve(u).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){s(i,n,o,a,u,"next",e)}function u(e){s(i,n,o,a,u,"throw",e)}a(void 0)})}}function c(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function l(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){var c=[s,u];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}null==a&&((a=function(e){if(e in o)return o[e].exports;if(e in i){var t=i[e];delete i[e];var r={id:e,exports:{}};return o[e]=r,t.call(r.exports,r,r.exports),r.exports}var n=Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}).register=function(e,t){i[e]=t},r.parcelRequireec24=a),a.register,Object.assign(a.i??={},{aykjc:"pow_bg.e56bb07e.wasm",lyHvT:"pow.worker.8c3779b0.js"}),"function"==typeof SuppressedError&&SuppressedError;var f={};"use strict";f=e("aykjc");var h={},d={};d=function(e,t,r){if(t===self.location.origin)return e;var n=r?"import "+JSON.stringify(e)+";":"importScripts("+JSON.stringify(e)+");";return URL.createObjectURL(new Blob([n],{type:"application/javascript"}))};var p=new URL(e("lyHvT"));function g(e,t){if(!e)return null;var r=e;if(Array.isArray(t)){for(var n=0;n<t.length;++n)if((void 0===r?"undefined":c(r))!=="object"||!(r=r[t[n]]))return null;return r}return(void 0===r?"undefined":c(r))==="object"?r[t]:null}function b(e,t,r,n,o){var i=g(e[t],r);if(i)return(void 0===i?"undefined":c(i))===o;if(n){for(var a=0;a<n.length;++a)if(i=g(e[n[a]],r))return(void 0===i?"undefined":c(i))===o}return!1}h=d(p.toString(),p.origin,!1);var m=new(function(){function e(e,t){var r=this;this._data={},this._fallback={},this._defaultLocale=null,this._locale=null,Object.keys(e).forEach(function(n){"toString"!==n&&(r._data[n]=e[n],void 0===t&&(t=n))}),this.locale=t||null,this._defaultLocale=this.locale}return Object.defineProperty(e.prototype,"availableLocales",{get:function(){return Object.keys(this._data)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"locale",{get:function(){return this._locale},set:function(e){this._locale=this.resolveLocale(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultLocale",{get:function(){return this._defaultLocale},set:function(e){this._defaultLocale=this.resolveLocale(e)},enumerable:!1,configurable:!0}),e.prototype.addMessages=function(e,t,r){var n=t||String(this.locale);if("function"!=typeof e&&(e=Object.keys(e).reduce(function(t,r){return"toString"!==r&&(t[r]=e[r]),t},{})),Array.isArray(r)&&r.length>0){for(var o=this._data[n],i=0;i<r.length-1;++i){var a=r[i];o[a]||(o[a]={}),o=o[a]}o[r[r.length-1]]=e}else this._data[n]=e;return this},e.prototype.resolveLocale=function(e){var t=String(e);if(this._data[t])return e;if(e){for(;t=t.replace(/[-_]?[^-_]*$/,"");)if(this._data[t])return t;for(var r=this.availableLocales,n=RegExp("^"+e+"[-_]"),o=0;o<r.length;++o)if(n.test(r[o]))return r[o]}return null},e.prototype.getFallback=function(e){var t=e||String(this.locale);return this._fallback[t]||(t!==this.defaultLocale&&this.defaultLocale?[this.defaultLocale]:[])},e.prototype.setFallback=function(e,t){return this._fallback[e]=Array.isArray(t)?t:null,this},e.prototype.hasMessage=function(e,t,r){var n=t||String(this.locale),o=r?this.getFallback(n):null;return b(this._data,n,e,o,"function")},e.prototype.hasObject=function(e,t,r){var n=t||String(this.locale),o=r?this.getFallback(n):null;return b(this._data,n,e,o,"object")},e.prototype.get=function(e,t,r){var n=r||String(this.locale),o=g(this._data[n],e);if(o)return"function"==typeof o?o(t):o;for(var i=this.getFallback(n),a=0;a<i.length;++a)if(o=g(this._data[i[a]],e))return"function"==typeof o?o(t):o;return e},e}())({zh:{challenge:{title:function(){return"验证您不是机器人"},calculating:function(){return"正在进行浏览器检查..."},difficulty_speed:function(e){return"难度:"+e.difficulty+",速度:"+e.speed+"kH/s"},taking_longer:function(){return"验证时间超出预期,请勿刷新页面"},why_seeing:function(){return"为什么我会看到这个页面?"},why_seeing_body:{part_1:function(e){return"您看到这个页面是因为网站管理员启用了 "+e.cerberus+" 来防御异常流量攻击。这类攻击可能导致网站服务中断,影响所有用户的正常访问。"},part_2:function(e){return"如果您了解 "+e.techaro+" 开发的 "+e.anubis+",那么 Cerberus 采用了类似的 PoW 验证技术。不同的是,Anubis 主要针对 AI 爬虫,而 Cerberus 则采用了更激进的策略来保护我们的开源基础设施。"},part_3:function(e){return"请注意,Cerberus 需要启用现代 JavaScript 功能,而 "+e.jshelter+" 等插件会禁用这些功能。请为本域名禁用 "+e.jshelter+" 或类似的插件。"}},must_enable_js:function(){return"请启用 JavaScript 以继续访问"}},success:{title:function(){return"验证成功"},verification_complete:function(){return"验证已完成"},took_time_iterations:function(e){return"用时 "+e.time+"ms,完成 "+e.iterations+" 次迭代"}},error:{error_occurred:function(){return"发生错误"},access_restricted:function(){return"访问受限"},browser_config_or_bug:function(){return"可能是浏览器配置问题,也可能是我们的系统出现了异常"},ip_blocked:function(){return"由于检测到可疑活动,您的 IP 地址或本地网络已被封禁"},wait_before_retry:function(){return"请稍后再试,某些情况下可能需要等待数小时"},contact_us:function(e){return"如有问题,请通过 "+e.mail+" 联系我们。请附上下方显示的 request ID,以便我们进行排查。"}},footer:{author:function(e){return"由 "+e.sjtug+" 开发的 "+e.cerberus+" 提供保护"},upstream:function(e){return"灵感来源于 \uD83C\uDDE8\uD83C\uDDE6 "+e.techaro+" 开发的 "+e.anubis}}},en:{challenge:{title:function(){return"Making sure you're not a bot!"},calculating:function(){return"Performing browser checks..."},difficulty_speed:function(e){return"Difficulty: "+e.difficulty+", Speed: "+e.speed+"kH/s"},taking_longer:function(){return"This is taking longer than expected. Please do not refresh the page."},why_seeing:function(){return"Why am I seeing this?"},why_seeing_body:{part_1:function(e){return"You are seeing this because the administrator of this website has set up "+e.cerberus+" to protect the server against abusive traffic. This can and does cause downtime for the websites, which makes their resources inaccessible for everyone."},part_2:function(e){return"If you're familiar with "+e.anubis+" by "+e.techaro+", Cerberus is similar - it performs a PoW challenge to verify the request. While Anubis focuses on protecting websites from AI scrapers, Cerberus takes a much more aggressive approach to protect our open-source infrastructure."},part_3:function(e){return"Please note that Cerberus requires the use of modern JavaScript features that plugins like "+e.jshelter+" will disable. Please disable "+e.jshelter+" or other such plugins for this domain."}},must_enable_js:function(){return"You must enable JavaScript to proceed."}},success:{title:function(){return"Success!"},verification_complete:function(){return"Verification Complete!"},took_time_iterations:function(e){return"Took "+e.time+"ms, "+e.iterations+" iterations"}},error:{error_occurred:function(){return"Error occurred while processing your request"},access_restricted:function(){return"Access has been restricted"},browser_config_or_bug:function(){return"There might be an issue with your browser configuration, or something is wrong on our side."},ip_blocked:function(){return"You (or your local network) have been blocked due to suspicious activity."},wait_before_retry:function(){return"Please wait a while before you try again; in some cases this may take a few hours."},contact_us:function(e){return"If you believe this is an error, please contact us at "+e.mail+". Attach the request ID shown below to help us investigate."}},footer:{author:function(e){return"Protected by "+e.cerberus+" from "+e.sjtug+"."},upstream:function(e){return"Heavily inspired by "+e.anubis+" from "+e.techaro+" in \uD83C\uDDE8\uD83C\uDDE6."}}}});function y(e,t){return m.get(e.split("."),t)}console.log(m.locale,m.availableLocales);var v={baseURL:"",version:"",locale:""},_={title:document.getElementById("title"),mascot:document.getElementById("mascot"),status:document.getElementById("status"),metrics:document.getElementById("metrics"),message:document.getElementById("message"),progressContainer:document.getElementById("progress-container"),progressBar:document.getElementById("progress-bar")},w={title:function(e){return _.title.textContent=e},mascotState:function(e){return _.mascot.src="".concat(v.baseURL,"/static/img/mascot-").concat(e,".png?v=").concat(v.version)},status:function(e){return _.status.textContent=e},metrics:function(e){return _.metrics.textContent=e},message:function(e){return _.message.textContent=e},progress:function(e){_.progressContainer.classList.toggle("hidden",!e),_.progressBar.style.width="".concat(e,"%")}};u(function(){var e,t,r,n,o,i,a,s,c,d,p,g,b,_,k,S,E,j,L;return l(this,function(C){switch(C.label){case 0:return r=(t=JSON.parse((e=document.getElementById("challenge-script")).getAttribute("x-challenge"))).challenge,n=t.difficulty,o=t.nonce,i=t.ts,a=t.signature,c=(s=JSON.parse(e.getAttribute("x-meta"))).baseURL,d=s.version,p=s.locale,v.baseURL=c,v.version=d,v.locale=p,m.locale=p,w.title(y("challenge.title")),w.mascotState("puzzle"),w.status(y("challenge.calculating")),w.metrics(y("challenge.difficulty_speed",{difficulty:n,speed:0})),w.message(""),w.progress(0),g=Date.now(),b=0,_=Math.pow(16,-n/2),[4,function(e){return u(function(e){var t,r,n,o,i=arguments;return l(this,function(a){return t=i.length>1&&void 0!==i[1]?i[1]:5,r=i.length>2&&void 0!==i[2]?i[2]:null,n=i.length>3&&void 0!==i[3]?i[3]:null,o=i.length>4&&void 0!==i[4]?i[4]:navigator.hardwareConcurrency||1,[2,new Promise(function(i,a){console.debug("fast algo");var s=[],c=function(){s.forEach(function(e){return e.terminate()}),null!==r&&(r.removeEventListener("abort",c),r.aborted&&(console.log("PoW aborted"),a(Error("PoW aborted"))))};null!==r&&r.addEventListener("abort",c,{once:!0}),u(function(){var r,u,d;return l(this,function(l){switch(l.label){case 0:var p;return[4,fetch((p=f)&&p.__esModule?p.default:p)];case 1:return[4,l.sent().arrayBuffer()];case 2:for(u=0,r=l.sent();u<o;u++)(d=new Worker(h)).onmessage=function(e){"number"==typeof e.data?null==n||n(e.data):(c(),i(e.data))},d.onerror=function(e){c(),a(e)},d.postMessage({wasmModule:r,data:e,difficulty:t,nonce:u,threads:o}),s.push(d);return[2]}})})()})]})}).apply(this,arguments)}("".concat(r,"|").concat(o,"|").concat(i,"|").concat(a,"|"),n,null,function(e){var t=Math.pow(1-_,e),r=(1-Math.pow(t,2))*100,o=Date.now()-g;o-b>200&&(w.progress(r),w.metrics(y("challenge.difficulty_speed",{difficulty:n,speed:(e/o).toFixed(3)})),w.message(t<.01?y("challenge.taking_longer"):void 0),b=o)})];case 1:return S=(k=C.sent()).hash,E=k.nonce,j=Date.now(),console.log({hash:S,solution:E}),w.title(y("success.title")),w.mascotState("pass"),w.status(y("success.verification_complete")),w.metrics(y("success.took_time_iterations",{time:j-g,iterations:E})),w.message(""),w.progress(0),L=function(e,t,r,n,o,i){function a(e,t,r){var n=document.createElement("input");n.type="hidden",n.name=t,n.value=r,e.appendChild(n)}var s=document.createElement("form");return s.method="POST",s.action="".concat(r,"/answer"),a(s,"response",e),a(s,"solution",t),a(s,"nonce",n),a(s,"ts",o),a(s,"signature",i),a(s,"redir",window.location.href),document.body.appendChild(s),s}(S,E,c,o,i,a),setTimeout(function(){L.submit()},250),[2]}})})()}(); -//# sourceMappingURL=main.js.map diff --git a/vendor/github.com/sjtug/cerberus/web/dist/main.js.map b/vendor/github.com/sjtug/cerberus/web/dist/main.js.map deleted file mode 100644 index 4247b34..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/main.js.map +++ /dev/null @@ -1 +0,0 @@ -{"mappings":"C,A,W,S,E,C,E,G,E,E,C,E,C,E,E,E,C,E,G,C,M,A,O,C,M,E,C,I,E,A,C,G,E,K,A,E,K,C,oE,I,E,O,E,E,E,C,C,E,A,C,O,I,I,E,E,G,Q,E,C,I,E,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,K,E,C,E,E,C,E,E,E,iB,CGAA,SAAS,EAAmB,CAAG,CAAE,CAAO,CAAE,CAAM,CAAE,CAAK,CAAE,CAAM,CAAE,CAAG,CAAE,CAAG,EACrE,GAAI,CACA,IAAI,EAAO,CAAG,CAAC,EAAI,CAAC,GAChB,EAAQ,EAAK,KAAK,AAC1B,CAAE,MAAO,EAAO,CACZ,EAAO,GACP,MACJ,CACI,EAAK,IAAI,CAAE,EAAQ,GAClB,QAAQ,OAAO,CAAC,GAAO,IAAI,CAAC,EAAO,EAC5C,CACA,SAAS,EAAoB,CAAE,EAC3B,OAAO,WACH,IAAI,EAAO,IAAI,CAAE,EAAO,UAExB,OAAO,IAAI,QAAQ,SAAS,CAAO,CAAE,CAAM,EACvC,IAAI,EAAM,EAAG,KAAK,CAAC,EAAM,GAEzB,SAAS,EAAM,CAAK,EAChB,EAAmB,EAAK,EAAS,EAAQ,EAAO,EAAQ,OAAQ,EACpE,CAEA,SAAS,EAAO,CAAG,EACf,EAAmB,EAAK,EAAS,EAAQ,EAAO,EAAQ,QAAS,EACrE,CAEA,EAAM,KAAA,EACV,EACJ,CACJ,CE7BA,SAAA,EAAA,CAAA,EAGI,OAAO,GAAO,AAAkB,aAAlB,OAAO,QAA0B,EAAI,WAAW,GAAK,OAAS,SAAW,OAAO,CAClG,CDwHO,SAAS,EAAY,CAAO,CAAE,CAAI,EACrC,IAAsG,EAAG,EAAG,EAAxG,EAAI,CAAE,MAAO,EAAG,KAAM,WAAa,GAAI,AAAO,EAAP,CAAC,CAAC,EAAE,CAAM,MAAM,CAAC,CAAC,EAAE,CAAE,OAAO,CAAC,CAAC,EAAE,AAAE,EAAG,KAAM,EAAE,CAAE,IAAK,EAAE,AAAC,EAAY,EAAI,OAAO,MAAM,CAAE,AAAA,CAAA,AAAoB,YAApB,OAAO,SAA0B,SAAW,MAAA,EAAQ,SAAS,EAC/L,OAAO,EAAE,IAAI,CAAG,EAAK,GAAI,EAAE,KAAQ,CAAG,EAAK,GAAI,EAAE,MAAS,CAAG,EAAK,GAAI,AAAkB,YAAlB,OAAO,QAA0B,CAAA,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAG,WAAa,OAAO,IAAI,AAAE,CAAA,EAAI,EAC1J,SAAS,EAAK,CAAC,EAAI,OAAO,SAAU,CAAC,MACvB,EADuC,CAAC,EAAG,EAAE,CAEvD,GAAI,EAAG,MAAM,AAAI,UAAU,mCAC3B,KAAO,GAAM,CAAA,EAAI,EAAG,CAAE,CAAC,EAAE,EAAK,CAAA,EAAI,CAAA,CAAA,EAAK,GAAG,GAAI,CAC1C,GAAI,EAAI,EAAG,GAAM,CAAA,EAAI,AAAQ,EAAR,CAAE,CAAC,EAAE,CAAO,EAAE,MAAS,CAAG,CAAE,CAAC,EAAE,CAAG,EAAE,KAAQ,EAAK,CAAA,AAAC,CAAA,EAAI,EAAE,MAAQ,AAAR,GAAc,EAAE,IAAI,CAAC,GAAI,CAAA,EAAK,EAAE,IAAG,AAAH,GAAS,CAAE,AAAA,CAAA,EAAI,EAAE,IAAI,CAAC,EAAG,CAAE,CAAC,EAAE,CAAA,EAAG,IAAI,CAAE,OAAO,EAE3J,OADI,EAAI,EAAJ,AAAO,GAAG,CAAA,EAAK,CAAC,AAAQ,EAAR,CAAE,CAAC,EAAE,CAAM,EAAE,KAAK,CAAC,AAAA,EAC/B,CAAE,CAAC,EAAE,EACT,KAAK,EAAG,KAAK,EAAG,EAAI,EAAI,KACxB,MAAK,EAAc,OAAX,EAAE,KAAK,GAAW,CAAE,MAAO,CAAE,CAAC,EAAE,CAAE,KAAM,CAAA,CAAM,CACtD,MAAK,EAAG,EAAE,KAAK,GAAI,EAAI,CAAE,CAAC,EAAE,CAAE,EAAK,CAAC,EAAE,CAAE,QACxC,MAAK,EAAG,EAAK,EAAE,GAAG,CAAC,GAAG,GAAI,EAAE,IAAI,CAAC,GAAG,GAAI,QACxC,SACI,GAAI,CAAc,CAAA,EAAI,AAAhB,CAAA,EAAI,EAAE,IAAI,AAAJ,EAAY,MAAM,CAAG,GAAK,CAAC,CAAC,EAAE,MAAM,CAAG,EAAC,AAAD,GAAQ,CAAA,AAAU,IAAV,CAAE,CAAC,EAAE,EAAU,AAAU,IAAV,CAAE,CAAC,EAAE,AAAK,EAAI,CAAE,EAAI,EAAG,QAAU,CAC3G,GAAI,AAAU,IAAV,CAAE,CAAC,EAAE,EAAW,CAAA,CAAC,GAAM,CAAE,CAAC,EAAE,CAAG,CAAC,CAAC,EAAE,EAAI,CAAE,CAAC,EAAE,CAAG,CAAC,CAAC,EAAE,AAAF,EAAM,CAAE,EAAE,KAAK,CAAG,CAAE,CAAC,EAAE,CAAE,KAAO,CACrF,GAAI,AAAU,IAAV,CAAE,CAAC,EAAE,EAAU,EAAE,KAAK,CAAG,CAAC,CAAC,EAAE,CAAE,CAAE,EAAE,KAAK,CAAG,CAAC,CAAC,EAAE,CAAE,EAAI,EAAI,KAAO,CACpE,GAAI,GAAK,EAAE,KAAK,CAAG,CAAC,CAAC,EAAE,CAAE,CAAE,EAAE,KAAK,CAAG,CAAC,CAAC,EAAE,CAAE,EAAE,GAAG,CAAC,IAAI,CAAC,GAAK,KAAO,CAC9D,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,GACnB,EAAE,IAAI,CAAC,GAAG,GAAI,QACtB,CACA,EAAK,EAAK,IAAI,CAAC,EAAS,EAC5B,CAAE,MAAO,EAAG,CAAE,EAAK,CAAC,EAAG,EAAE,CAAE,EAAI,CAAG,QAAU,CAAE,EAAI,EAAI,CAAG,CACzD,GAAI,AAAQ,EAAR,CAAE,CAAC,EAAE,CAAM,MAAM,CAAE,CAAC,EAAE,CAAE,MAAO,CAAE,MAAO,CAAE,CAAC,EAAE,CAAG,CAAE,CAAC,EAAE,CAAG,KAAK,EAAG,KAAM,CAAA,CAAK,CArBrB,CAAG,CAuBrE,C,M,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,O,M,C,E,C,G,C,EHtJ8B,CAAC,MAAQ,wCAAwC,MAAQ,yCAAyC,GGwUzG,AAA2B,YAA3B,OAAO,iBAAiC,gB,I,E,C,CKxU/D,CAAA,aFAA,EAAiB,EAAsB,S,I,E,C,E,E,C,EEEvC,EAAiB,SAAU,CAAS,CAAE,CAAM,CAAE,CAAK,EACjD,GAAI,IAAW,KAAK,QAAQ,CAAC,MAAM,CAGjC,OAAO,EAGP,IAAI,EAAS,EAAQ,UAAY,KAAK,SAAS,CAAC,GAAa,IAAM,iBAAmB,KAAK,SAAS,CAAC,GAAa,KAClH,OAAO,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,EAAO,CAAE,CAC5C,KAAM,wBACR,GAEJ,EDbA,IAAI,EAAM,IAAI,IAAI,EAAsB,UEiSxC,SAAS,EAAK,CAAG,CAAE,CAAG,EAClB,GAAI,CAAC,EACD,OAAO,KACX,IAAI,EAAM,EACV,GAAI,MAAM,OAAO,CAAC,GAAM,CACpB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAI,MAAM,CAAE,EAAE,EAC9B,GAAI,CAAA,AAAO,KAAA,IAAA,EAAA,YAAP,AAAA,EAAO,EAAA,IAAQ,UAGf,CADJ,CAAA,EAAM,CAAG,CAAC,CAAG,CAAC,EAAE,CAAC,AAAD,EADZ,OAAO,KAKf,OAAO,CACX,CACA,MAAO,AAAA,CAAA,AAAO,KAAA,IAAA,EAAA,YAAP,AAAA,EAAO,EAAA,IAAQ,SAAW,CAAG,CAAC,EAAI,CAAG,IAChD,CACA,SAAS,EAAK,CAAI,CAAE,CAAE,CAAE,CAAG,CAAE,CAAQ,CAAE,CAAI,EACvC,IAAI,EAAM,EAAK,CAAI,CAAC,EAAG,CAAE,GACzB,GAAI,EACA,MAAO,AAAA,CAAA,AAAO,KAAA,IAAA,EAAA,YAAP,AAAA,EAAO,EAAA,IAAQ,EAC1B,GAAI,EACA,CAAA,IAAK,IAAI,EAAI,EAAG,EAAI,EAAS,MAAM,CAAE,EAAE,EAEnC,GADA,EAAM,EAAK,CAAI,CAAC,CAAQ,CAAC,EAAE,CAAC,CAAE,GAE1B,MAAO,AAAA,CAAA,AAAO,KAAA,IAAA,EAAA,YAAP,AAAA,EAAO,EAAA,IAAQ,CAC9B,CAEJ,MAAO,CAAA,CACX,CF5TA,EAAiB,EAAU,EAAI,QAAQ,GAAI,EAAI,MAAM,CAAE,CAAA,GNIvD,IAAM,EAAW,GQmEa,CAAA,WAK1B,SAAS,EAAS,CAAO,CAAE,CAAa,EACpC,IAAI,EAAQ,IAAI,AAEhB,CAAA,IAAI,CAAC,KAAK,CAAG,CAAC,EAEd,IAAI,CAAC,SAAS,CAAG,CAAC,EAElB,IAAI,CAAC,cAAc,CAAG,KAEtB,IAAI,CAAC,OAAO,CAAG,KACf,OAAO,IAAI,CAAC,GAAS,OAAO,CAAC,SAAU,CAAE,EAC1B,aAAP,IACA,EAAM,KAAK,CAAC,EAAG,CAAG,CAAO,CAAC,EAAG,CACzB,AAAkB,KAAA,IAAlB,GACA,CAAA,EAAgB,CADpB,EAGR,GACA,IAAI,CAAC,MAAM,CAAG,GAAiB,KAC/B,IAAI,CAAC,cAAc,CAAG,IAAI,CAAC,MAAM,AACrC,CA8LA,OA7LA,OAAO,cAAc,CAAC,EAAS,SAAS,CAAE,mBAAoB,CAE1D,IAAK,WACD,OAAO,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CACjC,EACA,WAAY,CAAA,EACZ,aAAc,CAAA,CAClB,GACA,OAAO,cAAc,CAAC,EAAS,SAAS,CAAE,SAAU,CAQhD,IAAK,WACD,OAAO,IAAI,CAAC,OAAO,AACvB,EACA,IAAK,SAAU,CAAM,EACjB,IAAI,CAAC,OAAO,CAAG,IAAI,CAAC,aAAa,CAAC,EACtC,EACA,WAAY,CAAA,EACZ,aAAc,CAAA,CAClB,GACA,OAAO,cAAc,CAAC,EAAS,SAAS,CAAE,gBAAiB,CAQvD,IAAK,WACD,OAAO,IAAI,CAAC,cAAc,AAC9B,EACA,IAAK,SAAU,CAAM,EACjB,IAAI,CAAC,cAAc,CAAG,IAAI,CAAC,aAAa,CAAC,EAC7C,EACA,WAAY,CAAA,EACZ,aAAc,CAAA,CAClB,GAeA,EAAS,SAAS,CAAC,WAAW,CAAG,SAAU,CAAI,CAAE,CAAM,CAAE,CAAO,EAC5D,IAAI,EAAK,GAAU,OAAO,IAAI,CAAC,MAAM,EAQrC,GAPI,AAAgB,YAAhB,OAAO,GACP,CAAA,EAAO,OAAO,IAAI,CAAC,GAAM,MAAM,CAAC,SAAU,CAAG,CAAE,CAAG,EAG9C,MAFI,AAAQ,aAAR,GACA,CAAA,CAAG,CAAC,EAAI,CAAG,CAAI,CAAC,EAAI,AAAJ,EACb,CACX,EAAG,CAAC,EAAJ,EAEA,MAAM,OAAO,CAAC,IAAY,EAAQ,MAAM,CAAG,EAAG,CAE9C,IAAK,IADD,EAAW,IAAI,CAAC,KAAK,CAAC,EAAG,CACpB,EAAI,EAAG,EAAI,EAAQ,MAAM,CAAG,EAAG,EAAE,EAAG,CACzC,IAAI,EAAM,CAAO,CAAC,EAAE,AAChB,AAAC,CAAA,CAAQ,CAAC,EAAI,EACd,CAAA,CAAQ,CAAC,EAAI,CAAG,CAAC,CAAA,EACrB,EAAW,CAAQ,CAAC,EAAI,AAC5B,CACA,CAAQ,CAAC,CAAO,CAAC,EAAQ,MAAM,CAAG,EAAE,CAAC,CAAG,CAC5C,MAEI,IAAI,CAAC,KAAK,CAAC,EAAG,CAAG,EAErB,OAAO,IAAI,AACf,EAOA,EAAS,SAAS,CAAC,aAAa,CAAG,SAAU,CAAM,EAC/C,IAAI,EAAK,OAAO,GAChB,GAAI,IAAI,CAAC,KAAK,CAAC,EAAG,CACd,OAAO,EACX,GAAI,EAAQ,CACR,KAAQ,EAAK,EAAG,OAAO,CAAC,eAAgB,KACpC,GAAI,IAAI,CAAC,KAAK,CAAC,EAAG,CACd,OAAO,EAIf,IAAK,IAFD,EAAK,IAAI,CAAC,gBAAgB,CAC1B,EAAK,AAAI,OAAO,IAAM,EAAS,QAC1B,EAAI,EAAG,EAAI,EAAG,MAAM,CAAE,EAAE,EAC7B,GAAI,EAAG,IAAI,CAAC,CAAE,CAAC,EAAE,EACb,OAAO,CAAE,CAAC,EAAE,AAExB,CACA,OAAO,IACX,EAMA,EAAS,SAAS,CAAC,WAAW,CAAG,SAAU,CAAM,EAC7C,IAAI,EAAK,GAAU,OAAO,IAAI,CAAC,MAAM,EACrC,OAAQ,IAAI,CAAC,SAAS,CAAC,EAAG,EACrB,CAAA,IAAO,IAAI,CAAC,aAAa,EAAK,IAAI,CAAC,aAAa,CAE3C,CAAC,IAAI,CAAC,aAAa,CAAA,CADnB,EAAE,AACkB,CAClC,EAQA,EAAS,SAAS,CAAC,WAAW,CAAG,SAAU,CAAE,CAAE,CAAQ,EAEnD,OADA,IAAI,CAAC,SAAS,CAAC,EAAG,CAAG,MAAM,OAAO,CAAC,GAAY,EAAW,KACnD,IAAI,AACf,EAaA,EAAS,SAAS,CAAC,UAAU,CAAG,SAAU,CAAG,CAAE,CAAM,CAAE,CAAQ,EAC3D,IAAI,EAAK,GAAU,OAAO,IAAI,CAAC,MAAM,EACjC,EAAK,EAAW,IAAI,CAAC,WAAW,CAAC,GAAM,KAC3C,OAAO,EAAK,IAAI,CAAC,KAAK,CAAE,EAAI,EAAK,EAAI,WACzC,EAaA,EAAS,SAAS,CAAC,SAAS,CAAG,SAAU,CAAG,CAAE,CAAM,CAAE,CAAQ,EAC1D,IAAI,EAAK,GAAU,OAAO,IAAI,CAAC,MAAM,EACjC,EAAK,EAAW,IAAI,CAAC,WAAW,CAAC,GAAM,KAC3C,OAAO,EAAK,IAAI,CAAC,KAAK,CAAE,EAAI,EAAK,EAAI,SACzC,EAgBA,EAAS,SAAS,CAAC,GAAG,CAAG,SAAU,CAAG,CAAE,CAAK,CAAE,CAAM,EACjD,IAAI,EAAK,GAAU,OAAO,IAAI,CAAC,MAAM,EACjC,EAAM,EAAK,IAAI,CAAC,KAAK,CAAC,EAAG,CAAE,GAC/B,GAAI,EACA,MAAO,AAAc,YAAd,OAAO,EAAoB,EAAI,GAAS,EAEnD,IAAK,IADD,EAAK,IAAI,CAAC,WAAW,CAAC,GACjB,EAAI,EAAG,EAAI,EAAG,MAAM,CAAE,EAAE,EAE7B,GADA,EAAM,EAAK,IAAI,CAAC,KAAK,CAAC,CAAE,CAAC,EAAE,CAAC,CAAE,GAE1B,MAAO,AAAc,YAAd,OAAO,EAAoB,EAAI,GAAS,EAEvD,OAAO,CACX,EACO,CACX,GAAA,EC/Re,CACb,GAAI,CACF,UAAW,CACT,MAAO,WAAM,MAAA,U,EACb,YAAa,WAAM,MAAA,c,EACnB,iBAAkB,SAAC,CAAnB,EAAyB,MAAA,MAAQ,EAAE,UAAU,CAAG,OAAS,EAAE,KAAK,CAAG,M,EACnE,cAAe,WAAM,MAAA,iB,EACrB,WAAY,WAAM,MAAA,c,EAClB,gBAAiB,CACf,OAAQ,SAAC,CAAT,EAAe,MAAA,sBAAwB,EAAE,QAAQ,CAAG,wC,EACpD,OAAQ,SAAC,CAAT,EAAe,MAAA,SAAW,EAAE,OAAO,CAAG,QAAU,EAAE,MAAM,CAAG,wF,EAC3D,OAAQ,SAAC,CAAT,EAAe,MAAA,uCAAyC,EAAE,QAAQ,CAAG,uBAAyB,EAAE,QAAQ,CAAG,U,CAC7G,EACA,eAAgB,WAAM,MAAA,sB,CACxB,EACA,QAAS,CACP,MAAO,WAAM,MAAA,M,EACb,sBAAuB,WAAM,MAAA,O,EAC7B,qBAAsB,SAAC,CAAvB,EAA6B,MAAA,MAAQ,EAAE,IAAI,CAAG,SAAW,EAAE,UAAU,CAAG,M,CAC1E,EACA,MAAO,CACL,eAAgB,WAAM,MAAA,M,EACtB,kBAAmB,WAAM,MAAA,M,EACzB,sBAAuB,WAAM,MAAA,2B,EAC7B,WAAY,WAAM,MAAA,6B,EAClB,kBAAmB,WAAM,MAAA,sB,EACzB,WAAY,SAAC,CAAb,EAAmB,MAAA,YAAc,EAAE,IAAI,CAAG,qC,CAC5C,EACA,OAAQ,CACN,OAAQ,SAAC,CAAT,EAAe,MAAA,KAAO,EAAE,KAAK,CAAG,QAAU,EAAE,QAAQ,CAAG,O,EACvD,SAAU,SAAC,CAAX,EAAiB,MAAA,kCAAgB,EAAE,OAAO,CAAG,QAAU,EAAE,MAAM,A,CACjE,CACF,EACA,GAAI,CACF,UAAW,CACT,MAAO,WAAM,MAAA,+B,EACb,YAAa,WAAM,MAAA,8B,EACnB,iBAAkB,SAAC,CAAnB,EAAyB,MAAA,eAAiB,EAAE,UAAU,CAAG,YAAc,EAAE,KAAK,CAAG,M,EACjF,cAAe,WAAM,MAAA,sE,EACrB,WAAY,WAAM,MAAA,uB,EAClB,gBAAiB,CACf,OAAQ,SAAC,CAAT,EAAe,MAAA,4EAA8E,EAAE,QAAQ,CAAG,2J,EAC1G,OAAQ,SAAC,CAAT,EAAe,MAAA,2BAA6B,EAAE,MAAM,CAAG,OAAS,EAAE,OAAO,CAAG,oO,EAC5E,OAAQ,SAAC,CAAT,EAAe,MAAA,8FAAgG,EAAE,QAAQ,CAAG,iCAAmC,EAAE,QAAQ,CAAG,yC,CAC9K,EACA,eAAgB,WAAM,MAAA,wC,CACxB,EACA,QAAS,CACP,MAAO,WAAM,MAAA,U,EACb,sBAAuB,WAAM,MAAA,wB,EAC7B,qBAAsB,SAAC,CAAvB,EAA6B,MAAA,QAAU,EAAE,IAAI,CAAG,OAAS,EAAE,UAAU,CAAG,a,CAC1E,EACA,MAAO,CACL,eAAgB,WAAM,MAAA,8C,EACtB,kBAAmB,WAAM,MAAA,4B,EACzB,sBAAuB,WAAM,MAAA,6F,EAC7B,WAAY,WAAM,MAAA,2E,EAClB,kBAAmB,WAAM,MAAA,oF,EACzB,WAAY,SAAC,CAAb,EAAmB,MAAA,yDAA2D,EAAE,IAAI,CAAG,6D,CACzF,EACA,OAAQ,CACN,OAAQ,SAAC,CAAT,EAAe,MAAA,gBAAkB,EAAE,QAAQ,CAAG,SAAW,EAAE,KAAK,CAAG,G,EACnE,SAAU,SAAC,CAAX,EAAiB,MAAA,uBAAyB,EAAE,MAAM,CAAG,SAAW,EAAE,OAAO,CAAG,+B,CAC9E,CACF,CACF,GTzDA,SAAS,EAAE,CAAG,CAAE,CAAK,EACnB,OAAO,EAAS,GAAG,CAAC,EAAI,KAAK,CAAC,KAAM,EACtC,CAJA,QAAQ,GAAG,CAAC,EAAS,MAAM,CAAE,EAAS,gBAAgB,EAMtD,IAAM,EAAO,CACX,QAAS,GACT,QAAS,GACT,OAAQ,EACV,EAEM,EAAM,CACV,MAAO,SAAS,cAAc,CAAC,SAC/B,OAAQ,SAAS,cAAc,CAAC,UAChC,OAAQ,SAAS,cAAc,CAAC,UAChC,QAAS,SAAS,cAAc,CAAC,WACjC,QAAS,SAAS,cAAc,CAAC,WACjC,kBAAmB,SAAS,cAAc,CAAC,sBAC3C,YAAa,SAAS,cAAc,CAAC,eACvC,EAEM,EAAK,CACT,MAAO,SAAC,CAAR,EAAkB,OAAA,EAAI,KAAK,CAAC,WAAW,CAAG,C,EAC1C,YAAa,SAAC,CAAd,EAAwB,OAAA,EAAI,MAAM,CAAC,GAAG,CAAI,GAAoC,MAAA,CAAlC,EAAK,OAAO,CAAC,uBAAoC,MAAA,CAAf,EAAM,WAAsB,MAAA,CAAb,EAAK,OAAO,C,EACzG,OAAQ,SAAC,CAAT,EAAoB,OAAA,EAAI,MAAM,CAAC,WAAW,CAAG,C,EAC7C,QAAS,SAAC,CAAV,EAAsB,OAAA,EAAI,OAAO,CAAC,WAAW,CAAG,C,EAChD,QAAS,SAAC,CAAV,EAAsB,OAAA,EAAI,OAAO,CAAC,WAAW,CAAG,C,EAChD,SAAU,SAAC,CAAX,EACE,EAAI,iBAAiB,CAAC,SAAS,CAAC,MAAM,CAAC,SAAU,CAAC,GAClD,EAAI,WAAW,CAAC,KAAK,CAAC,KAAK,CAAI,GAAW,MAAA,CAAT,EAAS,IAC5C,CACF,E,A,E,WA+BQ,IAAA,EAC8D,EAA5D,EAAW,EAAmB,EAAY,EAAI,EACjB,EAA7B,EAAS,EAAS,EAkBpB,EACF,EAEE,EAG4B,EAA1B,EAAa,EAqBf,EAWA,E,O,A,E,I,C,S,C,E,O,E,K,E,K,EAhC4B,OAzB1B,EAA4D,AAAA,CAAA,EAAA,KAAK,KAAK,CAAC,AADzE,CAAA,EAAa,SAAS,cAAc,CAAC,mBAArC,EACoF,YAAY,CAAC,eAAA,EAA/F,SAAA,CAAW,EAAiD,EAAjD,UAAA,CAAmB,EAA8B,EAArC,KAAA,CAAmB,EAAkB,EAAlB,EAAA,CAAI,EAAc,EAAd,SAAc,CAC5D,EAA6B,AAAA,CAAA,EAAA,KAAK,KAAK,CAAC,EAAW,YAAY,CAAC,UAAA,EAAhE,OAAA,CAAS,EAAoB,EAApB,OAAA,CAAS,EAAW,EAAX,MAAW,CAGrC,EAAK,OAAO,CAAG,EACf,EAAK,OAAO,CAAG,EACf,EAAK,MAAM,CAAG,EAGd,EAAS,MAAM,CAAG,EAGlB,EAAG,KAAK,CAAC,EAAE,oBACX,EAAG,WAAW,CAAC,UACf,EAAG,MAAM,CAAC,EAAE,0BACZ,EAAG,OAAO,CAAC,EAAE,6BAA8B,CAAE,WAAA,EAAY,MAAO,CAAE,IAClE,EAAG,OAAO,CAAC,IACX,EAAG,QAAQ,CAAC,GAEN,EAAK,KAAK,GAAG,GACf,EAAa,EAEX,EAAa,KAAK,GAAG,CAAC,GAAI,CAAC,EAAW,GAGV,C,EAAM,AI7F3B,SAAA,CAAA,EACb,OAAA,AAAA,EAAA,SAAA,CAAI,E,IACJ,EACA,EACA,EACA,E,E,U,O,A,E,I,C,S,C,EAEA,OALA,EAAA,EAAA,MAAA,CAAA,GAAA,AAAA,KAAA,IAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAa,EACb,EAAA,EAAA,MAAA,CAAA,GAAA,AAAA,KAAA,IAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAS,KACT,EAAA,EAAA,MAAA,CAAA,GAAA,AAAA,KAAA,IAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAmB,KACnB,EAAA,EAAA,MAAA,CAAA,GAAA,AAAA,KAAA,IAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAW,UAAU,mBAAmB,EAAI,EAE5C,C,EAAO,IAAI,QAAQ,SAAC,CAAA,CAAS,CAAtB,EACL,QAAQ,KAAK,CAAC,aACd,IAAM,EAAU,EAAE,CACZ,EAAY,WAChB,EAAQ,OAAO,CAAC,SAAC,CAAjB,EAAuB,OAAA,EAAE,SAAS,E,GACnB,OAAX,IAEF,EAAO,mBAAmB,CAAC,QAAS,GAChC,EAAO,OAAO,GAChB,QAAQ,GAAG,CAAC,eACZ,EAAO,AAAI,MAAM,iBAGvB,CACI,AAAW,QAAX,GACF,EAAO,gBAAgB,CAAC,QAAS,EAAW,CAAE,KAAM,CAAA,CAAK,G,A,E,WAInD,IAAA,EAEG,EACH,E,O,A,E,I,C,S,C,E,O,E,K,E,K,M,EAHoB,MAAA,C,EAAM,M,C,EAAM,I,E,U,C,E,O,C,G,A,M,EAAnB,MAAA,C,EAAO,EAAA,IAAA,GAAmB,WAAW,G,A,M,EAExD,IAAS,EAAI,EAFP,EAAa,EAAb,IAAA,GAEU,EAAI,EAAS,IAG3B,AAFI,CAAA,EAAS,IAAI,OAAb,EAAA,EAEG,SAAS,CAAG,SAAC,CAApB,EACM,AAAsB,UAAtB,OAAO,EAAM,IAAI,CACnB,MAAA,GAAA,EAAmB,EAAM,IAAI,GAE7B,IACA,EAAQ,EAAM,IAAI,EAEtB,EAEA,EAAO,OAAO,CAAG,SAAC,CAAlB,EACE,IACA,EAAO,EACT,EAEA,EAAO,WAAW,CAAC,CACjB,WAAA,EACA,KAAA,EACA,WAAA,EACA,MAAO,EACP,QAAA,CACF,GAEA,EAAQ,IAAI,CAAC,G,M,C,E,A,C,EAEjB,IACF,G,A,EACF,GAAA,KAAA,CAAA,IAAA,CAAA,U,EJmC0B,GAAgB,MAAA,CAAb,EAAU,KAAiB,MAAA,CAAd,EAAW,KAAS,MAAA,CAAN,EAAG,KAAa,MAAA,CAAV,EAAU,KACT,EAAY,KAAM,SAAC,CAAxC,EAMtC,IAAM,EAAc,KAAK,GAAG,CAAC,EAAI,EAAY,GACvC,EAAY,AAAA,CAAA,EAAI,KAAK,GAAG,CAAC,EAAa,EAAA,EAAM,IAI5C,EAAQ,AADF,KAAK,GAAG,GACA,EAEhB,EAAQ,EAAa,MAEvB,EAAG,QAAQ,CAAC,GACZ,EAAG,OAAO,CAAC,EAAE,6BAA8B,CAAE,WAAA,EAAY,MAAO,AAFlD,CAAA,EAAQ,CAAtB,EAEsE,OAAO,CAAC,EAAG,IACjF,EAAG,OAAO,CAAC,EAAc,IAAO,EAAE,2BAA6B,KAAA,GAC/D,EAAa,EAEjB,G,A,M,E,OApBQ,EAA0B,AAAA,CAAA,EAAA,EAAA,IAAA,EAAA,EAA1B,IAAA,CAAa,EAAa,EAApB,KAAoB,CAqB5B,EAAK,KAAK,GAAG,GACnB,QAAQ,GAAG,CAAC,CAAE,KAAA,EAAM,SAAA,CAAS,GAG7B,EAAG,KAAK,CAAC,EAAE,kBACX,EAAG,WAAW,CAAC,QACf,EAAG,MAAM,CAAC,EAAE,kCACZ,EAAG,OAAO,CAAC,EAAE,+BAAgC,CAAE,KAAM,EAAK,EAAI,WAAY,CAAS,IACnF,EAAG,OAAO,CAAC,IACX,EAAG,QAAQ,CAAC,GAEN,EAAO,AAvFf,SAA0B,CAAI,CAAE,CAAQ,CAAE,CAAO,CAAE,CAAK,CAAE,CAAE,CAAE,CAAS,EACrE,SAAS,EAAe,CAAI,CAAE,CAAI,CAAE,CAAK,EACvC,IAAM,EAAQ,SAAS,aAAa,CAAC,QACrC,CAAA,EAAM,IAAI,CAAG,SACb,EAAM,IAAI,CAAG,EACb,EAAM,KAAK,CAAG,EACd,EAAK,WAAW,CAAC,EACnB,CAEA,IAAM,EAAO,SAAS,aAAa,CAAC,QAYpC,OAXA,EAAK,MAAM,CAAG,OACd,EAAK,MAAM,CAAI,GAAU,MAAA,CAAR,EAAQ,WAEzB,EAAe,EAAM,WAAY,GACjC,EAAe,EAAM,WAAY,GACjC,EAAe,EAAM,QAAS,GAC9B,EAAe,EAAM,KAAM,GAC3B,EAAe,EAAM,YAAa,GAClC,EAAe,EAAM,QAAS,OAAO,QAAQ,CAAC,IAAI,EAElD,SAAS,IAAI,CAAC,WAAW,CAAC,GACnB,CACT,EAiEgC,EAAM,EAAU,EAAS,EAAY,EAAI,GACvE,WAAW,WACT,EAAK,MAAM,EACb,EAAG,K,C,E,A,C,EAEL,I","sources":["<anon>","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/@parcel+runtime-js@2.15.1_@parcel+core@2.15.1_@swc+helpers@0.5.17_/node_modules/@parcel/runtime-js/lib/runtime-8d4e8e0fec2137e8.js","main.mjs","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/@swc+helpers@0.5.17/node_modules/@swc/helpers/esm/_async_to_generator.js","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/@swc+helpers@0.5.17/node_modules/@swc/helpers/esm/_type_of.js","pow.mjs","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/@parcel+runtime-js@2.15.1_@parcel+core@2.15.1_@swc+helpers@0.5.17_/node_modules/@parcel/runtime-js/lib/runtime-20c694af779891fe.js","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/@parcel+runtime-js@2.15.1_@parcel+core@2.15.1_@swc+helpers@0.5.17_/node_modules/@parcel/runtime-js/lib/runtime-bb3dbbdf0c599235.js","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/@parcel+runtime-js@2.15.1_@parcel+core@2.15.1_@swc+helpers@0.5.17_/node_modules/@parcel/runtime-js/lib/helpers/get-worker-url.js","node_modules/.pnpm/@messageformat+runtime@3.0.1/node_modules/@messageformat/runtime/esm/messages.js","icu/compiled.mjs"],"sourcesContent":["(function () {\n\nfunction $parcel$extendImportMap(map) {\n Object.assign(parcelRequire.i ??= {}, map);\n}\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nvar $parcel$bundleURL;\nfunction $parcel$resolve(url) {\n url = parcelRequire.i?.[url] || url;\n if (!$parcel$bundleURL) {\n try {\n throw new Error();\n } catch (err) {\n var matches = ('' + err.stack).match(\n /(https?|file|ftp|(chrome|moz|safari-web)-extension):\\/\\/[^)\\n]+/g,\n );\n if (matches) {\n $parcel$bundleURL = matches[0];\n } else {\n return $parcel$distDir + url;\n }\n }\n }\n return new URL($parcel$distDir + url, $parcel$bundleURL).toString();\n}\n\n var $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n var $parcel$distDir = \"./\";\n\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequireec24\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequireec24\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $62804d96ae25d478$exports = {};\n$parcel$extendImportMap({\n \"aykjc\": \"pow_bg.e56bb07e.wasm\",\n \"lyHvT\": \"pow.worker.8c3779b0.js\"\n});\n\n// This file contains code adapted from https://github.com/TecharoHQ/anubis under the MIT License.\nfunction $cf6e67383540718f$var$asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) resolve(value);\n else Promise.resolve(value).then(_next, _throw);\n}\nfunction $cf6e67383540718f$export$71511d61b312f219(fn) {\n return function() {\n var self = this, args = arguments;\n return new Promise(function(resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n $cf6e67383540718f$var$asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n $cf6e67383540718f$var$asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}\n\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ function $67ae305e1674258d$export$71511d61b312f219(obj) {\n \"@swc/helpers - typeof\";\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\n\n\nvar $01ec0fe86f91b5d8$var$extendStatics = function extendStatics1(d, b) {\n $01ec0fe86f91b5d8$var$extendStatics = Object.setPrototypeOf || ({\n __proto__: []\n }) instanceof Array && function(d, b) {\n d.__proto__ = b;\n } || function(d, b) {\n for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n };\n return $01ec0fe86f91b5d8$var$extendStatics(d, b);\n};\nfunction $01ec0fe86f91b5d8$export$a8ba968b8961cb8a(d, b) {\n if (typeof b !== \"function\" && b !== null) throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n $01ec0fe86f91b5d8$var$extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nvar $01ec0fe86f91b5d8$export$18ce0697a983be9b = function __assign1() {\n $01ec0fe86f91b5d8$export$18ce0697a983be9b = Object.assign || function __assign(t) {\n for(var s, i = 1, n = arguments.length; i < n; i++){\n s = arguments[i];\n for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return $01ec0fe86f91b5d8$export$18ce0697a983be9b.apply(this, arguments);\n};\nfunction $01ec0fe86f91b5d8$export$3c9a16f847548506(s, e) {\n var t = {};\n for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") {\n for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nfunction $01ec0fe86f91b5d8$export$29e00dfd3077644b(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if ((typeof Reflect === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(Reflect)) === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nfunction $01ec0fe86f91b5d8$export$d5ad3fd78186038f(paramIndex, decorator) {\n return function(target, key) {\n decorator(target, key, paramIndex);\n };\n}\nfunction $01ec0fe86f91b5d8$export$3a84e1ae4e97e9b0(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) {\n if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\");\n return f;\n }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for(var i = decorators.length - 1; i >= 0; i--){\n var context = {};\n for(var p in contextIn)context[p] = p === \"access\" ? {} : contextIn[p];\n for(var p in contextIn.access)context.access[p] = contextIn.access[p];\n context.addInitializer = function(f) {\n if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\");\n extraInitializers.push(accept(f || null));\n };\n var result = (0, decorators[i])(kind === \"accessor\" ? {\n get: descriptor.get,\n set: descriptor.set\n } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || (typeof result === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(result)) !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n } else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n}\nfunction $01ec0fe86f91b5d8$export$d831c04e792af3d(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for(var i = 0; i < initializers.length; i++)value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n return useValue ? value : void 0;\n}\nfunction $01ec0fe86f91b5d8$export$6a2a36740a146cb8(x) {\n return (typeof x === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(x)) === \"symbol\" ? x : \"\".concat(x);\n}\nfunction $01ec0fe86f91b5d8$export$d1a06452d3489bc7(f, name, prefix) {\n if ((typeof name === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(name)) === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", {\n configurable: true,\n value: prefix ? \"\".concat(prefix, \" \", name) : name\n });\n}\nfunction $01ec0fe86f91b5d8$export$f1db080c865becb9(metadataKey, metadataValue) {\n if ((typeof Reflect === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(Reflect)) === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nfunction $01ec0fe86f91b5d8$export$1050f835b63b671e(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function(resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function(resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nfunction $01ec0fe86f91b5d8$export$67ebef60e6f28a6(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([\n n,\n v\n ]);\n };\n }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while(g && (g = 0, op[0] && (_ = 0)), _)try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [\n op[0] & 2,\n t.value\n ];\n switch(op[0]){\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n case 5:\n _.label++;\n y = op[1];\n op = [\n 0\n ];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [\n 6,\n e\n ];\n y = 0;\n } finally{\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nvar $01ec0fe86f91b5d8$export$45d3717a4c69092e = Object.create ? function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {\n enumerable: true,\n get: function get() {\n return m[k];\n }\n };\n Object.defineProperty(o, k2, desc);\n} : function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n};\nfunction $01ec0fe86f91b5d8$export$f33643c0debef087(m, o) {\n for(var p in m)if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) $01ec0fe86f91b5d8$export$45d3717a4c69092e(o, m, p);\n}\nfunction $01ec0fe86f91b5d8$export$19a8beecd37a4c45(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nfunction $01ec0fe86f91b5d8$export$8d051b38c9118094(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while((n === void 0 || n-- > 0) && !(r = i.next()).done)ar.push(r.value);\n } catch (error) {\n e = {\n error: error\n };\n } finally{\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally{\n if (e) throw e.error;\n }\n }\n return ar;\n}\nfunction $01ec0fe86f91b5d8$export$afc72e2116322959() {\n for(var ar = [], i = 0; i < arguments.length; i++)ar = ar.concat($01ec0fe86f91b5d8$export$8d051b38c9118094(arguments[i]));\n return ar;\n}\nfunction $01ec0fe86f91b5d8$export$6388937ca91ccae8() {\n for(var s = 0, i = 0, il = arguments.length; i < il; i++)s += arguments[i].length;\n for(var r = Array(s), k = 0, i = 0; i < il; i++)for(var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)r[k] = a[j];\n return r;\n}\nfunction $01ec0fe86f91b5d8$export$1216008129fb82ed(to, from, pack) {\n if (pack || arguments.length === 2) {\n for(var i = 0, l = from.length, ar; i < l; i++)if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\nfunction $01ec0fe86f91b5d8$export$10c90e4f7922046c(v) {\n return this instanceof $01ec0fe86f91b5d8$export$10c90e4f7922046c ? (this.v = v, this) : new $01ec0fe86f91b5d8$export$10c90e4f7922046c(v);\n}\nfunction $01ec0fe86f91b5d8$export$e427f37a30a4de9b(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function() {\n return this;\n }, i;\n function awaitReturn(f) {\n return function(v) {\n return Promise.resolve(v).then(f, reject);\n };\n }\n function verb(n, f) {\n if (g[n]) {\n i[n] = function(v) {\n return new Promise(function(a, b) {\n q.push([\n n,\n v,\n a,\n b\n ]) > 1 || resume(n, v);\n });\n };\n if (f) i[n] = f(i[n]);\n }\n }\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n function step(r) {\n r.value instanceof $01ec0fe86f91b5d8$export$10c90e4f7922046c ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n function fulfill(value) {\n resume(\"next\", value);\n }\n function reject(value) {\n resume(\"throw\", value);\n }\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nfunction $01ec0fe86f91b5d8$export$bbd80228419bb833(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function(e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function() {\n return this;\n }, i;\n function verb(n, f) {\n i[n] = o[n] ? function(v) {\n return (p = !p) ? {\n value: $01ec0fe86f91b5d8$export$10c90e4f7922046c(o[n](v)),\n done: false\n } : f ? f(v) : v;\n } : f;\n }\n}\nfunction $01ec0fe86f91b5d8$export$e3b29a3d6162315f(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof $01ec0fe86f91b5d8$export$19a8beecd37a4c45 === \"function\" ? $01ec0fe86f91b5d8$export$19a8beecd37a4c45(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function() {\n return this;\n }, i);\n function verb(n) {\n i[n] = o[n] && function(v) {\n return new Promise(function(resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function(v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nfunction $01ec0fe86f91b5d8$export$4fb47efe1390b86f(cooked, raw) {\n if (Object.defineProperty) Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n else cooked.raw = raw;\n return cooked;\n}\nvar $01ec0fe86f91b5d8$var$__setModuleDefault = Object.create ? function __setModuleDefault(o, v) {\n Object.defineProperty(o, \"default\", {\n enumerable: true,\n value: v\n });\n} : function(o, v) {\n o[\"default\"] = v;\n};\nvar $01ec0fe86f91b5d8$var$ownKeys = function ownKeys1(o) {\n $01ec0fe86f91b5d8$var$ownKeys = Object.getOwnPropertyNames || function(o) {\n var ar = [];\n for(var k in o)if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return $01ec0fe86f91b5d8$var$ownKeys(o);\n};\nfunction $01ec0fe86f91b5d8$export$c21735bcef00d192(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) {\n for(var k = $01ec0fe86f91b5d8$var$ownKeys(mod), i = 0; i < k.length; i++)if (k[i] !== \"default\") $01ec0fe86f91b5d8$export$45d3717a4c69092e(result, mod, k[i]);\n }\n $01ec0fe86f91b5d8$var$__setModuleDefault(result, mod);\n return result;\n}\nfunction $01ec0fe86f91b5d8$export$da59b14a69baef04(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nfunction $01ec0fe86f91b5d8$export$d5dcaf168c640c35(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\nfunction $01ec0fe86f91b5d8$export$d40a35129aaff81f(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;\n}\nfunction $01ec0fe86f91b5d8$export$81fdc39f203e4e04(state, receiver) {\n if (receiver === null || (typeof receiver === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(receiver)) !== \"object\" && typeof receiver !== \"function\") throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\nfunction $01ec0fe86f91b5d8$export$88ac25d8e944e405(env, value, async) {\n if (value !== null && value !== void 0) {\n if ((typeof value === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(value)) !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function dispose() {\n try {\n inner.call(this);\n } catch (e) {\n return Promise.reject(e);\n }\n };\n env.stack.push({\n value: value,\n dispose: dispose,\n async: async\n });\n } else if (async) env.stack.push({\n async: true\n });\n return value;\n}\nvar $01ec0fe86f91b5d8$var$_SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function _SuppressedError(error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\nfunction $01ec0fe86f91b5d8$export$8f076105dc360e92(env) {\n function fail(e) {\n env.error = env.hasError ? new $01ec0fe86f91b5d8$var$_SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while(r = env.stack.pop())try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {\n fail(e);\n return next();\n });\n } else s |= 1;\n } catch (e) {\n fail(e);\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\nfunction $01ec0fe86f91b5d8$export$889dfb5d17574b0b(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : d + ext + \".\" + cm.toLowerCase() + \"js\";\n });\n return path;\n}\nvar $01ec0fe86f91b5d8$export$2e2bcd8739ae039 = {\n __extends: $01ec0fe86f91b5d8$export$a8ba968b8961cb8a,\n __assign: $01ec0fe86f91b5d8$export$18ce0697a983be9b,\n __rest: $01ec0fe86f91b5d8$export$3c9a16f847548506,\n __decorate: $01ec0fe86f91b5d8$export$29e00dfd3077644b,\n __param: $01ec0fe86f91b5d8$export$d5ad3fd78186038f,\n __esDecorate: $01ec0fe86f91b5d8$export$3a84e1ae4e97e9b0,\n __runInitializers: $01ec0fe86f91b5d8$export$d831c04e792af3d,\n __propKey: $01ec0fe86f91b5d8$export$6a2a36740a146cb8,\n __setFunctionName: $01ec0fe86f91b5d8$export$d1a06452d3489bc7,\n __metadata: $01ec0fe86f91b5d8$export$f1db080c865becb9,\n __awaiter: $01ec0fe86f91b5d8$export$1050f835b63b671e,\n __generator: $01ec0fe86f91b5d8$export$67ebef60e6f28a6,\n __createBinding: $01ec0fe86f91b5d8$export$45d3717a4c69092e,\n __exportStar: $01ec0fe86f91b5d8$export$f33643c0debef087,\n __values: $01ec0fe86f91b5d8$export$19a8beecd37a4c45,\n __read: $01ec0fe86f91b5d8$export$8d051b38c9118094,\n __spread: $01ec0fe86f91b5d8$export$afc72e2116322959,\n __spreadArrays: $01ec0fe86f91b5d8$export$6388937ca91ccae8,\n __spreadArray: $01ec0fe86f91b5d8$export$1216008129fb82ed,\n __await: $01ec0fe86f91b5d8$export$10c90e4f7922046c,\n __asyncGenerator: $01ec0fe86f91b5d8$export$e427f37a30a4de9b,\n __asyncDelegator: $01ec0fe86f91b5d8$export$bbd80228419bb833,\n __asyncValues: $01ec0fe86f91b5d8$export$e3b29a3d6162315f,\n __makeTemplateObject: $01ec0fe86f91b5d8$export$4fb47efe1390b86f,\n __importStar: $01ec0fe86f91b5d8$export$c21735bcef00d192,\n __importDefault: $01ec0fe86f91b5d8$export$da59b14a69baef04,\n __classPrivateFieldGet: $01ec0fe86f91b5d8$export$d5dcaf168c640c35,\n __classPrivateFieldSet: $01ec0fe86f91b5d8$export$d40a35129aaff81f,\n __classPrivateFieldIn: $01ec0fe86f91b5d8$export$81fdc39f203e4e04,\n __addDisposableResource: $01ec0fe86f91b5d8$export$88ac25d8e944e405,\n __disposeResources: $01ec0fe86f91b5d8$export$8f076105dc360e92,\n __rewriteRelativeImportExtension: $01ec0fe86f91b5d8$export$889dfb5d17574b0b\n};\n\n\n// This file contains code adapted from https://github.com/TecharoHQ/anubis under the MIT License.\n\n\nvar $66d4361906f4496b$exports = {};\n$66d4361906f4496b$exports = $parcel$resolve(\"aykjc\");\n\n\nvar $7077909a1ae871cf$exports = {};\nvar $0ae13573b5316750$exports = {};\n\"use strict\";\n$0ae13573b5316750$exports = function(workerUrl, origin, isESM) {\n if (origin === self.location.origin) // If the worker bundle's url is on the same origin as the document,\n // use the worker bundle's own url.\n return workerUrl;\n else {\n // Otherwise, create a blob URL which loads the worker bundle with `importScripts`.\n var source = isESM ? 'import ' + JSON.stringify(workerUrl) + ';' : 'importScripts(' + JSON.stringify(workerUrl) + ');';\n return URL.createObjectURL(new Blob([\n source\n ], {\n type: 'application/javascript'\n }));\n }\n};\n\n\nvar $7077909a1ae871cf$var$url = new URL($parcel$resolve(\"lyHvT\"));\n$7077909a1ae871cf$exports = $0ae13573b5316750$exports($7077909a1ae871cf$var$url.toString(), $7077909a1ae871cf$var$url.origin, false);\n\n\nfunction $2b9a098d94c679e8$export$2e2bcd8739ae039(_0) {\n return (/*#__PURE__*/ 0, /*#__PURE__*/ $cf6e67383540718f$export$71511d61b312f219)(function(data) {\n var difficulty, signal, progressCallback, threads;\n var _arguments = arguments;\n return (0, $01ec0fe86f91b5d8$export$67ebef60e6f28a6)(this, function(_state) {\n difficulty = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : 5, signal = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : null, progressCallback = _arguments.length > 3 && _arguments[3] !== void 0 ? _arguments[3] : null, threads = _arguments.length > 4 && _arguments[4] !== void 0 ? _arguments[4] : navigator.hardwareConcurrency || 1;\n return [\n 2,\n new Promise(function(resolve, reject) {\n console.debug(\"fast algo\");\n var workers = [];\n var terminate = function() {\n workers.forEach(function(w) {\n return w.terminate();\n });\n if (signal !== null) {\n // clean up listener to avoid memory leak\n signal.removeEventListener(\"abort\", terminate);\n if (signal.aborted) {\n console.log(\"PoW aborted\");\n reject(new Error(\"PoW aborted\"));\n }\n }\n };\n if (signal !== null) signal.addEventListener(\"abort\", terminate, {\n once: true\n });\n (function() {\n return (/*#__PURE__*/ 0, /*#__PURE__*/ $cf6e67383540718f$export$71511d61b312f219)(function() {\n var wasmModule, i, worker;\n return (0, $01ec0fe86f91b5d8$export$67ebef60e6f28a6)(this, function(_state) {\n switch(_state.label){\n case 0:\n return [\n 4,\n fetch((0, (/*@__PURE__*/$parcel$interopDefault($66d4361906f4496b$exports))))\n ];\n case 1:\n return [\n 4,\n _state.sent().arrayBuffer()\n ];\n case 2:\n wasmModule = _state.sent();\n for(i = 0; i < threads; i++){\n worker = new Worker($7077909a1ae871cf$exports);\n worker.onmessage = function(event) {\n if (typeof event.data === \"number\") progressCallback === null || progressCallback === void 0 ? void 0 : progressCallback(event.data);\n else {\n terminate();\n resolve(event.data);\n }\n };\n worker.onerror = function(event) {\n terminate();\n reject(event);\n };\n worker.postMessage({\n wasmModule: wasmModule,\n data: data,\n difficulty: difficulty,\n nonce: i,\n threads: threads\n });\n workers.push(worker);\n }\n return [\n 2\n ];\n }\n });\n })();\n })();\n })\n ];\n });\n }).apply(this, arguments);\n}\n\n\n/**\n * A collection of runtime utility functions\n *\n * @remarks\n * This package should be marked as a dependency for any package that publishes the output of {@link @messageformat/core#compileModule},\n * as it may be included in its ES module source output as a dependency.\n *\n * For applications that bundle their output using e.g. Webpack this is not necessary.\n *\n * The `Messages` accessor class is a completely optional addition.\n * See also {@link @messageformat/react# | @messageformat/react} for a React-specific solution.\n *\n * @packageDocumentation\n */ /**\n * Accessor class for compiled message functions generated by\n * {@link @messageformat/core#compileModule}\n *\n * @public\n * @remarks\n * ```js\n * import Messages from '@messageformat/runtime/messages'\n * ```\n *\n * @example\n * ```js\n * // build.js\n * import { writeFileSync } from 'fs';\n * import MessageFormat from '@messageformat/core';\n * import compileModule from '@messageformat/core/compile-module'\n *\n * const mf = new MessageFormat(['en', 'fi']);\n * const msgSet = {\n * en: {\n * a: 'A {TYPE} example.',\n * b: 'This has {COUNT, plural, one{one user} other{# users}}.',\n * c: {\n * d: 'We have {P, number, percent} code coverage.'\n * }\n * },\n * fi: {\n * b: 'Tällä on {COUNT, plural, one{yksi käyttäjä} other{# käyttäjää}}.',\n * e: 'Minä puhun vain suomea.'\n * }\n * };\n * writeFileSync('messages.js', compileModule(mf, msgSet));\n * ```\n *\n * ```js\n * // runtime.js\n * import Messages from '@messageformat/runtime/messages';\n * import msgData from './messages';\n *\n * const messages = new Messages(msgData, 'en');\n *\n * messages.hasMessage('a') // true\n * messages.hasObject('c') // true\n * messages.get('b', { COUNT: 3 }) // 'This has 3 users.'\n * messages.get(['c', 'd'], { P: 0.314 }) // 'We have 31% code coverage.'\n *\n * messages.get('e') // 'e'\n * messages.setFallback('en', ['foo', 'fi'])\n * messages.get('e') // 'Minä puhun vain suomea.'\n *\n * messages.locale = 'fi'\n * messages.hasMessage('a') // false\n * messages.hasMessage('a', 'en') // true\n * messages.hasMessage('a', null, true) // true\n * messages.hasObject('c') // false\n * messages.get('b', { COUNT: 3 }) // 'Tällä on 3 käyttäjää.'\n * messages.get('c').d({ P: 0.628 }) // 'We have 63% code coverage.'\n * ```\n */ \nvar $7d2dbc41645dbcab$var$Messages = /** @class */ function() {\n /**\n * @param msgData - A map of locale codes to their function objects\n * @param defaultLocale - If not defined, default and initial locale is the first key of `msgData`\n */ function Messages(msgData, defaultLocale) {\n var _this = this;\n /** @internal */ this._data = {};\n /** @internal */ this._fallback = {};\n /** @internal */ this._defaultLocale = null;\n /** @internal */ this._locale = null;\n Object.keys(msgData).forEach(function(lc) {\n if (lc !== 'toString') {\n _this._data[lc] = msgData[lc];\n if (defaultLocale === undefined) defaultLocale = lc;\n }\n });\n this.locale = defaultLocale || null;\n this._defaultLocale = this.locale;\n }\n Object.defineProperty(Messages.prototype, \"availableLocales\", {\n /** Read-only list of available locales */ get: function get() {\n return Object.keys(this._data);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Messages.prototype, \"locale\", {\n /**\n * Current locale\n *\n * @remarks\n * One of {@link Messages.availableLocales} or `null`.\n * Partial matches of language tags are supported, so e.g. with an `en` locale defined, it will be selected by `messages.locale = 'en-US'` and vice versa.\n */ get: function get() {\n return this._locale;\n },\n set: function set(locale) {\n this._locale = this.resolveLocale(locale);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Messages.prototype, \"defaultLocale\", {\n /**\n * Default fallback locale\n *\n * @remarks\n * One of {@link Messages.availableLocales} or `null`.\n * Partial matches of language tags are supported, so e.g. with an `en` locale defined, it will be selected by `messages.defaultLocale = 'en-US'` and vice versa.\n */ get: function get() {\n return this._defaultLocale;\n },\n set: function set(locale) {\n this._defaultLocale = this.resolveLocale(locale);\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Add new messages to the accessor; useful if loading data dynamically\n *\n * @remarks\n * The locale code `lc` should be an exact match for the locale being updated, or empty to default to the current locale.\n * Use {@link Messages.resolveLocale} for resolving partial locale strings.\n *\n * If `keypath` is empty, adds or sets the complete message object for the corresponding locale.\n * If any keys in `keypath` do not exist, a new object will be created at that key.\n *\n * @param data - Hierarchical map of keys to functions, or a single message function\n * @param locale - If empty or undefined, defaults to `this.locale`\n * @param keypath - The keypath being added\n */ Messages.prototype.addMessages = function(data, locale, keypath) {\n var lc = locale || String(this.locale);\n if (typeof data !== 'function') data = Object.keys(data).reduce(function(map, key) {\n if (key !== 'toString') map[key] = data[key];\n return map;\n }, {});\n if (Array.isArray(keypath) && keypath.length > 0) {\n var parent_1 = this._data[lc];\n for(var i = 0; i < keypath.length - 1; ++i){\n var key = keypath[i];\n if (!parent_1[key]) parent_1[key] = {};\n parent_1 = parent_1[key];\n }\n parent_1[keypath[keypath.length - 1]] = data;\n } else this._data[lc] = data;\n return this;\n };\n /**\n * Resolve `lc` to the key of an available locale or `null`, allowing for partial matches.\n *\n * @remarks\n * For example, with an `en` locale defined, it will be selected by `messages.defaultLocale = 'en-US'` and vice versa.\n */ Messages.prototype.resolveLocale = function(locale) {\n var lc = String(locale);\n if (this._data[lc]) return locale;\n if (locale) {\n while(lc = lc.replace(/[-_]?[^-_]*$/, '')){\n if (this._data[lc]) return lc;\n }\n var ll = this.availableLocales;\n var re = new RegExp('^' + locale + '[-_]');\n for(var i = 0; i < ll.length; ++i){\n if (re.test(ll[i])) return ll[i];\n }\n }\n return null;\n };\n /**\n * Get the list of fallback locales\n *\n * @param locale - If empty or undefined, defaults to `this.locale`\n */ Messages.prototype.getFallback = function(locale) {\n var lc = locale || String(this.locale);\n return this._fallback[lc] || (lc === this.defaultLocale || !this.defaultLocale ? [] : [\n this.defaultLocale\n ]);\n };\n /**\n * Set the fallback locale or locales for `lc`\n *\n * @remarks\n * To disable fallback for the locale, use `setFallback(lc, [])`.\n * To use the default fallback, use `setFallback(lc, null)`.\n */ Messages.prototype.setFallback = function(lc, fallback) {\n this._fallback[lc] = Array.isArray(fallback) ? fallback : null;\n return this;\n };\n /**\n * Check if `key` is a message function for the locale\n *\n * @remarks\n * `key` may be a `string` for functions at the root level, or `string[]` for\n * accessing hierarchical objects. If an exact match is not found and\n * `fallback` is true, the fallback locales are checked for the first match.\n *\n * @param key - The key or keypath being sought\n * @param locale - If empty or undefined, defaults to `this.locale`\n * @param fallback - If true, also checks fallback locales\n */ Messages.prototype.hasMessage = function(key, locale, fallback) {\n var lc = locale || String(this.locale);\n var fb = fallback ? this.getFallback(lc) : null;\n return $7d2dbc41645dbcab$var$_has(this._data, lc, key, fb, 'function');\n };\n /**\n * Check if `key` is a message object for the locale\n *\n * @remarks\n * `key` may be a `string` for functions at the root level, or `string[]` for\n * accessing hierarchical objects. If an exact match is not found and\n * `fallback` is true, the fallback locales are checked for the first match.\n *\n * @param key - The key or keypath being sought\n * @param locale - If empty or undefined, defaults to `this.locale`\n * @param fallback - If true, also checks fallback locales\n */ Messages.prototype.hasObject = function(key, locale, fallback) {\n var lc = locale || String(this.locale);\n var fb = fallback ? this.getFallback(lc) : null;\n return $7d2dbc41645dbcab$var$_has(this._data, lc, key, fb, 'object');\n };\n /**\n * Get the message or object corresponding to `key`\n *\n * @remarks\n * `key` may be a `string` for functions at the root level, or `string[]` for accessing hierarchical objects.\n * If an exact match is not found, the fallback locales are checked for the first match.\n *\n * If `key` maps to a message function, the returned value will be the result of calling it with `props`.\n * If it maps to an object, the object is returned directly.\n * If nothing is found, `key` is returned.\n *\n * @param key - The key or keypath being sought\n * @param props - Optional properties passed to the function\n * @param lc - If empty or undefined, defaults to `this.locale`\n */ Messages.prototype.get = function(key, props, locale) {\n var lc = locale || String(this.locale);\n var msg = $7d2dbc41645dbcab$var$_get(this._data[lc], key);\n if (msg) return typeof msg == 'function' ? msg(props) : msg;\n var fb = this.getFallback(lc);\n for(var i = 0; i < fb.length; ++i){\n msg = $7d2dbc41645dbcab$var$_get(this._data[fb[i]], key);\n if (msg) return typeof msg == 'function' ? msg(props) : msg;\n }\n return key;\n };\n return Messages;\n}();\nvar $7d2dbc41645dbcab$export$2e2bcd8739ae039 = $7d2dbc41645dbcab$var$Messages;\nfunction $7d2dbc41645dbcab$var$_get(obj, key) {\n if (!obj) return null;\n var res = obj;\n if (Array.isArray(key)) {\n for(var i = 0; i < key.length; ++i){\n if ((typeof res === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(res)) !== 'object') return null;\n res = res[key[i]];\n if (!res) return null;\n }\n return res;\n }\n return (typeof res === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(res)) === 'object' ? res[key] : null;\n}\nfunction $7d2dbc41645dbcab$var$_has(data, lc, key, fallback, type) {\n var msg = $7d2dbc41645dbcab$var$_get(data[lc], key);\n if (msg) return (typeof msg === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(msg)) === type;\n if (fallback) for(var i = 0; i < fallback.length; ++i){\n msg = $7d2dbc41645dbcab$var$_get(data[fallback[i]], key);\n if (msg) return (typeof msg === \"undefined\" ? \"undefined\" : (0, $67ae305e1674258d$export$71511d61b312f219)(msg)) === type;\n }\n return false;\n}\n\n\nvar $2442b2bff5a8bcca$export$2e2bcd8739ae039 = {\n zh: {\n challenge: {\n title: function() {\n return \"\\u9A8C\\u8BC1\\u60A8\\u4E0D\\u662F\\u673A\\u5668\\u4EBA\";\n },\n calculating: function() {\n return \"\\u6B63\\u5728\\u8FDB\\u884C\\u6D4F\\u89C8\\u5668\\u68C0\\u67E5...\";\n },\n difficulty_speed: function(d) {\n return \"\\u96BE\\u5EA6\\uFF1A\" + d.difficulty + \"\\uFF0C\\u901F\\u5EA6\\uFF1A\" + d.speed + \"kH/s\";\n },\n taking_longer: function() {\n return \"\\u9A8C\\u8BC1\\u65F6\\u95F4\\u8D85\\u51FA\\u9884\\u671F\\uFF0C\\u8BF7\\u52FF\\u5237\\u65B0\\u9875\\u9762\";\n },\n why_seeing: function() {\n return \"\\u4E3A\\u4EC0\\u4E48\\u6211\\u4F1A\\u770B\\u5230\\u8FD9\\u4E2A\\u9875\\u9762\\uFF1F\";\n },\n why_seeing_body: {\n part_1: function(d) {\n return \"\\u60A8\\u770B\\u5230\\u8FD9\\u4E2A\\u9875\\u9762\\u662F\\u56E0\\u4E3A\\u7F51\\u7AD9\\u7BA1\\u7406\\u5458\\u542F\\u7528\\u4E86 \" + d.cerberus + \" \\u6765\\u9632\\u5FA1\\u5F02\\u5E38\\u6D41\\u91CF\\u653B\\u51FB\\u3002\\u8FD9\\u7C7B\\u653B\\u51FB\\u53EF\\u80FD\\u5BFC\\u81F4\\u7F51\\u7AD9\\u670D\\u52A1\\u4E2D\\u65AD\\uFF0C\\u5F71\\u54CD\\u6240\\u6709\\u7528\\u6237\\u7684\\u6B63\\u5E38\\u8BBF\\u95EE\\u3002\";\n },\n part_2: function(d) {\n return \"\\u5982\\u679C\\u60A8\\u4E86\\u89E3 \" + d.techaro + \" \\u5F00\\u53D1\\u7684 \" + d.anubis + \"\\uFF0C\\u90A3\\u4E48 Cerberus \\u91C7\\u7528\\u4E86\\u7C7B\\u4F3C\\u7684 PoW \\u9A8C\\u8BC1\\u6280\\u672F\\u3002\\u4E0D\\u540C\\u7684\\u662F\\uFF0CAnubis \\u4E3B\\u8981\\u9488\\u5BF9 AI \\u722C\\u866B\\uFF0C\\u800C Cerberus \\u5219\\u91C7\\u7528\\u4E86\\u66F4\\u6FC0\\u8FDB\\u7684\\u7B56\\u7565\\u6765\\u4FDD\\u62A4\\u6211\\u4EEC\\u7684\\u5F00\\u6E90\\u57FA\\u7840\\u8BBE\\u65BD\\u3002\";\n },\n part_3: function(d) {\n return \"\\u8BF7\\u6CE8\\u610F\\uFF0CCerberus \\u9700\\u8981\\u542F\\u7528\\u73B0\\u4EE3 JavaScript \\u529F\\u80FD\\uFF0C\\u800C \" + d.jshelter + \" \\u7B49\\u63D2\\u4EF6\\u4F1A\\u7981\\u7528\\u8FD9\\u4E9B\\u529F\\u80FD\\u3002\\u8BF7\\u4E3A\\u672C\\u57DF\\u540D\\u7981\\u7528 \" + d.jshelter + \" \\u6216\\u7C7B\\u4F3C\\u7684\\u63D2\\u4EF6\\u3002\";\n }\n },\n must_enable_js: function() {\n return \"\\u8BF7\\u542F\\u7528 JavaScript \\u4EE5\\u7EE7\\u7EED\\u8BBF\\u95EE\";\n }\n },\n success: {\n title: function() {\n return \"\\u9A8C\\u8BC1\\u6210\\u529F\";\n },\n verification_complete: function() {\n return \"\\u9A8C\\u8BC1\\u5DF2\\u5B8C\\u6210\";\n },\n took_time_iterations: function(d) {\n return \"\\u7528\\u65F6 \" + d.time + \"ms\\uFF0C\\u5B8C\\u6210 \" + d.iterations + \" \\u6B21\\u8FED\\u4EE3\";\n }\n },\n error: {\n error_occurred: function() {\n return \"\\u53D1\\u751F\\u9519\\u8BEF\";\n },\n access_restricted: function() {\n return \"\\u8BBF\\u95EE\\u53D7\\u9650\";\n },\n browser_config_or_bug: function() {\n return \"\\u53EF\\u80FD\\u662F\\u6D4F\\u89C8\\u5668\\u914D\\u7F6E\\u95EE\\u9898\\uFF0C\\u4E5F\\u53EF\\u80FD\\u662F\\u6211\\u4EEC\\u7684\\u7CFB\\u7EDF\\u51FA\\u73B0\\u4E86\\u5F02\\u5E38\";\n },\n ip_blocked: function() {\n return \"\\u7531\\u4E8E\\u68C0\\u6D4B\\u5230\\u53EF\\u7591\\u6D3B\\u52A8\\uFF0C\\u60A8\\u7684 IP \\u5730\\u5740\\u6216\\u672C\\u5730\\u7F51\\u7EDC\\u5DF2\\u88AB\\u5C01\\u7981\";\n },\n wait_before_retry: function() {\n return \"\\u8BF7\\u7A0D\\u540E\\u518D\\u8BD5\\uFF0C\\u67D0\\u4E9B\\u60C5\\u51B5\\u4E0B\\u53EF\\u80FD\\u9700\\u8981\\u7B49\\u5F85\\u6570\\u5C0F\\u65F6\";\n },\n contact_us: function(d) {\n return \"\\u5982\\u6709\\u95EE\\u9898\\uFF0C\\u8BF7\\u901A\\u8FC7 \" + d.mail + \" \\u8054\\u7CFB\\u6211\\u4EEC\\u3002\\u8BF7\\u9644\\u4E0A\\u4E0B\\u65B9\\u663E\\u793A\\u7684 request ID\\uFF0C\\u4EE5\\u4FBF\\u6211\\u4EEC\\u8FDB\\u884C\\u6392\\u67E5\\u3002\";\n }\n },\n footer: {\n author: function(d) {\n return \"\\u7531 \" + d.sjtug + \" \\u5F00\\u53D1\\u7684 \" + d.cerberus + \" \\u63D0\\u4F9B\\u4FDD\\u62A4\";\n },\n upstream: function(d) {\n return \"\\u7075\\u611F\\u6765\\u6E90\\u4E8E \\uD83C\\uDDE8\\uD83C\\uDDE6 \" + d.techaro + \" \\u5F00\\u53D1\\u7684 \" + d.anubis;\n }\n }\n },\n en: {\n challenge: {\n title: function() {\n return \"Making sure you're not a bot!\";\n },\n calculating: function() {\n return \"Performing browser checks...\";\n },\n difficulty_speed: function(d) {\n return \"Difficulty: \" + d.difficulty + \", Speed: \" + d.speed + \"kH/s\";\n },\n taking_longer: function() {\n return \"This is taking longer than expected. Please do not refresh the page.\";\n },\n why_seeing: function() {\n return \"Why am I seeing this?\";\n },\n why_seeing_body: {\n part_1: function(d) {\n return \"You are seeing this because the administrator of this website has set up \" + d.cerberus + \" to protect the server against abusive traffic. This can and does cause downtime for the websites, which makes their resources inaccessible for everyone.\";\n },\n part_2: function(d) {\n return \"If you're familiar with \" + d.anubis + \" by \" + d.techaro + \", Cerberus is similar - it performs a PoW challenge to verify the request. While Anubis focuses on protecting websites from AI scrapers, Cerberus takes a much more aggressive approach to protect our open-source infrastructure.\";\n },\n part_3: function(d) {\n return \"Please note that Cerberus requires the use of modern JavaScript features that plugins like \" + d.jshelter + \" will disable. Please disable \" + d.jshelter + \" or other such plugins for this domain.\";\n }\n },\n must_enable_js: function() {\n return \"You must enable JavaScript to proceed.\";\n }\n },\n success: {\n title: function() {\n return \"Success!\";\n },\n verification_complete: function() {\n return \"Verification Complete!\";\n },\n took_time_iterations: function(d) {\n return \"Took \" + d.time + \"ms, \" + d.iterations + \" iterations\";\n }\n },\n error: {\n error_occurred: function() {\n return \"Error occurred while processing your request\";\n },\n access_restricted: function() {\n return \"Access has been restricted\";\n },\n browser_config_or_bug: function() {\n return \"There might be an issue with your browser configuration, or something is wrong on our side.\";\n },\n ip_blocked: function() {\n return \"You (or your local network) have been blocked due to suspicious activity.\";\n },\n wait_before_retry: function() {\n return \"Please wait a while before you try again; in some cases this may take a few hours.\";\n },\n contact_us: function(d) {\n return \"If you believe this is an error, please contact us at \" + d.mail + \". Attach the request ID shown below to help us investigate.\";\n }\n },\n footer: {\n author: function(d) {\n return \"Protected by \" + d.cerberus + \" from \" + d.sjtug + \".\";\n },\n upstream: function(d) {\n return \"Heavily inspired by \" + d.anubis + \" from \" + d.techaro + \" in \\uD83C\\uDDE8\\uD83C\\uDDE6.\";\n }\n }\n }\n};\n\n\nvar $879896b395956ce6$var$messages = new (0, $7d2dbc41645dbcab$export$2e2bcd8739ae039)((0, $2442b2bff5a8bcca$export$2e2bcd8739ae039));\nconsole.log($879896b395956ce6$var$messages.locale, $879896b395956ce6$var$messages.availableLocales);\nfunction $879896b395956ce6$var$t(key, props) {\n return $879896b395956ce6$var$messages.get(key.split('.'), props);\n}\nvar $879896b395956ce6$var$meta = {\n baseURL: \"\",\n version: \"\",\n locale: \"\"\n};\nvar $879896b395956ce6$var$dom = {\n title: document.getElementById('title'),\n mascot: document.getElementById('mascot'),\n status: document.getElementById('status'),\n metrics: document.getElementById('metrics'),\n message: document.getElementById('message'),\n progressContainer: document.getElementById('progress-container'),\n progressBar: document.getElementById('progress-bar')\n};\nvar $879896b395956ce6$var$ui = {\n title: function(title) {\n return $879896b395956ce6$var$dom.title.textContent = title;\n },\n mascotState: function(state) {\n return $879896b395956ce6$var$dom.mascot.src = \"\".concat($879896b395956ce6$var$meta.baseURL, \"/static/img/mascot-\").concat(state, \".png?v=\").concat($879896b395956ce6$var$meta.version);\n },\n status: function(status) {\n return $879896b395956ce6$var$dom.status.textContent = status;\n },\n metrics: function(metrics) {\n return $879896b395956ce6$var$dom.metrics.textContent = metrics;\n },\n message: function(message) {\n return $879896b395956ce6$var$dom.message.textContent = message;\n },\n progress: function(progress) {\n $879896b395956ce6$var$dom.progressContainer.classList.toggle('hidden', !progress);\n $879896b395956ce6$var$dom.progressBar.style.width = \"\".concat(progress, \"%\");\n }\n};\nfunction $879896b395956ce6$var$createAnswerForm(hash, solution, baseURL, nonce, ts, signature) {\n function addHiddenInput(form, name, value) {\n var input = document.createElement('input');\n input.type = 'hidden';\n input.name = name;\n input.value = value;\n form.appendChild(input);\n }\n var form = document.createElement('form');\n form.method = 'POST';\n form.action = \"\".concat(baseURL, \"/answer\");\n addHiddenInput(form, 'response', hash);\n addHiddenInput(form, 'solution', solution);\n addHiddenInput(form, 'nonce', nonce);\n addHiddenInput(form, 'ts', ts);\n addHiddenInput(form, 'signature', signature);\n addHiddenInput(form, 'redir', window.location.href);\n document.body.appendChild(form);\n return form;\n}\n(function() {\n return (/*#__PURE__*/ 0, /*#__PURE__*/ $cf6e67383540718f$export$71511d61b312f219)(function() {\n var thisScript, _JSON_parse, challenge, difficulty, inputNonce, ts, signature, _JSON_parse1, baseURL, version, locale, t0, lastUpdate, likelihood, mergedChallenge, _ref, hash, solution, t1, form;\n return (0, $01ec0fe86f91b5d8$export$67ebef60e6f28a6)(this, function(_state) {\n switch(_state.label){\n case 0:\n // const image = document.getElementById('image');\n // const spinner = document.getElementById('spinner');\n // const anubisVersion = JSON.parse(document.getElementById('anubis_version').textContent);\n thisScript = document.getElementById('challenge-script');\n _JSON_parse = JSON.parse(thisScript.getAttribute('x-challenge')), challenge = _JSON_parse.challenge, difficulty = _JSON_parse.difficulty, inputNonce = _JSON_parse.nonce, ts = _JSON_parse.ts, signature = _JSON_parse.signature;\n _JSON_parse1 = JSON.parse(thisScript.getAttribute('x-meta')), baseURL = _JSON_parse1.baseURL, version = _JSON_parse1.version, locale = _JSON_parse1.locale;\n // Initialize UI\n $879896b395956ce6$var$meta.baseURL = baseURL;\n $879896b395956ce6$var$meta.version = version;\n $879896b395956ce6$var$meta.locale = locale;\n // Set locale\n $879896b395956ce6$var$messages.locale = locale;\n // Set initial checking state\n $879896b395956ce6$var$ui.title($879896b395956ce6$var$t('challenge.title'));\n $879896b395956ce6$var$ui.mascotState('puzzle');\n $879896b395956ce6$var$ui.status($879896b395956ce6$var$t('challenge.calculating'));\n $879896b395956ce6$var$ui.metrics($879896b395956ce6$var$t('challenge.difficulty_speed', {\n difficulty: difficulty,\n speed: 0\n }));\n $879896b395956ce6$var$ui.message('');\n $879896b395956ce6$var$ui.progress(0);\n t0 = Date.now();\n lastUpdate = 0;\n likelihood = Math.pow(16, -difficulty / 2);\n mergedChallenge = \"\".concat(challenge, \"|\").concat(inputNonce, \"|\").concat(ts, \"|\").concat(signature, \"|\");\n return [\n 4,\n (0, $2b9a098d94c679e8$export$2e2bcd8739ae039)(mergedChallenge, difficulty, null, function(iters) {\n // the probability of still being on the page is (1 - likelihood) ^ iters.\n // by definition, half of the time the progress bar only gets to half, so\n // apply a polynomial ease-out function to move faster in the beginning\n // and then slow down as things get increasingly unlikely. quadratic felt\n // the best in testing, but this may need adjustment in the future.\n var probability = Math.pow(1 - likelihood, iters);\n var distance = (1 - Math.pow(probability, 2)) * 100;\n // Update progress every 200ms\n var now = Date.now();\n var delta = now - t0;\n if (delta - lastUpdate > 200) {\n var speed = iters / delta;\n $879896b395956ce6$var$ui.progress(distance);\n $879896b395956ce6$var$ui.metrics($879896b395956ce6$var$t('challenge.difficulty_speed', {\n difficulty: difficulty,\n speed: speed.toFixed(3)\n }));\n $879896b395956ce6$var$ui.message(probability < 0.01 ? $879896b395956ce6$var$t('challenge.taking_longer') : undefined);\n lastUpdate = delta;\n }\n })\n ];\n case 1:\n _ref = _state.sent(), hash = _ref.hash, solution = _ref.nonce;\n t1 = Date.now();\n console.log({\n hash: hash,\n solution: solution\n });\n // Show success state\n $879896b395956ce6$var$ui.title($879896b395956ce6$var$t('success.title'));\n $879896b395956ce6$var$ui.mascotState('pass');\n $879896b395956ce6$var$ui.status($879896b395956ce6$var$t('success.verification_complete'));\n $879896b395956ce6$var$ui.metrics($879896b395956ce6$var$t('success.took_time_iterations', {\n time: t1 - t0,\n iterations: solution\n }));\n $879896b395956ce6$var$ui.message('');\n $879896b395956ce6$var$ui.progress(0);\n form = $879896b395956ce6$var$createAnswerForm(hash, solution, baseURL, inputNonce, ts, signature);\n setTimeout(function() {\n form.submit();\n }, 250);\n return [\n 2\n ];\n }\n });\n })();\n})();\n\n})();\n//# sourceMappingURL=main.js.map\n","parcelRequire.extendImportMap({\"aykjc\":\"pow_bg.e56bb07e.wasm\",\"lyHvT\":\"pow.worker.8c3779b0.js\"});","// This file contains code adapted from https://github.com/TecharoHQ/anubis under the MIT License.\n\nimport pow from \"./pow.mjs\";\nimport Messages from \"@messageformat/runtime/messages\"\nimport msgData from \"./icu/compiled.mjs\"\n\nconst messages = new Messages(msgData)\nconsole.log(messages.locale, messages.availableLocales);\n\nfunction t(key, props) {\n return messages.get(key.split('.'), props)\n}\n\nconst meta = {\n baseURL: \"\",\n version: \"\",\n locale: \"\"\n}\n\nconst dom = {\n title: document.getElementById('title'),\n mascot: document.getElementById('mascot'),\n status: document.getElementById('status'),\n metrics: document.getElementById('metrics'),\n message: document.getElementById('message'),\n progressContainer: document.getElementById('progress-container'),\n progressBar: document.getElementById('progress-bar')\n}\n\nconst ui = {\n title: (title) => dom.title.textContent = title,\n mascotState: (state) => dom.mascot.src = `${meta.baseURL}/static/img/mascot-${state}.png?v=${meta.version}`,\n status: (status) => dom.status.textContent = status,\n metrics: (metrics) => dom.metrics.textContent = metrics,\n message: (message) => dom.message.textContent = message,\n progress: (progress) => {\n dom.progressContainer.classList.toggle('hidden', !progress);\n dom.progressBar.style.width = `${progress}%`;\n }\n}\n\nfunction createAnswerForm(hash, solution, baseURL, nonce, ts, signature) {\n function addHiddenInput(form, name, value) {\n const input = document.createElement('input');\n input.type = 'hidden';\n input.name = name;\n input.value = value;\n form.appendChild(input);\n }\n\n const form = document.createElement('form');\n form.method = 'POST';\n form.action = `${baseURL}/answer`;\n\n addHiddenInput(form, 'response', hash);\n addHiddenInput(form, 'solution', solution);\n addHiddenInput(form, 'nonce', nonce);\n addHiddenInput(form, 'ts', ts);\n addHiddenInput(form, 'signature', signature);\n addHiddenInput(form, 'redir', window.location.href);\n\n document.body.appendChild(form);\n return form;\n}\n\n(async () => {\n // const image = document.getElementById('image');\n // const spinner = document.getElementById('spinner');\n // const anubisVersion = JSON.parse(document.getElementById('anubis_version').textContent);\n\n const thisScript = document.getElementById('challenge-script');\n const { challenge, difficulty, nonce: inputNonce, ts, signature } = JSON.parse(thisScript.getAttribute('x-challenge'));\n const { baseURL, version, locale } = JSON.parse(thisScript.getAttribute('x-meta'));\n\n // Initialize UI\n meta.baseURL = baseURL;\n meta.version = version;\n meta.locale = locale;\n\n // Set locale\n messages.locale = locale;\n\n // Set initial checking state\n ui.title(t('challenge.title'));\n ui.mascotState('puzzle');\n ui.status(t('challenge.calculating'));\n ui.metrics(t('challenge.difficulty_speed', { difficulty, speed: 0 }));\n ui.message('');\n ui.progress(0);\n\n const t0 = Date.now();\n let lastUpdate = 0;\n\n const likelihood = Math.pow(16, -difficulty/2);\n\n const mergedChallenge = `${challenge}|${inputNonce}|${ts}|${signature}|`;\n const { hash, nonce: solution } = await pow(mergedChallenge, difficulty, null, (iters) => {\n // the probability of still being on the page is (1 - likelihood) ^ iters.\n // by definition, half of the time the progress bar only gets to half, so\n // apply a polynomial ease-out function to move faster in the beginning\n // and then slow down as things get increasingly unlikely. quadratic felt\n // the best in testing, but this may need adjustment in the future.\n const probability = Math.pow(1 - likelihood, iters);\n const distance = (1 - Math.pow(probability, 2)) * 100;\n\n // Update progress every 200ms\n const now = Date.now();\n const delta = now - t0;\n\n if (delta - lastUpdate > 200) {\n const speed = iters / delta;\n ui.progress(distance);\n ui.metrics(t('challenge.difficulty_speed', { difficulty, speed: speed.toFixed(3) }));\n ui.message(probability < 0.01 ? t('challenge.taking_longer') : undefined);\n lastUpdate = delta;\n };\n });\n const t1 = Date.now();\n console.log({ hash, solution });\n\n // Show success state\n ui.title(t('success.title'));\n ui.mascotState('pass');\n ui.status(t('success.verification_complete'));\n ui.metrics(t('success.took_time_iterations', { time: t1 - t0, iterations: solution }));\n ui.message('');\n ui.progress(0);\n\n const form = createAnswerForm(hash, solution, baseURL, inputNonce, ts, signature);\n setTimeout(() => {\n form.submit();\n }, 250);\n\n})();","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) resolve(value);\n else Promise.resolve(value).then(_next, _throw);\n}\nfunction _async_to_generator(fn) {\n return function() {\n var self = this, args = arguments;\n\n return new Promise(function(resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\nexport { _async_to_generator as _ };\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","function _type_of(obj) {\n \"@swc/helpers - typeof\";\n\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nexport { _type_of as _ };\n","// This file contains code adapted from https://github.com/TecharoHQ/anubis under the MIT License.\nimport wasm from 'url:pow-wasm/pow_bg.wasm';\n\nexport default async function process(\n data,\n difficulty = 5,\n signal = null,\n progressCallback = null,\n threads = (navigator.hardwareConcurrency || 1),\n) {\n return new Promise((resolve, reject) => {\n console.debug(\"fast algo\");\n const workers = [];\n const terminate = () => {\n workers.forEach((w) => w.terminate());\n if (signal !== null) {\n // clean up listener to avoid memory leak\n signal.removeEventListener(\"abort\", terminate);\n if (signal.aborted) {\n console.log(\"PoW aborted\");\n reject(new Error(\"PoW aborted\"));\n }\n }\n };\n if (signal !== null) {\n signal.addEventListener(\"abort\", terminate, { once: true });\n }\n\n (async () => {\n const wasmModule = await (await fetch(wasm)).arrayBuffer();\n\n for (let i = 0; i < threads; i++) {\n let worker = new Worker(new URL(\"./pow.worker.js\", import.meta.url), { type: \"module\" });\n\n worker.onmessage = (event) => {\n if (typeof event.data === \"number\") {\n progressCallback?.(event.data);\n } else {\n terminate();\n resolve(event.data);\n }\n };\n\n worker.onerror = (event) => {\n terminate();\n reject(event);\n };\n\n worker.postMessage({\n wasmModule,\n data,\n difficulty,\n nonce: i,\n threads,\n });\n\n workers.push(worker);\n }\n })();\n });\n}","module.exports = parcelRequire.resolve(\"aykjc\");","let workerURL = require('./helpers/get-worker-url');\nlet url = new URL(parcelRequire.resolve(\"lyHvT\"));\nmodule.exports = workerURL(url.toString(), url.origin, false);","\"use strict\";\n\nmodule.exports = function (workerUrl, origin, isESM) {\n if (origin === self.location.origin) {\n // If the worker bundle's url is on the same origin as the document,\n // use the worker bundle's own url.\n return workerUrl;\n } else {\n // Otherwise, create a blob URL which loads the worker bundle with `importScripts`.\n var source = isESM ? 'import ' + JSON.stringify(workerUrl) + ';' : 'importScripts(' + JSON.stringify(workerUrl) + ');';\n return URL.createObjectURL(new Blob([source], {\n type: 'application/javascript'\n }));\n }\n};","/**\n * A collection of runtime utility functions\n *\n * @remarks\n * This package should be marked as a dependency for any package that publishes the output of {@link @messageformat/core#compileModule},\n * as it may be included in its ES module source output as a dependency.\n *\n * For applications that bundle their output using e.g. Webpack this is not necessary.\n *\n * The `Messages` accessor class is a completely optional addition.\n * See also {@link @messageformat/react# | @messageformat/react} for a React-specific solution.\n *\n * @packageDocumentation\n */\n/**\n * Accessor class for compiled message functions generated by\n * {@link @messageformat/core#compileModule}\n *\n * @public\n * @remarks\n * ```js\n * import Messages from '@messageformat/runtime/messages'\n * ```\n *\n * @example\n * ```js\n * // build.js\n * import { writeFileSync } from 'fs';\n * import MessageFormat from '@messageformat/core';\n * import compileModule from '@messageformat/core/compile-module'\n *\n * const mf = new MessageFormat(['en', 'fi']);\n * const msgSet = {\n * en: {\n * a: 'A {TYPE} example.',\n * b: 'This has {COUNT, plural, one{one user} other{# users}}.',\n * c: {\n * d: 'We have {P, number, percent} code coverage.'\n * }\n * },\n * fi: {\n * b: 'Tällä on {COUNT, plural, one{yksi käyttäjä} other{# käyttäjää}}.',\n * e: 'Minä puhun vain suomea.'\n * }\n * };\n * writeFileSync('messages.js', compileModule(mf, msgSet));\n * ```\n *\n * ```js\n * // runtime.js\n * import Messages from '@messageformat/runtime/messages';\n * import msgData from './messages';\n *\n * const messages = new Messages(msgData, 'en');\n *\n * messages.hasMessage('a') // true\n * messages.hasObject('c') // true\n * messages.get('b', { COUNT: 3 }) // 'This has 3 users.'\n * messages.get(['c', 'd'], { P: 0.314 }) // 'We have 31% code coverage.'\n *\n * messages.get('e') // 'e'\n * messages.setFallback('en', ['foo', 'fi'])\n * messages.get('e') // 'Minä puhun vain suomea.'\n *\n * messages.locale = 'fi'\n * messages.hasMessage('a') // false\n * messages.hasMessage('a', 'en') // true\n * messages.hasMessage('a', null, true) // true\n * messages.hasObject('c') // false\n * messages.get('b', { COUNT: 3 }) // 'Tällä on 3 käyttäjää.'\n * messages.get('c').d({ P: 0.628 }) // 'We have 63% code coverage.'\n * ```\n */\nvar Messages = /** @class */ (function () {\n /**\n * @param msgData - A map of locale codes to their function objects\n * @param defaultLocale - If not defined, default and initial locale is the first key of `msgData`\n */\n function Messages(msgData, defaultLocale) {\n var _this = this;\n /** @internal */\n this._data = {};\n /** @internal */\n this._fallback = {};\n /** @internal */\n this._defaultLocale = null;\n /** @internal */\n this._locale = null;\n Object.keys(msgData).forEach(function (lc) {\n if (lc !== 'toString') {\n _this._data[lc] = msgData[lc];\n if (defaultLocale === undefined)\n defaultLocale = lc;\n }\n });\n this.locale = defaultLocale || null;\n this._defaultLocale = this.locale;\n }\n Object.defineProperty(Messages.prototype, \"availableLocales\", {\n /** Read-only list of available locales */\n get: function () {\n return Object.keys(this._data);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Messages.prototype, \"locale\", {\n /**\n * Current locale\n *\n * @remarks\n * One of {@link Messages.availableLocales} or `null`.\n * Partial matches of language tags are supported, so e.g. with an `en` locale defined, it will be selected by `messages.locale = 'en-US'` and vice versa.\n */\n get: function () {\n return this._locale;\n },\n set: function (locale) {\n this._locale = this.resolveLocale(locale);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Messages.prototype, \"defaultLocale\", {\n /**\n * Default fallback locale\n *\n * @remarks\n * One of {@link Messages.availableLocales} or `null`.\n * Partial matches of language tags are supported, so e.g. with an `en` locale defined, it will be selected by `messages.defaultLocale = 'en-US'` and vice versa.\n */\n get: function () {\n return this._defaultLocale;\n },\n set: function (locale) {\n this._defaultLocale = this.resolveLocale(locale);\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Add new messages to the accessor; useful if loading data dynamically\n *\n * @remarks\n * The locale code `lc` should be an exact match for the locale being updated, or empty to default to the current locale.\n * Use {@link Messages.resolveLocale} for resolving partial locale strings.\n *\n * If `keypath` is empty, adds or sets the complete message object for the corresponding locale.\n * If any keys in `keypath` do not exist, a new object will be created at that key.\n *\n * @param data - Hierarchical map of keys to functions, or a single message function\n * @param locale - If empty or undefined, defaults to `this.locale`\n * @param keypath - The keypath being added\n */\n Messages.prototype.addMessages = function (data, locale, keypath) {\n var lc = locale || String(this.locale);\n if (typeof data !== 'function') {\n data = Object.keys(data).reduce(function (map, key) {\n if (key !== 'toString')\n map[key] = data[key];\n return map;\n }, {});\n }\n if (Array.isArray(keypath) && keypath.length > 0) {\n var parent_1 = this._data[lc];\n for (var i = 0; i < keypath.length - 1; ++i) {\n var key = keypath[i];\n if (!parent_1[key])\n parent_1[key] = {};\n parent_1 = parent_1[key];\n }\n parent_1[keypath[keypath.length - 1]] = data;\n }\n else {\n this._data[lc] = data;\n }\n return this;\n };\n /**\n * Resolve `lc` to the key of an available locale or `null`, allowing for partial matches.\n *\n * @remarks\n * For example, with an `en` locale defined, it will be selected by `messages.defaultLocale = 'en-US'` and vice versa.\n */\n Messages.prototype.resolveLocale = function (locale) {\n var lc = String(locale);\n if (this._data[lc])\n return locale;\n if (locale) {\n while ((lc = lc.replace(/[-_]?[^-_]*$/, ''))) {\n if (this._data[lc])\n return lc;\n }\n var ll = this.availableLocales;\n var re = new RegExp('^' + locale + '[-_]');\n for (var i = 0; i < ll.length; ++i) {\n if (re.test(ll[i]))\n return ll[i];\n }\n }\n return null;\n };\n /**\n * Get the list of fallback locales\n *\n * @param locale - If empty or undefined, defaults to `this.locale`\n */\n Messages.prototype.getFallback = function (locale) {\n var lc = locale || String(this.locale);\n return (this._fallback[lc] ||\n (lc === this.defaultLocale || !this.defaultLocale\n ? []\n : [this.defaultLocale]));\n };\n /**\n * Set the fallback locale or locales for `lc`\n *\n * @remarks\n * To disable fallback for the locale, use `setFallback(lc, [])`.\n * To use the default fallback, use `setFallback(lc, null)`.\n */\n Messages.prototype.setFallback = function (lc, fallback) {\n this._fallback[lc] = Array.isArray(fallback) ? fallback : null;\n return this;\n };\n /**\n * Check if `key` is a message function for the locale\n *\n * @remarks\n * `key` may be a `string` for functions at the root level, or `string[]` for\n * accessing hierarchical objects. If an exact match is not found and\n * `fallback` is true, the fallback locales are checked for the first match.\n *\n * @param key - The key or keypath being sought\n * @param locale - If empty or undefined, defaults to `this.locale`\n * @param fallback - If true, also checks fallback locales\n */\n Messages.prototype.hasMessage = function (key, locale, fallback) {\n var lc = locale || String(this.locale);\n var fb = fallback ? this.getFallback(lc) : null;\n return _has(this._data, lc, key, fb, 'function');\n };\n /**\n * Check if `key` is a message object for the locale\n *\n * @remarks\n * `key` may be a `string` for functions at the root level, or `string[]` for\n * accessing hierarchical objects. If an exact match is not found and\n * `fallback` is true, the fallback locales are checked for the first match.\n *\n * @param key - The key or keypath being sought\n * @param locale - If empty or undefined, defaults to `this.locale`\n * @param fallback - If true, also checks fallback locales\n */\n Messages.prototype.hasObject = function (key, locale, fallback) {\n var lc = locale || String(this.locale);\n var fb = fallback ? this.getFallback(lc) : null;\n return _has(this._data, lc, key, fb, 'object');\n };\n /**\n * Get the message or object corresponding to `key`\n *\n * @remarks\n * `key` may be a `string` for functions at the root level, or `string[]` for accessing hierarchical objects.\n * If an exact match is not found, the fallback locales are checked for the first match.\n *\n * If `key` maps to a message function, the returned value will be the result of calling it with `props`.\n * If it maps to an object, the object is returned directly.\n * If nothing is found, `key` is returned.\n *\n * @param key - The key or keypath being sought\n * @param props - Optional properties passed to the function\n * @param lc - If empty or undefined, defaults to `this.locale`\n */\n Messages.prototype.get = function (key, props, locale) {\n var lc = locale || String(this.locale);\n var msg = _get(this._data[lc], key);\n if (msg)\n return typeof msg == 'function' ? msg(props) : msg;\n var fb = this.getFallback(lc);\n for (var i = 0; i < fb.length; ++i) {\n msg = _get(this._data[fb[i]], key);\n if (msg)\n return typeof msg == 'function' ? msg(props) : msg;\n }\n return key;\n };\n return Messages;\n}());\nexport default Messages;\nfunction _get(obj, key) {\n if (!obj)\n return null;\n var res = obj;\n if (Array.isArray(key)) {\n for (var i = 0; i < key.length; ++i) {\n if (typeof res !== 'object')\n return null;\n res = res[key[i]];\n if (!res)\n return null;\n }\n return res;\n }\n return typeof res === 'object' ? res[key] : null;\n}\nfunction _has(data, lc, key, fallback, type) {\n var msg = _get(data[lc], key);\n if (msg)\n return typeof msg === type;\n if (fallback) {\n for (var i = 0; i < fallback.length; ++i) {\n msg = _get(data[fallback[i]], key);\n if (msg)\n return typeof msg === type;\n }\n }\n return false;\n}\n","\nexport default {\n zh: {\n challenge: {\n title: () => \"验证您不是机器人\",\n calculating: () => \"正在进行浏览器检查...\",\n difficulty_speed: (d) => \"难度:\" + d.difficulty + \",速度:\" + d.speed + \"kH/s\",\n taking_longer: () => \"验证时间超出预期,请勿刷新页面\",\n why_seeing: () => \"为什么我会看到这个页面?\",\n why_seeing_body: {\n part_1: (d) => \"您看到这个页面是因为网站管理员启用了 \" + d.cerberus + \" 来防御异常流量攻击。这类攻击可能导致网站服务中断,影响所有用户的正常访问。\",\n part_2: (d) => \"如果您了解 \" + d.techaro + \" 开发的 \" + d.anubis + \",那么 Cerberus 采用了类似的 PoW 验证技术。不同的是,Anubis 主要针对 AI 爬虫,而 Cerberus 则采用了更激进的策略来保护我们的开源基础设施。\",\n part_3: (d) => \"请注意,Cerberus 需要启用现代 JavaScript 功能,而 \" + d.jshelter + \" 等插件会禁用这些功能。请为本域名禁用 \" + d.jshelter + \" 或类似的插件。\"\n },\n must_enable_js: () => \"请启用 JavaScript 以继续访问\"\n },\n success: {\n title: () => \"验证成功\",\n verification_complete: () => \"验证已完成\",\n took_time_iterations: (d) => \"用时 \" + d.time + \"ms,完成 \" + d.iterations + \" 次迭代\"\n },\n error: {\n error_occurred: () => \"发生错误\",\n access_restricted: () => \"访问受限\",\n browser_config_or_bug: () => \"可能是浏览器配置问题,也可能是我们的系统出现了异常\",\n ip_blocked: () => \"由于检测到可疑活动,您的 IP 地址或本地网络已被封禁\",\n wait_before_retry: () => \"请稍后再试,某些情况下可能需要等待数小时\",\n contact_us: (d) => \"如有问题,请通过 \" + d.mail + \" 联系我们。请附上下方显示的 request ID,以便我们进行排查。\"\n },\n footer: {\n author: (d) => \"由 \" + d.sjtug + \" 开发的 \" + d.cerberus + \" 提供保护\",\n upstream: (d) => \"灵感来源于 🇨🇦 \" + d.techaro + \" 开发的 \" + d.anubis\n }\n },\n en: {\n challenge: {\n title: () => \"Making sure you're not a bot!\",\n calculating: () => \"Performing browser checks...\",\n difficulty_speed: (d) => \"Difficulty: \" + d.difficulty + \", Speed: \" + d.speed + \"kH/s\",\n taking_longer: () => \"This is taking longer than expected. Please do not refresh the page.\",\n why_seeing: () => \"Why am I seeing this?\",\n why_seeing_body: {\n part_1: (d) => \"You are seeing this because the administrator of this website has set up \" + d.cerberus + \" to protect the server against abusive traffic. This can and does cause downtime for the websites, which makes their resources inaccessible for everyone.\",\n part_2: (d) => \"If you're familiar with \" + d.anubis + \" by \" + d.techaro + \", Cerberus is similar - it performs a PoW challenge to verify the request. While Anubis focuses on protecting websites from AI scrapers, Cerberus takes a much more aggressive approach to protect our open-source infrastructure.\",\n part_3: (d) => \"Please note that Cerberus requires the use of modern JavaScript features that plugins like \" + d.jshelter + \" will disable. Please disable \" + d.jshelter + \" or other such plugins for this domain.\"\n },\n must_enable_js: () => \"You must enable JavaScript to proceed.\"\n },\n success: {\n title: () => \"Success!\",\n verification_complete: () => \"Verification Complete!\",\n took_time_iterations: (d) => \"Took \" + d.time + \"ms, \" + d.iterations + \" iterations\"\n },\n error: {\n error_occurred: () => \"Error occurred while processing your request\",\n access_restricted: () => \"Access has been restricted\",\n browser_config_or_bug: () => \"There might be an issue with your browser configuration, or something is wrong on our side.\",\n ip_blocked: () => \"You (or your local network) have been blocked due to suspicious activity.\",\n wait_before_retry: () => \"Please wait a while before you try again; in some cases this may take a few hours.\",\n contact_us: (d) => \"If you believe this is an error, please contact us at \" + d.mail + \". Attach the request ID shown below to help us investigate.\"\n },\n footer: {\n author: (d) => \"Protected by \" + d.cerberus + \" from \" + d.sjtug + \".\",\n upstream: (d) => \"Heavily inspired by \" + d.anubis + \" from \" + d.techaro + \" in 🇨🇦.\"\n }\n }\n}"],"names":["$parcel$resolve","url","parcelRequire","i","$parcel$bundleURL","Error","err","matches","stack","match","$parcel$distDir","URL","toString","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","$cf6e67383540718f$var$asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","$cf6e67383540718f$export$71511d61b312f219","fn","args","arguments","apply","undefined","$67ae305e1674258d$export$71511d61b312f219","obj","Symbol","constructor","$01ec0fe86f91b5d8$export$67ebef60e6f28a6","thisArg","body","f","y","t","_","label","sent","trys","ops","g","Object","create","Iterator","prototype","next","verb","iterator","n","v","op","TypeError","call","pop","length","push","e","id","exports","init","module","code","register","assign","SuppressedError","$66d4361906f4496b$exports","$7077909a1ae871cf$exports","$0ae13573b5316750$exports","workerUrl","origin","isESM","location","source","JSON","stringify","createObjectURL","Blob","type","$7077909a1ae871cf$var$url","$7d2dbc41645dbcab$var$_get","res","Array","isArray","$7d2dbc41645dbcab$var$_has","data","lc","fallback","msg","$879896b395956ce6$var$messages","Messages","msgData","defaultLocale","_this","_data","_fallback","_defaultLocale","_locale","keys","forEach","locale","defineProperty","get","enumerable","configurable","set","resolveLocale","addMessages","keypath","String","reduce","map","parent_1","replace","ll","availableLocales","re","RegExp","test","getFallback","setFallback","hasMessage","fb","hasObject","props","zh","challenge","title","calculating","difficulty_speed","d","difficulty","speed","taking_longer","why_seeing","why_seeing_body","part_1","cerberus","part_2","techaro","anubis","part_3","jshelter","must_enable_js","success","verification_complete","took_time_iterations","time","iterations","error_occurred","access_restricted","browser_config_or_bug","ip_blocked","wait_before_retry","contact_us","mail","footer","author","sjtug","upstream","en","$879896b395956ce6$var$t","split","console","log","$879896b395956ce6$var$meta","baseURL","version","$879896b395956ce6$var$dom","document","getElementById","mascot","status","metrics","message","progressContainer","progressBar","$879896b395956ce6$var$ui","textContent","mascotState","state","src","concat","progress","classList","toggle","style","width","thisScript","_JSON_parse","inputNonce","ts","signature","_JSON_parse1","t0","lastUpdate","likelihood","_ref","hash","solution","t1","form","_state","parse","getAttribute","nonce","Date","now","Math","pow","_0","signal","progressCallback","threads","_arguments","navigator","hardwareConcurrency","debug","workers","terminate","w","removeEventListener","aborted","addEventListener","once","wasmModule","worker","a","fetch","__esModule","default","arrayBuffer","Worker","onmessage","event","onerror","postMessage","iters","probability","distance","delta","toFixed","$879896b395956ce6$var$createAnswerForm","addHiddenInput","name","input","createElement","appendChild","method","action","href","setTimeout","submit"],"version":3,"file":"main.js.map"}
\ No newline at end of file diff --git a/vendor/github.com/sjtug/cerberus/web/dist/pow.worker.8c3779b0.js b/vendor/github.com/sjtug/cerberus/web/dist/pow.worker.8c3779b0.js deleted file mode 100644 index 35fe6b2..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/pow.worker.8c3779b0.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(){function e(e,n,t,r){Object.defineProperty(e,n,{get:t,set:r,enumerable:!0,configurable:!0})}var n,t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},r={},o={},i=t.parcelRequireec24;null==i&&((i=function(e){if(e in r)return r[e].exports;if(e in o){var n=o[e];delete o[e];var t={id:e,exports:{}};return r[e]=t,n.call(t.exports,t,t.exports),t.exports}var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,n){o[e]=n},t.parcelRequireec24=i);var a=i.register;a("2838M",function(e,n){var t=i("gi2E2"),r=i("769Cg"),o=i("itvzF");addEventListener("message",function(e){return(0,t._)(function(){return(0,r.__generator)(this,function(n){return(0,o.initSync)({module:e.data.wasmModule}),(0,o.process_task)(e.data.data,e.data.difficulty,e.data.nonce,e.data.threads),[2]})})()})}),a("gi2E2",function(n,t){function r(e,n,t,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){t(e);return}c.done?n(u):Promise.resolve(u).then(r,o)}function o(e){return function(){var n=this,t=arguments;return new Promise(function(o,i){var a=e.apply(n,t);function c(e){r(a,o,i,c,u,"next",e)}function u(e){r(a,o,i,c,u,"throw",e)}c(void 0)})}}e(n.exports,"_",function(){return o})}),a("769Cg",function(n,t){function r(e,n){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(u){var s=[c,u];if(t)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],r=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}e(n.exports,"__generator",function(){return r}),i("eXCMu"),"function"==typeof SuppressedError&&SuppressedError}),a("eXCMu",function(n,t){e(n.exports,"_",function(){return r});function r(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}}),a("itvzF",function(n,r){e(n.exports,"process_task",function(){return m}),e(n.exports,"initSync",function(){return E});var o,a=i("gi2E2"),c=i("eXCMu"),u=i("769Cg");function s(e){var n=o.__externref_table_alloc();return o.__wbindgen_export_2.set(n,e),n}function f(e,n){try{return e.apply(this,n)}catch(e){var t=s(e);o.__wbindgen_exn_store(t)}}var l="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:function(){throw Error("TextDecoder not available")}};"undefined"!=typeof TextDecoder&&l.decode();var d=null;function b(){return(null===d||0===d.byteLength)&&(d=new Uint8Array(o.memory.buffer)),d}function _(e,n){return e>>>=0,l.decode(b().subarray(e,e+n))}var g=0,p="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:function(){throw Error("TextEncoder not available")}},w="function"==typeof p.encodeInto?function(e,n){return p.encodeInto(e,n)}:function(e,n){var t=p.encode(e);return n.set(t),{read:e.length,written:t.length}};function y(e,n,t){if(void 0===t){var r=p.encode(e),o=n(r.length,1)>>>0;return b().subarray(o,o+r.length).set(r),g=r.length,o}for(var i=e.length,a=n(i,1)>>>0,c=b(),u=0;u<i;u++){var s=e.charCodeAt(u);if(s>127)break;c[a+u]=s}if(u!==i){0!==u&&(e=e.slice(u)),a=t(a,i,i=u+3*e.length,1)>>>0;var f=w(e,b().subarray(a+u,a+i));u+=f.written,a=t(a,i,u,1)>>>0}return g=u,a}var v=null;function h(){return(null===v||!0===v.buffer.detached||void 0===v.buffer.detached&&v.buffer!==o.memory.buffer)&&(v=new DataView(o.memory.buffer)),v}function m(e,n,t,r){var i=y(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=g;o.process_task(i,a,n,t,r)}function x(e,n){return(0,a._)(function(){var t,r,o;return(0,u.__generator)(this,function(i){switch(i.label){case 0:if(!("function"==typeof Response&&e instanceof Response))return[3,7];if("function"!=typeof WebAssembly.instantiateStreaming)return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,WebAssembly.instantiateStreaming(e,n)];case 2:case 6:return[2,i.sent()];case 3:if(t=i.sent(),"application/wasm"!=e.headers.get("Content-Type"))console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t;return[3,4];case 4:return[4,e.arrayBuffer()];case 5:return r=i.sent(),[4,WebAssembly.instantiate(r,n)];case 7:return[4,WebAssembly.instantiate(e,n)];case 8:if((o=i.sent())instanceof WebAssembly.Instance)return[2,{instance:o,module:e}];return[2,o];case 9:return[2]}})})()}function S(){var e={};return e.wbg={},e.wbg.__wbg_call_672a4d21634d4a24=function(){return f(function(e,n){return e.call(n)},arguments)},e.wbg.__wbg_instanceof_DedicatedWorkerGlobalScope_a688e81380e34e02=function(e){var n;try{n=e instanceof DedicatedWorkerGlobalScope}catch(e){n=!1}return n},e.wbg.__wbg_new_405e22f390576ce2=function(){return{}},e.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,n){return Function(_(e,n))},e.wbg.__wbg_postMessage_83a8d58d3fcb6c13=function(){return f(function(e,n){e.postMessage(n)},arguments)},e.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,t){e[n]=t},e.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){var e=void 0===t?null:t;return null==e?0:s(e)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){var e="undefined"==typeof globalThis?null:globalThis;return null==e?0:s(e)},e.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){var e="undefined"==typeof self?null:self;return null==e?0:s(e)},e.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){var e="undefined"==typeof window?null:window;return null==e?0:s(e)},e.wbg.__wbindgen_debug_string=function(e,n){var t=y(function e(n){var t,r=void 0===n?"undefined":(0,c._)(n);if("number"==r||"boolean"==r||null==n)return"".concat(n);if("string"==r)return'"'.concat(n,'"');if("symbol"==r){var o=n.description;return null==o?"Symbol":"Symbol(".concat(o,")")}if("function"==r){var i=n.name;return"string"==typeof i&&i.length>0?"Function(".concat(i,")"):"Function"}if(Array.isArray(n)){var a=n.length,u="[";a>0&&(u+=e(n[0]));for(var s=1;s<a;s++)u+=", "+e(n[s]);return u+"]"}var f=/\[object ([^\]]+)\]/.exec(toString.call(n));if(!f||!(f.length>1))return toString.call(n);if("Object"==(t=f[1]))try{return"Object("+JSON.stringify(n)+")"}catch(e){return"Object"}return n instanceof Error?"".concat(n.name,": ").concat(n.message,"\n").concat(n.stack):t}(n),o.__wbindgen_malloc,o.__wbindgen_realloc),r=g;h().setInt32(e+4,r,!0),h().setInt32(e+0,t,!0)},e.wbg.__wbindgen_init_externref_table=function(){var e=o.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},e.wbg.__wbindgen_is_undefined=function(e){return void 0===e},e.wbg.__wbindgen_number_new=function(e){return e},e.wbg.__wbindgen_string_new=function(e,n){return _(e,n)},e.wbg.__wbindgen_throw=function(e,n){throw Error(_(e,n))},e}function O(e,n){return o=e.exports,A.__wbindgen_wasm_module=n,v=null,d=null,o.__wbindgen_start(),o}function E(e){if(void 0!==o)return o;void 0!==e&&(Object.getPrototypeOf(e)===Object.prototype?e=e.module:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));var n=S();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),O(new WebAssembly.Instance(e,n),e)}function A(e){return(0,a._)(function(){var n,t;return(0,u.__generator)(this,function(r){switch(r.label){case 0:if(void 0!==o)return[2,o];return void 0!==e&&(Object.getPrototypeOf(e)===Object.prototype?e=e.module_or_path:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===e&&(e=new URL(i("hmXoP"))),n=S(),("string"==typeof e||"function"==typeof Request&&e instanceof Request||"function"==typeof URL&&e instanceof URL)&&(e=fetch(e)),[4,e];case 1:return[4,x.apply(void 0,[r.sent(),n])];case 2:return[2,O((t=r.sent()).instance,t.module)]}})})()}}),a("hmXoP",function(e,t){e.exports=function(e){if(e=i.i?.[e]||e,!n)try{throw Error()}catch(r){var t=(""+r.stack).match(/(https?|file|ftp|(chrome|moz|safari-web)-extension):\/\/[^)\n]+/g);if(!t)return"./"+e;n=t[0]}return new URL("./"+e,n).toString()}("4RDch")}),Object.assign(i.i??={},{"4RDch":"pow_bg.e56bb07e.wasm"}),i("2838M")}(); -//# sourceMappingURL=pow.worker.8c3779b0.js.map diff --git a/vendor/github.com/sjtug/cerberus/web/dist/pow.worker.8c3779b0.js.map b/vendor/github.com/sjtug/cerberus/web/dist/pow.worker.8c3779b0.js.map deleted file mode 100644 index bfbf5c6..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/pow.worker.8c3779b0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"mappings":"C,A,W,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,C,E,a,C,C,E,C,I,E,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,I,E,E,Q,C,E,Q,S,C,C,C,E,I,E,E,S,E,E,S,E,E,SCEA,iBAAiB,UAAW,SAAO,CAAnC,E,M,A,C,E,E,C,A,E,W,M,A,C,E,E,W,A,E,I,C,S,C,E,MACI,AAAA,CAAA,EAAA,EAAA,QAAO,AAAP,EAAS,CAAE,OAAQ,EAAM,IAAI,CAAC,UAAU,AAAC,GACzC,AAAA,CAAA,EAAA,EAAA,YAAW,AAAX,EAAa,EAAM,IAAI,CAAC,IAAI,CAAE,EAAM,IAAI,CAAC,UAAU,CAAE,EAAM,IAAI,CAAC,KAAK,CAAE,EAAM,IAAI,CAAC,OAAO,E,C,E,A,EAC7F,I,E,G,E,Q,S,C,C,C,ECLA,SAAS,EAAmB,CAAG,CAAE,CAAO,CAAE,CAAM,CAAE,CAAK,CAAE,CAAM,CAAE,CAAG,CAAE,CAAG,EACrE,GAAI,CACA,IAAI,EAAO,CAAG,CAAC,EAAI,CAAC,GAChB,EAAQ,EAAK,KAAK,AAC1B,CAAE,MAAO,EAAO,CACZ,EAAO,GACP,MACJ,CACI,EAAK,IAAI,CAAE,EAAQ,GAClB,QAAQ,OAAO,CAAC,GAAO,IAAI,CAAC,EAAO,EAC5C,CACA,SAAS,EAAoB,CAAE,EAC3B,OAAO,WACH,IAAI,EAAO,IAAI,CAAE,EAAO,UAExB,OAAO,IAAI,QAAQ,SAAS,CAAO,CAAE,CAAM,EACvC,IAAI,EAAM,EAAG,KAAK,CAAC,EAAM,GAEzB,SAAS,EAAM,CAAK,EAChB,EAAmB,EAAK,EAAS,EAAQ,EAAO,EAAQ,OAAQ,EACpE,CAEA,SAAS,EAAO,CAAG,EACf,EAAmB,EAAK,EAAS,EAAQ,EAAO,EAAQ,QAAS,EACrE,CAEA,EAAM,KAAA,EACV,EACJ,CACJ,C,E,E,O,C,I,W,O,C,E,G,E,Q,S,C,C,C,EC+FO,SAAS,EAAY,CAAO,CAAE,CAAI,EACrC,IAAsG,EAAG,EAAG,EAAxG,EAAI,CAAE,MAAO,EAAG,KAAM,WAAa,GAAI,AAAO,EAAP,CAAC,CAAC,EAAE,CAAM,MAAM,CAAC,CAAC,EAAE,CAAE,OAAO,CAAC,CAAC,EAAE,AAAE,EAAG,KAAM,EAAE,CAAE,IAAK,EAAE,AAAC,EAAY,EAAI,OAAO,MAAM,CAAE,AAAA,CAAA,AAAoB,YAApB,OAAO,SAA0B,SAAW,MAAA,EAAQ,SAAS,EAC/L,OAAO,EAAE,IAAI,CAAG,EAAK,GAAI,EAAE,KAAQ,CAAG,EAAK,GAAI,EAAE,MAAS,CAAG,EAAK,GAAI,AAAkB,YAAlB,OAAO,QAA0B,CAAA,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAG,WAAa,OAAO,IAAI,AAAE,CAAA,EAAI,EAC1J,SAAS,EAAK,CAAC,EAAI,OAAO,SAAU,CAAC,MACvB,EADuC,CAAC,EAAG,EAAE,CAEvD,GAAI,EAAG,MAAM,AAAI,UAAU,mCAC3B,KAAO,GAAM,CAAA,EAAI,EAAG,CAAE,CAAC,EAAE,EAAK,CAAA,EAAI,CAAA,CAAA,EAAK,GAAG,GAAI,CAC1C,GAAI,EAAI,EAAG,GAAM,CAAA,EAAI,AAAQ,EAAR,CAAE,CAAC,EAAE,CAAO,EAAE,MAAS,CAAG,CAAE,CAAC,EAAE,CAAG,EAAE,KAAQ,EAAK,CAAA,AAAC,CAAA,EAAI,EAAE,MAAQ,AAAR,GAAc,EAAE,IAAI,CAAC,GAAI,CAAA,EAAK,EAAE,IAAG,AAAH,GAAS,CAAE,AAAA,CAAA,EAAI,EAAE,IAAI,CAAC,EAAG,CAAE,CAAC,EAAE,CAAA,EAAG,IAAI,CAAE,OAAO,EAE3J,OADI,EAAI,EAAJ,AAAO,GAAG,CAAA,EAAK,CAAC,AAAQ,EAAR,CAAE,CAAC,EAAE,CAAM,EAAE,KAAK,CAAC,AAAA,EAC/B,CAAE,CAAC,EAAE,EACT,KAAK,EAAG,KAAK,EAAG,EAAI,EAAI,KACxB,MAAK,EAAc,OAAX,EAAE,KAAK,GAAW,CAAE,MAAO,CAAE,CAAC,EAAE,CAAE,KAAM,CAAA,CAAM,CACtD,MAAK,EAAG,EAAE,KAAK,GAAI,EAAI,CAAE,CAAC,EAAE,CAAE,EAAK,CAAC,EAAE,CAAE,QACxC,MAAK,EAAG,EAAK,EAAE,GAAG,CAAC,GAAG,GAAI,EAAE,IAAI,CAAC,GAAG,GAAI,QACxC,SACI,GAAI,CAAc,CAAA,EAAI,AAAhB,CAAA,EAAI,EAAE,IAAI,AAAJ,EAAY,MAAM,CAAG,GAAK,CAAC,CAAC,EAAE,MAAM,CAAG,EAAC,AAAD,GAAQ,CAAA,AAAU,IAAV,CAAE,CAAC,EAAE,EAAU,AAAU,IAAV,CAAE,CAAC,EAAE,AAAK,EAAI,CAAE,EAAI,EAAG,QAAU,CAC3G,GAAI,AAAU,IAAV,CAAE,CAAC,EAAE,EAAW,CAAA,CAAC,GAAM,CAAE,CAAC,EAAE,CAAG,CAAC,CAAC,EAAE,EAAI,CAAE,CAAC,EAAE,CAAG,CAAC,CAAC,EAAE,AAAF,EAAM,CAAE,EAAE,KAAK,CAAG,CAAE,CAAC,EAAE,CAAE,KAAO,CACrF,GAAI,AAAU,IAAV,CAAE,CAAC,EAAE,EAAU,EAAE,KAAK,CAAG,CAAC,CAAC,EAAE,CAAE,CAAE,EAAE,KAAK,CAAG,CAAC,CAAC,EAAE,CAAE,EAAI,EAAI,KAAO,CACpE,GAAI,GAAK,EAAE,KAAK,CAAG,CAAC,CAAC,EAAE,CAAE,CAAE,EAAE,KAAK,CAAG,CAAC,CAAC,EAAE,CAAE,EAAE,GAAG,CAAC,IAAI,CAAC,GAAK,KAAO,CAC9D,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,GACnB,EAAE,IAAI,CAAC,GAAG,GAAI,QACtB,CACA,EAAK,EAAK,IAAI,CAAC,EAAS,EAC5B,CAAE,MAAO,EAAG,CAAE,EAAK,CAAC,EAAG,EAAE,CAAE,EAAI,CAAG,QAAU,CAAE,EAAI,EAAI,CAAG,CACzD,GAAI,AAAQ,EAAR,CAAE,CAAC,EAAE,CAAM,MAAM,CAAE,CAAC,EAAE,CAAE,MAAO,CAAE,MAAO,CAAE,CAAC,EAAE,CAAG,CAAE,CAAC,EAAE,CAAG,KAAK,EAAG,KAAM,CAAA,CAAK,CArBrB,CAAG,CAuBrE,C,E,E,O,C,c,W,O,C,GAzI8E,EAAA,SA2TvD,AAA2B,YAA3B,OAAO,iBAAiC,e,G,E,Q,S,C,C,C,E,E,E,O,C,I,W,O,C,GCxU/D,SAAS,EAAS,CAAG,EAGjB,OAAO,GAAO,AAAkB,aAAlB,OAAO,QAA0B,EAAI,WAAW,GAAK,OAAS,SAAW,OAAO,CAClG,C,G,E,Q,S,C,C,C,E,E,E,O,C,e,W,O,C,G,E,E,O,C,W,W,O,C,G,ICJI,E,E,E,S,E,E,S,E,E,SAEJ,SAAS,EAAqB,CAAG,EAC7B,IAAM,EAAM,EAAK,uBAAuB,GAExC,OADA,EAAK,mBAAmB,CAAC,GAAG,CAAC,EAAK,GAC3B,CACX,CAEA,SAAS,EAAY,CAAC,CAAE,CAAI,EACxB,GAAI,CACA,OAAO,EAAE,KAAK,CAAC,IAAI,CAAE,EACzB,CAAE,MAAO,EAAG,CACR,IAAM,EAAM,EAAqB,GACjC,EAAK,oBAAoB,CAAC,EAC9B,CACJ,CAEA,IAAM,EAAqB,AAAuB,aAAvB,OAAO,YAA8B,IAAI,YAAY,QAAS,CAAE,UAAW,CAAA,EAAM,MAAO,CAAA,CAAK,GAAK,CAAE,OAAQ,WAAQ,MAAM,MAAM,4BAA6B,CAAE,CAEtL,AAAuB,CAAA,aAAvB,OAAO,aAA+B,EAAkB,MAAM,GAElE,IAAI,EAA0B,KAE9B,SAAS,IAIL,MAHI,CAAA,AAA4B,OAA5B,GAAoC,AAAuC,IAAvC,EAAwB,UAAU,AAAK,GAC3E,CAAA,EAA0B,IAAI,WAAW,EAAK,MAAM,CAAC,MAAM,CAAA,EAExD,CACX,CAEA,SAAS,EAAmB,CAAG,CAAE,CAAG,EAEhC,OADA,KAAc,EACP,EAAkB,MAAM,CAAC,IAAuB,QAAQ,CAAC,EAAK,EAAM,GAC/E,CAuEA,IAAI,EAAkB,EAEhB,EAAqB,AAAuB,aAAvB,OAAO,YAA8B,IAAI,YAAY,SAAW,CAAE,OAAQ,WAAQ,MAAM,MAAM,4BAA6B,CAAE,EAElJ,EAAgB,AAAwC,YAAxC,OAAO,EAAkB,UAAU,CACnD,SAAU,CAAG,CAAE,CAAI,EACrB,OAAO,EAAkB,UAAU,CAAC,EAAK,EAC7C,EACM,SAAU,CAAG,CAAE,CAAI,EACrB,IAAM,EAAM,EAAkB,MAAM,CAAC,GAErC,OADA,EAAK,GAAG,CAAC,GACF,CACH,KAAM,EAAI,MAAM,CAChB,QAAS,EAAI,MAAM,AACvB,CACJ,EAEA,SAAS,EAAkB,CAAG,CAAE,CAAM,CAAE,CAAO,EAE3C,GAAI,AAAY,KAAA,IAAZ,EAAuB,CACvB,IAAM,EAAM,EAAkB,MAAM,CAAC,GAC/B,EAAM,EAAO,EAAI,MAAM,CAAE,KAAO,EAGtC,OAFA,IAAuB,QAAQ,CAAC,EAAK,EAAM,EAAI,MAAM,EAAE,GAAG,CAAC,GAC3D,EAAkB,EAAI,MAAM,CACrB,CACX,CASA,IAPA,IAAI,EAAM,EAAI,MAAM,CAChB,EAAM,EAAO,EAAK,KAAO,EAEvB,EAAM,IAER,EAAS,EAEN,EAAS,EAAK,IAAU,CAC3B,IAAM,EAAO,EAAI,UAAU,CAAC,GAC5B,GAAI,EAAO,IAAM,KACjB,CAAA,CAAG,CAAC,EAAM,EAAO,CAAG,CACxB,CAEA,GAAI,IAAW,EAAK,CACZ,AAAW,IAAX,GACA,CAAA,EAAM,EAAI,KAAK,CAAC,EADpB,EAGA,EAAM,EAAQ,EAAK,EAAK,EAAM,EAAS,AAAa,EAAb,EAAI,MAAM,CAAM,KAAO,EAE9D,IAAM,EAAM,EAAa,EADZ,IAAuB,QAAQ,CAAC,EAAM,EAAQ,EAAM,IAGjE,GAAU,EAAI,OAAO,CACrB,EAAM,EAAQ,EAAK,EAAK,EAAQ,KAAO,CAC3C,CAGA,OADA,EAAkB,EACX,CACX,CAEA,IAAI,EAAwB,KAE5B,SAAS,IAIL,MAHI,CAAA,AAA0B,OAA1B,GAAkC,AAA0C,CAAA,IAA1C,EAAsB,MAAM,CAAC,QAAQ,EAAc,AAA0C,KAAA,IAA1C,EAAsB,MAAM,CAAC,QAAQ,EAAkB,EAAsB,MAAM,GAAK,EAAK,MAAM,CAAC,MAAM,AAAN,GACzL,CAAA,EAAwB,IAAI,SAAS,EAAK,MAAM,CAAC,MAAM,CAAA,EAEpD,CACX,CAYO,SAAS,EAAa,CAAI,CAAE,CAAU,CAAE,CAAS,CAAE,CAAO,EAC7D,IAAM,EAAO,EAAkB,EAAM,EAAK,iBAAiB,CAAE,EAAK,kBAAkB,EAC9E,EAAO,EACb,EAAK,YAAY,CAAC,EAAM,EAAM,EAAY,EAAW,EACzD,CAEA,SAAe,EAAW,CAAM,CAAE,CAAO,E,M,A,C,E,E,C,A,E,WAMpB,IAAA,EAUP,EAIA,E,M,A,C,E,E,W,A,E,I,C,S,C,E,O,E,K,E,K,EAnBN,GAAA,CAAA,CAAA,AAAoB,YAApB,OAAO,UAA2B,aAAkB,QAAA,EAApD,MAAA,C,E,E,CACI,GAAA,AAA4C,YAA5C,OAAO,YAAY,oBAAoB,CAAvC,MAAA,C,E,E,A,C,E,K,C,C,M,EAEW,O,E,I,C,I,C,C,E,G,E,EAAA,C,EAAM,YAAY,oBAAoB,CAAC,EAAQ,G,A,M,E,K,EAAtD,MAAA,C,EAAO,EAAA,IAAA,G,A,M,EAGP,GADK,EAAA,EAAA,IAAA,GACD,AAAsC,oBAAtC,EAAO,OAAO,CAAC,GAAG,CAAC,gBACnB,QAAQ,IAAI,CAAC,oMAAqM,QAGlN,MAAM,E,M,C,E,E,A,M,EAKJ,MAAA,C,EAAM,EAAO,WAAW,G,A,M,EAC/B,OADD,EAAQ,EAAR,IAAA,GACC,C,EAAM,YAAY,WAAW,CAAC,EAAO,G,A,M,EAG3B,MAAA,C,EAAM,YAAY,WAAW,CAAC,EAAQ,G,A,M,EAEvD,GAAI,AAFE,CAAA,EAAW,EAAX,IAAA,EAAA,YAEkB,YAAY,QAAQ,CACxC,MADJ,C,EACW,CAAE,SAAA,EAAU,OAAA,CAAO,E,CAG1B,MAAA,C,EAAO,E,A,M,E,M,C,E,A,C,EAGnB,I,CAEA,SAAS,IACL,IAAM,EAAU,CAAC,EA+EjB,OA9EA,EAAQ,GAAG,CAAG,CAAC,EACf,EAAQ,GAAG,CAAC,2BAA2B,CAAG,WAAa,OAAO,EAAY,SAAU,CAAI,CAAE,CAAI,EAE1F,OADY,EAAK,IAAI,CAAC,EAE1B,EAAG,UAAW,EACd,EAAQ,GAAG,CAAC,4DAA4D,CAAG,SAAS,CAAI,MAChF,EACJ,GAAI,CACA,EAAS,aAAgB,0BAC7B,CAAE,MAAO,EAAG,CACR,EAAS,CAAA,CACb,CAEA,OADY,CAEhB,EACA,EAAQ,GAAG,CAAC,0BAA0B,CAAG,WAErC,MADY,CAAZ,CAEJ,EACA,EAAQ,GAAG,CAAC,gCAAgC,CAAG,SAAS,CAAI,CAAE,CAAI,EAE9D,OADY,AAAI,SAAS,EAAmB,EAAM,GAEtD,EACA,EAAQ,GAAG,CAAC,kCAAkC,CAAG,WAAa,OAAO,EAAY,SAAU,CAAI,CAAE,CAAI,EACjG,EAAK,WAAW,CAAC,EACrB,EAAG,UAAW,EACd,EAAQ,GAAG,CAAC,0BAA0B,CAAG,SAAS,CAAI,CAAE,CAAI,CAAE,CAAI,EAC9D,CAAI,CAAC,EAAK,CAAG,CACjB,EACA,EAAQ,GAAG,CAAC,6CAA6C,CAAG,WACxD,IAAM,EAAM,AAAkB,KAAA,IAAX,EAAyB,KAAO,EACnD,OAAO,AArNJ,MAqNe,EAAO,EAAI,EAAqB,EACtD,EACA,EAAQ,GAAG,CAAC,kDAAkD,CAAG,WAC7D,IAAM,EAAM,AAAsB,aAAtB,OAAO,WAA6B,KAAO,WACvD,OAAO,AAzNJ,MAyNe,EAAO,EAAI,EAAqB,EACtD,EACA,EAAQ,GAAG,CAAC,2CAA2C,CAAG,WACtD,IAAM,EAAM,AAAgB,aAAhB,OAAO,KAAuB,KAAO,KACjD,OAAO,AA7NJ,MA6Ne,EAAO,EAAI,EAAqB,EACtD,EACA,EAAQ,GAAG,CAAC,6CAA6C,CAAG,WACxD,IAAM,EAAM,AAAkB,aAAlB,OAAO,OAAyB,KAAO,OACnD,OAAO,AAjOJ,MAiOe,EAAO,EAAI,EAAqB,EACtD,EACA,EAAQ,GAAG,CAAC,uBAAuB,CAAG,SAAS,CAAI,CAAE,CAAI,EAErD,IAAM,EAAO,EADD,AAjOpB,SAAS,EAAY,CAAG,EAEpB,IAsCI,EAtCE,EAAO,AAAO,KAAA,IAAA,EAAA,YAAP,AAAA,CAAA,EAAA,EAAA,CAAS,AAAT,EAAO,GACpB,GAAI,AAAQ,UAAR,GAAoB,AAAQ,WAAR,GAAqB,AAAO,MAAP,EACzC,MAAS,GAAM,MAAA,CAAJ,GAEf,GAAI,AAAQ,UAAR,EACA,MAAO,IAAQ,MAAA,CAAJ,EAAI,KAEnB,GAAI,AAAQ,UAAR,EAAkB,CAClB,IAAM,EAAc,EAAI,WAAW,QACnC,AAAI,AAAe,MAAf,EACO,SAEA,UAAsB,MAAA,CAAZ,EAAY,IAErC,CACA,GAAI,AAAQ,YAAR,EAAoB,CACpB,IAAM,EAAO,EAAI,IAAI,OACrB,AAAI,AAAe,UAAf,OAAO,GAAoB,EAAK,MAAM,CAAG,EAClC,YAAiB,MAAA,CAAL,EAAK,KAEjB,UAEf,CAEA,GAAI,MAAM,OAAO,CAAC,GAAM,CACpB,IAAM,EAAS,EAAI,MAAM,CACrB,EAAQ,GACR,CAAA,EAAS,GACT,CAAA,GAAS,EAAY,CAAG,CAAC,EAAE,CAAA,EAE/B,IAAI,IAAI,EAAI,EAAG,EAAI,EAAQ,IACvB,GAAS,KAAO,EAAY,CAAG,CAAC,EAAE,EAGtC,OADA,EAAS,GAEb,CAEA,IAAM,EAAiB,sBAAsB,IAAI,CAAC,SAAS,IAAI,CAAC,IAEhE,GAAI,CAAA,IAAkB,CAAA,EAAe,MAAM,CAAG,CAAA,EAI1C,OAAO,SAAS,IAAI,CAAC,GAEzB,GAAI,AAAa,UALb,CAAA,EAAY,CAAc,CAAC,EAAE,AAAF,EAS3B,GAAI,CACA,MAAO,UAAY,KAAK,SAAS,CAAC,GAAO,GAC7C,CAAE,MAAO,EAAG,CACR,MAAO,QACX,QAGJ,AAAI,aAAe,MACP,GAAe,MAAA,CAAb,EAAI,IAAI,CAAC,MAAoB,MAAA,CAAhB,EAAI,OAAO,CAAC,MAAc,MAAA,CAAV,EAAI,KAAK,EAG7C,CACX,EAkKgC,GACY,EAAK,iBAAiB,CAAE,EAAK,kBAAkB,EAC7E,EAAO,EACb,IAAqB,QAAQ,CAAC,EAAO,EAAO,EAAM,CAAA,GAClD,IAAqB,QAAQ,CAAC,EAAO,EAAO,EAAM,CAAA,EACtD,EACA,EAAQ,GAAG,CAAC,+BAA+B,CAAG,WAC1C,IAAM,EAAQ,EAAK,mBAAmB,CAChC,EAAS,EAAM,IAAI,CAAC,GAC1B,EAAM,GAAG,CAAC,EAAG,KAAA,GACb,EAAM,GAAG,CAAC,EAAS,EAAG,KAAA,GACtB,EAAM,GAAG,CAAC,EAAS,EAAG,MACtB,EAAM,GAAG,CAAC,EAAS,EAAG,CAAA,GACtB,EAAM,GAAG,CAAC,EAAS,EAAG,CAAA,EAE1B,EACA,EAAQ,GAAG,CAAC,uBAAuB,CAAG,SAAS,CAAI,EAE/C,OADY,AAAS,KAAA,IAAT,CAEhB,EACA,EAAQ,GAAG,CAAC,qBAAqB,CAAG,SAAS,CAAI,EAE7C,OADY,CAEhB,EACA,EAAQ,GAAG,CAAC,qBAAqB,CAAG,SAAS,CAAI,CAAE,CAAI,EAEnD,OADY,EAAmB,EAAM,EAEzC,EACA,EAAQ,GAAG,CAAC,gBAAgB,CAAG,SAAS,CAAI,CAAE,CAAI,EAC9C,MAAM,AAAI,MAAM,EAAmB,EAAM,GAC7C,EAEO,CACX,CAMA,SAAS,EAAoB,CAAQ,CAAE,CAAM,EAQzC,OAPA,EAAO,EAAS,OAAO,CACvB,EAAW,sBAAsB,CAAG,EACpC,EAAwB,KACxB,EAA0B,KAG1B,EAAK,gBAAgB,GACd,CACX,CAEA,SAAS,EAAS,CAAM,EACpB,GAAI,AAAS,KAAA,IAAT,EAAoB,OAAO,CAGT,MAAA,IAAX,IACH,OAAO,cAAc,CAAC,KAAY,OAAO,SAAS,CAChD,EAAU,EAAV,MADN,CAGI,QAAQ,IAAI,CAAC,+EAIrB,IAAM,EAAU,IAUhB,OANI,AAAE,aAAkB,YAAY,MAAK,EACrC,CAAA,EAAS,IAAI,YAAY,MAAM,CAAC,EADpC,EAMO,EAFU,IAAI,YAAY,QAAQ,CAAC,EAAQ,GAEb,EACzC,CAEA,SAAe,EAAW,CAAc,E,M,A,C,E,E,C,A,E,WAe9B,IAAA,EAQuB,E,M,A,C,E,E,W,A,E,I,C,S,C,E,O,E,K,E,K,EAtB7B,GAAI,AAAS,KAAA,IAAT,EAAoB,MAAxB,C,EAA+B,E,CAsBe,OAnBhB,KAAA,IAAnB,IACH,OAAO,cAAc,CAAC,KAAoB,OAAO,SAAS,CACxD,EAAkB,EAAlB,cADN,CAGI,QAAQ,IAAI,CAAC,8FAIjB,AAA0B,KAAA,IAAnB,GACP,CAAA,EADJ,IAAA,IAAA,EAAA,SAAA,EAGM,EAAU,IAEZ,CAAA,AAA0B,UAA1B,OAAO,GAAgC,AAAmB,YAAnB,OAAO,SAA0B,aAA0B,SAAa,AAAe,YAAf,OAAO,KAAsB,aAA0B,GAAA,GACtK,CAAA,EAAiB,MAAM,EAD3B,EAM8C,C,EAAM,E,A,M,EAAvB,MAAA,C,EAAM,EAAA,KAAA,CAAA,KAAA,EAAA,CAAW,EAAA,IAAA,GAAsB,E,E,A,M,EAEpE,O,EAAO,EAFsB,AAAA,CAAA,EAAA,EAAA,IAAA,EAAA,EAArB,QAAA,CAAqB,EAAX,MAAW,E,C,EAGjC,I,C,G,E,Q,S,C,C,C,EC7WA,EAAA,OAAA,CAAiB,A,S,C,E,G,E,E,C,E,C,E,E,E,C,E,G,C,M,A,O,C,M,E,C,I,E,A,C,G,E,K,A,E,K,C,oE,I,E,M,A,K,E,E,C,C,E,A,C,O,I,I,A,K,E,G,Q,E,EAAsB,Q,G,O,M,C,E,C,G,C,ECAT,CAAC,QAAQ,uCAAuC,G,E,Q","sources":["<anon>","pow.worker.js","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/@swc+helpers@0.5.17/node_modules/@swc/helpers/esm/_async_to_generator.js","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/@swc+helpers@0.5.17/node_modules/@swc/helpers/esm/_type_of.js","node_modules/.pnpm/pow@file+..+..+pow+pkg/node_modules/pow/pow.js","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/@parcel+runtime-js@2.15.1_@parcel+core@2.15.1_@swc+helpers@0.5.17_/node_modules/@parcel/runtime-js/lib/runtime-98c5b16e56b1727d.js","../../../../../.cache/pnpm/dlx/7bc3f1fc538288d74bbdf957652e2bfde452102023bb0e338840e100a321b1b1/196f9d99867-3d05/node_modules/.pnpm/@parcel+runtime-js@2.15.1_@parcel+core@2.15.1_@swc+helpers@0.5.17_/node_modules/@parcel/runtime-js/lib/runtime-60527c1f2b254f89.js"],"sourcesContent":["(function () {\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n \nvar $parcel$bundleURL;\nfunction $parcel$resolve(url) {\n url = parcelRequire.i?.[url] || url;\n if (!$parcel$bundleURL) {\n try {\n throw new Error();\n } catch (err) {\n var matches = ('' + err.stack).match(\n /(https?|file|ftp|(chrome|moz|safari-web)-extension):\\/\\/[^)\\n]+/g,\n );\n if (matches) {\n $parcel$bundleURL = matches[0];\n } else {\n return $parcel$distDir + url;\n }\n }\n }\n return new URL($parcel$distDir + url, $parcel$bundleURL).toString();\n}\n\nfunction $parcel$extendImportMap(map) {\n Object.assign(parcelRequire.i ??= {}, map);\n}\nvar $parcel$distDir = \"./\";\n\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequireec24\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequireec24\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"2838M\", function(module, exports) {\n\nvar $gi2E2 = parcelRequire(\"gi2E2\");\n\nvar $769Cg = parcelRequire(\"769Cg\");\n\nvar $itvzF = parcelRequire(\"itvzF\");\naddEventListener('message', function(event) {\n return (/*#__PURE__*/ 0, /*#__PURE__*/ $gi2E2._)(function() {\n return (0, $769Cg.__generator)(this, function(_state) {\n (0, $itvzF.initSync)({\n module: event.data.wasmModule\n });\n (0, $itvzF.process_task)(event.data.data, event.data.difficulty, event.data.nonce, event.data.threads);\n return [\n 2\n ];\n });\n })();\n});\n\n});\nparcelRegister(\"gi2E2\", function(module, exports) {\n\n$parcel$export(module.exports, \"_\", function () { return $bdc060f6523371e4$export$71511d61b312f219; });\nfunction $bdc060f6523371e4$var$asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) resolve(value);\n else Promise.resolve(value).then(_next, _throw);\n}\nfunction $bdc060f6523371e4$export$71511d61b312f219(fn) {\n return function() {\n var self = this, args = arguments;\n return new Promise(function(resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n $bdc060f6523371e4$var$asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n $bdc060f6523371e4$var$asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}\n\n});\n\nparcelRegister(\"769Cg\", function(module, exports) {\n\n$parcel$export(module.exports, \"__generator\", function () { return $52b08d845193ff78$export$67ebef60e6f28a6; });\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ \nvar $eXCMu = parcelRequire(\"eXCMu\");\nvar $52b08d845193ff78$var$extendStatics = function extendStatics1(d, b) {\n $52b08d845193ff78$var$extendStatics = Object.setPrototypeOf || ({\n __proto__: []\n }) instanceof Array && function(d, b) {\n d.__proto__ = b;\n } || function(d, b) {\n for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n };\n return $52b08d845193ff78$var$extendStatics(d, b);\n};\nfunction $52b08d845193ff78$export$a8ba968b8961cb8a(d, b) {\n if (typeof b !== \"function\" && b !== null) throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n $52b08d845193ff78$var$extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nvar $52b08d845193ff78$export$18ce0697a983be9b = function __assign1() {\n $52b08d845193ff78$export$18ce0697a983be9b = Object.assign || function __assign(t) {\n for(var s, i = 1, n = arguments.length; i < n; i++){\n s = arguments[i];\n for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return $52b08d845193ff78$export$18ce0697a983be9b.apply(this, arguments);\n};\nfunction $52b08d845193ff78$export$3c9a16f847548506(s, e) {\n var t = {};\n for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") {\n for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nfunction $52b08d845193ff78$export$29e00dfd3077644b(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if ((typeof Reflect === \"undefined\" ? \"undefined\" : (0, $eXCMu._)(Reflect)) === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nfunction $52b08d845193ff78$export$d5ad3fd78186038f(paramIndex, decorator) {\n return function(target, key) {\n decorator(target, key, paramIndex);\n };\n}\nfunction $52b08d845193ff78$export$3a84e1ae4e97e9b0(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) {\n if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\");\n return f;\n }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for(var i = decorators.length - 1; i >= 0; i--){\n var context = {};\n for(var p in contextIn)context[p] = p === \"access\" ? {} : contextIn[p];\n for(var p in contextIn.access)context.access[p] = contextIn.access[p];\n context.addInitializer = function(f) {\n if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\");\n extraInitializers.push(accept(f || null));\n };\n var result = (0, decorators[i])(kind === \"accessor\" ? {\n get: descriptor.get,\n set: descriptor.set\n } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || (typeof result === \"undefined\" ? \"undefined\" : (0, $eXCMu._)(result)) !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n } else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n}\nfunction $52b08d845193ff78$export$d831c04e792af3d(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for(var i = 0; i < initializers.length; i++)value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n return useValue ? value : void 0;\n}\nfunction $52b08d845193ff78$export$6a2a36740a146cb8(x) {\n return (typeof x === \"undefined\" ? \"undefined\" : (0, $eXCMu._)(x)) === \"symbol\" ? x : \"\".concat(x);\n}\nfunction $52b08d845193ff78$export$d1a06452d3489bc7(f, name, prefix) {\n if ((typeof name === \"undefined\" ? \"undefined\" : (0, $eXCMu._)(name)) === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", {\n configurable: true,\n value: prefix ? \"\".concat(prefix, \" \", name) : name\n });\n}\nfunction $52b08d845193ff78$export$f1db080c865becb9(metadataKey, metadataValue) {\n if ((typeof Reflect === \"undefined\" ? \"undefined\" : (0, $eXCMu._)(Reflect)) === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nfunction $52b08d845193ff78$export$1050f835b63b671e(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function(resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function(resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nfunction $52b08d845193ff78$export$67ebef60e6f28a6(thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([\n n,\n v\n ]);\n };\n }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while(g && (g = 0, op[0] && (_ = 0)), _)try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [\n op[0] & 2,\n t.value\n ];\n switch(op[0]){\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n case 5:\n _.label++;\n y = op[1];\n op = [\n 0\n ];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [\n 6,\n e\n ];\n y = 0;\n } finally{\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nvar $52b08d845193ff78$export$45d3717a4c69092e = Object.create ? function __createBinding(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {\n enumerable: true,\n get: function get() {\n return m[k];\n }\n };\n Object.defineProperty(o, k2, desc);\n} : function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n};\nfunction $52b08d845193ff78$export$f33643c0debef087(m, o) {\n for(var p in m)if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) $52b08d845193ff78$export$45d3717a4c69092e(o, m, p);\n}\nfunction $52b08d845193ff78$export$19a8beecd37a4c45(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function next() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nfunction $52b08d845193ff78$export$8d051b38c9118094(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while((n === void 0 || n-- > 0) && !(r = i.next()).done)ar.push(r.value);\n } catch (error) {\n e = {\n error: error\n };\n } finally{\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally{\n if (e) throw e.error;\n }\n }\n return ar;\n}\nfunction $52b08d845193ff78$export$afc72e2116322959() {\n for(var ar = [], i = 0; i < arguments.length; i++)ar = ar.concat($52b08d845193ff78$export$8d051b38c9118094(arguments[i]));\n return ar;\n}\nfunction $52b08d845193ff78$export$6388937ca91ccae8() {\n for(var s = 0, i = 0, il = arguments.length; i < il; i++)s += arguments[i].length;\n for(var r = Array(s), k = 0, i = 0; i < il; i++)for(var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)r[k] = a[j];\n return r;\n}\nfunction $52b08d845193ff78$export$1216008129fb82ed(to, from, pack) {\n if (pack || arguments.length === 2) {\n for(var i = 0, l = from.length, ar; i < l; i++)if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\nfunction $52b08d845193ff78$export$10c90e4f7922046c(v) {\n return this instanceof $52b08d845193ff78$export$10c90e4f7922046c ? (this.v = v, this) : new $52b08d845193ff78$export$10c90e4f7922046c(v);\n}\nfunction $52b08d845193ff78$export$e427f37a30a4de9b(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function() {\n return this;\n }, i;\n function awaitReturn(f) {\n return function(v) {\n return Promise.resolve(v).then(f, reject);\n };\n }\n function verb(n, f) {\n if (g[n]) {\n i[n] = function(v) {\n return new Promise(function(a, b) {\n q.push([\n n,\n v,\n a,\n b\n ]) > 1 || resume(n, v);\n });\n };\n if (f) i[n] = f(i[n]);\n }\n }\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n function step(r) {\n r.value instanceof $52b08d845193ff78$export$10c90e4f7922046c ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n function fulfill(value) {\n resume(\"next\", value);\n }\n function reject(value) {\n resume(\"throw\", value);\n }\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nfunction $52b08d845193ff78$export$bbd80228419bb833(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function(e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function() {\n return this;\n }, i;\n function verb(n, f) {\n i[n] = o[n] ? function(v) {\n return (p = !p) ? {\n value: $52b08d845193ff78$export$10c90e4f7922046c(o[n](v)),\n done: false\n } : f ? f(v) : v;\n } : f;\n }\n}\nfunction $52b08d845193ff78$export$e3b29a3d6162315f(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof $52b08d845193ff78$export$19a8beecd37a4c45 === \"function\" ? $52b08d845193ff78$export$19a8beecd37a4c45(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function() {\n return this;\n }, i);\n function verb(n) {\n i[n] = o[n] && function(v) {\n return new Promise(function(resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function(v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nfunction $52b08d845193ff78$export$4fb47efe1390b86f(cooked, raw) {\n if (Object.defineProperty) Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n else cooked.raw = raw;\n return cooked;\n}\nvar $52b08d845193ff78$var$__setModuleDefault = Object.create ? function __setModuleDefault(o, v) {\n Object.defineProperty(o, \"default\", {\n enumerable: true,\n value: v\n });\n} : function(o, v) {\n o[\"default\"] = v;\n};\nvar $52b08d845193ff78$var$ownKeys = function ownKeys1(o) {\n $52b08d845193ff78$var$ownKeys = Object.getOwnPropertyNames || function(o) {\n var ar = [];\n for(var k in o)if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return $52b08d845193ff78$var$ownKeys(o);\n};\nfunction $52b08d845193ff78$export$c21735bcef00d192(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) {\n for(var k = $52b08d845193ff78$var$ownKeys(mod), i = 0; i < k.length; i++)if (k[i] !== \"default\") $52b08d845193ff78$export$45d3717a4c69092e(result, mod, k[i]);\n }\n $52b08d845193ff78$var$__setModuleDefault(result, mod);\n return result;\n}\nfunction $52b08d845193ff78$export$da59b14a69baef04(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nfunction $52b08d845193ff78$export$d5dcaf168c640c35(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\nfunction $52b08d845193ff78$export$d40a35129aaff81f(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;\n}\nfunction $52b08d845193ff78$export$81fdc39f203e4e04(state, receiver) {\n if (receiver === null || (typeof receiver === \"undefined\" ? \"undefined\" : (0, $eXCMu._)(receiver)) !== \"object\" && typeof receiver !== \"function\") throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\nfunction $52b08d845193ff78$export$88ac25d8e944e405(env, value, async) {\n if (value !== null && value !== void 0) {\n if ((typeof value === \"undefined\" ? \"undefined\" : (0, $eXCMu._)(value)) !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function dispose() {\n try {\n inner.call(this);\n } catch (e) {\n return Promise.reject(e);\n }\n };\n env.stack.push({\n value: value,\n dispose: dispose,\n async: async\n });\n } else if (async) env.stack.push({\n async: true\n });\n return value;\n}\nvar $52b08d845193ff78$var$_SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function _SuppressedError(error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\nfunction $52b08d845193ff78$export$8f076105dc360e92(env) {\n function fail(e) {\n env.error = env.hasError ? new $52b08d845193ff78$var$_SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while(r = env.stack.pop())try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {\n fail(e);\n return next();\n });\n } else s |= 1;\n } catch (e) {\n fail(e);\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\nfunction $52b08d845193ff78$export$889dfb5d17574b0b(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : d + ext + \".\" + cm.toLowerCase() + \"js\";\n });\n return path;\n}\nvar $52b08d845193ff78$export$2e2bcd8739ae039 = {\n __extends: $52b08d845193ff78$export$a8ba968b8961cb8a,\n __assign: $52b08d845193ff78$export$18ce0697a983be9b,\n __rest: $52b08d845193ff78$export$3c9a16f847548506,\n __decorate: $52b08d845193ff78$export$29e00dfd3077644b,\n __param: $52b08d845193ff78$export$d5ad3fd78186038f,\n __esDecorate: $52b08d845193ff78$export$3a84e1ae4e97e9b0,\n __runInitializers: $52b08d845193ff78$export$d831c04e792af3d,\n __propKey: $52b08d845193ff78$export$6a2a36740a146cb8,\n __setFunctionName: $52b08d845193ff78$export$d1a06452d3489bc7,\n __metadata: $52b08d845193ff78$export$f1db080c865becb9,\n __awaiter: $52b08d845193ff78$export$1050f835b63b671e,\n __generator: $52b08d845193ff78$export$67ebef60e6f28a6,\n __createBinding: $52b08d845193ff78$export$45d3717a4c69092e,\n __exportStar: $52b08d845193ff78$export$f33643c0debef087,\n __values: $52b08d845193ff78$export$19a8beecd37a4c45,\n __read: $52b08d845193ff78$export$8d051b38c9118094,\n __spread: $52b08d845193ff78$export$afc72e2116322959,\n __spreadArrays: $52b08d845193ff78$export$6388937ca91ccae8,\n __spreadArray: $52b08d845193ff78$export$1216008129fb82ed,\n __await: $52b08d845193ff78$export$10c90e4f7922046c,\n __asyncGenerator: $52b08d845193ff78$export$e427f37a30a4de9b,\n __asyncDelegator: $52b08d845193ff78$export$bbd80228419bb833,\n __asyncValues: $52b08d845193ff78$export$e3b29a3d6162315f,\n __makeTemplateObject: $52b08d845193ff78$export$4fb47efe1390b86f,\n __importStar: $52b08d845193ff78$export$c21735bcef00d192,\n __importDefault: $52b08d845193ff78$export$da59b14a69baef04,\n __classPrivateFieldGet: $52b08d845193ff78$export$d5dcaf168c640c35,\n __classPrivateFieldSet: $52b08d845193ff78$export$d40a35129aaff81f,\n __classPrivateFieldIn: $52b08d845193ff78$export$81fdc39f203e4e04,\n __addDisposableResource: $52b08d845193ff78$export$88ac25d8e944e405,\n __disposeResources: $52b08d845193ff78$export$8f076105dc360e92,\n __rewriteRelativeImportExtension: $52b08d845193ff78$export$889dfb5d17574b0b\n};\n\n});\nparcelRegister(\"eXCMu\", function(module, exports) {\n\n$parcel$export(module.exports, \"_\", function () { return $ae44a88405106244$export$71511d61b312f219; });\nfunction $ae44a88405106244$export$71511d61b312f219(obj) {\n \"@swc/helpers - typeof\";\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\n\n});\n\n\nparcelRegister(\"itvzF\", function(module, exports) {\n\n$parcel$export(module.exports, \"process_task\", function () { return $d7336d67281c62aa$export$fcb6bce1d050ce61; });\n$parcel$export(module.exports, \"initSync\", function () { return $d7336d67281c62aa$export$2ec80ee76a9348bf; });\n\nvar $gi2E2 = parcelRequire(\"gi2E2\");\n\nvar $eXCMu = parcelRequire(\"eXCMu\");\n\nvar $769Cg = parcelRequire(\"769Cg\");\nvar $d7336d67281c62aa$var$wasm;\nfunction $d7336d67281c62aa$var$addToExternrefTable0(obj) {\n var idx = $d7336d67281c62aa$var$wasm.__externref_table_alloc();\n $d7336d67281c62aa$var$wasm.__wbindgen_export_2.set(idx, obj);\n return idx;\n}\nfunction $d7336d67281c62aa$var$handleError(f, args) {\n try {\n return f.apply(this, args);\n } catch (e) {\n var idx = $d7336d67281c62aa$var$addToExternrefTable0(e);\n $d7336d67281c62aa$var$wasm.__wbindgen_exn_store(idx);\n }\n}\nvar $d7336d67281c62aa$var$cachedTextDecoder = typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', {\n ignoreBOM: true,\n fatal: true\n}) : {\n decode: function() {\n throw Error('TextDecoder not available');\n }\n};\nif (typeof TextDecoder !== 'undefined') $d7336d67281c62aa$var$cachedTextDecoder.decode();\nvar $d7336d67281c62aa$var$cachedUint8ArrayMemory0 = null;\nfunction $d7336d67281c62aa$var$getUint8ArrayMemory0() {\n if ($d7336d67281c62aa$var$cachedUint8ArrayMemory0 === null || $d7336d67281c62aa$var$cachedUint8ArrayMemory0.byteLength === 0) $d7336d67281c62aa$var$cachedUint8ArrayMemory0 = new Uint8Array($d7336d67281c62aa$var$wasm.memory.buffer);\n return $d7336d67281c62aa$var$cachedUint8ArrayMemory0;\n}\nfunction $d7336d67281c62aa$var$getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return $d7336d67281c62aa$var$cachedTextDecoder.decode($d7336d67281c62aa$var$getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\nfunction $d7336d67281c62aa$var$isLikeNone(x) {\n return x === undefined || x === null;\n}\nfunction $d7336d67281c62aa$var$debugString(val) {\n // primitive types\n var type = typeof val === \"undefined\" ? \"undefined\" : (0, $eXCMu._)(val);\n if (type == 'number' || type == 'boolean' || val == null) return \"\".concat(val);\n if (type == 'string') return '\"'.concat(val, '\"');\n if (type == 'symbol') {\n var description = val.description;\n if (description == null) return 'Symbol';\n else return \"Symbol(\".concat(description, \")\");\n }\n if (type == 'function') {\n var name = val.name;\n if (typeof name == 'string' && name.length > 0) return \"Function(\".concat(name, \")\");\n else return 'Function';\n }\n // objects\n if (Array.isArray(val)) {\n var length = val.length;\n var debug = '[';\n if (length > 0) debug += $d7336d67281c62aa$var$debugString(val[0]);\n for(var i = 1; i < length; i++)debug += ', ' + $d7336d67281c62aa$var$debugString(val[i]);\n debug += ']';\n return debug;\n }\n // Test for built-in\n var builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n var className;\n if (builtInMatches && builtInMatches.length > 1) className = builtInMatches[1];\n else // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n if (className == 'Object') // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n // errors\n if (val instanceof Error) return \"\".concat(val.name, \": \").concat(val.message, \"\\n\").concat(val.stack);\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\nvar $d7336d67281c62aa$var$WASM_VECTOR_LEN = 0;\nvar $d7336d67281c62aa$var$cachedTextEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : {\n encode: function() {\n throw Error('TextEncoder not available');\n }\n};\nvar $d7336d67281c62aa$var$encodeString = typeof $d7336d67281c62aa$var$cachedTextEncoder.encodeInto === 'function' ? function encodeString(arg, view) {\n return $d7336d67281c62aa$var$cachedTextEncoder.encodeInto(arg, view);\n} : function(arg, view) {\n var buf = $d7336d67281c62aa$var$cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n};\nfunction $d7336d67281c62aa$var$passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n var buf = $d7336d67281c62aa$var$cachedTextEncoder.encode(arg);\n var ptr = malloc(buf.length, 1) >>> 0;\n $d7336d67281c62aa$var$getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n $d7336d67281c62aa$var$WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n var len = arg.length;\n var ptr1 = malloc(len, 1) >>> 0;\n var mem = $d7336d67281c62aa$var$getUint8ArrayMemory0();\n var offset = 0;\n for(; offset < len; offset++){\n var code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr1 + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) arg = arg.slice(offset);\n ptr1 = realloc(ptr1, len, len = offset + arg.length * 3, 1) >>> 0;\n var view = $d7336d67281c62aa$var$getUint8ArrayMemory0().subarray(ptr1 + offset, ptr1 + len);\n var ret = $d7336d67281c62aa$var$encodeString(arg, view);\n offset += ret.written;\n ptr1 = realloc(ptr1, len, offset, 1) >>> 0;\n }\n $d7336d67281c62aa$var$WASM_VECTOR_LEN = offset;\n return ptr1;\n}\nvar $d7336d67281c62aa$var$cachedDataViewMemory0 = null;\nfunction $d7336d67281c62aa$var$getDataViewMemory0() {\n if ($d7336d67281c62aa$var$cachedDataViewMemory0 === null || $d7336d67281c62aa$var$cachedDataViewMemory0.buffer.detached === true || $d7336d67281c62aa$var$cachedDataViewMemory0.buffer.detached === undefined && $d7336d67281c62aa$var$cachedDataViewMemory0.buffer !== $d7336d67281c62aa$var$wasm.memory.buffer) $d7336d67281c62aa$var$cachedDataViewMemory0 = new DataView($d7336d67281c62aa$var$wasm.memory.buffer);\n return $d7336d67281c62aa$var$cachedDataViewMemory0;\n}\nfunction $d7336d67281c62aa$export$b3571188c770cc5a() {\n $d7336d67281c62aa$var$wasm.start();\n}\nfunction $d7336d67281c62aa$export$fcb6bce1d050ce61(data, difficulty, thread_id, threads) {\n var ptr0 = $d7336d67281c62aa$var$passStringToWasm0(data, $d7336d67281c62aa$var$wasm.__wbindgen_malloc, $d7336d67281c62aa$var$wasm.__wbindgen_realloc);\n var len0 = $d7336d67281c62aa$var$WASM_VECTOR_LEN;\n $d7336d67281c62aa$var$wasm.process_task(ptr0, len0, difficulty, thread_id, threads);\n}\nfunction $d7336d67281c62aa$var$__wbg_load(module, imports) {\n return (/*#__PURE__*/ 0, /*#__PURE__*/ $gi2E2._)(function() {\n var e, bytes, instance;\n return (0, $769Cg.__generator)(this, function(_state) {\n switch(_state.label){\n case 0:\n if (!(typeof Response === 'function' && module instanceof Response)) return [\n 3,\n 7\n ];\n if (!(typeof WebAssembly.instantiateStreaming === 'function')) return [\n 3,\n 4\n ];\n _state.label = 1;\n case 1:\n _state.trys.push([\n 1,\n 3,\n ,\n 4\n ]);\n return [\n 4,\n WebAssembly.instantiateStreaming(module, imports)\n ];\n case 2:\n return [\n 2,\n _state.sent()\n ];\n case 3:\n e = _state.sent();\n if (module.headers.get('Content-Type') != 'application/wasm') console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n else throw e;\n return [\n 3,\n 4\n ];\n case 4:\n return [\n 4,\n module.arrayBuffer()\n ];\n case 5:\n bytes = _state.sent();\n return [\n 4,\n WebAssembly.instantiate(bytes, imports)\n ];\n case 6:\n return [\n 2,\n _state.sent()\n ];\n case 7:\n return [\n 4,\n WebAssembly.instantiate(module, imports)\n ];\n case 8:\n instance = _state.sent();\n if (instance instanceof WebAssembly.Instance) return [\n 2,\n {\n instance: instance,\n module: module\n }\n ];\n else return [\n 2,\n instance\n ];\n _state.label = 9;\n case 9:\n return [\n 2\n ];\n }\n });\n })();\n}\nfunction $d7336d67281c62aa$var$__wbg_get_imports() {\n var imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_call_672a4d21634d4a24 = function() {\n return $d7336d67281c62aa$var$handleError(function(arg0, arg1) {\n var ret = arg0.call(arg1);\n return ret;\n }, arguments);\n };\n imports.wbg.__wbg_instanceof_DedicatedWorkerGlobalScope_a688e81380e34e02 = function(arg0) {\n var result;\n try {\n result = arg0 instanceof DedicatedWorkerGlobalScope;\n } catch (_) {\n result = false;\n }\n var ret = result;\n return ret;\n };\n imports.wbg.__wbg_new_405e22f390576ce2 = function() {\n var ret = new Object();\n return ret;\n };\n imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {\n var ret = new Function($d7336d67281c62aa$var$getStringFromWasm0(arg0, arg1));\n return ret;\n };\n imports.wbg.__wbg_postMessage_83a8d58d3fcb6c13 = function() {\n return $d7336d67281c62aa$var$handleError(function(arg0, arg1) {\n arg0.postMessage(arg1);\n }, arguments);\n };\n imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {\n arg0[arg1] = arg2;\n };\n imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {\n var ret = typeof $parcel$global === 'undefined' ? null : $parcel$global;\n return $d7336d67281c62aa$var$isLikeNone(ret) ? 0 : $d7336d67281c62aa$var$addToExternrefTable0(ret);\n };\n imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {\n var ret = typeof globalThis === 'undefined' ? null : globalThis;\n return $d7336d67281c62aa$var$isLikeNone(ret) ? 0 : $d7336d67281c62aa$var$addToExternrefTable0(ret);\n };\n imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {\n var ret = typeof self === 'undefined' ? null : self;\n return $d7336d67281c62aa$var$isLikeNone(ret) ? 0 : $d7336d67281c62aa$var$addToExternrefTable0(ret);\n };\n imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {\n var ret = typeof window === 'undefined' ? null : window;\n return $d7336d67281c62aa$var$isLikeNone(ret) ? 0 : $d7336d67281c62aa$var$addToExternrefTable0(ret);\n };\n imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {\n var ret = $d7336d67281c62aa$var$debugString(arg1);\n var ptr1 = $d7336d67281c62aa$var$passStringToWasm0(ret, $d7336d67281c62aa$var$wasm.__wbindgen_malloc, $d7336d67281c62aa$var$wasm.__wbindgen_realloc);\n var len1 = $d7336d67281c62aa$var$WASM_VECTOR_LEN;\n $d7336d67281c62aa$var$getDataViewMemory0().setInt32(arg0 + 4, len1, true);\n $d7336d67281c62aa$var$getDataViewMemory0().setInt32(arg0 + 0, ptr1, true);\n };\n imports.wbg.__wbindgen_init_externref_table = function() {\n var table = $d7336d67281c62aa$var$wasm.__wbindgen_export_2;\n var offset = table.grow(4);\n table.set(0, undefined);\n table.set(offset + 0, undefined);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n };\n imports.wbg.__wbindgen_is_undefined = function(arg0) {\n var ret = arg0 === undefined;\n return ret;\n };\n imports.wbg.__wbindgen_number_new = function(arg0) {\n var ret = arg0;\n return ret;\n };\n imports.wbg.__wbindgen_string_new = function(arg0, arg1) {\n var ret = $d7336d67281c62aa$var$getStringFromWasm0(arg0, arg1);\n return ret;\n };\n imports.wbg.__wbindgen_throw = function(arg0, arg1) {\n throw new Error($d7336d67281c62aa$var$getStringFromWasm0(arg0, arg1));\n };\n return imports;\n}\nfunction $d7336d67281c62aa$var$__wbg_init_memory(imports, memory) {}\nfunction $d7336d67281c62aa$var$__wbg_finalize_init(instance, module) {\n $d7336d67281c62aa$var$wasm = instance.exports;\n $d7336d67281c62aa$var$__wbg_init.__wbindgen_wasm_module = module;\n $d7336d67281c62aa$var$cachedDataViewMemory0 = null;\n $d7336d67281c62aa$var$cachedUint8ArrayMemory0 = null;\n $d7336d67281c62aa$var$wasm.__wbindgen_start();\n return $d7336d67281c62aa$var$wasm;\n}\nfunction $d7336d67281c62aa$export$2ec80ee76a9348bf(module) {\n if ($d7336d67281c62aa$var$wasm !== undefined) return $d7336d67281c62aa$var$wasm;\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) module = module.module;\n else console.warn('using deprecated parameters for `initSync()`; pass a single object instead');\n }\n var imports = $d7336d67281c62aa$var$__wbg_get_imports();\n $d7336d67281c62aa$var$__wbg_init_memory(imports);\n if (!(module instanceof WebAssembly.Module)) module = new WebAssembly.Module(module);\n var instance = new WebAssembly.Instance(module, imports);\n return $d7336d67281c62aa$var$__wbg_finalize_init(instance, module);\n}\n\nfunction $d7336d67281c62aa$var$__wbg_init(module_or_path) {\n return (/*#__PURE__*/ 0, /*#__PURE__*/ $gi2E2._)(function() {\n var imports, _ref, instance, module;\n return (0, $769Cg.__generator)(this, function(_state) {\n switch(_state.label){\n case 0:\n if ($d7336d67281c62aa$var$wasm !== undefined) return [\n 2,\n $d7336d67281c62aa$var$wasm\n ];\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) module_or_path = module_or_path.module_or_path;\n else console.warn('using deprecated parameters for the initialization function; pass a single object instead');\n }\n if (typeof module_or_path === 'undefined') module_or_path = new URL((parcelRequire(\"hmXoP\")));\n imports = $d7336d67281c62aa$var$__wbg_get_imports();\n if (typeof module_or_path === 'string' || typeof Request === 'function' && module_or_path instanceof Request || typeof URL === 'function' && module_or_path instanceof URL) module_or_path = fetch(module_or_path);\n $d7336d67281c62aa$var$__wbg_init_memory(imports);\n return [\n 4,\n module_or_path\n ];\n case 1:\n return [\n 4,\n $d7336d67281c62aa$var$__wbg_load.apply(void 0, [\n _state.sent(),\n imports\n ])\n ];\n case 2:\n _ref = _state.sent(), instance = _ref.instance, module = _ref.module;\n return [\n 2,\n $d7336d67281c62aa$var$__wbg_finalize_init(instance, module)\n ];\n }\n });\n })();\n}\nvar $d7336d67281c62aa$export$2e2bcd8739ae039 = $d7336d67281c62aa$var$__wbg_init;\n\n});\nparcelRegister(\"hmXoP\", function(module, exports) {\nmodule.exports = $parcel$resolve(\"4RDch\");\n\n});\n\n\n\nvar $9e766d59a66d30f2$exports = {};\n$parcel$extendImportMap({\n \"4RDch\": \"pow_bg.e56bb07e.wasm\"\n});\n\n\nparcelRequire(\"2838M\");\n})();\n//# sourceMappingURL=pow.worker.8c3779b0.js.map\n","import { initSync, process_task } from \"pow-wasm\";\n\naddEventListener('message', async (event) => {\n initSync({ module: event.data.wasmModule });\n process_task(event.data.data, event.data.difficulty, event.data.nonce, event.data.threads);\n});\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) resolve(value);\n else Promise.resolve(value).then(_next, _throw);\n}\nfunction _async_to_generator(fn) {\n return function() {\n var self = this, args = arguments;\n\n return new Promise(function(resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\nexport { _async_to_generator as _ };\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","function _type_of(obj) {\n \"@swc/helpers - typeof\";\n\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nexport { _type_of as _ };\n","let wasm;\n\nfunction addToExternrefTable0(obj) {\n const idx = wasm.__externref_table_alloc();\n wasm.__wbindgen_export_2.set(idx, obj);\n return idx;\n}\n\nfunction handleError(f, args) {\n try {\n return f.apply(this, args);\n } catch (e) {\n const idx = addToExternrefTable0(e);\n wasm.__wbindgen_exn_store(idx);\n }\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches && builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nexport function start() {\n wasm.start();\n}\n\n/**\n * @param {string} data\n * @param {number} difficulty\n * @param {number} thread_id\n * @param {number} threads\n */\nexport function process_task(data, difficulty, thread_id, threads) {\n const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n wasm.process_task(ptr0, len0, difficulty, thread_id, threads);\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {\n const ret = arg0.call(arg1);\n return ret;\n }, arguments) };\n imports.wbg.__wbg_instanceof_DedicatedWorkerGlobalScope_a688e81380e34e02 = function(arg0) {\n let result;\n try {\n result = arg0 instanceof DedicatedWorkerGlobalScope;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n };\n imports.wbg.__wbg_new_405e22f390576ce2 = function() {\n const ret = new Object();\n return ret;\n };\n imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {\n const ret = new Function(getStringFromWasm0(arg0, arg1));\n return ret;\n };\n imports.wbg.__wbg_postMessage_83a8d58d3fcb6c13 = function() { return handleError(function (arg0, arg1) {\n arg0.postMessage(arg1);\n }, arguments) };\n imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {\n arg0[arg1] = arg2;\n };\n imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {\n const ret = typeof global === 'undefined' ? null : global;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n };\n imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {\n const ret = typeof globalThis === 'undefined' ? null : globalThis;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n };\n imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {\n const ret = typeof self === 'undefined' ? null : self;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n };\n imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {\n const ret = typeof window === 'undefined' ? null : window;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n };\n imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {\n const ret = debugString(arg1);\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n };\n imports.wbg.__wbindgen_init_externref_table = function() {\n const table = wasm.__wbindgen_export_2;\n const offset = table.grow(4);\n table.set(0, undefined);\n table.set(offset + 0, undefined);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n ;\n };\n imports.wbg.__wbindgen_is_undefined = function(arg0) {\n const ret = arg0 === undefined;\n return ret;\n };\n imports.wbg.__wbindgen_number_new = function(arg0) {\n const ret = arg0;\n return ret;\n };\n imports.wbg.__wbindgen_string_new = function(arg0, arg1) {\n const ret = getStringFromWasm0(arg0, arg1);\n return ret;\n };\n imports.wbg.__wbindgen_throw = function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n };\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n wasm.__wbindgen_start();\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('pow_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n","module.exports = parcelRequire.resolve(\"4RDch\");","parcelRequire.extendImportMap({\"4RDch\":\"pow_bg.e56bb07e.wasm\"});"],"names":["$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$bundleURL","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","parcelRegister","$gi2E2","$769Cg","$itvzF","addEventListener","event","_","__generator","_state","initSync","data","wasmModule","process_task","difficulty","nonce","threads","$bdc060f6523371e4$var$asyncGeneratorStep","gen","resolve","reject","_next","_throw","key","arg","info","value","error","done","Promise","then","$bdc060f6523371e4$export$71511d61b312f219","fn","args","arguments","apply","undefined","$52b08d845193ff78$export$67ebef60e6f28a6","thisArg","body","f","y","t","label","sent","trys","ops","g","create","Iterator","prototype","next","verb","Symbol","iterator","op","TypeError","pop","length","push","SuppressedError","$ae44a88405106244$export$71511d61b312f219","obj","constructor","$d7336d67281c62aa$export$fcb6bce1d050ce61","$d7336d67281c62aa$export$2ec80ee76a9348bf","$d7336d67281c62aa$var$wasm","$eXCMu","$d7336d67281c62aa$var$addToExternrefTable0","idx","__externref_table_alloc","__wbindgen_export_2","$d7336d67281c62aa$var$handleError","__wbindgen_exn_store","$d7336d67281c62aa$var$cachedTextDecoder","TextDecoder","ignoreBOM","fatal","decode","$d7336d67281c62aa$var$cachedUint8ArrayMemory0","$d7336d67281c62aa$var$getUint8ArrayMemory0","byteLength","Uint8Array","memory","buffer","$d7336d67281c62aa$var$getStringFromWasm0","ptr","len","subarray","$d7336d67281c62aa$var$WASM_VECTOR_LEN","$d7336d67281c62aa$var$cachedTextEncoder","TextEncoder","encode","$d7336d67281c62aa$var$encodeString","encodeInto","view","buf","read","written","$d7336d67281c62aa$var$passStringToWasm0","malloc","realloc","ptr1","mem","offset","charCodeAt","slice","ret","$d7336d67281c62aa$var$cachedDataViewMemory0","$d7336d67281c62aa$var$getDataViewMemory0","detached","DataView","thread_id","ptr0","__wbindgen_malloc","__wbindgen_realloc","len0","$d7336d67281c62aa$var$__wbg_load","imports","bytes","instance","Response","WebAssembly","instantiateStreaming","headers","console","warn","arrayBuffer","instantiate","Instance","$d7336d67281c62aa$var$__wbg_get_imports","wbg","__wbg_call_672a4d21634d4a24","arg0","arg1","__wbg_instanceof_DedicatedWorkerGlobalScope_a688e81380e34e02","result","DedicatedWorkerGlobalScope","__wbg_new_405e22f390576ce2","__wbg_newnoargs_105ed471475aaf50","Function","__wbg_postMessage_83a8d58d3fcb6c13","postMessage","__wbg_set_3f1d0b984ed272ed","arg2","__wbg_static_accessor_GLOBAL_88a902d13a557d07","$d7336d67281c62aa$var$isLikeNone","x","__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0","__wbg_static_accessor_SELF_37c5d418e4bf5819","__wbg_static_accessor_WINDOW_5de37043a91a9c40","__wbindgen_debug_string","$d7336d67281c62aa$var$debugString","val","className","type","concat","description","name","Array","isArray","debug","i","builtInMatches","exec","toString","JSON","stringify","message","stack","len1","setInt32","__wbindgen_init_externref_table","table","grow","__wbindgen_is_undefined","__wbindgen_number_new","__wbindgen_string_new","__wbindgen_throw","$d7336d67281c62aa$var$__wbg_finalize_init","$d7336d67281c62aa$var$__wbg_init","__wbindgen_wasm_module","__wbindgen_start","getPrototypeOf","Module","module_or_path","_ref","URL","Request","fetch","$parcel$resolve","url","matches","match","$parcel$distDir","assign"],"version":3,"file":"pow.worker.8c3779b0.js.map"}
\ No newline at end of file diff --git a/vendor/github.com/sjtug/cerberus/web/dist/pow_bg.e56bb07e.wasm b/vendor/github.com/sjtug/cerberus/web/dist/pow_bg.e56bb07e.wasm Binary files differdeleted file mode 100644 index c5db5db..0000000 --- a/vendor/github.com/sjtug/cerberus/web/dist/pow_bg.e56bb07e.wasm +++ /dev/null diff --git a/vendor/github.com/sjtug/cerberus/web/embed.go b/vendor/github.com/sjtug/cerberus/web/embed.go deleted file mode 100644 index a9179bd..0000000 --- a/vendor/github.com/sjtug/cerberus/web/embed.go +++ /dev/null @@ -1,8 +0,0 @@ -package web - -import ( - "embed" -) - -//go:embed dist -var Content embed.FS diff --git a/vendor/github.com/sjtug/cerberus/web/global.css b/vendor/github.com/sjtug/cerberus/web/global.css deleted file mode 100644 index 1af3c9b..0000000 --- a/vendor/github.com/sjtug/cerberus/web/global.css +++ /dev/null @@ -1,6 +0,0 @@ -@import "tailwindcss" source("."); -@source not "dist"; - -body { - background-color: #f4e9d5; -}
\ No newline at end of file diff --git a/vendor/github.com/sjtug/cerberus/web/index.templ b/vendor/github.com/sjtug/cerberus/web/index.templ deleted file mode 100644 index c02ef69..0000000 --- a/vendor/github.com/sjtug/cerberus/web/index.templ +++ /dev/null @@ -1,147 +0,0 @@ -package web - -import ( - "context" - - "github.com/caddyserver/caddy/v2/modules/caddyhttp" - "github.com/invopop/ctxi18n/i18n" - "github.com/sjtug/cerberus/core" -) - -type contextKeyType int - -const ( - BaseURLCtxKey contextKeyType = iota - VersionCtxKey - LocaleCtxKey -) - -templ T(key string, args ...any) { - { i18n.T(ctx, key, args...) } -} - -templ UnsafeT(key string, args ...any) { - @templ.Raw(i18n.T(ctx, key, args...)) -} - -func GetBaseURL(ctx context.Context) string { - return ctx.Value(BaseURLCtxKey).(string) -} - -func GetVersion(ctx context.Context) string { - return ctx.Value(VersionCtxKey).(string) -} - -func GetLocale(ctx context.Context) string { - return ctx.Value(LocaleCtxKey).(string) -} - -func GetRequestID(ctx context.Context) string { - return caddyhttp.GetVar(ctx, core.VarReqID).(string) -} - -templ Base(title string, header string) { - <!DOCTYPE html> - <html lang="en"> - <head> - <meta charset="UTF-8"/> - <meta name="viewport" content="width=device-width, initial-scale=1.0"/> - <title>{ title }</title> - <link rel="stylesheet" href={ GetBaseURL(ctx) + "/static/global.css?v=" + GetVersion(ctx) }/> - </head> - <body class="min-h-screen flex flex-col items-center justify-center p-4 bg-[#fff8e7]"> - <div class="text-center text-lg my-auto max-w-2xl w-full px-4"> - <h1 id="title" class="text-4xl font-bold mb-6">{ header }</h1> - { children... } - <p class="text-gray-700 mt-4"> - @UnsafeT("footer.author", i18n.M{ - "cerberus": `<a href="https://github.com/SJTUG/cerberus" class="text-amber-600 hover:text-amber-700">Cerberus</a>`, - "sjtug": `<a href="https://sjtug.org" class="text-amber-600 hover:text-amber-700">SJTUG</a>`}) - </p> - <p class="text-gray-700 text-sm"> - @UnsafeT("footer.upstream", i18n.M{ - "anubis": `<a href="https://github.com/TecharoHQ/anubis" class="text-amber-600 hover:text-amber-700">Anubis</a>`, - "techaro": `<a href="https://techaro.lol" class="text-amber-600 hover:text-amber-700">Techaro</a>`}) - </p> - </div> - <p class="text-gray-700 text-sm pt-2"> - request_id: { GetRequestID(ctx) } - </p> - </body> - </html> -} - -templ Challenge(challenge string, difficulty int, nonce uint32, ts int64, signature string) { - {{ - challengeInput := struct { - Challenge string `json:"challenge"` - Difficulty int `json:"difficulty"` - Nonce uint32 `json:"nonce"` - TS int64 `json:"ts"` - Signature string `json:"signature"` - }{challenge, difficulty, nonce, ts, signature} - - baseURL := GetBaseURL(ctx) - version := GetVersion(ctx) - locale := GetLocale(ctx) - metaInput := struct { - BaseURL string `json:"baseURL"` - Version string `json:"version"` - Locale string `json:"locale"` - }{baseURL, version, locale} - - relPath := func(path string) string { - return baseURL + path + "?v=" + version - } - }} - <img id="mascot" src={ relPath("/static/img/mascot-puzzle.png") } alt="Cute anime mascot character" class="mx-auto p-4 mb-2 max-w-64"/> - <div id="status-container"> - <p id="status" class="text-gray-700 mb-1">status</p> - <p id="metrics" class="text-gray-700 mb-1">metrics</p> - <p id="message" class="text-gray-700 mb-2">message</p> - <!-- Progress Bar (hidden in success state) --> - <div id="progress-container" class="w-48 h-6 bg-white rounded-full border-2 border-[#b79ecf] p-1 mt-2 mb-4 mx-auto"> - <div id="progress-bar" class="h-full w-[60%] bg-[#b79ecf] rounded-full transition-all duration-300"></div> - </div> - </div> - <details class="mb-4"> - <summary class="cursor-pointer text-gray-600 hover:text-gray-800"> - @T("challenge.why_seeing") - </summary> - <div class="mt-2 text-base text-gray-600 space-y-2"> - <p> - @UnsafeT("challenge.why_seeing_body.part_1", i18n.M{ - "cerberus": `<a href="https://github.com/SJTUG/cerberus" class="text-amber-600 hover:text-amber-700">Cerberus</a>`, - }) - </p> - <p> - @UnsafeT("challenge.why_seeing_body.part_2", i18n.M{ - "anubis": `<a href="https://github.com/TecharoHQ/anubis" class="text-amber-600 hover:text-amber-700">Anubis</a>`, - "techaro": `<a href="https://techaro.lol" class="text-amber-600 hover:text-amber-700">Techaro</a>`, - }) - </p> - <p> - @UnsafeT("challenge.why_seeing_body.part_3", i18n.M{ - "jshelter": `<a href="https://jshelter.org/" class="text-amber-600 hover:text-amber-700">JShelter</a>`, - }) - </p> - </div> - </details> - <noscript> - <p> - @T("challenge.must_enable_js") - </p> - </noscript> - <script async defer id="challenge-script" x-meta={ templ.JSONString(metaInput) } x-challenge={ templ.JSONString(challengeInput) } src={ relPath("/static/main.js") }></script> -} - -templ Error(message string, description string, mail string) { - <img id="mascot" src={ GetBaseURL(ctx) + "/static/img/mascot-fail.png?v=" + GetVersion(ctx) } alt="Cute anime mascot character with a sad face" class="mx-auto p-4 mb-2 max-w-64"/> - <p id="message" class="text-gray-700 mb-2">{ message }</p> - <p id="description" class="text-gray-700 mb-2">{ description }</p> - if mail != "" { - <p class="text-gray-700 mb-4"> - @UnsafeT("error.contact_us", i18n.M{"mail": `<a href="mailto:` + mail + `" class="text-amber-600 hover:text-amber-700">` + mail + `</a>`}) - </p> - } -} diff --git a/vendor/github.com/sjtug/cerberus/web/index_templ.go b/vendor/github.com/sjtug/cerberus/web/index_templ.go deleted file mode 100644 index 5fe31ec..0000000 --- a/vendor/github.com/sjtug/cerberus/web/index_templ.go +++ /dev/null @@ -1,446 +0,0 @@ -// Code generated by templ - DO NOT EDIT. - -// templ: version: v0.3.865 -package web - -//lint:file-ignore SA4006 This context is only used if a nested component is present. - -import "github.com/a-h/templ" -import templruntime "github.com/a-h/templ/runtime" - -import ( - "context" - - "github.com/caddyserver/caddy/v2/modules/caddyhttp" - "github.com/invopop/ctxi18n/i18n" - "github.com/sjtug/cerberus/core" -) - -type contextKeyType int - -const ( - BaseURLCtxKey contextKeyType = iota - VersionCtxKey - LocaleCtxKey -) - -func T(key string, args ...any) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var1 := templ.GetChildren(ctx) - if templ_7745c5c3_Var1 == nil { - templ_7745c5c3_Var1 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - var templ_7745c5c3_Var2 string - templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, key, args...)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 20, Col: 28} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func UnsafeT(key string, args ...any) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var3 := templ.GetChildren(ctx) - if templ_7745c5c3_Var3 == nil { - templ_7745c5c3_Var3 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.Raw(i18n.T(ctx, key, args...)).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func GetBaseURL(ctx context.Context) string { - return ctx.Value(BaseURLCtxKey).(string) -} - -func GetVersion(ctx context.Context) string { - return ctx.Value(VersionCtxKey).(string) -} - -func GetLocale(ctx context.Context) string { - return ctx.Value(LocaleCtxKey).(string) -} - -func GetRequestID(ctx context.Context) string { - return caddyhttp.GetVar(ctx, core.VarReqID).(string) -} - -func Base(title string, header string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var4 := templ.GetChildren(ctx) - if templ_7745c5c3_Var4 == nil { - templ_7745c5c3_Var4 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(title) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 49, Col: 17} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</title><link rel=\"stylesheet\" href=\"") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(GetBaseURL(ctx) + "/static/global.css?v=" + GetVersion(ctx)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 50, Col: 92} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\"></head><body class=\"min-h-screen flex flex-col items-center justify-center p-4 bg-[#fff8e7]\"><div class=\"text-center text-lg my-auto max-w-2xl w-full px-4\"><h1 id=\"title\" class=\"text-4xl font-bold mb-6\">") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var7 string - templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(header) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 54, Col: 59} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</h1>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ_7745c5c3_Var4.Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<p class=\"text-gray-700 mt-4\">") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = UnsafeT("footer.author", i18n.M{ - "cerberus": `<a href="https://github.com/SJTUG/cerberus" class="text-amber-600 hover:text-amber-700">Cerberus</a>`, - "sjtug": `<a href="https://sjtug.org" class="text-amber-600 hover:text-amber-700">SJTUG</a>`}).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</p><p class=\"text-gray-700 text-sm\">") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = UnsafeT("footer.upstream", i18n.M{ - "anubis": `<a href="https://github.com/TecharoHQ/anubis" class="text-amber-600 hover:text-amber-700">Anubis</a>`, - "techaro": `<a href="https://techaro.lol" class="text-amber-600 hover:text-amber-700">Techaro</a>`}).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</p></div><p class=\"text-gray-700 text-sm pt-2\">request_id: ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var8 string - templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(GetRequestID(ctx)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 68, Col: 35} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "</p></body></html>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func Challenge(challenge string, difficulty int, nonce uint32, ts int64, signature string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var9 := templ.GetChildren(ctx) - if templ_7745c5c3_Var9 == nil { - templ_7745c5c3_Var9 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - - challengeInput := struct { - Challenge string `json:"challenge"` - Difficulty int `json:"difficulty"` - Nonce uint32 `json:"nonce"` - TS int64 `json:"ts"` - Signature string `json:"signature"` - }{challenge, difficulty, nonce, ts, signature} - - baseURL := GetBaseURL(ctx) - version := GetVersion(ctx) - locale := GetLocale(ctx) - metaInput := struct { - BaseURL string `json:"baseURL"` - Version string `json:"version"` - Locale string `json:"locale"` - }{baseURL, version, locale} - - relPath := func(path string) string { - return baseURL + path + "?v=" + version - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "<img id=\"mascot\" src=\"") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var10 string - templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(relPath("/static/img/mascot-puzzle.png")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 97, Col: 64} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\" alt=\"Cute anime mascot character\" class=\"mx-auto p-4 mb-2 max-w-64\"><div id=\"status-container\"><p id=\"status\" class=\"text-gray-700 mb-1\">status</p><p id=\"metrics\" class=\"text-gray-700 mb-1\">metrics</p><p id=\"message\" class=\"text-gray-700 mb-2\">message</p><!-- Progress Bar (hidden in success state) --><div id=\"progress-container\" class=\"w-48 h-6 bg-white rounded-full border-2 border-[#b79ecf] p-1 mt-2 mb-4 mx-auto\"><div id=\"progress-bar\" class=\"h-full w-[60%] bg-[#b79ecf] rounded-full transition-all duration-300\"></div></div></div><details class=\"mb-4\"><summary class=\"cursor-pointer text-gray-600 hover:text-gray-800\">") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = T("challenge.why_seeing").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</summary><div class=\"mt-2 text-base text-gray-600 space-y-2\"><p>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = UnsafeT("challenge.why_seeing_body.part_1", i18n.M{ - "cerberus": `<a href="https://github.com/SJTUG/cerberus" class="text-amber-600 hover:text-amber-700">Cerberus</a>`, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "</p><p>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = UnsafeT("challenge.why_seeing_body.part_2", i18n.M{ - "anubis": `<a href="https://github.com/TecharoHQ/anubis" class="text-amber-600 hover:text-amber-700">Anubis</a>`, - "techaro": `<a href="https://techaro.lol" class="text-amber-600 hover:text-amber-700">Techaro</a>`, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "</p><p>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = UnsafeT("challenge.why_seeing_body.part_3", i18n.M{ - "jshelter": `<a href="https://jshelter.org/" class="text-amber-600 hover:text-amber-700">JShelter</a>`, - }).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</p></div></details><noscript><p>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = T("challenge.must_enable_js").Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "</p></noscript><script async defer id=\"challenge-script\" x-meta=\"") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var11 string - templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(templ.JSONString(metaInput)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 135, Col: 79} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "\" x-challenge=\"") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var12 string - templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(templ.JSONString(challengeInput)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 135, Col: 128} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "\" src=\"") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var13 string - templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(relPath("/static/main.js")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 135, Col: 163} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "\"></script>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - return nil - }) -} - -func Error(message string, description string, mail string) templ.Component { - return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { - templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } - templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) - if !templ_7745c5c3_IsBuffer { - defer func() { - templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) - if templ_7745c5c3_Err == nil { - templ_7745c5c3_Err = templ_7745c5c3_BufErr - } - }() - } - ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var14 := templ.GetChildren(ctx) - if templ_7745c5c3_Var14 == nil { - templ_7745c5c3_Var14 = templ.NopComponent - } - ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<img id=\"mascot\" src=\"") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var15 string - templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(GetBaseURL(ctx) + "/static/img/mascot-fail.png?v=" + GetVersion(ctx)) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 139, Col: 92} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "\" alt=\"Cute anime mascot character with a sad face\" class=\"mx-auto p-4 mb-2 max-w-64\"><p id=\"message\" class=\"text-gray-700 mb-2\">") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var16 string - templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(message) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 140, Col: 53} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "</p><p id=\"description\" class=\"text-gray-700 mb-2\">") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var17 string - templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(description) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/index.templ`, Line: 141, Col: 61} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</p>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - if mail != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "<p class=\"text-gray-700 mb-4\">") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = UnsafeT("error.contact_us", i18n.M{"mail": `<a href="mailto:` + mail + `" class="text-amber-600 hover:text-amber-700">` + mail + `</a>`}).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</p>") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - return nil - }) -} - -var _ = templruntime.GeneratedTemplate diff --git a/vendor/github.com/zeebo/xxh3/.gitignore b/vendor/github.com/zeebo/xxh3/.gitignore deleted file mode 100644 index 928e12f..0000000 --- a/vendor/github.com/zeebo/xxh3/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -upstream -*.pprof -xxh3.test -.vscode -*.txt -_compat diff --git a/vendor/github.com/zeebo/xxh3/LICENSE b/vendor/github.com/zeebo/xxh3/LICENSE deleted file mode 100644 index 477f8e5..0000000 --- a/vendor/github.com/zeebo/xxh3/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -xxHash Library -Copyright (c) 2012-2014, Yann Collet -Copyright (c) 2019, Jeff Wendling -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/zeebo/xxh3/Makefile b/vendor/github.com/zeebo/xxh3/Makefile deleted file mode 100644 index 8bd78c4..0000000 --- a/vendor/github.com/zeebo/xxh3/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -.PHONY: all vet -all: genasm _compat - -genasm: avo/avx.go avo/sse.go - cd ./avo; go generate gen.go - -clean: - rm accum_vector_avx_amd64.s - rm accum_vector_sse_amd64.s - rm _compat - -upstream/xxhash.o: upstream/xxhash.h - ( cd upstream && make ) - -_compat: _compat.c upstream/xxhash.o - gcc -o _compat _compat.c ./upstream/xxhash.o - -vet: - GOOS=linux GOARCH=386 GO386=softfloat go vet ./... - GOOS=windows GOARCH=386 GO386=softfloat go vet ./... - GOOS=linux GOARCH=amd64 go vet ./... - GOOS=windows GOARCH=amd64 go vet ./... - GOOS=darwin GOARCH=amd64 go vet ./... - GOOS=linux GOARCH=arm go vet ./... - GOOS=linux GOARCH=arm64 go vet ./... - GOOS=windows GOARCH=arm64 go vet ./... - GOOS=darwin GOARCH=arm64 go vet ./...
\ No newline at end of file diff --git a/vendor/github.com/zeebo/xxh3/README.md b/vendor/github.com/zeebo/xxh3/README.md deleted file mode 100644 index 4633fc0..0000000 --- a/vendor/github.com/zeebo/xxh3/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# XXH3 -[](https://godoc.org/github.com/zeebo/xxh3) -[](https://sourcegraph.com/github.com/zeebo/xxh3?badge) -[](https://goreportcard.com/report/github.com/zeebo/xxh3) - -This package is a port of the [xxh3](https://github.com/Cyan4973/xxHash) library to Go. - -Upstream has fixed the output as of v0.8.0, and this package matches that. - ---- - -# Benchmarks - -Run on my `i7-8850H CPU @ 2.60GHz` - -## Small Sizes - -| Bytes | Rate | -|-----------|--------------------------------------| -|` 0 ` |` 0.74 ns/op ` | -|` 1-3 ` |` 4.19 ns/op (0.24 GB/s - 0.71 GB/s) `| -|` 4-8 ` |` 4.16 ns/op (0.97 GB/s - 1.98 GB/s) `| -|` 9-16 ` |` 4.46 ns/op (2.02 GB/s - 3.58 GB/s) `| -|` 17-32 ` |` 6.22 ns/op (2.76 GB/s - 5.15 GB/s) `| -|` 33-64 ` |` 8.00 ns/op (4.13 GB/s - 8.13 GB/s) `| -|` 65-96 ` |` 11.0 ns/op (5.91 GB/s - 8.84 GB/s) `| -|` 97-128 ` |` 12.8 ns/op (7.68 GB/s - 10.0 GB/s) `| - -## Large Sizes - -| Bytes | Rate | SSE2 Rate | AVX2 Rate | -|---------|--------------------------|--------------------------|--------------------------| -|` 129 ` |` 13.6 ns/op (9.45 GB/s) `| | | -|` 240 ` |` 23.8 ns/op (10.1 GB/s) `| | | -|` 241 ` |` 40.5 ns/op (5.97 GB/s) `|` 23.3 ns/op (10.4 GB/s) `|` 20.1 ns/op (12.0 GB/s) `| -|` 512 ` |` 69.8 ns/op (7.34 GB/s) `|` 30.4 ns/op (16.9 GB/s) `|` 24.7 ns/op (20.7 GB/s) `| -|` 1024 ` |` 132 ns/op (7.77 GB/s) `|` 48.9 ns/op (20.9 GB/s) `|` 37.7 ns/op (27.2 GB/s) `| -|` 100KB `|` 13.0 us/op (7.88 GB/s) `|` 4.05 us/op (25.3 GB/s) `|` 2.31 us/op (44.3 GB/s) `| diff --git a/vendor/github.com/zeebo/xxh3/_compat.c b/vendor/github.com/zeebo/xxh3/_compat.c deleted file mode 100644 index fda9f36..0000000 --- a/vendor/github.com/zeebo/xxh3/_compat.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "upstream/xxhash.h" -#include <stdio.h> - -int main() { - unsigned char buf[4096]; - for (int i = 0; i < 4096; i++) { - buf[i] = (unsigned char)((i+1)%251); - } - - printf("var testVecs64 = []uint64{\n"); - for (int i = 0; i < 4096; i++) { - if (i % 4 == 0) { - printf("\t"); - } - - uint64_t h = XXH3_64bits(buf, (size_t)i); - printf("0x%lx, ", h); - - if (i % 4 == 3) { - printf("\n\t"); - } - } - printf("}\n\n"); - - printf("var testVecs128 = [][2]uint64{\n"); - for (int i = 0; i < 4096; i++) { - if (i % 4 == 0) { - printf("\t"); - } - - XXH128_hash_t h = XXH3_128bits(buf, (size_t)i); - printf("{0x%lx, 0x%lx}, ", h.high64, h.low64); - - if (i % 4 == 3) { - printf("\n"); - } - } - printf("}\n\n"); -} diff --git a/vendor/github.com/zeebo/xxh3/accum_generic.go b/vendor/github.com/zeebo/xxh3/accum_generic.go deleted file mode 100644 index b1be785..0000000 --- a/vendor/github.com/zeebo/xxh3/accum_generic.go +++ /dev/null @@ -1,542 +0,0 @@ -package xxh3 - -// avx512Switch is the size at which the avx512 code is used. -// Bigger blocks benefit more. -const avx512Switch = 1 << 10 - -func accumScalar(accs *[8]u64, p, secret ptr, l u64) { - if secret != key { - accumScalarSeed(accs, p, secret, l) - return - } - for l > _block { - k := secret - - // accs - for i := 0; i < 16; i++ { - dv0 := readU64(p, 8*0) - dk0 := dv0 ^ readU64(k, 8*0) - accs[1] += dv0 - accs[0] += (dk0 & 0xffffffff) * (dk0 >> 32) - - dv1 := readU64(p, 8*1) - dk1 := dv1 ^ readU64(k, 8*1) - accs[0] += dv1 - accs[1] += (dk1 & 0xffffffff) * (dk1 >> 32) - - dv2 := readU64(p, 8*2) - dk2 := dv2 ^ readU64(k, 8*2) - accs[3] += dv2 - accs[2] += (dk2 & 0xffffffff) * (dk2 >> 32) - - dv3 := readU64(p, 8*3) - dk3 := dv3 ^ readU64(k, 8*3) - accs[2] += dv3 - accs[3] += (dk3 & 0xffffffff) * (dk3 >> 32) - - dv4 := readU64(p, 8*4) - dk4 := dv4 ^ readU64(k, 8*4) - accs[5] += dv4 - accs[4] += (dk4 & 0xffffffff) * (dk4 >> 32) - - dv5 := readU64(p, 8*5) - dk5 := dv5 ^ readU64(k, 8*5) - accs[4] += dv5 - accs[5] += (dk5 & 0xffffffff) * (dk5 >> 32) - - dv6 := readU64(p, 8*6) - dk6 := dv6 ^ readU64(k, 8*6) - accs[7] += dv6 - accs[6] += (dk6 & 0xffffffff) * (dk6 >> 32) - - dv7 := readU64(p, 8*7) - dk7 := dv7 ^ readU64(k, 8*7) - accs[6] += dv7 - accs[7] += (dk7 & 0xffffffff) * (dk7 >> 32) - - l -= _stripe - if l > 0 { - p, k = ptr(ui(p)+_stripe), ptr(ui(k)+8) - } - } - - // scramble accs - accs[0] ^= accs[0] >> 47 - accs[0] ^= key64_128 - accs[0] *= prime32_1 - - accs[1] ^= accs[1] >> 47 - accs[1] ^= key64_136 - accs[1] *= prime32_1 - - accs[2] ^= accs[2] >> 47 - accs[2] ^= key64_144 - accs[2] *= prime32_1 - - accs[3] ^= accs[3] >> 47 - accs[3] ^= key64_152 - accs[3] *= prime32_1 - - accs[4] ^= accs[4] >> 47 - accs[4] ^= key64_160 - accs[4] *= prime32_1 - - accs[5] ^= accs[5] >> 47 - accs[5] ^= key64_168 - accs[5] *= prime32_1 - - accs[6] ^= accs[6] >> 47 - accs[6] ^= key64_176 - accs[6] *= prime32_1 - - accs[7] ^= accs[7] >> 47 - accs[7] ^= key64_184 - accs[7] *= prime32_1 - } - - if l > 0 { - t, k := (l-1)/_stripe, secret - - for i := u64(0); i < t; i++ { - dv0 := readU64(p, 8*0) - dk0 := dv0 ^ readU64(k, 8*0) - accs[1] += dv0 - accs[0] += (dk0 & 0xffffffff) * (dk0 >> 32) - - dv1 := readU64(p, 8*1) - dk1 := dv1 ^ readU64(k, 8*1) - accs[0] += dv1 - accs[1] += (dk1 & 0xffffffff) * (dk1 >> 32) - - dv2 := readU64(p, 8*2) - dk2 := dv2 ^ readU64(k, 8*2) - accs[3] += dv2 - accs[2] += (dk2 & 0xffffffff) * (dk2 >> 32) - - dv3 := readU64(p, 8*3) - dk3 := dv3 ^ readU64(k, 8*3) - accs[2] += dv3 - accs[3] += (dk3 & 0xffffffff) * (dk3 >> 32) - - dv4 := readU64(p, 8*4) - dk4 := dv4 ^ readU64(k, 8*4) - accs[5] += dv4 - accs[4] += (dk4 & 0xffffffff) * (dk4 >> 32) - - dv5 := readU64(p, 8*5) - dk5 := dv5 ^ readU64(k, 8*5) - accs[4] += dv5 - accs[5] += (dk5 & 0xffffffff) * (dk5 >> 32) - - dv6 := readU64(p, 8*6) - dk6 := dv6 ^ readU64(k, 8*6) - accs[7] += dv6 - accs[6] += (dk6 & 0xffffffff) * (dk6 >> 32) - - dv7 := readU64(p, 8*7) - dk7 := dv7 ^ readU64(k, 8*7) - accs[6] += dv7 - accs[7] += (dk7 & 0xffffffff) * (dk7 >> 32) - - l -= _stripe - if l > 0 { - p, k = ptr(ui(p)+_stripe), ptr(ui(k)+8) - } - } - - if l > 0 { - p = ptr(ui(p) - uintptr(_stripe-l)) - - dv0 := readU64(p, 8*0) - dk0 := dv0 ^ key64_121 - accs[1] += dv0 - accs[0] += (dk0 & 0xffffffff) * (dk0 >> 32) - - dv1 := readU64(p, 8*1) - dk1 := dv1 ^ key64_129 - accs[0] += dv1 - accs[1] += (dk1 & 0xffffffff) * (dk1 >> 32) - - dv2 := readU64(p, 8*2) - dk2 := dv2 ^ key64_137 - accs[3] += dv2 - accs[2] += (dk2 & 0xffffffff) * (dk2 >> 32) - - dv3 := readU64(p, 8*3) - dk3 := dv3 ^ key64_145 - accs[2] += dv3 - accs[3] += (dk3 & 0xffffffff) * (dk3 >> 32) - - dv4 := readU64(p, 8*4) - dk4 := dv4 ^ key64_153 - accs[5] += dv4 - accs[4] += (dk4 & 0xffffffff) * (dk4 >> 32) - - dv5 := readU64(p, 8*5) - dk5 := dv5 ^ key64_161 - accs[4] += dv5 - accs[5] += (dk5 & 0xffffffff) * (dk5 >> 32) - - dv6 := readU64(p, 8*6) - dk6 := dv6 ^ key64_169 - accs[7] += dv6 - accs[6] += (dk6 & 0xffffffff) * (dk6 >> 32) - - dv7 := readU64(p, 8*7) - dk7 := dv7 ^ key64_177 - accs[6] += dv7 - accs[7] += (dk7 & 0xffffffff) * (dk7 >> 32) - } - } -} - -func accumBlockScalar(accs *[8]u64, p, secret ptr) { - if secret != key { - accumBlockScalarSeed(accs, p, secret) - return - } - // accs - for i := 0; i < 16; i++ { - dv0 := readU64(p, 8*0) - dk0 := dv0 ^ readU64(secret, 8*0) - accs[1] += dv0 - accs[0] += (dk0 & 0xffffffff) * (dk0 >> 32) - - dv1 := readU64(p, 8*1) - dk1 := dv1 ^ readU64(secret, 8*1) - accs[0] += dv1 - accs[1] += (dk1 & 0xffffffff) * (dk1 >> 32) - - dv2 := readU64(p, 8*2) - dk2 := dv2 ^ readU64(secret, 8*2) - accs[3] += dv2 - accs[2] += (dk2 & 0xffffffff) * (dk2 >> 32) - - dv3 := readU64(p, 8*3) - dk3 := dv3 ^ readU64(secret, 8*3) - accs[2] += dv3 - accs[3] += (dk3 & 0xffffffff) * (dk3 >> 32) - - dv4 := readU64(p, 8*4) - dk4 := dv4 ^ readU64(secret, 8*4) - accs[5] += dv4 - accs[4] += (dk4 & 0xffffffff) * (dk4 >> 32) - - dv5 := readU64(p, 8*5) - dk5 := dv5 ^ readU64(secret, 8*5) - accs[4] += dv5 - accs[5] += (dk5 & 0xffffffff) * (dk5 >> 32) - - dv6 := readU64(p, 8*6) - dk6 := dv6 ^ readU64(secret, 8*6) - accs[7] += dv6 - accs[6] += (dk6 & 0xffffffff) * (dk6 >> 32) - - dv7 := readU64(p, 8*7) - dk7 := dv7 ^ readU64(secret, 8*7) - accs[6] += dv7 - accs[7] += (dk7 & 0xffffffff) * (dk7 >> 32) - - p, secret = ptr(ui(p)+_stripe), ptr(ui(secret)+8) - } - - // scramble accs - accs[0] ^= accs[0] >> 47 - accs[0] ^= key64_128 - accs[0] *= prime32_1 - - accs[1] ^= accs[1] >> 47 - accs[1] ^= key64_136 - accs[1] *= prime32_1 - - accs[2] ^= accs[2] >> 47 - accs[2] ^= key64_144 - accs[2] *= prime32_1 - - accs[3] ^= accs[3] >> 47 - accs[3] ^= key64_152 - accs[3] *= prime32_1 - - accs[4] ^= accs[4] >> 47 - accs[4] ^= key64_160 - accs[4] *= prime32_1 - - accs[5] ^= accs[5] >> 47 - accs[5] ^= key64_168 - accs[5] *= prime32_1 - - accs[6] ^= accs[6] >> 47 - accs[6] ^= key64_176 - accs[6] *= prime32_1 - - accs[7] ^= accs[7] >> 47 - accs[7] ^= key64_184 - accs[7] *= prime32_1 -} - -// accumScalarSeed should be used with custom key. -func accumScalarSeed(accs *[8]u64, p, secret ptr, l u64) { - for l > _block { - k := secret - - // accs - for i := 0; i < 16; i++ { - dv0 := readU64(p, 8*0) - dk0 := dv0 ^ readU64(k, 8*0) - accs[1] += dv0 - accs[0] += (dk0 & 0xffffffff) * (dk0 >> 32) - - dv1 := readU64(p, 8*1) - dk1 := dv1 ^ readU64(k, 8*1) - accs[0] += dv1 - accs[1] += (dk1 & 0xffffffff) * (dk1 >> 32) - - dv2 := readU64(p, 8*2) - dk2 := dv2 ^ readU64(k, 8*2) - accs[3] += dv2 - accs[2] += (dk2 & 0xffffffff) * (dk2 >> 32) - - dv3 := readU64(p, 8*3) - dk3 := dv3 ^ readU64(k, 8*3) - accs[2] += dv3 - accs[3] += (dk3 & 0xffffffff) * (dk3 >> 32) - - dv4 := readU64(p, 8*4) - dk4 := dv4 ^ readU64(k, 8*4) - accs[5] += dv4 - accs[4] += (dk4 & 0xffffffff) * (dk4 >> 32) - - dv5 := readU64(p, 8*5) - dk5 := dv5 ^ readU64(k, 8*5) - accs[4] += dv5 - accs[5] += (dk5 & 0xffffffff) * (dk5 >> 32) - - dv6 := readU64(p, 8*6) - dk6 := dv6 ^ readU64(k, 8*6) - accs[7] += dv6 - accs[6] += (dk6 & 0xffffffff) * (dk6 >> 32) - - dv7 := readU64(p, 8*7) - dk7 := dv7 ^ readU64(k, 8*7) - accs[6] += dv7 - accs[7] += (dk7 & 0xffffffff) * (dk7 >> 32) - - l -= _stripe - if l > 0 { - p, k = ptr(ui(p)+_stripe), ptr(ui(k)+8) - } - } - - // scramble accs - accs[0] ^= accs[0] >> 47 - accs[0] ^= readU64(secret, 128) - accs[0] *= prime32_1 - - accs[1] ^= accs[1] >> 47 - accs[1] ^= readU64(secret, 136) - accs[1] *= prime32_1 - - accs[2] ^= accs[2] >> 47 - accs[2] ^= readU64(secret, 144) - accs[2] *= prime32_1 - - accs[3] ^= accs[3] >> 47 - accs[3] ^= readU64(secret, 152) - accs[3] *= prime32_1 - - accs[4] ^= accs[4] >> 47 - accs[4] ^= readU64(secret, 160) - accs[4] *= prime32_1 - - accs[5] ^= accs[5] >> 47 - accs[5] ^= readU64(secret, 168) - accs[5] *= prime32_1 - - accs[6] ^= accs[6] >> 47 - accs[6] ^= readU64(secret, 176) - accs[6] *= prime32_1 - - accs[7] ^= accs[7] >> 47 - accs[7] ^= readU64(secret, 184) - accs[7] *= prime32_1 - } - - if l > 0 { - t, k := (l-1)/_stripe, secret - - for i := u64(0); i < t; i++ { - dv0 := readU64(p, 8*0) - dk0 := dv0 ^ readU64(k, 8*0) - accs[1] += dv0 - accs[0] += (dk0 & 0xffffffff) * (dk0 >> 32) - - dv1 := readU64(p, 8*1) - dk1 := dv1 ^ readU64(k, 8*1) - accs[0] += dv1 - accs[1] += (dk1 & 0xffffffff) * (dk1 >> 32) - - dv2 := readU64(p, 8*2) - dk2 := dv2 ^ readU64(k, 8*2) - accs[3] += dv2 - accs[2] += (dk2 & 0xffffffff) * (dk2 >> 32) - - dv3 := readU64(p, 8*3) - dk3 := dv3 ^ readU64(k, 8*3) - accs[2] += dv3 - accs[3] += (dk3 & 0xffffffff) * (dk3 >> 32) - - dv4 := readU64(p, 8*4) - dk4 := dv4 ^ readU64(k, 8*4) - accs[5] += dv4 - accs[4] += (dk4 & 0xffffffff) * (dk4 >> 32) - - dv5 := readU64(p, 8*5) - dk5 := dv5 ^ readU64(k, 8*5) - accs[4] += dv5 - accs[5] += (dk5 & 0xffffffff) * (dk5 >> 32) - - dv6 := readU64(p, 8*6) - dk6 := dv6 ^ readU64(k, 8*6) - accs[7] += dv6 - accs[6] += (dk6 & 0xffffffff) * (dk6 >> 32) - - dv7 := readU64(p, 8*7) - dk7 := dv7 ^ readU64(k, 8*7) - accs[6] += dv7 - accs[7] += (dk7 & 0xffffffff) * (dk7 >> 32) - - l -= _stripe - if l > 0 { - p, k = ptr(ui(p)+_stripe), ptr(ui(k)+8) - } - } - - if l > 0 { - p = ptr(ui(p) - uintptr(_stripe-l)) - - dv0 := readU64(p, 8*0) - dk0 := dv0 ^ readU64(secret, 121) - accs[1] += dv0 - accs[0] += (dk0 & 0xffffffff) * (dk0 >> 32) - - dv1 := readU64(p, 8*1) - dk1 := dv1 ^ readU64(secret, 129) - accs[0] += dv1 - accs[1] += (dk1 & 0xffffffff) * (dk1 >> 32) - - dv2 := readU64(p, 8*2) - dk2 := dv2 ^ readU64(secret, 137) - accs[3] += dv2 - accs[2] += (dk2 & 0xffffffff) * (dk2 >> 32) - - dv3 := readU64(p, 8*3) - dk3 := dv3 ^ readU64(secret, 145) - accs[2] += dv3 - accs[3] += (dk3 & 0xffffffff) * (dk3 >> 32) - - dv4 := readU64(p, 8*4) - dk4 := dv4 ^ readU64(secret, 153) - accs[5] += dv4 - accs[4] += (dk4 & 0xffffffff) * (dk4 >> 32) - - dv5 := readU64(p, 8*5) - dk5 := dv5 ^ readU64(secret, 161) - accs[4] += dv5 - accs[5] += (dk5 & 0xffffffff) * (dk5 >> 32) - - dv6 := readU64(p, 8*6) - dk6 := dv6 ^ readU64(secret, 169) - accs[7] += dv6 - accs[6] += (dk6 & 0xffffffff) * (dk6 >> 32) - - dv7 := readU64(p, 8*7) - dk7 := dv7 ^ readU64(secret, 177) - accs[6] += dv7 - accs[7] += (dk7 & 0xffffffff) * (dk7 >> 32) - } - } -} - -// accumBlockScalarSeed should be used with custom key. -func accumBlockScalarSeed(accs *[8]u64, p, secret ptr) { - // accs - { - secret := secret - for i := 0; i < 16; i++ { - dv0 := readU64(p, 8*0) - dk0 := dv0 ^ readU64(secret, 8*0) - accs[1] += dv0 - accs[0] += (dk0 & 0xffffffff) * (dk0 >> 32) - - dv1 := readU64(p, 8*1) - dk1 := dv1 ^ readU64(secret, 8*1) - accs[0] += dv1 - accs[1] += (dk1 & 0xffffffff) * (dk1 >> 32) - - dv2 := readU64(p, 8*2) - dk2 := dv2 ^ readU64(secret, 8*2) - accs[3] += dv2 - accs[2] += (dk2 & 0xffffffff) * (dk2 >> 32) - - dv3 := readU64(p, 8*3) - dk3 := dv3 ^ readU64(secret, 8*3) - accs[2] += dv3 - accs[3] += (dk3 & 0xffffffff) * (dk3 >> 32) - - dv4 := readU64(p, 8*4) - dk4 := dv4 ^ readU64(secret, 8*4) - accs[5] += dv4 - accs[4] += (dk4 & 0xffffffff) * (dk4 >> 32) - - dv5 := readU64(p, 8*5) - dk5 := dv5 ^ readU64(secret, 8*5) - accs[4] += dv5 - accs[5] += (dk5 & 0xffffffff) * (dk5 >> 32) - - dv6 := readU64(p, 8*6) - dk6 := dv6 ^ readU64(secret, 8*6) - accs[7] += dv6 - accs[6] += (dk6 & 0xffffffff) * (dk6 >> 32) - - dv7 := readU64(p, 8*7) - dk7 := dv7 ^ readU64(secret, 8*7) - accs[6] += dv7 - accs[7] += (dk7 & 0xffffffff) * (dk7 >> 32) - - p, secret = ptr(ui(p)+_stripe), ptr(ui(secret)+8) - } - } - - // scramble accs - accs[0] ^= accs[0] >> 47 - accs[0] ^= readU64(secret, 128) - accs[0] *= prime32_1 - - accs[1] ^= accs[1] >> 47 - accs[1] ^= readU64(secret, 136) - accs[1] *= prime32_1 - - accs[2] ^= accs[2] >> 47 - accs[2] ^= readU64(secret, 144) - accs[2] *= prime32_1 - - accs[3] ^= accs[3] >> 47 - accs[3] ^= readU64(secret, 152) - accs[3] *= prime32_1 - - accs[4] ^= accs[4] >> 47 - accs[4] ^= readU64(secret, 160) - accs[4] *= prime32_1 - - accs[5] ^= accs[5] >> 47 - accs[5] ^= readU64(secret, 168) - accs[5] *= prime32_1 - - accs[6] ^= accs[6] >> 47 - accs[6] ^= readU64(secret, 176) - accs[6] *= prime32_1 - - accs[7] ^= accs[7] >> 47 - accs[7] ^= readU64(secret, 184) - accs[7] *= prime32_1 -} diff --git a/vendor/github.com/zeebo/xxh3/accum_stubs_amd64.go b/vendor/github.com/zeebo/xxh3/accum_stubs_amd64.go deleted file mode 100644 index 9baff6c..0000000 --- a/vendor/github.com/zeebo/xxh3/accum_stubs_amd64.go +++ /dev/null @@ -1,40 +0,0 @@ -package xxh3 - -import ( - "unsafe" - - "github.com/klauspost/cpuid/v2" -) - -var ( - hasAVX2 = cpuid.CPU.Has(cpuid.AVX2) - hasSSE2 = cpuid.CPU.Has(cpuid.SSE2) // Always true on amd64 - hasAVX512 = cpuid.CPU.Has(cpuid.AVX512F) -) - -//go:noescape -func accumAVX2(acc *[8]u64, data, key unsafe.Pointer, len u64) - -//go:noescape -func accumAVX512(acc *[8]u64, data, key unsafe.Pointer, len u64) - -//go:noescape -func accumSSE(acc *[8]u64, data, key unsafe.Pointer, len u64) - -//go:noescape -func accumBlockAVX2(acc *[8]u64, data, key unsafe.Pointer) - -//go:noescape -func accumBlockSSE(acc *[8]u64, data, key unsafe.Pointer) - -func withOverrides(avx512, avx2, sse2 bool, cb func()) { - avx512Orig, avx2Orig, sse2Orig := hasAVX512, hasAVX2, hasSSE2 - hasAVX512, hasAVX2, hasSSE2 = avx512, avx2, sse2 - defer func() { hasAVX512, hasAVX2, hasSSE2 = avx512Orig, avx2Orig, sse2Orig }() - cb() -} - -func withAVX512(cb func()) { withOverrides(hasAVX512, false, false, cb) } -func withAVX2(cb func()) { withOverrides(false, hasAVX2, false, cb) } -func withSSE2(cb func()) { withOverrides(false, false, hasSSE2, cb) } -func withGeneric(cb func()) { withOverrides(false, false, false, cb) } diff --git a/vendor/github.com/zeebo/xxh3/accum_stubs_other.go b/vendor/github.com/zeebo/xxh3/accum_stubs_other.go deleted file mode 100644 index 93bf625..0000000 --- a/vendor/github.com/zeebo/xxh3/accum_stubs_other.go +++ /dev/null @@ -1,25 +0,0 @@ -//go:build !amd64 -// +build !amd64 - -package xxh3 - -import ( - "unsafe" -) - -const ( - hasAVX2 = false - hasSSE2 = false - hasAVX512 = false -) - -func accumAVX2(acc *[8]u64, data, key unsafe.Pointer, len u64) { panic("unreachable") } -func accumSSE(acc *[8]u64, data, key unsafe.Pointer, len u64) { panic("unreachable") } -func accumBlockAVX2(acc *[8]u64, data, key unsafe.Pointer) { panic("unreachable") } -func accumBlockSSE(acc *[8]u64, data, key unsafe.Pointer) { panic("unreachable") } -func accumAVX512(acc *[8]u64, data, key unsafe.Pointer, len u64) { panic("unreachable") } - -func withAVX512(cb func()) { cb() } -func withAVX2(cb func()) { cb() } -func withSSE2(cb func()) { cb() } -func withGeneric(cb func()) { cb() } diff --git a/vendor/github.com/zeebo/xxh3/accum_vector_avx512_amd64.s b/vendor/github.com/zeebo/xxh3/accum_vector_avx512_amd64.s deleted file mode 100644 index cfaf9f0..0000000 --- a/vendor/github.com/zeebo/xxh3/accum_vector_avx512_amd64.s +++ /dev/null @@ -1,379 +0,0 @@ -// Code generated by command: go run gen.go -avx512 -out ../accum_vector_avx512_amd64.s -pkg xxh3. DO NOT EDIT. - -#include "textflag.h" - -DATA prime_avx512<>+0(SB)/8, $0x000000009e3779b1 -DATA prime_avx512<>+8(SB)/8, $0x000000009e3779b1 -DATA prime_avx512<>+16(SB)/8, $0x000000009e3779b1 -DATA prime_avx512<>+24(SB)/8, $0x000000009e3779b1 -DATA prime_avx512<>+32(SB)/8, $0x000000009e3779b1 -DATA prime_avx512<>+40(SB)/8, $0x000000009e3779b1 -DATA prime_avx512<>+48(SB)/8, $0x000000009e3779b1 -DATA prime_avx512<>+56(SB)/8, $0x000000009e3779b1 -GLOBL prime_avx512<>(SB), RODATA|NOPTR, $64 - -// func accumAVX512(acc *[8]uint64, data *byte, key *byte, len uint64) -// Requires: AVX, AVX512F, MMX+ -TEXT ·accumAVX512(SB), NOSPLIT, $0-32 - MOVQ acc+0(FP), AX - MOVQ data+8(FP), CX - MOVQ key+16(FP), DX - MOVQ len+24(FP), BX - VMOVDQU64 (AX), Z1 - VMOVDQU64 prime_avx512<>+0(SB), Z0 - VMOVDQU64 (DX), Z2 - VMOVDQU64 8(DX), Z3 - VMOVDQU64 16(DX), Z4 - VMOVDQU64 24(DX), Z5 - VMOVDQU64 32(DX), Z6 - VMOVDQU64 40(DX), Z7 - VMOVDQU64 48(DX), Z8 - VMOVDQU64 56(DX), Z9 - VMOVDQU64 64(DX), Z10 - VMOVDQU64 72(DX), Z11 - VMOVDQU64 80(DX), Z12 - VMOVDQU64 88(DX), Z13 - VMOVDQU64 96(DX), Z14 - VMOVDQU64 104(DX), Z15 - VMOVDQU64 112(DX), Z16 - VMOVDQU64 120(DX), Z17 - VMOVDQU64 128(DX), Z18 - VMOVDQU64 121(DX), Z19 - -accum_large: - CMPQ BX, $0x00000400 - JLE accum - VMOVDQU64 (CX), Z20 - PREFETCHT0 1024(CX) - VPXORD Z2, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 64(CX), Z20 - PREFETCHT0 1088(CX) - VPXORD Z3, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 128(CX), Z20 - PREFETCHT0 1152(CX) - VPXORD Z4, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 192(CX), Z20 - PREFETCHT0 1216(CX) - VPXORD Z5, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 256(CX), Z20 - PREFETCHT0 1280(CX) - VPXORD Z6, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 320(CX), Z20 - PREFETCHT0 1344(CX) - VPXORD Z7, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 384(CX), Z20 - PREFETCHT0 1408(CX) - VPXORD Z8, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 448(CX), Z20 - PREFETCHT0 1472(CX) - VPXORD Z9, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 512(CX), Z20 - PREFETCHT0 1536(CX) - VPXORD Z10, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 576(CX), Z20 - PREFETCHT0 1600(CX) - VPXORD Z11, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 640(CX), Z20 - PREFETCHT0 1664(CX) - VPXORD Z12, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 704(CX), Z20 - PREFETCHT0 1728(CX) - VPXORD Z13, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 768(CX), Z20 - PREFETCHT0 1792(CX) - VPXORD Z14, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 832(CX), Z20 - PREFETCHT0 1856(CX) - VPXORD Z15, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 896(CX), Z20 - PREFETCHT0 1920(CX) - VPXORD Z16, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - VMOVDQU64 960(CX), Z20 - PREFETCHT0 1984(CX) - VPXORD Z17, Z20, Z21 - VPSHUFD $0x31, Z21, Z22 - VPMULUDQ Z21, Z22, Z21 - VPSHUFD $0x4e, Z20, Z20 - VPADDQ Z1, Z20, Z1 - VPADDQ Z1, Z21, Z1 - ADDQ $0x00000400, CX - SUBQ $0x00000400, BX - VPSRLQ $0x2f, Z1, Z20 - VPTERNLOGD $0x96, Z1, Z18, Z20 - VPMULUDQ Z0, Z20, Z1 - VPSHUFD $0xf5, Z20, Z20 - VPMULUDQ Z0, Z20, Z20 - VPSLLQ $0x20, Z20, Z20 - VPADDQ Z1, Z20, Z1 - JMP accum_large - -accum: - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z2, Z0, Z2 - VPSHUFD $0x31, Z2, Z18 - VPMULUDQ Z2, Z18, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z3, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z4, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z5, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z6, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z7, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z8, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z9, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z10, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z11, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z12, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z13, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z14, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z15, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z16, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - CMPQ BX, $0x40 - JLE finalize - VMOVDQU64 (CX), Z0 - VPXORD Z17, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - ADDQ $0x00000040, CX - SUBQ $0x00000040, BX - -finalize: - CMPQ BX, $0x00 - JE return - SUBQ $0x40, CX - ADDQ BX, CX - VMOVDQU64 (CX), Z0 - VPXORD Z19, Z0, Z2 - VPSHUFD $0x31, Z2, Z3 - VPMULUDQ Z2, Z3, Z2 - VPSHUFD $0x4e, Z0, Z0 - VPADDQ Z1, Z0, Z1 - VPADDQ Z1, Z2, Z1 - -return: - VMOVDQU64 Z1, (AX) - VZEROUPPER - RET diff --git a/vendor/github.com/zeebo/xxh3/accum_vector_avx_amd64.s b/vendor/github.com/zeebo/xxh3/accum_vector_avx_amd64.s deleted file mode 100644 index b53c152..0000000 --- a/vendor/github.com/zeebo/xxh3/accum_vector_avx_amd64.s +++ /dev/null @@ -1,586 +0,0 @@ -// Code generated by command: go run gen.go -avx -out ../accum_vector_avx_amd64.s -pkg xxh3. DO NOT EDIT. - -#include "textflag.h" - -DATA prime_avx<>+0(SB)/8, $0x000000009e3779b1 -DATA prime_avx<>+8(SB)/8, $0x000000009e3779b1 -DATA prime_avx<>+16(SB)/8, $0x000000009e3779b1 -DATA prime_avx<>+24(SB)/8, $0x000000009e3779b1 -GLOBL prime_avx<>(SB), RODATA|NOPTR, $32 - -// func accumAVX2(acc *[8]uint64, data *byte, key *byte, len uint64) -// Requires: AVX, AVX2, MMX+ -TEXT ·accumAVX2(SB), NOSPLIT, $0-32 - MOVQ acc+0(FP), AX - MOVQ data+8(FP), CX - MOVQ key+16(FP), DX - MOVQ key+16(FP), BX - MOVQ len+24(FP), SI - VMOVDQU (AX), Y1 - VMOVDQU 32(AX), Y2 - VMOVDQU prime_avx<>+0(SB), Y0 - -accum_large: - CMPQ SI, $0x00000400 - JLE accum - VMOVDQU (CX), Y3 - VMOVDQU 32(CX), Y6 - PREFETCHT0 512(CX) - VPXOR (DX), Y3, Y4 - VPXOR 32(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 64(CX), Y3 - VMOVDQU 96(CX), Y6 - PREFETCHT0 576(CX) - VPXOR 8(DX), Y3, Y4 - VPXOR 40(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 128(CX), Y3 - VMOVDQU 160(CX), Y6 - PREFETCHT0 640(CX) - VPXOR 16(DX), Y3, Y4 - VPXOR 48(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 192(CX), Y3 - VMOVDQU 224(CX), Y6 - PREFETCHT0 704(CX) - VPXOR 24(DX), Y3, Y4 - VPXOR 56(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 256(CX), Y3 - VMOVDQU 288(CX), Y6 - PREFETCHT0 768(CX) - VPXOR 32(DX), Y3, Y4 - VPXOR 64(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 320(CX), Y3 - VMOVDQU 352(CX), Y6 - PREFETCHT0 832(CX) - VPXOR 40(DX), Y3, Y4 - VPXOR 72(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 384(CX), Y3 - VMOVDQU 416(CX), Y6 - PREFETCHT0 896(CX) - VPXOR 48(DX), Y3, Y4 - VPXOR 80(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 448(CX), Y3 - VMOVDQU 480(CX), Y6 - PREFETCHT0 960(CX) - VPXOR 56(DX), Y3, Y4 - VPXOR 88(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 512(CX), Y3 - VMOVDQU 544(CX), Y6 - PREFETCHT0 1024(CX) - VPXOR 64(DX), Y3, Y4 - VPXOR 96(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 576(CX), Y3 - VMOVDQU 608(CX), Y6 - PREFETCHT0 1088(CX) - VPXOR 72(DX), Y3, Y4 - VPXOR 104(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 640(CX), Y3 - VMOVDQU 672(CX), Y6 - PREFETCHT0 1152(CX) - VPXOR 80(DX), Y3, Y4 - VPXOR 112(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 704(CX), Y3 - VMOVDQU 736(CX), Y6 - PREFETCHT0 1216(CX) - VPXOR 88(DX), Y3, Y4 - VPXOR 120(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 768(CX), Y3 - VMOVDQU 800(CX), Y6 - PREFETCHT0 1280(CX) - VPXOR 96(DX), Y3, Y4 - VPXOR 128(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 832(CX), Y3 - VMOVDQU 864(CX), Y6 - PREFETCHT0 1344(CX) - VPXOR 104(DX), Y3, Y4 - VPXOR 136(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 896(CX), Y3 - VMOVDQU 928(CX), Y6 - PREFETCHT0 1408(CX) - VPXOR 112(DX), Y3, Y4 - VPXOR 144(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 960(CX), Y3 - VMOVDQU 992(CX), Y6 - PREFETCHT0 1472(CX) - VPXOR 120(DX), Y3, Y4 - VPXOR 152(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - ADDQ $0x00000400, CX - SUBQ $0x00000400, SI - VPSRLQ $0x2f, Y1, Y3 - VPXOR Y1, Y3, Y3 - VPXOR 128(DX), Y3, Y3 - VPMULUDQ Y0, Y3, Y1 - VPSHUFD $0xf5, Y3, Y3 - VPMULUDQ Y0, Y3, Y3 - VPSLLQ $0x20, Y3, Y3 - VPADDQ Y1, Y3, Y1 - VPSRLQ $0x2f, Y2, Y3 - VPXOR Y2, Y3, Y3 - VPXOR 160(DX), Y3, Y3 - VPMULUDQ Y0, Y3, Y2 - VPSHUFD $0xf5, Y3, Y3 - VPMULUDQ Y0, Y3, Y3 - VPSLLQ $0x20, Y3, Y3 - VPADDQ Y2, Y3, Y2 - JMP accum_large - -accum: - CMPQ SI, $0x40 - JLE finalize - VMOVDQU (CX), Y0 - VMOVDQU 32(CX), Y5 - VPXOR (BX), Y0, Y3 - VPXOR 32(BX), Y5, Y6 - VPSHUFD $0x31, Y3, Y4 - VPSHUFD $0x31, Y6, Y7 - VPMULUDQ Y3, Y4, Y3 - VPMULUDQ Y6, Y7, Y6 - VPSHUFD $0x4e, Y0, Y0 - VPSHUFD $0x4e, Y5, Y5 - VPADDQ Y1, Y0, Y1 - VPADDQ Y1, Y3, Y1 - VPADDQ Y2, Y5, Y2 - VPADDQ Y2, Y6, Y2 - ADDQ $0x00000040, CX - SUBQ $0x00000040, SI - ADDQ $0x00000008, BX - JMP accum - -finalize: - CMPQ SI, $0x00 - JE return - SUBQ $0x40, CX - ADDQ SI, CX - VMOVDQU (CX), Y0 - VMOVDQU 32(CX), Y5 - VPXOR 121(DX), Y0, Y3 - VPXOR 153(DX), Y5, Y6 - VPSHUFD $0x31, Y3, Y4 - VPSHUFD $0x31, Y6, Y7 - VPMULUDQ Y3, Y4, Y3 - VPMULUDQ Y6, Y7, Y6 - VPSHUFD $0x4e, Y0, Y0 - VPSHUFD $0x4e, Y5, Y5 - VPADDQ Y1, Y0, Y1 - VPADDQ Y1, Y3, Y1 - VPADDQ Y2, Y5, Y2 - VPADDQ Y2, Y6, Y2 - -return: - VMOVDQU Y1, (AX) - VMOVDQU Y2, 32(AX) - VZEROUPPER - RET - -// func accumBlockAVX2(acc *[8]uint64, data *byte, key *byte) -// Requires: AVX, AVX2 -TEXT ·accumBlockAVX2(SB), NOSPLIT, $0-24 - MOVQ acc+0(FP), AX - MOVQ data+8(FP), CX - MOVQ key+16(FP), DX - VMOVDQU (AX), Y1 - VMOVDQU 32(AX), Y2 - VMOVDQU prime_avx<>+0(SB), Y0 - VMOVDQU (CX), Y3 - VMOVDQU 32(CX), Y6 - VPXOR (DX), Y3, Y4 - VPXOR 32(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 64(CX), Y3 - VMOVDQU 96(CX), Y6 - VPXOR 8(DX), Y3, Y4 - VPXOR 40(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 128(CX), Y3 - VMOVDQU 160(CX), Y6 - VPXOR 16(DX), Y3, Y4 - VPXOR 48(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 192(CX), Y3 - VMOVDQU 224(CX), Y6 - VPXOR 24(DX), Y3, Y4 - VPXOR 56(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 256(CX), Y3 - VMOVDQU 288(CX), Y6 - VPXOR 32(DX), Y3, Y4 - VPXOR 64(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 320(CX), Y3 - VMOVDQU 352(CX), Y6 - VPXOR 40(DX), Y3, Y4 - VPXOR 72(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 384(CX), Y3 - VMOVDQU 416(CX), Y6 - VPXOR 48(DX), Y3, Y4 - VPXOR 80(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 448(CX), Y3 - VMOVDQU 480(CX), Y6 - VPXOR 56(DX), Y3, Y4 - VPXOR 88(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 512(CX), Y3 - VMOVDQU 544(CX), Y6 - VPXOR 64(DX), Y3, Y4 - VPXOR 96(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 576(CX), Y3 - VMOVDQU 608(CX), Y6 - VPXOR 72(DX), Y3, Y4 - VPXOR 104(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 640(CX), Y3 - VMOVDQU 672(CX), Y6 - VPXOR 80(DX), Y3, Y4 - VPXOR 112(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 704(CX), Y3 - VMOVDQU 736(CX), Y6 - VPXOR 88(DX), Y3, Y4 - VPXOR 120(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 768(CX), Y3 - VMOVDQU 800(CX), Y6 - VPXOR 96(DX), Y3, Y4 - VPXOR 128(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 832(CX), Y3 - VMOVDQU 864(CX), Y6 - VPXOR 104(DX), Y3, Y4 - VPXOR 136(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 896(CX), Y3 - VMOVDQU 928(CX), Y6 - VPXOR 112(DX), Y3, Y4 - VPXOR 144(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VMOVDQU 960(CX), Y3 - VMOVDQU 992(CX), Y6 - VPXOR 120(DX), Y3, Y4 - VPXOR 152(DX), Y6, Y7 - VPSHUFD $0x31, Y4, Y5 - VPSHUFD $0x31, Y7, Y8 - VPMULUDQ Y4, Y5, Y4 - VPMULUDQ Y7, Y8, Y7 - VPSHUFD $0x4e, Y3, Y3 - VPSHUFD $0x4e, Y6, Y6 - VPADDQ Y1, Y3, Y1 - VPADDQ Y1, Y4, Y1 - VPADDQ Y2, Y6, Y2 - VPADDQ Y2, Y7, Y2 - VPSRLQ $0x2f, Y1, Y3 - VPXOR Y1, Y3, Y3 - VPXOR 128(DX), Y3, Y3 - VPMULUDQ Y0, Y3, Y1 - VPSHUFD $0xf5, Y3, Y3 - VPMULUDQ Y0, Y3, Y3 - VPSLLQ $0x20, Y3, Y3 - VPADDQ Y1, Y3, Y1 - VPSRLQ $0x2f, Y2, Y3 - VPXOR Y2, Y3, Y3 - VPXOR 160(DX), Y3, Y3 - VPMULUDQ Y0, Y3, Y2 - VPSHUFD $0xf5, Y3, Y3 - VPMULUDQ Y0, Y3, Y3 - VPSLLQ $0x20, Y3, Y3 - VPADDQ Y2, Y3, Y2 - VMOVDQU Y1, (AX) - VMOVDQU Y2, 32(AX) - VZEROUPPER - RET diff --git a/vendor/github.com/zeebo/xxh3/accum_vector_sse_amd64.s b/vendor/github.com/zeebo/xxh3/accum_vector_sse_amd64.s deleted file mode 100644 index ba670e5..0000000 --- a/vendor/github.com/zeebo/xxh3/accum_vector_sse_amd64.s +++ /dev/null @@ -1,1236 +0,0 @@ -// Code generated by command: go run gen.go -sse -out ../accum_vector_sse_amd64.s -pkg xxh3. DO NOT EDIT. - -#include "textflag.h" - -DATA prime_sse<>+0(SB)/4, $0x9e3779b1 -DATA prime_sse<>+4(SB)/4, $0x9e3779b1 -DATA prime_sse<>+8(SB)/4, $0x9e3779b1 -DATA prime_sse<>+12(SB)/4, $0x9e3779b1 -GLOBL prime_sse<>(SB), RODATA|NOPTR, $16 - -// func accumSSE(acc *[8]uint64, data *byte, key *byte, len uint64) -// Requires: SSE2 -TEXT ·accumSSE(SB), NOSPLIT, $0-32 - MOVQ acc+0(FP), AX - MOVQ data+8(FP), CX - MOVQ key+16(FP), DX - MOVQ key+16(FP), BX - MOVQ len+24(FP), SI - MOVOU (AX), X1 - MOVOU 16(AX), X2 - MOVOU 32(AX), X3 - MOVOU 48(AX), X4 - MOVOU prime_sse<>+0(SB), X0 - -accum_large: - CMPQ SI, $0x00000400 - JLE accum - MOVOU (CX), X5 - MOVOU (DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 16(CX), X5 - MOVOU 16(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 32(CX), X5 - MOVOU 32(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 48(CX), X5 - MOVOU 48(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 64(CX), X5 - MOVOU 8(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 80(CX), X5 - MOVOU 24(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 96(CX), X5 - MOVOU 40(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 112(CX), X5 - MOVOU 56(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 128(CX), X5 - MOVOU 16(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 144(CX), X5 - MOVOU 32(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 160(CX), X5 - MOVOU 48(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 176(CX), X5 - MOVOU 64(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 192(CX), X5 - MOVOU 24(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 208(CX), X5 - MOVOU 40(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 224(CX), X5 - MOVOU 56(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 240(CX), X5 - MOVOU 72(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 256(CX), X5 - MOVOU 32(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 272(CX), X5 - MOVOU 48(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 288(CX), X5 - MOVOU 64(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 304(CX), X5 - MOVOU 80(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 320(CX), X5 - MOVOU 40(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 336(CX), X5 - MOVOU 56(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 352(CX), X5 - MOVOU 72(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 368(CX), X5 - MOVOU 88(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 384(CX), X5 - MOVOU 48(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 400(CX), X5 - MOVOU 64(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 416(CX), X5 - MOVOU 80(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 432(CX), X5 - MOVOU 96(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 448(CX), X5 - MOVOU 56(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 464(CX), X5 - MOVOU 72(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 480(CX), X5 - MOVOU 88(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 496(CX), X5 - MOVOU 104(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 512(CX), X5 - MOVOU 64(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 528(CX), X5 - MOVOU 80(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 544(CX), X5 - MOVOU 96(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 560(CX), X5 - MOVOU 112(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 576(CX), X5 - MOVOU 72(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 592(CX), X5 - MOVOU 88(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 608(CX), X5 - MOVOU 104(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 624(CX), X5 - MOVOU 120(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 640(CX), X5 - MOVOU 80(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 656(CX), X5 - MOVOU 96(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 672(CX), X5 - MOVOU 112(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 688(CX), X5 - MOVOU 128(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 704(CX), X5 - MOVOU 88(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 720(CX), X5 - MOVOU 104(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 736(CX), X5 - MOVOU 120(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 752(CX), X5 - MOVOU 136(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 768(CX), X5 - MOVOU 96(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 784(CX), X5 - MOVOU 112(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 800(CX), X5 - MOVOU 128(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 816(CX), X5 - MOVOU 144(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 832(CX), X5 - MOVOU 104(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 848(CX), X5 - MOVOU 120(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 864(CX), X5 - MOVOU 136(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 880(CX), X5 - MOVOU 152(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 896(CX), X5 - MOVOU 112(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 912(CX), X5 - MOVOU 128(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 928(CX), X5 - MOVOU 144(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 944(CX), X5 - MOVOU 160(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 960(CX), X5 - MOVOU 120(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 976(CX), X5 - MOVOU 136(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 992(CX), X5 - MOVOU 152(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 1008(CX), X5 - MOVOU 168(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - ADDQ $0x00000400, CX - SUBQ $0x00000400, SI - MOVOU X1, X5 - PSRLQ $0x2f, X5 - PXOR X5, X1 - MOVOU 128(DX), X5 - PXOR X5, X1 - PSHUFD $0xf5, X1, X5 - PMULULQ X0, X1 - PMULULQ X0, X5 - PSLLQ $0x20, X5 - PADDQ X5, X1 - MOVOU X2, X5 - PSRLQ $0x2f, X5 - PXOR X5, X2 - MOVOU 144(DX), X5 - PXOR X5, X2 - PSHUFD $0xf5, X2, X5 - PMULULQ X0, X2 - PMULULQ X0, X5 - PSLLQ $0x20, X5 - PADDQ X5, X2 - MOVOU X3, X5 - PSRLQ $0x2f, X5 - PXOR X5, X3 - MOVOU 160(DX), X5 - PXOR X5, X3 - PSHUFD $0xf5, X3, X5 - PMULULQ X0, X3 - PMULULQ X0, X5 - PSLLQ $0x20, X5 - PADDQ X5, X3 - MOVOU X4, X5 - PSRLQ $0x2f, X5 - PXOR X5, X4 - MOVOU 176(DX), X5 - PXOR X5, X4 - PSHUFD $0xf5, X4, X5 - PMULULQ X0, X4 - PMULULQ X0, X5 - PSLLQ $0x20, X5 - PADDQ X5, X4 - JMP accum_large - -accum: - CMPQ SI, $0x40 - JLE finalize - MOVOU (CX), X0 - MOVOU (BX), X5 - PXOR X0, X5 - PSHUFD $0x31, X5, X6 - PMULULQ X5, X6 - PSHUFD $0x4e, X0, X0 - PADDQ X0, X1 - PADDQ X6, X1 - MOVOU 16(CX), X0 - MOVOU 16(BX), X5 - PXOR X0, X5 - PSHUFD $0x31, X5, X6 - PMULULQ X5, X6 - PSHUFD $0x4e, X0, X0 - PADDQ X0, X2 - PADDQ X6, X2 - MOVOU 32(CX), X0 - MOVOU 32(BX), X5 - PXOR X0, X5 - PSHUFD $0x31, X5, X6 - PMULULQ X5, X6 - PSHUFD $0x4e, X0, X0 - PADDQ X0, X3 - PADDQ X6, X3 - MOVOU 48(CX), X0 - MOVOU 48(BX), X5 - PXOR X0, X5 - PSHUFD $0x31, X5, X6 - PMULULQ X5, X6 - PSHUFD $0x4e, X0, X0 - PADDQ X0, X4 - PADDQ X6, X4 - ADDQ $0x00000040, CX - SUBQ $0x00000040, SI - ADDQ $0x00000008, BX - JMP accum - -finalize: - CMPQ SI, $0x00 - JE return - SUBQ $0x40, CX - ADDQ SI, CX - MOVOU (CX), X0 - MOVOU 121(DX), X5 - PXOR X0, X5 - PSHUFD $0x31, X5, X6 - PMULULQ X5, X6 - PSHUFD $0x4e, X0, X0 - PADDQ X0, X1 - PADDQ X6, X1 - MOVOU 16(CX), X0 - MOVOU 137(DX), X5 - PXOR X0, X5 - PSHUFD $0x31, X5, X6 - PMULULQ X5, X6 - PSHUFD $0x4e, X0, X0 - PADDQ X0, X2 - PADDQ X6, X2 - MOVOU 32(CX), X0 - MOVOU 153(DX), X5 - PXOR X0, X5 - PSHUFD $0x31, X5, X6 - PMULULQ X5, X6 - PSHUFD $0x4e, X0, X0 - PADDQ X0, X3 - PADDQ X6, X3 - MOVOU 48(CX), X0 - MOVOU 169(DX), X5 - PXOR X0, X5 - PSHUFD $0x31, X5, X6 - PMULULQ X5, X6 - PSHUFD $0x4e, X0, X0 - PADDQ X0, X4 - PADDQ X6, X4 - -return: - MOVOU X1, (AX) - MOVOU X2, 16(AX) - MOVOU X3, 32(AX) - MOVOU X4, 48(AX) - RET - -// func accumBlockSSE(acc *[8]uint64, data *byte, key *byte) -// Requires: SSE2 -TEXT ·accumBlockSSE(SB), NOSPLIT, $0-24 - MOVQ acc+0(FP), AX - MOVQ data+8(FP), CX - MOVQ key+16(FP), DX - MOVOU (AX), X1 - MOVOU 16(AX), X2 - MOVOU 32(AX), X3 - MOVOU 48(AX), X4 - MOVOU prime_sse<>+0(SB), X0 - MOVOU (CX), X5 - MOVOU (DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 16(CX), X5 - MOVOU 16(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 32(CX), X5 - MOVOU 32(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 48(CX), X5 - MOVOU 48(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 64(CX), X5 - MOVOU 8(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 80(CX), X5 - MOVOU 24(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 96(CX), X5 - MOVOU 40(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 112(CX), X5 - MOVOU 56(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 128(CX), X5 - MOVOU 16(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 144(CX), X5 - MOVOU 32(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 160(CX), X5 - MOVOU 48(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 176(CX), X5 - MOVOU 64(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 192(CX), X5 - MOVOU 24(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 208(CX), X5 - MOVOU 40(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 224(CX), X5 - MOVOU 56(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 240(CX), X5 - MOVOU 72(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 256(CX), X5 - MOVOU 32(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 272(CX), X5 - MOVOU 48(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 288(CX), X5 - MOVOU 64(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 304(CX), X5 - MOVOU 80(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 320(CX), X5 - MOVOU 40(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 336(CX), X5 - MOVOU 56(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 352(CX), X5 - MOVOU 72(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 368(CX), X5 - MOVOU 88(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 384(CX), X5 - MOVOU 48(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 400(CX), X5 - MOVOU 64(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 416(CX), X5 - MOVOU 80(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 432(CX), X5 - MOVOU 96(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 448(CX), X5 - MOVOU 56(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 464(CX), X5 - MOVOU 72(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 480(CX), X5 - MOVOU 88(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 496(CX), X5 - MOVOU 104(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 512(CX), X5 - MOVOU 64(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 528(CX), X5 - MOVOU 80(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 544(CX), X5 - MOVOU 96(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 560(CX), X5 - MOVOU 112(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 576(CX), X5 - MOVOU 72(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 592(CX), X5 - MOVOU 88(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 608(CX), X5 - MOVOU 104(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 624(CX), X5 - MOVOU 120(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 640(CX), X5 - MOVOU 80(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 656(CX), X5 - MOVOU 96(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 672(CX), X5 - MOVOU 112(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 688(CX), X5 - MOVOU 128(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 704(CX), X5 - MOVOU 88(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 720(CX), X5 - MOVOU 104(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 736(CX), X5 - MOVOU 120(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 752(CX), X5 - MOVOU 136(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 768(CX), X5 - MOVOU 96(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 784(CX), X5 - MOVOU 112(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 800(CX), X5 - MOVOU 128(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 816(CX), X5 - MOVOU 144(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 832(CX), X5 - MOVOU 104(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 848(CX), X5 - MOVOU 120(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 864(CX), X5 - MOVOU 136(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 880(CX), X5 - MOVOU 152(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 896(CX), X5 - MOVOU 112(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 912(CX), X5 - MOVOU 128(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 928(CX), X5 - MOVOU 144(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 944(CX), X5 - MOVOU 160(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU 960(CX), X5 - MOVOU 120(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X1 - PADDQ X7, X1 - MOVOU 976(CX), X5 - MOVOU 136(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X2 - PADDQ X7, X2 - MOVOU 992(CX), X5 - MOVOU 152(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X3 - PADDQ X7, X3 - MOVOU 1008(CX), X5 - MOVOU 168(DX), X6 - PXOR X5, X6 - PSHUFD $0x31, X6, X7 - PMULULQ X6, X7 - PSHUFD $0x4e, X5, X5 - PADDQ X5, X4 - PADDQ X7, X4 - MOVOU X1, X5 - PSRLQ $0x2f, X5 - PXOR X5, X1 - MOVOU 128(DX), X5 - PXOR X5, X1 - PSHUFD $0xf5, X1, X5 - PMULULQ X0, X1 - PMULULQ X0, X5 - PSLLQ $0x20, X5 - PADDQ X5, X1 - MOVOU X2, X5 - PSRLQ $0x2f, X5 - PXOR X5, X2 - MOVOU 144(DX), X5 - PXOR X5, X2 - PSHUFD $0xf5, X2, X5 - PMULULQ X0, X2 - PMULULQ X0, X5 - PSLLQ $0x20, X5 - PADDQ X5, X2 - MOVOU X3, X5 - PSRLQ $0x2f, X5 - PXOR X5, X3 - MOVOU 160(DX), X5 - PXOR X5, X3 - PSHUFD $0xf5, X3, X5 - PMULULQ X0, X3 - PMULULQ X0, X5 - PSLLQ $0x20, X5 - PADDQ X5, X3 - MOVOU X4, X5 - PSRLQ $0x2f, X5 - PXOR X5, X4 - MOVOU 176(DX), X5 - PXOR X5, X4 - PSHUFD $0xf5, X4, X5 - PMULULQ X0, X4 - PMULULQ X0, X5 - PSLLQ $0x20, X5 - PADDQ X5, X4 - MOVOU X1, (AX) - MOVOU X2, 16(AX) - MOVOU X3, 32(AX) - MOVOU X4, 48(AX) - RET diff --git a/vendor/github.com/zeebo/xxh3/consts.go b/vendor/github.com/zeebo/xxh3/consts.go deleted file mode 100644 index 39ef6e1..0000000 --- a/vendor/github.com/zeebo/xxh3/consts.go +++ /dev/null @@ -1,97 +0,0 @@ -package xxh3 - -const ( - _stripe = 64 - _block = 1024 - - prime32_1 = 2654435761 - prime32_2 = 2246822519 - prime32_3 = 3266489917 - - prime64_1 = 11400714785074694791 - prime64_2 = 14029467366897019727 - prime64_3 = 1609587929392839161 - prime64_4 = 9650029242287828579 - prime64_5 = 2870177450012600261 -) - -var key = ptr(&[...]u8{ - 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe /* 8 */, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c, /* 16 */ - 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb /* 24 */, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f, /* 32 */ - 0xcb, 0x79, 0xe6, 0x4e, 0xcc, 0xc0, 0xe5, 0x78 /* 40 */, 0x82, 0x5a, 0xd0, 0x7d, 0xcc, 0xff, 0x72, 0x21, /* 48 */ - 0xb8, 0x08, 0x46, 0x74, 0xf7, 0x43, 0x24, 0x8e /* 56 */, 0xe0, 0x35, 0x90, 0xe6, 0x81, 0x3a, 0x26, 0x4c, /* 64 */ - 0x3c, 0x28, 0x52, 0xbb, 0x91, 0xc3, 0x00, 0xcb /* 72 */, 0x88, 0xd0, 0x65, 0x8b, 0x1b, 0x53, 0x2e, 0xa3, /* 80 */ - 0x71, 0x64, 0x48, 0x97, 0xa2, 0x0d, 0xf9, 0x4e /* 88 */, 0x38, 0x19, 0xef, 0x46, 0xa9, 0xde, 0xac, 0xd8, /* 96 */ - 0xa8, 0xfa, 0x76, 0x3f, 0xe3, 0x9c, 0x34, 0x3f /* 104 */, 0xf9, 0xdc, 0xbb, 0xc7, 0xc7, 0x0b, 0x4f, 0x1d, /* 112 */ - 0x8a, 0x51, 0xe0, 0x4b, 0xcd, 0xb4, 0x59, 0x31 /* 120 */, 0xc8, 0x9f, 0x7e, 0xc9, 0xd9, 0x78, 0x73, 0x64, /* 128 */ - 0xea, 0xc5, 0xac, 0x83, 0x34, 0xd3, 0xeb, 0xc3 /* 136 */, 0xc5, 0x81, 0xa0, 0xff, 0xfa, 0x13, 0x63, 0xeb, /* 144 */ - 0x17, 0x0d, 0xdd, 0x51, 0xb7, 0xf0, 0xda, 0x49 /* 152 */, 0xd3, 0x16, 0x55, 0x26, 0x29, 0xd4, 0x68, 0x9e, /* 160 */ - 0x2b, 0x16, 0xbe, 0x58, 0x7d, 0x47, 0xa1, 0xfc /* 168 */, 0x8f, 0xf8, 0xb8, 0xd1, 0x7a, 0xd0, 0x31, 0xce, /* 176 */ - 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28 /* 184 */, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e, /* 192 */ -}) - -const ( - key64_000 u64 = 0xbe4ba423396cfeb8 - key64_008 u64 = 0x1cad21f72c81017c - key64_016 u64 = 0xdb979083e96dd4de - key64_024 u64 = 0x1f67b3b7a4a44072 - key64_032 u64 = 0x78e5c0cc4ee679cb - key64_040 u64 = 0x2172ffcc7dd05a82 - key64_048 u64 = 0x8e2443f7744608b8 - key64_056 u64 = 0x4c263a81e69035e0 - key64_064 u64 = 0xcb00c391bb52283c - key64_072 u64 = 0xa32e531b8b65d088 - key64_080 u64 = 0x4ef90da297486471 - key64_088 u64 = 0xd8acdea946ef1938 - key64_096 u64 = 0x3f349ce33f76faa8 - key64_104 u64 = 0x1d4f0bc7c7bbdcf9 - key64_112 u64 = 0x3159b4cd4be0518a - key64_120 u64 = 0x647378d9c97e9fc8 - key64_128 u64 = 0xc3ebd33483acc5ea - key64_136 u64 = 0xeb6313faffa081c5 - key64_144 u64 = 0x49daf0b751dd0d17 - key64_152 u64 = 0x9e68d429265516d3 - key64_160 u64 = 0xfca1477d58be162b - key64_168 u64 = 0xce31d07ad1b8f88f - key64_176 u64 = 0x280416958f3acb45 - key64_184 u64 = 0x7e404bbbcafbd7af - - key64_103 u64 = 0x4f0bc7c7bbdcf93f - key64_111 u64 = 0x59b4cd4be0518a1d - key64_119 u64 = 0x7378d9c97e9fc831 - key64_127 u64 = 0xebd33483acc5ea64 - - key64_121 u64 = 0xea647378d9c97e9f - key64_129 u64 = 0xc5c3ebd33483acc5 - key64_137 u64 = 0x17eb6313faffa081 - key64_145 u64 = 0xd349daf0b751dd0d - key64_153 u64 = 0x2b9e68d429265516 - key64_161 u64 = 0x8ffca1477d58be16 - key64_169 u64 = 0x45ce31d07ad1b8f8 - key64_177 u64 = 0xaf280416958f3acb - - key64_011 = 0x6dd4de1cad21f72c - key64_019 = 0xa44072db979083e9 - key64_027 = 0xe679cb1f67b3b7a4 - key64_035 = 0xd05a8278e5c0cc4e - key64_043 = 0x4608b82172ffcc7d - key64_051 = 0x9035e08e2443f774 - key64_059 = 0x52283c4c263a81e6 - key64_067 = 0x65d088cb00c391bb - - key64_117 = 0xd9c97e9fc83159b4 - key64_125 = 0x3483acc5ea647378 - key64_133 = 0xfaffa081c5c3ebd3 - key64_141 = 0xb751dd0d17eb6313 - key64_149 = 0x29265516d349daf0 - key64_157 = 0x7d58be162b9e68d4 - key64_165 = 0x7ad1b8f88ffca147 - key64_173 = 0x958f3acb45ce31d0 -) - -const ( - key32_000 u32 = 0xbe4ba423 - key32_004 u32 = 0x396cfeb8 - key32_008 u32 = 0x1cad21f7 - key32_012 u32 = 0x2c81017c -) diff --git a/vendor/github.com/zeebo/xxh3/hash128.go b/vendor/github.com/zeebo/xxh3/hash128.go deleted file mode 100644 index 0040a21..0000000 --- a/vendor/github.com/zeebo/xxh3/hash128.go +++ /dev/null @@ -1,253 +0,0 @@ -package xxh3 - -import ( - "math/bits" -) - -// Hash128 returns the 128-bit hash of the byte slice. -func Hash128(b []byte) Uint128 { - return hashAny128(*(*str)(ptr(&b))) -} - -// HashString128 returns the 128-bit hash of the string slice. -func HashString128(s string) Uint128 { - return hashAny128(*(*str)(ptr(&s))) -} - -func hashAny128(s str) (acc u128) { - p, l := s.p, s.l - - switch { - case l <= 16: - switch { - case l > 8: // 9-16 - const bitflipl = key64_032 ^ key64_040 - const bitfliph = key64_048 ^ key64_056 - - input_lo := readU64(p, 0) - input_hi := readU64(p, ui(l)-8) - - m128_h, m128_l := bits.Mul64(input_lo^input_hi^bitflipl, prime64_1) - - m128_l += uint64(l-1) << 54 - input_hi ^= bitfliph - - m128_h += input_hi + uint64(uint32(input_hi))*(prime32_2-1) - - m128_l ^= bits.ReverseBytes64(m128_h) - - acc.Hi, acc.Lo = bits.Mul64(m128_l, prime64_2) - acc.Hi += m128_h * prime64_2 - - acc.Lo = xxh3Avalanche(acc.Lo) - acc.Hi = xxh3Avalanche(acc.Hi) - - return acc - - case l > 3: // 4-8 - const bitflip = key64_016 ^ key64_024 - - input_lo := readU32(p, 0) - input_hi := readU32(p, ui(l)-4) - input_64 := u64(input_lo) + u64(input_hi)<<32 - keyed := input_64 ^ bitflip - - acc.Hi, acc.Lo = bits.Mul64(keyed, prime64_1+(uint64(l)<<2)) - - acc.Hi += acc.Lo << 1 - acc.Lo ^= acc.Hi >> 3 - - acc.Lo ^= acc.Lo >> 35 - acc.Lo *= 0x9fb21c651e98df25 - acc.Lo ^= acc.Lo >> 28 - acc.Hi = xxh3Avalanche(acc.Hi) - - return acc - - case l == 3: // 3 - c12 := u64(readU16(p, 0)) - c3 := u64(readU8(p, 2)) - acc.Lo = c12<<16 + c3 + 3<<8 - - case l > 1: // 2 - c12 := u64(readU16(p, 0)) - acc.Lo = c12*(1<<24+1)>>8 + 2<<8 - - case l == 1: // 1 - c1 := u64(readU8(p, 0)) - acc.Lo = c1*(1<<24+1<<16+1) + 1<<8 - - default: // 0 - return u128{0x99aa06d3014798d8, 0x6001c324468d497f} - } - - acc.Hi = uint64(bits.RotateLeft32(bits.ReverseBytes32(uint32(acc.Lo)), 13)) - acc.Lo ^= uint64(key32_000 ^ key32_004) - acc.Hi ^= uint64(key32_008 ^ key32_012) - - acc.Lo = xxh64AvalancheSmall(acc.Lo) - acc.Hi = xxh64AvalancheSmall(acc.Hi) - - return acc - - case l <= 128: - acc.Lo = u64(l) * prime64_1 - - if l > 32 { - if l > 64 { - if l > 96 { - in8, in7 := readU64(p, ui(l)-8*8), readU64(p, ui(l)-7*8) - i6, i7 := readU64(p, 6*8), readU64(p, 7*8) - - acc.Hi += mulFold64(in8^key64_112, in7^key64_120) - acc.Hi ^= i6 + i7 - acc.Lo += mulFold64(i6^key64_096, i7^key64_104) - acc.Lo ^= in8 + in7 - - } // 96 - - in6, in5 := readU64(p, ui(l)-6*8), readU64(p, ui(l)-5*8) - i4, i5 := readU64(p, 4*8), readU64(p, 5*8) - - acc.Hi += mulFold64(in6^key64_080, in5^key64_088) - acc.Hi ^= i4 + i5 - acc.Lo += mulFold64(i4^key64_064, i5^key64_072) - acc.Lo ^= in6 + in5 - - } // 64 - - in4, in3 := readU64(p, ui(l)-4*8), readU64(p, ui(l)-3*8) - i2, i3 := readU64(p, 2*8), readU64(p, 3*8) - - acc.Hi += mulFold64(in4^key64_048, in3^key64_056) - acc.Hi ^= i2 + i3 - acc.Lo += mulFold64(i2^key64_032, i3^key64_040) - acc.Lo ^= in4 + in3 - - } // 32 - - in2, in1 := readU64(p, ui(l)-2*8), readU64(p, ui(l)-1*8) - i0, i1 := readU64(p, 0*8), readU64(p, 1*8) - - acc.Hi += mulFold64(in2^key64_016, in1^key64_024) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^key64_000, i1^key64_008) - acc.Lo ^= in2 + in1 - - acc.Hi, acc.Lo = (acc.Lo*prime64_1)+(acc.Hi*prime64_4)+(u64(l)*prime64_2), acc.Hi+acc.Lo - - acc.Hi = -xxh3Avalanche(acc.Hi) - acc.Lo = xxh3Avalanche(acc.Lo) - - return acc - - case l <= 240: - acc.Lo = u64(l) * prime64_1 - - { - i0, i1, i2, i3 := readU64(p, 0*8), readU64(p, 1*8), readU64(p, 2*8), readU64(p, 3*8) - - acc.Hi += mulFold64(i2^key64_016, i3^key64_024) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^key64_000, i1^key64_008) - acc.Lo ^= i2 + i3 - } - - { - i0, i1, i2, i3 := readU64(p, 4*8), readU64(p, 5*8), readU64(p, 6*8), readU64(p, 7*8) - - acc.Hi += mulFold64(i2^key64_048, i3^key64_056) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^key64_032, i1^key64_040) - acc.Lo ^= i2 + i3 - } - - { - i0, i1, i2, i3 := readU64(p, 8*8), readU64(p, 9*8), readU64(p, 10*8), readU64(p, 11*8) - - acc.Hi += mulFold64(i2^key64_080, i3^key64_088) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^key64_064, i1^key64_072) - acc.Lo ^= i2 + i3 - } - - { - i0, i1, i2, i3 := readU64(p, 12*8), readU64(p, 13*8), readU64(p, 14*8), readU64(p, 15*8) - - acc.Hi += mulFold64(i2^key64_112, i3^key64_120) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^key64_096, i1^key64_104) - acc.Lo ^= i2 + i3 - } - - // avalanche - acc.Hi = xxh3Avalanche(acc.Hi) - acc.Lo = xxh3Avalanche(acc.Lo) - - // trailing groups after 128 - top := ui(l) &^ 31 - for i := ui(4 * 32); i < top; i += 32 { - i0, i1, i2, i3 := readU64(p, i+0), readU64(p, i+8), readU64(p, i+16), readU64(p, i+24) - k0, k1, k2, k3 := readU64(key, i-125), readU64(key, i-117), readU64(key, i-109), readU64(key, i-101) - - acc.Hi += mulFold64(i2^k2, i3^k3) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^k0, i1^k1) - acc.Lo ^= i2 + i3 - } - - // last 32 bytes - { - i0, i1, i2, i3 := readU64(p, ui(l)-32), readU64(p, ui(l)-24), readU64(p, ui(l)-16), readU64(p, ui(l)-8) - - acc.Hi += mulFold64(i0^key64_119, i1^key64_127) - acc.Hi ^= i2 + i3 - acc.Lo += mulFold64(i2^key64_103, i3^key64_111) - acc.Lo ^= i0 + i1 - } - - acc.Hi, acc.Lo = (acc.Lo*prime64_1)+(acc.Hi*prime64_4)+(u64(l)*prime64_2), acc.Hi+acc.Lo - - acc.Hi = -xxh3Avalanche(acc.Hi) - acc.Lo = xxh3Avalanche(acc.Lo) - - return acc - - default: - acc.Lo = u64(l) * prime64_1 - acc.Hi = ^(u64(l) * prime64_2) - - accs := [8]u64{ - prime32_3, prime64_1, prime64_2, prime64_3, - prime64_4, prime32_2, prime64_5, prime32_1, - } - - if hasAVX512 && l >= avx512Switch { - accumAVX512(&accs, p, key, u64(l)) - } else if hasAVX2 { - accumAVX2(&accs, p, key, u64(l)) - } else if hasSSE2 { - accumSSE(&accs, p, key, u64(l)) - } else { - accumScalar(&accs, p, key, u64(l)) - } - - // merge accs - acc.Lo += mulFold64(accs[0]^key64_011, accs[1]^key64_019) - acc.Hi += mulFold64(accs[0]^key64_117, accs[1]^key64_125) - - acc.Lo += mulFold64(accs[2]^key64_027, accs[3]^key64_035) - acc.Hi += mulFold64(accs[2]^key64_133, accs[3]^key64_141) - - acc.Lo += mulFold64(accs[4]^key64_043, accs[5]^key64_051) - acc.Hi += mulFold64(accs[4]^key64_149, accs[5]^key64_157) - - acc.Lo += mulFold64(accs[6]^key64_059, accs[7]^key64_067) - acc.Hi += mulFold64(accs[6]^key64_165, accs[7]^key64_173) - - acc.Lo = xxh3Avalanche(acc.Lo) - acc.Hi = xxh3Avalanche(acc.Hi) - - return acc - } -} diff --git a/vendor/github.com/zeebo/xxh3/hash128_seed.go b/vendor/github.com/zeebo/xxh3/hash128_seed.go deleted file mode 100644 index 358009b..0000000 --- a/vendor/github.com/zeebo/xxh3/hash128_seed.go +++ /dev/null @@ -1,264 +0,0 @@ -package xxh3 - -import ( - "math/bits" -) - -// Hash128Seed returns the 128-bit hash of the byte slice. -func Hash128Seed(b []byte, seed uint64) Uint128 { - return hashAny128Seed(*(*str)(ptr(&b)), seed) -} - -// HashString128Seed returns the 128-bit hash of the string slice. -func HashString128Seed(s string, seed uint64) Uint128 { - return hashAny128Seed(*(*str)(ptr(&s)), seed) -} - -func hashAny128Seed(s str, seed uint64) (acc u128) { - p, l := s.p, s.l - - switch { - case l <= 16: - switch { - case l > 8: // 9-16 - bitflipl := (key64_032 ^ key64_040) - seed - bitfliph := (key64_048 ^ key64_056) + seed - - input_lo := readU64(p, 0) - input_hi := readU64(p, ui(l)-8) - - m128_h, m128_l := bits.Mul64(input_lo^input_hi^bitflipl, prime64_1) - - m128_l += uint64(l-1) << 54 - input_hi ^= bitfliph - - m128_h += input_hi + uint64(uint32(input_hi))*(prime32_2-1) - - m128_l ^= bits.ReverseBytes64(m128_h) - - acc.Hi, acc.Lo = bits.Mul64(m128_l, prime64_2) - acc.Hi += m128_h * prime64_2 - - acc.Lo = xxh3Avalanche(acc.Lo) - acc.Hi = xxh3Avalanche(acc.Hi) - - return acc - - case l > 3: // 4-8 - seed ^= u64(bits.ReverseBytes32(u32(seed))) << 32 - bitflip := (key64_016 ^ key64_024) + seed - input_lo := readU32(p, 0) - input_hi := readU32(p, ui(l)-4) - input_64 := u64(input_lo) + u64(input_hi)<<32 - keyed := input_64 ^ bitflip - - acc.Hi, acc.Lo = bits.Mul64(keyed, prime64_1+(uint64(l)<<2)) - - acc.Hi += acc.Lo << 1 - acc.Lo ^= acc.Hi >> 3 - - acc.Lo ^= acc.Lo >> 35 - acc.Lo *= 0x9fb21c651e98df25 - acc.Lo ^= acc.Lo >> 28 - acc.Hi = xxh3Avalanche(acc.Hi) - - return acc - - case l == 3: // 3 - c12 := u64(readU16(p, 0)) - c3 := u64(readU8(p, 2)) - acc.Lo = c12<<16 + c3 + 3<<8 - - case l > 1: // 2 - c12 := u64(readU16(p, 0)) - acc.Lo = c12*(1<<24+1)>>8 + 2<<8 - - case l == 1: // 1 - c1 := u64(readU8(p, 0)) - acc.Lo = c1*(1<<24+1<<16+1) + 1<<8 - - default: // 0 - bitflipl := key64_064 ^ key64_072 ^ seed - bitfliph := key64_080 ^ key64_088 ^ seed - return u128{Lo: xxh64AvalancheFull(bitflipl), Hi: xxh64AvalancheFull(bitfliph)} - } - - acc.Hi = uint64(bits.RotateLeft32(bits.ReverseBytes32(uint32(acc.Lo)), 13)) - acc.Lo ^= uint64(key32_000^key32_004) + seed - acc.Hi ^= uint64(key32_008^key32_012) - seed - - acc.Lo = xxh64AvalancheFull(acc.Lo) - acc.Hi = xxh64AvalancheFull(acc.Hi) - - return acc - - case l <= 128: - acc.Lo = u64(l) * prime64_1 - - if l > 32 { - if l > 64 { - if l > 96 { - in8, in7 := readU64(p, ui(l)-8*8), readU64(p, ui(l)-7*8) - i6, i7 := readU64(p, 6*8), readU64(p, 7*8) - - acc.Hi += mulFold64(in8^(key64_112+seed), in7^(key64_120-seed)) - acc.Hi ^= i6 + i7 - acc.Lo += mulFold64(i6^(key64_096+seed), i7^(key64_104-seed)) - acc.Lo ^= in8 + in7 - - } // 96 - - in6, in5 := readU64(p, ui(l)-6*8), readU64(p, ui(l)-5*8) - i4, i5 := readU64(p, 4*8), readU64(p, 5*8) - - acc.Hi += mulFold64(in6^(key64_080+seed), in5^(key64_088-seed)) - acc.Hi ^= i4 + i5 - acc.Lo += mulFold64(i4^(key64_064+seed), i5^(key64_072-seed)) - acc.Lo ^= in6 + in5 - - } // 64 - - in4, in3 := readU64(p, ui(l)-4*8), readU64(p, ui(l)-3*8) - i2, i3 := readU64(p, 2*8), readU64(p, 3*8) - - acc.Hi += mulFold64(in4^(key64_048+seed), in3^(key64_056-seed)) - acc.Hi ^= i2 + i3 - acc.Lo += mulFold64(i2^(key64_032+seed), i3^(key64_040-seed)) - acc.Lo ^= in4 + in3 - - } // 32 - - in2, in1 := readU64(p, ui(l)-2*8), readU64(p, ui(l)-1*8) - i0, i1 := readU64(p, 0*8), readU64(p, 1*8) - - acc.Hi += mulFold64(in2^(key64_016+seed), in1^(key64_024-seed)) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^(key64_000+seed), i1^(key64_008-seed)) - acc.Lo ^= in2 + in1 - - acc.Hi, acc.Lo = (acc.Lo*prime64_1)+(acc.Hi*prime64_4)+((u64(l)-seed)*prime64_2), acc.Hi+acc.Lo - - acc.Hi = -xxh3Avalanche(acc.Hi) - acc.Lo = xxh3Avalanche(acc.Lo) - - return acc - - case l <= 240: - acc.Lo = u64(l) * prime64_1 - - { - i0, i1, i2, i3 := readU64(p, 0*8), readU64(p, 1*8), readU64(p, 2*8), readU64(p, 3*8) - - acc.Hi += mulFold64(i2^(key64_016+seed), i3^(key64_024-seed)) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^(key64_000+seed), i1^(key64_008-seed)) - acc.Lo ^= i2 + i3 - } - - { - i0, i1, i2, i3 := readU64(p, 4*8), readU64(p, 5*8), readU64(p, 6*8), readU64(p, 7*8) - - acc.Hi += mulFold64(i2^(key64_048+seed), i3^(key64_056-seed)) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^(key64_032+seed), i1^(key64_040-seed)) - acc.Lo ^= i2 + i3 - } - - { - i0, i1, i2, i3 := readU64(p, 8*8), readU64(p, 9*8), readU64(p, 10*8), readU64(p, 11*8) - - acc.Hi += mulFold64(i2^(key64_080+seed), i3^(key64_088-seed)) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^(key64_064+seed), i1^(key64_072-seed)) - acc.Lo ^= i2 + i3 - } - - { - i0, i1, i2, i3 := readU64(p, 12*8), readU64(p, 13*8), readU64(p, 14*8), readU64(p, 15*8) - - acc.Hi += mulFold64(i2^(key64_112+seed), i3^(key64_120-seed)) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^(key64_096+seed), i1^(key64_104-seed)) - acc.Lo ^= i2 + i3 - } - - // avalanche - acc.Hi = xxh3Avalanche(acc.Hi) - acc.Lo = xxh3Avalanche(acc.Lo) - - // trailing groups after 128 - top := ui(l) &^ 31 - for i := ui(4 * 32); i < top; i += 32 { - i0, i1, i2, i3 := readU64(p, i+0), readU64(p, i+8), readU64(p, i+16), readU64(p, i+24) - k0, k1, k2, k3 := readU64(key, i-125)+seed, readU64(key, i-117)-seed, readU64(key, i-109)+seed, readU64(key, i-101)-seed - - acc.Hi += mulFold64(i2^k2, i3^k3) - acc.Hi ^= i0 + i1 - acc.Lo += mulFold64(i0^k0, i1^k1) - acc.Lo ^= i2 + i3 - } - - // last 32 bytes - { - i0, i1, i2, i3 := readU64(p, ui(l)-32), readU64(p, ui(l)-24), readU64(p, ui(l)-16), readU64(p, ui(l)-8) - - seed := 0 - seed - acc.Hi += mulFold64(i0^(key64_119+seed), i1^(key64_127-seed)) - acc.Hi ^= i2 + i3 - acc.Lo += mulFold64(i2^(key64_103+seed), i3^(key64_111-seed)) - acc.Lo ^= i0 + i1 - } - - acc.Hi, acc.Lo = (acc.Lo*prime64_1)+(acc.Hi*prime64_4)+((u64(l)-seed)*prime64_2), acc.Hi+acc.Lo - - acc.Hi = -xxh3Avalanche(acc.Hi) - acc.Lo = xxh3Avalanche(acc.Lo) - - return acc - - default: - acc.Lo = u64(l) * prime64_1 - acc.Hi = ^(u64(l) * prime64_2) - - secret := key - if seed != 0 { - secret = ptr(&[secretSize]byte{}) - initSecret(secret, seed) - } - - accs := [8]u64{ - prime32_3, prime64_1, prime64_2, prime64_3, - prime64_4, prime32_2, prime64_5, prime32_1, - } - - if hasAVX512 && l >= avx512Switch { - accumAVX512(&accs, p, secret, u64(l)) - } else if hasAVX2 { - accumAVX2(&accs, p, secret, u64(l)) - } else if hasSSE2 { - accumSSE(&accs, p, secret, u64(l)) - } else { - accumScalar(&accs, p, secret, u64(l)) - } - - // merge accs - const hi_off = 117 - 11 - - acc.Lo += mulFold64(accs[0]^readU64(secret, 11), accs[1]^readU64(secret, 19)) - acc.Hi += mulFold64(accs[0]^readU64(secret, 11+hi_off), accs[1]^readU64(secret, 19+hi_off)) - - acc.Lo += mulFold64(accs[2]^readU64(secret, 27), accs[3]^readU64(secret, 35)) - acc.Hi += mulFold64(accs[2]^readU64(secret, 27+hi_off), accs[3]^readU64(secret, 35+hi_off)) - - acc.Lo += mulFold64(accs[4]^readU64(secret, 43), accs[5]^readU64(secret, 51)) - acc.Hi += mulFold64(accs[4]^readU64(secret, 43+hi_off), accs[5]^readU64(secret, 51+hi_off)) - - acc.Lo += mulFold64(accs[6]^readU64(secret, 59), accs[7]^readU64(secret, 67)) - acc.Hi += mulFold64(accs[6]^readU64(secret, 59+hi_off), accs[7]^readU64(secret, 67+hi_off)) - - acc.Lo = xxh3Avalanche(acc.Lo) - acc.Hi = xxh3Avalanche(acc.Hi) - - return acc - } -} diff --git a/vendor/github.com/zeebo/xxh3/hash64.go b/vendor/github.com/zeebo/xxh3/hash64.go deleted file mode 100644 index 13aab95..0000000 --- a/vendor/github.com/zeebo/xxh3/hash64.go +++ /dev/null @@ -1,126 +0,0 @@ -package xxh3 - -import "math/bits" - -// Hash returns the hash of the byte slice. -func Hash(b []byte) uint64 { - return hashAny(*(*str)(ptr(&b))) -} - -// Hash returns the hash of the string slice. -func HashString(s string) uint64 { - return hashAny(*(*str)(ptr(&s))) -} - -func hashAny(s str) (acc u64) { - p, l := s.p, s.l - - switch { - case l <= 16: - switch { - case l > 8: // 9-16 - inputlo := readU64(p, 0) ^ (key64_024 ^ key64_032) - inputhi := readU64(p, ui(l)-8) ^ (key64_040 ^ key64_048) - folded := mulFold64(inputlo, inputhi) - return xxh3Avalanche(u64(l) + bits.ReverseBytes64(inputlo) + inputhi + folded) - - case l > 3: // 4-8 - input1 := readU32(p, 0) - input2 := readU32(p, ui(l)-4) - input64 := u64(input2) + u64(input1)<<32 - keyed := input64 ^ (key64_008 ^ key64_016) - return rrmxmx(keyed, u64(l)) - - case l == 3: // 3 - c12 := u64(readU16(p, 0)) - c3 := u64(readU8(p, 2)) - acc = c12<<16 + c3 + 3<<8 - - case l > 1: // 2 - c12 := u64(readU16(p, 0)) - acc = c12*(1<<24+1)>>8 + 2<<8 - - case l == 1: // 1 - c1 := u64(readU8(p, 0)) - acc = c1*(1<<24+1<<16+1) + 1<<8 - - default: // 0 - return 0x2d06800538d394c2 // xxh_avalanche(key64_056 ^ key64_064) - } - - acc ^= u64(key32_000 ^ key32_004) - return xxhAvalancheSmall(acc) - - case l <= 128: - acc = u64(l) * prime64_1 - - if l > 32 { - if l > 64 { - if l > 96 { - acc += mulFold64(readU64(p, 6*8)^key64_096, readU64(p, 7*8)^key64_104) - acc += mulFold64(readU64(p, ui(l)-8*8)^key64_112, readU64(p, ui(l)-7*8)^key64_120) - } // 96 - acc += mulFold64(readU64(p, 4*8)^key64_064, readU64(p, 5*8)^key64_072) - acc += mulFold64(readU64(p, ui(l)-6*8)^key64_080, readU64(p, ui(l)-5*8)^key64_088) - } // 64 - acc += mulFold64(readU64(p, 2*8)^key64_032, readU64(p, 3*8)^key64_040) - acc += mulFold64(readU64(p, ui(l)-4*8)^key64_048, readU64(p, ui(l)-3*8)^key64_056) - } // 32 - acc += mulFold64(readU64(p, 0*8)^key64_000, readU64(p, 1*8)^key64_008) - acc += mulFold64(readU64(p, ui(l)-2*8)^key64_016, readU64(p, ui(l)-1*8)^key64_024) - - return xxh3Avalanche(acc) - - case l <= 240: - acc = u64(l) * prime64_1 - - acc += mulFold64(readU64(p, 0*16+0)^key64_000, readU64(p, 0*16+8)^key64_008) - acc += mulFold64(readU64(p, 1*16+0)^key64_016, readU64(p, 1*16+8)^key64_024) - acc += mulFold64(readU64(p, 2*16+0)^key64_032, readU64(p, 2*16+8)^key64_040) - acc += mulFold64(readU64(p, 3*16+0)^key64_048, readU64(p, 3*16+8)^key64_056) - acc += mulFold64(readU64(p, 4*16+0)^key64_064, readU64(p, 4*16+8)^key64_072) - acc += mulFold64(readU64(p, 5*16+0)^key64_080, readU64(p, 5*16+8)^key64_088) - acc += mulFold64(readU64(p, 6*16+0)^key64_096, readU64(p, 6*16+8)^key64_104) - acc += mulFold64(readU64(p, 7*16+0)^key64_112, readU64(p, 7*16+8)^key64_120) - - // avalanche - acc = xxh3Avalanche(acc) - - // trailing groups after 128 - top := ui(l) &^ 15 - for i := ui(8 * 16); i < top; i += 16 { - acc += mulFold64(readU64(p, i+0)^readU64(key, i-125), readU64(p, i+8)^readU64(key, i-117)) - } - - // last 16 bytes - acc += mulFold64(readU64(p, ui(l)-16)^key64_119, readU64(p, ui(l)-8)^key64_127) - - return xxh3Avalanche(acc) - - default: - acc = u64(l) * prime64_1 - - accs := [8]u64{ - prime32_3, prime64_1, prime64_2, prime64_3, - prime64_4, prime32_2, prime64_5, prime32_1, - } - - if hasAVX512 && l >= avx512Switch { - accumAVX512(&accs, p, key, u64(l)) - } else if hasAVX2 { - accumAVX2(&accs, p, key, u64(l)) - } else if hasSSE2 { - accumSSE(&accs, p, key, u64(l)) - } else { - accumScalar(&accs, p, key, u64(l)) - } - - // merge accs - acc += mulFold64(accs[0]^key64_011, accs[1]^key64_019) - acc += mulFold64(accs[2]^key64_027, accs[3]^key64_035) - acc += mulFold64(accs[4]^key64_043, accs[5]^key64_051) - acc += mulFold64(accs[6]^key64_059, accs[7]^key64_067) - - return xxh3Avalanche(acc) - } -} diff --git a/vendor/github.com/zeebo/xxh3/hash64_seed.go b/vendor/github.com/zeebo/xxh3/hash64_seed.go deleted file mode 100644 index 429994c..0000000 --- a/vendor/github.com/zeebo/xxh3/hash64_seed.go +++ /dev/null @@ -1,134 +0,0 @@ -package xxh3 - -import "math/bits" - -// HashSeed returns the hash of the byte slice with given seed. -func HashSeed(b []byte, seed uint64) uint64 { - return hashAnySeed(*(*str)(ptr(&b)), seed) - -} - -// HashStringSeed returns the hash of the string slice with given seed. -func HashStringSeed(s string, seed uint64) uint64 { - return hashAnySeed(*(*str)(ptr(&s)), seed) -} - -func hashAnySeed(s str, seed uint64) (acc u64) { - p, l := s.p, s.l - - switch { - case l <= 16: - switch { - case l > 8: - inputlo := readU64(p, 0) ^ (key64_024 ^ key64_032 + seed) - inputhi := readU64(p, ui(l)-8) ^ (key64_040 ^ key64_048 - seed) - folded := mulFold64(inputlo, inputhi) - return xxh3Avalanche(u64(l) + bits.ReverseBytes64(inputlo) + inputhi + folded) - - case l > 3: - seed ^= u64(bits.ReverseBytes32(u32(seed))) << 32 - input1 := readU32(p, 0) - input2 := readU32(p, ui(l)-4) - input64 := u64(input2) + u64(input1)<<32 - keyed := input64 ^ (key64_008 ^ key64_016 - seed) - return rrmxmx(keyed, u64(l)) - - case l == 3: // 3 - c12 := u64(readU16(p, 0)) - c3 := u64(readU8(p, 2)) - acc = c12<<16 + c3 + 3<<8 - - case l > 1: // 2 - c12 := u64(readU16(p, 0)) - acc = c12*(1<<24+1)>>8 + 2<<8 - - case l == 1: // 1 - c1 := u64(readU8(p, 0)) - acc = c1*(1<<24+1<<16+1) + 1<<8 - - default: - return xxhAvalancheSmall(seed ^ key64_056 ^ key64_064) - } - - acc ^= u64(key32_000^key32_004) + seed - return xxhAvalancheSmall(acc) - - case l <= 128: - acc = u64(l) * prime64_1 - - if l > 32 { - if l > 64 { - if l > 96 { - acc += mulFold64(readU64(p, 6*8)^(key64_096+seed), readU64(p, 7*8)^(key64_104-seed)) - acc += mulFold64(readU64(p, ui(l)-8*8)^(key64_112+seed), readU64(p, ui(l)-7*8)^(key64_120-seed)) - } // 96 - acc += mulFold64(readU64(p, 4*8)^(key64_064+seed), readU64(p, 5*8)^(key64_072-seed)) - acc += mulFold64(readU64(p, ui(l)-6*8)^(key64_080+seed), readU64(p, ui(l)-5*8)^(key64_088-seed)) - } // 64 - acc += mulFold64(readU64(p, 2*8)^(key64_032+seed), readU64(p, 3*8)^(key64_040-seed)) - acc += mulFold64(readU64(p, ui(l)-4*8)^(key64_048+seed), readU64(p, ui(l)-3*8)^(key64_056-seed)) - } // 32 - acc += mulFold64(readU64(p, 0*8)^(key64_000+seed), readU64(p, 1*8)^(key64_008-seed)) - acc += mulFold64(readU64(p, ui(l)-2*8)^(key64_016+seed), readU64(p, ui(l)-1*8)^(key64_024-seed)) - - return xxh3Avalanche(acc) - - case l <= 240: - acc = u64(l) * prime64_1 - - acc += mulFold64(readU64(p, 0*16+0)^(key64_000+seed), readU64(p, 0*16+8)^(key64_008-seed)) - acc += mulFold64(readU64(p, 1*16+0)^(key64_016+seed), readU64(p, 1*16+8)^(key64_024-seed)) - acc += mulFold64(readU64(p, 2*16+0)^(key64_032+seed), readU64(p, 2*16+8)^(key64_040-seed)) - acc += mulFold64(readU64(p, 3*16+0)^(key64_048+seed), readU64(p, 3*16+8)^(key64_056-seed)) - acc += mulFold64(readU64(p, 4*16+0)^(key64_064+seed), readU64(p, 4*16+8)^(key64_072-seed)) - acc += mulFold64(readU64(p, 5*16+0)^(key64_080+seed), readU64(p, 5*16+8)^(key64_088-seed)) - acc += mulFold64(readU64(p, 6*16+0)^(key64_096+seed), readU64(p, 6*16+8)^(key64_104-seed)) - acc += mulFold64(readU64(p, 7*16+0)^(key64_112+seed), readU64(p, 7*16+8)^(key64_120-seed)) - - // avalanche - acc = xxh3Avalanche(acc) - - // trailing groups after 128 - top := ui(l) &^ 15 - for i := ui(8 * 16); i < top; i += 16 { - acc += mulFold64(readU64(p, i+0)^(readU64(key, i-125)+seed), readU64(p, i+8)^(readU64(key, i-117)-seed)) - } - - // last 16 bytes - acc += mulFold64(readU64(p, ui(l)-16)^(key64_119+seed), readU64(p, ui(l)-8)^(key64_127-seed)) - - return xxh3Avalanche(acc) - - default: - acc = u64(l) * prime64_1 - - secret := key - if seed != 0 { - secret = ptr(&[secretSize]byte{}) - initSecret(secret, seed) - } - - accs := [8]u64{ - prime32_3, prime64_1, prime64_2, prime64_3, - prime64_4, prime32_2, prime64_5, prime32_1, - } - - if hasAVX512 && l >= avx512Switch { - accumAVX512(&accs, p, secret, u64(l)) - } else if hasAVX2 { - accumAVX2(&accs, p, secret, u64(l)) - } else if hasSSE2 { - accumSSE(&accs, p, secret, u64(l)) - } else { - accumScalarSeed(&accs, p, secret, u64(l)) - } - - // merge accs - acc += mulFold64(accs[0]^readU64(secret, 11), accs[1]^readU64(secret, 19)) - acc += mulFold64(accs[2]^readU64(secret, 27), accs[3]^readU64(secret, 35)) - acc += mulFold64(accs[4]^readU64(secret, 43), accs[5]^readU64(secret, 51)) - acc += mulFold64(accs[6]^readU64(secret, 59), accs[7]^readU64(secret, 67)) - - return xxh3Avalanche(acc) - } -} diff --git a/vendor/github.com/zeebo/xxh3/hasher.go b/vendor/github.com/zeebo/xxh3/hasher.go deleted file mode 100644 index d978998..0000000 --- a/vendor/github.com/zeebo/xxh3/hasher.go +++ /dev/null @@ -1,239 +0,0 @@ -package xxh3 - -import ( - "encoding/binary" - "hash" -) - -// Hasher implements the hash.Hash interface -type Hasher struct { - acc [8]u64 - blk u64 - len u64 - key ptr - buf [_block + _stripe]byte - seed u64 -} - -var ( - _ hash.Hash = (*Hasher)(nil) - _ hash.Hash64 = (*Hasher)(nil) -) - -// New returns a new Hasher that implements the hash.Hash interface. -func New() *Hasher { - return new(Hasher) -} - -// NewSeed returns a new Hasher that implements the hash.Hash interface. -func NewSeed(seed uint64) *Hasher { - var h Hasher - h.Reset() - h.seed = seed - h.key = key - - // Only initiate once, not on reset. - if seed != 0 { - h.key = ptr(&[secretSize]byte{}) - initSecret(h.key, seed) - } - return &h -} - -// Reset resets the Hash to its initial state. -func (h *Hasher) Reset() { - h.acc = [8]u64{ - prime32_3, prime64_1, prime64_2, prime64_3, - prime64_4, prime32_2, prime64_5, prime32_1, - } - h.blk = 0 - h.len = 0 -} - -// BlockSize returns the hash's underlying block size. -// The Write method will accept any amount of data, but -// it may operate more efficiently if all writes are a -// multiple of the block size. -func (h *Hasher) BlockSize() int { return _stripe } - -// Size returns the number of bytes Sum will return. -func (h *Hasher) Size() int { return 8 } - -// Sum appends the current hash to b and returns the resulting slice. -// It does not change the underlying hash state. -func (h *Hasher) Sum(b []byte) []byte { - var tmp [8]byte - binary.BigEndian.PutUint64(tmp[:], h.Sum64()) - return append(b, tmp[:]...) -} - -// Write adds more data to the running hash. -// It never returns an error. -func (h *Hasher) Write(buf []byte) (int, error) { - h.update(buf) - return len(buf), nil -} - -// WriteString adds more data to the running hash. -// It never returns an error. -func (h *Hasher) WriteString(buf string) (int, error) { - h.updateString(buf) - return len(buf), nil -} - -func (h *Hasher) update(buf []byte) { - // relies on the data pointer being the first word in the string header - h.updateString(*(*string)(ptr(&buf))) -} - -func (h *Hasher) updateString(buf string) { - if h.key == nil { - h.key = key - h.Reset() - } - - // On first write, if more than 1 block, process without copy. - for h.len == 0 && len(buf) > len(h.buf) { - if hasAVX2 { - accumBlockAVX2(&h.acc, *(*ptr)(ptr(&buf)), h.key) - } else if hasSSE2 { - accumBlockSSE(&h.acc, *(*ptr)(ptr(&buf)), h.key) - } else { - accumBlockScalar(&h.acc, *(*ptr)(ptr(&buf)), h.key) - } - buf = buf[_block:] - h.blk++ - } - - for len(buf) > 0 { - if h.len < u64(len(h.buf)) { - n := copy(h.buf[h.len:], buf) - h.len += u64(n) - buf = buf[n:] - continue - } - - if hasAVX2 { - accumBlockAVX2(&h.acc, ptr(&h.buf), h.key) - } else if hasSSE2 { - accumBlockSSE(&h.acc, ptr(&h.buf), h.key) - } else { - accumBlockScalar(&h.acc, ptr(&h.buf), h.key) - } - - h.blk++ - h.len = _stripe - copy(h.buf[:_stripe], h.buf[_block:]) - } -} - -// Sum64 returns the 64-bit hash of the written data. -func (h *Hasher) Sum64() uint64 { - if h.key == nil { - h.key = key - h.Reset() - } - - if h.blk == 0 { - if h.seed == 0 { - return Hash(h.buf[:h.len]) - } - return HashSeed(h.buf[:h.len], h.seed) - } - - l := h.blk*_block + h.len - acc := l * prime64_1 - accs := h.acc - - if h.len > 0 { - // We are only ever doing 1 block here, so no avx512. - if hasAVX2 { - accumAVX2(&accs, ptr(&h.buf[0]), h.key, h.len) - } else if hasSSE2 { - accumSSE(&accs, ptr(&h.buf[0]), h.key, h.len) - } else { - accumScalar(&accs, ptr(&h.buf[0]), h.key, h.len) - } - } - - if h.seed == 0 { - acc += mulFold64(accs[0]^key64_011, accs[1]^key64_019) - acc += mulFold64(accs[2]^key64_027, accs[3]^key64_035) - acc += mulFold64(accs[4]^key64_043, accs[5]^key64_051) - acc += mulFold64(accs[6]^key64_059, accs[7]^key64_067) - } else { - secret := h.key - acc += mulFold64(accs[0]^readU64(secret, 11), accs[1]^readU64(secret, 19)) - acc += mulFold64(accs[2]^readU64(secret, 27), accs[3]^readU64(secret, 35)) - acc += mulFold64(accs[4]^readU64(secret, 43), accs[5]^readU64(secret, 51)) - acc += mulFold64(accs[6]^readU64(secret, 59), accs[7]^readU64(secret, 67)) - } - - acc = xxh3Avalanche(acc) - - return acc -} - -// Sum128 returns the 128-bit hash of the written data. -func (h *Hasher) Sum128() Uint128 { - if h.key == nil { - h.key = key - h.Reset() - } - - if h.blk == 0 { - if h.seed == 0 { - return Hash128(h.buf[:h.len]) - } - return Hash128Seed(h.buf[:h.len], h.seed) - } - - l := h.blk*_block + h.len - acc := Uint128{Lo: l * prime64_1, Hi: ^(l * prime64_2)} - accs := h.acc - - if h.len > 0 { - // We are only ever doing 1 block here, so no avx512. - if hasAVX2 { - accumAVX2(&accs, ptr(&h.buf[0]), h.key, h.len) - } else if hasSSE2 { - accumSSE(&accs, ptr(&h.buf[0]), h.key, h.len) - } else { - accumScalar(&accs, ptr(&h.buf[0]), h.key, h.len) - } - } - - if h.seed == 0 { - acc.Lo += mulFold64(accs[0]^key64_011, accs[1]^key64_019) - acc.Hi += mulFold64(accs[0]^key64_117, accs[1]^key64_125) - - acc.Lo += mulFold64(accs[2]^key64_027, accs[3]^key64_035) - acc.Hi += mulFold64(accs[2]^key64_133, accs[3]^key64_141) - - acc.Lo += mulFold64(accs[4]^key64_043, accs[5]^key64_051) - acc.Hi += mulFold64(accs[4]^key64_149, accs[5]^key64_157) - - acc.Lo += mulFold64(accs[6]^key64_059, accs[7]^key64_067) - acc.Hi += mulFold64(accs[6]^key64_165, accs[7]^key64_173) - } else { - secret := h.key - const hi_off = 117 - 11 - - acc.Lo += mulFold64(accs[0]^readU64(secret, 11), accs[1]^readU64(secret, 19)) - acc.Hi += mulFold64(accs[0]^readU64(secret, 11+hi_off), accs[1]^readU64(secret, 19+hi_off)) - - acc.Lo += mulFold64(accs[2]^readU64(secret, 27), accs[3]^readU64(secret, 35)) - acc.Hi += mulFold64(accs[2]^readU64(secret, 27+hi_off), accs[3]^readU64(secret, 35+hi_off)) - - acc.Lo += mulFold64(accs[4]^readU64(secret, 43), accs[5]^readU64(secret, 51)) - acc.Hi += mulFold64(accs[4]^readU64(secret, 43+hi_off), accs[5]^readU64(secret, 51+hi_off)) - - acc.Lo += mulFold64(accs[6]^readU64(secret, 59), accs[7]^readU64(secret, 67)) - acc.Hi += mulFold64(accs[6]^readU64(secret, 59+hi_off), accs[7]^readU64(secret, 67+hi_off)) - } - - acc.Lo = xxh3Avalanche(acc.Lo) - acc.Hi = xxh3Avalanche(acc.Hi) - - return acc -} diff --git a/vendor/github.com/zeebo/xxh3/utils.go b/vendor/github.com/zeebo/xxh3/utils.go deleted file mode 100644 index a837e68..0000000 --- a/vendor/github.com/zeebo/xxh3/utils.go +++ /dev/null @@ -1,129 +0,0 @@ -package xxh3 - -import ( - "math/bits" - "unsafe" -) - -// Uint128 is a 128 bit value. -// The actual value can be thought of as u.Hi<<64 | u.Lo. -type Uint128 struct { - Hi, Lo uint64 -} - -// Bytes returns the uint128 as an array of bytes in canonical form (big-endian encoded). -func (u Uint128) Bytes() [16]byte { - return [16]byte{ - byte(u.Hi >> 0x38), byte(u.Hi >> 0x30), byte(u.Hi >> 0x28), byte(u.Hi >> 0x20), - byte(u.Hi >> 0x18), byte(u.Hi >> 0x10), byte(u.Hi >> 0x08), byte(u.Hi), - byte(u.Lo >> 0x38), byte(u.Lo >> 0x30), byte(u.Lo >> 0x28), byte(u.Lo >> 0x20), - byte(u.Lo >> 0x18), byte(u.Lo >> 0x10), byte(u.Lo >> 0x08), byte(u.Lo), - } -} - -type ( - ptr = unsafe.Pointer - ui = uintptr - - u8 = uint8 - u32 = uint32 - u64 = uint64 - u128 = Uint128 -) - -type str struct { - p ptr - l uint -} - -func readU8(p ptr, o ui) uint8 { - return *(*uint8)(ptr(ui(p) + o)) -} - -func readU16(p ptr, o ui) uint16 { - b := (*[2]byte)(ptr(ui(p) + o)) - return uint16(b[0]) | uint16(b[1])<<8 -} - -func readU32(p ptr, o ui) uint32 { - b := (*[4]byte)(ptr(ui(p) + o)) - return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 -} - -func readU64(p ptr, o ui) uint64 { - b := (*[8]byte)(ptr(ui(p) + o)) - return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | - uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 -} - -func writeU64(p ptr, o ui, v u64) { - b := (*[8]byte)(ptr(ui(p) + o)) - b[0] = byte(v) - b[1] = byte(v >> 8) - b[2] = byte(v >> 16) - b[3] = byte(v >> 24) - b[4] = byte(v >> 32) - b[5] = byte(v >> 40) - b[6] = byte(v >> 48) - b[7] = byte(v >> 56) -} - -const secretSize = 192 - -func initSecret(secret ptr, seed u64) { - for i := ui(0); i < secretSize/16; i++ { - lo := readU64(key, 16*i) + seed - hi := readU64(key, 16*i+8) - seed - writeU64(secret, 16*i, lo) - writeU64(secret, 16*i+8, hi) - } -} - -func xxh64AvalancheSmall(x u64) u64 { - // x ^= x >> 33 // x must be < 32 bits - // x ^= u64(key32_000 ^ key32_004) // caller must do this - x *= prime64_2 - x ^= x >> 29 - x *= prime64_3 - x ^= x >> 32 - return x -} - -func xxhAvalancheSmall(x u64) u64 { - x ^= x >> 33 - x *= prime64_2 - x ^= x >> 29 - x *= prime64_3 - x ^= x >> 32 - return x -} - -func xxh64AvalancheFull(x u64) u64 { - x ^= x >> 33 - x *= prime64_2 - x ^= x >> 29 - x *= prime64_3 - x ^= x >> 32 - return x -} - -func xxh3Avalanche(x u64) u64 { - x ^= x >> 37 - x *= 0x165667919e3779f9 - x ^= x >> 32 - return x -} - -func rrmxmx(h64 u64, len u64) u64 { - h64 ^= bits.RotateLeft64(h64, 49) ^ bits.RotateLeft64(h64, 24) - h64 *= 0x9fb21c651e98df25 - h64 ^= (h64 >> 35) + len - h64 *= 0x9fb21c651e98df25 - h64 ^= (h64 >> 28) - return h64 -} - -func mulFold64(x, y u64) u64 { - hi, lo := bits.Mul64(x, y) - return hi ^ lo -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 74c347a..f9e3d35 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -55,11 +55,6 @@ github.com/Microsoft/go-winio/internal/fs github.com/Microsoft/go-winio/internal/socket github.com/Microsoft/go-winio/internal/stringbuffer github.com/Microsoft/go-winio/pkg/guid -# github.com/a-h/templ v0.3.943 -## explicit; go 1.23.0 -github.com/a-h/templ -github.com/a-h/templ/runtime -github.com/a-h/templ/safehtml # github.com/aksdb/caddy-cgi/v2 v2.2.6 ## explicit; go 1.24.0 github.com/aksdb/caddy-cgi/v2 @@ -133,8 +128,6 @@ github.com/caddyserver/zerossl # github.com/ccoveille/go-safecast v1.6.1 ## explicit; go 1.21 github.com/ccoveille/go-safecast -# github.com/cenkalti/backoff/v4 v4.3.0 -## explicit; go 1.18 # github.com/cenkalti/backoff/v5 v5.0.3 ## explicit; go 1.23 github.com/cenkalti/backoff/v5 @@ -204,9 +197,6 @@ github.com/dlclark/regexp2/syntax # github.com/dustin/go-humanize v1.0.1 ## explicit; go 1.16 github.com/dustin/go-humanize -# github.com/elastic/go-freelru v0.16.0 -## explicit; go 1.18 -github.com/elastic/go-freelru # github.com/felixge/httpsnoop v1.0.4 ## explicit; go 1.13 github.com/felixge/httpsnoop @@ -241,11 +231,6 @@ github.com/go-logr/stdr # github.com/go-sql-driver/mysql v1.9.3 ## explicit; go 1.21.0 github.com/go-sql-driver/mysql -# github.com/go-task/slim-sprig/v3 v3.0.0 -## explicit; go 1.20 -# github.com/golang-jwt/jwt/v5 v5.3.0 -## explicit; go 1.21 -github.com/golang-jwt/jwt/v5 # github.com/golang/protobuf v1.5.4 ## explicit; go 1.17 github.com/golang/protobuf/proto @@ -296,8 +281,6 @@ github.com/google/go-tspi/attestation github.com/google/go-tspi/tspi github.com/google/go-tspi/tspiconst github.com/google/go-tspi/verification -# github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 -## explicit; go 1.24.0 # github.com/google/s2a-go v0.1.9 ## explicit; go 1.20 github.com/google/s2a-go @@ -348,13 +331,6 @@ github.com/huandu/xstrings # github.com/inconshreveable/mousetrap v1.1.0 ## explicit; go 1.18 github.com/inconshreveable/mousetrap -# github.com/invopop/ctxi18n v0.9.0 -## explicit; go 1.21 -github.com/invopop/ctxi18n -github.com/invopop/ctxi18n/i18n -# github.com/invopop/yaml v0.3.1 -## explicit; go 1.14 -github.com/invopop/yaml # github.com/jackc/pgpassfile v1.0.0 ## explicit; go 1.12 github.com/jackc/pgpassfile @@ -430,8 +406,6 @@ github.com/mitchellh/reflectwalk # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/onsi/ginkgo/v2 v2.25.1 -## explicit; go 1.23.0 # github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 ## explicit; go 1.16 github.com/pbnjay/memory @@ -498,15 +472,6 @@ github.com/shurcooL/sanitized_anchor_name # github.com/sirupsen/logrus v1.9.3 ## explicit; go 1.13 github.com/sirupsen/logrus -# github.com/sjtug/cerberus v0.4.3 -## explicit; go 1.24 -github.com/sjtug/cerberus -github.com/sjtug/cerberus/core -github.com/sjtug/cerberus/directives -github.com/sjtug/cerberus/internal/expiremap -github.com/sjtug/cerberus/internal/ipblock -github.com/sjtug/cerberus/internal/randpool -github.com/sjtug/cerberus/web # github.com/slackhq/nebula v1.9.6 ## explicit; go 1.22.0 github.com/slackhq/nebula/cert @@ -622,6 +587,8 @@ github.com/yuin/goldmark/util # github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc ## explicit; go 1.13 github.com/yuin/goldmark-highlighting/v2 +# github.com/zeebo/assert v1.3.0 +## explicit; go 1.13 # github.com/zeebo/blake3 v0.2.4 ## explicit; go 1.18 github.com/zeebo/blake3 @@ -634,9 +601,6 @@ github.com/zeebo/blake3/internal/alg/hash/hash_avx2 github.com/zeebo/blake3/internal/alg/hash/hash_pure github.com/zeebo/blake3/internal/consts github.com/zeebo/blake3/internal/utils -# github.com/zeebo/xxh3 v1.0.2 -## explicit; go 1.17 -github.com/zeebo/xxh3 # go.etcd.io/bbolt v1.4.3 ## explicit; go 1.23 go.etcd.io/bbolt |
